From 3e823c72d03ce3acb2ca816fe38c8ea8feb4e77d Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 09 2020 09:10:38 +0000 Subject: cdrdao-1.2.3 base --- diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..9cb0f0e --- /dev/null +++ b/AUTHORS @@ -0,0 +1,10 @@ +Andreas Mueller : +- project founder, initial implementation of cdrdao + (no longer an active developer) + +Manuel Clos +- author of gcdmaster GUI front-end + +Denis Leroy +- project maintenance, Gtk2 port of gcdmaster + diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..a43ea21 --- /dev/null +++ b/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, 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 + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) 19yy + + This program 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. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/CREDITS b/CREDITS new file mode 100644 index 0000000..b2bc54d --- /dev/null +++ b/CREDITS @@ -0,0 +1,48 @@ +To: Heiko Eissfeldt +For: Data sector L-EC encoding library 'libedc_ecc'. + +To: Yasuhito Futatsuki +For: Maintaining the FreeBSD port. + +To: Max Khon +For: Direct SCSI interface implementation for FreeBSD. + +To: Cameron G. MacKinnon +For: Implementation of the yamaha-cdr10x driver. + +To: Monty +For: cdda_paranoia library for high quality DAE. + +To: Piergiorgio Sartor +For: SCSI manual for the Sony CDU948 recorder. + Implementation of sub-channel scanning for catalog number. + +To: Joerg Schilling +For: Portable SCSI interface library 'libscg'. + +To: Henk-Jan Slotboom +For: Implementation of the taiyo-yuden driver. + +To: Michael Weber +For: First implementation of on-the-fly writing. + +To: Leon Woestenberg +For: Bitwise correct audio extraction with Plextor drives. + +To: Jos� Carlos Garc�a Sogo +For: The --keepimage option. + +To: ITOH Yasufumi and Martin Buck +For: BURN Proof support + +To: Michael Reinelt +For: Help screen rework and multi session improvements + +To: Giuseppe "Cowo" Corbelli +For: Support for Plextor specific options in plextor driver. + +To: Matthias Czapla +For: The cue2toc utility + +To: Joe Drew +For: mpg321 code used in MP3 decoder diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..cbb6b43 --- /dev/null +++ b/ChangeLog @@ -0,0 +1,598 @@ +-------------------------------------------------------------------------- + cdrdao 1.2.3 (2009-10-05) +-------------------------------------------------------------------------- + + o By default, cdrdao tries to build with a native SCSI interface. Use + "--with-libscg" to use bundled libscg library. (Denis Leroy) + + o Complete rewrite of native Linux SG driver for SG 3.0 using SG_IO + ioctl. That should make it behave better with ConsoleKit based + permissions environment. Cdrdao should now be compiled on Linux + without cdrtools by using "--without-scglib". (Denis Leroy) + + o Added support for new FIRST_TRACK_NO keyword to allow a CD to start + with a track number other than 1. (Edgar Fuss) + + o Added native interfaces for Irix, Mac OSX and NetBSD. (Edgar Fuss) + + o Fixed old pregap length off-by-one error, see bug #604751 + (Thomas Vander Stichele) + + o Fixed bug in Toc file parser track length computation. (Denis Leroy) + + o Man page typo fixes. (Denis Leroy) + + o Cygwin compilation fixes. Other various compilation warning + fixes. (Denis Leroy) + + o Some scsilib fixes for FreeBSD, 32-bit and 64-bit SPARC. (Marius + Strobl) + + o Some makefile changes to avoid conflict with installed system libs. + (Marius Strobl) + + o Added patch to fix ARM and MIPS scsilib compile (Kedar Sovani, Debian) + + o Added man pages for toc2cue and toc2cddb, from Debian. + + o Move privilege drop earlier in main flow (based on Debian patch) + + o Commited Gentoo patch for CD-TEXT track check fix (Grant, Peter Alfredsen) + +GCDMaster changes: + + o Preferences now stored in GConf, exports schema file (Denis Leroy) + + o Added simple Preferences dialog to change temporary file directory + (Denis Leroy) + + o Fixed GCC 4.3 compilation issues (Denis Leroy) + +-------------------------------------------------------------------------- + cdrdao 1.2.2 (2006-09-20) +-------------------------------------------------------------------------- + + o Added device locking for win32 (Giuseppe Corbelli) + + o Man page cleanup (Andrew Suffield) + +GCDMaster changes: + + o Fixed GCC 4.1 compilation issues + + o Fixed hang when inserting WAV file + + +-------------------------------------------------------------------------- + cdrdao 1.2.1 (2005-10-28) +-------------------------------------------------------------------------- + + o Fixed bad bug with missing return statemements in recomputeLength + and format conversion. + + o Fixed broken '-' STDIN input feature. + + o Fixed various gcc4-related compile problems. + + o Fixed copy problem with single device when read_device is + specified. + + o Added autodetect of cdrtools header files in configure + + o Minor fixes to driver table. + + o pccts build is now better integrated with automake/autoconf. + + o Added FreeBSD 7 support to configure.ac. Fixed libao dependency. + +GCDMaster changes: + + o The crash when creating a new "Create Audio CD" view seemed to be + related to gtkmm and libsigc++ and went away with newer releases of + those packages. + +toc2cue changes: + + o toc2cue: fixed bug that was causing empty output files. + + o Added conversion of COPY to DCP flags. (Julio Sanchez Fernandez) + + +-------------------------------------------------------------------------- + cdrdao 1.2.0 (2005-05-12) +-------------------------------------------------------------------------- + + o SECURITY FIX: cdrdao now gives up its root privileges after setting + up real-time scheduling, as well as before saving settings through + the --save option. This fixes a potential local root exploit when + cdrdao is installed with the +s chmod flag. Using --save now also + forces an early exit after the settings are saved. + + o Added MP3 and Ogg Vorbis file support (through respectively the + libmad and libvorbis libraries). cdrdao will decode the MP3 and + Ogg files into temporary WAV files that will be deleted upon exit + (unless the new option --keep is used). The directory used to + store those temporary WAV files can be specified with the --tmpdir + option (default is /tmp). + + o Improved native CUE file support: replaced old incomplete existing + parser with the one from Matthias Czapla's excellent + cue2toc. Added support for cutting binary files. + + o Added --rspeed option to manually set the device reading speed. Be + warned not all devices support this. + + o Packaged scsilib library upgraded from cdrtools 2.01 (previously + was from 2.01a31). + + o Added --no-mode2-mixed option. Don't read a MODE2 disk as + MODE2_FORM_MIXED, only read MODE2_FORM1 or MODE2_FORM2 (Matthieu + Castet). + + o Added help for little-known drive-info command. + +GCDMaster changes: + + o MP3 and Ogg Vorbis support: you can drag and drop .mp3, .m3u and + .ogg files from Nautilus into the sample display window. + + o Switched to gtkmm24 API. Improved file browsers. + + o CUE files support. + + o Sound output now uses libao library. + + o Added 'Select All' item in menu. + + o Added 'Eject' button to progress dialog + + o Bug fixes (sample selection weirdness, couldn't close window during + play, problems with gcdmaster command-line argument, crashes with + multiple project windows, drive status not reported correctly). + +-------------------------------------------------------------------------- + cdrdao 1.1.9 (2004-06-07) +-------------------------------------------------------------------------- + + o MMC-driver auto-detection. If no --driver option is specified, + cdrdao will try to autodetect an MMC-compliant device and use the + generic-mmc driver by default. (Denis Leroy) + + o Included scsilib upgraded from cdrtools 2.01a31 (Denis Leroy) + + o Added --eject option to the unlock command to eject the cd after + unlocking. (Eric Benson) + + o New 'discid' command to display CDDB information. (Eric Benson, + Denis Leroy). + + o Fixed scsilib compiling problems with Linux kernel 2.6 (Jim Gifford) + + o Fixed compiling problems with gcc 3.4 (Jim Gifford, Denis Leroy) + + o Added --full-burn and --capacity options to extend lead-out to entire disc, + beyond 80 mins limit. (Vladimir Petrov) + + +GCDMaster changes (Denis Leroy): + + o Device configuration dialog now scans for devices on both ATA and + ATAPI interfaces. + + o Some bug fixes (manual driver configurations were not being saved + correctly). + +cue2toc changes: + + o Version 0.2 released. Complete rewrite, should now handle most of all + CUE files. (Matthias Czapla) + +-------------------------------------------------------------------------- + cdrdao 1.1.8 (2004-02-12) +-------------------------------------------------------------------------- + + o We have not heard from project founder and maintainer Andreas + Mueller for a long time and do not know what his intentions are + regarding cdrdao. Due to recent contributions to the project, we + have decided to nonetheless continue development and to keep + working towards future releases. Manuel Clos is now acting as + project maintainer. We hope to hear from Andreas soon. + + o The latest state of the CVS tree before the merge with the + Gnome2/Gtk2 branch has been tagged as 'Andreas_1_1_7'. + + o Improved performance of the new L-EC code by up to a factor 2 depending + on the hardware. + + o 'read-test' runs L-EC encoder over mode 1 or mode 2 form 1 sectors to + allow performance testing in conjunction with option --speed. + + o Fix for building on Mac OS X with gcc-3.1 (SF patch 611423). + + o Support for ATAPI drives: device is now specified as + [path:], such as '--device 0,0,0' or '--device + ATAPI:0,1,0'. If you run Linux 2.6, you can also use the latest + /dev/hd* interface with '--device ATA:0,0,0' (Denis Leroy) + +GCDMaster changes (Denis Leroy): + + o gcdmaster was ported to Gnome2/Gtk+2 using the new C++ Gtk2 bindings + (gtkmm2 and gnomeuimm2). + + o ATAPI drives support: gcdmaster will also scan for ATAPI + devices. Devices are now specified as a '[path:]x,y,z' string. + + o The samples selection can now be cleared (i.e. unselected) by + single-clicking the Audio view during Select mode (not in Zoom + mode). + + o You can now select multiple files from the file selector when + appending or inserting tracks/files from the main Audio Project menu. + + o Some features have been removed (temporarily): the multiple views + feature, the 'zoom to selection' icon. Also the progress dialog is + gone during import: progress is shown on the main status bar. + +mp32dao changes: + + o FLAC support. mp32dao now handles mp3/ogg/flac files. (Giuseppe Corbelli) + + o new: toc2cddb: translates a TOC file into a cddb file. (Giuseppe Corbelli) + + o new: cue2toc: convert CUE to TOC format for audio CDs. (Matthias Czapla) + +-------------------------------------------------------------------------- + cdrdao 1.1.7 (2002-10-06) +-------------------------------------------------------------------------- + + o Fixed crash in toc-file reader (only occurred for a certain type of + syntactical error). + + o Fixed compilation problems of "toc2mp3.cc" with pre gcc-3.x compilers. + + o Updated driver table. + +-------------------------------------------------------------------------- + cdrdao 1.1.6 (2002-09-16) +-------------------------------------------------------------------------- + + o Fixed cue sheet setup for CD-TEXT writing. Some older drives did not like + the cue sheet format as specified in the latest SCSI-3/mmc + specification. + + o Added sub-channel writing for the 'generic-mmc' and + 'generic-mmc-raw' driver. Currently only the R-W sub-channels can + be written. The track image files may contain packed or raw R-W + sub-channel data. For packed sub-channel data the L-EC data will be + calculated and interleaving will be performed if required by the + recording hardware. + + o Added sub-channel reading support for the generic-mmc(-raw) driver. + Currently packed and raw R-W sub-channel reading is supported + (option -read-subchan). + + o Added automatic check for support sub-channel reading modes to the + 'generic-mmc(-raw)' driver. The driver options (0x1, 0x2 and 0x20) + should be obsolete now, but are still available. + + o The data track extraction with the generic-mmc(-raw) driver is more + robust against read errors now. The + --tao-source/--tao-source-adjust option should be obsolete now - + but is still available. + + o Added on-the-fly copying support for the Win32 version. + + o Default blanking mode is now 'minimal' (SF feature request 425321) + + o Updated paranoia libraries to version of cdparanoia-III-alpha9.8. + + o Fixed waiting loop that was used to wait until the lead-out was written + and until a blanking operation is finished. Some drives do not + indicate this activities with a "not ready" status. Affected + drivers: generic-mmc and generic-mmc-raw (blanking only). + + o Fixed crash in cdrdao usage printing (SF bug 570156). + + o Fixed cue sheet setup for ISRC codes for the HP8100 recorder model. + + o Added/fixed SF patches 427753, 450058 and 534214. + + o New mp32dao version from Giuseppe Corbelli with these new features: + - Ogg support + - MP3/Ogg decoding supported only with external programs + - Code modularization and bugfixes + - cdrecord's .inf file support for CD-TEXT data + + o Cue parser accepts spaces and '\' characters in file name now. + + o The PCCTS package is now a part of the cdrdao source code distribution + which should avoid some compilation hassle. + + o Updated scsilib version. + + o Added patches for compilation under Unixware (incl. patches for scsilib). + + o Created new utility 'toc2mp3' that converts an audio CD image to a set + of mp3 files using the LAME encoder. The encoded mp3 files have no + gap at the end so that they play in sequence without noise at the + transition points. + + +GCDMaster changes: + + o Gcdmaster hotkeys are now back. (SourceForge bug 470864). + + o Gcdmaster can now copy cds with just one drive, thanks to Das Poelzi for + the patch. (SourceForge bug 566948). + + o Added switch to enable the overburn mode to the recording options box. + + o Added selection of the sub-channel reading mode the CD extraction options + box. + + o Fixed the 'Cancel' button staying disabled in the Recording/Reading progress + window. + +-------------------------------------------------------------------------- + cdrdao 1.1.5 (2001-04-29) +-------------------------------------------------------------------------- + + o Fixed bug in CD-TEXT writing code that caused the problems with the + unreliable read back of the written CD-TEXT data + + o Added CD-TEXT writing capability to the 'generic-mmc-raw' driver; the + recorder must support the 96 byte raw P-W sub-channel writing mode to + make use of it + + o Fixed bug in generic-mmc-raw driver: the TOC type was not written correctly + and some flags for data tracks were missing in the lead-in + + o Fixed handling of toc type for multi session CDs: the toc-type of + a session that just contains audio tracks is always CD_DA, even in multi + session mode + + o BURN Proof support added by ITOH Yasufumi/Martin Buck + + o Fixed bug in calculating the CDDB id (SourceForge bug 413467) + + o Added option --with-cddb to read CDDB data automatically with commands + 'copy', 'read-toc' and 'read-cd'; it is now possible to add CD-TEXT data + from CDDB while performing an on-the-fly copy + + o Updated to libscg-0.5 from cdrtools-1.10 + + o Handle drives that do not support the explicit power calibration command + + o Blanking of CD-RWs is now officially supported (command 'blank', + option --blank-mode) + + o Updated CD-R vendor table + + o Settings are now first read from "/etc/cdrdao.conf" and + "/etc/defaults/cdrdao" and then from "$HOME/.cdrdao" + + o Added command 'msinfo' to output multi session information suitable for + 'mkisofs' + + o Overburning is now prevented by default and must be explicitly requested + with option '--overburn'. Fix for Debian bug #79585 + (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=79585&repeatmerged=yes). + + o Fixed error in cdrdao's manual page (Debian bug #82816, + http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=82816&repeatmerged=yes) + + o cdrdao's help screen was reworked by Michael Reinelt + + o Added Giuseppe Corbelli's enhancements for the 'mp32dao' script + + o Makefiles now use make variable 'datadir' to specify the share directory + location + + o Fixed printing toc-file name with command 'copy --keepimage' + + +GCDMaster changes: + + o Added missing 'toshiba' driver to the device configuration dialog + (SourceForge bug 128633) + + o Removed the CD-TEXT table entry dialog from the 'Project Info' dialog; + it is now a non modal dialog on its own + + o Enhanced progress display for extracting and recording + + o Major rework of the infra structure to support multiple projects (toc-files) + and multiple views of a project + + o Gcdmaster starts with a project chooser now; this is the first step + to support different project types like data CD, mixed mode CD, + video CD etc. + +-------------------------------------------------------------------------- + cdrdao 1.1.4 (2000-08-27) +-------------------------------------------------------------------------- + + o Created new 'toshiba' driver for 'read-toc'/'read-cd' with Toshiba + CD-ROM drives. + + o Added full multi session support to the 'cdd2600' driver. + + o CD-TEXT is written without any copy protection flags now. + + o Added CDDB access to add title and artist data as CD-TEXT to an + existing toc-file. The direct cddbp and the http encapsulated protocol + is supported. + + o Added support to better handle disks written in track-at-once mode with + 'read-cd' and 'read-toc' (see options --tao-source and --tao-source-adjust). + + o Fixed bug that prevented recording of pure data CDs with the recent HP + and Sony recorder models in single session mode. + For multi session mode the restrictions mentioned in the README are + still valid. + + o Fixed 'unit not ready' problems after writing with the 'generic-mmc' + and 'generic-mmc-raw' driver. + + o Toc-files with tracks that are shorter than 4 seconds will be recorded + if option '--force' is given. + + o Some of the command line options are now saved to a settings file + "$HOME/.cdrdao" if option '--save' is given. + + o The driver database is now kept in an external file so it is possible + to update the database between the cdrdao releases. Actual driver + database files will be available from + + http://cdrdao.sourceforge.net/drives.html#dt + + o Added new option '--keepimage' which keeps the created image file after + the command 'copy' finishes. + + o Fixed bug in CD-TEXT reading code: CD-TEXT fields with empty strings were + only read for the first track. + + o Driver 'generic-mmc': If the power calibration fails the recording process + will be aborted now. + + o Driver 'generic-mmc-raw': Added explicit power calibration. + + +Xcdrdao changes: + + o Xcdrdao is now a Gnome application and will be called "Gnome CD Master" + (gcdmaster) in future. + + o Added table wise entry of CD-TEXT title/performer data. + + o Added a dialog to extract a CD to the hard disk. + + o Added a dialog to do CD to CD copy, with "on the fly" as an option. + + o Speed and record buffer are now selectable in the GUI. + + o When reading/duplicating a CD you can set the paranoia mode. + +-------------------------------------------------------------------------- + cdrdao 1.1.3 +-------------------------------------------------------------------------- + + o Data track writing is available with all drivers, especially the + 'ricoh-mp6200' and 'generic-mmc-raw' can write data tracks now. + + o Added DAE capability based on Monty's paranoia library to all drivers. + The 'plextor' driver will still use the special Plextor method for DAE + with Plextor drives but it is possible to force using the paranoia mode + with a driver option (see README). The paranoia mode can customized with + option '--paranoia-mode #'. Please read section 'Digital Audio Extraction' + of the README. + + o 'read-cd' creates now a complete image of a session. All tracks are written + to a single image file (comparable to a .bin file). Pre-gaps and index marks + of audio tracks are extracted while ripping the audio data so that a + 'read-toc' step is obsolete now. + It may choke on CDs written in TAO mode. + + o Experimental: Added a 'copy' command that performs all steps for copying a + CD session with a single or two drives. By default a temporary image file + is created in the current working directory. On the fly copying can be + selected with option '--on-the-fly' which avoids the temporary image file. + Copying of mixed mode CDs should be fine. + I expect problems with source CDs written in TAO mode but I did not make + any tests up to now. + On the fly copying is not available for the Win32 platform, yet. + Please read section 'Example for CD Copying' of the README. + + o 'read-cd' ignores sectors with L-EC errors now if option '--read-raw' is + given. The 'cdd2600', 'ricoh-mp6200' and 'generic-mmc-raw' driver will + recreate the erroneous sectors when recording. + + o Added full multi session support to the 'teac-cdr55' driver. + + o Added multiple language support for CD-TEXT. However, I have currently no + access to a CD-TEXT capable consumer CD-player so I am not sure if CD-TEXT + recording still works. Reading the written CD-TEXT data with a CD-ROM + drive gives the expected results. + + o ATAPI CD-ROM drives that were only working with the 'plextor' driver + should now be supported by the 'generic-mmc' driver with driver option 0x20 + (--driver generic-mmc:0x20). + + o A CD-R medium is automatically ejected now before writing to reset the disk + status after a simulation run which is necessary e.g. for the + Philips CDD2x00 recorder family. + + +Xcdrdao changes: + + o Added dialogs for entering meta data like UPC/EAN, ISRC code and CD-TEXT. + + o It is now possible to insert and remove samples at any place without + touching the audio files on the disk. + + o Added a dialog for configuration of all available CD-ROM/CD-R devices. + + o Recording can now be started from the GUI. Simultaneous recording with + multiple CD-recorders is possible if the hardware is suitable for it. + + o Created a man page. + +-------------------------------------------------------------------------- + cdrdao 1.1.2 +-------------------------------------------------------------------------- + + o Added support for bin/cue images. A cue file can be used now wherever a + toc-file is expected. The cue file must have exactly one FILE statement. + The bin file name is constructed from the cue file name by replacing + ".cue" with ".bin". Currently supported track modes: MODE1/2048, MODE1/2352, + MODE2/2336, MODE2/2352. The 'cdd2600' driver uses the L-EC data + contained in the MODEX/2352 track images when recording. All other drivers + will ignore and regenerate the L-EC data. + + o The 'generic-mmc' driver has full multi session support now. The start + address of the last and current session which must be used for the mkisofs + option '-C x,y' can be retrieved with 'disk-info'. + +s o The 'sony-cdu948' driver is included in the source package. + + o read-cd will create raw data track images (2352 byte sectors) if option + '--read-raw' is given. + +-------------------------------------------------------------------------- + cdrdao 1.1.0 +-------------------------------------------------------------------------- + + o Added data track support to 'generic-mmc' driver. + + o Added Henk-Jan Slotboom's driver for Taiyo-Yuden recorders. + + o Created driver for the Teac CD-R55S recorder. Data tracks should be + supported, too, but it is not well tested. + + o Added Cam MacKinnon's driver for the Yamaha CDR10x drive family. + Data track support is available, too, but also not well tested. + + o Added Leon Woestenberg's bitwise-exact digital audio extraction patch + for Plextor drives (see README.PlexDAE). + + o 'read-toc' will analyze mixed mode CDs now, but it is currently not + perfect. Please have a look at the README. + + o Fixed failed assertion problems with 'read-toc' that occured when + the raw P-W sub-channel data passed the CRC check but was actually + not consistent (happened quiet often with Teac CD-ROM CD-532S drives). + + o The SCSI interface can now use Joerg Schilling's SCSI library. Cdrdao is + reported to work on Solaris 2.6 and FreeBSD using the SCSI library. + Max Khon provided an independent SCSI interface implementation for FreeBSD + which can be selected when configuring. + + o Added experimental CD-TEXT support to 'read-toc'. + + o Updated xcdrdao source to compile with Gtk-- 0.99.1. + +Known Limitations: + + o 'read-toc' does not work for multi session CDs. + + o 'read-toc' does not work well for CDs written in TAO mode. diff --git a/INSTALL b/INSTALL new file mode 100644 index 0000000..feb34ae --- /dev/null +++ b/INSTALL @@ -0,0 +1,146 @@ +Installation: + + +If you fetched the source tree directly from CVS, you will first have +to run the autogen.sh script to unpack the scsilib and pccts libraries +and generate all the Makefiles. + + +1. CONFIGURE OPTIONS + +Type './configure' to run the configuration scripts. Use 'configure --help' for the list of available options, or see explanations below. + +1.1. LAME support + +The toc2mp3 utility requires the mp3lame library to encode its output +audio files into the MP3 format. The following options control the way +toc2mp3 is built: + + --without-lame Disable building of toc2mp3. + --with-lame-include Specifies the directory containing the lame + include directory. + --with-lame-lib Specifies the directory containing mp3lame + library. + --disable-lame-test Do not run a test program that checks for the + required mp3lame library version. It will be + assumed that the correct mp3lame library is + available. + +1.2. PCCTS support + +Cdrdao requires PCCTS at build time to generate its TOC file parser, +but because it depends on a specific older version of it (1.33), +cdrdao includes the PCCTS 1.33 source code in its source code +distribution and will build and use it by default. + +You can use the following options to use the PCCTS compiler and +libraries from an external source. We DO recommend however to use the +default version shipped with cdrdao as it works fine and has no known +bugs. + + --with-pcctsbin=dir Specifies directory that contains the PCCTS + executables (default: pccts/bin) + + --with-pcctsinc=dir Specifies directory that contains the PCCTS + header and source files + (default: pccts/h) + + +1.3. SCSI library options + +Cdrdao was written to take advantage of the scsi libraries that are +part of the cdrtools project (sometimes installed as the cdrecord and +cdrecord-devel packages with some distributions). Cdrdao can be +compiled in three different modes wrt to the cdrtools libraries : + +1.3.1. Using the provided cdrtools library + +Che cdrdao source distribution provides a subset of the cdrtools tree +in the scsilib directory. To select it, use : + + --with-scglib=pkg Use cdrtools tree provided in scsilib + directory + +1.3.2. Using an external cdrtools package. + +If you have the cdrtools development libraries installed on your +system, you can build cdrdoa against those rather than using the +scsilib directory. Note however that cdrdao requires specific header +files from cdrtools that are not installed by default. Currently, only +the RedHat/Fedora packaging of cdrtools (cdrecord-devel) provides the +sufficient headeres and libraries. + + --with-scglib=sys Use installed cdrtools headers. Try to + autodetect the location of libscg.a and + schily/schily.h. + +You can also explicitely set the location of those files with the +following options : + + --with-scglib-inc=dir Use SCSI library include files from specified + directory instead from the SCSI library that + comes with the cdrdao package. + + --with-scglib-lib=dir Specifies the directory that contains the SCSI + library. + +This is the recommended way of building cdrdao. You want to use the +available cdrtools package provided by your distribution rather than +the one packaged with the cdrdao source code, as distribution usually +include patches and fixes than you want cdrdao to benefit +from. Unfortunately, it is currently somewhat tricky to build cdrdao +straight from a manually compiled cdrtools package (because cdrtools +doesn't really export an 'official' API or devel-like package). + +1.3.3. Don't use cdrtools at all + +If cdrtools is not available for your operating system, you can still +build cdrdao using a simpler direct SCSI implementation provided by +cdrdao, and currently available for Linux and FreeBSD : + + + --without-scglib Use a direct SCSI implementation instead of + Joerg Schilling's SCSI library. This makes only + sense if the SCSI library does not compile for + some reason. Direct SCSI implementations are + currently available for Linux and FreeBSD. + + +1.4. GCDMaster option + +GCDMaster is written in C++ and therefore requires the Gnome/Gtk C++ +bindings to build (libsigc++, gtkmm and libgnomeuimm). The packages +are available from www.gnome.org and gtkmm.sourceforge.net. + + +GCDMaster has the following configuration options : + + --with-ogg-support Use the libogg and libvorbis libraries to add + Ogg Vorbis audio files support to GCDMaster. + + --with-mp3-support Use the libmad library to add MP3 files support + to GCDMAster. + + --without-xdao Disable build of gcdmaster completely. + + +1.5. Misc configuration options + + --with-linux-qnx-sched Enables Linux QNX real time scheduling. + This will only work if your kernel is compiled + with the QNX scheduler. + + --without-posix-threads Do not use posix threads for ring buffer even + if the system supports it. + + +2. BUILDING + +Type 'make' to compile the package. + + +3. INSTALLATION + +Type 'make install' as root to install the executables and the manual +pages under '/usr/local' or whatever was specified as the installation +prefix. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..6e4dc4d --- /dev/null +++ b/Makefile.am @@ -0,0 +1,45 @@ +if COND_XDAO +MAYBE_XDAO = xdao +else +MAYBE_XDAO = +endif + +if COND_SCSILIB +MAYBE_SCSILIB = scsilib +else +MAYBE_SCSILIB = +endif + +if COND_PCCTS +MAYBE_PCCTS = pccts +else +MAYBE_PCCTS = +endif + +SUBDIRS = $(MAYBE_SCSILIB) $(MAYBE_PCCTS) trackdb utils paranoia dao $(MAYBE_XDAO) + +DIST_SUBDIRS = trackdb utils paranoia dao xdao pccts + +EXTRA_DIST = \ + AUTHORS \ + ChangeLog \ + COPYING \ + CREDITS \ + INSTALL \ + NEWS \ + README \ + README.PlexDAE \ + README.Win32 \ + scsilib \ + specs/*.in \ + aspi.reg \ + cdrdao.lsm \ + testtocs/*.toc \ + contrib + +dist-hook: + rm -rf `find $(distdir)/contrib -name CVS` + + + + diff --git a/Makefile.in b/Makefile.in new file mode 100644 index 0000000..cebc174 --- /dev/null +++ b/Makefile.in @@ -0,0 +1,675 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = . +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/config.h.in \ + $(top_srcdir)/configure \ + $(top_srcdir)/specs/cdrdao.fedora.spec.in AUTHORS COPYING \ + ChangeLog INSTALL NEWS config.guess config.sub depcomp \ + install-sh missing mkinstalldirs +subdir = . +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno configure.status.lineno +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = config.h +CONFIG_CLEAN_FILES = specs/cdrdao.fedora.spec +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AO_CFLAGS = @AO_CFLAGS@ +AO_LIBS = @AO_LIBS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COND_MP3_FALSE = @COND_MP3_FALSE@ +COND_MP3_TRUE = @COND_MP3_TRUE@ +COND_OGG_FALSE = @COND_OGG_FALSE@ +COND_OGG_TRUE = @COND_OGG_TRUE@ +COND_PCCTS_FALSE = @COND_PCCTS_FALSE@ +COND_PCCTS_TRUE = @COND_PCCTS_TRUE@ +COND_SCSILIB_FALSE = @COND_SCSILIB_FALSE@ +COND_SCSILIB_TRUE = @COND_SCSILIB_TRUE@ +COND_TOC2MP3_FALSE = @COND_TOC2MP3_FALSE@ +COND_TOC2MP3_TRUE = @COND_TOC2MP3_TRUE@ +COND_XDAO_FALSE = @COND_XDAO_FALSE@ +COND_XDAO_TRUE = @COND_XDAO_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ +GTKMM2_CFLAGS = @GTKMM2_CFLAGS@ +GTKMM2_LIBS = @GTKMM2_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LAME_CFLAGS = @LAME_CFLAGS@ +LAME_LIBS = @LAME_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBGUIMM2_CFLAGS = @LIBGUIMM2_CFLAGS@ +LIBGUIMM2_LIBS = @LIBGUIMM2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAD_CFLAGS = @MAD_CFLAGS@ +MAD_LIBS = @MAD_LIBS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIGCPP2_CFLAGS = @SIGCPP2_CFLAGS@ +SIGCPP2_LIBS = @SIGCPP2_LIBS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +VORBISFILE_CFLAGS = @VORBISFILE_CFLAGS@ +VORBISFILE_LIBS = @VORBISFILE_LIBS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +antlr_path = @antlr_path@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +dao_src = @dao_src@ +datadir = @datadir@ +dlg_path = @dlg_path@ +en_cdrdao = @en_cdrdao@ +en_cue2toc = @en_cue2toc@ +en_toc2cue = @en_toc2cue@ +en_toc2mp3 = @en_toc2mp3@ +en_xdao = @en_xdao@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydefs = @mydefs@ +oldincludedir = @oldincludedir@ +pcctsinc = @pcctsinc@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +scsilib_dir = @scsilib_dir@ +scsilib_incl = @scsilib_incl@ +scsilib_libs = @scsilib_libs@ +scsilib_objs = @scsilib_objs@ +sharedstatedir = @sharedstatedir@ +sound_if_obj = @sound_if_obj@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +thread_libs = @thread_libs@ +@COND_XDAO_FALSE@MAYBE_XDAO = +@COND_XDAO_TRUE@MAYBE_XDAO = xdao +@COND_SCSILIB_FALSE@MAYBE_SCSILIB = +@COND_SCSILIB_TRUE@MAYBE_SCSILIB = scsilib +@COND_PCCTS_FALSE@MAYBE_PCCTS = +@COND_PCCTS_TRUE@MAYBE_PCCTS = pccts +SUBDIRS = $(MAYBE_SCSILIB) $(MAYBE_PCCTS) trackdb utils paranoia dao $(MAYBE_XDAO) +DIST_SUBDIRS = trackdb utils paranoia dao xdao pccts +EXTRA_DIST = \ + AUTHORS \ + ChangeLog \ + COPYING \ + CREDITS \ + INSTALL \ + NEWS \ + README \ + README.PlexDAE \ + README.Win32 \ + scsilib \ + specs/*.in \ + aspi.reg \ + cdrdao.lsm \ + testtocs/*.toc \ + contrib + +all: config.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --gnu '; \ + cd $(srcdir) && $(AUTOMAKE) --gnu \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +config.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status config.h +$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f config.h stamp-h1 +specs/cdrdao.fedora.spec: $(top_builddir)/config.status $(top_srcdir)/specs/cdrdao.fedora.spec.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + mkdir $(distdir) + $(mkdir_p) $(distdir)/specs $(distdir)/testtocs $(distdir)/xdao + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-hook + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile config.h +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \ + check-am clean clean-generic clean-recursive ctags \ + ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-hook \ + dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-generic distclean-hdr distclean-recursive \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + + +dist-hook: + rm -rf `find $(distdir)/contrib -name CVS` +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/NEWS diff --git a/README b/README new file mode 100644 index 0000000..c7fb965 --- /dev/null +++ b/README @@ -0,0 +1,869 @@ +Cdrdao - Write audio/data CD-Rs in disk-at-once mode +============================================================================= + +This file contains some additional information. See the manual page +for usage of the tool. + +Please use the write simulation mode (command 'simulate') when trying +this program the first time on your system. This will detect problems +or incompatibilities without wasting a CD-recordable. Note that you +may have to eject and reinsert the CD-R after a simulation run before +a real write can start. + + +Sources of Information +--------------------- + +Cdrdao Homepage: http://cdrdao.sourceforge.net/ + +Download: http://sourceforge.net/projects/cdrdao/ + +Mailing Lists: + + cdrdao-info@lists.sourceforge.net + Moderated list for informing about new releases or serious bugs. + For subscribing information send an email with 'help' in the body + to or visit the info page + http://lists.sourceforge.net/mailman/listinfo/cdrdao-info. + + cdrdao-devel@lists.sourceforge.net + Open lists for discussion about problems, implementation of new + features etc. + For subscribing information send an email with 'help' in the body + to or visit the info page + http://lists.sourceforge.net/mailman/listinfo/cdrdao-devel. + + +Please report bugs and suggestions to Denis Leroy . + + + +Drivers +------- + +The following driver IDs may be used with option '--driver'. It is +possible to specify option bits which modify the behavior of the +driver. Global and driver specific options are available. Options +flags can be combined by logical 'or' and appended to the '--driver' +option, e.g. '--driver plextor-scan:0x03'. + +By default, cdrdao will try to detect if your device is MMC compliant +and use the 'generic-mmc' driver is possible. + + Global Option Bits: + read-toc/read-cd related: + 0x00010000: Use the generic method to read the TOC of a CD for + commands 'read-toc' and 'read-cd'. If this flag is + selected multi session disks will not be handled + properly but some drives do not work with the + currently implemented method for reading the TOC + of a specific session. + + 0x00020000: If the byte order of the audio data retrieved with + 'read-cd' is wrong (i.e. not big endian samples) use + this option. + + 0x00040000: Use this option if your drive cannot read audio data + from the first track's pre-gap. You will get read error + messages in this case which should vanish if this option + is used. + + 0x00080000: Suppresses the automatic data type detection for the + raw TOC data and assumes that the drive sends BCD data. + Use this or the following option if cdrdao reports that + it cannot "determine if raw toc data is BCD or HEX". + + 0x00100000: Suppresses the automatic data type detection for the + raw TOC data and assumes that the drive sends HEX data. + Use this or the previous option if cdrdao reports that + it cannot "determine if raw toc data is BCD or HEX". + + 0x00200000: Do not try to read CD-TEXT data with command 'read-toc', + 'read-cd' or 'copy'. Some drives lock up or send junk + data when asked for the CD-TEXT data. + + Available Drivers: + + plextor + Supports CD structure analysis (command 'read-toc') for Plextor + CD-ROM readers. Pre-gaps and index marks are detected by + performing a binary search over the Q sub-channel for each + track. This method is fast and gives very exact results on + Plextor drives. The driver uses generic SCSI commands (PLAY AUDIO + and READ SUB-CHANNEL) so it may work on other models, too, but + result and speed is directly correlated to the digital audio + extraction capabilities. + + Option Bits: + read-toc/read-cd related: + 0x00000001: Force usage of the paranoia method for audio extraction + instead of the special Plextor method that is used + with Plextor drives. + + 0x00000002: Use the READ10 command to read audio data instead of + the vendor specific READ CDDA command. + Only used if the paranoia DAE method is selected. + + 0x00000010: Don't slow down after a read error. Available + only on Plextor devices. Manufacturer + default is to slow down. + + 0x00000020: Start data transfer before maximum + speed is reached. Available only on + Plextor PX-20 and later. Manufacturer + default is to wait for maximum speed. + + 0x00000040: Don't slow down when drive pauses to + avoid vibrations. Available only on + Plextor PX-20 and later. Manufacturer + default is to slow down. + + plextor-scan + This is an alternate driver for CD structure analysis with Plextor + drives. It scans the Q sub-channels of a track linearly like the + 'generic-mmc' driver but is faster on Plextor drives. + + Option Bits: + read-toc/read-cd related: + 0x00000001: Read 16 bytes PQ sub-channel instead of 96 byte + raw P-W sub-channel data. If 'read-toc'/'read-cd' + fails on your drive try to select this option. + + 0x00000002: Only used if option '0x00000001' is selected. If set + the read PQ sub-channel data is expected to contain + BCD instead of HEX values. If the time count that + is displayed while running 'read-toc' jumps you will + have to toggle this option. + + 0x00000004: Do not take ISRC code from the sub-channel data but use + the appropriate SCSI command for reading the ISRC + code. This option is automatically selected if 16 + byte PQ sub-channel data with HEX values is used. + + cdd2600 + This is a native driver for the Philips CDD2000/CDD2600 drive family. + 'read-toc' is implemented like in the 'plextor' driver but it is slow + and not very exact due to poor digital audio extraction capabilities of + these drives. Anyway, I don't recommend doing CD structure analysis with + the CDD2x00 because it stresses the mechanism too much. + + generic-mmc + This is a driver for SCSI-3/mmc compatible CD-recorders that support + session-at-once (cue sheet based) writing. Most of the recent drives + (ATAPI, SCSI, USB, Parallel Port) should be compatible with this or + with the 'generic-mmc-raw' driver described below. Data track writing + support is also available. + 'read-toc' scans linearly the Q sub-channel of each track to retrieve + the pre-gap length and index marks. This method is very accurate but + takes the same time like digital audio extraction. It should also work + with recent CD-ROM readers. + + Option Bits: + read-toc/read-cd related: + 0x00000001: See 'plextor-scan'. + + 0x00000002: See 'plextor-scan'. + + 0x00000004: See 'plextor-scan'. + + 0x00000008: Try to retrieve the media catalog number by scanning + the sub-channels instead of using the appropriate + SCSI command. This might be an option if the CD-R/CD-ROM + drive does not extract the catalog number otherwise. + + Note: A media catalog number need not be present on + on a CD. + + 0x00000020: Use this option if the drive cannot read sub-channel + data along with audio data. A binary search method for + pre-gap and index mark extraction will be selected in + this case which has to play a sector before the + sub-channel data can be retrieved. + If 'read-toc'/'read-cd' works only with this option + you should consider to use '--fast-toc' since the + data retrieved with the binary search method is usually + not very reliable and not worth the additional time. + + 0x00000100: Force using the raw R-W sub-channel reading + mode for audio and data tracks. + + writing related: + 0x00000010: Enable CD-TEXT writing. This must be done explicitly + because there is no way to detect if a recorder supports + CD-TEXT writing. Trying to write CD-TEXT data with + recorders that do not support this feature usually + results in an error message at the beginning of the + recording process and in real write mode the medium + will be unusable. + + 0x00000040: Suppresses the activation of the BURN Proof feature. + + 0x00000080: If the drive does not support packed R-W + sub-channel writing (the drive does not support + the L-EC data creation and interleaving for R-W + sub-channel data) you will have to specify this + option. Cdrdao will perform all the encoding + and write in raw R-W mode. If the drive does + not support the raw R-W writing mode, too, it + is not possible to write sub-channel data. + + generic-mmc-raw + This is an alternate driver for SCSI-3/mmc compatible CD-recorders. + It uses the raw writing interface where the driver has to provide the + PQ sub-channel data in addition to the audio data. This writing mode + allows using part of the lead-out area for audio data since the drive's + firmware has no chance to prevent this. Of course, you will get some + error message at the end of writing when the CD-R capacity is exhausted. + Multi session recording is currently not supported. + CD structure analysis is done like in the 'generic-mmc' driver. + + Option Bits: + All of 'generic-mmc' except + + 0x00000010: CD-TEXT writing capability is automatically determined. + + 0x00000080: R-W sub-channel writing capability is + automatically determined. + + + ricoh-mp6200 + Supports writing with the Ricoh MP6200S CD recorder. + CD structure analysis is done like in the 'generic-mmc' driver. + + sony-cdu920 + Driver for the Sony CDU920 recorder. Audio and data tracks are supported. + The Sony CDU948 recorder will work with this driver, too. Use option + '--speed 0' to get the full writing speed. + 'read-toc' uses the Q sub-channel scanning method. + + sony-cdu948 + Driver for the Sony CDU948 recorder. It extends the 'sony-cdu920' driver + by CD-TEXT writing and multi session mode. + + taiyo-yuden + This is an adapted 'cdd2600' driver for Taiyo-Yuden recorders. + 'read-toc' is done with 'plextor' method. + + teac-cdr55 + Driver for the Teac CD-R55 recorder. Audio and data tracks are supported. + 'read-toc' uses the Q sub-channel scanning method. + + toshiba + Read only driver for Toshiba SCSI CD-ROM drives. The Q sub-channel + scanning method is used to detect pre-gaps and index marks. + + yamaha-cdr10x + Driver for the Yamaha CDR10X recorder series that supports audio and + data tracks. 'read-toc' uses the Q sub-channel scanning method. + + +SCSI Device +----------- + +Cdrdao uses Joerg Schilling's SCSI library. Thus the same SCSI device +addressing scheme applies as for 'cdrecord'. A SCSI device is +addressed by a bus/id/lun triple, e.g. '--device 0,2,0' for a device +with SCSI ID 2 on SCSI bus 0. On some systems it is also possible +(sometimes required) to specify a device node directly, e.g. '--device +/dev/sg0' can be used on Linux systems instead of the bus/id/lun +triple. + +On Linux systems the generic SCSI device ('/dev/sg?') is required to +access the CD writer. Try 'cat /proc/devices' to check out if your +kernel supports the character device 'sg'. If not insert the +corresponding module ('insmod sg.o') or reconfigure and compile the +kernel. Cdrdao opens '/dev/cdrecorder' by default which should be a +link to the appropriate generic SCSI device. + + +ATAPI Support +------------- + +ATAPI drives use the same command set as SCSI devices so that cdrdao +also supports all ATAPI CD-ROM, CD-R and CD-RW drives. Either the +'generic-mmc' or the 'generic-mmc-raw' driver should work if the +recorder supports DAO writing at all. + +Cdrdao access ATAPI devices through the same interface as used for +SCSI devices. Therefor the operating system must emulate the ATAPI +devices as SCSI devices. Some operating systems do this by default +(e.g. Win32), other operating system must be told to do that +(e.g. Linux, enable the IDE host adapter emulation) and some operating +system may not support that. + +The same applies for USB and parallel port devices: cdrdao supports +them but the operating system must present them as SCSI devices. + +It is also possible to access ATAPI devices directly by using the +syntax '--device ATAPI:0,0,0' or '--device ATA:0,0,0' based in your +operating system. This is the same syntax used by cdrecord. It is +indeed the recommended way for recent Linux systems wich no longer +relies on the ide-scsi emulation layer. Linux kernel 2.4 users should +use the '--device ATAPI:0,0,0' syntax, while kernels above 2.6 can use +the more recent ATA interface ('--device ATA:0,0,0'). + + +Digital Audio Extraction +------------------------ + +The digital audio extraction is done with the help of Monty's paranoia +library except the 'plextor' driver which uses a special method for +Plextor drives. If you want to use the paranoia mode with the +'plextor' driver you will have to use option '--driver plextor:0x1'. + +The output file will always contain raw signed 16 bit audio samples +with MSB-LSB (big endian) byte order. If the byte order of the output +file is not MSB-LSB you will have to use the driver option '0x20000', +e.g. '--driver plextor:0x20000'. Please do not try to use '--swap' for +writing in this case because the byte order of the audio samples that +are fed to the paranoia library is wrong, too, which will cause +malfunction of the paranoia library routines. + +Even if you specify a file name with a ".wav" extension the resulting +file will be a raw audio file without any header. + +'read-cd' and 'copy' will read the first track's pre-gap, too. If your +drive cannot access these audio sectors which is usually indicated by +read errors you will have to use driver option 0x40000. + +Currently, cdrdao does not support as many CD-ROM drives as +cdparanoia. If audio extraction works with cdparanoia but not with +cdrdao please send me a log of a 'cdparanoia -v' run and I will +implement the required access command. + + +CD-TEXT Writing +--------------- + +CD-TEXT data is read with 'read-toc' or 'read-cd' if your drive +supports it (e.g. Teac CD-532e, HP CD-Writer+ 8100) and will be stored +in the toc-file. It is also possible to create the CD-TEXT data +manually by editing the toc-file or by using the xcdrdao GUI. If you +want to create your own CD-TEXT data be sure to add the fields 'TITLE' +and 'PERFORMER' to all tracks. + +IMPORTANT: The CD-TEXT writing feature must be explicitly enabled with +the driver option 0x10 for the 'generic-mmc' driver (see section +Drivers). If the driver is automatically selected for your recorder +model the driver options should be already set if your recorder is +known to write CD-TEXT data. Please report if the driver database is +not up to date or contains incorrect data. + +The directory "testtocs" contains a template toc-file "cdtext.toc". + + +Drives Known to Work +-------------------- + +Recorders: + +Model Firmware Rev. Driver +---------------------------------------------------------------------------- +ACER 10x8x32 ? generic-mmc-raw +ACER 2010A ? generic-mmc-raw +ACER 20x10x40 ? generic-mmc-raw +ACER 4406EU A.AZ generic-mmc-raw +ACER 4x4x6 ? generic-mmc-raw +ACER 8X4X32 5.GV generic-mmc-raw +ACER CD-R/RW 4X4X32 3.LS generic-mmc-raw +AOPEN CD-RW CRW1632 1.11 generic-mmc +AOPEN CD-RW CRW2040 1.01 generic-mmc +AOPEN CD-RW CRW3248 1.12 generic-mmc-raw +AOPEN CD-RW-241040 ? generic-mmc +AOPEN CRW1232 ? generic-mmc-raw +AOPEN CRW620 2.40 ricoh-mp6200 10 +AOPEN CRW9624 1.70 generic-mmc +ARTEC RW241040 1.02 generic-mmc-raw +ARTEC WRA-WA48 ? generic-mmc-raw +ARTEC WRR-4048 1.01 generic-mmc-raw +ASUS CRW-1610A atapi generic-mmc-raw +ASUS CRW-3212A 1.0 generic-mmc-raw +ATAPI CD-R/RW 12X8X32 9.JB generic-mmc-raw +ATAPI CD-R/RW 4X4X32 3.GS,3.HS generic-mmc-raw 7 +ATAPI CD-R/RW CRW6206A 1.3A generic-mmc-raw +BENQ CRW2410A P.MJ generic-mmc-raw +BTC BCE1610IM 0.19,A.20 generic-mmc-raw +BTC BCE2410IM A.22,A.23 generic-mmc-raw +BTC BCE621E 2.0 generic-mmc-raw +CD-RW CDR-2440MB 5SG1 generic-mmc +CREATIVE CD-RW RW1210E LCS6 generic-mmc +CREATIVE CD-RW RW4424 1.12 generic-mmc +CREATIVE CD-RW RW8433E 1R04 generic-mmc +CREATIVE CD5233E 1.00 generic-mmc +CYBERDRV CW018D 120 generic-mmc-raw +CYBERDRV CW038D 100C,110C generic-mmc-raw +CYBERDRV CW058D 100D generic-mmc-raw +DELTA OME-W141 1.40 generic-mmc +GENERIC CRD-BP1600P 2.43 generic-mmc +GENERIC CRD-R800S 1.10 generic-mmc +GENERIC CRD-RW2 1.12 generic-mmc 9 +Goldstar 8120B ? generic-mmc-raw +GRUNDIG CDR100IPW 1.26 cdd2600 +HL-DT-ST CD-RW GCE-8160B 1.02 generic-mmc-raw +HL-DT-ST CD-RW GCE-8320B 1.00,1.01,1.04 generic-mmc-raw +HL-DT-ST RW/DVD GCC-4120B 2.01 generic-mmc +HP 9510i 1.0e generic-mmc +HP CD-Writer 4020 1.27 cdd2600 +HP CD-Writer 6020 1.07 cdd2600 +HP CD-Writer+ 7100 3.01 generic-mmc-raw +HP CD-Writer+ 7200 3.01 generic-mmc-raw +HP CD-Writer+ 7570 1.0a generic-mmc 5 +HP CD-Writer+ 8100 1.0g generic-mmc 5 +HP CD-Writer+ 8200 1.0f generic-mmc 5 +HP CD-Writer+ 8290 1.3c generic-mmc 5 +HP CD-Writer+ 9100 1.0c generic-mmc 5 +HP CD-Writer+ 9110 1.0 generic-mmc 5 +HP CD-Writer+ 9200 1.0c, 1.0e generic-mmc 5 +HP CD-Writer+ 9300 1.0b generic-mmc 5 +HP CD-Writer+ 9600 1.0a generic-mmc 5 +HP CD-Writer+ 9700 1.0M generic-mmc +HP DVD Writer 100j 1.34 generic-mmc +HP DVD Writer 200j 1.06 generic-mmc-raw +IDE-CD R/RW 16x10A P1.5 generic-mmc +IDE-CD R/RW 2x2x24 1.4 generic-mmc-raw +IDE-CD R/RW 4x4x24 1.5C generic-mmc-raw +IDE-CD R/RW 4x4x32 1.3B,1.4B generic-mmc-raw +IDE-CD R/RW 8x4x32 1.3B,1.4B,1.5 generic-mmc-raw +IDE-CD ReWritable-2x2x6 3.09 generic-mmc-raw +IMATION IMW121032IAB 2.4B generic-mmc +IMS 522 1.05 cdd2600 +IMS CDD2000 1.25,1.26 cdd2600 +IOMEGA ZIPCD 4x650 1.04 generic-mmc-raw +JVC R2626 1.10,2.29 teac-cdr55 +JVC XR-W2010 1.51 teac-cdr55 +KODAK PCD-225 1.06 cdd2600 +LG 8088B ? generic-mmc +LG 8120B 1.03 generic-mmc +LG CD-ROM CDR-8428B 1.0 generic-mmc +LG CD-RW CED-8080B 1.05,1.06 generic-mmc +LG CD-RW CED-8081B 1.00,1.05,1.06 generic-mmc +LG CD-RW CED-8083B 1.06,1.09,1.1 generic-mmc +LG CD-RW GCE-8240B 1.06 generic-mmc +LG COMBO 1.0 generic-mmc +LG HL-DT-ST RW/DVD GCC-4080N 0010 generic-mmc +LITE-ON LTR-0841 MS10, MS84 generic-mmc +LITE-ON LTR-12101B LS15 generic-mmc-raw +LITE-ON LTR-16101B TSON generic-mmc-raw +LITE-ON LTR-16102C US52 generic-mmc-raw +LITE-ON LTR-24102B 5S07 generic-mmc +LITE-ON LTR-32123S XS0X generic-mmc-raw +LITE-ON LTR-32125W WBS4 generic-mmc +LITE-ON LTR-40125S ZS08 generic-mmc-raw +LITE-ON LTR-48125W VS04,VS06 generic-mmc-raw +MATSHITA CD-R CW-7502 X.14, X.17 generic-mmc 5 +MATSHITA CD-R CW-7503 1.04, 1.8 generic-mmc +MATSHITA CD-R CW-7582 1.00, 1.05, 1.10 generic-mmc +MATSHITA CD-R CW-7585 1.04 generic-mmc +MATSHITA CD-R CW-7586 1.01,1.08 generic-mmc +MATSHITA CDRRW01 1.34 generic-mmc +MATSHITA UJDA360 ? generic-mmc +MATSHITA UJDA710 1.50 generic-mmc +MATSHITA UJDA720 ? generic-mmc +MEMOREX 24MAX 1040 ? generic-mmc +MEMOREX 40MAXX 1248AJ ZWS1 generic-mmc +MEMOREX CD-RW4224 1.17 generic-mmc +MEMOREX CDRW-2216 1.0b generic-mmc-raw +MEMOREX CR-622 D4.0 generic-mmc-raw 5 +MEMOREX CRW-1662 D4.0 generic-mmc-raw +MEMOREX CRW620 1.20 ricoh-mp6200 +MICROSOLUTIONS BACKPACK CD REWRITER ? generic-mmc +MITSUMI 2801 1.10 generic-mmc-raw +MITSUMI CR-4801 2.02 generic-mmc 2 +MITSUMI CR-4802 1.2B, 1.4D generic-mmc-raw 4 +MITSUMI CR-4804 2.4C generic-mmc-raw +MITSUMI CR-48X5 1.2A generic-mmc +MITSUMI CR-48X5TE 1.6A generic-mmc +MITSUMI CR-48X8TE 1.1E generic-mmc +MITSUMI CR-48XATE 1.0C generic-mmc +OLYMPIC RWD RW4224 ? generic-mmc +OTI -975 SOCRATES ? generic-mmc-raw +PANASONIC CD-R CW-7582 1.05 generic-mmc +PHILIPS CDD 3801/31 ? generic-mmc-raw +PHILIPS CDD2000 1.25, 1.26 cdd2600 +PHILIPS CDD2600 1.07 cdd2600 +PHILIPS CDD3600 2.00 generic-mmc-raw +PHILIPS CDD3610 2.02, 3.01, 3.09 generic-mmc-raw +PHILIPS CDD4201 1.5C generic-mmc-raw +PHILIPS CDD4801 C1.3 generic-mmc-raw +PHILIPS CDD522 ? cdd2600 +PHILIPS CDRW1610A P1.4 generic-mmc +PHILIPS CDRW2412A P1.5 generic-mmc +PHILIPS CDRW400 ? generic-mmc-raw +PHILIPS OMNIWRITER26 1.20 ricoh-mp6200 +PHILIPS PCA460RW 1.0e,1.0g generic-mmc +PHILIPS PCRW1208 3.1,4.0 generic-mmc-raw +PHILIPS PCRW120899 ? generic-mmc-raw +PHILIPS PCRW404 1.06,1.4b generic-mmc-raw +PHILIPS PCRW804 1.5,2.0 generic-mmc-raw +PIONEER DVD-ROM DVD-114 2.06 generic-mmc +PLEXTOR CD-R PX-R412 1.04, 1.06, 1.07 generic-mmc +PLEXTOR CD-R PX-R820 1.03, 1.07 generic-mmc +PLEXTOR CD-R PX-W1210 1.02,1.04,1.05 generic-mmc +PLEXTOR CD-R PX-W124 1.02 generic-mmc +PLEXTOR CD-R PX-W1610 1.00 generic-mmc +PLEXTOR CD-R PX-W4220 1.01, 1.02 generic-mmc +PLEXTOR CD-R PX-W8220 1.01 generic-mmc +PLEXTOR CD-R PX-W8432 1.03, 1.05 generic-mmc +PLEXTOR CD-R PX-W241040 1.04 generic-mmc +PLEXTOR CD-R PX-W2410a 1.03,1.04 generic-mmc +PLEXTOR CD-R PX-W4012A 1.00,1.01 generic-mmc +QPS CRD-BP 1500P 6.38 generic-mmc-raw +RICOH CD-R/RW MP7040 1.4 generic-mmc +RICOH CD-R/RW MP7060 1.30, 1.50, 1.70 generic-mmc +RICOH CD-R/RW MP7063A 1.80 generic-mmc +RICOH CD-R/RW MP7080 1.10 generic-mmc +RICOH CD-R/RW MP7083A 1.20 generic-mmc +RICOH DVD/CDRW MP9060 1.50 generic-mmc +RICOH MP6200 2.20, 2.03, 1.20, 2.40 ricoh-mp6200 +RICOH MP6201 ? ricoh-mp6200 +SAF CD-R2006PLUS 2.05 teac-cdr55 +SAF CD-R4012 6.0J, 6.0L teac-cdr55 +SAF CD-R8020 1.24 generic-mmc +SAF CD-RW 226 1.12 teac-cdr55 +SAF CD-RW4224A 1.20 generic-mmc +SAF CD-RW6424 1.30 generic-mmc +SAMSUNG CD-R/RW SW-204B BS21 generic-mmc-raw +SAMSUNG CD-R/RW SW-206 1.40 generic-mmc +SAMSUNG CD-R/RW SW-208 BS01, BS02 generic-mmc-raw +SAMSUNG CD-R/RW SW-212B BS05,Q001 generic-mmc-raw +SAMSUNG CD-R/RW SW-224 R201 generic-mmc-raw +SAMSUNG CD-R/RW SW-408B BS02 generic-mmc +SAMSUNG CDRW/DVD SM-308B BS03,BS04,T100 generic-mmc +SAMSUNG SW-232 R300,R301 generic-mmc-raw +SANYO CRD-BP3 1.03 generic-mmc +SONY CD-R CDU920 ? sony-cdu920 +SONY CD-R CDU924 1.1d sony-cdu920 +SONY CD-R CDU948 1.0j sony-cdu948 5 +SONY CD-RW CRX700E 1.4r generic-mmc +SONY CRX-815 ? generic-mmc +SONY CRX100 1.0m generic-mmc 5 +SONY CRX120 1.0j generic-mmc 5 +SONY CRX140 1.0n generic-mmc 5 +SONY CRX145 1.0b generic-mmc 5 +SONY CRX160E 1.0e,1.0g generic-mmc +SONY CRX175A1 5YS2 generic-mmc +SONY CRX175E ? generic-mmc +SONY CRX185E1 XYS2 generic-mmc +SONY CRX195E1 ? generic-mmc-raw +T.YUDEN CD-WO EW-50 2.15, 2.16, 2.18 taiyo-yuden +TDK 4800 s7s5 generic-mmc +TDK CDRW121032 1.02 generic-mmc +TDK CDRW321040B X7S2 generic-mmc +TDK CDRW8432 1.07 generic-mmc +TEAC CD-R50 ? teac-cdr55 +TEAC CD-R55 1.0k,1.0n,1.0r teac-cdr55 +TEAC CD-R56 ? generic-mmc +TEAC CD-R58 1.0J, 1.0H generic-mmc +TEAC CD-W216E 1.0A generic-mmc +TEAC CD-W512EB 2.0B generic-mmc +TEAC CD-W512SB 1.0H generic-mmc +TEAC CD-W516EB 1.0A,1.0B generic-mmc +TEAC CD-W516EC 1.8C generic-mmc +TEAC CD-W524E 1.0b generic-mmc +TEAC CD-W54E 1.1B generic-mmc +TEAC CD-W58E 1.0A generic-mmc-raw +TORiSAN CDW-U4424 1.10 generic-mmc 11 +TOSHIBA DVD-ROM SD-M1612 1004 generic-mmc +TOSHIBA DVD-ROM SD-R1002 1030 generic-mmc +TOSHIBA DVD-ROM SD-R1202 1020 generic-mmc +TOSHIBA DVD-ROM SD-R2002 ? toshiba +TOSHIBA DVD-ROM SD-R2102 15 toshiba +TOSHIBA R/RW 4x4x24 ? generic-mmc-raw +TRAXDATA 241040 ? generic-mmc +TRAXDATA 2832 ? generic-mmc-raw +TRAXDATA CDR4120 5.0G, 5.0J, 5.0N teac-cdr55 +TRAXDATA CDRW2260+ 3.01 generic-mmc-raw +TRAXDATA CDRW4260 1.0f generic-mmc +TRAXDATA CRW2260 PRO 2.0 generic-mmc-raw +WAITEC WT2444EI 1.04 generic-mmc-raw +WAITEC WT4424 1.01 generic-mmc-raw +WAITEC WT624 7.0F generic-mmc +YAMAHA CDR100 1.0, 1.1 yamaha-cdr10x +YAMAHA CDR102 1.00, 1.01 yamaha-cdr10x +YAMAHA CDR200 1.0k generic-mmc +YAMAHA CDR400 1.0k, 1.0n generic-mmc 1,5 +YAMAHA CRW2100 1.0D, 1.0H generic-mmc +YAMAHA CRW2200 ? generic-mmc +YAMAHA CRW2260 1.0f generic-mmc +YAMAHA CRW3200 1.0d generic-mmc +YAMAHA CRW4001 1.0q generic-mmc +YAMAHA CRW4260 1.0h, 1.0q generic-mmc 5 +YAMAHA CRW4416 1.0b generic-mmc +YAMAHA CRW6416 1.0c, 1.0d generic-mmc 8 +YAMAHA CRW8424 1.0d generic-mmc +YAMAHA CRW8824 1.0 generic-mmc +_NEC 7900 ? generic-mmc-raw +_NEC NR-7700A 1.01 generic-mmc +_NEC NR-7800A 1.01,1.0B generic-mmc-raw + +Readers (command 'read-toc', 'read-cd'): + +Model Firmware Rev. Driver +-------------------------------------------------------------------------- +ASUS CD-S340 1.60 generic-mmc +ASUS CD-S400 2.40 generic-mmc +ASUS CD-S500/A 1.0K generic-mmc +ASUS DVD-ROM E608 1.10 generic-mmc +E-IDE CD-950E/TKU A41 generic-mmc +E-IDE CD-ROM 36X/AKU U23 generic-mmc 3 +E-IDE CD-ROM 52X/AKH A6E generic-mmc +FUNAI E295X 1.01 generic-mmc +HITACHI CDR-7730 ? generic-mmc +HITACHI CDR-8435 0010 generic-mmc +HITACHI DVD-ROM GD-2500 A011 plextor +LG CD-ROM CRD-8480C 1.04 generic-mmc +LG CD-ROM CRD-8482B 1.00 generic-mmc +LG CD-ROM CRD-8521B 1.01,1.06 generic-mmc +LG DVD-ROM DRN8080B LAB8 generic-mmc +LITE-ON CD-ROM ? generic-mmc +LITE-ON LTD-163 ghr3 generic-mmc +LITEON DVD-ROM LTD163D ? generic-mmc +MATSHITA CD-ROM CR-506 8S04 plextor +MATSHITA CD-ROM CR-588 LS15 generic-mmc +MATSHITA CD-ROM CR-589 GS0H generic-mmc +MATSHITA CR-8008 8.0e plextor +MATSHITA DVD-ROM SR-8585 ? generic-mmc +MEMOREX CD-233E U10A generic-mmc 6 +MITSUMI CD-ROM FX4820 D02A generic-mmc +NAKAMICH MJ-5.16S 1.07 plextor +OPTICS_S 8622 ? generic-mmc +PHILIPS 36X/AKU ? generic-mmc +PHILIPS CD-ROM PCCD052 F50P generic-mmc +PHILIPS E-IDE CD-ROM 36X U23 generic-mmc +PIONEER CD-ROM DR-U03 1.01 plextor +PIONEER CD-ROM DR-U06 1.05 plextor +PIONEER CD-ROM DR-U10 1.07 plextor +PIONEER CD-ROM DR-U12 1.06 plextor +PIONEER CD-ROM DR-U16 1.06 plextor +PIONEER CD-ROM DR-U32 1.00 generic-mmc +PIONEER DVD-103 1.09, 1.15 generic-mmc +PIONEER DVD-104 1.11 generic-mmc +PIONEER DVD-105 1.11 generic-mmc +PIONEER DVD-303 1.09 plextor +PIONEER DVD-305 1.03 plextor +PLEXTOR CD-ROM ? plextor-scan +PLEXTOR PX-40TS 1.11 plextor-scan +PLEXTOR PX-40TW ? plextor-scan +PLEXTOR PX-63 ? plextor-scan +SONY CD-ROM ? plextor +SONY CD-ROM CDU-76 1.1c plextor +SONY CD-ROM CDU31A-02 ? generic-mmc +SONY CD-ROM CDU4821 S0.P generic-mmc +SONY CDU5211 YYS2 generic-mmc +TEAC CD-524E 3.0B generic-mmc +TEAC CD-532E 1.0A generic-mmc +TEAC CD-532S 1.0A teac-cdr55 +TEAC CD-540E 1.0A,1.0C generic-mmc +TEAC CD-ROM CD-532S 1.0A plextor-scan +TOSHIBA 1504 1008 toshiba +TOSHIBA CD-ROM XM-3206B ? generic-mmc +TOSHIBA CD-ROM XM-3601B 1885 toshiba +TOSHIBA CD-ROM XM-5302TA 1095 toshiba +TOSHIBA CD-ROM XM-5701TA 0167 toshiba +TOSHIBA CD-ROM XM-6102B 1112 generic-mmc +TOSHIBA CD-ROM XM-6201TA 1037 toshiba +TOSHIBA CD-ROM XM-6302B 1012 generic-mmc +TOSHIBA CD-ROM XM-6401TA 1009 toshiba +TOSHIBA CD-ROM XM-6402B 1008 generic-mmc +TOSHIBA DVD-ROM SD-2102 1015 toshiba +TOSHIBA DVD-ROM SD-C2202 1020,1021 generic-mmc +TOSHIBA DVD-ROM SD-C2302 1021 generic-mmc +TOSHIBA DVD-ROM SD-C2402 1317 generic-mmc +TOSHIBA DVD-ROM SD-M1102 1426 generic-mmc +TOSHIBA DVD-ROM SD-M1401 1008 generic-mmc +TOSHIBA DVD-ROM SD-M1402 ? generic-mmc +TOSHIBA XM-5401 1036 plextor + +Notes: + 1) Writing with firmware revision 1.0i does not work. + 2) read-toc with plextor driver. + 3) Sold as Philips PCA36XCD CD-ROM. + 4) The generic-mmc driver will also work but the firmware seems to + create wrong sub-channel data in some cases. + 5) See notes at the end of this file. + 6) This drive seems to ignore ISRC Codes and the Catalog Number. + 7) Firmware version 3.DS does not work well in DAO mode. Update to 3.GS! + 8) With firmware 1.0c and Adaptec 2940U2W the transmission must be + set to asynchron according to Adaptec and Yamaha. + 9) Sanyo OEM 32x/12x/4x CD-RW drive. + 10) The firmware reports an empty vendor string so that the driver + will not be selected automatically. Please use the --driver option. + 11) As with Toast and Nero it`s best to write and rewrite at 2x. + + +Example for CD Copying +---------------------- + +The following command will copy the CD in the source drive specified +with option '--source-device' to the CD-R/CD-RW inserted in the +destination drive specified with option '--device'. Only a single +session will be copied which can be selected with option '--session' +(default: 1st session). If you want to keep the session open you will +have to use option '--multi'. + + cdrdao copy --source-device 0,2,0 --device 0,5,0 --buffers 64 + + +The option '--buffers' is used to adjust the ring buffer size. Each +buffer holds 1 second audio data. Dividing the specified number of +buffers by the writing speed gives the approx. time for which data +input my be stalled, e.g. 64 buffers and writing at 4x speed results +in 16 seconds. + +On the fly copying is selected with option '--on-the-fly'. No +intermediate data will be stored on the disk in this case. + +If the source CD contains audio tracks and the source drive is slow +you should consider to reduce the audio extraction quality with option +'--paranoia-mode 0' or reduce the writing speed to 2x. For +'--paranoia-mode 0' you will need a perfect CD-ROM drive that can +provide an accurate audio stream. + +The standard generic SCSI interface of Linux kernels < 2.2.6 cannot +handle multiple commands in parallel. Since the reading and the +writing part of cdrdao use the generic SCSI interface mutual blocking +will occur. This results in low fill rates of cdrdao's ring buffer and +very likely produces buffer under runs. + +To avoid these problems you should apply Heiko Eissfeldt's sg-buffer +patch which can be downloaded from: + ftp://ftp.fokus.gmd.de/pub/unix/cdrecord/alpha/ +It is available for 2.0.x and 2.1.x kernels. For 2.2.x kernels with +x < 6 the "SG-2.2.tar.gz" patch should be used. Kernel versions >= 2.2.6 +do not need any patch. + +I strongly recommend to perform some simulation runs before trying real +writing. + + +Example for composing an audio CD +--------------------------------- + +Assume three existing audio files 'audio1.wav', 'audio2.wav' and +'audio3.wav' that go in three tracks. We do not want a pause between +track 1 and 2 (no pre-gap). The first 10 seconds of 'audio1.wav' +should be used as pre-gap for track 3. Here is the toc-file: + + +// Track 1 +TRACK AUDIO +FILE "audio1.wav" 0 // take all audio data from 'audio1.wav', length is taken + // from file + +// Track 2 +TRACK AUDIO +FILE "audio2.wav" 0 // take all audio data from 'audio2.wav', length is taken + // from file, no pre-gap + +// Track 3 +TRACK AUDIO +FILE "audio1.wav" 0 0:10:0 // take first 10 seconds from 'audio1.wav' +START // everything before this line goes into the pre-gap +FILE "audio3.wav" 0 // take all audio data from 'audio3.wav', length is taken + // from file + + +Type 'cdrdao show-toc example.toc' to check for the correct syntax of +the toc-file. Note that even for the command 'show-toc' the audio +files must exist if the length of the audio files is not specified +like in the example. + +Type 'cdrdao read-test example.toc' to check if all audio files can be +read without error (optional). + +Type 'cdrdao simulate example.toc' to perform a write simulation +(optional). + +Type 'cdrdao write example.toc' to create the audio CD. + + + +Notes about some CD recorder models +----------------------------------- + +MATSHITA/PANASONIC CW-7502 + This drive will only produce useful disks with the recent firmware + revision X.17. The X depends on the drive hardware revision. + + Thanks to Jeroen Steenblik for adapting + the generic-mmc driver to the CW-7502 recorder. He spend a lot of time + and wasted many CD-Rs until it was obvious that the pre-X.14 + firmware does not completely comply with the SCSI-3/mmc standard. + + Here are Jeroen's notes for upgrading the firmware: + The update can be found at the Plasmon technical website, + http://tech.plasmon.co.uk/, choose 'Download Files' and obtain the + X.17 firmware for the CDR480. This includes all instructions. + One thing I might add, when downloading the two files in the sequence + described in their document, my drive refused the second file. I had + to reboot after downloading the first file and only then I could download + the second. Quite scary stuff. Swapping the download sequence should + prevent this (so I've read). + + +MEMOREX CR-622 + Submitted by Bryan E. Chafy : + + The drive as shipped comes with firmware that does not support DAO. + The firmware lives on a PROM, it is not flashable. + You need an EPROM burner, a 27c020 PLCC EPROM, and the + D4.0 ROM image for the CRW-1622 (can download it from Memorex web site, + the name of the image is d39e.dat). + + The ROM is socketed at the rear of the drive, you will see it when you + remove the top cover. Mine had a sticker on it with the numbers E07/885B. + + Note, this is for the CR-622 (and its sister the CDR-622 wearnes drive), + NOT the CRW-1622. The CRW-1622 drive is flash-upgradeable). + + IMHO, Wearnes/Memorex should be sending us new ROM's free of charge because + the box clearly states the CR-622 supports DAO. + + The new firmware does not turn the CR-622 into a cd-rw capable drive. + You can still only burn cd-r media. + + +YAMAHA CDR400, CRW4260 + These drives sometimes have problems with writing at 4x speed. The + resulting disk is hard read for some reason. Disks written at 1x or + 2x speed are fine. Yamaha's support is aware of this problem. It might + be related to the actual firmware revision. + I successfully wrote CD-Rs at 4x speed with a CDR400t and firmware + revision 1.0k. + + +HP CD-Writer+ 75XX, HP CD-Writer+ 8100, SONY CRX100, HP CD-Writer+ 8200 + The firmware restricts the possible disk types in multi session + mode (DAO only) to one of the following: + + o Pure audio CD. + o CD-EXTRA where the 1st session contains only audio tracks and the + 2nd session contains 1 data track. + + Further restrictions: + + o The length of the 1st track's pre-gap is restricted to a certain + amount. + o Cue sheets with ISRC codes are rejected of the COPY flag is set. + This might be fixed in future versions. + + +SONY CD-R CDU948 + The firmware restricts the possible disk types in DAO mode to one of + the following: + + o Pure audio CD. + o Mixed mode CD where the 1st track is a data track followed by at + least 1 audio track. + o CD-EXTRA where the 1st session contains only audio tracks and the + 2nd session contains 1 data track. + + The length of the 1st track's pre-gap is restricted to a certain + amount, too. + + If you want to create a pure data CD you will have to append a dummy + audio track to the toc-file, e.g. with: + + TRACK AUDIO + PREGAP 0:2:0 + SILENCE 0:4:0 diff --git a/README.PlexDAE b/README.PlexDAE new file mode 100644 index 0000000..f45d1fc --- /dev/null +++ b/README.PlexDAE @@ -0,0 +1,35 @@ +Plextor CD-ROM digital audio extraction for cdrdao + +These patches enhance "cdrdao" with bitwise-exact digital audio extraction +for "Plextor"-brand CD-ROM drives. + +It uses Plextor vendor unique SCSI command enhancements in order to +implement this. These features are not known to exist in other +brand drives (by me, as of 25-3-1999), or to be exploited in any +other software at this moment. + +Status is alpha, and there are some known bugs and things to do. + +Currently known bugs: + +- Incremental extraction of a CDDA block (by collecting correct samples +in successive reads of a partly errenous CDDA block) is known to fail +in some cases (leading to non-unique CDDA extraction). + +Current things to do: + +- Include output formats other than raw (big-endian). +- Include output to stdio (for on-the-fly application maybe). +- ... + +Usage hints: + +This clones a CD-DA as exactly as possible (but see known bugs!): + +cdrdao read-cd --device /dev/sga --datafile data.cdr data.toc +cdrdao write --swap --device /dev/sgb data.toc + +You may want to do a "md5sum" of "data.cdr" on two successive reads +to ensure the known bug did not occur. + +Leon Woestenberg \ No newline at end of file diff --git a/README.Win32 b/README.Win32 new file mode 100644 index 0000000..036508c --- /dev/null +++ b/README.Win32 @@ -0,0 +1,59 @@ +The Win32 port of cdrdao is based on the Cygwin Unix environment for Windows. +This package comes with the binary version of the cygwin1.dll. You can download +the corresponding source code from http://sourceforge.net/projects/cdrdao +in the download section or via www.cygwin.com. + +This port should work on all Win32 operation systems. + +If you will use "cdrdao.exe" in dos prompt under win9x, (or restart in MS-DOS +mode also), you have to check off "Auto Insert Notification" of the CD-R drive +property. When you do "cdrdao.exe read-xx" with "Auto Insert Notification" +property, your PC will hang (write is O.K.). + +During writing you should avoid to open the Explorer and similar tools. +Currently, cdrdao does not lock the recording device so that all access +action from the Explorer will lead to a failure of the recording process. + +Cdrdao requires a working ASPI installation for operation. You can fetch +an ASPI installation package from Adaptec's home page. After a successful +ASPI installation the command + + cdrdao scanbus + +should list all of your CD-ROM, DVD and recorder devices. If not the following +registry changes should make them visible: + + [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Aspi32] + "ErrorControl"=dword:00000001 + "Type"=dword:00000001 + "Start"=dword:00000002 + + [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Aspi32\Parameters] + "ExcludeMiniports"="" + +You can also execute the file "aspi.reg" to make the registry updates +automatically. + +A 'cdrdao scanbus' output looks like this: + + 1,0,0: E-IDE, CD-ROM 52X/AKH, A6E + 1,1,0: ARTEC, WRR-4048, 1.01 + +The number triple (e.g. 1,0,0) is the address of the drive. It must be +used with the --device option of cdrdao to select the recorder or reader +device. For example copying a CD works like this: + + cdrdao copy --source-device 1,0,0 --device 1,1,0 + +For simple tests you can use test toc-files from the "testtocs" +directory: + + cdrdao simulate --device x,y,z testtocs/t1.toc + +This will run a write simulation with the layout of a simple audio CD. +It is very useful to verify the principal functionality of cdrdao on +you system. + + + + diff --git a/acinclude.m4 b/acinclude.m4 new file mode 100644 index 0000000..b64b604 --- /dev/null +++ b/acinclude.m4 @@ -0,0 +1,163 @@ +# Configure paths for GTK-- +# Erik Andersen 30 May 1998 +# Modified by Tero Pulkkinen (added the compiler checks... I hope they work..) + +dnl Check and configure include and link paths for lame library +dnl AC_PATH_LAME(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +dnl +AC_DEFUN([AC_PATH_LAME], +[dnl + AC_ARG_ENABLE(lame-test,[ --disable-lame-test skip checking for right mp3lame library],lame_test=$enableval,lame_test=yes) + AC_ARG_WITH(lame,[ --with-lame enable building of toc2mp3 (default is YES)],lame=$withval,lame="yes") + AC_ARG_WITH(lame-lib,[ --with-lame-lib=dir set directory containing libmp3lame],lamelib=$withval,lamelib="") + AC_ARG_WITH(lame-include,[ --with-lame-include=dir set directory containing lame include files],lameinc=$withval,lameinc="") + + if test x$lame = xyes ; then + AC_MSG_CHECKING(for Lame library version >= $1) + lame_ok=yes + else + lame_ok=no + lame_test=no + fi + + if test x$lame_test = xyes ; then + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + ac_save_CXXFLAGS="$CXXFLAGS" + ac_save_LIBS="$LIBS" + + if test "x$lameinc" != x ; then + CXXFLAGS="$CXXFLAGS -I$lameinc" + fi + + if test "x$lamelib" != x ; then + LIBS="$LIBS -L$lamelib" + fi + + LIBS="$LIBS -lmp3lame" + + AC_TRY_RUN([ +#include +#include +#include +#include +int +main () +{ + int major, minor; + char *tmp_version; + lame_version_t lame_version; + + /* HP/UX 0 (%@#!) writes to sscanf strings */ + tmp_version = strdup("$1"); + if (sscanf(tmp_version, "%d.%d", &major, &minor) != 2) { + printf("%s, bad version string\n", "$1"); + exit(1); + } + + get_lame_version_numerical(&lame_version); + + if (lame_version.major > major || + ((lame_version.major == major) && (lame_version.minor >= minor))) { + return 0; + } + else { + printf("\n*** An old version of LAME (%d.%d) was found.\n", + lame_version.major, lame_version.minor); + printf("*** You need a version of LAME newer than %d.%d. The latest version of\n", + major, minor); + printf("*** LAME is available from http://www.mp3dev.org/.\n"); + printf("*** However, it is very likely that slightly older versions of LAME\n"); + printf("*** will also work. If you want to try it, run configure with option\n"); + printf("*** --disable-lame-test. This will skip this check and assume that\n"); + printf("*** LAME is available for compiling.\n"); + } + + return 1; +} +],,lame_ok=no,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + + CXXFLAGS="$ac_save_CXXFLAGS" + LIBS="$ac_save_LIBS" + + AC_LANG_RESTORE + fi + + LAME_CFLAGS="" + LAME_LIBS="" + + if test $lame_ok = yes ; then + AC_MSG_RESULT(yes) + + if test "x$lameinc" != x ; then + LAME_CFLAGS="-I$lameinc" + fi + + if test "x$lamelib" != x ; then + LAME_LIBS="-L$lamelib" + fi + + LAME_LIBS="$LAME_LIBS -lmp3lame" + + ifelse([$2], , :, [$2]) + else + if test x$lame = xyes ; then + AC_MSG_RESULT(no) + fi + + ifelse([$3], , :, [$3]) + fi + + AC_SUBST(LAME_CFLAGS) + AC_SUBST(LAME_LIBS) +] +) + +AC_DEFUN([AC_LIBSCG], +[dnl +dnl Get libscg version +dnl + +dnl AC_MSG_CHECKING(for scg/schily library >= $1) + + AC_LANG_SAVE + AC_LANG_C + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + + AC_MSG_CHECKING(for libscg/schily version >= $1) + CFLAGS="$scsilib_incl" + LIBS="$scsilib_libs" + + AC_RUN_IFELSE([AC_LANG_PROGRAM([[ +#include +#include +#include +#include +]],[[ + int maj1, maj2, min1, min2; + const char* v1 = "$1"; + const char* v2 = scg_version(0, SCG_VERSION); + maj1 = atoi(v1); + maj2 = atoi(v2); + if (maj2 < maj1) { + return -1; + } + if (!strchr(v1, '.') || !strchr(v2, '.')) + return -1; + + min1 = atoi(strchr(v1, '.') + 1); + min2 = atoi(strchr(v2, '.') + 1); + if (min2 < min1) { + return -1; + } + +]])],[AC_MSG_RESULT(yes); $2],[AC_MSG_RESULT(no); $3],[AC_MSG_RESULT(skipped); $2]) + + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + AC_LANG_RESTORE +] +) + diff --git a/aclocal.m4 b/aclocal.m4 new file mode 100644 index 0000000..8bebe6f --- /dev/null +++ b/aclocal.m4 @@ -0,0 +1,1090 @@ +# generated automatically by aclocal 1.9.6 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +dnl AM_GCONF_SOURCE_2 +dnl Defines GCONF_SCHEMA_CONFIG_SOURCE which is where you should install schemas +dnl (i.e. pass to gconftool-2 +dnl Defines GCONF_SCHEMA_FILE_DIR which is a filesystem directory where +dnl you should install foo.schemas files +dnl + +AC_DEFUN([AM_GCONF_SOURCE_2], +[ + if test "x$GCONF_SCHEMA_INSTALL_SOURCE" = "x"; then + GCONF_SCHEMA_CONFIG_SOURCE=`gconftool-2 --get-default-source` + else + GCONF_SCHEMA_CONFIG_SOURCE=$GCONF_SCHEMA_INSTALL_SOURCE + fi + + AC_ARG_WITH(gconf-source, + [ --with-gconf-source=sourceaddress Config database for installing schema files.],GCONF_SCHEMA_CONFIG_SOURCE="$withval",) + + AC_SUBST(GCONF_SCHEMA_CONFIG_SOURCE) + AC_MSG_RESULT([Using config source $GCONF_SCHEMA_CONFIG_SOURCE for schema installation]) + + if test "x$GCONF_SCHEMA_FILE_DIR" = "x"; then + GCONF_SCHEMA_FILE_DIR='$(sysconfdir)/gconf/schemas' + fi + + AC_ARG_WITH(gconf-schema-file-dir, + [ --with-gconf-schema-file-dir=dir Directory for installing schema files.],GCONF_SCHEMA_FILE_DIR="$withval",) + + AC_SUBST(GCONF_SCHEMA_FILE_DIR) + AC_MSG_RESULT([Using $GCONF_SCHEMA_FILE_DIR as install directory for schema files]) + + AC_ARG_ENABLE(schemas-install, + [ --disable-schemas-install Disable the schemas installation], + [case ${enableval} in + yes|no) ;; + *) AC_MSG_ERROR(bad value ${enableval} for --enable-schemas-install) ;; + esac]) + AM_CONDITIONAL([GCONF_SCHEMAS_INSTALL], [test "$enable_schemas_install" != no]) +]) + +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant . +# +# This program 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. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# +# Similar to PKG_CHECK_MODULES, make sure that the first instance of +# this or PKG_CHECK_MODULES is called, or make sure to call +# PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_ifval([$2], [$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$PKG_CONFIG"; then + if test -n "$$1"; then + pkg_cv_[]$1="$$1" + else + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_failed=yes]) + fi +else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT +])], + [AC_MSG_RESULT([no]) + $4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see .])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES + +# Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"]) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION so it can be traced. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], + [AM_AUTOMAKE_VERSION([1.9.6])]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 7 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE]) +AC_SUBST([$1_FALSE]) +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH]) +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 3 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 8 + +# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. +AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 12 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.58])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +]) +]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $1 | $1:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +install_sh=${install_sh-"$am_aux_dir/install-sh"} +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +AC_DEFUN([AM_MAINTAINER_MODE], +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST(MAINT)dnl +] +) + +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise. +# +# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories +# created by `make install' are always world readable, even if the +# installer happens to have an overly restrictive umask (e.g. 077). +# This was a mistake. There are at least two reasons why we must not +# use `-m 0755': +# - it causes special bits like SGID to be ignored, +# - it may be too restrictive (some setups expect 775 directories). +# +# Do not use -m 0755 and let people choose whatever they expect by +# setting umask. +# +# We cannot accept any implementation of `mkdir' that recognizes `-p'. +# Some implementations (such as Solaris 8's) are not thread-safe: if a +# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c' +# concurrently, both version can detect that a/ is missing, but only +# one can create it and the other will error out. Consequently we +# restrict ourselves to GNU make (using the --version option ensures +# this.) +AC_DEFUN([AM_PROG_MKDIR_P], +[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi +AC_SUBST([mkdir_p])]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 3 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([acinclude.m4]) diff --git a/aspi.reg b/aspi.reg new file mode 100644 index 0000000..3568fdf --- /dev/null +++ b/aspi.reg @@ -0,0 +1,10 @@ +Windows Registry Editor Version 5.00 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Aspi32] +"ErrorControl"=dword:00000001 +"Type"=dword:00000001 +"Start"=dword:00000002 + +[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Aspi32\Parameters] +"ExcludeMiniports"="" + diff --git a/cdrdao.lsm b/cdrdao.lsm new file mode 100644 index 0000000..7aed180 --- /dev/null +++ b/cdrdao.lsm @@ -0,0 +1,20 @@ +Begin3 +Title: cdrdao +Version: 1.0 +Entered-date: 03AUG98 +Description: Writes audio CD-Rs in disc-at-once (DAO) mode allowing + control over pre-gaps (length down to 0, nonzero audio + data) and sub-channel information like ISRC codes. All + data that is written to the disc must be specified with + a text file. Audio data may be in WAVE or raw format. +Keywords: CD-recording, audio, disc-at-once +Author: mueller@daneb.ping.de (Andreas Mueller) +Maintained-by: mueller@daneb.ping.de (Andreas Mueller) +Primary-site: sunsite.unc.edu /pub/Linux/utils/disk-management/ + 67 kB cdrdao-1.0.src.tar.gz + 103 kB cdrdao-1.0.bin.x86.linux.tar.gz +Alternate-site: +Platforms: Linux + Supported hardware: Philips CDD 2600 +Copying-policy: GPL +End diff --git a/config.guess b/config.guess new file mode 100755 index 0000000..f1657bb --- /dev/null +++ b/config.guess @@ -0,0 +1,1363 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002 Free Software Foundation, Inc. + +timestamp='2002-09-03' + +# This file 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. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Per Bothner . +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit build system type. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +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." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# This shell variable is my proudest work .. or something. --bje + +set_cc_for_build='tmpdir=${TMPDIR-/tmp}/config-guess-$$ ; +(old=`umask` && umask 077 && mkdir $tmpdir && umask $old && unset old) + || (echo "$me: cannot create $tmpdir" >&2 && exit 1) ; +dummy=$tmpdir/dummy ; +files="$dummy.c $dummy.o $dummy.rel $dummy" ; +trap '"'"'rm -f $files; rmdir $tmpdir; exit 1'"'"' 1 2 15 ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + rm -f $files ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; +unset files' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + macppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvmeppc:OpenBSD:*:*) + echo powerpc-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mipseb-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + eval $set_cc_for_build + cat <$dummy.s + .data +\$Lformat: + .byte 37,100,45,37,120,10,0 # "%d-%x\n" + + .text + .globl main + .align 4 + .ent main +main: + .frame \$30,16,\$26,0 + ldgp \$29,0(\$27) + .prologue 1 + .long 0x47e03d80 # implver \$0 + lda \$2,-1 + .long 0x47e20c21 # amask \$2,\$1 + lda \$16,\$Lformat + mov \$0,\$17 + not \$1,\$18 + jsr \$26,printf + ldgp \$29,0(\$26) + mov 0,\$16 + jsr \$26,exit + .end main +EOF + $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null + if test "$?" = 0 ; then + case `$dummy` in + 0-0) + UNAME_MACHINE="alpha" + ;; + 1-0) + UNAME_MACHINE="alphaev5" + ;; + 1-1) + UNAME_MACHINE="alphaev56" + ;; + 1-101) + UNAME_MACHINE="alphapca56" + ;; + 2-303) + UNAME_MACHINE="alphaev6" + ;; + 2-307) + UNAME_MACHINE="alphaev67" + ;; + 2-1307) + UNAME_MACHINE="alphaev68" + ;; + 3-1307) + UNAME_MACHINE="alphaev7" + ;; + esac + fi + rm -f $dummy.s $dummy && rmdir $tmpdir + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit 0 ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit 0;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit 0 ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7 && exit 0 ;; + esac ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit 0 ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit 0 ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit 0 ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy \ + && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit 0 ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:*:*:PowerMAX_OS) + echo powerpc-harris-powermax + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null) && HP_ARCH=`$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi + rm -f $dummy.c $dummy && rmdir $tmpdir + fi ;; + esac + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD $dummy.c -o $dummy && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 + rm -f $dummy.c $dummy && rmdir $tmpdir + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3D:*:*:*) + echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + # Determine whether the default compiler uses glibc. + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #if __GLIBC__ >= 2 + LIBC=gnu + #else + LIBC= + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + rm -f $dummy.c && rmdir $tmpdir + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit 0 ;; + x86:Interix*:3*) + echo i386-pc-interix3 + exit 0 ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i386-pc-interix + exit 0 ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit 0 ;; + arm*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef mips + #undef mipsel + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=mipsel + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=mips + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` + rm -f $dummy.c && rmdir $tmpdir + test x"${CPU}" != x && echo "${CPU}-pc-linux-gnu" && exit 0 + ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit 0 ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit 0 ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + i*86:Linux:*:*) + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. cd to the root directory to prevent + # problems with other programs or directories called `ld' in the path. + # Set LC_ALL=C to ensure ld outputs messages in English. + ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \ + | sed -ne '/supported targets:/!d + s/[ ][ ]*/ /g + s/.*supported targets: *// + s/ .*// + p'` + case "$ld_supported_targets" in + elf32-i386) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + a.out-i386-linux) + echo "${UNAME_MACHINE}-pc-linux-gnuaout" + exit 0 ;; + coff-i386) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 ;; + "") + # Either a pre-BFD a.out linker (linux-gnuoldld) or + # one that does not give us useful --help. + echo "${UNAME_MACHINE}-pc-linux-gnuoldld" + exit 0 ;; + esac + # Determine whether the default compiler is a.out or elf + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + #ifdef __ELF__ + # ifdef __GLIBC__ + # if __GLIBC__ >= 2 + LIBC=gnu + # else + LIBC=gnulibc1 + # endif + # else + LIBC=gnulibc1 + # endif + #else + #ifdef __INTEL_COMPILER + LIBC=gnu + #else + LIBC=gnuaout + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` + rm -f $dummy.c && rmdir $tmpdir + test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit 0 ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit 0 ;; + i*86:*:5:[78]*) + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit 0 ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit 0 ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit 0 ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit 0 ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit 0 ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + *:Darwin:*:*) + echo `uname -p`-apple-darwin${UNAME_RELEASE} + exit 0 ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit 0 ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit 0 ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit 0 ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit 0 ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit 0 ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit 0 ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && $dummy && rm -f $dummy.c $dummy && rmdir $tmpdir && exit 0 +rm -f $dummy.c $dummy && rmdir $tmpdir + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +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` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/config.h.in b/config.h.in new file mode 100644 index 0000000..ca68f35 --- /dev/null +++ b/config.h.in @@ -0,0 +1,185 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* "" */ +#undef HAVE_AO + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_GETOPT_H + +/* Define to 1 if you have the `getpagesize' function. */ +#undef HAVE_GETPAGESIZE + +/* Define to 1 if you have the `inet_aton' function. */ +#undef HAVE_INET_ATON + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MALLOC_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `mlockall' function. */ +#undef HAVE_MLOCKALL + +/* "" */ +#undef HAVE_MP3_SUPPORT + +/* Define to 1 if you have the `munlockall' function. */ +#undef HAVE_MUNLOCKALL + +/* "" */ +#undef HAVE_OGG_SUPPORT + +/* Define to 1 if you have the `pthread_attr_setschedparam' function. */ +#undef HAVE_PTHREAD_ATTR_SETSCHEDPARAM + +/* Define to 1 if you have the `pthread_attr_setschedpolicy' function. */ +#undef HAVE_PTHREAD_ATTR_SETSCHEDPOLICY + +/* Define to 1 if you have the `pthread_getschedparam' function. */ +#undef HAVE_PTHREAD_GETSCHEDPARAM + +/* Define to 1 if you have the `pthread_setschedparam' function. */ +#undef HAVE_PTHREAD_SETSCHEDPARAM + +/* Define to 1 if you have the `pthread_sigmask' function. */ +#undef HAVE_PTHREAD_SIGMASK + +/* "" */ +#undef HAVE_SCHED_GETPARAM + +/* "" */ +#undef HAVE_SCHED_GET_PRIORITY_MAX + +/* Define to 1 if you have the header file. */ +#undef HAVE_SCHED_H + +/* "" */ +#undef HAVE_SCHED_SETSCHEDULER + +/* Define to 1 if you have the `setegid' function. */ +#undef HAVE_SETEGID + +/* Define to 1 if you have the `seteuid' function. */ +#undef HAVE_SETEUID + +/* Define to 1 if you have the `setgid' function. */ +#undef HAVE_SETGID + +/* Define to 1 if you have the `setregid' function. */ +#undef HAVE_SETREGID + +/* Define to 1 if you have the `setreuid' function. */ +#undef HAVE_SETREUID + +/* Define to 1 if you have the `setuid' function. */ +#undef HAVE_SETUID + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MMAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `usleep' function. */ +#undef HAVE_USLEEP + +/* "Use real time scheduling for Linux" */ +#undef LINUX_QNX_SCHEDULING + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* The size of a `int', as computed by sizeof. */ +#undef SIZEOF_INT + +/* The size of a `long', as computed by sizeof. */ +#undef SIZEOF_LONG + +/* The size of a `long long', as computed by sizeof. */ +#undef SIZEOF_LONG_LONG + +/* The size of a `short', as computed by sizeof. */ +#undef SIZEOF_SHORT + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* "" */ +#undef USE_POSIX_THREADS + +/* Version number of package */ +#undef VERSION + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +#undef WORDS_BIGENDIAN + +/* "" */ +#undef _P1003_1B_VISIBLE + +/* "" */ +#undef int16_t + +/* "" */ +#undef int32_t + +/* "" */ +#undef size16 + +/* "" */ +#undef u_int16_t + +/* "" */ +#undef u_int32_t + +/* Define to `unsigned char' if does not define. */ +#undef u_int8_t diff --git a/config.sub b/config.sub new file mode 100755 index 0000000..1dea9b7 --- /dev/null +++ b/config.sub @@ -0,0 +1,1470 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002 Free Software Foundation, Inc. + +timestamp='2002-09-05' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file 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. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Please send patches to . Submit a context +# diff and a properly formatted ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +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." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) + echo "$version" ; exit 0 ;; + --help | --h* | -h ) + echo "$usage"; exit 0 ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit 0;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | freebsd*-gnu* | storm-chaos* | os2-emx* | windows32-* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis) + os= + basic_machine=$1 + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k \ + | m32r | m68000 | m68k | m88k | mcore \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64vr | mips64vrel \ + | mips64orion | mips64orionel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mipsisa32 | mipsisa32el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | ns16k | ns32k \ + | openrisc | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | sh | sh[1234] | sh3e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | strongarm \ + | tahoe | thumb | tic80 | tron \ + | v850 | v850e \ + | we32k \ + | x86 | xscale | xstormy16 | xtensa \ + | z8k) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* \ + | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* \ + | clipper-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* \ + | m32r-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | mcore-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39 | mipstx39el \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* \ + | sh-* | sh[1234]-* | sh3e-* | sh[34]eb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ + | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* | tic30-* | tic4x-* | tic54x-* | tic80-* | tron-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ + | xtensa-* \ + | ymp-* \ + | z8k-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + or32 | or32-*) + basic_machine=or32-unknown + os=-coff + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3d) + basic_machine=alpha-cray + os=-unicos + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic4x | c4x*) + basic_machine=tic4x-unknown + os=-coff + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + windows32) + basic_machine=i386-pc + os=-windows32-msvcrt + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh3 | sh4 | sh3eb | sh4eb | sh[1234]le | sh3ele) + basic_machine=sh-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparc | sparcv9 | sparcv9b) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* | -powermax*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto*) + os=-nto-qnx + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/configure b/configure new file mode 100755 index 0000000..cc59f6a --- /dev/null +++ b/configure @@ -0,0 +1,12258 @@ +#! /bin/sh +# From configure.ac Revision: 1.25 . +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.59 for cdrdao 1.2.3. +# +# Copyright (C) 2003 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+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +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 + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; 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'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# 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 + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + 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 + + ;; + 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_me: error: cannot find myself; rerun with an absolute path" >&2 + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # 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 before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, 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 + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\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 sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +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$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# 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'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + + +# 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` + +exec 6>&1 + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_config_libobj_dir=. +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} + +# Maximum number of lines to put in a shell here document. +# This variable seems obsolete. It should probably be removed, and +# only ac_max_sed_lines should be used. +: ${ac_max_here_lines=38} + +# Identity of this package. +PACKAGE_NAME='cdrdao' +PACKAGE_TARNAME='cdrdao' +PACKAGE_VERSION='1.2.3' +PACKAGE_STRING='cdrdao 1.2.3' +PACKAGE_BUGREPORT='' + +ac_unique_file="dao/main.cc" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#if HAVE_SYS_TYPES_H +# include +#endif +#if HAVE_SYS_STAT_H +# include +#endif +#if STDC_HEADERS +# include +# include +#else +# if HAVE_STDLIB_H +# include +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include +# endif +# include +#endif +#if HAVE_STRINGS_H +# include +#endif +#if HAVE_INTTYPES_H +# include +#else +# if HAVE_STDINT_H +# include +# endif +#endif +#if HAVE_UNISTD_H +# include +#endif" + +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 datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar MAINTAINER_MODE_TRUE MAINTAINER_MODE_FALSE MAINT build build_cpu build_vendor build_os host host_cpu host_vendor host_os GCONF_SCHEMA_CONFIG_SOURCE GCONF_SCHEMA_FILE_DIR GCONF_SCHEMAS_INSTALL_TRUE GCONF_SCHEMAS_INSTALL_FALSE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE CPP RANLIB ac_ct_RANLIB AR PKG_CONFIG ac_pt_PKG_CONFIG EGREP antlr_path dlg_path LAME_CFLAGS LAME_LIBS SIGCPP2_CFLAGS SIGCPP2_LIBS GTKMM2_CFLAGS GTKMM2_LIBS LIBGUIMM2_CFLAGS LIBGUIMM2_LIBS VORBISFILE_CFLAGS VORBISFILE_LIBS MAD_CFLAGS MAD_LIBS AO_CFLAGS AO_LIBS en_xdao en_toc2mp3 en_toc2cue en_cue2toc en_cdrdao scsilib_dir scsilib_incl scsilib_libs scsilib_objs pcctsinc dao_src sound_if_obj thread_libs mydefs COND_XDAO_TRUE COND_XDAO_FALSE COND_TOC2MP3_TRUE COND_TOC2MP3_FALSE COND_SCSILIB_TRUE COND_SCSILIB_FALSE COND_PCCTS_TRUE COND_PCCTS_FALSE COND_MP3_TRUE COND_MP3_FALSE COND_OGG_TRUE COND_OGG_FALSE LIBOBJS LTLIBOBJS' +ac_subst_files='' + +# 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. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +ac_prev= +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 + + ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_option in + + -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 | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir=$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" ;; + + -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'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + 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 ;; + + -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 ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + 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 ;; + + -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'` + case $ac_option in + *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; + *) ac_optarg=yes ;; + esac + 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; }; } + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + 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 paths. +for ac_var in exec_prefix prefix +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* | NONE | '' ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +done + +# Be sure to have absolute paths. +for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ + localstatedir libdir includedir oldincludedir infodir mandir +do + eval ac_val=$`echo $ac_var` + case $ac_val in + [\\/$]* | ?:[\\/]* ) ;; + *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; };; + esac +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 + + +# 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 its parent. + ac_confdir=`(dirname "$0") 2>/dev/null || +$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 + if test "$ac_srcdir_defaulted" = yes; then + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 + { (exit 1); exit 1; }; } + else + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } + fi +fi +(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || + { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 + { (exit 1); exit 1; }; } +srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` +ac_env_build_alias_set=${build_alias+set} +ac_env_build_alias_value=$build_alias +ac_cv_env_build_alias_set=${build_alias+set} +ac_cv_env_build_alias_value=$build_alias +ac_env_host_alias_set=${host_alias+set} +ac_env_host_alias_value=$host_alias +ac_cv_env_host_alias_set=${host_alias+set} +ac_cv_env_host_alias_value=$host_alias +ac_env_target_alias_set=${target_alias+set} +ac_env_target_alias_value=$target_alias +ac_cv_env_target_alias_set=${target_alias+set} +ac_cv_env_target_alias_value=$target_alias +ac_env_CC_set=${CC+set} +ac_env_CC_value=$CC +ac_cv_env_CC_set=${CC+set} +ac_cv_env_CC_value=$CC +ac_env_CFLAGS_set=${CFLAGS+set} +ac_env_CFLAGS_value=$CFLAGS +ac_cv_env_CFLAGS_set=${CFLAGS+set} +ac_cv_env_CFLAGS_value=$CFLAGS +ac_env_LDFLAGS_set=${LDFLAGS+set} +ac_env_LDFLAGS_value=$LDFLAGS +ac_cv_env_LDFLAGS_set=${LDFLAGS+set} +ac_cv_env_LDFLAGS_value=$LDFLAGS +ac_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_env_CPPFLAGS_value=$CPPFLAGS +ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} +ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CXX_set=${CXX+set} +ac_env_CXX_value=$CXX +ac_cv_env_CXX_set=${CXX+set} +ac_cv_env_CXX_value=$CXX +ac_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_env_CXXFLAGS_value=$CXXFLAGS +ac_cv_env_CXXFLAGS_set=${CXXFLAGS+set} +ac_cv_env_CXXFLAGS_value=$CXXFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP +ac_env_PKG_CONFIG_set=${PKG_CONFIG+set} +ac_env_PKG_CONFIG_value=$PKG_CONFIG +ac_cv_env_PKG_CONFIG_set=${PKG_CONFIG+set} +ac_cv_env_PKG_CONFIG_value=$PKG_CONFIG +ac_env_SIGCPP2_CFLAGS_set=${SIGCPP2_CFLAGS+set} +ac_env_SIGCPP2_CFLAGS_value=$SIGCPP2_CFLAGS +ac_cv_env_SIGCPP2_CFLAGS_set=${SIGCPP2_CFLAGS+set} +ac_cv_env_SIGCPP2_CFLAGS_value=$SIGCPP2_CFLAGS +ac_env_SIGCPP2_LIBS_set=${SIGCPP2_LIBS+set} +ac_env_SIGCPP2_LIBS_value=$SIGCPP2_LIBS +ac_cv_env_SIGCPP2_LIBS_set=${SIGCPP2_LIBS+set} +ac_cv_env_SIGCPP2_LIBS_value=$SIGCPP2_LIBS +ac_env_GTKMM2_CFLAGS_set=${GTKMM2_CFLAGS+set} +ac_env_GTKMM2_CFLAGS_value=$GTKMM2_CFLAGS +ac_cv_env_GTKMM2_CFLAGS_set=${GTKMM2_CFLAGS+set} +ac_cv_env_GTKMM2_CFLAGS_value=$GTKMM2_CFLAGS +ac_env_GTKMM2_LIBS_set=${GTKMM2_LIBS+set} +ac_env_GTKMM2_LIBS_value=$GTKMM2_LIBS +ac_cv_env_GTKMM2_LIBS_set=${GTKMM2_LIBS+set} +ac_cv_env_GTKMM2_LIBS_value=$GTKMM2_LIBS +ac_env_LIBGUIMM2_CFLAGS_set=${LIBGUIMM2_CFLAGS+set} +ac_env_LIBGUIMM2_CFLAGS_value=$LIBGUIMM2_CFLAGS +ac_cv_env_LIBGUIMM2_CFLAGS_set=${LIBGUIMM2_CFLAGS+set} +ac_cv_env_LIBGUIMM2_CFLAGS_value=$LIBGUIMM2_CFLAGS +ac_env_LIBGUIMM2_LIBS_set=${LIBGUIMM2_LIBS+set} +ac_env_LIBGUIMM2_LIBS_value=$LIBGUIMM2_LIBS +ac_cv_env_LIBGUIMM2_LIBS_set=${LIBGUIMM2_LIBS+set} +ac_cv_env_LIBGUIMM2_LIBS_value=$LIBGUIMM2_LIBS +ac_env_VORBISFILE_CFLAGS_set=${VORBISFILE_CFLAGS+set} +ac_env_VORBISFILE_CFLAGS_value=$VORBISFILE_CFLAGS +ac_cv_env_VORBISFILE_CFLAGS_set=${VORBISFILE_CFLAGS+set} +ac_cv_env_VORBISFILE_CFLAGS_value=$VORBISFILE_CFLAGS +ac_env_VORBISFILE_LIBS_set=${VORBISFILE_LIBS+set} +ac_env_VORBISFILE_LIBS_value=$VORBISFILE_LIBS +ac_cv_env_VORBISFILE_LIBS_set=${VORBISFILE_LIBS+set} +ac_cv_env_VORBISFILE_LIBS_value=$VORBISFILE_LIBS +ac_env_MAD_CFLAGS_set=${MAD_CFLAGS+set} +ac_env_MAD_CFLAGS_value=$MAD_CFLAGS +ac_cv_env_MAD_CFLAGS_set=${MAD_CFLAGS+set} +ac_cv_env_MAD_CFLAGS_value=$MAD_CFLAGS +ac_env_MAD_LIBS_set=${MAD_LIBS+set} +ac_env_MAD_LIBS_value=$MAD_LIBS +ac_cv_env_MAD_LIBS_set=${MAD_LIBS+set} +ac_cv_env_MAD_LIBS_value=$MAD_LIBS +ac_env_AO_CFLAGS_set=${AO_CFLAGS+set} +ac_env_AO_CFLAGS_value=$AO_CFLAGS +ac_cv_env_AO_CFLAGS_set=${AO_CFLAGS+set} +ac_cv_env_AO_CFLAGS_value=$AO_CFLAGS +ac_env_AO_LIBS_set=${AO_LIBS+set} +ac_env_AO_LIBS_value=$AO_LIBS +ac_cv_env_AO_LIBS_set=${AO_LIBS+set} +ac_cv_env_AO_LIBS_value=$AO_LIBS + +# +# 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 cdrdao 1.2.3 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 \`..'] + +_ACEOF + + cat <<_ACEOF +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] + --datadir=DIR read-only architecture-independent data [PREFIX/share] + --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] + --infodir=DIR info documentation [PREFIX/info] + --mandir=DIR man documentation [PREFIX/man] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of cdrdao 1.2.3:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --disable-schemas-install Disable the schemas installation + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --disable-lame-test skip checking for right mp3lame library + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-gconf-source=sourceaddress Config database for installing schema files. + --with-gconf-schema-file-dir=dir Directory for installing schema files. + --with-pcctsbin=dir set directory of PCCTS parser generator executables + --with-pcctsinc=dir set directory of PCCTS parser generator includes + --with-linux-qnx-sched enable QNX real time scheduling for Linux + --with-posix-threads use Posix threads for ring buffer (default is YES) + --with-scglib use bundled libscg SCSI library (see INSTALL) (default is NO) + --with-xdao enable build of gcdmaster Gnome GUI front-end (default is YES) + --with-ogg-support enable OGG format support (default is YES) + --with-mp3-support enable MP3 format support (default is YES) + --with-lame enable building of toc2mp3 (default is YES) + --with-lame-lib=dir set directory containing libmp3lame + --with-lame-include=dir set directory containing lame include files + +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++ preprocessor flags, e.g. -I if you have + headers in a nonstandard directory + CXX C++ compiler command + CXXFLAGS C++ compiler flags + CPP C preprocessor + PKG_CONFIG path to pkg-config utility + SIGCPP2_CFLAGS + C compiler flags for SIGCPP2, overriding pkg-config + SIGCPP2_LIBS + linker flags for SIGCPP2, overriding pkg-config + GTKMM2_CFLAGS + C compiler flags for GTKMM2, overriding pkg-config + GTKMM2_LIBS linker flags for GTKMM2, overriding pkg-config + LIBGUIMM2_CFLAGS + C compiler flags for LIBGUIMM2, overriding pkg-config + LIBGUIMM2_LIBS + linker flags for LIBGUIMM2, overriding pkg-config + VORBISFILE_CFLAGS + C compiler flags for VORBISFILE, overriding pkg-config + VORBISFILE_LIBS + linker flags for VORBISFILE, overriding pkg-config + MAD_CFLAGS C compiler flags for MAD, overriding pkg-config + MAD_LIBS linker flags for MAD, overriding pkg-config + AO_CFLAGS C compiler flags for AO, overriding pkg-config + AO_LIBS linker flags for AO, overriding pkg-config + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +_ACEOF +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + ac_popdir=`pwd` + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d $ac_dir || continue + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + cd $ac_dir + # Check for guested configure; otherwise get Cygnus style 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 + elif test -f $ac_srcdir/configure.ac || + test -f $ac_srcdir/configure.in; then + echo + $ac_configure --help + else + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi + cd $ac_popdir + done +fi + +test -n "$ac_init_help" && exit 0 +if $ac_init_version; then + cat <<\_ACEOF +cdrdao configure 1.2.3 +generated by GNU Autoconf 2.59 + +Copyright (C) 2003 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 0 +fi +exec 5>config.log +cat >&5 <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by cdrdao $as_me 1.2.3, which was +generated by GNU Autoconf 2.59. Invocation command line was + + $ $0 $@ + +_ACEOF +{ +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` +hostinfo = `(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 + +} >&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_sep= +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_sep'$ac_arg'" + # Get rid of the leading space. + ac_sep=" " + ;; + 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: Be sure not to use single quotes in there, as some shells, +# such as our DU 5.0 friend, will then `close' the trap. +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, +{ + (set) 2>&1 | + case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in + *ac_space=\ *) + sed -n \ + "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" + ;; + *) + sed -n \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} + echo + + cat <<\_ASBOX +## ----------------- ## +## Output variables. ## +## ----------------- ## +_ASBOX + echo + for ac_var in $ac_subst_vars + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + + if test -n "$ac_subst_files"; then + cat <<\_ASBOX +## ------------- ## +## Output files. ## +## ------------- ## +_ASBOX + echo + for ac_var in $ac_subst_files + do + eval ac_val=$`echo $ac_var` + echo "$ac_var='"'"'$ac_val'"'"'" + done | sort + echo + fi + + if test -s confdefs.h; then + cat <<\_ASBOX +## ----------- ## +## confdefs.h. ## +## ----------- ## +_ASBOX + echo + sed "/^$/d" confdefs.h | sort + echo + fi + test "$ac_signal" != 0 && + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core && + rm -rf 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 -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo >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 -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; 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 `(set) 2>&1 | + sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; 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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +am__api_version="1.9" +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f $ac_dir/shtool; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 +echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} + { (exit 1); exit 1; }; } +fi +ac_config_guess="$SHELL $ac_aux_dir/config.guess" +ac_config_sub="$SHELL $ac_aux_dir/config.sub" +ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo "$as_me:$LINENO: checking whether build environment is sane" >&5 +echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 +# Just in case +sleep 1 +echo timestamp > conftest.file +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } +fi +echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +test "$program_prefix" != NONE && + program_transform_name="s,^,$program_prefix,;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$,$program_suffix,;$program_transform_name" +# Double any \ or $. echo might interpret backslashes. +# By default was `s,x,x', remove it if useless. +cat <<\_ACEOF >conftest.sed +s/[\\$]/&&/g;s/;s,x,x,$// +_ACEOF +program_transform_name=`echo $program_transform_name | sed -f conftest.sed` +rm conftest.sed + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 +echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then + # We used to keeping the `.' as first argument, in order to + # allow $(mkdir_p) to be used without argument. As in + # $(mkdir_p) $(somedir) + # where $(somedir) is conditionally defined. However this is wrong + # for two reasons: + # 1. if the package is installed by a user who cannot write `.' + # make install will fail, + # 2. the above comment should most certainly read + # $(mkdir_p) $(DESTDIR)$(somedir) + # so it does not work when $(somedir) is undefined and + # $(DESTDIR) is not. + # To support the latter case, we have to write + # test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir), + # so the `.' trick is pointless. + mkdir_p='mkdir -p --' +else + # On NextStep and OpenStep, the `mkdir' command does not + # recognize any option. It will interpret all options as + # directories to create, and then abort because `.' already + # exists. + for d in ./-p ./--version; + do + test -d $d && rmdir $d + done + # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists. + if test -f "$ac_aux_dir/mkinstalldirs"; then + mkdir_p='$(mkinstalldirs)' + else + mkdir_p='$(install_sh) -d' + fi +fi + +for ac_prog in gawk mawk nawk awk +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_AWK+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AWK="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + echo "$as_me:$LINENO: result: $AWK" >&5 +echo "${ECHO_T}$AWK" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$AWK" && break +done + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +# test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && + test -f $srcdir/config.status; then + { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='cdrdao' + VERSION='1.2.3' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +install_sh=${install_sh-"$am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; 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_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + echo "$as_me:$LINENO: result: $STRIP" >&5 +echo "${ECHO_T}$STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; 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_STRIP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_STRIP="strip" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +echo "${ECHO_T}$ac_ct_STRIP" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + STRIP=$ac_ct_STRIP +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + + ac_config_headers="$ac_config_headers config.h" + +echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5 +echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi; + echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5 +echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6 + + +if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + +# Make sure we can run config.sub. +$ac_config_sub sun4 >/dev/null 2>&1 || + { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 +echo "$as_me: error: cannot run $ac_config_sub" >&2;} + { (exit 1); exit 1; }; } + +echo "$as_me:$LINENO: checking build system type" >&5 +echo $ECHO_N "checking build system type... $ECHO_C" >&6 +if test "${ac_cv_build+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_build_alias=$build_alias +test -z "$ac_cv_build_alias" && + ac_cv_build_alias=`$ac_config_guess` +test -z "$ac_cv_build_alias" && + { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } +ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_build" >&5 +echo "${ECHO_T}$ac_cv_build" >&6 +build=$ac_cv_build +build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + +echo "$as_me:$LINENO: checking host system type" >&5 +echo $ECHO_N "checking host system type... $ECHO_C" >&6 +if test "${ac_cv_host+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_host_alias=$host_alias +test -z "$ac_cv_host_alias" && + ac_cv_host_alias=$ac_cv_build_alias +ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || + { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 +echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} + { (exit 1); exit 1; }; } + +fi +echo "$as_me:$LINENO: result: $ac_cv_host" >&5 +echo "${ECHO_T}$ac_cv_host" >&6 +host=$ac_cv_host +host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + + + + if test "x$GCONF_SCHEMA_INSTALL_SOURCE" = "x"; then + GCONF_SCHEMA_CONFIG_SOURCE=`gconftool-2 --get-default-source` + else + GCONF_SCHEMA_CONFIG_SOURCE=$GCONF_SCHEMA_INSTALL_SOURCE + fi + + +# Check whether --with-gconf-source or --without-gconf-source was given. +if test "${with_gconf_source+set}" = set; then + withval="$with_gconf_source" + GCONF_SCHEMA_CONFIG_SOURCE="$withval" +fi; + + + echo "$as_me:$LINENO: result: Using config source $GCONF_SCHEMA_CONFIG_SOURCE for schema installation" >&5 +echo "${ECHO_T}Using config source $GCONF_SCHEMA_CONFIG_SOURCE for schema installation" >&6 + + if test "x$GCONF_SCHEMA_FILE_DIR" = "x"; then + GCONF_SCHEMA_FILE_DIR='$(sysconfdir)/gconf/schemas' + fi + + +# Check whether --with-gconf-schema-file-dir or --without-gconf-schema-file-dir was given. +if test "${with_gconf_schema_file_dir+set}" = set; then + withval="$with_gconf_schema_file_dir" + GCONF_SCHEMA_FILE_DIR="$withval" +fi; + + + echo "$as_me:$LINENO: result: Using $GCONF_SCHEMA_FILE_DIR as install directory for schema files" >&5 +echo "${ECHO_T}Using $GCONF_SCHEMA_FILE_DIR as install directory for schema files" >&6 + + # Check whether --enable-schemas-install or --disable-schemas-install was given. +if test "${enable_schemas_install+set}" = set; then + enableval="$enable_schemas_install" + case ${enableval} in + yes|no) ;; + *) { { echo "$as_me:$LINENO: error: bad value ${enableval} for --enable-schemas-install" >&5 +echo "$as_me: error: bad value ${enableval} for --enable-schemas-install" >&2;} + { (exit 1); exit 1; }; } ;; + esac +fi; + + +if test "$enable_schemas_install" != no; then + GCONF_SCHEMAS_INSTALL_TRUE= + GCONF_SCHEMAS_INSTALL_FALSE='#' +else + GCONF_SCHEMAS_INSTALL_TRUE='#' + GCONF_SCHEMAS_INSTALL_FALSE= +fi + + + + +# Check whether --with-pcctsbin or --without-pcctsbin was given. +if test "${with_pcctsbin+set}" = set; then + withval="$with_pcctsbin" + pcctsbin=$withval +else + pcctsbin=default +fi; + + +# Check whether --with-pcctsinc or --without-pcctsinc was given. +if test "${with_pcctsinc+set}" = set; then + withval="$with_pcctsinc" + pcctsinc=$withval +else + pcctsinc=default +fi; + + +# Check whether --with-linux-qnx-sched or --without-linux-qnx-sched was given. +if test "${with_linux_qnx_sched+set}" = set; then + withval="$with_linux_qnx_sched" + +cat >>confdefs.h <<\_ACEOF +#define LINUX_QNX_SCHEDULING 1 +_ACEOF + +fi; + + +# Check whether --with-posix-threads or --without-posix-threads was given. +if test "${with_posix_threads+set}" = set; then + withval="$with_posix_threads" + use_pthreads=$withval +else + use_pthreads=default +fi; + + +# Check whether --with-scglib or --without-scglib was given. +if test "${with_scglib+set}" = set; then + withval="$with_scglib" + scglib=$withval +else + scglib=default +fi; + + +# Check whether --with-xdao or --without-xdao was given. +if test "${with_xdao+set}" = set; then + withval="$with_xdao" + xdao=$withval +else + xdao=default +fi; + + +# Check whether --with-ogg-support or --without-ogg-support was given. +if test "${with_ogg_support+set}" = set; then + withval="$with_ogg_support" + +else + with_ogg_support=yes +fi; + + +# Check whether --with-mp3-support or --without-mp3-support was given. +if test "${with_mp3_support+set}" = set; then + withval="$with_mp3_support" + +else + with_mp3_support=yes +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 $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 + +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 $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 + +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 + + CC=$ac_ct_CC +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 $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 + +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 "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_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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CC="cc" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +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 + + CC=$ac_ct_CC +else + CC="$ac_cv_prog_CC" +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 $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 + +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 + 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 $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 + +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 +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 $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 + +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 + + CC=$ac_ct_CC +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` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&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[^ ]*//'` +if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 + (eval $ac_link_default) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + # Find the output, starting from the most likely. This scheme is +# not robust to junk in `.', hence go to wildcards (a.*) only as a last +# resort. + +# Be careful to initialize this variable, since it used to be cached. +# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. +ac_cv_exeext= +# b.out is created by i960 compilers. +for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) + ;; + conftest.$ac_ext ) + # This is the source file. + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + # FIXME: I believe we export ac_cv_exeext for Libtool, + # but it would be cool to find out if it's true. Does anybody + # maintain Libtool? --akim. + export ac_cv_exeext + break;; + * ) + break;; + esac +done +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 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 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 { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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 | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + export ac_cv_exeext + 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *) 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 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 +CFLAGS="-g" +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 + 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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 + +ac_cv_prog_cc_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +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 ANSI C" >&5 +echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 +if test "${ac_cv_prog_cc_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_prog_cc_stdc=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 -std1 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 -std1. */ +int osf4_cc_array ['\x00' == 0 ? 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 +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX 10.20 and later -Ae +# HP-UX older versions -Aa -D_HPUX_SOURCE +# SVR4 -Xc -D__EXTENSIONS__ +for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cc_stdc=$ac_arg +break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext +done +rm -f conftest.$ac_ext conftest.$ac_objext +CC=$ac_save_CC + +fi + +case "x$ac_cv_prog_cc_stdc" in + x|xno) + echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6 ;; + *) + echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 + CC="$CC $ac_cv_prog_cc_stdc" ;; +esac + +# Some people use a C++ compiler to compile C. Since we use `exit', +# in C++ we need to declare it. In case someone uses the same compiler +# for both compiling C and C++ we need to have the C++ compiler decide +# the declaration of exit, since it's the most demanding environment. +cat >conftest.$ac_ext <<_ACEOF +#ifndef __cplusplus + choke me +#endif +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +fi + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +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 +DEPDIR="${am__leading_dot}deps" + + ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo done +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 +echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# We grep out `Entering directory' and `Leaving directory' +# messages which can occur if `w' ends up in MAKEFLAGS. +# In particular we don't look at `^make:' because GNU make might +# be invoked under some other name (usually "gmake"), in which +# case it prints its new name instead of `make'. +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then + am__include=include + am__quote= + _am_result=GNU +fi +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then + am__include=.include + am__quote="\"" + _am_result=BSD + fi +fi + + +echo "$as_me:$LINENO: result: $_am_result" >&5 +echo "${ECHO_T}$_am_result" >&6 +rm -f confinc confmf + +# Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then + enableval="$enable_dependency_tracking" + +fi; +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + + +if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + + +depcc="$CC" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu +if test -n "$ac_tool_prefix"; then + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC + 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_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$CXX"; then + ac_cv_prog_CXX="$CXX" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +CXX=$ac_cv_prog_CXX +if test -n "$CXX"; then + echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$CXX" && break + done +fi +if test -z "$CXX"; then + ac_ct_CXX=$CXX + for ac_prog in $CCC g++ c++ gpp aCC CC cxx cc++ cl FCC KCC RCC xlC_r xlC +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_CXX+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_CXX"; then + ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_CXX="$ac_prog" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +ac_ct_CXX=$ac_cv_prog_ac_ct_CXX +if test -n "$ac_ct_CXX"; then + echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 +echo "${ECHO_T}$ac_ct_CXX" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + test -n "$ac_ct_CXX" && break +done +test -n "$ac_ct_CXX" || ac_ct_CXX="g++" + + CXX=$ac_ct_CXX +fi + + +# Provide some information about the compiler. +echo "$as_me:$LINENO:" \ + "checking for C++ compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` +{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 + (eval $ac_compiler --version &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 + (eval $ac_compiler -v &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 + (eval $ac_compiler -V &5) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } + +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_cxx_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 { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_cxx_compiler_gnu=$ac_compiler_gnu + +fi +echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 +GXX=`test $ac_compiler_gnu = yes && echo yes` +ac_test_CXXFLAGS=${CXXFLAGS+set} +ac_save_CXXFLAGS=$CXXFLAGS +CXXFLAGS="-g" +echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 +echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 +if test "${ac_cv_prog_cxx_g+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.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_prog_cxx_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_prog_cxx_g=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS=$ac_save_CXXFLAGS +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +for ac_declaration in \ + '' \ + 'extern "C" void std::exit (int) throw (); using std::exit;' \ + 'extern "C" void std::exit (int); using std::exit;' \ + 'extern "C" void exit (int) throw ();' \ + 'extern "C" void exit (int);' \ + 'void exit (int);' +do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +#include +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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 + +continue +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_declaration +int +main () +{ +exit (42); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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_cxx_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +rm -f conftest* +if test -n "$ac_declaration"; then + echo '#ifdef __cplusplus' >>confdefs.h + echo $ac_declaration >>confdefs.h + echo '#endif' >>confdefs.h +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 + +depcc="$CXX" am_compiler_list= + +echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 +echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 +if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CXX_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + case $depmode in + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + none) break ;; + esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. + if depmode=$depmode \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CXX_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CXX_dependencies_compiler_type=none +fi + +fi +echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 +echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6 +CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type + + + +if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then + am__fastdepCXX_TRUE= + am__fastdepCXX_FALSE='#' +else + am__fastdepCXX_TRUE='#' + am__fastdepCXX_FALSE= +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 +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&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 + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + done + done + ;; +esac +done + + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL=$ac_install_sh + fi +fi +echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; 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_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; 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_RANLIB+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + + test -z "$ac_cv_prog_ac_ct_RANLIB" && ac_cv_prog_ac_ct_RANLIB=":" +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + RANLIB=$ac_ct_RANLIB +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +# Extract the first word of "ar", so it can be a program name with args. +set dummy ar; 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_AR+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_prog_AR="ar" + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` +if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.make <<\_ACEOF +all: + @echo 'ac_maketemp="$(MAKE)"' +_ACEOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftest.make +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + SET_MAKE= +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; 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_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$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 + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_ac_pt_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$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 + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG + +if test -n "$ac_pt_PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 +echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + PKG_CONFIG=$ac_pt_PKG_CONFIG +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + + + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+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. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo $ECHO_N "checking for sys/wait.h that is POSIX.1 compatible... $ECHO_C" >&6 +if test "${ac_cv_header_sys_wait_h+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. */ +#include +#include +#ifndef WEXITSTATUS +# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +#endif +#ifndef WIFEXITED +# define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif + +int +main () +{ + int s; + wait (&s); + s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_sys_wait_h=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_sys_wait_h=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_wait_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_wait_h" >&6 +if test $ac_cv_header_sys_wait_h = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SYS_WAIT_H 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+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. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Header=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + + + + + + + +for ac_header in fcntl.h getopt.h malloc.h unistd.h sys/mman.h sched.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## --------------------------------- ## +## Report this to the cdrdao lists. ## +## --------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6 +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_c_bigendian=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +# It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +short ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } +int +main () +{ + _ascii (); _ebcdic (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +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 () +{ + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_c_bigendian=no +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_c_bigendian=yes +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6 +case $ac_cv_c_bigendian in + yes) + +cat >>confdefs.h <<\_ACEOF +#define WORDS_BIGENDIAN 1 +_ACEOF + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + { (exit 1); exit 1; }; } ;; +esac + +echo "$as_me:$LINENO: checking return type of signal handlers" >&5 +echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 +if test "${ac_cv_type_signal+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. */ +#include +#include +#ifdef signal +# undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int +main () +{ +int i; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_signal=void +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_signal=int +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 +echo "${ECHO_T}$ac_cv_type_signal" >&6 + +cat >>confdefs.h <<_ACEOF +#define RETSIGTYPE $ac_cv_type_signal +_ACEOF + + +echo "$as_me:$LINENO: checking for short" >&5 +echo $ECHO_N "checking for short... $ECHO_C" >&6 +if test "${ac_cv_type_short+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. */ +$ac_includes_default +int +main () +{ +if ((short *) 0) + return 0; +if (sizeof (short)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_short=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_short=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5 +echo "${ECHO_T}$ac_cv_type_short" >&6 + +echo "$as_me:$LINENO: checking size of short" >&5 +echo $ECHO_N "checking size of short... $ECHO_C" >&6 +if test "${ac_cv_sizeof_short+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_short" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (short))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (short))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (short))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (short))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_short=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (short), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +long longval () { return (long) (sizeof (short)); } +unsigned long ulongval () { return (long) (sizeof (short)); } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (short))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (short)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (short)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_short=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (short), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (short), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val +else + ac_cv_sizeof_short=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5 +echo "${ECHO_T}$ac_cv_sizeof_short" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_SHORT $ac_cv_sizeof_short +_ACEOF + + +echo "$as_me:$LINENO: checking for int" >&5 +echo $ECHO_N "checking for int... $ECHO_C" >&6 +if test "${ac_cv_type_int+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. */ +$ac_includes_default +int +main () +{ +if ((int *) 0) + return 0; +if (sizeof (int)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_int=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_int=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 +echo "${ECHO_T}$ac_cv_type_int" >&6 + +echo "$as_me:$LINENO: checking size of int" >&5 +echo $ECHO_N "checking size of int... $ECHO_C" >&6 +if test "${ac_cv_sizeof_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_int" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (int))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (int))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (int))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (int))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_int=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +long longval () { return (long) (sizeof (int)); } +unsigned long ulongval () { return (long) (sizeof (int)); } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (int))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (int)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (int)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_int=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (int), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val +else + ac_cv_sizeof_int=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 +echo "${ECHO_T}$ac_cv_sizeof_int" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_INT $ac_cv_sizeof_int +_ACEOF + + +echo "$as_me:$LINENO: checking for long" >&5 +echo $ECHO_N "checking for long... $ECHO_C" >&6 +if test "${ac_cv_type_long+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. */ +$ac_includes_default +int +main () +{ +if ((long *) 0) + return 0; +if (sizeof (long)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_long=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_long=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 +echo "${ECHO_T}$ac_cv_type_long" >&6 + +echo "$as_me:$LINENO: checking size of long" >&5 +echo $ECHO_N "checking size of long... $ECHO_C" >&6 +if test "${ac_cv_sizeof_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_long" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_long=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +long longval () { return (long) (sizeof (long)); } +unsigned long ulongval () { return (long) (sizeof (long)); } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (long))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (long)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (long)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_long=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val +else + ac_cv_sizeof_long=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG $ac_cv_sizeof_long +_ACEOF + + +echo "$as_me:$LINENO: checking for long long" >&5 +echo $ECHO_N "checking for long long... $ECHO_C" >&6 +if test "${ac_cv_type_long_long+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. */ +$ac_includes_default +int +main () +{ +if ((long long *) 0) + return 0; +if (sizeof (long long)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_long_long=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_long_long=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 +echo "${ECHO_T}$ac_cv_type_long_long" >&6 + +echo "$as_me:$LINENO: checking size of long long" >&5 +echo $ECHO_N "checking size of long long... $ECHO_C" >&6 +if test "${ac_cv_sizeof_long_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if test "$ac_cv_type_long_long" = yes; then + # The cast to unsigned long works around a bug in the HP C Compiler + # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects + # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. + # This bug is HP SR number 8606223364. + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=0 ac_mid=0 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr $ac_mid + 1` + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long long))) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=-1 ac_mid=-1 + while :; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long long))) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_lo=$ac_mid; break +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_hi=`expr '(' $ac_mid ')' - 1` + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + ac_mid=`expr 2 '*' $ac_mid` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo= ac_hi= +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo` + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(((long) (sizeof (long long))) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_hi=$ac_mid +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_lo=`expr '(' $ac_mid ')' + 1` +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in +?*) ac_cv_sizeof_long_long=$ac_lo;; +'') { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long long), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } ;; +esac +else + if test "$cross_compiling" = yes; then + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot run test program while cross compiling +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +long longval () { return (long) (sizeof (long long)); } +unsigned long ulongval () { return (long) (sizeof (long long)); } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + exit (1); + if (((long) (sizeof (long long))) < 0) + { + long i = longval (); + if (i != ((long) (sizeof (long long)))) + exit (1); + fprintf (f, "%ld\n", i); + } + else + { + unsigned long i = ulongval (); + if (i != ((long) (sizeof (long long)))) + exit (1); + fprintf (f, "%lu\n", i); + } + exit (ferror (f) || fclose (f) != 0); + + ; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_long_long=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +{ { echo "$as_me:$LINENO: error: cannot compute sizeof (long long), 77 +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (long long), 77 +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +rm -f conftest.val +else + ac_cv_sizeof_long_long=0 +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6 +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long +_ACEOF + + + +case 2 in + $ac_cv_sizeof_short) + +cat >>confdefs.h <<\_ACEOF +#define size16 short +_ACEOF + + SIZE16="short";; + $ac_cv_sizeof_int) + +cat >>confdefs.h <<\_ACEOF +#define size16 int +_ACEOF + + SIZE16="int";; +esac + +case 4 in + $ac_cv_sizeof_short) SIZE32="short";; + $ac_cv_sizeof_int) SIZE32="int";; + $ac_cv_sizeof_long) SIZE32="long";; +esac + +echo "$as_me:$LINENO: checking for u_int8_t" >&5 +echo $ECHO_N "checking for u_int8_t... $ECHO_C" >&6 +if test "${ac_cv_type_u_int8_t+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. */ +$ac_includes_default +int +main () +{ +if ((u_int8_t *) 0) + return 0; +if (sizeof (u_int8_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_u_int8_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_u_int8_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_u_int8_t" >&5 +echo "${ECHO_T}$ac_cv_type_u_int8_t" >&6 +if test $ac_cv_type_u_int8_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define u_int8_t unsigned char +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for int16_t" >&5 +echo $ECHO_N "checking for int16_t... $ECHO_C" >&6 +if test "${ac_cv_type_int16_t+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. */ +$ac_includes_default +int +main () +{ +if ((int16_t *) 0) + return 0; +if (sizeof (int16_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_int16_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_int16_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_int16_t" >&5 +echo "${ECHO_T}$ac_cv_type_int16_t" >&6 +if test $ac_cv_type_int16_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define int16_t $SIZE16 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for int32_t" >&5 +echo $ECHO_N "checking for int32_t... $ECHO_C" >&6 +if test "${ac_cv_type_int32_t+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. */ +$ac_includes_default +int +main () +{ +if ((int32_t *) 0) + return 0; +if (sizeof (int32_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_int32_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_int32_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_int32_t" >&5 +echo "${ECHO_T}$ac_cv_type_int32_t" >&6 +if test $ac_cv_type_int32_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define int32_t $SIZE32 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for u_int16_t" >&5 +echo $ECHO_N "checking for u_int16_t... $ECHO_C" >&6 +if test "${ac_cv_type_u_int16_t+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. */ +$ac_includes_default +int +main () +{ +if ((u_int16_t *) 0) + return 0; +if (sizeof (u_int16_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_u_int16_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_u_int16_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_u_int16_t" >&5 +echo "${ECHO_T}$ac_cv_type_u_int16_t" >&6 +if test $ac_cv_type_u_int16_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define u_int16_t $SIZE16 +_ACEOF + +fi + +echo "$as_me:$LINENO: checking for u_int32_t" >&5 +echo $ECHO_N "checking for u_int32_t... $ECHO_C" >&6 +if test "${ac_cv_type_u_int32_t+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. */ +$ac_includes_default +int +main () +{ +if ((u_int32_t *) 0) + return 0; +if (sizeof (u_int32_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_u_int32_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_u_int32_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_u_int32_t" >&5 +echo "${ECHO_T}$ac_cv_type_u_int32_t" >&6 +if test $ac_cv_type_u_int32_t = yes; then + : +else + +cat >>confdefs.h <<_ACEOF +#define u_int32_t $SIZE32 +_ACEOF + +fi + + +if test -z "$SIZE16"; then + { { echo "$as_me:$LINENO: error: No 16 bit type found on this platform!" >&5 +echo "$as_me: error: No 16 bit type found on this platform!" >&2;} + { (exit 1); exit 1; }; } +fi + + +echo "$as_me:$LINENO: checking for sched_getparam" >&5 +echo $ECHO_N "checking for sched_getparam... $ECHO_C" >&6 +if test "${ac_cv_func_sched_getparam+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. */ +/* Define sched_getparam to an innocuous variant, in case declares sched_getparam. + For example, HP-UX 11i declares gettimeofday. */ +#define sched_getparam innocuous_sched_getparam + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char sched_getparam (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef sched_getparam + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char sched_getparam (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_sched_getparam) || defined (__stub___sched_getparam) +choke me +#else +char (*f) () = sched_getparam; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != sched_getparam; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_sched_getparam=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_sched_getparam=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_sched_getparam" >&5 +echo "${ECHO_T}$ac_cv_func_sched_getparam" >&6 +if test $ac_cv_func_sched_getparam = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SCHED_GETPARAM 1 +_ACEOF + +else + echo "$as_me:$LINENO: checking for sched_getparam in -lposix4" >&5 +echo $ECHO_N "checking for sched_getparam in -lposix4... $ECHO_C" >&6 +if test "${ac_cv_lib_posix4_sched_getparam+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lposix4 $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char sched_getparam (); +int +main () +{ +sched_getparam (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_posix4_sched_getparam=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_posix4_sched_getparam=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_posix4_sched_getparam" >&5 +echo "${ECHO_T}$ac_cv_lib_posix4_sched_getparam" >&6 +if test $ac_cv_lib_posix4_sched_getparam = yes; then + use_libposix4=yes;cat >>confdefs.h <<\_ACEOF +#define HAVE_SCHED_GETPARAM 1 +_ACEOF + +fi + +fi + + +echo "$as_me:$LINENO: checking for sched_get_priority_max" >&5 +echo $ECHO_N "checking for sched_get_priority_max... $ECHO_C" >&6 +if test "${ac_cv_func_sched_get_priority_max+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. */ +/* Define sched_get_priority_max to an innocuous variant, in case declares sched_get_priority_max. + For example, HP-UX 11i declares gettimeofday. */ +#define sched_get_priority_max innocuous_sched_get_priority_max + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char sched_get_priority_max (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef sched_get_priority_max + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char sched_get_priority_max (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_sched_get_priority_max) || defined (__stub___sched_get_priority_max) +choke me +#else +char (*f) () = sched_get_priority_max; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != sched_get_priority_max; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_sched_get_priority_max=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_sched_get_priority_max=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_sched_get_priority_max" >&5 +echo "${ECHO_T}$ac_cv_func_sched_get_priority_max" >&6 +if test $ac_cv_func_sched_get_priority_max = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SCHED_GET_PRIORITY_MAX 1 +_ACEOF + +else + echo "$as_me:$LINENO: checking for sched_get_priority_max in -lposix4" >&5 +echo $ECHO_N "checking for sched_get_priority_max in -lposix4... $ECHO_C" >&6 +if test "${ac_cv_lib_posix4_sched_get_priority_max+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lposix4 $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char sched_get_priority_max (); +int +main () +{ +sched_get_priority_max (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_posix4_sched_get_priority_max=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_posix4_sched_get_priority_max=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_posix4_sched_get_priority_max" >&5 +echo "${ECHO_T}$ac_cv_lib_posix4_sched_get_priority_max" >&6 +if test $ac_cv_lib_posix4_sched_get_priority_max = yes; then + use_libposix4=yes; +cat >>confdefs.h <<\_ACEOF +#define HAVE_SCHED_GET_PRIORITY_MAX 1 +_ACEOF + +fi + +fi + + +echo "$as_me:$LINENO: checking for sched_setscheduler" >&5 +echo $ECHO_N "checking for sched_setscheduler... $ECHO_C" >&6 +if test "${ac_cv_func_sched_setscheduler+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. */ +/* Define sched_setscheduler to an innocuous variant, in case declares sched_setscheduler. + For example, HP-UX 11i declares gettimeofday. */ +#define sched_setscheduler innocuous_sched_setscheduler + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char sched_setscheduler (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef sched_setscheduler + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char sched_setscheduler (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_sched_setscheduler) || defined (__stub___sched_setscheduler) +choke me +#else +char (*f) () = sched_setscheduler; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != sched_setscheduler; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_sched_setscheduler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_sched_setscheduler=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_sched_setscheduler" >&5 +echo "${ECHO_T}$ac_cv_func_sched_setscheduler" >&6 +if test $ac_cv_func_sched_setscheduler = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SCHED_SETSCHEDULER 1 +_ACEOF + +else + echo "$as_me:$LINENO: checking for sched_setscheduler in -lposix4" >&5 +echo $ECHO_N "checking for sched_setscheduler in -lposix4... $ECHO_C" >&6 +if test "${ac_cv_lib_posix4_sched_setscheduler+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lposix4 $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char sched_setscheduler (); +int +main () +{ +sched_setscheduler (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_posix4_sched_setscheduler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_posix4_sched_setscheduler=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_posix4_sched_setscheduler" >&5 +echo "${ECHO_T}$ac_cv_lib_posix4_sched_setscheduler" >&6 +if test $ac_cv_lib_posix4_sched_setscheduler = yes; then + use_libposix4=yes; +cat >>confdefs.h <<\_ACEOF +#define HAVE_SCHED_SETSCHEDULER 1 +_ACEOF + +fi + +fi + + +echo "$as_me:$LINENO: checking for socket in -lsocket" >&5 +echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_socket+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char socket (); +int +main () +{ +socket (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_socket_socket=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_socket_socket=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6 +if test $ac_cv_lib_socket_socket = yes; then + use_libsocket=yes +fi + +echo "$as_me:$LINENO: checking for connect in -lsocket" >&5 +echo $ECHO_N "checking for connect in -lsocket... $ECHO_C" >&6 +if test "${ac_cv_lib_socket_connect+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsocket $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char connect (); +int +main () +{ +connect (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_socket_connect=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_socket_connect=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_socket_connect" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_connect" >&6 +if test $ac_cv_lib_socket_connect = yes; then + use_libsocket=yes +fi + + +if test "$use_libsocket" = yes; then + LIBS="$LIBS -lsocket" +fi + +if test "$use_libposix4" = yes; then + LIBS="$LIBS -lposix4" +fi + + +for ac_func in strerror +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+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. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + +for ac_func in mlockall munlockall +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+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. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in getpagesize +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+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. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in usleep +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+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. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + + + + + +for ac_func in setreuid setregid seteuid setegid setuid setgid +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+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. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + +for ac_func in inet_aton +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+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. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +if test "$use_pthreads" = default; then + use_pthreads=yes +fi + +if test "$use_pthreads" = yes; then + echo "$as_me:$LINENO: checking for pthread_create" >&5 +echo $ECHO_N "checking for pthread_create... $ECHO_C" >&6 +if test "${ac_cv_func_pthread_create+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. */ +/* Define pthread_create to an innocuous variant, in case declares pthread_create. + For example, HP-UX 11i declares gettimeofday. */ +#define pthread_create innocuous_pthread_create + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char pthread_create (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef pthread_create + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_create (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_pthread_create) || defined (__stub___pthread_create) +choke me +#else +char (*f) () = pthread_create; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != pthread_create; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_pthread_create=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_func_pthread_create=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_func_pthread_create" >&5 +echo "${ECHO_T}$ac_cv_func_pthread_create" >&6 +if test $ac_cv_func_pthread_create = yes; then + have_pthread_std=yes +else + have_pthread_std=no +fi + + + if test "$have_pthread_std" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define USE_POSIX_THREADS 1 +_ACEOF + + thread_libs="" + thread_test_lib="" + else + echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5 +echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6 +if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_create (); +int +main () +{ +pthread_create (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pthread_pthread_create=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthread_pthread_create=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthread_pthread_create" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread_pthread_create" >&6 +if test $ac_cv_lib_pthread_pthread_create = yes; then + have_pthread=yes +else + have_pthread=no +fi + + + if test "$have_pthread" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define USE_POSIX_THREADS 1 +_ACEOF + + thread_libs="-lpthread" + thread_test_lib="pthread" + else + echo "$as_me:$LINENO: checking for pthread_create in -lpthread32" >&5 +echo $ECHO_N "checking for pthread_create in -lpthread32... $ECHO_C" >&6 +if test "${ac_cv_lib_pthread32_pthread_create+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpthread32 $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_create (); +int +main () +{ +pthread_create (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_pthread32_pthread_create=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_pthread32_pthread_create=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_pthread32_pthread_create" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread32_pthread_create" >&6 +if test $ac_cv_lib_pthread32_pthread_create = yes; then + have_pthread32=yes +else + have_pthread32=no +fi + + if test "$have_pthread32" = yes; then + cat >>confdefs.h <<\_ACEOF +#define USE_POSIX_THREADS 1 +_ACEOF + + thread_libs="-lpthread32" + thread_test_lib="pthread32" + else + echo "$as_me:$LINENO: checking for pthread_create in -lc_r" >&5 +echo $ECHO_N "checking for pthread_create in -lc_r... $ECHO_C" >&6 +if test "${ac_cv_lib_c_r_pthread_create+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lc_r $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_create (); +int +main () +{ +pthread_create (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_c_r_pthread_create=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_c_r_pthread_create=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_create" >&5 +echo "${ECHO_T}$ac_cv_lib_c_r_pthread_create" >&6 +if test $ac_cv_lib_c_r_pthread_create = yes; then + have_c_r=yes +else + have_c_r=no +fi + + + if test "$have_c_r" = yes; then + cat >>confdefs.h <<\_ACEOF +#define USE_POSIX_THREADS 1 +_ACEOF + + thread_libs="-lc_r" + thread_test_lib="c_r" + else + use_pthreads=no + fi + fi + fi + fi + + if test "$use_pthreads" = yes; then + if test "$have_pthread_std" = yes; then + + +for ac_func in pthread_sigmask pthread_attr_setschedpolicy +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+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. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + +for ac_func in pthread_attr_setschedparam pthread_getschedparam +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+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. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +for ac_func in pthread_setschedparam +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+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. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +{ +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +char (*f) () = $ac_func; +#endif +#ifdef __cplusplus +} +#endif + +int +main () +{ +return f != $ac_func; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_var=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + else + as_ac_Lib=`echo "ac_cv_lib_$thread_test_lib''_pthread_sigmask" | $as_tr_sh` +echo "$as_me:$LINENO: checking for pthread_sigmask in -l$thread_test_lib" >&5 +echo $ECHO_N "checking for pthread_sigmask in -l$thread_test_lib... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Lib+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$thread_test_lib $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_sigmask (); +int +main () +{ +pthread_sigmask (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Lib=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Lib=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Lib'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 +if test `eval echo '${'$as_ac_Lib'}'` = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_PTHREAD_SIGMASK 1 +_ACEOF + +fi + + as_ac_Lib=`echo "ac_cv_lib_$thread_test_lib''_pthread_attr_setschedpolicy" | $as_tr_sh` +echo "$as_me:$LINENO: checking for pthread_attr_setschedpolicy in -l$thread_test_lib" >&5 +echo $ECHO_N "checking for pthread_attr_setschedpolicy in -l$thread_test_lib... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Lib+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$thread_test_lib $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_attr_setschedpolicy (); +int +main () +{ +pthread_attr_setschedpolicy (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Lib=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Lib=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Lib'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 +if test `eval echo '${'$as_ac_Lib'}'` = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_PTHREAD_ATTR_SETSCHEDPOLICY 1 +_ACEOF + +fi + + as_ac_Lib=`echo "ac_cv_lib_$thread_test_lib''_pthread_attr_setschedparam" | $as_tr_sh` +echo "$as_me:$LINENO: checking for pthread_attr_setschedparam in -l$thread_test_lib" >&5 +echo $ECHO_N "checking for pthread_attr_setschedparam in -l$thread_test_lib... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Lib+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$thread_test_lib $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_attr_setschedparam (); +int +main () +{ +pthread_attr_setschedparam (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Lib=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Lib=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Lib'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 +if test `eval echo '${'$as_ac_Lib'}'` = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_PTHREAD_ATTR_SETSCHEDPARAM 1 +_ACEOF + +fi + + as_ac_Lib=`echo "ac_cv_lib_$thread_test_lib''_pthread_getschedparam" | $as_tr_sh` +echo "$as_me:$LINENO: checking for pthread_getschedparam in -l$thread_test_lib" >&5 +echo $ECHO_N "checking for pthread_getschedparam in -l$thread_test_lib... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Lib+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$thread_test_lib $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_getschedparam (); +int +main () +{ +pthread_getschedparam (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Lib=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Lib=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Lib'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 +if test `eval echo '${'$as_ac_Lib'}'` = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_PTHREAD_GETSCHEDPARAM 1 +_ACEOF + +fi + + as_ac_Lib=`echo "ac_cv_lib_$thread_test_lib''_pthread_setschedparam" | $as_tr_sh` +echo "$as_me:$LINENO: checking for pthread_setschedparam in -l$thread_test_lib" >&5 +echo $ECHO_N "checking for pthread_setschedparam in -l$thread_test_lib... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Lib+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-l$thread_test_lib $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char pthread_setschedparam (); +int +main () +{ +pthread_setschedparam (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_Lib=yes" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +eval "$as_ac_Lib=no" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Lib'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Lib'}'`" >&6 +if test `eval echo '${'$as_ac_Lib'}'` = yes; then + cat >>confdefs.h <<\_ACEOF +#define HAVE_PTHREAD_SETSCHEDPARAM 1 +_ACEOF + +fi + + fi + fi +fi + +if test "$use_pthreads" = yes; then + mydefs="-D_THREAD_SAFE -D_REENTRANT $mydefs" +fi + + +en_pccts="no" +if test "$pcctsbin" = default; then + antlr_path='$(srcdir)/../pccts/antlr/antlr' + dlg_path='$(srcdir)/../pccts/dlg/dlg' + + + en_pccts="yes" +else + # Extract the first word of "antlr", so it can be a program name with args. +set dummy antlr; 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_antlr_path+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $antlr_path in + [\\/]* | ?:[\\/]*) + ac_cv_path_antlr_path="$antlr_path" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $pcctsbin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_antlr_path="$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 + + test -z "$ac_cv_path_antlr_path" && ac_cv_path_antlr_path="no" + ;; +esac +fi +antlr_path=$ac_cv_path_antlr_path + +if test -n "$antlr_path"; then + echo "$as_me:$LINENO: result: $antlr_path" >&5 +echo "${ECHO_T}$antlr_path" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + # Extract the first word of "dlg", so it can be a program name with args. +set dummy dlg; 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_dlg_path+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $dlg_path in + [\\/]* | ?:[\\/]*) + ac_cv_path_dlg_path="$dlg_path" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $pcctsbin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_dlg_path="$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 + + test -z "$ac_cv_path_dlg_path" && ac_cv_path_dlg_path="no" + ;; +esac +fi +dlg_path=$ac_cv_path_dlg_path + +if test -n "$dlg_path"; then + echo "$as_me:$LINENO: result: $dlg_path" >&5 +echo "${ECHO_T}$dlg_path" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + + if test $antlr_path = "no" || test $dlg_path = "no"; then + { echo "$as_me:$LINENO: WARNING: PCCTS: antlr or dlg not found in path, using own." >&5 +echo "$as_me: WARNING: PCCTS: antlr or dlg not found in path, using own." >&2;} + antlr_path='$(srcdir)/../pccts/antlr/antlr' + dlg_path='$(srcdir)/../pccts/dlg/dlg' + en_pccts="yes" + fi +fi + + +if test "$pcctsinc" = default; then + pcctsinc='$(srcdir)/../pccts/h' + antlr_path='$(srcdir)/../pccts/antlr/antlr' + dlg_path='$(srcdir)/../pccts/dlg/dlg' + en_pccts="yes" +else + ac_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -I$pcctsinc" + if test "${ac_cv_header_pcctscfg_h+set}" = set; then + echo "$as_me:$LINENO: checking for pcctscfg.h" >&5 +echo $ECHO_N "checking for pcctscfg.h... $ECHO_C" >&6 +if test "${ac_cv_header_pcctscfg_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_pcctscfg_h" >&5 +echo "${ECHO_T}$ac_cv_header_pcctscfg_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking pcctscfg.h usability" >&5 +echo $ECHO_N "checking pcctscfg.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking pcctscfg.h presence" >&5 +echo $ECHO_N "checking pcctscfg.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: pcctscfg.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: pcctscfg.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: pcctscfg.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: pcctscfg.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: pcctscfg.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: pcctscfg.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: pcctscfg.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: pcctscfg.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: pcctscfg.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: pcctscfg.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: pcctscfg.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: pcctscfg.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: pcctscfg.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: pcctscfg.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: pcctscfg.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: pcctscfg.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## --------------------------------- ## +## Report this to the cdrdao lists. ## +## --------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for pcctscfg.h" >&5 +echo $ECHO_N "checking for pcctscfg.h... $ECHO_C" >&6 +if test "${ac_cv_header_pcctscfg_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_pcctscfg_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_pcctscfg_h" >&5 +echo "${ECHO_T}$ac_cv_header_pcctscfg_h" >&6 + +fi +if test $ac_cv_header_pcctscfg_h = yes; then + : +else + + { echo "$as_me:$LINENO: WARNING: PCCTS: headers not found in path, using own." >&5 +echo "$as_me: WARNING: PCCTS: headers not found in path, using own." >&2;} + pcctsinc='$(srcdir)/../pccts/h' + antlr_path='$(srcdir)/../pccts/antlr/antlr' + en_pccts="yes" +fi + + + CPPFLAGS="$ac_save_CPPFLAGS" +fi + +utiltools="toc2cue cue2toc" +en_cdrdao=yes +en_toc2cue=yes +en_cue2toc=yes +en_toc2mp3=no + + + # Check whether --enable-lame-test or --disable-lame-test was given. +if test "${enable_lame_test+set}" = set; then + enableval="$enable_lame_test" + lame_test=$enableval +else + lame_test=yes +fi; + +# Check whether --with-lame or --without-lame was given. +if test "${with_lame+set}" = set; then + withval="$with_lame" + lame=$withval +else + lame="yes" +fi; + +# Check whether --with-lame-lib or --without-lame-lib was given. +if test "${with_lame_lib+set}" = set; then + withval="$with_lame_lib" + lamelib=$withval +else + lamelib="" +fi; + +# Check whether --with-lame-include or --without-lame-include was given. +if test "${with_lame_include+set}" = set; then + withval="$with_lame_include" + lameinc=$withval +else + lameinc="" +fi; + + if test x$lame = xyes ; then + echo "$as_me:$LINENO: checking for Lame library version >= 3.92" >&5 +echo $ECHO_N "checking for Lame library version >= 3.92... $ECHO_C" >&6 + lame_ok=yes + else + lame_ok=no + lame_test=no + fi + + if test x$lame_test = xyes ; then + + + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + + ac_save_CXXFLAGS="$CXXFLAGS" + ac_save_LIBS="$LIBS" + + if test "x$lameinc" != x ; then + CXXFLAGS="$CXXFLAGS -I$lameinc" + fi + + if test "x$lamelib" != x ; then + LIBS="$LIBS -L$lamelib" + fi + + LIBS="$LIBS -lmp3lame" + + if test "$cross_compiling" = yes; then + echo $ac_n "cross compiling; assumed OK... $ac_c" +else + 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 +int +main () +{ + int major, minor; + char *tmp_version; + lame_version_t lame_version; + + /* HP/UX 0 (%@#!) writes to sscanf strings */ + tmp_version = strdup("3.92"); + if (sscanf(tmp_version, "%d.%d", &major, &minor) != 2) { + printf("%s, bad version string\n", "3.92"); + exit(1); + } + + get_lame_version_numerical(&lame_version); + + if (lame_version.major > major || + ((lame_version.major == major) && (lame_version.minor >= minor))) { + return 0; + } + else { + printf("\n*** An old version of LAME (%d.%d) was found.\n", + lame_version.major, lame_version.minor); + printf("*** You need a version of LAME newer than %d.%d. The latest version of\n", + major, minor); + printf("*** LAME is available from http://www.mp3dev.org/.\n"); + printf("*** However, it is very likely that slightly older versions of LAME\n"); + printf("*** will also work. If you want to try it, run configure with option\n"); + printf("*** --disable-lame-test. This will skip this check and assume that\n"); + printf("*** LAME is available for compiling.\n"); + } + + return 1; +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +lame_ok=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + CXXFLAGS="$ac_save_CXXFLAGS" + LIBS="$ac_save_LIBS" + + 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 + + fi + + LAME_CFLAGS="" + LAME_LIBS="" + + if test $lame_ok = yes ; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + + if test "x$lameinc" != x ; then + LAME_CFLAGS="-I$lameinc" + fi + + if test "x$lamelib" != x ; then + LAME_LIBS="-L$lamelib" + fi + + LAME_LIBS="$LAME_LIBS -lmp3lame" + + utiltools="$utiltools toc2mp3" en_toc2mp3=yes + else + if test x$lame = xyes ; then + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + fi + + echo "Building of toc2mp3 disabled" + fi + + + + + + +en_xdao=no +if test "$xdao" = default; then + xdao=yes +fi +if test "$xdao" = yes; then + en_xdao=yes + + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; 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_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$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 + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG + +if test -n "$PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +echo "${ECHO_T}$PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; 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_ac_pt_PKG_CONFIG+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # 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 $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_ac_pt_PKG_CONFIG="$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 + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG + +if test -n "$ac_pt_PKG_CONFIG"; then + echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 +echo "${ECHO_T}$ac_pt_PKG_CONFIG" >&6 +else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + + PKG_CONFIG=$ac_pt_PKG_CONFIG +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 +echo $ECHO_N "checking pkg-config is at least version $_pkg_min_version... $ECHO_C" >&6 + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + else + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + PKG_CONFIG="" + fi + +fi + +pkg_failed=no +echo "$as_me:$LINENO: checking for SIGCPP2" >&5 +echo $ECHO_N "checking for SIGCPP2... $ECHO_C" >&6 + +if test -n "$PKG_CONFIG"; then + if test -n "$SIGCPP2_CFLAGS"; then + pkg_cv_SIGCPP2_CFLAGS="$SIGCPP2_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"sigc++-2.0 >= 2.0.0\"") >&5 + ($PKG_CONFIG --exists --print-errors "sigc++-2.0 >= 2.0.0") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_SIGCPP2_CFLAGS=`$PKG_CONFIG --cflags "sigc++-2.0 >= 2.0.0" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$SIGCPP2_LIBS"; then + pkg_cv_SIGCPP2_LIBS="$SIGCPP2_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"sigc++-2.0 >= 2.0.0\"") >&5 + ($PKG_CONFIG --exists --print-errors "sigc++-2.0 >= 2.0.0") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_SIGCPP2_LIBS=`$PKG_CONFIG --libs "sigc++-2.0 >= 2.0.0" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + SIGCPP2_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "sigc++-2.0 >= 2.0.0"` + else + SIGCPP2_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "sigc++-2.0 >= 2.0.0"` + fi + # Put the nasty error message in config.log where it belongs + echo "$SIGCPP2_PKG_ERRORS" >&5 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + echo "Building of gcdmaster disabled"; en_xdao=no +elif test $pkg_failed = untried; then + echo "Building of gcdmaster disabled"; en_xdao=no +else + SIGCPP2_CFLAGS=$pkg_cv_SIGCPP2_CFLAGS + SIGCPP2_LIBS=$pkg_cv_SIGCPP2_LIBS + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + : +fi + +pkg_failed=no +echo "$as_me:$LINENO: checking for GTKMM2" >&5 +echo $ECHO_N "checking for GTKMM2... $ECHO_C" >&6 + +if test -n "$PKG_CONFIG"; then + if test -n "$GTKMM2_CFLAGS"; then + pkg_cv_GTKMM2_CFLAGS="$GTKMM2_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gtkmm-2.4 >= 2.4.0\"") >&5 + ($PKG_CONFIG --exists --print-errors "gtkmm-2.4 >= 2.4.0") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_GTKMM2_CFLAGS=`$PKG_CONFIG --cflags "gtkmm-2.4 >= 2.4.0" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$GTKMM2_LIBS"; then + pkg_cv_GTKMM2_LIBS="$GTKMM2_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gtkmm-2.4 >= 2.4.0\"") >&5 + ($PKG_CONFIG --exists --print-errors "gtkmm-2.4 >= 2.4.0") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_GTKMM2_LIBS=`$PKG_CONFIG --libs "gtkmm-2.4 >= 2.4.0" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GTKMM2_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "gtkmm-2.4 >= 2.4.0"` + else + GTKMM2_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gtkmm-2.4 >= 2.4.0"` + fi + # Put the nasty error message in config.log where it belongs + echo "$GTKMM2_PKG_ERRORS" >&5 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + echo "Building of gcdmaster disabled"; en_xdao=no +elif test $pkg_failed = untried; then + echo "Building of gcdmaster disabled"; en_xdao=no +else + GTKMM2_CFLAGS=$pkg_cv_GTKMM2_CFLAGS + GTKMM2_LIBS=$pkg_cv_GTKMM2_LIBS + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + : +fi + +pkg_failed=no +echo "$as_me:$LINENO: checking for LIBGUIMM2" >&5 +echo $ECHO_N "checking for LIBGUIMM2... $ECHO_C" >&6 + +if test -n "$PKG_CONFIG"; then + if test -n "$LIBGUIMM2_CFLAGS"; then + pkg_cv_LIBGUIMM2_CFLAGS="$LIBGUIMM2_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libgnomeuimm-2.6 >= 2.6.0\"") >&5 + ($PKG_CONFIG --exists --print-errors "libgnomeuimm-2.6 >= 2.6.0") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_LIBGUIMM2_CFLAGS=`$PKG_CONFIG --cflags "libgnomeuimm-2.6 >= 2.6.0" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$LIBGUIMM2_LIBS"; then + pkg_cv_LIBGUIMM2_LIBS="$LIBGUIMM2_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libgnomeuimm-2.6 >= 2.6.0\"") >&5 + ($PKG_CONFIG --exists --print-errors "libgnomeuimm-2.6 >= 2.6.0") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_LIBGUIMM2_LIBS=`$PKG_CONFIG --libs "libgnomeuimm-2.6 >= 2.6.0" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + LIBGUIMM2_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "libgnomeuimm-2.6 >= 2.6.0"` + else + LIBGUIMM2_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "libgnomeuimm-2.6 >= 2.6.0"` + fi + # Put the nasty error message in config.log where it belongs + echo "$LIBGUIMM2_PKG_ERRORS" >&5 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + echo "Building of gcdmaster disabled"; en_xdao=no +elif test $pkg_failed = untried; then + echo "Building of gcdmaster disabled"; en_xdao=no +else + LIBGUIMM2_CFLAGS=$pkg_cv_LIBGUIMM2_CFLAGS + LIBGUIMM2_LIBS=$pkg_cv_LIBGUIMM2_LIBS + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + : +fi +fi + + +if test "$scglib" = yes; then + scsilib_dir=scsilib + scsilib_incl='-I$(srcdir)/../scsilib/export -I$(srcdir)/../scsilib/export/libschily' + scsilib_libs="-L../scsilib/export" + en_scsilib="yes" + + scsilib_libs="$scsilib_libs -lscg -lschily" + scsilib_objs="ScsiIf-lib.o" + + case "$host" in + *-freebsd*) + scsilib_libs="$scsilib_libs -lcam" + ;; + esac + +else + + en_scsilib="no (using native interface)" + scsilib_dir="" + scsilib_incl="" + scsilib_libs="" + + case "$host" in + *-linux*) + scsilib_libs="" + scsilib_objs="ScsiIf-linux.o sg_err.o" + ;; + + *-freebsd*) + scsilib_libs="-lcam" + scsilib_objs="ScsiIf-freebsd-cam.o" + ;; + + *-netbsd*) + scsilib_libs="-lutil" + scsilib_objs="ScsiIf-netbsd.o" + ;; + + *-irix*) + scsilib_libs="" + scsilib_objs="ScsiIf-irix.o" + ;; + + *-darwin*) + scsilib_libs="-framework IOKit -framework CoreFoundation" + scsilib_objs="ScsiIf-osx.o" + ;; + + *-pc-cygwin*) + scsilib_libs="" + scsilib_objs="ScsiIf-win.o" + ;; + + *) + { { echo "$as_me:$LINENO: error: No native interface for operating system $host_os, use --with-libscg" >&5 +echo "$as_me: error: No native interface for operating system $host_os, use --with-libscg" >&2;} + { (exit 1); exit 1; }; } + ;; + esac +fi + +case "$host" in + *) + dao_src=dao.cc + ;; +esac + +case "$host" in + *-freebsd*) + if test "$use_pthreads" = yes; then + LDFLAGS="-pthread $LDFLAGS" + thread_libs="" + fi + ;; + *darwin*) + +cat >>confdefs.h <<\_ACEOF +#define _P1003_1B_VISIBLE 1 +_ACEOF + + LIBS="$LIBS -framework CoreServices -framework IOKit" + ;; + +esac + +case "$host" in + *-linux* | *-freebsd* | *-solaris*) + sound_if_obj=SoundIF-ao.o + ;; + + *) + sound_if_obj=SoundIF-none.o + ;; +esac + +if test "$with_ogg_support" = yes; then + +pkg_failed=no +echo "$as_me:$LINENO: checking for VORBISFILE" >&5 +echo $ECHO_N "checking for VORBISFILE... $ECHO_C" >&6 + +if test -n "$PKG_CONFIG"; then + if test -n "$VORBISFILE_CFLAGS"; then + pkg_cv_VORBISFILE_CFLAGS="$VORBISFILE_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"vorbisfile >= 1.0\"") >&5 + ($PKG_CONFIG --exists --print-errors "vorbisfile >= 1.0") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_VORBISFILE_CFLAGS=`$PKG_CONFIG --cflags "vorbisfile >= 1.0" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$VORBISFILE_LIBS"; then + pkg_cv_VORBISFILE_LIBS="$VORBISFILE_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"vorbisfile >= 1.0\"") >&5 + ($PKG_CONFIG --exists --print-errors "vorbisfile >= 1.0") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_VORBISFILE_LIBS=`$PKG_CONFIG --libs "vorbisfile >= 1.0" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + VORBISFILE_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "vorbisfile >= 1.0"` + else + VORBISFILE_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "vorbisfile >= 1.0"` + fi + # Put the nasty error message in config.log where it belongs + echo "$VORBISFILE_PKG_ERRORS" >&5 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + echo "OGG support disabled"; with_ogg_support=no +elif test $pkg_failed = untried; then + echo "OGG support disabled"; with_ogg_support=no +else + VORBISFILE_CFLAGS=$pkg_cv_VORBISFILE_CFLAGS + VORBISFILE_LIBS=$pkg_cv_VORBISFILE_LIBS + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + : +fi +fi + +if test "$with_mp3_support" = yes; then + +pkg_failed=no +echo "$as_me:$LINENO: checking for MAD" >&5 +echo $ECHO_N "checking for MAD... $ECHO_C" >&6 + +if test -n "$PKG_CONFIG"; then + if test -n "$MAD_CFLAGS"; then + pkg_cv_MAD_CFLAGS="$MAD_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"mad >= 0.10\"") >&5 + ($PKG_CONFIG --exists --print-errors "mad >= 0.10") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_MAD_CFLAGS=`$PKG_CONFIG --cflags "mad >= 0.10" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$MAD_LIBS"; then + pkg_cv_MAD_LIBS="$MAD_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"mad >= 0.10\"") >&5 + ($PKG_CONFIG --exists --print-errors "mad >= 0.10") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_MAD_LIBS=`$PKG_CONFIG --libs "mad >= 0.10" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + MAD_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "mad >= 0.10"` + else + MAD_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "mad >= 0.10"` + fi + # Put the nasty error message in config.log where it belongs + echo "$MAD_PKG_ERRORS" >&5 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + echo "libMAD detection via pkg-config failed"; with_mp3_support=no +elif test $pkg_failed = untried; then + echo "libMAD detection via pkg-config failed"; with_mp3_support=no +else + MAD_CFLAGS=$pkg_cv_MAD_CFLAGS + MAD_LIBS=$pkg_cv_MAD_LIBS + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + : +fi + if test "$with_mp3_support" = no; then + echo "$as_me:$LINENO: checking for mad_stream_init in -lmad" >&5 +echo $ECHO_N "checking for mad_stream_init in -lmad... $ECHO_C" >&6 +if test "${ac_cv_lib_mad_mad_stream_init+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lmad $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char mad_stream_init (); +int +main () +{ +mad_stream_init (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 + (eval $ac_link) 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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_mad_mad_stream_init=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_mad_mad_stream_init=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_mad_mad_stream_init" >&5 +echo "${ECHO_T}$ac_cv_lib_mad_mad_stream_init" >&6 +if test $ac_cv_lib_mad_mad_stream_init = yes; then + if test "${ac_cv_header_mad_h+set}" = set; then + echo "$as_me:$LINENO: checking for mad.h" >&5 +echo $ECHO_N "checking for mad.h... $ECHO_C" >&6 +if test "${ac_cv_header_mad_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +echo "$as_me:$LINENO: result: $ac_cv_header_mad_h" >&5 +echo "${ECHO_T}$ac_cv_header_mad_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking mad.h usability" >&5 +echo $ECHO_N "checking mad.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&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' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking mad.h presence" >&5 +echo $ECHO_N "checking mad.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 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); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: mad.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: mad.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: mad.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: mad.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: mad.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: mad.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: mad.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: mad.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: mad.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: mad.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: mad.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: mad.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: mad.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: mad.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: mad.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: mad.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## --------------------------------- ## +## Report this to the cdrdao lists. ## +## --------------------------------- ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for mad.h" >&5 +echo $ECHO_N "checking for mad.h... $ECHO_C" >&6 +if test "${ac_cv_header_mad_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_mad_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_mad_h" >&5 +echo "${ECHO_T}$ac_cv_header_mad_h" >&6 + +fi + + +fi + + if test "$ac_cv_lib_mad_mad_stream_init" = yes; then + + + MAD_LIBS="-lmad" + MAD_CFLAGS="" + with_mp3_support=yes + else + echo "MP3 support disabled"; with_mp3_support=no + fi + fi +fi + +if test "$with_mp3_support" = yes || test "$with_ogg_support" = yes || test "$en_xdao" = yes; then + +pkg_failed=no +echo "$as_me:$LINENO: checking for AO" >&5 +echo $ECHO_N "checking for AO... $ECHO_C" >&6 + +if test -n "$PKG_CONFIG"; then + if test -n "$AO_CFLAGS"; then + pkg_cv_AO_CFLAGS="$AO_CFLAGS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"ao >= 0.8\"") >&5 + ($PKG_CONFIG --exists --print-errors "ao >= 0.8") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_AO_CFLAGS=`$PKG_CONFIG --cflags "ao >= 0.8" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi +if test -n "$PKG_CONFIG"; then + if test -n "$AO_LIBS"; then + pkg_cv_AO_LIBS="$AO_LIBS" + else + if test -n "$PKG_CONFIG" && \ + { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"ao >= 0.8\"") >&5 + ($PKG_CONFIG --exists --print-errors "ao >= 0.8") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_AO_LIBS=`$PKG_CONFIG --libs "ao >= 0.8" 2>/dev/null` +else + pkg_failed=yes +fi + fi +else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + AO_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "ao >= 0.8"` + else + AO_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "ao >= 0.8"` + fi + # Put the nasty error message in config.log where it belongs + echo "$AO_PKG_ERRORS" >&5 + + echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6 + echo "Building of gcdmaster disabled"; with_ogg_support=no; + with_mp3_support=no; en_xdao=no +elif test $pkg_failed = untried; then + echo "Building of gcdmaster disabled"; with_ogg_support=no; + with_mp3_support=no; en_xdao=no +else + AO_CFLAGS=$pkg_cv_AO_CFLAGS + AO_LIBS=$pkg_cv_AO_LIBS + echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6 + +cat >>confdefs.h <<\_ACEOF +#define HAVE_AO 1 +_ACEOF + +fi +fi + +if test "$with_ogg_support" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_OGG_SUPPORT 1 +_ACEOF + +fi +if test "$with_mp3_support" = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_MP3_SUPPORT 1 +_ACEOF + +fi + + +case "$host" in + *-sysv4*) + mydefs="-DUNIXWARE $mydefs" + LIBS="$LIBS -L/usr/ucblib -lucb" + ;; +esac + + + + + + + + + + + + + + + + + + + + + +if test "$en_xdao" = yes; then + COND_XDAO_TRUE= + COND_XDAO_FALSE='#' +else + COND_XDAO_TRUE='#' + COND_XDAO_FALSE= +fi + + + +if test "$en_toc2mp3" = yes; then + COND_TOC2MP3_TRUE= + COND_TOC2MP3_FALSE='#' +else + COND_TOC2MP3_TRUE='#' + COND_TOC2MP3_FALSE= +fi + + + +if test "$en_scsilib" = yes; then + COND_SCSILIB_TRUE= + COND_SCSILIB_FALSE='#' +else + COND_SCSILIB_TRUE='#' + COND_SCSILIB_FALSE= +fi + + + +if test "$en_pccts" = yes; then + COND_PCCTS_TRUE= + COND_PCCTS_FALSE='#' +else + COND_PCCTS_TRUE='#' + COND_PCCTS_FALSE= +fi + + + +if test "$with_mp3_support" = yes; then + COND_MP3_TRUE= + COND_MP3_FALSE='#' +else + COND_MP3_TRUE='#' + COND_MP3_FALSE= +fi + + + +if test "$with_ogg_support" = yes; then + COND_OGG_TRUE= + COND_OGG_FALSE='#' +else + COND_OGG_TRUE='#' + COND_OGG_FALSE= +fi + + + ac_config_files="$ac_config_files trackdb/Makefile dao/Makefile utils/Makefile xdao/Makefile xdao/gcdmaster.schemas xdao/stock/Makefile paranoia/Makefile pccts/Makefile pccts/antlr/Makefile pccts/dlg/Makefile Makefile specs/cdrdao.fedora.spec" + + +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, don't put newlines in cache variables' values. +# 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. +{ + (set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *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 \ + "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + ;; + esac; +} | + sed ' + t clear + : clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + /^ac_cv_env/!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 "updating cache $cache_file" + cat confcache >$cache_file + else + echo "not updating unwritable cache $cache_file" + 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}' + +# 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 + +DEFS=-DHAVE_CONFIG_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_i=`echo "$ac_i" | + sed 's/\$U\././;s/\.o$//;s/\.obj$//'` + # 2. Add them. + ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${GCONF_SCHEMAS_INSTALL_TRUE}" && test -z "${GCONF_SCHEMAS_INSTALL_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"GCONF_SCHEMAS_INSTALL\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"GCONF_SCHEMAS_INSTALL\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${COND_XDAO_TRUE}" && test -z "${COND_XDAO_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"COND_XDAO\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"COND_XDAO\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${COND_TOC2MP3_TRUE}" && test -z "${COND_TOC2MP3_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"COND_TOC2MP3\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"COND_TOC2MP3\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${COND_SCSILIB_TRUE}" && test -z "${COND_SCSILIB_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"COND_SCSILIB\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"COND_SCSILIB\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${COND_PCCTS_TRUE}" && test -z "${COND_PCCTS_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"COND_PCCTS\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"COND_PCCTS\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${COND_MP3_TRUE}" && test -z "${COND_MP3_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"COND_MP3\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"COND_MP3\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${COND_OGG_TRUE}" && test -z "${COND_OGG_FALSE}"; then + { { echo "$as_me:$LINENO: error: conditional \"COND_OGG\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +echo "$as_me: error: conditional \"COND_OGG\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi + +: ${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+"$@"}'='"$@"' +elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then + set -o posix +fi +DUALCASE=1; export DUALCASE # for MKS sh + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + + +# Work around bugs in pre-3.0 UWIN ksh. +$as_unset ENV MAIL MAILPATH +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 + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1; 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'` + + +# PATH needs CR, and LINENO needs CR and PATH. +# 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 + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" || { + # Find who we are. Look in the path if we contain no path at all + # relative or not. + 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 + + ;; + 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_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 +echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} + { (exit 1); exit 1; }; } + fi + case $CONFIG_SHELL in + '') + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for as_base in sh bash ksh sh5; do + case $as_dir in + /*) + if ("$as_dir/$as_base" -c ' + as_lineno_1=$LINENO + as_lineno_2=$LINENO + as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then + $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } + $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } + CONFIG_SHELL=$as_dir/$as_base + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" ${1+"$@"} + fi;; + esac + done +done +;; + esac + + # 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 before each line; the second 'sed' does the real + # work. The second script uses 'N' to pair each line-number line + # with the numbered line, 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 + # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) + sed '=' <$as_myself | + sed ' + N + s,$,-, + : loop + s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + t loop + s,-$,, + s,^['$as_cr_digits']*\n,, + ' >$as_me.lineno && + chmod +x $as_me.lineno || + { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 +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 sensible to this). + . ./$as_me.lineno + # Exit status is that of the last command. + exit +} + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ECHO_T=' ' ;; + *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; + *) ECHO_N= ECHO_C='\c' ECHO_T= ;; +esac + +if expr a : '\(a\)' >/dev/null 2>&1; then + as_expr=expr +else + as_expr=false +fi + +rm -f conf$$ conf$$.exe conf$$.file +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + # We could just check for DJGPP; but this test a) works b) is more generic + # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). + if test -f conf$$.exe; then + # Don't use ln at all; we don't have any links + as_ln_s='cp -p' + else + as_ln_s='ln -s' + fi +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$$.file + +if mkdir -p . 2>/dev/null; then + as_mkdir_p=: +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +as_executable_p="test -f" + +# 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'" + + +# IFS +# We need space, tab and new line, in precisely that order. +as_nl=' +' +IFS=" $as_nl" + +# CDPATH. +$as_unset CDPATH + +exec 6>&1 + +# Open the log real soon, to keep \$[0] and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. Logging --version etc. is OK. +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX +} >&5 +cat >&5 <<_CSEOF + +This file was extended by cdrdao $as_me 1.2.3, which was +generated by GNU Autoconf 2.59. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +_CSEOF +echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 +echo >&5 +_ACEOF + +# Files that config.status was made for. +if test -n "$ac_config_files"; then + echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_headers"; then + echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_links"; then + echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS +fi + +if test -n "$ac_config_commands"; then + echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS +fi + +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 + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration commands: +$config_commands + +Report bugs to ." +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +ac_cs_version="\\ +cdrdao config.status 1.2.3 +configured by $0, generated by GNU Autoconf 2.59, + with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" + +Copyright (C) 2003 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." +srcdir=$srcdir +INSTALL="$INSTALL" +_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 + ;; + *) # This is not an option, so the user has probably given explicit + # arguments. + ac_option=$1 + ac_need_defaults=false;; + esac + + case $ac_option in + # Handling of the options. +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --vers* | -V ) + echo "$ac_cs_version"; exit 0 ;; + --he | --h) + # Conflict between --help and --header + { { echo "$as_me:$LINENO: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&5 +echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2;} + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + CONFIG_FILES="$CONFIG_FILES $ac_optarg" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" + ac_need_defaults=false;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&5 +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" ;; + + 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 $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF +# +# INIT-COMMANDS section. +# + +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + +_ACEOF + + + +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_config_target in $ac_config_targets +do + case "$ac_config_target" in + # Handling of arguments. + "trackdb/Makefile" ) CONFIG_FILES="$CONFIG_FILES trackdb/Makefile" ;; + "dao/Makefile" ) CONFIG_FILES="$CONFIG_FILES dao/Makefile" ;; + "utils/Makefile" ) CONFIG_FILES="$CONFIG_FILES utils/Makefile" ;; + "xdao/Makefile" ) CONFIG_FILES="$CONFIG_FILES xdao/Makefile" ;; + "xdao/gcdmaster.schemas" ) CONFIG_FILES="$CONFIG_FILES xdao/gcdmaster.schemas" ;; + "xdao/stock/Makefile" ) CONFIG_FILES="$CONFIG_FILES xdao/stock/Makefile" ;; + "paranoia/Makefile" ) CONFIG_FILES="$CONFIG_FILES paranoia/Makefile" ;; + "pccts/Makefile" ) CONFIG_FILES="$CONFIG_FILES pccts/Makefile" ;; + "pccts/antlr/Makefile" ) CONFIG_FILES="$CONFIG_FILES pccts/antlr/Makefile" ;; + "pccts/dlg/Makefile" ) CONFIG_FILES="$CONFIG_FILES pccts/dlg/Makefile" ;; + "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "specs/cdrdao.fedora.spec" ) CONFIG_FILES="$CONFIG_FILES specs/cdrdao.fedora.spec" ;; + "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; + *) { { 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 + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason to put it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Create a temporary directory, and hook for its removal unless debugging. +$debug || +{ + trap 'exit_status=$?; rm -rf $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 -q "./confstatXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./confstat$$-$RANDOM + (umask 077 && mkdir $tmp) +} || +{ + echo "$me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} + +_ACEOF + +cat >>$CONFIG_STATUS <<_ACEOF + +# +# 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 + # Protect against being on the right side of a sed subst in config.status. + sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; + s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF +s,@SHELL@,$SHELL,;t t +s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t +s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t +s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t +s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t +s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t +s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t +s,@exec_prefix@,$exec_prefix,;t t +s,@prefix@,$prefix,;t t +s,@program_transform_name@,$program_transform_name,;t t +s,@bindir@,$bindir,;t t +s,@sbindir@,$sbindir,;t t +s,@libexecdir@,$libexecdir,;t t +s,@datadir@,$datadir,;t t +s,@sysconfdir@,$sysconfdir,;t t +s,@sharedstatedir@,$sharedstatedir,;t t +s,@localstatedir@,$localstatedir,;t t +s,@libdir@,$libdir,;t t +s,@includedir@,$includedir,;t t +s,@oldincludedir@,$oldincludedir,;t t +s,@infodir@,$infodir,;t t +s,@mandir@,$mandir,;t t +s,@build_alias@,$build_alias,;t t +s,@host_alias@,$host_alias,;t t +s,@target_alias@,$target_alias,;t t +s,@DEFS@,$DEFS,;t t +s,@ECHO_C@,$ECHO_C,;t t +s,@ECHO_N@,$ECHO_N,;t t +s,@ECHO_T@,$ECHO_T,;t t +s,@LIBS@,$LIBS,;t t +s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t +s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t +s,@INSTALL_DATA@,$INSTALL_DATA,;t t +s,@CYGPATH_W@,$CYGPATH_W,;t t +s,@PACKAGE@,$PACKAGE,;t t +s,@VERSION@,$VERSION,;t t +s,@ACLOCAL@,$ACLOCAL,;t t +s,@AUTOCONF@,$AUTOCONF,;t t +s,@AUTOMAKE@,$AUTOMAKE,;t t +s,@AUTOHEADER@,$AUTOHEADER,;t t +s,@MAKEINFO@,$MAKEINFO,;t t +s,@install_sh@,$install_sh,;t t +s,@STRIP@,$STRIP,;t t +s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t +s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t +s,@mkdir_p@,$mkdir_p,;t t +s,@AWK@,$AWK,;t t +s,@SET_MAKE@,$SET_MAKE,;t t +s,@am__leading_dot@,$am__leading_dot,;t t +s,@AMTAR@,$AMTAR,;t t +s,@am__tar@,$am__tar,;t t +s,@am__untar@,$am__untar,;t t +s,@MAINTAINER_MODE_TRUE@,$MAINTAINER_MODE_TRUE,;t t +s,@MAINTAINER_MODE_FALSE@,$MAINTAINER_MODE_FALSE,;t t +s,@MAINT@,$MAINT,;t t +s,@build@,$build,;t t +s,@build_cpu@,$build_cpu,;t t +s,@build_vendor@,$build_vendor,;t t +s,@build_os@,$build_os,;t t +s,@host@,$host,;t t +s,@host_cpu@,$host_cpu,;t t +s,@host_vendor@,$host_vendor,;t t +s,@host_os@,$host_os,;t t +s,@GCONF_SCHEMA_CONFIG_SOURCE@,$GCONF_SCHEMA_CONFIG_SOURCE,;t t +s,@GCONF_SCHEMA_FILE_DIR@,$GCONF_SCHEMA_FILE_DIR,;t t +s,@GCONF_SCHEMAS_INSTALL_TRUE@,$GCONF_SCHEMAS_INSTALL_TRUE,;t t +s,@GCONF_SCHEMAS_INSTALL_FALSE@,$GCONF_SCHEMAS_INSTALL_FALSE,;t t +s,@CC@,$CC,;t t +s,@CFLAGS@,$CFLAGS,;t t +s,@LDFLAGS@,$LDFLAGS,;t t +s,@CPPFLAGS@,$CPPFLAGS,;t t +s,@ac_ct_CC@,$ac_ct_CC,;t t +s,@EXEEXT@,$EXEEXT,;t t +s,@OBJEXT@,$OBJEXT,;t t +s,@DEPDIR@,$DEPDIR,;t t +s,@am__include@,$am__include,;t t +s,@am__quote@,$am__quote,;t t +s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t +s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t +s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t +s,@CCDEPMODE@,$CCDEPMODE,;t t +s,@am__fastdepCC_TRUE@,$am__fastdepCC_TRUE,;t t +s,@am__fastdepCC_FALSE@,$am__fastdepCC_FALSE,;t t +s,@CXX@,$CXX,;t t +s,@CXXFLAGS@,$CXXFLAGS,;t t +s,@ac_ct_CXX@,$ac_ct_CXX,;t t +s,@CXXDEPMODE@,$CXXDEPMODE,;t t +s,@am__fastdepCXX_TRUE@,$am__fastdepCXX_TRUE,;t t +s,@am__fastdepCXX_FALSE@,$am__fastdepCXX_FALSE,;t t +s,@CPP@,$CPP,;t t +s,@RANLIB@,$RANLIB,;t t +s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t +s,@AR@,$AR,;t t +s,@PKG_CONFIG@,$PKG_CONFIG,;t t +s,@ac_pt_PKG_CONFIG@,$ac_pt_PKG_CONFIG,;t t +s,@EGREP@,$EGREP,;t t +s,@antlr_path@,$antlr_path,;t t +s,@dlg_path@,$dlg_path,;t t +s,@LAME_CFLAGS@,$LAME_CFLAGS,;t t +s,@LAME_LIBS@,$LAME_LIBS,;t t +s,@SIGCPP2_CFLAGS@,$SIGCPP2_CFLAGS,;t t +s,@SIGCPP2_LIBS@,$SIGCPP2_LIBS,;t t +s,@GTKMM2_CFLAGS@,$GTKMM2_CFLAGS,;t t +s,@GTKMM2_LIBS@,$GTKMM2_LIBS,;t t +s,@LIBGUIMM2_CFLAGS@,$LIBGUIMM2_CFLAGS,;t t +s,@LIBGUIMM2_LIBS@,$LIBGUIMM2_LIBS,;t t +s,@VORBISFILE_CFLAGS@,$VORBISFILE_CFLAGS,;t t +s,@VORBISFILE_LIBS@,$VORBISFILE_LIBS,;t t +s,@MAD_CFLAGS@,$MAD_CFLAGS,;t t +s,@MAD_LIBS@,$MAD_LIBS,;t t +s,@AO_CFLAGS@,$AO_CFLAGS,;t t +s,@AO_LIBS@,$AO_LIBS,;t t +s,@en_xdao@,$en_xdao,;t t +s,@en_toc2mp3@,$en_toc2mp3,;t t +s,@en_toc2cue@,$en_toc2cue,;t t +s,@en_cue2toc@,$en_cue2toc,;t t +s,@en_cdrdao@,$en_cdrdao,;t t +s,@scsilib_dir@,$scsilib_dir,;t t +s,@scsilib_incl@,$scsilib_incl,;t t +s,@scsilib_libs@,$scsilib_libs,;t t +s,@scsilib_objs@,$scsilib_objs,;t t +s,@pcctsinc@,$pcctsinc,;t t +s,@dao_src@,$dao_src,;t t +s,@sound_if_obj@,$sound_if_obj,;t t +s,@thread_libs@,$thread_libs,;t t +s,@mydefs@,$mydefs,;t t +s,@COND_XDAO_TRUE@,$COND_XDAO_TRUE,;t t +s,@COND_XDAO_FALSE@,$COND_XDAO_FALSE,;t t +s,@COND_TOC2MP3_TRUE@,$COND_TOC2MP3_TRUE,;t t +s,@COND_TOC2MP3_FALSE@,$COND_TOC2MP3_FALSE,;t t +s,@COND_SCSILIB_TRUE@,$COND_SCSILIB_TRUE,;t t +s,@COND_SCSILIB_FALSE@,$COND_SCSILIB_FALSE,;t t +s,@COND_PCCTS_TRUE@,$COND_PCCTS_TRUE,;t t +s,@COND_PCCTS_FALSE@,$COND_PCCTS_FALSE,;t t +s,@COND_MP3_TRUE@,$COND_MP3_TRUE,;t t +s,@COND_MP3_FALSE@,$COND_MP3_FALSE,;t t +s,@COND_OGG_TRUE@,$COND_OGG_TRUE,;t t +s,@COND_OGG_FALSE@,$COND_OGG_FALSE,;t t +s,@LIBOBJS@,$LIBOBJS,;t t +s,@LTLIBOBJS@,$LTLIBOBJS,;t t +CEOF + +_ACEOF + + cat >>$CONFIG_STATUS <<\_ACEOF + # Split the substitutions into bite-sized pieces for seds with + # small command number limits, like on Digital OSF/1 and HP-UX. + ac_max_sed_lines=48 + ac_sed_frag=1 # Number of current file. + ac_beg=1 # First line for current file. + ac_end=$ac_max_sed_lines # Line after last line for current file. + ac_more_lines=: + ac_sed_cmds= + while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + else + sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag + fi + if test ! -s $tmp/subs.frag; then + ac_more_lines=false + else + # The purpose of the label and of the branching condition is to + # speed up the sed processing (if there are no `@' at all, there + # is no need to browse any of the substitutions). + # These are the two extra sed commands mentioned above. + (echo ':t + /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" + else + ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" + fi + ac_sed_frag=`expr $ac_sed_frag + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_lines` + fi + done + if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat + fi +fi # test -n "$CONFIG_FILES" + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$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'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$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'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + esac + + if test x"$ac_file" != x-; then + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + rm -f "$ac_file" + fi + # 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. */ + if test x"$ac_file" = x-; then + configure_input= + else + configure_input="$ac_file. " + fi + configure_input=$configure_input"Generated from `echo $ac_file_in | + sed 's,.*/,,'` by configure." + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } +_ACEOF +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,@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,@top_builddir@,$ac_top_builddir,;t t +s,@abs_top_builddir@,$ac_abs_top_builddir,;t t +s,@INSTALL@,$ac_INSTALL,;t t +" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out + rm -f $tmp/stdin + if test x"$ac_file" != x-; then + mv $tmp/out $ac_file + else + cat $tmp/out + rm -f $tmp/out + fi + +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_HEADER section. +# + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='[ ].*$,\1#\2' +ac_dC=' ' +ac_dD=',;t' +# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='$,\1#\2define\3' +ac_uC=' ' +ac_uD=',;t' + +for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case $ac_file in + - | *:- | *:-:* ) # input from stdin + cat >$tmp/stdin + ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; + * ) ac_file_in=$ac_file.in ;; + esac + + test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + + # First look for the input files in the build tree, otherwise in the + # src tree. + ac_file_inputs=`IFS=: + for f in $ac_file_in; do + case $f in + -) echo $tmp/stdin ;; + [\\/$]*) + # Absolute (can't be DOS-style, as IFS=:) + test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + # Do quote $f, to prevent DOS paths from being IFS'd. + echo "$f";; + *) # Relative + if test -f "$f"; then + # Build tree + echo "$f" + elif test -f "$srcdir/$f"; then + # Source tree + echo "$srcdir/$f" + else + # /dev/null tree + { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 +echo "$as_me: error: cannot find input file: $f" >&2;} + { (exit 1); exit 1; }; } + fi;; + esac + done` || { (exit 1); exit 1; } + # Remove the trailing spaces. + sed 's/[ ]*$//' $ac_file_inputs >$tmp/in + +_ACEOF + +# Transform confdefs.h into two sed scripts, `conftest.defines' and +# `conftest.undefs', that substitutes the proper values into +# config.h.in to produce config.h. The first handles `#define' +# templates, and the second `#undef' templates. +# And first: Protect against being on the right side of a sed subst in +# config.status. Protect against being in an unquoted here document +# in config.status. +rm -f conftest.defines conftest.undefs +# Using a here document instead of a string reduces the quoting nightmare. +# Putting comments in sed scripts is not portable. +# +# `end' is used to avoid that the second main sed command (meant for +# 0-ary CPP macros) applies to n-ary macro definitions. +# See the Autoconf documentation for `clear'. +cat >confdef2sed.sed <<\_ACEOF +s/[\\&,]/\\&/g +s,[\\$`],\\&,g +t clear +: clear +s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp +t end +s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp +: end +_ACEOF +# If some macros were called several times there might be several times +# the same #defines, which is useless. Nevertheless, we may not want to +# sort them, since we want the *last* AC-DEFINE to be honored. +uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines +sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs +rm -f confdef2sed.sed + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >>conftest.undefs <<\_ACEOF +s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, +_ACEOF + +# Break up conftest.defines because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS +echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS +echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS +echo ' :' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.defines >/dev/null +do + # Write a limited-size here document to $tmp/defines.sed. + echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#define' lines. + echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/defines.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines +echo ' fi # grep' >>$CONFIG_STATUS +echo >>$CONFIG_STATUS + +# Break up conftest.undefs because some shells have a limit on the size +# of here documents, and old seds have small limits too (100 cmds). +echo ' # Handle all the #undef templates' >>$CONFIG_STATUS +rm -f conftest.tail +while grep . conftest.undefs >/dev/null +do + # Write a limited-size here document to $tmp/undefs.sed. + echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS + # Speed up: don't consider the non `#undef' + echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS + # Work around the forget-to-reset-the-flag bug. + echo 't clr' >>$CONFIG_STATUS + echo ': clr' >>$CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS + echo 'CEOF + sed -f $tmp/undefs.sed $tmp/in >$tmp/out + rm -f $tmp/in + mv $tmp/out $tmp/in +' >>$CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail + rm -f conftest.undefs + mv conftest.tail conftest.undefs +done +rm -f conftest.undefs + +cat >>$CONFIG_STATUS <<\_ACEOF + # 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. */ + if test x"$ac_file" = x-; then + echo "/* Generated by configure. */" >$tmp/config.h + else + echo "/* $ac_file. Generated by configure. */" >$tmp/config.h + fi + cat $tmp/in >>$tmp/config.h + rm -f $tmp/in + if test x"$ac_file" != x-; then + if diff $ac_file $tmp/config.h >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} + else + ac_dir=`(dirname "$ac_file") 2>/dev/null || +$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'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$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'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + rm -f $ac_file + mv $tmp/config.h $ac_file + fi + else + cat $tmp/config.h + rm -f $tmp/config.h + fi +# Compute $ac_file's index in $config_headers. +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $ac_file | $ac_file:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $ac_file" >`(dirname $ac_file) 2>/dev/null || +$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'`/stamp-h$_am_stamp_count +done +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF + +# +# CONFIG_COMMANDS section. +# +for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue + ac_dest=`echo "$ac_file" | sed 's,:.*,,'` + ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` + ac_dir=`(dirname "$ac_dest") 2>/dev/null || +$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_dest" : 'X\(//\)[^/]' \| \ + X"$ac_dest" : 'X\(//\)$' \| \ + X"$ac_dest" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$ac_dest" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p "$ac_dir" + else + as_dir="$ac_dir" + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$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'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 +echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} + { (exit 1); exit 1; }; }; } + + ac_builddir=. + +if test "$ac_dir" != .; then + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A "../" for each directory in $ac_dir_suffix. + ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` +else + ac_dir_suffix= ac_top_builddir= +fi + +case $srcdir in + .) # No --srcdir option. We are building in place. + ac_srcdir=. + if test -z "$ac_top_builddir"; then + ac_top_srcdir=. + else + ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` + fi ;; + [\\/]* | ?:[\\/]* ) # Absolute path. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir ;; + *) # Relative path. + ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_builddir$srcdir ;; +esac + +# Do not use `cd foo && pwd` to compute absolute paths, because +# the directories may not exist. +case `pwd` in +.) ac_abs_builddir="$ac_dir";; +*) + case "$ac_dir" in + .) ac_abs_builddir=`pwd`;; + [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; + *) ac_abs_builddir=`pwd`/"$ac_dir";; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_builddir=${ac_top_builddir}.;; +*) + case ${ac_top_builddir}. in + .) ac_abs_top_builddir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; + *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_srcdir=$ac_srcdir;; +*) + case $ac_srcdir in + .) ac_abs_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; + *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; + esac;; +esac +case $ac_abs_builddir in +.) ac_abs_top_srcdir=$ac_top_srcdir;; +*) + case $ac_top_srcdir in + .) ac_abs_top_srcdir=$ac_abs_builddir;; + [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; + *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; + esac;; +esac + + + { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 +echo "$as_me: executing $ac_dest commands" >&6;} + case $ac_dest in + depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # So let's grep whole file. + if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then + dirpart=`(dirname "$mf") 2>/dev/null || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`(dirname "$file") 2>/dev/null || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| \ + . : '\(.\)' 2>/dev/null || +echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } + /^X\(\/\/\)[^/].*/{ s//\1/; q; } + /^X\(\/\/\)$/{ s//\1/; q; } + /^X\(\/\).*/{ s//\1/; q; } + s/.*/./; q'` + { if $as_mkdir_p; then + mkdir -p $dirpart/$fdir + else + as_dir=$dirpart/$fdir + as_dirs= + while test ! -d "$as_dir"; do + as_dirs="$as_dir $as_dirs" + as_dir=`(dirname "$as_dir") 2>/dev/null || +$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'` + done + test ! -n "$as_dirs" || mkdir $as_dirs + fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 +echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} + { (exit 1); exit 1; }; }; } + + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done +done + ;; + esac +done +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF + +{ (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 + + +echo +echo "------------------------------------------------------" +echo " Building scsilib : $en_scsilib" +echo " Building pccts : $en_pccts" +echo " Building cdrdao : $en_cdrdao" +echo " OGG support : $with_ogg_support" +echo " MP3 support : $with_mp3_support" +echo " Building toc2cue : $en_toc2cue" +echo " Building cue2toc : $en_cue2toc" +echo " Building toc2mp3 : $en_toc2mp3" +echo " Building gcdmaster : $en_xdao" +echo "------------------------------------------------------" diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..4fa199b --- /dev/null +++ b/configure.ac @@ -0,0 +1,425 @@ +dnl Process this file with autoconf to produce a configure script. +AC_REVISION($Revision: 1.25 $)dnl + +AC_INIT(cdrdao, 1.2.3) + +AC_CONFIG_SRCDIR(dao/main.cc) +AM_INIT_AUTOMAKE +AM_CONFIG_HEADER(config.h) +AM_MAINTAINER_MODE +AC_CANONICAL_HOST +AM_GCONF_SOURCE_2 + +AC_ARG_WITH(pcctsbin,[ --with-pcctsbin=dir set directory of PCCTS parser generator executables],[pcctsbin=$withval],[pcctsbin=default]) + +AC_ARG_WITH(pcctsinc,[ --with-pcctsinc=dir set directory of PCCTS parser generator includes],[pcctsinc=$withval],[pcctsinc=default]) + +AC_ARG_WITH(linux-qnx-sched,[ --with-linux-qnx-sched enable QNX real time scheduling for Linux],[AC_DEFINE(LINUX_QNX_SCHEDULING,1,"Use real time scheduling for Linux")]) + +AC_ARG_WITH(posix-threads,[ --with-posix-threads use Posix threads for ring buffer (default is YES)],[use_pthreads=$withval],[use_pthreads=default]) + +AC_ARG_WITH(scglib,[ --with-scglib use bundled libscg SCSI library (see INSTALL) (default is NO)],[scglib=$withval],[scglib=default]) + +AC_ARG_WITH(xdao,[ --with-xdao enable build of gcdmaster Gnome GUI front-end (default is YES)],[xdao=$withval],[xdao=default]) + +AC_ARG_WITH(ogg-support,[ --with-ogg-support enable OGG format support (default is YES)],[],[with_ogg_support=yes]) + +AC_ARG_WITH(mp3-support,[ --with-mp3-support enable MP3 format support (default is YES)],[],[with_mp3_support=yes]) + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_CXX +AC_PROG_CPP +AC_PROG_INSTALL +AC_PROG_RANLIB +AC_CHECK_PROG(AR,ar,ar) +AC_PROG_MAKE_SET +AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) + +dnl Checks for header files. +AC_HEADER_STDC +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS(fcntl.h getopt.h malloc.h unistd.h sys/mman.h sched.h) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_BIGENDIAN +AC_TYPE_SIGNAL +AC_CHECK_SIZEOF(short) +AC_CHECK_SIZEOF(int) +AC_CHECK_SIZEOF(long) +AC_CHECK_SIZEOF(long long) + +case 2 in + $ac_cv_sizeof_short) + AC_DEFINE(size16,short,"") + SIZE16="short";; + $ac_cv_sizeof_int) + AC_DEFINE(size16,int,"") + SIZE16="int";; +esac + +case 4 in + $ac_cv_sizeof_short) SIZE32="short";; + $ac_cv_sizeof_int) SIZE32="int";; + $ac_cv_sizeof_long) SIZE32="long";; +esac + +AC_CHECK_TYPE(u_int8_t, unsigned char) +AC_CHECK_TYPE(int16_t,,AC_DEFINE_UNQUOTED(int16_t,$SIZE16,"")) +AC_CHECK_TYPE(int32_t,,AC_DEFINE_UNQUOTED(int32_t,$SIZE32,"")) +AC_CHECK_TYPE(u_int16_t,,AC_DEFINE_UNQUOTED(u_int16_t,$SIZE16,"")) +AC_CHECK_TYPE(u_int32_t,,AC_DEFINE_UNQUOTED(u_int32_t,$SIZE32,"")) + +if test -z "$SIZE16"; then + AC_MSG_ERROR(No 16 bit type found on this platform!) +fi + +dnl Check for additionally required libraries + +AC_CHECK_FUNC(sched_getparam,AC_DEFINE(HAVE_SCHED_GETPARAM,1,""), + AC_CHECK_LIB(posix4,sched_getparam,[use_libposix4=yes;AC_DEFINE(HAVE_SCHED_GETPARAM)])) + +AC_CHECK_FUNC(sched_get_priority_max,AC_DEFINE(HAVE_SCHED_GET_PRIORITY_MAX,1,""), + AC_CHECK_LIB(posix4,sched_get_priority_max,[use_libposix4=yes;AC_DEFINE(HAVE_SCHED_GET_PRIORITY_MAX,1,"")])) + +AC_CHECK_FUNC(sched_setscheduler,AC_DEFINE(HAVE_SCHED_SETSCHEDULER,1,""), + AC_CHECK_LIB(posix4,sched_setscheduler,[use_libposix4=yes;AC_DEFINE(HAVE_SCHED_SETSCHEDULER,1,"")])) + +AC_CHECK_LIB(socket,socket,[use_libsocket=yes]) +AC_CHECK_LIB(socket,connect,[use_libsocket=yes]) + +dnl Add 'libsocket' if required +if test "$use_libsocket" = yes; then + LIBS="$LIBS -lsocket" +fi + +dnl Check if libposix4 must be linked +if test "$use_libposix4" = yes; then + LIBS="$LIBS -lposix4" +fi + +dnl Checks for library functions. +AC_CHECK_FUNCS(strerror) +AC_CHECK_FUNCS(mlockall munlockall) +AC_CHECK_FUNCS(getpagesize) +AC_CHECK_FUNCS(usleep) +AC_CHECK_FUNCS(setreuid setregid seteuid setegid setuid setgid) + +AC_CHECK_FUNCS(inet_aton) + +dnl check if Posix threads should be used +if test "$use_pthreads" = default; then + use_pthreads=yes +fi + +if test "$use_pthreads" = yes; then + AC_CHECK_FUNC(pthread_create,have_pthread_std=yes,have_pthread_std=no) + + if test "$have_pthread_std" = yes; then + AC_DEFINE(USE_POSIX_THREADS,1,"") + thread_libs="" + thread_test_lib="" + else + AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes,have_pthread=no) + + if test "$have_pthread" = yes; then + AC_DEFINE(USE_POSIX_THREADS,1,"") + thread_libs="-lpthread" + thread_test_lib="pthread" + else + AC_CHECK_LIB(pthread32,pthread_create,have_pthread32=yes,have_pthread32=no) + if test "$have_pthread32" = yes; then + AC_DEFINE(USE_POSIX_THREADS) + thread_libs="-lpthread32" + thread_test_lib="pthread32" + else + AC_CHECK_LIB(c_r,pthread_create,have_c_r=yes,have_c_r=no) + + if test "$have_c_r" = yes; then + AC_DEFINE(USE_POSIX_THREADS) + thread_libs="-lc_r" + thread_test_lib="c_r" + else + use_pthreads=no + fi + fi + fi + fi + + if test "$use_pthreads" = yes; then + if test "$have_pthread_std" = yes; then + AC_CHECK_FUNCS(pthread_sigmask pthread_attr_setschedpolicy) + AC_CHECK_FUNCS(pthread_attr_setschedparam pthread_getschedparam) + AC_CHECK_FUNCS(pthread_setschedparam) + else + AC_CHECK_LIB($thread_test_lib,pthread_sigmask,AC_DEFINE(HAVE_PTHREAD_SIGMASK)) + AC_CHECK_LIB($thread_test_lib,pthread_attr_setschedpolicy,AC_DEFINE(HAVE_PTHREAD_ATTR_SETSCHEDPOLICY)) + AC_CHECK_LIB($thread_test_lib,pthread_attr_setschedparam,AC_DEFINE(HAVE_PTHREAD_ATTR_SETSCHEDPARAM)) + AC_CHECK_LIB($thread_test_lib,pthread_getschedparam,AC_DEFINE(HAVE_PTHREAD_GETSCHEDPARAM)) + AC_CHECK_LIB($thread_test_lib,pthread_setschedparam,AC_DEFINE(HAVE_PTHREAD_SETSCHEDPARAM)) + fi + fi +fi + +if test "$use_pthreads" = yes; then + mydefs="-D_THREAD_SAFE -D_REENTRANT $mydefs" +fi + + +dnl Checks for pccts parser generator +en_pccts="no" +if test "$pcctsbin" = default; then + antlr_path='$(srcdir)/../pccts/antlr/antlr' + dlg_path='$(srcdir)/../pccts/dlg/dlg' + + + en_pccts="yes" +else + AC_PATH_PROG(antlr_path,antlr,no,$pcctsbin) + AC_PATH_PROG(dlg_path,dlg,no,$pcctsbin) + + if test $antlr_path = "no" || test $dlg_path = "no"; then + AC_MSG_WARN([PCCTS: antlr or dlg not found in path, using own.]) + antlr_path='$(srcdir)/../pccts/antlr/antlr' + dlg_path='$(srcdir)/../pccts/dlg/dlg' + en_pccts="yes" + fi +fi + + +if test "$pcctsinc" = default; then + pcctsinc='$(srcdir)/../pccts/h' + antlr_path='$(srcdir)/../pccts/antlr/antlr' + dlg_path='$(srcdir)/../pccts/dlg/dlg' + en_pccts="yes" +else + ac_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -I$pcctsinc" + AC_CHECK_HEADER(pcctscfg.h,,[ + AC_MSG_WARN([PCCTS: headers not found in path, using own.]) + pcctsinc='$(srcdir)/../pccts/h' + antlr_path='$(srcdir)/../pccts/antlr/antlr' + en_pccts="yes"]) + CPPFLAGS="$ac_save_CPPFLAGS" +fi + +utiltools="toc2cue cue2toc" +en_cdrdao=yes +en_toc2cue=yes +en_cue2toc=yes +en_toc2mp3=no + +AC_PATH_LAME(3.92, [utiltools="$utiltools toc2mp3" en_toc2mp3=yes], + [echo "Building of toc2mp3 disabled"]) + +dnl Determine whether we're building the gcdaster GUI front-end +en_xdao=no +if test "$xdao" = default; then + xdao=yes +fi +if test "$xdao" = yes; then + en_xdao=yes + PKG_CHECK_MODULES(SIGCPP2, sigc++-2.0 >= 2.0.0,[], + [echo "Building of gcdmaster disabled"; en_xdao=no]) + PKG_CHECK_MODULES(GTKMM2, gtkmm-2.4 >= 2.4.0,[], + [echo "Building of gcdmaster disabled"; en_xdao=no]) + PKG_CHECK_MODULES(LIBGUIMM2, libgnomeuimm-2.6 >= 2.6.0,[], + [echo "Building of gcdmaster disabled"; en_xdao=no]) +fi + +dnl Determine source for scsi interface class + +if test "$scglib" = yes; then + scsilib_dir=scsilib + scsilib_incl='-I$(srcdir)/../scsilib/export -I$(srcdir)/../scsilib/export/libschily' + scsilib_libs="-L../scsilib/export" + en_scsilib="yes" + + scsilib_libs="$scsilib_libs -lscg -lschily" + scsilib_objs="ScsiIf-lib.o" + + case "$host" in + *-freebsd*) + scsilib_libs="$scsilib_libs -lcam" + ;; + esac + +else + + en_scsilib="no (using native interface)" + scsilib_dir="" + scsilib_incl="" + scsilib_libs="" + + case "$host" in + *-linux*) + scsilib_libs="" + scsilib_objs="ScsiIf-linux.o sg_err.o" + ;; + + *-freebsd*) + scsilib_libs="-lcam" + scsilib_objs="ScsiIf-freebsd-cam.o" + ;; + + *-netbsd*) + scsilib_libs="-lutil" + scsilib_objs="ScsiIf-netbsd.o" + ;; + + *-irix*) + scsilib_libs="" + scsilib_objs="ScsiIf-irix.o" + ;; + + *-darwin*) + scsilib_libs="-framework IOKit -framework CoreFoundation" + scsilib_objs="ScsiIf-osx.o" + ;; + + *-pc-cygwin*) + scsilib_libs="" + scsilib_objs="ScsiIf-win.o" + ;; + + *) + AC_MSG_ERROR([No native interface for operating system $host_os, use --with-libscg]) + ;; + esac +fi + +dnl Selection of buffer code +case "$host" in + *) + dao_src=dao.cc + ;; +esac + +dnl Additional operating system dependent selections +case "$host" in + *-freebsd*) + if test "$use_pthreads" = yes; then + LDFLAGS="-pthread $LDFLAGS" +dnl -lc_r is automatically done by the linker + thread_libs="" + fi + ;; + *darwin*) + AC_DEFINE(_P1003_1B_VISIBLE,1,"") + LIBS="$LIBS -framework CoreServices -framework IOKit" + ;; + +esac + +dnl Sound device selection for xcdrdao +case "$host" in + *-linux* | *-freebsd* | *-solaris*) + sound_if_obj=SoundIF-ao.o + ;; + + *) + sound_if_obj=SoundIF-none.o + ;; +esac + +dnl Check for OGG support +if test "$with_ogg_support" = yes; then + PKG_CHECK_MODULES(VORBISFILE, vorbisfile >= 1.0, [], + [echo "OGG support disabled"; with_ogg_support=no]) +fi + +dnl Check for MP3 support +if test "$with_mp3_support" = yes; then + PKG_CHECK_MODULES(MAD, mad >= 0.10, [], + [echo "libMAD detection via pkg-config failed"; with_mp3_support=no]) + if test "$with_mp3_support" = no; then + AC_CHECK_LIB(mad, mad_stream_init, [AC_CHECK_HEADER([mad.h])]) + if test "$ac_cv_lib_mad_mad_stream_init" = yes; then + AC_ARG_VAR(MAD_LIBS,"") + AC_ARG_VAR(MAD_CFLAGS,"") + MAD_LIBS="-lmad" + MAD_CFLAGS="" + with_mp3_support=yes + else + echo "MP3 support disabled"; with_mp3_support=no + fi + fi +fi + +dnl Check for libao support +if test "$with_mp3_support" = yes || test "$with_ogg_support" = yes || test "$en_xdao" = yes; then +PKG_CHECK_MODULES(AO, ao >= 0.8, [AC_DEFINE(HAVE_AO,1,"")], + [echo "Building of gcdmaster disabled"; with_ogg_support=no; + with_mp3_support=no; en_xdao=no]) +fi + +if test "$with_ogg_support" = yes; then + AC_DEFINE(HAVE_OGG_SUPPORT,1,"") +fi +if test "$with_mp3_support" = yes; then + AC_DEFINE(HAVE_MP3_SUPPORT,1,"") +fi + +dnl General platform specific setup + +case "$host" in + *-sysv4*) + mydefs="-DUNIXWARE $mydefs" + LIBS="$LIBS -L/usr/ucblib -lucb" + ;; +esac + + +AC_SUBST(en_xdao) +AC_SUBST(en_toc2mp3) +AC_SUBST(en_toc2cue) +AC_SUBST(en_cue2toc) +AC_SUBST(en_cdrdao) +AC_SUBST(scsilib_dir) +AC_SUBST(scsilib_incl) +AC_SUBST(scsilib_libs) +AC_SUBST(scsilib_objs) +AC_SUBST(pcctsinc) +AC_SUBST(dao_src) +AC_SUBST(sound_if_obj) +AC_SUBST(thread_libs) +AC_SUBST(mydefs) +AC_SUBST(antlr_path) +AC_SUBST(dlg_path) + +AM_CONDITIONAL([COND_XDAO], [test "$en_xdao" = yes]) +AM_CONDITIONAL([COND_TOC2MP3], [test "$en_toc2mp3" = yes]) +AM_CONDITIONAL([COND_SCSILIB], [test "$en_scsilib" = yes]) +AM_CONDITIONAL([COND_PCCTS], [test "$en_pccts" = yes]) +AM_CONDITIONAL([COND_MP3], [test "$with_mp3_support" = yes]) +AM_CONDITIONAL([COND_OGG], [test "$with_ogg_support" = yes]) + +AC_CONFIG_FILES([ + trackdb/Makefile + dao/Makefile + utils/Makefile + xdao/Makefile + xdao/gcdmaster.schemas + xdao/stock/Makefile + paranoia/Makefile + pccts/Makefile + pccts/antlr/Makefile + pccts/dlg/Makefile + Makefile + specs/cdrdao.fedora.spec + ]) + +AC_OUTPUT + +echo +echo "------------------------------------------------------" +echo " Building scsilib : $en_scsilib" +echo " Building pccts : $en_pccts" +echo " Building cdrdao : $en_cdrdao" +echo " OGG support : $with_ogg_support" +echo " MP3 support : $with_mp3_support" +echo " Building toc2cue : $en_toc2cue" +echo " Building cue2toc : $en_cue2toc" +echo " Building toc2mp3 : $en_toc2mp3" +echo " Building gcdmaster : $en_xdao" +echo "------------------------------------------------------" diff --git a/contrib/mp32dao/BaseInfo.pm b/contrib/mp32dao/BaseInfo.pm new file mode 100644 index 0000000..c1eb31d --- /dev/null +++ b/contrib/mp32dao/BaseInfo.pm @@ -0,0 +1,65 @@ +# +# This program 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. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +#Copyright 2001 Giuseppe Corbelli - cowo@lugbs.linux.it +# +# This package is inherited by both mp3handler and ogghandler. It simply provides +# uniform autoloaded access methods to common information fields. + +package BaseInfo; +use strict; +use vars qw($AUTOLOAD); + +sub new { + my ($proto) = shift; + my ($class) = ref($proto) || $proto; + my ($self) = {}; + + bless ($self, $class); + return $self; +} + +# Autoloads methods with the same name as attribs. Standard args setup. +# 1 arg returns the actual value, 2 args to set the new one. +sub AUTOLOAD { + my ($self) = shift; + return if $AUTOLOAD =~ /::DESTROY$/; + $AUTOLOAD =~ s/^.*:://; + ($AUTOLOAD =~ /^\s*filename\s*$/i) ? $AUTOLOAD = 'Filename' : 1; + ($AUTOLOAD =~ /^\s*outfile\s*$/i) ? $AUTOLOAD = 'Outfile' : 1; + ($AUTOLOAD =~ /^\s*debug\s*$/i) ? $AUTOLOAD = 'debug' : 1; + ($AUTOLOAD =~ /^\s*decoder\s*$/i) ? $AUTOLOAD = 'decoder' : 1; + ($AUTOLOAD =~ /^\s*decoder_type\s*$/i) ? $AUTOLOAD = 'decoder_type' : 1; + ($AUTOLOAD =~ /^\s*artist\s*$/i) ? $AUTOLOAD = 'Artist' : 1; + ($AUTOLOAD =~ /^\s*album\s*$/i) ? $AUTOLOAD = 'Album' : 1; + ($AUTOLOAD =~ /^\s*title\s*$/i) ? $AUTOLOAD = 'Title' : 1; + ($AUTOLOAD =~ /^\s*avgbr\s*$/i) ? $AUTOLOAD = 'Avgbr' : 1; + ($AUTOLOAD =~ /^\s*year\s*$/i) ? $AUTOLOAD = 'Year' : 1; + ($AUTOLOAD =~ /^\s*comment\s*$/i) ? $AUTOLOAD = 'Comment' : 1; + ($AUTOLOAD =~ /^\s*genre\s*$/i) ? $AUTOLOAD = 'Genre' : 1; + ($AUTOLOAD =~ /^\s*durationmm\s*$/i) ? $AUTOLOAD = 'durationMM' : 1; + ($AUTOLOAD =~ /^\s*durationss\s*$/i) ? $AUTOLOAD = 'durationSS' : 1; + ($AUTOLOAD =~ /^\s*duration\s*$/i) ? $AUTOLOAD = 'duration' : 1; + ($AUTOLOAD =~ /^\s*channels\s*$/i) ? $AUTOLOAD = 'channels' : 1; + ($AUTOLOAD =~ /^\s*frequency\s*$/i) ? $AUTOLOAD = 'frequency' : 1; + ($AUTOLOAD =~ /^\s*debug\s*$/i) ? $AUTOLOAD = 'debug' : 1; + ($AUTOLOAD =~ /^\s*error\s*$/i) ? $AUTOLOAD = 'Error' : 1; + ($AUTOLOAD =~ /^\s*decoder_type\s*$/i) ? $AUTOLOAD = 'decoder_type' : 1; + ($AUTOLOAD =~ /^\s*decoder\s*$/i) ? $AUTOLOAD = 'decoder' : 1; + @_ ? $self->{$AUTOLOAD} = shift : return ($self->{$AUTOLOAD}); +} + +1; + diff --git a/contrib/mp32dao/MediaHandler.pm b/contrib/mp32dao/MediaHandler.pm new file mode 100644 index 0000000..fc26864 --- /dev/null +++ b/contrib/mp32dao/MediaHandler.pm @@ -0,0 +1,84 @@ +# +# This program 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. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +#Copyright 2001 Giuseppe Corbelli - cowo@lugbs.linux.it +#builds a list of handlers for all mediafiles in a directory + +package MediaHandler; +require mp3handler; +require ogghandler; +require flachandler; +@ISA = qw(mp3handler ogghandler flachandler); +use strict; +use vars qw ( @ext $AUTOLOAD ); + +#These are supported media files. Each time a new one is added +#its extension is put here and appropriate handler is instantiated in +#MediaHandler constructor. +@ext = ('.mp3', '.ogg', '.flac'); + +#2 args: self name and directory name +#returns blessed reference +#reads all filenames (extensions in @ext) in given directory, +#creates an handler for each one and puts istances in $self->{'LIST'} +sub new { + my ($proto, $dirname) = @_; + my ($class) = ref($proto)||$proto; + + my ($filename, $dh, @filelist, $self); + my ($total)=0; + $self->{'DIR'} = $dirname; + die ("Cannot open directory $dirname\n") if (!opendir (my ($DH), "$dirname")); + die ("No write permissions for directory $dirname\n") if (!-w "$dirname"); + while ($filename = readdir ($DH)) { + next if ( (!-r "$dirname/$filename" ) || (-z "$dirname/$filename") || (-d "$dirname/$filename") ); + chomp ($filename); + foreach (@ext) { + if ($filename =~ m/\Q$_\E/i) { + push (@filelist, $filename); + $total++; + } + } + } + $self->{'TOTAL'} = $total; + @filelist=sort(@filelist); + foreach $filename (@filelist) { + if ($filename =~ m/\.ogg/i) { + push (@{$self->{'LIST'}}, ogghandler->new("$dirname/$filename")); + } + if ($filename =~ m/\.wav/i) { + } + if ($filename =~ m/\.mp3/i) { + push (@{$self->{'LIST'}}, mp3handler->new("$dirname/$filename")); + } + if ($filename =~ m/\.flac/i) { + push (@{$self->{'LIST'}}, flachandler->new("$dirname/$filename")); + } + } + bless ($self, $class); + return $self; +} + +sub AUTOLOAD { + my ($self) = shift; + return if $AUTOLOAD =~ /::DESTROY$/; + $AUTOLOAD =~ s/^.*:://; + ($AUTOLOAD =~ /^\s*dir\s*$/i) ? $AUTOLOAD = 'DIR' : 1; + ($AUTOLOAD =~ /^\s*list\s*$/i) ? $AUTOLOAD = 'LIST' : 1; + ($AUTOLOAD =~ /^\s*total\s*$/i) ? $AUTOLOAD = 'TOTAL' : 1; + return ($self->{$AUTOLOAD}); +} + +1; diff --git a/contrib/mp32dao/docs/README b/contrib/mp32dao/docs/README new file mode 100644 index 0000000..39a6d0c --- /dev/null +++ b/contrib/mp32dao/docs/README @@ -0,0 +1,27 @@ +This Perl script automates the process of making CDs from MP3/Ogg/Flac files. +It will scan the current directory for MP3/Ogg/Flac files, parse the tags (if present), +decode all files to wav and produce: + [*] a suitable TOC file for cdrdao (with cd-text info if possible) + [*] a list of .inf files for cdrecord with cdtext info (if possible) +Some of the code is taken from Joe Steward's mp32dao, using to pad one track with the next. +MP3 decoding is done using any of the supported programs: +* lame +* mpg123 +* mpg321 +Ogg decoding is done using: +* ogg123 +Flac decoding is done using: +* flac +* metaflac (to gather info) + +In order to use mp32dao you need: + +-MP3::Info Perl module +-Ogg::Vorbis Perl module +-Cwd Perl module +-FindBin Perl module +-Audio::Wav Perl module +-Audio::Tools::Time Perl module + +Please send comments/bug reports to Giuseppe Corbelli +mp32dao is distributed as a part of cdrdao (see http://cdrdao.sourceforge.net) diff --git a/contrib/mp32dao/docs/THANKS b/contrib/mp32dao/docs/THANKS new file mode 100644 index 0000000..7252627 --- /dev/null +++ b/contrib/mp32dao/docs/THANKS @@ -0,0 +1,5 @@ +All the people that helped in developing mp32dao: + +[*] Kalen Petersen + Pointed out a bug in Mediahandler.pm. + diff --git a/contrib/mp32dao/docs/UML_diagram.dia b/contrib/mp32dao/docs/UML_diagram.dia new file mode 100644 index 0000000..19d2b76 Binary files /dev/null and b/contrib/mp32dao/docs/UML_diagram.dia differ diff --git a/contrib/mp32dao/docs/mp32dao.sgml b/contrib/mp32dao/docs/mp32dao.sgml new file mode 100644 index 0000000..d363f75 --- /dev/null +++ b/contrib/mp32dao/docs/mp32dao.sgml @@ -0,0 +1,217 @@ + + + + mp32dao documentation + + + Corbelli + Giuseppe + + + Steward + Joe + + + Everything is under GPL. + + + +What is it? + +mp32dao is a simple perl script designed to help you in +the task of creating audio CDs from MP3/Ogg/Flac files. It will decode compressed audio files to wav and create +a TOC file suitable for burning with cdrdao. + + + +Authors +The beginning and nowadays</> +<para> + The creator of mp32dao is <emphasis>Joe Steward</>. He had the idea of track padding. + It seems he's not maintaining mp32dao anymore, or at least I'm unable to contact him. +</para> +<para> + My name is <emphasis>Giuseppe Corbelli</> but I bet you saw it on the very first page + of this document ;-). I made some hacking on the original program adding CD-Text and Ogg + decoding, and reworking all the script. The original track padding code is still here. + You should not think of finding a good programming example, though :-). + You can contact me at <email>cowo@lugbs.linux.it</>. +</para> +</sect1> +</chapter> + +<chapter id="features"><title>Features +Why you'll love mp32dao</> +<para> + Suppose you have downloaded a bunch of mp3/ogg/flac files. Suppose you want to burn them on a + CD, without those annoying clicks between the tracks and with CD-Text support. This is + why you're going to use mp32dao. +</para> +<para> + Samples from the ending of a track are padded together with the beginning of the next to + avoid leaving a CD sector half-filled with zeroes. You can avoid clicks between tracks this + way. +</para> +<para> + By using tags in the compressed source files (e.g. ALBUM, AUTHOR, TITLE) mp32dao will generate a toc-file with CD-Text info + ready to use with cdrdao. If all the source files do not have the same AUTHOR and ALBUM tags the resulting toc + will show "Compilation" as title, and "Various Artists" as author. + Cdtext support requires the ALBUM, TITLE and ARTIST tags in all the source files. +</para> +</sect1> +</chapter> + +<chapter id="installation"><title>Installation +Requirements</> +<para> +In order to be able to use <productname>mp32dao</> you must have, +installed and working, the following software on your system: +<variablelist> +<varlistentry><term>Perl interpreter</> + <listitem><para> + I currently use: + <programlisting> +Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration: + Platform: + osname=linux, osvers=2.4.9-xfs, archname=i686-linux + uname='linux braveheart.cowo.net 2.4.9-xfs #5 + \mar ago 21 23:12:16 edt 2001 i686 unknown ' + config_args='' + hint=recommended, useposix=true, d_sigaction=define + usethreads=undef use5005threads=undef + \useithreads=undef usemultiplicity=undef + useperlio=undef d_sfio=undef uselargefiles=define + use64bitint=undef use64bitall=undef + \uselongdouble=undef usesocks=undef +</programlisting> + and it works for me. Please note I compiled Perl myself, disabling thread support. + </para></listitem> +</varlistentry> +<varlistentry><term>MP3::Info Perl Module</> +<listitem><para> + It is used to access MP3 informations such as playing length, ID3 tags and more. +</para></listitem> +</varlistentry> +<varlistentry><term>Ogg::Vorbis Perl Module</> +<listitem><para> + It is used to access Ogg informations such as playing length, comments and more. +</para></listitem> +</varlistentry> +<varlistentry><term>Audio::Wav Perl Module</> +<listitem><para> + It is used to access Wav file information such as length. +</para></listitem> +</varlistentry> +<varlistentry><term>Audio::Tools::Time Perl Module</> +<listitem><para> + Almost the same as above. +</para></listitem> +</varlistentry> +<varlistentry><term>FindBin Perl Module</> +<listitem><para> + It is used to fetch mp32dao.pl location, searching for modules here. You should already have it. +</para></listitem> +</varlistentry> +<varlistentry><term>Cwd Perl Module</> +<listitem><para> + It is used to fetch current working directory. You should already have it. +</para></listitem> +</varlistentry> +<varlistentry><term>mp3handler.pm, ogghandler.pm, flachandler.pm, MediaHandler.pm, Baseinfo.pm Perl Modules</> +<listitem><para> + They are part of <productname>mp32dao</> distribution. Leave them in the same directory where mp32dao.pl is or install them + in the perl search path. +</para></listitem> +</varlistentry> +</variablelist> +</para> +</sect1> +<sect1><title>Installation +You can put the main program file, mp32dao.pl anywhere you like. But it expets to find its components +in the perl search path or in its same directory. The needed components are: + +ogghandler.pm +mp3handler.pm +flachandler.pm +MediaHandler.pm +BaseInfo.pm + + + + +Usage</> +<sect1><title>Command line options</> +<para>The usage is fairly straightforward: + <orderedlist> + <listitem><para>put all and only the mp3 and/or ogg and/or flac files you want on the CD in a single directory. + </para></listitem> + <listitem><para>change to this directory + </para></listitem> + <listitem><para>launch mp32dao.pl [tocfile]. If you specify a tocfile it will be used to write the + file .toc used by cdrdao. If you don't <filename>cd.toc</> will be used. Other arguments are ignored. + </para></listitem> + </orderedlist> + The script should work with all filenames but you'll live happier if you don't name your files like this: + <screen>Iced % Earth - Burning ^ Times - [01].mp3</screen> + Avoid stupid naming schemes. + Please note the program will compose the CD using the files in the same order as their name suggests. + I <emphasis>strongly</> advise you to put the tracknumber at the beginning of the filename. + Example: + <screen> +01-The_Quickening.mp3 +02-Heart_Of_Storm.mp3 +03-Sworn_In_The_Metal_Wind.mp3 +04-The_Song_Of_Air.mp3 +05-World_Through_My_Fateless_Eyes.mp3 + </screen> +</para> +</sect1> +</chapter> +<chapter id="internals"><title>Internals</> +<sect1><title>Program structure +The Mediahandler constructor takes as input a directory name, scans for all supported +media files, and returns a list containing handlers for all common operations, such as wav decoding, +information access etc. This info is collected by the three lower level modules mp3handler, ogghandler and flachandler +using MP3::Info, Ogg::Vorbis and system program metaflac. The main program builds the TOC. In the distribution you will find +a simple UML diagram which should make it somewhat clearer. + + + +The future</> +<sect1><title>Next release plans</> +<para> + <variablelist> + <varlistentry><term>On-the-fly decoding</term> + <listitem><para> + No more huge wav files. It should be possible to do the decoding + on the fly using a FIFO. + </para></listitem> + </varlistentry> + <varlistentry><term>GUI</term> + <listitem><para> + Some GUIs using Perl/Tk and/or Perl/GTK. + </para></listitem> + </varlistentry> + <varlistentry><term>Binary</term> + <listitem><para> + Compile the script to have it available in binary form. + </para></listitem> + </varlistentry> + </variablelist> +</para> +</sect1> +</chapter> +<chapter id="troubleshooting"><title>Troubleshooting</> +<sect1><title>segfaults and nasty bugs here</> + <para>There's no point in writing such a section since I develop high quality software :-)). + </para> +</sect1> +</chapter> +<chapter id="developing"><title>Developing</> +<sect1><title>Wanna help me?</> + <para>I'm working on mp32dao alone. I always need help and knowledge. Please drop me a mail at + <email>cowo@lugbs.linux.it</> + </para> +</sect1> +</chapter> +</book> diff --git a/contrib/mp32dao/flachandler.pm b/contrib/mp32dao/flachandler.pm new file mode 100644 index 0000000..6fc8f9d --- /dev/null +++ b/contrib/mp32dao/flachandler.pm @@ -0,0 +1,198 @@ +# +# This program 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. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# Copyright 2003 Giuseppe Corbelli - cowo@lugbs.linux.it +# +# This package is inherited by Mediahandler and provides flac info access +# and decoding. See the attached UML diagram for access methods. +# Everything should be done using methods. + +package flachandler; +require BaseInfo; +@ISA = qw(BaseInfo); +#use Data::Dumper; +use strict; +use File::Basename; +use vars qw($AUTOLOAD); + +# 2 Args +# 1: self name +# 2: scalar containing filename +sub new { + my ($proto) = shift; + my ($class) = ref($proto)||$proto; + + #Inherit from BaseInfo + my $self = $class->SUPER::new(); + #Checks on input file + $self->Filename(shift); + + if (! $self->Filename) { + $self->Error("No input file defined."); + return -1; + } + if (! -r $self->Filename) { + $self->Error("Input file is not readable"); + return -1; + } + if (-z $self->Filename) { + $self->Error("Input file has 0 size"); + return -1; + } + #Identify available flac decoder + foreach my $dir (split (/\:/, $ENV{'PATH'})) { + if ( (-x "$dir/flac") && (-s "$dir/flac") ) { + $self->decoder_type('flac'); + $self->decoder("$dir/flac"); + last; + } + } + if ( !$self->decoder ) { + $self->Error("Cannot find any of the supported flac decoders in \$PATH."); + return -1; + } + + #Identify available metaflac decoder + foreach my $dir (split (/\:/, $ENV{'PATH'})) { + if ( (-x "$dir/metaflac") && (-s "$dir/metaflac") ) { + $self->metaflac("$dir/metaflac"); + last; + } + } + if ( !$self->metaflac ) { + $self->Error("Cannot find metaflac program in \$PATH."); + return -1; + } + + #Use a pipe to get metaflac data + my $cmdline = sprintf ("%s --list --block-type=STREAMINFO,VORBIS_COMMENT %s |", $self->metaflac, $self->Filename); + my $pid = open (METAFLAC, $cmdline); + if ( (!$pid) or ($pid < 0)) { + $self->Error ("Cannot get info from metaflac program."); + return -1; + } + while (<METAFLAC>) { + if (m/^\s*comment\[\d+\]\:\s*(\w+)\=(.+)$/) { + my $tag = $1; + my $value = $2; + foreach my $n (qw(artist album title year comment genre)) { + if ($n =~ /\Q$tag\E/i) { + $self->$n ($value); + printf ("%s matches %s value %s\n", $n, $tag, $value); + } + } + } elsif (m/^\s*sample\_rate\:\s*(\d+).*$/) { + my $freq = $1; + $self->frequency($freq); +# printf ("Frequency %d\n", $self->frequency); + } elsif (m/^\s*channels\:\s*(\d).*$/) { + my $chan = $1; + $self->channels($chan); +# printf ("Channels %d\n", $self->channels); + } elsif (m/^\s*total\ssamples\:\s*(\d+).*$/) { + my $samples = $1; + my $secs = $samples / $self->frequency; + $self->mm($secs / 60); + $self->ss($secs % 60); + $self->secs($secs); +# printf ("MM %d SS %d secs %d\n", $self->mm, $self->ss, $self->secs); + } + } + close (METAFLAC) or warn $! ? "Error closing metaflac pipe: $!" + : "Exit status $? from metaflac"; + $self->debug(1); + bless ($self, $class); + return $self; +} + +sub type { + return "flac"; +} + +#Decodes the file in mp3handler instance to the file specified as Outputfile in same instance +#Use system() and external decoder to do the work. Return value is external tool's one. +sub to_wav { + my ($self) = shift; + my (@temp, $cmdline); + if (! -w dirname($self->Filename) ) { + $self->Error("Output directory is not writable"); + return -1; + } + printf ("\nDecoding file %s", $self->Filename) if ($self->debug); + if (!$self->Outfile) { + $_ = $self->Filename; s/\.flac/\.wav/i; + $self->Outfile ($_); + print ("\n\tNo outputfile defined. Used ".$self->Outfile."\n") if ($self->debug); + } else { + printf (" to file %s\n", $self->Outfile) if ($self->debug); + } + if ( (-e $self->Outfile) && (-s $self->Outfile) && ($self->debug) ) { + print $self->Outfile." exists, skipping flac decode\n" if ($self->debug); + return 0; + } + if ($self->decoder_type =~ /flac/i) { + $cmdline = sprintf ("%s -d -o %s %s", $self->decoder, quotemeta ($self->Outfile), quotemeta ($self->Filename)); + } + system ("".$cmdline); + return $? >> 8; +} + +#No args +#Returns 0 +sub print_file_info { + my ($self) = @_; + printf ("\nFilename : %s, type %s\n", $self->Filename, $self->type); + printf ("\tArtist name: %s\t", $self->artist); + printf ("Album name: %s\t", $self->album); + printf ("Song title: %s\n", $self->title); + printf ("\tYear: %s\t", $self->year); + printf ("Song comment: %s\t", $self->comment); + printf ("Genre: %s\n", $self->genre); + printf ("\tDuration: %d min and %d sec\t", $self->durationMM, $self->durationSS); + printf ("Average Bitrate: %d kb/s\n", $self->Avgbr); + printf ("\t%d channel(s), %d HZ", $self->channels, ($self->frequency) * 1000); + return 0; +} + +#Arguments +# $trackno: Track number +# Optional: $filename: filename of .inf file +sub write_inf { + my ($self) = shift; + my ($trackno) = shift; + my ($inffilename); + if (@_) { + $inffilename = shift; + } else { + $inffilename = $self->Filename; + $inffilename =~ s/flac/inf/i; + } + my ($inffilehandle); + open ($inffilehandle, ">$inffilename"); + if (!$inffilehandle) {last}; + my (@tl) = localtime (time ()); + $_ = sprintf ("#Created by mp32dao.pl on %02d/%02d/%d %02d:%02d:%02d\n", + $tl[3], $tl[4]+1, $tl[5]+1900, $tl[2], $tl[1], $tl[0]); + print $inffilehandle $_; + print $inffilehandle "#Source file is ".$self->Filename."\n"; + print $inffilehandle "#Report bugs to Giuseppe \"Cowo\" Corbelli <cowo\@lugbs.linux.it>\n\n"; + print $inffilehandle "Performer=\t'".$self->Artist."'\n"; + print $inffilehandle "Tracktitle=\t'".$self->Title."'\n"; + print $inffilehandle "Albumtitle=\t'".$self->Album."'\n"; + print $inffilehandle "Tracknumber=\t".($trackno)."\n"; + close ($inffilehandle); +} + +1; diff --git a/contrib/mp32dao/mp32dao.pl b/contrib/mp32dao/mp32dao.pl new file mode 100644 index 0000000..8a2ae1d --- /dev/null +++ b/contrib/mp32dao/mp32dao.pl @@ -0,0 +1,166 @@ +#!/usr/bin/perl +# +# This program 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. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#Modified version of the original mp32dao distributed with cdrdao. +#Now with cdtext, mp3 and ogg support +#Support for cdrecord: builds .inf files +#Giuseppe Corbelli <cowo@lugbs.linux.it> +#Original code by Joe Steward <mp32dao@httptech.com> +use FindBin; +use lib $FindBin::Bin; +use Cwd; +use strict; +use MediaHandler; +use Audio::Wav; +use Audio::Tools::Time; + +my $wav = new Audio::Wav; +my ($count, $totalsamples, $divided, $rounded, $remainder, $artist, $album, $total, $song, $fh); +my $cdtext = 1; +my $samplestart = 0; +my (@tracklist, @filelist); + +print "-------- MP3-to-DAO Helper Script ---------\n"; +print "Usage: mp32dao.pl [tocfile]\n"; + +my $tocfile = $ARGV[0]; +unless ($tocfile) { + $tocfile = "cd.toc"; + warn "No toc file specified, using default \"cd.toc\"\n"; +} +my ($list) = MediaHandler->new (getcwd()); +die "No supported media files found!\n" if ($list->total == 0); +#Creates array of mediahandlers, sets artist and album. +foreach my $file (@{$list->list}) { + if (!$file->artist || !$file->title || !$file->album) {$cdtext = 0}; + #Sets artist and album name + if ($cdtext) { + #If artist is still not defined define as in first song tag + if (!$artist) { + $artist=$file->artist; + } + #If different artists mark as VVAA + if ( ! $artist =~ /\s*\Q$file->artist\E\s*/i) { + $artist = "Various Artists"; + } + #Same for album name + if (!$album) { $album = $file->album } + if (! $album =~ m/\Q$file->album\E/i) {$album = "Compilation"}; + } +} +open ($fh, ">$tocfile") or die "Couldn't open $tocfile for write!\n"; +tocfile_header($fh, $cdtext, $album, $artist); + +#Set outputfiles and decode to wav. +print "\nDecoding compressed files to wav\n"; +foreach my $file (@{$list->list}) { + if ( $_=($file->to_wav) != 0 ) { + printf ("\n\tWARNING: decoder for file %s exited with code %d\n", $file->Filename, $_); + } +} +$count=0; +print "\nAnalyzing wav files and creating toc\n\n"; +while ($count <= ($list->total-1)) { + my $file = ${$list->list}[$count]; + my $read = $wav->read($file->Outfile); + my $audio_bytes = $read->length; + my $time = Audio::Tools::Time->new (44100, 16, 2); + my $sample = $time->bytes_to_samples($audio_bytes); + tocfile_entry ($fh, $cdtext, $file, $samplestart, $count+1); + #if ($cdtext) {build_inf ($file, $count)}; + if ($cdtext) {$file->write_inf ($count+1)}; + $totalsamples = $sample - $samplestart; + $divided = $totalsamples / 588; + $rounded = int($divided) * 588; + $remainder = $totalsamples - $rounded; + printf ("\tNeed to pad up %d samples for track %d\n", $remainder, $count+1); + if (($remainder != 0) && ($count ne ($list->total-1))) { + my $nextfile = ${$list->list}[$count+1]; + print $fh "FILE \"".$nextfile->Outfile."\" "; + print $fh "0 $remainder\n\n"; + $samplestart = $remainder; + } + $count++; +} +print "\nFinished writing TOC/inf files. You may now burn the CD using\n\ + \tcdrdao write $tocfile\ + \tcdrecord dev=X,Y,Z -useinfo -dao -text -audio *.wav\n\n"; +print "You may want to normalize wav files right now.\n"; +close ($fh); +exit; + +sub seconds_to_cd_time { + my $seconds = shift; + my ($minutes, $frames); + my $minute_increment = int($seconds / 60); + if ($minute_increment) { + $seconds = $seconds - ($minute_increment * 60); + $minutes = $minutes + $minute_increment; + } + my $decimal = $seconds - int($seconds); + if ($decimal) { + $frames = int($decimal * 75); + } + return sprintf ("%02d:%02d:%02d", $minutes, $seconds, $frames); +} + +#Arguments: +# fh: filehandle opened for writing +# cdtext: if != 0 cdtext info wanted +# title: only if cdtext wanted, is the album title +# performer: only if cdtext wanted, is the album performer +sub tocfile_header { + my ($fh, $cdtext, $title, $performer) = @_; + print $fh "CD_DA\n"; + if ($cdtext) { + print $fh "CD_TEXT \{\n"; + print $fh "\tLANGUAGE_MAP \{\n"; + print $fh "\t\t0 : EN\n"; + print $fh "\t\}\n\n"; + print $fh "\tLANGUAGE 0 \{\n"; + print $fh "\t\tTITLE \"$title\"\n"; + print $fh "\t\tPERFORMER \"$performer\"\n"; + #print $fh "\t\tDISC_ID \"XY12345\"\n"; + #print $fh "\t\tUPC_EAN \"\"\n"; + print $fh "\t\}\n"; + print $fh "\}\n"; + } +} + +#Arguments: +# fh: Filehandle opened for writing +# cdtext: scalar != 0 if cdtext ON +# song: reference to song structure +# samplestart: scalar containing sample offset +# count: track number +sub tocfile_entry { + my ($fh, $cdtext, $song, $samplestart, $count) = @_; + + print $fh "// Track $count\n"; + print $fh "TRACK AUDIO\n"; + print $fh "TWO_CHANNEL_AUDIO\n"; + if ($cdtext) { + print $fh "CD_TEXT {\n"; + print $fh "\tLANGUAGE 0 {\n"; + print $fh "\t\tTITLE \"".$song->title."\"\n"; + print $fh "\t\tPERFORMER \"".$song->artist."\"\n"; + #print $fh "\t\tISRC \"US-XX1-98-01234\"\n"; + print $fh "\t}\n}\n"; + } + print $fh "FILE \"".$song->Outfile."\" "; + print $fh "$samplestart"; + print $fh "\n"; +} diff --git a/contrib/mp32dao/mp3handler.pm b/contrib/mp32dao/mp3handler.pm new file mode 100644 index 0000000..544e8a1 --- /dev/null +++ b/contrib/mp32dao/mp3handler.pm @@ -0,0 +1,180 @@ +# +# This program 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. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +#Copyright 2001 Giuseppe Corbelli - cowo@lugbs.linux.it +# +# This package is inherited by Mediahandler and provides mp3 info access +# and decoding. See the attached UML diagram for access methods. +# Everything should be done using methods. + +package mp3handler; +require BaseInfo; +@ISA = qw(BaseInfo); +use MP3::Info; +#use Data::Dumper; +use strict; +use File::Basename; +use vars qw($AUTOLOAD); + +# 2 Args +# 1: self name +# 2: scalar containing filename +sub new { + my ($proto) = shift; + my ($class) = ref($proto)||$proto; + + #Inherit from BaseInfo + my $self = $class->SUPER::new(); + #Checks on input file + $self->Filename(shift); + if (! $self->Filename) { + $self->Error("No input file defined."); + return -1; + } + if (! -r $self->Filename) { + $self->Error("Input file is not readable"); + return -1; + } + if (-z $self->Filename) { + $self->Error("Input file has 0 size"); + return -1; + } + #Identify available mp3 decoder + foreach my $dir (split (/\:/, $ENV{'PATH'})) { + if ( (-x "$dir/lame") && (-s "$dir/lame") ) { + $self->decoder_type('lame'); + $self->decoder("$dir/lame"); + last; + } + if ( (-x "$dir/mpg321") && (-s "$dir/mpg321") ) { + $self->decoder_type('mpg321'); + $self->decoder("$dir/mpg321"); + last; + } + if ( (-x "$dir/mpg123") && (-s "$dir/mpg123") ) { + $self->decoder_type('mpg123'); + $self->decoder("$dir/mpg123"); + last; + } + } + if ( !$self->decoder ) { + $self->Error("Cannot find any of the supported mp3 decoders in \$PATH."); + return -1; + } + + my $ID3tagref = MP3::Info::get_mp3tag ($self->Filename); + my $MP3info = MP3::Info::get_mp3info ($self->Filename); + + #First try the lowercase version, then the first char uppercase, last the all-uppercase + foreach my $n (qw(artist album title bitrate year comment genre mm ss secs frequency)) { + if ($ID3tagref->{$n}) { + $self->$n ($ID3tagref->{"$n"}); + } elsif ($ID3tagref->{"\u$n"}) { + $self->$n ($ID3tagref->{"\u$n"}); + } elsif ($ID3tagref->{"\U$n"}) { + $self->$n ($ID3tagref->{"\U$n"}); + } else { + $self->$n (''); + } + } + $MP3info->{"STEREO"} ? $self->channels(2) : $self->channels(1); + $self->debug(1); + bless ($self, $class); + return $self; +} + +sub type { + return "mp3"; +} + +#Decodes the file in mp3handler instance to the file specified as Outputfile in same instance +#Use system() and external decoder to do the work. Return value is external tool's one. +sub to_wav { + my ($self) = shift; + my (@temp, $cmdline); + if (! -w dirname($self->Filename) ) { + $self->Error("Output directory is not writable"); + return -1; + } + printf ("\nDecoding file %s", $self->Filename) if ($self->debug); + if (!$self->Outfile) { + $_ = $self->Filename; s/\.mp3/\.wav/i; + $self->Outfile ($_); + print ("\n\tNo outputfile defined. Used ".$self->Outfile."\n") if ($self->debug); + } else { + printf (" to file %s\n", $self->Outfile) if ($self->debug); + } + if ( (-e $self->Outfile) && (-s $self->Outfile) && ($self->debug) ) { + print $self->Outfile." exists, skipping mp3 decode\n" if ($self->debug); + return 0; + } + if ($self->decoder_type =~ /lame/i) { + $cmdline = $self->decoder." --decode --mp3input -S ".quotemeta ($self->Filename)." ".quotemeta ($self->Outfile); + } elsif ($self->decoder_type =~ /mpg321/i) { + $cmdline = $self->decoder." -q -w ".quotemeta ($self->Outfile)." ".quotemeta ($self->Filename); + } else { + $cmdline = $self->decoder." -q -s ".quotemeta ($self->Filename)." \> ".quotemeta ($self->Outfile); + } + system ("".$cmdline); + return $? >> 8; +} + +#No args +#Returns 0 +sub print_file_info { + my ($self) = @_; + printf ("\nFilename : %s, type %s\n", $self->Filename, $self->type); + printf ("\tArtist name: %s\t", $self->artist); + printf ("Album name: %s\t", $self->album); + printf ("Song title: %s\n", $self->title); + printf ("\tYear: %s\t", $self->year); + printf ("Song comment: %s\t", $self->comment); + printf ("Genre: %s\n", $self->genre); + printf ("\tDuration: %d min and %d sec\t", $self->durationMM, $self->durationSS); + printf ("Average Bitrate: %d kb/s\n", $self->Avgbr); + printf ("\t%d channel(s), %d HZ", $self->channels, ($self->frequency) * 1000); + return 0; +} + +#Arguments +# $trackno: Track number +# Optional: $filename: filename of .inf file +sub write_inf { + my ($self) = shift; + my ($trackno) = shift; + my ($inffilename); + if (@_) { + $inffilename = shift; + } else { + $inffilename = $self->Filename; + $inffilename =~ s/mp3/inf/i; + } + my ($inffilehandle); + open ($inffilehandle, ">$inffilename"); + if (!$inffilehandle) {last}; + my (@tl) = localtime (time ()); + $_ = sprintf ("#Created by mp32dao.pl on %02d/%02d/%d %02d:%02d:%02d\n", + $tl[3], $tl[4]+1, $tl[5]+1900, $tl[2], $tl[1], $tl[0]); + print $inffilehandle $_; + print $inffilehandle "#Source file is ".$self->Filename."\n"; + print $inffilehandle "#Report bugs to Giuseppe \"Cowo\" Corbelli <cowo\@lugbs.linux.it>\n\n"; + print $inffilehandle "Performer=\t'".$self->Artist."'\n"; + print $inffilehandle "Tracktitle=\t'".$self->Title."'\n"; + print $inffilehandle "Albumtitle=\t'".$self->Album."'\n"; + print $inffilehandle "Tracknumber=\t".($trackno)."\n"; + close ($inffilehandle); +} + +1; diff --git a/contrib/mp32dao/ogghandler.pm b/contrib/mp32dao/ogghandler.pm new file mode 100644 index 0000000..e02b367 --- /dev/null +++ b/contrib/mp32dao/ogghandler.pm @@ -0,0 +1,166 @@ +# +# This program 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. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Library General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +#Copyright 2001 Giuseppe Corbelli - cowo@lugbs.linux.it +# Please look at mp3handler.pm for comments. This is almost the same, +# only difference is Ogg::Vorbis backend + +package ogghandler; +require BaseInfo; +@ISA = qw(BaseInfo); +use strict; +#use Data::Dumper; +use vars qw($AUTOLOAD); +use Ogg::Vorbis; +use File::Basename; + +# 1 Arg, scalar containing filename +sub new { + my ($proto) = shift; + my ($class) = ref($proto)||$proto; + my $self = $class->SUPER::new(); + + $self->Filename(shift); + if (! $self->Filename) { + $self->Error("No input file defined."); + return -1; + } + if (! -r $self->Filename) { + $self->Error("Input file is not readable"); + return -1; + } + if (-z $self->Filename) { + $self->Error("Input file has 0 size"); + return -1; + } + + #Identify available ogg decoder + foreach my $dir (split (/\:/, $ENV{'PATH'})) { + if ( (-x "$dir/ogg123") && (-s "$dir/ogg123") ) { + $self->decoder_type('ogg123'); + $self->decoder("$dir/ogg123"); + last; + } + } + if ( !$self->decoder ) { + $self->Error("Cannot find any of the supported ogg decoders in \$PATH."); + return -1; + } + + open (my ($fh), "<".$self->Filename); + my $handle = Ogg::Vorbis->new; + $handle->open ($fh); + + #First try the lowercase version, then the first char uppercase, last the all-uppercase + foreach my $n (qw(artist album title date comment genre)) { + if ($handle->comment->{$n}) { + $self->$n ($handle->comment->{"$n"}); + } elsif ($handle->comment->{"\u$n"}) { + $self->$n ($handle->comment->{"\u$n"}); + } elsif ($handle->comment->{"\U$n"}) { + $self->$n ($handle->comment->{"\U$n"}); + } else { + $self->$n (''); + } + } + $self->Avgbr($handle->bitrate); + $self->durationMM($handle->time_total/60); + $self->durationSS($handle->time_total%60); + $self->duration($handle->time_total); + $self->channels($handle->info->channels); + $self->frequency($handle->info->rate); + $self->debug(1); + bless ($self, $class); + return $self; +} + +sub type { + return 'ogg'; +} + +sub print_file_info { + my ($self) = @_; + printf ("\nFilename : %s, type %s\n", $self->Filename, $self->type); + printf ("\tArtist name: %s\t", $self->artist); + printf ("Album name: %s\t", $self->album); + printf ("Song title: %s\n", $self->title); + printf ("\tYear: %s\t", $self->year); + printf ("Song comment: %s\t", $self->comment); + printf ("Genre: %s\n", $self->genre); + printf ("\tDuration: %d min and %d sec\t", $self->durationMM, $self->durationSS); + printf ("Average Bitrate: %d kb/s\n", $self->Avgbr/1024); + printf ("\t%d channel(s), %d HZ", $self->channels, $self->frequency); + return 0; +} + +sub to_wav { + my ($self) = shift; + my (@temp, $cmdline); + if (! -w dirname($self->Filename) ) { + $self->Error("Output directory is not writable"); + return -1; + } + printf ("\nDecoding file %s", $self->Filename) if ($self->debug); + if (!$self->Outfile) { + $_ = $self->Filename; s/\.ogg/\.wav/i; + $self->Outfile ($_); + print ("\n\tNo outputfile defined. Used ".$self->Outfile."\n") if ($self->debug); + } else { + printf (" to file %s\n", $self->Outfile) if ($self->debug); + } + if ( (-e $self->Outfile) && (-s $self->Outfile) && ($self->debug) ) { + print $self->Outfile." exists, skipping mp3 decode\n" if ($self->debug); + return 0; + } + if ($self->decoder_type =~ /ogg123/i) { + $cmdline = $self->decoder." -q -d wav -f ".quotemeta ($self->Outfile)." ".quotemeta ($self->Filename); + } + #print $cmdline; + #my ($ret)=(system ("".$cmdline))/256; + #print "$ret"; + #return $? >> 8; + return (system ("".$cmdline))/256; +} + +#Arguments +# $trackno: Track number +# Optional: $filename: filename of .inf file +sub write_inf { + my ($self) = shift; + my ($trackno) = shift; + my ($inffilename); + if (@_) { + $inffilename = shift; + } else { + $inffilename = $self->Filename; + $inffilename =~ s/ogg/inf/i; + } + my ($inffilehandle); + open ($inffilehandle, ">$inffilename"); + if (!$inffilehandle) {last}; + my (@tl) = localtime (time ()); + $_ = sprintf ("#Created by mp32dao.pl on %02d/%02d/%d %02d:%02d:%02d\n", + $tl[3], $tl[4]+1, $tl[5]+1900, $tl[2], $tl[1], $tl[0]); + print $inffilehandle $_; + print $inffilehandle "#Source file is ".$self->Filename."\n"; + print $inffilehandle "#Report bugs to Giuseppe \"Cowo\" Corbelli <cowo\@lugbs.linux.it>\n\n"; + print $inffilehandle "Performer=\t'".$self->Artist."'\n"; + print $inffilehandle "Tracktitle=\t'".$self->Title."'\n"; + print $inffilehandle "Albumtitle=\t'".$self->Album."'\n"; + print $inffilehandle "Tracknumber=\t".($trackno)."\n"; + close ($inffilehandle); +} + +1; diff --git a/contrib/psxcopy-0.2/Makefile b/contrib/psxcopy-0.2/Makefile new file mode 100644 index 0000000..010546e --- /dev/null +++ b/contrib/psxcopy-0.2/Makefile @@ -0,0 +1,34 @@ +# +# Makefile - Fabio Baracca +# + +CC = gcc +#-DDEBUG #-ggdb +CFLAGS = -O2 -s -fno-strength-reduce +LDFLAGS = +CNTFLGS = +EDITOR = joe + +default: cdjob psxdump remainder + +cdjob: cdjob.c + $(CC) $(CFLAGS) cdjob.c -o cdjob + +psxdump: psxdump.c + $(CC) $(CFLAGS) psxdump.c -o psxdump + +remainder: + @echo "Make completed." + @echo "Please also execute make batchconf to revise configuration of batch files." + +batchconf: + $(EDITOR) write-psx + $(EDITOR) read-psx + +clean: + rm -f *~ + rm -f *.o + +distclean: + rm -f psxdump + rm -f cdjob \ No newline at end of file diff --git a/contrib/psxcopy-0.2/README b/contrib/psxcopy-0.2/README new file mode 100644 index 0000000..67f8281 --- /dev/null +++ b/contrib/psxcopy-0.2/README @@ -0,0 +1,4 @@ +These tools can be used to make backup copies of PSX CDs. The implementation +is currently Linux specific. + +Please send comments/bug reports to Fabio Baracca <fabiobar@tiscalinet.it>. diff --git a/contrib/psxcopy-0.2/cdjob.c b/contrib/psxcopy-0.2/cdjob.c new file mode 100644 index 0000000..c405554 --- /dev/null +++ b/contrib/psxcopy-0.2/cdjob.c @@ -0,0 +1,186 @@ +/* cdjob.c + * + * Copyright (C) 1999 Fabio Baracca <fabiobar@tiscalinet.it> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stdio.h> +#include <string.h> + +#define BUF_S 1024 +#define DATA_SIGN "DATAFILE" +#define AUDIO_SIGN "FILE" +#define TRACKTYPE_SIGN "TRACK" +#define MODE1_SIGN "MODE1" +#define MODE2_SIGN "MODE2" +#define SECT_SIZE 2048 + +FILE *inf, *outf, *device; +char *fname, *track_info, *cdrom_device; +char buf[BUF_S], file_to_read[BUF_S]; +int is_data_track = 0, line_count = 0; +int i, j, k, x, data_size, chr; +int min, sec, frame, size_in_sect, rcode = 0, rem, readin; +int audio_begin = 0, audio_end = 0, tracks = 0, prevseek = 0; + +int main(int argc, char *argv[]) +{ + if (argc != 3) { + fprintf(stderr, "Usage: %s <cue-sheet> <cdrom device>\n", argv[0]); + return 1; + } + fname = argv[1]; + cdrom_device = argv[2]; + + inf = (FILE *) fopen(fname, "r+"); + if (inf == NULL) { + fprintf(stderr, "Unable to open \"%s\" cue-sheet!\n", fname); + return 2; + } + device = (FILE *) fopen(cdrom_device, "r"); + +/* + if (device == NULL) { + fprintf(stderr, "Unable to open \"%s\" for reading!\n", cdrom_device); + return 4; + } + fclose (device); +*/ + /* Testing for PSX CD */ + + sprintf (buf, "psxdump -T -d %s", cdrom_device); + i=system (buf); + + if (i!=0) { + fprintf(stderr, "Unable to read from %s or disk is not PSX, please check and retry.\n", cdrom_device); + exit (1); + } + + /* Total bytes (about to) read */ + readin = 0; + + printf("cdjob 0.2 - Fabio Baracca <fabiobar@tiscalinet.it>\n\n"); + + while (!feof(inf)) { + prevseek=ftell (inf); + fgets(buf, BUF_S, inf); + if (!feof(inf)) { + line_count++; + + /* Store data type */ + if (strncasecmp(buf, TRACKTYPE_SIGN, strlen(TRACKTYPE_SIGN)) == 0) { + if (strstr(buf, MODE1_SIGN)) + is_data_track = 1; + else if (strstr(buf, MODE2_SIGN)) { /* HACK IT! */ + is_data_track = 1; + buf[11]=0x20; + buf[12]='/'; + buf[13]='/'; + fseek (inf, prevseek, SEEK_SET); + fputs (buf, inf); + } + else + is_data_track = 0; + } + /* Data to be read.. */ + if ((strncasecmp(buf, DATA_SIGN, strlen(DATA_SIGN)) == 0) || + (strncasecmp(buf, AUDIO_SIGN, strlen(AUDIO_SIGN)) == 0)) { + /* Zero vars */ + i = j = k = x = 0; + + /* Search the name */ + for (j = 0, i = 0; i < strlen(buf); i++) { + if (buf[i] == '"') { + j++; + if (j == 1) + k = i + 1; + else if (j >= 2) { + x = i - 1; + break; + } + } + } + + /* Check the name */ + if (j != 2) { + fprintf(stderr, "Bogus characters at line %d\n", line_count); + rcode = 100; + } else if ((x - k + 1) > BUF_S) { + fprintf(stderr, "Ooppss.. filename too long..\n"); + rcode = 101; + } else { + strcpy(file_to_read, buf + k); + /* Track size info */ + track_info = buf + x + 2; + for (j = 0, i = x + 2; i < strlen(buf); i++) { + if (buf[i] == ':') { + j++; + if (j >= 2) { + track_info[i - x + 1] = 0; + break; + } + } + } + + x -= k; + file_to_read[++x] = 0; + + if (!is_data_track) { /* audio ? :-D */ + tracks++; + if (audio_begin != 0) + audio_end = tracks; + else + audio_begin = tracks; + } + if (is_data_track) { + tracks++; +/* printf("About data file: \"%s\"..", file_to_read);*/ + if ((sscanf(track_info, "%d:%d:%d", &min, &sec, &frame)) != 3) { + printf("bogus size info!\n"); + rcode = 102; + } else { + char toshell[1024]; /* HACK!!! */ + size_in_sect = (((min * 60 + sec) * 75 + frame) * SECT_SIZE); + track_info[1]=0x20; + track_info[2]='/'; + track_info[3]='/'; + fseek (inf, prevseek, SEEK_SET); + fputs (buf, inf); + + sprintf (toshell, "psxdump -f %s -d %s", file_to_read, cdrom_device); + system (toshell); + } + } else { + /* Silenty trash garbage */ + /* printf ("mm.. not a data file.. ignoring!\n"); */ + /* rcode=200; */ + } + } + } + } + } + + fclose(inf); + fclose(device); + if (audio_begin != 0) { /* Start cdparanoia */ + printf("Ok.. now reading audio part of the disk.\n\n"); + sprintf(buf, "cdparanoia -z %d- data.wav", audio_begin); + if (system(buf) != 0) + fprintf(stderr, "\n\nCdparanoia execution error. - CD dump can be corrupted.\n"); + } + printf ("\n"); + return rcode; +} diff --git a/contrib/psxcopy-0.2/psxdump.c b/contrib/psxcopy-0.2/psxdump.c new file mode 100644 index 0000000..dedeb93 --- /dev/null +++ b/contrib/psxcopy-0.2/psxdump.c @@ -0,0 +1,293 @@ +/* + * psxdump.c - Dumps playstation disks to file + * + * Portions (c) 1999 Fabio Baracca <fabiobar@tiscalinet.it> + * + * *HEAVILY BASED* on code from readxa.c + * that's (c) 1996,1997 Gerd Knorr <kraxel@cs.tu-berlin.de> + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <getopt.h> + +#include <fcntl.h> +#include <errno.h> +#include <sys/stat.h> +#include <sys/ioctl.h> +#include <linux/cdrom.h> +#include <linux/fs.h> + +/* Ugly, I know.. */ +extern char *sys_errlist[]; + +typedef unsigned char u8bit; +typedef unsigned short u16bit; +typedef unsigned u32bit; + +unsigned char psx_sign[] = +{0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x09, 0x00, 0x01, + 0x43, 0x44, 0x30, 0x30, 0x31, 0x01, 0x00, 0x50, 0x4C, + 0x41, 0x59, 0x53, 0x54, 0x41, 0x54, 0x49, 0x4F, 0x4E, + 0x20, 0x20, 0x20, 0x20, 0x20}; + +typedef struct tag_iso_dir_entry { + u8bit len_dr; + u8bit XAR_len; + u32bit loc_extentI; + u32bit loc_extentM; + u32bit data_lenI; + u32bit data_lenM; + u8bit record_time[7]; + u8bit file_flags_iso; + u8bit il_size; + u8bit il_skip; + u16bit VSSNI; + u16bit VSSNM; + u8bit len_fi; + u8bit file_id[32]; + u8bit padding; +} iso_dir_entry; + +iso_dir_entry dir_entry; + +static const char *device_list[] = +{ + /* try most common first ... */ + "/dev/cdrom", + "/dev/scd0", + "/dev/sr0", + "/dev/hdc", + "/dev/hdd", + + "/dev/scd1", + "/dev/sr1", + "/dev/scd2", + "/dev/sr2", + "/dev/scd3", + "/dev/sr3", + "/dev/hda", + "/dev/hdb", + "/dev/hde", + "/dev/hdf", + "/dev/hdg", + "/dev/hdh", + NULL +}; + +int print_info = 0; +int dump_raw = 0; + +void about(void) +{ + fprintf(stderr, "psxdump.c - Dumps playstation disks to file\n\nA quick hack that's (c) 1999 Fabio Baracca <fabiobar@tiscalinet.it>\nLicensed under GNU GPL - *HEAVILY BASED* on code from readxa.c\nthat's (c) 1996,1997 Gerd Knorr <kraxel@cs.tu-berlin.de>\n\n"); +} + +void usage(void) +{ + fprintf(stderr, + "syntax: psxdump -d <device> -f <output file>\n\n" + " -d <device> give device name\n" + " -f <output file> file to put track dump\n" + " -F force the program to proceed even if it's not a PSX disk\n" + " -T test type of disc (PSX or non) and report it as exit code\n" + " -h display this banner :-)\n"); +} + +int read_raw_frame(int fd, int lba, unsigned char *buf) +{ + struct cdrom_msf *msf; + int rc; + + msf = (struct cdrom_msf *) buf; + msf->cdmsf_min0 = (lba + CD_MSF_OFFSET) / CD_FRAMES / CD_SECS; + msf->cdmsf_sec0 = (lba + CD_MSF_OFFSET) / CD_FRAMES % CD_SECS; + msf->cdmsf_frame0 = (lba + CD_MSF_OFFSET) % CD_FRAMES; + rc = ioctl(fd, CDROMREADMODE2, buf); + if (-1 == rc) + perror("ioctl CDROMREADMODE2"); + return rc; +} + +int main(int argc, char *argv[]) +{ + int forcepsx = 0, ofile, cdrom, rc, c, size, percent, maxsize, testpsx = 0; + unsigned long block; + unsigned char *buf; + struct stat st, dev_st; + int device; + long seek = -1; + struct cdrom_tocentry toc, toc2; + + char *outfile = NULL, *devname = NULL; + + /* parse options */ + for (;;) { + c = getopt(argc, argv, "TFd:f:"); + if (c == -1) + break; + switch (c) { + case 'f': + outfile = optarg; + break; + case 'd': + devname = optarg; + break; + case 'F': + forcepsx = 1; + break; + case 'T': + testpsx = 1; + break; + case 'h': + default: + usage(); + exit(1); + } + } + + /* Malloc-ing memory */ + if (NULL == (buf = malloc(CD_FRAMESIZE_RAW0))) { + fprintf(stderr, "Out of memory\n"); + exit(1); + } + + if ((testpsx) && (devname)) { + if (-1 == (cdrom = open(devname ? devname : device_list[device], O_RDONLY | O_NONBLOCK))) { + fprintf(stderr, "open %s: %s\n", devname ? devname : device_list[device], sys_errlist[errno]); + exit(2); + } + if (0 != (rc = read_raw_frame(cdrom, 16, buf))) { + perror("read error"); + exit(2); + } + close(rc); + if (memcmp(psx_sign, buf, sizeof(psx_sign)) == 0) + exit(0); + else + exit(1); + } + + about(); + + if ((!outfile) || (!devname)) { + fprintf(stderr, "Please specify *either* the file name (or -T flag) *and* the device of the CD reader.\n\n"); + usage(); + exit(2); + } + /* Opening the CDROM reader */ + if (-1 == (cdrom = open(devname ? devname : device_list[device], O_RDONLY | O_NONBLOCK))) { + fprintf(stderr, "open %s: %s\n", devname ? devname : device_list[device], sys_errlist[errno]); + exit(1); + } + + if (!forcepsx) { + /* Checking if it's a PSX disk */ + printf("Checking if the disk is a PSX disk.."); + fflush(stdout); + if (0 != (rc = read_raw_frame(cdrom, 16, buf))) { /* Safe PSX signature is at 0x9200 */ + perror("read error"); + exit(1); + } + /* Checking PSX signature */ + if (memcmp(psx_sign, buf, sizeof(psx_sign)) == 0) { + printf("okay, found a PSX disk.\n"); + } else { + printf("sorry.. this doesn't seem a PSX disk.\n\nIf you think it's a bug, use -F flag and send a dump of the sector 16\nto me, Fabio Baracca <fabiobar@tiscalinet.it>. Thanks!\n"); + exit(3); + } + close(rc); + } else { + printf("-F specified: assuming that the disk is a PSX disk.\n"); + } + + /* Checking the limits of the track */ + if (-1 == (rc = open(devname, O_RDONLY | O_NONBLOCK))) { + fprintf(stderr, "open %s: %s\n", devname, sys_errlist[errno]); + exit(1); + } + toc.cdte_track = 1; + toc.cdte_format = CDROM_LBA; + if (-1 == ioctl(rc, CDROMREADTOCENTRY, &toc)) { + perror("ioctl CDROMREADTOCENTRY [start]"); + exit(1); + } + toc2.cdte_track = 2; + toc2.cdte_format = CDROM_LBA; + if (-1 == ioctl(rc, CDROMREADTOCENTRY, &toc2)) { + toc2.cdte_track = CDROM_LEADOUT; + toc2.cdte_format = CDROM_LBA; + if (-1 == ioctl(rc, CDROMREADTOCENTRY, &toc2)) { + perror("ioctl CDROMREADTOCENTRY [stop]"); + exit(1); + } + } + block = toc.cdte_addr.lba; /* Should be zero */ + if (block) { + fprintf(stderr, "Hei!.. S-T-R-A-N-G-E.. starting sector is NOT zero !??!\n"); + } + size = (toc2.cdte_addr.lba - block) * 2048; + close(rc); + + /* Opening the output file */ + if (-1 == (ofile = open(outfile, O_WRONLY | O_CREAT))) { + fprintf(stderr, "open %s: %s\n", outfile, sys_errlist[errno]); + exit(1); + } + /* Finnally dump the track */ + if (-1 == (rc = open(devname ? devname : device_list[device], O_RDONLY | O_NONBLOCK))) { + fprintf(stderr, "open %s: %s\n", devname ? devname : device_list[device], sys_errlist[errno]); + exit(1); + } + if (0 != (rc = read_raw_frame(cdrom, block, buf))) { + perror("read error"); + exit(1); + } + printf("\nDumping %d bytes (or maybe a bit less..) to disk..\n", (toc2.cdte_addr.lba - block) * 2336); + printf("Please IGNORE any error! Your disk WILL BE OK! 100%% Assured!\n\n"); + + maxsize = size; + percent = 0; /* Status bar */ + + printf("Completed: %d%%\r", percent); + fflush(stdout); + + for (;;) { + int offset, len, tmp; + + if (buf[0] == buf[4] && + buf[1] == buf[5] && + buf[2] == buf[6] && + buf[3] == buf[7] && + buf[2] != 0 && + buf[0] < 8 && + buf[1] < 8) { + offset = 8; + len = (buf[2] & 0x20) ? 2324 : 2048; + } else { + offset = 0; + len = 2048; + } + write(ofile, buf, CD_FRAMESIZE_RAW0); /* dump to disk */ + size -= 2048 /* len */ ; + block++; + if (size <= 0) + break; + + tmp = (int) 100 - (((double) size / (double) maxsize) * 100); + if (tmp != percent) { + percent = tmp; + printf("Completed: %d%%\r", percent); + fflush(stdout); + } + if (0 != (rc = read_raw_frame(cdrom, block, buf))) { + perror("read error (hei! the disk is 99.9%% ok if we are in the last part of the disk)"); + exit(1); + } + } + printf("PSX data track dump complete.\n"); + free(buf); + exit(0); +} diff --git a/contrib/psxcopy-0.2/read-psx b/contrib/psxcopy-0.2/read-psx new file mode 100644 index 0000000..9b2bbe4 --- /dev/null +++ b/contrib/psxcopy-0.2/read-psx @@ -0,0 +1,13 @@ +#!/bin/sh +echo read-psx - v.0.3 +reader_sg="/dev/sg0" +reader_cd="/dev/scd0" +if psxdump -T -d $reader_cd +then + rm -f $1.toc + cdrdao read-toc --device $reader_sg $1.toc + cp $1.toc $1.toc.backup + cdjob $1.toc $reader_cd +else + echo This is not a PSX disk.. +fi \ No newline at end of file diff --git a/contrib/psxcopy-0.2/write-psx b/contrib/psxcopy-0.2/write-psx new file mode 100644 index 0000000..ae42bf9 --- /dev/null +++ b/contrib/psxcopy-0.2/write-psx @@ -0,0 +1,7 @@ +#!/bin/sh +echo write-psx - v.0.4 +writer='/dev/sg2' +driver='generic-mmc' +cdrdao write --device $writer --speed 4 --buffers 128 -v 1 $1.toc +cp -f $1.toc.backup $1.toc 2> /dev/null +rm -f $1.toc.backup 2> /dev/null \ No newline at end of file diff --git a/contrib/wav2dao/wav2dao.pl b/contrib/wav2dao/wav2dao.pl new file mode 100644 index 0000000..910aed6 --- /dev/null +++ b/contrib/wav2dao/wav2dao.pl @@ -0,0 +1,71 @@ +#!/usr/bin/perl + +use strict 'subs'; +use strict 'refs'; + +@dev = ('--device', '/dev/pg0:0,0'); + +sub help { + print "Syntax: $0 [-H] [options] audiofiles\n"; + print <<"EOF" ; +Use cdrdao on the wav audio file arguments, making an appropriate toc file. +-d cdrw Use cdrw as the CDRW device (default: $dev[1]). +-o file Output the toc file on this file - do not use a temporary file. +-p Perform a 'print-size' cdrdao command. +-i Perform a 'toc-info' cdrdao command. +-c Perform a 'show-toc' cdrdao command. +-t Perform a 'read-test' cdrdao command. +-w Write the CD in DAO mode (default, if no other action is specified). +-s Simulate writing only ('simulate' instead of 'write' command). +-j Do not eject the CD after writing it. +-n Print the cdrdao commands, instead of executing them. +EOF +} + +require 'getopts.pl'; +&Getopts('o:pictwsjnH'); +if ($opt_H) { &help ; exit } +$dev[1] = $opt_d if $opt_d; +$opt_w = 1 unless $opt_p || $opt_i || $opt_c || $opt_t || $opt_w || $opt_s || $opt_o ne ""; + +die "Usage: $0 [options] audiofiles" unless @ARGV; + +$fname = $opt_o ne "" ? $opt_o : "/tmp/toc$$"; +open(F, "> $fname") || die "open($fname): $!, stopped"; +print F "CD_DA\n"; + +foreach (@ARGV) { + print F "\nTRACK AUDIO\nNO COPY\n"; +# print F "NO PRE_EMPHASIS\nTWO_CHANNEL_AUDIO\n"; + print F "FILE \"$_\" 0\n"; +# print F "START 00:02:00\n" if $no++; +} +close F; + +if ($opt_p) { + if ($opt_n) { print "cdrdao print-size $fname\n" } + else { system 'cdrdao', 'print-size', $fname} +} + +if ($opt_i) { + if ($opt_n) { print "cdrdao toc-info $fname\n" } + else { system 'cdrdao', 'toc-info', $fname} +} + +if ($opt_c) { + if ($opt_n) { print "cdrdao show-toc $fname\n" } + else { system 'cdrdao', 'show-toc', $fname} +} +if ($opt_t) { + if ($opt_n) { print "cdrdao read-test $fname\n" } + else { system 'cdrdao', 'read-test', $fname} +} + +if ($opt_w || $opt_s) { + unshift @dev, $opt_s ? 'simulate' : 'write'; + push @dev, '--eject' unless $opt_s || $opt_j; + push @dev, $fname; + if ($opt_n) { print "cdrdao @dev\n" } else { system 'cdrdao', @dev } +} +unlink $fname unless $opt_o ne ""; +__END__ diff --git a/dao/CDD2600.cc b/dao/CDD2600.cc new file mode 100644 index 0000000..39aaa45 --- /dev/null +++ b/dao/CDD2600.cc @@ -0,0 +1,917 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <string.h> +#include <assert.h> + +#include "CDD2600.h" +#include "SubChannel.h" +#include "PQSubChannel16.h" + +#include "Toc.h" +#include "log.h" + +CDD2600::CDD2600(ScsiIf *scsiIf, unsigned long options) + : CdrDriver(scsiIf, options|OPT_DRV_NO_PREGAP_READ), CDD2600Base(this) +{ + driverName_ = "CDD2600 - Version 1.1"; + + leadInLength_ = leadOutLength_ = 0; + speed_ = 2; + simulate_ = true; + encodingMode_ = 0; + + // reads big endian samples + audioDataByteOrder_ = 1; + + memset(&diskInfo_, 0, sizeof(DiskInfo)); +} + +CDD2600::~CDD2600() +{ +} + +// static constructor +CdrDriver *CDD2600::instance(ScsiIf *scsiIf, unsigned long options) +{ + return new CDD2600(scsiIf, options); +} + +// sets speed +// return: 0: OK +// 1: illegal speed +int CDD2600::speed(int s) +{ + if (s >= 0 && s <= 2) { + speed_ = s; + return 0; + } + else if (s > 2) { + speed_ = 2; + return 0; + } + else { + return 1; + } +} + +// loads ('unload' == 0) or ejects ('unload' == 1) tray +// return: 0: OK +// 1: scsi command failed + +int CDD2600::loadUnload(int unload) const +{ + unsigned char cmd[10]; + + memset(cmd, 0, 10); + + cmd[0] = 0xe7; // MEDIUM LOAD/UNLOAD + if (unload) { + cmd[8] |= 0x01; + } + + if (sendCmd(cmd, 10, NULL, 0, NULL, 0) != 0) { + log_message(-2, "Cannot load/unload medium."); + return 1; + } + + return 0; +} + +// sets various audio play parameters, output channels are set to stereo mode +// and given volume +// immediate: 0: wait until audio play command finished +// 1: command finishs immediately after playback has started +// sotc: 0: play across track boundaries +// 1: stop playing at track boundaries +int CDD2600::modeSelectPlay(int immediate, int sotc, unsigned char volume) +{ + unsigned char mp[16]; + + memset(mp, 0, 16); + + mp[0] = 0x0e; // PLAY page code + mp[1] = 14; // parameter length + if (immediate != 0) { + mp[2] |= 0x04; + } + if (sotc != 0) { + mp[2] |= 0x02; + } + mp[8] = 1; + mp[9] = volume; + mp[10] = 2; + mp[11] = volume; + + if (setModePage(mp, NULL, NULL, 1) != 0) { + log_message(-2, "Cannot set play parameters."); + return 1; + } + + return 0; +} + +int CDD2600::initDao(const Toc *toc) +{ + long n; + blockLength_ = AUDIO_BLOCK_LEN; + blocksPerWrite_ = scsiIf_->maxDataLen() / blockLength_; + + assert(blocksPerWrite_ > 0); + + toc_ = toc; + + diskInfo(); + + if (!diskInfo_.valid.empty || !diskInfo_.valid.append) { + log_message(-2, "Cannot determine status of inserted medium."); + return 1; + } + + if (!diskInfo_.append) { + log_message(-2, "Inserted medium is not appendable."); + return 1; + } + + if (modeSelectBlockSize(blockLength_, 1) != 0 || + modeSelectSpeed(-1, speed_, simulate_, 1) != 0 || + modeSelectCatalog(toc_) != 0 || + readSessionInfo(&leadInLength_, &leadOutLength_, 1) != 0) { + return 1; + } + + // allocate buffer for write zeros + n = blocksPerWrite_ * blockLength_; + delete[] zeroBuffer_; + zeroBuffer_ = new char[n]; + memset(zeroBuffer_, 0, n); + + return 0; +} + +int CDD2600::startDao() +{ + long lba; + + if (writeSession(toc_, multiSession_, diskInfo_.thisSessionLba) != 0) { + return 1; + } + + log_message(2, "Writing lead-in and gap..."); + + lba = diskInfo_.thisSessionLba - 150 - leadInLength_; + + // write lead-in + if (writeZeros(toc_->leadInMode(), TrackData::SUBCHAN_NONE, lba, lba + 150, + leadInLength_) != 0) { + flushCache(); + return 1; + } + + log_message(5, "Lba after lead-in: %ld", lba); + + // write gap (2 seconds) + if (writeZeros(toc_->leadInMode(), TrackData::SUBCHAN_NONE, + lba, lba + 150, 150) != 0) { + flushCache(); + return 1; + } + + log_message(2, ""); + + return 0; +} + +int CDD2600::finishDao() +{ + long lba = diskInfo_.thisSessionLba + toc_->length().lba(); + + log_message(2, "Writing lead-out..."); + + // write lead-out + if (writeZeros(toc_->leadOutMode(), TrackData::SUBCHAN_NONE, lba, lba + 150, + leadOutLength_) != 0) { + flushCache(); + return 1; + } + + log_message(2, "\nFlushing cache..."); + + if (flushCache() != 0) { + return 1; + } + + log_message(2, ""); + + blockLength_ = MODE1_BLOCK_LEN; + modeSelectBlockSize(blockLength_, 1); + + delete[] zeroBuffer_, zeroBuffer_ = NULL; + + return 0; +} + +void CDD2600::abortDao() +{ + flushCache(); + + blockLength_ = MODE1_BLOCK_LEN; + modeSelectBlockSize(blockLength_, 1); +} + +// Writes data to target, the block length depends on the actual writing mode +// and is stored internally. 'len' is number of blocks to write. +// 'lba' specifies the next logical block address for writing and is updated +// by this function but not used for writing +// return: 0: OK +// 1: scsi command failed +int CDD2600::writeData(TrackData::Mode mode, TrackData::SubChannelMode sm, + long &lba, const char *buf, long len) +{ + assert(blocksPerWrite_ > 0); + assert(blockLength_ > 0); + assert(mode == TrackData::AUDIO); + int nwritten = 0; + int writeLen = 0; + unsigned char cmd[10]; + + memset(cmd, 0, 10); + cmd[0] = 0x2a; // WRITE1 + + while (len > 0) { + writeLen = (len > blocksPerWrite_ ? blocksPerWrite_ : len); + + cmd[7] = writeLen >> 8; + cmd[8] = writeLen & 0xff; + + if (sendCmd(cmd, 10, (unsigned char *)(buf + (nwritten * blockLength_)), + writeLen * blockLength_, NULL, 0) != 0) { + log_message(-2, "Write data failed."); + return 1; + } + + lba += writeLen; + + len -= writeLen; + nwritten += writeLen; + } + + return 0; +} + +Toc *CDD2600::readDiskToc(int session, const char *audioFilename) +{ + + blockLength_ = AUDIO_BLOCK_LEN; + if (modeSelectBlockSize(blockLength_, 1) != 0) { + return NULL; + } + + modeSelectSpeed(2, -1, 1, 0); + + Toc *toc = CdrDriver::readDiskToc(session, audioFilename); + + setBlockSize(MODE1_BLOCK_LEN); + + return toc; +} + +Toc *CDD2600::readDisk(int session, const char *fname) +{ + Toc *toc = CdrDriver::readDisk(session, fname); + + setBlockSize(MODE1_BLOCK_LEN); + + return toc; +} + +int CDD2600::readIsrc(int trackNr, char *buf) +{ + unsigned char cmd[10]; + unsigned short dataLen = 0x30; + unsigned char data[0x30]; + int i; + + memset(cmd, 0, 10); + cmd[0] = 0x42; // READ SUB CHANNEL + cmd[2] = 0x40; // get sub channel data + cmd[3] = 0x03; // get ISRC code + cmd[6] = trackNr; + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen) != 0) { + log_message(-1, "Cannot read ISRC code."); + return 1; + } + else { + if (data[0x08] & 0x80) { + for (i = 0; i < 12; i++) { + buf[i] = data[0x09 + i]; + } + buf[12] = 0; + } + } + + return 0; +} + +// tries to read catalog number from disk and adds it to 'toc' +// return: 1 if valid catalog number was found, else 0 + +int CDD2600::readCatalog(Toc *toc, long startLba, long endLba) +{ + unsigned char cmd[10]; + unsigned short dataLen = 0x30; + unsigned char data[0x30]; + char catalog[14]; + int i; + + // read sub channel information + memset(cmd, 0, 10); + cmd[0] = 0x42; // READ SUB CHANNEL + cmd[2] = 0x40; // get sub channel data + cmd[3] = 0x02; // get media catalog number + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen) != 0) { + log_message(-2, "Cannot read sub channel data."); + return 0; + } + + if (data[0x08] & 0x80) { + for (i = 0; i < 13; i++) { + catalog[i] = data[0x09 + i]; + } + catalog[13] = 0; + + if (toc->catalog(catalog) == 0) { + return 1; + } + } + + return 0; +} + +int CDD2600::analyzeTrack(TrackData::Mode mode, int trackNr, long startLba, + long endLba, + Msf *index, int *indexCnt, long *pregap, + char *isrcCode, unsigned char *ctl) +{ + blockLength_ = AUDIO_BLOCK_LEN; + modeSelectBlockSize(blockLength_, 1); + + int ret = analyzeTrackSearch(mode, trackNr, startLba, endLba, + index, indexCnt, pregap, isrcCode, ctl); + + *isrcCode = 0; + + if (mode == TrackData::AUDIO) { + // read ISRC code from sub channel + readIsrc(trackNr, isrcCode); + } + + return ret; +} + +int CDD2600::getTrackIndex(long lba, int *trackNr, int *indexNr, + unsigned char *ctl) +{ + long relPos; + + readBlock(lba); + + return readSubChannelData(trackNr, indexNr, &relPos, ctl); +} + +int CDD2600::readSubChannelData(int *trackNr, int *indexNr, long *relPos, + unsigned char *ctl) +{ + unsigned char cmd[10]; + unsigned short dataLen = 0x30; + unsigned char data[0x30]; + + // read sub channel information + memset(cmd, 0, 10); + cmd[0] = 0x42; // READ SUB CHANNEL + cmd[2] = 0x40; // get sub channel data + cmd[3] = 0x00; // get sub Q channel data + cmd[6] = 0; + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen) != 0) { + log_message(-2, "Cannot read sub Q channel data."); + return 1; + } + + *trackNr = data[6]; + *indexNr = data[7]; + *relPos = 0; + *relPos |= data[0x0c] << 24; + *relPos |= data[0x0d] << 16; + *relPos |= data[0x0e] << 8; + *relPos |= data[0x0f]; + + if (ctl != NULL) { + *ctl = data[5] & 0x0f; + } + + return 0; +} + +// reads a single block of length 'blockLength_' from given sector +// return: 0: OK +// 1: error occured +void CDD2600::readBlock(unsigned long sector) +{ + unsigned char cmd[10]; + unsigned long dataLen = 2 * blockLength_; + unsigned char *data = new unsigned char[dataLen]; + + + // read sub channel information + memset(cmd, 0, 10); + cmd[0] = 0x28; // READ10 + cmd[2] = sector >> 24; + cmd[3] = sector >> 16; + cmd[4] = sector >> 8; + cmd[5] = sector; + cmd[7] = 0; + cmd[8] = 2; + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen) != 0) { + log_message(-2, "Cannot read block - ignored."); + } + + delete[] data; +} + +int CDD2600::nextWritableAddress(long *lba, int showError) +{ + unsigned char cmd[10]; + unsigned char data[6]; + + memset(data, 0, 6); + memset(cmd, 0, 10); + + cmd[0] = 0xe2; // FIRST WRITABLE ADDRESS + cmd[3] = 1 /*<< 2*/; // AUDIO + // cmd[7] = 1; // NPA + cmd[8] = 6; // allocation length + + if (sendCmd(cmd, 10, NULL, 0, data, 6, showError) != 0) { + if (showError) + log_message(-2, "Cannot retrieve next writable address."); + return 1; + } + + *lba = (data[1] << 24) | (data[2] << 16) | (data[3] << 8) | data[4]; + + return 0; +} + +// Retrieve disk information. +// return: DiskInfo structure or 'NULL' on error +DiskInfo *CDD2600::diskInfo() +{ + unsigned char cmd[10]; + unsigned char data[34]; + long nwa; + int i; + + memset(&diskInfo_, 0, sizeof(DiskInfo)); + + if (readCapacity(&(diskInfo_.capacity), 0) == 0) { + diskInfo_.valid.capacity = 1; + } + + if (readSessionInfo(&leadInLength_, &leadOutLength_, 0) == 0) { + diskInfo_.valid.manufacturerId = 1; + + // start time of lead-in + diskInfo_.manufacturerId = Msf(450150 - leadInLength_ - 150 ); + diskInfo_.append = 1; // this is for the CDD2000 which does not support + // READ DISK INFORMATION + } + else { + diskInfo_.append = 0; // this is for the CDD2000 which does not support + // READ DISK INFORMATION + } + diskInfo_.valid.empty = 1; + diskInfo_.valid.append = 1; + + memset(cmd, 0, 10); + memset(data, 0, 4); + + cmd[0] = 0x43; // READ TOC + cmd[6] = 0; + cmd[8] = 4; + + if (sendCmd(cmd, 10, NULL, 0, data, 4, 0) == 0) { + log_message(5, "First track %u, last track %u", data[2], data[3]); + diskInfo_.lastTrackNr = data[3]; + } + else { + log_message(5, "READ TOC (format 0) failed."); + } + + if (diskInfo_.lastTrackNr > 0) { + // the lead-in length does not specify the manufacturer ID anymore + diskInfo_.valid.manufacturerId = 0; + + diskInfo_.empty = 0; // CD-R is not empty + diskInfo_.diskTocType = 0xff; // undefined + + if (diskInfo_.lastTrackNr < 99 && nextWritableAddress(&nwa, 0) == 0) { + log_message(5, "NWA: %ld", nwa); + diskInfo_.thisSessionLba = nwa; + diskInfo_.append = 1; + } + else { + diskInfo_.append = 0; + } + + + memset(cmd, 0, 10); + memset(data, 0, 12); + + cmd[0] = 0x43; // READ TOC + cmd[6] = 0; + cmd[8] = 12; + cmd[9] = 1 << 6; + + if (sendCmd(cmd, 10, NULL, 0, data, 12) == 0) { + diskInfo_.sessionCnt = data[3]; + diskInfo_.lastSessionLba = (data[8] << 24) | (data[9] << 16) | + (data[10] << 8) | data[11]; + + log_message(5, "First session %u, last session %u, last session start %ld", + data[2], data[3], diskInfo_.lastSessionLba); + } + else { + log_message(5, "READ TOC (format 1) failed."); + } + + if (diskInfo_.sessionCnt > 0) { + int len; + CdRawToc *toc = getRawToc(diskInfo_.sessionCnt, &len); + + if (toc != NULL) { + for (i = 0; i < len; i++) { + if (toc[i].sessionNr == diskInfo_.sessionCnt) { +#if 0 + if (toc[i].point == 0xb0 && toc[i].min != 0xff && + toc[i].sec != 0xff && toc[i].frame != 0xff) { + int m = toc[i].min; + int s = toc[i].sec; + int f = toc[i].frame; + + if (m < 90 && s < 60 && f < 75) { + diskInfo_.thisSessionLba = Msf(m, s, f).lba(); // + 150 - 150 + diskInfo_.thisSessionLba += leadInLength_; + } + } +#endif + if (toc[i].point == 0xa0) { + diskInfo_.diskTocType = toc[i].psec; + } + } + + // The point C0 entry may be only stored in the first session's + // lead-in + if (toc[i].point == 0xc0 && toc[i].pmin <= 99 && + toc[i].psec < 60 && toc[i].pframe < 75) { + diskInfo_.manufacturerId = + Msf(toc[i].pmin, toc[i].psec, toc[i].pframe); + diskInfo_.valid.manufacturerId = 1; + } + } + +#if 0 + if (diskInfo_.thisSessionLba > 0) { + if (diskInfo_.lastTrackNr < 99) + diskInfo_.append = 1; + } + else { + log_message(4, "Did not find BO pointer in session %d.", + diskInfo_.sessionCnt); + + } +#endif + + delete[] toc; + } + else { + log_message(5, "getRawToc failed."); + } + } + } + else { + // disk is empty and appendable + diskInfo_.empty = 1; + } + + if (diskInfo_.append == 0) + diskInfo_.empty = 0; + + return &diskInfo_; +} + +CdRawToc *CDD2600::getRawToc(int sessionNr, int *len) +{ + unsigned char cmd[10]; + unsigned short dataLen; + unsigned char *data = NULL;; + unsigned char reqData[4]; // buffer for requestion the actual length + unsigned char *p = NULL; + int i; + CdRawToc *rawToc; + int entries; + + assert(sessionNr >= 1); + + // read disk toc length + memset(cmd, 0, 10); + cmd[0] = 0x43; // READ TOC + cmd[6] = sessionNr; + cmd[8] = 4; + cmd[9] |= 2 << 6; // get Q subcodes + + if (sendCmd(cmd, 10, NULL, 0, reqData, 4) != 0) { + log_message(-2, "Cannot read raw disk toc."); + return NULL; + } + + dataLen = ((reqData[0] << 8) | reqData[1]) + 2; + + log_message(5, "Raw toc data len: %d", dataLen); + + data = new unsigned char[dataLen]; + + // read disk toc + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen) != 0) { + log_message(-2, "Cannot read raw disk toc."); + delete[] data; + return NULL; + } + + entries = (((data[0] << 8) | data[1]) - 2) / 11; + + + rawToc = new CdRawToc[entries]; + + for (i = 0, p = data + 4; i < entries; i++, p += 11 ) { +#if 0 + log_message(0, "%d %02x %02d %2x %02d:%02d:%02d %02x %02d:%02d:%02d", + p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10]); +#endif + rawToc[i].sessionNr = p[0]; + rawToc[i].adrCtl = p[1]; + rawToc[i].point = p[3]; + rawToc[i].min = p[4]; + rawToc[i].sec = p[5]; + rawToc[i].frame = p[6]; + rawToc[i].pmin = p[8]; + rawToc[i].psec = p[9]; + rawToc[i].pframe = p[10]; + } + + delete[] data; + + *len = entries; + + return rawToc; +} + +long CDD2600::readTrackData(TrackData::Mode mode, TrackData::SubChannelMode, + long lba, long len, unsigned char *buf) +{ + unsigned char cmd[10]; + long blockLen = 2340; + long i; + TrackData::Mode actMode; + int ok = 0; + const unsigned char *sense; + int senseLen; + int softError; + + if (setBlockSize(blockLen) != 0) + return 0; + + memset(cmd, 0, 10); + + cmd[0] = 0x28; // READ10 + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + + /* + if (mode == TrackData::MODE2_FORM1 || mode == TrackData::MODE2_FORM2) + cmd[9] = 1 << 6; // MIX flag + */ + + while (len > 0 && !ok) { + cmd[7] = len >> 8; + cmd[8] = len; + + memset(transferBuffer_, 0, len * blockLen); + switch (sendCmd(cmd, 10, NULL, 0, transferBuffer_, len * blockLen, 0)) { + case 0: + ok = 1; + break; + + case 2: + softError = 0; + sense = scsiIf_->getSense(senseLen); + + if (senseLen > 0x0c) { + if ((sense[2] &0x0f) == 5) { + switch (sense[12]) { + case 0x64: // Illegal mode for this track + softError = 1; + break; + } + } + else if ((sense[2] & 0x0f) == 3) { // Medium error + switch (sense[12]) { + case 0x02: // No seek complete, sector not found + case 0x11: // L-EC error + return -2; + break; + } + } + } + + if (!softError) { + scsiIf_->printError(); + return -1; + } + break; + + default: + log_message(-2, "Read error at LBA %ld, len %ld", lba, len); + return -1; + break; + } + + if (!ok) { + len--; + } + } + + unsigned char *sector = transferBuffer_; + for (i = 0; i < len; i++) { + actMode = determineSectorMode(sector); + + if (!(actMode == mode || + (mode == TrackData::MODE2_FORM_MIX && + (actMode == TrackData::MODE2_FORM1 || + actMode == TrackData::MODE2_FORM2)) || + + (mode == TrackData::MODE1_RAW && actMode == TrackData::MODE1) || + + (mode == TrackData::MODE2_RAW && + (actMode == TrackData::MODE2 || + actMode == TrackData::MODE2_FORM1 || + actMode == TrackData::MODE2_FORM2)))) { + return i; + } + + if (buf != NULL) { + switch (mode) { + case TrackData::MODE1: + memcpy(buf, sector + 4, MODE1_BLOCK_LEN); + buf += MODE1_BLOCK_LEN; + break; + case TrackData::MODE2: + case TrackData::MODE2_FORM_MIX: + memcpy(buf, sector + 4, MODE2_BLOCK_LEN); + buf += MODE2_BLOCK_LEN; + break; + case TrackData::MODE2_FORM1: + memcpy(buf, sector + 12, MODE2_FORM1_DATA_LEN); + buf += MODE2_FORM1_DATA_LEN; + break; + case TrackData::MODE2_FORM2: + memcpy(buf, sector + 12, MODE2_FORM2_DATA_LEN); + buf += MODE2_FORM2_DATA_LEN; + break; + case TrackData::MODE1_RAW: + case TrackData::MODE2_RAW: + memcpy(buf, syncPattern, 12); + memcpy(buf + 12, sector, 2340); + buf += AUDIO_BLOCK_LEN; + break; + case TrackData::MODE0: + case TrackData::AUDIO: + log_message(-3, "CDD2600::readTrackData: Illegal mode."); + return 0; + break; + } + } + + sector += blockLen; + } + + return len; +} + +int CDD2600::readSubChannels(TrackData::SubChannelMode, long lba, long len, + SubChannel ***chans, Sample *audioData) +{ + unsigned char cmd[10]; + int tries = 5; + int ret; + + if (setBlockSize(AUDIO_BLOCK_LEN) != 0) + return 1; + + memset(cmd, 0, 10); + + cmd[0] = 0x28; // READ10 + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + cmd[7] = len >> 8; + cmd[8] = len; + + do { + ret = sendCmd(cmd, 10, NULL, 0, + (unsigned char*)audioData, len * AUDIO_BLOCK_LEN, + (tries == 1) ? 1 : 0); + + if (ret != 0 && tries == 1) { + log_message(-2, "Reading of audio data failed at sector %ld.", lba); + return 1; + } + + tries--; + } while (ret != 0 && tries > 0); + + *chans = NULL; + return 0; +} + +int CDD2600::readAudioRange(ReadDiskInfo *rinfo, int fd, long start, long end, + int startTrack, int endTrack, + TrackInfo *info) +{ + if (!onTheFly_) { + int t; + + log_message(1, "Analyzing..."); + + for (t = startTrack; t <= endTrack; t++) { + long totalProgress; + + totalProgress = t * 1000; + totalProgress /= rinfo->tracks; + + sendReadCdProgressMsg(RCD_ANALYZING, rinfo->tracks, t + 1, 0, + totalProgress); + + log_message(2, "Track %d...", t + 1); + info[t].isrcCode[0] = 0; + readIsrc(t + 1, info[t].isrcCode); + + if (info[t].isrcCode[0] != 0) + log_message(2, "Found ISRC code."); + + totalProgress = (t + 1) * 1000; + totalProgress /= rinfo->tracks; + + sendReadCdProgressMsg(RCD_ANALYZING, rinfo->tracks, t + 1, 1000, + totalProgress); + } + + log_message(1, "Reading..."); + } + + return CdrDriver::readAudioRangeParanoia(rinfo, fd, start, end, startTrack, + endTrack, info); +} diff --git a/dao/CDD2600.h b/dao/CDD2600.h new file mode 100644 index 0000000..b30b52b --- /dev/null +++ b/dao/CDD2600.h @@ -0,0 +1,95 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __CDD2600_H__ +#define __CDD2600_H__ + +#include "CdrDriver.h" +#include "CDD2600Base.h" +class Toc; +class Track; + +class CDD2600 : public CdrDriver, private CDD2600Base { +public: + + CDD2600(ScsiIf *scsiIf, unsigned long options); + ~CDD2600(); + + static CdrDriver *instance(ScsiIf *scsiIf, unsigned long options); + + unsigned long getReadCapabilities(const CdToc *, int) const { return 0; } + + // CDD2600 takes big endian samples + int bigEndianSamples() const { return 1; } + + int speed(int); + + DiskInfo *diskInfo(); + + int loadUnload(int) const; + + int initDao(const Toc *); + int startDao(); + int finishDao(); + void abortDao(); + + int writeData(TrackData::Mode, TrackData::SubChannelMode, long &lba, + const char *buf, long len); + + Toc *readDiskToc(int, const char *); + Toc *readDisk(int, const char *); + +protected: + DiskInfo diskInfo_; + + CdRawToc *getRawToc(int sessionNr, int *len); + int readCatalog(Toc *, long startLba, long endLba); + int readIsrc(int, char *); + int getTrackIndex(long lba, int *trackNr, int *indexNr, unsigned char *ctl); + int analyzeTrack(TrackData::Mode, int trackNr, long startLba, long endLba, + Msf *index, + int *indexCnt, long *pregap, char *isrcCode, + unsigned char *ctl); + int readSubChannels(TrackData::SubChannelMode, long lba, long len, + SubChannel ***, Sample *); + + +private: + long leadInLength_; + long leadOutLength_; + + int modeSelectPlay(int immediate, int sotc, unsigned char volume); + + int readSubChannelData(int *trackNr, int *indexNr, long *, + unsigned char *ctl); + + void readBlock(unsigned long sector); + + long readTrackData(TrackData::Mode, TrackData::SubChannelMode, long lba, + long len, unsigned char *buf); + + int readAudioRange(ReadDiskInfo *, int fd, long start, long end, + int startTrack, int endTrack, TrackInfo *); + + int nextWritableAddress(long *lba, int showError); + + +}; + +#endif diff --git a/dao/CDD2600Base.cc b/dao/CDD2600Base.cc new file mode 100644 index 0000000..3be4112 --- /dev/null +++ b/dao/CDD2600Base.cc @@ -0,0 +1,324 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <string.h> +#include <assert.h> + +#include "CDD2600Base.h" +#include "SubChannel.h" +#include "Toc.h" +#include "log.h" + +CDD2600Base::CDD2600Base(CdrDriver *driver) +{ + driver_ = driver; +} + +CDD2600Base::~CDD2600Base() +{ + driver_ = NULL; +} + +// sets the block length +// return: 0: OK +// 1: scsi command failed +int CDD2600Base::modeSelectBlockSize(int blockSize, int showMsg) +{ + unsigned char cmd[6]; + unsigned char data[12]; + + memset(cmd, 0, 6); + memset(data, 0, 12); + + cmd[0] = 0x15; // MODE SELECT + cmd[4] = 12; + + data[3] = 8; + + data[9] = blockSize >> 16; + data[10] = blockSize >> 8; + data[11] = blockSize; + + if (driver_->sendCmd(cmd, 6, data, 12, NULL, 0, showMsg) != 0) { + if (showMsg) + log_message(-2, "Cannot set block size to %d.", blockSize); + return 1; + } + + return 0; +} + +// sets read/write speed and simulation mode +// return: 0: OK +// 1: scsi command failed +int CDD2600Base::modeSelectSpeed(int readSpeed, int writeSpeed, int simulate, + int showMessage) +{ + unsigned char mp[8]; + + memset(mp, 0, 8); + + mp[0] = 0x23; + mp[1] = 0x06; + if (writeSpeed >= 0) { + mp[2] = writeSpeed; + } + mp[3] = (simulate != 0 ? 1 : 0); + if (readSpeed >= 0) { + mp[4] = readSpeed; + } + + if (driver_->setModePage(mp, NULL, NULL, showMessage) != 0) { + if (showMessage) { + log_message(-2, "Cannot set speed/simulation mode."); + } + return 1; + } + + return 0; +} + +// Sets catalog number if valid in given TOC. +// return: 0: OK +// 1: scsi command failed +int CDD2600Base::modeSelectCatalog(const Toc *toc) +{ + unsigned char mp[10]; + + memset(mp, 0, 10); + + mp[0] = 0x22; + mp[1] = 0x08; + + if (toc->catalogValid()) { + mp[2] = 0x01; + mp[3] = (toc->catalog(0) << 4) | toc->catalog(1); + mp[4] = (toc->catalog(2) << 4) | toc->catalog(3); + mp[5] = (toc->catalog(4) << 4) | toc->catalog(5); + mp[6] = (toc->catalog(6) << 4) | toc->catalog(7); + mp[7] = (toc->catalog(8) << 4) | toc->catalog(9); + mp[8] = (toc->catalog(10) << 4) | toc->catalog(11); + mp[9] = (toc->catalog(12) << 4); + } + + if (driver_->setModePage(mp, NULL, NULL, 1) != 0) { + log_message(-2, "Cannot set catalog number."); + return 1; + } + + return 0; +} + + +// Requests length of lead-in and lead-out. +// return: 0: OK +// 1: scsi command failed +int CDD2600Base::readSessionInfo(long *leadInLen, long *leadOutLen, + int showMessage) +{ + unsigned char cmd[10]; + unsigned char data[4]; + + memset(cmd, 0, 10); + memset(data, 0, 4); + + cmd[0] = 0xee; // READ SESSION INFO + cmd[8] = 4; + + if (driver_->sendCmd(cmd, 10, NULL, 0, data, 4, showMessage) != 0) { + if (showMessage) + log_message(-2, "Cannot read session info."); + return 1; + } + + *leadInLen = (data[0] << 8) | data[1]; + *leadOutLen = (data[2] << 8) | data[3]; + + log_message(4, "Lead-in length: %ld, lead-out length: %ld", *leadInLen, + *leadOutLen); + + return 0; +} + +// Sends initiating write session command for disk at once writing. This +// includes the complete table of contents with all related data. +// return: 0: OK +// 1: scsi command failed +int CDD2600Base::writeSession(const Toc *toc, int multiSession, long lbaOffset) +{ + unsigned char cmd[10]; + unsigned char *data = NULL; + unsigned int dataLen = 0; + unsigned char *tp = NULL; + unsigned int tdl = 0; // track descriptor length + int cdromMode = 0; + int indexCount = 0; + int i; + int n; + const Track *t; + Msf start, end, index; + + TrackIterator itr(toc); + + // count total number of index increments + for (t = itr.first(start, end); t != NULL; t = itr.next(start, end)) { + indexCount += t->nofIndices(); + } + + dataLen = toc->nofTracks() * 20 + indexCount * 4; + + /* + log_message(0, "%d tracks, %d indexes -> dataLen %u", toc->nofTracks(), + indexCount, dataLen); + */ + + data = new unsigned char[dataLen]; + memset(data, 0, dataLen); + tp = data; + + memset(cmd, 0, 10); + + cmd[0] = 0xed; // write session + + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + // setup toc-type, lead-out type and multi session flag + cmd[6] = 0; + + + switch (toc->tocType()) { + case Toc::CD_DA: + case Toc::CD_ROM: + cmd[6] = 0; + break; + case Toc::CD_ROM_XA: + cmd[6] = 3; + break; + case Toc::CD_I: + cmd[6] = 4; + break; + } + + if (cdromMode) { + // Programming manual says that lead-out fixation parameter is only + + // valid if the toc-type is CD-ROM. Unfortunately it does not tell + // which values to set. +#if 0 + switch (toc->leadOutMode()) { + case TrackData::MODE1: + cmd[6] |= 1 << 4; + break; + case TrackData::MODE2: + case TrackData::MODE2_FORM1: + case TrackData::MODE2_FORM2: + case TrackData::MODE2_FORM_MIX: + cmd[6] |= 2 << 4; + break; + default: + break; + } +#endif + } + + if (multiSession != 0) + cmd[6] |= 1 << 3; // open next session + + for (t = itr.first(start, end); t != NULL; t = itr.next(start, end)) { + n = t->nofIndices(); + tdl = 20 + n * 4; + tp[0] = tdl >> 8; + tp[1] = tdl; + + start = Msf(start.lba() + lbaOffset); + end = Msf(end.lba() + lbaOffset); + + tp[2] = 0; + if (t->copyPermitted()) { + tp[2] |= 0x02; + } + if (t->type() == TrackData::AUDIO) { + // audio track + if (t->preEmphasis()) { + tp[2] |= 0x01; + } + if (t->audioType() == 1) { + tp[2] |= 0x08; + } + + if (t->isrcValid()) { + tp[2] |= 0x80; + + tp[3] = SubChannel::ascii2Isrc(t->isrcCountry(0)); + tp[4] = SubChannel::ascii2Isrc(t->isrcCountry(1)); + tp[5] = SubChannel::ascii2Isrc(t->isrcOwner(0)); + tp[6] = SubChannel::ascii2Isrc(t->isrcOwner(1)); + tp[7] = SubChannel::ascii2Isrc(t->isrcOwner(2)); + tp[8] = (t->isrcYear(0) << 4) | t->isrcYear(1); + tp[9] = (t->isrcSerial(0) << 4) | t->isrcSerial(1); + tp[10] = (t->isrcSerial(2) << 4) | t->isrcSerial(3); + tp[11] = (t->isrcSerial(4) << 4); + } + } + else { + // data track + tp[2] |= 0x04; + } + + log_message(4, "Track start: %s(0x%06lx)", start.str(), start.lba()); + tp[12] = start.lba() >> 24; + tp[13] = start.lba() >> 16; + tp[14] = start.lba() >> 8; + tp[15] = start.lba(); + + for (i = 0; i < n; i++) { + index = start + t->getIndex(i); + log_message(4, " index: %s(0x%06lx)", index.str(), index.lba()); + + tp[16 + i * 4] = index.lba() >> 24; + tp[17 + i * 4] = index.lba() >> 16; + tp[18 + i * 4] = index.lba() >> 8; + tp[19 + i * 4] = index.lba(); + } + + log_message(4, " end : %s(0x%06lx)", end.str(), end.lba()); + + tp[16 + n * 4] = end.lba() >> 24; + tp[17 + n * 4] = end.lba() >> 16; + tp[18 + n * 4] = end.lba() >> 8; + tp[19 + n * 4] = end.lba(); + + tp += tdl; + } + + //log_message(0, "tp: %d", tp - data); + + if (driver_->sendCmd(cmd, 10, data, dataLen, NULL, 0) != 0) { + log_message(-2, "Cannot write disk toc."); + delete[] data; + return 1; + } + + delete[] data; + return 0; +} + diff --git a/dao/CDD2600Base.h b/dao/CDD2600Base.h new file mode 100644 index 0000000..e62147f --- /dev/null +++ b/dao/CDD2600Base.h @@ -0,0 +1,48 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* Basic disk-at-once writing methods for CDD2x00 writing interface. */ + +#ifndef __CDD2600_BASE_H__ +#define __CDD2600_BASE_H__ + +#include "CdrDriver.h" + +class Toc; +class Track; + +class CDD2600Base { +public: + CDD2600Base(CdrDriver *); + ~CDD2600Base(); + +protected: + int modeSelectBlockSize(int blockSize, int showMsg); + int modeSelectSpeed(int readSpeed, int writeSpeed, int simulate, + int showMessage); + int modeSelectCatalog(const Toc *); + + int readSessionInfo(long *, long *, int showMessage); + int writeSession(const Toc *, int multiSession, long lbaOffset); + +private: + CdrDriver *driver_; // driver for sending SCSI commands +}; + +#endif diff --git a/dao/CdTextEncoder.cc b/dao/CdTextEncoder.cc new file mode 100644 index 0000000..5334c92 --- /dev/null +++ b/dao/CdTextEncoder.cc @@ -0,0 +1,538 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include "CdTextEncoder.h" + +#include <stddef.h> +#include <string.h> +#include <assert.h> + +#include "log.h" +#include "Toc.h" +#include "CdTextItem.h" +#include "PWSubChannel96.h" + + +unsigned short CdTextEncoder::CRCTAB_[256] = { + 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7, 0x8108, + 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF, 0x1231, 0x0210, + 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6, 0x9339, 0x8318, 0xB37B, + 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE, 0x2462, 0x3443, 0x0420, 0x1401, + 0x64E6, 0x74C7, 0x44A4, 0x5485, 0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, + 0xF5CF, 0xC5AC, 0xD58D, 0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, + 0x5695, 0x46B4, 0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, + 0xC7BC, 0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823, + 0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B, 0x5AF5, + 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12, 0xDBFD, 0xCBDC, + 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A, 0x6CA6, 0x7C87, 0x4CE4, + 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41, 0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, + 0xAD2A, 0xBD0B, 0x8D68, 0x9D49, 0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, + 0x2E32, 0x1E51, 0x0E70, 0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, + 0x9F59, 0x8F78, 0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, + 0xE16F, 0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067, + 0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E, 0x02B1, + 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256, 0xB5EA, 0xA5CB, + 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D, 0x34E2, 0x24C3, 0x14A0, + 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xA7DB, 0xB7FA, 0x8799, 0x97B8, + 0xE75F, 0xF77E, 0xC71D, 0xD73C, 0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, + 0x7676, 0x4615, 0x5634, 0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, + 0xB98A, 0xA9AB, 0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, + 0x28A3, 0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A, + 0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92, 0xFD2E, + 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9, 0x7C26, 0x6C07, + 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1, 0xEF1F, 0xFF3E, 0xCF5D, + 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8, 0x6E17, 0x7E36, 0x4E55, 0x5E74, + 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0 +}; + + +class CdTextPackEntry { +public: + CdTextPackEntry(unsigned char packType, unsigned char trackNr, + unsigned char packId); + + int blockNr(); + void blockNr(int); + + void characterPos(int); + + union { + CdTextPack pack; + unsigned char packData[18]; + }; + + CdTextPackEntry *next_; +}; + +CdTextPackEntry::CdTextPackEntry(unsigned char packType, unsigned char trackNr, + unsigned char packId) +{ + memset(&pack, 0, sizeof(pack)); + next_ = NULL; + + pack.packType = packType; + pack.trackNumber = trackNr; + pack.sequenceNumber = packId; +} + +int CdTextPackEntry::blockNr() +{ + return (pack.blockCharacter >> 4) & 0x07; +} + +void CdTextPackEntry::blockNr(int blockNr) +{ + pack.blockCharacter &= 0x8f; + pack.blockCharacter |= (blockNr << 4) & 0x70; +} + +void CdTextPackEntry::characterPos(int pos) +{ + pack.blockCharacter &= 0xf0; + + if (pos > 15) { + pack.blockCharacter |= 0x0f; + } + else { + pack.blockCharacter |= pos; + } +} + + +CdTextEncoder::CdTextEncoder(const Toc *toc) +{ + int i; + + toc_ = toc; + + packCount_ = 0; + packs_ = lastPack_ = NULL; + lastPackPos_ = 0; + + subChannels_ = NULL; + subChannelCount_ = 0; + + for (i = 0; i < 8; i++) + memset(&(sizeInfo_[i]), 0, sizeof(CdTextSizeInfo)); +} + +CdTextEncoder::~CdTextEncoder() +{ + long i; + CdTextPackEntry *pnext; + + toc_ = NULL; + + while (packs_ != NULL) { + pnext = packs_->next_; + + delete packs_; + packs_ = pnext; + } + + lastPack_ = NULL; + + if (subChannels_ != NULL) { + for (i = 0; i < subChannelCount_; i++) { + delete subChannels_[i]; + subChannels_[i] = NULL; + } + + delete[] subChannels_; + subChannels_ = NULL; + } +} + +int CdTextEncoder::encode() +{ + buildPacks(); + + calcCrcs(); + + if (packs_ != NULL) { + log_message(4, "\nCD-TEXT packs:"); + CdTextPackEntry *prun; + for (prun = packs_; prun != NULL; prun = prun->next_) { + log_message(4, "%02x %02x %02x %02x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x CRC: %02x %02x", prun->pack.packType, + prun->pack.trackNumber, prun->pack.sequenceNumber, + prun->pack.blockCharacter, prun->pack.data[0], + prun->pack.data[1], prun->pack.data[2], prun->pack.data[3], + prun->pack.data[4], prun->pack.data[5], prun->pack.data[6], + prun->pack.data[7], prun->pack.data[8], prun->pack.data[9], + prun->pack.data[10], prun->pack.data[11], + prun->pack.crc0, prun->pack.crc1); + } + } + + buildSubChannels(); + + return 0; +} + +const PWSubChannel96 **CdTextEncoder::getSubChannels(long *subChannelCount) +{ + *subChannelCount = subChannelCount_; + + return (const PWSubChannel96 **)subChannels_; +} + +void CdTextEncoder::buildPacks() +{ + int blockNr; + + for (blockNr = 0; blockNr <= 7; blockNr++) { + if (toc_->cdTextLanguage(blockNr) >= 0) { + // only build the packs if the language code is defined + packId_ = 0; + + buildPacks(blockNr, CdTextItem::CDTEXT_TITLE); + buildPacks(blockNr, CdTextItem::CDTEXT_PERFORMER); + buildPacks(blockNr, CdTextItem::CDTEXT_SONGWRITER); + buildPacks(blockNr, CdTextItem::CDTEXT_COMPOSER); + buildPacks(blockNr, CdTextItem::CDTEXT_ARRANGER); + buildPacks(blockNr, CdTextItem::CDTEXT_MESSAGE); + buildPacks(blockNr, CdTextItem::CDTEXT_DISK_ID); + buildPacks(blockNr, CdTextItem::CDTEXT_GENRE); + buildPacks(blockNr, CdTextItem::CDTEXT_TOC_INFO1); + buildPacks(blockNr, CdTextItem::CDTEXT_TOC_INFO2); + buildPacks(blockNr, CdTextItem::CDTEXT_UPCEAN_ISRC); + } + } + + buildSizeInfoPacks(); +} + +// Build packs for specified language (blockNr) and pack type. First the +// global pack is created and then the track specific packs. +void CdTextEncoder::buildPacks(int blockNr, CdTextItem::PackType type) +{ + const CdTextItem *globalItem; + const CdTextItem *item; + int i; + int n = toc_->nofTracks(); + int tracks; + int offset = toc_->firstTrackNo() == 0 ? 0 : toc_->firstTrackNo() - 1; + + if ((globalItem = toc_->getCdTextItem(0, blockNr, type)) != NULL) { + encodeCdTextItem(0, blockNr, globalItem); + } + + if (CdTextItem::isTrackPack(type)) { + // count tracks that have the current pack type defined + tracks = 0; + + for (i = 1; i <= n; i++) { + if (toc_->getCdTextItem(i, blockNr, type) != NULL) + tracks++; + } + + if (tracks > 0) { + if (globalItem == NULL && type == CdTextItem::CDTEXT_UPCEAN_ISRC) { + // Special handling for UPC/EAN field. If this field is not defined + // but ISRC codes are defined for the tracks an pack with an empty + // string is created. + CdTextItem upcEan(CdTextItem::CDTEXT_UPCEAN_ISRC, blockNr, ""); + encodeCdTextItem(0, blockNr, &upcEan); + } + + for (i = 1; i <= n; i++) { + if ((item = toc_->getCdTextItem(i, blockNr, type)) == NULL) + item = globalItem; + + if (item != NULL) + encodeCdTextItem(offset + i, blockNr, item); + } + } + } +} + +// Build CD-TEXT packs for a CdTextItem. Space from the last pack is +// used if the pack type and language are matching. +void CdTextEncoder::encodeCdTextItem(int trackNr, int blockNr, + const CdTextItem *item) +{ + long dataLen = item->dataLen(); + const unsigned char *data = item->data(); + long pos, n; + CdTextPackEntry *pack = NULL; + int first = 1; + + if (CdTextItem::isBinaryPack(item->packType())) { + pos = 0; + + while (dataLen > 0) { + switch (item->packType()) { + case CdTextItem::CDTEXT_GENRE: + pack = new CdTextPackEntry(item->packType(), 0, packId_++); + if (pos > 0) + pack->characterPos((pos * 12) - 2); + break; + case CdTextItem::CDTEXT_TOC_INFO1: + if (pos == 0) + pack = new CdTextPackEntry(item->packType(), 0, packId_++); + else + pack = new CdTextPackEntry(item->packType(), ((pos - 1) * 4) + 1, + packId_++); + break; + default: + pack = new CdTextPackEntry(item->packType(), pos, packId_++); + break; + } + + n = (dataLen > 12) ? 12 : dataLen; + + memcpy(pack->pack.data, data, n); + pack->blockNr(blockNr); + + appendPack(pack); + lastPackPos_ = 12; + + data += n; + dataLen -= n; + pos++; + } + } + else { + pos = 0; + + while (dataLen > 0) { + if (first && lastPack_ != NULL && + lastPack_->pack.packType == item->packType() && + lastPack_->blockNr() == blockNr && + lastPackPos_ < 12) { + // we can use space from previous block + pack = lastPack_; + } + else { + pack = new CdTextPackEntry(item->packType(), trackNr, packId_++); + pack->blockNr(blockNr); + pack->characterPos(pos); + appendPack(pack); + lastPackPos_ = 0; + } + + n = (dataLen > 12 - lastPackPos_) ? 12 - lastPackPos_ : dataLen; + + memcpy(pack->pack.data + lastPackPos_, data, n); + + data += n; + lastPackPos_ += n; + pos += n; + dataLen -= n; + + first = 0; + } + } +} + +// Create the SIZE_INFO CD-TEXT packs which contains a summary about all +// CD-TEXT packs. +void CdTextEncoder::buildSizeInfoPacks() +{ + CdTextItem *sizeInfoItem; + int i; + int b; + + if (lastPack_ == NULL) { + // no packs at all -> nothing to do + return; + } + + for (b = 0; b < 8; b++) { + sizeInfo_[b].characterCode = 0; // ISO/IEC 8859-1 + + sizeInfo_[b].firstTrack = toc_->firstTrackNo() == 0 ? 1 : toc_->firstTrackNo(); + sizeInfo_[b].lastTrack = toc_->firstTrackNo() == 0 ? toc_->nofTracks() : toc_->firstTrackNo() + toc_->nofTracks() - 1; + + sizeInfo_[b].copyright = 0; // no copy protection + + for (i = 0; i < 8; i++) { + if (sizeInfo_[b].lastSequenceNumber[i] > 0) { + // set language code if we have at least one pack for this language + sizeInfo_[b].languageCode[i] = toc_->cdTextLanguage(i); + // adjust the last sequence number for the packs we will create + sizeInfo_[b].lastSequenceNumber[i] += 3; + } + } + + // adjust the counter for the packs we're currently creating + sizeInfo_[b].packTypeCount[15] += 3; // we create 3 packs + } + + for (b = 0; b < 8; b++) { + if (sizeInfo_[b].lastSequenceNumber[b] > 0) { + // ' - 3' because we've already adjusted the pack count + packId_ = sizeInfo_[b].lastSequenceNumber[b] - 3 + 1; + + sizeInfoItem = new CdTextItem(CdTextItem::CDTEXT_SIZE_INFO, b, + (unsigned char*)&(sizeInfo_[b]), + sizeof(CdTextSizeInfo)); + + encodeCdTextItem(0, b, sizeInfoItem); + + delete sizeInfoItem; + } + } +} + +// Calculates checksum for each CD-TEXT pack. +void CdTextEncoder::calcCrcs() +{ + CdTextPackEntry *prun; + register unsigned char data; + register unsigned short crc; + register int i; + + for (prun = packs_; prun != NULL; prun = prun->next_) { + crc = 0; + + for (i = 0; i < 16; i++) { + data = prun->packData[i]; + crc = CRCTAB_[(crc >> 8) ^ data] ^ (crc << 8); + } + + crc = ~crc; + + prun->pack.crc0 = crc >> 8; + prun->pack.crc1 = crc; + } +} + +// Builds the R-W sub-channel data for all CD-TEXT packs. The sub-channel +// data of each sector can hold 4 CD-TEXT packs. +void CdTextEncoder::buildSubChannels() +{ + long i, j; + CdTextPackEntry *prun; + unsigned char buf[72]; + + switch (packCount_ % 4) { + case 0: + subChannelCount_ = packCount_ / 4; + break; + case 2: + subChannelCount_ = packCount_ / 2; + break; + default: + subChannelCount_ = packCount_; + break; + } + + if (subChannelCount_ == 0) { + subChannels_ = NULL; + return; + } + + subChannels_ = new PWSubChannel96*[subChannelCount_]; + + prun = packs_; + + for (i = 0; i < subChannelCount_; i++) { + subChannels_[i] = new PWSubChannel96; + + for (j = 0; j < 4; j++) { + memcpy(buf + j * 18, prun->packData, 18); + + if ((prun = prun->next_) == NULL) + prun = packs_; + } + + subChannels_[i]->setRawRWdata(buf); + +#if 0 + int k; + + for (j = 0; j < 6; j++) { + log_message(0, "%ld:%d: ", i, j); + for (k = 0; k < 16; k++) { + log_message(0, "%02x ", subChannels_[i]->data()[j * 16 + k]); + } + log_message(0, ""); + } + + unsigned char buf1[72]; + + subChannels_[i]->getRawRWdata(buf1); + + log_message(0, "Match: %d", memcmp(buf, buf1, 72)); +#endif + } + + + assert(prun == packs_); +} + + +void CdTextEncoder::appendPack(CdTextPackEntry *pack) +{ + int b; + + assert(pack->blockNr() >= 0 && pack->blockNr() <= 7); + + pack->next_ = NULL; + + if (packs_ == NULL) { + packs_ = lastPack_ = pack; + } + else { + if (pack->blockNr() >= lastPack_->blockNr()) { + lastPack_->next_ = pack; + lastPack_ = pack; + } + else { + CdTextPackEntry *prun, *ppred; + + for (ppred = NULL, prun = packs_; prun != NULL; + ppred = prun, prun = prun->next_) { + if (pack->blockNr() < prun->blockNr()) + break; + } + + if (prun == NULL) { + // this case should have been handled above + lastPack_->next_ = pack; + lastPack_ = pack; + } + else { + if (ppred == NULL) { + pack->next_ = packs_; + packs_ = pack; + } + else { + ppred->next_ = pack; + pack->next_ = prun; + } + } + } + } + + packCount_++; + + // update summary data used for creating the SIZE_INFO pack + sizeInfo_[pack->blockNr()].packTypeCount[pack->pack.packType - 0x80] += 1; + + for (b = 0; b < 8; b++) { + if (pack->pack.sequenceNumber > + sizeInfo_[b].lastSequenceNumber[pack->blockNr()]) { + sizeInfo_[b].lastSequenceNumber[pack->blockNr()] = + pack->pack.sequenceNumber; + } + } +} diff --git a/dao/CdTextEncoder.h b/dao/CdTextEncoder.h new file mode 100644 index 0000000..dbef858 --- /dev/null +++ b/dao/CdTextEncoder.h @@ -0,0 +1,87 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998, 1999 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * $Log: CdTextEncoder.h,v $ + * Revision 1.1.1.1 2000/02/05 01:34:49 llanero + * Uploaded cdrdao 1.1.3 with pre10 patch applied. + * + * Revision 1.1 1999/06/13 19:31:15 mueller + * Initial revision + * + */ + +#ifndef __CD_TEXT_ENCODER_H__ +#define __CD_TEXT_ENCODER_H__ + +#include "CdrDriver.h" +#include "CdTextItem.h" + +class CdTextItem; +class PWSubChannel96; + +class CdTextEncoder { +public: + CdTextEncoder(const Toc *); + ~CdTextEncoder(); + + int encode(); + + const PWSubChannel96 **getSubChannels(long *subChannelCount); + +private: + struct CdTextSizeInfo { + unsigned char characterCode; + unsigned char firstTrack; + unsigned char lastTrack; + unsigned char copyright; + unsigned char packTypeCount[16]; + unsigned char lastSequenceNumber[8]; + unsigned char languageCode[8]; + }; + + const Toc *toc_; + + CdTextSizeInfo sizeInfo_[8]; + + long packCount_; + class CdTextPackEntry *packs_; + class CdTextPackEntry *lastPack_; + int lastPackPos_; // number of characters written to last pack + + long packId_; + + PWSubChannel96 **subChannels_; + long subChannelCount_; + + static unsigned short CRCTAB_[256]; + + void appendPack(CdTextPackEntry *); + + void buildPacks(); + void buildPacks(int blockNr, CdTextItem::PackType type); + void buildSizeInfoPacks(); + void calcCrcs(); + void buildSubChannels(); + + void encodeCdTextItem(int, int, const CdTextItem *); + +}; + +#endif diff --git a/dao/CdrDriver.cc b/dao/CdrDriver.cc new file mode 100644 index 0000000..ee89620 --- /dev/null +++ b/dao/CdrDriver.cc @@ -0,0 +1,4367 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <sys/types.h> +#include <sys/stat.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <errno.h> +#include <assert.h> +#include <fcntl.h> +#include <unistd.h> +#include <ctype.h> + +#include "CdrDriver.h" +#include "PWSubChannel96.h" +#include "Toc.h" +#include "util.h" +#include "log.h" +#include "CdTextItem.h" +#include "data.h" +#include "port.h" + +// all drivers +#include "CDD2600.h" +#include "PlextorReader.h" +#include "PlextorReaderScan.h" +#include "GenericMMC.h" +#include "GenericMMCraw.h" +#include "RicohMP6200.h" +#include "TaiyoYuden.h" +#include "YamahaCDR10x.h" +#include "TeacCdr55.h" +#include "SonyCDU920.h" +#include "SonyCDU948.h" +#include "ToshibaReader.h" + +// Paranoia DAE related +#include "cdda_interface.h" +#include "../paranoia/cdda_paranoia.h" + + +typedef CdrDriver *(*CdrDriverConstructor)(ScsiIf *, unsigned long); + +struct DriverSelectTable { + const char *driverId; + const char *vendor; + const char *model; + unsigned long options; + struct DriverSelectTable *next; +}; + +struct DriverTable { + const char *driverId; + CdrDriverConstructor constructor; +}; + +static DriverSelectTable *READ_DRIVER_TABLE = NULL; +static DriverSelectTable *WRITE_DRIVER_TABLE = NULL; + +static DriverSelectTable BUILTIN_READ_DRIVER_TABLE[] = { +{ "generic-mmc", "ASUS", "CD-S340", 0, NULL }, +{ "generic-mmc", "ASUS", "CD-S400", 0, NULL }, +{ "generic-mmc", "ASUS", "CD-S500/A", OPT_MMC_NO_SUBCHAN, NULL }, +{ "generic-mmc", "ASUS", "DVD-ROM E608", 0, NULL }, +{ "generic-mmc", "E-IDE", "CD-950E/TKU", 0, NULL }, +{ "generic-mmc", "E-IDE", "CD-ROM 36X/AKU", 0, NULL }, +{ "generic-mmc", "E-IDE", "CD-ROM 52X/AKH", 0, NULL }, +{ "generic-mmc", "FUNAI", "E295X", 0, NULL }, +{ "generic-mmc", "Goldstar", "CD-RW CED-8042B", 0, NULL }, +{ "generic-mmc", "HITACHI", "CDR-7730", 0, NULL }, +{ "generic-mmc", "HITACHI", "CDR-8435", OPT_MMC_NO_SUBCHAN, NULL }, +{ "generic-mmc", "LG", "CD-ROM CRD-8480C", OPT_MMC_NO_SUBCHAN, NULL }, +{ "generic-mmc", "LG", "CD-ROM CRD-8482B", OPT_MMC_NO_SUBCHAN, NULL }, +{ "generic-mmc", "LG", "CD-ROM CRD-8521B", 0, NULL }, +{ "generic-mmc", "LG", "DVD-ROM DRN8080B", OPT_DRV_GET_TOC_GENERIC, NULL }, +{ "generic-mmc", "LITE-ON", "CD-ROM", OPT_DRV_GET_TOC_GENERIC, NULL }, +{ "generic-mmc", "LITE-ON", "LTD-163", 0, NULL }, +{ "generic-mmc", "LITEON", "DVD-ROM LTD163D", 0, NULL }, +{ "generic-mmc", "MATSHITA", "CD-ROM CR-588", 0, NULL }, +{ "generic-mmc", "MATSHITA", "CD-ROM CR-589", OPT_MMC_USE_PQ|OPT_MMC_PQ_BCD, NULL }, +{ "generic-mmc", "MATSHITA", "DVD-ROM SR-8585", OPT_MMC_USE_PQ|OPT_MMC_PQ_BCD, NULL }, +{ "generic-mmc", "MEMOREX", "CD-233E", 0, NULL }, +{ "generic-mmc", "MITSUMI", "CD-ROM FX4820", OPT_MMC_NO_SUBCHAN, NULL }, +{ "generic-mmc", "OPTICS_S", "8622", 0, NULL }, +{ "generic-mmc", "PHILIPS", "36X/AKU", 0, NULL }, +{ "generic-mmc", "PHILIPS", "CD-ROM PCCD052", 0, NULL }, +{ "generic-mmc", "PHILIPS", "E-IDE CD-ROM 36X", 0, NULL }, +{ "generic-mmc", "PIONEER", "CD-ROM DR-U32", OPT_DRV_GET_TOC_GENERIC|OPT_MMC_USE_PQ|OPT_MMC_PQ_BCD, NULL }, +{ "generic-mmc", "PIONEER", "DVD-103", OPT_MMC_USE_PQ|OPT_MMC_PQ_BCD, NULL }, +{ "generic-mmc", "PIONEER", "DVD-104", OPT_MMC_USE_PQ|OPT_MMC_PQ_BCD, NULL }, +{ "generic-mmc", "PIONEER", "DVD-105", OPT_MMC_USE_PQ|OPT_MMC_PQ_BCD, NULL }, +{ "generic-mmc", "SONY", "CD-ROM CDU31A-02", 0, NULL }, +{ "generic-mmc", "SONY", "CD-ROM CDU4821", 0, NULL }, +{ "generic-mmc", "SONY", "CDU5211", 0, NULL }, +{ "generic-mmc", "TEAC", "CD-524E", OPT_DRV_GET_TOC_GENERIC|OPT_MMC_USE_PQ|OPT_MMC_PQ_BCD, NULL }, +{ "generic-mmc", "TEAC", "CD-532E", OPT_MMC_USE_PQ|OPT_MMC_PQ_BCD, NULL }, +{ "generic-mmc", "TEAC", "CD-540E", 0, NULL }, +{ "generic-mmc", "TOSHIBA", "CD-ROM XM-3206B", 0, NULL }, +{ "generic-mmc", "TOSHIBA", "CD-ROM XM-6102B", 0, NULL }, +{ "generic-mmc", "TOSHIBA", "CD-ROM XM-6302B", 0, NULL }, +{ "generic-mmc", "TOSHIBA", "CD-ROM XM-6402B", 0, NULL }, +{ "generic-mmc", "TOSHIBA", "DVD-ROM SD-C2202", 0, NULL }, +{ "generic-mmc", "TOSHIBA", "DVD-ROM SD-C2302", 0, NULL }, +{ "generic-mmc", "TOSHIBA", "DVD-ROM SD-C2402", 0, NULL }, +{ "generic-mmc", "TOSHIBA", "DVD-ROM SD-M1102", 0, NULL }, +{ "generic-mmc", "TOSHIBA", "DVD-ROM SD-M1401", 0, NULL }, +{ "generic-mmc", "TOSHIBA", "DVD-ROM SD-M1402", 0, NULL }, +{ "plextor", "HITACHI", "DVD-ROM GD-2500", 0, NULL }, +{ "plextor", "MATSHITA", "CD-ROM CR-506", OPT_PLEX_DAE_D4_12, NULL }, +{ "plextor", "MATSHITA", "CR-8008", 0, NULL }, +{ "plextor", "NAKAMICH", "MJ-5.16S", 0, NULL }, +{ "plextor", "PIONEER", "CD-ROM DR-U03", OPT_DRV_GET_TOC_GENERIC, NULL }, +{ "plextor", "PIONEER", "CD-ROM DR-U06", OPT_DRV_GET_TOC_GENERIC, NULL }, +{ "plextor", "PIONEER", "CD-ROM DR-U10", OPT_DRV_GET_TOC_GENERIC, NULL }, +{ "plextor", "PIONEER", "CD-ROM DR-U12", OPT_DRV_GET_TOC_GENERIC, NULL }, +{ "plextor", "PIONEER", "CD-ROM DR-U16", OPT_DRV_GET_TOC_GENERIC, NULL }, +{ "plextor", "PIONEER", "DVD-303", 0, NULL }, +{ "plextor", "PIONEER", "DVD-305", 0, NULL }, +{ "plextor", "SAF", "CD-R2006PLUS", 0, NULL }, +{ "plextor", "SONY", "CD-ROM", 0, NULL }, +{ "plextor", "SONY", "CD-ROM CDU-76", 0, NULL }, +{ "plextor", "TOSHIBA", "XM-5401", 0, NULL }, +{ "plextor-scan", "PLEXTOR", "CD-ROM", 0, NULL }, +{ "plextor-scan", "PLEXTOR", "PX-40TS", 0, NULL }, +{ "plextor-scan", "PLEXTOR", "PX-40TW", 0, NULL }, +{ "plextor-scan", "PLEXTOR", "PX-63", 0, NULL }, +{ "plextor-scan", "TEAC", "CD-ROM CD-532S", OPT_PLEX_USE_PQ|OPT_PLEX_PQ_BCD, NULL }, +{ "teac-cdr55", "TEAC", "CD-532S", 0, NULL }, +{ "toshiba", "TOSHIBA", "1504", 0, NULL }, +{ "toshiba", "TOSHIBA", "CD-ROM XM-3601B", 0, NULL }, +{ "toshiba", "TOSHIBA", "CD-ROM XM-5302TA", 0, NULL }, +{ "toshiba", "TOSHIBA", "CD-ROM XM-5701TA", 0, NULL }, +{ "toshiba", "TOSHIBA", "CD-ROM XM-6201TA", 0, NULL }, +{ "toshiba", "TOSHIBA", "CD-ROM XM-6401TA", 0, NULL }, +{ "toshiba", "TOSHIBA", "DVD-ROM SD-2102", 0, NULL }, +{ NULL, NULL, NULL, 0, NULL }}; + +static DriverSelectTable BUILTIN_WRITE_DRIVER_TABLE[] = { +{ "cdd2600", "GRUNDIG", "CDR100IPW", 0, NULL }, +{ "cdd2600", "HP", "CD-Writer 4020", 0, NULL }, +{ "cdd2600", "HP", "CD-Writer 6020", 0, NULL }, +{ "cdd2600", "IMS", "522", 0, NULL }, +{ "cdd2600", "IMS", "CDD2000", 0, NULL }, +{ "cdd2600", "KODAK", "PCD-225", 0, NULL }, +{ "cdd2600", "PHILIPS", "CDD2000", 0, NULL }, +{ "cdd2600", "PHILIPS", "CDD2600", 0, NULL }, +{ "cdd2600", "PHILIPS", "CDD522", 0, NULL }, +{ "generic-mmc", "AOPEN", "CD-RW CRW1632", 0, NULL }, +{ "generic-mmc", "AOPEN", "CD-RW CRW2040", 0, NULL }, +{ "generic-mmc", "AOPEN", "CD-RW-241040", 0, NULL }, +{ "generic-mmc", "AOPEN", "CRW9624", 0, NULL }, +{ "generic-mmc", "CD-RW", "CDR-2440MB", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "CREATIVE", "CD-RW RW1210E", 0, NULL }, +{ "generic-mmc", "CREATIVE", "CD-RW RW4424", 0, NULL }, +{ "generic-mmc", "CREATIVE", "CD-RW RW8433E", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "CREATIVE", "CD5233E", 0, NULL }, +{ "generic-mmc", "DELTA", "OME-W141", 0, NULL }, +{ "generic-mmc", "GENERIC", "CRD-BP1600P", 0, NULL }, +{ "generic-mmc", "GENERIC", "CRD-R800S", 0, NULL }, +{ "generic-mmc", "GENERIC", "CRD-RW2", 0, NULL }, +{ "generic-mmc", "HL-DT-ST", "RW/DVD GCC-4120B", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "HP", "9510i", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "HP", "CD-Writer+ 7570", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "HP", "CD-Writer+ 8100", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "HP", "CD-Writer+ 8200", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "HP", "CD-Writer+ 8290", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "HP", "CD-Writer+ 9100", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "HP", "CD-Writer+ 9110", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "HP", "CD-Writer+ 9200", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "HP", "CD-Writer+ 9300", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "HP", "CD-Writer+ 9600", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "HP", "CD-Writer+ 9700", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "HP", "DVD Writer 100j", 0, NULL }, +{ "generic-mmc", "IDE-CD", "R/RW 16x10A", 0, NULL }, +{ "generic-mmc", "IMATION", "IMW121032IAB", 0, NULL }, +{ "generic-mmc", "LG", "8088B", 0, NULL }, +{ "generic-mmc", "LG", "8120B", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "LG", "CD-ROM CDR-8428B", 0, NULL }, +{ "generic-mmc", "LG", "CD-RW CED-8080B", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "LG", "CD-RW CED-8081B", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "LG", "CD-RW CED-8083B", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "LG", "CD-RW GCE-8240B", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "LG", "COMBO", 0, NULL }, +{ "generic-mmc", "LG", "HL-DT-ST RW/DVD GCC-4080N", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "LITE-ON", "LTR-0841", OPT_MMC_CD_TEXT|OPT_MMC_NO_SUBCHAN, NULL }, +{ "generic-mmc", "LITE-ON", "LTR-24102B", 0, NULL }, +{ "generic-mmc", "LITE-ON", "LTR-32125W", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "MATSHITA", "CD-R CW-7502", 0, NULL }, +{ "generic-mmc", "MATSHITA", "CD-R CW-7503", 0, NULL }, +{ "generic-mmc", "MATSHITA", "CD-R CW-7582", 0, NULL }, +{ "generic-mmc", "MATSHITA", "CD-R CW-7585", 0, NULL }, +{ "generic-mmc", "MATSHITA", "CD-R CW-7586", 0, NULL }, +{ "generic-mmc", "MATSHITA", "CDRRW01", 0, NULL }, +{ "generic-mmc", "MATSHITA", "UJDA360", 0, NULL }, +{ "generic-mmc", "MATSHITA", "UJDA710", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "MATSHITA", "UJDA720", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "MEMOREX", "24MAX 1040", 0, NULL }, +{ "generic-mmc", "MEMOREX", "40MAXX 1248AJ", 0, NULL }, +{ "generic-mmc", "MEMOREX", "CD-RW4224", 0, NULL }, +{ "generic-mmc", "MICROSOLUTIONS", "BACKPACK CD REWRITER", 0, NULL }, +{ "generic-mmc", "MITSUMI", "CR-4801", 0, NULL }, +{ "generic-mmc", "MITSUMI", "CR-48X5", 0, NULL }, +{ "generic-mmc", "MITSUMI", "CR-48X5TE", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "MITSUMI", "CR-48X8TE", 0, NULL }, +{ "generic-mmc", "MITSUMI", "CR-48XATE", 0, NULL }, +{ "generic-mmc", "OLYMPIC", "RWD RW4224", OPT_DRV_GET_TOC_GENERIC|OPT_MMC_USE_PQ, NULL }, +{ "generic-mmc", "PANASONIC", "CD-R CW-7582", 0, NULL }, +{ "generic-mmc", "PHILIPS", "CDRW1610A", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "PHILIPS", "CDRW2412A", 0, NULL }, +{ "generic-mmc", "PHILIPS", "PCA460RW", 0, NULL }, +{ "generic-mmc", "PIONEER", "DVD-ROM DVD-114", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "PLEXTOR", "CD-R PX-R412", OPT_MMC_USE_PQ|OPT_MMC_READ_ISRC, NULL }, +{ "generic-mmc", "PLEXTOR", "CD-R PX-R820", 0, NULL }, +{ "generic-mmc", "PLEXTOR", "CD-R PX-W1210", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "PLEXTOR", "CD-R PX-W124", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "PLEXTOR", "CD-R PX-W1610", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "PLEXTOR", "CD-R PX-W4220", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "PLEXTOR", "CD-R PX-W8220", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "PLEXTOR", "CD-R PX-W8432", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "PLEXTOR", "CD-R PX-W241040", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "PLEXTOR", "CD-R PX-W2410a", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "PLEXTOR", "CD-R PX-W4012A", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "RICOH", "CD-R/RW MP7040", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "RICOH", "CD-R/RW MP7060", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "RICOH", "CD-R/RW MP7063A", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "RICOH", "CD-R/RW MP7080", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "RICOH", "CD-R/RW MP7083A", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "RICOH", "DVD/CDRW MP9060", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "SAF", "CD-R8020", 0, NULL }, +{ "generic-mmc", "SAF", "CD-RW4224A", 0, NULL }, +{ "generic-mmc", "SAF", "CD-RW6424", 0, NULL }, +{ "generic-mmc", "SAMSUNG", "CD-R/RW SW-206", 0, NULL }, +{ "generic-mmc", "SAMSUNG", "CD-R/RW SW-408B", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "SAMSUNG", "CDRW/DVD SM-308B", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "SANYO", "CRD-BP3", 0, NULL }, +{ "generic-mmc", "SONY", "CD-RW CRX700E", 0, NULL }, +{ "generic-mmc", "SONY", "CRX-815", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "SONY", "CRX100", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "SONY", "CRX120", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "SONY", "CRX140", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "SONY", "CRX145", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "SONY", "CRX160E", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "SONY", "CRX175A1", 0, NULL }, +{ "generic-mmc", "SONY", "CRX175E", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "SONY", "CRX185E1", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "TDK", "4800", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "TDK", "CDRW121032", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "TDK", "CDRW321040B", 0, NULL }, +{ "generic-mmc", "TDK", "CDRW8432", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "TEAC", "CD-R56", OPT_MMC_USE_PQ|OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "TEAC", "CD-R58", OPT_MMC_USE_PQ|OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "TEAC", "CD-W216E", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "TEAC", "CD-W512EB", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "TEAC", "CD-W512SB", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "TEAC", "CD-W516EB", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "TEAC", "CD-W516EC", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "TEAC", "CD-W524E", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "TEAC", "CD-W54E", 0, NULL }, +{ "generic-mmc", "TORiSAN", "CDW-U4424", 0, NULL }, +{ "generic-mmc", "TOSHIBA", "DVD-ROM SD-M1612", 0, NULL }, +{ "generic-mmc", "TOSHIBA", "DVD-ROM SD-R1002", 0, NULL }, +{ "generic-mmc", "TOSHIBA", "DVD-ROM SD-R1202", 0, NULL }, +{ "generic-mmc", "TRAXDATA", "241040", 0, NULL }, +{ "generic-mmc", "TRAXDATA", "CDRW4260", 0, NULL }, +{ "generic-mmc", "WAITEC", "WT624", OPT_MMC_NO_SUBCHAN, NULL }, +{ "generic-mmc", "YAMAHA", "CDR200", 0, NULL }, +{ "generic-mmc", "YAMAHA", "CDR400", 0, NULL }, +{ "generic-mmc", "YAMAHA", "CRW2100", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "YAMAHA", "CRW2200", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "YAMAHA", "CRW2260", 0, NULL }, +{ "generic-mmc", "YAMAHA", "CRW3200", OPT_MMC_CD_TEXT, NULL }, +{ "generic-mmc", "YAMAHA", "CRW4001", 0, NULL }, +{ "generic-mmc", "YAMAHA", "CRW4260", 0, NULL }, +{ "generic-mmc", "YAMAHA", "CRW4416", 0, NULL }, +{ "generic-mmc", "YAMAHA", "CRW6416", 0, NULL }, +{ "generic-mmc", "YAMAHA", "CRW8424", 0, NULL }, +{ "generic-mmc", "YAMAHA", "CRW8824", 0, NULL }, +{ "generic-mmc", "_NEC", "NR-7700A", 0, NULL }, +{ "generic-mmc-raw", "ACER", "10x8x32", 0, NULL }, +{ "generic-mmc-raw", "ACER", "2010A", 0, NULL }, +{ "generic-mmc-raw", "ACER", "20x10x40", 0, NULL }, +{ "generic-mmc-raw", "ACER", "4406EU", 0, NULL }, +{ "generic-mmc-raw", "ACER", "4x4x6", 0, NULL }, +{ "generic-mmc-raw", "ACER", "8X4X32", 0, NULL }, +{ "generic-mmc-raw", "ACER", "CD-R/RW 4X4X32", OPT_MMC_NO_SUBCHAN, NULL }, +{ "generic-mmc-raw", "AOPEN", "CD-RW CRW3248", 0, NULL }, +{ "generic-mmc-raw", "AOPEN", "CRW1232", 0, NULL }, +{ "generic-mmc-raw", "ARTEC", "RW241040", 0, NULL }, +{ "generic-mmc-raw", "ARTEC", "WRA-WA48", 0, NULL }, +{ "generic-mmc-raw", "ARTEC", "WRR-4048", 0, NULL }, +{ "generic-mmc-raw", "ASUS", "CRW-1610A", 0, NULL }, +{ "generic-mmc-raw", "ASUS", "CRW-3212A", 0, NULL }, +{ "generic-mmc-raw", "ATAPI", "CD-R/RW 12X8X32", 0, NULL }, +{ "generic-mmc-raw", "ATAPI", "CD-R/RW 4X4X32", 0, NULL }, +{ "generic-mmc-raw", "ATAPI", "CD-R/RW CRW6206A", 0, NULL }, +{ "generic-mmc-raw", "BENQ", "CRW2410A", 0, NULL }, +{ "generic-mmc-raw", "BTC", "BCE1610IM", 0, NULL }, +{ "generic-mmc-raw", "BTC", "BCE2410IM", 0, NULL }, +{ "generic-mmc-raw", "BTC", "BCE621E", 0, NULL }, +{ "generic-mmc-raw", "CyberDrv", "CW018D", 0, NULL }, +{ "generic-mmc-raw", "CyberDrv", "CW038D", 0, NULL }, +{ "generic-mmc-raw", "CyberDrv", "CW058D", 0, NULL }, +{ "generic-mmc-raw", "Goldstar", "8120B", 0, NULL }, +{ "generic-mmc-raw", "HL-DT-ST", "CD-RW GCE-8160B", 0, NULL }, +{ "generic-mmc-raw", "HL-DT-ST", "CD-RW GCE-8320B", 0, NULL }, +{ "generic-mmc-raw", "HP", "CD-Writer+ 7100", 0, NULL }, +{ "generic-mmc-raw", "HP", "CD-Writer+ 7200", 0, NULL }, +{ "generic-mmc-raw", "HP", "DVD Writer 200j", 0, NULL }, +{ "generic-mmc-raw", "IDE-CD", "R/RW 2x2x24", 0, NULL }, +{ "generic-mmc-raw", "IDE-CD", "R/RW 4x4x24", 0, NULL }, +{ "generic-mmc-raw", "IDE-CD", "R/RW 4x4x32", 0, NULL }, +{ "generic-mmc-raw", "IDE-CD", "R/RW 8x4x32", 0, NULL }, +{ "generic-mmc-raw", "IDE-CD", "ReWritable-2x2x6", 0, NULL }, +{ "generic-mmc-raw", "IOMEGA", "ZIPCD 4x650", 0, NULL }, +{ "generic-mmc-raw", "LITE-ON", "LTR-12101B", 0, NULL }, +{ "generic-mmc-raw", "LITE-ON", "LTR-16101B", 0, NULL }, +{ "generic-mmc-raw", "LITE-ON", "LTR-16102C", 0, NULL }, +{ "generic-mmc-raw", "LITE-ON", "LTR-32123S", 0, NULL }, +{ "generic-mmc-raw", "LITE-ON", "LTR-40125S", 0, NULL }, +{ "generic-mmc-raw", "LITE-ON", "LTR-48125W", 0, NULL }, +{ "generic-mmc-raw", "MEMOREX", "CDRW-2216", 0, NULL }, +{ "generic-mmc-raw", "MEMOREX", "CR-622", 0, NULL }, +{ "generic-mmc-raw", "MEMOREX", "CRW-1662", 0, NULL }, +{ "generic-mmc-raw", "MITSUMI", "2801", 0, NULL }, +{ "generic-mmc-raw", "MITSUMI", "CR-4802", 0, NULL }, +{ "generic-mmc-raw", "MITSUMI", "CR-4804", 0, NULL }, +{ "generic-mmc-raw", "OTI", "-975 SOCRATES", 0, NULL }, +{ "generic-mmc-raw", "PHILIPS", "CDD 3801/31", 0, NULL }, +{ "generic-mmc-raw", "PHILIPS", "CDD3600", 0, NULL }, +{ "generic-mmc-raw", "PHILIPS", "CDD3610", 0, NULL }, +{ "generic-mmc-raw", "PHILIPS", "CDD4201", OPT_MMC_NO_SUBCHAN, NULL }, +{ "generic-mmc-raw", "PHILIPS", "CDD4801", 0, NULL }, +{ "generic-mmc-raw", "PHILIPS", "CDRW400", 0, NULL }, +{ "generic-mmc-raw", "PHILIPS", "PCRW1208", 0, NULL }, +{ "generic-mmc-raw", "PHILIPS", "PCRW120899", 0, NULL }, +{ "generic-mmc-raw", "PHILIPS", "PCRW404", 0, NULL }, +{ "generic-mmc-raw", "PHILIPS", "PCRW804", 0, NULL }, +{ "generic-mmc-raw", "QPS", "CRD-BP 1500P", 0, NULL }, +{ "generic-mmc-raw", "SAMSUNG", "CD-R/RW SW-204B", 0, NULL }, +{ "generic-mmc-raw", "SAMSUNG", "CD-R/RW SW-208", 0, NULL }, +{ "generic-mmc-raw", "SAMSUNG", "CD-R/RW SW-212B", 0, NULL }, +{ "generic-mmc-raw", "SAMSUNG", "CD-R/RW SW-224", 0, NULL }, +{ "generic-mmc-raw", "SAMSUNG", "SW-232", 0, NULL }, +{ "generic-mmc-raw", "SONY", "CRX195E1", 0, NULL }, +{ "generic-mmc-raw", "TEAC", "CD-W58E", OPT_MMC_USE_PQ|OPT_MMC_PQ_BCD, NULL }, +{ "generic-mmc-raw", "TOSHIBA", "R/RW 4x4x24", 0, NULL }, +{ "generic-mmc-raw", "TRAXDATA", "2832", 0, NULL }, +{ "generic-mmc-raw", "TRAXDATA", "CDRW2260+", 0, NULL }, +{ "generic-mmc-raw", "TRAXDATA", "CRW2260 PRO", 0, NULL }, +{ "generic-mmc-raw", "WAITEC", "WT2444EI", 0, NULL }, +{ "generic-mmc-raw", "WAITEC", "WT4424", 0, NULL }, +{ "generic-mmc-raw", "_NEC", "7900", 0, NULL }, +{ "generic-mmc-raw", "_NEC", "NR-7800A", 0, NULL }, +{ "ricoh-mp6200", "AOPEN", "CRW620", 0, NULL }, +{ "ricoh-mp6200", "MEMOREX", "CRW620", 0, NULL }, +{ "ricoh-mp6200", "PHILIPS", "OMNIWRITER26", 0, NULL }, +{ "ricoh-mp6200", "RICOH", "MP6200", 0, NULL }, +{ "ricoh-mp6200", "RICOH", "MP6201", 0, NULL }, +{ "sony-cdu920", "SONY", "CD-R CDU920", 0, NULL }, +{ "sony-cdu920", "SONY", "CD-R CDU924", 0, NULL }, +{ "sony-cdu948", "SONY", "CD-R CDU948", 0, NULL }, +{ "taiyo-yuden", "T.YUDEN", "CD-WO EW-50", 0, NULL }, +{ "teac-cdr55", "JVC", "R2626", 0, NULL }, +{ "teac-cdr55", "JVC", "XR-W2010", 0, NULL }, +{ "teac-cdr55", "SAF", "CD-R2006PLUS", 0, NULL }, +{ "teac-cdr55", "SAF", "CD-R4012", 0, NULL }, +{ "teac-cdr55", "SAF", "CD-RW 226", 0, NULL }, +{ "teac-cdr55", "TEAC", "CD-R50", 0, NULL }, +{ "teac-cdr55", "TEAC", "CD-R55", 0, NULL }, +{ "teac-cdr55", "TRAXDATA", "CDR4120", 0, NULL }, +{ "toshiba", "TOSHIBA", "DVD-ROM SD-R2002", 0, NULL }, +{ "toshiba", "TOSHIBA", "DVD-ROM SD-R2102", 0, NULL }, +{ "yamaha-cdr10x", "YAMAHA", "CDR100", 0, NULL }, +{ "yamaha-cdr10x", "YAMAHA", "CDR102", 0, NULL }, +{ NULL, NULL, NULL, 0, NULL }}; + +static DriverTable DRIVERS[] = { +{ "cdd2600", &CDD2600::instance }, +{ "generic-mmc", &GenericMMC::instance }, +{ "generic-mmc-raw", &GenericMMCraw::instance }, +{ "plextor", &PlextorReader::instance }, +{ "plextor-scan", &PlextorReaderScan::instance }, +{ "ricoh-mp6200", &RicohMP6200::instance }, +{ "sony-cdu920", &SonyCDU920::instance }, +{ "sony-cdu948", &SonyCDU948::instance }, +{ "taiyo-yuden", &TaiyoYuden::instance }, +{ "teac-cdr55", &TeacCdr55::instance }, +{ "toshiba", &ToshibaReader::instance }, +{ "yamaha-cdr10x", &YamahaCDR10x::instance }, +{ NULL, NULL }}; + +struct CDRVendorTable { + char m1, s1, f1; // 1st vendor code + char m2, s2, f2; // 2nd vendor code + const char *id; // vendor ID +}; + +static CDRVendorTable VENDOR_TABLE[] = { + // permanent codes + { 97,28,30, 97,46,50, "Auvistar Industry Co.,Ltd." }, + { 97,26,60, 97,46,60, "CMC Magnetics Corporation" }, + { 97,23,10, 0,0,0, "Doremi Media Co., Ltd." }, + { 97,26,00, 97,45,00, "FORNET INTERNATIONAL PTE LTD." }, + { 97,46,40, 97,46,40, "FUJI Photo Film Co., Ltd." }, + { 97,26,40, 0,0,0, "FUJI Photo Film Co., Ltd." }, + { 97,28,10, 97,49,10, "GIGASTORAGE CORPORATION" }, + { 97,25,20, 97,47,10, "Hitachi Maxell, Ltd." }, + { 97,27,40, 97,48,10, "Kodak Japan Limited" }, + { 97,26,50, 97,48,60, "Lead Data Inc." }, + { 97,27,50, 97,48,50, "Mitsui Chemicals, Inc." }, + { 97,34,20, 97,50,20, "Mitsubishi Chemical Corporation" }, + { 97,28,20, 97,46,20, "Multi Media Masters & Machinary SA" }, + { 97,21,40, 0,0,0, "Optical Disc Manufacturing Equipment" }, + { 97,27,30, 97,48,30, "Pioneer Video Corporation" }, + { 97,27,10, 97,48,20, "Plasmon Data systems Ltd." }, + { 97,26,10, 97,47,40, "POSTECH Corporation" }, + { 97,27,20, 97,47,20, "Princo Corporation" }, + { 97,32,10, 0,0,0, "Prodisc Technology Inc." }, + { 97,27,60, 97,48,00, "Ricoh Company Limited" }, + { 97,31,00, 97,47,50, "Ritek Co." }, + { 97,26,20, 0,0,0, "SKC Co., Ltd." }, + { 97,24,10, 0,0,0, "SONY Corporation" }, + { 97,24,00, 97,46,00, "Taiyo Yuden Company Limited" }, + { 97,32,00, 97,49,00, "TDK Corporation" }, + { 97,25,60, 97,45,60, "Xcitek Inc." }, + + // tentative codes + { 97,22,60, 97,45,20, "Acer Media Technology, Inc" }, + { 97,25,50, 0,0,0, "AMS Technology Inc." }, + { 97,23,30, 0,0,0, "AUDIO DISTRIBUTORS CO., LTD." }, + { 97,21,30, 0,0,0, "Bestdisc Technology Corporation" }, + { 97,30,10, 97,50,30, "CDA Datentraeger Albrechts GmbH" }, + { 97,22,40, 97,45,40, "CIS Technology Inc." }, + { 97,24,20, 97,46,30, "Computer Support Italy s.r.l." }, + { 97,23,60, 0,0,0, "Customer Pressing Oosterhout" }, + { 97,28,50, 0,0,0, "DELPHI TECHNOLOGY INC." }, + { 97,27,00, 97,48,40, "DIGITAL STORAGE TECHNOLOGY CO.,LTD" }, + { 97,22,30, 0,0,0, "EXIMPO" }, + { 97,28,60, 0,0,0, "Friendly CD-Tek Co." }, + { 97,31,30, 97,51,10, "Grand Advance Technology Ltd." }, + { 97,29,50, 0,0,0, "General Magnetics Ld" }, + { 97,24,50, 97,45,50, "Guann Yinn Co.,Ltd." }, + { 97,29,00, 0,0,0, "Harmonic Hall Optical Disc Ltd." }, + { 97,29,30, 97,51,50, "Hile Optical Disc Technology Corp." }, + { 97,46,10, 97,22,50, "Hong Kong Digital Technology Co., Ltd." }, + { 97,25,30, 97,51,20, "INFODISC Technology Co., Ltd." }, + { 97,24,40, 0,0,0, "kdg mediatech AG" }, + { 97,28,40, 97,49,20, "King Pro Mediatek Inc." }, + { 97,23,00, 97,49,60, "Matsushita Electric Industrial Co., Ltd." }, + { 97,15,20, 0,0,0, "Mitsubishi Chemical Corporation" }, + { 97,25,00, 0,0,0, "MPO" }, + { 97,23,20, 0,0,0, "Nacar Media sr" }, + { 97,26,30, 0,0,0, "OPTICAL DISC CORPRATION" }, + { 97,28,00, 97,49,30, "Opti.Me.S. S.p.A." }, + { 97,23,50, 0,0,0, "OPTROM.INC." }, + { 97,47,60, 0,0,0, "Prodisc Technology Inc." }, + { 97,15,10, 0,0,0, "Ritek Co." }, + { 97,22,10, 0,0,0, "Seantram Technology Inc." }, + { 97,21,50, 0,0,0, "Sound Sound Multi-Media Development Limited" }, + { 97,29,00, 0,0,0, "Taeil Media Co.,Ltd." }, + { 97,18,60, 0,0,0, "TAROKO INTERNATIONAL CO.,LTD." }, + { 97,15,00, 0,0,0, "TDK Corporation." }, + { 97,29,20, 0,0,0, "UNIDISC TECHNOLOGY CO.,LTD" }, + { 97,24,30, 97,45,10, "UNITECH JAPAN INC." }, + { 97,29,10, 97,50,10, "Vanguard Disc Inc." }, + { 97,49,40, 97,23,40, "VICTOR COMPANY OF JAPAN, LIMITED" }, + { 97,29,40, 0,0,0, "VIVA MAGNETICS LIMITED" }, + { 97,25,40, 0,0,0, "VIVASTAR AG" }, + { 97,18,10, 0,0,0, "WEALTH FAIR INVESTMENT LIMITED" }, + { 97,22,00, 0,0,0, "Woongjin Media corp." }, + + { 0, 0, 0, 0, 0, 0, NULL} +}; + +unsigned char CdrDriver::syncPattern[12] = { + 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0 +}; + +char CdrDriver::REMOTE_MSG_SYNC_[4] = { 0xff, 0x00, 0xff, 0x00 }; + + +/* Maps a string to the corresponding driver option value + * Return: 0: string is not a valid driver option sting + * else: option value for string + */ +static unsigned long string2DriverOption(const char *s) +{ + if (strcmp(s, "OPT_DRV_GET_TOC_GENERIC") == 0) + return OPT_DRV_GET_TOC_GENERIC; + else if (strcmp(s, "OPT_DRV_SWAP_READ_SAMPLES") == 0) + return OPT_DRV_SWAP_READ_SAMPLES; + else if (strcmp(s, "OPT_DRV_NO_PREGAP_READ") == 0) + return OPT_DRV_NO_PREGAP_READ; + else if (strcmp(s, "OPT_DRV_RAW_TOC_BCD") == 0) + return OPT_DRV_RAW_TOC_BCD; + else if (strcmp(s, "OPT_DRV_RAW_TOC_HEX") == 0) + return OPT_DRV_RAW_TOC_HEX; + else if (strcmp(s, "OPT_MMC_USE_PQ") == 0) + return OPT_MMC_USE_PQ; + else if (strcmp(s, "OPT_MMC_PQ_BCD") == 0) + return OPT_MMC_PQ_BCD; + else if (strcmp(s, "OPT_MMC_READ_ISRC") == 0) + return OPT_MMC_READ_ISRC; + else if (strcmp(s, "OPT_MMC_SCAN_MCN") == 0) + return OPT_MMC_SCAN_MCN; + else if (strcmp(s, "OPT_MMC_CD_TEXT") == 0) + return OPT_MMC_CD_TEXT; + else if (strcmp(s, "OPT_MMC_NO_SUBCHAN") == 0) + return OPT_MMC_NO_SUBCHAN; + else if (strcmp(s, "OPT_MMC_NO_BURNPROOF") == 0) + return OPT_MMC_NO_BURNPROOF; + else if (strcmp(s, "OPT_MMC_NO_RW_PACKED") == 0) + return OPT_MMC_NO_RW_PACKED; + else if (strcmp(s, "OPT_MMC_USE_RAW_RW") == 0) + return OPT_MMC_USE_RAW_RW; + else if (strcmp(s, "OPT_MMC_YAMAHA_FORCE_SPEED") == 0) + return OPT_MMC_YAMAHA_FORCE_SPEED; + else if (strcmp(s, "OPT_PLEX_USE_PARANOIA") == 0) + return OPT_PLEX_USE_PARANOIA; + else if (strcmp(s, "OPT_PLEX_DAE_READ10") == 0) + return OPT_PLEX_DAE_READ10; + else if (strcmp(s, "OPT_PLEX_DAE_D4_12") == 0) + return OPT_PLEX_DAE_D4_12; + else if (strcmp(s, "OPT_PLEX_USE_PQ") == 0) + return OPT_PLEX_USE_PQ; + else if (strcmp(s, "OPT_PLEX_PQ_BCD") == 0) + return OPT_PLEX_PQ_BCD; + else if (strcmp(s, "OPT_PLEX_READ_ISRC") == 0) + return OPT_PLEX_READ_ISRC; + else + return 0; +} + + +/* Checks if 'n' is a valid driver name and returns the driver id string + * from the 'DRIVERS' on success. + * Return: driver id string + * NULL: if 'n' is not a valid driver id + */ +static const char *checkDriverName(const char *n) +{ + DriverTable *run = DRIVERS; + + while (run->driverId != NULL) { + if (strcmp(run->driverId, n) == 0) + return run->driverId; + + run++; + } + + return NULL; +} + +/* Reads driver table from specified file. + Return: 0: OK, driver table file could be opened + 1: could not open driver table file + */ + +#define MAX_DRIVER_TABLE_LINE_LEN 1024 + +static int readDriverTable(const char *filename) +{ + FILE *fp; + DriverSelectTable *ent; + long i; + int lineNr = 0; + int count = 0; + int rw; + int err; + char buf[MAX_DRIVER_TABLE_LINE_LEN]; + char *p, *l; + const char *sep = "|"; + char *vendor; + char *model; + char *driver; + const char *lastDriverName = NULL; + const char *driverName; + unsigned long opt, options; + + if ((fp = fopen(filename, "r")) == NULL) + return 1; + + log_message(4, "Reading driver table from file \"%s\".", filename); + + while (fgets(buf, MAX_DRIVER_TABLE_LINE_LEN, fp) != NULL) { + lineNr++; + + vendor = model = driver = NULL; + rw = 0; + options = 0; + err = 0; + + // remove comment + if ((p = strchr(buf, '#')) != NULL) + *p = 0; + + // remove leading white space + for (l = buf; *l != 0 && isspace(*l); l++) ; + + // remove trailing white space + for (i = strlen(l) - 1; i >= 0 && isspace(l[i]); i--) + l[i] = 0; + + + if ((p = strtok(l, sep)) != NULL) { + if (strcmp(p, "R") == 0) { + rw = 1; + } + else if (strcmp(p, "W") == 0) { + rw = 2; + } + else { + log_message(-1, + "%s:%d: Expecting 'R' or 'W' as first token - line ignored.", + filename, lineNr); + } + + if (rw > 0) { + if ((p = strtok(NULL, sep)) != NULL) { + vendor = strdupCC(p); + + if ((p = strtok(NULL, sep)) != NULL) { + model = strdupCC(p); + + if ((p = strtok(NULL, sep)) != NULL) { + driver = strdupCC(p); + + if (lastDriverName == NULL || + strcmp(lastDriverName, driver) != 0) { + if ((driverName = checkDriverName(driver)) == NULL) { + log_message(-1, "%s:%d: Driver '%s' not defined - line ignored.", + filename, lineNr, driver); + err = 1; + } + else { + lastDriverName = driverName; + } + } + + while (!err && (p = strtok(NULL, sep)) != NULL) { + if ((opt = string2DriverOption(p)) == 0) { + log_message(-1, "%s:%d: Driver option string '%s' not defined - line ignored.", + filename, lineNr, p); + err = 1; + } + + options |= opt; + } + + if (!err) { + ent = new DriverSelectTable; + + ent->vendor = vendor; + vendor = NULL; + ent->model = model; + model = NULL; + ent->driverId = driver; + driver = NULL; + ent->options = options; + + if (rw == 1) { + ent->next = READ_DRIVER_TABLE; + READ_DRIVER_TABLE = ent; + } + else { + ent->next = WRITE_DRIVER_TABLE; + WRITE_DRIVER_TABLE = ent; + } + + count++; + } + } + else { + log_message(-1, "%s:%d: Missing driver name - line ignored.", + filename, lineNr); + } + } + else { + log_message(-1, "%s:%d: Missing model name - line ignored.", + filename, lineNr); + } + } + else { + log_message(-1, "%s:%d: Missing vendor name - line ignored.", + filename, lineNr); + } + + delete[] vendor; + delete[] model; + delete[] driver; + } + } + } + + fclose(fp); + + log_message(4, "Found %d valid driver table entries.", count); + + return 0; +} + +/* Create driver tables from built-in driver table data. + */ +static void createDriverTable() +{ + DriverSelectTable *run; + DriverSelectTable *ent; + + for (run = BUILTIN_READ_DRIVER_TABLE; run->driverId != NULL; run++) { + ent = new DriverSelectTable; + + ent->driverId = strdupCC(run->driverId); + ent->vendor = strdupCC(run->vendor); + ent->model = strdupCC(run->model); + ent->options = run->options; + + ent->next = READ_DRIVER_TABLE; + READ_DRIVER_TABLE = ent; + } + + for (run = BUILTIN_WRITE_DRIVER_TABLE; run->driverId != NULL; run++) { + ent = new DriverSelectTable; + + ent->driverId = strdupCC(run->driverId); + ent->vendor = strdupCC(run->vendor); + ent->model = strdupCC(run->model); + ent->options = run->options; + + ent->next = WRITE_DRIVER_TABLE; + WRITE_DRIVER_TABLE = ent; + } +} + +/* Initialize driver table. First try to read the driver table from file + * 'DRIVER_TABLE_FILE'. If it does not exist the built-in driver table data + * will be used. After that an user specific driver table file is loaded if + * available. + */ +static void initDriverTable() +{ + static int initialized = 0; + const char *home; + char *path; + + if (initialized) + return; + + if (readDriverTable(DRIVER_TABLE_FILE) != 0) { + log_message(2, "Cannot read driver table from file \"%s\" - using built-in table.", DRIVER_TABLE_FILE); + createDriverTable(); + } + + /* read driver table from $HOME/.cdrdao-drivers */ + if ((home = getenv("HOME")) != NULL) { + path = strdup3CC(home, "/.cdrdao-drivers", NULL); + readDriverTable(path); + delete[] path; + } + + initialized = 1; +} + +const char *CdrDriver::selectDriver(int readWrite, const char *vendor, + const char *model, unsigned long *options) +{ + DriverSelectTable *run; + DriverSelectTable *match = NULL; + unsigned int matchLen = 0; + unsigned int len = 0; + + initDriverTable(); + + run = (readWrite == 0) ? READ_DRIVER_TABLE : WRITE_DRIVER_TABLE; + + while (run != NULL) { + if (strcmp(run->vendor, vendor) == 0 && + strstr(model, run->model) != NULL) { + if (match == NULL || (len = strlen(run->model)) > matchLen) { + matchLen = (match == NULL) ? strlen(run->model) : len; + match = run; + } + } + + run = run->next; + } + + if (match != NULL) { + *options = match->options; + return match->driverId; + } + + return NULL; +} + + +CdrDriver *CdrDriver::createDriver(const char *driverId, unsigned long options, + ScsiIf *scsiIf) +{ + DriverTable *run = DRIVERS; + + while (run->driverId != NULL) { + if (strcmp(run->driverId, driverId) == 0) + return run->constructor(scsiIf, options); + + run++; + } + + return NULL; +} + +const char *CdrDriver::detectDriver(ScsiIf *scsiIf, unsigned long *options) +{ + bool cd_r_read, cd_r_write, cd_rw_read, cd_rw_write; + if (scsiIf->checkMmc(&cd_r_read, &cd_r_write, &cd_rw_read, &cd_rw_write)) { + return "generic-mmc"; + } + + return NULL; +} + +void CdrDriver::printDriverIds() +{ + DriverTable *run = DRIVERS; + + while (run->driverId != NULL) { + log_message(0, "%s", run->driverId); + run++; + } +} + +CdrDriver::CdrDriver(ScsiIf *scsiIf, unsigned long options) +{ + size16 byteOrderTest = 1; + char *byteOrderTestP = (char*)&byteOrderTest; + + options_ = options; + scsiIf_ = scsiIf; + toc_ = NULL; + + if (*byteOrderTestP == 1) + hostByteOrder_ = 0; // little endian + else + hostByteOrder_ = 1; // big endian + + + enableBufferUnderRunProtection_ = 1; + enableWriteSpeedControl_ = 1; + + readCapabilities_ = 0; // reading capabilities are determined dynamically + + audioDataByteOrder_ = 0; // default to little endian + + fastTocReading_ = false; + rawDataReading_ = false; + mode2Mixed_ = true; + subChanReadMode_ = TrackData::SUBCHAN_NONE; + taoSource_ = 0; + taoSourceAdjust_ = 2; // usually we have 2 unreadable sectors between tracks + // written in TAO mode + padFirstPregap_ = 1; + onTheFly_ = 0; + onTheFlyFd_ = -1; + multiSession_ = false; + encodingMode_ = 0; + force_ = false; + remote_ = 0; + remoteFd_ = -1; + + blockLength_ = 0; + blocksPerWrite_ = 0; + zeroBuffer_ = NULL; + + userCapacity_ = 0; + fullBurn_ = false; + + scsiMaxDataLen_ = scsiIf_->maxDataLen(); + + transferBuffer_ = new unsigned char[scsiMaxDataLen_]; + + maxScannedSubChannels_ = scsiMaxDataLen_ / (AUDIO_BLOCK_LEN + PW_SUBCHANNEL_LEN); + scannedSubChannels_ = new SubChannel*[maxScannedSubChannels_]; + + paranoia_ = NULL; + paranoiaDrive_ = NULL; + paranoiaMode(3); // full paranoia but allow skip +} + +CdrDriver::~CdrDriver() +{ + toc_ = NULL; + + delete[] zeroBuffer_; + zeroBuffer_ = NULL; + + delete[] transferBuffer_; + transferBuffer_ = NULL; + + delete [] scannedSubChannels_; + scannedSubChannels_ = NULL; +} + +// Sets multi session mode. 0: close session, 1: open next session +// Return: 0: OK +// 1: multi session not supported by driver +int CdrDriver::multiSession(bool m) +{ + multiSession_ = m; + + return 0; +} + +// Sets number of adjust sectors for reading TAO source disks. +void CdrDriver::taoSourceAdjust(int val) +{ + if (val >= 0 && val < 100) { + taoSourceAdjust_ = val; + } +} + + +void CdrDriver::onTheFly(int fd) +{ + if (fd >= 0) { + onTheFly_ = 1; + onTheFlyFd_ = fd; + } + else { + onTheFly_ = 0; + onTheFlyFd_ = -1; + } +} + +void CdrDriver::remote(int f, int fd) +{ + if (f != 0 && fd >= 0) { + int flags; + + remote_ = 1; + remoteFd_ = fd; + + // switch 'fd' to non blocking IO mode + if ((flags = fcntl(fd, F_GETFL)) == -1) { + log_message(-1, "Cannot get flags of remote stream: %s", strerror(errno)); + remote_ = 0; + remoteFd_ = -1; + return; + } + + flags |= O_NONBLOCK; + + if (fcntl(fd, F_SETFL, flags) < 0) { + log_message(-1, "Cannot set flags of remote stream: %s", strerror(errno)); + remote_ = 0; + remoteFd_ = -1; + } + } + else { + remote_ = 0; + remoteFd_ = -1; + } +} + +// Returns acceptable sub-channel encoding mode for given sub-channel type: +// -1: writing of sub-channel type not supported at all +// 0: accepts plain data without encoding +// 1: accepts only completely encoded data +int CdrDriver::subChannelEncodingMode(TrackData::SubChannelMode sm) const +{ + if (sm == TrackData::SUBCHAN_NONE) + return 0; + else + return -1; +} + + +int CdrDriver::cdrVendor(Msf &code, const char **vendorId, + const char **mediumType) +{ + CDRVendorTable *run = VENDOR_TABLE; + + *vendorId = NULL; + + char m = code.min(); + char s = code.sec(); + char f = code.frac(); + + char type = f % 10; + f -= type; + + while (run->id != NULL) { + if ((run->m1 == m && run->s1 == s && run->f1 == f) || + (run->m2 == m && run->s2 == s && run->f2 == f)) { + *vendorId = run->id; + break; + } + run++; + } + + if (*vendorId != NULL) { + if (type < 5) { + *mediumType = "Long Strategy Type, e.g. Cyanine"; + } + else { + *mediumType = "Short Strategy Type, e.g. Phthalocyanine"; + } + + return 1; + } + + return 0; +} + +// Sends SCSI command via 'scsiIf_'. +// return: see 'ScsiIf::sendCmd()' +int CdrDriver::sendCmd(const unsigned char *cmd, int cmdLen, + const unsigned char *dataOut, int dataOutLen, + unsigned char *dataIn, int dataInLen, + int showErrorMsg) const +{ + return scsiIf_->sendCmd(cmd, cmdLen, dataOut, dataOutLen, dataIn, + dataInLen, showErrorMsg); +} + +// checks if unit is ready +// return: 0: OK +// 1: scsi command failed +// 2: not ready +// 3: not ready, no disk in drive +// 4: not ready, tray out + +int CdrDriver::testUnitReady(int ignoreUnitAttention) const +{ + unsigned char cmd[6]; + const unsigned char *sense; + int senseLen; + + memset(cmd, 0, 6); + + switch (scsiIf_->sendCmd(cmd, 6, NULL, 0, NULL, 0, 0)) { + case 1: + return 1; + + case 2: + sense = scsiIf_->getSense(senseLen); + + int code = sense[2] & 0x0f; + + if (code == 0x02) { + // not ready + return 2; + } + else if (code != 0x06) { + scsiIf_->printError(); + return 1; + } + else { + return 0; + } + } + + return 0; +} + +bool CdrDriver::rspeed(int a) { + rspeed_ = a; + return true; +} + +int CdrDriver::speed2Mult(int speed) +{ + return speed / 176; +} + +int CdrDriver::mult2Speed(int mult) +{ + return mult * 177; +} + +// start unit ('startStop' == 1) or stop unit ('startStop' == 0) +// return: 0: OK +// 1: scsi command failed + +int CdrDriver::startStopUnit(int startStop) const +{ + unsigned char cmd[6]; + + memset(cmd, 0, 6); + + cmd[0] = 0x1b; + + if (startStop != 0) { + cmd[4] |= 0x01; + } + + if (sendCmd(cmd, 6, NULL, 0, NULL, 0) != 0) { + log_message(-2, "Cannot start/stop unit."); + return 1; + } + + return 0; +} + + +// blocks or unblocks tray +// return: 0: OK +// 1: scsi command failed + +int CdrDriver::preventMediumRemoval(int block) const +{ + unsigned char cmd[6]; + + memset(cmd, 0, 6); + + cmd[0] = 0x1e; + + if (block != 0) { + cmd[4] |= 0x01; + } + + if (sendCmd(cmd, 6, NULL, 0, NULL, 0) != 0) { + log_message(-2, "Cannot prevent/allow medium removal."); + return 1; + } + + return 0; +} + +// reset device to initial state +// return: 0: OK +// 1: scsi command failed + +int CdrDriver::rezeroUnit(int showMessage) const +{ + unsigned char cmd[6]; + + memset(cmd, 0, 6); + + cmd[0] = 0x01; + + if (sendCmd(cmd, 6, NULL, 0, NULL, 0, showMessage) != 0) { + if (showMessage) + log_message(-2, "Cannot rezero unit."); + return 1; + } + + return 0; +} + +// Flushs cache of drive which inidcates end of write action. Errors resulting +// from this command are ignored because everything is already done and +// at most the last part of the lead-out track may be affected. +// return: 0: OK +int CdrDriver::flushCache() const +{ + unsigned char cmd[10]; + + memset(cmd, 0, 10); + + cmd[0] = 0x35; // FLUSH CACHE + + // Print no message if the flush cache command fails because some drives + // report errors even if all went OK. + sendCmd(cmd, 10, NULL, 0, NULL, 0, 0); + + return 0; +} + +// Reads the cd-rom capacity and stores the total number of available blocks +// in 'length'. +// return: 0: OK +// 1: SCSI command failed +int CdrDriver::readCapacity(long *length, int showMessage) +{ + unsigned char cmd[10]; + unsigned char data[8]; + + memset(cmd, 0, 10); + memset(data, 0, 8); + + cmd[0] = 0x25; // READ CD-ROM CAPACITY + + if (sendCmd(cmd, 10, NULL, 0, data, 8, showMessage) != 0) { + if (showMessage) + log_message(-2, "Cannot read capacity."); + return 1; + } + + *length = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; + // *length += 1; + + return 0; +} + +int CdrDriver::blankDisk(BlankingMode) +{ + log_message(-2, "Blanking is not supported by this driver."); + return 1; +} + +// Writes data to target, the block length depends on the actual writing mode +// 'mode'. 'len' is number of blocks to write. +// 'lba' specifies the next logical block address for writing and is updated +// by this function. +// return: 0: OK +// 1: scsi command failed +int CdrDriver::writeData(TrackData::Mode mode, TrackData::SubChannelMode sm, + long &lba, const char *buf, long len) +{ + assert(blocksPerWrite_ > 0); + int writeLen = 0; + unsigned char cmd[10]; + long blockLength = blockSize(mode, sm); + +#if 0 + long sum, i; + + sum = 0; + + for (i = 0; i < len * blockLength; i++) { + sum += buf[i]; + } + + log_message(0, "W: %ld: %ld, %ld, %ld", lba, blockLength, len, sum); + +#endif + + + memset(cmd, 0, 10); + cmd[0] = 0x2a; // WRITE1 + + while (len > 0) { + writeLen = (len > blocksPerWrite_ ? blocksPerWrite_ : len); + + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + + cmd[7] = writeLen >> 8; + cmd[8] = writeLen & 0xff; + + if (sendCmd(cmd, 10, (unsigned char *)buf, writeLen * blockLength, + NULL, 0) != 0) { + log_message(-2, "Write data failed."); + return 1; + } + + buf += writeLen * blockLength; + + lba += writeLen; + len -= writeLen; + } + + return 0; +} + +// Writes 'count' blocks with zero data with 'writeData'. +// m: mode for encoding zero data +// lba: logical block address for the write command, will be updated +// encLba: logical block address used by the LE-C encoder for the +// sector headers +// count: number of zero blocks to write +// Return: 0: OK +// 1: SCSI error occured +int CdrDriver::writeZeros(TrackData::Mode m, TrackData::SubChannelMode sm, + long &lba, long encLba, long count) +{ + assert(blocksPerWrite_ > 0); + assert(zeroBuffer_ != NULL); + + int n, i; + long cnt = 0; + long total; + long cntMb; + long lastMb = 0; + long blockLen; + unsigned char *buf; + + blockLen = blockSize(m, sm); + + total = count * blockLen; + +#if 0 + static int wcount = 0; + char fname[100]; + sprintf(fname, "zeros%d.out", wcount++); + FILE *fp = fopen(fname, "w"); +#endif + + while (count > 0) { + n = (count > blocksPerWrite_ ? blocksPerWrite_ : count); + + buf = (unsigned char *)zeroBuffer_; + + for (i = 0; i < n; i++) { + Track::encodeZeroData(encodingMode_, m, sm, encLba++, buf); + + if (encodingMode_ == 0 && bigEndianSamples() == 0) { + // swap encoded data blocks + swapSamples((Sample *)buf, SAMPLES_PER_BLOCK); + } + + buf += blockLen; + } + + + //fwrite(zeroBuffer_, blockLen, n, fp); + + if (writeData(encodingMode_ == 0 ? TrackData::AUDIO : m, sm, lba, + zeroBuffer_, n) != 0) { + return 1; + } + + cnt += n * blockLen; + + cntMb = cnt >> 20; + + if (cntMb > lastMb) { + log_message(1, "Wrote %ld of %ld MB.\r", cntMb, total >> 20); + fflush(stdout); + lastMb = cntMb; + } + + count -= n; + } + + //fclose(fp); + + return 0; +} + +// Requests mode page 'pageCode' from device and places it into given +// buffer of maximum length 'bufLen'. +// modePageHeader: if != NULL filled with mode page header (8 bytes) +// blockDesc : if != NULL filled with block descriptor (8 bytes), +// buffer is zeroed if no block descriptor is received +// return: 0: OK +// 1: scsi command failed +// 2: buffer too small for requested mode page +int CdrDriver::getModePage(int pageCode, unsigned char *buf, long bufLen, + unsigned char *modePageHeader, + unsigned char *blockDesc, + int showErrorMsg) +{ + unsigned char cmd[10]; + long dataLen = bufLen + 8/*mode parameter header*/ + + 100/*spare for block descriptors*/; + unsigned char *data = new unsigned char[dataLen]; + + memset(cmd, 0, 10); + memset(data, 0, dataLen); + memset(buf, 0, bufLen); + + cmd[0] = 0x5a; // MODE SENSE + cmd[2] = pageCode & 0x3f; + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen, showErrorMsg) != 0) { + delete[] data; + return 1; + } + + long modeDataLen = (data[0] << 8) | data[1]; + long blockDescLen = (data[6] << 8) | data[7]; + + if (modePageHeader != NULL) + memcpy(modePageHeader, data, 8); + + if (blockDesc != NULL) { + if (blockDescLen >= 8) + memcpy(blockDesc, data + 8, 8); + else + memset(blockDesc, 0, 8); + } + + if (modeDataLen > blockDescLen + 6) { + unsigned char *modePage = data + blockDescLen + 8; + long modePageLen = modePage[1] + 2; + + if (modePageLen > bufLen) + modePageLen = bufLen; + + memcpy(buf, modePage, modePageLen); + delete[] data; + return 0; + } + else { + log_message(-2, "No mode page data received."); + delete[] data; + return 1; + } +} + +// Sets mode page in device specified in buffer 'modePage' +// modePageHeader: if != NULL used as mode page header (8 bytes) +// blockDesc : if != NULL used as block descriptor (8 bytes), +// Return: 0: OK +// 1: SCSI command failed +int CdrDriver::setModePage(const unsigned char *modePage, + const unsigned char *modePageHeader, + const unsigned char *blockDesc, + int showErrorMsg) +{ + long pageLen = modePage[1] + 2; + unsigned char cmd[10]; + long dataLen = pageLen + 8/*mode parameter header*/; + + if (blockDesc != NULL) + dataLen += 8; + + unsigned char *data = new unsigned char[dataLen]; + + memset(cmd, 0, 10); + memset(data, 0, dataLen); + + if (modePageHeader != NULL) + memcpy(data, modePageHeader, 8); + + data[0] = 0; + data[1] = 0; + data[4] = 0; + data[5] = 0; + + + if (blockDesc != NULL) { + memcpy(data + 8, blockDesc, 8); + memcpy(data + 16, modePage, pageLen); + data[6] = 0; + data[7] = 8; + } + else { + memcpy(data + 8, modePage, pageLen); + data[6] = 0; + data[7] = 0; + } + + cmd[0] = 0x55; // MODE SELECT + cmd[1] = 1 << 4; + + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + if (sendCmd(cmd, 10, data, dataLen, NULL, 0, showErrorMsg) != 0) { + delete[] data; + return 1; + } + + delete[] data; + return 0; +} + +// As above, but implemented with six byte mode commands + +// Requests mode page 'pageCode' from device and places it into given +// buffer of maximum length 'bufLen'. +// modePageHeader: if != NULL filled with mode page header (4 bytes) +// blockDesc : if != NULL filled with block descriptor (8 bytes), +// buffer is zeroed if no block descriptor is received +// return: 0: OK +// 1: scsi command failed +// 2: buffer too small for requested mode page +int CdrDriver::getModePage6(int pageCode, unsigned char *buf, long bufLen, + unsigned char *modePageHeader, + unsigned char *blockDesc, + int showErrorMsg) +{ + unsigned char cmd[6]; + long dataLen = bufLen + 4/*mode parameter header*/ + + 100/*spare for block descriptors*/; + unsigned char *data = new unsigned char[dataLen]; + + memset(cmd, 0, 6); + memset(data, 0, dataLen); + memset(buf, 0, bufLen); + + cmd[0] = 0x1a; // MODE SENSE(6) + cmd[2] = pageCode & 0x3f; + cmd[4] = (dataLen > 255) ? 0 : dataLen; + + if (sendCmd(cmd, 6, NULL, 0, data, dataLen, showErrorMsg) != 0) { + delete[] data; + return 1; + } + + long modeDataLen = data[0]; + long blockDescLen = data[3]; + + if (modePageHeader != NULL) + memcpy(modePageHeader, data, 4); + + if (blockDesc != NULL) { + if (blockDescLen >= 8) + memcpy(blockDesc, data + 4, 8); + else + memset(blockDesc, 0, 8); + } + + if (modeDataLen > blockDescLen + 4) { + unsigned char *modePage = data + blockDescLen + 4; + long modePageLen = modePage[1] + 2; + + if (modePageLen > bufLen) + modePageLen = bufLen; + + memcpy(buf, modePage, modePageLen); + delete[] data; + return 0; + } + else { + log_message(-2, "No mode page data received."); + delete[] data; + return 1; + } +} + +// Sets mode page in device specified in buffer 'modePage' +// modePageHeader: if != NULL used as mode page header (4 bytes) +// blockDesc : if != NULL used as block descriptor (8 bytes), +// Return: 0: OK +// 1: SCSI command failed +int CdrDriver::setModePage6(const unsigned char *modePage, + const unsigned char *modePageHeader, + const unsigned char *blockDesc, + int showErrorMsg) +{ + long pageLen = modePage[1] + 2; + unsigned char cmd[6]; + long dataLen = pageLen + 4/*mode parameter header*/; + + if (blockDesc != NULL) + dataLen += 8; + + unsigned char *data = new unsigned char[dataLen]; + + memset(cmd, 0, 6); + memset(data, 0, dataLen); + + if (modePageHeader != NULL) + memcpy(data, modePageHeader, 4); + + data[0] = 0; + + if (blockDesc != NULL) { + memcpy(data + 4, blockDesc, 8); + memcpy(data + 12, modePage, pageLen); + data[3] = 8; + } + else { + memcpy(data + 4, modePage, pageLen); + data[3] = 0; + } + + cmd[0] = 0x15; // MODE SELECT(6) + cmd[1] = 1 << 4; + + cmd[4] = dataLen; + + if (sendCmd(cmd, 6, data, dataLen, NULL, 0, showErrorMsg) != 0) { + delete[] data; + return 1; + } + + delete[] data; + return 0; +} + + +// Retrieves TOC data of inserted CD. It won't distinguish between different +// sessions. +// The track information is returned either for all sessions or for the +// first session depending on the drive. 'cdTocLen' is filled with number +// of entries including the lead-out track. +// Return: 'NULL' on error, else array of 'CdToc' structures with '*cdTocLen' +// entries +CdToc *CdrDriver::getTocGeneric(int *cdTocLen) +{ + unsigned char cmd[10]; + unsigned short dataLen; + unsigned char *data = NULL;; + unsigned char reqData[4]; // buffer for requestion the actual length + unsigned char *p = NULL; + int i; + CdToc *toc; + int nTracks; + + // read disk toc length + memset(cmd, 0, 10); + cmd[0] = 0x43; // READ TOC + cmd[6] = 0; // return info for all tracks + cmd[8] = 4; + + if (sendCmd(cmd, 10, NULL, 0, reqData, 4) != 0) { + log_message(-2, "Cannot read disk toc."); + return NULL; + } + + dataLen = (reqData[0] << 8) | reqData[1]; + dataLen += 2; + + log_message(4, "getTocGeneric: data len %d", dataLen); + + if (dataLen < 12) { + dataLen = (100 * 8) + 4; + } + + data = new unsigned char[dataLen]; + memset(data, 0, dataLen); + + // read disk toc + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen) != 0) { + log_message(-2, "Cannot read disk toc."); + delete[] data; + return NULL; + } + + nTracks = data[3] - data[2] + 1; + if (nTracks > 99) { + log_message(-2, "Got illegal toc data."); + delete[] data; + return NULL; + } + + toc = new CdToc[nTracks + 1]; + + for (i = 0, p = data + 4; i <= nTracks; i++, p += 8) { + toc[i].track = p[2]; + toc[i].adrCtl = p[1]; + toc[i].start = (p[4] << 24) | (p[5] << 16) | (p[6] << 8) | p[7]; + } + + *cdTocLen = nTracks + 1; + + delete[] data; + + return toc; +} + +// Retrieves TOC data of inserted CD. The track information is returend for +// specified session number only. The lead-out start is taken from the +// correct session so that it can be used to calculate the length of the +// last track. +// 'cdTocLen' is filled with number of entries including the lead-out track. +// Return: 'NULL' on error, else array of 'CdToc' structures with '*cdTocLen' +// entries + +#define IS_BCD(v) (((v) & 0xf0) <= 0x90 && ((v) & 0x0f) <= 0x09) +CdToc *CdrDriver::getToc(int sessionNr, int *cdTocLen) +{ + int rawTocLen; + int completeTocLen; + CdToc *completeToc; // toc retrieved with generic method to verify with raw + // toc data + CdToc *cdToc; + CdRawToc *rawToc; + int i, j, tocEnt; + int nTracks = 0; + int trackNr; + long trackStart; + int isBcd = -1; + int lastTrack; + int min, sec, frame; + + if ((completeToc = getTocGeneric(&completeTocLen)) == NULL) + return NULL; + + if (options_ & OPT_DRV_GET_TOC_GENERIC) { + *cdTocLen = completeTocLen; + return completeToc; + } + + if ((rawToc = getRawToc(1, &rawTocLen)) == NULL) { + *cdTocLen = completeTocLen; + return completeToc; + } + + // Try to determine if raw toc data contains BCD or HEX numbers. + for (i = 0; i < rawTocLen; i++) { + if ((rawToc[i].adrCtl & 0xf0) == 0x10) { // only process QMODE1 entries + if (rawToc[i].point < 0xa0 && !IS_BCD(rawToc[i].point)) { + isBcd = 0; + } + + if (rawToc[i].point < 0xa0 || rawToc[i].point == 0xa2) { + if (!IS_BCD(rawToc[i].pmin) || !IS_BCD(rawToc[i].psec) || + !IS_BCD(rawToc[i].pframe)) { + isBcd = 0; + break; + } + } + } + } + + if (options_ & OPT_DRV_RAW_TOC_BCD) { + if (isBcd == 0) { + log_message(-2, "The driver option 0x%lx indicates that the raw TOC data", + OPT_DRV_RAW_TOC_BCD); + log_message(-2, "contains BCD values but a non BCD value was found."); + log_message(-2, "Please adjust the driver options."); + log_message(-1, "Using TOC data retrieved with generic method (no multi session support)."); + + delete[] rawToc; + *cdTocLen = completeTocLen; + return completeToc; + } + isBcd = 1; + } + else if (options_ & OPT_DRV_RAW_TOC_HEX) { + isBcd = 0; + } + else { + if (isBcd == -1) { + // We still don't know if the values are BCD or HEX but we've ensured + // so far that all values are valid BCD numbers. + + // Assume that we have BCD numbers and compare with the generic toc data. + isBcd = 1; + for (i = 0; i < rawTocLen && isBcd == 1; i++) { + if ((rawToc[i].adrCtl & 0xf0) == 0x10 && // only process QMODE1 entries + rawToc[i].point < 0xa0) { + trackNr = SubChannel::bcd2int(rawToc[i].point); + + for (j = 0; j < completeTocLen; j++) { + if (completeToc[j].track == trackNr) { + break; + } + } + + if (j < completeTocLen) { + min = SubChannel::bcd2int(rawToc[i].pmin); + sec = SubChannel::bcd2int(rawToc[i].psec); + frame = SubChannel::bcd2int(rawToc[i].pframe); + + if (min <= 99 && sec < 60 && frame < 75) { + trackStart = Msf(min, sec, frame).lba() - 150; + if (completeToc[j].start != trackStart) { + // start does not match -> values are not BCD + isBcd = 0; + } + } + else { + // bogus time code -> values are not BCD + isBcd = 0; + } + } + else { + // track not found -> values are not BCD + isBcd = 0; + } + } + } + + if (isBcd == 1) { + // verify last lead-out pointer + trackStart = 0; // start of lead-out + for (i = rawTocLen - 1; i >= 0; i--) { + if ((rawToc[i].adrCtl & 0xf0) == 0x10 && // QMODE1 entry + rawToc[i].point == 0xa2) { + min = SubChannel::bcd2int(rawToc[i].pmin); + sec = SubChannel::bcd2int(rawToc[i].psec); + frame = SubChannel::bcd2int(rawToc[i].pframe); + + if (min <= 99 && sec < 60 && frame < 75) + trackStart = Msf(min, sec, frame).lba() - 150; + break; + } + } + + if (i < 0) { + log_message(-1, "Found bogus toc data (no lead-out entry in raw data)."); + log_message(-1, "Your drive probably does not support raw toc reading."); + log_message(-1, "Using TOC data retrieved with generic method (no multi session support)."); + log_message(-1, "Use driver option 0x%lx to suppress this message.", + OPT_DRV_GET_TOC_GENERIC); + + delete[] rawToc; + *cdTocLen = completeTocLen; + return completeToc; + } + + for (j = 0; j < completeTocLen; j++) { + if (completeToc[j].track == 0xaa) { + break; + } + } + + if (j < completeTocLen) { + if (trackStart != completeToc[j].start) { + // lead-out start does not match -> values are not BCD + isBcd = 0; + } + } + else { + log_message(-2, "Found bogus toc data (no lead-out entry)."); + + delete[] completeToc; + delete[] rawToc; + return NULL; + } + } + + } + + if (isBcd == 0) { + // verify that the decision is really correct. + for (i = 0; i < rawTocLen && isBcd == 0; i++) { + if ((rawToc[i].adrCtl & 0xf0) == 0x10 && // only process QMODE1 entries + rawToc[i].point < 0xa0) { + + trackNr = rawToc[i].point; + + for (j = 0; j < completeTocLen; j++) { + if (completeToc[j].track == trackNr) { + break; + } + } + + if (j < completeTocLen) { + min = rawToc[i].pmin; + sec = rawToc[i].psec; + frame = rawToc[i].pframe; + + if (min <= 99 && sec < 60 && frame < 75) { + trackStart = Msf(min, sec, frame).lba() - 150; + if (completeToc[j].start != trackStart) { + // start does not match -> values are not HEX + isBcd = -1; + } + } + else { + // bogus time code -> values are not HEX + isBcd = -1; + } + } + else { + // track not found -> values are not BCD + isBcd = -1; + } + } + } + + // verify last lead-out pointer + trackStart = 0; // start of lead-out + for (i = rawTocLen - 1; i >= 0; i--) { + if ((rawToc[i].adrCtl & 0xf0) == 0x10 && // QMODE1 entry + rawToc[i].point == 0xa2) { + min = rawToc[i].pmin; + sec = rawToc[i].psec; + frame = rawToc[i].pframe; + + if (min <= 99 && sec < 60 && frame < 75) + trackStart = Msf(min, sec, frame).lba() - 150; + break; + } + } + + if (i < 0) { + log_message(-1, "Found bogus toc data (no lead-out entry in raw data)."); + log_message(-1, "Your drive probably does not support raw toc reading."); + log_message(-1, "Using TOC data retrieved with generic method (no multi session support)."); + log_message(-1, "Use driver option 0x%lx to suppress this message.", + OPT_DRV_GET_TOC_GENERIC); + + delete[] rawToc; + *cdTocLen = completeTocLen; + return completeToc; + } + + for (j = 0; j < completeTocLen; j++) { + if (completeToc[j].track == 0xaa) { + break; + } + } + + if (j < completeTocLen) { + if (trackStart != completeToc[j].start) { + // lead-out start does not match -> values are not BCD + isBcd = -1; + } + } + else { + log_message(-1, "Found bogus toc data (no lead-out entry)."); + + delete[] rawToc; + delete[] completeToc; + return NULL; + } + } + + if (isBcd == -1) { + log_message(-1, "Could not determine if raw toc data is BCD or HEX. Please report!"); + log_message(-1, "Using TOC data retrieved with generic method (no multi session support)."); + log_message(-1, + "Use driver option 0x%lx or 0x%lx to assume BCD or HEX data.", + OPT_DRV_RAW_TOC_BCD, OPT_DRV_RAW_TOC_HEX); + + delete[] rawToc; + *cdTocLen = completeTocLen; + return completeToc; + } + } + + log_message(4, "Raw toc contains %s values.", isBcd == 0 ? "HEX" : "BCD"); + + for (i = 0; i < rawTocLen; i++) { + if (rawToc[i].sessionNr == sessionNr && + (rawToc[i].adrCtl & 0xf0) == 0x10 && /* QMODE1 entry */ + rawToc[i].point < 0xa0) { + nTracks++; + } + } + + if (nTracks == 0 || nTracks > 99) { + log_message(-1, "Found bogus toc data (0 or > 99 tracks). Please report!"); + log_message(-1, "Your drive probably does not support raw toc reading."); + log_message(-1, "Using TOC data retrieved with generic method (no multi session support)."); + log_message(-1, "Use driver option 0x%lx to suppress this message.", + OPT_DRV_GET_TOC_GENERIC); + + delete[] rawToc; + *cdTocLen = completeTocLen; + return completeToc; + } + + cdToc = new CdToc[nTracks + 1]; + tocEnt = 0; + lastTrack = -1; + + for (i = 0; i < rawTocLen; i++) { + if (rawToc[i].sessionNr == sessionNr && + (rawToc[i].adrCtl & 0xf0) == 0x10 && // QMODE1 entry + rawToc[i].point < 0xa0) { + + if (isBcd) { + trackNr = SubChannel::bcd2int(rawToc[i].point); + trackStart = Msf(SubChannel::bcd2int(rawToc[i].pmin), + SubChannel::bcd2int(rawToc[i].psec), + SubChannel::bcd2int(rawToc[i].pframe)).lba(); + } + else { + trackNr = rawToc[i].point; + trackStart = + Msf(rawToc[i].pmin, rawToc[i].psec, rawToc[i].pframe).lba(); + } + + if (lastTrack != -1 && trackNr != lastTrack + 1) { + log_message(-1, "Found bogus toc data (track number sequence). Please report!"); + log_message(-1, "Your drive probably does not support raw toc reading."); + log_message(-1, "Using TOC data retrieved with generic method (no multi session support)."); + log_message(-1, "Use driver option 0x%lx to suppress this message.", + OPT_DRV_GET_TOC_GENERIC); + + delete[] cdToc; + delete[] rawToc; + *cdTocLen = completeTocLen; + return completeToc; + } + + lastTrack = trackNr; + + cdToc[tocEnt].adrCtl = rawToc[i].adrCtl; + cdToc[tocEnt].track = trackNr; + cdToc[tocEnt].start = trackStart - 150; + tocEnt++; + } + } + + // find lead-out pointer + for (i = 0; i < rawTocLen; i++) { + if (rawToc[i].sessionNr == sessionNr && + (rawToc[i].adrCtl & 0xf0) == 0x10 && // QMODE1 entry + rawToc[i].point == 0xa2 /* Lead-out pointer */) { + + if (isBcd) { + trackStart = Msf(SubChannel::bcd2int(rawToc[i].pmin), + SubChannel::bcd2int(rawToc[i].psec), + SubChannel::bcd2int(rawToc[i].pframe)).lba(); + } + else { + trackStart = + Msf(rawToc[i].pmin, rawToc[i].psec, rawToc[i].pframe).lba(); + } + + cdToc[tocEnt].adrCtl = rawToc[i].adrCtl; + cdToc[tocEnt].track = 0xaa; + cdToc[tocEnt].start = trackStart - 150; + tocEnt++; + + break; + } + } + + if (tocEnt != nTracks + 1) { + log_message(-1, "Found bogus toc data (no lead-out pointer for session). Please report!"); + log_message(-1, "Your drive probably does not support raw toc reading."); + log_message(-1, "Using TOC data retrieved with generic method (no multi session support)."); + log_message(-1, "Use driver option 0x%lx to suppress this message.", + OPT_DRV_GET_TOC_GENERIC); + + delete[] cdToc; + delete[] rawToc; + *cdTocLen = completeTocLen; + return completeToc; + } + + + delete[] rawToc; + delete[] completeToc; + + *cdTocLen = nTracks + 1; + return cdToc; +} + +static char *buildDataFileName(int trackNr, CdToc *toc, int nofTracks, + const char *basename, const char *extension) +{ + char buf[30]; + int start, end; + int run; + int onlyOneAudioRange = 1; + + // don't modify the STDIN filename + if (strcmp(basename, "-") == 0) + return strdupCC(basename); + + + if ((toc[trackNr].adrCtl & 0x04) != 0) { + // data track + sprintf(buf, "_%d", trackNr + 1); + return strdup3CC(basename, buf, NULL); + } + + // audio track, find continues range of audio tracks + start = trackNr; + while (start > 0 && (toc[start - 1].adrCtl & 0x04) == 0) + start--; + + if (start > 0) { + run = start - 1; + while (run >= 0) { + if ((toc[run].adrCtl & 0x04) == 0) { + onlyOneAudioRange = 0; + break; + } + run--; + } + } + + end = trackNr; + while (end < nofTracks - 1 && (toc[end + 1].adrCtl & 0x04) == 0) + end++; + + if (onlyOneAudioRange && end < nofTracks - 1) { + run = end + 1; + while (run < nofTracks) { + if ((toc[run].adrCtl & 0x04) == 0) { + onlyOneAudioRange = 0; + break; + } + run++; + } + } + + if (onlyOneAudioRange) { + return strdup3CC(basename, extension, NULL); + } + else { + sprintf(buf, "_%d-%d", start + 1, end + 1); + return strdup3CC(basename, buf, extension); + } +} + +/* Checks if drive's capabilites support the selected sub-channel reading + mode for given track mode. + mode: track mode + caps: capabilities bits + Return: 1: current sub-channel reading mode is supported + 0: current sub-channel reading mode is not supported +*/ +int CdrDriver::checkSubChanReadCaps(TrackData::Mode mode, unsigned long caps) +{ + int ret = 0; + + switch (subChanReadMode_) { + case TrackData::SUBCHAN_NONE: + ret = 1; + break; + + case TrackData::SUBCHAN_RW_RAW: + if (mode == TrackData::AUDIO) { + if ((caps & (CDR_READ_CAP_AUDIO_RW_RAW|CDR_READ_CAP_AUDIO_PW_RAW)) != 0) + ret = 1; + } + else { + if ((caps & (CDR_READ_CAP_DATA_RW_RAW|CDR_READ_CAP_DATA_PW_RAW)) != 0) + ret = 1; + } + break; + + case TrackData::SUBCHAN_RW: + if (mode == TrackData::AUDIO) { + if ((caps & CDR_READ_CAP_AUDIO_RW_COOKED) != 0) + ret = 1; + } + else { + if ((caps & CDR_READ_CAP_DATA_RW_COOKED) != 0) + ret = 1; + } + break; + } + + return ret; +} + +// Creates 'Toc' object for inserted CD. +// session: session that should be analyzed +// audioFilename: name of audio file that is placed into TOC +// Return: newly allocated 'Toc' object or 'NULL' on error +Toc *CdrDriver::readDiskToc(int session, const char *dataFilename) +{ + int nofTracks = 0; + int i, j; + CdToc *cdToc = getToc(session, &nofTracks); + Msf indexIncrements[98]; + int indexIncrementCnt = 0; + char isrcCode[13]; + unsigned char trackCtl; // control nibbles of track + int ctlCheckOk; + char *fname; + char *extension = NULL; + char *p; + TrackInfo *trackInfos; + + if (cdToc == NULL) { + return NULL; + } + + if (nofTracks <= 1) { + log_message(-1, "No tracks on disk."); + delete[] cdToc; + return NULL; + } + + log_message(1, ""); + printCdToc(cdToc, nofTracks); + log_message(1, ""); + //return NULL; + + nofTracks -= 1; // do not count lead-out + + readCapabilities_ = getReadCapabilities(cdToc, nofTracks); + + fname = strdupCC(dataFilename); + if ((p = strrchr(fname, '.')) != NULL) { + extension = strdupCC(p); + *p = 0; + } + + trackInfos = new TrackInfo[nofTracks + 1]; + memset(trackInfos, 0, (nofTracks + 1) * sizeof(TrackInfo)); + + for (i = 0; i < nofTracks; i++) { + TrackData::Mode trackMode; + + if ((cdToc[i].adrCtl & 0x04) != 0) { + if ((trackMode = getTrackMode(i + 1, cdToc[i].start)) == + TrackData::MODE0) { + log_message(-1, "Cannot determine mode of data track %d - asuming MODE1.", + i + 1); + trackMode = TrackData::MODE1; + } + + if (rawDataReading_) { + if (trackMode == TrackData::MODE1) { + trackMode = TrackData::MODE1_RAW; + } + else if (trackMode == TrackData::MODE2) { + trackMode = TrackData::MODE2_RAW; + } + else if (trackMode == TrackData::MODE2_FORM1 || + trackMode == TrackData::MODE2_FORM2 || + trackMode == TrackData::MODE2_FORM_MIX) { + trackMode = TrackData::MODE2_RAW; + } + } + else if (mode2Mixed_) { + if (trackMode == TrackData::MODE2_FORM1 || + trackMode == TrackData::MODE2_FORM2) { + trackMode = TrackData::MODE2_FORM_MIX; + } + } + } + else { + trackMode = TrackData::AUDIO; + } + + if (!checkSubChanReadCaps(trackMode, readCapabilities_)) { + log_message(-2, "This drive does not support %s sub-channel reading.", + TrackData::subChannelMode2String(subChanReadMode_)); + delete[] cdToc; + delete[] trackInfos; + delete[] fname; + return NULL; + } + + trackInfos[i].trackNr = cdToc[i].track; + trackInfos[i].ctl = cdToc[i].adrCtl & 0x0f; + trackInfos[i].mode = trackMode; + trackInfos[i].start = cdToc[i].start; + trackInfos[i].pregap = 0; + trackInfos[i].fill = 0; + trackInfos[i].indexCnt = 0; + trackInfos[i].isrcCode[0] = 0; + trackInfos[i].filename = buildDataFileName(i, cdToc, nofTracks, fname, + extension); + trackInfos[i].bytesWritten = 0; + } + + // lead-out entry + trackInfos[nofTracks].trackNr = 0xaa; + trackInfos[nofTracks].ctl = 0; + trackInfos[nofTracks].mode = trackInfos[nofTracks - 1].mode; + trackInfos[nofTracks].start = cdToc[nofTracks].start; + if (taoSource()) { + trackInfos[nofTracks].start -= taoSourceAdjust_; + } + trackInfos[nofTracks].pregap = 0; + trackInfos[nofTracks].fill = 0; + trackInfos[nofTracks].indexCnt = 0; + trackInfos[nofTracks].isrcCode[0] = 0; + trackInfos[nofTracks].filename = NULL; + trackInfos[nofTracks].bytesWritten = 0; + + long pregap = 0; + long defaultPregap; + long slba, elba; + + if (session == 1) { + pregap = cdToc[0].start; // pre-gap of first track + } + + for (i = 0; i < nofTracks; i++) { + trackInfos[i].pregap = pregap; + + slba = trackInfos[i].start; + elba = trackInfos[i + 1].start; + + defaultPregap = 0; + + if (taoSource()) { + // assume always a pre-gap of 150 + # link blocks between two tracks + // except between two audio tracks + if ((trackInfos[i].mode != TrackData::AUDIO || + trackInfos[i + 1].mode != TrackData::AUDIO) && + i < nofTracks - 1) { + defaultPregap = 150 + taoSourceAdjust_; + } + } + else { + // assume a pre-gap of 150 between tracks of different mode + if (trackInfos[i].mode != trackInfos[i + 1].mode) { + defaultPregap = 150; + } + } + + elba -= defaultPregap; + + + Msf trackLength(elba - slba); + + log_message(1, "Analyzing track %02d (%s): start %s, ", i + 1, + TrackData::mode2String(trackInfos[i].mode), + Msf(cdToc[i].start).str()); + log_message(1, "length %s...", trackLength.str()); + + if (pregap > 0) { + log_message(2, "Found pre-gap: %s", Msf(pregap).str()); + } + + isrcCode[0] = 0; + indexIncrementCnt = 0; + pregap = 0; + trackCtl = 0; + + if (!fastTocReading_) { + // Find index increments and pre-gap of next track + if (trackInfos[i].mode == TrackData::AUDIO) { + analyzeTrack(TrackData::AUDIO, i + 1, slba, elba, + indexIncrements, &indexIncrementCnt, + i < nofTracks - 1 ? &pregap : 0, isrcCode, &trackCtl); + if (defaultPregap != 0) + pregap = defaultPregap; + } + } + else { + if (trackInfos[i].mode == TrackData::AUDIO) { + if (readIsrc(i + 1, isrcCode) != 0) { + isrcCode[0] = 0; + } + } + } + + if (pregap == 0) { + pregap = defaultPregap; + } + + if (isrcCode[0] != 0) { + log_message(2, "Found ISRC code."); + memcpy(trackInfos[i].isrcCode, isrcCode, 13); + } + + for (j = 0; j < indexIncrementCnt; j++) + trackInfos[i].index[j] = indexIncrements[j].lba(); + + trackInfos[i].indexCnt = indexIncrementCnt; + + if ((trackCtl & 0x80) != 0) { + // Check track against TOC control nibbles + ctlCheckOk = 1; + if ((trackCtl & 0x01) != (cdToc[i].adrCtl & 0x01)) { + log_message(-1, "Pre-emphasis flag of track differs from TOC - toc file contains TOC setting."); + ctlCheckOk = 0; + } + if ((trackCtl & 0x08) != (cdToc[i].adrCtl & 0x08)) { + log_message(-1, "2-/4-channel-audio flag of track differs from TOC - toc file contains TOC setting."); + ctlCheckOk = 0; + } + + if (ctlCheckOk) { + log_message(2, "Control nibbles of track match CD-TOC settings."); + } + } + } + + int padFirstPregap; + + if (onTheFly_) { + if (session == 1 && (options_ & OPT_DRV_NO_PREGAP_READ) == 0) + padFirstPregap = 0; + else + padFirstPregap = 1; + } + else { + padFirstPregap = (session != 1) || padFirstPregap_; + } + + + Toc *toc = buildToc(trackInfos, nofTracks + 1, padFirstPregap); + + if (toc != NULL) { + if ((options_ & OPT_DRV_NO_CDTEXT_READ) == 0) + readCdTextData(toc); + + if (readCatalog(toc, trackInfos[0].start, trackInfos[nofTracks].start)) + log_message(2, "Found disk catalogue number."); + } + + // overwrite last time message + log_message(1, " \t"); + + delete[] cdToc; + delete[] trackInfos; + + delete[] fname; + if (extension != NULL) + delete[] extension; + + return toc; +} + +// Implementation is based on binary search over all sectors of actual +// track. ISRC codes are not extracted here. +int CdrDriver::analyzeTrackSearch(TrackData::Mode, int trackNr, long startLba, + long endLba, Msf *index, int *indexCnt, + long *pregap, char *isrcCode, + unsigned char *ctl) +{ + isrcCode[0] = 0; + *ctl = 0; + + + if (pregap != NULL) { + *pregap = findIndex(trackNr + 1, 0, startLba, endLba - 1); + if (*pregap >= endLba) { + *pregap = 0; + } + else if (*pregap > 0) { + *pregap = endLba - *pregap; + } + } + + // check for index increments + int ind = 2; + long indexLba = startLba; + *indexCnt = 0; + + do { + if ((indexLba = findIndex(trackNr, ind, indexLba, endLba - 1)) > 0) { + log_message(2, "Found index %d at %s", ind, Msf(indexLba).str()); + if (*indexCnt < 98 && indexLba > startLba) { + index[*indexCnt] = Msf(indexLba - startLba); + *indexCnt += 1; + } + ind++; + } + } while (indexLba > 0 && indexLba < endLba); + + + // Retrieve control nibbles of track, add 75 to track start so we + // surely get a block of current track. + int dummy, track; + if (getTrackIndex(startLba + 75, &track, &dummy, ctl) == 0 && + track == trackNr) { + *ctl |= 0x80; + } + + return 0; +} + +int CdrDriver::getTrackIndex(long lba, int *trackNr, int *indexNr, + unsigned char *ctl) +{ + return 1; +} + +// Scan from lba 'trackStart' to 'trackEnd' for the position at which the +// index switchs to 'index' of track number 'track'. +// return: lba of index start postion or 0 if index was not found +long CdrDriver::findIndex(int track, int index, long trackStart, + long trackEnd) +{ + int actTrack; + int actIndex; + long start = trackStart; + long end = trackEnd; + long mid; + + //log_message(0, "findIndex: %ld - %ld", trackStart, trackEnd); + + while (start < end) { + mid = start + ((end - start) / 2); + + //log_message(0, "Checking block %ld...", mid); + if (getTrackIndex(mid, &actTrack, &actIndex, NULL) != 0) { + return 0; + } + //log_message(0, "Found track %d, index %d", actTrack, actIndex); + if ((actTrack < track || actIndex < index) && mid + 1 < trackEnd) { + //log_message(0, " Checking block %ld...", mid + 1); + if (getTrackIndex(mid + 1, &actTrack, &actIndex, NULL) != 0) { + return 0; + } + //log_message(0, " Found track %d, index %d", actTrack, actIndex); + if (actTrack == track && actIndex == index) { + //log_message(0, "Found pregap at %ld", mid + 1); + return mid; + } + else { + start = mid + 1; + } + + } + else { + end = mid; + } + } + + return 0; +} + +int CdrDriver::analyzeTrackScan(TrackData::Mode, int trackNr, long startLba, + long endLba, + Msf *index, int *indexCnt, long *pregap, + char *isrcCode, unsigned char *ctl) +{ + SubChannel **subChannels; + int n, i; + int actIndex = 1; + long length; + long crcErrCnt = 0; + long timeCnt = 0; + int ctlSet = 0; + int isrcCodeFound = 0; + long trackStartLba = startLba; + + *isrcCode = 0; + + if (pregap != NULL) + *pregap = 0; + + *indexCnt = 0; + *ctl = 0; + + //startLba -= 75; + if (startLba < 0) { + startLba = 0; + } + length = endLba - startLba; + + while (length > 0) { + n = (length > maxScannedSubChannels_) ? maxScannedSubChannels_ : length; + + if (readSubChannels(TrackData::SUBCHAN_NONE, startLba, n, &subChannels, + NULL) != 0 || + subChannels == NULL) { + return 1; + } + + for (i = 0; i < n; i++) { + SubChannel *chan = subChannels[i]; + //chan->print(); + + if (chan->checkCrc() && chan->checkConsistency()) { + if (chan->type() == SubChannel::QMODE1DATA) { + int t = chan->trackNr(); + Msf time(chan->min(), chan->sec(), chan->frame()); // track rel time + Msf atime(chan->amin(), chan->asec(), chan->aframe()); // abs time + + if (timeCnt > 74) { + log_message(1, "%s\r", time.str()); + timeCnt = 0; + } + + if (t == trackNr && !ctlSet) { + *ctl = chan->ctl(); + *ctl |= 0x80; + ctlSet = 1; + } + if (t == trackNr && chan->indexNr() == actIndex + 1) { + actIndex = chan->indexNr(); + log_message(2, "Found index %d at: %s", actIndex, time.str()); + if ((*indexCnt) < 98) { + index[*indexCnt] = time; + *indexCnt += 1; + } + } + else if (t == trackNr + 1) { + if (chan->indexNr() == 0) { + if (pregap != NULL) { + // don't use time.lba() to calculate pre-gap length; it would + // count one frame too many if the CD counts the pre-gap down + // to 00:00:00 instead of 00:00:01 + // Instead, count number of frames until start of Index 01 + // See http://sourceforge.net/tracker/?func=detail&aid=604751&group_id=2171&atid=102171 + // atime starts at 02:00, so subtract it + *pregap = endLba - (atime.lba() - 150); + } + if (crcErrCnt != 0) + log_message(2, "Found %ld Q sub-channels with CRC errors.", + crcErrCnt); + + return 0; + } + } + } + else if (chan->type() == SubChannel::QMODE3) { + if (!isrcCodeFound && startLba > trackStartLba) { + strcpy(isrcCode, chan->isrc()); + isrcCodeFound = 1; + } + } + } + else { + crcErrCnt++; +#if 0 + if (chan->type() == SubChannel::QMODE1DATA) { + log_message(2, "Q sub-channel data at %02d:%02d:%02d failed CRC check - ignored", + chan->min(), chan->sec(), chan->frame()); + } + else { + log_message(2, "Q sub-channel data failed CRC check - ignored."); + } + chan->print(); +#endif + } + + timeCnt++; + } + + length -= n; + startLba += n; + } + + if (crcErrCnt != 0) + log_message(2, "Found %ld Q sub-channels with CRC errors.", crcErrCnt); + + return 0; +} + +// Checks if toc is suitable for writing. Usually all tocs are OK so +// return just 0 here. +// Return: 0: OK +// 1: toc may not be suitable +// 2: toc is not suitable +int CdrDriver::checkToc(const Toc *toc) +{ + int ret = 0; + + if (multiSession_ && toc->tocType() != Toc::CD_ROM_XA) { + log_message(-1, "The toc type should be set to CD_ROM_XA if a multi session"); + log_message(-1, "CD is recorded."); + ret = 1; + } + + TrackIterator itr(toc); + const Track *run; + int tracknr; + + for (run = itr.first(), tracknr = 1; run != NULL; + run = itr.next(), tracknr++) { + if (run->subChannelType() != TrackData::SUBCHAN_NONE) { + if (subChannelEncodingMode(run->subChannelType()) == -1) { + log_message(-2, "Track %d: sub-channel writing mode is not supported by driver.", tracknr); + ret = 2; + } + } + } + + return ret; +} + +// Returns block size for given mode and actual 'encodingMode_' that must +// be used to send data to the recorder. +long CdrDriver::blockSize(TrackData::Mode m, + TrackData::SubChannelMode sm) const +{ + long bsize = 0; + + if (encodingMode_ == 0) { + // only audio blocks are written + bsize = AUDIO_BLOCK_LEN; + } + else if (encodingMode_ == 1) { + // encoding for SCSI-3/mmc drives in session-at-once mode + switch (m) { + case TrackData::AUDIO: + bsize = AUDIO_BLOCK_LEN; + break; + case TrackData::MODE1: + case TrackData::MODE1_RAW: + bsize = MODE1_BLOCK_LEN; + break; + case TrackData::MODE2: + case TrackData::MODE2_RAW: + case TrackData::MODE2_FORM1: + case TrackData::MODE2_FORM2: + case TrackData::MODE2_FORM_MIX: + bsize = MODE2_BLOCK_LEN; + break; + case TrackData::MODE0: + log_message(-3, "Illegal mode in 'CdrDriver::blockSize()'."); + break; + } + } + else { + log_message(-3, "Illegal encoding mode in 'CdrDriver::blockSize()'."); + } + + bsize += TrackData::subChannelSize(sm); + + return bsize; +} + +void CdrDriver::printCdToc(CdToc *toc, int tocLen) +{ + int t; + long len; + + log_message(1, "Track Mode Flags Start Length"); + log_message(1, "------------------------------------------------------------"); + + for (t = 0; t < tocLen; t++) { + if (t == tocLen - 1) { + log_message(1, "Leadout %s %x %s(%6ld)", + (toc[t].adrCtl & 0x04) != 0 ? "DATA " : "AUDIO", + toc[t].adrCtl & 0x0f, + Msf(toc[t].start).str(), toc[t].start); + } + else { + len = toc[t + 1].start - toc[t].start; + log_message(1, "%2d %s %x %s(%6ld) ", toc[t].track, + (toc[t].adrCtl & 0x04) != 0 ? "DATA " : "AUDIO", + toc[t].adrCtl & 0x0f, + Msf(toc[t].start).str(), toc[t].start); + log_message(1, " %s(%6ld)", Msf(len).str(), len); + } + } +} + + +TrackData::Mode CdrDriver::getTrackMode(int, long trackStartLba) +{ + unsigned char cmd[10]; + unsigned char data[2340]; + int blockLength = 2340; + TrackData::Mode mode; + + if (setBlockSize(blockLength) != 0) { + return TrackData::MODE0; + } + + memset(cmd, 0, 10); + + cmd[0] = 0x28; // READ10 + cmd[2] = trackStartLba >> 24; + cmd[3] = trackStartLba >> 16; + cmd[4] = trackStartLba >> 8; + cmd[5] = trackStartLba; + cmd[8] = 1; + + if (sendCmd(cmd, 10, NULL, 0, data, blockLength) != 0) { + setBlockSize(MODE1_BLOCK_LEN); + return TrackData::MODE0; + } + + setBlockSize(MODE1_BLOCK_LEN); + + mode = determineSectorMode(data); + + if (mode == TrackData::MODE0) { + log_message(-2, "Found illegal mode in sector %ld.", trackStartLba); + } + + return mode; +} + +TrackData::Mode CdrDriver::determineSectorMode(unsigned char *buf) +{ + switch (buf[3]) { + case 1: + return TrackData::MODE1; + break; + + case 2: + return analyzeSubHeader(buf + 4); + break; + } + + // illegal mode found + return TrackData::MODE0; +} + +// Analyzes given 8 byte sub head and tries to determine if it belongs +// to a form 1, form 2 or a plain mode 2 sector. +TrackData::Mode CdrDriver::analyzeSubHeader(unsigned char *sh) +{ + if (sh[0] == sh[4] && sh[1] == sh[5] && sh[2] == sh[6] && sh[3] == sh[7]) { + // check first copy + //if (sh[0] < 8 && sh[1] < 8 && sh[2] != 0) { + if ((sh[2] & 0x20) != 0) + return TrackData::MODE2_FORM2; + else + return TrackData::MODE2_FORM1; + //} + +#if 0 + // check second copy + if (sh[4] < 8 && sh[5] < 8 && sh[6] != 0) { + if (sh[6] & 0x20 != 0) + return TrackData::MODE2_FORM2; + else + return TrackData::MODE2_FORM1; + } +#endif + } + else { + // no valid sub-header data, sector is a plain MODE2 sector + return TrackData::MODE2; + } +} + + +// Sets block size for read/write operation to given value. +// blocksize: block size in bytes +// density: (optional, default: 0) density code +// Return: 0: OK +// 1: SCSI command failed +int CdrDriver::setBlockSize(long blocksize, unsigned char density) +{ + unsigned char cmd[10]; + unsigned char ms[16]; + + if (blockLength_ == blocksize) + return 0; + + memset(ms, 0, 16); + + ms[3] = 8; + ms[4] = density; + ms[10] = blocksize >> 8; + ms[11] = blocksize; + + memset(cmd, 0, 10); + + cmd[0] = 0x15; // MODE SELECT6 + cmd[4] = 12; + + if (sendCmd(cmd, 6, ms, 12, NULL, 0) != 0) { + log_message(-2, "Cannot set block size."); + return 1; + } + + blockLength_ = blocksize; + + return 0; +} + + +// Returns control flags for given track. +unsigned char CdrDriver::trackCtl(const Track *track) +{ + unsigned char ctl = 0; + + if (track->copyPermitted()) { + ctl |= 0x20; + } + + if (track->type() == TrackData::AUDIO) { + // audio track + if (track->preEmphasis()) { + ctl |= 0x10; + } + if (track->audioType() == 1) { + ctl |= 0x80; + } + } + else { + // data track + ctl |= 0x40; + } + + return ctl; +} + +// Returns session format for point A0 toc entry depending on Toc type. +unsigned char CdrDriver::sessionFormat() +{ + unsigned char ret = 0; + int nofMode1Tracks; + int nofMode2Tracks; + + switch (toc_->tocType()) { + case Toc::CD_DA: + case Toc::CD_ROM: + ret = 0x00; + break; + + case Toc::CD_I: + ret = 0x10; + break; + + case Toc::CD_ROM_XA: + /* The toc type can only be set to CD_ROM_XA if the session contains + at least one data track. Otherwise the toc type must be CD_DA even + in multi session mode. + */ + toc_->trackSummary(NULL, &nofMode1Tracks, &nofMode2Tracks); + if (nofMode1Tracks + nofMode2Tracks > 0) + ret = 0x20; + else + ret = 0x0; + break; + } + + log_message(3, "Session format: %x", ret); + + return ret; +} + +// Generic method to read CD-TEXT packs according to the MMC-2 specification. +// nofPacks: filled with number of found CD-TEXT packs +// return: array of CD-TEXT packs or 'NULL' if no packs where retrieved +CdTextPack *CdrDriver::readCdTextPacks(long *nofPacks) +{ + unsigned char cmd[12]; + unsigned char *data; + unsigned char reqData[4]; + +#if 0 + memset(cmd, 0, 12); + + cmd[0] = 0xbe; + cmd[2] = 0xf0; + cmd[3] = 0x00; + cmd[4] = 0x00; + cmd[5] = 0x00; + cmd[8] = 15; + cmd[9] = 0x0; + cmd[10] = 0x1; + + long len1 = 15 * (AUDIO_BLOCK_LEN + 96); + data = new unsigned char [len1]; + + if (sendCmd(cmd, 12, NULL, 0, data, len1) != 0) { + log_message(1, "Cannot read raw CD-TEXT data."); + } + + long i, j; + unsigned char *p = data + AUDIO_BLOCK_LEN; + + log_message(0, "Raw CD-TEXT data"); + + for (i = 0; i < 15; i++) { + unsigned char packs[72]; + PWSubChannel96 chan(p); + + chan.getRawRWdata(packs); + + for (j = 0; j < 4; j++) { + log_message(0, "%02x %02x %02x %02x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x CRC: %02x %02x", + packs[j*18+0], packs[j*18+1], packs[j*18+2], packs[j*18+3], + packs[j*18+4], packs[j*18+5], packs[j*18+6], packs[j*18+7], + packs[j*18+8], packs[j*18+9], packs[j*18+10], packs[j*18+11], + packs[j*18+12], packs[j*18+13], packs[j*18+14], packs[j*18+15], + packs[j*18+16], packs[j*18+17]); + } + + p += AUDIO_BLOCK_LEN + 96; + } + + delete[] data; + + + log_message(0, "Raw CD-TEXT data - end"); +#endif + + memset(cmd, 0, 10); + + cmd[0] = 0x43; // READ TOC/PMA/ATIP + cmd[2] = 5; // CD-TEXT + cmd[8] = 4; + + if (sendCmd(cmd, 10, NULL, 0, reqData, 4, 0) != 0) { + log_message(3, "Cannot read CD-TEXT data - maybe not supported by drive."); + return NULL; + } + + long len = ((reqData[0] << 8 ) | reqData[1]) + 2; + + log_message(4, "CD-TEXT data len: %ld", len); + + if (len <= 4) + return NULL; + + if (len > scsiMaxDataLen_) { + log_message(-2, "CD-TEXT data too big for maximum SCSI transfer length."); + return NULL; + } + + data = new unsigned char[len]; + + cmd[7] = len >> 8; + cmd[8] = len; + + if (sendCmd(cmd, 10, NULL, 0, data, len, 1) != 0) { + log_message(-2, "Reading of CD-TEXT data failed."); + delete[] data; + return NULL; + } + + *nofPacks = (len - 4) / sizeof(CdTextPack); + + CdTextPack *packs = new CdTextPack[*nofPacks]; + + memcpy(packs, data + 4, *nofPacks * sizeof(CdTextPack)); + + delete[] data; + + return packs; +} + +// Analyzes CD-TEXT packs and stores read data in given 'Toc' object. +// Return: 0: OK +// 1: error occured +int CdrDriver::readCdTextData(Toc *toc) +{ + long i, j; + long nofPacks; + CdTextPack *packs = readCdTextPacks(&nofPacks); + unsigned char buf[256 * 12]; + unsigned char lastType; + int lastBlockNumber; + int blockNumber; + int pos; + int actTrack; + CdTextItem::PackType packType; + CdTextItem *sizeInfoItem = NULL; + CdTextItem *item; + + if (packs == NULL) + return 1; + + log_message(1, "Found CD-TEXT data."); + + pos = 0; + lastType = packs[0].packType; + lastBlockNumber = (packs[0].blockCharacter >> 4) & 0x07; + actTrack = 0; + + for (i = 0; i < nofPacks; i++) { + CdTextPack &p = packs[i]; + +#if 1 + log_message(4, "%02x %02x %02x %02x: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x CRC: %02x %02x", p.packType, p.trackNumber, + p.sequenceNumber, p.blockCharacter, p.data[0], p.data[1], + p.data[2], p.data[3], p.data[4], p.data[5], p.data[6], p.data[7], + p.data[8], p.data[9], p.data[10], p.data[11], + p.crc0, p.crc1); +#endif + + blockNumber = (p.blockCharacter >> 4) & 0x07; + + if (lastType != p.packType || lastBlockNumber != blockNumber) { + if (lastType >= 0x80 && lastType <= 0x8f) { + packType = CdTextItem::int2PackType(lastType); + + if (CdTextItem::isBinaryPack(packType)) { + // finish binary data + + if (packType == CdTextItem::CDTEXT_GENRE) { + // The two genre codes may be followed by a string. Adjust 'pos' + // so that all extra 0 bytes at the end of the data are stripped + // off. + for (j = 2; j < pos && buf[j] != 0; j++) ; + if (j < pos) + pos = j + 1; + } + + item = new CdTextItem(packType, lastBlockNumber, buf, pos); + + if (packType == CdTextItem::CDTEXT_SIZE_INFO) + sizeInfoItem = item; + + toc->addCdTextItem(0, item); + } + } + else { + log_message(-2, "CD-TEXT: Found invalid pack type: %02x", lastType); + delete[] packs; + return 1; + } + + lastType = p.packType; + lastBlockNumber = blockNumber; + pos = 0; + actTrack = 0; + } + + if (p.packType >= 0x80 && p.packType <= 0x8f) { + packType = CdTextItem::int2PackType(p.packType); + + if (CdTextItem::isBinaryPack(packType)) { + memcpy(buf + pos, p.data, 12); + pos += 12; + } + else { + // pack contains text -> read all string from it + j = 0; + + while (j < 12 && actTrack <= toc->nofTracks()) { + for (; j < 12 && p.data[j] != 0; j++) + buf[pos++] = p.data[j]; + + if (j < 12) { + // string is finished + buf[pos] = 0; + +#if 0 + log_message(0, "%02x %02x: %s", p.packType, p.trackNumber, buf); +#endif + + toc->addCdTextItem(actTrack, + new CdTextItem(packType, blockNumber, + (char*)buf)); + actTrack++; + pos = 0; + + if (CdTextItem::isTrackPack(packType)) { + j++; // skip zero + } + else { + j = 12; // don't use remaining zeros to build track packs + } + } + } + } + } + else { + log_message(-2, "CD-TEXT: Found invalid pack type: %02x", p.packType); + delete[] packs; + return 1; + } + } + + if (pos != 0 && lastType >= 0x80 && lastType <= 0x8f) { + packType = CdTextItem::int2PackType(lastType); + + if (CdTextItem::isBinaryPack(packType)) { + // finish binary data + + if (packType == CdTextItem::CDTEXT_GENRE) { + // The two genre codes may be followed by a string. Adjust 'pos' + // so that all extra 0 bytes at the end of the data are stripped + // off. + for (j = 2; j < pos && buf[j] != 0; j++) ; + if (j < pos) + pos = j + 1; + } + + item = new CdTextItem(packType, lastBlockNumber, buf, pos); + toc->addCdTextItem(0, item); + + if (packType == CdTextItem::CDTEXT_SIZE_INFO) + sizeInfoItem = item; + } + } + + delete[] packs; + + // update language mapping from SIZE INFO pack data + if (sizeInfoItem != NULL && sizeInfoItem->dataLen() >= 36) { + const unsigned char *data = sizeInfoItem->data(); + for (i = 0; i < 8; i++) { + if (data[28 + i] > 0) + toc->cdTextLanguage(i, data[28 + i]); + else + toc->cdTextLanguage(i, -1); + } + } + else { + log_message(-1, "Cannot determine language mapping from CD-TEXT data."); + log_message(-1, "Using default mapping."); + } + + return 0; +} + +int CdrDriver::analyzeDataTrack(TrackData::Mode mode, int trackNr, + long startLba, long endLba, long *pregap) +{ + long maxLen = scsiMaxDataLen_ / AUDIO_BLOCK_LEN; + long lba = startLba; + long len = endLba - startLba; + long actLen, n; + + *pregap = 0; + + while (len > 0) { + n = len > maxLen ? maxLen : len; + + if ((actLen = readTrackData(mode, TrackData::SUBCHAN_NONE, lba, n, + transferBuffer_)) < 0) { + log_message(-2, "Analyzing of track %d failed.", trackNr); + return 1; + } + + log_message(1, "%s\r", Msf(lba).str()); + + if (actLen != n) { + //log_message(0, "Data track pre-gap: %ld", len - actLen); + *pregap = len - actLen; + + if (*pregap > 300) { + log_message(-1, + "The pre-gap of the following track appears to have length %s.", + Msf(*pregap).str()); + log_message(-1, "This value is probably bogus and may be caused by unexpected"); + log_message(-1, "behavior of the drive. Try to verify with other tools how"); + log_message(-1, "much data can be read from the current track and compare it"); + log_message(-1, "to the value stored in the toc-file. Usually, the pre-gap"); + log_message(-1, "should have length 00:02:00."); + } + + return 0; + } + + len -= n; + lba += n; + } + + return 0; +} + +/* Reads toc and audio data from CD for specified 'session' number. + * The data is written to file 'dataFilename' unless on-the-fly writing + * is active in which case the data is written to the file descriptor + * 'onTheFlyFd'. + * Return: newly created 'Toc' object or 'NULL' if an error occured + */ + +Toc *CdrDriver::readDisk(int session, const char *dataFilename) +{ + int padFirstPregap = 1; + int nofTracks = 0; + int i; + CdToc *cdToc = getToc(session, &nofTracks); + //unsigned char trackCtl; // control nibbles of track + //int ctlCheckOk; + TrackInfo *trackInfos; + TrackData::Mode trackMode; + int fp = -1; + char *fname = strdupCC(dataFilename); + Toc *toc = NULL; + int trs = 0; + int tre = 0; + long slba, elba; + ReadDiskInfo info; + + if (cdToc == NULL) { + return NULL; + } + + if (nofTracks <= 1) { + log_message(-1, "No tracks on disk."); + delete[] cdToc; + return NULL; + } + + log_message(1, ""); + printCdToc(cdToc, nofTracks); + log_message(1, ""); + //return NULL; + + nofTracks -= 1; // do not count lead-out + + readCapabilities_ = getReadCapabilities(cdToc, nofTracks); + + trackInfos = new TrackInfo[nofTracks + 1]; + + for (i = 0; i < nofTracks; i++) { + if ((cdToc[i].adrCtl & 0x04) != 0) { + if ((trackMode = getTrackMode(i + 1, cdToc[i].start)) == + TrackData::MODE0) { + log_message(-1, "Cannot determine mode of data track %d - asuming MODE1.", + i + 1); + trackMode = TrackData::MODE1; + } + + if (rawDataReading_) { + if (trackMode == TrackData::MODE1) { + trackMode = TrackData::MODE1_RAW; + } + else if (trackMode == TrackData::MODE2_FORM1 || + trackMode == TrackData::MODE2_FORM2 || + trackMode == TrackData::MODE2_FORM_MIX) { + trackMode = TrackData::MODE2_RAW; + } + } + else if (mode2Mixed_) { + if (trackMode == TrackData::MODE2_FORM1 || + trackMode == TrackData::MODE2_FORM2 || + trackMode == TrackData::MODE2_FORM_MIX) { + trackMode = TrackData::MODE2_FORM_MIX; + } + } + } + else { + trackMode = TrackData::AUDIO; + } + + if (!checkSubChanReadCaps(trackMode, readCapabilities_)) { + log_message(-2, "This drive does not support %s sub-channel reading.", + TrackData::subChannelMode2String(subChanReadMode_)); + goto fail; + } + + trackInfos[i].trackNr = cdToc[i].track; + trackInfos[i].ctl = cdToc[i].adrCtl & 0x0f; + trackInfos[i].mode = trackMode; + trackInfos[i].start = cdToc[i].start; + trackInfos[i].pregap = 0; + trackInfos[i].fill = 0; + trackInfos[i].indexCnt = 0; + trackInfos[i].isrcCode[0] = 0; + trackInfos[i].filename = fname; + trackInfos[i].bytesWritten = 0; + } + + // lead-out entry + trackInfos[nofTracks].trackNr = 0xaa; + trackInfos[nofTracks].ctl = 0; + trackInfos[nofTracks].mode = trackInfos[nofTracks - 1].mode; + trackInfos[nofTracks].start = cdToc[nofTracks].start; + if (taoSource()) { + trackInfos[nofTracks].start -= taoSourceAdjust_; + } + trackInfos[nofTracks].pregap = 0; + trackInfos[nofTracks].indexCnt = 0; + trackInfos[nofTracks].isrcCode[0] = 0; + trackInfos[nofTracks].filename = NULL; + trackInfos[nofTracks].bytesWritten = 0; + + + if (onTheFly_) { + fp = onTheFlyFd_; + } + else { + + giveUpRootPrivileges(); + +#ifdef __CYGWIN__ + if ((fp = open(dataFilename, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, + 0666)) < 0) +#else + if ((fp = open(dataFilename, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) +#endif + { + log_message(-2, "Cannot open \"%s\" for writing: %s", dataFilename, + strerror(errno)); + delete[] cdToc; + return NULL; + } + } + + info.tracks = nofTracks; + info.startLba = trackInfos[0].start; + info.endLba = trackInfos[nofTracks].start; + + + while (trs < nofTracks) { + if (trackInfos[trs].mode != TrackData::AUDIO) { + if (trs == 0) { + if (session == 1) + trackInfos[trs].pregap = trackInfos[trs].start; + } + else { + if (taoSource()) { + trackInfos[trs].pregap = 150 + taoSourceAdjust_; + } + else { + if (trackInfos[trs].mode != trackInfos[trs - 1].mode) + trackInfos[trs].pregap = 150; + } + } + + slba = trackInfos[trs].start; + elba = trackInfos[trs + 1].start; + + if (taoSource()) { + if (trs < nofTracks - 1) + elba -= 150 + taoSourceAdjust_; + } + else { + if (trackInfos[trs].mode != trackInfos[trs + 1].mode) { + elba -= 150; + } + } + + + log_message(1, "Copying data track %d (%s): start %s, ", trs + 1, + TrackData::mode2String(trackInfos[trs].mode), + Msf(cdToc[trs].start).str()); + log_message(1, "length %s to \"%s\"...", Msf(elba - slba).str(), + trackInfos[trs].filename); + + if (readDataTrack(&info, fp, slba, elba, &trackInfos[trs]) != 0) + goto fail; + + trs++; + } + else { + // find continuous range of audio tracks + tre = trs; + while (tre < nofTracks && trackInfos[tre].mode == TrackData::AUDIO) + tre++; + + if (trs == 0) { + if (session == 1) + trackInfos[trs].pregap = trackInfos[trs].start; + } + else { + // previous track must be of different mode so assume a standard + // pre-gap here + if (taoSource()) { + trackInfos[trs].pregap = 150 + taoSourceAdjust_; + } + else { + trackInfos[trs].pregap = 150; + } + } + + slba = cdToc[trs].start; + elba = cdToc[tre].start; + + // If we have the first track of the first session we can start ripping + // from lba 0 to extract the pre-gap data. + // But only if the drive supports it as indicated by 'options_'. + if (session == 1 && trs == 0 && + (options_ & OPT_DRV_NO_PREGAP_READ) == 0) { + slba = 0; + } + + // Assume that the pre-gap length conforms to the standard if the track + // mode changes. + if (taoSource()) { + if (tre < nofTracks) + elba -= 150 + taoSourceAdjust_; + } + else { + if (trackInfos[tre - 1].mode != trackInfos[tre].mode) { + elba -= 150; + } + } + + log_message(1, "Copying audio tracks %d-%d: start %s, ", trs + 1, tre, + Msf(slba).str()); + log_message(1, "length %s to \"%s\"...", Msf(elba - slba).str(), + trackInfos[trs].filename); + + if (readAudioRange(&info, fp, slba, elba, trs, tre - 1, trackInfos) != 0) + goto fail; + + trs = tre; + } + } + + // if the drive allows to read audio data from the first track's + // pre-gap the data will be written to the output file and + // 'buildToc()' must not create zero data for the pre-gap + padFirstPregap = 1; + + if (session == 1 && (options_ & OPT_DRV_NO_PREGAP_READ) == 0) + padFirstPregap = 0; + + toc = buildToc(trackInfos, nofTracks + 1, padFirstPregap); + + if (!onTheFly_ && toc != NULL) { + if ((options_ & OPT_DRV_NO_CDTEXT_READ) == 0) + readCdTextData(toc); + + if (readCatalog(toc, trackInfos[0].start, trackInfos[nofTracks].start)) { + log_message(2, "Found disk catalogue number."); + } + } + + sendReadCdProgressMsg(RCD_EXTRACTING, nofTracks, nofTracks, 1000, 1000); + +fail: + delete[] cdToc; + delete[] trackInfos; + + delete[] fname; + + if (!onTheFly_ && fp >= 0) { + if (close(fp) != 0) { + log_message(-2, "Writing to \"%s\" failed: %s", dataFilename, + strerror(errno)); + delete toc; + return NULL; + } + } + + return toc; +} + + +Toc *CdrDriver::buildToc(TrackInfo *trackInfos, long nofTrackInfos, + int padFirstPregap) +{ + long i, j; + long nofTracks = nofTrackInfos - 1; + int foundDataTrack = 0; + int foundAudioTrack = 0; + int foundXATrack = 0; + long modeStartLba = 0; // start LBA for current mode + unsigned long dataLen; + TrackData::Mode trackMode; + TrackData::Mode lastMode = TrackData::MODE0; // illegal in this context + TrackData::SubChannelMode trackSubChanMode; + int newMode; + long byteOffset = 0; + + if (nofTrackInfos < 2) + return NULL; + + Toc *toc = new Toc; + + // build the Toc + + for (i = 0; i < nofTracks; i++) { + TrackInfo &ati = trackInfos[i]; // actual track info + TrackInfo &nti = trackInfos[i + 1]; // next track info + + newMode = 0; + trackMode = ati.mode; + trackSubChanMode = subChanReadMode_; + + switch (trackMode) { + case TrackData::AUDIO: + foundAudioTrack = 1; + break; + case TrackData::MODE1: + case TrackData::MODE1_RAW: + case TrackData::MODE2: + foundDataTrack = 1; + break; + case TrackData::MODE2_RAW: + case TrackData::MODE2_FORM1: + case TrackData::MODE2_FORM2: + case TrackData::MODE2_FORM_MIX: + foundXATrack = 1; + break; + case TrackData::MODE0: + // should not happen + break; + } + + if (trackMode != lastMode) { + newMode = 1; + if (i == 0 && !padFirstPregap) + modeStartLba = 0; + else + modeStartLba = ati.start; + lastMode = trackMode; + } + + Track t(trackMode, trackSubChanMode); + + t.preEmphasis(ati.ctl & 0x01); + t.copyPermitted(ati.ctl & 0x02); + t.audioType(ati.ctl & 0x08); + + if (ati.isrcCode[0] != 0) + t.isrc(ati.isrcCode); + + if (trackMode == TrackData::AUDIO) { + if (trackSubChanMode == TrackData::SUBCHAN_NONE) { + if (newMode && (i > 0 || padFirstPregap)) { + Msf trackLength(nti.start - ati.start - nti.pregap); + if (ati.pregap > 0) { + t.append(SubTrack(SubTrack::DATA, + TrackData(Msf(ati.pregap).samples()))); + } + t.append(SubTrack(SubTrack::DATA, + TrackData(ati.filename, byteOffset, + 0, trackLength.samples()))); + } + else { + Msf trackLength(nti.start - ati.start - nti.pregap + ati.pregap); + t.append(SubTrack(SubTrack::DATA, + TrackData(ati.filename, byteOffset, + Msf(ati.start - modeStartLba + - ati.pregap).samples(), + trackLength.samples()))); + } + } + else { + if (newMode && (i > 0 || padFirstPregap)) { + long trackLength = nti.start - ati.start - nti.pregap; + + if (ati.pregap > 0) { + dataLen = ati.pregap * TrackData::dataBlockSize(trackMode, + trackSubChanMode); + t.append(SubTrack(SubTrack::DATA, + TrackData(trackMode, trackSubChanMode, + dataLen))); + } + dataLen = trackLength * TrackData::dataBlockSize(trackMode, + trackSubChanMode); + t.append(SubTrack(SubTrack::DATA, + TrackData(trackMode, trackSubChanMode, + ati.filename, byteOffset, dataLen))); + } + else { + long trackLength = nti.start - ati.start - nti.pregap + ati.pregap; + dataLen = trackLength * TrackData::dataBlockSize(trackMode, + trackSubChanMode); + long offset = + (ati.start - modeStartLba - ati.pregap) * + TrackData::dataBlockSize(trackMode, trackSubChanMode); + + + t.append(SubTrack(SubTrack::DATA, + TrackData(trackMode, trackSubChanMode, + ati.filename, byteOffset + offset, + dataLen))); + } + } + + t.start(Msf(ati.pregap)); + } + else { + long trackLength = nti.start - ati.start - nti.pregap - ati.fill; + + if (ati.pregap != 0) { + // add zero data for pre-gap + dataLen = ati.pregap * TrackData::dataBlockSize(trackMode, + trackSubChanMode); + t.append(SubTrack(SubTrack::DATA, + TrackData(trackMode, trackSubChanMode, dataLen))); + } + + dataLen = trackLength * TrackData::dataBlockSize(trackMode, + trackSubChanMode); + t.append(SubTrack(SubTrack::DATA, + TrackData(trackMode, trackSubChanMode, ati.filename, + byteOffset, dataLen))); + + if (ati.fill > 0) { + dataLen = ati.fill * TrackData::dataBlockSize(trackMode, + trackSubChanMode); + t.append(SubTrack(SubTrack::DATA, + TrackData(trackMode, trackSubChanMode, dataLen))); + } + + t.start(Msf(ati.pregap)); + } + + for (j = 0; j < ati.indexCnt; j++) + t.appendIndex(Msf(ati.index[j])); + + toc->append(&t); + + byteOffset += ati.bytesWritten; + } + + if (foundXATrack) + toc->tocType(Toc::CD_ROM_XA); + else if (foundDataTrack) + toc->tocType(Toc::CD_ROM); + else + toc->tocType(Toc::CD_DA); + + return toc; +} + +// Reads a complete data track. +// start: start of data track from TOC +// end: start of next track from TOC +// trackInfo: info about current track, updated by this function +// Return: 0: OK +// 1: error occured +int CdrDriver::readDataTrack(ReadDiskInfo *info, int fd, long start, long end, + TrackInfo *trackInfo) +{ + long len = end - start; + long totalLen = len; + long lba; + long lastLba; + long blockLen = 0; + long blocking; + long burst; + long iterationsWithoutError = 0; + long n, ret; + long act; + int foundLECError; + unsigned char *buf; + TrackData::Mode mode = TrackData::AUDIO; + + switch (trackInfo->mode) { + case TrackData::MODE1: + mode = TrackData::MODE1; + blockLen = MODE1_BLOCK_LEN; + break; + case TrackData::MODE1_RAW: + mode = TrackData::MODE1_RAW; + blockLen = AUDIO_BLOCK_LEN; + break; + case TrackData::MODE2: + mode = TrackData::MODE2; + blockLen = MODE2_BLOCK_LEN; + break; + case TrackData::MODE2_RAW: + mode = TrackData::MODE2_RAW; + blockLen = AUDIO_BLOCK_LEN; + break; + case TrackData::MODE2_FORM1: + mode = TrackData::MODE2_FORM1; + blockLen = MODE2_FORM1_DATA_LEN; + break; + case TrackData::MODE2_FORM2: + mode = TrackData::MODE2_FORM2; + blockLen = MODE2_FORM2_DATA_LEN; + break; + case TrackData::MODE2_FORM_MIX: + mode = TrackData::MODE2_FORM_MIX; + blockLen = MODE2_BLOCK_LEN; + break; + case TrackData::MODE0: + case TrackData::AUDIO: + log_message(-3, "CdrDriver::readDataTrack: Illegal mode."); + return 1; + break; + } + + blockLen += TrackData::subChannelSize(subChanReadMode_); + + // adjust mode in 'trackInfo' + trackInfo->mode = mode; + + trackInfo->bytesWritten = 0; + + blocking = scsiMaxDataLen_ / (AUDIO_BLOCK_LEN + PW_SUBCHANNEL_LEN); + assert(blocking > 0); + + buf = new unsigned char[blocking * blockLen]; + + lba = lastLba = start; + burst = blocking; + + while (len > 0) { + if (burst != blocking && iterationsWithoutError > 2 * blocking) + burst = blocking; + + n = (len > burst) ? burst : len; + + foundLECError = 0; + + if ((act = readTrackData(mode, subChanReadMode_, lba, n, buf)) == -1) { + log_message(-2, "Read error while copying data from track."); + delete[] buf; + return 1; + } + + if (act == -2) { + // L-EC error encountered + if (trackInfo->mode == TrackData::MODE1_RAW || + trackInfo->mode == TrackData::MODE2_RAW) { + + if (n > 1) { + // switch to single step mode + iterationsWithoutError = 0; + burst = 1; + continue; + } + else { + foundLECError = 1; + act = n = 0; + } + } + else { + log_message(-2, "L-EC error around sector %ld while copying data from track.", lba); + log_message(-2, "Use option '--read-raw' to ignore L-EC errors."); + delete[] buf; + return 1; + } + } + + if (foundLECError) { + iterationsWithoutError = 0; + + log_message(2, "Found L-EC error at sector %ld - ignored.", lba); + + // create a dummy sector for the sector with L-EC errors + Msf m(lba + 150); + + memcpy(buf, syncPattern, 12); + buf[12] = SubChannel::bcd(m.min()); + buf[13] = SubChannel::bcd(m.sec()); + buf[14] = SubChannel::bcd(m.frac()); + if (trackInfo->mode == TrackData::MODE1_RAW) + buf[15] = 1; + else + buf[15] = 2; + + memcpy(buf + 16, SECTOR_ERROR_DATA, blockLen - 16); + + if ((ret = fullWrite(fd, buf, blockLen)) != blockLen) { + if (ret < 0) + log_message(-2, "Writing of data failed: %s", strerror(errno)); + else + log_message(-2, "Writing of data failed: Disk full"); + + delete[] buf; + return 1; + } + + trackInfo->bytesWritten += blockLen; + + lba += 1; + len -= 1; + } + else { + iterationsWithoutError++; + + if (act > 0) { + if ((ret = fullWrite(fd, buf, blockLen * act)) != blockLen * act) { + if (ret < 0) + log_message(-2, "Writing of data failed: %s", strerror(errno)); + else + log_message(-2, "Writing of data failed: Disk full"); + + delete[] buf; + return 1; + } + } + + trackInfo->bytesWritten += blockLen * act; + + if (lba > lastLba + 75) { + Msf lbatime(lba); + log_message(1, "%02d:%02d:00\r", lbatime.min(), lbatime.sec()); + lastLba = lba; + + if (remote_) { + long totalProgress; + long progress; + + progress = (totalLen - len) * 1000; + progress /= totalLen; + + totalProgress = lba - info->startLba; + + if (totalProgress > 0) { + totalProgress *= 1000; + totalProgress /= (info->endLba - info->startLba); + } + else { + totalProgress = 0; + } + + sendReadCdProgressMsg(RCD_EXTRACTING, info->tracks, + trackInfo->trackNr, progress, totalProgress); + } + } + + lba += act; + len -= act; + + if (act != n) + break; + } + } + + // pad remaining blocks with zero data, e.g. for disks written in TAO mode + + if (len > 0) { + log_message(-1, "Padding with %ld zero sectors.", len); + + if (mode == TrackData::MODE1_RAW || mode == TrackData::MODE2_RAW) { + memcpy(buf, syncPattern, 12); + + if (mode == TrackData::MODE1_RAW) + buf[15] = 1; + else + buf[15] = 2; + + memset(buf + 16, 0, blockLen - 16); + } + else { + memset(buf, 0, blockLen); + } + + while (len > 0) { + if (mode == TrackData::MODE1_RAW || mode == TrackData::MODE2_RAW) { + Msf m(lba + 150); + + buf[12] = SubChannel::bcd(m.min()); + buf[13] = SubChannel::bcd(m.sec()); + buf[14] = SubChannel::bcd(m.frac()); + } + + if ((ret = fullWrite(fd, buf, blockLen)) != blockLen) { + if (ret < 0) + log_message(-2, "Writing of data failed: %s", strerror(errno)); + else + log_message(-2, "Writing of data failed: Disk full"); + + delete[] buf; + return 1; + } + + trackInfo->bytesWritten += blockLen; + + len--; + lba++; + } + } + + delete[] buf; + + return 0; +} + +// Tries to read the catalog number from the sub-channels starting at LBA 0. +// If a catalog number is found it will be placed into the provided 14 byte +// buffer 'mcnCode'. Otherwise 'mcnCode[0]' is set to 0. +// Return: 0: OK +// 1: SCSI error occured +#define N_ELEM 11 +#define MCN_LEN 13 +#define MAX_MCN_SCAN_LENGTH 5000 + +static int cmpMcn(const void *p1, const void *p2) +{ + const char *s1 = (const char *)p1; + const char *s2 = (const char *)p2; + + return strcmp(s1, s2); +} + +int CdrDriver::readCatalogScan(char *mcnCode, long startLba, long endLba) +{ + + SubChannel **subChannels; + int n, i; + long length; + int mcnCodeFound = 0; + char mcn[N_ELEM][MCN_LEN+1]; + + *mcnCode = 0; + + length = endLba - startLba; + + if (length > MAX_MCN_SCAN_LENGTH) + length = MAX_MCN_SCAN_LENGTH; + + + while ((length > 0) && (mcnCodeFound < N_ELEM)) { + n = (length > maxScannedSubChannels_ ? maxScannedSubChannels_ : length); + + if (readSubChannels(TrackData::SUBCHAN_NONE, startLba, n, &subChannels, + NULL) != 0 || + subChannels == NULL) { + return 1; + } + + for (i = 0; i < n; i++) { + SubChannel *chan = subChannels[i]; + //chan->print(); + + if (chan->checkCrc() && chan->checkConsistency()) { + if (chan->type() == SubChannel::QMODE2) { + if (mcnCodeFound < N_ELEM) { + strcpy(mcn[mcnCodeFound++], chan->catalog()); + } + } + } + } + + length -= n; + startLba += n; + } + + if(mcnCodeFound > 0) { + qsort(mcn, mcnCodeFound, MCN_LEN + 1, cmpMcn); + strcpy(mcnCode, mcn[(mcnCodeFound >> 1)]); + } + + return 0; +} + +#undef N_ELEM +#undef MCN_LEN +#undef MAX_MCN_SCAN_LENGTH + + +// Sends a read cd progress message without blocking the actual process. +void CdrDriver::sendReadCdProgressMsg(ReadCdProgressType type, int totalTracks, + int track, int trackProgress, + int totalProgress) +{ + if (remote_) { + int fd = remoteFd_; + ProgressMsg p; + + p.status = type; + p.totalTracks = totalTracks; + p.track = track; + p.trackProgress = trackProgress; + p.totalProgress = totalProgress; + p.bufferFillRate = 0; + p.writerFillRate = 0; + + if (write(fd, REMOTE_MSG_SYNC_, sizeof(REMOTE_MSG_SYNC_)) != sizeof(REMOTE_MSG_SYNC_) || + write(fd, (const char*)&p, sizeof(p)) != sizeof(p)) { + log_message(-1, "Failed to send read CD remote progress message."); + } + } +} + +// Sends a write cd progress message without blocking the actual process. +int CdrDriver::sendWriteCdProgressMsg(WriteCdProgressType type, + int totalTracks, int track, + int trackProgress, int totalProgress, + int bufferFillRate, int writeFill) +{ + if (remote_) { + int fd = remoteFd_; + ProgressMsg p; + + p.status = type; + p.totalTracks = totalTracks; + p.track = track; + p.trackProgress = trackProgress; + p.totalProgress = totalProgress; + p.bufferFillRate = bufferFillRate; + p.writerFillRate = writeFill; + + if (write(fd, REMOTE_MSG_SYNC_, sizeof(REMOTE_MSG_SYNC_)) != sizeof(REMOTE_MSG_SYNC_) || + write(fd, (const char*)&p, sizeof(p)) != sizeof(p)) { + log_message(-1, "Failed to send write CD remote progress message."); + return 1; + } + } + + return 0; +} + +// Sends a blank cd progress message without blocking the actual process. +int CdrDriver::sendBlankCdProgressMsg(int totalProgress) +{ + if (remote_) { + int fd = remoteFd_; + ProgressMsg p; + + p.status = PGSMSG_BLK; + p.totalTracks = 0; + p.track = 0; + p.trackProgress = 0; + p.totalProgress = totalProgress; + p.bufferFillRate = 0; + p.writerFillRate = 0; + + if (write(fd, REMOTE_MSG_SYNC_, sizeof(REMOTE_MSG_SYNC_)) != sizeof(REMOTE_MSG_SYNC_) || + write(fd, (const char*)&p, sizeof(p)) != sizeof(p)) { + log_message(-1, "Failed to send write CD remote progress message."); + return 1; + } + } + + return 0; +} + +long CdrDriver::audioRead(TrackData::SubChannelMode sm, int byteOrder, + Sample *buffer, long startLba, long len) +{ + SubChannel **chans; + int i; + int swap; + long blockLen = AUDIO_BLOCK_LEN + TrackData::subChannelSize(sm); + + if (readSubChannels(sm, startLba, len, &chans, buffer) != 0) { + memset(buffer, 0, len * blockLen); + audioReadError_ = 1; + return len; + } + + swap = (audioDataByteOrder_ == byteOrder) ? 0 : 1; + + if (options_ & OPT_DRV_SWAP_READ_SAMPLES) + swap = !swap; + + if (swap) { + unsigned char *b = (unsigned char*)buffer; + + for (i = 0; i < len; i++) { + swapSamples((Sample *)b, SAMPLES_PER_BLOCK); + b += blockLen; + } + } + + + if (remote_ && startLba > audioReadLastLba_) { + long totalTrackLen = audioReadTrackInfo_[audioReadActTrack_ + 1].start - + audioReadTrackInfo_[audioReadActTrack_ ].start; + long progress = startLba - audioReadTrackInfo_[audioReadActTrack_ ].start; + long totalProgress; + + if (progress > 0) { + progress *= 1000; + progress /= totalTrackLen; + } + else { + progress = 0; + } + + totalProgress = startLba + len - audioReadInfo_->startLba; + + if (totalProgress > 0) { + totalProgress *= 1000; + totalProgress /= audioReadInfo_->endLba - audioReadInfo_->startLba; + } + else { + totalProgress = 0; + } + + sendReadCdProgressMsg(RCD_EXTRACTING, audioReadInfo_->tracks, + audioReadActTrack_ + 1, progress, totalProgress); + + audioReadLastLba_ = startLba; + } + + + if (chans == NULL) { + // drive does not provide sub channel data so that's all we could do here: + + if (startLba > audioReadTrackInfo_[audioReadActTrack_ + 1].start) { + audioReadActTrack_++; + log_message(1, "Track %d...", audioReadActTrack_ + 1); + } + + if (startLba - audioReadProgress_ > 75) { + audioReadProgress_ = startLba; + Msf m(audioReadProgress_); + log_message(1, "%02d:%02d:00\r", m.min(), m.sec()); + } + + return len; + } + + // analyze sub-channels to find pre-gaps, index marks and ISRC codes + for (i = 0; i < len; i++) { + SubChannel *chan = chans[i]; + //chan->print(); + + if (chan->checkCrc() && chan->checkConsistency()) { + if (chan->type() == SubChannel::QMODE1DATA) { + int t = chan->trackNr() - 1; + Msf atime = Msf(chan->amin(), chan->asec(), chan->aframe()); + + //log_message(0, "LastLba: %ld, ActLba: %ld", audioReadActLba_, atime.lba()); + + if (t >= audioReadStartTrack_ && t <= audioReadEndTrack_ && + atime.lba() > audioReadActLba_ && + atime.lba() - 150 < audioReadTrackInfo_[t + 1].start) { + Msf time(chan->min(), chan->sec(), chan->frame()); // track rel time + + audioReadActLba_ = atime.lba(); + + if (audioReadActLba_ - audioReadProgress_ > 75) { + audioReadProgress_ = audioReadActLba_; + Msf m(audioReadProgress_ - 150); + log_message(1, "%02d:%02d:00\r", m.min(), m.sec()); + } + + if (t == audioReadActTrack_ && + chan->indexNr() == audioReadActIndex_ + 1) { + + if (chan->indexNr() > 1) { + log_message(2, "Found index %d at: %s", chan->indexNr(), + time.str()); + + if (audioReadTrackInfo_[t].indexCnt < 98) { + audioReadTrackInfo_[t].index[audioReadTrackInfo_[t].indexCnt] = time.lba(); + audioReadTrackInfo_[t].indexCnt += 1; + } + } + } + else if (t == audioReadActTrack_ + 1) { + log_message(1, "Track %d...", t + 1); + //chan->print(); + if (chan->indexNr() == 0) { + // don't use time.lba() to calculate pre-gap length; it would + // count one frame too many if the CD counts the pre-gap down + // to 00:00:00 instead of 00:00:01 + // Instead, count number of frames until start of Index 01 + // See http://sourceforge.net/tracker/?func=detail&aid=604751&group_id=2171&atid=102171 + // atime starts at 02:00, so subtract it + audioReadTrackInfo_[t].pregap = (startLba + len + 1) - \ + (atime.lba() - 150); + log_message(2, "Found pre-gap: %s", + Msf(audioReadTrackInfo_[t].pregap).str()); + } + } + + audioReadActIndex_ = chan->indexNr(); + audioReadActTrack_ = t; + } + } + else if (chan->type() == SubChannel::QMODE3) { + if (audioReadTrackInfo_[audioReadActTrack_].isrcCode[0] == 0) { + log_message(2, "Found ISRC code."); + strcpy(audioReadTrackInfo_[audioReadActTrack_].isrcCode, + chan->isrc()); + } + } + } + else { + audioReadCrcCount_++; + } + } + + return len; +} + +int CdrDriver::readAudioRangeStream(ReadDiskInfo *info, int fd, long start, + long end, int startTrack, int endTrack, + TrackInfo *trackInfo) +{ + long startLba = start; + long endLba = end - 1; + long len, ret; + long blocking, blockLen; + long lba = startLba; + unsigned char *buf; + + blockLen = AUDIO_BLOCK_LEN + TrackData::subChannelSize(subChanReadMode_); + blocking = scsiMaxDataLen_ / blockLen; + assert(blocking > 0); + + buf = new unsigned char[blocking * blockLen]; + + audioReadInfo_ = info; + audioReadTrackInfo_ = trackInfo; + audioReadStartTrack_ = startTrack; + audioReadEndTrack_ = endTrack; + audioReadLastLba_ = audioReadActLba_ = startLba + 149; + audioReadActTrack_ = startTrack; + audioReadActIndex_ = 1; + audioReadCrcCount_ = 0; + audioReadError_ = 0; + audioReadProgress_ = 0; + + len = endLba - startLba + 1; + + log_message(1, "Track %d...", startTrack + 1); + + trackInfo[endTrack].bytesWritten = 0; + + while (len > 0) { + long n = len > blocking ? blocking : len; + long bytesToWrite = n * blockLen; + + CdrDriver::audioRead(subChanReadMode_, 1/*big endian byte order*/, + (Sample *)buf, lba, n); + + lba += n; + + if ((ret = fullWrite(fd, buf, bytesToWrite)) != bytesToWrite) { + if (ret < 0) + log_message(-2, "Writing of data failed: %s", strerror(errno)); + else + log_message(-2, "Writing of data failed: Disk full"); + + delete[] buf; + return 1; + } + + trackInfo[endTrack].bytesWritten += bytesToWrite; + + len -= n; + } + + + if (audioReadCrcCount_ != 0) + log_message(2, "Found %ld Q sub-channels with CRC errors.", audioReadCrcCount_); + + delete[] buf; + return 0; +} + + +// read cdda paranoia related: + +void CdrDriver::paranoiaMode(int mode) +{ + paranoiaMode_ = PARANOIA_MODE_FULL^PARANOIA_MODE_NEVERSKIP; + + switch (mode) { + case 0: + paranoiaMode_ = PARANOIA_MODE_DISABLE; + break; + + case 1: + paranoiaMode_ |= PARANOIA_MODE_OVERLAP; + paranoiaMode_ &= ~PARANOIA_MODE_VERIFY; + break; + + case 2: + paranoiaMode_ &= ~(PARANOIA_MODE_SCRATCH|PARANOIA_MODE_REPAIR); + break; + } +} + + +int CdrDriver::readAudioRangeParanoia(ReadDiskInfo *info, int fd, long start, + long end, int startTrack, int endTrack, + TrackInfo *trackInfo) +{ + long startLba = start; + long endLba = end - 1; + long len, ret; + size16 *buf; + + if (paranoia_ == NULL) { + // first time -> allocate paranoia structure + paranoiaDrive_ = new cdrom_drive; + paranoiaDrive_->cdr = this; + paranoiaDrive_->nsectors = maxScannedSubChannels_; + paranoia_ = paranoia_init(paranoiaDrive_); + } + + paranoia_set_range(paranoia_, startLba, endLba); + paranoia_modeset(paranoia_, paranoiaMode_); + + audioReadInfo_ = info; + audioReadTrackInfo_ = trackInfo; + audioReadStartTrack_ = startTrack; + audioReadEndTrack_ = endTrack; + audioReadLastLba_ = audioReadActLba_ = startLba + 149; + audioReadActTrack_ = startTrack; + audioReadActIndex_ = 1; + audioReadCrcCount_ = 0; + audioReadError_ = 0; + audioReadProgress_ = 0; + + len = endLba - startLba + 1; + + log_message(1, "Track %d...", startTrack + 1); + + trackInfo[endTrack].bytesWritten = 0; + + while (len > 0) { + buf = paranoia_read(paranoia_, &CdrDriver::paranoiaCallback); + + // The returned samples are always in host byte order. We want to + // output in big endian byte order so swap if we are a little + // endian host. + if (hostByteOrder_ == 0) + swapSamples((Sample*)buf, SAMPLES_PER_BLOCK); + + if ((ret = fullWrite(fd, buf, AUDIO_BLOCK_LEN)) != AUDIO_BLOCK_LEN) { + if (ret < 0) + log_message(-2, "Writing of data failed: %s", strerror(errno)); + else + log_message(-2, "Writing of data failed: Disk full"); + + return 1; + } + + trackInfo[endTrack].bytesWritten += AUDIO_BLOCK_LEN; + + len--; + } + + + if (audioReadCrcCount_ != 0) + log_message(2, "Found %ld Q sub-channels with CRC errors.", audioReadCrcCount_); + + return 0; +} + + +long cdda_read(cdrom_drive *d, void *buffer, long beginsector, long sectors) +{ + CdrDriver *cdr = (CdrDriver*)d->cdr; + + return cdr->audioRead(TrackData::SUBCHAN_NONE, cdr->hostByteOrder(), + (Sample*)buffer, beginsector, sectors); +} + +void CdrDriver::paranoiaCallback(long, int) +{ +} diff --git a/dao/CdrDriver.h b/dao/CdrDriver.h new file mode 100644 index 0000000..3d904ca --- /dev/null +++ b/dao/CdrDriver.h @@ -0,0 +1,675 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __CDRDRIVER_H__ +#define __CDRDRIVER_H__ + +#include "ScsiIf.h" +#include "Msf.h" +#include "TrackData.h" +#include "SubChannel.h" +#include "remote.h" + +class Toc; +class Track; + +#define OPT_DRV_GET_TOC_GENERIC 0x00010000 +#define OPT_DRV_SWAP_READ_SAMPLES 0x00020000 +#define OPT_DRV_NO_PREGAP_READ 0x00040000 +#define OPT_DRV_RAW_TOC_BCD 0x00080000 +#define OPT_DRV_RAW_TOC_HEX 0x00100000 +#define OPT_DRV_NO_CDTEXT_READ 0x00200000 + + +// reading capabilities +#define CDR_READ_CAP_AUDIO_PW_RAW 0x001 +#define CDR_READ_CAP_AUDIO_RW_COOKED 0x002 +#define CDR_READ_CAP_AUDIO_RW_RAW 0x004 +#define CDR_READ_CAP_AUDIO_PQ_BCD 0x008 +#define CDR_READ_CAP_AUDIO_PQ_HEX 0x010 +#define CDR_READ_CAP_DATA_PW_RAW 0x020 +#define CDR_READ_CAP_DATA_RW_COOKED 0x040 +#define CDR_READ_CAP_DATA_RW_RAW 0x080 +#define CDR_READ_CAP_DATA_PQ_BCD 0x100 +#define CDR_READ_CAP_DATA_PQ_HEX 0x200 + +#define CDR_AUDIO_SCAN_CAP (CDR_READ_CAP_AUDIO_PW_RAW|CDR_READ_CAP_AUDIO_PQ_BCD|CDR_READ_CAP_AUDIO_PQ_HEX) + +struct DiskInfo { + long capacity; // recordable capacity of medium + Msf manufacturerId; // disk identification + int recSpeedLow; // lowest recording speed + int recSpeedHigh; // highest recording speed + + int sessionCnt; // number of closed sessions + int lastTrackNr; // number of last track on disk + + long lastSessionLba; // start lba of first track of last closed session + long thisSessionLba; // start lba of this session + + int diskTocType; // type of CD TOC, only valid if CD-R is not empty + + unsigned int empty : 1; // 1 for empty disk, else 0 + unsigned int append : 1; // 1 if CD-R is appendable, else 0 + unsigned int cdrw : 1; // 1 if disk is a CD-RW + + struct { + unsigned int empty : 1; + unsigned int append : 1; + unsigned int cdrw : 1; + unsigned int capacity : 1; + unsigned int manufacturerId : 1; + unsigned int recSpeed : 1; + } valid; +}; + +struct DriveInfo { + int maxReadSpeed; + int currentReadSpeed; + int maxWriteSpeed; + int currentWriteSpeed; + + unsigned int accurateAudioStream : 1; + unsigned int burnProof : 1; + unsigned int ricohJustLink : 1; + unsigned int ricohJustSpeed : 1; +}; + +struct CdTextPack { + unsigned char packType; + unsigned char trackNumber; + unsigned char sequenceNumber; + unsigned char blockCharacter; + unsigned char data[12]; + unsigned char crc0; + unsigned char crc1; +}; + +struct CdToc { + int track; // number + long start; // LBA of track start + unsigned char adrCtl; // ADR/CTL field +}; + +struct CdRawToc { + int sessionNr; + int point; + int min; + int sec; + int frame; + int pmin; + int psec; + int pframe; + unsigned char adrCtl; +}; + +struct TrackInfo { + int trackNr; // track number + unsigned char ctl; // flags + TrackData::Mode mode; // track data mode + long start; // absolute start position from CD TOC + long pregap; // pre-gap length of track in blocks + long fill; // number of blocks to fill with zero data at end + int indexCnt; // number of index increments + long index[98]; // index marks + char isrcCode[13]; // ISRC code, valid if 'isrcCode[0] != 0' + char *filename; // data file name + long bytesWritten; // number of bytes written to file +}; + + +class CdrDriver { +public: + CdrDriver(ScsiIf *scsiIf, unsigned long options); + virtual ~CdrDriver(); + + // returns stored SCSI interface object + virtual ScsiIf *scsiIf() const { return scsiIf_; } + + // sets SCSI interface object + void scsiIf(ScsiIf *i) { scsiIf_ = i; } + + // returns name of driver + virtual const char *driverName() const { return driverName_; } + + // returns options flags + virtual unsigned long options() const { return options_; } + + // returns 1 if drive takes audio samples in big endian byte order or + // 0 for little endian byte order + virtual int bigEndianSamples() const = 0; + + // return information about drive + virtual const DriveInfo *driveInfo(bool showErrorMsg) { return NULL; } + + // returns current writing speed + virtual int speed() { return speed_; } + + // returns current reading speed + virtual int rspeed() { return rspeed_; } + + // sets writing speed, returns 0 for OK or 1 for illegal speed, + // this function may send SCSI commands to the drive + virtual int speed(int) = 0; + + // sets reading speed, returns 0 for OK or 1 for illegal speed, + // this function may send SCSI commands to the drive + virtual bool rspeed(int); + + // sets/return buffer under run protection setting (if supported by + // the drive: 1 = enabled, 0 = disbaled + virtual int bufferUnderRunProtection() const { + return enableBufferUnderRunProtection_; + } + + virtual void bufferUnderRunProtection(int s) { + enableBufferUnderRunProtection_ = s != 0 ? 1 : 0; + } + + // sets/return writing speed control setting (if supported by + // the drive: 1 = enabled, 0 = disbaled + virtual int writeSpeedControl() const { return enableWriteSpeedControl_; } + + virtual void writeSpeedControl(int s) { + enableWriteSpeedControl_ = s != 0 ? 1 : 0; } + + // returns 1 if simulation mode, 0 for real writing + virtual bool simulate() const { return simulate_; } + + // sets simulation mode, returns 0 for OK, 1 if given mode is not supported + virtual void simulate(bool s) { simulate_ = s; } + + // Sets multi session mode (0: close session, 1: open next session). + // Returns 1 if multi session is not supported by driver, else 0 + virtual int multiSession(bool); + + // Returns mutli session mode. + virtual bool multiSession() const { return multiSession_; } + + // Returns/sets fast toc reading flag (no sub-channel analysis) + virtual bool fastTocReading() const { return fastTocReading_; } + virtual void fastTocReading(bool f) { fastTocReading_ = f; } + + // Returns/sets raw data track reading flag + virtual bool rawDataReading() const { return rawDataReading_; } + virtual void rawDataReading(bool f) { rawDataReading_ = f; } + + // Returns/sets mode2 mixed track reading flag + virtual bool mode2Mixed() const { return mode2Mixed_; } + virtual void mode2Mixed(bool f) { mode2Mixed_ = f; } + + virtual TrackData::SubChannelMode subChanReadMode() const { return subChanReadMode_; } + virtual void subChanReadMode(TrackData::SubChannelMode m) { subChanReadMode_ = m; } + + // Sets/returns the pad first pre-gap flag + virtual int padFirstPregap() const { return padFirstPregap_; } + virtual void padFirstPregap(int f) { padFirstPregap_ = f != 0 ? 1 : 0; } + + // Returns the on-thy-fly flag. + virtual int onTheFly() const { return onTheFly_; } + + // Sets file descriptor for on the fly data and sets the on-the-fly flag + // if 'fd' is >= 0 and clears it otherwise + virtual void onTheFly(int fd); + + // Returns force flag + virtual bool force() const { return force_; } + + // Sets force flag + virtual void force(bool f) { force_ = f; } + + // Returns TAO source flag + virtual bool taoSource() const { return taoSource_; } + + // Sets TAO source flag + virtual void taoSource(bool f) { taoSource_ = f; } + + // Return number of adjust sectors for reading TAO source disks + virtual int taoSourceAdjust() const { return taoSourceAdjust_; } + + // Sets number of adjust sectors for reading TAO source disks + virtual void taoSourceAdjust(int val); + + // Sets remote mode + virtual void remote(int flag, int fd); + + // Return remote mode flag + virtual int remote() { return remote_; } + + // Sets cdda paranoia mode + void paranoiaMode(int); + + // Sets user defined capacity + virtual void userCapacity(int c) { userCapacity_ = c; } + + // Sets burning to the outer edge mode + virtual void fullBurn(bool f) { fullBurn_ = f; } + + // Return byte order of host (0: little endian, 1: big endian) + int hostByteOrder() const { return hostByteOrder_; } + + // general commands + virtual int testUnitReady(int) const; + + virtual int startStopUnit(int) const; + + virtual int preventMediumRemoval(int) const; + + virtual int rezeroUnit(int showMessage = 1) const; + + virtual int loadUnload(int) const = 0; + + virtual int flushCache() const; + + virtual int readCapacity(long *length, int showMessage = 1); + + virtual bool readBufferCapacity(long* total, long* available) { + return false; + } + + // CD-RW specific commands + + enum BlankingMode { BLANK_FULL, BLANK_MINIMAL }; + virtual int blankDisk(BlankingMode); + + // disk at once recording related commands + + // Returns acceptable sub-channel encoding mode for given sub-channel type: + // -1: writing of sub-channel type not supported at all + // 0: accepts plain data without encoding + // 1: accepts only completely encoded data + virtual int subChannelEncodingMode(TrackData::SubChannelMode) const; + + // Should check if toc is suitable for DAO writing with the actual driver. + // Returns 0 if toc is OK, else 1. + // Usually all tocs are suitable for writing so that the base class + // implementation simply returns 0. + virtual int checkToc(const Toc *); + + // Used to make necessary initializations but without touching the CD-R. + // It should be possible to abort the writing process after this function + // has been called without destroying the CD-R. + virtual int initDao(const Toc *) = 0; + + // Performs all steps that must be done before the first user data block + // is written, e.g. sending cue sheet, writing lead-in. + virtual int startDao() = 0; + + // Performs all steps for successfully finishing the writing process, + // e.g. writing lead-out, flushing the cache. + virtual int finishDao() = 0; + + // Aborts writing process. Called if an error occurs or the user aborts + // recording prematurely. + virtual void abortDao() = 0; + + // Sends given data to drive. 'lba' should be the current writing address + // and will be updated according to the written number of blocks. + virtual int writeData(TrackData::Mode, TrackData::SubChannelMode sm, + long &lba, const char *buf, long len); + + // returns mode for main channel data encoding, the value is used by + // Track::readData() + // 0: raw audio mode, all sectors must be encoded as audio sectors + // 1: no encoding for MODE1 and MODE2 sectors, MODE2_FORM1 and MODE2_FORM2 + // are extended by sub header and zero EDC/ECC data + int encodingMode() const { return encodingMode_; } + + // disk read commands + + // analyzes the CD structure (Q sub-channels) of the inserted CD + virtual Toc *readDiskToc(int session, const char *); + + // analyzes the CD structure and reads data + virtual Toc *readDisk(int session, const char *); + + // returns information about inserted medium + virtual DiskInfo *diskInfo() { return 0; } + + + + // Returns block size depending on given sector mode and 'encodingMode_' + // that must be used to send data to the recorder. + virtual long blockSize(TrackData::Mode, TrackData::SubChannelMode) const; + + // sends a status message to the driving application if in remote mode + enum WriteCdProgressType { WCD_LEADIN = PGSMSG_WCD_LEADIN, + WCD_DATA = PGSMSG_WCD_DATA, + WCD_LEADOUT = PGSMSG_WCD_LEADOUT }; + int sendWriteCdProgressMsg(WriteCdProgressType type, int totalTracks, + int track, int trackProgress, int totalProgress, + int bufferFillRate, int writeBufferFill = 0); + + int sendBlankCdProgressMsg(int totalProgress); + + + // static functions + + // Selects driver id for given vendor/model string. NULL is returned if + // no driver could be selected. + // readWrite: 0: select a driver for read operations + // 1: select a driver for write operations + // options: filled with option flags for vendor/model + static const char *selectDriver(int readWrite, const char *vendor, + const char *model, unsigned long *options); + + // Creates instance of driver with specified id. + static CdrDriver *createDriver(const char *driverId, unsigned long options, + ScsiIf *); + + // Try to autodetect a driver on given Scsi interface. + static const char *detectDriver(ScsiIf *, unsigned long *options); + + // Prints list of all available driver ids. + static void printDriverIds(); + + // returns vendor/type of CD-R medium + static int cdrVendor(Msf &, const char **vendor, const char** mediumType); + +protected: + struct ReadDiskInfo { + int tracks; // total number of tracks + long startLba; // LBA where extraction starts + long endLba; // LBA where extraction ends + }; + + unsigned long options_; // driver option flags + ScsiIf *scsiIf_; + int scsiMaxDataLen_; + const char *driverName_; + + int hostByteOrder_; // 0: little endian, 1: big endian + + unsigned long readCapabilities_; + + int blockLength_; // length of data block for 'writeData' command + long blocksPerWrite_; // number of blocks that can be written with a + // single SCSI WRITE command + char *zeroBuffer_; // zeroed buffer for writing zeros + + int enableBufferUnderRunProtection_; + int enableWriteSpeedControl_; + int speed_; + int rspeed_; + bool simulate_; + bool multiSession_; + int encodingMode_; // mode for encoding data sectors + bool fastTocReading_; + bool rawDataReading_; + int mode2Mixed_; + TrackData::SubChannelMode subChanReadMode_; + int padFirstPregap_; // used by 'read-toc': defines if the first audio + // track's pre-gap is padded with zeros in the toc-file + // or if it is taken from the data file + int onTheFly_; // 1 if operating in on-the-fly mode + int onTheFlyFd_; // file descriptor for on the fly data + bool force_; // force flag to allow certain operations + int remote_; // 1 for remote mode, else 0 + int remoteFd_; // file descriptor for remote messages + bool taoSource_; // 1 to indicate a TAO writting source CD for read-cd/read-toc + int taoSourceAdjust_; // number of unreadable sectors between two tracks + // written in TAO mode + const Toc *toc_; + + SubChannel **scannedSubChannels_; + long maxScannedSubChannels_; + + unsigned char *transferBuffer_; + + // Byte order of audio samples read from the drive, e.g. with + // 'readSubChannels()'. 0: little endian, 1: big endian + int audioDataByteOrder_; + + int userCapacity_; + bool fullBurn_; + + static unsigned char syncPattern[12]; + static char REMOTE_MSG_SYNC_[4]; + + static int speed2Mult(int); + static int mult2Speed(int); + + virtual int sendCmd(const unsigned char *cmd, int cmdLen, + const unsigned char *dataOut, int dataOutLen, + unsigned char *dataIn, int dataInLen, + int showErrorMsg = 1) const; + + virtual int getModePage(int pageCode, unsigned char *buf, long bufLen, + unsigned char *modePageHeader, + unsigned char *blockDesc, int showErrorMsg); + virtual int setModePage(const unsigned char *buf, + const unsigned char *modePageHeader, + const unsigned char *blockDesc, int showErrorMsg); + + // some drives (e.g. Yamaha CDR100) don't implement mode sense/select(10) + virtual int getModePage6(int pageCode, unsigned char *buf, long bufLen, + unsigned char *modePageHeader, + unsigned char *blockDesc, int showErrorMsg); + virtual int setModePage6(const unsigned char *buf, + const unsigned char *modePageHeader, + const unsigned char *blockDesc, int showErrorMsg); + + virtual int writeZeros(TrackData::Mode, TrackData::SubChannelMode, + long &lba, long encLba, long count); + + + // Returns track control flags for given track, bits 0-3 are always zero + virtual unsigned char trackCtl(const Track *track); + + // Returns session format code for point A0 TOC entry, generated from + // stored 'toc_' object. + virtual unsigned char sessionFormat(); + + // readToc related functions: + + // returns TOC data of specified session of inserted CD, + // a generic function is implemented in 'CdrDriver.cc', it will return + // the tracks of all session or of the first session depending on the + // drive + virtual CdToc *getToc(int sessionNr, int *nofTracks); + + // Generic function to retrieve basic TOC data. Cannot distinguish + // between different sessions. + CdToc *getTocGeneric(int *nofTracks); + + // Reads raw toc data of inserted CD. Used by base implementation of + // 'getToc()' and must be implemented by the actual driver. + virtual CdRawToc *getRawToc(int sessionNr, int *len) = 0; + + // Reads CD-TEXT packs from the lead-in of a CD. The base implementation + // uses the SCSI-3/mmc commands. + virtual CdTextPack *readCdTextPacks(long *); + + // reads CD-TEXT data and adds it to given 'Toc' object + int readCdTextData(Toc *); + + // Tries to determine the data mode of specified track. + virtual TrackData::Mode getTrackMode(int trackNr, long trackStartLba); + + // Determines mode of given sector, 'buf' should contain the sector header + // at the first 4 bytes followed by the sub-header for XA tracks. + // If an illegal mode is found in the sector header 'MODE0' will be + // returned. + TrackData::Mode determineSectorMode(unsigned char *buf); + + // analyzes given 8 byte sub header and returns wether the sector is + // a MODE2, MODE2_FORM1 or MODE2_FORM2 sector + TrackData::Mode analyzeSubHeader(unsigned char *); + + virtual unsigned long getReadCapabilities(const CdToc *, int) const = 0; + + // Called by 'readDiskToc()' to retrieve following information about + // the track 'trackNr' with given start/end lba addresses: + // - all index increments, filled into 'index'/'indexCnt' + // - ISRC Code, filled into provided buffer 'isrcCode' (13 bytes) + // - length of pre-gap of next track, filled into 'pregap' + // - control nibbles read from track, filled into bits 0-3 of 'ctrl', + // bit 7 must be set to indicate valid data + // This function must be overloaded by an actual driver. + // return: 0: OK, 1: error occured + virtual int analyzeTrack(TrackData::Mode, int trackNr, long startLba, + long endLba, Msf *index, + int *indexCnt, long *pregap, char *isrcCode, + unsigned char *ctl) = 0; + + // Track analysis algorithm using the binary search method. The base + // class implements the basic algorithm. It uses 'findIndex()' which + // can be implemented by an actual driver to get the track and index + // number at a specific block address. This base class contains an + // implementation of 'findIndex()', too, that can be usually used. + // It'll be always better to use the linear scan algorithm (see below) + // if possible. + int analyzeTrackSearch(TrackData::Mode, int trackNr, long startLba, + long endLba, Msf *index, + int *indexCnt, long *pregap, char *isrcCode, + unsigned char *ctl); + + // finds position (lba) where index for given track number switches to + // 'index' (binary search, base algorithm is implemented in 'CdrDriver'). + // It uses the method 'getTrackIndex()' which must be overloaded by + // the actual driver. + virtual long findIndex(int track, int index, long trackStart, long trackEnd); + + // Retrieves track, index and control nibbles at given lba address. Must + // be implemented by the driver if the binary search method + // ('analyzeTrackSearch()') should be used. + virtual int getTrackIndex(long lba, int *trackNr, int *indexNr, + unsigned char *ctl); + + // Basic track analyzis using the linear scan algorithm. The base class + // implements the basic algorithm which calls 'readSubChannels()' to + // read the sub-channel data. Actual drivers should overload the + // 'readSubChannels()' function. + int analyzeTrackScan(TrackData::Mode, int trackNr, long startLba, + long endLba, Msf *index, int *indexCnt, long *pregap, + char *isrcCode, unsigned char *ctl); + + // Reads 'len' sub-channels from sectors starting at 'lba'. + // The returned vector contains 'len' pointers to 'SubChannel' objects. + // Audio data that is usually retrieved with the sub-channels is placed + // in 'buf' if it is not NULL. + // Used by 'analyzeTrackScan()' and 'readAudioRangeParanoia()'. + virtual int readSubChannels(TrackData::SubChannelMode, long lba, long len, + SubChannel ***, Sample *buf) = 0; + + // Determines the readable length of a data track and the pre-gap length + // of the following track. The implementation in the base class should + // be suitable for all drivers. + virtual int analyzeDataTrack(TrackData::Mode mode, int trackNr, + long startLba, long endLba, long *pregap); + + // Reads 'len' data sectors starting at 'lba' and returns the number of + // successfully read sectors. If the end of the current track is encountered + // the returned value will be smaller than 'len' down to 0. If a read + // error occus -1 is returned. If a L-EC error occures -2 is returned. + // This method is used by 'readDataTrack'/'analyzeDataTrack' and must be + // overloaded by the driver. + virtual long readTrackData(TrackData::Mode, TrackData::SubChannelMode, + long lba, long len, unsigned char *buf) = 0; + + // Reads a complete data track and saves data to a file. + virtual int readDataTrack(ReadDiskInfo *, int fp, long start, long end, + TrackInfo *trackInfo); + + // Reads the audio data of given audio track range 'startTrack', 'endTrack'. + // 'trackInfo' is am array of TrackInfo structures for all tracks. + // This function is called by 'readDisk()' and must be overloaded by the + // actual driver. + virtual int readAudioRange(ReadDiskInfo *, int fp, long start, long end, + int startTrack, int endTrack, + TrackInfo *) = 0; + + virtual int readAudioRangeStream(ReadDiskInfo *, int fd, long start, + long end, int startTrack, int endTrack, + TrackInfo *); + + // Reads catalog number by scanning the sub-channels. + // Uses 'readSubChannels()' to read the the sub-channels. + int readCatalogScan(char *mcnCode, long startLba, long endLba); + + // Reads catalog number and stores it in given 'Toc' object. Must be + // implemented by the actual driver. 'startLba' and 'endLba' specify + // the allowed range for sub-channel scanning. + virtual int readCatalog(Toc *toc, long startLba, long endLba) = 0; + + // Reads ISRC code and writes into provided 13 bytes buffer. Must be + // implemented by the actual driver. + virtual int readIsrc(int trackNr, char *) = 0; + + // Build Toc object from gathered TrackInfo data + Toc *buildToc(TrackInfo *trackInfos, long nofTrackInfos, int padFirstPregap); + + // sets block size for read/write operations + virtual int setBlockSize(long blocksize, unsigned char density = 0); + + // checks if drive capabilities support requested sub-channel reading mode + int checkSubChanReadCaps(TrackData::Mode, unsigned long caps); + + void printCdToc(CdToc *toc, int tocLen); + + enum ReadCdProgressType { RCD_ANALYZING = PGSMSG_RCD_ANALYZING, + RCD_EXTRACTING = PGSMSG_RCD_EXTRACTING }; + void sendReadCdProgressMsg(ReadCdProgressType, int totalTracks, int track, + int trackProgress, int totalProgress); + + +public: + // function to read audio data and also the sub-channel data from + // specified lba, + // this function is called from 'cdda_read()', so that it is currently + // public because I did not manage to define a friend function that has + // C linkage :) + long audioRead(TrackData::SubChannelMode, int byteOrder, + Sample *buffer, long startLba, long len); + + + // Interface for Monty's paranoia library: +protected: + // Extracts audio data for given track range with the help of + // Monty's paranoia library. + int readAudioRangeParanoia(ReadDiskInfo *, int fp, long start, long end, + int startTrack, int endTrack, + TrackInfo *trackInfo); + +private: + // dynamic data + void *paranoia_; // paranoia structure + struct cdrom_drive *paranoiaDrive_; // paranoia device + int paranoiaMode_; // paranoia mode + ReadDiskInfo *audioReadInfo_; + TrackInfo *audioReadTrackInfo_; + int audioReadStartTrack_; + int audioReadEndTrack_; + long audioReadLastLba_; + long audioReadActLba_; + int audioReadActTrack_; + int audioReadActIndex_; + long audioReadCrcCount_; + int audioReadError_; + long audioReadProgress_; + + // callback for the paranoia library, does nothing, currently + static void paranoiaCallback(long, int); + + + // friend classes: + friend class CDD2600Base; +}; + +#endif diff --git a/dao/GenericMMC.cc b/dao/GenericMMC.cc new file mode 100644 index 0000000..bf6a6a9 --- /dev/null +++ b/dao/GenericMMC.cc @@ -0,0 +1,2815 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <string.h> +#include <time.h> +#include <assert.h> + +#include "GenericMMC.h" + +#include "port.h" +#include "Toc.h" +#include "log.h" +#include "PQSubChannel16.h" +#include "PWSubChannel96.h" +#include "CdTextEncoder.h" + + + +// Variants for cue sheet generation + +// do not set ctl flags for ISRC cue sheet entries +#define CUE_VAR_ISRC_NO_CTL 0x1 + +// do not set start of lead-in time in lead-in cue sheet entry +#define CUE_VAR_CDTEXT_NO_TIME 0x2 + +#define CUE_VAR_MAX 0x3 + + +// Variants for write parameters mode page + +//do not set data block type to block size 2448 if a CD-TEXT lead-in is written +#define WMP_VAR_CDTEXT_NO_DATA_BLOCK_TYPE 0x1 + +#define WMP_VAR_MAX 0x1 + + +GenericMMC::GenericMMC(ScsiIf *scsiIf, unsigned long options) + : CdrDriver(scsiIf, options) +{ + int i; + driverName_ = "Generic SCSI-3/MMC - Version 2.0"; + + speed_ = 0; + rspeed_ = 0; + simulate_ = true; + encodingMode_ = 1; + + scsiTimeout_ = 0; + + cdTextEncoder_ = NULL; + + driveInfo_ = NULL; + + memset(&diskInfo_, 0, sizeof(DiskInfo)); + + for (i = 0; i < maxScannedSubChannels_; i++) { + if (options_ & OPT_MMC_USE_PQ) + scannedSubChannels_[i] = new PQSubChannel16; + else + scannedSubChannels_[i] = new PWSubChannel96; + } + + // MMC drives usually return little endian samples + audioDataByteOrder_ = 0; +} + +GenericMMC::~GenericMMC() +{ + int i; + + for (i = 0; i < maxScannedSubChannels_; i++) { + delete scannedSubChannels_[i]; + scannedSubChannels_[i] = NULL; + } + + delete cdTextEncoder_; + cdTextEncoder_ = NULL; + + delete driveInfo_; + driveInfo_ = NULL; +} + +// static constructor +CdrDriver *GenericMMC::instance(ScsiIf *scsiIf, unsigned long options) +{ + return new GenericMMC(scsiIf, options); +} + + +int GenericMMC::checkToc(const Toc *toc) +{ + int err = CdrDriver::checkToc(toc); + int e; + + if (options_ & OPT_MMC_CD_TEXT) { + if ((e = toc->checkCdTextData()) > err) + err = e; + } + + return err; +} + +int GenericMMC::subChannelEncodingMode(TrackData::SubChannelMode sm) const +{ + int ret = 0; + + switch (sm) { + case TrackData::SUBCHAN_NONE: + ret = 0; + break; + + case TrackData::SUBCHAN_RW: +#if 0 + if (options_ & OPT_MMC_NO_RW_PACKED) + ret = 1; // have to encode the R-W sub-channel data + else + ret = 0; +#endif + ret = 0; + break; + + case TrackData::SUBCHAN_RW_RAW: + // raw R-W sub-channel writing is assumed to be always supported + ret = 1; + break; + } + + return ret; +} + +// sets speed +// return: 0: OK +// 1: illegal speed +int GenericMMC::speed(int s) +{ + speed_ = s; + + if (selectSpeed() != 0) + return 1; + + return 0; +} + +int GenericMMC::speed() +{ + const DriveInfo *di; + + delete driveInfo_; + driveInfo_ = NULL; + + if ((di = driveInfo(true)) == NULL) { + return 0; + } + + return speed2Mult(di->currentWriteSpeed); + +} + +// sets fspeed +// return: true: OK +// false: illegal speed +bool GenericMMC::rspeed(int s) +{ + rspeed_ = s; + + if (selectSpeed() != 0) + return false; + + return true; +} + +int GenericMMC::rspeed() +{ + const DriveInfo *di; + + delete driveInfo_; + driveInfo_ = NULL; + + if ((di = driveInfo(true)) == NULL) { + return 0; + } + + return speed2Mult(di->currentReadSpeed); +} + + +// loads ('unload' == 0) or ejects ('unload' == 1) tray +// return: 0: OK +// 1: scsi command failed +int GenericMMC::loadUnload(int unload) const +{ + unsigned char cmd[6]; + + memset(cmd, 0, 6); + + cmd[0] = 0x1b; // START/STOP UNIT + if (unload) { + cmd[4] = 0x02; // LoUnlo=1, Start=0 + } + else { + cmd[4] = 0x03; // LoUnlo=1, Start=1 + } + + if (sendCmd(cmd, 6, NULL, 0, NULL, 0) != 0) { + log_message(-2, "Cannot load/unload medium."); + return 1; + } + + return 0; +} + +// Checks for ready status of the drive after a write operation +// Return: 0: drive ready +// 1: error occured +// 2: drive not ready + +int GenericMMC::checkDriveReady() const +{ + unsigned char cmd[10]; + unsigned char data[4]; + int ret; + + ret = testUnitReady(0); + + if (ret == 0) { + // testUnitReady reports ready status but this might actually not + // be the truth -> additionally check the READ DISK INFO command + + memset(cmd, 0, 10); + + cmd[0] = 0x51; // READ DISK INFORMATION + cmd[8] = 4; + + ret = sendCmd(cmd, 10, NULL, 0, data, 4, 0); + + if (ret == 2) { + const unsigned char *sense; + int senseLen; + + ret = 0; // indicates ready status + + sense = scsiIf_->getSense(senseLen); + + if (senseLen >= 14 && (sense[2] & 0x0f) == 0x2 && sense[7] >= 6 && + sense[12] == 0x4 && + (sense[13] == 0x8 || sense[13] == 0x7)) { + // Not Ready, long write in progress + ret = 2; // indicates not ready status + } + } + } + + return ret; +} + +// Performs complete blanking of a CD-RW. +// return: 0: OK +// 1: scsi command failed +int GenericMMC::blankDisk(BlankingMode mode) +{ + unsigned char cmd[12]; + int ret, progress; + time_t startTime, endTime; + + setSimulationMode(0); + + + memset(cmd, 0, 12); + + cmd[0] = 0xa1; // BLANK + + switch (mode) { + case BLANK_FULL: + cmd[1] = 0x0; // erase complete disk + break; + case BLANK_MINIMAL: + cmd[1] = 0x1; // erase PMA, lead-in and 1st track's pre-gap + break; + } + + cmd[1] |= 1 << 4; // immediate return + + sendBlankCdProgressMsg(0); + + if (sendCmd(cmd, 12, NULL, 0, NULL, 0, 1) != 0) { + log_message(-2, "Cannot erase CD-RW."); + return 1; + } + + time(&startTime); + progress = 0; + + do { + mSleep(2000); + + ret = checkDriveReady(); + + if (ret == 1) { + log_message(-2, "Test Unit Ready command failed."); + } + + progress += 10; + sendBlankCdProgressMsg(progress); + + if (progress >= 1000) + progress = 0; + + } while (ret == 2); + + if (ret == 0) + sendBlankCdProgressMsg(1000); + + time(&endTime); + + log_message(2, "Blanking time: %ld seconds", endTime - startTime); + + return ret; +} + +// sets read/write speed and simulation mode +// return: 0: OK +// 1: scsi command failed +int GenericMMC::selectSpeed() +{ + unsigned char cmd[12]; + int spd; + + memset(cmd, 0, 12); + + cmd[0] = 0xbb; // SET CD SPEED + + // select maximum read speed + if (rspeed_ == 0) { + cmd[2] = 0xff; + cmd[3] = 0xff; + } + else { + spd = mult2Speed(rspeed_); + cmd[2] = spd >> 8; + cmd[3] = spd; + } + + // select maximum write speed + if (speed_ == 0) { + cmd[4] = 0xff; + cmd[5] = 0xff; + } + else { + spd = mult2Speed(speed_); + cmd[4] = spd >> 8; + cmd[5] = spd; + } + + if ((options_ & OPT_MMC_YAMAHA_FORCE_SPEED) != 0 && + writeSpeedControl()) + cmd[11] = 0x80; // enable Yamaha's force speed + + if (sendCmd(cmd, 12, NULL, 0, NULL, 0) != 0) { + log_message(-2, "Cannot set cd speed."); + return 1; + } + + return 0; +} + +// Determins start and length of lead-in and length of lead-out. +// return: 0: OK +// 1: SCSI command failed +int GenericMMC::getSessionInfo() +{ + unsigned char cmd[10]; + unsigned long dataLen = 34; + unsigned char data[34]; + + memset(cmd, 0, 10); + memset(data, 0, dataLen); + + cmd[0] = 0x51; // READ DISK INFORMATION + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen) != 0) { + log_message(-2, "Cannot retrieve disk information."); + return 1; + } + + leadInStart_ = Msf(data[17], data[18], data[19]); + + if (leadInStart_.lba() >= Msf(80, 0, 0).lba()) { + leadInLen_ = 450000 - leadInStart_.lba(); + + if (fullBurn_) { + leadOutLen_ = (userCapacity_ ? Msf(userCapacity_, 0, 0).lba() : diskInfo_.capacity) + Msf(1, 30, 0).lba() - toc_->length().lba() - diskInfo_.thisSessionLba - 150; // Fill all rest space <vladux> + if (leadOutLen_ < Msf(1, 30, 0).lba()) { + leadOutLen_ = Msf(1, 30, 0).lba(); // 90 seconds lead-out + } + } else { + leadOutLen_ = Msf(1, 30, 0).lba(); // 90 seconds lead-out + } + } + else { + leadInLen_ = Msf(1, 0, 0).lba(); + leadOutLen_ = Msf(0, 30, 0).lba(); + } + + + log_message(4, "Lead-in start: %s length: %ld", leadInStart_.str(), + leadInLen_); + log_message(4, "Lead-out length: %ld", leadOutLen_); + + return 0; +} + +bool GenericMMC::readBufferCapacity(long *capacity, long *available) +{ + unsigned char cmd[10]; + unsigned char data[12]; + long bufsize; + + memset(cmd, 0, 10); + memset(data, 0, 12); + + cmd[0] = 0x5c; // READ BUFFER CAPACITY + cmd[8] = 12; + + if (sendCmd(cmd, 10, NULL, 0, data, 12) != 0) { + log_message(-2, "Read buffer capacity failed."); + return false; + } + + *capacity = (data[4] << 24) | (data[5] << 16) | (data[6] << 8) | data[7]; + *available = (data[8] << 24) | (data[9] << 16) | (data[10] << 8) | data[11]; + + return true; +} + +int GenericMMC::performPowerCalibration() +{ + unsigned char cmd[10]; + int ret; + long old_timeout; + + memset(cmd, 0, 10); + + cmd[0] = 0x54; // SEND OPC INFORMATION + cmd[1] = 1; + + log_message(2, "Executing power calibration..."); + + old_timeout = scsiIf_->timeout(30); + ret = sendCmd(cmd, 10, NULL, 0, NULL, 0); + (void)scsiIf_->timeout(old_timeout); + + if (ret == 0) { + log_message(2, "Power calibration successful."); + return 0; + } + if (ret == 2) { + const unsigned char *sense; + int senseLen; + + sense = scsiIf_->getSense(senseLen); + + if (senseLen >= 14 && (sense[2] & 0x0f) == 0x5 && sense[7] >= 6 && + sense[12] == 0x20 && sense[13] == 0x0) { + log_message(2, "Power calibration not supported."); + return 0; + } /* else fall trough */ + } + log_message(-2, "Power calibration failed."); + return 1; +} + +// Sets write parameters via mode page 0x05. +// return: 0: OK +// 1: scsi command failed +int GenericMMC::setWriteParameters(unsigned long variant) +{ + unsigned char mp[0x38]; + unsigned char mpHeader[8]; + unsigned char blockDesc[8]; + + if (getModePage(5/*write parameters mode page*/, mp, 0x38, + mpHeader, blockDesc, 1) != 0) { + log_message(-2, "Cannot retrieve write parameters mode page."); + return 1; + } + + mp[0] &= 0x7f; // clear PS flag + + mp[2] &= 0xe0; + mp[2] |= 0x02; // write type: Session-at-once + if (simulate_) { + mp[2] |= 1 << 4; // test write + } + + const DriveInfo *di; + if ((di = driveInfo(true)) != NULL) { + if (di->burnProof) { + // This drive has BURN-Proof function. + // Enable it unless explicitly disabled. + if (bufferUnderRunProtection()) { + log_message(2, "Turning BURN-Proof on"); + mp[2] |= 0x40; + } + else { + log_message(2, "Turning BURN-Proof off"); + mp[2] &= ~0x40; + } + } + + RicohSetWriteOptions(di); + } + + mp[3] &= 0x3f; // Multi-session: No B0 pointer, next session not allowed + + if (multiSession_) + mp[3] |= 0x03 << 6; // open next session + else if (!diskInfo_.empty) + mp[3] |= 0x01 << 6; // use B0=FF:FF:FF when closing last session of a + // multi session CD-R + + log_message(4, "Multi session mode: %d", mp[3] >> 6); + + mp[4] &= 0xf0; // Data Block Type: raw data, block size: 2352 (I think not + // used for session at once writing) + + if (cdTextEncoder_ != NULL) { + if ((variant & WMP_VAR_CDTEXT_NO_DATA_BLOCK_TYPE) == 0) + mp[4] |= 3; /* Data Block Type: raw data with raw P-W sub-channel data, + block size 2448, required for CD-TEXT lead-in writing + according to the SCSI/MMC-3 manual + */ + } + + log_message(4, "Data block type: %u", mp[4] & 0x0f); + + mp[8] = sessionFormat(); + + if (!diskInfo_.empty) { + // use the toc type of the already recorded sessions + switch (diskInfo_.diskTocType) { + case 0x00: + case 0x10: + case 0x20: + mp[8] = diskInfo_.diskTocType; + break; + } + } + + log_message(4, "Toc type: 0x%x", mp[8]); + + if (setModePage(mp, mpHeader, NULL, 0) != 0) { + log_message(-2, "Cannot set write parameters mode page."); + return 1; + } + + return 0; +} + +// Sets simulation mode via mode page 0x05. +// return: 0: OK +// 1: scsi command failed +int GenericMMC::setSimulationMode(int showMessage) +{ + unsigned char mp[0x38]; + unsigned char mpHeader[8]; + + if (getModePage(5/*write parameters mode page*/, mp, 0x38, + mpHeader, NULL, showMessage) != 0) { + if (showMessage) + log_message(-2, "Cannot retrieve write parameters mode page."); + return 1; + } + + mp[0] &= 0x7f; // clear PS flag + + if (simulate_) + mp[2] |= 1 << 4; // test write + else + mp[2] &= ~(1 << 4); + + if (setModePage(mp, mpHeader, NULL, showMessage) != 0) { + if (showMessage) + log_message(-2, "Cannot set write parameters mode page."); + return 1; + } + + return 0; +} + +int GenericMMC::getNWA(long *nwa) +{ + unsigned char cmd[10]; + int infoblocklen = 16; + unsigned char info[16]; + long lba = 0; + + cmd[0] = 0x52; // READ TRACK INFORMATION + cmd[1] = 0x01; // track instead of lba designation + cmd[2] = 0x00; + cmd[3] = 0x00; + cmd[4] = 0x00; + cmd[5] = 0xff; // invisible track + cmd[6] = 0x00; // reserved + cmd[7] = infoblocklen << 8; + cmd[8] = infoblocklen; // alloc length + cmd[9] = 0x00; // Control Byte + + if (sendCmd(cmd, 10, NULL, 0, info, infoblocklen) != 0) { + log_message(-2, "Cannot get Track Information Block."); + return 1; + } + +#if 0 + log_message(3,"Track Information Block"); + for (int i=0;i<infoblocklen;i++) log_message(3,"byte %02x : %02x",i,info[i]); +#endif + + if ((info[6] & 0x40) && (info[7] & 0x01) && !(info[6] & 0xb0)) + { + log_message(4,"Track is Blank, Next Writable Address is valid"); + lba |= info[12] << 24; // MSB of LBA + lba |= info[13] << 16; + lba |= info[14] << 8; + lba |= info[15]; // LSB of LBA + } + + log_message(4, "NWA: %ld", lba); + + if (nwa != NULL) + *nwa = lba; + + return 0; +} + +// Determines first writable address of data area of current empty session. +// lba: set to start of data area +// return: 0: OK +// 1: error occured +int GenericMMC::getStartOfSession(long *lba) +{ + unsigned char mp[0x38]; + unsigned char mpHeader[8]; + + // first set the writing mode because it influences which address is + // returned with 'READ TRACK INFORMATION' + + if (getModePage(5/*write parameters mode page*/, mp, 0x38, + mpHeader, NULL, 0) != 0) { + return 1; + } + + mp[0] &= 0x7f; // clear PS flag + + mp[2] &= 0xe0; + mp[2] |= 0x02; // write type: Session-at-once + + if (setModePage(mp, mpHeader, NULL, 1) != 0) { + log_message(-2, "Cannot set write parameters mode page."); + return 1; + } + + return getNWA(lba); +} + +static unsigned char leadInOutDataMode(TrackData::Mode mode) +{ + unsigned char ret = 0; + + switch (mode) { + case TrackData::AUDIO: + ret = 0x01; + break; + + case TrackData::MODE0: // should not happen + case TrackData::MODE1: + case TrackData::MODE1_RAW: + ret = 0x14; + break; + + case TrackData::MODE2_FORM1: + case TrackData::MODE2_FORM2: + case TrackData::MODE2_FORM_MIX: + case TrackData::MODE2_RAW: // assume it contains XA sectors + ret = 0x24; + break; + + case TrackData::MODE2: + ret = 0x34; + break; + } + + return ret; +} + + +unsigned char GenericMMC::subChannelDataForm(TrackData::SubChannelMode sm, + int encodingMode) +{ + unsigned char ret = 0; + + switch (sm) { + case TrackData::SUBCHAN_NONE: + break; + + case TrackData::SUBCHAN_RW: + case TrackData::SUBCHAN_RW_RAW: + if (encodingMode == 0) + ret = 0xc0; + else + ret = 0x40; + break; + } + + return ret; +} + + +// Creates cue sheet for current toc. +// cueSheetLen: filled with length of cue sheet in bytes +// return: newly allocated cue sheet buffer or 'NULL' on error +unsigned char *GenericMMC::createCueSheet(unsigned long variant, + long *cueSheetLen) +{ + const Track *t; + int trackNr; + Msf start, end, index; + unsigned char *cueSheet; + long len = 3; // entries for lead-in, gap, lead-out + long n; // index into cue sheet + unsigned char ctl; // control nibbles of cue sheet entry CTL/ADR + long i; + unsigned char dataMode; + int trackOffset; + long lbaOffset; + + if (!diskInfo_.empty && diskInfo_.append) { + if (toc_->firstTrackNo() != 0 && toc_->firstTrackNo() != diskInfo_.lastTrackNr + 1) { + log_message(-2, "Number of first track doesn't match"); + return NULL; + } +#if 0 + /* for progress message */ + toc_->firstTrackNo(diskInfo_.lastTrackNr + 1); +#endif + trackOffset = diskInfo_.lastTrackNr; + lbaOffset = diskInfo_.thisSessionLba; + } else { + trackOffset = toc_->firstTrackNo() == 0 ? 0 : toc_->firstTrackNo() - 1; + lbaOffset = 0; + } + if (trackOffset + toc_->nofTracks() > 99) { + log_message(-2, "Track numbers too large"); + return NULL; + } + + TrackIterator itr(toc_); + + if (itr.first(start, end) == NULL) { + return NULL; + } + + if (toc_->catalogValid()) { + len += 2; + } + + for (t = itr.first(start, end), trackNr = 1; + t != NULL; t = itr.next(start, end), trackNr++) { + len += 1; // entry for track + if (t->start().lba() != 0 && trackNr > 1) { + len += 1; // entry for pre-gap + } + if (t->type() == TrackData::AUDIO && t->isrcValid()) { + len += 2; // entries for ISRC code + } + len += t->nofIndices(); // entry for each index increment + } + + cueSheet = new unsigned char[len * 8]; + n = 0; + + if (toc_->leadInMode() == TrackData::AUDIO) { + ctl = 0; + } + else { + ctl = 0x40; + } + + if (toc_->catalogValid()) { + // fill catalog number entry + cueSheet[n*8] = 0x02 | ctl; + cueSheet[(n+1)*8] = 0x02 | ctl; + for (i = 1; i <= 13; i++) { + if (i < 8) { + cueSheet[n*8 + i] = toc_->catalog(i-1) + '0'; + } + else { + cueSheet[(n+1)*8 + i - 7] = toc_->catalog(i-1) + '0'; + } + } + cueSheet[(n+1)*8+7] = 0; + n += 2; + } + + // entry for lead-in + cueSheet[n*8] = 0x01 | ctl; // CTL/ADR + cueSheet[n*8+1] = 0; // Track number + cueSheet[n*8+2] = 0; // Index + + if (cdTextEncoder_ != NULL) { + cueSheet[n*8+3] = 0x41; // Data Form: CD-DA with P-W sub-channels, + // main channel data generated by device + } + else { + cueSheet[n*8+3] = leadInOutDataMode(toc_->leadInMode()); + } + + cueSheet[n*8+4] = 0; // Serial Copy Management System + + if (cdTextEncoder_ != NULL && + (variant & CUE_VAR_CDTEXT_NO_TIME) == 0) { + cueSheet[n*8+5] = leadInStart_.min(); + cueSheet[n*8+6] = leadInStart_.sec(); + cueSheet[n*8+7] = leadInStart_.frac(); + } + else { + cueSheet[n*8+5] = 0; // MIN + cueSheet[n*8+6] = 0; // SEC + cueSheet[n*8+7] = 0; // FRAME + } + + n++; + + int firstTrack = 1; + + for (t = itr.first(start, end), trackNr = trackOffset + 1; + t != NULL; + t = itr.next(start, end), trackNr++) { + if (encodingMode_ == 0) { + // just used for some experiments with raw writing + dataMode = 0; + } + else { + switch (t->type()) { + case TrackData::AUDIO: + dataMode = 0; + break; + case TrackData::MODE1: + case TrackData::MODE1_RAW: + dataMode = 0x10; + break; + case TrackData::MODE2: + dataMode = 0x30; + break; + case TrackData::MODE2_RAW: // assume it contains XA sectors + case TrackData::MODE2_FORM1: + case TrackData::MODE2_FORM2: + case TrackData::MODE2_FORM_MIX: + dataMode = 0x20; + break; + default: + dataMode = 0; + break; + } + } + + // add mode for sub-channel writing + dataMode |= subChannelDataForm(t->subChannelType(), + subChannelEncodingMode(t->subChannelType())); + + ctl = 0; + if (t->copyPermitted()) { + ctl |= 0x20; + } + + if (t->type() == TrackData::AUDIO) { + // audio track + if (t->preEmphasis()) { + ctl |= 0x10; + } + if (t->audioType() == 1) { + ctl |= 0x80; + } + + if (t->isrcValid()) { + if ((variant & CUE_VAR_ISRC_NO_CTL) == 0) + cueSheet[n*8] = ctl | 0x03; + else + cueSheet[n*8] = 0x03; + + cueSheet[n*8+1] = trackNr; + cueSheet[n*8+2] = t->isrcCountry(0); + cueSheet[n*8+3] = t->isrcCountry(1); + cueSheet[n*8+4] = t->isrcOwner(0); + cueSheet[n*8+5] = t->isrcOwner(1); + cueSheet[n*8+6] = t->isrcOwner(2); + cueSheet[n*8+7] = t->isrcYear(0) + '0'; + n++; + + if ((variant & CUE_VAR_ISRC_NO_CTL) == 0) + cueSheet[n*8] = ctl | 0x03; + else + cueSheet[n*8] = 0x03; + + cueSheet[n*8+1] = trackNr; + cueSheet[n*8+2] = t->isrcYear(1) + '0'; + cueSheet[n*8+3] = t->isrcSerial(0) + '0'; + cueSheet[n*8+4] = t->isrcSerial(1) + '0'; + cueSheet[n*8+5] = t->isrcSerial(2) + '0'; + cueSheet[n*8+6] = t->isrcSerial(3) + '0'; + cueSheet[n*8+7] = t->isrcSerial(4) + '0'; + n++; + } + } + else { + // data track + ctl |= 0x40; + } + + + if (firstTrack) { + Msf sessionStart(lbaOffset); + + // entry for gap before first track + cueSheet[n*8] = ctl | 0x01; + cueSheet[n*8+1] = trackNr; + cueSheet[n*8+2] = 0; // Index 0 + cueSheet[n*8+3] = dataMode; // Data Form + cueSheet[n*8+4] = 0; // Serial Copy Management System + cueSheet[n*8+5] = sessionStart.min(); + cueSheet[n*8+6] = sessionStart.sec(); + cueSheet[n*8+7] = sessionStart.frac(); + n++; + } + else if (t->start().lba() != 0) { + // entry for pre-gap + Msf pstart(lbaOffset + start.lba() - t->start().lba() + 150); + + cueSheet[n*8] = ctl | 0x01; + cueSheet[n*8+1] = trackNr; + cueSheet[n*8+2] = 0; // Index 0 indicates pre-gap + cueSheet[n*8+3] = dataMode; // Data Form + cueSheet[n*8+4] = 0; // no alternate copy bit + cueSheet[n*8+5] = pstart.min(); + cueSheet[n*8+6] = pstart.sec(); + cueSheet[n*8+7] = pstart.frac(); + n++; + } + + Msf tstart(lbaOffset + start.lba() + 150); + + cueSheet[n*8] = ctl | 0x01; + cueSheet[n*8+1] = trackNr; + cueSheet[n*8+2] = 1; // Index 1 + cueSheet[n*8+3] = dataMode; // Data Form + cueSheet[n*8+4] = 0; // no alternate copy bit + cueSheet[n*8+5] = tstart.min(); + cueSheet[n*8+6] = tstart.sec(); + cueSheet[n*8+7] = tstart.frac(); + n++; + + for (i = 0; i < t->nofIndices(); i++) { + index = tstart + t->getIndex(i); + cueSheet[n*8] = ctl | 0x01; + cueSheet[n*8+1] = trackNr; + cueSheet[n*8+2] = i+2; // Index + cueSheet[n*8+3] = dataMode; // Data Form + cueSheet[n*8+4] = 0; // no alternate copy bit + cueSheet[n*8+5] = index.min(); + cueSheet[n*8+6] = index.sec(); + cueSheet[n*8+7] = index.frac(); + n++; + } + + firstTrack = 0; + } + + assert(n == len - 1); + + // entry for lead out + Msf lostart(lbaOffset + toc_->length().lba() + 150); + ctl = toc_->leadOutMode() == TrackData::AUDIO ? 0 : 0x40; + + cueSheet[n*8] = ctl | 0x01; + cueSheet[n*8+1] = 0xaa; + cueSheet[n*8+2] = 1; // Index 1 + cueSheet[n*8+3] = leadInOutDataMode(toc_->leadOutMode()); + cueSheet[n*8+4] = 0; // no alternate copy bit + cueSheet[n*8+5] = lostart.min(); + cueSheet[n*8+6] = lostart.sec(); + cueSheet[n*8+7] = lostart.frac(); + + log_message(3, "\nCue Sheet (variant %lx):", variant); + log_message(3, "CTL/ TNO INDEX DATA SCMS MIN SEC FRAME"); + log_message(3, "ADR FORM"); + for (n = 0; n < len; n++) { + log_message(3, "%02x %02x %02x %02x %02x %02d %02d %02d", + cueSheet[n*8], + cueSheet[n*8+1], cueSheet[n*8+2], cueSheet[n*8+3], cueSheet[n*8+4], + cueSheet[n*8+5], cueSheet[n*8+6], cueSheet[n*8+7]); + } + + *cueSheetLen = len * 8; + return cueSheet; +} + +int GenericMMC::sendCueSheet() +{ + unsigned char cmd[10]; + long cueSheetLen; + unsigned long variant; + unsigned char *cueSheet; + int cueSheetSent = 0; + + for (variant = 0; variant <= CUE_VAR_MAX; variant++) { + + if (cdTextEncoder_ == NULL && + (variant & CUE_VAR_CDTEXT_NO_TIME) != 0) { + // skip CD-TEXT variants if no CD-TEXT has to be written + continue; + } + + cueSheet = createCueSheet(variant, &cueSheetLen); + + if (cueSheet != NULL) { + memset(cmd, 0, 10); + + cmd[0] = 0x5d; // SEND CUE SHEET + + cmd[6] = cueSheetLen >> 16; + cmd[7] = cueSheetLen >> 8; + cmd[8] = cueSheetLen; + + if (sendCmd(cmd, 10, cueSheet, cueSheetLen, NULL, 0, 0) != 0) { + delete[] cueSheet; + } + else { + log_message(3, "Drive accepted cue sheet variant %lx.", variant); + delete[] cueSheet; + cueSheetSent = 1; + break; + } + } + } + + if (cueSheetSent) { + return 0; + } + else { + log_message(-2, + "Drive does not accept any cue sheet variant - please report."); + return 1; + } +} + +int GenericMMC::initDao(const Toc *toc) +{ + long n; + blockLength_ = AUDIO_BLOCK_LEN + MAX_SUBCHANNEL_LEN; + blocksPerWrite_ = scsiIf_->maxDataLen() / blockLength_; + + assert(blocksPerWrite_ > 0); + + toc_ = toc; + + if (options_ & OPT_MMC_CD_TEXT) { + delete cdTextEncoder_; + cdTextEncoder_ = new CdTextEncoder(toc_); + if (cdTextEncoder_->encode() != 0) { + log_message(-2, "CD-TEXT encoding failed."); + return 1; + } + + if (cdTextEncoder_->getSubChannels(&n) == NULL || n == 0) { + delete cdTextEncoder_; + cdTextEncoder_ = NULL; + } + + //return 1; + } + + diskInfo(); + + if (!diskInfo_.valid.empty || !diskInfo_.valid.append) { + log_message(-2, "Cannot determine status of inserted medium."); + return 1; + } + + if (!diskInfo_.append) { + log_message(-2, "Inserted medium is not appendable."); + return 1; + } + + if ((!diskInfo_.empty && diskInfo_.append) && toc_->firstTrackNo() != 0 ) { + log_message(-1, "Cannot choose number of first track in append mode."); + return 1; + } + + if (selectSpeed() != 0 || + getSessionInfo() != 0) { + return 1; + } + + + // allocate buffer for writing zeros + n = blocksPerWrite_ * blockLength_; + delete[] zeroBuffer_; + zeroBuffer_ = new char[n]; + memset(zeroBuffer_, 0, n); + + return 0; +} + +int GenericMMC::startDao() +{ + unsigned long variant; + int writeParametersSet = 0; + + scsiTimeout_ = scsiIf_->timeout(3 * 60); + + for (variant = 0; variant <= WMP_VAR_MAX; variant++) { + if (cdTextEncoder_ == NULL && + (variant & WMP_VAR_CDTEXT_NO_DATA_BLOCK_TYPE) != 0) { + // skip CD-TEXT variants if no CD-TEXT has to be written + continue; + } + + if (setWriteParameters(variant) == 0) { + log_message(3, "Drive accepted write parameter mode page variant %lx.", + variant); + writeParametersSet = 1; + break; + } + } + + if (!writeParametersSet) { + log_message(-2, "Cannot setup write parameters for session-at-once mode."); + log_message(-2, "Please try to use the 'generic-mmc-raw' driver."); + return 1; + } + + if (!simulate_) { + if (performPowerCalibration() != 0) { + if (!force()) { + log_message(-2, "Use option --force to ignore this error."); + return 1; + } + else { + log_message(-2, "Ignored because of option --force."); + } + } + } + + // It does not hurt if the following command fails. + // The Panasonic CW-7502 needs it, unfortunately it returns the wrong + // data so we ignore the returned data and start writing always with + // LBA -150. + getNWA(NULL); + + if (sendCueSheet() != 0) + return 1; + + //log_message(2, "Writing lead-in and gap..."); + + if (writeCdTextLeadIn() != 0) { + return 1; + } + + + long lba = diskInfo_.thisSessionLba - 150; + + TrackData::Mode mode = TrackData::AUDIO; + TrackData::SubChannelMode subChanMode = TrackData::SUBCHAN_NONE; + TrackIterator itr(toc_); + const Track *tr; + + if ((tr = itr.first()) != NULL) { + mode = tr->type(); + subChanMode = tr->subChannelType(); + } + + if (writeZeros(mode, subChanMode, lba, lba + 150, 150) != 0) { + return 1; + } + + return 0; +} + +int GenericMMC::finishDao() +{ + int ret; + + flushCache(); /* Some drives never return to a ready state after writing + * the lead-out. This is a try to solve this problem. + */ + + while ((ret = checkDriveReady()) == 2) { + mSleep(2000); + } + + if (ret != 0) + log_message(-1, "TEST UNIT READY failed after recording."); + + log_message(2, "Flushing cache..."); + + if (flushCache() != 0) { + return 1; + } + + scsiIf_->timeout(scsiTimeout_); + + delete cdTextEncoder_; + cdTextEncoder_ = NULL; + + delete[] zeroBuffer_, zeroBuffer_ = NULL; + + return 0; +} + +void GenericMMC::abortDao() +{ + flushCache(); + + delete cdTextEncoder_; + cdTextEncoder_ = NULL; +} + +// Writes data to target, the block length depends on the actual writing +// 'mode'. 'len' is number of blocks to write. +// 'lba' specifies the next logical block address for writing and is updated +// by this function. +// return: 0: OK +// 1: scsi command failed +int GenericMMC::writeData(TrackData::Mode mode, TrackData::SubChannelMode sm, + long &lba, const char *buf, long len) +{ + assert(blocksPerWrite_ > 0); + int writeLen = 0; + unsigned char cmd[10]; + long blockLength = blockSize(mode, sm); + int retry; + int ret; + +#if 0 + long bufferCapacity; + int waitForBuffer; + int speedFrac; + + if (speed_ > 0) + speedFrac = 75 * speed_; + else + speedFrac = 75 * 10; // adjust this value when the first >10x burner is out +#endif + +#if 0 + long sum, i; + + sum = 0; + + for (i = 0; i < len * blockLength; i++) { + sum += buf[i]; + } + + log_message(0, "W: %ld: %ld, %ld, %ld", lba, blockLength, len, sum); +#endif + + memset(cmd, 0, 10); + cmd[0] = 0x2a; // WRITE1 + + while (len > 0) { + writeLen = (len > blocksPerWrite_ ? blocksPerWrite_ : len); + + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + + cmd[7] = writeLen >> 8; + cmd[8] = writeLen & 0xff; + +#if 0 + do { + long available + waitForBuffer = 0; + + if (readBufferCapacity(&bufferCapacity, &available) == 0) { + //log_message(0, "Buffer Capacity: %ld", bufferCapacity); + if (bufferCapacity < writeLen * blockLength) { + long t = 1000 * writeLen; + t /= speedFrac; + if (t <= 0) + t = 1; + + log_message(0, "Waiting for %ld msec at lba %ld", t, lba); + + mSleep(t); + waitForBuffer = 1; + } + } + } while (waitForBuffer); +#endif + + do { + retry = 0; + + ret = sendCmd(cmd, 10, (unsigned char *)buf, writeLen * blockLength, + NULL, 0, 0); + + if(ret == 2) { + const unsigned char *sense; + int senseLen; + + sense = scsiIf_->getSense(senseLen); + + // check if drive rejected the command because the internal buffer + // is filled + if(senseLen >= 14 && (sense[2] & 0x0f) == 0x2 && sense[7] >= 6 && + sense[12] == 0x4 && sense[13] == 0x8) { + // Not Ready, long write in progress + mSleep(40); + retry = 1; + } + else { + scsiIf_->printError(); + } + } + } while (retry); + + if (ret != 0) { + log_message(-2, "Write data failed."); + return 1; + } + + buf += writeLen * blockLength; + + lba += writeLen; + len -= writeLen; + } + + return 0; +} + +int GenericMMC::writeCdTextLeadIn() +{ + unsigned char cmd[10]; + const PWSubChannel96 **cdTextSubChannels; + long cdTextSubChannelCount; + long channelsPerCmd; + long scp = 0; + long lba = -150 - leadInLen_; + long len = leadInLen_; + long n; + long i; + int retry; + int ret; + unsigned char *p; + + if (cdTextEncoder_ == NULL) + return 0; + + channelsPerCmd = scsiIf_->maxDataLen() / 96; + + cdTextSubChannels = cdTextEncoder_->getSubChannels(&cdTextSubChannelCount); + + assert(channelsPerCmd > 0); + assert(cdTextSubChannels != NULL); + assert(cdTextSubChannelCount > 0); + + log_message(2, "Writing CD-TEXT lead-in..."); + + log_message(4, "Start LBA: %ld, length: %ld", lba, len); + + memset(cmd, 0, 10); + cmd[0] = 0x2a; // WRITE1 + + while (len > 0) { + n = (len > channelsPerCmd) ? channelsPerCmd : len; + + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + + cmd[7] = n >> 8; + cmd[8] = n; + + p = transferBuffer_; + + for (i = 0; i < n; i++) { + memcpy(p, cdTextSubChannels[scp]->data(), 96); + p += 96; + + scp++; + if (scp >= cdTextSubChannelCount) + scp = 0; + } + + log_message(5, "Writing %ld CD-TEXT sub-channels at LBA %ld.", n, lba); + + do { + retry = 0; + + ret = sendCmd(cmd, 10, transferBuffer_, n * 96, NULL, 0, 0); + + if(ret == 2) { + const unsigned char *sense; + int senseLen; + + sense = scsiIf_->getSense(senseLen); + + // check if drive rejected the command because the internal buffer + // is filled + if(senseLen >= 14 && (sense[2] & 0x0f) == 0x2 && sense[7] >= 6 && + sense[12] == 0x4 && sense[13] == 0x8) { + // Not Ready, long write in progress + mSleep(40); + retry = 1; + } + else { + scsiIf_->printError(); + } + } + } while (retry); + + if (ret != 0) { + log_message(-2, "Writing of CD-TEXT data failed."); + return 1; + } + + + len -= n; + lba += n; + } + + return 0; +} + +DiskInfo *GenericMMC::diskInfo() +{ + unsigned char cmd[10]; + unsigned long dataLen = 34; + unsigned char data[34]; + char spd; + + memset(&diskInfo_, 0, sizeof(DiskInfo)); + + // perform READ DISK INFORMATION + memset(cmd, 0, 10); + memset(data, 0, dataLen); + + cmd[0] = 0x51; // READ DISK INFORMATION + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen, 0) == 0) { + diskInfo_.cdrw = (data[2] & 0x10) ? 1 : 0; + diskInfo_.valid.cdrw = 1; + + switch (data[2] & 0x03) { + case 0: + // disc is empty + diskInfo_.empty = 1; + diskInfo_.append = 1; + + diskInfo_.manufacturerId = Msf(data[17], data[18], data[19]); + diskInfo_.valid.manufacturerId = 1; + break; + + case 1: + // disc is not empty but appendable + diskInfo_.sessionCnt = data[4]; + diskInfo_.lastTrackNr = data[6]; + + diskInfo_.diskTocType = data[8]; + + switch ((data[2] >> 2) & 0x03) { + case 0: + // last session is empty + diskInfo_.append = 1; + + // don't count the empty session and invisible track + diskInfo_.sessionCnt -= 1; + diskInfo_.lastTrackNr -= 1; + + if (getStartOfSession(&(diskInfo_.thisSessionLba)) == 0) { + // reserve space for pre-gap after lead-in + diskInfo_.thisSessionLba += 150; + } + else { + // try to guess start of data area from start of lead-in + // reserve space for 4500 lead-in and 150 pre-gap sectors + diskInfo_.thisSessionLba = Msf(data[17], data[18], + data[19]).lba() - 150 + 4650; + } + break; + + case 1: + // last session is incomplete (not fixated) + // we cannot append in DAO mode, just update the statistic data + + diskInfo_.diskTocType = data[8]; + + // don't count the invisible track + diskInfo_.lastTrackNr -= 1; + break; + } + break; + + case 2: + // disk is complete + diskInfo_.sessionCnt = data[4]; + diskInfo_.lastTrackNr = data[6]; + diskInfo_.diskTocType = data[8]; + break; + } + + diskInfo_.valid.empty = 1; + diskInfo_.valid.append = 1; + + if (data[21] != 0xff || data[22] != 0xff || data[23] != 0xff) { + diskInfo_.valid.capacity = 1; + diskInfo_.capacity = Msf(data[21], data[22], data[23]).lba() - 150; + } + } + + // perform READ TOC to get session info + memset(cmd, 0, 10); + dataLen = 12; + memset(data, 0, dataLen); + + cmd[0] = 0x43; // READ TOC + cmd[2] = 1; // get session info + cmd[8] = dataLen; // allocation length + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen, 0) == 0) { + diskInfo_.lastSessionLba = (data[8] << 24) | (data[9] << 16) | + (data[10] << 8) | data[11]; + + if (!diskInfo_.valid.empty) { + diskInfo_.valid.empty = 1; + diskInfo_.empty = (data[3] == 0) ? 1 : 0; + + diskInfo_.sessionCnt = data[3]; + } + } + + // read ATIP data + dataLen = 28; + memset(cmd, 0, 10); + memset(data, 0, dataLen); + + cmd[0] = 0x43; // READ TOC/PMA/ATIP + cmd[1] = 0x00; + cmd[2] = 4; // get ATIP + cmd[7] = 0; + cmd[8] = dataLen; // data length + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen, 0) == 0) { + if (data[6] & 0x04) { + diskInfo_.valid.recSpeed = 1; + spd = (data[16] >> 4) & 0x07; + diskInfo_.recSpeedLow = spd == 1 ? 2 : 0; + + spd = (data[16] & 0x0f); + diskInfo_.recSpeedHigh = spd >= 1 && spd <= 4 ? spd * 2 : 0; + } + + if (data[8] >= 80 && data[8] <= 99) { + diskInfo_.manufacturerId = Msf(data[8], data[9], data[10]); + diskInfo_.valid.manufacturerId = 1; + } + } + + return &diskInfo_; +} + + +// tries to read catalog number from disk and adds it to 'toc' +// return: 1 if valid catalog number was found, else 0 +int GenericMMC::readCatalog(Toc *toc, long startLba, long endLba) +{ + unsigned char cmd[10]; + unsigned char data[24]; + char catalog[14]; + int i; + + if (options_ & OPT_MMC_SCAN_MCN) { + if (readCatalogScan(catalog, startLba, endLba) == 0) { + if (catalog[0] != 0) { + if (toc->catalog(catalog) == 0) + return 1; + else + log_message(-1, "Found illegal MCN data: %s", catalog); + } + } + } + else { + memset(cmd, 0, 10); + memset(data, 0, 24); + + cmd[0] = 0x42; // READ SUB-CHANNEL + cmd[2] = 1 << 6; + cmd[3] = 0x02; // get media catalog number + cmd[8] = 24; // transfer length + + if (sendCmd(cmd, 10, NULL, 0, data, 24) != 0) { + log_message(-2, "Cannot get catalog number."); + return 0; + } + + if (data[8] & 0x80) { + for (i = 0; i < 13; i++) { + catalog[i] = data[0x09 + i]; + } + catalog[13] = 0; + + if (toc->catalog(catalog) == 0) { + return 1; + } + } + } + + return 0; +} + +int GenericMMC::readIsrc(int trackNr, char *buf) +{ + unsigned char cmd[10]; + unsigned char data[24]; + int i; + + buf[0] = 0; + + memset(cmd, 0, 10); + memset(data, 0, 24); + + cmd[0] = 0x42; // READ SUB-CHANNEL + cmd[2] = 1 << 6; + cmd[3] = 0x03; // get ISRC + cmd[6] = trackNr; + cmd[8] = 24; // transfer length + + if (sendCmd(cmd, 10, NULL, 0, data, 24) != 0) { + log_message(-2, "Cannot get ISRC code."); + return 0; + } + + if (data[8] & 0x80) { + for (i = 0; i < 12; i++) { + buf[i] = data[0x09 + i]; + } + buf[12] = 0; + } + + return 0; +} + +int GenericMMC::analyzeTrack(TrackData::Mode mode, int trackNr, long startLba, + long endLba, Msf *indexIncrements, + int *indexIncrementCnt, long *pregap, + char *isrcCode, unsigned char *ctl) +{ + int ret; + int noScan = 0; + + selectSpeed(); + + if ((readCapabilities_ & CDR_AUDIO_SCAN_CAP) == 0) { + ret = analyzeTrackSearch(mode, trackNr, startLba, endLba, indexIncrements, + indexIncrementCnt, pregap, isrcCode, ctl); + noScan = 1; + } + else { + ret = analyzeTrackScan(mode, trackNr, startLba, endLba, + indexIncrements, indexIncrementCnt, pregap, + isrcCode, ctl); + } + + if (noScan || (options_ & OPT_MMC_READ_ISRC) != 0 || + (readCapabilities_ & CDR_READ_CAP_AUDIO_PQ_HEX) != 0) { + // The ISRC code is usually not usable if the PQ channel data is + // converted to hex numbers by the drive. Read them with the + // appropriate command in this case + + *isrcCode = 0; + if (mode == TrackData::AUDIO) + readIsrc(trackNr, isrcCode); + } + + return ret; +} + +int GenericMMC::readSubChannels(TrackData::SubChannelMode sm, + long lba, long len, SubChannel ***chans, + Sample *audioData) +{ + int retries = 5; + unsigned char cmd[12]; + int i; + long blockLen = 0; + unsigned long subChanMode = 0; + + cmd[0] = 0xbe; // READ CD + cmd[1] = 0; + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + cmd[6] = len >> 16; + cmd[7] = len >> 8; + cmd[8] = len; + cmd[9] = 0xf8; + cmd[11] = 0; + + switch (sm) { + case TrackData::SUBCHAN_NONE: + // no sub-channel data selected choose what is available + + if ((readCapabilities_ & CDR_READ_CAP_AUDIO_PW_RAW) != 0) { + // reading of raw P-W sub-channel data is supported + blockLen = AUDIO_BLOCK_LEN + 96; + cmd[10] = 0x01; // raw P-W sub-channel data + + subChanMode = CDR_READ_CAP_AUDIO_PW_RAW; + } + else if ((readCapabilities_ & + (CDR_READ_CAP_AUDIO_PQ_BCD|CDR_READ_CAP_AUDIO_PQ_HEX)) != 0) { + // reading of PQ sub-channel data is supported + blockLen = AUDIO_BLOCK_LEN + 16; + cmd[10] = 0x02; // PQ sub-channel data + + if ((readCapabilities_ & CDR_READ_CAP_AUDIO_PQ_BCD) != 0) + subChanMode = CDR_READ_CAP_AUDIO_PQ_BCD; + else + subChanMode = CDR_READ_CAP_AUDIO_PQ_HEX; + } + else { + // no usable sub-channel reading mode is supported + blockLen = AUDIO_BLOCK_LEN; + cmd[10] = 0; + + subChanMode = 0; + } + break; + + case TrackData::SUBCHAN_RW: + blockLen = AUDIO_BLOCK_LEN + 96; + cmd[10] = 0x04; + break; + + case TrackData::SUBCHAN_RW_RAW: + blockLen = AUDIO_BLOCK_LEN + 96; + cmd[10] = 0x01; + break; + } + + while (1) { + if (sendCmd(cmd, 12, NULL, 0, + transferBuffer_, len * blockLen, retries == 0 ? 1 : 0) != 0) { + if (retries == 0) + return 1; + } + else { + break; + } + + retries--; + } + +#if 0 + if (lba > 5000) { + char fname[200]; + sprintf(fname, "testout_%ld", lba); + FILE *fp = fopen(fname, "w"); + fwrite(transferBuffer_, blockLen, len, fp); + fclose(fp); + } +#endif + + if (subChanMode != 0) { + unsigned char *buf = transferBuffer_ + AUDIO_BLOCK_LEN; + + for (i = 0; i < len; i++) { + switch (subChanMode) { + case CDR_READ_CAP_AUDIO_PQ_HEX: + // All numbers in sub-channel data are hex conforming to the + // MMC standard. We have to convert them back to BCD for the + // 'SubChannel' class. + buf[1] = SubChannel::bcd(buf[1]); + buf[2] = SubChannel::bcd(buf[2]); + buf[3] = SubChannel::bcd(buf[3]); + buf[4] = SubChannel::bcd(buf[4]); + buf[5] = SubChannel::bcd(buf[5]); + buf[6] = SubChannel::bcd(buf[6]); + buf[7] = SubChannel::bcd(buf[7]); + buf[8] = SubChannel::bcd(buf[8]); + buf[9] = SubChannel::bcd(buf[9]); + // fall through + + case CDR_READ_CAP_AUDIO_PQ_BCD: + ((PQSubChannel16*)scannedSubChannels_[i])->init(buf); + if (scannedSubChannels_[i]->type() != SubChannel::QMODE_ILLEGAL) { + // the CRC of the sub-channel data is usually invalid -> mark the + // sub-channel object that it should not try to verify the CRC + scannedSubChannels_[i]->crcInvalid(); + } + break; + + case CDR_READ_CAP_AUDIO_PW_RAW: + ((PWSubChannel96*)scannedSubChannels_[i])->init(buf); + break; + } + +#if 0 + if (subChanMode == CDR_READ_CAP_AUDIO_PW_RAW) { + // xxam! + int j, k; + + log_message(0, ""); + for (j = 0; j < 4; j++) { + for (k = 0; k < 24; k++) { + unsigned char data = buf[j * 24 + k]; + log_message(0, "%02x ", data&0x3f); + } + log_message(0, ""); + } + } +#endif + + buf += blockLen; + } + } + + if (audioData != NULL) { + unsigned char *p = transferBuffer_; + + for (i = 0; i < len; i++) { + memcpy(audioData, p, AUDIO_BLOCK_LEN); + + audioData += SAMPLES_PER_BLOCK; + + switch (sm) { + case TrackData::SUBCHAN_NONE: + break; + + case TrackData::SUBCHAN_RW: + case TrackData::SUBCHAN_RW_RAW: + memcpy(audioData, p + AUDIO_BLOCK_LEN, PW_SUBCHANNEL_LEN); + audioData += PW_SUBCHANNEL_LEN / SAMPLE_LEN; + break; + } + + p += blockLen; + } + } + + if (subChanMode == 0) + *chans = NULL; + else + *chans = scannedSubChannels_; + + return 0; +} + + +// Tries to retrieve configuration feature 'feature' and fills data to +// provided buffer 'buf' with maximum length 'bufLen'. +// Return: 0: OK +// 1: feature not available +// 2: SCSI error +int GenericMMC::getFeature(unsigned int feature, unsigned char *buf, + unsigned long bufLen, int showMsg) +{ + unsigned char header[8]; + unsigned char *data; + unsigned char cmd[10]; + unsigned long len; + + memset(cmd, 0, 10); + memset(header, 0, 8); + + cmd[0] = 0x46; // GET CONFIGURATION + cmd[1] = 0x02; // return single feature descriptor + cmd[2] = feature >> 8; + cmd[3] = feature; + cmd[8] = 8; // allocation length + + if (sendCmd(cmd, 10, NULL, 0, header, 8, showMsg) != 0) { + if (showMsg) + log_message(-2, "Cannot get feature 0x%x.", feature); + return 2; + } + + len = (header[0] << 24) | (header[1] << 16) | (header[2] << 8) | header[3]; + + log_message(4, "getFeature: data len: %lu", len); + + if (len < 8) + return 1; // feature not defined + + if (bufLen == 0) + return 0; + + len -= 4; + + if (len > bufLen) + len = bufLen; + + data = new unsigned char[len + 8]; + + cmd[7] = (len + 8) >> 8; + cmd[8] = (len + 8); + + if (sendCmd(cmd, 10, NULL, 0, data, len + 8, showMsg) != 0) { + if (showMsg) + log_message(-2, "Cannot get data for feature 0x%x.", feature); + + delete[] data; + return 2; + } + + len = (header[0] << 24) | (header[1] << 16) | (header[2] << 8) | header[3]; + + log_message(4, "getFeature: data len: %lu", len); + + if (len < 8) { + delete[] data; + return 1; // feature not defined + } + + len -= 4; + + if (len > bufLen) + len = bufLen; + + memcpy(buf, data + 8, len); + + delete[] data; + + return 0; +} + +const DriveInfo *GenericMMC::driveInfo(bool showErrorMsg) +{ + unsigned char mp[32]; + + if (driveInfo_ != NULL) + return driveInfo_; + + driveInfo_ = new DriveInfo; + + if (getModePage(0x2a, mp, 32, NULL, NULL, showErrorMsg) != 0) { + if (showErrorMsg) { + log_message(-2, "Cannot retrieve drive capabilities mode page."); + } + delete driveInfo_; + driveInfo_ = NULL; + return NULL; + } + + driveInfo_->burnProof = (mp[4] & 0x80) ? 1 : 0; + driveInfo_->accurateAudioStream = mp[5] & 0x02 ? 1 : 0; + + driveInfo_->maxReadSpeed = (mp[8] << 8) | mp[9]; + driveInfo_->currentReadSpeed = (mp[14] << 8) | mp[15]; + + driveInfo_->maxWriteSpeed = (mp[18] << 8) | mp[19]; + driveInfo_->currentWriteSpeed = (mp[20] << 8) | mp[21]; + +#if 0 + unsigned char cdMasteringFeature[8]; + if (getFeature(0x2e, cdMasteringFeature, 8, 1) == 0) { + log_message(0, "Feature: %x %x %x %x %x %x %x %x", cdMasteringFeature[0], + cdMasteringFeature[1], cdMasteringFeature[2], + cdMasteringFeature[3], cdMasteringFeature[4], + cdMasteringFeature[5], cdMasteringFeature[6], + cdMasteringFeature[7]); + } +#endif + + RicohGetWriteOptions(); + + return driveInfo_; +} + +TrackData::Mode GenericMMC::getTrackMode(int, long trackStartLba) +{ + unsigned char cmd[12]; + unsigned char data[AUDIO_BLOCK_LEN]; + + memset(cmd, 0, 12); + cmd[0] = 0xbe; // READ CD + + cmd[2] = trackStartLba >> 24; + cmd[3] = trackStartLba >> 16; + cmd[4] = trackStartLba >> 8; + cmd[5] = trackStartLba; + + cmd[8] = 1; + + cmd[9] = 0xf8; + + if (sendCmd(cmd, 12, NULL, 0, data, AUDIO_BLOCK_LEN) != 0) { + log_message(-2, "Cannot read sector of track."); + return TrackData::MODE0; + } + + if (memcmp(CdrDriver::syncPattern, data, 12) != 0) { + // cannot be a data sector + return TrackData::MODE0; + } + + TrackData::Mode mode = determineSectorMode(data + 12); + + if (mode == TrackData::MODE0) { + // illegal + log_message(-2, "Found illegal mode in sector %ld.", trackStartLba); + } + + return mode; +} + +CdRawToc *GenericMMC::getRawToc(int sessionNr, int *len) +{ + unsigned char cmd[10]; + unsigned short dataLen; + unsigned char *data = NULL;; + unsigned char reqData[4]; // buffer for requestion the actual length + unsigned char *p; + int i, entries; + CdRawToc *rawToc; + + assert(sessionNr >= 1); + + // read disk toc length + memset(cmd, 0, 10); + cmd[0] = 0x43; // READ TOC + cmd[2] = 2; + cmd[6] = sessionNr; + cmd[8] = 4; + + if (sendCmd(cmd, 10, NULL, 0, reqData, 4) != 0) { + log_message(-2, "Cannot read disk toc."); + return NULL; + } + + dataLen = ((reqData[0] << 8) | reqData[1]) + 2; + + log_message(4, "Raw toc data len: %d", dataLen); + + data = new unsigned char[dataLen]; + + // read disk toc + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen) != 0) { + log_message(-2, "Cannot read disk toc."); + delete[] data; + return NULL; + } + + entries = (((data[0] << 8) | data[1]) - 2) / 11; + + rawToc = new CdRawToc[entries]; + + for (i = 0, p = data + 4; i < entries; i++, p += 11 ) { +#if 0 + log_message(5, "%d %02x %02d %2x %02d:%02d:%02d %02d %02d:%02d:%02d", + p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10]); +#endif + rawToc[i].sessionNr = p[0]; + rawToc[i].adrCtl = p[1]; + rawToc[i].point = p[3]; + rawToc[i].pmin = p[8]; + rawToc[i].psec = p[9]; + rawToc[i].pframe = p[10]; + } + + delete[] data; + + *len = entries; + + return rawToc; +} + +long GenericMMC::readTrackData(TrackData::Mode mode, + TrackData::SubChannelMode sm, + long lba, long len, unsigned char *buf) +{ + long i; + long inBlockLen = AUDIO_BLOCK_LEN; + unsigned char cmd[12]; + const unsigned char *sense; + int senseLen; + + memset(cmd, 0, 12); + + cmd[0] = 0xbe; // READ CD + cmd[1] = 0; + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + cmd[6] = len >> 16; + cmd[7] = len >> 8; + cmd[8] = len; + cmd[9] = 0xf8; + + switch (sm) { + case TrackData::SUBCHAN_NONE: + cmd[10] = 0; // no sub-channel reading + break; + + case TrackData::SUBCHAN_RW: + cmd[10] = 0x4; + inBlockLen += PW_SUBCHANNEL_LEN; + break; + + case TrackData::SUBCHAN_RW_RAW: + cmd[10] = 0x1; + inBlockLen += PW_SUBCHANNEL_LEN; + break; + } + + switch (sendCmd(cmd, 12, NULL, 0, transferBuffer_, len * inBlockLen, 0)) { + case 0: + break; + + case 2: + sense = scsiIf_->getSense(senseLen); + + if (senseLen > 0x0c) { + if ((sense[2] & 0x0f) == 5) { // Illegal request + switch (sense[12]) { + case 0x63: // End of user area encountered on this track + case 0x64: // Illegal mode for this track + return -2; + break; + + case 0x20: // INVALID COMMAND OPERATION CODE + case 0x24: // INVALID FIELD IN CDB + case 0x26: // INVALID FIELD IN PARAMETER LIST + /* These error codes mean that something was wrong with the + * command we are sending. Report them as hard errors to the + * upper level. + */ + scsiIf_->printError(); + return -1; + break; + } + } + else if ((sense[2] & 0x0f) == 4) { // Hardware Error + switch (sense[12]) { + case 0x9: // focus servo failure + return -2; + break; + } + } + else if ((sense[2] & 0x0f) == 3) { // Medium error + switch (sense[12]) { + case 0x02: // No seek complete, sector not found + case 0x06: // no reference position found + case 0x11: // L-EC error + case 0x15: // random positioning error + return -2; + break; + } + } + } + + /* All other errors are unexpected. They will be treated like L-EC errors + * by the upper layer. Just print the error code so that we can decice + * later to add the errors to the known possible error list. + */ + + scsiIf_->printError(); + return -2; + break; + + default: + log_message(-2, "Read error at LBA %ld, len %ld", lba, len); + return -2; + break; + } + + unsigned char *sector = transferBuffer_; + for (i = 0; i < len; i++) { + if (buf != NULL) { + switch (mode) { + case TrackData::MODE1: + memcpy(buf, sector + 16, MODE1_BLOCK_LEN); + buf += MODE1_BLOCK_LEN; + break; + case TrackData::MODE1_RAW: + memcpy(buf, sector, AUDIO_BLOCK_LEN); + buf += AUDIO_BLOCK_LEN; + break; + case TrackData::MODE2: + case TrackData::MODE2_FORM_MIX: + memcpy(buf, sector + 16, MODE2_BLOCK_LEN); + buf += MODE2_BLOCK_LEN; + break; + case TrackData::MODE2_FORM1: + memcpy(buf, sector + 24, MODE2_FORM1_DATA_LEN); + buf += MODE2_FORM1_DATA_LEN; + break; + case TrackData::MODE2_FORM2: + memcpy(buf, sector + 24, MODE2_FORM2_DATA_LEN); + buf += MODE2_FORM2_DATA_LEN; + break; + case TrackData::MODE2_RAW: + memcpy(buf, sector, AUDIO_BLOCK_LEN); + buf += AUDIO_BLOCK_LEN; + break; + case TrackData::MODE0: + case TrackData::AUDIO: + log_message(-3, "GenericMMC::readTrackData: Illegal mode."); + return 0; + break; + } + + // copy sub-channel data + switch (sm) { + case TrackData::SUBCHAN_NONE: + break; + + case TrackData::SUBCHAN_RW: + case TrackData::SUBCHAN_RW_RAW: + memcpy(buf, sector + AUDIO_BLOCK_LEN, PW_SUBCHANNEL_LEN); + buf += PW_SUBCHANNEL_LEN; + break; + } + } + +#if 0 + // xxam! + int j, k; + + log_message(0, ""); + for (j = 0; j < 4; j++) { + for (k = 0; k < 24; k++) { + unsigned char data = sector[AUDIO_BLOCK_LEN + j * 24 + k]; + log_message(0, "%02x ", data&0x3f); + } + log_message(0, ""); + } +#endif + + sector += inBlockLen; + } + + return len; +} + +int GenericMMC::readAudioRange(ReadDiskInfo *rinfo, int fd, long start, + long end, int startTrack, + int endTrack, TrackInfo *info) +{ + if (!onTheFly_) { + if (((readCapabilities_ & CDR_READ_CAP_AUDIO_PQ_BCD) == 0 && + (readCapabilities_ & CDR_READ_CAP_AUDIO_PW_RAW) == 0) || + (options_ & OPT_MMC_READ_ISRC) != 0) { + int t; + long pregap = 0; + + // The ISRC code is usually not usable if the PQ channel data is + // converted to hex numbers by the drive. Read them with the + // appropriate command in this case + + log_message(1, "Analyzing..."); + + + for (t = startTrack; t <= endTrack; t++) { + long totalProgress; + + log_message(1, "Track %d...", t + 1); + + totalProgress = t * 1000; + totalProgress /= rinfo->tracks; + sendReadCdProgressMsg(RCD_ANALYZING, rinfo->tracks, t + 1, 0, + totalProgress); + + if ((readCapabilities_ & CDR_AUDIO_SCAN_CAP) == 0) { + // we have to use the binary search method to find pre-gap and + // index marks if the drive cannot read sub-channel data + if (!fastTocReading_) { + long slba, elba; + int i, indexCnt; + Msf index[98]; + unsigned char ctl; + + if (pregap > 0) + log_message(2, "Found pre-gap: %s", Msf(pregap).str()); + + slba = info[t].start; + if (info[t].mode == info[t + 1].mode) + elba = info[t + 1].start; + else + elba = info[t + 1].start - 150; + + pregap = 0; + if (analyzeTrackSearch(TrackData::AUDIO, t + 1, slba, elba, + index, &indexCnt, &pregap, info[t].isrcCode, + &ctl) != 0) + return 1; + + for (i = 0; i < indexCnt; i++) + info[t].index[i] = index[i].lba(); + + info[t].indexCnt = indexCnt; + + if (t < endTrack) + info[t + 1].pregap = pregap; + } + else { + info[t].indexCnt = 0; + info[t + 1].pregap = 0; + } + } + + + info[t].isrcCode[0] = 0; + readIsrc(t + 1, info[t].isrcCode); + if (info[t].isrcCode[0] != 0) + log_message(2, "Found ISRC code."); + + totalProgress = (t + 1) * 1000; + totalProgress /= rinfo->tracks; + sendReadCdProgressMsg(RCD_ANALYZING, rinfo->tracks, t + 1, 1000, + totalProgress); + } + + log_message(1, "Reading..."); + } + } + + if (subChanReadMode_ == TrackData::SUBCHAN_NONE) { + return CdrDriver::readAudioRangeParanoia(rinfo, fd, start, end, startTrack, + endTrack, info); + } + else { + return CdrDriver::readAudioRangeStream(rinfo, fd, start, end, startTrack, + endTrack, info); + } +} + +int GenericMMC::getTrackIndex(long lba, int *trackNr, int *indexNr, + unsigned char *ctl) +{ + unsigned char cmd[12]; + unsigned short dataLen = 0x30; + unsigned char data[0x30]; + int waitLoops = 10; + int waitFailed = 0; + + // play one audio block + memset(cmd, 0, 10); + cmd[0] = 0x45; // PLAY AUDIO + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + cmd[7] = 0; + cmd[8] = 1; + + if (sendCmd(cmd, 10, NULL, 0, NULL, 0) != 0) { + log_message(-2, "Cannot play audio block."); + return 1; + } + + // wait until the play command finished + memset(cmd, 0, 12); + cmd[0] = 0xbd; // MECHANISM STATUS + cmd[9] = 8; + + while (waitLoops > 0) { + if (sendCmd(cmd, 12, NULL, 0, data, 8, 0) == 0) { + //log_message(0, "%d, %x", waitLoops, data[1]); + if ((data[1] >> 5) == 1) // still playing? + waitLoops--; + else + waitLoops = 0; + } + else { + waitFailed = 1; + waitLoops = 0; + } + } + + if (waitFailed) { + // The play operation immediately returns success status and the waiting + // loop above failed. Wait here for a while until the desired block is + // played. It takes ~13 msecs to play a block but access time is in the + // order of several 100 msecs + mSleep(300); + } + + // read sub channel information + memset(cmd, 0, 10); + cmd[0] = 0x42; // READ SUB CHANNEL + cmd[2] = 0x40; // get sub channel data + cmd[3] = 0x01; // get sub Q channel data + cmd[6] = 0; + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen) != 0) { + log_message(-2, "Cannot read sub Q channel data."); + return 1; + } + + *trackNr = data[6]; + *indexNr = data[7]; + if (ctl != NULL) { + *ctl = data[5] & 0x0f; + } + + //log_message(0, "%d %d", *trackNr, *indexNr); + + return 0; +} + +/* + * Checks if a certain sub-channel reading mode is supported. + * lba: start address for reading + * len: maximum number of sectors available for testing + * subChanMode: 1: read PQ sub-channels + * 2: read raw P-W sub-channels + * 3: read cooked R-W sub-channels + * Return: 0 sub-channel read mode not supported + * 1 sub-channel read mode supported (BCD for PQ) + * 2 sub-channel read mode supported (HEX for PQ) + * 3 sub-channel read mode PQ supported but cannot determine data + * format +*/ + +int GenericMMC::readCdTest(long lba, long len, int subChanMode) const +{ + unsigned char cmd[12]; + long blockLen; + int ret; + int successRead = 0; + int pqSubChanBcdOk = 0; + int pqSubChanHexOk = 0; + + memset(cmd, 0, sizeof(cmd)); + + //log_message(0, "readCdTest: %ld %ld %d", lba, len, subChanMode); + + if (len <= 0) + return 0; + + cmd[0] = 0xbe; // READ CD + cmd[8] = 1; // transfer length: 1 + cmd[9] = 0xf8; + + blockLen = AUDIO_BLOCK_LEN; + + switch (subChanMode) { + case 1: // PQ + blockLen += PQ_SUBCHANNEL_LEN; + cmd[10] = 0x02; + if (len > 300) + len = 300; /* we have to check many sub-channels here to determine the + * data mode (BCD or HEX) + */ + break; + + case 2: // PW_RAW + cmd[10] = 0x01; + blockLen += PW_SUBCHANNEL_LEN; + if (len > 10) + len = 10; + break; + + case 3: // RW_COOKED + cmd[10] = 0x04; + blockLen += PW_SUBCHANNEL_LEN; + if (len > 10) + len = 10; + break; + } + + while (len > 0) { + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + + if ((ret = sendCmd(cmd, 12, NULL, 0, transferBuffer_, blockLen, 0)) == 0) { + successRead++; + + if (subChanMode == 1) { + unsigned char *buf = transferBuffer_ + AUDIO_BLOCK_LEN; + +#if 0 + { + PQSubChannel16 chan; + chan.init(buf); + chan.print(); + } +#endif + + // check if Q sub-channel values are in BCD or HEX format + if (SubChannel::isBcd(buf[1]) && + SubChannel::isBcd(buf[2]) && + SubChannel::isBcd(buf[3]) && + SubChannel::isBcd(buf[4]) && + SubChannel::isBcd(buf[5]) && + SubChannel::isBcd(buf[6]) && + SubChannel::isBcd(buf[7]) && + SubChannel::isBcd(buf[8]) && + SubChannel::isBcd(buf[9])) { + PQSubChannel16 chan; + chan.init(buf); + + chan.type(SubChannel::QMODE1DATA); + + int min = chan.amin(); + int sec = chan.asec(); + int frac = chan.aframe(); + + if ((frac >= 0 && frac < 75) && + (sec >= 0 && sec < 60) && + (min >= 0)) { + long pqlba = Msf(min, sec, frac).lba() - 150; + + long diff = pqlba - lba; + if (diff < 0) + diff = -diff; + + if (diff < 20) { + pqSubChanBcdOk++; + } + } + } + + if (buf[7] < 100 && buf[8] < 60 && buf[9] < 75) { + long pqlba = Msf(buf[7], buf[8], buf[9]).lba() - 150; + + //log_message(0, "readCdTest: pqlba: %ld", pqlba); + long diff = pqlba - lba; + if (diff < 0) + diff = -diff; + + if (diff < 20) { + pqSubChanHexOk++; + } + } + } + } + + + len--; + lba++; + } + + if (successRead) { + if (subChanMode == 1) { + if (pqSubChanBcdOk > pqSubChanHexOk) + return 1; + else if (pqSubChanHexOk > pqSubChanBcdOk) + return 2; + else return 3; + } + else { + return 1; + } + } + + return 0; +} + +unsigned long GenericMMC::getReadCapabilities(const CdToc *toc, + int nofTracks) const +{ + unsigned long caps = 0; + int audioRawPWChecked = 0; + int audioPQChecked = 0; + int audioCookedRWChecked = 0; + int dataRawPWChecked = 0; + int dataPQChecked = 0; + int dataCookedRWChecked = 0; + int t; + + if ((options_ & OPT_MMC_NO_SUBCHAN) != 0) { + // driver options indicate that PQ and raw RW sub-channel reading for + // audio tracks is not supported so skip all corresponding tests + audioPQChecked = 1; + audioRawPWChecked = 1; + } + else if ((options_ & OPT_MMC_USE_PQ) != 0) { + // driver options indicated that PQ sub-channel reading is supported for + // audio/data tracks and RW sub-channel reading is not supported, skip + // the corresponding checks and set the capabilities appropriately + audioPQChecked = 1; + audioRawPWChecked = 1; + dataPQChecked = 1; + + if ((options_ & OPT_MMC_PQ_BCD) != 0) + caps |= CDR_READ_CAP_AUDIO_PQ_BCD | CDR_READ_CAP_DATA_PQ_BCD; + else + caps |= CDR_READ_CAP_AUDIO_PQ_HEX | CDR_READ_CAP_DATA_PQ_HEX; + } + else if ((options_ & OPT_MMC_USE_RAW_RW) != 0) { + // driver options indicated that raw PW sub-channel reading is supported + // audio tracks and raw PW sub-channel reading is not supported, skip + // the corresponding checks and set the capabilities appropriately + audioPQChecked = 1; + audioRawPWChecked = 1; + + caps |= CDR_READ_CAP_DATA_PW_RAW; + } + + for (t = 0; t < nofTracks; t++) { + long tlen = toc[t+1].start - toc[t].start; + + if ((toc[t].adrCtl & 0x04) != 0) { + // data track + if (!dataPQChecked) { + dataPQChecked = 1; + + log_message(3, "Checking for PQ sub-channel reading support (data track)..."); + switch (readCdTest(toc[t].start, tlen, 1)) { + case 0: + log_message(3, "PQ sub-channel reading (data track) not supported."); + break; + + case 1: + log_message(2, "PQ sub-channel reading (data track) is supported, data format is BCD."); + caps |= CDR_READ_CAP_DATA_PQ_BCD; + break; + + case 2: + log_message(2, "PQ sub-channel reading (data track) is supported, data format is HEX."); + caps |= CDR_READ_CAP_DATA_PQ_HEX; + break; + + case 3: + log_message(2, "PQ sub-channel reading (data track) seems to be supported but cannot determine data format."); + log_message(2, "Please use driver option '--driver generic-mmc:0x1' or '--driver generic-mmc:0x3' to set the data format explicitly."); + break; + } + } + + if (!dataRawPWChecked) { + dataRawPWChecked = 1; + + log_message(3, "Checking for raw P-W sub-channel reading support (data track)..."); + if (readCdTest(toc[t].start, tlen, 2)) { + log_message(2, "Raw P-W sub-channel reading (data track) is supported."); + caps |= CDR_READ_CAP_DATA_PW_RAW; + } + else { + log_message(3, "Raw P-W sub-channel reading (data track) is not supported."); + } + } + + if (!dataCookedRWChecked) { + dataCookedRWChecked = 1; + + log_message(3, "Checking for cooked R-W sub-channel reading support (data track)..."); + if (readCdTest(toc[t].start, tlen, 3)) { + log_message(2, "Cooked R-W sub-channel reading (data track) is supported."); + caps |= CDR_READ_CAP_DATA_RW_COOKED; + } + else { + log_message(3, "Cooked R-W sub-channel reading (data track) is not supported."); + } + } + } + else { + // audio track + if (!audioPQChecked) { + audioPQChecked = 1; + + log_message(3, "Checking for PQ sub-channel reading support (audio track)..."); + switch (readCdTest(toc[t].start, tlen, 1)) { + case 0: + log_message(3, "PQ sub-channel reading (audio track) is not supported."); + break; + + case 1: + log_message(2, "PQ sub-channel reading (audio track) is supported, data format is BCD."); + caps |= CDR_READ_CAP_AUDIO_PQ_BCD; + break; + + case 2: + log_message(2, "PQ sub-channel reading (audio track) is supported, data format is HEX."); + caps |= CDR_READ_CAP_AUDIO_PQ_HEX; + break; + + case 3: + log_message(2, "PQ sub-channel reading (audio track) seems to be supported but cannot determine data format."); + log_message(2, "Please use driver option '--driver generic-mmc:0x1' or '--driver generic-mmc:0x3' to set the data format explicitly."); + break; + } + } + + if (!audioRawPWChecked) { + audioRawPWChecked = 1; + + log_message(3, "Checking for raw P-W sub-channel reading support (audio track)..."); + if (readCdTest(toc[t].start, tlen, 2)) { + log_message(2, "Raw P-W sub-channel reading (audio track) is supported."); + caps |= CDR_READ_CAP_AUDIO_PW_RAW; + } + else { + log_message(3, "Raw P-W sub-channel reading (audio track) is not supported."); + } + } + + if (!audioCookedRWChecked) { + audioCookedRWChecked = 1; + + log_message(3, "Checking for cooked R-W sub-channel reading support (audio track)..."); + if (readCdTest(toc[t].start, tlen, 3)) { + log_message(2, "Cooked R-W sub-channel reading (audio track) is supported."); + caps |= CDR_READ_CAP_AUDIO_RW_COOKED; + } + else { + log_message(3, "Raw R-W sub-channel reading (audio track) is not supported."); + } + } + } + } + + return caps; +} + +int GenericMMC::RicohGetWriteOptions() +{ + unsigned char mp[14]; + + driveInfo_->ricohJustLink = 0; + driveInfo_->ricohJustSpeed = 0; + + if (getModePage(0x30, mp, 14, NULL, NULL, 0) != 0) { + return 1; + } + + if (mp[1] != 14) + return 1; + + if (mp[2] & (1 << 5)) + driveInfo_->ricohJustSpeed = 1; + + if (mp[2] & 0x01) + driveInfo_->ricohJustLink = 1; + + return 0; +} + +int GenericMMC::RicohSetWriteOptions(const DriveInfo *di) +{ + unsigned char mp[14]; + + if (di->ricohJustLink == 0 && di->ricohJustSpeed == 0) + return 0; + + if (getModePage(0x30, mp, 14, NULL, NULL, 1) != 0) { + log_message(-2, "Cannot retrieve Ricoh mode page 30."); + return 1; + } + + if (di->ricohJustLink) { + if (bufferUnderRunProtection()) { + log_message(2, "Enabling JustLink."); + mp[3] |= 0x1; + } + else { + log_message(2, "Disabling JustLink."); + mp[3] &= ~0x1; + } + } + + if (di->ricohJustSpeed) { + if (writeSpeedControl()) { + log_message(2, "Enabling JustSpeed."); + mp[3] &= ~(1 << 5); // clear bit to enable write speed control + } + else { + log_message(2, "Disabling JustSpeed."); + mp[3] |= (1 << 5); // set bit to disable write speed control + } + } + + if (setModePage(mp, NULL, NULL, 1) != 0) { + log_message(-2, "Cannot set Ricoh mode page 30."); + return 1; + } + + return 0; +} diff --git a/dao/GenericMMC.h b/dao/GenericMMC.h new file mode 100644 index 0000000..00f99dc --- /dev/null +++ b/dao/GenericMMC.h @@ -0,0 +1,466 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __GENERIC_MMC_H__ +#define __GENERIC_MMC_H__ + +#include "CdrDriver.h" + +class Toc; +class Track; +class CdTextEncoder; + +/*! \def OPT_MMC_USE_PQ + \brief use PQ sub-channel data for scanning +*/ +#define OPT_MMC_USE_PQ 0x0001 +/*! \def OPT_MMC_PQ_BCD + \brief PQ sub-channel contains BCD numbers +*/ +#define OPT_MMC_PQ_BCD 0x0002 +/*! \def OPT_MMC_READ_ISRC + \brief force reading of ISRC code with + READ SUB CHANNEL instead taking it from + the sub-channel data +*/ +#define OPT_MMC_READ_ISRC 0x0004 +/*! \def OPT_MMC_SCAN_MCN + \brief take MCN from the sub-channel data + instead using READ SUB CHANNEL +*/ +#define OPT_MMC_SCAN_MCN 0x0008 +/*! \def OPT_MMC_CD_TEXT + \brief drive supports CD-TEXT writing +*/ +#define OPT_MMC_CD_TEXT 0x0010 +/*! \def OPT_MMC_NO_SUBCHAN + \brief drive does not support + reading sub-channel data +*/ +#define OPT_MMC_NO_SUBCHAN 0x0020 +/*! \def OPT_MMC_NO_BURNPROOF + \brief disable BURN-Proof +*/ +#define OPT_MMC_NO_BURNPROOF 0x0040 +/*! \def OPT_MMC_NO_RW_PACKED + \brief drive does not support the packed R-W + sub-channel writing mode +*/ +#define OPT_MMC_NO_RW_PACKED 0x0080 +/*! \def OPT_MMC_USE_RAW_RW + \brief use RW sub-channel data for scanning +*/ +#define OPT_MMC_USE_RAW_RW 0x0100 + +#define OPT_MMC_YAMAHA_FORCE_SPEED 0x0200 + // drive supports Yamaha's Force Speed + // feature + +/*! \brief Driver for Generic MMC units +*/ +class GenericMMC : public CdrDriver { +public: +/*! \brief Default constructor + \param scsiIf As obtained from ScsiIf::ScsiIf + \param options Binary AND of options like OPT_MMC_USE_PQ and subsequent + \sa OPT_MMC_USE_PQ +*/ + GenericMMC(ScsiIf *scsiIf, unsigned long options); +/*! \brief Default destructor */ + ~GenericMMC(); +/*! \brief Static constructor + \sa GenericMMC::GenericMMC +*/ + static CdrDriver *instance(ScsiIf *scsiIf, unsigned long options); + +/*! \brief See what subchannel reading modes are available + + For each data/audio track it tries PQ subchannel (using GenericMMC::readCdTest); + it may result in: + - not supported + - BCD format + - HEX format + - unknown (error printout) + + Then it tries + - Raw PW + - Cooked PW + + You may skip some tests if you have initialized the driver with something + like OPT_MMC_USE_PQ. + \param CdToc* Toc of the disc, used to compute track lengths + \param int Number of tracks to use for the test + \return Binary OR of the capabilities. + \sa CDR_READ_CAP_DATA_PW_RAW and similar. +*/ + unsigned long getReadCapabilities(const CdToc *, int) const; + + /*! \brief MMC compatible drives take little endian samples + \return 0 + */ + int bigEndianSamples() const { return 0; } + + /*! \brief Sanity checking of the TOC + + A first check is done using CdrDriver::checkToc. + Then, if CD TEXT capabilities are available, it checks CD TEXT + using Toc::checkCdTextData. + + \return 0 if OK, 1 if some warning, 2 on error + */ + int checkToc(const Toc *); + + /*! \brief Sets read/write speed + + Uses SET CD SPEED command 0xBB. + Speeds are specified as multipliers, using 0 as means max value. + Write speed is set from protected variable GenericMMC::speed_. + \param int Read speed as multiplier. + \return 0 on success, 1 if SCSI command error + */ + int speed(int); + + /*! \brief Returns current write speed + + Rebuilds the GenericMMC::driveInfo_ structure by reading + mode page 0x2A. Information is extracted from this structure. + \return Write speed (as multiplier) or 0 if SCSI error occurred. + */ + int speed(); + + bool rspeed(int); + int rspeed(); + + /*! \brief Gathers various info about inserted disk. + + - Issues READ DISK INFORMATION 0x51. Obtains number of tracks and + sessions and disk completion status. + + - Issues READ TOC 0x43 with parameter 1 to get session info. + + - Reads ATIP data (READ TOC 0x43, parameter 4) + \return Pointer to protected attribute GenericMMC::diskInfo_ + */ + DiskInfo *diskInfo(); + + /*! \brief Loads or ejects tray + + Uses START/STOP unit command 0x1B. + \param int 0 to load tray, 1 to eject + \return 0 on success, 1 on error + */ + int loadUnload(int) const; + + /*! \brief Blanks a CDRW + + First the drive is put in simulation or write mode, as specified in + GenericMMC::simulate_ attribute. Then the disk is blanked with BLANK 0xA1. + The IMMED bit is not set, and the call will + block until the operation is completed. Drive status will be polled + every 2 seconds. + \param BlankingMode Either BLANK_FULL or BLANK_MINIMAL + \return 0 on success or 1 on error + */ + int blankDisk(BlankingMode); + + /*! \brief Initializes internal stuff before a write session. + + - Setup CD-TEXT encoder if specified in GenericMMC::options_ + + - Gets inserted disk info with GenericMMC::diskInfo + + - Sets write speed with GenericMMC::selectSpeed + + - Allocates new data buffer into GenericMMC::zeroBuffer_ + + \param Toc* TOC of the disk you want to write + \return 0 on success, 1 on error + */ + int initDao(const Toc *); + + /*! \brief Begins write process + + Sets write parameters (MP 0x05), performs power calibration if not + in simulation mode, sends cue sheet and writes leadin. The session LBA + is always -150. First 150 sectors are zeroed. + \return 0 on success, 1 on error + */ + int startDao(); + + /*! \brief Finishes a writing + + Flush device cache and wait for device to become ready. Since some drives + do not return to ready after writing a leadout the cache flush is done twice, + before and after the wait unit ready. + Then the CD-TEXT encoder and the zero buffer are deleted. + \return 0 on success, 1 on error + */ + int finishDao(); + + /*! \brief Aborts a writing + + Flush device cache and delete CD-TEXT encoder. + */ + void abortDao(); + + /*! \brief Writes data to target + + The block length depends on the actual writing. Writing is done using + WRITE10 (0x2A) command. Command is retried if device buffer is full. + \param TrackData::Mode Main channel writing mode + \param TrackData::SubChannelMode Subchannel writing mode + \param lba specifies the next logical block address for writing and is updated + by this function. + \param buf Data to be written + \param len Number of blocks to write + \return 0 if OK, 1 if WRITE command failed + */ + int writeData(TrackData::Mode, TrackData::SubChannelMode, long &lba, + const char *buf, long len); + + /*! \brief Gets useful parameters about the device. + + Gets mode page 0x2A and info about + - Burnproof + - Accurate audio stream + - Maximum read speed + - Current read speed + - Maximum write speed + - Maximum read speed + \param showErrorMsg If true print out errors + \return Pointer to the protected variable driveInfo_ + */ + const DriveInfo *driveInfo(bool showErrorMsg); + + /*! + Returns 0 or 1 depending on the SubChannelMode parameter. + - 0 if SUBCHAN_NONE + - 0 if SUBCHAN_RW + - 1 if SUBCHAN_RW_RAW + \param SubChannelMode One of TrackData::SubChannelMode + \return 0 or 1 (see above) + */ + int subChannelEncodingMode(TrackData::SubChannelMode) const; + +protected: + /*! \brief Timeout for commands on the target */ + int scsiTimeout_; + /*! \brief Start of lead-in */ + Msf leadInStart_; + /*! \brief Length of lead-in */ + long leadInLen_; + /*! \brief Length if lead-out */ + long leadOutLen_; + /*! \brief Various info about the inserted media + \sa diskInfo + */ + DiskInfo diskInfo_; + /*! \brief Various info about the device + \sa driveInfo + */ + DriveInfo *driveInfo_; + /*! Called by GenericMMC::initDao if needed. */ + CdTextEncoder *cdTextEncoder_; + + /*! \brief Determines start and length of lead-in and length of lead-out. + + Uses READ DISK INFORMATION cmd 0x51. + \return 0 on success, 1 on SCSI error + */ + virtual int getSessionInfo(); + /*! \brief Gets next writable address + + Uses READ TRACK INFORMATION 0x52 on incomplete track 0xFF. Must return + RT=1 and NWA_V=1. LBA of next writable address is taken from bytes 12-15. + \param long* LBA of next writable address. + \return 0 on success, 1 on SCSI error + */ + virtual int getNWA(long *); + /*! \brief Determines first writable address of data area of current empty session. + + Places the device in Session At Once write type and calls GenericMMC::getNWA + \param long* LBA of the beginning of data area + \return 0 on success, 1 on SCSI error. + */ + virtual int getStartOfSession(long *); + /*! \brief Still unused */ + virtual int getFeature(unsigned int feature, unsigned char *buf, + unsigned long bufLen, int showMsg); + + /*! \brief Reads Media Catalog Number + + If option OPT_MMC_SCAN_MCN is specified uses CdrDriver::readCatalogScan to + scan subchannels of sectors from startlba to endlba to find MCN and (if valid) + saves it into Toc. If OPT_MMC_SCAN_MCN isn't asserted uses proper command + READ SUBCHANNEL 0x42 with parameter 0x02 to do the same (and startlba, endlba + are unused). + \param Toc* Toc of the disk. MCN can be saved here + \param startLba Start subchannel scan here + \param endLba End subchannel scan here + \return 1 if valid MCN found, else 0 + */ + int readCatalog(Toc *, long startLba, long endLba); + /*! \brief Reads media ISRC + + Uses READ SUBCHANNEL 0x42 with parameter 0x03. Track is specified + by the int parameter. + If TCVAL == 1 ISRC is valid and is copied to char* parameter. + \param int Track to read ISRC of. + \param char* Pre-allocated buffer to store ISRC (12 bytes) + \return Always 0 + */ + int readIsrc(int, char *); + + /*! \brief Sets read/write speed + + Sets the read speed from readSpeed parameter, and write + speed from GenericMMC::speed_ protected attribute. + Both can be specified as 0 for maximum or as multiplier. + \param readSpeed Read speed to set: use 0 for max or multiplier + \todo This documentation needs to be updated + \return 1 on SCSI error, 0 on success + */ + virtual int selectSpeed(); + + /*! \brief Sets write parameters in page 0x05 + + - Write type is 0x02 (SAO). + - Simulation is set from GenericMMC::simulate_ protected attrib. + - BurnFree is set if drive supports it, unless explicitly disabled. + - Next session opened if GenericMMC::multiSession_ + - Data block type ranges from 0 to 3, depending on the CD-TEXT encoder. + \param variant Ranges from 0 to 3, defining modes 0-3 of Data Block Type + Codes in Write Mode Page 0x05. + \return 0 on success, 1 on SCSI error. + */ + virtual int setWriteParameters(unsigned long variant); + + /*! \brief Puts drive in simulation/write mode + + Based on GenericMMC::simulate_ attrib. + \param showMessage If asserted print out errors. + \return 0 on success, 1 on SCSI errors + */ + int setSimulationMode(int showMessage); + + /*! \brief Asks unit to perform power calibration + + Uses SEND OPC INFORMATION (0x54) command with DoOpc set to 1. + \return 0 if command not supported or power calibration successful, + 1 on error + */ + int performPowerCalibration(); + + /*! \brief Free data bytes available in the device's buffer. + + Uses READ BUFFER CAPACITY 0x5C command. + \param capacity Will hold number of bytes. + \todo This documentation needs to be updated + \return 0 on success, 1 on SCSI command error. + */ + bool readBufferCapacity(long *capacity, long *available); + + /*! \brief Creates cue sheet for current toc + + Called by GenericMMC::sendCueSheet to build cuesheets. + \param variant Ranges from 0 to 3, defining modes 0-3 of Data Block Type + Codes in Write Mode Page 0x05. + \param cueSheetLen Filled with cue sheet length in bytes + \return Newly allocated cue sheet buffer or 'NULL' on error + */ + unsigned char *createCueSheet(unsigned long variant, long *cueSheetLen); + + /*! \brief Builds and sends cuesheet + + For each of the 4 available variants builds (using GenericMMC::sendCueSheet) + a cuesheet and sends to the device using SEND CUE SHEET 0x5D. + Stops when device accepts a variant. + \return 0 on success, 1 on error (no variants accepted) + */ + int sendCueSheet(); + + /*! \brief Returns subchannel SCSI standard code for cuesheet + + Used in GenericMMC::createCueSheet to obtain code for cuesheet. + \param TrackData::SubChannelMode One of SUBCHAN_NONE,SUBCHAN_RW,SUBCHAN_RW_RAW + \param encodingMode 0 or 1 + \return int + - 0 if SUBCHAN_NONE + - 0x40 if encodingMode==0 and SUBCHAN_RW(_RAW) + - 0x40 if encodingMode==1 and SUBCHAN_RW(_RAW) + */ + unsigned char subChannelDataForm(TrackData::SubChannelMode, + int encodingMode); + + /*! \brief Writes the subchannel data in the leadin section, used in CD-TEXT + + Issues WRITE (0x2A) commands to write PW subchannels starting + at LBA = -150 - leadInLen_ + \return int + - 0 if cdTextEncoder_ == NULL or everything OK + - 1 if some error occurred (message output) + */ + int writeCdTextLeadIn(); + + int analyzeTrack(TrackData::Mode, int trackNr, long startLba, long endLba, + Msf *index, + int *indexCnt, long *pregap, char *isrcCode, + unsigned char *ctl); + + int getTrackIndex(long lba, int *trackNr, int *indexNr, unsigned char *ctl); + + int readSubChannels(TrackData::SubChannelMode, long lba, long len, + SubChannel ***, Sample *); + + /*! + \brief retrieve mode of the track that starts at the specified trackStartLba. + + Uses READ CD (0xBE) command with byte 9 == 0xF8 (SYNC + Header + Userdata + EDC_ECC + C2 and block errors, + No subchannels) to retrieve the sector addressed as trackStartLba. Uses + CdrDriver::determineSectorMode to identify track mode. + \return TrackData::Mode + */ + TrackData::Mode getTrackMode(int, long trackStartLba); + + CdRawToc *getRawToc(int sessionNr, int *len); + + long readTrackData(TrackData::Mode, TrackData::SubChannelMode, + long lba, long len, unsigned char *buf); + + int readAudioRange(ReadDiskInfo *, int fd, long start, long end, + int startTrack, int endTrack, TrackInfo *); + + int readCdTest(long lba, long len, int subChanMode) const; + + /*! + \brief Checks for ready status of the drive after a write operation. Disc must be inserted. + + Unit should return successfully from TEST UNIT READY command, and from READ DISC INFORMATION. + \return int + - 0 drive ready + - 1 error occured at os level, no sense data + - 2 NOT READY,LONG WRITE IN PROGRESS + */ + int checkDriveReady() const; + + int RicohGetWriteOptions(); + int RicohSetWriteOptions(const DriveInfo *); +}; + +#endif diff --git a/dao/GenericMMCraw.cc b/dao/GenericMMCraw.cc new file mode 100644 index 0000000..bf53b3a --- /dev/null +++ b/dao/GenericMMCraw.cc @@ -0,0 +1,749 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <string.h> +#include <assert.h> + +#include "GenericMMCraw.h" +#include "PQSubChannel16.h" +#include "PWSubChannel96.h" +#include "CdTextEncoder.h" + +#include "Toc.h" +#include "log.h" +#include "port.h" + +GenericMMCraw::GenericMMCraw(ScsiIf *scsiIf, unsigned long options) + : GenericMMC(scsiIf, options), PQChannelEncoder() +{ + driverName_ = "Generic SCSI-3/MMC (raw writing) - Version 2.0"; + + encodingMode_ = 0; + + subChannelMode_ = 0; + + leadInLen_ = leadOutLen_ = 0; + subChannel_ = NULL; + encSubChannel_ = NULL; + encodeBuffer_ = NULL; + + // CD-TEXT dynamic data + cdTextStartLba_ = 0; + cdTextEndLba_ = 0; + cdTextSubChannels_ = NULL; + cdTextSubChannelCount_ = 0; + cdTextSubChannelAct_ = 0; +} + +GenericMMCraw::~GenericMMCraw() +{ + delete subChannel_, subChannel_ = NULL; + delete[] encodeBuffer_, encodeBuffer_ = NULL; + + delete[] encSubChannel_; + encSubChannel_ = NULL; + + cdTextStartLba_ = 0; + cdTextEndLba_ = 0; + cdTextSubChannels_ = NULL; + cdTextSubChannelCount_ = 0; + cdTextSubChannelAct_ = 0; +} + +int GenericMMCraw::multiSession(bool m) +{ + if (m) { + // multi session mode is currently not support for raw writing + return 1; + } + + return 0; +} + +// static constructor +CdrDriver *GenericMMCraw::instance(ScsiIf *scsiIf, unsigned long options) +{ + return new GenericMMCraw(scsiIf, options); +} + +int GenericMMCraw::subChannelEncodingMode(TrackData::SubChannelMode sm) const +{ + int ret = 0; + + + if (subChannelMode_ == 0) { + // The supported sub-channel writing mode has not been determined, yet, + // so just return the plain mode here. 'initDao' will finally check if + // writing of the sub-channel data defined in 'toc_' is supported by the + // drive. + return 0; + } + + switch (sm) { + case TrackData::SUBCHAN_NONE: + ret = 0; + break; + + case TrackData::SUBCHAN_RW: + switch (subChannelMode_) { + case 2: + ret = 0; // plain + break; + case 3: + ret = -1; // currently not supported + //ret = 1; // have to create parity and perform interleaving + break; + default: + ret = -1; // not supported + break; + } + break; + + case TrackData::SUBCHAN_RW_RAW: + if (subChannelMode_ == 3) + ret = 1; + else + ret = -1; + break; + } + + return ret; +} + +// Sets write parameters via mode page 0x05. +// return: 0: OK +// 1: scsi command failed +int GenericMMCraw::setWriteParameters(int dataBlockType) +{ + unsigned char mp[0x38]; + + if (getModePage(5/*write parameters mode page*/, mp, 0x38, + NULL, NULL, 1) != 0) { + log_message(-2, "Cannot retrieve write parameters mode page."); + return 1; + } + + mp[0] &= 0x7f; // clear PS flag + + mp[2] &= 0xe0; + mp[2] |= 0x03; // write type: raw + if (simulate_) { + mp[2] |= 1 << 4; // test write + } + + const DriveInfo *di; + if ((di = driveInfo(1)) != NULL) { + if (di->burnProof) { + // This drive has BURN-Proof function. + // Enable it unless explicitly disabled. + if (bufferUnderRunProtection()) { + log_message(2, "Turning BURN-Proof on"); + mp[2] |= 0x40; + } + else { + log_message(2, "Turning BURN-Proof off"); + mp[2] &= ~0x40; + } + } + + RicohSetWriteOptions(di); + } + + mp[3] &= 0x3f; // Multi-session: No B0 pointer, next session not allowed + mp[3] = 0; + + mp[4] &= 0xf0; + mp[4] = dataBlockType & 0x0f; // Data Block Type: + // 1: raw data, block size: 2368 PQ sub chan + // 2: raw data, block size: 2448 + // 3: raw data, block size: 2448 + + mp[8] = 0; // session format: CD-DA or CD-ROM + + if (setModePage(mp, NULL, NULL, 0) != 0) { + //log_message(-2, "Cannot set write parameters mode page."); + return 1; + } + + return 0; +} + +int GenericMMCraw::getMultiSessionInfo(int sessionNr, int multi, + SessionInfo *info) +{ + int err = 0; + + memset(info, 0, sizeof(SessionInfo)); + + info->sessionNr = 1; + + if (getSessionInfo() != 0) + return 1; + + info->leadInStart = leadInStart_.lba() - 150; + + if (leadInStart_.min() >= 80) { + info->leadInStart = leadInStart_.lba() - 450000; + } + + info->leadInLen = leadInLen_; + info->leadOutLen = leadOutLen_; + + if (multi) { + unsigned char cmd[10]; + unsigned char data[4]; + unsigned char *buf = NULL; + long dataLen; + + // read ATIP data + memset(cmd, 0, 10); + memset(data, 0, 4); + + cmd[0] = 0x43; // READ TOC/PMA/ATIP + cmd[1] = 0x00; + cmd[2] = 4; // get ATIP + cmd[7] = 0; + cmd[8] = 4; // data length + + if (sendCmd(cmd, 10, NULL, 0, data, 4, 0) != 0) { + log_message(-2, "Cannot read ATIP data."); + return 1; + } + + dataLen = (data[0] << 8) | data[1]; + dataLen += 2; + + log_message(4, "ATIP data len: %ld", dataLen); + + if (sessionNr == 1) { + if (dataLen < 19) { + log_message(-2, "Cannot read ATIP data."); + return 1; + } + } + else { + if (dataLen < 15) { + log_message(-2, "Cannot read ATIP data."); + return 1; + } + } + + buf = new unsigned char[dataLen]; + memset(buf, 0, dataLen); + + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + if (sendCmd(cmd, 10, NULL, 0, buf, dataLen, 0) != 0) { + log_message(-2, "Cannot read ATIP data."); + delete[] buf; + return 1; + } + + info->lastLeadoutStart = Msf(buf[12], buf[13], buf[14]); + + if (sessionNr == 1) { + info->optimumRecordingPower = buf[4]; + + if (buf[8] >= 80 && buf[8] <= 99) { + info->atipLeadinStart = Msf(buf[8], buf[9], buf[10]); + } + else { + log_message(-2, "Invalid start time of lead-in in ATIP."); + err = 1; + } + + info->cdrw = (buf[6] & 0x40) ? 1 : 0; + + if (info->cdrw) { + if (buf[6] & 0x04) { + info->atipA1[0] = buf[16]; + info->atipA1[1] = buf[17]; + info->atipA1[2] = buf[18]; + } + else { + log_message(-2, "ATIP data does not contain point A1 data."); + err = 1; + } + } + } + + delete[] buf; + buf = NULL; + } + + log_message(4, "SI: session nr: %d", info->sessionNr); + log_message(4, "SI: lead-in start: %ld", info->leadInStart); + log_message(4, "SI: lead-in len: %ld", info->leadInLen); + log_message(4, "SI: lead-out len: %ld", info->leadOutLen); + log_message(4, "SI: last lead-out start: %d %d %d", info->lastLeadoutStart.min(), + info->lastLeadoutStart.sec(), info->lastLeadoutStart.frac()); + log_message(4, "SI: cdrw: %d", info->cdrw); + log_message(4, "SI: atip lead-in start: %d %d %d", info->atipLeadinStart.min(), + info->atipLeadinStart.sec(), info->atipLeadinStart.frac()); + log_message(4, "SI: optimum recording power: %u", info->optimumRecordingPower); + log_message(4, "SI: atip A1: %u %u %u", info->atipA1[0], info->atipA1[1], + info->atipA1[2]); + + return err; +} + +int GenericMMCraw::getSubChannelModeFromToc() +{ + TrackIterator itr(CdrDriver::toc_); + const Track *tr; + int mode = 0; + + for (tr = itr.first(); tr != NULL; tr = itr.next()) { + switch (tr->subChannelType()) { + case TrackData::SUBCHAN_NONE: + break; + + case TrackData::SUBCHAN_RW: + // we need at least packed RW writing + if (mode < 2) + mode = 2; + break; + + case TrackData::SUBCHAN_RW_RAW: + // we need raw PW writing + mode = 3; + break; + } + } + + log_message(5, "Sub-channel mode requested by toc: %d", mode); + + return mode; +} + +int GenericMMCraw::setSubChannelMode() +{ + delete subChannel_; + subChannel_ = NULL; + + subChannelMode_ = 0; + +#if 1 + if (cdTextEncoder_ != NULL) { + if (setWriteParameters(3) == 0) { + subChannel_ = new PWSubChannel96; + subChannelMode_ = 3; + } + else { + delete cdTextEncoder_; + cdTextEncoder_ = NULL; + + log_message(force() ? -1 : -2, + "Cannot write CD-TEXT data because the 96 byte raw P-W sub-channel data mode is not supported."); + + if (force()) { + log_message(-1, "Ignored because of --force option."); + } + else { + log_message(-2, "Use option --force to ignore this error."); + return 1; + } + } + } + + // check if the toc requires a certain sub-channel mode and try to set it + if (subChannel_ == NULL) { + int tocMode = getSubChannelModeFromToc(); + + if (tocMode > 0) { + for (; tocMode <= 3 && subChannel_ == NULL; tocMode++) { + if (setWriteParameters(tocMode) == 0) { + if (tocMode == 1) + subChannel_ = new PQSubChannel16; + else + subChannel_ = new PWSubChannel96; + + subChannelMode_ = tocMode; + } + } + + if (subChannel_ == NULL) { + log_message(-2, "Cannot setup sub-channel writing mode for sub-channel data defined in the toc-file."); + return 1; + } + } + } + + // select any available sub-channel mode + if (subChannel_ == NULL) { + if (setWriteParameters(1) == 0) { + subChannel_ = new PQSubChannel16; + subChannelMode_ = 1; + } + else if (setWriteParameters(3) == 0) { + subChannel_ = new PWSubChannel96; + subChannelMode_ = 3; + } + else if (setWriteParameters(2) == 0) { + subChannel_ = new PWSubChannel96; + subChannelMode_ = 2; + } + else { + log_message(-2, "Cannot setup disk-at-once writing for this drive."); + return 1; + } + } + +#else + + //subChannel_ = new PWSubChannel96; + subChannel_ = new PQSubChannel16; + subChannelMode_ = 1; +#endif + + switch (subChannelMode_) { + case 1: + log_message(2, "Using 16 byte P-Q sub-channel data mode."); + break; + case 2: + log_message(2, "Using 96 byte packed P-W sub-channel data mode."); + break; + case 3: + if (cdTextEncoder_ != NULL) + log_message(2, "Using 96 byte raw P-W sub-channel data mode for CD-TEXT."); + else + log_message(2, "Using 96 byte raw P-W sub-channel data mode."); + break; + } + + return 0; +} + +int GenericMMCraw::initDao(const Toc *toc) +{ + long n; + + CdrDriver::toc_ = toc; + + if (selectSpeed() != 0 || + getSessionInfo() != 0) { + return 1; + } + + delete cdTextEncoder_; + cdTextEncoder_ = new CdTextEncoder(toc); + if (cdTextEncoder_->encode() != 0) { + log_message(-2, "CD-TEXT encoding failed."); + return 1; + } + + if (cdTextEncoder_->getSubChannels(&n) == NULL || n == 0) { + delete cdTextEncoder_; + cdTextEncoder_ = NULL; + } + + if (setSubChannelMode() != 0) + return 1; + + blockLength_ = AUDIO_BLOCK_LEN + subChannel_->dataLength(); + blocksPerWrite_ = scsiIf_->maxDataLen() / blockLength_; + assert(blocksPerWrite_ > 0); + log_message(4, "Block length: %ld", blockLength_); + + long cueSheetLen; + unsigned char *cueSheet = createCueSheet(0, &cueSheetLen); + + if (cueSheet == NULL) { + return 1; + } + + if (setCueSheet(subChannel_, sessionFormat(), cueSheet, cueSheetLen, + leadInStart_) != 0) { + return 1; + } + + if (cdTextEncoder_ != NULL) { + cdTextStartLba_ = leadInStart_.lba() - 450150; + cdTextEndLba_ = cdTextStartLba_ + leadInLen_; + cdTextSubChannels_ = cdTextEncoder_->getSubChannels(&cdTextSubChannelCount_); + cdTextSubChannelAct_ = 0; + } + else { + cdTextStartLba_ = 0; + cdTextEndLba_ = 0; + cdTextSubChannels_ = NULL; + cdTextSubChannelCount_ = 0; + cdTextSubChannelAct_ = 0; + } + + // allocate buffer for write zeros + n = blocksPerWrite_ * (AUDIO_BLOCK_LEN + subChannel_->dataLength()); + delete[] zeroBuffer_; + zeroBuffer_ = new char[n]; + memset(zeroBuffer_, 0, n); + + // allocate buffer for sub-channel encoding + n = blocksPerWrite_ * blockLength_; + delete[] encodeBuffer_; + encodeBuffer_ = new unsigned char[n]; + + delete[] encSubChannel_; + encSubChannel_ = new unsigned char[blocksPerWrite_ * subChannel_->dataLength()]; + + /* + SessionInfo sessInfo; + + getMultiSessionInfo(1, 1, &sessInfo); + + return 1; + */ + + if (!simulate_) { + if (performPowerCalibration() != 0) { + if (!force()) { + log_message(-2, "Use option --force to ignore this error."); + return 1; + } + else { + log_message(-2, "Ignored because of option --force."); + } + } + } + + return 0; +} + +int GenericMMCraw::startDao() +{ + log_message(2, "Writing lead-in and gap..."); + + long lba = leadInStart_.lba() - 450150; + + if (writeZeros(CdrDriver::toc_->leadInMode(), TrackData::SUBCHAN_NONE, + lba, 0, leadInLen_) != 0) { + return 1; + } + + TrackData::SubChannelMode subChanMode = TrackData::SUBCHAN_NONE; + TrackIterator itr(CdrDriver::toc_); + const Track *tr; + + if ((tr = itr.first()) != NULL) { + subChanMode = tr->subChannelType(); + } + + if (writeZeros(CdrDriver::toc_->leadInMode(), subChanMode, lba, 0, 150) + != 0) { + return 1; + } + + return 0; +} + +int GenericMMCraw::finishDao() +{ + int ret; + + log_message(2, "Writing lead-out..."); + + long lba = CdrDriver::toc_->length().lba(); + + writeZeros(CdrDriver::toc_->leadOutMode(), TrackData::SUBCHAN_NONE, + lba, lba + 150, leadOutLen_); + + log_message(2, "\nFlushing cache..."); + + if (flushCache() != 0) { + return 1; + } + + while ((ret = checkDriveReady()) == 2) + mSleep(2000); + + if (ret != 0) + log_message(-1, "TEST UNIT READY failed after recording."); + + delete cdTextEncoder_, cdTextEncoder_ = NULL; + delete[] zeroBuffer_, zeroBuffer_ = NULL; + delete[] encodeBuffer_, encodeBuffer_ = NULL; + + return 0; +} + +long GenericMMCraw::nextWritableAddress() +{ + unsigned char cmd[10]; + unsigned char data[28]; + long lba = 0xffffffff; + + memset(cmd, 0, 10); + memset(data, 0, 28); + + cmd[0] = 0x52; // READ TRACK INFORMATION + cmd[1] = 0; + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + cmd[8] = 28; + + if (sendCmd(cmd, 10, NULL, 0, data, 28) != 0) { + log_message(-2, "Cannt get track information."); + return 0; + } + + long adr = (data[12] << 24) | (data[13] << 16) | (data[14] << 8) | + data[15]; + + return adr; + +} + +// Writes data to target. The encoded sub-channel data is appended to each +// block. +// return: 0: OK +// 1: scsi command failed +int GenericMMCraw::writeData(TrackData::Mode mode, + TrackData::SubChannelMode sm, + long &lba, const char *buf, long len) +{ + assert(blockLength_ > 0); + assert(blocksPerWrite_ > 0); + assert(mode == TrackData::AUDIO); + int writeLen = 0; + unsigned char cmd[10]; + int i, j; + + long iblen = blockSize(mode, sm); + long slen = subChannel_->dataLength(); + + /* + log_message(0, "lba: %ld, len: %ld, bpc: %d, bl: %d ", lba, len, blocksPerCmd, + blockLength_); + */ + + memset(cmd, 0, 10); + cmd[0] = 0x2a; // WRITE1 + + while (len > 0) { + writeLen = (len > blocksPerWrite_ ? blocksPerWrite_ : len); + + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + + cmd[7] = writeLen >> 8; + cmd[8] = writeLen; + + // encode the PQ sub-channel data + encode(lba, encSubChannel_, writeLen); + + for (i = 0; i < writeLen; i++) { + memcpy(encodeBuffer_ + i * blockLength_, buf + i * iblen, + AUDIO_BLOCK_LEN); + + memcpy(encodeBuffer_ + i * blockLength_ + AUDIO_BLOCK_LEN, + encSubChannel_ + i * slen, slen); + + if (cdTextSubChannels_ != NULL && lba >= cdTextStartLba_ && + lba + i < cdTextEndLba_) { + + const unsigned char *data = cdTextSubChannels_[cdTextSubChannelAct_]->data(); + long dataLen = cdTextSubChannels_[cdTextSubChannelAct_]->dataLength(); + + unsigned char *actBuf = encodeBuffer_ + i * blockLength_ + AUDIO_BLOCK_LEN; + + //log_message(0, "Adding CD-TEXT channel %ld for LBA %ld", cdTextSubChannelAct_, lba + i); + for (j = 0; j < dataLen; j++) { + *actBuf |= (*data & 0x3f); + actBuf++; + data++; + } + + cdTextSubChannelAct_++; + if (cdTextSubChannelAct_ >= cdTextSubChannelCount_) + cdTextSubChannelAct_ = 0; + } + else { + switch (sm) { + case TrackData::SUBCHAN_NONE: + break; + + case TrackData::SUBCHAN_RW: + case TrackData::SUBCHAN_RW_RAW: + { + unsigned char *oBuf = encodeBuffer_ + i * blockLength_ + AUDIO_BLOCK_LEN; + const char *iBuf = buf + i * iblen + AUDIO_BLOCK_LEN; + + for (j = 0; j < PW_SUBCHANNEL_LEN; j++) { + *oBuf |= (*iBuf & 0x3f); + oBuf++; + iBuf++; + } + } + break; + } + } + } + + +#if 0 + // consistency checks + long sum1, sum2; + int n; + const char *p; + for (i = 0; i < writeLen; i++) { + log_message(0, "%ld: ", lba + i); + SubChannel *chan = subChannel_->makeSubChannel(encodeBuffer_ + i * blockLength_ + AUDIO_BLOCK_LEN); + chan->print(); + delete chan; + + sum1 = 0; + for (p = buf + i * iblen, n = 0; + n < AUDIO_BLOCK_LEN; n++, p++) { + sum1 += *p; + } + + sum2 = 0; + for (n = 0; n < AUDIO_BLOCK_LEN; n++) { + sum2 += *(char *)(encodeBuffer_ + i * blockLength_ + n); + } + + //log_message(0, "%ld - %ld", sum1, sum2); + assert(sum1 == sum2); + } +#endif + +#if 1 + if (sendCmd(cmd, 10, encodeBuffer_, writeLen * blockLength_, + NULL, 0) != 0) { + log_message(-2, "Write data failed."); + return 1; + } +#endif + //log_message(0, ". "); + + lba += writeLen; + len -= writeLen; + buf += writeLen * iblen; + } + + //log_message(0, ""); + + return 0; +} diff --git a/dao/GenericMMCraw.h b/dao/GenericMMCraw.h new file mode 100644 index 0000000..11bc2a8 --- /dev/null +++ b/dao/GenericMMCraw.h @@ -0,0 +1,75 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __GENERIC_MMC_RAW_H__ +#define __GENERIC_MMC_RAW_H__ + +#include "GenericMMC.h" +#include "PQChannelEncoder.h" +#include "PWSubChannel96.h" + +class GenericMMCraw : public GenericMMC, private PQChannelEncoder { +public: + + GenericMMCraw(ScsiIf *scsiIf, unsigned long options); + ~GenericMMCraw(); + + static CdrDriver *instance(ScsiIf *scsiIf, unsigned long options); + + int multiSession(bool); + + int subChannelEncodingMode(TrackData::SubChannelMode) const; + + int initDao(const Toc *); + int startDao(); + int finishDao(); + + int writeData(TrackData::Mode, TrackData::SubChannelMode, long &lba, + const char *buf, long len); + +protected: + + int setWriteParameters(int); + +private: + unsigned char *encodeBuffer_; // buffer for encoding sub-channels + unsigned char *encSubChannel_; // holds encoded sub-channels + + SubChannel *subChannel_; // sub channel template + + int subChannelMode_; /* selected sub-channel writing mode: + 0: undefined + 1: 16 byte PQ + 2: 96 byte PW packed + 3: 96 byte PW raw + */ + + long cdTextStartLba_; + long cdTextEndLba_; + const PWSubChannel96 **cdTextSubChannels_; + long cdTextSubChannelCount_; + long cdTextSubChannelAct_; + + long nextWritableAddress(); + int getMultiSessionInfo(int sessionNr, int multi, SessionInfo *info); + int getSubChannelModeFromToc(); + int setSubChannelMode(); +}; + +#endif diff --git a/dao/Makefile.am b/dao/Makefile.am new file mode 100644 index 0000000..a22f567 --- /dev/null +++ b/dao/Makefile.am @@ -0,0 +1,124 @@ +noinst_LIBRARIES = libdao.a + +bin_PROGRAMS = cdrdao + +cdrdao_SOURCES = \ + main.cc + +libdao_a_SOURCES = \ + main.cc \ + dao.cc \ + port.cc \ + data.cc \ + CdrDriver.cc \ + CDD2600Base.cc \ + CDD2600.cc \ + PlextorReader.cc \ + GenericMMC.cc \ + SubChannel.cc \ + PQSubChannel16.cc \ + PWSubChannel96.cc \ + PQChannelEncoder.cc \ + GenericMMCraw.cc \ + PlextorReaderScan.cc \ + RicohMP6200.cc \ + TaiyoYuden.cc \ + YamahaCDR10x.cc \ + TeacCdr55.cc \ + SonyCDU920.cc \ + SonyCDU948.cc \ + ToshibaReader.cc \ + CdTextEncoder.cc \ + Settings.cc \ + CDD2600Base.h \ + CDD2600.h \ + cdda_interface.h \ + CdrDriver.h \ + CdTextEncoder.h \ + dao.h \ + data.h \ + GenericMMC.h \ + GenericMMCraw.h \ + PlextorReader.h \ + PlextorReaderScan.h \ + port.h \ + PQChannelEncoder.h \ + PQSubChannel16.h \ + PWSubChannel96.h \ + remote.h \ + RicohMP6200.h \ + ScsiIf.h \ + Settings.h \ + sg_err.h \ + SonyCDU920.h \ + SonyCDU948.h \ + SubChannel.h \ + TaiyoYuden.h \ + TeacCdr55.h \ + ToshibaReader.h \ + winaspi.h \ + YamahaCDR10x.h + +EXTRA_libdao_a_SOURCES = \ + dao-win32.cc \ + decodeSense.cc \ + sg_err.cc \ + ScsiIf-lib.cc \ + ScsiIf-common.cc \ + ScsiIf-linux.cc \ + ScsiIf-freebsd-cam.cc \ + ScsiIf-netbsd.cc \ + ScsiIf-irix.cc \ + ScsiIf-osx.cc \ + ScsiIf-nt.cc \ + ScsiIf-win.cc + +libdao_a_LIBADD = \ + @scsilib_objs@ + +libdao_a_DEPENDENCIES = \ + @scsilib_objs@ + +cdrdao_LDADD = \ + ./libdao.a \ + $(top_builddir)/paranoia/libcdda_paranoia.a \ + $(top_builddir)/trackdb/libtrackdb.a \ + @thread_libs@ \ + @scsilib_libs@ + +if COND_MP3 +cdrdao_LDADD += @MAD_LIBS@ +endif + +if COND_OGG +cdrdao_LDADD += @VORBISFILE_LIBS@ +endif + +cdrdao_LDADD += @AO_LIBS@ + +cdrdao_DEPENDENCIES = \ + $(top_builddir)/paranoia/libcdda_paranoia.a \ + $(top_builddir)/trackdb/libtrackdb.a \ + @scsilib_objs@ \ + libdao.a + +drivertabledir = $(datadir)/cdrdao +drivertable_DATA = cdrdao.drivers + +CDRDAO_DATA_DIR = $(datadir)/cdrdao +DRIVER_TABLE_FILE = $(CDRDAO_DATA_DIR)/drivers + +install-data-hook: + cd $(DESTDIR)$(datadir)/cdrdao && \ + mv cdrdao.drivers drivers + +INCLUDES = \ + -I$(srcdir)/../trackdb \ + -I$(srcdir)/../paranoia \ + @scsilib_incl@ + +AM_CXXFLAGS = -DDRIVER_TABLE_FILE=\"$(DRIVER_TABLE_FILE)\" + +man1_MANS = cdrdao.man +EXTRA_DIST = $(man1_MANS) cdrdao.drivers + diff --git a/dao/Makefile.in b/dao/Makefile.in new file mode 100644 index 0000000..b57fc7c --- /dev/null +++ b/dao/Makefile.in @@ -0,0 +1,712 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = cdrdao$(EXEEXT) +@COND_MP3_TRUE@am__append_1 = @MAD_LIBS@ +@COND_OGG_TRUE@am__append_2 = @VORBISFILE_LIBS@ +subdir = dao +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libdao_a_AR = $(AR) $(ARFLAGS) +am_libdao_a_OBJECTS = main.$(OBJEXT) dao.$(OBJEXT) port.$(OBJEXT) \ + data.$(OBJEXT) CdrDriver.$(OBJEXT) CDD2600Base.$(OBJEXT) \ + CDD2600.$(OBJEXT) PlextorReader.$(OBJEXT) GenericMMC.$(OBJEXT) \ + SubChannel.$(OBJEXT) PQSubChannel16.$(OBJEXT) \ + PWSubChannel96.$(OBJEXT) PQChannelEncoder.$(OBJEXT) \ + GenericMMCraw.$(OBJEXT) PlextorReaderScan.$(OBJEXT) \ + RicohMP6200.$(OBJEXT) TaiyoYuden.$(OBJEXT) \ + YamahaCDR10x.$(OBJEXT) TeacCdr55.$(OBJEXT) \ + SonyCDU920.$(OBJEXT) SonyCDU948.$(OBJEXT) \ + ToshibaReader.$(OBJEXT) CdTextEncoder.$(OBJEXT) \ + Settings.$(OBJEXT) +libdao_a_OBJECTS = $(am_libdao_a_OBJECTS) +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \ + "$(DESTDIR)$(drivertabledir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_cdrdao_OBJECTS = main.$(OBJEXT) +cdrdao_OBJECTS = $(am_cdrdao_OBJECTS) +am__DEPENDENCIES_1 = +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libdao_a_SOURCES) $(EXTRA_libdao_a_SOURCES) \ + $(cdrdao_SOURCES) +DIST_SOURCES = $(libdao_a_SOURCES) $(EXTRA_libdao_a_SOURCES) \ + $(cdrdao_SOURCES) +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man1_MANS) +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +drivertableDATA_INSTALL = $(INSTALL_DATA) +DATA = $(drivertable_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AO_CFLAGS = @AO_CFLAGS@ +AO_LIBS = @AO_LIBS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COND_MP3_FALSE = @COND_MP3_FALSE@ +COND_MP3_TRUE = @COND_MP3_TRUE@ +COND_OGG_FALSE = @COND_OGG_FALSE@ +COND_OGG_TRUE = @COND_OGG_TRUE@ +COND_PCCTS_FALSE = @COND_PCCTS_FALSE@ +COND_PCCTS_TRUE = @COND_PCCTS_TRUE@ +COND_SCSILIB_FALSE = @COND_SCSILIB_FALSE@ +COND_SCSILIB_TRUE = @COND_SCSILIB_TRUE@ +COND_TOC2MP3_FALSE = @COND_TOC2MP3_FALSE@ +COND_TOC2MP3_TRUE = @COND_TOC2MP3_TRUE@ +COND_XDAO_FALSE = @COND_XDAO_FALSE@ +COND_XDAO_TRUE = @COND_XDAO_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ +GTKMM2_CFLAGS = @GTKMM2_CFLAGS@ +GTKMM2_LIBS = @GTKMM2_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LAME_CFLAGS = @LAME_CFLAGS@ +LAME_LIBS = @LAME_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBGUIMM2_CFLAGS = @LIBGUIMM2_CFLAGS@ +LIBGUIMM2_LIBS = @LIBGUIMM2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAD_CFLAGS = @MAD_CFLAGS@ +MAD_LIBS = @MAD_LIBS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIGCPP2_CFLAGS = @SIGCPP2_CFLAGS@ +SIGCPP2_LIBS = @SIGCPP2_LIBS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +VORBISFILE_CFLAGS = @VORBISFILE_CFLAGS@ +VORBISFILE_LIBS = @VORBISFILE_LIBS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +antlr_path = @antlr_path@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +dao_src = @dao_src@ +datadir = @datadir@ +dlg_path = @dlg_path@ +en_cdrdao = @en_cdrdao@ +en_cue2toc = @en_cue2toc@ +en_toc2cue = @en_toc2cue@ +en_toc2mp3 = @en_toc2mp3@ +en_xdao = @en_xdao@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydefs = @mydefs@ +oldincludedir = @oldincludedir@ +pcctsinc = @pcctsinc@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +scsilib_dir = @scsilib_dir@ +scsilib_incl = @scsilib_incl@ +scsilib_libs = @scsilib_libs@ +scsilib_objs = @scsilib_objs@ +sharedstatedir = @sharedstatedir@ +sound_if_obj = @sound_if_obj@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +thread_libs = @thread_libs@ +noinst_LIBRARIES = libdao.a +cdrdao_SOURCES = \ + main.cc + +libdao_a_SOURCES = \ + main.cc \ + dao.cc \ + port.cc \ + data.cc \ + CdrDriver.cc \ + CDD2600Base.cc \ + CDD2600.cc \ + PlextorReader.cc \ + GenericMMC.cc \ + SubChannel.cc \ + PQSubChannel16.cc \ + PWSubChannel96.cc \ + PQChannelEncoder.cc \ + GenericMMCraw.cc \ + PlextorReaderScan.cc \ + RicohMP6200.cc \ + TaiyoYuden.cc \ + YamahaCDR10x.cc \ + TeacCdr55.cc \ + SonyCDU920.cc \ + SonyCDU948.cc \ + ToshibaReader.cc \ + CdTextEncoder.cc \ + Settings.cc \ + CDD2600Base.h \ + CDD2600.h \ + cdda_interface.h \ + CdrDriver.h \ + CdTextEncoder.h \ + dao.h \ + data.h \ + GenericMMC.h \ + GenericMMCraw.h \ + PlextorReader.h \ + PlextorReaderScan.h \ + port.h \ + PQChannelEncoder.h \ + PQSubChannel16.h \ + PWSubChannel96.h \ + remote.h \ + RicohMP6200.h \ + ScsiIf.h \ + Settings.h \ + sg_err.h \ + SonyCDU920.h \ + SonyCDU948.h \ + SubChannel.h \ + TaiyoYuden.h \ + TeacCdr55.h \ + ToshibaReader.h \ + winaspi.h \ + YamahaCDR10x.h + +EXTRA_libdao_a_SOURCES = \ + dao-win32.cc \ + decodeSense.cc \ + sg_err.cc \ + ScsiIf-lib.cc \ + ScsiIf-common.cc \ + ScsiIf-linux.cc \ + ScsiIf-freebsd-cam.cc \ + ScsiIf-netbsd.cc \ + ScsiIf-irix.cc \ + ScsiIf-osx.cc \ + ScsiIf-nt.cc \ + ScsiIf-win.cc + +libdao_a_LIBADD = \ + @scsilib_objs@ + +libdao_a_DEPENDENCIES = \ + @scsilib_objs@ + +cdrdao_LDADD = ./libdao.a $(top_builddir)/paranoia/libcdda_paranoia.a \ + $(top_builddir)/trackdb/libtrackdb.a @thread_libs@ \ + @scsilib_libs@ $(am__append_1) $(am__append_2) @AO_LIBS@ +cdrdao_DEPENDENCIES = \ + $(top_builddir)/paranoia/libcdda_paranoia.a \ + $(top_builddir)/trackdb/libtrackdb.a \ + @scsilib_objs@ \ + libdao.a + +drivertabledir = $(datadir)/cdrdao +drivertable_DATA = cdrdao.drivers +CDRDAO_DATA_DIR = $(datadir)/cdrdao +DRIVER_TABLE_FILE = $(CDRDAO_DATA_DIR)/drivers +INCLUDES = \ + -I$(srcdir)/../trackdb \ + -I$(srcdir)/../paranoia \ + @scsilib_incl@ + +AM_CXXFLAGS = -DDRIVER_TABLE_FILE=\"$(DRIVER_TABLE_FILE)\" +man1_MANS = cdrdao.man +EXTRA_DIST = $(man1_MANS) cdrdao.drivers +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu dao/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu dao/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libdao.a: $(libdao_a_OBJECTS) $(libdao_a_DEPENDENCIES) + -rm -f libdao.a + $(libdao_a_AR) libdao.a $(libdao_a_OBJECTS) $(libdao_a_LIBADD) + $(RANLIB) libdao.a +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +cdrdao$(EXEEXT): $(cdrdao_OBJECTS) $(cdrdao_DEPENDENCIES) + @rm -f cdrdao$(EXEEXT) + $(CXXLINK) $(cdrdao_LDFLAGS) $(cdrdao_OBJECTS) $(cdrdao_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CDD2600.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CDD2600Base.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CdTextEncoder.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CdrDriver.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GenericMMC.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GenericMMCraw.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PQChannelEncoder.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PQSubChannel16.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PWSubChannel96.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PlextorReader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PlextorReaderScan.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RicohMP6200.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ScsiIf-common.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ScsiIf-freebsd-cam.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ScsiIf-irix.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ScsiIf-lib.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ScsiIf-linux.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ScsiIf-netbsd.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ScsiIf-nt.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ScsiIf-osx.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ScsiIf-win.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Settings.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SonyCDU920.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SonyCDU948.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SubChannel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TaiyoYuden.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TeacCdr55.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ToshibaReader.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/YamahaCDR10x.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dao-win32.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dao.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/data.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/decodeSense.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/port.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sg_err.Po@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +uninstall-info-am: +install-man1: $(man1_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)" + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ + done +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ + done +install-drivertableDATA: $(drivertable_DATA) + @$(NORMAL_INSTALL) + test -z "$(drivertabledir)" || $(mkdir_p) "$(DESTDIR)$(drivertabledir)" + @list='$(drivertable_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(drivertableDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(drivertabledir)/$$f'"; \ + $(drivertableDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(drivertabledir)/$$f"; \ + done + +uninstall-drivertableDATA: + @$(NORMAL_UNINSTALL) + @list='$(drivertable_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(drivertabledir)/$$f'"; \ + rm -f "$(DESTDIR)$(drivertabledir)/$$f"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(PROGRAMS) $(MANS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(drivertabledir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-noinstLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-drivertableDATA install-man + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-data-hook + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: install-man1 + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-drivertableDATA \ + uninstall-info-am uninstall-man + +uninstall-man: uninstall-man1 + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-noinstLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am \ + install-data-hook install-drivertableDATA install-exec \ + install-exec-am install-info install-info-am install-man \ + install-man1 install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ + ps ps-am tags uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-drivertableDATA uninstall-info-am uninstall-man \ + uninstall-man1 + + +install-data-hook: + cd $(DESTDIR)$(datadir)/cdrdao && \ + mv cdrdao.drivers drivers +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/dao/PQChannelEncoder.cc b/dao/PQChannelEncoder.cc new file mode 100644 index 0000000..8590564 --- /dev/null +++ b/dao/PQChannelEncoder.cc @@ -0,0 +1,534 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <stdio.h> +#include <string.h> +#include <assert.h> + +#include "PQChannelEncoder.h" + +#include "Msf.h" +#include "Track.h" +#include "log.h" + + +PQChannelEncoder::PQChannelEncoder() +{ + cueSheet_ = NULL; + cueSheetLen_ = 0; + toc_ = NULL; + tocLen_ = 0; + discType_ = 0; + current_ = NULL; + catalog_ = NULL; + isrc_ = NULL; +} + +PQChannelEncoder::~PQChannelEncoder() +{ + int i; + + for (i = 0; i < tocLen_; i++) { + delete toc_[i]; + } + delete[] toc_; + + delete[] cueSheet_; + delete current_; + delete catalog_; + delete isrc_; +} + + +int PQChannelEncoder::setCueSheet(SubChannel *chan, unsigned char discType, + const unsigned char *sheet, int len, + const Msf &leadInStart) +{ + int tocEnt, i; + + subChannel_ = chan; + + // Convert toc type to decimal numbers so that they look like the + // corresponding hex value when stored as BCD in the sub-channel + switch (discType) { + case 0: + break; + case 0x10: + discType = 10; + break; + case 0x20: + discType = 20; + break; + default: + log_message(-3, "Illegal disc type."); + return 1; + } + + if ((len % sizeof(CueSheetEntry)) != 0) { + log_message(-3, "Illegal cue sheet length."); + return 1; + } + + discType_ = discType; + + cueSheetLen_ = len / sizeof(CueSheetEntry); + cueSheet_ = new CueSheetEntry[cueSheetLen_ + 1]; + memcpy(cueSheet_, sheet, len); + // mark end of queue sheet with a zeroed entry + memset(cueSheet_ + cueSheetLen_, 0, sizeof(CueSheetEntry)); + + // create some sub channel objects + catalog_ = subChannel_->makeSubChannel(SubChannel::QMODE2); + isrc_ = subChannel_->makeSubChannel(SubChannel::QMODE3); + current_ = subChannel_->makeSubChannel(SubChannel::QMODE1DATA); + + if (analyzeCueSheet() != 0) { + return 1; + } + + // create PQ sub channels for toc in lead-in + tocLen_ = lastTrackNr_ - firstTrackNr_ + 1 + 3/*A0, A1, A2*/; + toc_ = new SubChannel*[tocLen_]; + + for (i = 0; i < tocLen_; i++) { + toc_[i] = subChannel_->makeSubChannel(SubChannel::QMODE1TOC); + } + + CueSheetEntry *run; + for (run = actCueSheetEntry_, tocEnt = 0; + (run->ctlAdr & 0x0f) != 1 || run->trackNr != 0xaa; run++) { + if ((run->ctlAdr & 0x0f) == 1 && run->trackNr > 0 && run->trackNr <= 99 && + run->indexNr == 1) { + toc_[tocEnt]->ctl(run->ctlAdr & 0xf0); + toc_[tocEnt]->point(run->trackNr); + toc_[tocEnt]->pmin(run->min); + toc_[tocEnt]->psec(run->sec); + toc_[tocEnt]->pframe(run->frame); + tocEnt++; + } + } + + toc_[tocEnt]->point(0xa0); + toc_[tocEnt]->pmin(firstTrackNr_); + toc_[tocEnt]->psec(discType_); + toc_[tocEnt]->ctl(firstTrackCtlAdr_ & 0xf0); + tocEnt++; + + toc_[tocEnt]->point(0xa1); + toc_[tocEnt]->pmin(lastTrackNr_); + toc_[tocEnt]->ctl(lastTrackCtlAdr_ & 0xf0); + tocEnt++; + + toc_[tocEnt]->point(0xa2); + toc_[tocEnt]->pmin(leadOutStart_.min()); + toc_[tocEnt]->psec(leadOutStart_.sec()); + toc_[tocEnt]->pframe(leadOutStart_.frac()); + toc_[tocEnt]->ctl(leadOutCtlAdr_ & 0xf0); + tocEnt++; + + assert(tocEnt == tocLen_); + + // setup encoder dynamic data + abslba_ = leadInStart.lba() - 450150; + trlba_ = 0; + writeIsrc_ = 0; + deferredCatalog_ = 0; + deferredIsrc_ = 0; + + actTocEnt_ = actTocCount_ = 0; + + run = nextCueSheetEntry(actCueSheetEntry_, 1); + assert(run != NULL); + nextTransitionLba_ = Msf(run->min, run->sec, run->frame).lba() - 150; + + run = nextCueSheetEntry(actCueSheetEntry_, firstTrackNr_, 1); + assert(run != NULL); + nextTrackStartLba_ = Msf(run->min, run->sec, run->frame).lba() - 150; + + return 0; +} + + +int PQChannelEncoder::analyzeCueSheet() +{ + int i; + CueSheetEntry *ent; + int prevTrackNr = -1; + long prevLba = -1; + long lba; + + firstTrackNr_ = 0; + firstTrackCtlAdr_ = 0; + lastTrackNr_ = 0; + lastTrackCtlAdr_ = 0; + leadOutStart_ = 0; + leadOutCtlAdr_ = 0; + actCueSheetEntry_ = NULL; + writeCatalog_ = 0; + + for (ent = cueSheet_, i = 0; i < cueSheetLen_; ent++, i++) { + + switch (ent->ctlAdr & 0x0f) { + case 1: + if (ent->min > 99 || ent->sec > 59 || ent->frame > 74) { + log_message(-3, "Illegal time field value at cue sheet entry: %d", + i); + return 1; + } + + if (ent->trackNr == 0) { // indicates lead-in + if (i == 0 || (writeCatalog_ && i == 2)) { // must be first entry + actCueSheetEntry_ = ent; + } + else { + log_message(-3, "Illegal track number at cue sheet entry: %d", i); + return 1; + } + } + else if (ent->trackNr == 0xaa) { // indicates lead-out + if (i == cueSheetLen_ - 1) { // must be last entry + leadOutStart_ = Msf(ent->min, ent->sec, ent->frame); + leadOutCtlAdr_ = ent->ctlAdr; + } + else { + log_message(-3, "Illegal track number at cue sheet entry: %d", i); + return 1; + } + } + else if (ent->trackNr <= 99) { // data track + if (firstTrackNr_ == 0) { + firstTrackNr_ = ent->trackNr; + firstTrackCtlAdr_ = ent->ctlAdr; + prevTrackNr = ent->trackNr; + } + else { + if (ent->trackNr != prevTrackNr && ent->trackNr != prevTrackNr + 1) { + log_message(-3, + "Wrong track number sequence at cue sheet entry: %d", i); + return 1; + } + prevTrackNr = ent->trackNr; + } + lastTrackNr_ = ent->trackNr; + lastTrackCtlAdr_ = ent->ctlAdr; + } + else { + log_message(-3, "Illegal track number at cue sheet entry: %d", i); + return 1; + } + + if (ent->trackNr != 0) { + lba = Msf(ent->min, ent->sec, ent->frame).lba(); + if (lba <= prevLba) { + log_message(-3, + "Time field does not increase at cue sheet entry: %d", i); + return 1; + } + prevLba = lba; + } + break; + + case 2: + if (i != 0) { + log_message(-3, "Catalog number must be first cue sheet entry."); + return 1; + } + if ((cueSheet_[1].ctlAdr & 0x0f) != 2) { + log_message(-3, "Missing second catalog number entry."); + return 1; + } + writeCatalog_ = 1; + catalog_->catalog(ent->trackNr, ent->indexNr, ent->dataForm, ent->scms, + ent->min, ent->sec, ent->frame, cueSheet_[1].trackNr, + cueSheet_[1].indexNr, cueSheet_[1].dataForm, + cueSheet_[1].scms, cueSheet_[1].min, cueSheet_[1].sec); + // skip next entry + ent++; + i++; + break; + + case 3: + if (((ent + 1)->ctlAdr & 0x0f) != 3) { + log_message(-3, "Missing second ISRC code entry."); + return 1; + } + + // skip next entry + ent++; + i++; + break; + default: + log_message(-3, "Illegal adr field at cue sheet entry: %d.", i); + return 1; + break; + } + } + + if (actCueSheetEntry_ == NULL) { + log_message(-3, "Cue sheet contains no lead-in entry."); + return 1; + } + + if (leadOutStart_.lba() == 0) { + log_message(-3, "Cue sheet contains no lead-out entry."); + return 1; + } + + if (firstTrackNr_ == 0) { + log_message(-3, "Cue sheet contains no data track."); + return 1; + } + + return 0; +} + + +void PQChannelEncoder::encode(long lba, unsigned char *out, long blocks) +{ + long clen = subChannel_->dataLength(); + const SubChannel *chan; + long i; + + for (i = 0; i < blocks; i++, lba++) { + chan = encodeSubChannel(lba); + memcpy(out, chan->data(), clen); + out += clen; + } +} + + + +const SubChannel *PQChannelEncoder::encodeSubChannel(long lba) +{ + int newTransition = 0; + SubChannel *chan = NULL; + + // check consistency of internal lba with external lba + assert(lba == abslba_); + + if (lba == nextTransitionLba_) { + // switch to next transition + //log_message(3, "Switching to next transition at lba: %ld", lba); + nextTransition(); + newTransition = 1; + } + + if (actCueSheetEntry_->trackNr == 0) { + // lead-in sector + chan = toc_[actTocEnt_]; + + Msf m(trlba_); + chan->min(m.min()); + chan->sec(m.sec()); + chan->frame(m.frac()); + + // advance to next to entry + if (++actTocCount_ == 3) { + actTocCount_ = 0; + if (++actTocEnt_ == tocLen_) { + actTocEnt_ = 0; + } + } + } + else { + // data or lead-out sector + + // Q channel setup + + // catalog number + if (writeCatalog_ && + (deferredCatalog_ || (abslba_ % 90) == 0)) { + if (newTransition) { + deferredCatalog_ = 1; + } + else { + deferredCatalog_ = 0; + chan = catalog_; + chan->aframe(Msf(abslba_ + 150).frac()); + } + } + + // ISRC code + if (writeIsrc_ && + (deferredIsrc_ || (abslba_ % 90) == 50 || (abslba_ % 90) == -40)) { + if (newTransition) { + deferredIsrc_ = 1; + } + else { + deferredIsrc_ = 0; + chan = isrc_; + chan->aframe(Msf(abslba_ + 150).frac()); + } + } + + if (chan == NULL) { + // Current position + chan = current_; + + Msf m(trlba_ < 0 ? -trlba_ : trlba_); + chan->min(m.min()); + chan->sec(m.sec()); + chan->frame(m.frac()); + + m = Msf(abslba_ + 150); + chan->amin(m.min()); + chan->asec(m.sec()); + chan->aframe(m.frac()); + } + + + // P channel setup + if (trlba_ <= 0 || + (abslba_ >= nextTrackStartLba_ - 150 && + abslba_ <= nextTrackStartLba_)) { + // set P channel flag in pre-gap and 2 seconds before next track starts + chan->pChannel(1); + } + else if (abslba_ >= leadOutStart_.lba() ) { + // P channel flag is 0 2 secs from start of lead-out, after that + // flag alternates at 2 Hz. + chan->pChannel(((trlba_ - 150) % 38) < 19 ? 1 : 0); + } + else { + chan->pChannel(0); + } + } + + abslba_++; + trlba_++; + + assert(chan != NULL); + chan->calcCrc(); + + return chan; +} + +void PQChannelEncoder::nextTransition() +{ + CueSheetEntry *nextEnt, *ent , *ent1; + + nextEnt = nextCueSheetEntry(actCueSheetEntry_, 1); + assert(nextEnt != NULL); + + if (nextEnt->trackNr != actCueSheetEntry_->trackNr) { + // new track started + + // check for ISRC code cue sheet entry + if ((ent = nextCueSheetEntry(actCueSheetEntry_, 3)) != NULL && + ent->trackNr == nextEnt->trackNr) { + ent1 = ent + 1; + isrc_->isrc(ent->indexNr, ent->dataForm, ent->scms, ent->min, ent->sec, + ent->frame, ent1->indexNr, ent1->dataForm, ent1->scms, + ent1->min, ent1->sec, ent1->frame); + writeIsrc_ = 1; + } + else { + writeIsrc_ = 0; + } + deferredIsrc_ = 0; + + // setup 'trlba' + if (nextEnt->indexNr == 0) { + // track has a pre-gap -> determine length + ent = nextCueSheetEntry(nextEnt, nextEnt->trackNr, 1); + assert(ent != NULL); + + trlba_ = Msf(nextEnt->min, nextEnt->sec, nextEnt->frame).lba() - + Msf(ent->min, ent->sec, ent->frame).lba(); + } + else { + trlba_ = 0; + } + } + + actCueSheetEntry_ = nextEnt; + + current_->ctl(actCueSheetEntry_->ctlAdr & 0xf0); + current_->trackNr(actCueSheetEntry_->trackNr); + current_->indexNr(actCueSheetEntry_->indexNr); + + if (writeCatalog_) + catalog_->ctl(actCueSheetEntry_->ctlAdr & 0xf0); + + if (writeIsrc_) + isrc_->ctl(actCueSheetEntry_->ctlAdr & 0xf0); + + if (actCueSheetEntry_->trackNr != 0xaa) { + // find next transition point + + ent = nextCueSheetEntry(actCueSheetEntry_, 1); + assert(ent != NULL); + nextTransitionLba_ = Msf(ent->min, ent->sec, ent->frame).lba() - 150; + + if (actCueSheetEntry_->indexNr == 1) { + // find next track start lba + if (actCueSheetEntry_->trackNr == lastTrackNr_) + ent = nextCueSheetEntry(actCueSheetEntry_, 0xaa, 1); + else + ent = nextCueSheetEntry(actCueSheetEntry_, + actCueSheetEntry_->trackNr + 1, 1); + assert(ent != NULL); + + nextTrackStartLba_ = Msf(ent->min, ent->sec, ent->frame).lba() - 150; + } + } +} + +CueSheetEntry *PQChannelEncoder::nextCueSheetEntry(CueSheetEntry *act, + int adr) +{ + if (act->trackNr == 0xaa) { + return NULL; + } + + act++; + + while (act->ctlAdr != 0) { + if ((act->ctlAdr & 0x0f) == adr) { + return act; + } + act++; + } + + return NULL; +} + +CueSheetEntry *PQChannelEncoder::nextCueSheetEntry(CueSheetEntry *act, + int trackNr, int indexNr) +{ + if (act->trackNr == 0xaa) { + return NULL; + } + + act++; + + while (act->ctlAdr != 0) { + if ((act->ctlAdr & 0x0f) == 1 && act->trackNr == trackNr && + act->indexNr == indexNr) { + return act; + } + act++; + } + + return NULL; +} + + diff --git a/dao/PQChannelEncoder.h b/dao/PQChannelEncoder.h new file mode 100644 index 0000000..4b4da19 --- /dev/null +++ b/dao/PQChannelEncoder.h @@ -0,0 +1,116 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __PQ_CHANNEL_ENCODER_H__ +#define __PQ_CHANNEL_ENCODER_H__ + +#include "Msf.h" +#include "SubChannel.h" + +struct CueSheetEntry { + unsigned char ctlAdr; + unsigned char trackNr; + unsigned char indexNr; + unsigned char dataForm; + unsigned char scms; + unsigned char min; + unsigned char sec; + unsigned char frame; +}; + +class PQChannelEncoder { +public: + struct SessionInfo { + // required for all sessions + int sessionNr; + long leadInStart; + long leadInLen; + long leadOutLen; + + // required for all sessions of a multi session disk + Msf lastLeadoutStart; + + // required for 1st session of a multi session disk + int cdrw; + Msf atipLeadinStart; + unsigned char optimumRecordingPower; + + // required for a CD-RW for 1st session of a multi session disk + unsigned char atipA1[3]; + }; + + PQChannelEncoder(); + ~PQChannelEncoder(); + + // sets cue sheet and initializes the module, 'len' is length of cure + // sheet in bytes + int setCueSheet(SubChannel *, unsigned char discType, + const unsigned char *, int len, + const Msf &leadInStart); + + // encodes 'blocks' blocks of data in 'in' and places them appended by + // PQ sub channel data in caller provided buffer 'out' + void encode(long lba, unsigned char *out, long blocks); + +private: + SubChannel *subChannel_; // template for all sub channel objects + + CueSheetEntry *cueSheet_; + int cueSheetLen_; + unsigned char discType_; + + int firstTrackNr_; + int lastTrackNr_; + Msf leadOutStart_; + + unsigned char firstTrackCtlAdr_; + unsigned char lastTrackCtlAdr_; + unsigned char leadOutCtlAdr_; + + CueSheetEntry *actCueSheetEntry_; + long trlba_; // track relative lba + long abslba_; // absolute lba on disc + long nextTransitionLba_; + long nextTrackStartLba_; + + SubChannel **toc_; + int tocLen_; + int actTocEnt_; // actual toc entry + int actTocCount_; // counter for reapeating each toc entry three times + + SubChannel *catalog_; + int writeCatalog_; + int deferredCatalog_; + + SubChannel *isrc_; + int writeIsrc_; + int deferredIsrc_; + + SubChannel *current_; + + int analyzeCueSheet(); + const SubChannel *encodeSubChannel(long lba); + void nextTransition(); + CueSheetEntry *nextCueSheetEntry(CueSheetEntry *act, int adr); + CueSheetEntry *nextCueSheetEntry(CueSheetEntry *act, int trackNr, + int indexNr); + +}; + +#endif diff --git a/dao/PQSubChannel16.cc b/dao/PQSubChannel16.cc new file mode 100644 index 0000000..83d4be0 --- /dev/null +++ b/dao/PQSubChannel16.cc @@ -0,0 +1,432 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "PQSubChannel16.h" + +#include <stdio.h> +#include <string.h> +#include <assert.h> + +#include "log.h" + +PQSubChannel16::PQSubChannel16() +{ + memset(data_, 0, 16); + type_ = QMODE1DATA; +} + + +PQSubChannel16::~PQSubChannel16() +{ +} + +SubChannel *PQSubChannel16::makeSubChannel(Type t) +{ + PQSubChannel16 *chan = new PQSubChannel16; + + chan->type_ = t; + + switch (t) { + case QMODE1TOC: + case QMODE1DATA: + chan->data_[0] = 0x01; + break; + + case QMODE2: + chan->data_[0] = 0x02; + break; + + case QMODE3: + chan->data_[0] = 0x03; + break; + + case QMODE5TOC: + chan->data_[0] = 0x05; + break; + + case QMODE_ILLEGAL: + chan->data_[0] = 0x00; + break; + } + + return chan; +} + +void PQSubChannel16::init(unsigned char *buf) +{ + memcpy(data_, buf, 16); + + switch (data_[0] & 0x0f) { + case 1: + type_ = QMODE1DATA; + break; + + case 2: + type_ = QMODE2; + break; + + case 3: + type_ = QMODE3; + break; + + case 5: + type_ = QMODE5TOC; + break; + + default: + type_ = QMODE_ILLEGAL; + break; + } +} + +SubChannel *PQSubChannel16::makeSubChannel(unsigned char *buf) +{ + PQSubChannel16 *chan = new PQSubChannel16; + + chan->init(buf); + + return chan; +} + + +const unsigned char *PQSubChannel16::data() const +{ + return data_; +} + +long PQSubChannel16::dataLength() const +{ + return 16; +} + +// calculate the crc over Q sub channel bytes 0-9 and stores it in byte 10,11 +void PQSubChannel16::calcCrc() +{ + register unsigned short crc = 0; + register int i; + + for (i = 0; i < 10; i++) { + crc = crctab[(crc >> 8) ^ data_[i]] ^ (crc << 8); + } + + data_[10] = crc >> 8; + data_[11] = crc; +} + +int PQSubChannel16::checkCrc() const +{ + register unsigned short crc = 0; + register int i; + + if (!crcValid_) { + return 1; + } + + for (i = 0; i < 10; i++) { + crc = crctab[(crc >> 8) ^ data_[i]] ^ (crc << 8); + } + + if (data_[10] == (crc >> 8) && data_[11] == (crc & 0xff)) + return 1; + else + return 0; +} + +// returns Q type +SubChannel::Type PQSubChannel16::type() const +{ + return type_; +} + +// set Q type +void PQSubChannel16::type(unsigned char type) +{ + switch (type & 0x0f) { + case 1: + type_ = QMODE1DATA; + break; + + case 2: + type_ = QMODE2; + break; + + case 3: + type_ = QMODE3; + break; + + case 5: + type_ = QMODE5TOC; + break; + + default: + type_ = QMODE_ILLEGAL; + break; + } + + data_[0] &= 0xf0; + data_[0] |= type & 0x0f; +} + +// sets P channel bit +void PQSubChannel16::pChannel(int f) +{ + data_[15] = f != 0 ? 0x80 : 0; +} + + +// function for setting various Q sub channel fields + +void PQSubChannel16::ctl(int c) +{ + assert((c & 0x0f) == 0); + + data_[0] &= 0x0f; + data_[0] |= c & 0xf0; +} + +unsigned char PQSubChannel16::ctl() const +{ + return data_[0] >> 4; +} + +void PQSubChannel16::trackNr(int t) +{ + assert(type_ == QMODE1DATA); + data_[1] = bcd(t); +} + +int PQSubChannel16::trackNr() const +{ + assert(type_ == QMODE1DATA); + return bcd2int(data_[1]); +} + +void PQSubChannel16::indexNr(int i) +{ + assert(type_ == QMODE1DATA); + data_[2] = bcd(i); +} + +int PQSubChannel16::indexNr() const +{ + assert(type_ == QMODE1DATA); + return bcd2int(data_[2]); +} + +void PQSubChannel16::point(int p) +{ + assert(type_ == QMODE1TOC || type_ == QMODE5TOC); + data_[2] = bcd(p); +} + +void PQSubChannel16::min(int m) +{ + assert(type_ == QMODE1TOC || type_ == QMODE1DATA || type_ == QMODE5TOC); + data_[3] = bcd(m); +} + +int PQSubChannel16::min() const +{ + assert(type_ == QMODE1TOC || type_ == QMODE1DATA || type_ == QMODE5TOC); + return bcd2int(data_[3]); +} + +void PQSubChannel16::sec(int s) +{ + assert(type_ == QMODE1TOC || type_ == QMODE1DATA || type_ == QMODE5TOC); + data_[4] = bcd(s); +} + +int PQSubChannel16::sec() const +{ + assert(type_ == QMODE1TOC || type_ == QMODE1DATA || type_ == QMODE5TOC); + return bcd2int(data_[4]); +} + +void PQSubChannel16::frame(int f) +{ + assert(type_ == QMODE1TOC || type_ == QMODE1DATA || type_ == QMODE5TOC); + data_[5] = bcd(f); +} + +int PQSubChannel16::frame() const +{ + assert(type_ == QMODE1TOC || type_ == QMODE1DATA || type_ == QMODE5TOC); + return bcd2int(data_[5]); +} + +void PQSubChannel16::zero(int z) +{ + assert(type_ == QMODE5TOC); + data_[6] = bcd(z); +} + +void PQSubChannel16::amin(int am) +{ + assert(type_ == QMODE1DATA); + data_[7] = bcd(am); +} + +int PQSubChannel16::amin() const +{ + assert(type_ == QMODE1DATA); + return bcd2int(data_[7]); +} + +void PQSubChannel16::asec(int as) +{ + assert(type_ == QMODE1DATA); + data_[8] = bcd(as); +} + +int PQSubChannel16::asec() const +{ + assert(type_ == QMODE1DATA); + return bcd2int(data_[8]); +} + +void PQSubChannel16::aframe(int af) +{ + assert(type_ == QMODE1DATA || type_ == QMODE2 || type_ == QMODE3); + data_[9] = bcd(af); +} + +int PQSubChannel16::aframe() const +{ + assert(type_ == QMODE1DATA || type_ == QMODE2 || type_ == QMODE3); + return bcd2int(data_[9]); +} + +void PQSubChannel16::pmin(int pm) +{ + assert(type_ == QMODE1TOC || type_ == QMODE5TOC); + data_[7] = bcd(pm); +} + +void PQSubChannel16::psec(int ps) +{ + assert(type_ == QMODE1TOC || type_ == QMODE5TOC); + data_[8] = bcd(ps); +} + +void PQSubChannel16::pframe(int pf) +{ + assert(type_ == QMODE1TOC || type_ == QMODE5TOC); + data_[9] = bcd(pf); +} + +void PQSubChannel16::catalog(char n1, char n2, char n3, char n4, char n5, + char n6, char n7, char n8, char n9, char n10, + char n11, char n12, char n13) +{ + assert(type_ == QMODE2); + + encodeCatalogNumber(data_ + 1, n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, + n11, n12, n13); + data_[8] = 0; +} + +const char *PQSubChannel16::catalog() const +{ + static char buf[14]; + + assert(type_ == QMODE2); + + decodeCatalogNumber(data_ + 1, &buf[0], &buf[1], &buf[2], &buf[3], &buf[4], + &buf[5], &buf[6], &buf[7], &buf[8], &buf[9], &buf[10], + &buf[11], &buf[12]); + + buf[13] = 0; + + return buf; +} + +void PQSubChannel16::isrc(char c1, char c2, char o1, char o2, char o3, + char y1, char y2, char s1, char s2, char s3, + char s4, char s5) +{ + assert(type_ == QMODE3); + + encodeIsrcCode(data_ + 1, c1, c2, o1, o2, o3, y1, y2, s1, s2, s3, s4, s5); +} + + +const char *PQSubChannel16::isrc() const +{ + static char buf[13]; + + assert(type_ == QMODE3); + + decodeIsrcCode(data_ + 1, &buf[0], &buf[1], &buf[2], &buf[3], &buf[4], + &buf[5], &buf[6], &buf[7], &buf[8], &buf[9], &buf[10], + &buf[11]); + buf[12] = 0; + + return buf; +} + + +void PQSubChannel16::print() const +{ + if (type_ != QMODE_ILLEGAL) + log_message(0, "P:%02x ", data_[15]); + + switch (type_) { + case QMODE1TOC: + case QMODE1DATA: + case QMODE5TOC: + log_message(0, "Q: (%02x) %02x,%02x %02x:%02x:%02x %02x %02x:%02x:%02x ", + data_[0], data_[1], data_[2], data_[3], data_[4], data_[5], + data_[6], data_[7], data_[8], data_[9]); + break; + case QMODE2: + log_message(0, "Q: (%02x) MCN: %s %02x ", data_[0], catalog(), data_[9]); + break; + case QMODE3: + log_message(0, "Q: (%02x) ISRC: %s %02x ", data_[0], isrc(), data_[9]); + break; + case QMODE_ILLEGAL: + log_message(0, "INVALID QMODE: %02x", data_[0]); + break; + } + + if (type_ != QMODE_ILLEGAL) + log_message(0, "%04x %d", (data_[10] << 8) | data_[11], checkCrc()); +} + +int PQSubChannel16::checkConsistency() +{ + switch (type_) { + case QMODE1DATA: + if (!isBcd(data_[3]) || !isBcd(data_[4]) || !isBcd(data_[5]) || + !isBcd(data_[7]) || !isBcd(data_[8]) || !isBcd(data_[9])) + return 0; + break; + + case QMODE1TOC: + case QMODE2: + case QMODE3: + case QMODE5TOC: + case QMODE_ILLEGAL: + // no checks, yet + break; + } + + return SubChannel::checkConsistency(); +} diff --git a/dao/PQSubChannel16.h b/dao/PQSubChannel16.h new file mode 100644 index 0000000..94d2a0a --- /dev/null +++ b/dao/PQSubChannel16.h @@ -0,0 +1,129 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * $Log: PQSubChannel16.h,v $ + * Revision 1.3 2002/06/29 17:23:09 andreasm + * Some cosmetic fixes. + * + * Revision 1.2 2000/12/17 10:51:22 andreasm + * Default verbose level is now 2. Adaopted message levels to have finer + * grained control about the amount of messages printed by cdrdao. + * Added CD-TEXT writing support to the GenericMMCraw driver. + * Fixed CD-TEXT cue sheet creating for the GenericMMC driver. + * + * Revision 1.1.1.1 2000/02/05 01:35:04 llanero + * Uploaded cdrdao 1.1.3 with pre10 patch applied. + * + * Revision 1.4 1999/04/05 11:04:48 mueller + * Added decoding of media catalog number and ISRC code. + * + * Revision 1.3 1999/03/27 20:58:55 mueller + * Added various access functions. + * + * Revision 1.2 1998/08/30 19:10:32 mueller + * Added handling of Catalog Number and ISRC codes. + * + * Revision 1.1 1998/08/29 21:31:36 mueller + * Initial revision + * + * + */ + +#ifndef __PQ_SUB_CHANNEL_16_H__ +#define __PQ_SUB_CHANNEL_16_H__ + +#include "SubChannel.h" + +class PQSubChannel16 : public SubChannel { +public: + PQSubChannel16(); + virtual ~PQSubChannel16(); + + // virtual constructors: + // create sub channel with specified q-mode + SubChannel *makeSubChannel(Type); + // create sub channel with reading sub channel data from given buffer + SubChannel *makeSubChannel(unsigned char *); + + // initialize sub-channel from given buffer (16 bytes) + void init(unsigned char *); + + void type(unsigned char); // set Q type + Type type() const; // returns Q mode type + + long dataLength() const; // returns number of sub channel bytes + + void pChannel(int); // sets P channel bit + + void ctl(int); // sets control flags + unsigned char ctl() const; // return control nibbles in bits 0-3 + + void trackNr(int); // sets track number (QMODE1DATA) + int trackNr() const; // returns track number (QMODE1DATA) + + void indexNr(int); // sets index number (QMODE1DATA) + int indexNr() const; // returns index number (QMODE1DATA) + + void point(int); // sets point filed (QMODE1TOC) + + void min(int); // track relative time (QMODE1TOC, QMODE1DATA) + int min() const; + + void sec(int); // track relative time (QMODE1TOC, QMODE1DATA) + int sec() const; + + void frame(int); // track relative time (QMODE1TOC, QMODE1DATA) + int frame() const; + + void amin(int); // absolute time (QMODE1DATA) + int amin() const; + + void asec(int); // absolute time (QMODE1DATA) + int asec() const; + + void aframe(int); // absolute time (QMODE1DATA) + int aframe() const; + + void pmin(int); // track start time (QMODE1TOC) + void psec(int); // track start time (QMODE1TOC) + void pframe(int); // track start time (QMODE1TOC) + void zero(int); // zero field (QMODE5TOC) + + void catalog(char, char, char, char, char, char, char, char, char, char, + char, char, char); + const char *catalog() const; + + void isrc(char, char, char, char, char, char, char, char, char, char, char, + char); + const char *isrc() const; + + void print() const; + + void calcCrc(); // calculates crc and stores it in crc fields + int checkCrc() const; + + int checkConsistency(); + + const unsigned char *data() const; + +protected: + unsigned char data_[16]; // P and Q sub channel data +}; + +#endif diff --git a/dao/PWSubChannel96.cc b/dao/PWSubChannel96.cc new file mode 100644 index 0000000..54eba68 --- /dev/null +++ b/dao/PWSubChannel96.cc @@ -0,0 +1,537 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "PWSubChannel96.h" + +#include <stdio.h> +#include <string.h> +#include <assert.h> + +#include "log.h" + +PWSubChannel96::PWSubChannel96() +{ + memset(data_, 0, 96); + type_ = QMODE1DATA; +} + +PWSubChannel96::PWSubChannel96(unsigned char *buf) +{ + init(buf); +} + +void PWSubChannel96::init(unsigned char *buf) +{ + memcpy(data_, buf, 96); + + switch (getChannelByte(Q_CHAN, 0) & 0x0f) { + case 1: + type_ = QMODE1DATA; + break; + + case 2: + type_ = QMODE2; + break; + + case 3: + type_ = QMODE3; + break; + + case 5: + type_ = QMODE5TOC; + break; + + default: + type_ = QMODE_ILLEGAL; + break; + } +} + +PWSubChannel96::~PWSubChannel96() +{ +} + +SubChannel *PWSubChannel96::makeSubChannel(Type t) +{ + PWSubChannel96 *chan = new PWSubChannel96; + + chan->type_ = t; + + switch (t) { + case QMODE1TOC: + case QMODE1DATA: + chan->setChannelByte(Q_CHAN, 0, 0x01); + break; + + case QMODE2: + chan->setChannelByte(Q_CHAN, 0, 0x02); + break; + + case QMODE3: + chan->setChannelByte(Q_CHAN, 0, 0x03); + break; + + case QMODE5TOC: + chan->setChannelByte(Q_CHAN, 0, 0x05); + break; + + case QMODE_ILLEGAL: + chan->setChannelByte(Q_CHAN, 0, 0x00); + break; + } + + return chan; +} + +SubChannel *PWSubChannel96::makeSubChannel(unsigned char *buf) +{ + PWSubChannel96 *chan = new PWSubChannel96(buf); + + return chan; +} + +void PWSubChannel96::setChannelByte(Channel chan, int byteNr, + unsigned char value) +{ + assert(byteNr >= 0 && byteNr < 12); + + register unsigned char setMask = 1 << chan; + register unsigned char clearMask = ~setMask; + + register unsigned char *p = data_ + (byteNr * 8); + register int i; + + for (i = 0; i < 8; i++) { + if (value & 0x80) + *p |= setMask; + else + *p &= clearMask; + + p++; + value <<= 1; + } +} + +unsigned char PWSubChannel96::getChannelByte(Channel chan, int byteNr) const +{ + assert(byteNr >= 0 && byteNr < 12); + + register unsigned char testMask = 1 << chan; + register const unsigned char *p = data_ + (byteNr * 8); + register unsigned char val = 0; + register int i; + + for (i = 0; i < 8; i++) { + val <<= 1; + if ((*p) & testMask) + val |= 0x01; + + p++; + } + + return val; +} + +const unsigned char *PWSubChannel96::data() const +{ + return data_; +} + +long PWSubChannel96::dataLength() const +{ + return 96; +} + +// calculate the crc over Q sub channel bytes 0-9 and stores it in byte 10,11 +void PWSubChannel96::calcCrc() +{ + register unsigned short crc = 0; + register int i; + + for (i = 0; i < 10; i++) { + register unsigned char data = getChannelByte(Q_CHAN, i); + crc = crctab[(crc >> 8) ^ data] ^ (crc << 8); + } + + crc = ~crc; + + setChannelByte(Q_CHAN, 10, crc >> 8); + setChannelByte(Q_CHAN, 11, crc); +} + +int PWSubChannel96::checkCrc() const +{ + register unsigned short crc = 0; + register int i; + + if (!crcValid_) { + return 1; + } + + for (i = 0; i < 10; i++) { + register unsigned char data = getChannelByte(Q_CHAN, i); + crc = crctab[(crc >> 8) ^ data] ^ (crc << 8); + } + + crc = ~crc; + + if (getChannelByte(Q_CHAN, 10) == (crc >> 8) && + getChannelByte(Q_CHAN, 11) == (crc & 0xff)) + return 1; + else + return 0; +} + + +// sets P channel bit +void PWSubChannel96::pChannel(int f) +{ + register int i; + + if (f != 0) { + for (i = 0; i < 96; i++) + data_[i] |= 0x80; + } + else { + for (i = 0; i < 96; i++) + data_[i] &= 0x7f; + } +} + +// returns Q type +SubChannel::Type PWSubChannel96::type() const +{ + return type_; +} + + +// set Q type +void PWSubChannel96::type(unsigned char type) +{ + switch (type & 0x0f) { + case 1: + type_ = QMODE1DATA; + break; + + case 2: + type_ = QMODE2; + break; + + case 3: + type_ = QMODE3; + break; + + case 5: + type_ = QMODE5TOC; + break; + + default: + type_ = QMODE_ILLEGAL; + break; + } + + register unsigned char val = getChannelByte(Q_CHAN, 0); + + val &= 0xf0; + val |= type & 0x0f; + + setChannelByte(Q_CHAN, 0, val); +} + +// function for setting various Q sub channel fields + +void PWSubChannel96::ctl(int c) +{ + assert((c & 0x0f) == 0); + + register unsigned char val = getChannelByte(Q_CHAN, 0); + + val &= 0x0f; + val |= c & 0xf0; + + setChannelByte(Q_CHAN, 0, val); +} + +unsigned char PWSubChannel96::ctl() const +{ + register unsigned char val = getChannelByte(Q_CHAN, 0); + + return val >> 4; +} + +void PWSubChannel96::trackNr(int t) +{ + assert(type_ == QMODE1DATA); + setChannelByte(Q_CHAN, 1, bcd(t)); +} + +int PWSubChannel96::trackNr() const +{ + assert(type_ == QMODE1DATA); + return bcd2int(getChannelByte(Q_CHAN, 1)); +} + +void PWSubChannel96::indexNr(int i) +{ + assert(type_ == QMODE1DATA); + setChannelByte(Q_CHAN, 2, bcd(i)); +} + +int PWSubChannel96::indexNr() const +{ + assert(type_ == QMODE1DATA); + return bcd2int(getChannelByte(Q_CHAN, 2)); +} + +void PWSubChannel96::point(int p) +{ + assert(type_ == QMODE1TOC || type_ == QMODE5TOC); + setChannelByte(Q_CHAN, 2, bcd(p)); +} + +void PWSubChannel96::min(int m) +{ + assert(type_ == QMODE1TOC || type_ == QMODE1DATA || type_ == QMODE5TOC); + setChannelByte(Q_CHAN, 3, bcd(m)); +} + +int PWSubChannel96::min() const +{ + assert(type_ == QMODE1TOC || type_ == QMODE1DATA || type_ == QMODE5TOC); + return bcd2int(getChannelByte(Q_CHAN, 3)); +} + +void PWSubChannel96::sec(int s) +{ + assert(type_ == QMODE1TOC || type_ == QMODE1DATA || type_ == QMODE5TOC); + setChannelByte(Q_CHAN, 4, bcd(s)); +} + +int PWSubChannel96::sec() const +{ + assert(type_ == QMODE1TOC || type_ == QMODE1DATA || type_ == QMODE5TOC); + return bcd2int(getChannelByte(Q_CHAN, 4)); +} + +void PWSubChannel96::frame(int f) +{ + assert(type_ == QMODE1TOC || type_ == QMODE1DATA || type_ == QMODE5TOC); + setChannelByte(Q_CHAN, 5, bcd(f)); +} + +int PWSubChannel96::frame() const +{ + assert(type_ == QMODE1TOC || type_ == QMODE1DATA || type_ == QMODE5TOC); + return bcd2int(getChannelByte(Q_CHAN, 5)); +} + +void PWSubChannel96::zero(int z) +{ + assert(type_ == QMODE5TOC); + + setChannelByte(Q_CHAN, 6, bcd(z)); +} + +void PWSubChannel96::amin(int am) +{ + assert(type_ == QMODE1DATA); + setChannelByte(Q_CHAN, 7, bcd(am)); +} + +int PWSubChannel96::amin() const +{ + assert(type_ == QMODE1DATA); + return bcd2int(getChannelByte(Q_CHAN, 7)); +} + +void PWSubChannel96::asec(int as) +{ + assert(type_ == QMODE1DATA); + setChannelByte(Q_CHAN, 8, bcd(as)); +} + +int PWSubChannel96::asec() const +{ + assert(type_ == QMODE1DATA); + return bcd2int(getChannelByte(Q_CHAN, 8)); +} + +void PWSubChannel96::aframe(int af) +{ + assert(type_ == QMODE1DATA || type_ == QMODE2 || type_ == QMODE3); + setChannelByte(Q_CHAN, 9, bcd(af)); +} + +int PWSubChannel96::aframe() const +{ + assert(type_ == QMODE1DATA || type_ == QMODE2 || type_ == QMODE3); + return bcd2int(getChannelByte(Q_CHAN, 9)); +} + +void PWSubChannel96::pmin(int pm) +{ + assert(type_ == QMODE1TOC || type_ == QMODE5TOC); + setChannelByte(Q_CHAN, 7, bcd(pm)); +} + +void PWSubChannel96::psec(int ps) +{ + assert(type_ == QMODE1TOC || type_ == QMODE5TOC); + setChannelByte(Q_CHAN, 8, bcd(ps)); +} + +void PWSubChannel96::pframe(int pf) +{ + assert(type_ == QMODE1TOC || type_ == QMODE5TOC); + setChannelByte(Q_CHAN, 9, bcd(pf)); +} + +void PWSubChannel96::catalog(char n1, char n2, char n3, char n4, char n5, + char n6, char n7, char n8, char n9, char n10, + char n11, char n12, char n13) +{ + assert(type_ == QMODE2); + + unsigned char buf[8]; + int i; + + encodeCatalogNumber(buf, n1, n2, n3, n4, n5, n6, n7, n8, n9, n10, n11, n12, + n13); + buf[7] = 0; + + for (i = 0; i < 8; i++) + setChannelByte(Q_CHAN, i + 1, buf[i]); +} + +const char *PWSubChannel96::catalog() const +{ + static char buf[14]; + unsigned char in[7]; + int i; + + for (i = 0; i < 7; i++) + in[i] = getChannelByte(Q_CHAN, i + 1); + + decodeCatalogNumber(in, &buf[0], &buf[1], &buf[2], &buf[3], &buf[4], + &buf[5], &buf[6], &buf[7], &buf[8], &buf[9], &buf[10], + &buf[11], &buf[12]); + + buf[13] = 0; + + return buf; +} + +void PWSubChannel96::isrc(char c1, char c2, char o1, char o2, char o3, + char y1, char y2, char s1, char s2, char s3, + char s4, char s5) +{ + assert(type_ == QMODE3); + + unsigned char buf[8]; + int i; + + encodeIsrcCode(buf, c1, c2, o1, o2, o3, y1, y2, s1, s2, s3, s4, s5); + + for (i = 0; i < 8; i++) + setChannelByte(Q_CHAN, i + 1, buf[i]); +} + +const char *PWSubChannel96::isrc() const +{ + static char buf[13]; + unsigned char in[8]; + int i; + + assert(type_ == QMODE3); + + for (i = 0; i < 8; i++) + in[i] = getChannelByte(Q_CHAN, i + 1); + + decodeIsrcCode(in, &buf[0], &buf[1], &buf[2], &buf[3], &buf[4], + &buf[5], &buf[6], &buf[7], &buf[8], &buf[9], &buf[10], + &buf[11]); + buf[12] = 0; + + return buf; +} + + +void PWSubChannel96::print() const +{ + if (type_ != QMODE_ILLEGAL) + log_message(0, "P:%02x ", getChannelByte(P_CHAN, 0)); + + switch (type_) { + case QMODE1TOC: + case QMODE1DATA: + case QMODE5TOC: + log_message(0, "Q: (%02x) %02x,%02x %02x:%02x:%02x %02x %02x:%02x:%02x ", + getChannelByte(Q_CHAN, 0), getChannelByte(Q_CHAN, 1), + getChannelByte(Q_CHAN, 2), getChannelByte(Q_CHAN, 3), + getChannelByte(Q_CHAN, 4), getChannelByte(Q_CHAN, 5), + getChannelByte(Q_CHAN, 6), getChannelByte(Q_CHAN, 7), + getChannelByte(Q_CHAN, 8), getChannelByte(Q_CHAN, 9)); + break; + case QMODE2: + log_message(0, "Q: (%02x) MCN: %s %02x ", getChannelByte(Q_CHAN, 0), + catalog(), getChannelByte(Q_CHAN, 9)); + break; + case QMODE3: + log_message(0, "Q: (%02x) ISRC: %s %02x ", getChannelByte(Q_CHAN, 0), + isrc(), getChannelByte(Q_CHAN, 9)); + break; + case QMODE_ILLEGAL: + log_message(0, "INVALID QMODE: %02x", getChannelByte(Q_CHAN, 0)); + break; + } + + if (type_ != QMODE_ILLEGAL) + log_message(0, "%04x %d", + (getChannelByte(Q_CHAN, 10) << 8) | getChannelByte(Q_CHAN, 11), + checkCrc()); +} + +// sets R-W channel bits from 72 byte data buffer, used for CD-TEXT +void PWSubChannel96::setRawRWdata(const unsigned char *data) +{ + int i; + + for (i = 0; i < 96; i += 4) { + data_[i] |= (data[0] >> 2) & 0x3f; + data_[i + 1] |= ((data[0] << 4) & 0x30) | ((data[1] >> 4) & 0x0f); + data_[i + 2] |= ((data[1] << 2) & 0x3c) | ((data[2] >> 6) & 0x03); + data_[i + 3] |= data[2] & 0x3f; + + data += 3; + } +} + +// concatenates the R-W channel bits and writes them to provided 72 byte buffer +void PWSubChannel96::getRawRWdata(unsigned char *data) const +{ + int i; + + for (i = 0; i < 96; i += 4) { + data[0] = ((data_[i] << 2) & 0xfc) | ((data_[i + 1] >> 4) & 0x03); + data[1] = ((data_[i + 1] << 4) & 0xf0) | ((data_[i + 2] >> 2) & 0x0f); + data[2] = ((data_[i + 2] << 6) & 0xc0) | (data_[i + 3] & 0x3f); + + data += 3; + } +} diff --git a/dao/PWSubChannel96.h b/dao/PWSubChannel96.h new file mode 100644 index 0000000..99d7704 --- /dev/null +++ b/dao/PWSubChannel96.h @@ -0,0 +1,139 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * $Log: PWSubChannel96.h,v $ + * Revision 1.2 2000/12/17 10:51:22 andreasm + * Default verbose level is now 2. Adaopted message levels to have finer + * grained control about the amount of messages printed by cdrdao. + * Added CD-TEXT writing support to the GenericMMCraw driver. + * Fixed CD-TEXT cue sheet creating for the GenericMMC driver. + * + * Revision 1.1.1.1 2000/02/05 01:35:05 llanero + * Uploaded cdrdao 1.1.3 with pre10 patch applied. + * + * Revision 1.5 1999/04/05 11:04:48 mueller + * Added decoding of media catalog number and ISRC code. + * + * Revision 1.4 1999/03/27 20:58:55 mueller + * Added various access functions. + * + * Revision 1.3 1998/09/27 19:19:39 mueller + * Added retrieval of control nibbles for track with 'analyzeTrack()'. + * + * Revision 1.2 1998/08/30 19:10:32 mueller + * Added handling of Catalog Number and ISRC codes. + * + * Revision 1.1 1998/08/29 21:32:27 mueller + * Initial revision + * + * + */ + +#ifndef __PW_SUB_CHANNEL_96_H__ +#define __PW_SUB_CHANNEL_96_H__ + +#include "SubChannel.h" + +class PWSubChannel96 : public SubChannel { +public: + + enum Channel { P_CHAN = 7, Q_CHAN = 6 }; + + PWSubChannel96(); + PWSubChannel96(unsigned char *buf); + ~PWSubChannel96(); + + // virtual constructors: + // create sub channel with specified q-mode + SubChannel *makeSubChannel(Type); + // create sub channel with reading sub channel data from given buffer + SubChannel *makeSubChannel(unsigned char *); + + // initialize sub-channel from given buffer (96 bytes) + void init(unsigned char *); + + void type(unsigned char); // set Q type + Type type() const; // returns Q mode type + + long dataLength() const; // returns number of sub channel bytes + + void pChannel(int); // sets P channel bit + + void ctl(int); // sets control flags + unsigned char ctl() const; // return control nibbles in bits 0-3 + + void trackNr(int); // sets track number (QMODE1DATA) + int trackNr() const; // returns track number (QMODE1DATA) + + void indexNr(int); // sets index number (QMODE1DATA) + int indexNr() const; // returns index number (QMODE1DATA) + + void point(int); // sets point filed (QMODE1TOC) + + void min(int); // track relative time (QMODE1TOC, QMODE1DATA) + int min() const; + void sec(int); // track relative time (QMODE1TOC, QMODE1DATA) + int sec() const; + void frame(int); // track relative time (QMODE1TOC, QMODE1DATA) + int frame() const; + + void amin(int); // absolute time (QMODE1DATA) + int amin() const; + + void asec(int); // absolute time (QMODE1DATA) + int asec() const; + + void aframe(int); // absolute time (QMODE1DATA) + int aframe() const; + + void pmin(int); // track start time (QMODE1TOC) + void psec(int); // track start time (QMODE1TOC) + void pframe(int); // track start time (QMODE1TOC) + void zero(int); // zero field (QMODE5TOC) + + // sets raw R-W channels from 72 byte buffer + void setRawRWdata(const unsigned char *); + + // gets raw R-W channels to 72 byte buffer + void getRawRWdata(unsigned char *) const; + + void print() const; + + void calcCrc(); // calculates crc and stores it in crc fields + int checkCrc() const; + + void catalog(char, char, char, char, char, char, char, char, char, char, + char, char, char); + const char *catalog() const; + + void isrc(char, char, char, char, char, char, char, char, char, char, char, + char); + const char *isrc() const; + + const unsigned char *data() const; + +protected: + unsigned char data_[96]; // P - W sub channel data + +private: + void setChannelByte(Channel, int byteNr, unsigned char value); + unsigned char getChannelByte(Channel, int byteNr) const; +}; + +#endif diff --git a/dao/PlextorReader.cc b/dao/PlextorReader.cc new file mode 100644 index 0000000..614804a --- /dev/null +++ b/dao/PlextorReader.cc @@ -0,0 +1,1226 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <unistd.h> +#include <string.h> +#include <assert.h> +#include <errno.h> + +#include "PlextorReader.h" + +#include "Toc.h" +#include "util.h" +#include "log.h" + +#include "PWSubChannel96.h" + +PlextorReader::PlextorReader(ScsiIf *scsiIf, unsigned long options) + : CdrDriver(scsiIf, options) +{ + driverName_ = "Plextor CD-ROM Reader - Version 1.3"; + + speed_ = 0; + simulate_ = false; + audioDataByteOrder_ = 0; + + slow_down_on_read_errors = -1; + transfer_data_before_max_speed = -1; + slow_down_on_vibrations = -1; + + memset(&diskInfo_, 0, sizeof(DiskInfo)); + diskInfo_.valid.empty = 1; + + { + struct + { + int number; + const char *productid; // as obtained through INQUIRY + } models[] = + { + { 1,"CD-ROM PX-4XCH" }, + { 2,"CD-ROM PX-4XCS" }, + { 3,"CD-ROM PX-4XCE" }, + { 4,"CD-ROM PX-6X" }, + { 5,"CD-ROM PX-8X" }, + { 6,"CD-ROM PX-12" }, + { 7,"CD-ROM PX-20" }, + { 8,"CD-ROM PX-32" }, + { 9,"CD-ROM PX-40" }, + { 0,NULL } + }; + int m = 0; + while (models[m].number) + { + if (strncmp(scsiIf_->product(), models[m].productid, + strlen(models[m].productid)) == 0) + break; + else + m++; + } + model_ = models[m].number; // zero if not found + + if (model_ > 0) { + /* Plextor special features initialization */ + unsigned char buf[32]; + unsigned char header[8]; + unsigned char blockdesc[8]; + struct plex_msg { + int value; + const char *msg; + }; + struct plex_msg slowdown_msg[] = { + { -1, "Unsupported"}, + { 0, "Enabled, unit will slow down"}, + { 1, "Disabled, unit won't slow down"} + }; + struct plex_msg trbefmax_msg[] = { + { -1, "Unsupported"}, + { 0, "Disabled, unit will wait for max speed"}, + { 1, "Enabled, unit will transfer as soon as possible"} + }; + /* Read error slowdown seems available for all drives, while + vibration and transfer control only for PX-20 and later + Data is taken from + Mode page 0x31 byte 3 [ x x x x x sl td re ] + re=read errors , if 0 slow down on read errors, 0 default + td=transfer data, if 0 wait for max speed before transfer data, 0 default + sl=if 0 slowdown to avoid vibrations, 0 default + */ + slow_down_on_read_errors = -1; + transfer_data_before_max_speed = -1; + slow_down_on_vibrations = -1; + orig_byte3 = 0; + if (getModePage6 (0x31, buf, 32, header, blockdesc, 1) == 0) { + orig_byte3 = buf[3]; + slow_down_on_read_errors = buf[3] & 0x01; + if (model_ >= 7) { + transfer_data_before_max_speed = (buf[3] & 0x02) >> 1; + slow_down_on_vibrations = (buf[3] & 0x04) >> 2; + } + } + if (options & OPT_PLEX_NOSLOW_ON_ERR) + ReadErrorsSlowDown (0); + if (options & OPT_PLEX_TRANSF_BEF_MAX) + WaitMaxSpeed (0); + if (options & OPT_PLEX_NOSLOW_ON_VIB) + VibrationsSlowDown (0); + log_message(4, "Plextor features status:"); + log_message(4, " Slowdown on read errors: %s", + slowdown_msg[slow_down_on_read_errors+1].msg); + log_message(4, " Slowdown to avoid vibrations: %s", + slowdown_msg[slow_down_on_vibrations+1].msg); + log_message(4, " Transfer data before max speed: %s", + trbefmax_msg[transfer_data_before_max_speed+1].msg); + } + log_message(4, "model number %d\n",model_); + log_message(4, "PRODUCT ID: '%s'\n", scsiIf_->product()); + } +} + +PlextorReader::~PlextorReader () { + /* Only for Plextor units */ + if (model_ > 0) { + unsigned char buf[32]; + unsigned char header[8]; + unsigned char blockdesc[8]; + if (getModePage6 (0x31, buf, 32, header, blockdesc, 1) != 0) + return; + buf[3] = orig_byte3; + setModePage6 (buf, header, blockdesc, 1); + } +} + +int PlextorReader::ReadErrorsSlowDown (int slowdown) { + /* Not supported */ + if (slow_down_on_read_errors == -1 ) return -1; + slowdown ? slowdown = 0 : slowdown = 1; + + unsigned char buf[32]; + unsigned char header[8]; + unsigned char blockdesc[8]; + if (getModePage6 (0x31, buf, 32, header, blockdesc, 1) != 0) + return -1; + if (slowdown) + buf[3] |= 0x01; + if (setModePage6 (buf, header, blockdesc, 1) != 0) + return -1; + slow_down_on_read_errors = slowdown; + return 1; +} + +int PlextorReader::VibrationsSlowDown (int slowdown) { + if (slow_down_on_vibrations == -1) return -1; + slowdown ? slowdown = 0 : slowdown = 1; + + unsigned char buf[32]; + unsigned char header[8]; + unsigned char blockdesc[8]; + if (getModePage6 (0x31, buf, 32, header, blockdesc, 1) != 0) + return -1; + if (slowdown) + buf[3] |= 0x04; + if (setModePage6 (buf, header, blockdesc, 1) != 0) + return -1; + slow_down_on_vibrations = slowdown; + return 1; +} + +int PlextorReader::WaitMaxSpeed (int wait) { + if (transfer_data_before_max_speed == -1) return -1; + wait ? wait = 0 : wait = 1; + + unsigned char buf[32]; + unsigned char header[8]; + unsigned char blockdesc[8]; + if (getModePage6 (0x31, buf, 32, header, blockdesc, 1) != 0) + return -1; + if (wait) + buf[3] |= 0x02; + if (setModePage6 (buf, header, blockdesc, 1) != 0) + return -1; + transfer_data_before_max_speed = wait; + return 1; +} + +// static constructor +CdrDriver *PlextorReader::instance(ScsiIf *scsiIf, unsigned long options) +{ + return new PlextorReader(scsiIf, options); +} + +// sets speed +// return: 0: OK +// 1: illegal speed (n/a; the strategy is to map to a valid speed) +int PlextorReader::speed(int speed) +{ + unsigned short dataLen = 56; + unsigned char data[56]; + char speedvalue=0; + + if (model_ == 0) // not a Plextor device + return 0; + + switch (model_) { + case 4: + speedvalue = (speed-1)/2; + break; + default: + speedvalue = speed/2; + break; + } + + getModePage6((long)0x31,data,dataLen,NULL,NULL,1); + //log_message(0,"page code %0x\n",data[0]); + //log_message(0,"speed value was %d\n",data[2]); + data[2]=speedvalue; + //log_message(0,"new speedvalue %d\n",speedvalue); + setModePage6(data,NULL,NULL,1); + + return 0; +} + +DiskInfo *PlextorReader::diskInfo() +{ + return &diskInfo_; +} + +int PlextorReader::initDao(const Toc *toc) +{ + log_message(-2, "Writing is not supported by this driver."); + return 1; +} + +int PlextorReader::startDao() +{ + return 1; +} + +int PlextorReader::finishDao() +{ + return 1; +} + +void PlextorReader::abortDao() +{ +} + +// tries to read catalog number from disk and adds it to 'toc' +// return: 1 if valid catalog number was found, else 0 + +int PlextorReader::readCatalog(Toc *toc, long startLba, long endLba) +{ + unsigned char cmd[10]; + unsigned short dataLen = 0x30; + unsigned char data[0x30]; + char catalog[14]; + int i; + + // read sub channel information + memset(cmd, 0, 10); + cmd[0] = 0x42; // READ SUB CHANNEL + cmd[2] = 0x40; // get sub channel data + cmd[3] = 0x02; // get media catalog number + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen) != 0) { + log_message(-2, "Cannot read sub channel data."); + return 0; + } + + if (data[0x08] & 0x80) { + for (i = 0; i < 13; i++) { + catalog[i] = data[0x09 + i]; + } + catalog[13] = 0; + + if (toc->catalog(catalog) == 0) { + return 1; + } + } + + return 0; +} + +// plays one audio block starting from given position +void PlextorReader::playAudioBlock(long start, long len) +{ + unsigned char cmd[10]; + + // play one audio block + memset(cmd, 0, 10); + cmd[0] = 0x45; // PLAY AUDIO + cmd[2] = start >> 24; + cmd[3] = start >> 16; + cmd[4] = start >> 8; + cmd[5] = start; + cmd[7] = len >> 8; + cmd[8] = len; + + if (sendCmd(cmd, 10, NULL, 0, NULL, 0) != 0) { + log_message(-2, "Cannot play audio block."); + return; + } +} + +int PlextorReader::analyzeTrack(TrackData::Mode mode, int trackNr, + long startLba, long endLba, + Msf *index, int *indexCnt, long *pregap, + char *isrcCode, unsigned char *ctl) +{ + int ret = analyzeTrackSearch(mode, trackNr, startLba, endLba, + index, indexCnt, pregap, isrcCode, ctl); + + if (mode == TrackData::AUDIO) + readIsrc(trackNr, isrcCode); + else + *isrcCode = 0; + + return ret; +} + +// tries to read ISRC code of given track number and stores it in +// given buffer. +// return: 1 if valid ISRC code was found, else 0 +int PlextorReader::readIsrc(int trackNr, char *buf) +{ + unsigned char cmd[10]; + unsigned short dataLen = 0x30; + unsigned char data[0x30]; + int i; + + // time to finish the last audio play operation + sleep(1); + + buf[0] = 0; + + // read sub channel information + memset(cmd, 0, 10); + cmd[0] = 0x42; // READ SUB CHANNEL + cmd[2] = 0x40; // get sub channel data + cmd[3] = 0x03; // get ISRC code + cmd[6] = trackNr; + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen) != 0) { + log_message(-1, "Cannot read ISRC code."); + return 0; + } + + if (data[0x08] & 0x80) { + for (i = 0; i < 12; i++) { + buf[i] = data[0x09 + i]; + } + buf[12] = 0; + + } + + return 0; +} + +// Reads actual track number, index and relative position from sub channel. +// return: 0 OK, 1: SCSI command failed +int PlextorReader::readSubChannelData(int *trackNr, int *indexNr, + long *relPos, unsigned char *ctl) +{ + unsigned char cmd[10]; + unsigned short dataLen = 0x30; + unsigned char data[0x30]; + + // read sub channel information + memset(cmd, 0, 10); + cmd[0] = 0x42; // READ SUB CHANNEL + cmd[2] = 0x40; // get sub channel data + cmd[3] = 0x01; // get sub Q channel data + cmd[6] = 0; + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen) != 0) { + log_message(-2, "Cannot read sub Q channel data."); + } + + *trackNr = data[6]; + *indexNr = data[7]; + *relPos = 0; + *relPos |= data[0x0c] << 24; + *relPos |= data[0x0d] << 16; + *relPos |= data[0x0e] << 8; + *relPos |= data[0x0f]; + + if (ctl != NULL) { + *ctl = data[5] & 0x0f; + } + + return 0; +} + +// Retrieves track and index at given block address 'lba'. +// Return: 0: OK, 1: SCSI command failed +int PlextorReader::getTrackIndex(long lba, int *trackNr, int *indexNr, + unsigned char *ctl) +{ + long relPos; + + playAudioBlock(lba, 1); + + return readSubChannelData(trackNr, indexNr, &relPos, ctl); +} + +CdRawToc *PlextorReader::getRawToc(int sessionNr, int *len) +{ + unsigned char cmd[10]; + unsigned short dataLen; + unsigned char *data = NULL;; + unsigned char reqData[4]; // buffer for requestion the actual length + unsigned char *p = NULL; + int i, entries; + CdRawToc *rawToc; + + assert(sessionNr >= 1); + + // read disk toc length + memset(cmd, 0, 10); + cmd[0] = 0x43; // READ TOC + cmd[6] = sessionNr; + cmd[8] = 4; + cmd[9] |= 2 << 6; // get Q subcodes + + if (sendCmd(cmd, 10, NULL, 0, reqData, 4) != 0) { + log_message(-2, "Cannot read raw disk toc."); + return NULL; + } + + dataLen = ((reqData[0] << 8) | reqData[1]) + 2; + + log_message(4, "Raw toc data len: %d", dataLen); + + data = new unsigned char[dataLen]; + + // read disk toc + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen) != 0) { + log_message(-2, "Cannot read raw disk toc."); + delete[] data; + return NULL; + } + + entries = (((data[0] << 8) | data[1]) - 2) / 11; + + + rawToc = new CdRawToc[entries]; + + for (i = 0, p = data + 4; i < entries; i++, p += 11 ) { +#if 0 + log_message(0, "%d %02x %02d %2x %02x:%02x:%02x %02x %02x:%02x:%02x", + p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10]); +#endif + rawToc[i].sessionNr = p[0]; + rawToc[i].adrCtl = p[1]; + rawToc[i].point = p[3]; + rawToc[i].pmin = p[8]; + rawToc[i].psec = p[9]; + rawToc[i].pframe = p[10]; + } + + delete[] data; + + *len = entries; + + return rawToc; +} + +long PlextorReader::readTrackData(TrackData::Mode mode, + TrackData::SubChannelMode, + long lba, long len, unsigned char *buf) +{ + unsigned char cmd[10]; + long blockLen = 2340; + long i; + TrackData::Mode actMode; + int ok = 0; + const unsigned char *sense; + int senseLen; + int softError; + + if (setBlockSize(blockLen) != 0) + return 0; + + memset(cmd, 0, 10); + + cmd[0] = 0x28; // READ10 + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + + while (len > 0 && !ok) { + cmd[7] = len >> 8; + cmd[8] = len; + + memset(transferBuffer_, 0, len * blockLen); + switch (sendCmd(cmd, 10, NULL, 0, transferBuffer_, len * blockLen, 0)) { + case 0: + ok = 1; + break; + + case 2: + softError = 0; + sense = scsiIf_->getSense(senseLen); + + if (senseLen > 0x0c) { + if ((sense[2] &0x0f) == 5) { // Illegal request + switch (sense[12]) { + case 0x63: // End of user area encountered on this track + case 0x64: // Illegal mode for this track + softError = 1; + break; + } + } + else if ((sense[2] & 0x0f) == 3) { // Medium error + switch (sense[12]) { + case 0x02: // No seek complete, sector not found + case 0x11: // L-EC error + return -2; + break; + } + } + } + + if (!softError) { + scsiIf_->printError(); + return -1; + } + break; + + default: + log_message(-2, "Read error at LBA %ld, len %ld", lba, len); + return -1; + break; + } + + if (!ok) { + len--; + } + } + + unsigned char *sector = transferBuffer_; + for (i = 0; i < len; i++) { + actMode = determineSectorMode(sector); + + if (!(actMode == mode || + (mode == TrackData::MODE2_FORM_MIX && + (actMode == TrackData::MODE2_FORM1 || + actMode == TrackData::MODE2_FORM2)) || + + (mode == TrackData::MODE1_RAW && actMode == TrackData::MODE1) || + + (mode == TrackData::MODE2_RAW && + (actMode == TrackData::MODE2 || + actMode == TrackData::MODE2_FORM1 || + actMode == TrackData::MODE2_FORM2)))) { + log_message(4, "Stopped because sector with not matching mode %s found.", + TrackData::mode2String(actMode)); + log_message(4, "%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x", + sector[0], sector[1], sector[2], sector[3], sector[4], + sector[5], sector[6], sector[7], sector[8], sector[9], + sector[10], sector[11]); + return i; + } + + if (buf != NULL) { + switch (mode) { + case TrackData::MODE1: + memcpy(buf, sector + 4, MODE1_BLOCK_LEN); + buf += MODE1_BLOCK_LEN; + break; + case TrackData::MODE2: + case TrackData::MODE2_FORM_MIX: + memcpy(buf, sector + 4, MODE2_BLOCK_LEN); + buf += MODE2_BLOCK_LEN; + break; + case TrackData::MODE2_FORM1: + memcpy(buf, sector + 12, MODE2_FORM1_DATA_LEN); + buf += MODE2_FORM1_DATA_LEN; + break; + case TrackData::MODE2_FORM2: + memcpy(buf, sector + 12, MODE2_FORM2_DATA_LEN); + buf += MODE2_FORM2_DATA_LEN; + break; + case TrackData::MODE1_RAW: + case TrackData::MODE2_RAW: + memcpy(buf, syncPattern, 12); + memcpy(buf + 12, sector, 2340); + buf += AUDIO_BLOCK_LEN; + break; + case TrackData::MODE0: + case TrackData::AUDIO: + log_message(-3, "PlextorReader::readTrackData: Illegal mode."); + return 0; + break; + } + } + + sector += blockLen; + } + + return len; +} + +Toc *PlextorReader::readDiskToc(int session, const char *audioFilename) +{ + Toc *toc = CdrDriver::readDiskToc(session, audioFilename); + + setBlockSize(MODE1_BLOCK_LEN); + + return toc; +} + +Toc *PlextorReader::readDisk(int session, const char *dataFilename) +{ + Toc *toc = CdrDriver::readDisk(session, dataFilename); + + setBlockSize(MODE1_BLOCK_LEN); + + return toc; +} + +// Creates 'Toc' object for inserted CD. +// audioFilename: name of audio file that is placed into TOC +// Return: newly allocated 'Toc' object or 'NULL' on error +int PlextorReader::readAudioRangePlextor(ReadDiskInfo *rinfo, int fd, + long startLba, long endLba, + int startTrack, int endTrack, + TrackInfo *info) +{ + int i; + int ret; + //unsigned char trackCtl; // control nibbles of track + //int ctlCheckOk; + + int blockLength = AUDIO_BLOCK_LEN + 1 + 294 + 96; + long blocksPerRead = scsiIf_->maxDataLen() / blockLength; + long stampLba; + + // first, last, current and number of recorded tracks + int fat=-1,lat=-1,cat,nat=0; + + // first, last, number, current, remaining and read (audio blocks) + long fab,lab,nab,cab,rab,n; + + // SCSI command + unsigned char cmd[12]; + unsigned char *data; + + // number of byte errors in current audio block (cab) + int cabFaulty; + + // number of retries and goods of current audio block (cab) + unsigned long cabRetries=0,cabGoods=0,scsiRetries=0; + + // audio repair block + unsigned char repairBlock[AUDIO_BLOCK_LEN + 1 + 294 + 96]; + //unsigned char referBlock[AUDIO_BLOCK_LEN + 1 + 294 + 96]; + int repairErrors=-1; + + int overspeed,cai=-1; + + data = new unsigned char[blocksPerRead * blockLength]; + + fat = startTrack; + lat = endTrack; + nat = endTrack - startTrack + 1; + + info[lat].bytesWritten = 0; + + // set first, last and number of audio blocks + fab = startLba; + lab = endLba; + + nab=lab-fab; + + log_message(1, "Reading CDDA tracks in range [%lu,%lu].", fat+1,lat+1); + + cat = fat + 1; + + log_message(2, "Reading CDDA blocks in range [%lu,%lu>" + " (%lu blocks=%lu bytes).",fab,lab,nab,nab*2352); + + memset(cmd,0,12); + cmd[0]=0xd8; + cmd[10]=0x09; + +#if 0 // for testing purposes I set the position/length of a scratch here + fab+=3000; + nab=921; +#endif + + // set current audio block + cab=fab; + // set remaining audio blocks + rab=nab; + + stampLba = cab; + + // start optimistic + speed(overspeed=20); + + + // while still audio blocks left to read + while (rab != 0) + { + // the maximum number of blocks to read, or just those which are left + n=(rab > blocksPerRead ? blocksPerRead : rab); + + // set starting audio block + cmd[2] = cab >> 24; + cmd[3] = cab >> 16; + cmd[4] = cab >> 8; + cmd[5] = cab; + // set number of blocks + cmd[6] = n >> 24; + cmd[7] = n >> 16; + cmd[8] = n >> 8; + cmd[9] = n; + + log_message(1, "block %6ld\r",cab); + + if (remote_) { + if (cab > stampLba + 75) { + long totalLen = info[cat + 1].start - info[cat].start; + long progress = cab - info[cat].start; + long totalProgress; + + if (progress > 0) { + progress *= 1000; + progress /= totalLen; + } + else { + progress = 0; + } + + totalProgress = cab - rinfo->startLba; + + if (totalProgress > 0) { + totalProgress *= 1000; + totalProgress /= rinfo->endLba - rinfo->startLba; + } + else { + totalProgress = 0; + } + + sendReadCdProgressMsg(RCD_EXTRACTING, rinfo->tracks, cat + 1, progress, + totalProgress); + + stampLba = cab; + } + } + + // SCSI command failed? + while (sendCmd(cmd,12,NULL,0,data,n*blockLength)) + { + scsiRetries++; + if (cabRetries==0) + { + if (scsiRetries==10) + { + delete[] data; + return 1; + } + } + else + { + scsiRetries=0; + //cabRetries++; + break; + } + } + + // iterate through the read audio blocks + for (i=0;i<n;i++) + { + // create subchannel object + PWSubChannel96 chan(data + i*blockLength + AUDIO_BLOCK_LEN + 1 + 294); + + // q subchannel error? + if (!chan.checkCrc()) + { + // TODO: Implement heuristic subchannel error correction here + } + // q subchannel ok? + if (chan.checkCrc() && chan.checkConsistency()) + { + // q subchannel contains mode 1 data? + if(chan.type() == SubChannel::QMODE1DATA) + { + // track relative time as it occurs in subchannel + Msf qRelTime(chan.min(),chan.sec(),chan.frame()); + // disc absolute time as it occurs in subchannel + Msf qAbsTime(chan.amin(),chan.asec(),chan.aframe()); + + if ((chan.indexNr()!=cai) || (chan.trackNr()!=cat)) + { + log_message(2, "(track,index,absolute)=(%2d,%2d,%s)", + chan.trackNr(),chan.indexNr(),qAbsTime.str()); + + // first track start? + if ((chan.trackNr()==1) && (chan.indexNr()==1)) + { + log_message(1, "Found track number %02d at %s (block %d).", + chan.trackNr(),qAbsTime.str(),cab); + if ((qAbsTime.lba()-150)!=info[0].start) + { + log_message(2, "TOC SAYS TRACK STARTS AT %s!", + Msf(info[0].start).str()); + } + } + // next track start? + else if ((chan.trackNr()==(cat+1)) && (chan.indexNr()==1)) + { + log_message(1, "Found track number %02d at %s.", + chan.trackNr(),qAbsTime.str()); + if ((qAbsTime.lba()-150)!=info[cat].start) + { + log_message(2, "TOC SAYS TRACK STARTS AT %s!", + Msf(info[cat].start).str()); + } + } + // pregap of next track? + else if ((chan.trackNr()==(cat+1)) && (chan.indexNr()==0)) + { + log_message(2, "Found pregap of track %02d with size %s at ", + chan.trackNr(), qRelTime.str()); + log_message(2, "%s", qAbsTime.str()); + if (cat <= lat) { + info[cat].pregap = qRelTime.lba(); + } + } + // index increment? + else if ((chan.trackNr()==cat) && (chan.indexNr()==(cai+1))) + { + if (chan.indexNr() > 1) + { + log_message(2, "Found index number %02d at %s.", + chan.indexNr(),qAbsTime.str()); + + int indexCnt = info[cat - 1].indexCnt; + if (cat - 1 <= lat && indexCnt < 98) { + info[cat - 1].index[indexCnt] = qRelTime.lba(); + info[cat - 1].indexCnt += 1; + } + } + } + else if (chan.trackNr()==0xAA) + { + log_message(2, "LEAD OUT TRACK ENCOUNTERED!"); + n=0; + i=0; + rab=0; + cab-=1; + lab=cab; + break; + } + else if ((chan.trackNr()==cat) && (chan.indexNr()==cai)) + { + } + else + { + log_message(1, "UNEXPECTED!"); + } + cat=chan.trackNr(); + cai=chan.indexNr(); + } + } + else if (chan.type() == SubChannel::QMODE3) + { + // subchannel contains ISRC code + if (info[cat - 1].isrcCode[0] == 0) { + memcpy(info[cat - 1].isrcCode, chan.isrc(), 13); + log_message(2, "Found ISRC code of track %02d.", cat); + } + } + } + // erronous subchannel data + else + { + } + + // read CIRC error indicator + cabFaulty=data[i*blockLength+AUDIO_BLOCK_LEN]; + + // only errorless blocks or often retried blocks are accepted + if ((cabFaulty==0) || (repairErrors==0) || (cabRetries>80)) + { + unsigned char *block; + // the current audio block in the data buffer is perfect + if (cabFaulty==0) + { + block=data + i*blockLength; + // write this block's audio data + //fwrite(data + i*blockLength,1,AUDIO_BLOCK_LEN,fd); + // increment number of consecutive good blocks + cabGoods++; + if (cabRetries) + { + log_message(1,"block %6ld read and written without errors now. \n", cab); + } + } + // we have a fully repaired block + else if (repairErrors==0) + { + // write this block's audio data + block=repairBlock; + //fwrite(repairBlock,1,AUDIO_BLOCK_LEN,fd); + log_message(1,"block %6ld written after fully being repaired...", cab); + } + // we have a partially repaired block + else if (cabRetries>=0) + { + // write this block's audio data + block=repairBlock; + //fwrite(repairBlock,1,AUDIO_BLOCK_LEN,fd); + log_message(1,"block %6ld written with %4ld erronous bytes in it!", cab, repairErrors); + } + else + { + log_message(1,"PROGRAM BUG!!!! BUG #1! ENTERED ILLEGAL STATE\n"); + } + +#if 1 // not if we test please + if (options_ & OPT_DRV_SWAP_READ_SAMPLES) + swapSamples((Sample*)block, SAMPLES_PER_BLOCK); + + if ((ret = fullWrite(fd, block, AUDIO_BLOCK_LEN)) != AUDIO_BLOCK_LEN) { + if (ret < 0) + log_message(-2, "Writing of data failed: %s", strerror(errno)); + else + log_message(-2, "Writing of data failed: Disk full"); + + delete[] data; + return 1; + } + info[lat].bytesWritten += AUDIO_BLOCK_LEN; +#endif + + repairErrors=-1; + cabRetries=0; + // proceed to next audio block + //log_message(0,"PROCEEDING TO NEXT BLOCK"); + cab++; + rab--; + if (cabGoods == 1000) + { + if (overspeed<20) + { + overspeed=((overspeed*2)>=20?20:overspeed*2); + // crank up the speed again + // log_message(0,"Speeding up to %ld overspeed...\r",overspeed); + speed(overspeed); + cabGoods=0; + } + } + } + else + // the current block contains errors + { + int j; + // first time error on this block? + if (cabRetries==0) + { + // copy faulty block into our repair buffer + memcpy(repairBlock,data+i*blockLength,AUDIO_BLOCK_LEN+1+294+96); + // slow down to lower error rate (we hope so!?) + if (overspeed>1) overspeed/=2; + // log_message(0,"Slowing down to %ld...\r",overspeed); + speed(overspeed); + } + // iterate through all audio samples, merge all good samples into + // a repair audio block + + // Implementor's note: The following info is NOT mentioned in the + // official Plextor documentation I have, but IS confirmed by + // Plextor. -- Leon Woestenberg <leon@stack.nl>. + + // NOTE: Any two bytes of a sample (or both) can be damaged. + // Although the error bit flag can be set for just one byte, the + // other byte can be changed due to the fact that DSP interpolation + // is applied to the whole (two-byte) sample. + // THEREFORE, any of the two bits relating to a two-byte sample + // indicate the WHOLE sample is incorrect, and we will try to + // repair the whole sample, not just the one byte. + // THIS will ensure we have a 100% bit-wise accurate copy of + // the audio data. + + repairErrors=0; + for (j=0;j<AUDIO_BLOCK_LEN;j+=2) // iterate by steps of 1 sample + { + // sample erronous in repair block? (bits 7-j and/or 6-j set?) + if (repairBlock[AUDIO_BLOCK_LEN+1+(j/8)] & (192>>(j%8))) + { + // sample good in fresh data block? + if (!(data[i*blockLength+AUDIO_BLOCK_LEN+1+(j/8)] & (192>>(j%8)))) + { +#if 0 + printf("\nerrenous sample %d (bytes %d/%d) being repaired with %04x", + j/2,j,j+1,data[i*blockLength+j]*256+data[i*blockLength+j+1]); +#endif + // then copy it into the repairBlock; + repairBlock[j]=data[i*blockLength+j]; + repairBlock[j+1]=data[i*blockLength+j+1]; + // clear error bit in repair block + repairBlock[AUDIO_BLOCK_LEN+1+(j/8)] &= (~(192>>(j%8))); + } + // erronous sample could not be replaced by the good one + else + { +#if 0 + printf("%d, ",j/2); +#endif + // increment number of repair block erronous samples + repairErrors++; + } +#if 0 + log_message(0,"bits %ld/%ld (bits %ld/%ld of byte %ld) was 1", + j,j+1,7-(j%8),6-(j%8),j/8); +#endif + } +#if 0 + else + { + log_message(0,"bits %ld/%ld (bits %ld/%ld of byte %ld) were 0", + j,j+1,7-(j%8),6-(j%8),j/8); + } +#endif + } + if (cabRetries==0) + { + log_message(1,"\nblock %6ld has %3ld error samples\r", + cab,repairErrors); + } + else + { + log_message(1,"block %6ld has %3ld error samples left after %3ld retries\r", + cab,repairErrors,cabRetries); + } + // increase number of retries + cabRetries++; + cabGoods=0; + // break out of for-loop (into while-loop) to re-read current block + break; + } + } + } + + delete[] data; + + return 0; +} + +int PlextorReader::readSubChannels(TrackData::SubChannelMode, + long lba, long len, SubChannel ***chans, + Sample *audioData) +{ + unsigned char cmd[12]; + int cmdLen; + int tries = 5; + int ret; + + + memset(cmd, 0, 12); + + if (options_ & OPT_PLEX_DAE_READ10) { + if (setBlockSize(AUDIO_BLOCK_LEN) != 0) + return 1; + + cmd[0] = 0x28; // READ10 + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + cmd[7] = len >> 8; + cmd[8] = len; + + cmdLen = 10; + } + else if (options_ & OPT_PLEX_DAE_D4_12) { + cmd[0] = 0xd4; + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + cmd[8] = len >> 8; + cmd[9] = len; + + cmdLen = 12; + } + else { + cmd[0]=0xd8; // READ CDDA + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + cmd[6] = len >> 24; + cmd[7] = len >> 16; + cmd[8] = len >> 8; + cmd[9] = len; + + cmdLen = 12; + } + + do { + ret = sendCmd(cmd, cmdLen, NULL, 0, + (unsigned char*)audioData, len * AUDIO_BLOCK_LEN, + (tries == 1) ? 1 : 0); + + if (ret != 0 && tries == 1) { + log_message(-2, "Reading of audio data failed at sector %ld.", lba); + return 1; + } + + tries--; + } while (ret != 0 && tries > 0); + + *chans = NULL; + return 0; +} + +int PlextorReader::readAudioRange(ReadDiskInfo *rinfo, int fd, long start, + long end, int startTrack, int endTrack, + TrackInfo *info) +{ + if (model_ != 0 && (options_ & OPT_PLEX_USE_PARANOIA) == 0) { + // we have a plextor drive -> use the special plextor method which + // will also detect pre-gaps, index marks and ISRC codes + return readAudioRangePlextor(rinfo, fd, start, end, startTrack, endTrack, + info); + } + + if (!onTheFly_) { + int t, i; + long pregap = 0; + int indexCnt = 0; + Msf index[98]; + unsigned char ctl; + long slba, elba; + + log_message(1, "Analyzing..."); + + for (t = startTrack; t <= endTrack; t++) { + long totalProgress; + + log_message(1, "Track %d...", t + 1); + + totalProgress = t * 1000; + totalProgress /= rinfo->tracks; + sendReadCdProgressMsg(RCD_ANALYZING, rinfo->tracks, t + 1, 0, + totalProgress); + + + if (!fastTocReading_) { + if (pregap != 0) + log_message(2, "Found pre-gap: %s", Msf(pregap).str()); + + slba = info[t].start; + if (info[t].mode == info[t + 1].mode) + elba = info[t + 1].start; + else + elba = info[t + 1].start - 150; + + pregap = 0; + if (analyzeTrackSearch(TrackData::AUDIO, t + 1, slba, elba, + index, &indexCnt, &pregap, info[t].isrcCode, + &ctl) != 0) + return 1; + + for (i = 0; i < indexCnt; i++) + info[t].index[i] = index[i].lba(); + + info[t].indexCnt = indexCnt; + + if (t < endTrack) + info[t + 1].pregap = pregap; + } + else { + info[t].indexCnt = 0; + info[t + 1].pregap = 0; + } + + info[t].isrcCode[0] = 0; + readIsrc(t + 1, info[t].isrcCode); + if (info[t].isrcCode[0] != 0) + log_message(2, "Found ISRC code."); + + totalProgress = (t + 1) * 1000; + totalProgress /= rinfo->tracks; + + sendReadCdProgressMsg(RCD_ANALYZING, rinfo->tracks, t + 1, 1000, + totalProgress); + } + + log_message(1, "Reading..."); + } + + return CdrDriver::readAudioRangeParanoia(rinfo, fd, start, end, startTrack, + endTrack, info); +} diff --git a/dao/PlextorReader.h b/dao/PlextorReader.h new file mode 100644 index 0000000..865052d --- /dev/null +++ b/dao/PlextorReader.h @@ -0,0 +1,169 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __PLEXTOR_READER_H__ +#define __PLEXTOR_READER_H__ + +#include "CdrDriver.h" + +#define OPT_PLEX_USE_PARANOIA 0x0001 // always use paranoia method for DAE +#define OPT_PLEX_DAE_READ10 0x0002 // use READ10 for DAE +#define OPT_PLEX_DAE_D4_12 0x0004 // use 12 byte command 0xD4 for DAE + +/*! \def OPT_PLEX_NOSLOW_ON_ERR + \brief Don't slow down read speed if any read error encountered + + By default is activated, so the unit slows down. Passing + this option will disable it; unit won't slow down. Driver checks + previous status and restores it. + Mode page 0x31 + byte 3 [ x x x x x x x re ] 1 means don't slow down, 0 default +*/ +#define OPT_PLEX_NOSLOW_ON_ERR 0x0010 + +/*! \def OPT_PLEX_TRANSF_BEF_MAX + \brief Start to transfer data before max speed reached + + By default is disabled, so unit reaches max speed before beginning + transfer. Passing this options will enable it; unit will transfer + data before reaching max speed. Driver checks previous status and + restores it. + Mode page 0x31 + byte 3 [ x x x x x x td x ] 1 means don't wait for max speed, 0 default +*/ +#define OPT_PLEX_TRANSF_BEF_MAX 0x0020 + +/*! \def OPT_PLEX_NOSLOW_ON_VIB + \brief Don't slowdown to avoid vibrations + + By default is activated, so unit slows down. Passing this option + will disable it; unit won't slow down. Driver checks previous status + and restores it. + Mode page 0x31 + byte 3 [ x x x x x sl x x ] 1 means don't slow down, 0 default +*/ +#define OPT_PLEX_NOSLOW_ON_VIB 0x0040 + +class Toc; +class Track; + +class PlextorReader : public CdrDriver { +public: + + PlextorReader(ScsiIf *scsiIf, unsigned long options); + + /*! + * Its only purpose is to reset Plextor special features to their value + * before cdrdao initialization. + */ + virtual ~PlextorReader(); + static CdrDriver *instance(ScsiIf *scsiIf, unsigned long options); + + unsigned long getReadCapabilities(const CdToc *, int) const { return 0; } + + // not used for readers + int bigEndianSamples() const { return 0;} + + int speed(int); + + int loadUnload(int) const { return 0; } + + int initDao(const Toc *); + int startDao(); + int finishDao(); + void abortDao(); + + inline int ReadErrorsSlowDown () {return slow_down_on_read_errors;} + inline int VibrationsSlowDown () {return slow_down_on_vibrations;} + inline int WaitMaxSpeed () {return transfer_data_before_max_speed;} + /*! \brief Controls wheter drive slows down when a read error occurs + + Special plextor feature; + \param slowdown 0 to disable slowdown, 1 to enable (default) + \return 1 on success, -1 on error + */ + int ReadErrorsSlowDown (int slowdown); + /*! \brief Controls wheter drive slows down when paused to avoid + vibrations + + Special plextor feature, available on PX-20 and later + \param slowdown 0 to disable slowdown, 1 to enable (default) + \return 1 on success, -1 on error + */ + int VibrationsSlowDown (int slowdown); + /*! \brief Controls wheter drive waits for max speed before transferring data + + Special plextor feature, available on PX-20 and later + \param wait 0 to transfer before maximum speed, 1 to wait (default) + \return 1 on success, -1 on error + */ + int WaitMaxSpeed (int wait); + + DiskInfo *diskInfo(); + + Toc *readDiskToc(int, const char *); + Toc *readDisk(int, const char *); + +protected: + DiskInfo diskInfo_; + /*! \brief Drive model, as index of following + + { 1,"CD-ROM PX-4XCH" }, { 2,"CD-ROM PX-4XCS" }, + { 3,"CD-ROM PX-4XCE" }, { 4,"CD-ROM PX-6X" }, + { 5,"CD-ROM PX-8X" }, { 6,"CD-ROM PX-12" }, + { 7,"CD-ROM PX-20" }, { 8,"CD-ROM PX-32" }, + { 9,"CD-ROM PX-40" } + */ + int model_; + + CdRawToc *getRawToc(int sessionNr, int *len); + + int getTrackIndex(long lba, int *trackNr, int *indexNr, + unsigned char *ctl); + int readCatalog(Toc *, long startLba, long endLba); + int analyzeTrack(TrackData::Mode, int trackNr, long startLba, long endLba, + Msf *index, + int *indexCnt, long *pregap, char *isrcCode, + unsigned char *ctl); + int readIsrc(int trackNr, char *); + + long readTrackData(TrackData::Mode mode, TrackData::SubChannelMode, + long lba, long len, unsigned char *buf); + int readSubChannels(TrackData::SubChannelMode, long lba, long len, + SubChannel ***, Sample *); + int readAudioRange(ReadDiskInfo *, int fd, long start, long end, + int startTrack, int endTrack, TrackInfo *trackInfo); + + +private: + void playAudioBlock(long start, long len); + int readSubChannelData(int *trackNr, int *indexNr, long *, + unsigned char *ctl); + + int readAudioRangePlextor(ReadDiskInfo *, int fd, long start, long end, + int startTrack, int endTrack, TrackInfo *); + /* These can be -1 if not available, 0 or 1 */ + int slow_down_on_read_errors; + int transfer_data_before_max_speed; + int slow_down_on_vibrations; + /* Original status of plextor special features */ + unsigned char orig_byte3; +}; + +#endif diff --git a/dao/PlextorReaderScan.cc b/dao/PlextorReaderScan.cc new file mode 100644 index 0000000..582343a --- /dev/null +++ b/dao/PlextorReaderScan.cc @@ -0,0 +1,237 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <string.h> +#include <assert.h> + +#include "PlextorReaderScan.h" +#include "PWSubChannel96.h" +#include "PQSubChannel16.h" + +#include "Toc.h" +#include "log.h" + +PlextorReaderScan::PlextorReaderScan(ScsiIf *scsiIf, unsigned long options) + : PlextorReader(scsiIf, options) +{ + int i; + + driverName_ = "Plextor CD-ROM Reader (scanning) - Version 1.0"; + + for (i = 0; i < maxScannedSubChannels_; i++) { + if (options_ & OPT_PLEX_USE_PQ) + scannedSubChannels_[i] = new PQSubChannel16; + else + scannedSubChannels_[i] = new PWSubChannel96; + } +} + +PlextorReaderScan::~PlextorReaderScan() +{ + int i; + + for (i = 0; i < maxScannedSubChannels_; i++) { + delete scannedSubChannels_[i]; + scannedSubChannels_[i] = NULL; + } +} + +// static constructor +CdrDriver *PlextorReaderScan::instance(ScsiIf *scsiIf, unsigned long options) +{ + return new PlextorReaderScan(scsiIf, options); +} + +Toc *PlextorReaderScan::readDisk(int session, const char *fname) +{ + Toc *toc = CdrDriver::readDisk(session, fname); + + setBlockSize(MODE1_BLOCK_LEN); + + return toc; +} + +int PlextorReaderScan::analyzeTrack(TrackData::Mode mode, int trackNr, + long startLba, + long endLba, Msf *indexIncrements, + int *indexIncrementCnt, long *pregap, + char *isrcCode, unsigned char *ctl) +{ + int ret = analyzeTrackScan(mode, trackNr, startLba, endLba, + indexIncrements, indexIncrementCnt, pregap, + isrcCode, ctl); + + if ((options_ & OPT_PLEX_READ_ISRC) || + ((options_ & OPT_PLEX_USE_PQ) && !(options_ & OPT_PLEX_PQ_BCD))) { + // The ISRC code is usually not usable if the PQ channel data is + // converted to hex numbers by the drive. Read them with the + // appropriate command in this case + + *isrcCode = 0; + if (mode == TrackData::AUDIO) + readIsrc(trackNr, isrcCode); + } + + return ret; +} + +int PlextorReaderScan::readSubChannels(TrackData::SubChannelMode sm, + long lba, long len, SubChannel ***chans, + Sample *audioData) +{ + unsigned char cmd[12]; + int i; + int retries = 5; + long blockLen; + + if (options_ & OPT_PLEX_USE_PQ) + blockLen = AUDIO_BLOCK_LEN + 16; + else + blockLen = AUDIO_BLOCK_LEN + 96; + + cmd[0] = 0xd8; // READ CDDA + cmd[1] = 0; + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + cmd[6] = 0; + cmd[7] = len >> 16; + cmd[8] = len >> 8; + cmd[9] = len; + + if (options_ & OPT_PLEX_USE_PQ) + cmd[10] = 0x01; + else + cmd[10] = 0x02; + + cmd[11] = 0; + + while (1) { + if (sendCmd(cmd, 12, NULL, 0, transferBuffer_, len * blockLen, + retries == 0 ? 1 : 0) != 0) { + if (retries == 0) + return 1; + } + else { + break; + } + + retries--; + } + +#if 0 + if (lba > 5000) { + char fname[200]; + sprintf(fname, "testout_%ld", lba); + FILE *fp = fopen(fname, "w"); + fwrite(transferBuffer_, blockLen, len, fp); + fclose(fp); + } +#endif + + unsigned char *p = transferBuffer_ + AUDIO_BLOCK_LEN; + + for (i = 0; i < len; i++) { + if (options_ & OPT_PLEX_USE_PQ) { + if (!(options_ & OPT_PLEX_PQ_BCD)) { + // Numbers in sub-channel data are hex instead of BCD. + // We have to convert them back to BCD for the 'SubChannel' class. + p[1] = SubChannel::bcd(p[1]); + p[2] = SubChannel::bcd(p[2]); + p[3] = SubChannel::bcd(p[3]); + p[4] = SubChannel::bcd(p[4]); + p[5] = SubChannel::bcd(p[5]); + p[6] = SubChannel::bcd(p[6]); + p[7] = SubChannel::bcd(p[7]); + p[8] = SubChannel::bcd(p[8]); + p[9] = SubChannel::bcd(p[9]); + } + + ((PQSubChannel16*)scannedSubChannels_[i])->init(p); + + if (scannedSubChannels_[i]->type() != SubChannel::QMODE_ILLEGAL) { + // the CRC of the sub-channel data is usually invalid -> mark the + // sub-channel object that it should not try to verify the CRC + scannedSubChannels_[i]->crcInvalid(); + } + } + else { + ((PWSubChannel96*)scannedSubChannels_[i])->init(p); + } + + p += blockLen; + } + + if (audioData != NULL) { + p = transferBuffer_; + + for (i = 0; i < len; i++) { + memcpy(audioData, p, AUDIO_BLOCK_LEN); + + p += blockLen; + audioData += SAMPLES_PER_BLOCK; + } + } + + *chans = scannedSubChannels_; + return 0; +} + +int PlextorReaderScan::readAudioRange(ReadDiskInfo *info, int fd, long start, + long end, int startTrack, int endTrack, + TrackInfo *trackInfo) +{ + if (!onTheFly_) { + if ((options_ & OPT_PLEX_READ_ISRC) || + ((options_ & OPT_PLEX_USE_PQ) && !(options_ & OPT_PLEX_PQ_BCD))) { + int t; + + log_message(1, "Analyzing..."); + + for (t = startTrack; t <= endTrack; t++) { + long totalProgress; + + log_message(1, "Track %d...", t + 1); + + totalProgress = t * 1000; + totalProgress /= info->tracks; + sendReadCdProgressMsg(RCD_ANALYZING, info->tracks, t + 1, 0, + totalProgress); + + trackInfo[t].isrcCode[0] = 0; + readIsrc(t + 1, trackInfo[t].isrcCode); + if (trackInfo[t].isrcCode[0] != 0) + log_message(2, "Found ISRC code."); + + totalProgress = (t + 1) * 1000; + totalProgress /= info->tracks; + sendReadCdProgressMsg(RCD_ANALYZING, info->tracks, t + 1, 1000, + totalProgress); + } + + log_message(1, "Reading..."); + } + } + + return CdrDriver::readAudioRangeParanoia(info, fd, start, end, startTrack, + endTrack, trackInfo); +} diff --git a/dao/PlextorReaderScan.h b/dao/PlextorReaderScan.h new file mode 100644 index 0000000..949408d --- /dev/null +++ b/dao/PlextorReaderScan.h @@ -0,0 +1,57 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __PLEXTOR_READER_SCAN_H__ +#define __PLEXTOR_READER_SCAN_H__ + +#include "PlextorReader.h" + +#define OPT_PLEX_USE_PQ 0x0001 // use PQ sub-channel data for scanning +#define OPT_PLEX_PQ_BCD 0x0002 // PQ sub-channel contains BCD numbers +#define OPT_PLEX_READ_ISRC 0x0004 // force reading of ISRC code with + // READ SUB CHANNEL instead taking it from + // the sub-channel data + +class PlextorReaderScan : public PlextorReader { +public: + + PlextorReaderScan(ScsiIf *scsiIf, unsigned long options); + ~PlextorReaderScan(); + static CdrDriver *instance(ScsiIf *scsiIf, unsigned long options); + + Toc *readDisk(int session, const char *); + + unsigned long getReadCapabilites(const CdToc *, int) const { return 0; } + +protected: + + int analyzeTrack(TrackData::Mode, int trackNr, long startLba, long endLba, + Msf *index, + int *indexCnt, long *pregap, char *isrcCode, + unsigned char *ctl); + + int readSubChannels(TrackData::SubChannelMode, long lba, long len, + SubChannel ***, Sample *); + + int readAudioRange(ReadDiskInfo *, int fd, long start, long end, + int startTrack, int endTrack, TrackInfo *); + +}; + +#endif diff --git a/dao/RicohMP6200.cc b/dao/RicohMP6200.cc new file mode 100644 index 0000000..40012ca --- /dev/null +++ b/dao/RicohMP6200.cc @@ -0,0 +1,250 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* Driver for the Ricoh MP6200 drive. It's mainly SCSI-3/mmc compatible but + * disk-at-once writing is done with the Philips CDD2x00 commands. + */ + +#include <config.h> + +#include <string.h> +#include <assert.h> + +#include "RicohMP6200.h" +#include "SubChannel.h" +#include "Toc.h" +#include "log.h" + +RicohMP6200::RicohMP6200(ScsiIf *scsiIf, unsigned long options) + : GenericMMC(scsiIf, options), CDD2600Base(this) +{ + driverName_ = "Ricoh MP6200 - Version 0.1(alpha)"; + + simulate_ = true; + encodingMode_ = 0; +} + +RicohMP6200::~RicohMP6200() +{ +} + +// static constructor +CdrDriver *RicohMP6200::instance(ScsiIf *scsiIf, unsigned long options) +{ + return new RicohMP6200(scsiIf, options); +} + + +// Sets write parameters via mode page 0x05. +// return: 0: OK +// 1: scsi command failed +int RicohMP6200::setWriteParameters() +{ + int i; + unsigned char mp[0x38]; + + if (getModePage(5/*write parameters mode page*/, mp, 0x38, + NULL, NULL, 1) != 0) { + log_message(-2, "Cannot retrieve write parameters mode page."); + return 1; + } + + mp[0] &= 0x7f; // clear PS flag + + mp[2] &= 0xef; + + if (simulate_) { + mp[2] |= 1 << 4; // test write + } + + mp[3] &= 0x3f; // Multi-session: No B0 pointer, next session not allowed + if (multiSession_ != 0) + mp[3] |= 0x03 << 6; // open next session + + if (toc_->catalogValid()) { + mp[16] = 0x80; + + for (i = 0; i < 13; i++) + mp[17 + i] = toc_->catalog(i) + '0'; + + mp[30] = 0; + mp[31] = 0; + } + else { + mp[16] = 0; + } + + if (setModePage(mp, NULL, NULL, 1) != 0) { + log_message(-2, "Cannot set write parameters mode page."); + return 1; + } + + return 0; +} + + +int RicohMP6200::initDao(const Toc *toc) +{ + long n; + blockLength_ = AUDIO_BLOCK_LEN; + blocksPerWrite_ = scsiIf_->maxDataLen() / blockLength_; + + assert(blocksPerWrite_ > 0); + + toc_ = toc; + + // the ATAPI version does not like the following command so a failure + // is non fatal + modeSelectBlockSize(blockLength_, 0); + + if (readSessionInfo(&leadInLen_, &leadOutLen_, 1) != 0 || + setWriteParameters() != 0) + return 1; + + // allocate buffer for write zeros + n = blocksPerWrite_ * blockLength_; + delete[] zeroBuffer_; + zeroBuffer_ = new char[n]; + memset(zeroBuffer_, 0, n); + + return 0; +} + +int RicohMP6200::startDao() +{ + long lba = 0; + + if (writeSession(toc_, multiSession_, 0) != 0) { + return 1; + } + + log_message(2, "Writing lead-in and gap..."); + + // write lead-in + if (writeZeros(toc_->leadInMode(), TrackData::SUBCHAN_NONE, lba, 0, + leadInLen_) != 0) { + flushCache(); + return 1; + } + + // write gap (2 seconds) + if (writeZeros(toc_->leadInMode(), TrackData::SUBCHAN_NONE, lba, 0, 150) + != 0) { + flushCache(); + return 1; + } + + log_message(2, ""); + + return 0; +} + +int RicohMP6200::finishDao() +{ + long lba = toc_->length().lba(); + + log_message(2, "Writing lead-out..."); + + // write lead-out + if (writeZeros(toc_->leadOutMode(), TrackData::SUBCHAN_NONE, lba, lba + 150, + leadOutLen_) != 0) { + flushCache(); + return 1; + } + + log_message(2, "\nFlushing cache..."); + + if (flushCache() != 0) { + return 1; + } + + log_message(2, ""); + + delete[] zeroBuffer_, zeroBuffer_ = NULL; + + return 0; +} + +void RicohMP6200::abortDao() +{ + flushCache(); +} + +// Writes data to target, the block length depends on the actual writing mode +// and is stored internally. 'len' is number of blocks to write. +// 'lba' specifies the next logical block address for writing and is updated +// by this function but not used for writing +// return: 0: OK +// 1: scsi command failed +int RicohMP6200::writeData(TrackData::Mode mode, TrackData::SubChannelMode sm, + long &lba, const char *buf, long len) +{ + assert(blocksPerWrite_ > 0); + assert(blockLength_ > 0); + assert(mode == TrackData::AUDIO); + int nwritten = 0; + int writeLen = 0; + unsigned char cmd[10]; + + memset(cmd, 0, 10); + cmd[0] = 0x2a; // WRITE1 + + while (len > 0) { + writeLen = (len > blocksPerWrite_ ? blocksPerWrite_ : len); + + cmd[7] = writeLen >> 8; + cmd[8] = writeLen & 0xff; + + if (sendCmd(cmd, 10, (unsigned char *)(buf + (nwritten * blockLength_)), + writeLen * blockLength_, NULL, 0) != 0) { + log_message(-2, "Write data failed."); + return 1; + } + + lba += writeLen; + + len -= writeLen; + nwritten += writeLen; + } + + return 0; +} + +// loads ('unload' == 0) or ejects ('unload' == 1) tray +// return: 0: OK +// 1: scsi command failed + +int RicohMP6200::loadUnload(int unload) const +{ + unsigned char cmd[10]; + + memset(cmd, 0, 10); + + cmd[0] = 0xe7; // MEDIUM LOAD/UNLOAD + if (unload) { + cmd[8] |= 0x01; + } + + if (sendCmd(cmd, 10, NULL, 0, NULL, 0) != 0) { + log_message(-2, "Cannot load/unload medium."); + return 1; + } + + return 0; +} diff --git a/dao/RicohMP6200.h b/dao/RicohMP6200.h new file mode 100644 index 0000000..f4fc4ba --- /dev/null +++ b/dao/RicohMP6200.h @@ -0,0 +1,50 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* Driver for the Ricoh MP6200 drive. It's mainly SCSI-3/mmc compatible but + * disk-at-once writing is done with the Philips CDD2x00 commands. + */ + +#ifndef __RICOH_MP6200_H__ +#define __RICOH_MP6200_H__ + +#include "GenericMMC.h" +#include "CDD2600Base.h" + +class RicohMP6200 : public GenericMMC, private CDD2600Base { +public: + RicohMP6200(ScsiIf *scsiIf, unsigned long options); + ~RicohMP6200(); + static CdrDriver *instance(ScsiIf *scsiIf, unsigned long options); + + int initDao(const Toc *); + int startDao(); + int finishDao(); + void abortDao(); + + int writeData(TrackData::Mode, TrackData::SubChannelMode, long &lba, + const char *buf, long len); + + int loadUnload(int unload) const; + +protected: + int setWriteParameters(); +}; + +#endif diff --git a/dao/ScsiIf-common.cc b/dao/ScsiIf-common.cc new file mode 100644 index 0000000..cab7bc8 --- /dev/null +++ b/dao/ScsiIf-common.cc @@ -0,0 +1,148 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1999 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * $Log: ScsiIf-common.cc,v $ + * Revision 1.4 2007/12/29 12:26:33 poolshark + * Complete rewrite of native Linux SG driver for SG 3.0 using SG_IO ioctl. Code cleanup + * + * Revision 1.3 2004/04/13 01:23:44 poolshark + * Cleanup of scglib selection. Fixed without-scglib option. Default build of scsilib was problematic on older systems + * + * Revision 1.2 2004/03/23 18:46:07 poolshark + * MMC autodetect mode + * + * Revision 1.1.1.1 2000/02/05 01:36:55 llanero + * Uploaded cdrdao 1.1.3 with pre10 patch applied. + * + */ + +// checks if unit is ready +// return: 0: OK, ready +// 1: not ready (busy) +// 2: not ready, no disk in drive +// 3: scsi command failed + + + +int ScsiIf::testUnitReady() +{ + unsigned char cmd[6]; + const unsigned char *senseData; + int senseLen; + int ret = 0; + + memset(cmd, 0, 6); + + switch (sendCmd(cmd, 6, NULL, 0, NULL, 0, 0)) { + case 1: + ret = 3; + break; + + case 2: + senseData = getSense(senseLen); + + switch (senseData[2] & 0x0f) { + case 0x02: // Not ready + switch (senseData[12]) { + case 0x3a: // medium not present + ret = 2; + break; + + default: + ret = 1; + break; + } + break; + + case 0x06: // Unit attention + ret = 0; + break; + + default: + ret = 3; + break; + } + } + + return ret; +} + +typedef struct { + unsigned char p_len; + unsigned cd_r_read : 1; + unsigned cd_rw_read : 1; + unsigned method2 : 1; + unsigned dvd_rom_read : 1; + unsigned dvd_r_read : 1; + unsigned dvd_ram_read : 1; + unsigned res_2_67 : 2; + unsigned cd_r_write : 1; + unsigned cd_rw_write : 1; + unsigned test_write : 1; + unsigned res_3_3 : 1; + unsigned dvd_r_write : 1; + unsigned dvd_ram_write : 1; + unsigned res_3_67 : 2; +} cd_page_2a; + +bool ScsiIf::checkMmc(bool *cd_r_read, bool *cd_r_write, + bool *cd_rw_read, bool *cd_rw_write) +{ + static const int MODE_SENSE_G1_CMD = 0x5a; + static const int MODE_MAX_SIZE = 256; + static const int MODE_PAGE_HEADER_SIZE = 8; + static const int MODE_CD_CAP_PAGE = 0x2a; + + unsigned char mode[MODE_MAX_SIZE]; + memset(mode, 0, sizeof(mode)); + + // First, read header of mode page 0x2A, to figure out its exact + // length. For this, we issue a MODE_SENSE (10) command with a + // data length of 8, just the size of the mode header. + unsigned char cmd[10]; + memset(&cmd, 0, sizeof(cmd)); + cmd[0] = MODE_SENSE_G1_CMD; // MODE SENSE(10) + cmd[2] = MODE_CD_CAP_PAGE; + cmd[8] = MODE_PAGE_HEADER_SIZE; + if (sendCmd((unsigned char*)&cmd, 10, NULL, 0, mode, + MODE_PAGE_HEADER_SIZE) != 0) { + return false; + } + + int len = ((mode[0] << 8) + mode[1]) + 2; // +2 is for address field + if (len > MODE_MAX_SIZE) len = MODE_MAX_SIZE; + + // Now we have the length of page 0x2a, read the whole page. + memset(mode, 0, MODE_PAGE_HEADER_SIZE); + memset(&cmd, 0, sizeof(cmd)); + cmd[0] = MODE_SENSE_G1_CMD; // MODE SENSE(10) + cmd[2] = MODE_CD_CAP_PAGE; + cmd[8] = len; + if (sendCmd((unsigned char*)&cmd, 10, NULL, 0, mode, len) != 0) { + return false; + } + + cd_page_2a *p2a = (cd_page_2a*)(mode + 9); + + *cd_r_read = p2a->cd_r_read; + *cd_r_write = p2a->cd_r_write; + *cd_rw_read = p2a->cd_rw_read; + *cd_rw_write = p2a->cd_rw_write; + return true; +} diff --git a/dao/ScsiIf-freebsd-cam.cc b/dao/ScsiIf-freebsd-cam.cc new file mode 100644 index 0000000..cd5aace --- /dev/null +++ b/dao/ScsiIf-freebsd-cam.cc @@ -0,0 +1,232 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* SCSI interface implemenation for FreeBSD. + * Written by Max Khon <fjoe@iclub.nsu.ru> + */ + +#include <config.h> + +#include <fcntl.h> +#include <stdio.h> +#include <string.h> + +#include <camlib.h> +#include <cam/scsi/scsi_message.h> + +#include "ScsiIf.h" +#include "log.h" + +#define DEF_RETRY_COUNT 1 + +#include "decodeSense.cc" + +class ScsiIfImpl { +public: + char * devname; + struct cam_device * dev; + union ccb * ccb; + int timeout; /* timeout in ms */ +}; + +ScsiIf::ScsiIf(const char *devname) +{ + impl_ = new ScsiIfImpl; + impl_->devname = strdupCC(devname); + impl_->dev = NULL; + impl_->ccb = NULL; + impl_->timeout = 5000; + + maxDataLen_ = 32 * 1024; + vendor_[0] = 0; + product_[0] = 0; + revision_[0] = 0; +} + +ScsiIf::~ScsiIf() +{ + if (impl_->ccb) + cam_freeccb(impl_->ccb); + if (impl_->dev) + cam_close_device(impl_->dev); + delete[] impl_->devname; + delete impl_; +} + +// opens scsi device +// return: 0: OK +// 1: device could not be opened +// 2: inquiry failed +int ScsiIf::init() +{ + if ((impl_->dev = cam_open_device(impl_->devname, O_RDWR)) == NULL) { + log_message(-2, "%s", cam_errbuf); + return 1; + } + + impl_->ccb = cam_getccb(impl_->dev); + if (impl_->ccb == NULL) { + log_message(-2, "init: error allocating ccb"); + return 1; + } + + if (inquiry()) + return 2; + + return 0; +} + +// Sets given timeout value in seconds and returns old timeout. +// return: old timeout +int ScsiIf::timeout(int t) +{ + int old = impl_->timeout; + impl_->timeout = t*1000; + return old/1000; +} + +// sends a scsi command and receives data +// return 0: OK +// 1: scsi command failed (os level, no sense data available) +// 2: scsi command failed (sense data available) +int ScsiIf::sendCmd(const unsigned char *cmd, int cmdLen, + const unsigned char *dataOut, int dataOutLen, + unsigned char *dataIn, int dataInLen, + int showMessage) +{ + int retval; + int flags = CAM_DIR_NONE; + u_int8_t * data_ptr; + size_t data_len; + + bzero(impl_->ccb, sizeof(union ccb)); + bcopy(cmd, &impl_->ccb->csio.cdb_io.cdb_bytes, cmdLen); + + if (dataOut && dataOutLen > 0) { + data_ptr = (u_int8_t*) dataOut; + data_len = dataOutLen; + flags = CAM_DIR_OUT; + } + else if (dataIn && dataInLen > 0) { + data_ptr = dataIn; + data_len = dataInLen; + flags = CAM_DIR_IN; + } + + cam_fill_csio(&impl_->ccb->csio, + DEF_RETRY_COUNT, + NULL, + flags | CAM_DEV_QFRZDIS, + MSG_SIMPLE_Q_TAG, + data_ptr, + data_len, + SSD_FULL_SIZE, + cmdLen, + impl_->timeout); + if ((retval = cam_send_ccb(impl_->dev, impl_->ccb)) < 0 + || (impl_->ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if (retval < 0) { + log_message(-2, "sendCmd: error sending command"); + return 1; + } + + if ((impl_->ccb->ccb_h.status & CAM_STATUS_MASK) == + CAM_SCSI_STATUS_ERROR) { + if (showMessage) + printError(); + + return 2; + } + return 1; + } + + return 0; +} + +const unsigned char *ScsiIf::getSense(int &len) const +{ + len = impl_->ccb->csio.sense_len; + return (const unsigned char*) &impl_->ccb->csio.sense_data; +} + +void ScsiIf::printError() +{ + decodeSense((const unsigned char*) &impl_->ccb->csio.sense_data, + impl_->ccb->csio.sense_len); +} + +int ScsiIf::inquiry() +{ + int i; + struct scsi_inquiry_data inq_data; + + bzero(impl_->ccb, sizeof(union ccb)); + bzero(&inq_data, sizeof(inq_data)); + + scsi_inquiry(&impl_->ccb->csio, + DEF_RETRY_COUNT, + NULL, + MSG_SIMPLE_Q_TAG, + (u_int8_t*) &inq_data, + sizeof(inq_data), + 0, + 0, + SSD_FULL_SIZE, + impl_->timeout); + impl_->ccb->ccb_h.flags |= CAM_DEV_QFRZDIS; + + if (cam_send_ccb(impl_->dev, impl_->ccb) < 0) { + if ((impl_->ccb->ccb_h.status & CAM_STATUS_MASK) != + CAM_SCSI_STATUS_ERROR) { + log_message(-2, "%s", cam_errbuf); + return 1; + } + + printError(); + return 1; + } + + strncpy(vendor_, inq_data.vendor, 8); + vendor_[8] = 0; + + strncpy(product_, inq_data.product, 16); + product_[16] = 0; + + strncpy(revision_, inq_data.revision, 4); + revision_[4] = 0; + + for (i = 7; i >= 0 && vendor_[i] == ' '; i--) + vendor_[i] = 0; + + for (i = 15; i >= 0 && product_[i] == ' '; i--) + product_[i] = 0; + + for (i = 3; i >= 0 && revision_[i] == ' '; i--) + revision_[i] = 0; + + return 0; +} + +ScsiIf::ScanData *ScsiIf::scan(int *len, char* scsi_dev_path) +{ + *len = 0; + return NULL; +} + +#include "ScsiIf-common.cc" diff --git a/dao/ScsiIf-irix.cc b/dao/ScsiIf-irix.cc new file mode 100644 index 0000000..c2a9927 --- /dev/null +++ b/dao/ScsiIf-irix.cc @@ -0,0 +1,330 @@ +/* + * Native implementation of cdrdao's SCSI interface for Irix 6. + * Copyright (C) by Edgar Fu�, Bonn, May 2003, July 2007. + * Do with this whatever you like, as long as you are either me or you keep + * this message intact and both + * - acknowledge that I wrote it for cdrdao in the first place, and + * - don't blame me if it doesn't do what you like or expect. + * These routines do exactly what they do. If that's not what you expect them + * or would like them to do, don't complain with me, the cdrdao project, my + * neighbour's brother-in-law or anybody else, but rewrite them to your taste. + */ + +#include <stdio.h> +#include <ctype.h> +#include <string.h> +#include <errno.h> +#include <sys/dsreq.h> +#include <fcntl.h> +#include <sys/types.h> +#include <dirent.h> +#include <unistd.h> + +#include "ScsiIf.h" + +extern void message(int level, const char *fmt, ...); + +#include "decodeSense.cc" + +#define MAX_SCAN 32 +#define SENSE_MAX 256 + +class ScsiIfImpl { + public: + char *name_; + int fd_; + long timeout_; /* in ms */ + struct dsreq dsreq_; + char *error_; + unsigned char sensebuf_[SENSE_MAX]; +}; + +ScsiIf::ScsiIf(const char *name) +{ +#define PREFIX "/dev/scsi/" +#define PREFIX_SC "/dev/scsi/sc" + int len; + int bus, targ, lun, count; + + impl_ = new ScsiIfImpl; + len = strlen(name); + if (len == 0) { + impl_->name_ = NULL; + } else if (sscanf(name, "%i,%i,%i%n", &bus, &targ, &lun, &count) == 3 && + count == len) { + if ((bus < 0) || (targ < 0) || (lun < 0)) + impl_->name_ = NULL; + else { + impl_->name_ = new char[strlen(PREFIX_SC) + len + 1]; + sprintf(impl_->name_, "%s%dd%dl%d", PREFIX_SC, bus, targ, lun); + } + } else if (strncmp(name, "/", 1) == 0 || + strncmp(name, "./", 2) == 0 || + strncmp(name, "../", 3) == 0) { + impl_->name_ = new char[len + 1]; + strcpy(impl_->name_, name); + } else { + impl_->name_ = new char[strlen(PREFIX) + len + 1]; + strcpy(impl_->name_, PREFIX); + strcat(impl_->name_, name); + } + impl_->fd_ = -1; + impl_->timeout_ = 10*1000; + impl_->error_ = NULL; + + maxDataLen_ = 64 * 1024; + vendor_[0] = 0; + product_[0] = 0; + revision_[0] = 0; +#undef PREFIX +} + +ScsiIf::~ScsiIf() +{ + if (impl_->fd_ >= 0) (void)close(impl_->fd_); + if (impl_->name_ != NULL) delete[] impl_->name_; + if (impl_->error_ != NULL) delete[] impl_->error_; + delete impl_; +} + +int ScsiIf::init() +{ + if (impl_->name_ == NULL) return 1; + if ((impl_->fd_ = open(impl_->name_, O_RDWR, 0)) < 0) { + message(-2, "init: %s", strerror(errno)); + return 1; + } + if (inquiry()) return 2; + return 0; +} + +int ScsiIf::timeout(int t) +{ + int ret = impl_->timeout_/1000; + impl_->timeout_ = t*1000; + return ret; +} + +int ScsiIf::sendCmd(const unsigned char *cmd, int cmdLen, + const unsigned char *dataOut, int dataOutLen, + unsigned char *dataIn, int dataInLen, + int showMessage) +{ +#define ERROR(msg) {\ + impl_->error_ = new char[9 + strlen(msg) + 1];\ + strcpy(impl_->error_, "sendCmd: ");\ + strcat(impl_->error_, msg);\ + if (showMessage) printError();\ + return 1;\ +} + + if (impl_->error_ != NULL) { delete[] impl_->error_; impl_->error_ = NULL; } + /* for printError: */ + impl_->dsreq_.ds_cmdbuf = NULL; impl_->dsreq_.ds_cmdlen = 0; + impl_->dsreq_.ds_databuf = NULL; impl_->dsreq_.ds_datalen = 0; + impl_->dsreq_.ds_flags = 0; + impl_->dsreq_.ds_time = impl_->timeout_; + if (cmdLen == 0) ERROR("cmdLen == 0"); + if (cmdLen > 255) ERROR("cmdLen > 255"); + impl_->dsreq_.ds_cmdbuf = (caddr_t)cmd; + impl_->dsreq_.ds_cmdlen = cmdLen; + if (dataOut != NULL && dataIn != NULL) { + ERROR("Out and In"); + } else if (dataOut != NULL) { + if (dataOutLen == 0) ERROR("dataOutLen == 0"); + if (dataInLen != 0) ERROR("dataInLen != 0"); + impl_->dsreq_.ds_flags |= DSRQ_WRITE; + impl_->dsreq_.ds_databuf = (caddr_t)dataOut; + impl_->dsreq_.ds_datalen = dataOutLen; + } else if (dataIn != NULL) { + if (dataInLen == 0) ERROR("dataInLen == 0"); + if (dataOutLen !=0) ERROR("dataOutLen != 0"); + impl_->dsreq_.ds_flags |= DSRQ_READ; + impl_->dsreq_.ds_databuf = (caddr_t)dataIn; + impl_->dsreq_.ds_datalen = dataInLen; + } else { + if (dataOutLen !=0 || dataInLen != 0) ERROR("dataLen != 0"); + impl_->dsreq_.ds_databuf = NULL; + impl_->dsreq_.ds_datalen = 0; + } + impl_->dsreq_.ds_senselen = SENSE_MAX; + impl_->dsreq_.ds_sensebuf = (caddr_t)impl_->sensebuf_; + impl_->dsreq_.ds_flags |= DSRQ_SENSE; + if (ioctl(impl_->fd_, DS_ENTER, &impl_->dsreq_) < 0) { + char str[80]; + strcpy(str, "DS_ENTER: "); strcat(str, strerror(errno)); + ERROR(str); + } + if (impl_->dsreq_.ds_ret == 0 || + impl_->dsreq_.ds_ret == DSRT_OK || + impl_->dsreq_.ds_ret == DSRT_SHORT) + return 0; + else if (impl_->dsreq_.ds_ret == DSRT_SENSE) { + if (showMessage) printError(); + return 1; + } else { + if (showMessage) printError(); + return 2; + } +#undef ERROR +} + +const unsigned char *ScsiIf::getSense(int &len) const +{ + len = impl_->dsreq_.ds_sensesent; + return impl_->sensebuf_; +} + +void ScsiIf::printError() +{ + if (impl_->dsreq_.ds_cmdbuf != NULL) { + char s[80]; + char *p = s; + int i; + p += snprintf(p, s + sizeof(s) - p, "CDB="); + for (i = 0; i < impl_->dsreq_.ds_cmdlen; i++) { + p += snprintf(p, s + sizeof(s) - p, "%.2X ", impl_->dsreq_.ds_cmdbuf[i]); + } + p[-1] = ','; + switch (impl_->dsreq_.ds_flags & (DSRQ_READ | DSRQ_WRITE)) { + case DSRQ_READ: p += snprintf(p, s + sizeof(s) - p, " RD"); break; + case DSRQ_WRITE: p += snprintf(p, s + sizeof(s) - p, " WR"); break; + case DSRQ_READ | DSRQ_WRITE: p += snprintf(p, s + sizeof(s) - p, " RW"); break; + } + p += snprintf(p, s + sizeof(s) - p, ", BUF=%p", impl_->dsreq_.ds_databuf); + p += snprintf(p, s + sizeof(s) - p, ", LEN=%lu", impl_->dsreq_.ds_datalen); + p += snprintf(p, s + sizeof(s) - p, ", TO=%lu", impl_->dsreq_.ds_time); + message(-2, s); + } + if (impl_->error_ != NULL) { + message(-2, impl_->error_); + } else { + switch (impl_->dsreq_.ds_ret) { + case DSRT_DEVSCSI: message(-2,"devscsi failure"); break; + case DSRT_MULT: message(-2,"request rejected"); break; + case DSRT_CANCEL: message(-2,"request cancelled"); break; + case DSRT_REVCODE: message(-2,"obsolete"); break; + case DSRT_AGAIN: message(-2,"try again"); break; + case DSRT_HOST: message(-2,"host failure"); break; + case DSRT_NOSEL: message(-2,"no select"); break; + case DSRT_SHORT: message(-2,"short transfer"); break; + case DSRT_OK: message(-2,"complete transfer"); break; + case DSRT_SENSE: /* message(-2,"sense"); */ + decodeSense(impl_->sensebuf_, + impl_->dsreq_.ds_sensesent); + break; + case DSRT_NOSENSE: message(-2,"sense error"); break; + case DSRT_TIMEOUT: message(-2,"timeout"); break; + case DSRT_LONG: message(-2,"overrun"); break; + case DSRT_PROTO: message(-2,"protocol failure"); break; + case DSRT_EBSY: message(-2,"busy lost"); break; + case DSRT_REJECT: message(-2,"mesage reject"); break; + case DSRT_PARITY: message(-2,"parity error"); break; + case DSRT_MEMORY: message(-2,"memory error"); break; + case DSRT_CMDO: message(-2,"command error"); break; + case DSRT_STAI: message(-2,"status error"); break; + case DSRT_UNIMPL: message(-2,"not implemented"); break; + default: message(-2, "undefined ds_ret"); break; + } + switch (impl_->dsreq_.ds_status) { + case 0x00: message(-2, "GOOD"); break; + case 0x02: message(-2, "CHECK CONDITION"); break; + case 0x04: message(-2, "CONDITION MET"); break; + case 0x08: message(-2, "BUSY"); break; + case 0x10: message(-2, "INTERMEDIATE"); break; + case 0x14: message(-2, "INTERMEDIATE, CONDITION MET"); break; + case 0x18: message(-2, "RESERVATION CONFLICT"); break; + case 0x22: message(-2, "COMMAND TERMINATED"); break; + case 0x28: message(-2, "QUEUE FULL"); break; + case 0xff: break; + default: message(-2, "undefined status"); + } + } +} + +int inq(int fd, void *sensebuf, int senselen, char *vend, char *prod, char *rev) +{ + char buf[44]; + char cmd[] = {0x12, 0, 0, 0, sizeof(buf), 0}; + struct dsreq dsreq = { + /* flags */ DSRQ_READ, + /* time */ 1000, + /* private */ 0, + /* cmdbuf */ (caddr_t)cmd, + /* cmdlen */ sizeof(cmd), + /* databuf */ (caddr_t)buf, + /* datalen */ sizeof(buf), + /* sensebuf */ (caddr_t)sensebuf, + /* senselen */ senselen, + /* iovbuf */ NULL, + /* iovlen */ 0, + /* link */ NULL, + /* sync */ 0, + /* revcode */ 0, + /* ret */ 0, + /* status */ 0, + /* msg */ 0, + /* cmdsent */ 0, + /* datasent */ 0, + /* sensesent */ 0 + }; + char *p, *q; + + if (sensebuf != NULL && senselen > 0) + dsreq.ds_flags |= DSRQ_SENSE; + if (ioctl(fd, DS_ENTER, &dsreq) < 0 || + (dsreq.ds_ret != 0 && dsreq.ds_ret != DSRT_OK && + dsreq.ds_ret != DSRT_SHORT)) { + vend[0] = prod[0] = rev[0] = '\0'; + return 1; + } + p = buf + 8; q = buf + 16; while (q > p && q[-1] == ' ') q--; + memcpy(vend, p, q - p); vend[q - p] = '\0'; + p = buf + 16; q = buf + 32; while (q > p && q[-1] == ' ') q--; + memcpy(prod, p, q - p); prod[q - p] = '\0'; + p = buf + 32; q = buf + 36; while (q > p && q[-1] == ' ') q--; + memcpy(rev, p, q - p); rev[q - p] = '\0'; + return 0; +} + +int ScsiIf::inquiry() +{ + return inq(impl_->fd_, impl_->sensebuf_, SENSE_MAX, vendor_, product_, revision_); +} + +ScsiIf::ScanData *ScsiIf::scan(int *len) +{ + DIR *dirp; + struct dirent *dp; + int l; + int fd; + ScanData *scanData; + char s[35]; + int bus, targ, lun, count; + + scanData = new ScanData[MAX_SCAN]; *len = 0; + if ((dirp = opendir("/dev/scsi")) == 0) { *len = 0; return NULL; } + while ((dp = readdir(dirp)) != NULL) { + l = strlen(dp->d_name); + if (*len < MAX_SCAN && l > 2 && + sscanf(dp->d_name, "sc%dd%dl%d%n", &bus, &targ, &lun, &count) == 3 && + count == l) { + scanData[*len].bus = bus; + scanData[*len].id = targ; + scanData[*len].lun = lun; + strcpy(s, "/dev/scsi/"); + strcat(s, dp->d_name); + if ((fd = open(s, O_RDWR, 0)) >= 0) { + if (inq(fd, NULL, 0, + scanData[*len].vendor, + scanData[*len].product, + scanData[*len].revision) == 0) (*len)++; + } + (void)close(fd); + } + } + closedir(dirp); + return scanData; +} + +#include "ScsiIf-common.cc" diff --git a/dao/ScsiIf-lib.cc b/dao/ScsiIf-lib.cc new file mode 100644 index 0000000..792af50 --- /dev/null +++ b/dao/ScsiIf-lib.cc @@ -0,0 +1,580 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <unistd.h> +#include <string.h> +#include <assert.h> +#include <errno.h> +#include <fcntl.h> + +#include "ScsiIf.h" +#include "log.h" +#include "util.h" + +#include "xconfig.h" + +#include "standard.h" +#include "scg/scgcmd.h" +#include "scg/scsitransp.h" +#include "scg/scsireg.h" + +// schily/standard.h define these, i don't know what they smoked the +// day they came up with those defines. +#undef vendor +#undef product +#undef revision + +static void printVersionInfo(SCSI *scgp); + +#define MAX_DATALEN_LIMIT (63 * 1024) +#define MAX_SCAN_DATA_LEN 30 + +static int VERSION_INFO_PRINTED = 0; + +class ScsiIfImpl { +public: + char *dev_; + + int maxSendLen_; + SCSI *scgp_; + + long timeout_; + + unsigned int pageSize_; + char *pageAlignedBuffer_; + +#ifdef linux + const char *makeDevName(int k, int do_numeric); + const char *openScsiDevAsSg(const char *devname); +#endif +}; + +ScsiIf::ScsiIf(const char *dev) +{ + impl_ = new ScsiIfImpl; + + impl_->dev_ = strdupCC(dev); + impl_->scgp_ = NULL; + impl_->pageAlignedBuffer_ = NULL; + + vendor_[0] = 0; + product_[0] = 0; + revision_[0] = 0; + + //set_progname("cdrdao"); + + +#if defined(HAVE_GETPAGESIZE) + impl_->pageSize_ = getpagesize(); +#elif defined(_SC_PAGESIZE) + impl_->pageSize_ = sysconf(_SC_PAGESIZE); +#elif defined(_SC_PAGE_SIZE) // saw this on HPUX 9.05 + impl_->pageSize_ = sysconf(_SC_PAGE_SIZE); +#else + impl_->pageSize_ = 0; +#endif + + if (impl_->pageSize_ == 0) { + log_message(-3, "Cannot determine page size."); + impl_->pageSize_ = 1; + } + +} + +ScsiIf::~ScsiIf() +{ + if (impl_->scgp_ != NULL) { + scg_close(impl_->scgp_); + impl_->scgp_ = NULL; + } + + impl_->pageAlignedBuffer_ = NULL; + + delete[] impl_->dev_; + impl_->dev_ = NULL; + + delete impl_; +} + +// Opens the scsi device. Most of the code originates from cdrecord's +// initialization function. +// return: 0: OK +// 1: device could not be opened +// 2: inquiry failed +int ScsiIf::init() +{ + char errstr[80]; + + if ((impl_->scgp_ = scg_open(impl_->dev_, errstr, sizeof(errstr), 0, 0)) + == NULL) { + log_message(-2, "Cannot open SCSI device '%s': %s", impl_->dev_, errstr); + return 1; + } + + impl_->timeout_ = impl_->scgp_->deftimeout; + + maxDataLen_ = scg_bufsize(impl_->scgp_, MAX_DATALEN_LIMIT); + + log_message(5, "SCSI: max DMA: %ld", maxDataLen_); + + if (maxDataLen_ > MAX_DATALEN_LIMIT) + maxDataLen_ = MAX_DATALEN_LIMIT; + + impl_->pageAlignedBuffer_ = (char *)scg_getbuf(impl_->scgp_, maxDataLen_); + + if (impl_->pageAlignedBuffer_ == NULL) { + log_message(-2, "Cannot get SCSI buffer."); + return 1; + } + + printVersionInfo(impl_->scgp_); + + if (inquiry() != 0) + return 2; + + return 0; + +} + +// Sets given timeout value in seconds and returns old timeout. +// return: old timeout +int ScsiIf::timeout(int t) +{ + long oldTimeout = impl_->timeout_; + + if (t > 0) + impl_->timeout_ = t; + + return oldTimeout; +} + +// sends a scsi command and receives data +// return 0: OK +// 1: scsi command failed (os level, no sense data available) +// 2: scsi command failed (sense data available) +int ScsiIf::sendCmd(const unsigned char *cmd, int cmdLen, + const unsigned char *dataOut, int dataOutLen, + unsigned char *dataIn, int dataInLen, + int showMessage) +{ + assert(cmdLen > 0 && cmdLen <= 12); + + assert(dataOutLen == 0 || dataInLen == 0); + + assert(dataOutLen <= maxDataLen_); + assert(dataInLen <= maxDataLen_); + + struct scg_cmd *scmd = impl_->scgp_->scmd; + int usedPageAlignedBuffer = 0; + + memset(scmd, 0, sizeof(*scmd)); + + memcpy(scmd->cdb.cmd_cdb, cmd, cmdLen); + scmd->cdb_len = cmdLen; + + if (dataOutLen > 0) { + if (((size_t)dataOut % impl_->pageSize_) != 0) { + //log_message(0, "Use SCSI buffer for data out."); + memcpy(impl_->pageAlignedBuffer_, dataOut, dataOutLen); + scmd->addr = impl_->pageAlignedBuffer_; + } + else { + //log_message(0, "Data out is page aligned."); + scmd->addr = (char*)dataOut; + } + + scmd->size = dataOutLen; + } + else if (dataInLen > 0) { + if (((size_t)dataIn % impl_->pageSize_) != 0) { + //log_message(0, "Use SCSI buffer for data in."); + scmd->addr = impl_->pageAlignedBuffer_; + usedPageAlignedBuffer = 1; + } + else { + //log_message(0, "Data in is page aligned."); + scmd->addr = (char*)dataIn; + } + + scmd->size = dataInLen; + scmd->flags = SCG_RECV_DATA; + } + + scmd->flags |= SCG_DISRE_ENA; + scmd->timeout = impl_->timeout_; + + scmd->sense_len = CCS_SENSE_LEN; + //scmd->target = impl_->scgp_->target; + + impl_->scgp_->cmdname = (char*)" "; + impl_->scgp_->verbose = 0; + impl_->scgp_->silent = 1; + + if (scg_cmd(impl_->scgp_) < 0) { + return scmd->sense_count > 0 ? 2 : 1; + } + + if (usedPageAlignedBuffer) + memcpy(dataIn, impl_->pageAlignedBuffer_, dataInLen); + + return 0; +} + +const unsigned char *ScsiIf::getSense(int &len) const +{ + len = impl_->scgp_->scmd->sense_count; + + return impl_->scgp_->scmd->u_sense.cmd_sense; +} + +void ScsiIf::printError() +{ + scg_printerr(impl_->scgp_); +} + +int ScsiIf::inquiry() +{ + unsigned char cmd[6]; + unsigned char result[0x2c]; + int i; + + cmd[0] = 0x12; // INQUIRY + cmd[1] = cmd[2] = cmd[3] = 0; + cmd[4] = 0x2c; + cmd[5] = 0; + + + if (sendCmd(cmd, 6, NULL, 0, result, 0x2c, 0) != 0) { + log_message(-2, "Inquiry command failed on '%s'.", impl_->dev_); + return 1; + } + + strncpy(vendor_, (char *)(result + 0x08), 8); + vendor_[8] = 0; + + strncpy(product_, (char *)(result + 0x10), 16); + product_[16] = 0; + + strncpy(revision_, (char *)(result + 0x20), 4); + revision_[4] = 0; + + for (i = 7; i >= 0 && vendor_[i] == ' '; i--) { + vendor_[i] = 0; + } + + for (i = 15; i >= 0 && product_[i] == ' '; i--) { + product_[i] = 0; + } + + for (i = 3; i >= 0 && revision_[i] == ' '; i--) { + revision_[i] = 0; + } + + return 0; +} + +static int scanInquiry(SCSI *scgp, unsigned char *buf, ScsiIf::ScanData *sdata) +{ + struct scg_cmd *cmd = scgp->scmd; + int i; + + int dev_sense = scg_sense_key(scgp); + + memset(buf, 0, 36); + memset(cmd, 0, sizeof(struct scg_cmd)); + + cmd->cdb.g0_cdb.cmd = 0x12; // INQUIRY + cmd->cdb.g0_cdb.count = 36; + + cmd->addr = (char*)buf; + cmd->size = 36; + cmd->flags = SCG_RECV_DATA|SCG_DISRE_ENA; + cmd->cdb_len = SC_G0_CDBLEN; + cmd->sense_len = CCS_SENSE_LEN; + scgp->silent = 1; + scgp->cmdname = (char*)"inquiry"; + +#ifdef SCSI_ATAPI + int is_atapi = scg_isatapi(scgp); +#else + int is_atapi = 0; +#endif + int cmd_status = scg_cmd(scgp); + + if (cmd_status == 0 || (is_atapi && dev_sense >= 0)) { + struct scsi_inquiry* inq = (struct scsi_inquiry*)buf; + if (inq->type == INQ_OPTD || inq->type == INQ_ROMD) { + char buf[16]; + sprintf(buf, "%d,%d,%d", scg_scsibus(scgp), scg_target(scgp), + scg_lun(scgp)); + sdata->dev += buf; + + strncpy(sdata->vendor, inq->vendor_info, 8); + sdata->vendor[8] = 0; + strncpy(sdata->product, inq->prod_ident, 16); + sdata->product[16] = 0; + strncpy(sdata->revision, inq->prod_revision, 4); + sdata->revision[4] = 0; + + return 1; + } + } + + return 0; +} + +ScsiIf::ScanData *ScsiIf::scan(int *len, char* scsi_dev) +{ + ScanData *sdata = NULL; + SCSI *scgp; + unsigned char *buf; + char errstr[80]; + + *len = 0; + + if ((scgp = scg_open(scsi_dev, errstr, sizeof(errstr), 0, 0)) == NULL) + return NULL; + + printVersionInfo(scgp); + + // allocate buffer for inquiry data + if ((buf = (unsigned char *)scg_getbuf(scgp, 100)) == NULL) { + scg_close(scgp); + return NULL; + } + + sdata = new ScanData[MAX_SCAN_DATA_LEN]; + + for (int bus = 0; bus < 16 && *len < MAX_SCAN_DATA_LEN; bus++) { + + if (scg_havebus(scgp, bus)) { + int lun = 0; + + for (int target=0; target < 16 && *len < MAX_SCAN_DATA_LEN; target++) { + scg_settarget(scgp, bus, target, lun); + if (scsi_dev) { + sdata[*len].dev = scsi_dev; + sdata[*len].dev += ":"; + } + if (scanInquiry(scgp, buf, &(sdata[*len]))) + *len += 1; + } + } + } + + + scg_close(scgp); + + return sdata; +} + +static void printVersionInfo(SCSI *scgp) +{ + if (!VERSION_INFO_PRINTED) { + VERSION_INFO_PRINTED = 1; + + const char *vers = scg_version(0, SCG_VERSION); + const char *auth = scg_version(0, SCG_AUTHOR); + log_message(3, "Using libscg version '%s-%s'", auth, vers); + + vers = scg_version(scgp, SCG_VERSION); + auth = scg_version(scgp, SCG_AUTHOR); + + log_message(3, "Using libscg transport code version '%s-%s'", auth, vers); + + vers = scg_version(scgp, SCG_RVERSION); + auth = scg_version(scgp, SCG_RAUTHOR); + + if (vers != NULL && auth != NULL) { + log_message(3, "Using remote transport code version '%s-%s'", auth, vers); + } + + log_message(2, ""); + } +} + +const int ScsiIf::bus () +{ + return scg_scsibus (this->impl_->scgp_); +} + +const int ScsiIf::id () +{ + return scg_target (this->impl_->scgp_); +} + +const int ScsiIf::lun () +{ + return scg_lun (this->impl_->scgp_); +} + +#include "ScsiIf-common.cc" + +#ifdef linux + +#include <sys/ioctl.h> +#include <scsi/scsi.h> +#include <scsi/sg.h> + +/* Function for mapping any SCSI device to the corresponding SG device. + * Taken from D. Gilbert's example code. + */ + +#define MAX_SG_DEVS 26 + +#define SCAN_ALPHA 0 +#define SCAN_NUMERIC 1 +#define DEF_SCAN SCAN_ALPHA + +const char *ScsiIfImpl::makeDevName(int k, int do_numeric) +{ + static char filename[100]; + char buf[20]; + + strcpy(filename, "/dev/sg"); + + if (do_numeric) { + sprintf(buf, "%d", k); + strcat(filename, buf); + } + else { + if (k <= 26) { + buf[0] = 'a' + (char)k; + buf[1] = '\0'; + strcat(filename, buf); + } + else { + strcat(filename, "xxxx"); + } + } + + return filename; +} + +const char *ScsiIfImpl::openScsiDevAsSg(const char *devname) +{ + int fd, bus, bbus, k; + int do_numeric = DEF_SCAN; + const char *fname = devname; + struct { + int mux4; + int hostUniqueId; + } m_idlun, mm_idlun; + + if ((fd = open(fname, O_RDONLY | O_NONBLOCK)) < 0) { + if (EACCES == errno) + fd = open(fname, O_RDWR | O_NONBLOCK); + } + + if (fd < 0) { + log_message(-2, "Cannot open \"%s\": %s", fname, strerror(errno)); + return NULL; + } + + if (ioctl(fd, SG_GET_TIMEOUT, 0) < 0) { /* not a sg device ? */ + +#ifdef SCSI_IOCTL_GET_BUS_NUMBER + if (ioctl(fd, SCSI_IOCTL_GET_BUS_NUMBER, &bus) < 0) { + log_message(-2, "%s: Need a filename that resolves to a SCSI device.", + fname); + close(fd); + return NULL; + } +#else + bus = 0; +#endif + + + if (ioctl(fd, SCSI_IOCTL_GET_IDLUN, &m_idlun) < 0) { + log_message(-2, "%s: Need a filename that resolves to a SCSI device (2).", + fname); + close(fd); + return NULL; + } + close(fd); + + for (k = 0; k < MAX_SG_DEVS; k++) { + fname = makeDevName(k, do_numeric); + if ((fd = open(fname, O_RDONLY | O_NONBLOCK)) < 0) { + if (EACCES == errno) + fd = open(fname, O_RDWR | O_NONBLOCK); + if (fd < 0) { + if ((ENOENT == errno) && (0 == k) && (do_numeric == DEF_SCAN)) { + do_numeric = ! DEF_SCAN; + fname = makeDevName(k, do_numeric); + if ((fd = open(fname, O_RDONLY | O_NONBLOCK)) < 0) { + if (EACCES == errno) + fd = open(fname, O_RDWR | O_NONBLOCK); + } + } + if (fd < 0) { + if (EBUSY == errno) + continue; /* step over if O_EXCL already on it */ + else + break; + } + } + } + +#ifdef SCSI_IOCTL_GET_BUS_NUMBER + if (ioctl(fd, SCSI_IOCTL_GET_BUS_NUMBER, &bbus) < 0) { + log_message(-2, "%s: SG: ioctl SCSI_IOCTL_GET_BUS_NUMBER failed: %s", + fname, strerror(errno)); + close(fd); + fd = -9999; + } +#else + bbus = 0; +#endif + + if (ioctl(fd, SCSI_IOCTL_GET_IDLUN, &mm_idlun) < 0) { + log_message(-2, "%s: SG: ioctl SCSI_IOCTL_GET_IDLUN failed: %s", + fname, strerror(errno)); + close(fd); + fd = -9999; + } + if ((bus == bbus) && + ((m_idlun.mux4 & 0xff) == (mm_idlun.mux4 & 0xff)) && + (((m_idlun.mux4 >> 8) & 0xff) == + ((mm_idlun.mux4 >> 8) & 0xff)) && + (((m_idlun.mux4 >> 16) & 0xff) == + ((mm_idlun.mux4 >> 16) & 0xff))) { + log_message(4, "Mapping %s to sg device: %s", devname, fname); + break; + } + else { + close(fd); + fd = -9999; + } + } + } + + if (fd >= 0) { + close(fd); + return fname; + } + else { + log_message(-2, "Cannot map \"%s\" to a SG device.", devname); + return NULL; + } +} + +#endif diff --git a/dao/ScsiIf-linux.cc b/dao/ScsiIf-linux.cc new file mode 100644 index 0000000..1073e6a --- /dev/null +++ b/dao/ScsiIf-linux.cc @@ -0,0 +1,432 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 2007 Denis Leroy <denis@poolshark.org> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <stdio.h> +#include <fcntl.h> +#include <unistd.h> +#include <errno.h> +#include <string.h> +#include <assert.h> +#include <sys/ioctl.h> +#include <glob.h> +#include <asm/param.h> +#include <scsi/scsi.h> +#include <scsi/sg.h> + +#include "ScsiIf.h" +#include "sg_err.h" +#include "log.h" +#include "util.h" + +// +// SG_IO Linux SCSI interface +/// + +#ifndef SG_GET_RESERVED_SIZE +#define SG_GET_RESERVED_SIZE 0x2272 +#endif + +#ifndef SG_SET_RESERVED_SIZE +#define SG_SET_RESERVED_SIZE 0x2275 +#endif + +#ifndef SG_GET_VERSION_NUM +#define SG_GET_VERSION_NUM 0x2282 +#endif + +#ifndef SG_MAX_SENSE +#define SG_MAX_SENSE 16 +#endif + +#define CDRDAO_DEFAULT_TIMEOUT 30000 + +#define SYSFS_SCSI_DEVICES "/sys/bus/scsi/devices" + +typedef unsigned char uchar; + +class ScsiIfImpl +{ +public: + char* filename_; // user provided device name + int fd_; + bool readOnlyMode; + + int openScsiDevAsSg(const char* devname); + int adjustReservedBuffer(int requestedSize); + + uchar sense_buffer[SG_MAX_SENSE]; + uchar sense_buffer_length; + + uchar last_sense_buffer_length; + uchar last_command_status; + + int timeout_ms; +}; + + +ScsiIf::ScsiIf(const char *dev) +{ + impl_ = new ScsiIfImpl; + memset(impl_, 0, sizeof(ScsiIfImpl)); + + impl_->filename_ = strdupCC(dev); + impl_->fd_ = -1; + impl_->sense_buffer_length = SG_MAX_SENSE; + impl_->timeout_ms = CDRDAO_DEFAULT_TIMEOUT; +} + +ScsiIf::~ScsiIf() +{ + if (impl_->fd_ >= 0) + close(impl_->fd_); + + delete[] impl_->filename_; + delete impl_; +} + +// Opens and flushes scsi device. + +int ScsiIf::init() +{ + int flags; + int sg_version = 0; + + impl_->fd_ = open(impl_->filename_, O_RDWR | O_NONBLOCK | O_EXCL); + + if (impl_->fd_ < 0) { + + if (errno == EACCES) { + impl_->fd_ = open(impl_->filename_, O_RDONLY | O_NONBLOCK); + + if (impl_->fd_ < 0) { + goto failed; + } + impl_->readOnlyMode = true; + log_message(-1, "No permission to write to SCSI device." + "Only read commands are supported."); + } else { + goto failed; + } + } + + if (ioctl(impl_->fd_, SG_GET_VERSION_NUM, &sg_version) == 0) { + log_message(3, "Detected SG driver version: %d.%d.%d", + sg_version / 10000, + (sg_version / 100) % 100, sg_version % 100); + if (sg_version < 30000) { + log_message(-2, "SG interface under 3.0 not supported."); + return 1; + } + } + + maxDataLen_ = impl_->adjustReservedBuffer(64 * 1024); + + if (inquiry() != 0) { + return 2; + } + + return 0; + + failed: + log_message(-2, "Unable to open SCSI device %s: %s.", + impl_->filename_, strerror(errno)); + return 1; +} + +// Sets given timeout value in seconds and returns old timeout. Return +// the previous timeout value. + +int ScsiIf::timeout(int t) +{ + int old = impl_->timeout_ms / 1000; + impl_->timeout_ms = t * 1000; + + return old; +} + +// Sens a scsi command and send/receive data. + +int ScsiIf::sendCmd(const uchar *cmd, int cmdLen, const uchar *dataOut, + int dataOutLen, uchar *dataIn, int dataInLen, int showMsg) +{ + int status; + + sg_io_hdr_t io_hdr; + memset(&io_hdr, 0, sizeof(io_hdr)); + + // Check SCSI cdb length. + assert(cmdLen >= 0 && cmdLen <= 16); + // Can't both input and output data. + assert(!(dataOut && dataIn)); + + io_hdr.interface_id = 'S'; + io_hdr.cmd_len = cmdLen; + io_hdr.cmdp = (unsigned char*)cmd; + io_hdr.timeout = impl_->timeout_ms; + io_hdr.sbp = impl_->sense_buffer; + io_hdr.mx_sb_len = impl_->sense_buffer_length; + io_hdr.flags = 1; + + if (dataOut) { + io_hdr.dxferp = (void*)dataOut; + io_hdr.dxfer_len = dataOutLen; + io_hdr.dxfer_direction = SG_DXFER_TO_DEV; + } else if (dataIn) { + io_hdr.dxferp = dataIn; + io_hdr.dxfer_len = dataInLen; + io_hdr.dxfer_direction = SG_DXFER_FROM_DEV; + } + + log_message(4, "%s: Initiating SCSI command %s%s", + impl_->filename_, sg_strcommand(cmd[0]), + sg_strcmdopts(cmd)); + + if (ioctl(impl_->fd_, SG_IO, &io_hdr) < 0) { + int errnosave = errno; + log_message((showMsg ? -2 : 3), "%s: SCSI command %s (0x%02x) " + "failed: %s.", impl_->filename_, + sg_strcommand(cmd[0]), cmd[0], + strerror(errnosave)); + return 1; + } + + log_message(4, "%s: SCSI command %s (0x%02x) executed in %u ms, status=%d", + impl_->filename_, sg_strcommand(cmd[0]), + cmd[0], io_hdr.duration, io_hdr.status); + + impl_->last_sense_buffer_length = io_hdr.sb_len_wr; + impl_->last_command_status = io_hdr.status; + + if (io_hdr.status) { + if (io_hdr.sb_len_wr > 0) + return 2; + else + return 1; + } + + return 0; +} + +const uchar *ScsiIf::getSense(int &len) const +{ + len = impl_->last_sense_buffer_length; + return impl_->sense_buffer; +} + +void ScsiIf::printError() +{ + sg_print_sense("\nSCSI command failed", impl_->sense_buffer); +} + + +int ScsiIf::inquiry() +{ + unsigned char cmd[6] = { INQUIRY, 0, 0, 0, 0x2c, 0 }; + unsigned char result[0x2c]; + int i; + + memset(result, 0, sizeof(result)); + + if (sendCmd(cmd, 6, NULL, 0, result, 0x2c, 1) != 0) { + log_message(-2, "Inquiry command failed on \"%s\"", impl_->filename_); + return 1; + } + + strncpy(vendor_, (char *)(result + 0x08), 8); + vendor_[8] = 0; + + strncpy(product_, (char *)(result + 0x10), 16); + product_[16] = 0; + + strncpy(revision_, (char *)(result + 0x20), 4); + revision_[4] = 0; + + // Remove all trailing spaces. + for (i = 7; i >= 0 && vendor_[i] == ' '; i--) { + vendor_[i] = 0; + } + for (i = 15; i >= 0 && product_[i] == ' '; i--) { + product_[i] = 0; + } + for (i = 3; i >= 0 && revision_[i] == ' '; i--) { + revision_[i] = 0; + } + + return 0; +} + +// Scan implementation uses sysfs to + +ScsiIf::ScanData *ScsiIf::scan(int *len, char* scsi_dev_path) +{ + struct stat st; + int matches = 0; + unsigned i; + ScanData* sdata = NULL; + char* path = NULL; + glob_t pglob; + + if (stat(SYSFS_SCSI_DEVICES, &st) != 0) { + log_message(-2, "Unable to access sysfs filesystem at %s", + SYSFS_SCSI_DEVICES); + goto fail; + } + + path = (char*)alloca(strlen(SYSFS_SCSI_DEVICES) + 64); + sprintf(path, "%s/*", SYSFS_SCSI_DEVICES); + if (glob(path, 0, NULL, &pglob) != 0) { + log_message(-2, "Unable to glob through sysfs filesystem (%d).", + errno); + goto fail; + } + + sdata = new ScanData[pglob.gl_pathc]; + + for (i = 0; i < pglob.gl_pathc; i++) { + int type; + char rbuf[16]; + FILE* f; + + sprintf(path, "%s/type", pglob.gl_pathv[i]); + f = fopen(path, "r"); + if (!f) + continue; + int ret = fscanf(f, "%d", &type); + fclose(f); + + if (ret != 1 || type != TYPE_ROM) + continue; + + // Now we have a CD-ROM device. + memset(&sdata[matches].vendor, 0, sizeof(sdata[matches].vendor)); + memset(&sdata[matches].product, 0, sizeof(sdata[matches].product)); + memset(&sdata[matches].revision, 0, sizeof(sdata[matches].revision)); + + // Copy vendor data + sprintf(path, "%s/vendor", pglob.gl_pathv[i]); + f = fopen(path, "r"); + if (!f) + continue; + if (fread(sdata[matches].vendor, 8, 1, f) != 1) { + fclose(f); + continue; + } + fclose(f); + + // Copy product data + sprintf(path, "%s/model", pglob.gl_pathv[i]); + f = fopen(path, "r"); + if (!f) + continue; + if (fread(sdata[matches].product, 16, 1, f) != 1) { + fclose(f); + continue; + } + fclose(f); + + // Copy revision data + sprintf(path, "%s/rev", pglob.gl_pathv[i]); + f = fopen(path, "r"); + if (!f) + continue; + if (fread(sdata[matches].revision, 4, 1, f) != 1) { + fclose(f); + continue; + } + fclose(f); + + // figure out the block device + glob_t bglob; + char* devname = NULL; + sprintf(path, "%s/block:*", pglob.gl_pathv[i]); + if (glob(path, 0, NULL, &bglob) == 0) { + + if (bglob.gl_pathc != 1) { + globfree(&bglob); + continue; + } + + char* match = strrchr(bglob.gl_pathv[0], ':'); + if (!match) { + globfree(&bglob); + continue; + } + devname = (char*)alloca(strlen(match)); + strcpy(devname, match+1); + } else { + sprintf(path, "%s/block/*", pglob.gl_pathv[i]); + if (glob(path, 0, NULL, &bglob) == 0) { + + if (bglob.gl_pathc != 1) { + globfree(&bglob); + continue; + } + char* match = strrchr(bglob.gl_pathv[0], '/'); + devname = (char*)alloca(strlen(match)); + strcpy(devname, match + 1); + } + } + + if (devname) { + sdata[matches].dev = "/dev/"; + sdata[matches].dev += devname; + globfree(&bglob); + } else { + continue; + } + + matches++; + + } + globfree(&pglob); + + if (matches) { + *len = matches; + return sdata; + } + + delete[] sdata; + fail: + *len = 0; + return NULL; +} + +#include "ScsiIf-common.cc" + +int ScsiIfImpl::adjustReservedBuffer(int requestedSize) +{ + int maxTransferLength; + + if (ioctl(fd_, SG_SET_RESERVED_SIZE, &requestedSize) < 0) { + log_message(-2, "SG_SET_RESERVED_SIZE ioctl failed: %s", + strerror(errno)); + return 0; + } + if (ioctl(fd_, SG_GET_RESERVED_SIZE, &maxTransferLength) < 0) { + log_message(-2, "SG_GET_RESERVED_SIZE ioctl failed: %s", + strerror(errno)); + return 0; + } + + log_message(4, "SG: Maximum transfer length: %ld", maxTransferLength); + + return maxTransferLength; +} diff --git a/dao/ScsiIf-netbsd.cc b/dao/ScsiIf-netbsd.cc new file mode 100644 index 0000000..dbd80c1 --- /dev/null +++ b/dao/ScsiIf-netbsd.cc @@ -0,0 +1,321 @@ +/* + * Native implementation of cdrdao's SCSI interface for NetBSD. + * Copyright (C) by Edgar Fu�, Bonn, May 2003, July 2007. + * Do with this whatever you like, as long as you are either me or you keep + * this message intact and both + * - acknowledge that I wrote it for cdrdao and NetBSD in the first place, and + * - don't blame me if it doesn't do what you like or expect. + * These routines do exactly what they do. If that's not what you expect them + * or would like them to do, don't complain with me, the cdrdao project, my + * neighbour's brother-in-law or anybody else, but rewrite them to your taste. + */ + +#include <ctype.h> +#include <string.h> +#include <errno.h> +#include <sys/scsiio.h> +#include <fcntl.h> +#include <sys/types.h> +#include <dirent.h> +/* avoid ../trackdb/util.h */ +#include "/usr/include/util.h" +#include <unistd.h> + +#include "ScsiIf.h" + +/* can't include trackdb/util.h */ +extern void message(int level, const char *fmt, ...); + +#include "decodeSense.cc" + +#define MAX_SCAN 32 + +class ScsiIfImpl { +public: + char *name_; + int fd_; + long timeout_; /* in ms */ + struct scsireq screq_; + char *error_; +}; + +ScsiIf::ScsiIf(const char *name) +{ +#define PREFIX "/dev/" + int len; + + impl_ = new ScsiIfImpl; + len = strlen(name); + if (len == 0) { + impl_->name_ = NULL; + } else if (strncmp(name, "/", 1) == 0 || + strncmp(name, "./", 2) == 0 || + strncmp(name, "../", 3) == 0) { + impl_->name_ = new char[len + 1]; + strcpy(impl_->name_, name); + } else if (isdigit(name[len-1]) && + (strncmp(name, "sd", 2) == 0 || + strncmp(name, "rsd", 3) == 0 || + strncmp(name, "cd", 2) == 0 || + strncmp(name, "rcd", 3) == 0)) { + impl_->name_ = new char[strlen(PREFIX) + len + 1 + 1]; + strcpy(impl_->name_, PREFIX); + strcat(impl_->name_, name); + impl_->name_[strlen(PREFIX) + len] = 'a' + getrawpartition(); + impl_->name_[strlen(PREFIX) + len + 1] = '\0'; + } else { + impl_->name_ = new char[strlen(PREFIX) + len + 1]; + strcpy(impl_->name_, PREFIX); + strcat(impl_->name_, name); + } + impl_->fd_ = -1; + impl_->timeout_ = 5*1000; + impl_->error_ = NULL; + + maxDataLen_ = 64 * 1024; + vendor_[0] = 0; + product_[0] = 0; + revision_[0] = 0; +#undef PREFIX +} + +ScsiIf::~ScsiIf() +{ + if (impl_->fd_ >= 0) (void)close(impl_->fd_); + if (impl_->name_ != NULL) delete[] impl_->name_; + if (impl_->error_ != NULL) delete[] impl_->error_; + delete impl_; +} + +int ScsiIf::init() +{ + if (impl_->name_ == NULL) return 1; + if ((impl_->fd_ = open(impl_->name_, O_RDWR, 0)) < 0) { + message(-2, "init: %s", strerror(errno)); + return 1; + } + if (inquiry()) return 2; + return 0; +} + +int ScsiIf::timeout(int t) +{ + int ret = impl_->timeout_/1000; + impl_->timeout_ = t*1000; + return ret; +} + +// sends a scsi command and receives data +// return 0: OK +// 1: scsi command failed (os level, no sense data available) +// 2: scsi command failed (sense data available) +int ScsiIf::sendCmd(const unsigned char *cmd, int cmdLen, + const unsigned char *dataOut, int dataOutLen, + unsigned char *dataIn, int dataInLen, + int showMessage) +{ +#define ERROR(msg) {\ + impl_->error_ = new char[9 + strlen(msg) + 1];\ + strcpy(impl_->error_, "sendCmd: ");\ + strcat(impl_->error_, msg);\ + if (showMessage) printError();\ + return 1;\ +} + if (impl_->error_ != NULL) { delete[] impl_->error_; impl_->error_ = NULL; } + /* for printError: */ + impl_->screq_.cmdlen = 0; + impl_->screq_.databuf = NULL; impl_->screq_.datalen = 0; + impl_->screq_.flags = 0; + impl_->screq_.timeout = impl_->timeout_; + if (cmdLen > 16) ERROR("cmdLen > 16"); + if (cmdLen == 0) ERROR("cmdLen == 0"); + memcpy(impl_->screq_.cmd, cmd, cmdLen); + impl_->screq_.cmdlen = cmdLen; + if (dataOut != NULL && dataIn != NULL) { + ERROR("Out and In"); + } else if (dataOut != NULL) { + if (dataOutLen == 0) ERROR("dataOutLen == 0"); + if (dataInLen != 0) ERROR("dataInLen != 0"); + impl_->screq_.flags |= SCCMD_WRITE; + impl_->screq_.databuf = (caddr_t)dataOut; + impl_->screq_.datalen = dataOutLen; + } else if (dataIn != NULL) { + if (dataInLen == 0) ERROR("dataInLen == 0"); + if (dataOutLen !=0) ERROR("dataOutLen != 0"); + impl_->screq_.flags |= SCCMD_READ; + impl_->screq_.databuf = (caddr_t)dataIn; + impl_->screq_.datalen = dataInLen; + } else { + if (dataOutLen !=0 || dataInLen != 0) ERROR("dataLen != 0"); + impl_->screq_.databuf = NULL; + impl_->screq_.datalen = 0; + } + impl_->screq_.senselen = SENSEBUFLEN; + if (ioctl(impl_->fd_, SCIOCCOMMAND, &impl_->screq_) < 0) { + char str[80]; + strcpy(str, "SCIOCOMMAND: "); strcat(str, strerror(errno)); + ERROR(str); + } + if (impl_->screq_.retsts == SCCMD_OK && impl_->screq_.status == 0) + return 0; + else if (impl_->screq_.retsts == SCCMD_SENSE && impl_->screq_.status == 0) { + if (showMessage) printError(); + return 1; + } else { + if (showMessage) printError(); + return 2; + } +#undef ERROR +} + +const unsigned char *ScsiIf::getSense(int &len) const +{ + len = impl_->screq_.senselen_used; + return impl_->screq_.sense; +} + +void ScsiIf::printError() +{ + if (impl_->screq_.cmdlen > 0) { + char s[80]; + char *p = s; + int i; + p += snprintf(p, s + sizeof(s) - p, "CDB="); + for (i = 0; i < impl_->screq_.cmdlen; i++) { + p += snprintf(p, s + sizeof(s) - p, "%.2X ", impl_->screq_.cmd[i]); + } + p[-1] = ','; + switch (impl_->screq_.flags & (SCCMD_READ | SCCMD_WRITE)) { + case SCCMD_READ: p += snprintf(p, s + sizeof(s) - p, " RD"); break; + case SCCMD_WRITE: p += snprintf(p, s + sizeof(s) - p, " WR"); break; + case SCCMD_READ | SCCMD_WRITE: p += snprintf(p, s + sizeof(s) - p, " RW"); break; + } + p += snprintf(p, s + sizeof(s) - p, ", BUF=%p", impl_->screq_.databuf); + p += snprintf(p, s + sizeof(s) - p, ", LEN=%lu", impl_->screq_.datalen); + p += snprintf(p, s + sizeof(s) - p, ", TO=%lu", impl_->screq_.timeout); + message(-2, s); + } + if (impl_->error_ != NULL) { + message(-2, impl_->error_); + } else switch (impl_->screq_.retsts) { + case SCCMD_OK: switch (impl_->screq_.status) { + case 0x00: message(-2, "GOOD"); break; + case 0x02: message(-2, "CHECK CONDITION"); break; + case 0x04: message(-2, "CONDITION MET"); break; + case 0x08: message(-2, "BUSY"); break; + case 0x10: message(-2, "INTERMEDIATE"); break; + case 0x14: message(-2, "INTERMEDIATE, CONDITION MET"); break; + case 0x18: message(-2, "RESERVATION CONFLICT"); break; + case 0x22: message(-2, "COMMAND TERMINATED"); break; + case 0x28: message(-2, "QUEUE FULL"); break; + default: message(-2, "undefined status"); + } break; + case SCCMD_TIMEOUT: message(-2, "timeout"); break; + case SCCMD_BUSY: message(-2, "busy"); break; + case SCCMD_SENSE: decodeSense(impl_->screq_.sense, + impl_->screq_.senselen_used); break; + case SCCMD_UNKNOWN: message(-2, "unknown error"); break; + default: message(-2, "undefined retsts"); break; + } +} + +int inq(int fd, char *vend, char *prod, char *rev) +{ + char buf[44]; + struct scsireq screq = { + /* flags */ SCCMD_READ, + /* timeout */ 1000, + /* cmd */ {0x12, 0, 0, 0, sizeof(buf), 0}, + /* cmdlen */ 6, + /* databuf */ (caddr_t)&buf, + /* datalen */ sizeof(buf), + /* datalen_used */ 0, + /* sense */ {}, + /* senselen */ SENSEBUFLEN, + /* senselen_used */ 0, + /* status */ 0, + /* retsts */ 0, + /* error */ 0 + }; + char *p, *q; + + if (ioctl(fd, SCIOCCOMMAND, &screq) < 0 || + screq.status != 0 || + screq.retsts != SCCMD_OK) { + vend[0] = prod[0] = rev[0] = '\0'; + return 1; + } + p = buf + 8; q = buf + 16; while (q > p && q[-1] == ' ') q--; + memcpy(vend, p, q - p); vend[q - p] = '\0'; + p = buf + 16; q = buf + 32; while (q > p && q[-1] == ' ') q--; + memcpy(prod, p, q - p); prod[q - p] = '\0'; + p = buf + 32; q = buf + 36; while (q > p && q[-1] == ' ') q--; + memcpy(rev, p, q - p); rev[q - p] = '\0'; + return 0; +} + +int ScsiIf::inquiry() +{ + return inq(impl_->fd_, vendor_, product_, revision_); +} + +ScsiIf::ScanData *ScsiIf::scan(int *len) +{ + DIR *dirp; + struct dirent *dp; + char c; + int l; + int fd; + struct scsi_addr saddr; + ScanData *scanData; + char *s; + + scanData = new ScanData[MAX_SCAN]; *len = 0; + c = 'a' + getrawpartition(); + if ((dirp = opendir("/dev")) == 0) { *len = 0; return NULL; } + while ((dp = readdir(dirp)) != NULL) { + l = strlen(dp->d_name); + if (*len < MAX_SCAN && l > 2 && + (((strncmp(dp->d_name, "rsd", 3) == 0 || + strncmp(dp->d_name, "rcd", 3) == 0) && + isdigit(dp->d_name[l-2]) && dp->d_name[l-1] == c) || + ((strncmp(dp->d_name, "enrst", 5) == 0 || + strncmp(dp->d_name, "ch", 2) == 0 || + strncmp(dp->d_name, "enss", 4) == 0 || + strncmp(dp->d_name, "uk", 2) == 0) && + isdigit(dp->d_name[l-1])))) { + s = new char[5 + l + 1]; + strcpy(s, "/dev/"); + strcat(s, dp->d_name); + if ((fd = open(s, O_RDWR, 0)) >= 0) { + if (ioctl(fd, SCIOCIDENTIFY, &saddr) >= 0) { + switch (saddr.type) { + case TYPE_SCSI: + scanData[*len].bus = saddr.addr.scsi.scbus; + scanData[*len].id = saddr.addr.scsi.target; + scanData[*len].lun = saddr.addr.scsi.lun; + break; + case TYPE_ATAPI: + scanData[*len].bus = saddr.addr.atapi.atbus; + scanData[*len].id = saddr.addr.atapi.drive; + scanData[*len].lun = -1; + break; + default: + scanData[*len].bus = + scanData[*len].id = + scanData[*len].lun = -1; + } + if (inq(fd, scanData[*len].vendor, + scanData[*len].product, + scanData[*len].revision) == 0) (*len)++; + } + (void)close(fd); + } + delete[] s; + } + } + closedir(dirp); + return scanData; +} + +#include "ScsiIf-common.cc" diff --git a/dao/ScsiIf-nt.cc b/dao/ScsiIf-nt.cc new file mode 100644 index 0000000..c62b6e5 --- /dev/null +++ b/dao/ScsiIf-nt.cc @@ -0,0 +1,338 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "config.h" + +#include <windows.h> +#include <winioctl.h> +#include <stdio.h> +#include <fcntl.h> +#include <errno.h> +#include <stddef.h> +#include <string.h> +#include <assert.h> + +#include "ScsiIf.h" +#include "log.h" + +#include "ntddcdrm.h" + +#include "decodeSense.cc" + +// +// SCSI Definitionen. +// + +#define IOCTL_SCSI_BASE FILE_DEVICE_CONTROLLER +#define IOCTL_SCSI_GET_CAPABILITIES CTL_CODE(IOCTL_SCSI_BASE, 0x0404, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_SCSI_PASS_THROUGH_DIRECT CTL_CODE(IOCTL_SCSI_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_SCSI_GET_ADDRESS CTL_CODE(IOCTL_SCSI_BASE, 0x0406, METHOD_BUFFERED, FILE_ANY_ACCESS) + + +#define SCSI_IOCTL_DATA_OUT 0 +#define SCSI_IOCTL_DATA_IN 1 +#define SCSI_IOCTL_DATA_UNSPECIFIED 2 + +#pragma pack(4) + +typedef struct _IO_SCSI_CAPABILITIES +{ + ULONG Length; + ULONG MaximumTransferLength; + ULONG MaximumPhysicalPages; + ULONG SupportedAsynchronousEvents; + ULONG AlignmentMask; + BOOLEAN TaggedQueuing; + BOOLEAN AdapterScansDown; + BOOLEAN AdapterUsesPio; +} IO_SCSI_CAPABILITIES, *PIO_SCSI_CAPABILITIES; + +typedef struct _SCSI_PASS_THROUGH_DIRECT +{ + USHORT Length; + UCHAR ScsiStatus; + UCHAR PathId; + UCHAR TargetId; + UCHAR Lun; + UCHAR CdbLength; + UCHAR SenseInfoLength; + UCHAR DataIn; + ULONG DataTransferLength; + ULONG TimeOutValue; + PVOID DataBuffer; + ULONG SenseInfoOffset; + UCHAR Cdb[16]; +} SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT; + + +typedef struct _SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER +{ + SCSI_PASS_THROUGH_DIRECT sptd; + ULONG Filler; // realign buffer to double word boundary + UCHAR ucSenseBuf[32]; +} SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, *PSCSI_PASS_THROUGH_DIRECT_WITH_BUFFER; + +typedef struct _SCSI_INQUIRY_DEVICE +{ + UCHAR Type; + UCHAR TypeModifier; + UCHAR Version; + UCHAR Format; + UCHAR AddLength; // n-4 + UCHAR Reserved[2]; + UCHAR Flags; + char VendorId[8]; + char ProductId[16]; + char ProductRevLevel[4]; + char ProductRevDate[8]; +} SCSI_INQUIRY_DEVICE, *PSCSI_INQUIRY_DEVICE; + + +typedef struct _SCSI_ADDRESS { + ULONG Length; + UCHAR PortNumber; + UCHAR PathId; + UCHAR TargetId; + UCHAR Lun; +}SCSI_ADDRESS, *PSCSI_ADDRESS; + + +#pragma pack(1) + +// +// SCSI CDB operation codes +// + +#define SCSIOP_INQUIRY 0x12 +#define SCSIOP_MODE_SELECT 0x15 +#define SCSIOP_MODE_SENSE 0x1A + +#define AUDIO_BLOCK_LEN 2352 +#define BUF_SIZE (63*1024) + +class ScsiIfImpl +{ +public: + char *dev_; + + HANDLE hCD; + SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER sb; + + unsigned char senseBuffer_[32]; + + char haid_; + char lun_; + char scsi_id_; +}; + +ScsiIf::ScsiIf(const char *dev) +{ + impl_ = new ScsiIfImpl; + + impl_->dev_ = strdup3CC("\\\\.\\", dev, NULL); + + impl_->hCD = INVALID_HANDLE_VALUE; + + vendor_[0] = 0; + product_[0] = 0; + revision_[0] = 0; +} + +ScsiIf::~ScsiIf() +{ + if (impl_->hCD != INVALID_HANDLE_VALUE) + CloseHandle (impl_->hCD); + + delete impl_; +} + +// opens scsi device +// return: 0: OK +// 1: device could not be opened +// 2: inquiry failed + +int ScsiIf::init() +{ + int i = 0; + DWORD ol; + + SCSI_ADDRESS sa; + IO_SCSI_CAPABILITIES ca; + + while (i++ < 3 && (impl_->hCD == INVALID_HANDLE_VALUE)) + { + impl_->hCD = CreateFile (impl_->dev_, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + } + + if (impl_->hCD == INVALID_HANDLE_VALUE) { + return 1; + } + + if (DeviceIoControl (impl_->hCD, IOCTL_SCSI_GET_ADDRESS, NULL, 0, &sa, sizeof(SCSI_ADDRESS), &ol, NULL)) + { + impl_->haid_ = sa.PortNumber; + impl_->lun_ = sa.Lun; + impl_->scsi_id_ = sa.TargetId; + } + else + { + CloseHandle (impl_->hCD); + impl_->hCD = INVALID_HANDLE_VALUE; + return 1; + } + + if (DeviceIoControl (impl_->hCD, IOCTL_SCSI_GET_CAPABILITIES, NULL, 0, &ca, sizeof(IO_SCSI_CAPABILITIES), &ol, NULL)) + { + maxDataLen_ = ca.MaximumTransferLength; + } + else + { + CloseHandle (impl_->hCD); + impl_->hCD = INVALID_HANDLE_VALUE; + return 1; + } + + if (inquiry() != 0) + return 2; + + return 0; +} + +// Sets given timeout value in seconds and returns old timeout. +// return: old timeout + +int ScsiIf::timeout (int t) +{ + return 0; +} + +// sends a scsi command and receives data +// return 0: OK +// 1: scsi command failed (os level, no sense data available) +// 2: scsi command failed (sense data available) + +int ScsiIf::sendCmd (unsigned char *cmd, int cmdLen, + unsigned char *dataOut, int dataOutLen, + unsigned char *dataIn, int dataInLen, + int showMessage) +{ + int i = 10; + + DWORD er, il, ol; + + ZeroMemory (&impl_->sb, sizeof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER)); + + impl_->sb.sptd.Length = sizeof(SCSI_PASS_THROUGH_DIRECT); + impl_->sb.sptd.PathId = 0; + impl_->sb.sptd.TargetId = impl_->scsi_id_; + impl_->sb.sptd.Lun = impl_->lun_; + impl_->sb.sptd.CdbLength = cmdLen; + impl_->sb.sptd.SenseInfoLength = 32; + impl_->sb.sptd.TimeOutValue = 4; + impl_->sb.sptd.SenseInfoOffset = offsetof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, ucSenseBuf); + memcpy (impl_->sb.sptd.Cdb, cmd, cmdLen); + + if (dataOut && dataOutLen) + { + impl_->sb.sptd.DataIn = SCSI_IOCTL_DATA_OUT; + impl_->sb.sptd.DataBuffer = dataOut; + impl_->sb.sptd.DataTransferLength = dataOutLen; + } + else + { + impl_->sb.sptd.DataIn = SCSI_IOCTL_DATA_IN; + impl_->sb.sptd.DataBuffer = dataIn; + impl_->sb.sptd.DataTransferLength = dataInLen; + } + + il = sizeof (SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER); + + // AM: what about sense data? + if (DeviceIoControl (impl_->hCD, IOCTL_SCSI_PASS_THROUGH_DIRECT, &impl_->sb, il, &impl_->sb, il, &ol, NULL)) + { + er = impl_->sb.sptd.ScsiStatus ? impl_->sb.sptd.ScsiStatus | 0x20000000 : 0; + + if (!er) + return (0); + } + else + return (1); + + return 0; +} + +const unsigned char *ScsiIf::getSense(int &len) const +{ + len = 32; + return impl_->sb.ucSenseBuf; +} + +void ScsiIf::printError() +{ + decodeSense(impl_->sb.ucSenseBuf, 32); +} + +int ScsiIf::inquiry() +{ + unsigned char cmd[6]; + int i; + + SCSI_INQUIRY_DEVICE NTinqbuf; + + ZeroMemory (&NTinqbuf, sizeof(SCSI_INQUIRY_DEVICE)); + + cmd[0] = 0x12; // INQUIRY + cmd[1] = cmd[2] = cmd[3] = 0; + cmd[4] = sizeof (NTinqbuf); + cmd[5] = 0; + + if (sendCmd (cmd, 6, NULL, 0, + (unsigned char *) &NTinqbuf, sizeof (NTinqbuf), 1) != 0) { + log_message(-2, "Inquiry command failed on '%s': ", impl_->dev_); + return 1; + } + + strncpy(vendor_, (char *)(NTinqbuf.VendorId), 8); + vendor_[8] = 0; + + strncpy(product_, (char *)(NTinqbuf.ProductId), 16); + product_[16] = 0; + + strncpy(revision_, (char *)(NTinqbuf.ProductRevLevel), 4); + revision_[4] = 0; + + for (i = 7; i >= 0 && vendor_[i] == ' '; i--) + { + vendor_[i] = 0; + } + + for (i = 15; i >= 0 && product_[i] == ' '; i--) + { + product_[i] = 0; + } + + for (i = 3; i >= 0 && revision_[i] == ' '; i--) + { + revision_[i] = 0; + } + + return 0; +} + + diff --git a/dao/ScsiIf-osx.cc b/dao/ScsiIf-osx.cc new file mode 100644 index 0000000..5f7b1a7 --- /dev/null +++ b/dao/ScsiIf-osx.cc @@ -0,0 +1,507 @@ +/* + * Native implementation of cdrdao's SCSI interface for Mac OS X. + * Copyright (C) by Edgar Fu�, Bonn, July 2007. + * Do with this whatever you like, as long as you are either me or you keep + * this message intact and both + * - acknowledge that I wrote it for cdrdao in the first place, and + * - don't blame me if it doesn't do what you like or expect. + * These routines do exactly what they do. If that's not what you expect them + * or would like them to do, don't complain with me, the cdrdao project, my + * neighbour's brother-in-law or anybody else, but rewrite them to your taste. + */ + +/* standard includes */ +#include <stdio.h> +#include <ctype.h> +#include <string.h> + +/* cdrdao specific includes and prototype */ +#include "ScsiIf.h" +#include "trackdb/util.h" +extern void message(int level, const char *fmt, ...); +#include "decodeSense.cc" + +/* Mac OS X specific includes */ +#include <CoreFoundation/CFPlugInCOM.h> +#include <IOKit/IOKitLib.h> +#include <IOKit/scsi/SCSITaskLib.h> +#include <IOKit/scsi/SCSICommandOperationCodes.h> +#include <IOKit/scsi/SCSICmds_INQUIRY_Definitions.h> + +class ScsiIfImpl { +public: + int num_; /* number of device for compatibility mode */ + char *path_; /* native (IO registry) pathname of device */ + io_object_t object_; + IOCFPlugInInterface **plugin_; + MMCDeviceInterface **mmc_; + SCSITaskDeviceInterface **scsi_; + int exclusive_; + long timeout_; /* in ms */ + char *error_; /* sendCmd() internal error string */ + SCSIServiceResponse response_; + SCSITaskStatus status_; + struct SCSI_Sense_Data sense_; +}; + +ScsiIf::ScsiIf(const char *name) +{ + int len; + int bus, targ, lun, count; + + impl_ = new ScsiIfImpl; + impl_->num_ = 0; + impl_->path_ = NULL; + len = strlen(name); + if (len) { + if (isdigit(name[0])) { + /* Compatibility mode. Just add bus+targ+lun */ + if (sscanf(name, "%i,%i,%i%n", &bus, &targ, &lun, &count) == 3 && count == len) { + if ((bus >= 0) && (targ >= 0) && (lun >= 0)) + impl_->num_ = 1 + bus + targ + lun; + } + } else { + /* Native mode. Take name as IOreg path */ + impl_->path_ = strdupCC(name); + } + } + impl_->object_ = 0; + impl_->plugin_ = NULL; + impl_->mmc_ = NULL; + impl_->scsi_ = NULL; + impl_->exclusive_ = 0; + impl_->timeout_ = 10*1000; + impl_->error_ = NULL; + + vendor_[0] = 0; + product_[0] = 0; + revision_[0] = 0; + + maxDataLen_ = 64*1024; /* XXX */ +} + +ScsiIf::~ScsiIf() +{ + if (impl_->scsi_) { + if (impl_->exclusive_) + (*impl_->scsi_)->ReleaseExclusiveAccess(impl_->scsi_); + (*impl_->scsi_)->Release(impl_->scsi_); + } + if (impl_->mmc_) + (*impl_->mmc_)->Release(impl_->mmc_); + if (impl_->plugin_) + IODestroyPlugInInterface(impl_->plugin_); + if (impl_->object_) + IOObjectRelease(impl_->object_); + if (impl_->path_ != NULL) delete[] impl_->path_; + if (impl_->error_ != NULL) delete[] impl_->error_; + delete impl_; +} + +int ScsiIf::init() +{ + CFMutableDictionaryRef dict = NULL; + CFMutableDictionaryRef sub = NULL; + io_iterator_t iterator = 0; + kern_return_t err; + SInt32 score; + HRESULT herr; + int i; + + if (impl_->num_) { + /* + * Compatibility mode. + * Build dictionaries to search for num_'th device having the + * authoring property using an IO iterator. + */ + dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, NULL, NULL); + sub = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, NULL, NULL); + CFDictionarySetValue(sub, CFSTR(kIOPropertySCSITaskDeviceCategory), + CFSTR(kIOPropertySCSITaskAuthoringDevice)); + CFDictionarySetValue(dict, CFSTR(kIOPropertyMatchKey), sub); + IOServiceGetMatchingServices(kIOMasterPortDefault, dict, &iterator); + if (!iterator) message(-2, "init: no iterator"); + if (iterator) { + i = impl_->num_; + do { + impl_->object_ = IOIteratorNext(iterator); + i--; + } while (i && impl_->object_); + IOObjectRelease(iterator); + } + } else if (impl_->path_) { + /* Native mode. Just use the IO Registry pathname */ + impl_->object_ = IORegistryEntryFromPath(kIOMasterPortDefault, impl_->path_); + } + /* Strange if (!x) ... if (x) style so you can #ifdef out the !x part */ + if (!impl_->object_) message(-2, "init: no object"); + if (impl_->object_) { + /* Get intermediate (IOCFPlugIn) plug-in for MMC device */ + err = IOCreatePlugInInterfaceForService(impl_->object_, + kIOMMCDeviceUserClientTypeID, kIOCFPlugInInterfaceID, + &impl_->plugin_, &score); + if (err != noErr) + message(-2, "init: IOCreatePlugInInterfaceForService failed: %d", err); + } + if (!impl_->plugin_) message(-2, "init: no plugin"); + if (impl_->plugin_) { + /* Get the MMC interface (MMCDeviceInterface) */ + herr = (*impl_->plugin_)->QueryInterface(impl_->plugin_, + CFUUIDGetUUIDBytes(kIOMMCDeviceInterfaceID), + /* + * Most of Apple's examples erroneously cast to LPVOID, + * not LPVOID *. + */ + (LPVOID *)&impl_->mmc_); + if (herr != S_OK) + message(-2, "init: QueryInterface failed: %d", herr); + } + if (!impl_->mmc_) message(-2, "init: no mmc"); + if (impl_->mmc_) { + /* Get the SCSI interface */ + impl_->scsi_ = (*impl_->mmc_)->GetSCSITaskDeviceInterface(impl_->mmc_); + } + if (!impl_->scsi_) message(-2, "init: no scsi"); + if (impl_->scsi_) { + /* Obtain exclusive access to device */ + err = (*impl_->scsi_)->ObtainExclusiveAccess(impl_->scsi_); + if (err != noErr) + message(-2, "init: ObtainExclusiveAccess failed: %d", err); + if (err == noErr) { + impl_->exclusive_ = 1; + /* Send SCSI inquiry command */ + i = inquiry(); + if (i != 0) + message(-2, "init: inquiry failed: %d", i); + return (i == 0) ? 0 : 2; + } + } + message(-2, "init: failed"); + return 1; +} + +int ScsiIf::timeout(int t) +{ + int ret = impl_->timeout_/1000; + impl_->timeout_ = t*1000; + return ret; +} + +int ScsiIf::sendCmd(const unsigned char *cmd, int cmdLen, + const unsigned char *dataOut, int dataOutLen, + unsigned char *dataIn, int dataInLen, + int showMessage) +{ + SCSITaskInterface **task; + IOVirtualRange range; + IOReturn ret; + UInt64 len; + + if (impl_->error_ != NULL) { delete[] impl_->error_; impl_->error_ = NULL; } + +#define ERROR(msg) do {\ + impl_->error_ = new char[9 + strlen(msg) + 1];\ + strcpy(impl_->error_, "sendCmd: ");\ + strcat(impl_->error_, msg);\ + if (showMessage) printError();\ + if (task) (*task)->Release(task);\ + return 1;\ +} while(0) + + task = (*impl_->scsi_)->CreateSCSITask(impl_->scsi_); + if (!task) ERROR("no task"); + ret = (*task)->SetCommandDescriptorBlock(task, (UInt8 *)cmd, cmdLen); + if (ret != kIOReturnSuccess) ERROR("SetCommandDescriptorBlock failed"); + /* The OSX SCSI interface can't deal with two data phases */ + if (dataIn && dataOut) ERROR("dataIn && dataOut"); + if (dataIn) { + range.address = (IOVirtualAddress)dataIn; + range.length = dataInLen; + ret = (*task)->SetScatterGatherEntries(task, &range, 1, + dataInLen, kSCSIDataTransfer_FromTargetToInitiator); + } else if (dataOut) { + range.address = (IOVirtualAddress)dataOut; + range.length = dataOutLen; + ret = (*task)->SetScatterGatherEntries(task, &range, 1, + dataOutLen, kSCSIDataTransfer_FromInitiatorToTarget); + } else { + /* Just to make sure. We pass in zero ranges anyway */ + range.address = (IOVirtualAddress)NULL; + range.length = 0; + ret = (*task)->SetScatterGatherEntries(task, &range, 0, + 0, kSCSIDataTransfer_NoDataTransfer); + } + if (ret != kIOReturnSuccess) ERROR("SetScatterGatherEntries failed"); + ret = (*task)->SetTimeoutDuration(task, impl_->timeout_); + if (ret != kIOReturnSuccess) ERROR("SetTimeoutDuration failed"); + ret = (*task)->ExecuteTaskSync(task, &impl_->sense_, &impl_->status_, &len); + if (ret != kIOReturnSuccess) ERROR("ExecuteTaskSync failed"); + ret = (*task)->GetSCSIServiceResponse(task, &impl_->response_); + if (ret != kIOReturnSuccess) ERROR("GetSCSIServiceResponse failed"); + (*task)->Release(task); + if (impl_->response_ == kSCSIServiceResponse_TASK_COMPLETE) { + if (impl_->status_ == kSCSITaskStatus_GOOD) return 0; + if (impl_->status_ == kSCSITaskStatus_CHECK_CONDITION) return 2; + } + if (impl_->response_ == kSCSIServiceResponse_SERVICE_DELIVERY_OR_TARGET_FAILURE) return 1; + return 1 /* XXX This shouldn't happen */; + +#undef ERROR +} + +const unsigned char *ScsiIf::getSense(int &len) const +{ + len = kSenseDefaultSize; + return (unsigned char *)&impl_->sense_; +} + +void ScsiIf::printError() +{ + char *s; + + if (impl_->error_) + /* Internal error in sendCmd(). We saved a message string. */ + s = impl_->error_; + else switch (impl_->response_) { + case kSCSIServiceResponse_SERVICE_DELIVERY_OR_TARGET_FAILURE: + /* The SCSI command didn't complete */ + switch (impl_->status_) { + case kSCSITaskStatus_TaskTimeoutOccurred: + s = "task timeout"; break; + case kSCSITaskStatus_ProtocolTimeoutOccurred: + s = "protocol timeout"; break; + case kSCSITaskStatus_DeviceNotResponding: + s = "device not responding"; break; + case kSCSITaskStatus_DeviceNotPresent: + s = "device not present"; break; + case kSCSITaskStatus_DeliveryFailure: + s = "delivery failure"; break; + case kSCSITaskStatus_No_Status: + s = "no status"; break; + default: + s = "failure, unknown status"; break; + } + break; + case kSCSIServiceResponse_TASK_COMPLETE: + /* The SCSI command did complete */ + switch (impl_->status_) { + case kSCSITaskStatus_GOOD: + s = "good"; break; + case kSCSITaskStatus_CHECK_CONDITION: + decodeSense((unsigned char *)&impl_->sense_, sizeof(impl_->sense_)); + s = NULL; break; + case kSCSITaskStatus_CONDITION_MET: + s = "condition met"; break; + case kSCSITaskStatus_BUSY: + s = "busy"; break; + case kSCSITaskStatus_INTERMEDIATE: + s = "intermediate"; break; + case kSCSITaskStatus_INTERMEDIATE_CONDITION_MET: + s = "intermediate, condition met"; break; + case kSCSITaskStatus_RESERVATION_CONFLICT: + s = "reservation conflict"; break; + case kSCSITaskStatus_TASK_SET_FULL: + s = "task set full"; break; + case kSCSITaskStatus_ACA_ACTIVE: + s = "aca active"; break; + default: + s = "complete, unknown status"; break; + } + break; + default: + s = "unknown response"; break; + } + if (s) message(-2, s); +} + +/* + * Internal form or inquiry command. + * Used by both inquiry() and scanData(), but with different data. + */ +int inq(SCSITaskDeviceInterface **scsi, + SCSIServiceResponse *response, + SCSITaskStatus *status, + struct SCSI_Sense_Data *sense, + char *vend, char *prod, char *rev) +{ + SCSICmd_INQUIRY_StandardData inq_data; + SCSICommandDescriptorBlock cdb; + SCSITaskInterface **task; + IOVirtualRange range; + IOReturn ret; + UInt64 len; + int i; + + task = (*scsi)->CreateSCSITask(scsi); + if (!task) { + message(-2, "inq: no task"); + return 1; + } + bzero(cdb, sizeof(cdb)); + cdb[0] = kSCSICmd_INQUIRY; + cdb[4] = sizeof(inq_data); + ret = (*task)->SetCommandDescriptorBlock(task, cdb, kSCSICDBSize_6Byte); + if (ret != kIOReturnSuccess) { + message(-2, "inq: SetCommandDescriptorBlock failed: %d", ret); + (*task)->Release(task); + return 1; + } + range.address = (IOVirtualAddress)&inq_data; + range.length = sizeof(inq_data); + ret = (*task)->SetScatterGatherEntries(task, &range, 1, + sizeof(inq_data), kSCSIDataTransfer_FromTargetToInitiator); + if (ret != kIOReturnSuccess) { + message(-2, "inq: SetScatterGatherEntries failed: %d", ret); + (*task)->Release(task); + return 1; + } + ret = (*task)->SetTimeoutDuration(task, 1000); + if (ret != kIOReturnSuccess) { + message(-2, "inq: SetTimeoutDuration failed: %d", ret); + (*task)->Release(task); + return 1; + } + ret = (*task)->ExecuteTaskSync(task, sense, status, &len); + if (ret != kIOReturnSuccess) { + message(-2, "inq: ExecuteTaskSync failed: %d", ret); + (*task)->Release(task); + return 1; + } + ret = (*task)->GetSCSIServiceResponse(task, response); + if (ret != kIOReturnSuccess) { + message(-2, "inq: GetSCSIServiceResponse failed: %d", ret); + (*task)->Release(task); + return 1; + } + if (*response != kSCSIServiceResponse_TASK_COMPLETE) { + message(-2, "inq: response=%d", *response); + (*task)->Release(task); + return 1; + } + if (*status != kSCSITaskStatus_GOOD) { + message(-2, "inq: status=%d", *status); + (*task)->Release(task); + return 1; + } + (*task)->Release(task); + /* Copy vendor/product/revision stripping traiiling spaces */ + i = kINQUIRY_VENDOR_IDENTIFICATION_Length; + while (i > 0 && inq_data.VENDOR_IDENTIFICATION[i - 1] == ' ') i--; + memcpy(vend, inq_data.VENDOR_IDENTIFICATION, i); + vend[i] = '\0'; + i = kINQUIRY_PRODUCT_IDENTIFICATION_Length; + while (i > 0 && inq_data.PRODUCT_IDENTIFICATION[i - 1] == ' ') i--; + memcpy(prod, inq_data.PRODUCT_IDENTIFICATION, i); + prod[i] = '\0'; + i = kINQUIRY_PRODUCT_REVISION_LEVEL_Length; + while (i > 0 && inq_data.PRODUCT_REVISION_LEVEL[i - 1] == ' ') i--; + memcpy(rev, inq_data.PRODUCT_REVISION_LEVEL, i); + rev[i] = '\0'; + return 0; +} + +int ScsiIf::inquiry() +{ + return inq(impl_->scsi_, &impl_->response_, &impl_->status_, &impl_->sense_, + vendor_, product_, revision_); +} + +#define MAX_SCAN 10 + +ScsiIf::ScanData *ScsiIf::scan(int *len, char *dev) +{ + ScanData *scanData; + CFMutableDictionaryRef dict = NULL; + CFMutableDictionaryRef sub = NULL; + io_iterator_t iterator = 0; + io_object_t object = 0; + IOCFPlugInInterface **plugin = NULL; + MMCDeviceInterface **mmc = NULL; + SCSITaskDeviceInterface **scsi = NULL; + SCSIServiceResponse response; + SCSITaskStatus status; + int exclusive = 0; + io_string_t path; + kern_return_t err; + SInt32 score; + HRESULT herr; + int ret; + int i; + + /* Ignore dev. We don't support different kinds of busses that way. */ + /* Build matching dictionaries to find authoring decices. See init(). */ + dict = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, NULL, NULL); + sub = CFDictionaryCreateMutable(kCFAllocatorDefault, 0, NULL, NULL); + CFDictionarySetValue(sub, CFSTR(kIOPropertySCSITaskDeviceCategory), + CFSTR(kIOPropertySCSITaskAuthoringDevice)); + CFDictionarySetValue(dict, CFSTR(kIOPropertyMatchKey), sub); + IOServiceGetMatchingServices(kIOMasterPortDefault, dict, &iterator); + if (!iterator) { + message(-2, "scan: no iterator"); + *len = 0; + return NULL; + } + scanData = new ScanData[MAX_SCAN]; *len = 0; + for (i = 0; ; i++) { + object = IOIteratorNext(iterator); + if (!object) break; + if (*len == MAX_SCAN) break; + /* Get native (IO Registry) pathname of this device. */ + err = IORegistryEntryGetPath(object, kIOServicePlane, path); + if (err == noErr) { + scanData[*len].dev = strdupCC(path); + } + /* See init() for a description of the plugin/interface tour. */ + err = IOCreatePlugInInterfaceForService(object, + kIOMMCDeviceUserClientTypeID, kIOCFPlugInInterfaceID, + &plugin, &score); + if (err != noErr) { + message(-2, "scan: IOCreatePlugInInterfaceForService failed: %d", err); + goto clean; + } + if (!plugin) { + message(-2, "scan: no plugin"); + goto clean; + } + herr = (*plugin)->QueryInterface(plugin, + CFUUIDGetUUIDBytes(kIOMMCDeviceInterfaceID), + (LPVOID *)&mmc); + if (herr != S_OK) { + message(-2, "scan: QueryInterface failed: %d", herr); + goto clean; + } + if (!mmc) { + message(-2, "scan: no mmc"); + goto clean; + } + scsi = (*mmc)->GetSCSITaskDeviceInterface(mmc); + if (!scsi) { + message(-2, "scan: no scsi"); + goto clean; + } + err = (*scsi)->ObtainExclusiveAccess(scsi); + if (err != noErr) { + message(-2, "scan: ObtainExclusiveAccess failed: %d", err); + goto clean; + } + ret = inq(scsi, &response, &status, NULL, + scanData[*len].vendor, + scanData[*len].product, + scanData[*len].revision); + if (ret != 0) { + message(-2, "scan: inq failed: %d", ret); + goto clean; + } + (*len)++; +clean: + if (exclusive) (*scsi)->ReleaseExclusiveAccess(scsi); + if (scsi) (*scsi)->Release(scsi); + if (mmc) (*mmc)->Release(mmc); + if (plugin) IODestroyPlugInInterface(plugin); + if (object) IOObjectRelease(object); + } + IOObjectRelease(iterator); + return scanData; +} + +#include "ScsiIf-common.cc" diff --git a/dao/ScsiIf-win.cc b/dao/ScsiIf-win.cc new file mode 100644 index 0000000..a649a37 --- /dev/null +++ b/dao/ScsiIf-win.cc @@ -0,0 +1,360 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "config.h" + +#include <windows.h> +#include <stdio.h> +#include <fcntl.h> +#include <errno.h> +#include <string.h> +#include <assert.h> + +#include "winaspi.h" +#include "ScsiIf.h" +#include "log.h" +#include "util.h" + +#include "decodeSense.cc" + + +typedef DWORD (*GETSUPPORTINFO) (void); +typedef DWORD (*GETDLLVERSION) (void); +typedef DWORD (*SENDCOMMAND) (char *); + +#define BUF_SIZE (32*1024) + +class ScsiIfImpl +{ +public: + char *dev_; + + int maxSendLen_; + + SRB_ExecSCSICmd6 cmd6_; + SRB_ExecSCSICmd10 cmd10_; + SRB_ExecSCSICmd12 cmd12_; + + unsigned char senseBuffer_[SENSE_LEN]; + + char haid_; + char lun_; + char scsi_id_; + + HINSTANCE hinstlib; + SENDCOMMAND Sendcommand; +}; + +ScsiIf::ScsiIf(const char *dev) +{ + char *p, *q; + + impl_ = new ScsiIfImpl; + + impl_->dev_ = strdupCC(dev); + + maxDataLen_ = BUF_SIZE; + + impl_->haid_ = 0; + impl_->lun_ = 0; + impl_->scsi_id_ = 0; + + if (p = strchr (impl_->dev_, ':')) + { + *p = 0; + impl_->haid_ = atoi (impl_->dev_); + q = ++p; + + if (p = strchr (q, ':')) + { + *p = 0; + impl_->lun_ = atoi (q); + q = ++p; + impl_->scsi_id_ = atoi (q); + } + } + + impl_->hinstlib = 0; + + vendor_[0] = 0; + product_[0] = 0; + revision_[0] = 0; +} + +ScsiIf::~ScsiIf() +{ + delete[] impl_->dev_; + impl_->dev_ = NULL; + + if (impl_->hinstlib) + FreeLibrary (impl_->hinstlib); + + delete impl_; +} + +// opens and flushes scsi device +// return: 0: OK +// 1: device could not be opened +// 2: inquiry failed + +int ScsiIf::init() +{ + impl_->hinstlib = LoadLibrary ("WNASPI32.DLL"); + + if (!impl_->hinstlib) + { + log_message(-2, "Can't load WNASPI32.DLL"); + return 1; + } + else { + impl_->Sendcommand = (SENDCOMMAND)GetProcAddress (impl_->hinstlib, "SendASPI32Command"); + } + + if (inquiry() != 0) + return 2; + + return 0; +} + +// Sets given timeout value in seconds and returns old timeout. +// return: old timeout + +int ScsiIf::timeout (int t) +{ + return 0; +} + +// sends a scsi command and receives data +// return 0: OK +// 1: scsi command failed (os level, no sense data available) +// 2: scsi command failed (sense data available) + +int ScsiIf::sendCmd (const unsigned char *cmd, int cmdLen, + const unsigned char *dataOut, int dataOutLen, + unsigned char *dataIn, int dataInLen, + int showMessage) +{ + int status, i = 10; + + switch (cmdLen) + { + case 6: memset (&impl_->cmd6_, 0, sizeof (SRB_ExecSCSICmd6)); + memcpy (impl_->cmd6_.CDBByte, cmd, 6); + + impl_->cmd6_.SRB_Cmd = SC_EXEC_SCSI_CMD; + impl_->cmd6_.SRB_HaId = impl_->haid_; + impl_->cmd6_.SRB_Target = impl_->scsi_id_; + impl_->cmd6_.SRB_Lun = impl_->lun_; + impl_->cmd6_.SRB_SenseLen = SENSE_LEN; + impl_->cmd6_.SRB_CDBLen = 6; + + if (dataOut && dataOutLen) + { + impl_->cmd6_.SRB_Flags = SRBF_WRITE; + impl_->cmd6_.SRB_BufPointer = (BYTE*)dataOut; + impl_->cmd6_.SRB_BufLen = dataOutLen; + } + else + { + impl_->cmd6_.SRB_Flags = SRBF_READ; + impl_->cmd6_.SRB_BufPointer = dataIn; + impl_->cmd6_.SRB_BufLen = dataInLen; + } + + + (impl_->Sendcommand) ((char *) &impl_->cmd6_); + + while (i-- && impl_->cmd6_.SRB_Status != SS_COMP) + { + while (!impl_->cmd6_.SRB_Status) + Sleep (10); + } + + // AM: Try to get sense data + if (impl_->cmd6_.SRB_Status == SS_ERR && + impl_->cmd6_.SRB_TargStat == STATUS_CHKCOND) { + memcpy(impl_->senseBuffer_, impl_->cmd6_.SenseArea, SENSE_LEN); + + if (showMessage) + printError(); + + return 2; + } + + if (impl_->cmd6_.SRB_Status != SS_COMP) + return (1); + break; + + case 10: memset (&impl_->cmd10_, 0, sizeof (SRB_ExecSCSICmd10)); + memcpy (impl_->cmd10_.CDBByte, cmd, 10); + + impl_->cmd10_.SRB_Cmd = SC_EXEC_SCSI_CMD; + impl_->cmd10_.SRB_HaId = impl_->haid_; + impl_->cmd10_.SRB_Target = impl_->scsi_id_; + impl_->cmd10_.SRB_Lun = impl_->lun_; + impl_->cmd10_.SRB_SenseLen = SENSE_LEN; + impl_->cmd10_.SRB_CDBLen = 10; + + if (dataOut && dataOutLen) + { + impl_->cmd10_.SRB_Flags = SRBF_WRITE; + impl_->cmd10_.SRB_BufPointer = (BYTE*)dataOut; + impl_->cmd10_.SRB_BufLen = dataOutLen; + } + else + { + impl_->cmd10_.SRB_Flags = SRBF_READ; + impl_->cmd10_.SRB_BufPointer = dataIn; + impl_->cmd10_.SRB_BufLen = dataInLen; + } + + + (impl_->Sendcommand) ((char *) &impl_->cmd10_); + + while (i-- && impl_->cmd10_.SRB_Status != SS_COMP) + { + while (!impl_->cmd10_.SRB_Status) + Sleep (10); + } + + // AM: Try to get sense data + if (impl_->cmd10_.SRB_Status == SS_ERR && + impl_->cmd10_.SRB_TargStat == STATUS_CHKCOND) { + memcpy(impl_->senseBuffer_, impl_->cmd10_.SenseArea10, + SENSE_LEN); + + if (showMessage) + printError(); + + return 2; + } + + if (impl_->cmd10_.SRB_Status != SS_COMP) + return (1); + + break; + + case 12: memset (&impl_->cmd12_, 0, sizeof (SRB_ExecSCSICmd12)); + memcpy (impl_->cmd12_.CDBByte, cmd, 12); + + impl_->cmd12_.SRB_Cmd = SC_EXEC_SCSI_CMD; + impl_->cmd12_.SRB_HaId = impl_->haid_; + impl_->cmd12_.SRB_Target = impl_->scsi_id_; + impl_->cmd12_.SRB_Lun = impl_->lun_; + impl_->cmd12_.SRB_SenseLen = SENSE_LEN; + impl_->cmd12_.SRB_CDBLen = 12; + + if (dataOut && dataOutLen) + { + impl_->cmd12_.SRB_Flags = SRBF_WRITE; + impl_->cmd12_.SRB_BufPointer = (BYTE*)dataOut; + impl_->cmd12_.SRB_BufLen = dataOutLen; + } + else + { + impl_->cmd12_.SRB_Flags = SRBF_READ; + impl_->cmd12_.SRB_BufPointer = dataIn; + impl_->cmd12_.SRB_BufLen = dataInLen; + } + + + + (impl_->Sendcommand) ((char *) &impl_->cmd12_); + + while (i-- && impl_->cmd12_.SRB_Status != SS_COMP) + { + while (!impl_->cmd12_.SRB_Status) + Sleep (10); + } + + // AM: Try to get sense data + if (impl_->cmd12_.SRB_Status == SS_ERR && + impl_->cmd12_.SRB_TargStat == STATUS_CHKCOND) { + memcpy(impl_->senseBuffer_, impl_->cmd12_.SenseArea12, + SENSE_LEN); + + if (showMessage) + printError(); + + return 2; + } + + if (impl_->cmd12_.SRB_Status != SS_COMP) + return (1); + + break; + } + + return 0; +} + +const unsigned char *ScsiIf::getSense(int &len) const +{ + len = SENSE_LEN; + return impl_->senseBuffer_; +} + +void ScsiIf::printError() +{ + decodeSense(impl_->senseBuffer_, SENSE_LEN); +} + +int ScsiIf::inquiry() +{ + unsigned char cmd[6]; + unsigned char result[0x2c]; + int i; + + + cmd[0] = 0x12; // INQUIRY + cmd[1] = cmd[2] = cmd[3] = 0; + cmd[4] = 0x2c; + cmd[5] = 0; + + if (sendCmd (cmd, 6, NULL, 0, result, 0x2c, 1) != 0) { + log_message(-2, "Inquiry command failed on '%s': ", impl_->dev_); + return 1; + } + + strncpy(vendor_, (char *)(result + 0x08), 8); + vendor_[8] = 0; + + strncpy(product_, (char *)(result + 0x10), 16); + product_[16] = 0; + + strncpy(revision_, (char *)(result + 0x20), 4); + revision_[4] = 0; + + for (i = 7; i >= 0 && vendor_[i] == ' '; i--) + { + vendor_[i] = 0; + } + + for (i = 15; i >= 0 && product_[i] == ' '; i--) + { + product_[i] = 0; + } + + for (i = 3; i >= 0 && revision_[i] == ' '; i--) + { + revision_[i] = 0; + } + + return 0; +} diff --git a/dao/ScsiIf.h b/dao/ScsiIf.h new file mode 100644 index 0000000..cd601b4 --- /dev/null +++ b/dao/ScsiIf.h @@ -0,0 +1,165 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998, 1999 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +// \file ScsiIf.h +// \brief Low level SCSI interface. + +#ifndef __SCSIIF_H__ +#define __SCSIIF_H__ + +#include <stdlib.h> +#include <string> + +class ScsiIfImpl; + +//! \brief Base class to communicate with SCSI device + +class ScsiIf +{ + public: + + //! \brief Constructor. Does not do SCSI initialization. + // + // Sets up some internal data and gets page size. + + ScsiIf(const char *dev); + ~ScsiIf(); + + //! \brief Accessor method: vendor string of the device. + const char *vendor() const { return vendor_; } + //! \brief Accessor method: product string of the device. + const char *product() const { return product_; } + //! \brief Accessor method: revision string of the device. + const char *revision() const { return revision_; } + + //! \brief Accessor method: SCSI bus this device is connected to. + const int bus (); + //! \brief Accessor method: SCSI ID of the device. + const int id (); + /*! \brief Accessor method: SCSI LUN of the device. */ + const int lun (); + + //! \brief Opens the scsi device. Most of the code originates + // from cdrecord's initialization function. + // Tries to build a scglib SCSI* object using device specified in + // ScsiIf::ScsiIf and issues an inquiry to test the + // communication. Gets max DMA transfer length using scg_bufsize, + // upto MAX_DATALEN_LIMIT, and builds a buffer of this size. + // + // \return int + // - 0 OK + // - 1 device could not be opened + // - 2 inquiry failed + int init(); + + // \brief Accessor method: returns max DMA transfer length. + int maxDataLen() const { return maxDataLen_; } + + //! \brief Sends a SCSI command and receives data + // \param cmd Buffer with CDB + // \param cmdLen Length of CDB + // \param dataOut Output buffer from the command, preallocated, + // will be overwritten + // \param dataOutLen Length of preallocated output + // buffer. dataOutLen or dataInLen must be 0. + // \param dataIn Input buffer to the command, containing + // parameters to the command + // \param dataInLen Length of input buffer. dataOutLen or + // dataInLen must be 0. + // \param showMessage If 0 makes scglib silent. If 1 verbose + // command execution. + // \return int + // - 0 OK + // - 1 scsi command failed (os level, no sense data available) + // - 2 scsi command failed (sense data available) + int sendCmd(const unsigned char *cmd, int cmdLen, + const unsigned char *dataOut, int dataOutLen, + unsigned char *dataIn, int dataInLen, int showMessage = 1); + + //! \brief Return the actual sense buffer in scglib + // \param len will be overwritten and contain + // ScsiIf::impl->scgp_->scmd->sense_count (length of returned + // buffer). + // \return ScsiIf::impl->scgp_->scmd->u_sense.cmd_sense. This + // buffer contains last sense data available to scglib. The + // buffer is owned by scglib and must not be freed. + const unsigned char *getSense(int &len) const; + + //! \brief Prints extended status information of the last SCSI command. + // Prints the following SCSI codes: + // - command transport status + // - CDB + // - SCSI status byte + // - Sense Bytes + // - Decoded Sense data + // - DMA status + // - SCSI timing + // + // to file specified in ScsiIf::impl_->scgp_->errfile (defaults to + // stderr) + void printError(); + + //! \brief Sets new timeout (seconds) and returns old timeout. + int timeout(int); + + //! \brief Issues TEST UNIT READY command + // \return int + // - 0 OK, ready + // - 1 not ready (busy, default case when TUR command fails, + // except when there's no disk in drive, see below) + // - 2 not ready, no disk in drive + // - 3 scsi command failed at OS level, no sense available + int testUnitReady(); + + //! \brief Check for mmc capability. Return whether the + //driver/drive can read and write CD-R and CD-RW disks. + bool checkMmc(bool *cd_r_read, bool *cd_r_write, + bool *cd_rw_read, bool *cd_rw_write); + + struct ScanData { + std::string dev; + // This is crazy, but the schily header #define vendor, product + // and revision. Talk about namespace pollution... + char vendor[9]; + char product[17]; + char revision[5]; + }; + + //! Scans for all SCSI devices and returns a newly allocated + // 'ScanData' array. + static ScanData *scan(int *len, char* scsi_dev_path = NULL); + + private: + char vendor_[9]; + char product_[17]; + char revision_[5]; + + int maxDataLen_; + + // \brief Standard INQUIRY command used to fill ScsiIf::vendor_ , + // ScsiIf::product_ , ScsiIf::revision_ + // \return int + // - 0 if all right + // - 1 if INQUIRY command failed + int inquiry(); + + ScsiIfImpl *impl_; +}; + +#endif diff --git a/dao/Settings.cc b/dao/Settings.cc new file mode 100644 index 0000000..5e055d7 --- /dev/null +++ b/dao/Settings.cc @@ -0,0 +1,333 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> +#include <unistd.h> +#include <errno.h> +#include <string.h> +#include <assert.h> + +#include "Settings.h" + +#include "util.h" +#include "log.h" + + +#ifdef UNIXWARE +extern "C" { + extern int strcasecmp(const char *, const char *); +} +#endif + + +enum SettingType { SET_INTEGER, SET_STRING }; + +const char* Settings::setWriteSpeed = "write_speed"; +const char* Settings::setWriteDriver = "write_driver"; +const char* Settings::setWriteDevice = "write_device"; +const char* Settings::setWriteBuffers = "write_buffers"; +const char* Settings::setUserCapacity = "user_capacity"; +const char* Settings::setFullBurn = "full_burn"; +const char* Settings::setReadSpeed = "read_speed"; +const char* Settings::setReadDriver = "read_driver"; +const char* Settings::setReadDevice = "read_device"; +const char* Settings::setReadParanoiaMode = "read_paranoia_mode"; +const char* Settings::setCddbServerList = "cddb_server_list"; +const char* Settings::setCddbTimeout = "cddb_timeout"; +const char* Settings::setCddbDbDir = "cddb_directory"; +const char* Settings::setTmpFileDir = "tmp_file_dir"; + +class SettingEntry { +public: + SettingEntry(const char *, int); + SettingEntry(const char *, const char *); + ~SettingEntry(); + + SettingType type_; + + char *name_; + union { + int integerValue_; + char *stringValue_; + } val_; + + SettingEntry *next_; +}; + +class SettingsImpl { +public: + SettingsImpl(); + ~SettingsImpl(); + + void addSetting(SettingEntry *); + SettingEntry *findSetting(const char *, SettingType); + void set(const char *, int); + void set(const char *, const char *); + + int read(FILE *); + + void parseAndSetValue(char *name, char *valStr); + + SettingEntry *settings_; +}; + +SettingEntry::SettingEntry(const char *name, int val) +{ + type_ = SET_INTEGER; + name_ = strdupCC(name); + val_.integerValue_ = val; +} + +SettingEntry::SettingEntry(const char *name, const char *val) +{ + type_ = SET_STRING; + name_ = strdupCC(name); + val_.stringValue_ = strdupCC(val); +} + +SettingEntry::~SettingEntry() +{ + delete[] name_; + name_ = NULL; + + if (type_ == SET_STRING) { + delete[] val_.stringValue_; + val_.stringValue_ = NULL; + } +} + + +SettingsImpl::SettingsImpl() +{ + settings_ = NULL; +} + +SettingsImpl::~SettingsImpl() +{ + SettingEntry *next; + + while (settings_ != NULL) { + next = settings_->next_; + delete settings_; + settings_ = next; + } +} + +void SettingsImpl::addSetting(SettingEntry *s) +{ + s->next_ = settings_; + settings_ = s; +} + + +SettingEntry *SettingsImpl::findSetting(const char *name, SettingType type) +{ + SettingEntry *run; + + for (run = settings_; run != NULL; run = run->next_) { + if (run->type_ == type && strcasecmp(run->name_, name) == 0) + return run; + } + + return NULL; +} + +void SettingsImpl::set(const char *name, int val) +{ + SettingEntry *s = findSetting(name, SET_INTEGER); + + if (s == NULL) { + addSetting(new SettingEntry(name, val)); + } + else { + s->val_.integerValue_ = val; + } +} + +void SettingsImpl::set(const char *name, const char *val) +{ + SettingEntry *s = findSetting(name, SET_STRING); + + if (s == NULL) { + addSetting(new SettingEntry(name, val)); + } + else { + delete[] s->val_.stringValue_; + s->val_.stringValue_ = strdupCC(val); + } +} + +#define MAX_LINE_LENGTH 1024 +int SettingsImpl::read(FILE *fp) +{ + char buf[MAX_LINE_LENGTH]; + char *p, *p1; + char *name; + long n; + + while (fgets(buf, MAX_LINE_LENGTH, fp) != NULL) { + // handle comment + if ((p = strchr(buf, '#')) != NULL) + continue; + + if ((p = strchr(buf, ':')) != NULL) { + *p++ = 0; + + p1 = buf; + while (*p1 != 0 && isspace(*p1)) + p1++; + + name = p1; + + while (*p1 != 0 && !isspace(*p1)) + p1++; + *p1 = 0; + + while (*p != 0 && isspace(*p)) + p++; + + // strip off trailing white space + if ((n = strlen(p)) > 0) { + for (p1 = p + n - 1; p1 >= p; p1--) { + if (isspace(*p1)) { + *p1 = 0; + } + } + } + + parseAndSetValue(name, p); + } + } + + return 0; +} + +void SettingsImpl::parseAndSetValue(char *name, char *valStr) +{ + char *p; + char *val; + int intValue; + + if (name == NULL || *name == 0 || valStr == NULL || *valStr == 0) + return; + + if (*valStr == '"') { + val = valStr + 1; + p = val + strlen(val)-1; + if (*p != '"') { + fprintf(stderr,"Error in string constant '%s'\n", valStr); + } else { + *p=0; + set(name, val); + } + + } else { /* valSTR is numeric? */ + char * end = NULL; + errno=0; + intValue = strtol(valStr, &end, 0); + if(errno != 0 || !end || *end) { + fprintf(stderr,"Error parsing numeric option '%s' (missing quotes?)\n", + valStr); + } else + set(name, intValue); + } +} + +Settings::Settings() +{ + impl_ = new SettingsImpl; +} + +Settings::~Settings() +{ + delete impl_; + impl_ = NULL; +} + +int Settings::read(const char *fname) +{ + FILE *fp; + + if ((fp = fopen(fname, "r")) == NULL) + return 1; + + impl_->read(fp); + + fclose(fp); + + return 0; +} + +int Settings::write(const char *fname) const +{ + SettingEntry *run; + FILE *fp; + + if ((fp = fopen(fname, "w")) == NULL) { + log_message(-2, "Cannot open \"%s\" for writing: %s", fname, strerror(errno)); + return 1; + } + + for (run = impl_->settings_; run != NULL; run = run->next_) { + switch (run->type_) { + case SET_INTEGER: + fprintf(fp, "%s: %d\n", run->name_, run->val_.integerValue_); + break; + case SET_STRING: + fprintf(fp, "%s: \"%s\"\n", run->name_, run->val_.stringValue_); + break; + } + } + + fclose(fp); + + return 0; +} + +const int *Settings::getInteger(const char *name) const +{ + SettingEntry *s = impl_->findSetting(name, SET_INTEGER); + + if (s != NULL) + return &(s->val_.integerValue_); + else + return NULL; +} + +const char *Settings::getString(const char *name) const +{ + SettingEntry *s = impl_->findSetting(name, SET_STRING); + + if (s != NULL) + return s->val_.stringValue_; + else + return NULL; +} + +void Settings::set(const char *name, int val) +{ + impl_->set(name, val); +} + +void Settings::set(const char *name, const char *val) +{ + impl_->set(name, val); +} diff --git a/dao/Settings.h b/dao/Settings.h new file mode 100644 index 0000000..cab62bd --- /dev/null +++ b/dao/Settings.h @@ -0,0 +1,57 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __SETTINGS_H__ +#define __SETTINGS_H__ + +class Settings { +public: + Settings(); + ~Settings(); + + int read(const char *); + int write(const char *) const; + + const int *getInteger(const char *) const; + const char *getString(const char *) const; + + void set(const char *, int); + void set(const char *, const char *); + + // Key name definitions + static const char* setWriteSpeed; + static const char* setWriteDriver; + static const char* setWriteDevice; + static const char* setWriteBuffers; + static const char* setUserCapacity; + static const char* setFullBurn; + static const char* setReadSpeed; + static const char* setReadDriver; + static const char* setReadDevice; + static const char* setReadParanoiaMode; + static const char* setCddbServerList; + static const char* setCddbTimeout; + static const char* setCddbDbDir; + static const char* setTmpFileDir; + +private: + class SettingsImpl *impl_; +}; + +#endif diff --git a/dao/SonyCDU920.cc b/dao/SonyCDU920.cc new file mode 100644 index 0000000..cdbfd51 --- /dev/null +++ b/dao/SonyCDU920.cc @@ -0,0 +1,981 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include <config.h> + +#include <string.h> +#include <assert.h> +#include <unistd.h> + +#include "SonyCDU920.h" + +#include "port.h" +#include "Toc.h" +#include "log.h" +#include "PQSubChannel16.h" + +SonyCDU920::SonyCDU920(ScsiIf *scsiIf, unsigned long options) + : CdrDriver(scsiIf, options) +{ + int i; + driverName_ = "Sony CDU920 - Version 0.1 (data) (alpha)"; + + speed_ = 2; + simulate_ = true; + encodingMode_ = 1; + + scsiTimeout_ = 0; + leadInLen_ = 0; + + for (i = 0; i < maxScannedSubChannels_; i++) { + scannedSubChannels_[i] = new PQSubChannel16; + } + + // reads little endian samples + audioDataByteOrder_ = 0; +} + +SonyCDU920::~SonyCDU920() +{ + int i; + + for (i = 0; i < maxScannedSubChannels_; i++) { + delete scannedSubChannels_[i]; + scannedSubChannels_[i] = NULL; + } +} + +// static constructor +CdrDriver *SonyCDU920::instance(ScsiIf *scsiIf, unsigned long options) +{ + return new SonyCDU920(scsiIf, options); +} + +int SonyCDU920::bigEndianSamples() const +{ + return 0; // drive takes little endian samples + } + +int SonyCDU920::multiSession(int m) +{ + return 1; // not supported in DAO mode +} + +// sets speed +// return: 0: OK +// 1: illegal speed +int SonyCDU920::speed(int s) +{ + if (s >= 0 && s <= 2) + speed_ = s; + else if (s > 2) + speed_ = 2; + else + return 1; + + return 0; +} + +// loads ('unload' == 0) or ejects ('unload' == 1) tray +// return: 0: OK +// 1: scsi command failed +int SonyCDU920::loadUnload(int unload) const +{ + unsigned char cmd[6]; + + memset(cmd, 0, 6); + + cmd[0] = 0x1b; // START/STOP UNIT + if (unload) { + cmd[4] = 0x02; // LoUnlo=1, Start=0 + } + else { + cmd[4] = 0x01; // LoUnlo=0, Start=1 + } + + if (sendCmd(cmd, 6, NULL, 0, NULL, 0) != 0) { + log_message(-2, "Cannot load/unload medium."); + return 1; + } + + return 0; +} + + +// sets read/write speed and simulation mode +// return: 0: OK +// 1: scsi command failed +int SonyCDU920::selectSpeed() +{ + unsigned char mp[4]; + + mp[0] = 0x31; + mp[1] = 2; + mp[2] = 0; + mp[3] = 0; + + switch (speed_) { + case 0: + mp[2] = 0xff; + case 1: + mp[2] = 0; + break; + case 2: + mp[2] = 1; + break; + } + + if (setModePage6(mp, NULL, NULL, 1) != 0) { + log_message(-2, "Cannot set speed mode page."); + return 1; + } + + return 0; +} + +// Determins start and length of lead-in. +// return: 0: OK +// 1: SCSI command failed +int SonyCDU920::getSessionInfo() +{ + unsigned char mp[32]; + + if (getModePage6(0x22, mp, 32, NULL, NULL, 1) != 0) { + log_message(-2, "Cannot retrieve CD-R disc information mode page."); + return 1; + } + + leadInStart_ = Msf(mp[25], mp[26], mp[27]); + + if (leadInStart_.lba() != 0) + leadInLen_ = 450000 - leadInStart_.lba(); + else + leadInLen_ = 0; + + log_message(4, "Lead-in start: %s length: %ld", leadInStart_.str(), + leadInLen_); + + return 0; +} + + +// Sets write parameters. +// return: 0: OK +// 1: scsi command failed +int SonyCDU920::setWriteParameters() +{ + unsigned char mp[32]; + + memset(mp, 0, 8); + mp[0] = 0x20; + mp[1] = 6; + mp[3] = (simulate_ != 0) ? 2 : 0; + + if (setModePage6(mp, NULL, NULL, 1) != 0) { + log_message(-2, "Cannot set CD-R mastering information page."); + return 1; + } + + memset(mp, 0, 32); + if (getModePage6(0x22, mp, 32, NULL, NULL, 1) != 0) { + log_message(-2, "Cannot retrieve CD-R disc information page."); + return 1; + } + + mp[0] &= 0x7f; // clear PS flag + + mp[2] = 0; // Disc Style: uninterrupted + mp[3] = sessionFormat(); // Disc Type: from 'toc_' object + mp[19] = 0; // no automatic post-gap; required? + + if (setModePage6(mp, NULL, NULL, 1) != 0) { + log_message(-2, "Cannot set CD-R disc information page."); + return 1; + } + + return 0; +} + +// Creates cue sheet for current 'toc_' object. +// cueSheetLen: filled with length of cue sheet in bytes +// return: newly allocated cue sheet buffer or 'NULL' on error +unsigned char *SonyCDU920::createCueSheet(unsigned char leadInDataForm, + long *cueSheetLen) +{ + const Track *t; + int trackNr; + Msf start, end, index; + unsigned char *cueSheet; + long len; + long n; // index into cue sheet + unsigned char ctl; // control nibbles of cue sheet entry CTL/ADR + long i; + unsigned char dataMode; + int firstTrack; + + TrackIterator itr(toc_); + + if (itr.first(start, end) == NULL) { + return NULL; + } + + // determine length of cue sheet + len = 3; // entries for lead-in, 1st pre-gap, lead-out + for (t = itr.first(start, end), trackNr = 1; + t != NULL; + t = itr.next(start, end), trackNr++) { + len += 1; // entry for track + + if (t->start().lba() != 0 && trackNr > 1) { + len += 1; // entry for pre-gap + } + + len += t->nofIndices(); // entry for each index increment + } + + cueSheet = new unsigned char[len * 8]; + n = 0; + + // entry for lead-in + ctl = (toc_->leadInMode() == TrackData::AUDIO) ? 0 : 0x40; + + cueSheet[n*8] = 0x01 | ctl; // CTL/ADR + cueSheet[n*8+1] = 0; // Track number + cueSheet[n*8+2] = 0; // Index + cueSheet[n*8+3] = leadInDataForm; + cueSheet[n*8+4] = 0; // Serial Copy Management System + cueSheet[n*8+5] = 0; // MIN + cueSheet[n*8+6] = sessionFormat(); // disc type + cueSheet[n*8+7] = 0; // FRAME + n++; + + firstTrack = 1; + for (t = itr.first(start, end), trackNr = 1; + t != NULL; + t = itr.next(start, end), trackNr++) { + + switch (t->type()) { + case TrackData::AUDIO: + dataMode = 0x01; + break; + case TrackData::MODE1: + case TrackData::MODE1_RAW: + dataMode = 0x11; + break; + case TrackData::MODE2: + dataMode = 0x19; + break; + case TrackData::MODE2_RAW: + case TrackData::MODE2_FORM1: + case TrackData::MODE2_FORM2: + case TrackData::MODE2_FORM_MIX: + dataMode = 0x23; + break; + default: + dataMode = 0; + break; + } + + ctl = 0; + if (t->copyPermitted()) { + ctl |= 0x20; + } + + if (t->type() == TrackData::AUDIO) { + // audio track + if (t->preEmphasis()) { + ctl |= 0x10; + } + if (t->audioType() == 1) { + ctl |= 0x80; + } + } + else { + // data track + ctl |= 0x40; + } + + Msf tstart(start.lba() + 150); // start of index 1 of current track + + if (firstTrack) { + // entry for pre-gap before first track + cueSheet[n*8] = ctl | 0x01; + cueSheet[n*8+1] = SubChannel::bcd(trackNr); + cueSheet[n*8+2] = 0; // Index 0 + cueSheet[n*8+3] = dataMode; // Data Form + cueSheet[n*8+4] = 0; // Serial Copy Management System + cueSheet[n*8+5] = 0; // MIN 0 + cueSheet[n*8+6] = 0; // SEC 0 + cueSheet[n*8+7] = 0; // FRAME 0 + n++; + } + else if (t->start().lba() != 0) { + // entry for pre-gap + Msf pstart(tstart.lba() - t->start().lba()); + + cueSheet[n*8] = ctl | 0x01; + cueSheet[n*8+1] = SubChannel::bcd(trackNr); + cueSheet[n*8+2] = 0; // Index 0: pre-gap + cueSheet[n*8+3] = dataMode; // Data Form + cueSheet[n*8+4] = 0; // no alternate copy bit + cueSheet[n*8+5] = SubChannel::bcd(pstart.min()); + cueSheet[n*8+6] = SubChannel::bcd(pstart.sec()); + cueSheet[n*8+7] = SubChannel::bcd(pstart.frac()); + n++; + } + + cueSheet[n*8] = ctl | 0x01; + cueSheet[n*8+1] = SubChannel::bcd(trackNr); + cueSheet[n*8+2] = 1; // Index 1 + cueSheet[n*8+3] = dataMode; // Data Form + cueSheet[n*8+4] = 0; // no alternate copy bit + cueSheet[n*8+5] = SubChannel::bcd(tstart.min()); + cueSheet[n*8+6] = SubChannel::bcd(tstart.sec()); + cueSheet[n*8+7] = SubChannel::bcd(tstart.frac()); + n++; + + for (i = 0; i < t->nofIndices(); i++) { + index = tstart + t->getIndex(i); + cueSheet[n*8] = ctl | 0x01; + cueSheet[n*8+1] = SubChannel::bcd(trackNr); + cueSheet[n*8+2] = SubChannel::bcd(i + 2); // Index + cueSheet[n*8+3] = dataMode; // Data Form + cueSheet[n*8+4] = 0; // no alternate copy bit + cueSheet[n*8+5] = SubChannel::bcd(index.min()); + cueSheet[n*8+6] = SubChannel::bcd(index.sec()); + cueSheet[n*8+7] = SubChannel::bcd(index.frac()); + n++; + } + + firstTrack = 0; + } + + assert(n == len - 1); + + // entry for lead out + Msf lostart(toc_->length().lba() + 150); + ctl = (toc_->leadOutMode() == TrackData::AUDIO) ? 0 : 0x40; + + cueSheet[n*8] = ctl | 0x01; + cueSheet[n*8+1] = 0xaa; + cueSheet[n*8+2] = 1; // Index 1 + cueSheet[n*8+3] = 0x00; // CD-DA data, data generated by device + cueSheet[n*8+4] = 0; // no alternate copy bit + cueSheet[n*8+5] = SubChannel::bcd(lostart.min()); + cueSheet[n*8+6] = SubChannel::bcd(lostart.sec()); + cueSheet[n*8+7] = SubChannel::bcd(lostart.frac()); + + log_message(4, "\nCue Sheet:"); + log_message(4, "CTL/ TNO INDEX DATA SCMS MIN SEC FRAME"); + log_message(4, "ADR FORM BCD BCD BCD"); + for (n = 0; n < len; n++) { + log_message(4, "%02x %02x %02x %02x %02x %02x %02x %02x", + cueSheet[n*8], + cueSheet[n*8+1], cueSheet[n*8+2], cueSheet[n*8+3], cueSheet[n*8+4], + cueSheet[n*8+5], cueSheet[n*8+6], cueSheet[n*8+7]); + } + + *cueSheetLen = len * 8; + return cueSheet; +} + +int SonyCDU920::sendCueSheet(unsigned char leadInDataForm) +{ + unsigned char cmd[10]; + long cueSheetLen; + unsigned char *cueSheet = createCueSheet(leadInDataForm, &cueSheetLen); + + if (cueSheet == NULL) { + return 1; + } + + if (cueSheetLen > 3600) { + log_message(-2, "Cue sheet too big. Please remove index marks."); + delete[] cueSheet; + return 1; + } + + memset(cmd, 0, 10); + + cmd[0] = 0xe0; // WRITE START + cmd[1] = (cueSheetLen >> 16) & 0x0f; + cmd[2] = cueSheetLen >> 8; + cmd[3] = cueSheetLen; + + if (sendCmd(cmd, 10, cueSheet, cueSheetLen, NULL, 0) != 0) { + log_message(-2, "Cannot send cue sheet."); + delete[] cueSheet; + return 1; + } + + delete[] cueSheet; + return 0; +} + +int SonyCDU920::readBufferCapacity(long *capacity) +{ + unsigned char cmd[10]; + unsigned char data[8]; + + memset(cmd, 0, 10); + memset(data, 0, 8); + + cmd[0] = 0xec; // READ BUFFER CAPACITY + + if (sendCmd(cmd, 10, NULL, 0, data, 8) != 0) { + log_message(-2, "Read buffer capacity failed."); + return 1; + } + + *capacity = (data[5] << 16) | (data[6] << 8) | data[7]; + + return 0; +} + +int SonyCDU920::initDao(const Toc *toc) +{ + long n; + + toc_ = toc; + + blockLength_ = AUDIO_BLOCK_LEN; + blocksPerWrite_ = scsiIf_->maxDataLen() / blockLength_; + + assert(blocksPerWrite_ > 0); + + if (selectSpeed() != 0 || + getSessionInfo() != 0) { + return 1; + } + + // allocate buffer for writing zeros + n = blocksPerWrite_ * blockLength_; + delete[] zeroBuffer_; + zeroBuffer_ = new char[n]; + memset(zeroBuffer_, 0, n); + + return 0; +} + +int SonyCDU920::startDao() +{ + scsiTimeout_ = scsiIf_->timeout(3 * 60); + + if (setWriteParameters() != 0 || + sendCueSheet(0x00/* Data Form: CD-DA, generate data by device */) != 0) + return 1; + + long lba = -150; + + // write mandatory pre-gap after lead-in + if (writeZeros(toc_->leadInMode(), TrackData::SUBCHAN_NONE, lba, 0, 150) + != 0) { + return 1; + } + + return 0; +} + +int SonyCDU920::finishDao() +{ + scsiIf_->timeout(scsiTimeout_); + + delete[] zeroBuffer_, zeroBuffer_ = NULL; + + return 0; +} + +void SonyCDU920::abortDao() +{ + unsigned char cmd[10]; + + memset(cmd, 0, 10); + + cmd[0] = 0xe2; // DISCONTINUE + + sendCmd(cmd, 10, NULL, 0, NULL, 0, 1); +} + + +// Writes data to target, the block length depends on the actual track 'mode'. +// 'len' is number of blocks to write. +// 'lba' specifies the next logical block address for writing and is updated +// by this function. +// return: 0: OK +// 1: scsi command failed +int SonyCDU920::writeData(TrackData::Mode mode, TrackData::SubChannelMode sm, + long &lba, const char *buf, long len) +{ + assert(blocksPerWrite_ > 0); + + unsigned char cmd[10]; + int writeLen = 0; + long blockLength = blockSize(mode, TrackData::SUBCHAN_NONE); + long byteLen; + int ret; + +#if 0 + long sum, i; + + sum = 0; + + for (i = 0; i < len * blockLength; i++) { + sum += buf[i]; + } + + log_message(0, "W: %ld: %ld, %ld, %ld", lba, blockLength, len, sum); +#endif + + memset(cmd, 0, 10); + cmd[0] = 0xe1; // WRITE CONTINUE + + while (len > 0) { + writeLen = (len > blocksPerWrite_ ? blocksPerWrite_ : len); + + byteLen = writeLen * blockLength; + + cmd[1] = (byteLen >> 16) & 0x1f; + cmd[2] = byteLen >> 8; + cmd[3] = byteLen; + + if ((ret = sendCmd(cmd, 10, (unsigned char *)buf, byteLen, NULL, 0, 0)) + != 0) { + if(ret == 2) { + const unsigned char *sense; + int senseLen; + + sense = scsiIf_->getSense(senseLen); + + // The drive logs in the CD-R after write simulation again and + // reports this by Unit Attention. Ceck for this error and ignore it. + if(senseLen >= 14 && (sense[2] & 0x0f) == 0x6 && sense[7] >= 6 && + (sense[12] == 0x80 /*this really happened*/ || + sense[12] == 0xd4 /*EXIT FROM PSEUDO TRACK AT ONCE RECORDING*/)) { + sleep(10); // wait until drive becomes ready again + } + else { + scsiIf_->printError(); + log_message(-2, "Write data failed."); + return 1; + } + } + else { + log_message(-2, "Write data failed."); + return 1; + } + } + + buf += byteLen; + + lba += writeLen; + len -= writeLen; + } + + return 0; +} + +DiskInfo *SonyCDU920::diskInfo() +{ + unsigned char mp[32]; + + memset(&diskInfo_, 0, sizeof(DiskInfo)); + + memset(mp, 0, 32); + if (getModePage6(0x22, mp, 32, NULL, NULL, 1) != 0) { + log_message(-2, "Cannot retrieve CD-R disc information mode page."); + return &diskInfo_; + } + + diskInfo_.empty = ((mp[16] >> 6) == 0 ? 1 : 0); + diskInfo_.valid.empty = 1; + + diskInfo_.cdrw = 0; + diskInfo_.valid.cdrw = 1; + + if (diskInfo_.empty) { + diskInfo_.manufacturerId = Msf(mp[25], mp[26], mp[27]); + diskInfo_.valid.manufacturerId = 1; + + diskInfo_.capacity = Msf(mp[13], mp[14], mp[15]).lba(); + diskInfo_.valid.capacity = 1; + } + + return &diskInfo_; +} + +Toc *SonyCDU920::readDiskToc(int session, const char *audioFilename) +{ + Toc *toc = CdrDriver::readDiskToc(session, audioFilename); + + setBlockSize(MODE1_BLOCK_LEN); + + return toc; +} + +// tries to read catalog number from disk and adds it to 'toc' +// return: 1 if valid catalog number was found, else 0 +int SonyCDU920::readCatalog(Toc *toc, long startLba, long endLba) +{ + unsigned char cmd[10]; + unsigned char data[24]; + char catalog[14]; + int i; + + memset(cmd, 0, 10); + memset(data, 0, 24); + + cmd[0] = 0x42; // READ SUB-CHANNEL + cmd[2] = 1 << 6; + cmd[3] = 0x02; // get media catalog number + cmd[8] = 24; // transfer length + + if (sendCmd(cmd, 10, NULL, 0, data, 24) != 0) { + log_message(-2, "Cannot get catalog number."); + return 0; + } + + if (data[8] & 0x80) { + for (i = 0; i < 13; i++) { + catalog[i] = data[0x09 + i]; + } + catalog[13] = 0; + + if (toc->catalog(catalog) == 0) { + return 1; + } + } + + return 0; +} + +int SonyCDU920::readIsrc(int trackNr, char *buf) +{ + unsigned char cmd[10]; + unsigned char data[24]; + int i; + + buf[0] = 0; + + memset(cmd, 0, 10); + memset(data, 0, 24); + + cmd[0] = 0x42; // READ SUB-CHANNEL + cmd[2] = 1 << 6; + cmd[3] = 0x03; // get media catalog number + cmd[6] = trackNr; + cmd[8] = 24; // transfer length + + if (sendCmd(cmd, 10, NULL, 0, data, 24) != 0) { + log_message(-2, "Cannot get ISRC code."); + return 0; + } + + if (data[8] & 0x80) { + for (i = 0; i < 12; i++) { + buf[i] = data[0x09 + i]; + } + buf[12] = 0; + } + + return 0; +} + +int SonyCDU920::analyzeTrack(TrackData::Mode mode, int trackNr, long startLba, + long endLba, Msf *indexIncrements, + int *indexIncrementCnt, long *pregap, + char *isrcCode, unsigned char *ctl) +{ + selectSpeed(); + + int ret = analyzeTrackScan(mode, trackNr, startLba, endLba, + indexIncrements, indexIncrementCnt, pregap, + isrcCode, ctl); + + return ret; +} + +int SonyCDU920::readSubChannels(TrackData::SubChannelMode, + long lba, long len, SubChannel ***chans, + Sample *audioData) +{ + unsigned char cmd[12]; + int i; + int retries = 5; + long blockLen = AUDIO_BLOCK_LEN + 16; + + cmd[0] = 0xd8; // READ CDDA + cmd[1] = 0; + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + cmd[6] = len >> 24; + cmd[7] = len >> 16; + cmd[8] = len >> 8; + cmd[9] = len; + cmd[10] = 0x01; + cmd[11] = 0; + + while (1) { + if (sendCmd(cmd, 12, NULL, 0, transferBuffer_, len * blockLen, + retries == 0 ? 1 : 0) != 0) { + if (retries == 0) + return 1; + } + else { + break; + } + + retries--; + } + + unsigned char *p = transferBuffer_ + AUDIO_BLOCK_LEN; + + for (i = 0; i < len; i++) { + ((PQSubChannel16*)scannedSubChannels_[i])->init(p); + + if (scannedSubChannels_[i]->type() != SubChannel::QMODE_ILLEGAL) { + // the CRC of the sub-channel data is set to zero -> mark the + // sub-channel object that it should not try to verify the CRC + scannedSubChannels_[i]->crcInvalid(); + } + + p += blockLen; + } + + if (audioData != NULL) { + p = transferBuffer_; + + for (i = 0; i < len; i++) { + memcpy(audioData, p, AUDIO_BLOCK_LEN); + + p += blockLen; + audioData += SAMPLES_PER_BLOCK; + } + } + + *chans = scannedSubChannels_; + return 0; +} + +CdRawToc *SonyCDU920::getRawToc(int sessionNr, int *len) +{ + unsigned char cmd[10]; + unsigned short dataLen; + unsigned char *data = NULL;; + unsigned char reqData[4]; // buffer for requestion the actual length + unsigned char *p; + int i, entries; + CdRawToc *rawToc; + + assert(sessionNr >= 1); + + // read disk toc length + memset(cmd, 0, 10); + cmd[0] = 0x43; // READ TOC + cmd[6] = sessionNr; + cmd[8] = 4; + cmd[9] = (2 << 6); + + if (sendCmd(cmd, 10, NULL, 0, reqData, 4) != 0) { + log_message(-2, "Cannot read disk toc."); + return NULL; + } + + dataLen = ((reqData[0] << 8) | reqData[1]) + 2; + + log_message(4, "Raw toc data len: %d", dataLen); + + data = new unsigned char[dataLen]; + + // read disk toc + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen) != 0) { + log_message(-2, "Cannot read disk toc."); + delete[] data; + return NULL; + } + + entries = (((data[0] << 8) | data[1]) - 2) / 11; + + rawToc = new CdRawToc[entries]; + + for (i = 0, p = data + 4; i < entries; i++, p += 11 ) { +#if 0 + log_message(0, "%d %02x %02d %2x %02d:%02d:%02d %02d %02d:%02d:%02d", + p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10]); +#endif + rawToc[i].sessionNr = p[0]; + rawToc[i].adrCtl = p[1]; + rawToc[i].point = p[3]; + rawToc[i].pmin = p[8]; + rawToc[i].psec = p[9]; + rawToc[i].pframe = p[10]; + } + + delete[] data; + + *len = entries; + + return rawToc; +} + +long SonyCDU920::readTrackData(TrackData::Mode mode, + TrackData::SubChannelMode, + long lba, long len, unsigned char *buf) +{ + unsigned char cmd[10]; + long blockLen = 2340; + long i; + TrackData::Mode actMode; + int ok = 0; + const unsigned char *sense; + int senseLen; + int softError; + + if (setBlockSize(blockLen) != 0) + return 0; + + memset(cmd, 0, 10); + + cmd[0] = 0x28; // READ10 + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + + while (len > 0 && !ok) { + cmd[7] = len >> 8; + cmd[8] = len; + + memset(transferBuffer_, 0, len * blockLen); + switch (sendCmd(cmd, 10, NULL, 0, transferBuffer_, len * blockLen, 0)) { + case 0: + ok = 1; + break; + + case 2: + softError = 0; + sense = scsiIf_->getSense(senseLen); + + if (senseLen > 0x0c) { + if ((sense[2] &0x0f) == 5) { + switch (sense[12]) { + case 0x63: // end of user area encountered on this track + case 0x64: // Illegal mode for this track + softError = 1; + break; + } + } + else if ((sense[2] & 0x0f) == 3) { // Medium error + switch (sense[12]) { + case 0x02: // No seek complete, sector not found + case 0x11: // L-EC error + return -2; + break; + } + } + } + + if (!softError) { + scsiIf_->printError(); + return -1; + } + break; + + default: + log_message(-2, "Read error at LBA %ld, len %ld", lba, len); + return -1; + break; + } + + if (!ok) { + len--; + } + } + + unsigned char *sector = transferBuffer_; + for (i = 0; i < len; i++) { + actMode = determineSectorMode(sector); + + if (!(actMode == mode || + (mode == TrackData::MODE2_FORM_MIX && + (actMode == TrackData::MODE2_FORM1 || + actMode == TrackData::MODE2_FORM2)) || + + (mode == TrackData::MODE1_RAW && actMode == TrackData::MODE1) || + + (mode == TrackData::MODE2_RAW && + (actMode == TrackData::MODE2 || + actMode == TrackData::MODE2_FORM1 || + actMode == TrackData::MODE2_FORM2)))) { + log_message(4, "Stopped because sector with not matching mode %s found.", + TrackData::mode2String(actMode)); + return i; + } + + if (buf != NULL) { + switch (mode) { + case TrackData::MODE1: + memcpy(buf, sector + 4, MODE1_BLOCK_LEN); + buf += MODE1_BLOCK_LEN; + break; + case TrackData::MODE2: + case TrackData::MODE2_FORM_MIX: + memcpy(buf, sector + 4, MODE2_BLOCK_LEN); + buf += MODE2_BLOCK_LEN; + break; + case TrackData::MODE2_FORM1: + memcpy(buf, sector + 12, MODE2_FORM1_DATA_LEN); + buf += MODE2_FORM1_DATA_LEN; + break; + case TrackData::MODE2_FORM2: + memcpy(buf, sector + 12, MODE2_FORM2_DATA_LEN); + buf += MODE2_FORM2_DATA_LEN; + break; + case TrackData::MODE1_RAW: + case TrackData::MODE2_RAW: + memcpy(buf, syncPattern, 12); + memcpy(buf + 12, sector, 2340); + buf += AUDIO_BLOCK_LEN; + break; + case TrackData::MODE0: + case TrackData::AUDIO: + log_message(-3, "PlextorReader::readTrackData: Illegal mode."); + return 0; + break; + } + } + + sector += blockLen; + } + + return len; +} + +int SonyCDU920::readAudioRange(ReadDiskInfo *rinfo, int fd, long start, + long end, int startTrack, + int endTrack, TrackInfo *info) +{ + return CdrDriver::readAudioRangeParanoia(rinfo, fd, start, end, startTrack, + endTrack, info); +} diff --git a/dao/SonyCDU920.h b/dao/SonyCDU920.h new file mode 100644 index 0000000..e9fc1bf --- /dev/null +++ b/dao/SonyCDU920.h @@ -0,0 +1,93 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1999-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __SONY_CDU920_H__ +#define __SONY_CDU920_H__ + +#include "CdrDriver.h" + +class Toc; +class Track; + +class SonyCDU920 : public CdrDriver { +public: + + SonyCDU920(ScsiIf *scsiIf, unsigned long options); + ~SonyCDU920(); + static CdrDriver *instance(ScsiIf *scsiIf, unsigned long options); + + unsigned long getReadCapabilities(const CdToc *, int) const { return 0; } + + int bigEndianSamples() const; + + int multiSession(int); + int speed(int); + + int loadUnload(int) const; + + int initDao(const Toc *); + int startDao(); + int finishDao(); + void abortDao(); + int writeData(TrackData::Mode, TrackData::SubChannelMode, long &lba, + const char *buf, long len); + + DiskInfo *diskInfo(); + Toc *readDiskToc(int session, const char *audioFilename); + +protected: + int scsiTimeout_; + Msf leadInStart_; // start of lead-in + long leadInLen_; // length of lead-in + + DiskInfo diskInfo_; + + int getSessionInfo(); + + int readCatalog(Toc *, long startLba, long endLba); + int readIsrc(int, char *); + + virtual int selectSpeed(); // overloaded by 'SonyCDU948' + virtual int setWriteParameters(); // overloaded by 'SonyCDU948' + + unsigned char *createCueSheet(unsigned char leadInDataForm, + long *cueSheetLen); + int sendCueSheet(unsigned char leadInDataForm); + + int readBufferCapacity(long *capacity); + + int analyzeTrack(TrackData::Mode, int trackNr, long startLba, long endLba, + Msf *index, + int *indexCnt, long *pregap, char *isrcCode, + unsigned char *ctl); + + int readSubChannels(TrackData::SubChannelMode, long lba, long len, + SubChannel ***, Sample *); + + CdRawToc *getRawToc(int sessionNr, int *len); + + long readTrackData(TrackData::Mode, TrackData::SubChannelMode, + long lba, long len, unsigned char *buf); + + int readAudioRange(ReadDiskInfo *, int fd, long start, long end, + int startTrack, int endTrack, TrackInfo *); + +}; + +#endif diff --git a/dao/SonyCDU948.cc b/dao/SonyCDU948.cc new file mode 100644 index 0000000..0fb489c --- /dev/null +++ b/dao/SonyCDU948.cc @@ -0,0 +1,261 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include <config.h> + +#include <string.h> +#include <assert.h> + +#include "SonyCDU948.h" +#include "PWSubChannel96.h" + +#include "log.h" +#include "Toc.h" +#include "CdTextEncoder.h" + +SonyCDU948::SonyCDU948(ScsiIf *scsiIf, unsigned long options) + : SonyCDU920(scsiIf, options) +{ + driverName_ = "Sony CDU948 - Version 0.1 (data) (alpha)"; + + speed_ = 4; + + cdTextEncoder_ = NULL; +} + +SonyCDU948::~SonyCDU948() +{ + delete cdTextEncoder_; + cdTextEncoder_ = NULL; +} + +// static constructor +CdrDriver *SonyCDU948::instance(ScsiIf *scsiIf, unsigned long options) +{ + return new SonyCDU948(scsiIf, options); +} + +int SonyCDU948::checkToc(const Toc *toc) +{ + int err = SonyCDU920::checkToc(toc); + int e; + + if ((e = toc->checkCdTextData()) > err) + err = e; + + return err; +} + +int SonyCDU948::multiSession(int m) +{ + multiSession_ = m != 0 ? 1 : 0; + + return 0; +} + +// sets speed +// return: 0: OK +// 1: illegal speed +int SonyCDU948::speed(int s) +{ + if (s == 0 || s == 1 || s == 2 || s == 4) + speed_ = s; + else if (s == 3) + speed_ = 2; + else if (s > 4) + speed_ = 4; + else + return 1; + + return 0; +} + +// sets read/write speed and simulation mode +// return: 0: OK +// 1: scsi command failed +int SonyCDU948::selectSpeed() +{ + unsigned char mp[4]; + + mp[0] = 0x31; + mp[1] = 2; + mp[2] = 0; + mp[3] = 0; + + switch (speed_) { + case 0: + mp[2] = 0xff; + case 1: + mp[2] = 0; + break; + case 2: + mp[2] = 1; + break; + case 4: + mp[2] = 3; + break; + } + + if (setModePage6(mp, NULL, NULL, 1) != 0) { + log_message(-2, "Cannot set speed mode page."); + return 1; + } + + return 0; +} + +// Sets write parameters. +// return: 0: OK +// 1: scsi command failed +int SonyCDU948::setWriteParameters() +{ + unsigned char cmd[10]; + unsigned char data[52]; + + if (SonyCDU920::setWriteParameters() != 0) + return 1; + + memset(cmd, 0, 10); + memset(data, 0, 52); + + cmd[0] = 0xf8; // SET WRITE PARAMETERS + cmd[7] = 0; + cmd[8] = 52; + + data[1] = 50; + data[3] = (multiSession_ != 0 ? (3 << 6) : 0); + + if (sendCmd(cmd, 10, data, 52, NULL, 0, 1) != 0) { + log_message(-1, "Cannot set write parameters."); + return 1; + } + + return 0; +} + +int SonyCDU948::initDao(const Toc *toc) +{ + long n; + + delete cdTextEncoder_; + cdTextEncoder_ = new CdTextEncoder(toc); + if (cdTextEncoder_->encode() != 0) { + log_message(-2, "CD-TEXT encoding failed."); + return 1; + } + + if (cdTextEncoder_->getSubChannels(&n) == NULL || n == 0) { + // there is no CD-TEXT data to write + delete cdTextEncoder_; + cdTextEncoder_ = NULL; + } + + return SonyCDU920::initDao(toc); +} + +int SonyCDU948::startDao() +{ + unsigned char leadInDataForm = 0x00; // CD-DA, generate data by device + scsiTimeout_ = scsiIf_->timeout(3 * 60); + + if (cdTextEncoder_ != NULL) + leadInDataForm = 0xc0; // CD-DA with P-W sub-channel data + + if (setWriteParameters() != 0 || + sendCueSheet(leadInDataForm) != 0) + return 1; + + if (writeCdTextLeadIn() != 0) { + return 1; + } + + long lba = -150; + + // write mandatory pre-gap after lead-in + if (writeZeros(toc_->leadInMode(), TrackData::SUBCHAN_NONE, lba, 0, 150) + != 0) { + return 1; + } + + return 0; +} + +int SonyCDU948::writeCdTextLeadIn() +{ + unsigned char cmd[10]; + const PWSubChannel96 **cdTextSubChannels; + long cdTextSubChannelCount; + long channelsPerCmd = scsiIf_->maxDataLen() / 96; + long scp = 0; + long byteLen; + long len = leadInLen_; + long n; + long i; + unsigned char *p; + + if (cdTextEncoder_ == NULL) + return 0; + + if (leadInLen_ == 0) { + log_message(-2, "Cannot write CD-TEXT lead-in because lead-in length is not known."); + return 1; + } + + cdTextSubChannels = cdTextEncoder_->getSubChannels(&cdTextSubChannelCount); + + assert(channelsPerCmd > 0); + assert(cdTextSubChannels != NULL); + assert(cdTextSubChannelCount > 0); + + log_message(2, "Writing CD-TEXT lead-in..."); + + memset(cmd, 0, 10); + cmd[0] = 0xe1; // WRITE CONTINUE + + while (len > 0) { + n = (len > channelsPerCmd) ? channelsPerCmd : len; + + byteLen = n * 96; + + cmd[1] = (byteLen >> 16) & 0x1f; + cmd[2] = byteLen >> 8; + cmd[3] = byteLen; + + p = transferBuffer_; + + for (i = 0; i < n; i++) { + memcpy(p, cdTextSubChannels[scp]->data(), 96); + p += 96; + + scp++; + if (scp >= cdTextSubChannelCount) + scp = 0; + } + + if (sendCmd(cmd, 10, transferBuffer_, byteLen, NULL, 0) != 0) { + log_message(-2, "Writing of CD-TEXT data failed."); + return 1; + } + + len -= n; + } + + return 0; +} diff --git a/dao/SonyCDU948.h b/dao/SonyCDU948.h new file mode 100644 index 0000000..46a5f00 --- /dev/null +++ b/dao/SonyCDU948.h @@ -0,0 +1,54 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1999-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __SONY_CDU948_H__ +#define __SONY_CDU948_H__ + +#include "SonyCDU920.h" + +class Toc; +class Track; + +class CdTextEncoder; + +class SonyCDU948 : public SonyCDU920 { +public: + SonyCDU948(ScsiIf *scsiIf, unsigned long options); + ~SonyCDU948(); + static CdrDriver *instance(ScsiIf *scsiIf, unsigned long options); + + int checkToc(const Toc *); + + int multiSession(int); + int speed(int); + + int initDao(const Toc *); + int startDao(); + +protected: + CdTextEncoder *cdTextEncoder_; + + int selectSpeed(); + int setWriteParameters(); + + int writeCdTextLeadIn(); + +}; + +#endif diff --git a/dao/SubChannel.cc b/dao/SubChannel.cc new file mode 100644 index 0000000..1db39a1 --- /dev/null +++ b/dao/SubChannel.cc @@ -0,0 +1,315 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * $Log: SubChannel.cc,v $ + * Revision 1.2 2000/12/17 10:51:23 andreasm + * Default verbose level is now 2. Adaopted message levels to have finer + * grained control about the amount of messages printed by cdrdao. + * Added CD-TEXT writing support to the GenericMMCraw driver. + * Fixed CD-TEXT cue sheet creating for the GenericMMC driver. + * + * Revision 1.1.1.1 2000/02/05 01:37:27 llanero + * Uploaded cdrdao 1.1.3 with pre10 patch applied. + * + * Revision 1.4 1999/04/05 11:04:48 mueller + * Added decoding of media catalog number and ISRC code. + * + * Revision 1.3 1999/03/27 20:58:55 mueller + * Added various access functions. + * + * Revision 1.2 1998/08/30 19:10:32 mueller + * Added handling of Catalog Number and ISRC codes. + * + * Revision 1.1 1998/08/29 21:31:00 mueller + * Initial revision + * + * + */ + +#include "SubChannel.h" + +#include <ctype.h> + +// lookup table for crc calculation +unsigned short SubChannel::crctab[256] = { + 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50A5, 0x60C6, 0x70E7, 0x8108, + 0x9129, 0xA14A, 0xB16B, 0xC18C, 0xD1AD, 0xE1CE, 0xF1EF, 0x1231, 0x0210, + 0x3273, 0x2252, 0x52B5, 0x4294, 0x72F7, 0x62D6, 0x9339, 0x8318, 0xB37B, + 0xA35A, 0xD3BD, 0xC39C, 0xF3FF, 0xE3DE, 0x2462, 0x3443, 0x0420, 0x1401, + 0x64E6, 0x74C7, 0x44A4, 0x5485, 0xA56A, 0xB54B, 0x8528, 0x9509, 0xE5EE, + 0xF5CF, 0xC5AC, 0xD58D, 0x3653, 0x2672, 0x1611, 0x0630, 0x76D7, 0x66F6, + 0x5695, 0x46B4, 0xB75B, 0xA77A, 0x9719, 0x8738, 0xF7DF, 0xE7FE, 0xD79D, + 0xC7BC, 0x48C4, 0x58E5, 0x6886, 0x78A7, 0x0840, 0x1861, 0x2802, 0x3823, + 0xC9CC, 0xD9ED, 0xE98E, 0xF9AF, 0x8948, 0x9969, 0xA90A, 0xB92B, 0x5AF5, + 0x4AD4, 0x7AB7, 0x6A96, 0x1A71, 0x0A50, 0x3A33, 0x2A12, 0xDBFD, 0xCBDC, + 0xFBBF, 0xEB9E, 0x9B79, 0x8B58, 0xBB3B, 0xAB1A, 0x6CA6, 0x7C87, 0x4CE4, + 0x5CC5, 0x2C22, 0x3C03, 0x0C60, 0x1C41, 0xEDAE, 0xFD8F, 0xCDEC, 0xDDCD, + 0xAD2A, 0xBD0B, 0x8D68, 0x9D49, 0x7E97, 0x6EB6, 0x5ED5, 0x4EF4, 0x3E13, + 0x2E32, 0x1E51, 0x0E70, 0xFF9F, 0xEFBE, 0xDFDD, 0xCFFC, 0xBF1B, 0xAF3A, + 0x9F59, 0x8F78, 0x9188, 0x81A9, 0xB1CA, 0xA1EB, 0xD10C, 0xC12D, 0xF14E, + 0xE16F, 0x1080, 0x00A1, 0x30C2, 0x20E3, 0x5004, 0x4025, 0x7046, 0x6067, + 0x83B9, 0x9398, 0xA3FB, 0xB3DA, 0xC33D, 0xD31C, 0xE37F, 0xF35E, 0x02B1, + 0x1290, 0x22F3, 0x32D2, 0x4235, 0x5214, 0x6277, 0x7256, 0xB5EA, 0xA5CB, + 0x95A8, 0x8589, 0xF56E, 0xE54F, 0xD52C, 0xC50D, 0x34E2, 0x24C3, 0x14A0, + 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, 0xA7DB, 0xB7FA, 0x8799, 0x97B8, + 0xE75F, 0xF77E, 0xC71D, 0xD73C, 0x26D3, 0x36F2, 0x0691, 0x16B0, 0x6657, + 0x7676, 0x4615, 0x5634, 0xD94C, 0xC96D, 0xF90E, 0xE92F, 0x99C8, 0x89E9, + 0xB98A, 0xA9AB, 0x5844, 0x4865, 0x7806, 0x6827, 0x18C0, 0x08E1, 0x3882, + 0x28A3, 0xCB7D, 0xDB5C, 0xEB3F, 0xFB1E, 0x8BF9, 0x9BD8, 0xABBB, 0xBB9A, + 0x4A75, 0x5A54, 0x6A37, 0x7A16, 0x0AF1, 0x1AD0, 0x2AB3, 0x3A92, 0xFD2E, + 0xED0F, 0xDD6C, 0xCD4D, 0xBDAA, 0xAD8B, 0x9DE8, 0x8DC9, 0x7C26, 0x6C07, + 0x5C64, 0x4C45, 0x3CA2, 0x2C83, 0x1CE0, 0x0CC1, 0xEF1F, 0xFF3E, 0xCF5D, + 0xDF7C, 0xAF9B, 0xBFBA, 0x8FD9, 0x9FF8, 0x6E17, 0x7E36, 0x4E55, 0x5E74, + 0x2E93, 0x3EB2, 0x0ED1, 0x1EF0 +}; + +SubChannel::SubChannel() +{ + crcValid_ = 1; // CRC is usually valid +} + + +SubChannel::~SubChannel() +{ +} + +void SubChannel::crcInvalid() +{ + crcValid_ = 0; +} + +SubChannel::Type SubChannel::type() const +{ + return type_; +} + +// returns bcd value for given binary value if it is >= 0 and <= 99, otherwise +// the given value is returned +unsigned char SubChannel::bcd(int d) +{ + if (d >= 0 && d <= 99) + return ((d / 10) << 4) | (d % 10); + else + return d; +} + +int SubChannel::bcd2int(unsigned char d) +{ + unsigned char d1 = d & 0x0f; + unsigned char d2 = d >> 4; + + if (d1 <= 9 && d2 <= 9) { + return d2 * 10 + d1; + } + else { + return d; + } +} + +int SubChannel::isBcd(unsigned char d) +{ + if ((d & 0x0f) <= 9 && (d >> 4) <= 9) + return 1; + + return 0; +} + +// Encodes the given catalog number digits 'n1' - 'n13' (ascii) into +// provided buffer 'buf' of 7 bytes length +void SubChannel::encodeCatalogNumber(unsigned char *buf, char n1, char n2, + char n3, char n4, char n5, char n6, + char n7, char n8, char n9, char n10, + char n11, char n12, char n13) +{ + buf[0] = ((n1 - '0') << 4) | ((n2 - '0') & 0x0f); + buf[1] = ((n3 - '0') << 4) | ((n4 - '0') & 0x0f); + buf[2] = ((n5 - '0') << 4) | ((n6 - '0') & 0x0f); + buf[3] = ((n7 - '0') << 4) | ((n8 - '0') & 0x0f); + buf[4] = ((n9 - '0') << 4) | ((n10 - '0') & 0x0f); + buf[5] = ((n11 - '0') << 4) | ((n12 - '0') & 0x0f); + buf[6] = ((n13 - '0') << 4); +} + +// Decodes given 7 byte buffer to ascii media catalog numbers. +void SubChannel::decodeCatalogNumber(const unsigned char *in, char *n1, + char *n2, char *n3, char *n4, char *n5, + char *n6, char *n7, char *n8, char *n9, + char *n10, char *n11, char *n12, + char *n13) +{ + *n1 = ((in[0] >> 4) & 0x0f) + '0'; + *n2 = (in[0] & 0x0f) + '0'; + *n3 = ((in[1] >> 4) & 0x0f) + '0'; + *n4 = (in[1] & 0x0f) + '0'; + *n5 = ((in[2] >> 4) & 0x0f) + '0'; + *n6 = (in[2] & 0x0f) + '0'; + *n7 = ((in[3] >> 4) & 0x0f) + '0'; + *n8 = (in[3] & 0x0f) + '0'; + *n9 = ((in[4] >> 4) & 0x0f) + '0'; + *n10 = (in[4] & 0x0f) + '0'; + *n11 = ((in[5] >> 4) & 0x0f) + '0'; + *n12 = (in[5] & 0x0f) + '0'; + *n13 = ((in[6] >> 4) & 0x0f) + '0'; +} + +// Encodes given ISRC code into provided buffer of 8 bytes length. +// c1 - c2: country code (ascii digits or letters) +// o1 - o3: country code (ascii digits or letters) +// y1 - y2: year of recording (ascii digits) +// s1 - s2: serial number (ascii digits) +void SubChannel::encodeIsrcCode(unsigned char *buf, char c1, char c2, + char o1, char o2, char o3, char y1, char y2, + char s1, char s2, char s3, char s4, char s5) +{ + unsigned char d; + + buf[0] = ascii2Isrc(c1) << 2; + + d = ascii2Isrc(c2); + buf[0] |= d >> 4; + buf[1] = d << 4; + + d = ascii2Isrc(o1); + buf[1] |= d >> 2; + buf[2] = d << 6; + + buf[2] |= ascii2Isrc(o2); + + buf[3] = ascii2Isrc(o3) << 2; + + buf[4] = ((y1 - '0') << 4) | ((y2 - '0') & 0x0f); + buf[5] = ((s1 - '0') << 4) | ((s2 - '0') & 0x0f); + buf[6] = ((s3 - '0') << 4) | ((s4 - '0') & 0x0f); + buf[7] = ((s5 - '0') << 4); +} + +// Decodes ISRC code from given 8 byte length buffer to ascii characters. +void SubChannel::decodeIsrcCode(const unsigned char *in, char *c1, char *c2, + char *o1, char *o2, char *o3, char *y1, + char *y2, char *s1, char *s2, char *s3, + char *s4, char *s5) +{ + unsigned char d; + + d = (in[0] >> 2) & 0x3f; + *c1 = isrc2Ascii(d); + + d = ((in[0] & 0x03) << 4) | ((in[1] >> 4) & 0x0f); + *c2 = isrc2Ascii(d); + + d = ((in[1] & 0x0f) << 2) | ((in[2] >> 6) & 0x03); + *o1 = isrc2Ascii(d); + + d = in[2] & 0x3f; + *o2 = isrc2Ascii(d); + + d = (in[3] >> 2) & 0x3f; + *o3 = isrc2Ascii(d); + + *y1 = ((in[4] >> 4) & 0x0f) + '0'; + *y2 = (in[4] & 0x0f) + '0'; + *s1 = ((in[5] >> 4) & 0x0f) + '0'; + *s2 = (in[5] & 0x0f) + '0'; + *s3 = ((in[6] >> 4) & 0x0f) + '0'; + *s4 = (in[6] & 0x0f) + '0'; + *s5 = ((in[7] >> 4) & 0x0f) + '0'; +} + +unsigned char SubChannel::ascii2Isrc(char c) +{ + if (isdigit(c)) + return (c - '0') & 0x3f; + + if (isupper(c)) + return (c - 'A' + 17) & 0x3f; + + if (islower(c)) + return (c - 'a' + 17) & 0x3f; + + return 0; +} + +char SubChannel::isrc2Ascii(unsigned char c) +{ + if (c <= 9) + return '0' + c; + + if (c >= 17 && c <= 42) + return 'A' + (c - 17); + + return 0; +} + +int SubChannel::checkConsistency() +{ + const char *buf; + int i; + + switch (type()) { + case QMODE1TOC: + // Not complete, yet. + if (min() > 99 || sec() > 59 || frame() > 74) + return 0; + break; + + case QMODE5TOC: + // not required right now + break; + + case QMODE1DATA: + if (trackNr() < 1 || trackNr() > 99) + return 0; + + if (indexNr() > 99) + return 0; + + if (min() > 99 || sec() > 59 || frame() > 74) + return 0; + + if (amin() > 99 || asec() > 59 || aframe() > 74) + return 0; + break; + + case QMODE2: + buf = catalog(); + for (i = 0; i < 13; i++) { + if (!isdigit(buf[i])) + return 0; + } + break; + + case QMODE3: + buf = isrc(); + for (i = 0; i < 5; i++) { + if (!isdigit(buf[i]) && !isupper(buf[i])) + return 0; + } + for (i = 5; i < 12; i++) { + if (!isdigit(buf[i])) + return 0; + } + break; + + case QMODE_ILLEGAL: + return 0; + break; + } + + return 1; +} diff --git a/dao/SubChannel.h b/dao/SubChannel.h new file mode 100644 index 0000000..79c32be --- /dev/null +++ b/dao/SubChannel.h @@ -0,0 +1,140 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __SUB_CHANNEL_H__ +#define __SUB_CHANNEL_H__ + +class SubChannel { +public: + enum Type { QMODE1TOC, // toc data + QMODE1DATA, // current position in data + QMODE2, // Catalog number + QMODE3, // ISRC code + QMODE5TOC, // toc data + QMODE_ILLEGAL // indicates illegal adr field + }; + + SubChannel(); + virtual ~SubChannel(); + + // marks the CRC of this sub-channel as invalid, 'checkCrc()' will always + // return true for such sub-channels + void crcInvalid(); + + // virtual constructors: + // create sub channel with specified q-mode + virtual SubChannel *makeSubChannel(Type) = 0; + // create sub channel with reading sub channel data from given buffer + virtual SubChannel *makeSubChannel(unsigned char *) = 0; + + virtual void type(unsigned char) = 0; // sets Q mode type + virtual Type type() const; // return Q mode type + + virtual long dataLength() const = 0; // returns number of sub channel bytes + + virtual void pChannel(int) = 0; // sets P channel bit + + virtual void ctl(int) = 0; // sets control flags + virtual unsigned char ctl() const = 0; // return control nibbles in bits 0-3 + + virtual void trackNr(int) = 0; // sets track number (QMODE1DATA) + virtual int trackNr() const = 0; // returns track number (QMODE1DATA) + + virtual void indexNr(int) = 0; // sets index number (QMODE1DATA) + virtual int indexNr() const = 0; // returns index number (QMODE1DATA) + + virtual void point(int) = 0; // sets point filed (QMODE1TOC, QMODE5TOC) + + virtual void min(int) = 0; // track relative time (QMODE1TOC, QMODE1DATA, QMODE5TOC) + virtual int min() const = 0; + + virtual void sec(int) = 0; // track relative time (QMODE1TOC, QMODE1DATA, QMODE5TOC) + virtual int sec() const = 0; + + virtual void frame(int) = 0; // track relative time (QMODE1TOC, QMODE1DATA, QMODE5TOC) + virtual int frame() const = 0; + + virtual void amin(int) = 0; // absolute time (QMODE1DATA) + virtual int amin() const = 0; + + virtual void asec(int) = 0; // absolute time (QMODE1DATA) + virtual int asec() const = 0; + + virtual void aframe(int) = 0; // absolute time (QMODE1DATA, QMODE2, QMODE3) + virtual int aframe() const = 0; + + virtual void pmin(int) = 0; // track start time (QMODE1TOC, QMODE5TOC) + virtual void psec(int) = 0; // track start time (QMODE1TOC, QMODE5TOC) + virtual void pframe(int) = 0; // track start time (QMODE1TOC, QMODE5TOC) + + virtual void zero(int) = 0; // zero field (QMODE5TOC) + + // set catalog number (QMODE2) + virtual void catalog(char, char, char, char, char, char, char, char, char, + char, char, char, char) = 0; + // return catalog number + virtual const char *catalog() const = 0; + + // set ISRC code (QMODE3) + virtual void isrc(char, char, char, char, char, char, char, char, char, + char, char, char) = 0; + + // returns ISRC code + virtual const char *isrc() const = 0; + + virtual void print() const = 0; + + virtual void calcCrc() = 0; // calculates crc and stores it in crc fields + virtual int checkCrc() const = 0; + + virtual int checkConsistency(); + + virtual const unsigned char *data() const = 0; + + static unsigned char ascii2Isrc(char); + static char isrc2Ascii(unsigned char); + + static unsigned char bcd(int); + static int bcd2int(unsigned char d); + static int isBcd(unsigned char); + +protected: + Type type_; + int crcValid_; // 0 if sub channel has no valid CRC that can be checked, + // 1 if CRC is valid and can be checked + static unsigned short crctab[256]; + + static void encodeCatalogNumber(unsigned char *, char, char, char, char, + char, char, char, char, char, char, char, + char, char); + static void decodeCatalogNumber(const unsigned char *, char *, char *, + char *, char *, char *, char *, char *, + char *, char *, char *, char *, char *, + char *); + + static void encodeIsrcCode(unsigned char *, char, char, char, char, char, + char, char, char, char, char, char, char); + static void decodeIsrcCode(const unsigned char *in, char *c1, char *c2, + char *o1, char *o2, char *o3, char *y1, + char *y2, char *s1, char *s2, char *s3, + char *s4, char *s5); + +}; + +#endif diff --git a/dao/TaiyoYuden.cc b/dao/TaiyoYuden.cc new file mode 100644 index 0000000..59d81b7 --- /dev/null +++ b/dao/TaiyoYuden.cc @@ -0,0 +1,309 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* Driver for the TaiyoYuden drive created by Henk-Jan Slotboom. + * Very similar to the Philips CDD2x00 drives. + */ + +#include <config.h> + +#include <string.h> +#include <assert.h> + +#include "TaiyoYuden.h" +#include "SubChannel.h" + +#include "Toc.h" +#include "log.h" + +TaiyoYuden::TaiyoYuden(ScsiIf *scsiIf, unsigned long options) + : PlextorReader(scsiIf, options), CDD2600Base(this) +{ + driverName_ = "Taiyo-Yuden - Version 0.1(alpha)"; + + leadInLength_ = leadOutLength_ = 0; + speed_ = 2; + simulate_ = true; + encodingMode_ = 0; + + audioDataByteOrder_ = 0; // little endian + + memset(&diskInfo_, 0, sizeof(DiskInfo)); +} + +TaiyoYuden::~TaiyoYuden() +{ +} + +// static constructor +CdrDriver *TaiyoYuden::instance(ScsiIf *scsiIf, unsigned long options) +{ + return new TaiyoYuden(scsiIf, options); +} + + +// sets speed +// return: 0: OK +// 1: illegal speed +int TaiyoYuden::speed(int s) +{ + if (s >= 0 && s <= 2) { + speed_ = s; + return 0; + } + else if (s > 2) { + speed_ = 2; + return 0; + } + else { + return 1; + } +} + +// loads ('unload' == 0) or ejects ('unload' == 1) tray +// return: 0: OK +// 1: scsi command failed +int TaiyoYuden::loadUnload(int unload) const +{ + unsigned char cmd[10]; + + memset(cmd, 0, 10); + + cmd[0] = 0xe7; // MEDIUM LOAD/UNLOAD + if (unload) { + cmd[8] |= 0x01; + } + + if (sendCmd(cmd, 10, NULL, 0, NULL, 0) != 0) { + log_message(-2, "Cannot load/unload medium."); + return 1; + } + + return 0; +}; + +int TaiyoYuden::initDao(const Toc *toc) +{ + long n; + + toc_ = toc; + + blockLength_ = AUDIO_BLOCK_LEN; + blocksPerWrite_ = scsiIf_->maxDataLen() / blockLength_; + + assert(blocksPerWrite_ > 0); + + if (modeSelectBlockSize(blockLength_, 1) != 0 || + modeSelectSpeed(-1, speed_, simulate_, 1) != 0 || + modeSelectCatalog(toc_) != 0 || + readSessionInfo(&leadInLength_, &leadOutLength_, 1) != 0) { + return 1; + } + + // allocate buffer for write zeros + n = blocksPerWrite_ * blockLength_; + delete[] zeroBuffer_; + zeroBuffer_ = new char[n]; + memset(zeroBuffer_, 0, n); + + return 0; +} + +int TaiyoYuden::startDao() +{ + long lba = -leadInLength_ - 150; // Value is not really important since the + // LBA is not used by 'writeData'. + + if (writeSession(toc_, multiSession_, 0) != 0) { + return 1; + } + + log_message(2, "Writing lead-in and gap..."); + + // write lead-in + if (writeZeros(toc_->leadInMode(), TrackData::SUBCHAN_NONE, lba, 0, + leadInLength_) != 0) { + flushCache(); + return 1; + } + + // write gap (2 seconds) + if (writeZeros(toc_->leadInMode(), TrackData::SUBCHAN_NONE, lba, 0, 150) + != 0) { + flushCache(); + return 1; + } + + + log_message(2, ""); + + return 0; +} + +int TaiyoYuden::finishDao() +{ + long lba = toc_->length().lba(); + + log_message(2, "Writing lead-out..."); + + // write lead-out + if (writeZeros(toc_->leadOutMode(), TrackData::SUBCHAN_NONE, lba, lba + 150, + leadOutLength_) != 0) { + flushCache(); + return 1; + } + + log_message(2, "\nFlushing cache..."); + + if (flushCache() != 0) { + return 1; + } + + log_message(2, ""); + + delete[] zeroBuffer_, zeroBuffer_ = NULL; + + return 0; +} + +void TaiyoYuden::abortDao() +{ + flushCache(); +} + +// Writes data to target, the block length depends on the actual writing mode +// and is stored internally. 'len' is number of blocks to write. +// 'lba' specifies the next logical block address for writing and is updated +// by this function but not used for writing +// return: 0: OK +// 1: scsi command failed +int TaiyoYuden::writeData(TrackData::Mode mode, TrackData::SubChannelMode sm, + long &lba, const char *buf, long len) +{ + assert(blocksPerWrite_ > 0); + assert(blockLength_ > 0); + assert(mode == TrackData::AUDIO); + int nwritten = 0; + int writeLen = 0; + unsigned char cmd[10]; + + memset(cmd, 0, 10); + cmd[0] = 0x2a; // WRITE1 + + while (len > 0) { + writeLen = (len > blocksPerWrite_ ? blocksPerWrite_ : len); + + cmd[7] = writeLen >> 8; + cmd[8] = writeLen & 0xff; + + if (sendCmd(cmd, 10, (unsigned char *)(buf + (nwritten * blockLength_)), + writeLen * blockLength_, NULL, 0) != 0) { + log_message(-2, "Write data failed."); + return 1; + } + + lba += writeLen; + + len -= writeLen; + nwritten += writeLen; + } + + return 0; +} + +// Retrieve disk information. +// return: DiskInfo structure or 'NULL' on error +DiskInfo *TaiyoYuden::diskInfo() +{ + unsigned char cmd[10]; + unsigned long dataLen = 34; + unsigned char data[34]; + + memset(&diskInfo_, 0, sizeof(DiskInfo)); + + if (readCapacity(&(diskInfo_.capacity), 0) == 0) { + diskInfo_.valid.capacity = 1; + } + + if (readSessionInfo(&leadInLength_, &leadOutLength_, 0) == 0) { + diskInfo_.valid.manufacturerId = 1; + // start time of lead-in + diskInfo_.manufacturerId = Msf(450150 - leadInLength_ - 150 ); + diskInfo_.empty = 1; + } + else { + diskInfo_.empty = 0; + } + + diskInfo_.valid.empty = 0; // does not work for this drive + + memset(cmd, 0, 10); + memset(data, 0, dataLen); + + cmd[0] = 0x51; // READ DISK INFORMATION + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen, 0) == 0) { + diskInfo_.empty = (data[2] & 0x03) == 0 ? 1 : 0; + diskInfo_.cdrw = (data[2] & 0x10) != 0 ? 1 : 0; + diskInfo_.valid.cdrw = 1; + } + + return &diskInfo_; +} + +// Special toc check for Taiyo-Yuden drives. Every track must have a pre-gap +// to create a correct disk. The pre-gap length may be only 1 block. +// Only warnings are created. +// Return: 0: OK +// 1: at least one warning was given +// 2: at least on error was given + +int TaiyoYuden::checkToc(const Toc *toc) +{ + int err = PlextorReader::checkToc(toc); + int trackNr; + Msf start, end; + const Track *t; + int warningGiven = 0; + + TrackIterator itr(toc); + + for (t = itr.first(start, end), trackNr = 1; + t != NULL; + t = itr.next(start, end), trackNr++) { + if (t->start().lba() == 0 && trackNr > 1) { + if (!warningGiven) { + warningGiven = 1; + log_message(-1, "Each track must have a minimal pre-gap to create a useful disk."); + log_message(-1, "This is not fulfilled for following track(s):"); + } + log_message(-1, "Track %d", trackNr); + } + } + + if (warningGiven) { + log_message(0,""); + if (err < 1) + err = 1; + } + + return err; +} diff --git a/dao/TaiyoYuden.h b/dao/TaiyoYuden.h new file mode 100644 index 0000000..e355e76 --- /dev/null +++ b/dao/TaiyoYuden.h @@ -0,0 +1,64 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* Driver for the TaiyoYuden drive created by Henk-Jan Slotboom. + * Very similar to the Philips CDD2x00 drives. + */ + +#ifndef __TAIYO_YUDEN_H__ +#define __TAIYO_YUDEN_H__ + +#include "CdrDriver.h" +#include "PlextorReader.h" +#include "CDD2600Base.h" + +class TaiyoYuden : public PlextorReader, private CDD2600Base { +public: + TaiyoYuden(ScsiIf *scsiIf, unsigned long options); + ~TaiyoYuden(); + + static CdrDriver *instance(ScsiIf *scsiIf, unsigned long options); + + // takes little endian samples + int bigEndianSamples() const { return 0; } + + int speed(int); + + DiskInfo *diskInfo(); + + int loadUnload(int) const; + + int checkToc(const Toc *); + int initDao(const Toc *); + int startDao(); + int finishDao(); + void abortDao(); + + int writeData(TrackData::Mode, TrackData::SubChannelMode, long &lba, + const char *buf, long len); + +protected: + DiskInfo diskInfo_; + +private: + long leadInLength_; + long leadOutLength_; +}; + +#endif diff --git a/dao/TeacCdr55.cc b/dao/TeacCdr55.cc new file mode 100644 index 0000000..fbff875 --- /dev/null +++ b/dao/TeacCdr55.cc @@ -0,0 +1,1518 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <string.h> +#include <assert.h> + +#include "TeacCdr55.h" + +#include "Toc.h" +#include "PQSubChannel16.h" +#include "log.h" + +TeacCdr55::TeacCdr55(ScsiIf *scsiIf, unsigned long options) + : CdrDriver(scsiIf, options) +{ + int i; + driverName_ = "Teac CD-R50/55 - Version 0.1 (data)"; + + speed_ = 0; + simulate_ = true; + encodingMode_ = 1; + + scsiTimeout_ = 0; + + actMode_ = TrackData::AUDIO; + writeEndLba_ = 0; + + memset(modeSelectData_, 0, 12); + memset(&diskInfo_, 0, sizeof(DiskInfo)); + + for (i = 0; i < maxScannedSubChannels_; i++) + scannedSubChannels_[i] = new PQSubChannel16; + + // reads little endian samples + audioDataByteOrder_ = 0; +} + +TeacCdr55::~TeacCdr55() +{ + int i; + + for (i = 0; i < maxScannedSubChannels_; i++) { + delete scannedSubChannels_[i]; + scannedSubChannels_[i] = NULL; + } +} + +// static constructor +CdrDriver *TeacCdr55::instance(ScsiIf *scsiIf, unsigned long options) +{ + return new TeacCdr55(scsiIf, options); +} + +// sets speed +// return: 0: OK +// 1: illegal speed +int TeacCdr55::speed(int s) +{ + if (s >= 0 && s <= 4 && s != 3) { + speed_ = s; + } + else if (s == 3) { + speed_ = 2; + } + else if (s > 4) { + speed_ = 4; + } + else { + return 1; + } + + return 0; +} + +// loads ('unload' == 0) or ejects ('unload' == 1) tray +// return: 0: OK +// 1: scsi command failed +int TeacCdr55::loadUnload(int unload) const +{ + + unsigned char cmd[6]; + + memset(cmd, 0, 6); + + cmd[0] = 0x1b; // START/STOP UNIT + cmd[4] = unload ? 0x02 : 0x03; + + if (sendCmd(cmd, 6, NULL, 0, NULL, 0) != 0) { + log_message(-2, "Cannot load/unload medium."); + return 1; + } + + return 0; +} + +// Retrieves mode select header and block descriptor and stores it in +// class member 'modeSelectData_' for later usage with various mode select +// commands. +// Return: 0: OK, 1: SCSI error +int TeacCdr55::getModeSelectData() +{ + unsigned char cmd[6]; + + memset(cmd, 0, 6); + memset(modeSelectData_, 0, 12); + + cmd[0] = 0x1a; // MODE SENSE + cmd[4] = 12; + + if (sendCmd(cmd, 6, NULL, 0, modeSelectData_, 12, 1) != 0) { + log_message(-2, "Mode Sense failed."); + return 1; + } + + return 0; +} + +// sets read/write speed and simulation mode +// return: 0: OK +// 1: scsi command failed +int TeacCdr55::setWriteSpeed() +{ + unsigned char mp[4]; + + mp[0] = 0x31; + mp[1] = 2; + mp[2] = 0; + mp[3] = 0; + + switch (speed_) { + case 1: + mp[2] = 0; + break; + case 2: + mp[2] = 1; + break; + case 0: + case 4: + mp[2] = 2; + break; + } + + if (setModePage6(mp, modeSelectData_, NULL, 1) != 0) { + log_message(-2, "Cannot set speed mode page."); + return 1; + } + + return 0; +} + +// Sets write parameters via mode page 0x22. +// return: 0: OK +// 1: scsi command failed +int TeacCdr55::setWriteParameters() +{ + unsigned char mp[9]; + + memset(mp, 0, 9); + + mp[0] = 0x22; + mp[1] = 7; + + if (multiSession()) { + mp[4] = 4; // session at once, keep session open + } + else { + if (diskInfo_.sessionCnt > 0) + mp[4] = 0x84; // session at once and close disk + else + mp[4] = 2; // disk at once + } + + if (setModePage6(mp, modeSelectData_, NULL, 1) != 0) { + log_message(-2, "Cannot set write method mode page."); + return 1; + } + + return 0; +} + +int TeacCdr55::setSimulationMode() +{ + unsigned char mp[3]; + + mp[0] = 0x21; + mp[1] = 1; + + if (simulate()) + mp[2] = 3; + else + mp[2] = 0; + + if (setModePage6(mp, modeSelectData_, NULL, 1) != 0) { + log_message(-2, "Cannot set preview write mode page."); + return 1; + } + + return 0; +} + +int TeacCdr55::setWriteDensity(TrackData::Mode mode) +{ + long blockLength = blockSize(mode, TrackData::SUBCHAN_NONE); + unsigned char cmd[6]; + unsigned char data[12]; + + memset(cmd, 0, 6); + + cmd[0] = 0x15; // MODE SELECT + cmd[1] = 0x10; + cmd[4] = 12; + + memcpy(data, modeSelectData_, 12); + + data[0] = 0; + data[3] = 8; + data[9] = 0; + + switch (mode) { + case TrackData::AUDIO: + data[4] = 0x04; + break; + case TrackData::MODE1: + case TrackData::MODE1_RAW: + data[4] = 0x01; + break; + case TrackData::MODE2: + data[4] = 0xc1; + break; + case TrackData::MODE2_FORM1: + data[4] = 0x81; + break; + case TrackData::MODE2_FORM2: + data[4] = 0x82; + break; + case TrackData::MODE2_RAW: + case TrackData::MODE2_FORM_MIX: + data[4] = 0x83; // I'm not sure if this really allows writing of mixed + // form 1 and form 2 sectors. + break; + case TrackData::MODE0: + log_message(-3, "Illegal mode in 'TeacCdr55::setWriteDensity()'."); + return 0; + break; + } + + data[10] = blockLength >> 8; + data[11] = blockLength; + + log_message(3, "Changing write density to 0x%02x/0x%02x%02x.", data[4], data[10], + data[11]); + + if (sendCmd(cmd, 6, data, 12, NULL, 0, 1) != 0) { + log_message(-2, "Cannot set density/block size."); + return 1; + } + + return 0; +} + + +// Judges disc and performs power calibration if possible. +// judge: 1: judge disc, 0: don't judge disc +// Return 0: OK +// 1: judge disc rejected inserted medium +// 2: SCSI error occured +int TeacCdr55::executeOPC(int judge) +{ + unsigned char cmd[12]; + const unsigned char *senseCode; + int senseLen; + + memset(cmd, 0, 12); + + cmd[0] = 0xec; // OPC EXECUTION + + if (judge) { + cmd[1] = 1; // judge current disc + + log_message(2, "Judging disk..."); + switch (sendCmd(cmd, 12, NULL, 0, NULL, 0, 0)) { + case 0: // OK, disc can be written at selected speed + break; + + case 1: + log_message(-2, "Judge disk command failed."); + return 2; + break; + + case 2: // Check sense code + senseCode = scsiIf_->getSense(senseLen); + if (senseLen > 12 && (senseCode[2] & 0x0f) == 5 && senseCode[7] != 0) { + switch (senseCode[12]) { + case 0xcd: + log_message(-2, "Cannot ensure reliable writing with inserted disk."); + return 1; + break; + case 0xce: + log_message(-2, "Cannot ensure reliable writing at selected speed."); + return 1; + break; + case 0xcf: + log_message(-2, "Cannot ensure reliable writing - disk has no ID code."); + return 1; + break; + } + } + scsiIf_->printError(); + return 2; + break; + } + } + + if (simulate()) { + log_message(2, "Skipping optimum power calibration in simulation mode."); + return 0; + } + + cmd[1] = 0; + + log_message(2, "Performing optimum power calibration..."); + if (sendCmd(cmd, 12, NULL, 0, NULL, 0, 1) != 0) { + log_message(-2, "Optimum power calibration failed."); + return 2; + } + + return 0; +} + +// Clears the drive's subcode data. +// Return: 0: OK, 1: SCSI error +int TeacCdr55::clearSubcode() +{ + unsigned char cmd[12]; + + memset(cmd, 0, 12); + + cmd[0] = 0xe4; // CLEAR SUBCODE + cmd[5] = 0x80; + + if (sendCmd(cmd, 12, NULL, 0, NULL, 0, 1) != 0) { + log_message(-2, "Clear subcode failed."); + return 1; + } + + return 0; +} + +// Sets subcode data. +// start: start LBA +// end: end LBA, one greater than last block with specfied subcode data +// ctl: track mode flags in bits 4-7 +// trackNr: track number +// indexNr: index number +// pflag: P-channel flag +// return: 0: OK, 1: SCSI error +int TeacCdr55::setSubcode(long start, long end, unsigned char ctl, int trackNr, + int indexNr, int pflag) +{ + assert(start < end); + + unsigned char cmd[12]; + unsigned char data[4]; + + long len = end - start; + + log_message(4, + "Setting subcode: start: %6ld, end: %6ld, len: %6ld, CTL: %02x P: %d, T: %2d I: %2d", + start, end, len, ctl, pflag, trackNr, indexNr); + + memset(cmd, 0, 12); + + cmd[0] = 0xb3; // SET LIMITS + + cmd[2] = start >> 24; + cmd[3] = start >> 16; + cmd[4] = start >> 8; + cmd[5] = start; + + cmd[6] = len >> 24; + cmd[7] = len >> 16; + cmd[8] = len >> 8; + cmd[9] = len; + + if (sendCmd(cmd, 12, NULL, 0, NULL, 0, 1) != 0) { + log_message(-2, "Cannot set limits."); + return 1; + } + + memset(cmd, 0, 10); + + cmd[0] = 0xc2; // SET SUBCODE + cmd[8] = 4; // parameter list length + + data[0] = pflag != 0 ? 1 : 0; + data[1] = (ctl & 0xf0) | 0x01; + data[2] = SubChannel::bcd(trackNr); + data[3] = SubChannel::bcd(indexNr); + + if (sendCmd(cmd, 10, data, 4, NULL, 0, 1) != 0) { + log_message(-2, "Cannot set subcode."); + return 1; + } + + return 0; +} + +// Sets the subcodes for given track. +// track: actual track +// trackNr: number of current track +// start: LBA of track start (index 1), pre-gap length is taken from 'track' +// end: LBA of track end, same as 'nstart' if next track has no pre-gap +// nstart: LBA of next track start (index 1) +// Return: 0: OK +// 1: SCSI command failed + +struct SubCodeData { + long start; // start LBA + int index; // index + int pflag; // P channel flag +}; + +int TeacCdr55::setSubcodes(const Track *track, int trackNr, + long start, long end, long nstart) +{ + assert(start < end); + assert(end <= nstart); + + unsigned char ctl = trackCtl(track); + SubCodeData subCodes[102]; // index 0-99 + P-channel entry + end-entry + int n = 0; + int i; + + if (track->start().lba() != 0) { + // pre-gap + subCodes[n].start = start - track->start().lba(); + subCodes[n].index = 0; + subCodes[n].pflag = 1; + n++; + } + + // track start (index 1) + subCodes[n].start = start; + subCodes[n].index = 1; + subCodes[n].pflag = 0; + n++; + + // create index marks + + // We have to check if we have to add an entry for the P-channel flag if the + // pre-gap of the following track is shorter than 2 seconds + + // calculate LBA where P-channel must be set for next track, if + // it is behind 'end' it'll be ignored + long pChangeLba = nstart - 150; + + int pChangeEntry = 0; // set to 1 if a P-channel entry was created + long indexStart; + + for (i = 0; i < track->nofIndices(); i++) { + indexStart = track->getIndex(i).lba() + start; + + if (indexStart > pChangeLba && pChangeEntry == 0) { + subCodes[n].start = pChangeLba; + subCodes[n].index = i + 1; + subCodes[n].pflag = 1; + n++; + pChangeEntry = 1; + } + else if (indexStart == pChangeLba) { + // index increment coincides with p channel change position + // -> no entry required + pChangeEntry = 1; + } + + subCodes[n].start = indexStart; + subCodes[n].index = i + 2; + subCodes[n].pflag = indexStart >= pChangeLba ? 1 : 0; + n++; + } + + if (pChangeEntry == 0 && pChangeLba < end) { + subCodes[n].start = pChangeLba; + subCodes[n].index = i + 1; + subCodes[n].pflag = 1; + n++; + } + + // add end of track as last entry + subCodes[n].start = end; + subCodes[n].index = 0; // not used + subCodes[n].pflag = 0; // not used + + assert(n <= 101); + + // now issue the subcode commands + for (i = 0; i < n; i++) { + if (setSubcode(subCodes[i].start, subCodes[i+1].start, ctl, trackNr, + subCodes[i].index, subCodes[i].pflag) != 0) { + return 1; + } + } + + return 0; +} + +// Sets sub codes for all tracks. +// Return: 0: OK +// 1: toc contains no track +// 2: SCSI error +int TeacCdr55::setSubcodes() +{ + const Track *t, *nt; + int trackNr; + Msf start, end; + Msf nstart, nend; + long offset = diskInfo_.thisSessionLba; + int first = 1; + + TrackIterator itr(toc_); + + trackNr = diskInfo_.lastTrackNr; + if ((nt = itr.first(nstart, nend)) == NULL) { + return 1; + } + + if (clearSubcode() != 0) + return 2; + + do { + trackNr += 1; + t = nt; + start = nstart; + end = nend; + + if ((nt = itr.next(nstart, nend)) == NULL) + nstart = Msf(toc_->length()); // start of lead-out + + if (first) { + // set sub code for pre-gap of first track + first = 0; + if (setSubcode(offset - 150, offset, trackCtl(t), trackNr, 0, 1) != 0) + return 2; + } + + if (setSubcodes(t, trackNr, start.lba() + offset, end.lba() + offset, + nstart.lba() + offset) != 0) { + return 2; + } + + } while (nt != NULL); + + return 0; +} + +// Sets toc data. +// Return: 0: OK +// 1: toc contains no track +// 2: SCSI command failed +int TeacCdr55::setToc() +{ + const Track *t; + int trackNr; + Msf start, end; + long offset = diskInfo_.thisSessionLba + 150; // LBA offset + int trackOffset = diskInfo_.lastTrackNr + 1; + unsigned char firstTrackCtl = 0; + unsigned char lastTrackCtl = 0; + unsigned char ctl; + int lastTrackNr = 0; + int sessFormat; + unsigned char cmd[10]; + unsigned char data[3 + 102 * 5]; // max. 99 tracks + 3 POINT entries + unsigned char *p = data + 3; + + data[0] = 0; + data[1] = 0; + data[2] = 0; + + TrackIterator itr(toc_); + + for (t = itr.first(start, end), trackNr = trackOffset; + t != NULL && trackNr <= 99; + t = itr.next(start, end), trackNr++) { + + Msf s(start.lba() + offset); + + ctl = trackCtl(t); + if (trackNr == trackOffset) + firstTrackCtl = ctl; + + p[0] = ctl | 0x01; + p[1] = SubChannel::bcd(trackNr); + p[2] = SubChannel::bcd(s.min()); + p[3] = SubChannel::bcd(s.sec()); + p[4] = SubChannel::bcd(s.frac()); + p += 5; + + lastTrackNr = trackNr; + lastTrackCtl = ctl; + } + + if (lastTrackNr == 0) + return 1; + + + // Point A0 entry (first track nr and session format) + if (diskInfo_.empty) { + // disk is empty -> take toc type from toc-file + sessFormat = sessionFormat(); + } + else { + // Disk has already a recorded session -> take toc type from + // previous session if it is well defined. + switch (diskInfo_.diskTocType) { + case 0x00: + case 0x10: + case 0x20: + sessFormat = diskInfo_.diskTocType; + break; + default: + sessFormat = sessionFormat(); + break; + } + } + + p[0] = firstTrackCtl | 0x01; + p[1] = 0xa0; + p[2] = SubChannel::bcd(trackOffset); + p[3] = SubChannel::bcd(sessFormat); + p[4] = 0; + p += 5; + + // Point A1 entry (last track nr) + p[0] = lastTrackCtl | 0x01; + p[1] = 0xa1; + p[2] = SubChannel::bcd(lastTrackNr); + p[3] = 0; + p[4] = 0; + p += 5; + + // Point A2 entry (start of lead-out) + Msf los(toc_->length().lba() + offset); + + p[0] = lastTrackCtl | 0x01; + p[1] = 0xa2; + p[2] = SubChannel::bcd(los.min()); + p[3] = SubChannel::bcd(los.sec()); + p[4] = SubChannel::bcd(los.frac()); + p += 5; + + + long dataLen = p - data; + +#if 1 + log_message(4, "TOC data:"); + long i; + for (i = 3; i < dataLen; i += 5) { + log_message(4, "%02x %02x %02x:%02x:%02x", + data[i], data[i+1], data[i+2], data[i+3], data[i+4]); + } +#endif + + + memset(cmd, 0, 10); + + cmd[0] = 0xc2; // SET SUBCODE + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + if (sendCmd(cmd, 10, data, dataLen, NULL, 0, 1) != 0) { + log_message(-2, "Cannot set TOC data."); + return 2; + } + + return 0; +} + +// Sets catalog number. +// Return: 0: OK +// 1: SCSI command failed +int TeacCdr55::setCatalog() +{ + unsigned char cmd[10]; + unsigned char data[15]; + int i; + + if (!toc_->catalogValid()) + return 0; + + data[0] = 0; + + if (toc_->leadInMode() == TrackData::AUDIO) + data[1] = 0x02; + else + data[1] = 0x42; + + for (i = 0; i < 13; i++) + data[2 + i] = toc_->catalog(i); + + + memset(cmd, 0, 10); + + cmd[0] = 0xc2; // SET SUBCODE + cmd[8] = 15; + + if (sendCmd(cmd, 10, data, 15, NULL, 0, 1) != 0) { + log_message(-2, "Cannot set catalog number data."); + return 2; + } + + return 0; +} + +// Sets ISRC codes for all tracks +int TeacCdr55::setIsrc() +{ + const Track *t; + int trackNr; + Msf start, end; + int trackOffset = diskInfo_.lastTrackNr + 1; + unsigned char cmd[10]; + unsigned char data[15]; + + data[0] = 0; + + memset(cmd, 0, 10); + + cmd[0] = 0xc2; // SET SUBCODE + cmd[8] = 15; + + TrackIterator itr(toc_); + + for (t = itr.first(start, end), trackNr = trackOffset; + t != NULL && trackNr <= 99; + t = itr.next(start, end), trackNr++) { + if (t->isrcValid()) { + data[1] = trackCtl(t) | 0x03; + data[2] = t->isrcCountry(0); + data[3] = t->isrcCountry(1); + data[4] = t->isrcOwner(0); + data[5] = t->isrcOwner(1); + data[6] = t->isrcOwner(2); + data[7] = t->isrcYear(0) + '0'; + data[8] = t->isrcYear(1) + '0'; + data[9] = t->isrcSerial(0) + '0'; + data[10] = t->isrcSerial(1) + '0'; + data[11] = t->isrcSerial(2) + '0'; + data[12] = t->isrcSerial(3) + '0'; + data[13] = t->isrcSerial(4) + '0'; + data[14] = 0; + + cmd[6] = trackNr; + if (sendCmd(cmd, 10, data, 15, NULL, 0, 1) != 0) { + log_message(-2, "Cannot set ISRC code."); + return 2; + } + } + } + + return 0; +} + + +// Need to overload this function to set the WriteExtension flag. It'll +// also change the write density if the actual mode changes. +int TeacCdr55::writeData(TrackData::Mode mode, TrackData::SubChannelMode sm, + long &lba, const char *buf, long len) +{ + assert(blocksPerWrite_ > 0); + int writeLen = 0; + unsigned char cmd[10]; + long blockLength = blockSize(mode, TrackData::SUBCHAN_NONE); + +#if 0 + long sum, i; + + sum = 0; + + for (i = 0; i < len * blockLength; i++) { + sum += buf[i]; + } + + log_message(0, "W: %ld: %ld, %ld, %ld", lba, blockLength, len, sum); +#endif + + if (mode != actMode_) { + actMode_ = mode; + log_message(3, "Changed write density at LBA %ld.", lba); + + if (setWriteDensity(actMode_) != 0) { + return 1; + } + } + + memset(cmd, 0, 10); + cmd[0] = 0x2a; // WRITE10 + + while (len > 0) { + writeLen = (len > blocksPerWrite_ ? blocksPerWrite_ : len); + + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + + cmd[7] = writeLen >> 8; + cmd[8] = writeLen & 0xff; + + if (lba + writeLen >= writeEndLba_) { + // last write command + log_message(4, "Last write command at LBA: %ld", lba); + cmd[9] = 0; + } + else { + cmd[9] = 0x80; // extended write + } + + if (sendCmd(cmd, 10, (unsigned char *)buf, writeLen * blockLength, + NULL, 0) != 0) { + log_message(-2, "Write data failed."); + return 1; + } + + buf += writeLen * blockLength; + + lba += writeLen; + len -= writeLen; + } + + return 0; +} + + +int TeacCdr55::initDao(const Toc *toc) +{ + long offset; // LBA offset for this session + long n; + + toc_ = toc; + + blockLength_ = AUDIO_BLOCK_LEN; + blocksPerWrite_ = scsiIf_->maxDataLen() / blockLength_; + + assert(blocksPerWrite_ > 0); + + diskInfo(); + + if (!diskInfo_.valid.empty || !diskInfo_.valid.append) { + log_message(-2, "Cannot determine status of inserted medium."); + return 1; + } + + if (!diskInfo_.append) { + log_message(-2, "Inserted medium is not appendable."); + return 1; + } + + offset = diskInfo_.thisSessionLba; + + + // allocate buffer for writing zeros + n = blocksPerWrite_ * blockLength_; + delete[] zeroBuffer_; + zeroBuffer_ = new char[n]; + memset(zeroBuffer_, 0, n); + + + writeEndLba_ = toc_->length().lba() + offset; + actMode_ = toc_->leadInMode(); + + if (getModeSelectData() != 0 || + setWriteDensity(actMode_) != 0 || + setSimulationMode() != 0 || + setWriteParameters() != 0 || + setWriteSpeed() != 0) { + return 1; + } + + return 0; +} + +int TeacCdr55::startDao() +{ + scsiTimeout_ = scsiIf_->timeout(3 * 60); + + if (executeOPC(1) != 0 || + setSubcodes() != 0 || + setCatalog() != 0 || + setToc() != 0 || + setIsrc() != 0) { + return 1; + } + + long lba = diskInfo_.thisSessionLba - 150; + + if (writeZeros(actMode_, TrackData::SUBCHAN_NONE, lba, lba + 150, 150) + != 0) { + return 1; + } + + return 0; +} + +int TeacCdr55::finishDao() +{ + //log_message(0, "Writing lead-out..."); + + // wait until writing of lead-out is finished ??? + + scsiIf_->timeout(scsiTimeout_); + + delete[] zeroBuffer_, zeroBuffer_ = NULL; + + return 0; +} + +void TeacCdr55::abortDao() +{ + unsigned char cmd[10]; + + // Send a zero length write command with cleared extendened write bit. + // I don't know if it has the expected effect. + + memset(cmd, 0, 10); + cmd[0] = 0x2a; // WRITE10 + + sendCmd(cmd, 10, NULL, 0, NULL, 0, 0); +} + +DiskInfo *TeacCdr55::diskInfo() +{ + int i; + unsigned char cmd[12]; + unsigned char data[12]; + + memset(&diskInfo_, 0, sizeof(DiskInfo)); + + diskInfo_.cdrw = 0; + diskInfo_.valid.cdrw = 1; + + memset(cmd, 0, 10); + memset(data, 0, 8); + + cmd[0] = 0x25; // READ CAPACITY + cmd[9] = 0x80; + + if (sendCmd(cmd, 10, NULL, 0, data, 8, 1) != 0) { + log_message(-1, "Cannot read CD-R capacity."); + } + else { + diskInfo_.capacity = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | + data[3]; + diskInfo_.valid.capacity = 1; + } + + memset(cmd, 0, 12); + memset(data, 0, 4); + + cmd[0] = 0xe6; // NEXT WRITABLE ADDRESS + cmd[2] = 0xff; + cmd[3] = 0xff; + cmd[4] = 0xff; + cmd[5] = 0xff; + cmd[6] = 0xff; + cmd[7] = 0xff; + cmd[8] = 0xff; + cmd[9] = 0xff; + + long nwa = 0; + + switch (sendCmd(cmd, 12, NULL, 0, data, 4, 0)) { + case 0: // command succeed -> writable area exists + diskInfo_.empty = 1; + diskInfo_.valid.empty = 1; + nwa = (data[0] << 24) | (data[1] << 16) | (data[2] << 8) | data[3]; + log_message(4, "Next writable address: %ld", nwa); + break; + case 1: // SCSI command failed, no sense data -> cannot tell anything + log_message(-1, "Get next writable address failed."); + break; + case 2: // SCSI command failed, sense data available + // assume that disk is not writable + log_message(4, "Cannot get next writable address."); + diskInfo_.empty = 0; + diskInfo_.valid.empty = 1; + break; + } + + // SCSI command failed -> stop further processing + if (diskInfo_.valid.empty == 0) + return &diskInfo_; + + memset(cmd, 0, 10); + memset(data, 0, 4); + + cmd[0] = 0x43; // READ TOC + cmd[6] = 1; + cmd[8] = 4; + + if (sendCmd(cmd, 10, NULL, 0, data, 4, 0) == 0) { + log_message(4, "First track %u, last track %u", data[2], data[3]); + diskInfo_.lastTrackNr = data[3]; + } + else { + log_message(4, "READ TOC (format 0) failed."); + } + + if (diskInfo_.lastTrackNr > 0) { + diskInfo_.empty = 0; + diskInfo_.diskTocType = 0xff; // undefined + + memset(cmd, 0, 10); + memset(data, 0, 12); + + cmd[0] = 0x43; // READ TOC + cmd[6] = 0; + cmd[8] = 12; + cmd[9] = 1 << 6; + + if (sendCmd(cmd, 10, NULL, 0, data, 12) == 0) { + diskInfo_.sessionCnt = data[3]; + diskInfo_.lastSessionLba = (data[8] << 24) | (data[9] << 16) | + (data[10] << 8) | data[11]; + + log_message(4, "First session %u, last session %u, last session start %ld", + data[2], data[3], diskInfo_.lastSessionLba); + } + else { + log_message(4, "READ TOC (format 1) failed."); + } + + if (diskInfo_.sessionCnt > 0) { + int len; + CdRawToc *toc = getRawToc(diskInfo_.sessionCnt, &len); + + if (toc != NULL) { + for (i = 0; i < len; i++) { + if (toc[i].sessionNr == diskInfo_.sessionCnt) { + if (toc[i].point == 0xb0 && toc[i].min != 0xff && + toc[i].sec != 0xff && toc[i].frame != 0xff) { + int m = SubChannel::bcd2int(toc[i].min); + int s = SubChannel::bcd2int(toc[i].sec); + int f = SubChannel::bcd2int(toc[i].frame); + + if (m < 90 && s < 60 && f < 75) + diskInfo_.thisSessionLba = Msf(m, s, f).lba(); // + 150 - 150 + } + + if (toc[i].point == 0xa0) { + diskInfo_.diskTocType = SubChannel::bcd2int(toc[i].psec); + } + } + } + + if (diskInfo_.thisSessionLba > 0) { + if (diskInfo_.lastTrackNr < 99) + diskInfo_.append = 1; + } + else { + log_message(4, "Did not find BO pointer in session %d.", + diskInfo_.sessionCnt); + } + + delete[] toc; + } + else { + log_message(4, "getRawToc failed."); + } + } + } + else { + // disk is empty and appendable + diskInfo_.empty = 1; + diskInfo_.append = 1; + } + + diskInfo_.valid.append = 1; + + return &diskInfo_; +} + + +// tries to read catalog number from disk and adds it to 'toc' +// return: 1 if valid catalog number was found, else 0 +int TeacCdr55::readCatalog(Toc *toc, long startLba, long endLba) +{ + unsigned char cmd[10]; + unsigned char data[24]; + char catalog[14]; + int i; + + memset(cmd, 0, 10); + memset(data, 0, 24); + + cmd[0] = 0x42; // READ SUB-CHANNEL + cmd[2] = 1 << 6; + cmd[3] = 0x02; // get media catalog number + cmd[8] = 24; // transfer length + + if (sendCmd(cmd, 10, NULL, 0, data, 24) != 0) { + log_message(-2, "Cannot get catalog number."); + return 0; + } + + if (data[8] & 0x80) { + for (i = 0; i < 13; i++) { + catalog[i] = data[0x09 + i]; + } + catalog[13] = 0; + + if (toc->catalog(catalog) == 0) { + return 1; + } + } + + return 0; +} + +int TeacCdr55::readIsrc(int trackNr, char *buf) +{ + unsigned char cmd[10]; + unsigned char data[24]; + int i; + + buf[0] = 0; + + memset(cmd, 0, 10); + memset(data, 0, 24); + + cmd[0] = 0x42; // READ SUB-CHANNEL + cmd[2] = 1 << 6; + cmd[3] = 0x03; // get media catalog number + cmd[6] = trackNr; + cmd[8] = 24; // transfer length + + if (sendCmd(cmd, 10, NULL, 0, data, 24) != 0) { + log_message(-2, "Cannot get ISRC code."); + return 0; + } + + if (data[8] & 0x80) { + for (i = 0; i < 12; i++) { + buf[i] = data[0x09 + i]; + } + buf[12] = 0; + } + + return 0; +} + +int TeacCdr55::analyzeTrack(TrackData::Mode mode, int trackNr, + long startLba, + long endLba, Msf *indexIncrements, + int *indexIncrementCnt, long *pregap, + char *isrcCode, unsigned char *ctl) +{ + int ret = analyzeTrackScan(mode, trackNr, startLba, endLba, + indexIncrements, indexIncrementCnt, pregap, + isrcCode, ctl); + + if (mode == TrackData::AUDIO) + readIsrc(trackNr, isrcCode); + else + *isrcCode = 0; + + return ret; +} + +int TeacCdr55::readSubChannels(TrackData::SubChannelMode, + long lba, long len, SubChannel ***chans, + Sample *audioData) +{ + int retries = 5; + unsigned char cmd[12]; + int i; + + cmd[0] = 0xd8; // READ CD_DA + cmd[1] = 0; + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + cmd[6] = len >> 24; + cmd[7] = len >> 16; + cmd[8] = len >> 8; + cmd[9] = len; + cmd[10] = 0x01; // Q sub-channel data + cmd[11] = 0; + + while (1) { + if (sendCmd(cmd, 12, NULL, 0, + transferBuffer_, len * (AUDIO_BLOCK_LEN + 16), + retries == 0 ? 1 : 0) != 0) { + if (retries == 0) + return 1; + } + else { + break; + } + + retries--; + } + + for (i = 0; i < len; i++) { + PQSubChannel16 *chan = (PQSubChannel16*)scannedSubChannels_[i]; + unsigned char *p = + transferBuffer_ + i * (AUDIO_BLOCK_LEN + 16) + AUDIO_BLOCK_LEN; + + // slightly reorder the sub-channel so it is suitable for 'PQSubChannel16' + p[0] <<= 4; // ctl/adr + p[0] |= p[1]; + p[1] = p[2]; // track nr + p[2] = p[3]; // index nr + p[3] = p[4]; // min + p[4] = p[5]; // sec + p[5] = p[6]; // frame + p[6] = 0; // zero + // p[7] is amin + // p[8] is asec + // p[9] is aframe + + chan->init(p); + + if (chan->checkConsistency()) + chan->calcCrc(); + } + + if (audioData != NULL) { + unsigned char *p = transferBuffer_; + + for (i = 0; i < len; i++) { + memcpy(audioData, p, AUDIO_BLOCK_LEN); + + p += AUDIO_BLOCK_LEN + 16; + audioData += SAMPLES_PER_BLOCK; + } + } + + *chans = scannedSubChannels_; + return 0; +} + + +CdRawToc *TeacCdr55::getRawToc(int sessionNr, int *len) +{ + unsigned char cmd[10]; + unsigned short dataLen; + unsigned char *data = NULL;; + unsigned char reqData[4]; // buffer for requestion the actual length + unsigned char *p = NULL; + int i, entries; + CdRawToc *rawToc; + + assert(sessionNr >= 1); + + // read disk toc length + memset(cmd, 0, 10); + cmd[0] = 0x43; // READ TOC + cmd[6] = sessionNr; + cmd[8] = 4; + cmd[9] |= 2 << 6; // get Q subcodes + + if (sendCmd(cmd, 10, NULL, 0, reqData, 4) != 0) { + log_message(-2, "Cannot read raw disk toc."); + return NULL; + } + + dataLen = ((reqData[0] << 8) | reqData[1]) + 2; + + log_message(4, "Raw toc data len: %d", dataLen); + + if (dataLen == 4) + return NULL; + + data = new unsigned char[dataLen]; + + // read disk toc + cmd[7] = dataLen >> 8; + cmd[8] = dataLen; + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen) != 0) { + log_message(-2, "Cannot read raw disk toc."); + delete[] data; + return NULL; + } + + entries = (((data[0] << 8) | data[1]) - 2) / 11; + + + rawToc = new CdRawToc[entries]; + + for (i = 0, p = data + 4; i < entries; i++, p += 11 ) { +#if 0 + log_message(0, "%d %02x %02d %2x %02x:%02x:%02x %02x %02x:%02x:%02x", + p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10]); +#endif + rawToc[i].sessionNr = p[0]; + rawToc[i].adrCtl = p[1]; + rawToc[i].point = p[3]; + rawToc[i].min = p[4]; + rawToc[i].sec = p[5]; + rawToc[i].frame = p[6]; + rawToc[i].pmin = p[8]; + rawToc[i].psec = p[9]; + rawToc[i].pframe = p[10]; + } + + delete[] data; + + *len = entries; + + return rawToc; +} + +long TeacCdr55::readTrackData(TrackData::Mode mode, + TrackData::SubChannelMode, + long lba, long len, unsigned char *buf) +{ + unsigned char cmd[10]; + long blockLen = 2340; + long i; + TrackData::Mode actMode; + int ok = 0; + int softError; + const unsigned char *sense; + int senseLen; + + if (setBlockSize(blockLen) != 0) + return 0; + + memset(cmd, 0, 10); + + cmd[0] = 0x28; // READ10 + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + + while (len > 0 && !ok) { + cmd[7] = len >> 8; + cmd[8] = len; + + memset(transferBuffer_, 0, len * blockLen); + switch (sendCmd(cmd, 10, NULL, 0, transferBuffer_, len * blockLen, 0)) { + case 0: + ok = 1; + break; + + case 2: + softError = 0; + sense = scsiIf_->getSense(senseLen); + + if (senseLen > 0x0c) { + if ((sense[2] &0x0f) == 5) { + switch (sense[12]) { + case 0x63: // end of user area encountered on this track + case 0x64: // Illegal mode for this track + softError = 1; + break; + } + } + else if ((sense[2] & 0x0f) == 3) { // Medium error + switch (sense[12]) { + case 0x02: // No seek complete, sector not found + case 0x11: // L-EC error + return -2; + break; + } + } + } + + if (!softError) { + scsiIf_->printError(); + return -1; + } + break; + + default: + log_message(-2, "Read error at LBA %ld, len %ld", lba, len); + return -1; + break; + } + + if (!ok) { + len--; + } + } + + unsigned char *sector = transferBuffer_; + for (i = 0; i < len; i++) { + actMode = determineSectorMode(sector); + + if (!(actMode == mode || + (mode == TrackData::MODE2_FORM_MIX && + (actMode == TrackData::MODE2_FORM1 || + actMode == TrackData::MODE2_FORM2)) || + + (mode == TrackData::MODE1_RAW && actMode == TrackData::MODE1) || + + (mode == TrackData::MODE2_RAW && + (actMode == TrackData::MODE2 || + actMode == TrackData::MODE2_FORM1 || + actMode == TrackData::MODE2_FORM2)))) { + return i; + } + + if (buf != NULL) { + switch (mode) { + case TrackData::MODE1: + memcpy(buf, sector + 4, MODE1_BLOCK_LEN); + buf += MODE1_BLOCK_LEN; + break; + case TrackData::MODE2: + case TrackData::MODE2_FORM_MIX: + memcpy(buf, sector + 4, MODE2_BLOCK_LEN); + buf += MODE2_BLOCK_LEN; + break; + case TrackData::MODE2_FORM1: + memcpy(buf, sector + 12, MODE2_FORM1_DATA_LEN); + buf += MODE2_FORM1_DATA_LEN; + break; + case TrackData::MODE2_FORM2: + memcpy(buf, sector + 12, MODE2_FORM2_DATA_LEN); + buf += MODE2_FORM2_DATA_LEN; + break; + case TrackData::MODE1_RAW: + case TrackData::MODE2_RAW: + memcpy(buf, syncPattern, 12); + memcpy(buf + 12, sector, 2340); + buf += AUDIO_BLOCK_LEN; + break; + case TrackData::MODE0: + case TrackData::AUDIO: + log_message(-3, "TeacCdr55::readTrackData: Illegal mode."); + return 0; + break; + } + } + + sector += blockLen; + } + + return len; +} + +Toc *TeacCdr55::readDiskToc(int session, const char *audioFilename) +{ + Toc *toc = CdrDriver::readDiskToc(session, audioFilename); + + setBlockSize(MODE1_BLOCK_LEN); + + return toc; +} + +Toc *TeacCdr55::readDisk(int session, const char *fname) +{ + Toc *toc = CdrDriver::readDisk(session, fname); + + setBlockSize(MODE1_BLOCK_LEN); + + return toc; +} + +int TeacCdr55::readAudioRange(ReadDiskInfo *rinfo, int fd, long start, + long end, int startTrack, + int endTrack, TrackInfo *info) +{ + if (!onTheFly_) { + int t; + + log_message(1, "Analyzing..."); + + for (t = startTrack; t <= endTrack; t++) { + long totalProgress; + + totalProgress = t * 1000; + totalProgress /= rinfo->tracks; + sendReadCdProgressMsg(RCD_ANALYZING, rinfo->tracks, t + 1, 0, + totalProgress); + + log_message(1, "Track %d...", t + 1); + info[t].isrcCode[0] = 0; + readIsrc(t + 1, info[t].isrcCode); + if (info[t].isrcCode[0] != 0) + log_message(2, "Found ISRC code."); + + totalProgress = (t + 1) * 1000; + totalProgress /= rinfo->tracks; + sendReadCdProgressMsg(RCD_ANALYZING, rinfo->tracks, t + 1, 1000, + totalProgress); + } + + log_message(1, "Reading..."); + } + + return CdrDriver::readAudioRangeParanoia(rinfo, fd, start, end, startTrack, + endTrack, info); +} + diff --git a/dao/TeacCdr55.h b/dao/TeacCdr55.h new file mode 100644 index 0000000..d09a529 --- /dev/null +++ b/dao/TeacCdr55.h @@ -0,0 +1,102 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __TEAC_CDR55_H__ +#define __TEAC_CDR55_H__ + +#include "CdrDriver.h" + +class Toc; +class Track; + +class TeacCdr55 : public CdrDriver { +public: + + TeacCdr55(ScsiIf *scsiIf, unsigned long options); + ~TeacCdr55(); + static CdrDriver *instance(ScsiIf *scsiIf, unsigned long options); + + unsigned long getReadCapabilities(const CdToc *, int) const { return 0; } + + // MMC compatible drives take little endian samples + int bigEndianSamples() const { return 0; } + + int speed(int); + + DiskInfo *diskInfo(); + int driveInfo(DriveInfo *, bool showErrorMsg); + + Toc *readDiskToc(int, const char *audioFilename); + Toc *readDisk(int, const char *audioFilename); + + int initDao(const Toc *); + int startDao(); + int finishDao(); + void abortDao(); + + int writeData(TrackData::Mode, TrackData::SubChannelMode, long &lba, + const char *buf, long len); + + int loadUnload(int) const; + +protected: + DiskInfo diskInfo_; + + unsigned char modeSelectData_[12]; + TrackData::Mode actMode_; // actual writing mode, used to switch modes + // in 'writeData()' + long writeEndLba_; // LBA at which writing ends, used in 'writeData()' + + int scsiTimeout_; + + int getModeSelectData(); + int setWriteSpeed(); + int setWriteParameters(); + int setSimulationMode(); + int setWriteDensity(TrackData::Mode); + int executeOPC(int judge); + int clearSubcode(); + int setSubcode(long start, long end, unsigned char ctl, int trackNr, + int indexNr, int pflag); + int setSubcodes(const Track *track, int trackNr, long start, long end, + long nstart); + int setSubcodes(); + int setToc(); + int setCatalog(); + int setIsrc(); + + + CdRawToc *getRawToc(int sessionNr, int *len); + int analyzeTrack(TrackData::Mode mode, int trackNr, long startLba, + long endLba, Msf *indexIncrements, int *indexIncrementCnt, + long *pregap, char *isrcCode, unsigned char *ctl); + + int readSubChannels(TrackData::SubChannelMode, long lba, long len, + SubChannel ***, Sample *); + long readTrackData(TrackData::Mode, TrackData::SubChannelMode, + long lba, long len, unsigned char *buf); + + int readIsrc(int trackNr, char *buf); + int readCatalog(class Toc *, long startLba, long endLba); + int readAudioRange(ReadDiskInfo *, int fd, long start, long end, + int startTrack, int endTrack, TrackInfo *); + +}; + +#endif diff --git a/dao/ToshibaReader.cc b/dao/ToshibaReader.cc new file mode 100644 index 0000000..5b1abc7 --- /dev/null +++ b/dao/ToshibaReader.cc @@ -0,0 +1,83 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1999-2001 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <unistd.h> +#include <assert.h> + +#include "ToshibaReader.h" + +#include "Toc.h" +#include "log.h" + +ToshibaReader::ToshibaReader(ScsiIf *scsiIf, unsigned long options) + : PlextorReader(scsiIf, options | OPT_DRV_GET_TOC_GENERIC) +{ + driverName_ = "Toshiba CD-ROM Reader - Version 0.1"; + + audioDataByteOrder_ = 0; + model_ = 0; +} + +// static constructor +CdrDriver *ToshibaReader::instance(ScsiIf *scsiIf, unsigned long options) +{ + return new ToshibaReader(scsiIf, options); +} + +int ToshibaReader::readSubChannels(TrackData::SubChannelMode, + long lba, long len, SubChannel ***chans, + Sample *audioData) +{ + unsigned char cmd[10]; + int tries = 5; + int ret; + + if (setBlockSize(AUDIO_BLOCK_LEN, 0x82) != 0) + return 1; + + cmd[0] = 0x28; // READ10 + cmd[1] = 0x08; // force unit access + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + cmd[6] = 0; + cmd[7] = len >> 8; + cmd[8] = len; + cmd[9] = 0; + + do { + ret = sendCmd(cmd, 10, NULL, 0, + (unsigned char*)audioData, len * AUDIO_BLOCK_LEN, + (tries == 1) ? 1 : 0); + + if (ret != 0 && tries == 1) { + log_message(-2, "Reading of audio data failed at sector %ld.", lba); + return 1; + } + + tries--; + } while (ret != 0 && tries > 0); + + *chans = NULL; + return 0; +} + diff --git a/dao/ToshibaReader.h b/dao/ToshibaReader.h new file mode 100644 index 0000000..f1124fa --- /dev/null +++ b/dao/ToshibaReader.h @@ -0,0 +1,42 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1999-2001 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __TOSHIBA_READER_H__ +#define __TOSHIBA_READER_H__ + +#include "PlextorReader.h" + +class Toc; +class Track; + +class ToshibaReader : public PlextorReader { +public: + + ToshibaReader(ScsiIf *scsiIf, unsigned long options); + static CdrDriver *instance(ScsiIf *scsiIf, unsigned long options); + + unsigned long getReadCapabilites(const CdToc *, int) const { return 0; } + +protected: + int readSubChannels(TrackData::SubChannelMode, long lba, long len, + SubChannel ***, Sample *); + +}; + +#endif diff --git a/dao/YamahaCDR10x.cc b/dao/YamahaCDR10x.cc new file mode 100644 index 0000000..ca6f2ba --- /dev/null +++ b/dao/YamahaCDR10x.cc @@ -0,0 +1,1075 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1999-2001 Cameron G. MacKinnon <C_MacKinnon@yahoo.com> + * Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* Driver for Yamaha CDR10X drives. + * Written by Cameron G. MacKinnon <C_MacKinnon@yahoo.com>. + */ + + +#include <config.h> + +#include <unistd.h> +#include <string.h> +#include <assert.h> + +#include "YamahaCDR10x.h" + +#include "Toc.h" +#include "PQSubChannel16.h" +#include "log.h" +#include "port.h" + + +YamahaCDR10x::YamahaCDR10x(ScsiIf *scsiIf, unsigned long options) + : CdrDriver(scsiIf, options) +{ + int i; + + driverName_ = "Yamaha CDR10x - Version 0.5 (data)"; + + encodingMode_ = 1; + + speed_ = 0; + simulate_ = true; + + scsiTimeout_ = 0; + + for (i = 0; i < maxScannedSubChannels_; i++) + scannedSubChannels_[i] = new PQSubChannel16; + + // reads little endian samples + audioDataByteOrder_ = 0; +} + +// static constructor +CdrDriver *YamahaCDR10x::instance(ScsiIf *scsiIf, unsigned long options) +{ + return new YamahaCDR10x(scsiIf, options); +} + +YamahaCDR10x::~YamahaCDR10x() +{ + int i; + + for (i = 0; i < maxScannedSubChannels_; i++) { + delete scannedSubChannels_[i]; + scannedSubChannels_[i] = NULL; + } +} + +int YamahaCDR10x::multiSession(int m) +{ + if (m != 0) { + return 1; // multi session mode is not supported + } + + return 0; +} + +// sets speed +// return: 0: OK +// 1: illegal speed +int YamahaCDR10x::speed(int s) +{ + if (s == 0 || s == 1 || s == 2 || s == 4) + speed_ = s; + else if (s == 3) + speed_ = 2; + else if (s > 4) + speed_ = 4; + else + return 1; + + if (selectSpeed() != 0) + return 1; + + return 0; +} + +int YamahaCDR10x::speed() +{ + DriveInfo di; + + if (driveInfo(&di, 1) != 0) { + return 0; + } + + return speed2Mult(di.currentWriteSpeed); + +} + +// loads ('unload' == 0) or ejects ('unload' == 1) tray +// return: 0: OK +// 1: scsi command failed +int YamahaCDR10x::loadUnload(int unload) const +{ + unsigned char cmd[6]; + + memset(cmd, 0, 6); + + cmd[0] = 0x1b; // START/STOP UNIT + if (unload) { + cmd[4] = 0x02; // LoUnlo=1, Start=0 + } + else { + cmd[4] = 0x01; // LoUnlo=0, Start=1: This is a caddy, and load is reserved + } + + if (sendCmd(cmd, 6, NULL, 0, NULL, 0) != 0) { + log_message(-2, "Cannot %s medium.", (unload ? "stop & unload" : "start")); + return 1; + } + + return 0; +} + +// sets read/write speed +// return: 0: OK +// 1: scsi command failed +int YamahaCDR10x::selectSpeed() +{ + unsigned char mp[4]; + + if (getModePage6(0x31/*drive configuration mode page*/, mp, 4, + NULL, NULL, 1) != 0) { + log_message(-2, "Cannot retrieve drive configuration mode page (0x31)."); + return 1; + } + + mp[3] &= 0x0f; + if(speed_ == 0 || speed_ == 4) { + mp[3] |= 0x20; // read at 4x, write at 2x (CDR102) or 4x (CDR100) + } else if(speed_ == 2) { + mp[3] |= 0x10; // read at 2x, write at 2x + } else if(speed_ == 1) { + ; // read at 1x, write at 1x + } else { + log_message(-2, "Invalid write speed argument %d. 0, 1, 2 or 4 expected.", + speed_); + return 1; + } + + if (setModePage6(mp, NULL, NULL, 1) != 0) { + log_message(-2, "Cannot set drive configuration mode page for cd speed."); + return 1; + } + + return 0; +} + +// Sets write parameters via mode pages 0x31 and 0x32. +// return: 0: OK +// 1: scsi command failed +int YamahaCDR10x::setWriteParameters() +{ + unsigned char mp[8]; // the larger of 4 and 8, gets used twice + + if (getModePage6(0x31/*drive configuration mode page*/, mp, 4, + NULL, NULL, 1) != 0) { + log_message(-2, "Cannot retrieve drive configuration mode page (0x31)."); + return 1; + } + + mp[3] &= 0xf0; // save speed settings in high nibble + mp[3] |= (simulate_ ? 1 : 0); + + if (setModePage6(mp, NULL, NULL, 1) != 0) { + log_message(-2, "Cannot set drive configuration mode page (0x31)."); + return 1; + } + + memset(mp, 0, 8); + + if (getModePage6(0x32/*write format mode page*/, mp, 8, + NULL, NULL, 1) != 0) { + log_message(-2, "Cannot retrieve write format mode page (0x32)."); + return 1; + } + + mp[2] &= 0xf0; // RW subcode internally zero supplied + mp[3] &= 0xf0; + mp[3] |= 0x04; // disc at once (single session) + + if (setModePage6(mp, NULL, NULL, 1) != 0) { + log_message(-2, "Cannot set write format mode page (0x32)."); + return 1; + } + + return 0; +} + +void YamahaCDR10x::cueSheetDataType(TrackData::Mode mode, + unsigned char *dataType, + unsigned char *dataForm) +{ + switch (mode) { + case TrackData::AUDIO: + *dataType = 0; + *dataForm = 0; + break; + + case TrackData::MODE1: + case TrackData::MODE1_RAW: + *dataType = 2; + *dataForm = 3; + break; + + case TrackData::MODE2: + *dataType = 3; + *dataForm = 3; + break; + + case TrackData::MODE2_RAW: + case TrackData::MODE2_FORM1: + case TrackData::MODE2_FORM2: + case TrackData::MODE2_FORM_MIX: + if (toc_->tocType() == Toc::CD_I) + *dataType = 4; + else + *dataType = 5; + *dataForm = 3; + break; + + case TrackData::MODE0: + log_message(-3, "Illegal mode in 'YamahaCDR10x::cueSheetDataType()'."); + *dataType = 0; + *dataForm = 0; + break; + } +} + +// Creates cue sheet for current toc. +// cueSheetLen: filled with length of cue sheet in bytes +// return: newly allocated cue sheet buffer or 'NULL' on error +// CHECKS OUT WITH DOS-DAO AND MANUAL +unsigned char *YamahaCDR10x::createCueSheet(long *cueSheetLen) +{ + const Track *t; + int trackNr; + Msf start, end, index; + unsigned char *cueSheet; + long len = 2; // entries for lead-in, lead-out + long n; // index into cue sheet + unsigned char ctl; // control nibbles of cue sheet entry CTL/ADR + long i; + unsigned char dataForm; + unsigned char dataType; + + TrackIterator itr(toc_); + + if (itr.first(start, end) == NULL) { + return NULL; + } + + if (toc_->catalogValid()) { + len += 2; + } + + for (t = itr.first(start, end), trackNr = 1; + t != NULL; t = itr.next(start, end), trackNr++) { + len += 2; // entry for track and mandatory pre-gap + if (t->type() == TrackData::AUDIO && t->isrcValid()) { + len += 2; // entries for ISRC code + } + len += t->nofIndices(); // entry for each index increment + } + + cueSheet = new unsigned char[len * 8]; + n = 0; + + if (toc_->leadInMode() == TrackData::AUDIO) + ctl = 0; + else + ctl = 0x40; + + if (toc_->catalogValid()) { + // fill catalog number entry + cueSheet[n*8] = 0x02 | ctl; + cueSheet[(n+1)*8] = 0x02 | ctl; + for (i = 1; i <= 13; i++) { + if (i < 8) { + cueSheet[n*8 + i] = toc_->catalog(i-1) + '0'; + } + else { + cueSheet[(n+1)*8 + i - 7] = toc_->catalog(i-1) + '0'; + } + } + cueSheet[(n+1)*8+7] = 0; + n += 2; + } + + cueSheetDataType(toc_->leadInMode(), &dataType, &dataForm); + + // entry for lead-in + cueSheet[n*8] = 0x01 | ctl; // CTL/ADR + cueSheet[n*8+1] = 0; // Track number + cueSheet[n*8+2] = 0; // Index + cueSheet[n*8+3] = dataType; // Data Type + cueSheet[n*8+4] = 0; // Data Form: always 0 for lead-in + cueSheet[n*8+5] = 0; // MIN + cueSheet[n*8+6] = 0; // SEC + cueSheet[n*8+7] = 0; // FRAME + n++; + + for (t = itr.first(start, end), trackNr = 1; + t != NULL; + t = itr.next(start, end), trackNr++) { + + cueSheetDataType(t->type(), &dataType, &dataForm); + + ctl = trackCtl(t); + + if (t->type() == TrackData::AUDIO) { + // set ISRC code for audio track + if (t->isrcValid()) { + cueSheet[n*8] = ctl | 0x03; + cueSheet[n*8+1] = SubChannel::bcd(trackNr); + cueSheet[n*8+2] = t->isrcCountry(0); + cueSheet[n*8+3] = t->isrcCountry(1); + cueSheet[n*8+4] = t->isrcOwner(0); + cueSheet[n*8+5] = t->isrcOwner(1); + cueSheet[n*8+6] = t->isrcOwner(2); + cueSheet[n*8+7] = t->isrcYear(0) + '0'; + n++; + + cueSheet[n*8] = ctl | 0x03; + cueSheet[n*8+1] = SubChannel::bcd(trackNr); + cueSheet[n*8+2] = t->isrcYear(1) + '0'; + cueSheet[n*8+3] = t->isrcSerial(0) + '0'; + cueSheet[n*8+4] = t->isrcSerial(1) + '0'; + cueSheet[n*8+5] = t->isrcSerial(2) + '0'; + cueSheet[n*8+6] = t->isrcSerial(3) + '0'; + cueSheet[n*8+7] = t->isrcSerial(4) + '0'; + n++; + } + } + + Msf tstart(start.lba() + 150); // start of index 1 + + // start of pre-gap, atime equals index 1 if no pre-gap is defined + Msf pstart(trackNr == 1 ? 0 : tstart.lba() - t->start().lba()); + + // entry for pre-gap + cueSheet[n*8] = ctl | 0x01; + cueSheet[n*8+1] = SubChannel::bcd(trackNr); + cueSheet[n*8+2] = 0; // Index 0 indicates pre-gap + cueSheet[n*8+3] = dataType; // Data Type + cueSheet[n*8+4] = dataForm; // Data Form + cueSheet[n*8+5] = SubChannel::bcd(pstart.min()); + cueSheet[n*8+6] = SubChannel::bcd(pstart.sec()); + cueSheet[n*8+7] = SubChannel::bcd(pstart.frac()); + n++; + + cueSheet[n*8] = ctl | 0x01; + cueSheet[n*8+1] = SubChannel::bcd(trackNr); + cueSheet[n*8+2] = 1; // Index 1 + cueSheet[n*8+3] = dataType; // Data Type + cueSheet[n*8+4] = dataForm; // Data Form + cueSheet[n*8+5] = SubChannel::bcd(tstart.min()); + cueSheet[n*8+6] = SubChannel::bcd(tstart.sec()); + cueSheet[n*8+7] = SubChannel::bcd(tstart.frac()); + n++; + + for (i = 0; i < t->nofIndices(); i++) { + index = tstart + t->getIndex(i); + cueSheet[n*8] = ctl | 0x01; + cueSheet[n*8+1] = SubChannel::bcd(trackNr); + cueSheet[n*8+2] = SubChannel::bcd(i+2); // Index + cueSheet[n*8+3] = dataType; // DataType + cueSheet[n*8+4] = dataForm; // Data Form + cueSheet[n*8+5] = SubChannel::bcd(index.min()); + cueSheet[n*8+6] = SubChannel::bcd(index.sec()); + cueSheet[n*8+7] = SubChannel::bcd(index.frac()); + n++; + } + } + + assert(n == len - 1); + + // entry for lead out + Msf lostart(toc_->length().lba() + 150); + cueSheetDataType(toc_->leadOutMode(), &dataType, &dataForm); + ctl = toc_->leadOutMode() == TrackData::AUDIO ? 0 : 0x40; + + cueSheet[n*8] = ctl | 0x01; + cueSheet[n*8+1] = 0xaa; // This IS BCD + cueSheet[n*8+2] = 1; // Index 1 + cueSheet[n*8+3] = dataType; // Data for lead-out + cueSheet[n*8+4] = 0; // Data Form, always 0 for lead-out + cueSheet[n*8+5] = SubChannel::bcd(lostart.min()); + cueSheet[n*8+6] = SubChannel::bcd(lostart.sec()); + cueSheet[n*8+7] = SubChannel::bcd(lostart.frac()); + + log_message(4, "\nCue Sheet:"); + log_message(4, "CTL/ TNO INDEX DATA DATA MIN SEC FRAME"); + log_message(4, "ADR BCD BCD TYPE Form BCD BCD BCD <- Note"); + for (n = 0; n < len; n++) { + log_message(4, "%02x %02x %02x %02x %02x %02x %02x %02x", + cueSheet[n*8], + cueSheet[n*8+1], cueSheet[n*8+2], cueSheet[n*8+3], cueSheet[n*8+4], + cueSheet[n*8+5], cueSheet[n*8+6], cueSheet[n*8+7]); + } + + *cueSheetLen = len * 8; + return cueSheet; +} + +// LOOKS GOOD +int YamahaCDR10x::sendCueSheet() +{ + unsigned char cmd[10]; + long cueSheetLen; + unsigned char *cueSheet = createCueSheet(&cueSheetLen); + + if (cueSheet == NULL) { + return 1; + } + + if(cueSheetLen > 32768) { // Limit imposed by drive. + log_message(-2, "Cue sheet too long for this device: Limit is 32k bytes."); + delete[] cueSheet; + return 1; + } + + memset(cmd, 0, 10); + + cmd[0] = 0xea; // Yamaha Vendor Specific WRITE TOC + + cmd[7] = cueSheetLen >> 8; + cmd[8] = cueSheetLen; + + if (sendCmd(cmd, 10, cueSheet, cueSheetLen, NULL, 0) != 0) { + log_message(-2, "Cannot send cue sheet."); + delete[] cueSheet; + return 1; + } + + delete[] cueSheet; + return 0; +} + +// DOES NOT TALK TO DRIVE: JUST HOUSEKEEPING +int YamahaCDR10x::initDao(const Toc *toc) +{ + long n; + + toc_ = toc; + + blockLength_ = AUDIO_BLOCK_LEN; + blocksPerWrite_ = scsiIf_->maxDataLen() / blockLength_; + + assert(blocksPerWrite_ > 0); + + if (selectSpeed() != 0) { + return 1; + } + + // allocate buffer for writing zeros + n = blocksPerWrite_ * blockLength_; + delete[] zeroBuffer_; + zeroBuffer_ = new char[n]; + memset(zeroBuffer_, 0, n); + + return 0; +} + +// LOOKS OK - dodgy WRITE TRACK parameters, but apparently how DAO16 does it +int YamahaCDR10x::startDao() +{ + unsigned char cmd[10]; + + scsiTimeout_ = scsiIf_->timeout(3 * 60); + + if (setWriteParameters() != 0 || + sendCueSheet() != 0) { + return 1; + } + + memset(cmd, 0, 10); + cmd[0] = 0xe6; // Yamaha WRITE TRACK(10) + cmd[5] = 0; // Track Number + cmd[6] &= 0xdf; // R Parity = 0; + cmd[6] &= 0xef; // Byte Swap = 0 = little endian + cmd[6] &= 0xf7; // Copy = 0 + cmd[6] &= 0xfb; // Audio = 0 (false) + cmd[6] &= 0xfc; // Mode=0 NB This combination of mode/audio is reserved + // so we end up sending a bare e6 command with nine bytes of nulls + + if (sendCmd(cmd, 10, NULL, 0, NULL, 0) != 0) { + log_message(-2, "Could not send command 0xE6: WRITE TRACK(10)"); + return 1; + } + + //log_message(2, "Writing lead-in and gap..."); + + long lba = -150; + + if (writeZeros(toc_->leadInMode(), TrackData::SUBCHAN_NONE, lba, 0, 150) + != 0) { + return 1; + } + + return 0; +} + +int YamahaCDR10x::finishDao() +{ + unsigned char cmd[6]; + const unsigned char *sense; + int senseLen; + + log_message(2, "Flushing cache..."); + + if (flushCache() != 0) { + return 1; + } + + memset(cmd, 0, 6); + + // wait until lead-out is written + while(sendCmd(cmd, 6, NULL, 0, NULL, 0, 0) == 2 + && (sense = scsiIf_->getSense(senseLen)) && senseLen + && sense[2] == 0x0b && sense[0xc] == 0x50) { + sleep(1); + } + + scsiIf_->timeout(scsiTimeout_); + + delete[] zeroBuffer_, zeroBuffer_ = NULL; + + return 0; +} + +void YamahaCDR10x::abortDao() +{ + flushCache(); +} + +///////////////////////// FIXME THE TOP BAR ////////////////////////////// + +// NEEDS WORK +DiskInfo *YamahaCDR10x::diskInfo() +{ + unsigned char cmd[10]; + unsigned long dataLen = 8; + unsigned char data[8]; + static DiskInfo di; + //char spd; + + memset(&di, 0, sizeof(DiskInfo)); + + di.valid.cdrw = 0; // by definition, for this device + + memset(cmd, 0, 10); + memset(data, 0, dataLen); + + // This looks like CdrDevice::readCapacity, but with a difference: we + // get data for a ROM, and we need to check that our disc is writable + + cmd[0] = 0x25; // READ CD-ROM CAPACITY + + if (sendCmd(cmd, 10, NULL, 0, data, dataLen) != 0) { + log_message(-1, "Cannot read CD-ROM capacity."); + return &di; + } + + if(data[4] | data[5] | data[6] | data[7]) { // block length field, 0=writable + di.capacity = 0; + } else { // disk is writable + di.capacity = data[0]<<24 | data[1]<<16 | data[2]<<8 | data[3]; + } + di.valid.capacity = 1; + + // FIXME: need to come up with empty, manufacturerID, recSpeed + + // maybe use READ DISC INFO (0x43) here? se p. 62 +///////////////////////////////////////// + + return &di; +} + + +// tries to read catalog number from disk and adds it to 'toc' +// return: 1 if valid catalog number was found, else 0 +int YamahaCDR10x::readCatalog(Toc *toc, long startLba, long endLba) +{ + unsigned char cmd[10]; + unsigned char data[24]; + char catalog[14]; + int i; + + memset(cmd, 0, 10); + memset(data, 0, 24); + + cmd[0] = 0x42; // READ SUB-CHANNEL + cmd[2] = 1 << 6; + cmd[3] = 0x02; // get media catalog number + cmd[8] = 24; // transfer length + + if (sendCmd(cmd, 10, NULL, 0, data, 24) != 0) { + log_message(-2, "Cannot get catalog number."); + return 0; + } + + if (data[8] & 0x80) { + for (i = 0; i < 13; i++) { + catalog[i] = data[0x09 + i]; + } + catalog[13] = 0; + + if (toc->catalog(catalog) == 0) { + return 1; + } + } + + return 0; +} + +int YamahaCDR10x::readIsrc(int trackNr, char *buf) +{ + unsigned char cmd[10]; + unsigned char data[24]; + int i; + + buf[0] = 0; + + memset(cmd, 0, 10); + memset(data, 0, 24); + + cmd[0] = 0x42; // READ SUB-CHANNEL + cmd[2] = 1 << 6; + cmd[3] = 0x03; // get ISRC + cmd[6] = trackNr; + cmd[8] = 24; // transfer length + + if (sendCmd(cmd, 10, NULL, 0, data, 24) != 0) { + log_message(-2, "Cannot get ISRC code."); + return 0; + } + + // FIXME this looks right, but the offsets could be wrong + if (data[8] & 0x80) { + for (i = 0; i < 12; i++) { + buf[i] = data[0x09 + i]; + } + buf[12] = 0; + } + + return 0; +} + +int YamahaCDR10x::analyzeTrack(TrackData::Mode mode, int trackNr, + long startLba, + long endLba, Msf *indexIncrements, + int *indexIncrementCnt, long *pregap, + char *isrcCode, unsigned char *ctl) +{ + int ret = analyzeTrackScan(mode, trackNr, startLba, endLba, + indexIncrements, indexIncrementCnt, pregap, + isrcCode, ctl); + + if (mode == TrackData::AUDIO) + readIsrc(trackNr, isrcCode); + else + *isrcCode = 0; + + return ret; +} + +int YamahaCDR10x::readSubChannels(TrackData::SubChannelMode, + long lba, long len, SubChannel ***chans, + Sample *audioData) +{ + int retries = 5; + int i; + unsigned char cmd[12]; + + cmd[0] = 0xd8; // Yamaha READ CD-DA + cmd[1] = 0; + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + cmd[6] = len >> 24; + cmd[7] = len >> 16; + cmd[8] = len >> 8; + cmd[9] = len; + cmd[10] = 0x01; // 2352 + 10 Q (no CRC) + 6 NULL + cmd[11] = 0; + + while (1) { + if (sendCmd(cmd, 12, NULL, 0, + transferBuffer_, len * (AUDIO_BLOCK_LEN + 16), + retries == 0 ? 1 : 0) != 0) { + if (retries == 0) + return 1; + } + else { + break; + } + + retries--; + } + + for (i = 0; i < len; i++) { + PQSubChannel16 *chan = (PQSubChannel16*)scannedSubChannels_[i]; + unsigned char *p = + transferBuffer_ + i * (AUDIO_BLOCK_LEN + 16) + AUDIO_BLOCK_LEN; + + // slightly reorder the sub-channel so it is suitable for 'PQSubChannel16' + p[0] <<= 4; // ctl/adr + p[0] |= p[1]; + p[1] = p[2]; // track nr + p[2] = p[3]; // index nr + p[3] = p[4]; // min + p[4] = p[5]; // sec + p[5] = p[6]; // frame + p[6] = 0; // zero + // p[7] is amin + // p[8] is asec + // p[9] is aframe + + chan->init(p); + + if (chan->checkConsistency()) + chan->calcCrc(); + } + + if (audioData != NULL) { + unsigned char *p = transferBuffer_; + + for (i = 0; i < len; i++) { + memcpy(audioData, p, AUDIO_BLOCK_LEN); + + p += AUDIO_BLOCK_LEN + 16; + audioData += SAMPLES_PER_BLOCK; + } + } + + *chans = scannedSubChannels_; + return 0; +} + +// LOOKSGOOD, except for accurate audio stream bit +int YamahaCDR10x::driveInfo(DriveInfo *info, bool showErrorMsg) +{ + unsigned char mp[4]; + + if (getModePage6(0x31, mp, 4, NULL, NULL, showErrorMsg) != 0) { + if (showErrorMsg) { + log_message(-2, "Cannot retrieve drive configuration mode page (0x31)."); + } + return 1; + } + + // FIXME + // info->accurateAudioStream = mp[5] & 0x02 ? 1 : 0; + info->accurateAudioStream = 0; + + info->maxReadSpeed = mult2Speed(4); + + if(!strncmp(scsiIf_->product(), "CDR100", 6)) { + info->maxWriteSpeed = mult2Speed(4); + info->currentWriteSpeed = info->currentReadSpeed = + mult2Speed(1 << (mp[3] >> 4)); + } else { // CDR102, crippled to 2x write + info->maxWriteSpeed = mult2Speed(2); + info->currentReadSpeed = mult2Speed(1 << (mp[3] >> 4)); + info->currentWriteSpeed = mult2Speed((mp[3] >> 4) ? 2 : 1); + } + + return 0; +} + +// writeData is overridden here because the CDR10x, while writing the disc +// lead-in with the buffer full, will return CHECK CONDITION with sense +// DRIVE BUSY and additional sense 0xb8 = WRITE LEAD-IN IN PROGRESS. +// This is normal operation and the write should be retried until successful. + +// Writes data to target, the block length depends on the actual writing mode +// 'len' is number of blocks to write. +// 'lba' specifies the next logical block address for writing and is updated +// by this function. +// return: 0: OK +// 1: scsi command failed +int YamahaCDR10x::writeData(TrackData::Mode mode, TrackData::SubChannelMode sm, + long &lba, const char *buf, long len) +{ + assert(blocksPerWrite_ > 0); + int writeLen = 0; + unsigned char cmd[10]; + int retry; + int retval; + long blockLength = blockSize(mode, TrackData::SUBCHAN_NONE); + +#if 0 + long sum, i; + + sum = 0; + + for (i = 0; i < len * blockLength; i++) { + sum += buf[i]; + } + + log_message(0, "W: %ld: %ld, %ld, %ld", lba, blockLength, len, sum); +#endif + + memset(cmd, 0, 10); + cmd[0] = 0x2a; // WRITE1 + + while (len > 0) { + writeLen = (len > blocksPerWrite_ ? blocksPerWrite_ : len); + + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + + cmd[7] = writeLen >> 8; + cmd[8] = writeLen & 0xff; + + do { + retry = 0; + retval = sendCmd(cmd, 10, (unsigned char *)buf, writeLen * blockLength, + NULL, 0, 0); + if(retval == 2) { + const unsigned char *sense; + int senseLen; + + sense = scsiIf_->getSense(senseLen); + + // we spin on the write here, waiting a reasonable time in between + // we should really use READ BLOCK LIMIT (0x05) + if(senseLen && sense[2] == 9 && sense[0xc] == 0xb8) { + mSleep(40); + retry = 1; + } + else { + scsiIf_->printError(); + } + } + } while(retry == 1); + + if(retval) { + log_message(-2, "Write data failed."); + return 1; + } + + buf += writeLen * blockLength; + + lba += writeLen; + len -= writeLen; + } + + return 0; +} + +CdRawToc *YamahaCDR10x::getRawToc(int sessionNr, int *len) +{ + // not supported by drive + return NULL; +} + + +long YamahaCDR10x::readTrackData(TrackData::Mode mode, + TrackData::SubChannelMode, + long lba, long len, + unsigned char *buf) +{ + unsigned char cmd[10]; + long blockLen = 2340; + long i; + TrackData::Mode actMode; + int ok = 0; + int softError; + const unsigned char *sense; + int senseLen; + + if (setBlockSize(blockLen) != 0) + return 0; + + memset(cmd, 0, 10); + + cmd[0] = 0x28; // READ10 + cmd[2] = lba >> 24; + cmd[3] = lba >> 16; + cmd[4] = lba >> 8; + cmd[5] = lba; + + while (len > 0 && !ok) { + cmd[7] = len >> 8; + cmd[8] = len; + + memset(transferBuffer_, 0, len * blockLen); + switch (sendCmd(cmd, 10, NULL, 0, transferBuffer_, len * blockLen, 0)) { + case 0: + ok = 1; + break; + + case 2: + softError = 0; + sense = scsiIf_->getSense(senseLen); + + if (senseLen > 0x0c) { + if ((sense[2] &0x0f) == 5) { + switch (sense[12]) { + case 0x63: // end of user area encountered on this track + case 0x64: // Illegal mode for this track + softError = 1; + break; + } + } + else if ((sense[2] & 0x0f) == 3) { // Medium error + switch (sense[12]) { + case 0x02: // No seek complete, sector not found + case 0x11: // L-EC error + return -2; + break; + } + } + } + + if (!softError) { + scsiIf_->printError(); + return -1; + } + break; + + default: + log_message(-2, "Read error at LBA %ld, len %ld", lba, len); + return -1; + break; + } + + if (!ok) { + len--; + } + } + + unsigned char *sector = transferBuffer_; + for (i = 0; i < len; i++) { + actMode = determineSectorMode(sector); + + if (!(actMode == mode || + (mode == TrackData::MODE2_FORM_MIX && + (actMode == TrackData::MODE2_FORM1 || + actMode == TrackData::MODE2_FORM2)) || + + (mode == TrackData::MODE1_RAW && actMode == TrackData::MODE1) || + + (mode == TrackData::MODE2_RAW && + (actMode == TrackData::MODE2 || + actMode == TrackData::MODE2_FORM1 || + actMode == TrackData::MODE2_FORM2)))) { + return i; + } + + if (buf != NULL) { + switch (mode) { + case TrackData::MODE1: + memcpy(buf, sector + 4, MODE1_BLOCK_LEN); + buf += MODE1_BLOCK_LEN; + break; + case TrackData::MODE2: + case TrackData::MODE2_FORM_MIX: + memcpy(buf, sector + 4, MODE2_BLOCK_LEN); + buf += MODE2_BLOCK_LEN; + break; + case TrackData::MODE2_FORM1: + memcpy(buf, sector + 12, MODE2_FORM1_DATA_LEN); + buf += MODE2_FORM1_DATA_LEN; + break; + case TrackData::MODE2_FORM2: + memcpy(buf, sector + 12, MODE2_FORM2_DATA_LEN); + buf += MODE2_FORM2_DATA_LEN; + break; + case TrackData::MODE1_RAW: + case TrackData::MODE2_RAW: + memcpy(buf, syncPattern, 12); + memcpy(buf + 12, sector, 2340); + buf += AUDIO_BLOCK_LEN; + break; + case TrackData::MODE0: + case TrackData::AUDIO: + log_message(-3, "YamahaCDR10x::readTrackData: Illegal mode."); + return 0; + break; + } + } + + sector += blockLen; + } + + return len; +} + +Toc *YamahaCDR10x::readDiskToc(int session, const char *audioFilename) +{ + Toc *toc = CdrDriver::readDiskToc(session, audioFilename); + + setBlockSize(MODE1_BLOCK_LEN); + + return toc; +} + +Toc *YamahaCDR10x::readDisk(int session, const char *fname) +{ + Toc *toc = CdrDriver::readDisk(session, fname); + + setBlockSize(MODE1_BLOCK_LEN); + + return toc; +} + +int YamahaCDR10x::readAudioRange(ReadDiskInfo *rinfo, int fd, long start, + long end, int startTrack, + int endTrack, TrackInfo *info) +{ + if (!onTheFly_) { + int t; + + log_message(1, "Analyzing..."); + + for (t = startTrack; t <= endTrack; t++) { + long totalProgress; + + totalProgress = t * 1000; + totalProgress /= rinfo->tracks; + sendReadCdProgressMsg(RCD_ANALYZING, rinfo->tracks, t + 1, 0, + totalProgress); + + log_message(1, "Track %d...", t + 1); + info[t].isrcCode[0] = 0; + readIsrc(t + 1, info[t].isrcCode); + if (info[t].isrcCode[0] != 0) + log_message(2, "Found ISRC code."); + + totalProgress = (t + 1) * 1000; + totalProgress /= rinfo->tracks; + sendReadCdProgressMsg(RCD_ANALYZING, rinfo->tracks, t + 1, 1000, + totalProgress); + } + + log_message(1, "Reading..."); + } + + return CdrDriver::readAudioRangeParanoia(rinfo, fd, start, end, startTrack, + endTrack, info); +} diff --git a/dao/YamahaCDR10x.h b/dao/YamahaCDR10x.h new file mode 100644 index 0000000..7160181 --- /dev/null +++ b/dao/YamahaCDR10x.h @@ -0,0 +1,101 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1999 Cameron G. MacKinnon <C_MacKinnon@yahoo.com> + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* Driver for Yamaha CDR10X drives. + * Written by Cameron G. MacKinnon <C_MacKinnon@yahoo.com>. + */ + +#ifndef __YAMAHACDR10X_H__ +#define __YAMAHACDR10X_H__ + +#include "CdrDriver.h" +#include "TrackData.h" + +class Toc; +class Track; + +class YamahaCDR10x : public CdrDriver { +public: + + YamahaCDR10x(ScsiIf *scsiIf, unsigned long options); + ~YamahaCDR10x(); + static CdrDriver *instance(ScsiIf *scsiIf, unsigned long options); + + unsigned long getReadCapabilities(const CdToc *, int) const { return 0; } + + // FIXME: We say we're little endian, incurring work for the host + // The drive has endian flags, but I don't want to experiment + int bigEndianSamples() const { return 0; } + + int multiSession(int); + int speed(int); + int speed(); + + DiskInfo *diskInfo(); + + Toc *readDiskToc(int, const char *audioFilename); + Toc *readDisk(int, const char *audioFilename); + + int loadUnload(int) const; + + int initDao(const Toc *); + int startDao(); + int finishDao(); + void abortDao(); + + int driveInfo(DriveInfo *, bool showErrorMsg); + int writeData(TrackData::Mode, TrackData::SubChannelMode, long &lba, + const char *buf, long len); + +protected: + int scsiTimeout_; + unsigned char audioModePage_[16]; // saved audio mode page + Msf leadInStart_; // start of lead-in + long leadInLen_; // length of lead-in + long leadOutLen_; // length if lead-out + + + CdRawToc *getRawToc(int sessionNr, int *len); + + int readCatalog(Toc *, long startLba, long endLba); + int readIsrc(int, char *); + int readSubChannels(TrackData::SubChannelMode, long lba, long len, + SubChannel ***, Sample *); + + virtual int selectSpeed(); + virtual int setWriteParameters(); + + void cueSheetDataType(TrackData::Mode mode, unsigned char *dataType, + unsigned char *dataForm); + unsigned char *createCueSheet(long *cueSheetLen); + int sendCueSheet(); + + int analyzeTrack(TrackData::Mode, int trackNr, long startLba, long endLba, + Msf *index, int *indexCnt, long *pregap, char *isrcCode, + unsigned char *ctl); + long readTrackData(TrackData::Mode, TrackData::SubChannelMode, + long lba, long len, unsigned char *buf); + + int readAudioRange(ReadDiskInfo *, int fd, long start, long end, + int startTrack, int endTrack, TrackInfo *); + +}; + +#endif diff --git a/dao/cdda_interface.h b/dao/cdda_interface.h new file mode 100644 index 0000000..e00a495 --- /dev/null +++ b/dao/cdda_interface.h @@ -0,0 +1,41 @@ +/****************************************************************** + * CopyPolicy: GNU Public License 2 applies + * Copyright (C) 1998 Monty xiphmont@mit.edu + * and Heiko Eissfeldt heiko@escape.colossus.de + * + * Toplevel interface header; applications include this + * + ******************************************************************/ + +#ifndef _cdda_interface_h_ +#define _cdda_interface_h_ + +#ifndef CD_FRAMESIZE +#define CD_FRAMESIZE 2048 +#endif +#ifndef CD_FRAMESIZE_RAW +#define CD_FRAMESIZE_RAW 2352 +#endif +#define CD_FRAMESAMPLES (CD_FRAMESIZE_RAW / 4) + +#include <sys/types.h> + +typedef struct cdrom_drive{ + long nsectors; /* number of sectors that can be read at once */ + void *cdr; /* pointer to a CdrDriver object */ +} cdrom_drive; + + +#ifdef __cplusplus +extern "C" { +#endif + +extern long cdda_read(cdrom_drive *d, void *buffer, + long beginsector, long sectors); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/dao/cdrdao.drivers b/dao/cdrdao.drivers new file mode 100644 index 0000000..5acd9c1 --- /dev/null +++ b/dao/cdrdao.drivers @@ -0,0 +1,322 @@ +# Driver table for cdrdao-1.1.7 +# Generated Sun Sep 22 18:06:35 2002 by mueller + +# Drivers for read operations +R|ASUS|CD-S340|generic-mmc +R|ASUS|CD-S400|generic-mmc +R|ASUS|CD-S500/A|generic-mmc|OPT_MMC_NO_SUBCHAN +R|ASUS|DVD-ROM E608|generic-mmc +R|E-IDE|CD-950E/TKU|generic-mmc +R|E-IDE|CD-ROM 36X/AKU|generic-mmc +R|E-IDE|CD-ROM 52X/AKH|generic-mmc +R|FUNAI|E295X|generic-mmc +R|Goldstar|CD-RW CED-8042B|generic-mmc +R|HITACHI|CDR-7730|generic-mmc +R|HITACHI|CDR-8435|generic-mmc|OPT_MMC_NO_SUBCHAN +R|LG|CD-ROM CRD-8480C|generic-mmc|OPT_MMC_NO_SUBCHAN +R|LG|CD-ROM CRD-8482B|generic-mmc|OPT_MMC_NO_SUBCHAN +R|LG|CD-ROM CRD-8521B|generic-mmc +R|LG|DVD-ROM DRN8080B|generic-mmc|OPT_DRV_GET_TOC_GENERIC +R|LITE-ON|CD-ROM|generic-mmc|OPT_DRV_GET_TOC_GENERIC +R|LITE-ON|LTD-163|generic-mmc +R|LITEON|DVD-ROM LTD163D|generic-mmc +R|MATSHITA|CD-ROM CR-588|generic-mmc +R|MATSHITA|CD-ROM CR-589|generic-mmc|OPT_MMC_USE_PQ|OPT_MMC_PQ_BCD +R|MATSHITA|DVD-ROM SR-8585|generic-mmc|OPT_MMC_USE_PQ|OPT_MMC_PQ_BCD +R|MEMOREX|CD-233E|generic-mmc +R|MITSUMI|CD-ROM FX4820|generic-mmc|OPT_MMC_NO_SUBCHAN +R|OPTICS_S|8622|generic-mmc +R|PHILIPS|36X/AKU|generic-mmc +R|PHILIPS|CD-ROM PCCD052|generic-mmc +R|PHILIPS|E-IDE CD-ROM 36X|generic-mmc +R|PIONEER|CD-ROM DR-U32|generic-mmc|OPT_DRV_GET_TOC_GENERIC|OPT_MMC_USE_PQ|OPT_MMC_PQ_BCD +R|PIONEER|DVD-103|generic-mmc|OPT_MMC_USE_PQ|OPT_MMC_PQ_BCD +R|PIONEER|DVD-104|generic-mmc|OPT_MMC_USE_PQ|OPT_MMC_PQ_BCD +R|PIONEER|DVD-105|generic-mmc|OPT_MMC_USE_PQ|OPT_MMC_PQ_BCD +R|PIONEER|DVR-106D|generic-mmc|OPT_MMC_USE_PQ|OPT_MMC_PQ_BCD +R|PIONEER|DVR-107D|generic-mmc|OPT_MMC_USE_PQ|OPT_MMC_PQ_BCD +R|SONY|CD-ROM CDU31A-02|generic-mmc +R|SONY|CD-ROM CDU4821|generic-mmc +R|SONY|CDU5211|generic-mmc +R|TEAC|CD-524E|generic-mmc|OPT_DRV_GET_TOC_GENERIC|OPT_MMC_USE_PQ|OPT_MMC_PQ_BCD +R|TEAC|CD-532E|generic-mmc|OPT_MMC_USE_PQ|OPT_MMC_PQ_BCD +R|TEAC|CD-540E|generic-mmc +R|TOSHIBA|CD-ROM XM-3206B|generic-mmc +R|TOSHIBA|CD-ROM XM-6102B|generic-mmc +R|TOSHIBA|CD-ROM XM-6302B|generic-mmc +R|TOSHIBA|CD-ROM XM-6402B|generic-mmc +R|TOSHIBA|DVD-ROM SD-C2202|generic-mmc +R|TOSHIBA|DVD-ROM SD-C2302|generic-mmc +R|TOSHIBA|DVD-ROM SD-C2402|generic-mmc +R|TOSHIBA|DVD-ROM SD-M1102|generic-mmc +R|TOSHIBA|DVD-ROM SD-M1401|generic-mmc +R|TOSHIBA|DVD-ROM SD-M1402|generic-mmc +R|HITACHI|DVD-ROM GD-2500|plextor +R|MATSHITA|CD-ROM CR-506|plextor|OPT_PLEX_DAE_D4_12 +R|MATSHITA|CR-8008|plextor +R|NAKAMICH|MJ-5.16S|plextor +R|PIONEER|CD-ROM DR-U03|plextor|OPT_DRV_GET_TOC_GENERIC +R|PIONEER|CD-ROM DR-U06|plextor|OPT_DRV_GET_TOC_GENERIC +R|PIONEER|CD-ROM DR-U10|plextor|OPT_DRV_GET_TOC_GENERIC +R|PIONEER|CD-ROM DR-U12|plextor|OPT_DRV_GET_TOC_GENERIC +R|PIONEER|CD-ROM DR-U16|plextor|OPT_DRV_GET_TOC_GENERIC +R|PIONEER|DVD-303|plextor +R|PIONEER|DVD-305|plextor +R|SAF|CD-R2006PLUS|plextor +R|SONY|CD-ROM|plextor +R|SONY|CD-ROM CDU-76|plextor +R|TOSHIBA|XM-5401|plextor +R|PLEXTOR|CD-ROM|plextor-scan +R|PLEXTOR|PX-40TS|plextor-scan +R|PLEXTOR|PX-40TW|plextor-scan +R|PLEXTOR|PX-63|plextor-scan +R|TEAC|CD-ROM CD-532S|plextor-scan|OPT_PLEX_USE_PQ|OPT_PLEX_PQ_BCD +R|TEAC|CD-532S|teac-cdr55 +R|TOSHIBA|1504|toshiba +R|TOSHIBA|CD-ROM XM-3601B|toshiba +R|TOSHIBA|CD-ROM XM-5302TA|toshiba +R|TOSHIBA|CD-ROM XM-5701TA|toshiba +R|TOSHIBA|CD-ROM XM-6201TA|toshiba +R|TOSHIBA|CD-ROM XM-6401TA|toshiba +R|TOSHIBA|DVD-ROM SD-2102|toshiba + +# Drivers for write operations +W|CDWRITER|IDE5224|generic-mmc|OPT_MMC_CD_TEXT +W|GRUNDIG|CDR100IPW|cdd2600 +W|HP|CD-Writer 4020|cdd2600 +W|HP|CD-Writer 6020|cdd2600 +W|IMS|522|cdd2600 +W|IMS|CDD2000|cdd2600 +W|KODAK|PCD-225|cdd2600 +W|PHILIPS|CDD2000|cdd2600 +W|PHILIPS|CDD2600|cdd2600 +W|PHILIPS|CDD522|cdd2600 +W|AOPEN|CD-RW CRW1632|generic-mmc +W|AOPEN|CD-RW CRW2040|generic-mmc +W|AOPEN|CD-RW-241040|generic-mmc +W|AOPEN|CRW9624|generic-mmc +W|CD-RW|CDR-2440MB|generic-mmc|OPT_MMC_CD_TEXT +W|CREATIVE|CD-RW RW1210E|generic-mmc +W|CREATIVE|CD-RW RW4424|generic-mmc +W|CREATIVE|CD-RW RW8433E|generic-mmc|OPT_MMC_CD_TEXT +W|CREATIVE|CD5233E|generic-mmc +W|DELTA|OME-W141|generic-mmc +W|GENERIC|CRD-BP1600P|generic-mmc +W|GENERIC|CRD-R800S|generic-mmc +W|GENERIC|CRD-RW2|generic-mmc +W|HL-DT-ST|RW/DVD GCC-4120B|generic-mmc|OPT_MMC_CD_TEXT +W|HP|9510i|generic-mmc|OPT_MMC_CD_TEXT +W|HP|CD-Writer+ 7570|generic-mmc|OPT_MMC_CD_TEXT +W|HP|CD-Writer+ 8100|generic-mmc|OPT_MMC_CD_TEXT +W|HP|CD-Writer+ 8200|generic-mmc|OPT_MMC_CD_TEXT +W|HP|CD-Writer+ 8290|generic-mmc|OPT_MMC_CD_TEXT +W|HP|CD-Writer+ 9100|generic-mmc|OPT_MMC_CD_TEXT +W|HP|CD-Writer+ 9110|generic-mmc|OPT_MMC_CD_TEXT +W|HP|CD-Writer+ 9200|generic-mmc|OPT_MMC_CD_TEXT +W|HP|CD-Writer+ 9300|generic-mmc|OPT_MMC_CD_TEXT +W|HP|CD-Writer+ 9600|generic-mmc|OPT_MMC_CD_TEXT +W|HP|CD-Writer+ 9700|generic-mmc|OPT_MMC_CD_TEXT +W|HP|DVD Writer 100j|generic-mmc +W|IDE-CD|R/RW 16x10A|generic-mmc +W|IMATION|IMW121032IAB|generic-mmc +W|LG|8088B|generic-mmc +W|LG|8120B|generic-mmc|OPT_MMC_CD_TEXT +W|LG|CD-ROM CDR-8428B|generic-mmc +W|LG|CD-RW CED-8080B|generic-mmc|OPT_MMC_CD_TEXT +W|LG|CD-RW CED-8081B|generic-mmc|OPT_MMC_CD_TEXT +W|LG|CD-RW CED-8083B|generic-mmc|OPT_MMC_CD_TEXT +W|LG|CD-RW GCE-8240B|generic-mmc|OPT_MMC_CD_TEXT +W|LG|COMBO|generic-mmc +W|LG|HL-DT-ST RW/DVD GCC-4080N|generic-mmc|OPT_MMC_CD_TEXT +W|LITE-ON|LTR-0841|generic-mmc|OPT_MMC_CD_TEXT|OPT_MMC_NO_SUBCHAN +W|LITE-ON|LTR-24102B|generic-mmc +W|LITE-ON|LTR-32125W|generic-mmc|OPT_MMC_CD_TEXT +W|MATSHITA|CD-R CW-7502|generic-mmc +W|MATSHITA|CD-R CW-7503|generic-mmc +W|MATSHITA|CD-R CW-7582|generic-mmc +W|MATSHITA|CD-R CW-7585|generic-mmc +W|MATSHITA|CD-R CW-7586|generic-mmc +W|MATSHITA|CDRRW01|generic-mmc +W|MATSHITA|UJDA360|generic-mmc +W|MATSHITA|UJDA710|generic-mmc|OPT_MMC_CD_TEXT +W|MATSHITA|UJDA720|generic-mmc|OPT_MMC_CD_TEXT +W|MEMOREX|24MAX 1040|generic-mmc +W|MEMOREX|40MAXX 1248AJ|generic-mmc +W|MEMOREX|CD-RW4224|generic-mmc +W|MICROSOLUTIONS|BACKPACK CD REWRITER|generic-mmc +W|MITSUMI|CR-4801|generic-mmc +W|MITSUMI|CR-48X5|generic-mmc +W|MITSUMI|CR-48X5TE|generic-mmc|OPT_MMC_CD_TEXT +W|MITSUMI|CR-48X8TE|generic-mmc +W|MITSUMI|CR-48XATE|generic-mmc +W|OLYMPIC|RWD RW4224|generic-mmc|OPT_DRV_GET_TOC_GENERIC|OPT_MMC_USE_PQ +W|PANASONIC|CD-R CW-7582|generic-mmc +W|PHILIPS|CDRW1610A|generic-mmc|OPT_MMC_CD_TEXT +W|PHILIPS|CDRW2412A|generic-mmc +W|PHILIPS|PCA460RW|generic-mmc +W|PIONEER|DVD-ROM DVD-114|generic-mmc|OPT_MMC_CD_TEXT +W|PLEXTOR|CD-R PX-R412|generic-mmc|OPT_MMC_USE_PQ|OPT_MMC_READ_ISRC +W|PLEXTOR|CD-R PX-R820|generic-mmc +W|PLEXTOR|CD-R PX-W1210|generic-mmc|OPT_MMC_CD_TEXT +W|PLEXTOR|CD-R PX-W124|generic-mmc|OPT_MMC_CD_TEXT +W|PLEXTOR|CD-R PX-W1610|generic-mmc|OPT_MMC_CD_TEXT +W|PLEXTOR|CD-R PX-W2410|generic-mmc|OPT_MMC_CD_TEXT +W|PLEXTOR|CD-R PX-W4220|generic-mmc|OPT_MMC_CD_TEXT +W|PLEXTOR|CD-R PX-W8220|generic-mmc|OPT_MMC_CD_TEXT +W|PLEXTOR|CD-R PX-W8432|generic-mmc|OPT_MMC_CD_TEXT +W|PLEXTOR|CD-R PX-W241040|generic-mmc|OPT_MMC_CD_TEXT +W|PLEXTOR|CD-R PX-W2410a|generic-mmc|OPT_MMC_CD_TEXT +W|PLEXTOR|CD-R PX-W4012A|generic-mmc|OPT_MMC_CD_TEXT +W|RICOH|CD-R/RW MP7040|generic-mmc|OPT_MMC_CD_TEXT +W|RICOH|CD-R/RW MP7060|generic-mmc|OPT_MMC_CD_TEXT +W|RICOH|CD-R/RW MP7063A|generic-mmc|OPT_MMC_CD_TEXT +W|RICOH|CD-R/RW MP7080|generic-mmc|OPT_MMC_CD_TEXT +W|RICOH|CD-R/RW MP7083A|generic-mmc|OPT_MMC_CD_TEXT +W|RICOH|DVD/CDRW MP9060|generic-mmc|OPT_MMC_CD_TEXT +W|SAF|CD-R8020|generic-mmc +W|SAF|CD-RW4224A|generic-mmc +W|SAF|CD-RW6424|generic-mmc +W|SAMSUNG|CD-R/RW SW-206|generic-mmc +W|SAMSUNG|CD-R/RW SW-408B|generic-mmc|OPT_MMC_CD_TEXT +W|SAMSUNG|CDRW/DVD SM-308B|generic-mmc|OPT_MMC_CD_TEXT +W|SANYO|CRD-BP3|generic-mmc +W|SONY|CD-RW CRX700E|generic-mmc +W|SONY|CRX-815|generic-mmc|OPT_MMC_CD_TEXT +W|SONY|CRX100|generic-mmc|OPT_MMC_CD_TEXT +W|SONY|CRX120|generic-mmc|OPT_MMC_CD_TEXT +W|SONY|CRX140|generic-mmc|OPT_MMC_CD_TEXT +W|SONY|CRX145|generic-mmc|OPT_MMC_CD_TEXT +W|SONY|CRX160E|generic-mmc|OPT_MMC_CD_TEXT +W|SONY|CRX175A1|generic-mmc +W|SONY|CRX175E|generic-mmc|OPT_MMC_CD_TEXT +W|SONY|CRX185E1|generic-mmc|OPT_MMC_CD_TEXT +W|TDK|4800|generic-mmc|OPT_MMC_CD_TEXT +W|TDK|CDRW121032|generic-mmc|OPT_MMC_CD_TEXT +W|TDK|CDRW321040B|generic-mmc +W|TDK|CDRW8432|generic-mmc|OPT_MMC_CD_TEXT +W|TEAC|CD-R56|generic-mmc|OPT_MMC_USE_PQ|OPT_MMC_CD_TEXT +W|TEAC|CD-R58|generic-mmc|OPT_MMC_USE_PQ|OPT_MMC_CD_TEXT +W|TEAC|CD-W216E|generic-mmc|OPT_MMC_CD_TEXT +W|TEAC|CD-W512EB|generic-mmc|OPT_MMC_CD_TEXT +W|TEAC|CD-W512SB|generic-mmc|OPT_MMC_CD_TEXT +W|TEAC|CD-W516EB|generic-mmc|OPT_MMC_CD_TEXT +W|TEAC|CD-W516EC|generic-mmc|OPT_MMC_CD_TEXT +W|TEAC|CD-W524E|generic-mmc|OPT_MMC_CD_TEXT +W|TEAC|CD-W54E|generic-mmc +W|TORiSAN|CDW-U4424|generic-mmc +W|TOSHIBA|DVD-ROM SD-M1612|generic-mmc +W|TOSHIBA|DVD-ROM SD-R1002|generic-mmc +W|TOSHIBA|DVD-ROM SD-R1202|generic-mmc +W|TRAXDATA|241040|generic-mmc +W|TRAXDATA|CDRW4260|generic-mmc +W|WAITEC|WT624|generic-mmc|OPT_MMC_NO_SUBCHAN +W|YAMAHA|CDR200|generic-mmc +W|YAMAHA|CDR400|generic-mmc +W|YAMAHA|CRW2100|generic-mmc|OPT_MMC_CD_TEXT +W|YAMAHA|CRW2200|generic-mmc|OPT_MMC_CD_TEXT +W|YAMAHA|CRW2260|generic-mmc +W|YAMAHA|CRW3200|generic-mmc|OPT_MMC_CD_TEXT +W|YAMAHA|CRW4001|generic-mmc +W|YAMAHA|CRW4260|generic-mmc +W|YAMAHA|CRW4416|generic-mmc +W|YAMAHA|CRW6416|generic-mmc +W|YAMAHA|CRW8424|generic-mmc +W|YAMAHA|CRW8824|generic-mmc +W|_NEC|NR-7700A|generic-mmc +W|ACER|10x8x32|generic-mmc-raw +W|ACER|2010A|generic-mmc-raw +W|ACER|20x10x40|generic-mmc-raw +W|ACER|4406EU|generic-mmc-raw +W|ACER|4x4x6|generic-mmc-raw +W|ACER|8X4X32|generic-mmc-raw +W|ACER|CD-R/RW 4X4X32|generic-mmc-raw|OPT_MMC_NO_SUBCHAN +W|AOPEN|CD-RW CRW3248|generic-mmc-raw +W|AOPEN|CRW1232|generic-mmc-raw +W|ARTEC|RW241040|generic-mmc-raw +W|ARTEC|WRA-WA48|generic-mmc-raw +W|ARTEC|WRR-4048|generic-mmc-raw +W|ASUS|CRW-1610A|generic-mmc-raw +W|ASUS|CRW-3212A|generic-mmc-raw +W|ATAPI|CD-R/RW 12X8X32|generic-mmc-raw +W|ATAPI|CD-R/RW 4X4X32|generic-mmc-raw +W|ATAPI|CD-R/RW CRW6206A|generic-mmc-raw +W|BENQ|CRW2410A|generic-mmc-raw +W|BTC|BCE1610IM|generic-mmc-raw +W|BTC|BCE2410IM|generic-mmc-raw +W|BTC|BCE621E|generic-mmc-raw +W|CyberDrv|CW018D|generic-mmc-raw +W|CyberDrv|CW038D|generic-mmc-raw +W|CyberDrv|CW058D|generic-mmc-raw +W|Goldstar|8120B|generic-mmc-raw +W|HL-DT-ST|CD-RW GCE-8160B|generic-mmc-raw +W|HL-DT-ST|CD-RW GCE-8320B|generic-mmc-raw +W|HP|CD-Writer+ 7100|generic-mmc-raw +W|HP|CD-Writer+ 7200|generic-mmc-raw +W|HP|DVD Writer 200j|generic-mmc-raw +W|IDE-CD|R/RW 2x2x24|generic-mmc-raw +W|IDE-CD|R/RW 4x4x24|generic-mmc-raw +W|IDE-CD|R/RW 4x4x32|generic-mmc-raw +W|IDE-CD|R/RW 8x4x32|generic-mmc-raw +W|IDE-CD|ReWritable-2x2x6|generic-mmc-raw +W|IOMEGA|ZIPCD 4x650|generic-mmc-raw +W|LITE-ON|LTR-12101B|generic-mmc-raw +W|LITE-ON|LTR-16101B|generic-mmc-raw +W|LITE-ON|LTR-16102C|generic-mmc-raw +W|LITE-ON|LTR-32123S|generic-mmc-raw +W|LITE-ON|LTR-40125S|generic-mmc-raw +W|LITE-ON|LTR-48125W|generic-mmc-raw +W|MEMOREX|CDRW-2216|generic-mmc-raw +W|MEMOREX|CR-622|generic-mmc-raw +W|MEMOREX|CRW-1662|generic-mmc-raw +W|MITSUMI|2801|generic-mmc-raw +W|MITSUMI|CR-4802|generic-mmc-raw +W|MITSUMI|CR-4804|generic-mmc-raw +W|OTI|-975 SOCRATES|generic-mmc-raw +W|PHILIPS|CDD 3801/31|generic-mmc-raw +W|PHILIPS|CDD3600|generic-mmc-raw +W|PHILIPS|CDD3610|generic-mmc-raw +W|PHILIPS|CDD4201|generic-mmc-raw|OPT_MMC_NO_SUBCHAN +W|PHILIPS|CDD4801|generic-mmc-raw +W|PHILIPS|CDRW400|generic-mmc-raw +W|PHILIPS|PCRW1208|generic-mmc-raw +W|PHILIPS|PCRW120899|generic-mmc-raw +W|PHILIPS|PCRW404|generic-mmc-raw +W|PHILIPS|PCRW804|generic-mmc-raw +W|QPS|CRD-BP 1500P|generic-mmc-raw +W|SAMSUNG|CD-R/RW SW-204B|generic-mmc-raw +W|SAMSUNG|CD-R/RW SW-208|generic-mmc-raw +W|SAMSUNG|CD-R/RW SW-212B|generic-mmc-raw +W|SAMSUNG|CD-R/RW SW-224|generic-mmc-raw +W|SAMSUNG|SW-232|generic-mmc-raw +W|SONY|CRX195E1|generic-mmc-raw +W|TEAC|CD-W512E|generic-mmc|OPT_MMC_CD_TEXT +W|TEAC|CD-W58E|generic-mmc-raw|OPT_MMC_USE_PQ|OPT_MMC_PQ_BCD +W|TOSHIBA|R/RW 4x4x24|generic-mmc-raw +W|TRAXDATA|2832|generic-mmc-raw +W|TRAXDATA|CDRW2260+|generic-mmc-raw +W|TRAXDATA|CRW2260 PRO|generic-mmc-raw +W|WAITEC|WT2444EI|generic-mmc-raw +W|WAITEC|WT4424|generic-mmc-raw +W|_NEC|7900|generic-mmc-raw +W|_NEC|NR-7800A|generic-mmc-raw +W|AOPEN|CRW620|ricoh-mp6200 +W|MEMOREX|CRW620|ricoh-mp6200 +W|PHILIPS|OMNIWRITER26|ricoh-mp6200 +W|RICOH|MP6200|ricoh-mp6200 +W|RICOH|MP6201|ricoh-mp6200 +W|SONY|CD-R CDU920|sony-cdu920 +W|SONY|CD-R CDU924|sony-cdu920 +W|SONY|CD-R CDU948|sony-cdu948 +W|T.YUDEN|CD-WO EW-50|taiyo-yuden +W|JVC|R2626|teac-cdr55 +W|JVC|XR-W2010|teac-cdr55 +W|SAF|CD-R2006PLUS|teac-cdr55 +W|SAF|CD-R4012|teac-cdr55 +W|SAF|CD-RW 226|teac-cdr55 +W|TEAC|CD-R50|teac-cdr55 +W|TEAC|CD-R55|teac-cdr55 +W|TRAXDATA|CDR4120|teac-cdr55 +W|TOSHIBA|DVD-ROM SD-R2002|toshiba +W|TOSHIBA|DVD-ROM SD-R2102|toshiba +W|YAMAHA|CDR100|yamaha-cdr10x +W|YAMAHA|CDR102|yamaha-cdr10x diff --git a/dao/cdrdao.man b/dao/cdrdao.man new file mode 100644 index 0000000..2435d75 --- /dev/null +++ b/dao/cdrdao.man @@ -0,0 +1,874 @@ +.TH CDRDAO 1 "Jan 18, 2006" +.SH NAME +cdrdao \- reads and writes CDs in disc-at-once mode +.SH SYNOPSIS +.B cdrdao +.RB { show-toc|read-toc|read-cd|read-cddb|show-data|read-test|disk-info|msinfo|unlock|simulate|write|copy|blank } +.RB [ --device +.IR device ] +.RB [ --source-device +.IR device ] +.RB [ --driver +.IR driver-id ] +.RB [ --source-driver +.IR driver-id ] +.RB [ --simulate ] +.RB [ --speed +.IR writing-speed ] +.RB [ --blank-mode +.IR mode] +.RB [ --datafile +.IR file ] +.RB [ --read-raw ] +.RB [ --read-subchan +.RB [ --no-mode2-mixed ] +.IR mode ] +.RB [ --tao-source ] +.RB [ --tao-source-adjust +.IR link-blocks ] +.RB [ --fast-toc ] +.RB [ --buffers +.IR buffer-count ] +.RB [ --multi ] +.RB [ --overburn ] +.RB [ --eject ] +.RB [ --swap ] +.RB [ --session ] +.RB [ --force ] +.RB [ --reload ] +.RB [ --keepimage ] +.RB [ --on-the-fly ] +.RB [ --paranoia-mode +.IR mode ] +.RB [ --with-cddb ] +.RB [ --cddb-servers +.IR server-list ] +.RB [ --cddb-timeout +.IR timeout ] +.RB [ --cddb-directory +.IR directory ] +.RB [ --tmpdir +.IR directory ] +.RB [ --keep ] +.RB [ --save ] +.RB [ -n ] +.RB [ -v +.IR verbose-level ] +.RI toc-file +.SH DESCRIPTION +.I cdrdao +creates audio and data CD-Rs in disk-at-once (DAO) mode driven by a description +file called +.I toc-file. +In DAO mode it is possible to create non standard track pre-gaps that +have other lengths than 2 seconds and contain nonzero audio +data. This is for example useful to divide live recordings into +tracks where 2 second gaps would be kind of irritating. + +Instead of a +.I toc-file +a cue file (used by a famous DOS/Windows mastering tool) may be used. See +the CUE FILES section for more details. + +.SH COMMANDS +.TP +The first argument must be one of the following commands: +.TP +.BI show-toc +Print out a summary about what will be written to the CD-R. +.TP +.BI read-toc +Analyze each track of the inserted CD and create a +.I toc-file +that can be used to make a more or less exact copy of the CD. +This command does not read out the audio or data tracks, +use +.BI read-cd +for this purpose. + +You can specify a filename for the data file via the +.BI \--datafile +option. +.TP +.BI read-cd +Copies all tracks of the inserted CD to an image file and creates a corresponding +.I toc-file. +The name of the image file defaults to "data.bin" if no +.BI --datafile +option is given. +.TP +.BI read-cddb +Tries to retrieve title and artist data from a CDDB server for the CD +represented by the given toc-file. The retrieved data is added as CD-TEXT +data for language 0 to the toc-file. Existing CD-TEXT data for language 0 will +be overwritten. +.TP +.BI show-data +Print out all samples that would be written to the CD-R. Each line +contains the sample number (starting at 0) and the decimal sample +value for the left and right channel. Useful to check if the byte +order of audio files is correct. +.TP +.BI read-test +Check if all data can be read from the audio files that are defined in +the +.I toc-file. +This will also check the communication with the slave process that is +responsible for writing the audio data to the CD-recorder. Mainly used +for testing. +.TP +.BI disk-info +Shows information about the inserted CD-R. If the CD-R has an open session +it will also print the start of the last and current session which is +used by mkisofs to create an image for a second or higher session. +.TP +.BI msinfo +Shows information required for creating multi session disks with +mkisofs. The output is meant for processing by scripts. +.TP +.BI unlock +Tries to unlock the recorder device after a failed write or simulation +run. If you cannot eject the CD after a cdrdao run try this command. +.TP +.BI blank +Blanks a CD-RW. The CD-RW is minimally blanked by default. Use option +.BI --blank-mode +to select another blanking mode. +Sometimes the blanking speed must be manually reduced for a successful +blanking operation. Use option +.BI --speed +to select another blanking speed. +.TP +.BI simulate +Like +.BI write +but laser stays cold. It is a shortcut for +.BI "write --simulate." +.TP +.BI write +Write the CD-R according to the specifications in the +.I toc-file. +.TP +.BI copy +Performs all steps to copy a CD. The device containing the source CD must +be specified with option +.BI --source-device +and the recorder device with option +.BI --device. +If only a single device is available the option +.BI --source-device +must be omitted and cdrdao will prompt to insert the CD-R after an image +of the source CD was created. + +The image file with name "cddata<pid>.bin" will be created in the current +working directory if no +.BI --datafile +option is given. The created image will be removed after it has been +written. + +If option +.BI --on-the-fly +is given no image file is created and the data will be directly piped from +the reading device to the CD recorder. + + +.SH OPTIONS +.TP +.BI \--device " [prot:]bus,id,lun" +Sets the SCSI address of the CD-recorder in form of a bus/id/lun +triple, e.g. '0,2,0' for the logical unit 0 of SCSI device with ID 2 +on bus 0. ATAPI devices can be specified by using the prefix 'ATAPI:', +e.g. 'ATAPI:0,0,0'. On some systems a device node may be specified +directly, e.g. '/dev/sg0' on Linux systems. Linux 2.6 users may also +try the newer ATAPI interface with the 'ATA:' prefix. +.TP +.BI \--source-device " [prot:]bus,id,lun" +Like above but used for the +.BI copy +command to specify the source device. +.TP +.BI \--driver " driver-id:option-flags" +Force usage of specified driver instead of the automatically +determined driver. Available driver IDs: +.br +cdd2600, plextor, plextor-scan, generic-mmc, generic-mmc-raw, +ricoh-mp6200, yamaha-cdr10x, teac-cdr55, sony-cdu920, sony-cdu948, +taiyo-yuden, toshiba. +.br +Specifying an illegal driver ID will give a list of available drivers. +Option flags may be used to modify the behavior of some drivers. See +.BI README +for details. +.TP +.BI \--source-driver " driver-id:option-flags" +Like above but used for the device specified with option +.BI --source-device. +.TP +.BI \--speed " value" +Set the writing speed to +.I value. +Default is the highest possible speed. +.TP +.BI \--blank-mode " mode" +Sets the blanking mode. Available modes are +.BI full +and +.BI minimal. +Please consider that the data of minimally blanked disks may be easily +recovered. Use the +.BI full +blanking mode for completely erasing all data. The default blanking mode +is +.BI minimal. +.TP +.BI \--datafile " file" +Used for +.BI "read-toc, read-cd" +and +.BI copy. +Set the default data file placed in the toc-file by +.BI read-toc. +Use "-" to indicate STDIN. +For commands +.BI read-cd +and +.BI copy +it specifies the name of the created image file. +.TP +.BI \--read-raw +Only used for commands +.BI read-cd +and +.BI read-toc. +All data sectors will be written as 2352 byte blocks including the sector +header and L-EC data to the image file. The track mode will be set to +MODE1_RAW or MODE2_RAW in the created +.I toc-file. +.TP +.BI \--read-subchan " mode" +Used by commands +.BI read-cd, +.BI read-toc +and +.BI copy. +Specifies the type of sub-channel data that is extracted from the source CD +and written to the track image or copied to the destination CD. +Mode may be +.BI rw +for reading packed R-W sub-channel data (de-interleaved and error +corrected) +and +.BI rw_raw +for reading raw R-W sub-channel data (not de-interleaved, not error +corrected, L-EC data included in the track image). +If this option is not specified no sub-channel data will be extracted. +.TP +.BI \--no-mode2-mixed +Only used for commands +.BI read-cd +and +.BI read-toc. +If we have MODE2_FORM1 or MODE2_FORM2, don't extract it as MODE2_FORM_MIX. +.I toc-file. +.TP +.BI \--tao-source +This option indicates to the commands +.I read-toc +and +.I read-cd +that the source CD was written in TAO mode. It will be assumed that the +pre-gap length between all tracks (except between two audio tracks) is +the standard 150 blocks plus the number of link blocks (usually 2). The +number of link blocks can be controlled with option +.I --tao-source-adjust. + +Use this option only if +.I read-toc +or +.I read-cd +give error messages in the transition areas between two tracks. If you use +this option with pressed CDs or CDs written in DAO mode you will get wrong +results. +.TP +.BI \--tao-source-adjust " link-blocks" +Specifies the number of link blocks for tracks written in TAO mode. This +option has only an effect if option +.I --tao-source +is given. +.TP +.BI \--fast-toc +Only used for command +.BI read-toc. +This option suppresses the pre-gap length and index mark extraction +which +speeds up the read-toc process. Standard 2 second pre-gaps (but no +silence!) will be placed into the toc-file. The resulting CD will +sound like the source CD. Only the CD player's display will behave +slightly different in the transition area between two tracks. + +This option might help, too, if read-toc fails with your drive otherwise. + +.TP +.BI \--buffers " buffer-count" +Specifies the number of buffers that are allocated to avoid buffer under runs. +The minimal buffer count is fixed to 10, default is 32 except +on FreeBSD systems, on which default is 20. +Each buffer holds 1 second of audio data so that dividing +.I buffer-count +by the writing speed gives the maximum time for which reading of audio data +may be stalled. +.TP +.BI \--multi +If this option is given the session will not be closed after the audio data +is successfully written. It is possible to append another session on such +disks, e.g. to create a CD-EXTRA. +.TP +.BI \--overburn +By default cdrdao will not allow to write more data on a medium than +specified by the current medium. This option allows to ignore this condition. +.TP +.BI \--eject +Eject the CD-R after writing or write simulation. +.TP +.BI \--swap +Swap the byte order of all samples that are send to the CD-recorder. +.TP +.BI \--session " session-nr" +Used for +.BI read-toc +and +.BI read-cd +to specify the session which should be processed on multi session CDs. +.TP +.BI \--reload +Indicates that the tray may be opened before writing without prompting +the user to reset the disk status after a simulation run. +.TP +.BI \--force +Forces the execution of an operation that otherwise would not be +performed. +.TP +.BI \--paranoia-mode " mode" +Sets the correction mode for digital audio extraction. 0: No checking, +data is copied directly from the drive. 1: Perform overlapped reading +to avoid jitter. 2: Like 1 but with additional checks of the read +audio data. 3: Like 2 but with additional scratch detection and +repair. + +The extraction speed reduces from 0 to 3. + +Default is the full paranoia mode (3). +.TP +.BI \--keepimage +If a CD is copied with command +.I copy +this option will cause that the created image is not removed after the +copy process has finished. +.TP +.BI \--on-the-fly +Perform CD copy on the fly without creating an image file. +.TP +.BI \--with-cddb +Enables the automatic fetching of CDDB data for use as CD-TEXT data for +commands +.I copy, +.I read-toc +and +.I read-cd. +.TP +.BI \--cddb-servers " server-list" +Sets space or ',' separated list of CDDB servers used for command +.I read-cddb +or for commands where the +.I --with-cddb +option is active. +A server entry may have the following forms: +.IP <server> +Connect to <server>, default cddbp port (888), use cddbp protocol. +.IP <server>:<port> +Connect to <server>, port <port>, use cddbp protocol. +.IP <server>:<cgi-bin-path> +Connect to <server>, default http port (80), use http protocol, +url: <cgi-bin-path>. +.IP <server>:<port>:<cgi-bin-path> +Connect to <server>, port <port>, use http protocol, url: <cgi-bin-path>. +.IP <server>:<port>:<cgi-bin-path>:<proxy-server> +Connect to <proxy-server>, default http port (80), use http protocol, +url: http://<server>:<port>/<cgi-bin-path>. +.IP <server>:<port>:<cgi-bin-path>:<proxy-server>:<proxy-port> +Connect to <proxy-server>, port <proxy-port>, use http protocol, +url: http://<server>:<port>/<cgi-bin-path>. + +The <cgi-bin-path> is usually "/~cddb/cddb.cgi". + +All servers of the server list will be tried in the given order until a +successful connection can be established. For http proxy servers +the first successful connected http proxy server will be used independent of +the ability to connect to the target http server. + +Example: freedb.freedb.org:/~cddb/cddb.cgi +.TP +.BI \--cddb-timeout " timeout" +Sets the timeout in seconds used for connections to CDDB servers. +.TP +.BI \--cddb-directory " directory" +Specifies the local CDDB database directory where fetched CDDB records will +be stored. If this option is not given a fetched CDDB record will not be stored +locally. +.TP +.BI \--tmpdir " directory" +Specifies the directory in which to store temporary data files created from decoding MP3 and Ogg Vorbis files. By default, "/tmp" is used. +.TP +.BI \--keep +Upon exit from cdrdao, do not delete temporary WAV files created from MP3 and Ogg Vorbis files. +.TP +.BI \--save +Saves some of the current options to the settings file +"$HOME/.cdrdao" and exit. See section \'SETTINGS\' for more details. +.TP +.BI \-n +Suppresses the 10 second pause before writing or simulating. +.TP +.BI \-v " verbose-level +Sets verbose level. Levels > 2 are debug levels which produce a lot of +output. + +.SH "TOC FILES" +The +.I toc-file +describes what data is written to the CD-R and allows control +over track/index positions, pre-gaps and sub-channel information. It +is a simple text file, use your favorite text editor to create it. + +A +.I toc-file +contains an optional header and a sequence of track +specifications. Comments starting with '//' reaching until end of line can be +placed anywhere. + +.SS Header +.IP CATALOG\ "ddddddddddddd" +Specifies the optional catalog number of the CD. The string must +contain exactly 13 digits. +.LP +The following flags specify the type of session that will be created. It +is used to create the correct CD-TOC format and to check the consistency of +the track modes for the desired session type. If multiple flags are given +the last one will take effect. +.IP CD_DA +The disc contains only audio tracks. +.IP CD_ROM +The disc contains just mode 1 tracks or mode 1 and audio tracks (mixed +mode CD). +.IP CD_ROM_XA +The disc contains mode 2 form 1 or mode 2 form 2 tracks. Audio tracks +are allowed, too. This type must be used if multi session disks are +created (option --multi). +.IP CD_TEXT\ {\ ...\ } +Defines global CD-TEXT data like the album title and the used languages. +See the CD-TEXT section below for the syntax of the CD-TEXT block contents. +.SS Track\ Specification +.IP TRACK\ <track-mode>\ [<sub-channel-mode>] +Starts a new track, the track number is incremented by 1. The length +of a track must be at least 4 seconds. The block length of the input +data depends on the <track-mode>: AUDIO: 2352 bytes (588 samples), +MODE1: 2048 bytes, MODE1_RAW: 2352 bytes, MODE2: 2336 bytes, +MODE2_FORM1: 2048 bytes, MODE2_FORM2: 2324 bytes, MODE2_FORM_MIX: 2336 bytes +including the sub-header, MODE2_RAW: 2352 bytes. +The <sub-channel-mode> is optional. If given it specifies the type of +sub-channel data for each sector. RW: packed R-W sub-channel data (96 +bytes, L-EC data will be generated if required), RW_RAW: raw R-W +sub-channel data (interleaved and L-EC data already calculated, 96 +bytes). The block length is increased by the sub-channel data length +if a <sub-channel-mode> is specified. +If the input data length is not a multiple of the block length it +will be padded with zeros. +.LP +The following flags may follow the track start statement. They are +used to set sub-channel information for the current track. Each flag +is optional. If not given the following defaults are used: copy not +permitted, no pre emphasis, two channel audio, no ISRC code. +.IP "[ NO ] COPY" +Sets or clears the copy permitted flag. +.IP "[ NO ] PRE_EMPHASIS" +Sets or clears the pre emphasis flag (only for audio tracks). +.IP TWO_CHANNEL_AUDIO +Indicates that track contains two channel audio data (only for audio tracks). +.IP FOUR_CHANNEL_AUDIO +Indicates that track contains four channel audio data (only for audio tracks). +.IP ISRC\ "CCOOOYYSSSSS" +Sets ISRC code of track (only for audio tracks). +.br +C: country code (upper case letters or digits) +.br +O: owner code (upper case letters or digits) +.br +Y: year (digits) +.br +S: serial number (digits) +.LP +An optional CD-TEXT block that defines the CD-TEXT data for this track +may follow. See the CD-TEXT section below for the syntax of the CD-TEXT +block contents. +.IP "CD_TEXT { ... }" +.LP +At least one of the following statements must appear to specify the +data for the current track. Lengths and start positions may be +expressed in samples (1/44100 seconds) for audio tracks or in bytes +for data tracks. It is also possible to give the length in blocks +with the MSF format 'MM:SS:FF' specifying minutes, seconds and frames +(0 <= 'FF' < 75) . A frame equals one block. + +If more than one statement is used the track will be composed by +concatenating the data in the specified order. +.IP "SILENCE <length>" +Adds zero audio data of specified length to the current audio track. +Useful to create silent pre-gaps. +.IP "ZERO <length>" +Adds zero data to data tracks. Must be used to +define pre- or post-gaps between tracks of different mode. +.IP [\ FILE\ |\ AUDIOFILE\ ]\ "<filename>"\ <start>\ [\ <length>\ ] +Adds the audio data of specified file to the current audio track. It +is possible to select a portion of an audio file with <start> and +<length> which allows non destructive cutting. The first sample of an +audio file is addressed with <start> = 0. If <length> is omitted or +set to 0 all audio data from <start> until the end of file is used. + +Audio files may have raw or WAVE format with 16 bits per sample, 44.1 +kHz sampling rate, stereo. Raw files must have the layout 'MSBLeft +LSBLeft MSBRight LSBRight ...' (big endian byte order). WAVE files are +expected to have little endian byte order. The option --swap reverses +the expected byte order for all raw and WAVE files. Only filenames +with a ".wav" ending are treated as WAVE files, all other names are +assumed to be raw audio files. Use tools like sox(1) to convert other +file formats to supported formats. + +Specifying a "-" as filename causes data to be read from STDIN. Currently +only raw files are supported from STDIN. + +If you are unsure about the byte order of your audio files try the +command 'show-data'. If the byte order is correct you will see a +sequence of increasing or decreasing numbers for both +channels. Otherwise numbers are jumping between very high and low +values - high volume static. +.IP DATAFILE\ "<filename>"\ [\ <length>\ ] +Adds data from given file to the current data track. If <length> is omitted +the actual file length will be used. +.IP FIFO\ "<fifo\ path>"\ <length> +Adds data from specified FIFO path to the current audio or data track. +<length> must specify the amount of data that will be read from the +FIFO. The value is always in terms of bytes (scalar value) or in terms +of the block length (MSF value). +.IP "START [ MM:SS:FF ]" +Defines the length of the pre-gap (position where index switches from +0 to 1). If the MSF value is omitted the current track length is +used. If the current track length is not a multiple of the block +length the pre-gap length will be rounded up to next block boundary. + +If no START statement is given the track will not have a pre-gap. +.IP "PREGAP MM:SS:FF" +This is an alternate way to specify a pre-gap with zero audio data. It +may appear before the first SILENCE, ZERO or FILE statement. Either PREGAP +or START can be used within a track specification. It is equivalent to +the sequence +.br + SILENCE MM:SS:FF +.br + START +.br +for audio tracks or +.br + ZERO MM:SS:FF +.br + START +.br +for data tracks. +.LP +Nothing prevents mixing 'DATAFILE'/'ZERO' and 'AUDIOFILE'/'SILENCE' +statements within the same track. The results, however, are undefined. + + +The end of a track specification may contain zero or more index +increment statements: +.IP "INDEX MM:SS:FF" +Increments the index number at given position within the track. The +first statement will increment from 1 to 2. The position is relative +to the real track start, not counting an existing pre-gap. + +.SS CD-TEXT Blocks +A CD-TEXT block may be placed in the global section to define data valid for +the whole CD and in each track specification of a +.I toc-file. +The global section must define a language map that is used to map a +.I language-number +to country codes. Up to 8 different languages can be defined: +.IP "LANGUAGE_MAP { 0 : c1 1 : c2 ... 7 : c7 }" +The country code may be an integer value in the range 0..255 or one of the +following countries (the corresponding integer value is placed in braces +behind the token): EN(9, English) +.br +It is just necessary to define a mapping for the used languages. +.LP +If no mapping exists for a +.I language-number +the data for this language will be ignored. + +For each language a language block must exist that defines the actual data +for a certain language. +.IP "LANGUAGE language-number { cd-text-item cd-text-data cd-text-item cd-text-data ... }" +Defines the CD-TEXT items for given +.I language-number +which must be defined in the language map. +.LP + +The +.I cd-text-data +may be either a string enclosed by " or binary data like +.nf +.in +.5i +{ 0, 10, 255, ... } +.in -.5i +.fi +where each integer number must be in the range 0..255. +.br +The +.I cd-text-item +may be one of the following: +.IP TITLE +String data: Title of CD or track. +.IP PERFORMER +String data. +.IP SONGWRITER +String data. +.IP COMPOSER +String data. +.IP ARRANGER +String data. +.IP MESSAGE +String data. Message to the user. +.IP DISC_ID +String data: Should only appear in the global CD-TEXT block. The format is +usually: XY12345 +.IP GENRE +Mixture of binary data (genre code) and string data. Should only appear in +the global CD-TEXT block. Useful entries will be created by +.I gcdmaster. +.IP TOC_INFO1 +Binary data: Optional table of contents 1. Should only appear in the global +CD-TEXT block. +.IP TOC_INFO2 +Binary data: Optional table of contents 2. Should only appear in the global +CD-TEXT block. +.IP UPC_EAN +String data: This item should only appear in the global CD-TEXT block. Was +always an empty string on the CD-TEXT CDs I had access to. +.IP ISRC +String data: ISRC code of track. The format is usually: CC-OOO-YY-SSSSS +.IP SIZE_INFO +Binary data: Contains summary about all CD-TEXT data and should only appear +in the global CD-TEXT block. The data will be automatically (re)created when +the CD-TEXT data is written. + +If one of the CD-TEXT items TITLE, PERFORMER, SONGWRITER, COMPOSER, ARRANGER, +ISRC is defined for at least on track or in the global section it must be +defined for all tracks and in the global section. If a DISC_ID item is defined +in the global section, an ISRC entry must be defined for each track. + +.SS Examples + +Simple track without pre-gap with all audio data from WAVE file +"data.wav": +.nf +.in +.5i +CD_DA +TRACK AUDIO +FILE "data.wav" 0 +.in -.5i +.fi + +Standard track with two second pre-gap, ISRC code and CD-TEXT: +.nf +.in +.5i +CD_DA +CD_TEXT { + LANGUAGE_MAP { + 0 : EN + } + + LANGUAGE 0 { + TITLE "CD Title" + PERFORMER "Performer" + DISC_ID "XY12345" + UPC_EAN "" + } +} + +TRACK AUDIO +ISRC "DEXXX9800001" +CD_TEXT { + LANGUAGE 0 { + TITLE "Track Title" + PERFORMER "Performer" + ISRC "DE-XXX-98-00001" + } +} +PREGAP 0:2:0 +FILE "data.wav" 0 +.in -.5i +.fi + +Track with 10 second pre-gap containing audio data from raw file +"data.cdr": +.nf +.in +.5i +CD_DA +TRACK AUDIO +FILE "data.cdr" 0 +START 0:10:0 +.in -.5i +.fi + +Composed track with data from different files. Pre-gap data and length +is taken from "pregapdata.wav". The first minute of +"track.cdr" is omitted and two seconds silence are inserted at +\&'2:0:0'. Index will be incremented after 2 and 4 minutes past track start: +.nf +.in +.5i +CD_DA +TRACK AUDIO +FILE "pregapdata.wav" 0 +START +FILE "track.cdr" 1:0:0 1:0:0 +SILENCE 0:2:0 +FILE "track.cdr" 2:0:0 +INDEX 2:0:0 +INDEX 4:0:0 +.in -.5i +.fi + +Mixed mode CD with a data track as first track followed by two audio tracks. +.nf +.in +.5i +CD_ROM +TRACK MODE1 +DATAFILE "data_1" +ZERO 00:02:00 // post-gap + +TRACK AUDIO +SILENCE 00:02:00 // pre-gap +START +FILE "data_2.wav" 0 + +TRACK AUDIO +FILE "data_3.wav" 0 +.in -.5i +.fi + +.SH CUE FILES + +Cue files may be used wherever a +.I toc-file +is expected. The corresponding bin file is not taken from the FILE statement +of a cue file but constructed from the cue file name by replacing ".cue" by +".bin". The cue file must have exactly one FILE statement. + +Currently, following track modes are supported: MODE1/2048, MODE1/2352, +MODE2/2336, MODE2/2352. The CATALOG, ISRC and POSTGAP statements are +parsed but not evaluated, yet. + +.SH SETTINGS + +Some of the command line options can be stored as settings at +following locations. The files will be read on startup of +.I cdrdao +in that order: + +1. /etc/cdrdao.conf + +2. /etc/defaults/cdrdao + +3. /etc/default/cdrdao + +4. $HOME/.cdrdao + + +Command line options will overwrite the loaded settings. +The settings file contains name - value pairs separated by a +colon. String values must be enclosed by ". The file is +automatically written if the command line option +.I \--save +is used but it is also possible to modify it manually. Following +values are defined: +.IP write_device +Device used for operations +.I simulate, write, copy, blank, disk-info +and +.I unlock. +Corresponding option: +.I --device +.IP write_driver +Driver (including driver options) that is used for operations +.I simulate, write, copy, blank, disk-info +and +.I unlock. +Corresponding option: +.I --driver +.IP write_speed +Specifies writing speed. Corresponding option: --speed +.IP write_buffers +Specifies fifo buffers used for recording. Corresponding option: --buffers +.IP read_device +Device used for operations +.I read-toc, read-cd +and +.I copy. +Corresponding option: +.I --device +or +.I --source-device +.IP read_driver +Driver (including driver options) used for operations +.I read-toc, read-cd +and +.I copy. +Corresponding option: +.I --driver +or +.I --source-driver +.IP read_paranoia_mode +Paranoia mode used for operations +.I read-cd and copy. +Corresponding option: +.I --paranoia-mode +.IP cddb_server_list +CDDB server list for +.I read-cddb. +Corresponding option: +.I --cddb-servers +.IP cddb_timeout +CDDB connection timeout in seconds used by +.I read-cddb. +Corresponding option: +.I --cddb-timeout +.IP cddb_directory +Local directory where fetched CDDB records will be stored, used by +.I read-cddb. +Corresponding option: +.I --cddb-directory +.IP tmp_file_dir +Directory where temporary WAV files will be created from decoding MP3 and Ogg Vorbis files. Corresponding option: +.I --tmpdir +.LP +.SH BUGS +If the program is terminated during the write/simulation process used IPC +resources may not be released. Use ipcs(8) and ipcrm(8) to delete them. +.SH AUTHOR +.ft CW +.nf +\&Andreas Mueller mueller@daneb.ping.de [DEFUNCT] +\&Denis Leroy <denis@poolshark.org> +\&Manuel Clos <llanero@users.sourceforge.net> +.ft R +.fi +.SH SEE ALSO +.BR gcdmaster "(1), "cdrecord "(1), "cdda2wav "(1), "cdparanoia "(1), " sox "(1), "ipcs "(8), " ipcrm (8) diff --git a/dao/dao-win32.cc b/dao/dao-win32.cc new file mode 100644 index 0000000..1922ee8 --- /dev/null +++ b/dao/dao-win32.cc @@ -0,0 +1,219 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "config.h" + +#include <stdio.h> +#include <malloc.h> +#include <errno.h> +#include <string.h> +#include <signal.h> + +#include <sys/types.h> + +#include "dao.h" +#include "log.h" + +#define BUFSIZE 150 + +// buffer size in blocks +int BUFFER_SIZE = BUFSIZE; + +static int TERMINATE = 0; +unsigned char rbuf1[BUFSIZE * AUDIO_BLOCK_LEN]; +// unsigned char rbuf2[BUFSIZE * AUDIO_BLOCK_LEN]; + +/* +typedef struct uebergabe_write +{ + CdrDriver *cdr; + int testmode; + DWORD total; +} UWRITE; +*/ + +int writeDiskAtOnce (const Toc *toc, CdrDriver *cdr, int nofBuffers, int swap, + int testMode) +{ + long length = toc->length().lba(); + long total = length * AUDIO_BLOCK_LEN; + long n, rn; + int err = 0; + + long cnt = 0; + long blkCount = 0; + long lba = 0; // LBA for writing + long encodeLba = 150; // LBA for encoding data blocks + + long cntMb; + long lastMb = 0; + + const Track *track = NULL; + int trackNr = 1; + Msf tstart, tend; + TrackData::Mode dataMode; + int encodingMode = 0; + + + /* + DWORD thread; + UWRITE uw; + */ + + TERMINATE = 0; + + if (cdr != NULL && cdr->bigEndianSamples() == 0) + { + // swap samples for little endian recorders + swap = !swap; + encodingMode = cdr->encodingMode(); + } + + if (!testMode) + { + if (cdr->initDao() != 0) + { + err = 1; + goto fail; + } + } + + TrackIterator itr(toc_); + TrackReader reader; + + track = itr.first(tstart, tend); + reader.init(track); + + if (reader.openData() != 0) { + log_message(-2, "Opening of track data failed."); + err = 1; + goto fail; + } + + dataMode = encodingMode == 0 ? TrackData::AUDIO : track->type(); + + if (!testMode) { + if (cdr->startDao() != 0) + { + err = 2; + goto fail; + } + + log_message(0, "Writing tracks..."); + } + + log_message(0, "Writing track %02d (mode %s/%s)...", trackNr, + TrackData::mode2String(track->type()), + TrackData::mode2String(dataMode)); + + while (length > 0 && !TERMINATE) { + n = (length > BUFFER_SIZE ? BUFFER_SIZE : length); + + do { + rn = reader.readData(encodingMode, encodeLba, (char*)rbuf1, n); + + if (rn < 0) { + log_message(-2, "Reading of track data failed."); + err = 1; + goto fail; + } + + if (rn == 0) { + track = itr.next(tstart, tend); + + reader.init(track); + if (reader.openData() != 0) { + log_message(-2, "Opening of track data failed."); + err = 1; + goto fail; + } + trackNr++; + if (encodingMode != 0) + dataMode = track->type(); + + log_message(0, "Writing track %02d (mode %s/%s)...", trackNr, + TrackData::mode2String(track->type()), + TrackData::mode2String(dataMode)); + + } + } while (rn == 0); + + encodeLba += rn; + + if (track->type() == TrackData::AUDIO && swap) + swapSamples ((Sample *)rbuf1, rn * SAMPLES_PER_BLOCK); + + if (!testMode) + { + if (cdr->writeData(dataMode, lba, (char *) rbuf1, rn) != 0) + { + log_message(-2, "Write of audio data failed."); + cdr->flushCache(); + err = 1; + goto fail; + } + else + { + cntMb = cnt >> 20; + + if (cntMb > lastMb) + { + log_message(0, "Wrote %ld of %ld MB.\r", cnt >> 20, total >> 20); + lastMb = cntMb; + } + } + } + else + { + log_message(0, "Read %ld of %ld MB.\r", cnt >> 20, total >> 20); + } + + length -= rn; + cnt += rn * AUDIO_BLOCK_LEN; + blkCount += rn; + + /* + uw.cdr = cdr; + uw.testmode = testMode; + uw.total = total; + + if ((thread = _beginthread (writeSlave, 4096, &uw)) != -1) + { + + + } + */ + } + + if (testMode) + log_message(0, "Read %ld blocks.", blkCount); + else + log_message(0, "Wrote %ld blocks.", blkCount); + + if (!testMode && daoStarted) + { + if (cdr->finishDao() != 0) + err = 3; + } + +fail: + + return err; +} + diff --git a/dao/dao.cc b/dao/dao.cc new file mode 100644 index 0000000..f9f33f5 --- /dev/null +++ b/dao/dao.cc @@ -0,0 +1,1010 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <stdio.h> +#include <unistd.h> +#include <fcntl.h> +#include <errno.h> +#include <string.h> +#include <signal.h> +#include <sys/types.h> +#include <sys/wait.h> +#include <assert.h> + +#ifdef linux +#include <linux/unistd.h> +#include <linux/types.h> +#endif + +#ifdef HAVE_SYS_MMAN_H +#include <sys/mman.h> +#endif + +#ifdef USE_POSIX_THREADS +#include <pthread.h> +#else +#include <sys/ipc.h> +#include <sys/shm.h> +#endif + +#include "dao.h" +#include "util.h" +#include "log.h" +#include "port.h" +#include "log.h" + + +#define DEBUG_WRITE 0 + + + +#if defined(__FreeBSD__) +#define IPC_ARG_T void +#else +#define IPC_ARG_T msgbuf +#endif + + +struct ShmSegment { + int id; + char *buffer; +}; + +struct Buffer { + long bufLen; // number of blocks in buffer that should be written + TrackData::Mode mode; // data mode for writing + TrackData::Mode trackMode; // mode of track may differ from 'mode' if data + // blocks must be encoded in audio blocks, + // only used for message printing + TrackData::SubChannelMode subChanMode; // sub-channel data mode + int trackNr; // if != 0 a new track with given number has started + int trackProgress; // reading progress of current track 0..1000 + char *buffer; // address of buffer that should be written +}; + +struct BufferHeader { + long buffersRead; // number of blocks that are read and put to the buffer + long buffersWritten; // number of blocks that were taken from the buffer + int buffersFilled; // set to 1 by reader process when buffer is filled the + // first time + int readerFinished; + int readerTerminated; + int terminateReader; + + long nofBuffers; // number of available buffers + Buffer *buffers; +}; + +// buffer size in blocks +int BUFFER_SIZE = 75; + +static int TERMINATE = 0; + + + + +static int getSharedMemory(long nofBuffers, BufferHeader **header, + long *nofSegments, ShmSegment **shmSegments); +static void releaseSharedMemory(long nofSegments, ShmSegment *shmSegments); + + + +static RETSIGTYPE terminationRequest(int sig) +{ + if (sig == SIGQUIT || sig == SIGTERM) + TERMINATE = 1; + +#if 0 + if (sig == SIGCHLD) { + log_message(0, "SIGCHLD received."); + } +#endif +} + + +#ifndef USE_POSIX_THREADS +// Waits or polls for termination of a child process. +// noHang: 0: wait until child terminates, 1: just poll if child terminated +// status: filled with status information, only valid if 0 is returned +// return: 0: child exited +// 1: no child exited, can only happen if 'noHang' is 1 +// 2: wait failed, 'errno' contains cause +static int waitForChild(int noHang, int *status) +{ + int ret; + + do { + if (noHang) + ret = wait3(status, WNOHANG, NULL); + else + ret = wait(status); + + if (ret > 0) + return 0; + + if (ret < 0 && errno != EINTR +#ifdef ERESTARTSYS + && errno != ERESTARTSYS +#endif + ) { + return 2; + } + } while (ret < 0); + + return 1; +} + +#endif + +// Blocks all signals that are handled by this module. +static void blockSignals() +{ + sigset_t set; + + sigemptyset(&set); + sigaddset(&set, SIGCHLD); + sigaddset(&set, SIGQUIT); + sigaddset(&set, SIGTERM); + +#ifdef USE_POSIX_THREADS + +#ifdef HAVE_PTHREAD_SIGMASK + pthread_sigmask(SIG_BLOCK, &set, NULL); +#endif + +#else + sigprocmask(SIG_BLOCK, &set, NULL); +#endif +} + +// Blocks all signals that are handled by this module. +static void unblockSignals() +{ + sigset_t set; + + sigemptyset(&set); + sigaddset(&set, SIGCHLD); + sigaddset(&set, SIGQUIT); + sigaddset(&set, SIGTERM); + +#ifdef USE_POSIX_THREADS + +#ifdef HAVE_PTHREAD_SIGMASK + pthread_sigmask(SIG_UNBLOCK, &set, NULL); +#endif + +#else + sigprocmask(SIG_UNBLOCK, &set, NULL); +#endif +} + +// return: 0: OK +// 1: child process terminated and has been collected with 'wait()' +// 2: error -> child process must be terminated +static int writer(const Toc *toc, CdrDriver *cdr, BufferHeader *header, + long lba, int speed) +{ + long total = toc->length().lba() * AUDIO_BLOCK_LEN; + long totalTracks = toc->nofTracks(); + long cnt = 0; + long blkCount = 0; + long len = 0; + long cntMb; + long lastMb = 0; + long buffered; + int buffFill; + int writerFill = 0; + int minFill = 100; + int maxFill = 0; + int actTrackNr = 0; + long actProgress; + TrackData::Mode dataMode; + TrackData::SubChannelMode subChanMode; +#ifndef USE_POSIX_THREADS + int status; +#endif + + log_message(3, "Waiting for reader process"); + + while (header->buffersFilled == 0) { + sleep(1); + + if (header->readerTerminated) { + log_message(-2, "Reader process terminated abnormally."); + return 1; + } + +#ifndef USE_POSIX_THREADS + // Check if child has terminated + switch (waitForChild(1, &status)) { + case 0: // Child exited + log_message(-2, "Reader process terminated abnormally."); + return 1; + case 2: + log_message(-2, "wait failed: %s", strerror(errno)); + return 2; + } +#endif + } + +#if DEBUG_WRITE + FILE *fp = fopen("test.out", "w"); +#endif + + log_message(3, "Awaken, will start writing"); + + if (cdr != NULL) { + cdr->sendWriteCdProgressMsg(CdrDriver::WCD_LEADIN, + totalTracks, 0, 0, 0, 100); + + blockSignals(); + if (cdr->startDao() != 0) { + unblockSignals(); + return 2; + } + unblockSignals(); + } + + do { + //log_message(4, "Slave: waiting for master."); + + while (header->buffersWritten == header->buffersRead) { + if (header->readerTerminated) { + log_message(-2, "Reader process terminated abnormally."); + return 1; + } + +#ifndef USE_POSIX_THREADS + // Check if child has terminated + switch (waitForChild(1, &status)) { + case 0: // Child exited + log_message(-2, "Reader process terminated abnormally."); + return 1; + case 2: + log_message(-2, "wait failed: %s", strerror(errno)); + return 2; + } +#endif + + mSleep(10); + } + + Buffer &buf = header->buffers[header->buffersWritten % header->nofBuffers]; + len = buf.bufLen; + dataMode = buf.mode; + subChanMode = buf.subChanMode; + + if (header->readerFinished) { + buffFill = 100; + if (maxFill == 0) + maxFill = 100; + } + else { + buffered = header->buffersRead - header->buffersWritten; + + if (buffered == header->nofBuffers || + buffered == header->nofBuffers - 1) { + buffFill = 100; + } + else { + buffFill = 100 * buffered; + buffFill /= header->nofBuffers; + } + + if (buffFill > maxFill) + maxFill = buffFill; + } + + if (buffFill < minFill) + minFill = buffFill; + + if (len == 0) { + // all data is written + log_message(1, ""); + if (cdr == NULL) + log_message(1, "Read %ld blocks.", blkCount); + else + log_message(1, "Wrote %ld blocks. Buffer fill min %d%%/max %d%%.", + blkCount, minFill, maxFill); + +#if DEBUG_WRITE + if (fp != NULL) + fclose(fp); +#endif + + if (cdr != NULL) { + cdr->sendWriteCdProgressMsg(CdrDriver::WCD_LEADOUT, + totalTracks, 0xaa, 1000, 1000, 100); + + blockSignals(); + if (cdr->finishDao() != 0) { + unblockSignals(); + return 2; + } + unblockSignals(); + } + + return 0; + } + + cnt += len * AUDIO_BLOCK_LEN; + blkCount += len; + + if (buf.trackNr > 0) { + log_message(1, "Writing track %02d (mode %s/%s %s)...", buf.trackNr, + TrackData::mode2String(buf.trackMode), + TrackData::mode2String(dataMode), + TrackData::subChannelMode2String(subChanMode)); + + actTrackNr = buf.trackNr; + } + + //log_message(4, "Slave: writing buffer %p (%ld).", buf, len); + +#if DEBUG_WRITE + if (fp != NULL) { + if (cdr != NULL) { + log_message(0, "dao: blockSize: %ld", cdr->blockSize(dataMode, subChanMode)); + + fwrite(buf.buffer, cdr->blockSize(dataMode, subChanMode), len, fp); + } + else { + fwrite(buf.buffer, 2352, len, fp); + } + } +#endif + + // Write track data. + if (cdr != NULL) { + blockSignals(); + if (cdr->writeData(dataMode, subChanMode, lba, buf.buffer, len) != 0) { + log_message(-2, "Writing failed - buffer under run?"); + unblockSignals(); + return 2; + } + + // Print stat line update every megabyte. + cntMb = cnt >> 20; + if (cntMb > lastMb) { + long totalcap, availcap; + if (cdr->readBufferCapacity(&totalcap, &availcap)) { + writerFill = (int)((1.0 - ((double)availcap / (double)totalcap)) + * 100.0); + log_message(1, "Wrote %ld of %ld MB (Buffers %3d%% %3d%%).\r", + cnt >> 20, total >> 20, buffFill, writerFill); + } else { + log_message(1, "Wrote %ld of %ld MB (Buffer %3d%%).\r", + cnt >> 20, total >> 20, buffFill); + } + lastMb = cntMb; + } + + unblockSignals(); + + actProgress = cnt; + actProgress /= total / 1000; + + cdr->sendWriteCdProgressMsg(CdrDriver::WCD_DATA, totalTracks, actTrackNr, + buf.trackProgress, actProgress, buffFill, + writerFill); + } + else { + if (speed > 0) { + log_message(1, "Read %ld of %ld MB (Buffer %3d%%).\r", cnt >> 20, total >> 20, buffFill); + mSleep(1000 / speed); + } + else { + log_message(1, "Read %ld of %ld MB.\r", cnt >> 20, total >> 20); + } + } + + + header->buffersWritten += 1; + + } while (!TERMINATE); + + log_message(-1, "Writing/simulation/read-test aborted on user request."); + + return 2; +} + +struct ReaderArgs { + const Toc *toc; + CdrDriver *cdr; + int swap; + BufferHeader *header; + long startLba; +}; + +static void *reader(void *args) +{ + const Toc *toc = ((ReaderArgs*)args)->toc; + CdrDriver *cdr = ((ReaderArgs*)args)->cdr; + int swap = ((ReaderArgs*)args)->swap; + BufferHeader *header = ((ReaderArgs*)args)->header; + long lba = ((ReaderArgs*)args)->startLba + 150; // used to encode the sector + // header (MSF) + + long length = toc->length().lba(); + long n, rn; + int first = header->nofBuffers; + const Track *track; + int trackNr = toc->firstTrackNo() == 0 ? 1 : toc->firstTrackNo(); + TrackData::Mode dataMode; + TrackData::SubChannelMode subChanMode; + int encodingMode = 0; + int subChanEncodingMode = 1; + int newTrack; + long tact; // number of blocks already read from current track + long tprogress; + + setRealTimeScheduling(4); + + giveUpRootPrivileges(); + + if (cdr != NULL) { + if (cdr->bigEndianSamples() == 0) { + // swap samples for little endian recorders + swap = !swap; + } + encodingMode = cdr->encodingMode(); + } + log_message(4, "Swap: %d", swap); + + TrackIterator itr(toc); + TrackReader reader; + + track = itr.first(); + reader.init(track); + + if (reader.openData() != 0) { + log_message(-2, "Opening of track data failed."); + goto fail; + } + + newTrack = 1; + tact = 0; + + dataMode = (encodingMode == 0) ? TrackData::AUDIO : track->type(); + subChanMode = track->subChannelType(); + + if (cdr != NULL) + subChanEncodingMode = cdr->subChannelEncodingMode(subChanMode); + + do { + n = (length > BUFFER_SIZE ? BUFFER_SIZE : length); + + Buffer &buf = header->buffers[header->buffersRead % header->nofBuffers]; + + do { + rn = reader.readData(encodingMode, subChanEncodingMode, lba, buf.buffer, + n); + + if (rn < 0) { + log_message(-2, "Reading of track data failed."); + goto fail; + } + + if (rn == 0) { + track = itr.next(); + reader.init(track); + + if (reader.openData() != 0) { + log_message(-2, "Opening of track data failed."); + goto fail; + } + + trackNr++; + + if (encodingMode != 0) + dataMode = track->type(); + + subChanMode = track->subChannelType(); + + if (cdr != NULL) + subChanEncodingMode = cdr->subChannelEncodingMode(subChanMode); + + newTrack = 1; + tact = 0; + } + } while (rn == 0); + + lba += rn; + tact += rn; + + if (cdr != NULL && + ((track->type() == TrackData::AUDIO && swap) || + (encodingMode == 0 && cdr->bigEndianSamples() == 0))) { + // swap audio data + long blockLen = cdr->blockSize(dataMode, subChanMode); + char *brun = buf.buffer; + int i; + + for (i = 0; i < rn; i++, brun += blockLen) + swapSamples((Sample *)brun, SAMPLES_PER_BLOCK); + } + + buf.bufLen = rn; + buf.mode = dataMode; + buf.trackMode = track->type(); + buf.subChanMode = subChanMode; + + tprogress = tact * 1000; + tprogress /= track->length().lba(); + + buf.trackProgress = tprogress; + + if (newTrack) { + // inform write process that it should print message about new track + buf.trackNr = trackNr; + } + else { + buf.trackNr = 0; + } + + header->buffersRead += 1; + + length -= rn; + + if (first > 0) { + first--; + if (first == 0 || length == 0) { + log_message(3, "Buffer filled"); + + header->buffersFilled = 1; + } + } + + // wait for writing process to finish writing of previous buffer + //log_message(4, "Reader: waiting for Writer."); + while (header->buffersRead - header->buffersWritten + == header->nofBuffers && + header->terminateReader == 0) { + mSleep(10); + } + + + newTrack = 0; + } while (length > 0 && header->terminateReader == 0); + + header->readerFinished = 1; + + if (header->terminateReader == 0) { + Buffer &buf1 = header->buffers[header->buffersRead % header->nofBuffers]; + buf1.bufLen = 0; + buf1.trackNr = 0; + header->buffersRead += 1; + } + +#ifndef USE_POSIX_THREADS + // wait until we get killed + while (1) + sleep(1000); + + exit(0); +#endif + + return NULL; + +fail: + header->readerTerminated = 1; + +#ifndef USE_POSIX_THREADS + exit(1); +#endif + + return NULL; +} + + +int writeDiskAtOnce(const Toc *toc, CdrDriver *cdr, int nofBuffers, int swap, + int testMode, int speed) +{ + int err = 0; + BufferHeader *header = NULL; + long nofShmSegments = 0; + ShmSegment *shmSegments = NULL; + long startLba = 0; + +#ifdef USE_POSIX_THREADS + pthread_t readerThread; + pthread_attr_t readerThreadAttr; + int threadStarted = 0; +#else + int pid = 0; + int status; +#endif + +#if 1 + if (nofBuffers < 10) { + nofBuffers = 10; + log_message(-1, "Adjusted number of FIFO buffers to 10."); + } +#endif + + if (getSharedMemory(nofBuffers, &header, &nofShmSegments, + &shmSegments) != 0) { + releaseSharedMemory(nofShmSegments, shmSegments); + return 1; + } + + header->buffersRead = 0; + header->buffersWritten = 0; + header->buffersFilled = 0; + header->readerFinished = 0; + header->readerTerminated = 0; + header->terminateReader = 0; + + TERMINATE = 0; + + installSignalHandler(SIGINT, SIG_IGN); + installSignalHandler(SIGPIPE, SIG_IGN); + installSignalHandler(SIGALRM, SIG_IGN); + installSignalHandler(SIGCHLD, terminationRequest); + installSignalHandler(SIGQUIT, terminationRequest); + installSignalHandler(SIGTERM, terminationRequest); + + if (!testMode) { + const DiskInfo *di; + + if (cdr->initDao(toc) != 0) { + err = 1; goto fail; + } + + if ((di = cdr->diskInfo()) != NULL) { + startLba = di->thisSessionLba; + } + } + + // start reader process +#ifdef USE_POSIX_THREADS + + if (pthread_attr_init(&readerThreadAttr) != 0) { + log_message(-2, "pthread_attr_init failed: %s", strerror(errno)); + err = 1; goto fail; + } + + ReaderArgs rargs; + + rargs.toc = toc; + rargs.cdr = cdr; + rargs.swap = swap; + rargs.header = header; + rargs.startLba = startLba; + + if (pthread_create(&readerThread, &readerThreadAttr, reader, &rargs) != 0) { + log_message(-2, "Cannot create thread: %s", strerror(errno)); + pthread_attr_destroy(&readerThreadAttr); + err = 1; goto fail; + } + else { + threadStarted = 1; + } + +#else /* USE_POSIX_THREADS */ + + if ((pid = fork()) == 0) { + // we are the new process + + setsid(); // detach from controlling terminal + +#ifdef HAVE_MLOCKALL + if (geteuid() == 0) { + if (mlockall(MCL_CURRENT|MCL_FUTURE) != 0) { + log_message(-1, "Cannot lock memory pages: %s", strerror(errno)); + } + log_message(4, "Reader process memory locked"); + } +#endif + + ReaderArgs rargs; + + rargs.toc = toc; + rargs.cdr = cdr; + rargs.swap = swap; + rargs.header = header; + rargs.startLba = startLba; + + reader(&rargs); + } + else if (pid < 0) { + log_message(-2, "fork failed: %s", strerror(errno)); + err = 1; goto fail; + } +#endif /* USE_POSIX_THREADS */ + + switch (setRealTimeScheduling(5)) { + case 1: + log_message(-1, "No super user permission to setup real time scheduling."); + break; + case 2: + log_message(2, "Real time scheduling not available."); + break; + } + +#ifdef HAVE_MLOCKALL + if (geteuid() == 0) { + if (mlockall(MCL_CURRENT|MCL_FUTURE) != 0) { + log_message(-1, "Cannot lock memory pages: %s", strerror(errno)); + } + log_message(4, "Memory locked"); + } +#endif + + giveUpRootPrivileges(); + + switch (writer(toc, cdr, header, startLba, speed)) { + case 1: // error, reader process terminated abnormally +#ifndef USE_POSIX_THREADS + pid = 0; +#endif + err = 1; + break; + case 2: // error, reader process must be terminated + err = 1; + break; + } + + if (err != 0 && cdr != NULL) + cdr->abortDao(); // abort writing process + + fail: +#ifdef HAVE_MUNLOCKALL + munlockall(); +#endif + +#ifdef USE_POSIX_THREADS + if (threadStarted) { + header->terminateReader = 1; + + if (pthread_join(readerThread, NULL) != 0) { + log_message(-2, "pthread_join failed: %s", strerror(errno)); + err = 1; + } + + pthread_attr_destroy(&readerThreadAttr); + } + +#else + if (pid != 0) { + if (kill(pid, SIGKILL) == 0) { + waitForChild(0, &status); + } + } +#endif + + releaseSharedMemory(nofShmSegments, shmSegments); + + installSignalHandler(SIGINT, SIG_DFL); + installSignalHandler(SIGPIPE, SIG_DFL); + installSignalHandler(SIGALRM, SIG_DFL); + installSignalHandler(SIGCHLD, SIG_DFL); + installSignalHandler(SIGQUIT, SIG_DFL); + installSignalHandler(SIGTERM, SIG_DFL); + + return err; +} + + +#ifdef USE_POSIX_THREADS +static int getSharedMemory(long nofBuffers, + BufferHeader **header, long *nofSegments, + ShmSegment **shmSegment) +{ + long b; + long bufferSize = BUFFER_SIZE * (AUDIO_BLOCK_LEN + PW_SUBCHANNEL_LEN); + + *header = NULL; + *nofSegments = 0; + *shmSegment = NULL; + + if (nofBuffers <= 0) { + return 1; + } + + *shmSegment = new ShmSegment; + *nofSegments = 1; + + (*shmSegment)->id = -1; + + (*shmSegment)->buffer = new char[sizeof(BufferHeader) + + nofBuffers * sizeof(Buffer) + + nofBuffers * bufferSize]; + + if ( (*shmSegment)->buffer == NULL) { + log_message(-2, "Cannot allocated memory for ring buffer."); + return 1; + } + + *header = (BufferHeader*)((*shmSegment)->buffer); + (*header)->nofBuffers = nofBuffers; + (*header)->buffers = + (Buffer*)((*shmSegment)->buffer + sizeof(BufferHeader)); + + char *bufferBase = (*shmSegment)->buffer + sizeof(BufferHeader) + + nofBuffers * sizeof(Buffer); + + for (b = 0; b < nofBuffers; b++) + (*header)->buffers[b].buffer = bufferBase + b * bufferSize; + + return 0; +} + +static void releaseSharedMemory(long nofSegments, ShmSegment *shmSegment) +{ + if (shmSegment == NULL || nofSegments == 0) + return; + + if (shmSegment->buffer != NULL) { + delete[] shmSegment->buffer; + shmSegment->buffer = NULL; + } + + delete shmSegment; +} + +#else /* USE_POSIX_THREADS */ + +static int getSharedMemory(long nofBuffers, + BufferHeader **header, long *nofSegments, + ShmSegment **shmSegments) +{ + long i, b; + long bufferSize = BUFFER_SIZE * (AUDIO_BLOCK_LEN + PW_SUBCHANNEL_LEN); + long maxSegmentSize = 0; + long bcnt = 0; + + *header = NULL; + *nofSegments = 0; + *shmSegments = NULL; + + if (nofBuffers <= 0) { + return 1; + } + +#if defined(linux) && defined(IPC_INFO) + struct shminfo info; + + if (shmctl(0, IPC_INFO, (struct shmid_ds*)&info) < 0) { + log_message(-1, "Cannot get IPC info: %s", strerror(errno)); + maxSegmentSize = 4 * 1024 * 1024; + log_message(-1, "Assuming %ld MB shared memory segment size.", + maxSegmentSize >> 20); + } + else { + maxSegmentSize = info.shmmax; + } + +#elif defined(__FreeBSD__) + maxSegmentSize = 4 * 1024 * 1024; // 4 MB +#else + maxSegmentSize = 1 * 1024 * 1024; // 1 MB +#endif + + log_message(4, "Shm max segement size: %ld (%ld MB)", maxSegmentSize, + maxSegmentSize >> 20); + + if (maxSegmentSize < sizeof(BufferHeader) + nofBuffers * sizeof(Buffer)) { + log_message(-2, "Shared memory segment cannot hold a single buffer."); + return 1; + } + + maxSegmentSize -= sizeof(BufferHeader) + nofBuffers * sizeof(Buffer); + + long buffersPerSegment = maxSegmentSize / bufferSize; + + if (buffersPerSegment == 0) { + log_message(-2, "Shared memory segment cannot hold a single buffer."); + return 1; + } + + *nofSegments = nofBuffers / buffersPerSegment; + + if (nofBuffers % buffersPerSegment != 0) + *nofSegments += 1; + + *shmSegments = new ShmSegment[*nofSegments]; + + log_message(4, "Using %ld shared memory segments.", *nofSegments); + + for (i = 0; i < *nofSegments; i++) { + (*shmSegments)[i].id = -1; + (*shmSegments)[i].buffer = NULL; + } + + long bufCnt = nofBuffers; + long n; + long segmentLength; + char *bufferBase; + + for (i = 0; i < *nofSegments; i++) { + n = (bufCnt > buffersPerSegment ? buffersPerSegment : bufCnt); + + segmentLength = n * bufferSize; + if (*header == NULL) { + // first segment contains the buffer header + segmentLength += sizeof(BufferHeader) + nofBuffers * sizeof(Buffer); + } + + (*shmSegments)[i].id = shmget(IPC_PRIVATE, segmentLength, 0600|IPC_CREAT); + if ((*shmSegments)[i].id < 0) { + log_message(-2, "Cannot create shared memory segment: %s", + strerror(errno)); + log_message(-2, "Try to reduce the buffer count (option --buffers)."); + return 1; + } + + (*shmSegments)[i].buffer = (char *)shmat((*shmSegments)[i].id, 0, 0); + if (((*shmSegments)[i].buffer) == NULL || + ((*shmSegments)[i].buffer) == (char *)-1) { + (*shmSegments)[i].buffer = NULL; + log_message(-2, "Cannot get shared memory: %s", strerror(errno)); + log_message(-2, "Try to reduce the buffer count (option --buffers)."); + return 1; + } + + + if (*header == NULL) { + bufferBase = (*shmSegments)[i].buffer + sizeof(BufferHeader) + + nofBuffers * sizeof(Buffer); + *header = (BufferHeader*)(*shmSegments)[i].buffer; + (*header)->nofBuffers = nofBuffers; + (*header)->buffers = + (Buffer*)((*shmSegments)[i].buffer + sizeof(BufferHeader)); + } + else { + bufferBase = (*shmSegments)[i].buffer; + } + + for (b = 0; b < n; b++) + (*header)->buffers[bcnt++].buffer = bufferBase + b * bufferSize; + + bufCnt -= n; + } + + assert(bcnt == nofBuffers); + + return 0; +} + +static void releaseSharedMemory(long nofSegments, ShmSegment *shmSegments) +{ + long i; + + if (shmSegments == NULL || nofSegments == 0) + return; + + for (i = 0; i < nofSegments; i++) { + if (shmSegments[i].id >= 0) { + if (shmSegments[i].buffer != NULL) { + if (shmdt(shmSegments[i].buffer) != 0) { + log_message(-2, "shmdt: %s", strerror(errno)); + } + } + if (shmctl(shmSegments[i].id, IPC_RMID, NULL) != 0) { + log_message(-2, "Cannot remove shared memory: %s", strerror(errno)); + } + } + } + + delete[] shmSegments; +} +#endif /* USE_POSIX_THREADS */ diff --git a/dao/dao.h b/dao/dao.h new file mode 100644 index 0000000..7f6d768 --- /dev/null +++ b/dao/dao.h @@ -0,0 +1,29 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __DAO_H__ +#define __DAO_H__ + +#include "Toc.h" +#include "CdrDriver.h" + +int writeDiskAtOnce(const Toc *, CdrDriver *, int nofBuffers, int swap, + int testMode, int speed); + +#endif diff --git a/dao/data.cc b/dao/data.cc new file mode 100644 index 0000000..efd3d4a --- /dev/null +++ b/dao/data.cc @@ -0,0 +1,176 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* Data for creating an sector with L-EC errors */ +unsigned char SECTOR_ERROR_DATA[2448] = { +0x95,0xd1,0x90,0x52,0x73,0xeb,0xf3,0xda,0xef,0x6e,0xd1,0x4b,0x03,0xab,0xd9,0xe5, +0x71,0x86,0x4e,0xb4,0x4a,0x39,0x2c,0xa2,0x10,0x75,0xfb,0x70,0xbf,0x33,0xc6,0x55, +0x05,0x56,0xa7,0x78,0x41,0x9b,0x52,0x30,0x09,0x24,0x7b,0x0d,0xcf,0x55,0xf2,0x40, +0xdb,0x40,0xf4,0x26,0x7a,0x21,0xc8,0x8a,0x96,0xc3,0xfa,0x55,0xf7,0xc0,0xaa,0xfc, +0x17,0x52,0x74,0x58,0xed,0xc7,0x89,0xf6,0xeb,0x04,0x03,0xba,0x59,0xf5,0xfb,0x35, +0x36,0xef,0x5b,0xb0,0x10,0x23,0x3a,0xa6,0xe7,0x34,0xfc,0xde,0xf4,0xa6,0xda,0x0b, +0xf8,0x4e,0x64,0xe5,0x15,0xed,0xdc,0x00,0xf1,0xdf,0xbb,0x4b,0xd5,0xb6,0x80,0x0b, +0xa5,0xdb,0xbb,0xb6,0xfe,0xf5,0x5c,0xe5,0x29,0x58,0xc3,0x1d,0xff,0x9d,0x29,0xf7, +0xec,0x8d,0xdd,0x01,0x7a,0xb9,0x02,0x6b,0x98,0xbd,0xb6,0x6d,0x73,0x36,0x78,0x18, +0x11,0x33,0xce,0x10,0x28,0x2b,0xf5,0x51,0x83,0xb9,0x6f,0x82,0x56,0x98,0x7a,0x42, +0x25,0x57,0x44,0x9f,0x10,0x46,0x0a,0xa8,0x03,0xc1,0x16,0x76,0xf7,0x8e,0x8e,0x09, +0xc2,0x5d,0x19,0xea,0x88,0x0e,0x3c,0x0b,0xc7,0xab,0x8e,0x1e,0x43,0x08,0x60,0x68, +0x5f,0xa4,0x07,0x6f,0xea,0x11,0x17,0xed,0xd2,0x2d,0x63,0xca,0xbc,0xf2,0xd3,0x7e, +0x4f,0xec,0x68,0xd7,0xfa,0xa4,0xe2,0xc2,0x4f,0x70,0xe0,0x92,0x78,0x40,0xfa,0xd7, +0xe5,0x01,0x46,0xcf,0x13,0x5e,0xbd,0xe5,0x8b,0x20,0xaf,0x47,0x12,0x82,0xc5,0x61, +0x6e,0x2e,0x38,0x69,0xd2,0x1b,0x2b,0x22,0x8b,0x0b,0xb4,0x04,0x4b,0xaf,0xdb,0x30, +0xb0,0x22,0x00,0xc3,0x80,0xbd,0xa9,0x0b,0xdd,0x58,0x53,0xf0,0xdb,0x18,0x51,0x49, +0x46,0x8a,0xb2,0x19,0xa5,0xdd,0x3b,0x30,0xe8,0xef,0x34,0x34,0x9e,0x10,0x64,0x4f, +0x32,0x64,0x12,0xb2,0x21,0xbb,0xbd,0xff,0x14,0x10,0xef,0xef,0x29,0x40,0x38,0x6f, +0xca,0xeb,0x88,0x6f,0xc8,0xc3,0xa0,0xb1,0xb3,0xd4,0xe5,0x51,0xe4,0x49,0xa0,0x16, +0xae,0xb3,0xc8,0xcf,0x6e,0x86,0xce,0x82,0x96,0xbd,0x71,0xbf,0xfe,0xaa,0x2f,0xc8, +0x95,0xb7,0x38,0x5d,0x7b,0xd8,0x0e,0x2e,0xac,0xf3,0x7f,0x91,0x3d,0x20,0xa7,0xeb, +0xd3,0x70,0xba,0x41,0xf6,0x89,0xc4,0x8c,0x46,0x35,0x4c,0x44,0xdf,0x7b,0x0d,0x74, +0x32,0x45,0xd2,0xad,0x1d,0xe0,0xdb,0xc9,0xd4,0x5b,0x5a,0x11,0x7b,0x02,0xfc,0x4e, +0x72,0xb6,0x8f,0x68,0x3f,0x53,0xf4,0x86,0x89,0x40,0xca,0x68,0xbb,0xd7,0xdd,0xee, +0x1c,0xaf,0x9b,0x39,0x8f,0x77,0x03,0x63,0xd2,0x5d,0x74,0x4d,0x5f,0x70,0x9b,0xd1, +0x27,0x2a,0x39,0x66,0x7e,0x2e,0xec,0x07,0x6e,0xb7,0x6f,0x2a,0x8e,0x4c,0x18,0xab, +0xfb,0xb3,0xe4,0x8b,0x2a,0xe7,0xee,0xfc,0x45,0x63,0x49,0xa4,0xd3,0xe4,0x76,0xfa, +0x0f,0xaf,0x61,0x8d,0xdd,0x4d,0x94,0x4c,0x04,0x03,0x76,0x93,0x50,0x8e,0x3e,0x4b, +0x41,0x22,0xd6,0x6c,0x0a,0xc5,0x68,0x4f,0x28,0xb2,0xf3,0xfb,0x96,0x69,0xf6,0xa5, +0x19,0x57,0x32,0xf6,0xa4,0xc6,0x42,0xa9,0xca,0xb8,0x3c,0x1a,0x46,0x7a,0x65,0x88, +0x9c,0x3c,0xf4,0xa6,0x01,0x5c,0xf5,0x29,0x0e,0xe9,0x24,0xa5,0x52,0x1a,0x4a,0x6b, +0x71,0x7d,0x62,0x16,0x43,0xa4,0xbf,0x0d,0x5d,0xfb,0x27,0xa3,0x75,0x8d,0x2b,0x11, +0xc9,0x1f,0xb8,0xca,0x7c,0xad,0xf3,0x8a,0x96,0x17,0x2f,0xe9,0x32,0x7a,0x54,0xa3, +0xf7,0xb6,0xb9,0x3a,0x5b,0x78,0x48,0xb8,0x73,0x6f,0x5b,0xe8,0xfc,0x87,0xfa,0xc5, +0xa6,0xb2,0x8f,0x22,0x5f,0x82,0xad,0xf6,0x9a,0xdc,0xdf,0xcc,0x56,0x33,0x6f,0x4d, +0xea,0x29,0x88,0x45,0xa1,0xd0,0xfd,0x15,0x3f,0x58,0xfd,0x3c,0xdf,0xf7,0x01,0x86, +0xa9,0x91,0xa8,0x09,0x13,0x55,0xff,0xad,0x32,0xde,0x79,0x88,0x11,0xe9,0xd6,0xfb, +0x12,0x5e,0x40,0xb3,0x2e,0x3d,0xc8,0x6d,0x96,0xc6,0xa9,0x75,0xbd,0xab,0xfb,0x67, +0x3c,0xa4,0x70,0x4f,0xf9,0x6f,0xfd,0x2b,0x4d,0x76,0xb4,0x5e,0x5f,0x8a,0x5a,0x71, +0xe8,0x9a,0x25,0x16,0xd8,0xed,0x83,0x6e,0xb3,0x2d,0xe3,0x71,0xd8,0xdf,0xd8,0x14, +0x83,0x48,0x63,0x7c,0xb7,0x60,0xa8,0x04,0xd7,0x5c,0x62,0x36,0xe6,0xbc,0xa8,0xce, +0x57,0xcd,0xe4,0x2f,0xba,0x67,0x9d,0x6e,0x94,0x80,0xdf,0x6c,0x5f,0xb7,0x80,0xe2, +0xff,0xe4,0x5f,0xb6,0x44,0x07,0xba,0x1b,0x63,0x1c,0x52,0x49,0xd9,0xfa,0x17,0x30, +0xc7,0xfb,0x5f,0x81,0x62,0xfc,0xef,0xf7,0x7c,0xce,0x63,0xdc,0x85,0xe4,0xbe,0x84, +0xc8,0x1d,0x3a,0x0c,0x24,0xf4,0x28,0x87,0x11,0x7a,0xd0,0xea,0x74,0xe7,0x1a,0x3b, +0xe2,0x79,0xbc,0x45,0x75,0xac,0x3c,0xf1,0x7a,0x9f,0xcd,0x00,0x83,0x8c,0x84,0x4b, +0xa9,0xbf,0x58,0xce,0xb3,0x80,0x55,0xc4,0xfa,0x26,0xae,0x6e,0x0d,0xc8,0xa9,0xf0, +0x41,0x65,0x35,0xb6,0x11,0x71,0xa8,0x8c,0x10,0x75,0x8c,0x94,0x01,0x10,0xdf,0xab, +0xcf,0x37,0x79,0x83,0xb7,0xce,0x47,0xb1,0xf4,0xf6,0x1f,0x02,0xbe,0xc8,0xf2,0x00, +0x2e,0x27,0xb6,0x3f,0x98,0x5e,0xcb,0xa8,0xd4,0x57,0x3c,0xd5,0x68,0x1c,0x80,0x37, +0x53,0xf9,0xba,0x0b,0xc8,0x02,0xbc,0xbc,0xf8,0xdc,0xbe,0xb6,0xa4,0xb0,0xb6,0xd2, +0xd7,0x6d,0x12,0x6f,0xcb,0xdd,0x18,0x9f,0x35,0x54,0x75,0x9d,0x70,0xf5,0xd4,0xc4, +0xef,0x8f,0xcf,0xb7,0x91,0x8b,0x73,0x89,0x67,0x32,0x3f,0x0c,0xe2,0xf6,0xde,0xba, +0x63,0xf0,0x29,0x2e,0xce,0x41,0xce,0x03,0x96,0x43,0xa0,0x06,0x38,0x74,0xca,0x27, +0x03,0x99,0xde,0x94,0x25,0x52,0x1d,0x8c,0x84,0x5d,0x98,0x66,0x53,0x77,0x20,0xb6, +0x67,0x4a,0xe4,0x35,0x8b,0xb2,0x38,0x21,0xf5,0xd8,0x28,0x2e,0x4d,0xf2,0x55,0x50, +0x8c,0x34,0xe5,0xb1,0x86,0x02,0x3d,0x0a,0x5f,0xd6,0x70,0xb2,0x4d,0x91,0x68,0xb4, +0xdb,0x4d,0xea,0x66,0xff,0x22,0x88,0xf5,0xfb,0xb0,0x23,0x48,0xa2,0x78,0x98,0x2e, +0xac,0x7d,0xdf,0x32,0x80,0x1d,0x3c,0xdf,0xf3,0xad,0x92,0x40,0x3e,0xfa,0xf4,0x19, +0x47,0xde,0x7f,0x47,0x01,0x07,0x3c,0xfc,0xb7,0x5f,0x44,0x5a,0xd7,0xdc,0x88,0x84, +0x5a,0x68,0xb6,0xda,0x85,0xf3,0xb9,0x78,0xa0,0x4b,0xb8,0xde,0x46,0xac,0xf7,0x8d, +0x8b,0x76,0xd4,0x8c,0x7e,0x10,0x88,0x35,0x6f,0xcc,0x8f,0x47,0xa8,0x18,0xcb,0x02, +0x80,0x81,0xdc,0x05,0x74,0x96,0x7d,0x14,0xe1,0x35,0xf2,0x27,0xe1,0xe9,0xb5,0x6c, +0x60,0x89,0xf8,0xde,0x9a,0x80,0x13,0x09,0x4c,0xa3,0x50,0xf5,0xbb,0x1b,0xf7,0x3b, +0x9d,0xd4,0x40,0x11,0x6a,0xbd,0x26,0x4b,0xf2,0x18,0x73,0xd3,0x02,0x28,0x40,0x62, +0xb1,0x38,0x40,0x4b,0xb9,0x53,0x55,0x05,0xf6,0xa5,0xfa,0xb1,0xc1,0xf2,0xec,0x5e, +0xc6,0x2c,0x6f,0x30,0xe9,0x95,0x7b,0xdb,0xae,0xee,0xaf,0xb0,0x16,0xef,0x12,0xc8, +0x27,0x52,0x13,0xe0,0xa5,0x68,0xe6,0x9c,0x0e,0xe0,0x4d,0xcf,0xd2,0x3a,0x2d,0x98, +0x66,0x9c,0xc8,0x50,0x32,0x44,0x2b,0xe0,0x32,0xda,0x90,0x49,0xc9,0xa2,0x11,0xf1, +0xf4,0x24,0xd1,0x99,0x8d,0xb7,0x35,0x9b,0x98,0x83,0x6a,0x6a,0xbd,0x97,0x03,0x23, +0x33,0xcb,0x73,0x65,0x0f,0x9f,0x45,0x42,0x79,0xd5,0x8b,0x43,0x77,0x9c,0x34,0x6b, +0xc0,0x05,0x05,0x4d,0xbd,0x3a,0xe8,0x55,0xbd,0x52,0xbf,0x7a,0xe9,0xc2,0x9e,0x1d, +0x8e,0x11,0x82,0x9d,0xb0,0xc8,0xdf,0x2a,0x9d,0x6a,0x6d,0x15,0x06,0xa1,0x80,0xc7, +0xa6,0x85,0x14,0x63,0xc0,0xfd,0xb8,0x7d,0x4f,0x78,0xf8,0x39,0x3a,0x96,0x56,0xc8, +0xa7,0xd8,0x66,0x58,0xa0,0x45,0x82,0x3e,0xb0,0xef,0x53,0xb6,0x90,0xd3,0x7d,0x36, +0x59,0x92,0x9a,0x19,0x8f,0x52,0x96,0xde,0xca,0x8e,0x17,0x05,0x24,0x6d,0xcd,0xcc, +0x46,0x33,0x24,0xe6,0x79,0xa6,0x24,0x29,0x95,0x77,0xdf,0x25,0x4b,0x5d,0x5b,0xa4, +0xef,0xf5,0xbd,0x7e,0x48,0x53,0x5c,0x12,0xe2,0x74,0x17,0x06,0xe1,0xe5,0xd2,0x27, +0x18,0xf6,0x0e,0x91,0x9c,0x32,0xba,0x31,0xaa,0x9a,0x56,0xf5,0xf7,0xb2,0x99,0xe6, +0xa7,0x56,0x64,0xef,0xa9,0xc0,0x02,0x8b,0x34,0x19,0x92,0x16,0xfe,0x64,0x3d,0x17, +0x5b,0x4b,0xa8,0xf7,0x7e,0x63,0x29,0x28,0xfd,0x7f,0x1d,0xf4,0x31,0xb6,0xda,0xd9, +0x0c,0x3e,0xc8,0xb5,0xfe,0xca,0x41,0x33,0xe4,0xd3,0x49,0xe2,0x37,0x86,0xf9,0x92, +0xd2,0xa2,0x8a,0x50,0x05,0xb3,0x78,0x02,0x32,0x95,0xf6,0x64,0x4b,0xd0,0x3d,0x57, +0x0e,0x05,0x0c,0x0c,0xd0,0x4d,0x3f,0xb4,0x20,0x88,0x96,0x58,0x0f,0x90,0xea,0xe1, +0x32,0x74,0x31,0x37,0x27,0xa9,0x39,0x5a,0x3e,0x2f,0xbe,0x89,0xff,0xfb,0xe0,0x0d, +0x00,0xec,0x19,0xd0,0x3a,0x59,0x84,0x5a,0xe1,0x1b,0xb2,0xf0,0xab,0x9d,0xd1,0xdd, +0x11,0x02,0x14,0x39,0xab,0x4d,0x93,0xe9,0x7c,0x51,0x72,0x7b,0x4c,0x52,0x88,0x4c, +0x3f,0xa1,0x1d,0x79,0xfa,0xa1,0xd3,0xdc,0xbc,0x86,0xcc,0x67,0x23,0x9e,0x44,0x34, +0xa0,0x58,0x6d,0x4c,0xa5,0x00,0x35,0x21,0x51,0xa8,0x9c,0x9d,0xfa,0x24,0xea,0x39, +0xc6,0x07,0xb2,0xc0,0xa8,0x86,0x9c,0x65,0x0c,0x69,0xcc,0x2f,0x07,0x11,0x63,0xa7, +0x69,0xd1,0xf3,0x0f,0xd1,0x29,0x30,0x23,0xd1,0xcd,0xc0,0xcb,0xf1,0xaa,0x05,0xb7, +0xb1,0xb7,0x78,0x5a,0x3d,0x14,0xbf,0x49,0x7d,0x8b,0x78,0x84,0x9c,0xdc,0x2c,0x06, +0xad,0x1f,0x15,0x7e,0x48,0x45,0xa1,0x19,0x12,0x62,0xe5,0x04,0x0c,0xea,0xbb,0xbe, +0xa1,0x33,0x18,0xdf,0x48,0xd7,0x28,0xc5,0x62,0xa1,0x4a,0xff,0x7d,0x76,0x05,0x2a, +0x95,0x1a,0xa8,0xde,0x5f,0x4a,0xf7,0x72,0xac,0xdc,0x76,0xb8,0xc6,0x31,0x76,0x68, +0x65,0x8e,0x47,0xad,0x65,0x6f,0x72,0xc8,0x10,0xbc,0xc7,0x8d,0x32,0xcc,0xb7,0xc8, +0xe6,0x60,0xa6,0x45,0xaa,0x9d,0xb7,0x56,0x7a,0x2d,0x0e,0x40,0x5f,0x85,0xa8,0xc4, +0x13,0xef,0x71,0x79,0x5f,0xe3,0x41,0x6f,0xa0,0x08,0xfd,0xd2,0xd4,0xb4,0x9a,0xba, +0x14,0x40,0xff,0xbe,0xde,0xb7,0x14,0x58,0xe4,0x23,0x98,0x43,0xa8,0x41,0x07,0xbb, +0x30,0x78,0x34,0x8f,0x5c,0x75,0xff,0xfc,0x7d,0xfc,0xce,0x51,0xb0,0x69,0x0b,0xc5, +0xa9,0x0b,0x83,0x87,0xc2,0x98,0xdf,0xa6,0xbb,0x78,0xea,0x63,0xb9,0xf1,0x1e,0xe9, +0x6a,0x53,0x79,0xc6,0xc8,0x78,0xc2,0x46,0x74,0x90,0x97,0x24,0xf9,0xa3,0xe9,0xa3, +0xae,0x6d,0x2a,0x70,0x05,0x0a,0x16,0xc0,0x82,0x00,0x23,0x3b,0xf2,0x41,0x24,0x5c, +0x94,0x9d,0x22,0x5d,0x15,0xe4,0xa3,0x89,0x74,0x3a,0xae,0x6e,0xdd,0x97,0x11,0x8b, +0x04,0x3b,0xfb,0x09,0x45,0x12,0xc9,0xc7,0x12,0xec,0x02,0x04,0x2e,0x27,0x60,0xc2, +0xc4,0x82,0x1f,0xda,0x66,0xc2,0x63,0xdb,0xfd,0x11,0x49,0xda,0xa9,0x5a,0x66,0xad, +0x95,0x61,0xb7,0xdb,0x73,0x80,0xa2,0x86,0x6d,0xa5,0x8a,0x9b,0xcc,0xeb,0x5d,0x90, +0x6d,0x7d,0x6a,0xd4,0x3f,0xce,0xaf,0x3c,0xdf,0xf8,0x17,0x88,0x52,0x7d,0x36,0xe7, +0xde,0xed,0xc2,0x52,0x6d,0x65,0xd8,0xda,0x0a,0x62,0x75,0xd6,0x4d,0xd3,0x66,0xbb, +0x50,0xd1,0x8f,0x8f,0x9f,0x3e,0xcc,0x7e,0x36,0xe3,0x07,0x88,0x60,0x3d,0x6f,0x3e, +0x2a,0x32,0x90,0x97,0x97,0x68,0x72,0xa1,0xcb,0xe7,0x77,0x18,0xba,0xdd,0xd3,0x0a, +0xae,0x62,0x9a,0x4d,0xa0,0x66,0xcc,0xd6,0x49,0xd3,0x5e,0xa9,0x10,0xce,0xe7,0x3a, +0x00,0x78,0xd1,0x97,0xe0,0x43,0x38,0xab,0x2b,0xaf,0xc4,0xe5,0x8c,0x97,0xf0,0x3b, +0xfa,0x8a,0x88,0x9a,0xf0,0x54,0x71,0x39,0x27,0xcf,0xe2,0x37,0x9d,0xc9,0x71,0x9d, +0x41,0x43,0x34,0x22,0x86,0x6c,0xcd,0xb1,0x1b,0x91,0x97,0xa8,0x29,0x87,0xe3,0x23, +0x11,0x6b,0xbd,0x01,0xc0,0x2e,0x3a,0xe7,0xfe,0x1c,0x1f,0x9b,0xe5,0x90,0x39,0x27, +0xd3,0x6d,0x49,0x5a,0xda,0x16,0x0b,0xf5,0xa8,0xa2,0x9d,0xd1,0x29,0x80,0xf4,0x3a, +0xec,0xb1,0x3b,0xac,0xe0,0x75,0x93,0xde,0x91,0xb2,0x79,0x77,0x43,0xb2,0x9e,0x16, +0x20,0xe7,0x70,0xfa,0xfd,0x7c,0xef,0xa5,0x1e,0x8d,0x76,0x48,0x0d,0x6a,0x82,0xf9, +0x1c,0xbe,0xa5,0xfc,0x33,0x39,0xda,0xc5,0xeb,0x53,0x3c,0x2e,0x06,0xda,0x45,0x26, +0xc1,0xb5,0x20,0xbe,0x31,0x0f,0x64,0x50,0x9c,0xda,0x98,0xaa,0x45,0x1a,0xa3,0x61, +0xd8,0x49,0x5d,0x0c,0x82,0x37,0xd1,0x6d,0x8a,0x0d,0x9c,0x90,0xe7,0xe1,0xb6,0xa8, +0x96,0xd6,0x66,0xc8,0xe6,0xca,0x18,0x82,0xa5,0xb0,0x2c,0xea,0xca,0xd0,0x4b,0xa3, +0x19,0xa8,0xaf,0x9b,0xdf,0x80,0x08,0x69,0x8d,0xa4,0xfa,0x74,0x85,0xb0,0x1c,0x1c, +0x87,0x82,0xe4,0x6d,0x4d,0xfc,0xef,0xf2,0xac,0x1c,0xdc,0x76,0xec,0x27,0x19,0x05, +0xcf,0xc8,0xa0,0xae,0x48,0xa8,0x17,0xd5,0x4d,0x11,0x49,0xd2,0xc2,0x65,0xee,0x49, +0xe8,0xd2,0xb6,0x35,0xce,0xa5,0x27,0x7a,0xc1,0x03,0xf1,0xad,0x2a,0x0a,0xb2,0xf9, +0xd3,0x52,0xa7,0x1b,0xfb,0xbe,0xf1,0x48,0xd0,0x3a,0x1a,0x92,0xa0,0x09,0xdb,0x88, +0xdb,0x91,0xbd,0xaa,0x36,0xe4,0x24,0xf8,0xe7,0x15,0xa5,0x11,0x20,0x58,0x0a,0xf3, +0xaa,0xb1,0x0e,0xa5,0x6f,0xff,0xed,0x3f,0x3a,0x08,0xd1,0xda,0x11,0xac,0x62,0xec, +0x3d,0x1f,0x96,0x74,0x03,0xbb,0x6c,0xea,0xd0,0x11,0xfb,0xf0,0x69,0x05,0xe3,0x14, +0xb6,0xf2,0xb9,0x25,0xf1,0xa7,0x65,0x2b,0xaf,0x36,0x05,0xc0,0xe3,0x67,0xac,0x20, +0x86,0x43,0x94,0x89,0xfe,0x00,0x73,0xce,0x12,0x6e,0xbf,0x7b,0x73,0xa2,0x8f,0x29, +0x94,0x49,0x4f,0x86,0xf0,0xb4,0xb1,0x9f,0xea,0xb7,0x5f,0xcd,0x1e,0x0b,0xee,0xa5, +0x4e,0x82,0x2e,0x4c,0x83,0xa2,0x1b,0x95,0x10,0xda,0x10,0x84,0x7c,0xa0,0xad,0x11, +0xe9,0xfc,0x97,0xd9,0xb0,0x48,0x78,0x9b,0xff,0xd7,0x68,0x1e,0xe2,0x56,0xc3,0x31, +0xd9,0xf1,0x7d,0x5c,0x93,0x98,0xf1,0xa4,0x72,0x01,0x28,0xef,0xa1,0xd5,0x00,0x8a, +0xd2,0x97,0x63,0x82,0xdf,0xdb,0x1d,0xdf,0xb2,0x86,0xfd,0x95,0xdc,0xc0,0xc6,0xb5, +0xb1,0x43,0x11,0x45,0xdc,0x02,0xe9,0x4e,0x04,0x11,0x3d,0xa5,0xe6,0x3d,0x30,0xb8, +0xd4,0x93,0x3b,0xb4,0x6f,0x58,0x93,0x21,0xde,0x90,0xb6,0xbb,0x50,0x7c,0x70,0x01, +0xc0,0x82,0x46,0x9c,0x84,0x2f,0xea,0x88,0x40,0x28,0x2e,0x27,0x65,0x5e,0xdf,0x3a, +0xf1,0x1a,0xee,0x60,0x73,0x81,0x82,0x51,0x11,0x38,0x0c,0x61,0xb5,0x7d,0x62,0x75, +0xff,0xa9,0x11,0x83,0xd8,0xfb,0x0c,0x19,0x23,0x3a,0x40,0x89,0x98,0x1f,0xc3,0x89, +0x3a,0xb1,0xea,0xad,0x32,0x6c,0xfe,0x43,0xa4,0x0b,0xa4,0x59,0x88,0x06,0xce,0x87, +0xaf,0xdf,0x0a,0x88,0xdb,0x16,0xa1,0xfe,0x50,0xe1,0x87,0xe8,0x00,0x4a,0x72,0x3a, +0xfb,0x5c,0xe7,0x2d,0xc8,0xe6,0x70,0x6c,0xf1,0x14,0xc6,0x79,0x1b,0x94,0x00,0xca, +0x74,0x0a,0x52,0x4f,0x21,0xf3,0x4d,0x71,0xd4,0xd5,0x5a,0xd5,0x1f,0xcc,0x0f,0x1b, +0x28,0xf7,0x48,0xf0,0xdd,0xb9,0x5c,0xce,0xcd,0x22,0x47,0xe8,0xb7,0x47,0xb3,0x2b, +0x51,0x05,0x7a,0x72,0xf9,0xc7,0xe4,0xcd,0x9c,0x3e,0xa2,0xbc,0x0a,0xb2,0xd7,0x32, +0xa9,0x1f,0x22,0x86,0xd8,0x7e,0x54,0xa6,0xa1,0x9b,0x8e,0x58,0xe2,0x41,0x83,0x33, +0x47,0xfd,0xa6,0x40,0xc4,0x8a,0x0d,0x61,0xc8,0xb0,0x1d,0xd2,0x62,0xf4,0x04,0x0b, +0x13,0x26,0x91,0xec,0xa4,0xe5,0x92,0x45,0x80,0x20,0x9d,0x62,0x62,0x20,0x95,0xa9 +}; + diff --git a/dao/data.h b/dao/data.h new file mode 100644 index 0000000..4fee88e --- /dev/null +++ b/dao/data.h @@ -0,0 +1,25 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __DATA_H__ +#define __DATA_H__ + +extern unsigned char SECTOR_ERROR_DATA[2448]; + +#endif diff --git a/dao/decodeSense.cc b/dao/decodeSense.cc new file mode 100644 index 0000000..b530ad6 --- /dev/null +++ b/dao/decodeSense.cc @@ -0,0 +1,98 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998, 1999 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * $Log: decodeSense.cc,v $ + * Revision 1.2 2007/12/29 12:26:34 poolshark + * Complete rewrite of native Linux SG driver for SG 3.0 using SG_IO ioctl. Code cleanup + * + * Revision 1.1.1.1 2000/02/05 01:38:06 llanero + * Uploaded cdrdao 1.1.3 with pre10 patch applied. + * + * Revision 1.1 1999/03/14 15:34:03 mueller + * Initial revision + * + */ + + +/* Sense code printing for direct SCSI implementations */ + +struct StringTable { + int code; + char *message; +}; + +static StringTable SENSE_KEYS[] = { + { 0x00, "NO SENSE" }, + { 0x01, "RECOVERED ERROR" }, + { 0x02, "NOT READY" }, + { 0x03, "MEDIUM ERROR" }, + { 0x04, "HARDWARE ERROR" }, + { 0x05, "ILLEGAL REQUEST" }, + { 0x06, "UNIT ATTENTION" }, + { 0x08, "BLANK CHECK" }, + { 0x09, "VENDOR SPECIFIC" }, + { 0x0b, "ABORTED COMMAND" }, + { 0x0d, "VOLUME OVERFLOW" }, + { 0x0e, "MISCOMPARE" }, + { 0x00, (char *)0 } +}; + +static const char *getFromStringTable(const StringTable *t, int code) +{ + while (t->message != NULL) { + if (t->code == code) { + return t->message; + } + + t += 1; + } + + return NULL; +} + +// Prints decoded sense message, if 'ignoreUnitAttention' is != 0 and sense +// code indicates unit attention nothing will be printed and 0 will be +// returned. +// return: 0: OK, no error +// 1: sense key indicates error +static int decodeSense(const unsigned char *buf, int len) +{ + int code = buf[2] & 0x0f; + const char *msg; + + if (code == 0) { + return 0; + } + + msg = getFromStringTable(SENSE_KEYS, code); + + log_message(-2, "SCSI command failed:"); + log_message(-2, " sense key 0x%x: %s.", code, + msg != NULL ? msg : "unknown code"); + + if (len > 0x0c && buf[7] != 0) { + log_message(-2, " additional sense code: 0x%x", buf[0x0c]); + } + if (len > 0x0d && buf[7] != 0) { + log_message(-2, " additional sense code qualifier: 0x%x", buf[0x0d]); + } + + return 1; +} diff --git a/dao/main.cc b/dao/main.cc new file mode 100644 index 0000000..1d3c25f --- /dev/null +++ b/dao/main.cc @@ -0,0 +1,3008 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <sys/types.h> + +#include <sys/wait.h> +#include <sys/utsname.h> +#include <pwd.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <fcntl.h> +#include <unistd.h> +#include <errno.h> +#include <iostream> +#include <fstream> +#include <stdarg.h> +#include <signal.h> +#include <ctype.h> +#include <list> +#include <string> +#include <assert.h> + +#include "log.h" +#include "util.h" +#include "Toc.h" +#include "ScsiIf.h" +#include "CdrDriver.h" +#include "dao.h" +#include "port.h" +#include "Settings.h" +#include "Cddb.h" +#include "TempFileManager.h" +#include "FormatConverter.h" + +#ifdef __CYGWIN__ +#define NOMINMAX +#include <windows.h> +#include <winioctl.h> +#define IOCTL_SCSI_BASE FILE_DEVICE_CONTROLLER +#define IOCTL_SCSI_GET_CAPABILITIES CTL_CODE(IOCTL_SCSI_BASE, 0x0404, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_SCSI_PASS_THROUGH_DIRECT CTL_CODE(IOCTL_SCSI_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_SCSI_GET_ADDRESS CTL_CODE(IOCTL_SCSI_BASE, 0x0406, METHOD_BUFFERED, FILE_ANY_ACCESS) +#endif + +#ifdef UNIXWARE +extern "C" { + extern int seteuid(uid_t); + extern int setegid(uid_t); +}; +#endif + +typedef enum { + UNKNOWN = -1, + SHOW_TOC, + SHOW_DATA, + READ_TEST, + SIMULATE, + WRITE, + READ_TOC, + DISK_INFO, + READ_CD, + TOC_INFO, + TOC_SIZE, + BLANK, + SCAN_BUS, + UNLOCK, + COPY_CD, + READ_CDDB, + MSINFO, + DRIVE_INFO, + DISCID, + SHOW_VERSION, + LAST_CMD, +} DaoCommand; + +typedef enum { + NO_DEVICE, + NEED_CDR_R, + NEED_CDR_W, + NEED_CDRW_W, +} DaoDeviceType; + +// The cmdInfo[] array provides information about each of cdrdao's +// main commands, including some of the basic processing steps +// required, almost as a simplified state machine. + +static struct { + // The command code, which is also the index into the array + DaoCommand cmd; + // The command-line string for this command + const char* str; + // What type of device does the command require, for device + // auto-detection. + DaoDeviceType requiredDevice; + // Does the command require a toc file + bool needTocFile; + // Does the command require to parse an existing toc file + bool tocParse; + // Does the command require to check the parsed toc file + bool tocCheck; +} cmdInfo[LAST_CMD] = { + { SHOW_TOC, "show-toc", NO_DEVICE, 1, 1, 0 }, + { SHOW_DATA, "show-data", NO_DEVICE, 1, 1, 1 }, + { READ_TEST, "read-test", NO_DEVICE, 1, 1, 1 }, + { SIMULATE, "simulate", NEED_CDR_W, 1, 1, 1 }, + { WRITE, "write", NEED_CDR_W, 1, 1, 1 }, + { READ_TOC, "read-toc", NEED_CDR_R, 1, 0, 1 }, + { DISK_INFO, "disk-info", NEED_CDR_R, 0, 0, 1 }, + { READ_CD, "read-cd", NEED_CDR_R, 1, 0, 1 }, + { TOC_INFO, "toc-info", NO_DEVICE, 1, 1, 1 }, + { TOC_SIZE, "toc-size", NO_DEVICE, 1, 1, 1 }, + { BLANK, "blank", NEED_CDRW_W, 0, 0, 1 }, + { SCAN_BUS, "scanbus", NO_DEVICE, 0, 0, 1 }, + { UNLOCK, "unlock", NEED_CDR_R, 0, 0, 1 }, + { COPY_CD, "copy", NEED_CDR_W, 0, 0, 1 }, + { READ_CDDB, "read-cddb", NO_DEVICE, 1, 1, 0 }, + { MSINFO, "msinfo", NEED_CDR_R, 0, 0, 1 }, + { DRIVE_INFO, "drive-info", NEED_CDR_R, 0, 0, 1 }, + { DISCID, "discid", NEED_CDR_R, 0, 0, 1 }, + { SHOW_VERSION, "version", NO_DEVICE, 0, 0, 0 }, +}; + +typedef struct { + + DaoCommand command; + + const char* progName; + const char* tocFile; + const char* driverId; + const char* sourceDriverId; + const char* scsiDevice; + const char* sourceScsiDevice; + const char* dataFilename; + const char* cddbLocalDbDir; + const char* tmpFileDir; + const char* cddbServerList; + + int readingSpeed; + int writingSpeed; + bool eject; + bool swap; + bool multiSession; + int verbose; + int session; + int fifoBuffers; + bool fastToc; + bool pause; + bool readRaw; + bool mode2Mixed; + bool remoteMode; + int remoteFd; + bool reload; + bool force; + int paranoiaMode; + bool onTheFly; + bool writeSimulate; + bool saveSettings; + int userCapacity; + bool fullBurn; + int cddbTimeout; + bool withCddb; + bool taoSource; + int taoSourceAdjust; + bool keepImage; + bool overburn; + int bufferUnderrunProtection; + bool writeSpeedControl; + bool keep; + bool printQuery; + + CdrDriver::BlankingMode blankingMode; + TrackData::SubChannelMode readSubchanMode; + +} DaoCommandLine; + +static bool isNT = false; + +#ifdef __CYGWIN__ +/*! \brief OS handle to the device + As obtained from CreateFile, used to apply OS level locking. +*/ +static HANDLE fh = NULL; +/*! \brief Device string + Like "\\\\.\\E:", used in CreateFile to obtain handle to device. +*/ +static char devstr[10]; +#endif + +static void printVersion() +{ + log_message(2, "Cdrdao version %s - (C) Andreas Mueller <andreas@daneb.de>", + VERSION); + + std::list<std::string> list; + int num = formatConverter.supportedExtensions(list); + + if (num) { + std::string msg = "Format converter enabled for extensions:"; + std::list<std::string>::iterator i = list.begin(); + for (;i != list.end(); i++) { + msg += " "; + msg += (*i); + } + log_message(3, msg.c_str()); + } +} + +static void setOptionDefaults(DaoCommandLine* options) +{ + memset(options, 0, sizeof(DaoCommandLine)); + + options->readingSpeed = -1; + options->writingSpeed = -1; + options->command = UNKNOWN; + options->verbose = 2; + options->session = 1; + options->pause = true; + options->mode2Mixed = true; + options->remoteFd = -1; + options->paranoiaMode = 3; + options->cddbTimeout = 60; + options->taoSourceAdjust = -1; + options->bufferUnderrunProtection = 1; + options->writeSpeedControl = true; + options->keep = false; + options->printQuery = false; +#if defined(__FreeBSD__) + options->fifoBuffers = 20; +#else + options->fifoBuffers = 32; +#endif + options->cddbServerList = "freedb.freedb.org freedb.freedb.org" + ":/~cddb/cddb.cgi uk.freedb.org uk.freedb.org:/~cddb/cddb.cgi" + "cz.freedb.org cz.freedb.org:/~cddb/cddb.cgi"; + + options->blankingMode = CdrDriver::BLANK_MINIMAL; + options->readSubchanMode = TrackData::SUBCHAN_NONE; +} + +static void printUsage(DaoCommandLine* options) +{ + switch (options->command) { + + case UNKNOWN: + log_message(0, "\nUsage: %s <command> [options] [toc-file]", + options->progName); + log_message(0, +"command:\n" +" show-toc - prints out toc and exits\n" +" toc-info - prints out short toc-file summary\n" +" toc-size - prints total number of blocks for toc\n" +" read-toc - create toc file from audio CD\n" +" read-cd - create toc and rip audio data from CD\n" +" read-cddb - contact CDDB server and add data as CD-TEXT to toc-file\n" +" show-data - prints out audio data and exits\n" +" read-test - reads all audio files and exits\n" +" disk-info - shows information about inserted medium\n" +" discid - prints out CDDB information\n" +" msinfo - shows multi session info, output is suited for scripts\n" +" drive-info - shows drive information\n" +" unlock - unlock drive after failed writing\n" +" blank - blank a CD-RW\n" +" scanbus - scan for devices\n" +" simulate - shortcut for 'write --simulate'\n" +" write - writes CD\n" +" copy - copies CD\n"); + + log_message(0, "\n Try '%s <command> -h' to get a list of available " + "options\n", options->progName); + break; + + case SHOW_TOC: + log_message(0, "\nUsage: %s show-toc [options] toc-file", + options->progName); + log_message(0, +"options:\n" +" --tmpdir <path> - sets directory for temporary wav files\n" +" --keep - keep generated temp wav files after exit\n" +" -v # - sets verbose level\n"); + break; + + case SHOW_DATA: + log_message(0, "\nUsage: %s show-data [--swap] [-v #] toc-file\n", + options->progName); + break; + + case READ_TEST: + log_message(0, "\nUsage: %s read-test [-v #] toc-file\n", + options->progName); + break; + + case SIMULATE: + log_message(0, "\nUsage: %s simulate [options] toc-file", + options->progName); + log_message(0, +"options:\n" +" --device [proto:]{<x,y,z>|device} - sets SCSI device of CD-writer\n" +" --driver <id> - force usage of specified driver\n" +" --speed <writing-speed> - selects writing speed\n" +" --multi - session will not be closed\n" +" --overburn - allow to overburn a medium\n" +" --full-burn - force burning to the outer disk edge\n" +" with '--driver generic-mmc-raw'\n" +" --capacity <minutes> - sets disk capacity for '--full-burn'\n" +" you must specify this when using blanks bigger\n" +" than 80 min. (90,99,etc.)\n" +" because they seems like 80 min. blanks\n" +" --eject - ejects cd after simulation\n" +" --swap - swap byte order of audio files\n" +" --buffers # - sets fifo buffer size (min. 10)\n" +" --reload - reload the disk if necessary for writing\n" +" --force - force execution of operation\n" +" --tmpdir <path> - sets directory for temporary wav files\n" +" --keep - keep generated temp wav files after exit\n" +" -v # - sets verbose level\n" +" -n - no pause before writing\n"); + break; + + case WRITE: + log_message(0, "\nUsage: %s write [options] toc-file", options->progName); + log_message(0, +"options:\n" +" --device [proto:]{<x,y,z>|device} - sets SCSI device of CD-writer\n" +" --driver <id> - force usage of specified driver\n" +" --simulate - just perform a write simulation\n" +" --speed <writing-speed> - selects writing speed\n" +" --multi - session will not be closed\n" +" --buffer-under-run-protection #\n" +" - 0: disable buffer under run protection\n" +" 1: enable buffer under run protection (default)\n" +" --write-speed-control # - 0: disable writing speed control by the drive\n" +" 1: enable writing speed control (default)\n" +" --overburn - allow to overburn a medium\n" +" --full-burn - force burning to the outer disk edge\n" +" with '--driver generic-mmc-raw'\n" +" --capacity <minutes> - sets disk capacity for '--full-burn'\n" +" you must specify this when using blanks bigger\n" +" than 80 min. (90,99,etc.)\n" +" because they seems like 80 min. blanks\n" +" --eject - ejects cd after writing or simulation\n" +" --swap - swap byte order of audio files\n" +" --buffers # - sets fifo buffer size (min. 10)\n" +" --reload - reload the disk if necessary for writing\n" +" --force - force execution of operation\n" +" --tmpdir <path> - sets directory for temporary wav files\n" +" --keep - keep generated temp wav files after exit\n" +" -v # - sets verbose level\n" +" -n - no pause before writing\n"); + break; + + case READ_TOC: + log_message(0, "\nUsage: %s read-toc [options] toc-file", + options->progName); + log_message(0, +"options:\n" +" --device [proto:]{<x,y,z>|device} - sets SCSI device of CD-ROM reader\n" +" --driver <id> - force usage of specified driver for source device\n" +" --datafile <filename> - name of data file placed in toc-file\n" +" --session # - select session\n" +" --fast-toc - do not extract pre-gaps and index marks\n" +" --read-raw - select raw sectors modes for data tracks\n" +" --no-mode2-mixed - don't switch to mode2_mixed\n" +" --rspeed <read-speed> - selects reading speed\n" +" --read-subchan <mode> - defines sub-channel reading mode\n" +" <mode> = rw | rw_raw\n" +" --tao-source - indicate that source CD was written in TAO mode\n" +" --tao-source-adjust # - # of link blocks for TAO source CDs (def. 2)\n" +" --with-cddb - retrieve CDDB CD-TEXT data while copying\n" +" --cddb-servers <list> - sets space separated list of CDDB servers\n" +" --cddb-timeout # - timeout in seconds for CDDB server communication\n" +" --cddb-directory <path> - path to local CDDB directory where fetched\n" +" CDDB records will be stored\n" +" --force - force execution of operation\n" +" -v # - sets verbose level\n"); + break; + + case DISK_INFO: + log_message(0, "\nUsage: %s disk-info [options]", options->progName); + log_message(0, +"options:\n" +" --device [proto:]{<x,y,z>|device} - sets SCSI device of CD-writer\n" +" --driver <id> - force usage of specified driver\n" +" -v # - sets verbose level\n"); + break; + + case DISCID: + log_message(0, "\nUsage: %s discid [options]", options->progName); + log_message(0, +"options:\n" +" --device [proto:]{<x,y,z>|device} - sets SCSI device of CD-writer\n" +" --driver <id> - force usage of specified driver\n" +" --cddb-servers <list> - sets space separated list of CDDB servers\n" +" --cddb-timeout # - timeout in seconds for CDDB server communication\n" +" --cddb-directory <path> - path to local CDDB directory where fetched\n" +" CDDB records will be stored\n" +" --query-string - prints out CDDB query only\n" +" -v # - sets verbose level\n"); + break; + + case READ_CD: + log_message(0, "\nUsage: %s read-cd [options] toc-file", + options->progName); + log_message(0, +"options:\n" +" --device [proto:]{<x,y,z>|device} - sets SCSI device of CD-ROM reader\n" +" --driver <id> - force usage of specified driver for source device\n" +" --datafile <filename> - name of data file placed in toc-file\n" +" --session # - select session\n" +" --fast-toc - do not extract pre-gaps and index marks\n" +" --read-raw - read raw data sectors (including L-EC data)\n" +" --no-mode2-mixed - don't switch to mode2_mixed\n" +" --rspeed <read-speed> - selects reading speed\n" +" --read-subchan <mode> - defines sub-channel reading mode\n" +" <mode> = rw | rw_raw\n" +" --tao-source - indicate that source CD was written in TAO mode\n" +" --tao-source-adjust # - # of link blocks for TAO source CDs (def. 2)\n" +" --paranoia-mode # - DAE paranoia mode (0..3)\n" +" --with-cddb - retrieve CDDB CD-TEXT data while copying\n" +" --cddb-servers <list> - sets space separated list of CDDB servers\n" +" --cddb-timeout # - timeout in seconds for CDDB server communication\n" +" --cddb-directory <path> - path to local CDDB directory where fetched\n" +" CDDB records will be stored\n" +" --force - force execution of operation\n" +" -v # - sets verbose level\n"); + break; + + case TOC_INFO: + log_message(0, "\nUsage: %s toc-info [options] toc-file", + options->progName); + log_message(0, +"options:\n" +" --tmpdir <path> - sets directory for temporary wav files\n" +" --keep - keep generated temp wav files after exit\n" +" -v # - sets verbose level\n"); + break; + + case TOC_SIZE: + log_message(0, "\nUsage: %s toc-size [options] toc-file", + options->progName); + log_message(0, +"options:\n" +" --tmpdir <path> - sets directory for temporary wav files\n" +" --keep - keep generated temp wav files after exit\n" +" -v # - sets verbose level\n"); + break; + + case BLANK: + log_message(0, "\nUsage: %s blank [options]", options->progName); + log_message(0, +"options:\n" +" --device [proto:]{<x,y,z>|device} - sets SCSI device of CD-writer\n" +" --driver <id> - force usage of specified driver\n" +" --speed <writing-speed> - selects writing speed\n" +" --blank-mode <mode> - blank mode ('full', 'minimal')\n" +" --eject - ejects cd after writing or simulation\n" +" -v # - sets verbose level\n"); + break; + + case SCAN_BUS: + log_message(0, "\nUsage: %s scan-bus [-v #]\n", options->progName); + break; + + case UNLOCK: + log_message(0, "\nUsage: %s unlock [options]", options->progName); + log_message(0, +"options:\n" +" --device [proto:]{<x,y,z>|device} - sets SCSI device of CD-writer\n" +" --driver <id> - force usage of specified driver\n" +" --reload - reload the disk if necessary for writing\n" +" --eject - ejects cd after unlocking\n" +" -v # - sets verbose level\n"); + break; + + case DRIVE_INFO: + log_message(0, "\nUsage: %s drive-info [options]", options->progName); + log_message(0, +"options:\n" +" --device [proto:]{<x,y,z>|device} - sets SCSI device of CD-writer\n" +" --driver <id> - force usage of specified driver\n" +" -v # - sets verbose level\n"); + break; + + case COPY_CD: + log_message(0, "\nUsage: %s copy [options]", options->progName); + log_message(0, +"options:\n" +" --device [proto:]{<x,y,z>|device} - sets SCSI device of CD-writer\n" +" --source-device {<x,y,z>|device} - sets SCSI device of CD-ROM reader\n" +" --driver <id> - force usage of specified driver\n" +" --source-driver <id> - force usage of specified driver for source device\n" +" --simulate - just perform a copy simulation\n" +" --speed <writing-speed> - selects writing speed\n" +" --rspeed <read-speed> - selects reading speed\n" +" --multi - session will not be closed\n" +" --buffer-under-run-protection #\n" +" - 0: disable buffer under run protection\n" +" 1: enable buffer under run protection (default)\n" +" --write-speed-control # - 0: disable writing speed control by the drive\n" +" 1: enable writing speed control (default)\n" +" --overburn - allow to overburn a medium\n" +" --full-burn - force burning to the outer disk edge\n" +" with '--driver generic-mmc-raw'\n" +" --capacity <minutes> - sets disk capacity for '--full-burn'\n" +" you must specify this when using blanks bigger\n" +" than 80 min. (90,99,etc.)\n" +" because they seems like 80 min. blanks\n" +" --eject - ejects cd after writing or simulation\n" +" --swap - swap byte order of audio files\n" +" --on-the-fly - perform on-the-fly copy, no image file is created\n" +" --datafile <filename> - name of temporary data file\n" +" --buffers # - sets fifo buffer size (min. 10)\n" +" --session # - select session\n" +" --fast-toc - do not extract pre-gaps and index marks\n" +" --read-subchan <mode> - defines sub-channel reading mode\n" +" <mode> = rw | rw_raw\n" +" --keepimage - the image will not be deleted after copy\n" +" --tao-source - indicate that source CD was written in TAO mode\n" +" --tao-source-adjust # - # of link blocks for TAO source CDs (def. 2)\n" +" --paranoia-mode # - DAE paranoia mode (0..3)\n" +" --reload - reload the disk if necessary for writing\n" +" --force - force execution of operation\n" +" --with-cddb - retrieve CDDB CD-TEXT data while copying\n" +" --cddb-servers <list> - sets space separated list of CDDB servers\n" +" --cddb-timeout # - timeout in seconds for CDDB server communication\n" +" --cddb-directory <path> - path to local CDDB directory where fetched\n" +" CDDB records will be stored\n" +" -v # - sets verbose level\n" +" -n - no pause before writing\n"); + break; + + case READ_CDDB: + log_message(0, "\nUsage: %s read-cddb [options] toc-file", + options->progName); + log_message(0, +"options:\n" +" --cddb-servers <list> - sets space separated list of CDDB servers\n" +" --cddb-timeout # - timeout in seconds for CDDB server communication\n" +" --cddb-directory <path> - path to local CDDB directory where fetched\n" +" CDDB records will be stored\n" +" -v # - sets verbose level\n"); + break; + + case MSINFO: + log_message(0, "\nUsage: %s msinfo [options]", options->progName); + log_message(0, +"options:\n" +" --device [proto:]{<x,y,z>|device} - sets SCSI device of CD-writer\n" +" --driver <id> - force usage of specified driver\n" +" --reload - reload the disk if necessary for writing\n" +" -v # - sets verbose level\n"); + break; + + default: + log_message(0, "Sorry, no help available for command %d :-(\n", + options->command); + break; + } + +} + +static void importSettings(DaoCommandLine* opts, Settings* settings) +{ + const char *sval; + const int *ival; + + DaoCommand cmd = opts->command; + + if (cmd == SIMULATE || cmd == WRITE || cmd == COPY_CD) { + if ((sval = settings->getString(Settings::setWriteDriver)) != NULL) { + opts->driverId = strdupCC(sval); + } + + if ((sval = settings->getString(Settings::setWriteDevice)) != NULL) { + opts->scsiDevice = strdupCC(sval); + } + + if ((ival = settings->getInteger(Settings::setWriteSpeed)) != NULL && + *ival >= 0) { + opts->writingSpeed = *ival; + } + + if ((ival = settings->getInteger(Settings::setWriteBuffers)) != NULL && + *ival >= 10) { + opts->fifoBuffers = *ival; + } + if ((ival = settings->getInteger(Settings::setUserCapacity)) != NULL && + *ival >= 0) { + opts->userCapacity = *ival; + } + if ((ival = settings->getInteger(Settings::setFullBurn)) != NULL && + *ival >= 0) { + opts->fullBurn = *ival; + } + } + + if (cmd == READ_CD || cmd == READ_TOC) { + if ((sval = settings->getString(Settings::setReadDriver)) != NULL) { + opts->driverId = strdupCC(sval); + } + + if ((sval = settings->getString(Settings::setReadDevice)) != NULL) { + opts->scsiDevice = strdupCC(sval); + } + + if ((ival = settings->getInteger(Settings::setReadParanoiaMode)) != NULL && + *ival >= 0) { + opts->paranoiaMode = *ival; + } + } + + if (cmd == COPY_CD) { + if ((sval = settings->getString(Settings::setReadDriver)) != NULL) { + opts->sourceDriverId = strdupCC(sval); + } + + if ((sval = settings->getString(Settings::setReadDevice)) != NULL) { + opts->sourceScsiDevice = strdupCC(sval); + } + + if ((ival = settings->getInteger(Settings::setReadParanoiaMode)) != NULL && + *ival >= 0) { + opts->paranoiaMode = *ival; + } + } + + if (cmd == BLANK || cmd == DISK_INFO || cmd == MSINFO || cmd == UNLOCK || + cmd == DISCID || cmd == DRIVE_INFO) { + if ((sval = settings->getString(Settings::setWriteDriver)) != NULL) { + opts->driverId = strdupCC(sval); + } + + if ((sval = settings->getString(Settings::setWriteDevice)) != NULL) { + opts->scsiDevice = strdupCC(sval); + } + } + + if (cmd == READ_CDDB || cmd == COPY_CD || cmd == READ_TOC || + cmd == READ_CD || cmd == DISCID) { + if ((sval = settings->getString(Settings::setCddbServerList)) != NULL) { + opts->cddbServerList = strdupCC(sval); + } + + if ((sval = settings->getString(Settings::setCddbDbDir)) != NULL) { + opts->cddbLocalDbDir = strdupCC(sval); + } + + if ((ival = settings->getInteger(Settings::setCddbTimeout)) != NULL && + *ival > 0) { + opts->cddbTimeout = *ival; + } + if ((sval = settings->getString(Settings::setTmpFileDir)) != NULL) { + opts->tmpFileDir = strdupCC(sval); + } + } + + if ((ival = settings->getInteger(Settings::setReadSpeed)) != NULL && + *ival >= 0) { + opts->readingSpeed = *ival; + } +} + +static void exportSettings(DaoCommandLine* opts, Settings* settings) +{ + DaoCommand cmd = opts->command; + + if (cmd == SIMULATE || cmd == WRITE || cmd == COPY_CD) { + if (opts->driverId != NULL) + settings->set(Settings::setWriteDriver, opts->driverId); + + if (opts->scsiDevice != NULL) + settings->set(Settings::setWriteDevice, opts->scsiDevice); + + if (opts->writingSpeed >= 0) { + settings->set(Settings::setWriteSpeed, opts->writingSpeed); + } + + if (opts->fifoBuffers > 0) { + settings->set(Settings::setWriteBuffers, opts->fifoBuffers); + } + + if (opts->fullBurn > 0) { + settings->set(Settings::setFullBurn, opts->fullBurn); + } + + if (opts->userCapacity > 0) { + settings->set(Settings::setUserCapacity, opts->userCapacity); + } + } + + if (cmd == READ_CD) { + if (opts->driverId != NULL) + settings->set(Settings::setReadDriver, opts->driverId); + + if (opts->scsiDevice != NULL) + settings->set(Settings::setReadDevice, opts->scsiDevice); + + settings->set(Settings::setReadParanoiaMode, opts->paranoiaMode); + } + + if (cmd == COPY_CD) { + if (opts->sourceDriverId != NULL) + settings->set(Settings::setReadDriver, opts->sourceDriverId); + + if (opts->sourceScsiDevice != NULL) + settings->set(Settings::setReadDevice, opts->sourceScsiDevice); + + settings->set(Settings::setReadParanoiaMode, opts->paranoiaMode); + } + + if (cmd == BLANK || cmd == DISK_INFO || cmd == MSINFO || cmd == UNLOCK || + cmd == DISCID || cmd == DRIVE_INFO) { + if (opts->driverId != NULL) + settings->set(Settings::setWriteDriver, opts->driverId); + + if (opts->scsiDevice != NULL) + settings->set(Settings::setWriteDevice, opts->scsiDevice); + } + + if (cmd == READ_CDDB || + (opts->withCddb && (cmd == COPY_CD || cmd == READ_TOC || + cmd == READ_CD || cmd == DISCID))) { + if (opts->cddbServerList != NULL) { + settings->set(Settings::setCddbServerList, opts->cddbServerList); + } + + if (opts->cddbLocalDbDir != NULL) { + settings->set(Settings::setCddbDbDir, opts->cddbLocalDbDir); + } + + if (opts->cddbTimeout > 0) { + settings->set(Settings::setCddbTimeout, opts->cddbTimeout); + } + } + + if (opts->readingSpeed >= 0) { + settings->set(Settings::setReadSpeed, opts->readingSpeed); + } + + if (cmd == SHOW_TOC || cmd == SIMULATE || cmd == WRITE || + cmd == TOC_INFO || cmd == TOC_SIZE) { + settings->set(Settings::setTmpFileDir, opts->tmpFileDir); + } +} + +static int parseCmdline(int argc, char **argv, DaoCommandLine* opts, + Settings* settings) +{ + int i; + + if (argc < 1) { + return 1; + } + + for (i = 0; i < LAST_CMD; i++) { + if (strcmp(*argv, cmdInfo[i].str) == 0) { + opts->command = cmdInfo[i].cmd; + break; + } + } + + if (opts->command == UNKNOWN) { + log_message(-2, "Illegal command: %s", *argv); + return 1; + } + + // retrieve settings from $HOME/.cdrdao for given command + importSettings(opts, settings); + + argc--, argv++; + + while (argc > 0 && (*argv)[0] == '-') { + + if ((*argv)[1] != '-') { + switch ((*argv)[1]) { + case 'h': + return 1; + + case 'v': + if ((*argv)[2] != 0) { + opts->verbose = atoi((*argv) + 2); + } else { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + opts->verbose = atoi(argv[1]); + argc--, argv++; + } + } + break; + + case 'n': + opts->pause = false; + break; + + default: + log_message(-2, "Illegal option: %s", *argv); + return 1; + break; + } + } + else { + + if (strcmp((*argv) + 2, "help") == 0) { + return 1; + } + if (strcmp((*argv) + 2, "device") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + opts->scsiDevice = argv[1]; + argc--, argv++; + } + } + else if (strcmp((*argv) + 2, "source-device") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + opts->sourceScsiDevice = argv[1]; + argc--, argv++; + } + } + else if (strcmp((*argv) + 2, "rspeed") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + opts->readingSpeed = atol(argv[1]); + if (opts->readingSpeed < 0) { + log_message(-2, "Illegal reading speed: %s", argv[1]); + return 1; + } + argc--, argv++; + } + } + else if (strcmp((*argv) + 2, "speed") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + opts->writingSpeed = atol(argv[1]); + if (opts->writingSpeed < 0) { + log_message(-2, "Illegal writing speed: %s", argv[1]); + return 1; + } + argc--, argv++; + } + } + else if (strcmp((*argv) + 2, "capacity") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + opts->userCapacity = atol(argv[1]); + if (opts->userCapacity < 0) { + log_message(-2, "Illegal disk capacity: %s minutes", + argv[1]); + return 1; + } + argc--, argv++; + } + } + else if (strcmp((*argv) + 2, "blank-mode") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + if (strcmp(argv[1], "full") == 0) { + opts->blankingMode = CdrDriver::BLANK_FULL; + } else if (strcmp(argv[1], "minimal") == 0) { + opts->blankingMode = CdrDriver::BLANK_MINIMAL; + } else { + log_message(-2, "Illegal blank mode. Valid values: full minimal"); + return 1; + } + argc--, argv++; + } + } + else if (strcmp((*argv) + 2, "paranoia-mode") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + opts->paranoiaMode= atol(argv[1]); + if (opts->paranoiaMode < 0) { + log_message(-2, "Illegal paranoia mode: %s", argv[1]); + return 1; + } + argc--, argv++; + } + } + else if (strcmp((*argv) + 2, "remote") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + opts->remoteFd = atol(argv[1]); + if (opts->remoteFd < 0) { + log_message(-2, "Invalid remote message file descriptor: %s", argv[1]); + return 1; + } + opts->remoteMode = true; + argc--, argv++; + } + } + else if (strcmp((*argv) + 2, "eject") == 0) { + opts->eject = true; + } + else if (strcmp((*argv) + 2, "swap") == 0) { + opts->swap = true; + } + else if (strcmp((*argv) + 2, "query-string") == 0) { + opts->printQuery = true; + } + else if (strcmp((*argv) + 2, "multi") == 0) { + opts->multiSession = true; + } + else if (strcmp((*argv) + 2, "simulate") == 0) { + opts->writeSimulate = true; + } + else if (strcmp((*argv) + 2, "fast-toc") == 0) { + opts->fastToc = true; + } + else if (strcmp((*argv) + 2, "read-raw") == 0) { + opts->readRaw = true; + } + else if (strcmp((*argv) + 2, "no-mode2-mixed") == 0) { + opts->mode2Mixed = false; + } + else if (strcmp((*argv) + 2, "reload") == 0) { + opts->reload = true; + } + else if (strcmp((*argv) + 2, "force") == 0) { + opts->force = true; + } + else if (strcmp((*argv) + 2, "keep") == 0) { + opts->keep = true; + } + else if (strcmp((*argv) + 2, "on-the-fly") == 0) { + opts->onTheFly = true; + } + else if (strcmp((*argv) + 2, "save") == 0) { + opts->saveSettings = true; + } + else if (strcmp((*argv) + 2, "tao-source") == 0) { + opts->taoSource = true; + } + else if (strcmp((*argv) + 2, "keepimage") == 0) { + opts->keepImage = true; + } + else if (strcmp((*argv) + 2, "overburn") == 0) { + opts->overburn = true; + } + else if (strcmp((*argv) + 2, "full-burn") == 0) { + opts->fullBurn = true; + } + else if (strcmp((*argv) + 2, "with-cddb") == 0) { + opts->withCddb = true; + } + else if (strcmp((*argv) + 2, "driver") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + opts->driverId = argv[1]; + argc--, argv++; + } + } + else if (strcmp((*argv) + 2, "source-driver") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + opts->sourceDriverId = argv[1]; + argc--, argv++; + } + } + else if (strcmp((*argv) + 2, "datafile") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + opts->dataFilename = argv[1]; + argc--, argv++; + } + } + else if (strcmp((*argv) + 2, "buffers") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + opts->fifoBuffers = atoi(argv[1]); + argc--, argv++; + } + } + else if (strcmp((*argv) + 2, "session") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + opts->session = atoi(argv[1]); + argc--, argv++; + if (opts->session < 1) { + log_message(-2, "Illegal session number: %d", + opts->session); + return 1; + } + } + } + else if (strcmp((*argv) + 2, "cddb-servers") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + opts->cddbServerList = argv[1]; + argc--, argv++; + } + } + else if (strcmp((*argv) + 2, "cddb-directory") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + opts->cddbLocalDbDir = argv[1]; + argc--, argv++; + } + } + else if (strcmp((*argv) + 2, "tmpdir") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + opts->tmpFileDir = argv[1]; + argc--, argv++; + } + } + else if (strcmp((*argv) + 2, "cddb-timeout") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + opts->cddbTimeout = atoi(argv[1]); + argc--, argv++; + if (opts->cddbTimeout < 1) { + log_message(-2, "Illegal CDDB timeout: %d", + opts->cddbTimeout); + return 1; + } + } + } + else if (strcmp((*argv) + 2, "tao-source-adjust") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + opts->taoSourceAdjust = atoi(argv[1]); + argc--, argv++; + if (opts->taoSourceAdjust < 0 || + opts->taoSourceAdjust >= 100) { + log_message(-2, "Illegal number of TAO link blocks: %d", + opts->taoSourceAdjust); + return 1; + } + } + } + else if (strcmp((*argv) + 2, "buffer-under-run-protection") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + int val = atoi(argv[1]); + argc--, argv++; + if (val < 0 || val > 1) { + log_message(-2, "Illegal value for option --buffer-under-run-protection: %d", val); + return 1; + } + opts->bufferUnderrunProtection = val; + } + } + else if (strcmp((*argv) + 2, "write-speed-control") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + int val = atoi(argv[1]); + argc--, argv++; + if (val < 0 || val > 1) { + log_message(-2, "Illegal value for option --write-speed-control: %d", val); + return 1; + } + opts->writeSpeedControl = val; + } + } + else if (strcmp((*argv) + 2, "read-subchan") == 0) { + if (argc < 2) { + log_message(-2, "Missing argument after: %s", *argv); + return 1; + } else { + if (strcmp(argv[1], "rw") == 0) { + opts->readSubchanMode = TrackData::SUBCHAN_RW; + } else if (strcmp(argv[1], "rw_raw") == 0) { + opts->readSubchanMode = TrackData::SUBCHAN_RW_RAW; + } else { + log_message(-2, "Invalid argument after %s: %s", + argv[0], argv[1]); + return 1; + } + + argc--, argv++; + } + } + else { + log_message(-2, "Illegal option: %s", *argv); + return 1; + } + } + + argc--, argv++; + } + + if (cmdInfo[opts->command].needTocFile) { + if (argc < 1) { + log_message(-2, "Missing toc-file."); + return 1; + } else if (argc > 1) { + log_message(-2, "Expecting only one toc-file."); + return 1; + } + opts->tocFile = *argv; + } + + + return 0; +} + +// Commit settings to overall system. Export them. +static void commitSettings(DaoCommandLine* opts, Settings* settings, + const char* settingsPath) +{ + if (opts->tmpFileDir) + tempFileManager.setTempDirectory(opts->tmpFileDir); + + tempFileManager.setKeepTemps(opts->keep); + + if (opts->saveSettings && settingsPath != NULL) { + // If we're saving our settings, give up root privileges and + // exit. The --save option is only compiled in if setreuid() is + // available (because it could be used for a local root exploit). + if (giveUpRootPrivileges()) { + exportSettings(opts, settings); + settings->write(settingsPath); + } + exit(0); + } +} + +// Selects driver for device of 'scsiIf'. +static CdrDriver *selectDriver(DaoCommand cmd, ScsiIf *scsiIf, + const char *driverId) +{ + unsigned long options = 0; + CdrDriver *ret = NULL; + + if (driverId != NULL) { + char *s = strdupCC(driverId); + char *p = strchr(s, ':'); + + if (p != NULL) { + *p = 0; + options = strtoul(p + 1, NULL, 0); + } + + ret = CdrDriver::createDriver(s, options, scsiIf); + + if (ret == NULL) { + log_message(-2, "%s: Illegal driver ID, available drivers:", s); + CdrDriver::printDriverIds(); + } + + delete[] s; + } + else { + const char *id = NULL; + + // for reading commands try to select a special read driver first: + if (cmd == READ_TOC || cmd == READ_CD) + id = CdrDriver::selectDriver(0, scsiIf->vendor(), scsiIf->product(), + &options); + + // try to select a write driver + if (id == NULL) + id = CdrDriver::selectDriver(1, scsiIf->vendor(), scsiIf->product(), + &options); + // if no driver is selected, yet, try to select a read driver for + // disk-info + if (id == NULL && (cmd == DISK_INFO || cmd == MSINFO || cmd == DISCID)) + id = CdrDriver::selectDriver(0, scsiIf->vendor(), scsiIf->product(), + &options); + // Still no driver, try to autodetect one + if (id == NULL) + id = CdrDriver::detectDriver(scsiIf, &options); + + if (id != NULL) { + ret = CdrDriver::createDriver(id, options, scsiIf); + } + else { + log_message(0, ""); + log_message(-2, "No driver found for '%s %s', available drivers:\n", + scsiIf->vendor(), scsiIf->product()); + CdrDriver::printDriverIds(); + + log_message(0, "\nFor all recent recorder models either the 'generic-mmc' or"); + log_message(0, "the 'generic-mmc-raw' driver should work."); + log_message(0, "Use option '--driver' to force usage of a driver, e.g.: --driver generic-mmc"); + } + } + + return ret; +} + +const char* getDefaultDevice(DaoDeviceType req) +{ + int i, len; + static char buf[128]; + + // This function should not be called if the command issues + // doesn't actually require a device. + assert(req != NO_DEVICE); + + ScsiIf::ScanData* sdata = ScsiIf::scan(&len); + + if (sdata) { + for (i = 0; i < len; i++) { + + ScsiIf testif(sdata[i].dev.c_str()); + + if (testif.init() != 0) { + continue; + } + bool rr, rw, rwr, rww; + + if (!testif.checkMmc(&rr, &rw, &rwr, &rww)) + continue; + + if (req == NEED_CDR_R && !rr) + continue; + if (req == NEED_CDR_W && !rw) + continue; + if (req == NEED_CDRW_W && !rww) + continue; + + strncpy(buf, sdata[i].dev.c_str(), 128); + delete[] sdata; + return buf; + } + delete[] sdata; + } + + return NULL; +} + +#define MAX_RETRY 10 +static CdrDriver *setupDevice(DaoCommand cmd, const char *scsiDevice, + const char *driverId, int initDevice, + int checkReady, int checkEmpty, + int readingSpeed, + bool remote, bool reload) +{ + ScsiIf *scsiIf = NULL; + CdrDriver *cdr = NULL; + DiskInfo *di = NULL; + int inquiryFailed = 0; + int retry = 0; + int initTries = 2; + int ret = 0; + + scsiIf = new ScsiIf(scsiDevice); + + switch (scsiIf->init()) { + case 1: + log_message(-2, "Please use option '--device {[proto:]bus,id,lun}|device'" + ", e.g. " + "--device 0,6,0, --device ATA:0,0,0 or --device /dev/cdrom"); + delete scsiIf; + return NULL; + break; + case 2: + inquiryFailed = 1; + break; + } + + log_message(2, "%s: %s %s\tRev: %s", scsiDevice, scsiIf->vendor(), + scsiIf->product(), scsiIf->revision()); + + + if (inquiryFailed && driverId == NULL) { + log_message(-2, "Inquiry failed and no driver id is specified."); + log_message(-2, "Please use option --driver to specify a driver id."); + delete scsiIf; + return NULL; + } + + if ((cdr = selectDriver(cmd, scsiIf, driverId)) == NULL) { + delete scsiIf; + return NULL; + } + + log_message(2, "Using driver: %s (options 0x%04lx)\n", cdr->driverName(), + cdr->options()); + + if (!initDevice) + return cdr; + + while (initTries > 0) { + // clear unit attention + cdr->rezeroUnit(0); + if (readingSpeed >= 0) { + if (!cdr->rspeed(readingSpeed)) { + log_message(-2, "Reading speed %d is not supported by device.", + readingSpeed); + exit(1); + } + } + + if (checkReady) { + retry = 0; + + while (retry < MAX_RETRY) { + if (retry++) + sleep(3); + if (!(ret = cdr->testUnitReady(1))) + break; + if (ret == 1) { + delete cdr; + delete scsiIf; + return NULL; + } + log_message(-1, "Unit not ready, still trying..."); + } + + if (ret != 0) { + log_message(-2, "Unit not ready, giving up."); + delete cdr; + delete scsiIf; + return NULL; + } + + cdr->rezeroUnit(0); + + if (readingSpeed >= 0) { + log_message(0, "Setting reading speed %d.", + readingSpeed); + if (!cdr->rspeed(readingSpeed)) { + log_message(-2, "Reading speed %d is not supported by device.", + readingSpeed); + exit(1); + } + } + + if ((di = cdr->diskInfo()) == NULL) { + log_message(-2, "Cannot get disk information."); + delete cdr; + delete scsiIf; + return NULL; + } + + if (checkEmpty && initTries == 2 && + di->valid.empty && !di->empty && + (!di->valid.append || !di->append) && + (!remote || reload)) { + if (!reload) { + log_message(0, "Disk seems to be written - hit return to reload disk."); + fgetc(stdin); + } + + log_message(1, "Reloading disk..."); + + if (cdr->loadUnload(1) != 0) { + delete cdr; + delete scsiIf; + return NULL; + } + + sleep(1); + cdr->rezeroUnit(0); // clear unit attention + + if (cdr->loadUnload(0) != 0) { + log_message(-2, "Cannot load tray."); + delete cdr; + delete scsiIf; + return NULL; + } + + initTries = 1; + } + else { + initTries = 0; + } + } + else { + initTries = 0; + } + } + +#ifdef __CYGWIN__ +/* Experimental device locking code. Should work on Win2k/NT only. */ + typedef struct _SCSI_ADDRESS { + ULONG Length; + UCHAR PortNumber; + UCHAR PathId; + UCHAR TargetId; + UCHAR Lun; + }SCSI_ADDRESS, *PSCSI_ADDRESS; + + OSVERSIONINFO osinfo; + osinfo.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); + if ((GetVersionEx (&osinfo)) && (osinfo.dwPlatformId == VER_PLATFORM_WIN32_NT)) + isNT = true; + if (isNT) { + char devletter; + SCSI_ADDRESS sa; + DWORD bytes; + bool gotit = false; + int ha,id,lun; + + ha = scsiIf->bus (); + id = scsiIf->id (); + lun = scsiIf->lun (); + + for (devletter = 'A'; devletter <= 'Z'; devletter++) { + sprintf (devstr, "%c:\\\0", devletter); + if (GetDriveType (devstr) != DRIVE_CDROM) + continue; + sprintf (devstr, "\\\\.\\%c:", devletter); + fh = CreateFile (devstr, + GENERIC_READ, + 0, + NULL, + OPEN_EXISTING, + FILE_FLAG_WRITE_THROUGH|FILE_FLAG_NO_BUFFERING, + NULL); + if (fh == INVALID_HANDLE_VALUE) { + //~ printf ("Error opening device %s: %d\n", devstr, GetLastError()); + fh = NULL; + continue; + } + if (DeviceIoControl (fh, IOCTL_SCSI_GET_ADDRESS, NULL, 0, &sa, sizeof(SCSI_ADDRESS), &bytes, NULL)) { + if ( (ha == sa.PortNumber) && (lun == sa.Lun) && (id == sa.TargetId) ) { + gotit = true; + break; + } else { + CloseHandle (fh); + fh = NULL; + continue; + } + } + } + if (gotit) { + if (!DeviceIoControl (fh, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &bytes, NULL)) { + log_message(-2, "Couldn't lock device %s!", devstr); + CloseHandle (fh); + fh = NULL; + } + else + log_message(2, "OS lock on device %s. Unit won't be accessible while burning.", devstr); + } else { + log_message(-2, "Unable to determine drive letter for device %s! No OS level locking.", scsiDevice); + if (fh) CloseHandle (fh); + fh = NULL; + } + } else + log_message(2,"You are running Windows 9x. No OS level locking available."); +#endif + + if (readingSpeed >= 0) { + if (!cdr->rspeed(readingSpeed)) { + log_message(-2, "Reading speed %d is not supported by device.", + readingSpeed); + exit(1); + } + } + + return cdr; +} + +static void showDriveInfo(const DriveInfo *i) +{ + if (i == NULL) { + log_message(0, "No drive information available."); + return; + } + + printf("Maximum reading speed: %d kB/s\n", i->maxReadSpeed); + printf("Current reading speed: %d kB/s\n", i->currentReadSpeed); + printf("Maximum writing speed: %d kB/s\n", i->maxWriteSpeed); + printf("Current writing speed: %d kB/s\n", i->currentWriteSpeed); + printf("BurnProof supported: %s\n", i->burnProof ? "yes" : "no"); + printf("JustLink supported: %s\n", i->ricohJustLink ? "yes" : "no"); + printf("JustSpeed supported: %s\n", i->ricohJustSpeed ? "yes" : "no"); +} + +static void showTocInfo(const Toc *toc, const char *tocFile) +{ + long len = toc->length().lba() * AUDIO_BLOCK_LEN; + len >>= 20; + + printf("%s: %d tracks, length %s, %ld blocks, %ld MB\n", tocFile, + toc->nofTracks(), toc->length().str(), toc->length().lba(), len); +} + +static void showTocSize(const Toc *toc, const char *tocFile) +{ + printf("%ld\n", toc->length().lba()); +} + +static void showToc(const Toc *toc) +{ + const Track *t; + Msf start, end, index; + int i; + int n; + int tcount = 1; + char buf[14]; + + printf("TOC TYPE: %s\n", Toc::tocType2String(toc->tocType())); + + if (toc->catalogValid()) { + for (i = 0; i < 13; i++) + buf[i] = toc->catalog(i) + '0'; + buf[13] = 0; + + printf("CATALOG NUMBER: %s\n", buf); + } + + TrackIterator itr(toc); + + for (t = itr.first(start, end); t != NULL; t = itr.next(start, end)) { + if (tcount > 1) + printf("\n"); + + printf("TRACK %2d Mode %s", tcount, + TrackData::mode2String(t->type())); + + if (t->subChannelType() != TrackData::SUBCHAN_NONE) + printf(" %s", TrackData::subChannelMode2String(t->subChannelType())); + + printf(":\n"); + + if (t->type() == TrackData::AUDIO) { + if (t->isrcValid()) { + printf(" ISRC %c%c %c%c%c %c%c %c%c%c%c%c\n", + t->isrcCountry(0), t->isrcCountry(1), + t->isrcOwner(0), t->isrcOwner(1), t->isrcOwner(2), + t->isrcYear(0) + '0', t->isrcYear(1) + '0', + t->isrcSerial(0) + '0', t->isrcSerial(1) + '0', + t->isrcSerial(2) + '0', t->isrcSerial(3) + '0', + t->isrcSerial(4) + '0'); + } + } + printf(" COPY%sPERMITTED\n", + t->copyPermitted() ? " " : " NOT "); + + if (t->type() == TrackData::AUDIO) { + printf(" %sPRE-EMPHASIS\n", + t->preEmphasis() ? "" : "NO "); + printf(" %s CHANNEL AUDIO\n", + t->audioType() == 0 ? "TWO" : "FOUR"); + } + + if (t->start().lba() != 0) { + printf(" PREGAP %s(%6ld)\n", + t->start().str(), t->start().lba()); + } + printf(" START %s(%6ld)\n", + start.str(), start.lba()); + n = t->nofIndices(); + for (i = 0; i < n; i++) { + index = start + t->getIndex(i); + printf(" INDEX %2d %s(%6ld)\n", + i + 2, index.str(), index.lba()); + } + + printf(" END%c %s(%6ld)\n", + t->isPadded() ? '*' : ' ', end.str(), end.lba()); + + tcount++; + } +} + +void showData(const Toc *toc, bool swap) +{ + long length = toc->length().lba(); + Sample buf[SAMPLES_PER_BLOCK]; + int i; + unsigned long sampleNr = 0; + long lba = 150; + + TocReader reader(toc); + + if (reader.openData() != 0) { + log_message(-2, "Cannot open audio data."); + return; + } + + while (length > 0) { + if (reader.readSamples(buf, SAMPLES_PER_BLOCK) != SAMPLES_PER_BLOCK) { + log_message(-2, "Read of audio data failed."); + return; + } + lba++; + + if (swap) { + swapSamples(buf, SAMPLES_PER_BLOCK); + } + + for (i = 0; i < SAMPLES_PER_BLOCK; i++) { + printf("%7lu:%6d %6d\n", sampleNr, buf[i].left(), buf[i].right()); + sampleNr++; + } + length -= 1; + } +} + +void showDiskInfo(DiskInfo *di) +{ + const char *s1, *s2; + + log_message(2, "That data below may not reflect the real status of the inserted medium"); + log_message(2, "if a simulation run was performed before. Reload the medium in this case."); + log_message(2, ""); + + printf("CD-RW : "); + if (di->valid.cdrw) + printf(di->cdrw ? "yes" : "no"); + else + printf("n/a"); + + printf("\n"); + + printf("Total Capacity : "); + if (di->valid.capacity) + printf("%s (%ld blocks, %ld/%ld MB)", Msf(di->capacity).str(), + di->capacity, + (di->capacity * 2) >> 10, + (di->capacity * AUDIO_BLOCK_LEN) >> 20); + else + printf("n/a"); + + printf("\n"); + + printf("CD-R medium : "); + if (di->valid.manufacturerId) { + if (CdrDriver::cdrVendor(di->manufacturerId, &s1, &s2)) { + printf("%s\n", s1); + printf(" %s\n", s2); + } + else { + printf("%s: unknown vendor ID\n", di->manufacturerId.str()); + } + } + else { + printf("n/a\n"); + } + + printf("Recording Speed : "); + if (di->valid.recSpeed) + printf("%dX - %dX", di->recSpeedLow, di->recSpeedHigh); + else + printf("n/a"); + + printf("\n"); + + printf("CD-R empty : "); + if (di->valid.empty) + printf(di->empty ? "yes" : "no"); + else + printf("n/a"); + + printf("\n"); + + if (di->valid.empty && !di->empty && di->valid.append) { + printf("Toc Type : "); + switch (di->diskTocType) { + case 0x00: + printf("CD-DA or CD-ROM"); + break; + case 0x10: + printf("CD-I"); + break; + case 0x20: + printf("CD-ROM XA"); + break; + case 0xff: + printf("Undefined"); + break; + default: + printf("invalid: %d", di->diskTocType); + break; + } + + printf("\n"); + + printf("Sessions : %d\n", di->sessionCnt); + printf("Last Track : %d\n", di->lastTrackNr); + printf("Appendable : %s\n", di->append ? "yes" : "no"); + + if (di->append) { + printf("Start of last session: %ld (%s)\n", di->lastSessionLba, + Msf(di->lastSessionLba + 150).str()); + printf("Start of new session : %ld (%s)\n", di->thisSessionLba, + Msf(di->thisSessionLba + 150).str()); + + if (di->valid.capacity && di->capacity > di->thisSessionLba) { + long r = di->capacity - di->thisSessionLba; + + printf("Remaining Capacity : %s (%ld blocks, %ld/%ld MB)\n", + Msf(r).str(), r, (r * 2) >> 10, (r * AUDIO_BLOCK_LEN) >> 20); + } + } + } +} + +/* + * Show multi session info in a format that is easy to parse with scritps. + * Return: 0: OK + * 1: disk is not empty and not appendable + * 2: could not determine the requested information + */ +static int showMultiSessionInfo(DiskInfo *di) +{ + + if (di->valid.empty) { + if (di->empty) { + // print nothing to indicate empty disk + return 0; + } + else if (di->valid.append) { + if (di->append) { + printf("%ld,%ld\n", di->lastSessionLba, di->thisSessionLba); + return 0; + } + else { + return 1; + } + } + } + + return 2; +} + +static void printCddbQuery(Toc *toc) +{ + Cddb cddb(toc); + + cddb.printDbQuery(); +} + +static int readCddb(DaoCommandLine* opts, Toc *toc, bool showEntry = false) +{ + int err = 0; + char *servers = strdupCC(opts->cddbServerList); + char *p; + const char *sep = " ,"; + char *user = NULL; + char *host = NULL; + struct passwd *pwent; + Cddb::QueryResults *qres, *qrun, *qsel; + Cddb::CddbEntry *dbEntry; + + Cddb cddb(toc); + + cddb.timeout(opts->cddbTimeout); + + if (opts->cddbLocalDbDir != NULL) + cddb.localCddbDirectory(opts->cddbLocalDbDir); + + + for (p = strtok(servers, sep); p != NULL; p = strtok(NULL, sep)) + cddb.appendServer(p); + + delete[] servers; + servers = NULL; + + if ((pwent = getpwuid(getuid())) != NULL && + pwent->pw_name != NULL) { + user = strdupCC(pwent->pw_name); + } + else { + user = strdupCC("unknown"); + } + + { + struct utsname sinfo; + if (uname(&sinfo) == 0) { + host = strdupCC(sinfo.nodename); + } + else { + host = strdupCC("unknown"); + } + } + + + if (cddb.connectDb(user, host, "cdrdao", VERSION) != 0) { + log_message(-2, "Cannot connect to any CDDB server."); + err = 2; goto fail; + } + + + if (cddb.queryDb(&qres) != 0) { + log_message(-2, "Querying of CDDB server failed."); + err = 2; goto fail; + } + + if (qres == NULL) { + log_message(1, "No CDDB record found for this toc-file."); + err = 1; goto fail; + } + + if (qres->next != NULL || !(qres->exactMatch)) { + int qcount; + + if (qres->next == NULL) + log_message(0, "Found following inexact match:"); + else + log_message(0, "Found following inexact matches:"); + + log_message(0, "\n DISKID CATEGORY TITLE\n"); + + for (qrun = qres, qcount = 0; qrun != NULL; qrun = qrun->next, qcount++) { + log_message(0, "%2d. %-8s %-12s %s", qcount + 1, qrun->diskId, + qrun->category, qrun->title); + } + + log_message(0, "\n"); + + qsel = NULL; + + while (1) { + char buf[20]; + int sel; + + log_message(0, "Select match, 0 for none [0-%d]?", qcount); + + if (fgets(buf, 20, stdin) == NULL) + break; + + for (p = buf; *p != 0 && isspace(*p); p++) ; + + if (*p != 0 && isdigit(*p)) { + sel = atoi(p); + + if (sel == 0) { + break; + } + else if (sel > 0 && sel <= qcount) { + sel--; + for (qsel = qres, qcount = 0; qsel != NULL && qcount != sel; + qsel = qsel->next, qcount++) ; + + break; + } + } + } + + if (qsel == NULL) { + log_message(0, "No match selected."); + err = 1; goto fail; + } + } + else { + qsel = qres; + } + + + log_message(1, "Reading CDDB record for: %s-%s-%s", qsel->diskId, qsel->category, + qsel->title); + + if (cddb.readDb(qsel->category, qsel->diskId, &dbEntry) != 0) { + log_message(-2, "Reading of CDDB record failed."); + err = 2; goto fail; + } + + if (showEntry) + cddb.printDbEntry(); + + if (!cddb.addAsCdText(toc)) + err = 1; + + fail: + delete[] user; + delete[] host; + + return err; +} + +static void scanBus() +{ + int i, len; + ScsiIf::ScanData *sdata = ScsiIf::scan(&len); + + if (sdata) { + for (i = 0; i < len; i++) { + log_message(0, "%s : %s, %s, %s", sdata[i].dev.c_str(), sdata[i].vendor, + sdata[i].product, sdata[i].revision); + } + delete[] sdata; + } + +#ifdef SCSI_ATAPI + sdata = ScsiIf::scan(&len, "ATA"); + if (sdata) { + for (i = 0; i < len; i++) { + log_message(0, "%-20s %s, %s, %s", sdata[i].dev.c_str(), sdata[i].vendor, + sdata[i].product, sdata[i].revision); + } + delete[] sdata; + } else { + sdata = ScsiIf::scan(&len, "ATAPI"); + if (sdata) { + for (i = 0; i < len; i++) { + log_message(0, "%-20s %s, %s, %s", sdata[i].dev.c_str(), sdata[i].vendor, + sdata[i].product, sdata[i].revision); + } + delete[] sdata; + } + } +#endif +} + +static int checkToc(const Toc *toc, bool force) +{ + int ret = toc->check(); + + if (ret == 0 || (ret == 1 && force)) + return 0; + + log_message(-2, "The toc check function detected at least one warning."); + log_message(-2, "If you record this toc the resulting CD might be unusable"); + log_message(-2, "or the recording process might abort with error."); + log_message(-2, "Use option --force to ignore the warnings."); + + return ret; +} + +static int copyCd(DaoCommandLine* opts, CdrDriver *src, CdrDriver *dst) +{ + char dataFilenameBuf[50]; + long pid = getpid(); + Toc *toc; + int ret = 0; + DiskInfo *di = NULL; + int isAppendable = 0; + + if (opts->dataFilename == NULL) { + // create a unique temporary data file name in current directory + sprintf(dataFilenameBuf, "cddata%ld.bin", pid); + opts->dataFilename = dataFilenameBuf; + } + + src->rawDataReading(true); + src->taoSource(opts->taoSource); + if (opts->taoSourceAdjust >= 0) + src->taoSourceAdjust(opts->taoSourceAdjust); + + if ((toc = src->readDisk(opts->session, opts->dataFilename)) == NULL) { + unlink(opts->dataFilename); + log_message(-2, "Creation of source CD image failed."); + return 1; + } + + if (opts->withCddb) { + if (readCddb(opts, toc) == 0) + log_message(2, "CD-TEXT data was added to toc-file."); + else + log_message(2, "Reading of CD-TEXT data failed - " + "continuing without CD-TEXT data."); + } + + if (opts->keepImage) { + char tocFilename[50]; + + sprintf(tocFilename, "cd%ld.toc", pid); + + log_message(2, "Keeping created image file \"%s\".", + opts->dataFilename); + log_message(2, "Corresponding toc-file is written to \"%s\".", + tocFilename); + + toc->write(tocFilename); + } + + if (checkToc(toc, opts->force)) { + log_message(-3, "Toc created from source CD image is inconsistent."); + toc->print(std::cout); + delete toc; + return 1; + } + + switch (dst->checkToc(toc)) { + case 0: // OK + break; + case 1: // warning + if (!opts->force) { + log_message(-2, "The toc extracted from the source CD is not suitable for"); + log_message(-2, "the recorder device and may produce undefined results."); + log_message(-2, "Use option --force to use it anyway."); + delete toc; + return 1; + } + break; + default: // error + log_message(-2, "The toc extracted from the source CD is not suitable for this drive."); + delete toc; + return 1; + break; + } + + if (src == dst) { + // Unlock src to make swaping possible + src->preventMediumRemoval(0); + log_message(0, "Please insert a recordable medium and hit enter."); + getc(stdin); + } + + do { + if ((di = dst->diskInfo()) == NULL) { + log_message(-2, "Cannot get disk information from recorder device."); + delete toc; + return 1; + } + + if (!di->valid.empty) { + log_message(-2, "Cannot determine disk status - hit enter to try again."); + getc(stdin); + isAppendable = 0; + } else if (!di->empty && (!di->valid.append || !di->append)) { + log_message(0, "Medium in recorder device is not empty and not appendable."); + log_message(0, "Please insert a recordable medium and hit enter."); + getc(stdin); + isAppendable = 0; + } else { + isAppendable = 1; + } + } while (!isAppendable); + + + if (dst->preventMediumRemoval(1) != 0) { + if (!opts->keepImage) { + if (unlink(opts->dataFilename) != 0) + log_message(-2, "Cannot remove CD image file \"%s\": %s", + opts->dataFilename, + strerror(errno)); + } + + delete toc; + return 1; + } + + if (writeDiskAtOnce(toc, dst, opts->fifoBuffers, opts->swap, 0, 0) != 0) { + if (dst->simulate()) + log_message(-2, "Simulation failed."); + else + log_message(-2, "Writing failed."); + + ret = 1; + } else { + if (dst->simulate()) + log_message(1, "Simulation finished successfully."); + else + log_message(1, "Writing finished successfully."); + } + + if (dst->preventMediumRemoval(0) != 0) + ret = 1; + + dst->rezeroUnit(0); + + if (ret == 0 && opts->eject) { + dst->loadUnload(1); + } + + if (!opts->keepImage) { + if (unlink(opts->dataFilename) != 0) + log_message(-2, "Cannot remove CD image file \"%s\": %s", + opts->dataFilename, + strerror(errno)); + } + + delete toc; + + return ret; +} + +static int copyCdOnTheFly(DaoCommandLine* opts,CdrDriver *src, CdrDriver *dst) +{ + Toc *toc = NULL; + int pipeFds[2]; + pid_t pid = -1; + int ret = 0; + int oldStdin = -1; + + if (src == dst) + return 1; + + if (pipe(pipeFds) != 0) { + log_message(-2, "Cannot create pipe: %s", strerror(errno)); + return 1; + } + + src->rawDataReading(true); + src->taoSource(opts->taoSource); + if (opts->taoSourceAdjust >= 0) + src->taoSourceAdjust(opts->taoSourceAdjust); + + src->onTheFly(1); + // the fd is not used by 'readDiskToc', just need to + // indicate that on-the-fly copying is active for + // automatical selection if the first track's pre-gap + // is padded with zeros in the created Toc. + + if ((toc = src->readDiskToc(opts->session, "-")) == NULL) { + log_message(-2, "Creation of source CD toc failed."); + ret = 1; + goto fail; + } + + if (opts->withCddb) { + if (readCddb(opts, toc) != 0) { + ret = 1; + goto fail; + } else { + log_message(2, "CD-TEXT data was added to toc."); + } + } + + if (checkToc(toc, opts->force) != 0) { + log_message(-3, "Toc created from source CD image is inconsistent" + "- please report."); + toc->print(std::cout); + ret = 1; + goto fail; + } + + switch (dst->checkToc(toc)) { + case 0: // OK + break; + case 1: // warning + if (!opts->force) { + log_message(-2, "The toc extracted from the source CD is not suitable for"); + log_message(-2, "the recorder device and may produce undefined results."); + log_message(-2, "Use option --force to use it anyway."); + ret = 1; + goto fail; + } + break; + default: // error + log_message(-2, "The toc extracted from the source CD is not suitable for this drive."); + ret = 1; + goto fail; + break; + } + + if ((pid = fork()) < 0) { + log_message(-2, "Cannot fork reader process: %s", strerror(errno)); + ret = 1; + goto fail; + } + + if (pid == 0) { + // we are the reader process + setsid(); + close(pipeFds[0]); + + src->onTheFly(pipeFds[1]); + + opts->verbose = 0; + +#ifdef __CYGWIN__ + /* Close the SCSI interface and open it again. This will re-init the + * ASPI layer which is required for the child process + */ + + delete src->scsiIf(); + + src->scsiIf(new ScsiIf(opts->sourceScsiDevice)); + + if (src->scsiIf()->init() != 0) { + log_message(-2, "Re-init of SCSI interace failed."); + + // indicate end of data + close(pipeFds[1]); + + while (1) + sleep(10); + } +#endif + + if (src->readDisk(opts->session, "-") != NULL) + log_message(1, "CD image reading finished successfully."); + else + log_message(-2, "CD image reading failed."); + + // indicate end of data + close(pipeFds[1]); + while (1) + sleep(10); + } + + close(pipeFds[1]); + pipeFds[1] = -1; + + if ((oldStdin = dup(fileno(stdin))) < 0) { + log_message(-2, "Cannot duplicate stdin: %s", strerror(errno)); + ret = 1; + goto fail; + } + + if (dup2(pipeFds[0], fileno(stdin)) != 0) { + log_message(-2, "Cannot connect pipe to stdin: %s", strerror(errno)); + close(oldStdin); + oldStdin = -1; + ret = 1; + goto fail; + } + + dst->onTheFly(fileno(stdin)); + + if (dst->preventMediumRemoval(1) != 0) { + ret = 1; + goto fail; + } + + if (writeDiskAtOnce(toc, dst, opts->fifoBuffers, opts->swap, 0, 0) != 0) { + if (dst->simulate()) + log_message(-2, "Simulation failed."); + else + log_message(-2, "Writing failed."); + + ret = 1; + } else { + if (dst->simulate()) + log_message(1, "Simulation finished successfully."); + else + log_message(1, "Writing finished successfully."); + } + + dst->rezeroUnit(0); + + if (dst->preventMediumRemoval(0) != 0) + ret = 1; + + if (ret == 0 && opts->eject) { + dst->loadUnload(1); + } + + +fail: + if (pid > 0) { + int status; + kill(pid, SIGKILL); + wait(&status); + } + + if (oldStdin >= 0) { + dup2(oldStdin, fileno(stdin)); + close(oldStdin); + } + + delete toc; + + close(pipeFds[0]); + + if (pipeFds[1] >= 0) + close(pipeFds[1]); + + return ret; +} + +int main(int argc, char **argv) +{ + int exitCode = 0; + Toc *toc = NULL; + ScsiIf *cdrScsi = NULL; + ScsiIf *srcCdrScsi = NULL; + CdrDriver *cdr = NULL; + CdrDriver *srcCdr = NULL; + int delSrcDevice = 0; + DiskInfo *di = NULL; + DiskInfo *srcDi = NULL; + const char *homeDir; + const char *settingsPath = NULL; + +#if defined(HAVE_SETEUID) && defined(HAVE_SETEGID) + if (geteuid() == 0 && getuid() != 0) { + uid_t uid = getuid(); + if (setuid(uid) == -1) { + log_message(-2, "Failed to drop privileges; exiting."); + exit(1); + } + } +#endif + + log_init(); + + // Initialize command line options to default values + DaoCommandLine options; + setOptionDefaults(&options); + options.progName = argv[0]; + + Settings* settings = new Settings; + + settingsPath = "/etc/cdrdao.conf"; + if (settings->read(settingsPath) == 0) + log_message(3, "Read settings from \"%s\".", settingsPath); + + settingsPath = "/etc/defaults/cdrdao"; + if (settings->read(settingsPath) == 0) + log_message(3, "Read settings from \"%s\".", settingsPath); + + settingsPath = NULL; + + if ((homeDir = getenv("HOME")) != NULL) { + settingsPath = strdup3CC(homeDir, "/.cdrdao", NULL); + + if (settings->read(settingsPath) == 0) + log_message(3, "Read settings from \"%s\".", settingsPath); + } else { + log_message(-1, "Environment variable 'HOME' not defined" + "- cannot read .cdrdao."); + } + +#ifdef UNIXWARE + if (getuid() != 0) { + log_message(-2, "You must be root to use cdrdao."); + exit(1); + } +#endif + + // Parse command line command and options. + if (parseCmdline(argc - 1, argv + 1, &options, settings) != 0) { + log_set_verbose(2); + printVersion(); + printUsage(&options); + exit(1); + } + + log_set_verbose(options.verbose); + commitSettings(&options, settings, settingsPath); + + printVersion(); + + // Just show version ? We're done. + if (options.command == SHOW_VERSION) + goto fail; + + // --------------------------------------------------------------------- + // Parse and check the toc file + // --------------------------------------------------------------------- + if (cmdInfo[options.command].tocParse) { + + // Parse TOC file + toc = Toc::read(options.tocFile); + + if (options.remoteMode) { + unlink(options.tocFile); + } + + // Check and resolve input files paths + if (!toc || !toc->resolveFilenames(options.tocFile)) { + exitCode = 1; + goto fail; + } + + if (!toc->convertFilesToWav()) { + log_message(-2, + "Could not decode audio files from toc file \"%s\".", + options.tocFile); + exitCode = 1; + goto fail; + } + + toc->recomputeLength(); + + if (cmdInfo[options.command].tocCheck) { + if (checkToc(toc, options.force) != 0) { + log_message(-2, "Toc file \"%s\" is inconsistent.", + options.tocFile); + exitCode = 1; + goto fail; + } + } + } + + // --------------------------------------------------------------------- + // Setup the CD device, obtain disk media information. + // --------------------------------------------------------------------- + + if (cmdInfo[options.command].requiredDevice != NO_DEVICE) { + + if (!options.scsiDevice) + options.scsiDevice = + getDefaultDevice(cmdInfo[options.command].requiredDevice); + + cdr = setupDevice(options.command, + options.scsiDevice, + options.driverId, + /* init device? */ + (options.command == UNLOCK) ? 0 : 1, + /* check for ready status? */ + (options.command == BLANK || + options.command == DRIVE_INFO || + options.command == DISCID) ? 0 : 1, + /* reset status of medium if not empty? */ + (options.command == SIMULATE || + options.command == WRITE) ? 1 : 0, + options.readingSpeed, + options.remoteMode, + options.reload); + + if (cdr == NULL) { + log_message(-2, "Cannot setup device %s.", options.scsiDevice); + exitCode = 1; goto fail; + } + + cdrScsi = cdr->scsiIf(); + + if ((di = cdr->diskInfo()) == NULL) { + log_message(-2, "Cannot get disk information."); + exitCode = 1; goto fail; + } + } + + // --------------------------------------------------------------------- + // Process fullburn option for writing commands. + // --------------------------------------------------------------------- + + if (options.command == SIMULATE || + options.command == WRITE || + options.command == COPY_CD) { + if (options.fullBurn) { + if (options.driverId && + strcmp(options.driverId, "generic-mmc-raw") != 0) { + log_message(-2, "You must use the generic-mmc-raw driver to use the " + "full-burn option."); + exitCode = 1; goto fail; + } else { + int mins = options.userCapacity ? options.userCapacity : + Msf(cdr->diskInfo()->capacity).min(); + log_message(2, "Burning entire %d mins disc.", mins); + } + } + cdr->fullBurn(options.fullBurn); + cdr->userCapacity(options.userCapacity); + } + + // --------------------------------------------------------------------- + // Setup secondary device for copy command. + // --------------------------------------------------------------------- + + if (options.command == COPY_CD) { + if (options.sourceScsiDevice != NULL && + strcmp(options.scsiDevice, options.sourceScsiDevice) != 0) { + delSrcDevice = 1; + srcCdr = setupDevice(READ_CD, options.sourceScsiDevice, + options.sourceDriverId, + 1, 1, 0, options.readingSpeed, false, false); + + if (srcCdr == NULL) { + log_message(-2, "Cannot setup source device %s.", + options.sourceScsiDevice); + exitCode = 1; goto fail; + } + + srcCdrScsi = srcCdr->scsiIf(); + + if ((srcDi = srcCdr->diskInfo()) == NULL) { + log_message(-2, + "Cannot get disk information from source device."); + exitCode = 1; goto fail; + } + } else { + srcCdr = cdr; + srcDi = di; + } + } + + if (options.remoteMode) + options.pause = false; + + // --------------------------------------------------------------------- + // Main command dispatch. + // --------------------------------------------------------------------- + + switch (options.command) { + case READ_CDDB: + if ((exitCode = readCddb(&options, toc)) == 0) { + log_message(1, "Writing CD-TEXT populated toc-file \"%s\".", + options.tocFile); + if (toc->write(options.tocFile) != 0) + exitCode = 2; + } + break; + + case SCAN_BUS: + scanBus(); + break; + + case DRIVE_INFO: + showDriveInfo(cdr->driveInfo(true)); + break; + + case SHOW_TOC: + showToc(toc); + if (toc->check() > 1) { + log_message(-2, "Toc file \"%s\" is inconsistent.", + options.tocFile); + } + break; + + case TOC_INFO: + showTocInfo(toc, options.tocFile); + if (toc->check() > 1) { + log_message(-2, "Toc file \"%s\" is inconsistent.", + options.tocFile); + } + break; + + case TOC_SIZE: + showTocSize(toc, options.tocFile); + if (toc->check() > 1) { + log_message(-2, "Toc file \"%s\" is inconsistent.", + options.tocFile); + } + break; + + case SHOW_DATA: + showData(toc, options.swap); + break; + + case READ_TEST: + log_message(1, "Starting read test..."); + log_message(2, "Process can be aborted with QUIT signal " + "(usually CTRL-\\)."); + if (writeDiskAtOnce(toc, NULL, options.fifoBuffers, + options.swap, 1, + options.writingSpeed) != 0) { + log_message(-2, "Read test failed."); + exitCode = 1; goto fail; + } + break; + + case DISK_INFO: + showDiskInfo(di); + break; + + case DISCID: + if (di->valid.empty && di->empty) { + log_message(-2, "Inserted disk is empty."); + exitCode = 1; goto fail; + } + cdr->subChanReadMode(options.readSubchanMode); + cdr->rawDataReading(options.readRaw); + cdr->mode2Mixed(options.mode2Mixed); + cdr->fastTocReading(true); + cdr->taoSource(options.taoSource); + if (options.taoSourceAdjust >= 0) + cdr->taoSourceAdjust(options.taoSourceAdjust); + + cdr->force(options.force); + + if ((toc = cdr->readDiskToc(options.session, + (options.dataFilename == NULL) ? + "data.wav" : options.dataFilename)) + == NULL) { + cdr->rezeroUnit(0); + exitCode = 1; goto fail; + } else { + cdr->rezeroUnit(0); + + if (options.printQuery) + printCddbQuery(toc); + else + readCddb(&options, toc, true); + } + break; + + case MSINFO: + switch (showMultiSessionInfo(di)) { + case 0: + log_message(2, "msinfo: Session is appendable"); + exitCode = 0; + break; + + case 1: // CD-R is not empty and not appendable + log_message(2, "msinfo: CD-R is not empty and not appendable"); + exitCode = 2; + break; + + case 2: // cannot determine state + log_message(2, "msinfo: cannot determine state"); + exitCode = 3; + break; + + default: // everthing else is an error + log_message(2, "msinfo: command error"); + exitCode = 1; + break; + } + break; + + + case READ_TOC: + if (di->valid.empty && di->empty) { + log_message(-2, "Inserted disk is empty."); + exitCode = 1; goto fail; + } + log_message(1, "Reading toc data..."); + + if (access(options.tocFile, R_OK) == 0) { + log_message(-2, "File \"%s\" exists, will not overwrite.", + options.tocFile); + exitCode = 1; goto fail; + } + + cdr->subChanReadMode(options.readSubchanMode); + cdr->rawDataReading(options.readRaw); + cdr->mode2Mixed(options.mode2Mixed); + cdr->fastTocReading(options.fastToc); + cdr->taoSource(options.taoSource); + if (options.taoSourceAdjust >= 0) + cdr->taoSourceAdjust(options.taoSourceAdjust); + + cdr->force(options.force); + + if ((toc = + cdr->readDiskToc(options.session, + (options.dataFilename == NULL) ? + "data.wav" : options.dataFilename)) == NULL) { + cdr->rezeroUnit(0); + exitCode = 1; goto fail; + } else { + cdr->rezeroUnit(0); + + if (options.withCddb) { + if (readCddb(&options, toc) == 0) { + log_message(2, "CD-TEXT data was added to toc-file."); + } + } + + { + std::ofstream out(options.tocFile); + if (!out) { + log_message(-2, "Cannot open \"%s\" for writing: %s", + options.tocFile, + strerror(errno)); + exitCode = 1; goto fail; + } + toc->print(out); + } + + log_message(1, "Reading of toc data finished successfully."); + } + break; + + case READ_CD: + if (di->valid.empty && di->empty) { + log_message(-2, "Inserted disk is empty."); + exitCode = 1; goto fail; + } + log_message(1, "Reading toc and track data..."); + + if (access(options.tocFile, R_OK) == 0) { + log_message(-2, "File \"%s\" exists, will not overwrite.", + options.tocFile); + exitCode = 1; goto fail; + } + + cdr->subChanReadMode(options.readSubchanMode); + cdr->rawDataReading(options.readRaw); + cdr->mode2Mixed(options.mode2Mixed); + cdr->taoSource(options.taoSource); + if (options.taoSourceAdjust >= 0) + cdr->taoSourceAdjust(options.taoSourceAdjust); + + cdr->paranoiaMode(options.paranoiaMode); + cdr->fastTocReading(options.fastToc); + cdr->remote(options.remoteMode, options.remoteFd); + cdr->force(options.force); + + toc = cdr->readDisk(options.session, + (options.dataFilename == NULL) ? "data.bin" : + options.dataFilename); + + if (toc == NULL) { + cdr->rezeroUnit(0); + exitCode = 1; goto fail; + } + cdr->rezeroUnit(0); + + if (options.withCddb) { + if (readCddb(&options, toc) == 0) { + log_message(2, "CD-TEXT data was added to toc-file."); + } + } + + { + std::ofstream out(options.tocFile); + if (!out) { + log_message(-2, "Cannot open \"%s\" for writing: %s", + options.tocFile, strerror(errno)); + exitCode = 1; goto fail; + } + toc->print(out); + } + + log_message(1, "Reading of toc and track data finished successfully."); + break; + + case WRITE: + if (!options.writeSimulate) + cdr->simulate(false); + // fall through + + case SIMULATE: + if (di->valid.empty && !di->empty && + (!di->valid.append || !di->append)) { + log_message(-2, "Inserted disk is not empty and not appendable."); + exitCode = 1; goto fail; + } + + if (toc->length().lba() > di->capacity) { + log_message((options.overburn ? -1 : -2), + "Length of toc (%s, %ld blocks) exceeds capacity ", + toc->length().str(), toc->length().lba()); + log_message(0, "of CD-R (%s, %ld blocks).", + Msf(di->capacity).str(), + di->capacity); + + if (options.overburn) { + log_message(-1, "Ignored because of option '--overburn'."); + log_message(-1, "Some drives may fail to record this toc."); + } else { + log_message(-2, "Please use option '--overburn' to start" + "recording anyway."); + exitCode = 1; goto fail; + } + } + + if (options.multiSession) { + if (cdr->multiSession(1) != 0) { + log_message(-2, "This driver does not support " + "multi session discs."); + exitCode = 1; goto fail; + } + } + + if (options.writingSpeed >= 0) { + if (cdr->speed(options.writingSpeed) != 0) { + log_message(-2, "Writing speed %d not supported by device.", + options.writingSpeed); + exitCode = 1; goto fail; + } + } + + cdr->bufferUnderRunProtection(options.bufferUnderrunProtection); + cdr->writeSpeedControl(options.writeSpeedControl); + + cdr->force(options.force); + cdr->remote(options.remoteMode, options.remoteFd); + + switch (cdr->checkToc(toc)) { + case 0: // OK + break; + case 1: // warning + if (!options.force && !options.remoteMode) { + log_message(-2, "Toc-file \"%s\" may create undefined " + "results.", options.tocFile); + log_message(-2, "Use option --force to use it anyway."); + exitCode = 1; goto fail; + } + break; + default: // error + log_message(-2, "Toc-file \"%s\" is not suitable for this drive.", + options.tocFile); + exitCode = 1; goto fail; + break; + } + + log_message(1, "Starting write "); + if (cdr->simulate()) { + log_message(1, "simulation "); + } + log_message(1, "at speed %d...", cdr->speed()); + if (cdr->multiSession() != 0) { + log_message(1, "Using multi session mode."); + } + + if (options.pause) { + log_message(1, "Pausing 10 seconds - hit CTRL-C to abort."); + sleep(10); + } + + log_message(2, "Process can be aborted with QUIT signal " + "(usually CTRL-\\)."); + if (cdr->preventMediumRemoval(1) != 0) { + exitCode = 1; goto fail; + } + + if (writeDiskAtOnce(toc, cdr, options.fifoBuffers, + options.swap, 0, 0) != 0) { + if (cdr->simulate()) { + log_message(-2, "Simulation failed."); + } else { + log_message(-2, "Writing failed."); + } + cdr->preventMediumRemoval(0); + cdr->rezeroUnit(0); + exitCode = 1; goto fail; + } + + if (cdr->simulate()) { + log_message(1, "Simulation finished successfully."); + } else { + log_message(1, "Writing finished successfully."); + } + + cdr->rezeroUnit(0); + if (cdr->preventMediumRemoval(0) != 0) { + exitCode = 1; goto fail; + } + + if (options.eject) { + cdr->loadUnload(1); + } + break; + + case COPY_CD: + if (cdr != srcCdr) { + if (di->valid.empty && !di->empty && + (!di->valid.append || !di->append)) { + log_message(-2, "Medium in recorder device is not empty" + "and not appendable."); + exitCode = 1; goto fail; + } + } + + if (srcDi->valid.empty && srcDi->empty) { + log_message(-2, "Medium in source device is empty."); + exitCode = 1; goto fail; + } + + cdr->simulate(options.writeSimulate); + cdr->force(options.force); + cdr->remote(options.remoteMode, options.remoteFd); + + cdr->bufferUnderRunProtection(options.bufferUnderrunProtection); + cdr->writeSpeedControl(options.writeSpeedControl); + + if (options.multiSession) { + if (cdr->multiSession(1) != 0) { + log_message(-2, "This driver does not support multi" + "session discs."); + exitCode = 1; goto fail; + } + } + + if (options.writingSpeed >= 0) { + if (cdr->speed(options.writingSpeed) != 0) { + log_message(-2, "Writing speed %d not supported by device.", + options.writingSpeed); + exitCode = 1; goto fail; + } + } + + srcCdr->paranoiaMode(options.paranoiaMode); + srcCdr->subChanReadMode(options.readSubchanMode); + srcCdr->fastTocReading(options.fastToc); + srcCdr->force(options.force); + + if (options.onTheFly) + log_message(1, "Starting on-the-fly CD copy "); + else + log_message(1, "Starting CD copy "); + if (cdr->simulate()) { + log_message(1, "simulation "); + } + log_message(1, "at speed %d...", cdr->speed()); + if (cdr->multiSession() != 0) { + log_message(1, "Using multi session mode."); + } + + if (options.onTheFly) { + if (srcCdr == cdr) { + log_message(-2, "Two different device are required " + "for on-the-fly copying."); + log_message(-2, "Please use option '--source-device x,y,z'."); + exitCode = 1; goto fail; + } + + if (copyCdOnTheFly(&options, srcCdr, cdr) == 0) { + log_message(1, "On-the-fly CD copying finished successfully."); + } else { + log_message(-2, "On-the-fly CD copying failed."); + exitCode = 1; goto fail; + } + + } else { + if (srcCdr != cdr) + srcCdr->remote(options.remoteMode, options.remoteFd); + + if (copyCd(&options, srcCdr, cdr) == 0) { + log_message(1, "CD copying finished successfully."); + } else { + log_message(-2, "CD copying failed."); + exitCode = 1; goto fail; + } + } + break; + + case BLANK: + if (options.writingSpeed >= 0) { + if (cdr->speed(options.writingSpeed) != 0) { + log_message(-2, "Blanking speed %d not supported by device.", + options.writingSpeed); + exitCode = 1; goto fail; + } + } + + cdr->remote(options.remoteMode, options.remoteFd); + cdr->simulate(options.writeSimulate); + + log_message(1, "Blanking disk..."); + if (cdr->blankDisk(options.blankingMode) != 0) { + log_message(-2, "Blanking failed."); + exitCode = 1; goto fail; + } + + if (options.eject) + cdr->loadUnload(1); + break; + + case UNLOCK: + log_message(1, "Trying to unlock drive..."); + + cdr->abortDao(); + + if (cdr->preventMediumRemoval(0) != 0) { + exitCode = 1; goto fail; + } + + if (options.eject) + cdr->loadUnload(1); + break; + + case UNKNOWN: + assert(0); + break; + case SHOW_VERSION: + case LAST_CMD: + /* To avoid warning */ + break; + } + + fail: + delete cdr; + if (delSrcDevice) + delete srcCdr; + delete cdrScsi; + if (delSrcDevice) + delete srcCdrScsi; + + delete toc; + +#ifdef __CYGWIN__ + if (isNT) { + DWORD bytes; + if (fh) { + if (!DeviceIoControl (fh, FSCTL_UNLOCK_VOLUME, NULL, 0, NULL, 0, &bytes, NULL)) + log_message(-2, "Couldn't unlock device %s!", devstr); + else + log_message(2, "Device %s unlocked.", devstr); + CloseHandle (fh); + } + } +#endif + exit(exitCode); +} diff --git a/dao/port.cc b/dao/port.cc new file mode 100644 index 0000000..180e349 --- /dev/null +++ b/dao/port.cc @@ -0,0 +1,328 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <unistd.h> +#include <signal.h> +#include <errno.h> +#include <string.h> + +#ifdef USE_POSIX_THREADS +#include <pthread.h> +#endif + +#if defined(HAVE_USLEEP) + +#else + +#include <sys/time.h> +#include <sys/types.h> + +#endif + +#ifdef __CYGWIN__ +#include <windows.h> +#endif + +#ifdef UNIXWARE +#include <sys/priocntl.h> +#include <sys/fppriocntl.h> +extern uid_t geteuid(); +#endif + +#include "log.h" + +/* Select POSIX scheduler interface for real time scheduling if possible */ +#ifdef USE_POSIX_THREADS + +#undef LINUX_QNX_SCHEDULING + +#if (defined HAVE_PTHREAD_GETSCHEDPARAM) && (defined HAVE_SCHED_GET_PRIORITY_MAX) && (defined HAVE_PTHREAD_ATTR_SETSCHEDPOLICY) && (defined HAVE_PTHREAD_ATTR_SETSCHEDPARAM) && (defined HAVE_PTHREAD_SETSCHEDPARAM) && (!defined LINUX_QNX_SCHEDULING) +#define POSIX_SCHEDULING +#endif + +#else + +#if (defined HAVE_SCHED_GETPARAM) && (defined HAVE_SCHED_GET_PRIORITY_MAX) && (defined HAVE_SCHED_SETSCHEDULER) && (!defined LINUX_QNX_SCHEDULING) +#define POSIX_SCHEDULING +#endif + +#endif + + +#if defined LINUX_QNX_SCHEDULING + +#include <sys/types.h> + +#define SCHED_OTHER 0 +#define SCHED_FIFO 1 +#define SCHED_RR 2 + +struct sched_param { + unsigned int priority; + int fork_penalty_threshold; + unsigned int starvation_threshold; + unsigned int ts_max; + unsigned int run_q, run_q_min, run_q_max; +}; +extern "C" int sched_setparam __P((pid_t __pid, const struct sched_param *__param)); +extern "C" int sched_getparam __P((pid_t __pid, struct sched_param *__param)); +extern "C" int sched_setscheduler __P((pid_t __pid, int __policy, const struct sched_param *__param)); +extern "C" int sched_getscheduler __P((pid_t __pid)); + +#elif defined POSIX_SCHEDULING + +#ifdef HAVE_SCHED_H +#include <sched.h> +#endif + +#endif + + +#include "port.h" + +#include "log.h" + +void mSleep(long milliSeconds) +{ +#if defined(HAVE_USLEEP) + + usleep(milliSeconds * 1000); + +#else + + struct timeval tv; + + tv.tv_sec = 0; + tv.tv_usec = 1000 * milliSeconds; + select(0, NULL, NULL, NULL, &tv); + +#endif +} + +// Installs signal handler for signal 'sig' that will stay installed after +// it is called. +void installSignalHandler(int sig, SignalHandler handler) +{ + struct sigaction action; + + memset(&action, 0, sizeof(action)); + +#ifdef UNIXWARE + action.sa_handler = (void(*)()) handler; +#else + action.sa_handler = handler; +#endif + + sigemptyset(&(action.sa_mask)); + + if (sigaction(sig, &action, NULL) != 0) + log_message(-2, "Cannot install signal handler: %s", strerror(errno)); +} + +// Blocks specified signal. +void blockSignal(int sig) +{ + sigset_t set; + + sigemptyset(&set); + sigaddset(&set, sig); + +#ifdef USE_POSIX_THREADS + +#ifdef HAVE_PTHREAD_SIGMASK + pthread_sigmask(SIG_BLOCK, &set, NULL); +#endif + +#else + sigprocmask(SIG_BLOCK, &set, NULL); +#endif +} + +// Unblocks specified signal. +void unblockSignal(int sig) +{ + sigset_t set; + + sigemptyset(&set); + sigaddset(&set, sig); + +#ifdef USE_POSIX_THREADS + +#ifdef HAVE_PTHREAD_SIGMASK + pthread_sigmask(SIG_UNBLOCK, &set, NULL); +#endif + +#else + sigprocmask(SIG_UNBLOCK, &set, NULL); +#endif +} + + +/* Sets real time scheduling. + * int priority: priority which is subtracted from the maximum priority + * Return: 0: OK + * 1: no permissions + * 2: real time scheduling not available + * 3: error occured + */ +int setRealTimeScheduling(int priority) +{ +#if defined(__CYGWIN__) + if (!SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS)) { + log_message(-1, "Cannot set real time priority class."); + return 3; + } + + if (!SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL)) { + log_message(-1, "Cannot set real time priority."); + return 3; + } + + log_message(5, "Using WIN32 real time scheduling."); + +#elif defined(USE_POSIX_THREADS) && defined(POSIX_SCHEDULING) + struct sched_param schedp; + int schedPolicy; + + if (geteuid() != 0) { + return 1; + } + + pthread_getschedparam(pthread_self(), &schedPolicy, &schedp); + schedp.sched_priority = sched_get_priority_max(SCHED_RR) - priority; + + if (pthread_setschedparam(pthread_self(), SCHED_RR, &schedp) < 0) { + log_message(-1, "Cannot setup real time scheduling: %s", strerror(errno)); + return 3; + } + else { + log_message(5, "Using pthread POSIX real time scheduling."); + } + +#elif defined(LINUX_QNX_SCHEDULING) + struct sched_param schedp; + + if (geteuid() != 0) { + return 1; + } + + sched_getparam (0, &schedp); + schedp.run_q_min = schedp.run_q_max = 2; + if (sched_setscheduler (0, SCHED_RR, &schedp) < 0) { + log_message(-1, "Cannot setup real time scheduling: %s", strerror(errno)); + return 3; + } + else { + log_message(5, "Using Linux QNX real time scheduling."); + } + +#elif defined POSIX_SCHEDULING + struct sched_param schedp; + + if (geteuid() != 0) { + return 1; + } + + sched_getparam (0, &schedp); + schedp.sched_priority = sched_get_priority_max (SCHED_RR) - priority; + if (sched_setscheduler (0, SCHED_RR, &schedp) < 0) { + log_message(-1, "Cannot setup real time scheduling: %s", strerror(errno)); + return 3; + } + else { + log_message(5, "Using POSIX real time scheduling."); + } + +#elif defined UNIXWARE + /* Switch to fixed priority scheduling for this process */ + pcinfo_t pci; + pcparms_t pcp; + fpparms_t *fp; + + if (geteuid() != 0) { + return 1; + } + + /* set fixed priority class */ + strcpy(pci.pc_clname, "FP"); + fp = (fpparms_t *) &pcp.pc_clparms; + fp->fp_pri = FP_NOCHANGE; + fp->fp_tqsecs = (ulong_t) FP_TQDEF; + fp->fp_tqnsecs = FP_TQDEF; + + if (priocntl(P_PID, 0, PC_GETCID, (void *) &pci) < 0) { + log_message(-1, "priocntl PC_GETCID failed"); + return 3; + } + + pcp.pc_cid = pci.pc_cid; + + if (priocntl(P_PID, getpid(), PC_SETPARMS, (void *) &pcp) < 0) { + log_message(-1, "priocntl PC_SETPARMS failed"); + return 3; + } + + log_message(5, "Now running in fixed-priority scheduling mode."); + +#else + return 2; +#endif + + return 0; +} + +// Give up root privileges. Returns true if succeeded or no action was +// taken. + +bool giveUpRootPrivileges() +{ + if (geteuid() != getuid()) { +#if defined(HAVE_SETREUID) + if (setreuid((uid_t)-1, getuid()) != 0) + return false; +#elif defined(HAVE_SETEUID) + if (seteuid(getuid()) != 0) + return false; +#elif defined(HAVE_SETUID) + if (setuid(getuid()) != 0) + return false; +#else + return false; +#endif + } + + if (getegid() != getgid()) { +#if defined(HAVE_SETREGID) + if (setregid((gid_t)-1, getgid()) != 0) + return false; +#elif defined(HAVE_SETEGID) + if (setegid(getgid()) != 0) + return false; +#elif defined(HAVE_SETGID) + if (setgid(getgid()) != 0) + return false; +#else + return false; +#endif + } + + return true; +} diff --git a/dao/port.h b/dao/port.h new file mode 100644 index 0000000..a48b42f --- /dev/null +++ b/dao/port.h @@ -0,0 +1,34 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __PORT_H__ +#define __PORT_H__ + +#include "config.h" + +typedef RETSIGTYPE (*SignalHandler)(int); + +void mSleep(long milliSeconds); +void installSignalHandler(int sig, SignalHandler); +void blockSignal(int sig); +void unblockSignal(int sig); +int setRealTimeScheduling(int priority); +bool giveUpRootPrivileges(); + +#endif diff --git a/dao/remote.h b/dao/remote.h new file mode 100644 index 0000000..a488157 --- /dev/null +++ b/dao/remote.h @@ -0,0 +1,72 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * $Log: remote.h,v $ + * Revision 1.6 2004/02/12 01:13:31 poolshark + * Merge from gnome2 branch + * + * Revision 1.5.4.1 2004/01/12 20:53:33 poolshark + * Added writer buffer fill in Progress Message structure + * + * Revision 1.5 2001/10/01 18:08:41 andreasm + * Enabled remote progress messages for blanking. + * + * Revision 1.4 2000/11/05 19:20:59 andreasm + * Unified progress messages sent from cdrdao to gcdmaster. + * + * Revision 1.3 2000/10/08 16:39:41 andreasm + * Remote progress message now always contain the track relative and total + * progress and the total number of processed tracks. + * + * Revision 1.2 2000/04/23 16:29:50 andreasm + * Updated to state of my private development environment. + * + * Revision 1.2 1999/12/15 20:31:46 mueller + * Added remote messages for 'read-cd' progress used by a GUI. + * + * Revision 1.1 1999/11/07 09:17:08 mueller + * Initial revision + * + */ + +#ifndef __REMOTE_H__ +#define __REMOTE_H__ + +#define PGSMSG_MIN PGSMSG_RCD_ANALYZING +#define PGSMSG_RCD_ANALYZING 1 +#define PGSMSG_RCD_EXTRACTING 2 +#define PGSMSG_WCD_LEADIN 3 +#define PGSMSG_WCD_DATA 4 +#define PGSMSG_WCD_LEADOUT 5 +#define PGSMSG_BLK 6 +#define PGSMSG_MAX PGSMSG_BLK + +#define PSGMSG_MINSIZE 24 + +struct ProgressMsg { + int status; // see PGSMSG_* constants + int totalTracks; // total number of tracks + int track; // actually written track + int trackProgress; // progress for current track 0..1000 + int totalProgress; // total writing progress 0..1000 + int bufferFillRate; // buffer fill rate 0..100 + int writerFillRate; // device write buffer fill rate 0..100 +}; + +#endif diff --git a/dao/sg_err.cc b/dao/sg_err.cc new file mode 100644 index 0000000..2f5f0be --- /dev/null +++ b/dao/sg_err.cc @@ -0,0 +1,664 @@ +#include <stdio.h> +#include <stdlib.h> +#include "sg_err.h" +#include "log.h" + +/* This file is a huge cut, paste and hack from linux/drivers/scsi/constant.c +* which I guess was written by: +* Copyright (C) 1993, 1994, 1995 Eric Youngdale + +* The rest of this is: +* Copyright (C) 1999 D. Gilbert +* +* This program 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, or (at your option) +* any later version. +* +* ASCII values for a number of symbolic constants, printing functions, etc. +* +* Some of the tables have been updated for SCSI 2. +* +* Version 0.61 (990519) +*/ + + +static const unsigned char scsi_command_size[8] = { 6, 10, 10, 12, + 12, 12, 10, 10 }; + +#define COMMAND_SIZE(opcode) scsi_command_size[((opcode) >> 5) & 7] + +static const char unknown[] = "UNKNOWN"; + +static const char * group_0_commands[] = { +/* 00-03 */ "Test Unit Ready", "Rezero Unit", unknown, "Request Sense", +/* 04-07 */ "Format Unit", "Read Block Limits", unknown, "Reasssign Blocks", +/* 08-0d */ "Read (6)", unknown, "Write (6)", "Seek (6)", unknown, unknown, +/* 0e-12 */ unknown, "Read Reverse", "Write Filemarks", "Space", "Inquiry", +/* 13-16 */ "Verify", "Recover Buffered Data", "Mode Select", "Reserve", +/* 17-1b */ "Release", "Copy", "Erase", "Mode Sense", "Start/Stop Unit", +/* 1c-1d */ "Receive Diagnostic", "Send Diagnostic", +/* 1e-1f */ "Prevent/Allow Medium Removal", unknown, +}; + + +static const char *group_1_commands[] = { +/* 20-22 */ unknown, unknown, unknown, +/* 23-28 */ unknown, "Define window parameters", "Read Capacity", + unknown, unknown, "Read (10)", +/* 29-2d */ "Read Generation", "Write (10)", "Seek (10)", "Erase", + "Read updated block", +/* 2e-31 */ "Write Verify","Verify", "Search High", "Search Equal", +/* 32-34 */ "Search Low", "Set Limits", "Prefetch or Read Position", +/* 35-37 */ "Synchronize Cache","Lock/Unlock Cache", "Read Defect Data", +/* 38-3c */ "Medium Scan", "Compare", "Copy Verify", "Write Buffer", + "Read Buffer", +/* 3d-3f */ "Update Block", "Read Long", "Write Long", +}; + +static const char *group_2_commands[] = { +/* 40-41 */ "Change Definition", "Write Same", +/* 42-44 */ "Read sub-channel", "Read TOC", "Read header", +/* 45-47 */ "Play audio (10)", "Get configuration", "Play audio msf", +/* 48 */ "Play audio track/index", +/* 49-4a */ "Play track relative (10)", "Get event/status notification", +/* 4b */ "Pause/resume", +/* 4c-4f */ "Log Select", "Log Sense", "Stop play/scan", unknown, +/* 50-55 */ unknown, "Read disc information", "Read track information", + "Reserve track", "Send OPC information", "Mode Select (10)", +/* 56-5b */ unknown, unknown, "Repair track", unknown, "Mode Sense (10)", + "Close track/session", +/* 5c-5f */ "Read buffer capacity", "Send cue sheet", unknown, +}; + + +/* The following are 12 byte commands in group 5 */ +static const char *group_5_commands[] = { +/* a0-a5 */ unknown, "Blank", unknown, "Send key", "Report key", + "Move medium/play audio(12)", +/* a6-a9 */ "Exchange medium", "Set read ahead", "Read(12)", "Play track relative(12)", +/* aa-ae */ "Write(12)", "Read media s/n", "Erase(12)", "Read disc structure", + "Write and verify(12)", +/* af-b1 */ "Verify(12)", "Search data high(12)", "Search data equal(12)", +/* b2-b4 */ "Search data low(12)", "Set limits(12)", unknown, +/* b5-b6 */ "Request volume element address", "Send volume tag", +/* b7-b9 */ "Read defect data(12)", "Read element status", "Read CD MSF", +/* ba-bf */ unknown, "Set CD speed", unknown, "Mechanism status", "Read CD", + "Send disc structure", +}; + + + + +#define group(opcode) (((opcode) >> 5) & 7) + +#define RESERVED_GROUP 0 +#define VENDOR_GROUP 1 + +static const char **commands[] = { + group_0_commands, group_1_commands, group_2_commands, + (const char **) RESERVED_GROUP, (const char **) RESERVED_GROUP, + group_5_commands, (const char **) VENDOR_GROUP, + (const char **) VENDOR_GROUP +}; + +static const char reserved[] = "RESERVED"; +static const char vendor[] = "VENDOR SPECIFIC"; + +static void print_opcode(int opcode) { + const char **table = commands[ group(opcode) ]; + switch ((unsigned long) table) { + case RESERVED_GROUP: + log_message(0, "%s(0x%02x) ", reserved, opcode); + break; + case VENDOR_GROUP: + log_message(0, "%s(0x%02x) ", vendor, opcode); + break; + default: + if (table[opcode & 0x1f] != unknown) + log_message(0, "%s ",table[opcode & 0x1f]); + else + log_message(0, "%s(0x%02x) ", unknown, opcode); + break; + } +} + +void sg_print_command (const unsigned char * command) { + int i,s; + print_opcode(command[0]); + for ( i = 1, s = COMMAND_SIZE(command[0]); i < s; ++i) + log_message(0, "%02x ", command[i]); + log_message(0, ""); +} + +const char* sg_strcommand(unsigned char opcode) +{ + static char buf[8]; + + const char** table = commands[group(opcode)]; + switch ((unsigned long)table) { + case RESERVED_GROUP: + case VENDOR_GROUP: + break; + default: + if (table[opcode & 0x1f] != unknown) + return table[opcode & 0x1f]; + break; + } + sprintf(buf, "0x%02x", opcode); + return buf; +} + +const char* sg_strcmdopts(const unsigned char* cdb) +{ + static char buf[32]; + + switch (cdb[0]) { + case 0x1a: + case 0x5a: + snprintf(buf, sizeof(buf), " (page %02x.%02x len %d)", cdb[2] & 0x3f, + cdb[3], cdb[8]); + return buf; + case 0x43: + snprintf(buf, sizeof(buf), " (fmt %d num %d)", cdb[2] & 0x0f, + cdb[6]); + return buf; + default: + return ""; + } +} + +static const char * statuses[] = { +/* 0-4 */ "Good", "Check Condition", "Condition Met", unknown, "Busy", +/* 5-9 */ unknown, unknown, unknown, "Intermediate", unknown, +/* a-c */ "Intermediate-Condition Met", unknown, "Reservation Conflict", +/* d-10 */ unknown, unknown, unknown, unknown, +/* 11-14 */ "Command Terminated", unknown, unknown, "Queue Full", +/* 15-1a */ unknown, unknown, unknown, unknown, unknown, unknown, +/* 1b-1f */ unknown, unknown, unknown, unknown, unknown, +}; + +void sg_print_target_status (int target_status) { + /* status = (status >> 1) & 0xf; */ /* already done */ + log_message(0, "%s ",statuses[target_status]); +} + +#define D 0x001 /* DIRECT ACCESS DEVICE (disk) */ +#define T 0x002 /* SEQUENTIAL ACCESS DEVICE (tape) */ +#define L 0x004 /* PRINTER DEVICE */ +#define P 0x008 /* PROCESSOR DEVICE */ +#define W 0x010 /* WRITE ONCE READ MULTIPLE DEVICE */ +#define R 0x020 /* READ ONLY (CD-ROM) DEVICE */ +#define S 0x040 /* SCANNER DEVICE */ +#define O 0x080 /* OPTICAL MEMORY DEVICE */ +#define M 0x100 /* MEDIA CHANGER DEVICE */ +#define C 0x200 /* COMMUNICATION DEVICE */ + +struct error_info{ + unsigned char code1, code2; + unsigned short int devices; + const char * text; +}; + +struct error_info2{ + unsigned char code1, code2_min, code2_max; + unsigned short int devices; + const char * text; +}; + +static struct error_info2 additional2[] = +{ + {0x40,0x00,0x7f,D,"Ram failure (%x)"}, + {0x40,0x80,0xff,D|T|L|P|W|R|S|O|M|C,"Diagnostic failure on component (%x)"}, + {0x41,0x00,0xff,D,"Data path failure (%x)"}, + {0x42,0x00,0xff,D,"Power-on or self-test failure (%x)"}, + {0, 0, 0, 0, NULL} +}; + +static struct error_info additional[] = +{ + {0x00,0x01,T,"Filemark detected"}, + {0x00,0x02,T|S,"End-of-partition/medium detected"}, + {0x00,0x03,T,"Setmark detected"}, + {0x00,0x04,T|S,"Beginning-of-partition/medium detected"}, + {0x00,0x05,T|S,"End-of-data detected"}, + {0x00,0x06,D|T|L|P|W|R|S|O|M|C,"I/O process terminated"}, + {0x00,0x11,R,"Audio play operation in progress"}, + {0x00,0x12,R,"Audio play operation paused"}, + {0x00,0x13,R,"Audio play operation successfully completed"}, + {0x00,0x14,R,"Audio play operation stopped due to error"}, + {0x00,0x15,R,"No current audio status to return"}, + {0x01,0x00,D|W|O,"No index/sector signal"}, + {0x02,0x00,D|W|R|O|M,"No seek complete"}, + {0x03,0x00,D|T|L|W|S|O,"Peripheral device write fault"}, + {0x03,0x01,T,"No write current"}, + {0x03,0x02,T,"Excessive write errors"}, + {0x04,0x00,D|T|L|P|W|R|S|O|M|C, + "Logical unit not ready, cause not reportable"}, + {0x04,0x01,D|T|L|P|W|R|S|O|M|C, + "Logical unit is in process of becoming ready"}, + {0x04,0x02,D|T|L|P|W|R|S|O|M|C, + "Logical unit not ready, initializing command required"}, + {0x04,0x03,D|T|L|P|W|R|S|O|M|C, + "Logical unit not ready, manual intervention required"}, + {0x04,0x04,D|T|L|O,"Logical unit not ready, format in progress"}, + {0x05,0x00,D|T|L|W|R|S|O|M|C,"Logical unit does not respond to selection"}, + {0x06,0x00,D|W|R|O|M,"No reference position found"}, + {0x07,0x00,D|T|L|W|R|S|O|M,"Multiple peripheral devices selected"}, + {0x08,0x00,D|T|L|W|R|S|O|M|C,"Logical unit communication failure"}, + {0x08,0x01,D|T|L|W|R|S|O|M|C,"Logical unit communication time-out"}, + {0x08,0x02,D|T|L|W|R|S|O|M|C,"Logical unit communication parity error"}, + {0x09,0x00,D|T|W|R|O,"Track following error"}, + {0x09,0x01,W|R|O,"Tracking servo failure"}, + {0x09,0x02,W|R|O,"Focus servo failure"}, + {0x09,0x03,W|R|O,"Spindle servo failure"}, + {0x0A,0x00,D|T|L|P|W|R|S|O|M|C,"Error log overflow"}, + {0x0C,0x00,T|S,"Write error"}, + {0x0C,0x01,D|W|O,"Write error recovered with auto reallocation"}, + {0x0C,0x02,D|W|O,"Write error - auto reallocation failed"}, + {0x10,0x00,D|W|O,"Id crc or ecc error"}, + {0x11,0x00,D|T|W|R|S|O,"Unrecovered read error"}, + {0x11,0x01,D|T|W|S|O,"Read retries exhausted"}, + {0x11,0x02,D|T|W|S|O,"Error too long to correct"}, + {0x11,0x03,D|T|W|S|O,"Multiple read errors"}, + {0x11,0x04,D|W|O,"Unrecovered read error - auto reallocate failed"}, + {0x11,0x05,W|R|O,"L-ec uncorrectable error"}, + {0x11,0x06,W|R|O,"Circ unrecovered error"}, + {0x11,0x07,W|O,"Data resynchronization error"}, + {0x11,0x08,T,"Incomplete block read"}, + {0x11,0x09,T,"No gap found"}, + {0x11,0x0A,D|T|O,"Miscorrected error"}, + {0x11,0x0B,D|W|O,"Unrecovered read error - recommend reassignment"}, + {0x11,0x0C,D|W|O,"Unrecovered read error - recommend rewrite the data"}, + {0x12,0x00,D|W|O,"Address mark not found for id field"}, + {0x13,0x00,D|W|O,"Address mark not found for data field"}, + {0x14,0x00,D|T|L|W|R|S|O,"Recorded entity not found"}, + {0x14,0x01,D|T|W|R|O,"Record not found"}, + {0x14,0x02,T,"Filemark or setmark not found"}, + {0x14,0x03,T,"End-of-data not found"}, + {0x14,0x04,T,"Block sequence error"}, + {0x15,0x00,D|T|L|W|R|S|O|M,"Random positioning error"}, + {0x15,0x01,D|T|L|W|R|S|O|M,"Mechanical positioning error"}, + {0x15,0x02,D|T|W|R|O,"Positioning error detected by read of medium"}, + {0x16,0x00,D|W|O,"Data synchronization mark error"}, + {0x17,0x00,D|T|W|R|S|O,"Recovered data with no error correction applied"}, + {0x17,0x01,D|T|W|R|S|O,"Recovered data with retries"}, + {0x17,0x02,D|T|W|R|O,"Recovered data with positive head offset"}, + {0x17,0x03,D|T|W|R|O,"Recovered data with negative head offset"}, + {0x17,0x04,W|R|O,"Recovered data with retries and/or circ applied"}, + {0x17,0x05,D|W|R|O,"Recovered data using previous sector id"}, + {0x17,0x06,D|W|O,"Recovered data without ecc - data auto-reallocated"}, + {0x17,0x07,D|W|O,"Recovered data without ecc - recommend reassignment"}, + {0x18,0x00,D|T|W|R|O,"Recovered data with error correction applied"}, + {0x18,0x01,D|W|R|O,"Recovered data with error correction and retries applied"}, + {0x18,0x02,D|W|R|O,"Recovered data - data auto-reallocated"}, + {0x18,0x03,R,"Recovered data with circ"}, + {0x18,0x04,R,"Recovered data with lec"}, + {0x18,0x05,D|W|R|O,"Recovered data - recommend reassignment"}, + {0x19,0x00,D|O,"Defect list error"}, + {0x19,0x01,D|O,"Defect list not available"}, + {0x19,0x02,D|O,"Defect list error in primary list"}, + {0x19,0x03,D|O,"Defect list error in grown list"}, + {0x1A,0x00,D|T|L|P|W|R|S|O|M|C,"Parameter list length error"}, + {0x1B,0x00,D|T|L|P|W|R|S|O|M|C,"Synchronous data transfer error"}, + {0x1C,0x00,D|O,"Defect list not found"}, + {0x1C,0x01,D|O,"Primary defect list not found"}, + {0x1C,0x02,D|O,"Grown defect list not found"}, + {0x1D,0x00,D|W|O,"Miscompare during verify operation"}, + {0x1E,0x00,D|W|O,"Recovered id with ecc correction"}, + {0x20,0x00,D|T|L|P|W|R|S|O|M|C,"Invalid command operation code"}, + {0x21,0x00,D|T|W|R|O|M,"Logical block address out of range"}, + {0x21,0x01,M,"Invalid element address"}, + {0x22,0x00,D,"Illegal function (should use 20 00, 24 00, or 26 00)"}, + {0x24,0x00,D|T|L|P|W|R|S|O|M|C,"Invalid field in cdb"}, + {0x25,0x00,D|T|L|P|W|R|S|O|M|C,"Logical unit not supported"}, + {0x26,0x00,D|T|L|P|W|R|S|O|M|C,"Invalid field in parameter list"}, + {0x26,0x01,D|T|L|P|W|R|S|O|M|C,"Parameter not supported"}, + {0x26,0x02,D|T|L|P|W|R|S|O|M|C,"Parameter value invalid"}, + {0x26,0x03,D|T|L|P|W|R|S|O|M|C,"Threshold parameters not supported"}, + {0x27,0x00,D|T|W|O,"Write protected"}, + {0x28,0x00,D|T|L|P|W|R|S|O|M|C,"Not ready to ready transition (medium may have changed)"}, + {0x28,0x01,M,"Import or export element accessed"}, + {0x29,0x00,D|T|L|P|W|R|S|O|M|C,"Power on, reset, or bus device reset occurred"}, + {0x2A,0x00,D|T|L|W|R|S|O|M|C,"Parameters changed"}, + {0x2A,0x01,D|T|L|W|R|S|O|M|C,"Mode parameters changed"}, + {0x2A,0x02,D|T|L|W|R|S|O|M|C,"Log parameters changed"}, + {0x2B,0x00,D|T|L|P|W|R|S|O|C,"Copy cannot execute since host cannot disconnect"}, + {0x2C,0x00,D|T|L|P|W|R|S|O|M|C,"Command sequence error"}, + {0x2C,0x01,S,"Too many windows specified"}, + {0x2C,0x02,S,"Invalid combination of windows specified"}, + {0x2D,0x00,T,"Overwrite error on update in place"}, + {0x2F,0x00,D|T|L|P|W|R|S|O|M|C,"Commands cleared by another initiator"}, + {0x30,0x00,D|T|W|R|O|M,"Incompatible medium installed"}, + {0x30,0x01,D|T|W|R|O,"Cannot read medium - unknown format"}, + {0x30,0x02,D|T|W|R|O,"Cannot read medium - incompatible format"}, + {0x30,0x03,D|T,"Cleaning cartridge installed"}, + {0x31,0x00,D|T|W|O,"Medium format corrupted"}, + {0x31,0x01,D|L|O,"Format command failed"}, + {0x32,0x00,D|W|O,"No defect spare location available"}, + {0x32,0x01,D|W|O,"Defect list update failure"}, + {0x33,0x00,T,"Tape length error"}, + {0x36,0x00,L,"Ribbon, ink, or toner failure"}, + {0x37,0x00,D|T|L|W|R|S|O|M|C,"Rounded parameter"}, + {0x39,0x00,D|T|L|W|R|S|O|M|C,"Saving parameters not supported"}, + {0x3A,0x00,D|T|L|W|R|S|O|M,"Medium not present"}, + {0x3B,0x00,T|L,"Sequential positioning error"}, + {0x3B,0x01,T,"Tape position error at beginning-of-medium"}, + {0x3B,0x02,T,"Tape position error at end-of-medium"}, + {0x3B,0x03,L,"Tape or electronic vertical forms unit not ready"}, + {0x3B,0x04,L,"Slew failure"}, + {0x3B,0x05,L,"Paper jam"}, + {0x3B,0x06,L,"Failed to sense top-of-form"}, + {0x3B,0x07,L,"Failed to sense bottom-of-form"}, + {0x3B,0x08,T,"Reposition error"}, + {0x3B,0x09,S,"Read past end of medium"}, + {0x3B,0x0A,S,"Read past beginning of medium"}, + {0x3B,0x0B,S,"Position past end of medium"}, + {0x3B,0x0C,S,"Position past beginning of medium"}, + {0x3B,0x0D,M,"Medium destination element full"}, + {0x3B,0x0E,M,"Medium source element empty"}, + {0x3D,0x00,D|T|L|P|W|R|S|O|M|C,"Invalid bits in identify message"}, + {0x3E,0x00,D|T|L|P|W|R|S|O|M|C,"Logical unit has not self-configured yet"}, + {0x3F,0x00,D|T|L|P|W|R|S|O|M|C,"Target operating conditions have changed"}, + {0x3F,0x01,D|T|L|P|W|R|S|O|M|C,"Microcode has been changed"}, + {0x3F,0x02,D|T|L|P|W|R|S|O|M|C,"Changed operating definition"}, + {0x3F,0x03,D|T|L|P|W|R|S|O|M|C,"Inquiry data has changed"}, + {0x43,0x00,D|T|L|P|W|R|S|O|M|C,"Message error"}, + {0x44,0x00,D|T|L|P|W|R|S|O|M|C,"Internal target failure"}, + {0x45,0x00,D|T|L|P|W|R|S|O|M|C,"Select or reselect failure"}, + {0x46,0x00,D|T|L|P|W|R|S|O|M|C,"Unsuccessful soft reset"}, + {0x47,0x00,D|T|L|P|W|R|S|O|M|C,"Scsi parity error"}, + {0x48,0x00,D|T|L|P|W|R|S|O|M|C,"Initiator detected error message received"}, + {0x49,0x00,D|T|L|P|W|R|S|O|M|C,"Invalid message error"}, + {0x4A,0x00,D|T|L|P|W|R|S|O|M|C,"Command phase error"}, + {0x4B,0x00,D|T|L|P|W|R|S|O|M|C,"Data phase error"}, + {0x4C,0x00,D|T|L|P|W|R|S|O|M|C,"Logical unit failed self-configuration"}, + {0x4E,0x00,D|T|L|P|W|R|S|O|M|C,"Overlapped commands attempted"}, + {0x50,0x00,T,"Write append error"}, + {0x50,0x01,T,"Write append position error"}, + {0x50,0x02,T,"Position error related to timing"}, + {0x51,0x00,T|O,"Erase failure"}, + {0x52,0x00,T,"Cartridge fault"}, + {0x53,0x00,D|T|L|W|R|S|O|M,"Media load or eject failed"}, + {0x53,0x01,T,"Unload tape failure"}, + {0x53,0x02,D|T|W|R|O|M,"Medium removal prevented"}, + {0x54,0x00,P,"Scsi to host system interface failure"}, + {0x55,0x00,P,"System resource failure"}, + {0x57,0x00,R,"Unable to recover table-of-contents"}, + {0x58,0x00,O,"Generation does not exist"}, + {0x59,0x00,O,"Updated block read"}, + {0x5A,0x00,D|T|L|P|W|R|S|O|M,"Operator request or state change input (unspecified)"}, + {0x5A,0x01,D|T|W|R|O|M,"Operator medium removal request"}, + {0x5A,0x02,D|T|W|O,"Operator selected write protect"}, + {0x5A,0x03,D|T|W|O,"Operator selected write permit"}, + {0x5B,0x00,D|T|L|P|W|R|S|O|M,"Log exception"}, + {0x5B,0x01,D|T|L|P|W|R|S|O|M,"Threshold condition met"}, + {0x5B,0x02,D|T|L|P|W|R|S|O|M,"Log counter at maximum"}, + {0x5B,0x03,D|T|L|P|W|R|S|O|M,"Log list codes exhausted"}, + {0x5C,0x00,D|O,"Rpl status change"}, + {0x5C,0x01,D|O,"Spindles synchronized"}, + {0x5C,0x02,D|O,"Spindles not synchronized"}, + {0x60,0x00,S,"Lamp failure"}, + {0x61,0x00,S,"Video acquisition error"}, + {0x61,0x01,S,"Unable to acquire video"}, + {0x61,0x02,S,"Out of focus"}, + {0x62,0x00,S,"Scan head positioning error"}, + {0x63,0x00,R,"End of user area encountered on this track"}, + {0x64,0x00,R,"Illegal mode for this track"}, + {0, 0, 0, NULL} +}; + +static const char *snstext[] = { + "None", /* There is no sense information */ + "Recovered Error", /* The last command completed successfully + but used error correction */ + "Not Ready", /* The addressed target is not ready */ + "Medium Error", /* Data error detected on the medium */ + "Hardware Error", /* Controller or device failure */ + "Illegal Request", + "Unit Attention", /* Removable medium was changed, or + the target has been reset */ + "Data Protect", /* Access to the data is blocked */ + "Blank Check", /* Reached unexpected written or unwritten + region of the medium */ + "Key=9", /* Vendor specific */ + "Copy Aborted", /* COPY or COMPARE was aborted */ + "Aborted Command", /* The target aborted the command */ + "Equal", /* A SEARCH DATA command found data equal */ + "Volume Overflow", /* Medium full with still data to be written */ + "Miscompare", /* Source data and data on the medium + do not agree */ + "Key=15" /* Reserved */ +}; + +/* Print sense information */ +void sg_print_sense(const char * leadin, const unsigned char * sense_buffer) +{ + int i, s; + int sense_class, valid, code; + const char * error = NULL; + + sense_class = (sense_buffer[0] >> 4) & 0x07; + code = sense_buffer[0] & 0xf; + valid = sense_buffer[0] & 0x80; + + if (sense_class == 7) { /* extended sense data */ + s = sense_buffer[7] + 8; + if(s > SG_ERR_MAX_SENSE_LEN) + s = SG_ERR_MAX_SENSE_LEN; + + if (!valid) + log_message(0, "[valid=0] "); + log_message(0, "Info fld=%d, ", (int)((sense_buffer[3] << 24) | + (sense_buffer[4] << 16) | (sense_buffer[5] << 8) | + sense_buffer[6])); + + if (sense_buffer[2] & 0x80) + log_message(0, "FMK "); /* current command has read a filemark */ + if (sense_buffer[2] & 0x40) + log_message(0, "EOM "); /* end-of-medium condition exists */ + if (sense_buffer[2] & 0x20) + log_message(0, "ILI "); /* incorrect block length requested */ + + switch (code) { + case 0x0: + error = "Current"; /* error concerns current command */ + break; + case 0x1: + error = "Deferred"; /* error concerns some earlier command */ + /* e.g., an earlier write to disk cache succeeded, but + now the disk discovers that it cannot write the data */ + break; + default: + error = "Invalid"; + } + + log_message(0, "%s ", error); + + if (leadin) + log_message(0, "%s: ", leadin); + log_message(0, "sense key: 0x%02x: %s", sense_buffer[2] & 0x0f, + snstext[sense_buffer[2] & 0x0f]); + + /* Check to see if additional sense information is available */ + if(sense_buffer[7] + 7 < 13 || + (sense_buffer[12] == 0 && sense_buffer[13] == 0)) goto done; + + for(i=0; additional[i].text; i++) + if(additional[i].code1 == sense_buffer[12] && + additional[i].code2 == sense_buffer[13]) + log_message(0, "Additional sense indicates: %s", + additional[i].text); + + for(i=0; additional2[i].text; i++) + if(additional2[i].code1 == sense_buffer[12] && + additional2[i].code2_min >= sense_buffer[13] && + additional2[i].code2_max <= sense_buffer[13]) { + log_message(0, "Additional sense indicates: "); + log_message(0, additional2[i].text, sense_buffer[13]); + log_message(0, ""); + }; + } else { /* non-extended sense data */ + + /* + * Standard says: + * sense_buffer[0] & 0200 : address valid + * sense_buffer[0] & 0177 : vendor-specific error code + * sense_buffer[1] & 0340 : vendor-specific + * sense_buffer[1..3] : 21-bit logical block address + */ + + if (leadin) + log_message(0, "%s: ", leadin); + if (sense_buffer[0] < 15) + log_message(0, "old sense: key %s", snstext[sense_buffer[0] & 0x0f]); + else + log_message(0, "sns = %2x %2x", sense_buffer[0], sense_buffer[2]); + + log_message(0, "Non-extended sense class %d code 0x%0x", sense_class, code); + s = 4; + } + + done: + log_message(0, "Raw sense data: "); + for (i = 0; i < s; ++i) { + if ((i > 0) && (0 == (i % 10))) + log_message(0, ""); + log_message(0, "0x%02x ", sense_buffer[i]); + } + log_message(0, ""); + return; +} + +static const char * hostbyte_table[]={ +"DID_OK", "DID_NO_CONNECT", "DID_BUS_BUSY", "DID_TIME_OUT", "DID_BAD_TARGET", +"DID_ABORT", "DID_PARITY", "DID_ERROR", "DID_RESET", "DID_BAD_INTR", +"DID_PASSTHROUGH", "DID_SOFT_ERROR", NULL}; + +void sg_print_host_status(int host_status) +{ static int maxcode=0; + int i; + + if(! maxcode) { + for(i = 0; hostbyte_table[i]; i++) ; + maxcode = i-1; + } + log_message(0, "Host_status=0x%02x ", host_status); + if(host_status > maxcode) { + log_message(0, "is invalid "); + return; + } + log_message(0, "(%s) ",hostbyte_table[host_status]); +} + +static const char * driverbyte_table[]={ +"DRIVER_OK", "DRIVER_BUSY", "DRIVER_SOFT", "DRIVER_MEDIA", "DRIVER_ERROR", +"DRIVER_INVALID", "DRIVER_TIMEOUT", "DRIVER_HARD", "DRIVER_SENSE", NULL}; + +static const char * driversuggest_table[]={"SUGGEST_OK", +"SUGGEST_RETRY", "SUGGEST_ABORT", "SUGGEST_REMAP", "SUGGEST_DIE", +unknown,unknown,unknown, "SUGGEST_SENSE",NULL}; + + +void sg_print_driver_status(int driver_status) +{ + static int driver_max =0 , suggest_max=0; + int i; + int dr = driver_status & DRIVER_MASK; + int su = (driver_status & SUGGEST_MASK) >> 4; + + if(! driver_max) { + for(i = 0; driverbyte_table[i]; i++) ; + driver_max = i; + for(i = 0; driversuggest_table[i]; i++) ; + suggest_max = i; + } + log_message(0, "Driver_status=0x%02x ",driver_status); + log_message(0, "(%s,%s) ", + dr < driver_max ? driverbyte_table[dr]:"invalid", + su < suggest_max ? driversuggest_table[su]:"invalid"); +} + +int sg_chk_n_print(const char * leadin, int target_status, + int host_status, int driver_status, + const unsigned char * sense_buffer) +{ + int done_leadin = 0; + int done_sense = 0; + + if ((0 == target_status) && (0 == host_status) && (0 == driver_status)) + return 1; /* No problems */ + if (0 != target_status) { + if (leadin) + log_message(0, "%s: ", leadin); + done_leadin = 1; + sg_print_target_status(target_status); + log_message(0, ""); + if (sense_buffer && ((target_status == CHECK_CONDITION) || + (target_status == COMMAND_TERMINATED))) { + sg_print_sense(0, sense_buffer); + done_sense = 1; + } + } + if (0 != host_status) { + if (leadin && (! done_leadin)) + log_message(0, "%s: ", leadin); + if (done_leadin) + log_message(0, "plus...: "); + else + done_leadin = 1; + sg_print_host_status(host_status); + log_message(0, ""); + } + if (0 != driver_status) { + if (leadin && (! done_leadin)) + log_message(0, "%s: ", leadin); + if (done_leadin) + log_message(0, "plus...: "); + else + done_leadin = 1; + sg_print_driver_status(driver_status); + log_message(0, ""); + if (sense_buffer && (! done_sense) && (DRIVER_SENSE & driver_status)) + sg_print_sense(0, sense_buffer); + } + return 0; +} + +int sg_err_category(int target_status, int host_status, int driver_status, + const unsigned char * sense_buffer) +{ + if ((0 == target_status) && (0 == host_status) && (0 == driver_status)) + return SG_ERR_CAT_CLEAN; + if ((CHECK_CONDITION == target_status) || + (COMMAND_TERMINATED == target_status) || + (DRIVER_SENSE & driver_status)) { + if (sense_buffer) { + if(RECOVERED_ERROR == sense_buffer[2]) + return SG_ERR_CAT_RECOVERED; + else if (UNIT_ATTENTION == (0x0f & sense_buffer[2])) { + if (0x28 == sense_buffer[12]) + return SG_ERR_CAT_MEDIA_CHANGED; + if (0x29 == sense_buffer[12]) + return SG_ERR_CAT_RESET; + } + } + return SG_ERR_CAT_SENSE; + } + if (0 != host_status) { + if ((DID_NO_CONNECT == host_status) || + (DID_BUS_BUSY == host_status) || + (DID_TIME_OUT == host_status)) + return SG_ERR_CAT_TIMEOUT; + } + if (0 != driver_status) { + if (DRIVER_TIMEOUT == driver_status) + return SG_ERR_CAT_TIMEOUT; + } + return SG_ERR_CAT_OTHER; +} + +int sg_get_command_size(unsigned char opcode) +{ + return COMMAND_SIZE(opcode); +} diff --git a/dao/sg_err.h b/dao/sg_err.h new file mode 100644 index 0000000..fcd1dd4 --- /dev/null +++ b/dao/sg_err.h @@ -0,0 +1,100 @@ +#ifndef SG_ERR_H +#define SG_ERR_H +#include <linux/../scsi/scsi.h> /* cope with silly includes */ + +/* Feel free to copy and modify this GPL-ed code into your applications. */ + +/* Version 0.61 (990519) */ + + +/* Some of the following error/status codes are exchanged between the + various layers of the SCSI sub-system in Linux and should never + reach the user. They are placed here for completeness. What appears + here is copied from drivers/scsi/scsi.h which is not visible in + the user space. */ + +/* The following are 'host_status' codes */ +#ifndef DID_OK +#define DID_OK 0x00 +#endif +#ifndef DID_NO_CONNECT +#define DID_NO_CONNECT 0x01 /* Unable to connect before timeout */ +#define DID_BUS_BUSY 0x02 /* Bus remain busy until timeout */ +#define DID_TIME_OUT 0x03 /* Timed out for some other reason */ +#define DID_BAD_TARGET 0x04 /* Bad target (id?) */ +#define DID_ABORT 0x05 /* Told to abort for some other reason */ +#define DID_PARITY 0x06 /* Parity error (on SCSI bus) */ +#define DID_ERROR 0x07 /* Internal error */ +#define DID_RESET 0x08 /* Reset by somebody */ +#define DID_BAD_INTR 0x09 /* Received an unexpected interrupt */ +#define DID_PASSTHROUGH 0x0a /* Force command past mid-level */ +#define DID_SOFT_ERROR 0x0b /* The low-level driver wants a retry */ +#endif + +/* The following are 'driver_status' codes */ +#ifndef DRIVER_OK +#define DRIVER_OK 0x00 +#endif +#ifndef DRIVER_BUSY +#define DRIVER_BUSY 0x01 +#define DRIVER_SOFT 0x02 +#define DRIVER_MEDIA 0x03 +#define DRIVER_ERROR 0x04 + +#define DRIVER_INVALID 0x05 +#define DRIVER_TIMEOUT 0x06 +#define DRIVER_HARD 0x07 +#define DRIVER_SENSE 0x08 /* Sense_buffer has been set */ + +/* Following "suggests" are "or-ed" with one of previous 8 entries */ +#define SUGGEST_RETRY 0x10 +#define SUGGEST_ABORT 0x20 +#define SUGGEST_REMAP 0x30 +#define SUGGEST_DIE 0x40 +#define SUGGEST_SENSE 0x80 +#define SUGGEST_IS_OK 0xff +#endif +#ifndef DRIVER_MASK +#define DRIVER_MASK 0x0f +#endif +#ifndef SUGGEST_MASK +#define SUGGEST_MASK 0xf0 +#endif + +#define SG_ERR_MAX_SENSE_LEN 16 + + +/* The following "print" functions send ACSII to stdout */ +extern void sg_print_command(const unsigned char * command); +extern const char* sg_strcommand(unsigned char opcode); +extern const char* sg_strcmdopts(const unsigned char* command); +extern void sg_print_sense(const char * leadin, + const unsigned char * sense_buffer); +extern void sg_print_target_status(int target_status); +extern void sg_print_host_status(int host_status); +extern void sg_print_driver_status(int driver_status); + +/* sg_chk_n_print() returns 1 quietly if there are no errors/warnings + else it prints to standard output and returns 0. */ +extern int sg_chk_n_print(const char * leadin, int target_status, + int host_status, int driver_status, + const unsigned char * sense_buffer); + + +/* The following "category" function returns one of the following */ +#define SG_ERR_CAT_CLEAN 0 /* No errors or other information */ +#define SG_ERR_CAT_MEDIA_CHANGED 1 /* interpreted from sense buffer */ +#define SG_ERR_CAT_RESET 2 /* interpreted from sense buffer */ +#define SG_ERR_CAT_TIMEOUT 3 +#define SG_ERR_CAT_RECOVERED 4 /* Successful command after recovered err */ +#define SG_ERR_CAT_SENSE 98 /* Something else is in the sense buffer */ +#define SG_ERR_CAT_OTHER 99 /* Some other error/warning has occurred */ + +extern int sg_err_category(int target_status, int host_status, + int driver_status, const unsigned char * sense_buffer); + + +/* Returns length of SCSI command given the opcode (first byte) */ +int sg_get_command_size(unsigned char opcode); + +#endif diff --git a/dao/winaspi.h b/dao/winaspi.h new file mode 100644 index 0000000..993be3a --- /dev/null +++ b/dao/winaspi.h @@ -0,0 +1,219 @@ +/*------------------------------------------------------------------------------ + winaspi.h +------------------------------------------------------------------------------*/ + +#define SS_PENDING 0x00 // SCSI request is in progress. +#define SS_COMP 0x01 // SCSI Request Completed Without Error +#define SS_ABORTED 0x02 // SCSI command has been aborted. +#define SS_ERR 0x04 // SCSI command has completed with an error. +#define SS_INVALID_SRB 0xE0 // One or more parameters in the SCSI Request Block + // (SRB) are set incorrectly. +#define SS_OLD_MANAGER 0xE1 // One or more ASPI for DOS managers are loaded which + // do not support ASPI for Win16. +#define SS_ILLEGAL_MODE 0xE2 // This ASPI manager does not support this mode of + // Windows. You typically see this error code when + // running Windows in Real Mode. +#define SS_NO_ASPI 0xE3 // No ASPI managers are loaded. This typically occurs + // when a DOS ASPI manager is not resident in memory. +#define SS_FAILED_INIT 0xE4 // For some reason, other than SS_OLD_MANAGER, + // SS_ILLEGAL_MODE or SS_NO_ASPI, ASPI for Win16 + // could not properly initialize itself. This may be + // caused by a lack of system resources. +#define SS_ASPI_IS_BUSY 0xE5 // The ASPI manager cannot handle the request at this + // time. This error generally occurs if the ASPI + // manager is already using up all of his resources + // to execute other requests. Try resending the + // command later. +#define SS_BUFFER_TO_BIG 0xE6 // The ASPI manager cannot handle the given transfer +#define SS_INVALID_HA 0x81 // Invalid Host Adapter Number +#define SS_NO_DEVICE 0x82 // SCSI Device Not Installed + +#define HASTAT_OK 0x00 // Host adapter did not detect an error +#define HASTAT_SEL_TO 0x11 // Selection time-out +#define HASTAT_DO_DU 0x12 // Data overrun/underrun +#define HASTAT_BUS_FREE 0x13 // Unexpected Bus Free +#define HASTAT_PHASE_ERR 0x14 // Target Bus phase sequence failure + +#define STATUS_GOOD 0x00 // No target status +#define STATUS_CHKCOND 0x02 // Check status (sense data is in SenseArea) +#define STATUS_BUSY 0x08 // Specified Target/LUN is busy +#define STATUS_RESCONF 0x18 // Reservation conflict + +#define SENSE_LEN 14 + + +#define SC_HA_INQUIRY 0x00 +#define SC_GET_DEV_TYPE 0x01 +#define SC_EXEC_SCSI_CMD 0x02 +#define SC_ABORT_SRB 0x03 +#define SC_RESET_DEV 0x04 + +#define SRBF_POSTING 0x01 +#define SRBF_LINKED 0x02 +#define SRBF_NOLENCHECK 0x00 // direction ctrled by SCSI cmd +#define SRBF_READ 0x08 // xfer to host, length checked +#define SRBF_WRITE 0x10 // xfer to target, length checked +#define SRBF_NOXFER 0x18 // no data transfer +#define SRB_EVENT_NOTIFY 0x40 + + + +/* +typedef unsigned char BYTE; +typedef unsigned int WORD; +typedef unsigned long DWORD; +*/ + +typedef unsigned char * LPSRB; + + +typedef struct +{ + BYTE SRB_Cmd; // ASPI command code = SC_HA_INQUIRY + BYTE SRB_Status; // ASPI command status byte + BYTE SRB_HaId; // ASPI host adapter number + BYTE SRB_Flags; // ASPI request flags + WORD SRB_55AASignature; // Extended signature bytes + WORD SRB_ExtBufferSize; // Extended buffer length + BYTE HA_Count; // Number of host adapters present + BYTE HA_SCSI_ID; // SCSI ID of host adapter + BYTE HA_ManagerId[16]; // String describing the manager + BYTE HA_Identifier[16]; // String describing the host adapter + BYTE HA_Unique[16]; // Host Adapter Unique parameters + WORD HA_ExtBuffer; // Extended buffer area +} SRB_HAInquiry; + +typedef struct +{ + BYTE SRB_Cmd; // ASPI command code = SC_GET_DEV_TYPE + BYTE SRB_Status; // ASPI command status byte + BYTE SRB_HaId; // ASPI host adapter number + BYTE SRB_Flags; // ASPI request flags + DWORD SRB_Hdr_Rsvd; // Reserved, MUST = 0 + BYTE SRB_Target; // Target's SCSI ID + BYTE SRB_Lun; // Target's LUN number + BYTE SRB_DeviceType; // Target's peripheral device type + BYTE SRB_Rsvd1; // Reserved for alignment +} SRB_GDEVBlock; + +typedef struct +{ // Structure for 6-byte CDBs + BYTE SRB_Cmd; // ASPI command code = SC_EXEC_SCSI_CMD + BYTE SRB_Status; // ASPI command status byte + BYTE SRB_HaId; // ASPI host adapter number + BYTE SRB_Flags; // ASPI request flags + DWORD SRB_Hdr_Rsvd; // Reserved, MUST = 0 + BYTE SRB_Target; // Target's SCSI ID + BYTE SRB_Lun; // Target's LUN number + WORD SRB_Rsvd1; // Reserved for Alignment + DWORD SRB_BufLen; // Data Allocation LengthPG + BYTE *SRB_BufPointer; // Data Buffer Pointer + BYTE SRB_SenseLen; // Sense Allocation Length + BYTE SRB_CDBLen; // CDB Length = 6 + BYTE SRB_HaStat; // Host Adapter Status + BYTE SRB_TargStat; // Target Status + void (*SRB_PostProc)(); // Post routine + void *SRB_Rsvd2; // Reserved + BYTE SRB_Rsvd3[16]; // Reserved for expansion + BYTE CDBByte[16]; // SCSI CDB + BYTE SenseArea[SENSE_LEN+2]; // Request Sense buffer +} SRB_ExecSCSICmd6; + +typedef struct +{ // Structure for 10-byte CDBs + BYTE SRB_Cmd; // ASPI command code = SC_EXEC_SCSI_CMD + BYTE SRB_Status; // ASPI command status byte + BYTE SRB_HaId; // ASPI host adapter number + BYTE SRB_Flags; // ASPI request flags + DWORD SRB_Hdr_Rsvd; // Reserved, MUST = 0 + BYTE SRB_Target; // Target's SCSI ID + BYTE SRB_Lun; // Target's LUN number + WORD SRB_Rsvd1; // Reserved, MUST = 0 + DWORD SRB_BufLen; // Data Allocation Length + BYTE *SRB_BufPointer; // Data Buffer Pointer + BYTE SRB_SenseLen; // Sense Allocation Length + BYTE SRB_CDBLen; // CDB Length = 10 + BYTE SRB_HaStat; // Host Adapter Status + BYTE SRB_TargStat; // Target Status + void (*SRB_PostProc)(); // Post routine + void *SRB_Rsvd2; // Reserved + BYTE SRB_Rsvd3[16]; // Reserved for expansion + BYTE CDBByte[16]; // SCSI CDB + BYTE SenseArea10[SENSE_LEN+2]; // Request Sense buffer +} SRB_ExecSCSICmd10; + +typedef struct +{ + BYTE SRB_Cmd; // ASPI command code = SC_EXEC_SCSI_CMD + BYTE SRB_Status; // ASPI command status byte + BYTE SRB_HaId; // ASPI host adapter number + BYTE SRB_Flags; // ASPI request flags + DWORD SRB_Hdr_Rsvd; // Reserved, MUST = 0 + BYTE SRB_Target; // Target's SCSI ID + BYTE SRB_Lun; // Target's LUN number + WORD SRB_Rsvd1; // Reserved, MUST = 0 + DWORD SRB_BufLen; // Data Allocation Length + BYTE *SRB_BufPointer; // Data Buffer Pointer + BYTE SRB_SenseLen; // Sense Allocation Length + BYTE SRB_CDBLen; // CDB Length = 10 + BYTE SRB_HaStat; // Host Adapter Status + BYTE SRB_TargStat; // Target Status + void (*SRB_PostProc)(); // Post routine + void *SRB_Rsvd2; // Reserved + BYTE SRB_Rsvd3[16]; // Reserved for expansion + BYTE CDBByte[16]; // SCSI CDB + BYTE SenseArea12[SENSE_LEN+2]; // Request Sense buffer +} SRB_ExecSCSICmd12; + + +typedef struct +{ + BYTE SRB_Cmd; // ASPI command code = SC_ABORT_SRB + BYTE SRB_Status; // ASPI command status byte + BYTE SRB_HaId; // ASPI host adapter number + BYTE SRB_Flags; // ASPI request flags + DWORD SRB_Hdr_Rsvd; // Reserved, MUST = 0 + void *SRB_ToAbort; // Pointer to SRB to abort +} SRB_Abort; + +typedef struct +{ + BYTE SRB_Cmd; // ASPI command code = SC_RESET_DEV + BYTE SRB_Status; // ASPI command status byte + BYTE SRB_HaId; // ASPI host adapter number + BYTE SRB_Flags; // ASPI request flags + DWORD SRB_Hdr_Rsvd; // Reserved, MUST = 0 + BYTE SRB_Target; // Target's SCSI ID + BYTE SRB_Lun; // Target's LUN number + BYTE SRB_ResetRsvd1[12]; // Reserved, MUST = 0 + BYTE SRB_HaStat; // Host Adapter Status + BYTE SRB_TargStat; // Target Status + void *SRB_PostProc; // Post routine + void *SRB_Rsvd2; // Reserved + BYTE SRB_Rsvd3[32]; // Reserved +} SRB_BusDeviceReset; + + +typedef struct +{ + BYTE res0; + BYTE TRACK_adr_contrl; + BYTE TRACK_nr; + BYTE res1; + DWORD TRACK_abs_adr; +} TRACK; + +typedef struct +{ + WORD TOC_len; + BYTE TOC_first; + BYTE TOC_last; + TRACK track[99]; +} TOC; + + + +void ASPIPostProc6 (SRB_ExecSCSICmd6 *DoneSRB); +void ASPIPostProc10 (SRB_ExecSCSICmd10 *DoneSRB); +void ASPIPostProc12 (SRB_ExecSCSICmd12 *DoneSRB); + diff --git a/depcomp b/depcomp new file mode 100755 index 0000000..807b991 --- /dev/null +++ b/depcomp @@ -0,0 +1,423 @@ +#! /bin/sh + +# depcomp - compile a program generating dependencies as side-effects +# Copyright 1999, 2000 Free Software Foundation, Inc. + +# This program 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, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>. + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi +# `libtool' can also be set to `yes' or `no'. + +if test -z "$depfile"; then + base=`echo "$object" | sed -e 's,^.*/,,' -e 's,\.\([^.]*\)$,.P\1,'` + dir=`echo "$object" | sed 's,/.*$,/,'` + if test "$dir" = "$object"; then + dir= + fi + # FIXME: should be _deps on DOS. + depfile="$dir.deps/$base" +fi + +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. + "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> $depfile + echo >> $depfile + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> $depfile + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. This file always lives in the current directory. + # Also, the AIX compiler puts `$object:' at the start of each line; + # $object doesn't have directory information. + stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` + tmpdepfile="$stripped.u" + outname="$stripped.o" + if test "$libtool" = yes; then + "$@" -Wc,-M + else + "$@" -M + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" + sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + tmpdepfile1="$dir.libs/$base.lo.d" + tmpdepfile2="$dir.libs/$base.d" + "$@" -Wc,-MD + else + tmpdepfile1="$dir$base.o.d" + tmpdepfile2="$dir$base.d" + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + if test -f "$tmpdepfile1"; then + tmpdepfile="$tmpdepfile1" + else + tmpdepfile="$tmpdepfile2" + fi + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a space and a tab in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. We will use -o /dev/null later, + # however we can't do the remplacement now because + # `-o $object' might simply not be used + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + "$@" -o /dev/null $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # X makedepend + shift + cleared=no + for arg in "$@"; do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + -*) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix="`echo $object | sed 's/^.*\././'`" + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test $1 != '--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the proprocessed file to stdout, regardless of -o, + # because we must use -o when running libtool. + "$@" || exit $? + IFS=" " + for arg + do + case "$arg" in + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 diff --git a/install-sh b/install-sh new file mode 100755 index 0000000..ebc6691 --- /dev/null +++ b/install-sh @@ -0,0 +1,250 @@ +#! /bin/sh +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# +# Copyright 1991 by the Massachusetts Institute of Technology +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/missing b/missing new file mode 100755 index 0000000..6a37006 --- /dev/null +++ b/missing @@ -0,0 +1,336 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997, 1999, 2000, 2002 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. + +# This program 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, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +case "$1" in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case "$1" in + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing 0.4 - GNU automake" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case "$f" in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. + You can get \`$1Help2man' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` + test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison|yacc) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if [ ! -f y.tab.h ]; then + echo >y.tab.h + fi + if [ ! -f y.tab.c ]; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex|flex) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if [ $# -ne 1 ]; then + eval LASTARG="\${$#}" + case "$LASTARG" in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if [ -f "$SRCFILE" ]; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if [ ! -f lex.yy.c ]; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` + fi + if [ -f "$file" ]; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit 1 + fi + ;; + + makeinfo) + if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then + # We have makeinfo, but it failed. + exit 1 + fi + + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` + if test -z "$file"; then + file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` + fi + touch $file + ;; + + tar) + shift + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + fi + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case "$firstarg" in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case "$firstarg" in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and you do not seem to have it handy on your + system. You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequirements for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 diff --git a/mkinstalldirs b/mkinstalldirs new file mode 100755 index 0000000..750926c --- /dev/null +++ b/mkinstalldirs @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman <friedman@prep.ai.mit.edu> +# Created: 1993-05-16 +# Public domain + +# $Id: mkinstalldirs,v 1.1.1.1 2000/02/05 01:30:58 llanero Exp $ + +errstatus=0 + +for file +do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d + do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" 1>&2 + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/paranoia/Makefile.am b/paranoia/Makefile.am new file mode 100644 index 0000000..37101e7 --- /dev/null +++ b/paranoia/Makefile.am @@ -0,0 +1,3 @@ +noinst_LIBRARIES = libcdda_paranoia.a + +libcdda_paranoia_a_SOURCES = paranoia.c p_block.c overlap.c gap.c isort.c cdda_paranoia.h gap.h isort.h overlap.h p_block.h diff --git a/paranoia/Makefile.in b/paranoia/Makefile.in new file mode 100644 index 0000000..f4705c2 --- /dev/null +++ b/paranoia/Makefile.in @@ -0,0 +1,442 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = paranoia +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libcdda_paranoia_a_AR = $(AR) $(ARFLAGS) +libcdda_paranoia_a_LIBADD = +am_libcdda_paranoia_a_OBJECTS = paranoia.$(OBJEXT) p_block.$(OBJEXT) \ + overlap.$(OBJEXT) gap.$(OBJEXT) isort.$(OBJEXT) +libcdda_paranoia_a_OBJECTS = $(am_libcdda_paranoia_a_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libcdda_paranoia_a_SOURCES) +DIST_SOURCES = $(libcdda_paranoia_a_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AO_CFLAGS = @AO_CFLAGS@ +AO_LIBS = @AO_LIBS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COND_MP3_FALSE = @COND_MP3_FALSE@ +COND_MP3_TRUE = @COND_MP3_TRUE@ +COND_OGG_FALSE = @COND_OGG_FALSE@ +COND_OGG_TRUE = @COND_OGG_TRUE@ +COND_PCCTS_FALSE = @COND_PCCTS_FALSE@ +COND_PCCTS_TRUE = @COND_PCCTS_TRUE@ +COND_SCSILIB_FALSE = @COND_SCSILIB_FALSE@ +COND_SCSILIB_TRUE = @COND_SCSILIB_TRUE@ +COND_TOC2MP3_FALSE = @COND_TOC2MP3_FALSE@ +COND_TOC2MP3_TRUE = @COND_TOC2MP3_TRUE@ +COND_XDAO_FALSE = @COND_XDAO_FALSE@ +COND_XDAO_TRUE = @COND_XDAO_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ +GTKMM2_CFLAGS = @GTKMM2_CFLAGS@ +GTKMM2_LIBS = @GTKMM2_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LAME_CFLAGS = @LAME_CFLAGS@ +LAME_LIBS = @LAME_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBGUIMM2_CFLAGS = @LIBGUIMM2_CFLAGS@ +LIBGUIMM2_LIBS = @LIBGUIMM2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAD_CFLAGS = @MAD_CFLAGS@ +MAD_LIBS = @MAD_LIBS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIGCPP2_CFLAGS = @SIGCPP2_CFLAGS@ +SIGCPP2_LIBS = @SIGCPP2_LIBS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +VORBISFILE_CFLAGS = @VORBISFILE_CFLAGS@ +VORBISFILE_LIBS = @VORBISFILE_LIBS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +antlr_path = @antlr_path@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +dao_src = @dao_src@ +datadir = @datadir@ +dlg_path = @dlg_path@ +en_cdrdao = @en_cdrdao@ +en_cue2toc = @en_cue2toc@ +en_toc2cue = @en_toc2cue@ +en_toc2mp3 = @en_toc2mp3@ +en_xdao = @en_xdao@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydefs = @mydefs@ +oldincludedir = @oldincludedir@ +pcctsinc = @pcctsinc@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +scsilib_dir = @scsilib_dir@ +scsilib_incl = @scsilib_incl@ +scsilib_libs = @scsilib_libs@ +scsilib_objs = @scsilib_objs@ +sharedstatedir = @sharedstatedir@ +sound_if_obj = @sound_if_obj@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +thread_libs = @thread_libs@ +noinst_LIBRARIES = libcdda_paranoia.a +libcdda_paranoia_a_SOURCES = paranoia.c p_block.c overlap.c gap.c isort.c cdda_paranoia.h gap.h isort.h overlap.h p_block.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu paranoia/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu paranoia/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libcdda_paranoia.a: $(libcdda_paranoia_a_OBJECTS) $(libcdda_paranoia_a_DEPENDENCIES) + -rm -f libcdda_paranoia.a + $(libcdda_paranoia_a_AR) libcdda_paranoia.a $(libcdda_paranoia_a_OBJECTS) $(libcdda_paranoia_a_LIBADD) + $(RANLIB) libcdda_paranoia.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/isort.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/overlap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/p_block.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/paranoia.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/paranoia/README b/paranoia/README new file mode 100644 index 0000000..9a45530 --- /dev/null +++ b/paranoia/README @@ -0,0 +1,15 @@ +This is Monty's <monty@xiph.org> paranoia library that allows high quality +digital audio extraction even with scratched CDs. It is taken from the +cdparanoia-III-alpha9.8 package. + +Changes: + - Provided my own version of the 'cdrom_drive' structure and changed + the include path for "cdda_interface.h". It is now located in + "dao/cdda_interface.h". + - Removed include of "../interface/smallft.h" because nothing from it + was used. + - Commented out the functions 'i_paranoia_firstlast()' and + 'paranoia_seek()' to reduce the required cdda interface functions. + Now only 'cdda_read()' is referenced by the library. + - Added function 'paranoia_set_range()' to set the valid range of audio + sectors. diff --git a/paranoia/cdda_paranoia.h b/paranoia/cdda_paranoia.h new file mode 100644 index 0000000..9881656 --- /dev/null +++ b/paranoia/cdda_paranoia.h @@ -0,0 +1,57 @@ +/*** + * CopyPolicy: GNU Public License 2 applies + * Copyright (C) by Monty (xiphmont@mit.edu) + * + ***/ + +#ifndef _CDROM_PARANOIA_ +#define _CDROM_PARANOIA_ + +#define CD_FRAMEWORDS (CD_FRAMESIZE_RAW/2) + +#define PARANOIA_CB_READ 0 +#define PARANOIA_CB_VERIFY 1 +#define PARANOIA_CB_FIXUP_EDGE 2 +#define PARANOIA_CB_FIXUP_ATOM 3 +#define PARANOIA_CB_SCRATCH 4 +#define PARANOIA_CB_REPAIR 5 +#define PARANOIA_CB_SKIP 6 +#define PARANOIA_CB_DRIFT 7 +#define PARANOIA_CB_BACKOFF 8 +#define PARANOIA_CB_OVERLAP 9 +#define PARANOIA_CB_FIXUP_DROPPED 10 +#define PARANOIA_CB_FIXUP_DUPED 11 +#define PARANOIA_CB_READERR 12 + +#define PARANOIA_MODE_FULL 0xff +#define PARANOIA_MODE_DISABLE 0 + +#define PARANOIA_MODE_VERIFY 1 +#define PARANOIA_MODE_FRAGMENT 2 +#define PARANOIA_MODE_OVERLAP 4 +#define PARANOIA_MODE_SCRATCH 8 +#define PARANOIA_MODE_REPAIR 16 +#define PARANOIA_MODE_NEVERSKIP 32 + +#ifndef CDP_COMPILE +typedef void cdrom_paranoia; +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +extern cdrom_paranoia *paranoia_init(cdrom_drive *d); +extern void paranoia_modeset(cdrom_paranoia *p,int mode); +extern long paranoia_seek(cdrom_paranoia *p,long seek,int mode); +extern int16_t *paranoia_read(cdrom_paranoia *p,void(*callback)(long,int)); +extern int16_t *paranoia_read_limited(cdrom_paranoia *p,void(*callback)(long,int),int maxretries); +extern void paranoia_free(cdrom_paranoia *p); +extern void paranoia_overlapset(cdrom_paranoia *p,long overlap); +extern void paranoia_set_range(cdrom_paranoia *p, long start, long end); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/paranoia/gap.c b/paranoia/gap.c new file mode 100644 index 0000000..23f450c --- /dev/null +++ b/paranoia/gap.c @@ -0,0 +1,193 @@ +/*** + * CopyPolicy: GNU Public License 2 applies + * Copyright (C) by Monty (xiphmont@mit.edu) + * + * Gapa analysis support code for paranoia + * + ***/ + +#include <string.h> +#include "p_block.h" +#include "cdda_paranoia.h" +#include "gap.h" + +/**** Gap analysis code ***************************************************/ + +long i_paranoia_overlap_r(int16_t *buffA,int16_t *buffB, + long offsetA, long offsetB){ + long beginA=offsetA; + long beginB=offsetB; + + for(;beginA>=0 && beginB>=0;beginA--,beginB--) + if(buffA[beginA]!=buffB[beginB])break; + beginA++; + beginB++; + + return(offsetA-beginA); +} + +long i_paranoia_overlap_f(int16_t *buffA,int16_t *buffB, + long offsetA, long offsetB, + long sizeA,long sizeB){ + long endA=offsetA; + long endB=offsetB; + + for(;endA<sizeA && endB<sizeB;endA++,endB++) + if(buffA[endA]!=buffB[endB])break; + + return(endA-offsetA); +} + +int i_stutter_or_gap(int16_t *A, int16_t *B,long offA, long offB, + long gap){ + long a1=offA; + long b1=offB; + + if(a1<0){ + b1-=a1; + gap+=a1; + a1=0; + } + + return(memcmp(A+a1,B+b1,gap*2)); +} + +/* riftv is the first value into the rift -> or <- */ +void i_analyze_rift_f(int16_t *A,int16_t *B, + long sizeA, long sizeB, + long aoffset, long boffset, + long *matchA,long *matchB,long *matchC){ + + long apast=sizeA-aoffset; + long bpast=sizeB-boffset; + long i; + + *matchA=0, *matchB=0, *matchC=0; + + /* Look for three possible matches... (A) Ariftv->B, (B) Briftv->A and + (c) AB->AB. */ + + for(i=0;;i++){ + if(i<bpast) /* A */ + if(i_paranoia_overlap_f(A,B,aoffset,boffset+i,sizeA,sizeB)>=MIN_WORDS_RIFT){ + *matchA=i; + break; + } + + if(i<apast){ /* B */ + if(i_paranoia_overlap_f(A,B,aoffset+i,boffset,sizeA,sizeB)>=MIN_WORDS_RIFT){ + *matchB=i; + break; + } + if(i<bpast) /* C */ + if(i_paranoia_overlap_f(A,B,aoffset+i,boffset+i,sizeA,sizeB)>=MIN_WORDS_RIFT){ + *matchC=i; + break; + } + }else + if(i>=bpast)break; + + } + + if(*matchA==0 && *matchB==0 && *matchC==0)return; + + if(*matchC)return; + if(*matchA){ + if(i_stutter_or_gap(A,B,aoffset-*matchA,boffset,*matchA)) + return; + *matchB=-*matchA; /* signify we need to remove n bytes from B */ + *matchA=0; + return; + }else{ + if(i_stutter_or_gap(B,A,boffset-*matchB,aoffset,*matchB)) + return; + *matchA=-*matchB; + *matchB=0; + return; + } +} + +/* riftv must be first even val of rift moving back */ + +void i_analyze_rift_r(int16_t *A,int16_t *B, + long sizeA, long sizeB, + long aoffset, long boffset, + long *matchA,long *matchB,long *matchC){ + + long apast=aoffset+1; + long bpast=boffset+1; + long i; + + *matchA=0, *matchB=0, *matchC=0; + + /* Look for three possible matches... (A) Ariftv->B, (B) Briftv->A and + (c) AB->AB. */ + + for(i=0;;i++){ + if(i<bpast) /* A */ + if(i_paranoia_overlap_r(A,B,aoffset,boffset-i)>=MIN_WORDS_RIFT){ + *matchA=i; + break; + } + if(i<apast){ /* B */ + if(i_paranoia_overlap_r(A,B,aoffset-i,boffset)>=MIN_WORDS_RIFT){ + *matchB=i; + break; + } + if(i<bpast) /* C */ + if(i_paranoia_overlap_r(A,B,aoffset-i,boffset-i)>=MIN_WORDS_RIFT){ + *matchC=i; + break; + } + }else + if(i>=bpast)break; + + } + + if(*matchA==0 && *matchB==0 && *matchC==0)return; + + if(*matchC)return; + + if(*matchA){ + if(i_stutter_or_gap(A,B,aoffset+1,boffset-*matchA+1,*matchA)) + return; + *matchB=-*matchA; /* signify we need to remove n bytes from B */ + *matchA=0; + return; + }else{ + if(i_stutter_or_gap(B,A,boffset+1,aoffset-*matchB+1,*matchB)) + return; + *matchA=-*matchB; + *matchB=0; + return; + } +} + +void analyze_rift_silence_f(int16_t *A,int16_t *B,long sizeA,long sizeB, + long aoffset, long boffset, + long *matchA, long *matchB){ + *matchA=-1; + *matchB=-1; + + sizeA=prna_min(sizeA,aoffset+MIN_WORDS_RIFT); + sizeB=prna_min(sizeB,boffset+MIN_WORDS_RIFT); + + aoffset++; + boffset++; + + while(aoffset<sizeA){ + if(A[aoffset]!=A[aoffset-1]){ + *matchA=0; + break; + } + aoffset++; + } + + while(boffset<sizeB){ + if(B[boffset]!=B[boffset-1]){ + *matchB=0; + break; + } + boffset++; + } +} diff --git a/paranoia/gap.h b/paranoia/gap.h new file mode 100644 index 0000000..dd3d4c9 --- /dev/null +++ b/paranoia/gap.h @@ -0,0 +1,28 @@ +/*** + * CopyPolicy: GNU Public License 2 applies + * Copyright (C) by Monty (xiphmont@mit.edu) + ***/ + +#ifndef _GAP_H_ +#define _GAP_H_ + +extern long i_paranoia_overlap_r(int16_t *buffA,int16_t *buffB, + long offsetA, long offsetB); +extern long i_paranoia_overlap_f(int16_t *buffA,int16_t *buffB, + long offsetA, long offsetB, + long sizeA,long sizeB); +extern int i_stutter_or_gap(int16_t *A, int16_t *B,long offA, long offB, + long gap); +extern void i_analyze_rift_f(int16_t *A,int16_t *B, + long sizeA, long sizeB, + long aoffset, long boffset, + long *matchA,long *matchB,long *matchC); +extern void i_analyze_rift_r(int16_t *A,int16_t *B, + long sizeA, long sizeB, + long aoffset, long boffset, + long *matchA,long *matchB,long *matchC); + +extern void analyze_rift_silence_f(int16_t *A,int16_t *B,long sizeA,long sizeB, + long aoffset, long boffset, + long *matchA, long *matchB); +#endif diff --git a/paranoia/isort.c b/paranoia/isort.c new file mode 100644 index 0000000..57f0e60 --- /dev/null +++ b/paranoia/isort.c @@ -0,0 +1,114 @@ +/*** + * CopyPolicy: GNU Public License 2 applies + * Copyright (C) by Monty (xiphmont@mit.edu) + * + * sorted vector abstraction for paranoia + * + ***/ + +/* Old isort got a bit complex. This re-constrains complexity to + give a go at speed through a more alpha-6-like mechanism. */ + +#include <stdlib.h> +#include <string.h> +#include "p_block.h" +#include "isort.h" + +sort_info *sort_alloc(long size){ + sort_info *ret=calloc(1,sizeof(sort_info)); + + ret->vector=NULL; + ret->sortbegin=-1; + ret->size=-1; + ret->maxsize=size; + + ret->head=calloc(65536,sizeof(sort_link *)); + ret->bucketusage=malloc(65536*sizeof(long)); + ret->revindex=calloc(size,sizeof(sort_link)); + ret->lastbucket=0; + + return(ret); +} + +void sort_unsortall(sort_info *i){ + if(i->lastbucket>2000){ /* a guess */ + memset(i->head,0,65536*sizeof(sort_link *)); + }else{ + long b; + for(b=0;b<i->lastbucket;b++) + i->head[i->bucketusage[b]]=NULL; + } + + i->lastbucket=0; + i->sortbegin=-1; +} + +void sort_free(sort_info *i){ + free(i->revindex); + free(i->head); + free(i->bucketusage); + free(i); +} + +static void sort_sort(sort_info *i,long sortlo,long sorthi){ + long j; + + for(j=sorthi-1;j>=sortlo;j--){ + sort_link **hv=i->head+i->vector[j]+32768; + sort_link *l=i->revindex+j; + + if(*hv==NULL){ + i->bucketusage[i->lastbucket]=i->vector[j]+32768; + i->lastbucket++; + } + l->next=*hv; + *hv=l; + } + i->sortbegin=0; +} + +/* size *must* be less than i->maxsize */ +void sort_setup(sort_info *i,int16_t *vector,long *abspos, + long size,long sortlo,long sorthi){ + if(i->sortbegin!=-1)sort_unsortall(i); + + i->vector=vector; + i->size=size; + i->abspos=abspos; + + i->lo=prna_min(size,prna_max(sortlo-*abspos,0)); + i->hi=prna_max(0,prna_min(sorthi-*abspos,size)); +} + +sort_link *sort_getmatch(sort_info *i,long post,long overlap,int value){ + sort_link *ret; + + if(i->sortbegin==-1)sort_sort(i,i->lo,i->hi); + /* Now we reuse lo and hi */ + + post=prna_max(0,prna_min(i->size,post)); + i->val=value+32768; + i->lo=prna_max(0,post-overlap); /* absolute position */ + i->hi=prna_min(i->size,post+overlap); /* absolute position */ + + ret=i->head[i->val]; + while(ret){ + if(ipos(i,ret)<i->lo){ + ret=ret->next; + }else{ + if(ipos(i,ret)>=i->hi) + ret=NULL; + break; + } + } + /*i->head[i->val]=ret;*/ + return(ret); +} + +sort_link *sort_nextmatch(sort_info *i,sort_link *prev){ + sort_link *ret=prev->next; + + if(!ret || ipos(i,ret)>=i->hi)return(NULL); + return(ret); +} + diff --git a/paranoia/isort.h b/paranoia/isort.h new file mode 100644 index 0000000..c63c94a --- /dev/null +++ b/paranoia/isort.h @@ -0,0 +1,51 @@ +/*** + * CopyPolicy: GNU Public License 2 applies + * Copyright (C) by Monty (xiphmont@mit.edu) + ***/ + +#ifndef _ISORT_H_ +#define _ISORT_H_ + +#include <stdint.h> + +typedef struct sort_link{ + struct sort_link *next; +} sort_link; + +typedef struct sort_info{ + int16_t *vector; /* vector (storage doesn't belong to us) */ + + long *abspos; /* pointer for side effects */ + long size; /* vector size */ + + long maxsize; /* maximum vector size */ + + long sortbegin; /* range of contiguous sorted area */ + long lo,hi; /* current post, overlap range */ + int val; /* ...and val */ + + /* sort structs */ + sort_link **head; /* sort buckets (65536) */ + + long *bucketusage; /* of used buckets (65536) */ + long lastbucket; + sort_link *revindex; + +} sort_info; + +extern sort_info *sort_alloc(long size); +extern void sort_unsortall(sort_info *i); +extern void sort_setup(sort_info *i,int16_t *vector,long *abspos,long size, + long sortlo, long sorthi); +extern void sort_free(sort_info *i); +extern sort_link *sort_getmatch(sort_info *i,long post,long overlap,int value); +extern sort_link *sort_nextmatch(sort_info *i,sort_link *prev); + +#define is(i) (i->size) +#define ib(i) (*i->abspos) +#define ie(i) (i->size+*i->abspos) +#define iv(i) (i->vector) +#define ipos(i,l) (l-i->revindex) + +#endif + diff --git a/paranoia/overlap.c b/paranoia/overlap.c new file mode 100644 index 0000000..3e74174 --- /dev/null +++ b/paranoia/overlap.c @@ -0,0 +1,181 @@ +/*** + * CopyPolicy: GNU Public License 2 applies + * Copyright (C) by Monty (xiphmont@mit.edu) + * + * Statistic code and cache management for overlap settings + * + ***/ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include "p_block.h" +#include "cdda_paranoia.h" +#include "overlap.h" +#include "isort.h" + +/**** Internal cache management *****************************************/ + +void paranoia_resetcache(cdrom_paranoia *p){ + c_block *c=c_first(p); + v_fragment *v; + + while(c){ + free_c_block(c); + c=c_first(p); + } + + v=v_first(p); + while(v){ + free_v_fragment(v); + v=v_first(p); + } +} + +void paranoia_resetall(cdrom_paranoia *p){ + p->root.returnedlimit=0; + p->dyndrift=0; + p->root.lastsector=0; + + if(p->root.vector){ + i_cblock_destructor(p->root.vector); + p->root.vector=NULL; + } + + paranoia_resetcache(p); +} + +void i_paranoia_trim(cdrom_paranoia *p,long beginword,long endword){ + root_block *root=&(p->root); + if(root->vector!=NULL){ + long target=beginword-MAX_SECTOR_OVERLAP*CD_FRAMEWORDS; + long rbegin=cb(root->vector); + long rend=ce(root->vector); + + if(rbegin>beginword) + goto rootfree; + + if(rbegin+MAX_SECTOR_OVERLAP*CD_FRAMEWORDS<beginword){ + if(target+MIN_WORDS_OVERLAP>rend) + goto rootfree; + + { + long offset=target-rbegin; + c_removef(root->vector,offset); + } + } + + { + c_block *c=c_first(p); + while(c){ + c_block *next=c_next(c); + if(ce(c)<beginword-MAX_SECTOR_OVERLAP*CD_FRAMEWORDS) + free_c_block(c); + c=next; + } + } + + } + return; + +rootfree: + + i_cblock_destructor(root->vector); + root->vector=NULL; + root->returnedlimit=-1; + root->lastsector=0; + +} + +/**** Statistical and heuristic[al? :-] management ************************/ + +void offset_adjust_settings(cdrom_paranoia *p, void(*callback)(long,int)){ + if(p->stage2.offpoints>=10){ + /* drift: look at the average offset value. If it's over one + sector, frob it. We just want a little hysteresis [sp?]*/ + long av=(p->stage2.offpoints?p->stage2.offaccum/p->stage2.offpoints:0); + + if(abs(av)>p->dynoverlap/4){ + av=(av/MIN_SECTOR_EPSILON)*MIN_SECTOR_EPSILON; + + if(callback)(*callback)(ce(p->root.vector),PARANOIA_CB_DRIFT); + p->dyndrift+=av; + + /* Adjust all the values in the cache otherwise we get a + (potentially unstable) feedback loop */ + { + c_block *c=c_first(p); + v_fragment *v=v_first(p); + + while(v && v->one){ + /* safeguard beginning bounds case with a hammer */ + if(fb(v)<av || cb(v->one)<av){ + v->one=NULL; + }else{ + fb(v)-=av; + } + v=v_next(v); + } + while(c){ + long adj=prna_min(av,cb(c)); + c_set(c,cb(c)-adj); + c=c_next(c); + } + } + + p->stage2.offaccum=0; + p->stage2.offmin=0; + p->stage2.offmax=0; + p->stage2.offpoints=0; + p->stage2.newpoints=0; + p->stage2.offdiff=0; + } + } + + if(p->stage1.offpoints>=10){ + /* dynoverlap: we arbitrarily set it to 4x the running difference + value, unless min/max are more */ + + p->dynoverlap=(p->stage1.offpoints?p->stage1.offdiff/ + p->stage1.offpoints*3:CD_FRAMEWORDS); + + if(p->dynoverlap<-p->stage1.offmin*1.5) + p->dynoverlap=-p->stage1.offmin*1.5; + + if(p->dynoverlap<p->stage1.offmax*1.5) + p->dynoverlap=p->stage1.offmax*1.5; + + if(p->dynoverlap<MIN_SECTOR_EPSILON)p->dynoverlap=MIN_SECTOR_EPSILON; + if(p->dynoverlap>MAX_SECTOR_OVERLAP*CD_FRAMEWORDS) + p->dynoverlap=MAX_SECTOR_OVERLAP*CD_FRAMEWORDS; + + if(callback)(*callback)(p->dynoverlap,PARANOIA_CB_OVERLAP); + + if(p->stage1.offpoints>600){ /* bit of a bug; this routine is + called too often due to the overlap + mesh alg we use in stage 1 */ + p->stage1.offpoints/=1.2; + p->stage1.offaccum/=1.2; + p->stage1.offdiff/=1.2; + } + p->stage1.offmin=0; + p->stage1.offmax=0; + p->stage1.newpoints=0; + } +} + +void offset_add_value(cdrom_paranoia *p,offsets *o,long value, + void(*callback)(long,int)){ + if(o->offpoints!=-1){ + + o->offdiff+=abs(value); + o->offpoints++; + o->newpoints++; + o->offaccum+=value; + if(value<o->offmin)o->offmin=value; + if(value>o->offmax)o->offmax=value; + + if(o->newpoints>=10)offset_adjust_settings(p,callback); + } +} + diff --git a/paranoia/overlap.h b/paranoia/overlap.h new file mode 100644 index 0000000..48d25af --- /dev/null +++ b/paranoia/overlap.h @@ -0,0 +1,18 @@ +/*** + * CopyPolicy: GNU Public License 2 applies + * Copyright (C) by Monty (xiphmont@mit.edu) + ***/ + +#ifndef _OVERLAP_H_ +#define _OVERLAP_H_ + +extern void offset_add_value(cdrom_paranoia *p,offsets *o,long value, + void(*callback)(long,int)); +extern void offset_clear_settings(offsets *o); +extern void offset_adjust_settings(cdrom_paranoia *p, + void(*callback)(long,int)); +extern void i_paranoia_trim(cdrom_paranoia *p,long beginword,long endword); +extern void paranoia_resetall(cdrom_paranoia *p); +extern void paranoia_resetcache(cdrom_paranoia *p); + +#endif diff --git a/paranoia/p_block.c b/paranoia/p_block.c new file mode 100644 index 0000000..6b662f1 --- /dev/null +++ b/paranoia/p_block.c @@ -0,0 +1,335 @@ +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <limits.h> +#include "p_block.h" +#include "../dao/cdda_interface.h" +#include "cdda_paranoia.h" + +linked_list *new_list(void *(*newp)(void),void (*freep)(void *)){ + linked_list *ret=calloc(1,sizeof(linked_list)); + ret->new_poly=newp; + ret->free_poly=freep; + return(ret); +} + +linked_element *add_elem(linked_list *l,void *elem){ + + linked_element *ret=calloc(1,sizeof(linked_element)); + ret->stamp=l->current++; + ret->ptr=elem; + ret->list=l; + + if(l->head) + l->head->prev=ret; + else + l->tail=ret; + ret->next=l->head; + ret->prev=NULL; + l->head=ret; + l->active++; + + return(ret); +} + +linked_element *new_elem(linked_list *list){ + void *new=list->new_poly(); + return(add_elem(list,new)); +} + +void free_elem(linked_element *e,int free_ptr){ + linked_list *l=e->list; + if(free_ptr)l->free_poly(e->ptr); + + if(e==l->head) + l->head=e->next; + if(e==l->tail) + l->tail=e->prev; + + if(e->prev) + e->prev->next=e->next; + if(e->next) + e->next->prev=e->prev; + + l->active--; + free(e); +} + +void free_list(linked_list *list,int free_ptr){ + while(list->head) + free_elem(list->head,free_ptr); + free(list); +} + +void *get_elem(linked_element *e){ + return(e->ptr); +} + +linked_list *copy_list(linked_list *list){ + linked_list *new=new_list(list->new_poly,list->free_poly); + linked_element *i=list->tail; + + while(i){ + add_elem(new,i->ptr); + i=i->prev; + } + return(new); +} + +/**** C_block stuff ******************************************************/ + +static c_block *i_cblock_constructor(cdrom_paranoia *p){ + c_block *ret=calloc(1,sizeof(c_block)); + return(ret); +} + +void i_cblock_destructor(c_block *c){ + if(c){ + if(c->vector)free(c->vector); + if(c->flags)free(c->flags); + c->e=NULL; + free(c); + } +} + +c_block *new_c_block(cdrom_paranoia *p){ + linked_element *e=new_elem(p->cache); + c_block *c=e->ptr; + c->e=e; + c->p=p; + return(c); +} + +void free_c_block(c_block *c){ + /* also rid ourselves of v_fragments that reference this block */ + v_fragment *v=v_first(c->p); + + while(v){ + v_fragment *next=v_next(v); + if(v->one==c)free_v_fragment(v); + v=next; + } + + free_elem(c->e,1); +} + +static v_fragment *i_vfragment_constructor(void){ + v_fragment *ret=calloc(1,sizeof(v_fragment)); + return(ret); +} + +static void i_v_fragment_destructor(v_fragment *v){ + free(v); +} + +v_fragment *new_v_fragment(cdrom_paranoia *p,c_block *one, + long begin, long end, int last){ + linked_element *e=new_elem(p->fragments); + v_fragment *b=e->ptr; + + b->e=e; + b->p=p; + + b->one=one; + b->begin=begin; + b->vector=one->vector+begin-one->begin; + b->size=end-begin; + b->lastsector=last; + + return(b); +} + +void free_v_fragment(v_fragment *v){ + free_elem(v->e,1); +} + +c_block *c_first(cdrom_paranoia *p){ + if(p->cache->head) + return(p->cache->head->ptr); + return(NULL); +} + +c_block *c_last(cdrom_paranoia *p){ + if(p->cache->tail) + return(p->cache->tail->ptr); + return(NULL); +} + +c_block *c_next(c_block *c){ + if(c->e->next) + return(c->e->next->ptr); + return(NULL); +} + +c_block *c_prev(c_block *c){ + if(c->e->prev) + return(c->e->prev->ptr); + return(NULL); +} + +v_fragment *v_first(cdrom_paranoia *p){ + if(p->fragments->head){ + return(p->fragments->head->ptr); + } + return(NULL); +} + +v_fragment *v_last(cdrom_paranoia *p){ + if(p->fragments->tail) + return(p->fragments->tail->ptr); + return(NULL); +} + +v_fragment *v_next(v_fragment *v){ + if(v->e->next) + return(v->e->next->ptr); + return(NULL); +} + +v_fragment *v_prev(v_fragment *v){ + if(v->e->prev) + return(v->e->prev->ptr); + return(NULL); +} + +void recover_cache(cdrom_paranoia *p){ + linked_list *l=p->cache; + + /* Are we at/over our allowed cache size? */ + while(l->active>p->cache_limit) + /* cull from the tail of the list */ + free_c_block(c_last(p)); + +} + +int16_t *v_buffer(v_fragment *v){ + if(!v->one)return(NULL); + if(!cv(v->one))return(NULL); + return(v->vector); +} + +/* alloc a c_block not on a cache list */ +c_block *c_alloc(int16_t *vector,long begin,long size){ + c_block *c=calloc(1,sizeof(c_block)); + c->vector=vector; + c->begin=begin; + c->size=size; + return(c); +} + +void c_set(c_block *v,long begin){ + v->begin=begin; +} + +/* pos here is vector position from zero */ +void c_insert(c_block *v,long pos,int16_t *b,long size){ + int vs=cs(v); + if(pos<0 || pos>vs)return; + + if(v->vector) + v->vector=realloc(v->vector,sizeof(int16_t)*(size+vs)); + else + v->vector=malloc(sizeof(int16_t)*size); + + if(pos<vs)memmove(v->vector+pos+size,v->vector+pos, + (vs-pos)*sizeof(int16_t)); + memcpy(v->vector+pos,b,size*sizeof(int16_t)); + + v->size+=size; +} + +void c_remove(c_block *v,long cutpos,long cutsize){ + int vs=cs(v); + if(cutpos<0 || cutpos>vs)return; + if(cutpos+cutsize>vs)cutsize=vs-cutpos; + if(cutsize<0)cutsize=vs-cutpos; + if(cutsize<1)return; + + memmove(v->vector+cutpos,v->vector+cutpos+cutsize, + (vs-cutpos-cutsize)*sizeof(int16_t)); + + v->size-=cutsize; +} + +void c_overwrite(c_block *v,long pos,int16_t *b,long size){ + int vs=cs(v); + + if(pos<0)return; + if(pos+size>vs)size=vs-pos; + + memcpy(v->vector+pos,b,size*sizeof(int16_t)); +} + +void c_append(c_block *v, int16_t *vector, long size){ + int vs=cs(v); + + /* update the vector */ + if(v->vector) + v->vector=realloc(v->vector,sizeof(int16_t)*(size+vs)); + else + v->vector=malloc(sizeof(int16_t)*size); + memcpy(v->vector+vs,vector,sizeof(int16_t)*size); + + v->size+=size; +} + +void c_removef(c_block *v, long cut){ + c_remove(v,0,cut); + v->begin+=cut; +} + + + +/**** Initialization *************************************************/ + +/* +void i_paranoia_firstlast(cdrom_paranoia *p){ + int i; + cdrom_drive *d=p->d; + p->current_lastsector=-1; + for(i=cdda_sector_gettrack(d,p->cursor);i<cdda_tracks(d);i++) + if(!cdda_track_audiop(d,i)) + p->current_lastsector=cdda_track_lastsector(d,i-1); + if(p->current_lastsector==-1) + p->current_lastsector=cdda_disc_lastsector(d); + + p->current_firstsector=-1; + for(i=cdda_sector_gettrack(d,p->cursor);i>0;i--) + if(!cdda_track_audiop(d,i)) + p->current_firstsector=cdda_track_firstsector(d,i+1); + if(p->current_firstsector==-1) + p->current_firstsector=cdda_disc_firstsector(d); + +} +*/ + +cdrom_paranoia *paranoia_init(cdrom_drive *d){ + cdrom_paranoia *p=calloc(1,sizeof(cdrom_paranoia)); + + p->cache=new_list((void *)&i_cblock_constructor, + (void *)&i_cblock_destructor); + + p->fragments=new_list((void *)&i_vfragment_constructor, + (void *)&i_v_fragment_destructor); + + p->readahead=150; + p->sortcache=sort_alloc(p->readahead*CD_FRAMEWORDS); + p->d=d; + p->dynoverlap=MAX_SECTOR_OVERLAP*CD_FRAMEWORDS; + p->cache_limit=JIGGLE_MODULO; + p->enable=PARANOIA_MODE_FULL; + /*p->cursor=cdda_disc_firstsector(d);*/ + p->lastread=LONG_MAX; + + /* One last one... in case data and audio tracks are mixed... */ + /* i_paranoia_firstlast(p); ++AM: I use paranoia_set_range instead */ + + return(p); +} + +void paranoia_set_range(cdrom_paranoia *p, long start, long end) +{ + p->cursor = start; + p->current_firstsector = start; + p->current_lastsector = end; +} diff --git a/paranoia/p_block.h b/paranoia/p_block.h new file mode 100644 index 0000000..23c664c --- /dev/null +++ b/paranoia/p_block.h @@ -0,0 +1,190 @@ +/*** + * CopyPolicy: GNU Public License 2 applies + * Copyright (C) by Monty (xiphmont@mit.edu) + ***/ + +#ifndef _p_block_h_ +#define _p_block_h_ + +#include "../dao/cdda_interface.h" + +#define MIN_WORDS_OVERLAP 64 /* 16 bit words */ +#define MIN_WORDS_SEARCH 64 /* 16 bit words */ +#define MIN_WORDS_RIFT 16 /* 16 bit words */ +#define MAX_SECTOR_OVERLAP 32 /* sectors */ +#define MIN_SECTOR_EPSILON 128 /* words */ +#define MIN_SECTOR_BACKUP 16 /* sectors */ +#define JIGGLE_MODULO 15 /* sectors */ +#define MIN_SILENCE_BOUNDARY 1024 /* 16 bit words */ + +#define prna_min(x,y) ((x)>(y)?(y):(x)) +#define prna_max(x,y) ((x)<(y)?(y):(x)) + +#include "isort.h" + +typedef struct linked_list{ + /* linked list */ + struct linked_element *head; + struct linked_element *tail; + + void *(*new_poly)(); + void (*free_poly)(void *poly); + long current; + long active; + +} linked_list; + +typedef struct linked_element{ + void *ptr; + struct linked_element *prev; + struct linked_element *next; + + struct linked_list *list; + int stamp; +} linked_element; + +extern linked_list *new_list(void *(*new)(void),void (*free)(void *)); +extern linked_element *new_elem(linked_list *list); +extern linked_element *add_elem(linked_list *list,void *elem); +extern void free_list(linked_list *list,int free_ptr); /* unlink or free */ +extern void free_elem(linked_element *e,int free_ptr); /* unlink or free */ +extern void *get_elem(linked_element *e); +extern linked_list *copy_list(linked_list *list); /* shallow; doesn't copy + contained structures */ + +typedef struct c_block{ + /* The buffer */ + int16_t *vector; + long begin; + long size; + + /* auxiliary support structures */ + unsigned char *flags; /* 1 known boundaries in read data + 2 known blanked data + 4 matched sample + 8 reserved + 16 reserved + 32 reserved + 64 reserved + 128 reserved + */ + + /* end of session cases */ + long lastsector; + struct cdrom_paranoia *p; + struct linked_element *e; + +} c_block; + +extern void free_c_block(c_block *c); +extern void i_cblock_destructor(c_block *c); +extern c_block *new_c_block(struct cdrom_paranoia *p); + +typedef struct v_fragment{ + c_block *one; + + long begin; + long size; + int16_t *vector; + + /* end of session cases */ + long lastsector; + + /* linked list */ + struct cdrom_paranoia *p; + struct linked_element *e; + +} v_fragment; + +extern void free_v_fragment(v_fragment *c); +extern v_fragment *new_v_fragment(struct cdrom_paranoia *p,c_block *one, + long begin, long end, int lastsector); +extern int16_t *v_buffer(v_fragment *v); + +extern c_block *c_first(struct cdrom_paranoia *p); +extern c_block *c_last(struct cdrom_paranoia *p); +extern c_block *c_next(c_block *c); +extern c_block *c_prev(c_block *c); + +extern v_fragment *v_first(struct cdrom_paranoia *p); +extern v_fragment *v_last(struct cdrom_paranoia *p); +extern v_fragment *v_next(v_fragment *v); +extern v_fragment *v_prev(v_fragment *v); + +typedef struct root_block{ + long returnedlimit; + long lastsector; + struct cdrom_paranoia *p; + + c_block *vector; /* doesn't use any sorting */ + int silenceflag; + long silencebegin; +} root_block; + +typedef struct offsets{ + + long offpoints; + long newpoints; + long offaccum; + long offdiff; + long offmin; + long offmax; + +} offsets; + +typedef struct cdrom_paranoia{ + cdrom_drive *d; + + root_block root; /* verified/reconstructed cached data */ + linked_list *cache; /* our data as read from the cdrom */ + long cache_limit; + linked_list *fragments; /* fragments of blocks that have been 'verified' */ + sort_info *sortcache; + + int readahead; /* sectors of readahead in each readop */ + int jitter; + long lastread; + + int enable; + long cursor; + long current_lastsector; + long current_firstsector; + + /* statistics for drift/overlap */ + struct offsets stage1; + struct offsets stage2; + + long dynoverlap; + long dyndrift; + + /* statistics for verification */ + +} cdrom_paranoia; + +extern c_block *c_alloc(int16_t *vector,long begin,long size); +extern void c_set(c_block *v,long begin); +extern void c_insert(c_block *v,long pos,int16_t *b,long size); +extern void c_remove(c_block *v,long cutpos,long cutsize); +extern void c_overwrite(c_block *v,long pos,int16_t *b,long size); +extern void c_append(c_block *v, int16_t *vector, long size); +extern void c_removef(c_block *v, long cut); + +#define ce(v) (v->begin+v->size) +#define cb(v) (v->begin) +#define cs(v) (v->size) + +/* pos here is vector position from zero */ + +extern void recover_cache(cdrom_paranoia *p); +extern void i_paranoia_firstlast(cdrom_paranoia *p); + +#define cv(c) (c->vector) + +#define fe(f) (f->begin+f->size) +#define fb(f) (f->begin) +#define fs(f) (f->size) +#define fv(f) (v_buffer(f)) + +#define CDP_COMPILE +#endif + diff --git a/paranoia/paranoia.c b/paranoia/paranoia.c new file mode 100644 index 0000000..9fdc077 --- /dev/null +++ b/paranoia/paranoia.c @@ -0,0 +1,1318 @@ +/*** + * CopyPolicy: GNU Public License 2 applies + * Copyright (C) by Monty (xiphmont@mit.edu) + * + * Toplevel file for the paranoia abstraction over the cdda lib + * + ***/ + +/* immediate todo:: */ +/* Allow disabling of root fixups? */ +/* Dupe bytes are creeping into cases that require greater overlap + than a single fragment can provide. We need to check against a + larger area* (+/-32 sectors of root?) to better eliminate + dupes. Of course this leads to other problems... Is it actually a + practically solvable problem? */ +/* Bimodal overlap distributions break us. */ +/* scratch detection/tolerance not implemented yet */ + +/*************************************************************** + + Da new shtick: verification now a two-step assymetric process. + + A single 'verified/reconstructed' data segment cache, and then the + multiple fragment cache + + verify a newly read block against previous blocks; do it only this + once. We maintain a list of 'verified sections' from these matches. + + We then glom these verified areas into a new data buffer. + Defragmentation fixups are allowed here alone. + + We also now track where read boundaries actually happened; do not + verify across matching boundaries. + + **************************************************************/ + +/*************************************************************** + + Silence. "It's BAAAAAAaaack." + + audio is now treated as great continents of values floating on a + mantle of molten silence. Silence is not handled by basic + verification at all; we simply anchor sections of nonzero audio to a + position and fill in everything else as silence. We also note the + audio that interfaces with silence; an edge must be 'wet'. + + **************************************************************/ + +#include <stdlib.h> +#include <unistd.h> +#include <stdio.h> +#include <string.h> +#include <math.h> +#include "../dao/cdda_interface.h" +#include "p_block.h" +#include "cdda_paranoia.h" +#include "overlap.h" +#include "gap.h" +#include "isort.h" + +static inline long re(root_block *root){ + if(!root)return(-1); + if(!root->vector)return(-1); + return(ce(root->vector)); +} + +static inline long rb(root_block *root){ + if(!root)return(-1); + if(!root->vector)return(-1); + return(cb(root->vector)); +} + +static inline long rs(root_block *root){ + if(!root)return(-1); + if(!root->vector)return(-1); + return(cs(root->vector)); +} + +static inline int16_t *rv(root_block *root){ + if(!root)return(NULL); + if(!root->vector)return(NULL); + return(cv(root->vector)); +} + +#define rc(r) (r->vector) + +/**** matching and analysis code *****************************************/ + +static inline long i_paranoia_overlap(int16_t *buffA,int16_t *buffB, + long offsetA, long offsetB, + long sizeA,long sizeB, + long *ret_begin, long *ret_end){ + long beginA=offsetA,endA=offsetA; + long beginB=offsetB,endB=offsetB; + + for(;beginA>=0 && beginB>=0;beginA--,beginB--) + if(buffA[beginA]!=buffB[beginB])break; + beginA++; + beginB++; + + for(;endA<sizeA && endB<sizeB;endA++,endB++) + if(buffA[endA]!=buffB[endB])break; + + if(ret_begin)*ret_begin=beginA; + if(ret_end)*ret_end=endA; + return(endA-beginA); +} + +static inline long i_paranoia_overlap2(int16_t *buffA,int16_t *buffB, + char *flagsA,char *flagsB, + long offsetA, long offsetB, + long sizeA,long sizeB, + long *ret_begin, long *ret_end){ + long beginA=offsetA,endA=offsetA; + long beginB=offsetB,endB=offsetB; + + for(;beginA>=0 && beginB>=0;beginA--,beginB--){ + if(buffA[beginA]!=buffB[beginB])break; + /* don't allow matching across matching sector boundaries */ + /* don't allow matching through known missing data */ + if((flagsA[beginA]&flagsB[beginB]&1)){ + beginA--; + beginB--; + break; + } + if((flagsA[beginA]&2)|| (flagsB[beginB]&2))break; + } + beginA++; + beginB++; + + for(;endA<sizeA && endB<sizeB;endA++,endB++){ + if(buffA[endA]!=buffB[endB])break; + /* don't allow matching across matching sector boundaries */ + if((flagsA[endA]&flagsB[endB]&1) &&endA!=beginA){ + break; + } + + /* don't allow matching through known missing data */ + if((flagsA[endA]&2)||(flagsB[endB]&2))break; + } + + if(ret_begin)*ret_begin=beginA; + if(ret_end)*ret_end=endA; + return(endA-beginA); +} + +/* Top level of the first stage matcher */ + +/* We match each analysis point of new to the preexisting blocks +recursively. We can also optionally maintain a list of fragments of +the preexisting block that didn't match anything, and match them back +afterward. */ + +#define OVERLAP_ADJ (MIN_WORDS_OVERLAP/2-1) + +static inline long do_const_sync(c_block *A, + sort_info *B,char *flagB, + long posA,long posB, + long *begin,long *end,long *offset){ + char *flagA=(char*)A->flags; + long ret=0; + + if(flagB==NULL) + ret=i_paranoia_overlap(cv(A),iv(B),posA,posB, + cs(A),is(B),begin,end); + else + if((flagB[posB]&2)==0) + ret=i_paranoia_overlap2(cv(A),iv(B),flagA,flagB,posA,posB,cs(A), + is(B),begin,end); + + if(ret>MIN_WORDS_SEARCH){ + *offset=+(posA+cb(A))-(posB+ib(B)); + *begin+=cb(A); + *end+=cb(A); + return(ret); + } + + return(0); +} + +/* post is w.r.t. B. in stage one, we post from old. In stage 2 we + post from root. Begin, end, offset count from B's frame of + reference */ + +static inline long try_sort_sync(cdrom_paranoia *p, + sort_info *A,char *Aflags, + c_block *B, + long post,long *begin,long *end, + long *offset,void (*callback)(long,int)){ + + long dynoverlap=p->dynoverlap; + sort_link *ptr=NULL; + char *Bflags=(char*)B->flags; + + /* block flag matches 0x02 (unmatchable) */ + if(Bflags==NULL || (Bflags[post-cb(B)]&2)==0){ + /* always try absolute offset zero first! */ + { + long zeropos=post-ib(A); + if(zeropos>=0 && zeropos<is(A)){ + if(cv(B)[post-cb(B)]==iv(A)[zeropos]){ + if(do_const_sync(B,A,Aflags, + post-cb(B),zeropos, + begin,end,offset)){ + + offset_add_value(p,&(p->stage1),*offset,callback); + + return(1); + } + } + } + } + }else + return(0); + + ptr=sort_getmatch(A,post-ib(A),dynoverlap,cv(B)[post-cb(B)]); + + while(ptr){ + + if(do_const_sync(B,A,Aflags, + post-cb(B),ipos(A,ptr), + begin,end,offset)){ + offset_add_value(p,&(p->stage1),*offset,callback); + return(1); + } + ptr=sort_nextmatch(A,ptr); + } + + *begin=-1; + *end=-1; + *offset=-1; + return(0); +} + +static inline void stage1_matched(c_block *old,c_block *new, + long matchbegin,long matchend, + long matchoffset,void (*callback)(long,int)){ + long i; + long oldadjbegin=matchbegin-cb(old); + long oldadjend=matchend-cb(old); + long newadjbegin=matchbegin-matchoffset-cb(new); + long newadjend=matchend-matchoffset-cb(new); + + if(matchbegin-matchoffset<=cb(new) || + matchbegin<=cb(old) || + (new->flags[newadjbegin]&1) || + (old->flags[oldadjbegin]&1)){ + if(matchoffset) + if(callback)(*callback)(matchbegin,PARANOIA_CB_FIXUP_EDGE); + }else + if(callback)(*callback)(matchbegin,PARANOIA_CB_FIXUP_ATOM); + + if(matchend-matchoffset>=ce(new) || + (new->flags[newadjend]&1) || + matchend>=ce(old) || + (old->flags[oldadjend]&1)){ + if(matchoffset) + if(callback)(*callback)(matchend,PARANOIA_CB_FIXUP_EDGE); + }else + if(callback)(*callback)(matchend,PARANOIA_CB_FIXUP_ATOM); + + /* Mark the verification flags. Don't mark the first or + last OVERLAP/2 elements so that overlapping fragments + have to overlap by OVERLAP to actually merge. We also + remove elements from the sort such that later sorts do + not have to sift through already matched data */ + + newadjbegin+=OVERLAP_ADJ; + newadjend-=OVERLAP_ADJ; + for(i=newadjbegin;i<newadjend;i++) + new->flags[i]|=4; /* mark verified */ + + oldadjbegin+=OVERLAP_ADJ; + oldadjend-=OVERLAP_ADJ; + for(i=oldadjbegin;i<oldadjend;i++) + old->flags[i]|=4; /* mark verified */ + +} + +static long i_iterate_stage1(cdrom_paranoia *p,c_block *old,c_block *new, + void(*callback)(long,int)){ + + long matchbegin=-1,matchend=-1,matchoffset; + + /* we no longer try to spread the stage one search area by dynoverlap */ + long searchend=prna_min(ce(old),ce(new)); + long searchbegin=prna_max(cb(old),cb(new)); + long searchsize=searchend-searchbegin; + sort_info *i=p->sortcache; + long ret=0; + long j; + + long tried=0,matched=0; + + if(searchsize<=0)return(0); + + /* match return values are in terms of the new vector, not old */ + + for(j=searchbegin;j<searchend;j+=23){ + if((new->flags[j-cb(new)]&6)==0){ + tried++; + if(try_sort_sync(p,i,(char*)new->flags,old,j,&matchbegin,&matchend,&matchoffset, + callback)==1){ + + matched+=matchend-matchbegin; + + /* purely cosmetic: if we're matching zeros, don't use the + callback because they will appear to be all skewed */ + { + long j=matchbegin-cb(old); + long end=matchend-cb(old); + for(;j<end;j++)if(cv(old)[j]!=0)break; + if(j<end){ + stage1_matched(old,new,matchbegin,matchend,matchoffset,callback); + }else{ + stage1_matched(old,new,matchbegin,matchend,matchoffset,NULL); + } + } + ret++; + if(matchend-1>j)j=matchend-1; + } + } + } +#ifdef NOISY + fprintf(stderr,"iterate_stage1: search area=%ld[%ld-%ld] tried=%ld matched=%ld spans=%ld\n", + searchsize,searchbegin,searchend,tried,matched,ret); +#endif + + return(ret); +} + +static long i_stage1(cdrom_paranoia *p,c_block *new, + void(*callback)(long,int)){ + + long size=cs(new); + c_block *ptr=c_last(p); + int ret=0; + long begin=0,end; + + if(ptr)sort_setup(p->sortcache,cv(new),&cb(new),cs(new), + cb(new),ce(new)); + + while(ptr && ptr!=new){ + + if(callback)(*callback)(cb(new),PARANOIA_CB_VERIFY); + i_iterate_stage1(p,ptr,new,callback); + + ptr=c_prev(ptr); + } + + /* parse the verified areas of new into v_fragments */ + + begin=0; + while(begin<size){ + for(;begin<size;begin++)if(new->flags[begin]&4)break; + for(end=begin;end<size;end++)if((new->flags[end]&4)==0)break; + if(begin>=size)break; + + ret++; + + new_v_fragment(p,new,cb(new)+prna_max(0,begin-OVERLAP_ADJ), + cb(new)+prna_min(size,end+OVERLAP_ADJ), + (end+OVERLAP_ADJ>=size && new->lastsector)); + + begin=end; + } + + return(ret); +} + +/* reconcile v_fragments to root buffer. Free if matched, fragment/fixup root + if necessary */ + +typedef struct sync_result { + long offset; + long begin; + long end; +} sync_result; + +/* do *not* match using zero posts */ +static long i_iterate_stage2(cdrom_paranoia *p,v_fragment *v, + sync_result *r,void(*callback)(long,int)){ + root_block *root=&(p->root); + long matchbegin=-1,matchend=-1,offset; + long fbv,fev; + +#ifdef NOISY + fprintf(stderr,"Stage 2 search: fbv=%ld fev=%ld\n",fb(v),fe(v)); +#endif + + if(prna_min(fe(v)+p->dynoverlap,re(root))- + prna_max(fb(v)-p->dynoverlap,rb(root))<=0)return(0); + + if(callback)(*callback)(fb(v),PARANOIA_CB_VERIFY); + + /* just a bit of v; determine the correct area */ + fbv=prna_max(fb(v),rb(root)-p->dynoverlap); + + /* we want to avoid zeroes */ + while(fbv<fe(v) && fv(v)[fbv-fb(v)]==0)fbv++; + if(fbv==fe(v))return(0); + fev=prna_min(prna_min(fbv+256,re(root)+p->dynoverlap),fe(v)); + + { + /* spread the search area a bit. We post from root, so containment + must strictly adhere to root */ + long searchend=prna_min(fev+p->dynoverlap,re(root)); + long searchbegin=prna_max(fbv-p->dynoverlap,rb(root)); + sort_info *i=p->sortcache; + long j; + + sort_setup(i,fv(v),&fb(v),fs(v),fbv,fev); + for(j=searchbegin;j<searchend;j+=23){ + while(j<searchend && rv(root)[j-rb(root)]==0)j++; + if(j==searchend)break; + + if(try_sort_sync(p,i,NULL,rc(root),j, + &matchbegin,&matchend,&offset,callback)){ + + r->begin=matchbegin; + r->end=matchend; + r->offset=-offset; + if(offset)if(callback)(*callback)(r->begin,PARANOIA_CB_FIXUP_EDGE); + return(1); + } + } + } + + return(0); +} + +/* simple test for a root vector that ends in silence*/ +static void i_silence_test(root_block *root){ + int16_t *vec=rv(root); + long end=re(root)-rb(root)-1; + long j; + + for(j=end-1;j>=0;j--)if(vec[j]!=0)break; + if(j<0 || end-j>MIN_SILENCE_BOUNDARY){ + if(j<0)j=0; + root->silenceflag=1; + root->silencebegin=rb(root)+j; + if(root->silencebegin<root->returnedlimit) + root->silencebegin=root->returnedlimit; + } +} + +/* match into silence vectors at offset zero if at all possible. This + also must be called with vectors in ascending begin order in case + there are nonzero islands */ +static long i_silence_match(root_block *root, v_fragment *v, + void(*callback)(long,int)){ + + cdrom_paranoia *p=v->p; + int16_t *vec=fv(v); + long end=fs(v),begin; + long j; + + /* does this vector begin wet? */ + if(end<MIN_SILENCE_BOUNDARY)return(0); + for(j=0;j<end;j++)if(vec[j]!=0)break; + if(j<MIN_SILENCE_BOUNDARY)return(0); + j+=fb(v); + + /* is the new silent section ahead of the end of the old by < + p->dynoverlap? */ + if(fb(v)>=re(root) && fb(v)-p->dynoverlap<re(root)){ + /* extend the zeroed area of root */ + long addto=fb(v)+MIN_SILENCE_BOUNDARY-re(root); + int16_t vec[addto]; + memset(vec,0,sizeof(vec)); + c_append(rc(root),vec,addto); + } + + /* do we have an 'effortless' overlap? */ + begin=prna_max(fb(v),root->silencebegin); + end=prna_min(j,re(root)); + + if(begin<end){ + + /* don't use it unless it will extend... */ + + if(fe(v)>re(root)){ + long voff=begin-fb(v); + + c_remove(rc(root),begin-rb(root),-1); + c_append(rc(root),vec+voff,fs(v)-voff); + } + offset_add_value(p,&p->stage2,0,callback); + + }else{ + if(j<begin){ + /* OK, we'll have to force it a bit as the root is jittered + forward */ + long voff=j-fb(v); + + /* don't use it unless it will extend... */ + if(begin+fs(v)-voff>re(root)){ + c_remove(rc(root),root->silencebegin-rb(root),-1); + c_append(rc(root),vec+voff,fs(v)-voff); + } + offset_add_value(p,&p->stage2,end-begin,callback); + }else + return(0); + } + + /* test the new root vector for ending in silence */ + root->silenceflag=0; + i_silence_test(root); + + if(v->lastsector)root->lastsector=1; + free_v_fragment(v); + return(1); +} + +static long i_stage2_each(root_block *root, v_fragment *v, + void(*callback)(long,int)){ + + cdrom_paranoia *p=v->p; + long dynoverlap=p->dynoverlap/2*2; + + if(!v || !v->one)return(0); + + if(!rv(root)){ + return(0); + }else{ + sync_result r; + + if(i_iterate_stage2(p,v,&r,callback)){ + + long begin=r.begin-rb(root); + long end=r.end-rb(root); + long offset=r.begin+r.offset-fb(v)-begin; + long temp; + c_block *l=NULL; + + /* we have a match! We don't rematch off rift, we chase the + match all the way to both extremes doing rift analysis. */ + +#ifdef NOISY + fprintf(stderr,"Stage 2 match\n"); +#endif + + /* chase backward */ + /* note that we don't extend back right now, only forward. */ + while((begin+offset>0 && begin>0)){ + long matchA=0,matchB=0,matchC=0; + long beginL=begin+offset; + + if(l==NULL){ + int16_t *buff=malloc(fs(v)*sizeof(int16_t)); + l=c_alloc(buff,fb(v),fs(v)); + memcpy(buff,fv(v),fs(v)*sizeof(int16_t)); + } + + i_analyze_rift_r(rv(root),cv(l), + rs(root),cs(l), + begin-1,beginL-1, + &matchA,&matchB,&matchC); + +#ifdef NOISY + fprintf(stderr,"matching rootR: matchA:%ld matchB:%ld matchC:%ld\n", + matchA,matchB,matchC); +#endif + + if(matchA){ + /* a problem with root */ + if(matchA>0){ + /* dropped bytes; add back from v */ + if(callback)(*callback)(begin+rb(root)-1,PARANOIA_CB_FIXUP_DROPPED); + if(rb(root)+begin<p->root.returnedlimit) + break; + else{ + c_insert(rc(root),begin,cv(l)+beginL-matchA, + matchA); + offset-=matchA; + begin+=matchA; + end+=matchA; + } + }else{ + /* duplicate bytes; drop from root */ + if(callback)(*callback)(begin+rb(root)-1,PARANOIA_CB_FIXUP_DUPED); + if(rb(root)+begin+matchA<p->root.returnedlimit) + break; + else{ + c_remove(rc(root),begin+matchA,-matchA); + offset-=matchA; + begin+=matchA; + end+=matchA; + } + } + }else if(matchB){ + /* a problem with the fragment */ + if(matchB>0){ + /* dropped bytes */ + if(callback)(*callback)(begin+rb(root)-1,PARANOIA_CB_FIXUP_DROPPED); + c_insert(l,beginL,rv(root)+begin-matchB, + matchB); + offset+=matchB; + }else{ + /* duplicate bytes */ + if(callback)(*callback)(begin+rb(root)-1,PARANOIA_CB_FIXUP_DUPED); + c_remove(l,beginL+matchB,-matchB); + offset+=matchB; + } + }else if(matchC){ + /* Uhh... problem with both */ + + /* Set 'disagree' flags in root */ + if(rb(root)+begin-matchC<p->root.returnedlimit) + break; + c_overwrite(rc(root),begin-matchC, + cv(l)+beginL-matchC,matchC); + + }else{ + /* do we have a mismatch due to silence beginning/end case? */ + /* in the 'chase back' case, we don't do anything. */ + + /* Did not determine nature of difficulty... + report and bail */ + + /*RRR(*callback)(post,PARANOIA_CB_XXX);*/ + break; + } + /* not the most efficient way, but it will do for now */ + beginL=begin+offset; + i_paranoia_overlap(rv(root),cv(l), + begin,beginL, + rs(root),cs(l), + &begin,&end); + } + + /* chase forward */ + temp=l?cs(l):fs(v); + while(end+offset<temp && end<rs(root)){ + long matchA=0,matchB=0,matchC=0; + long beginL=begin+offset; + long endL=end+offset; + + if(l==NULL){ + int16_t *buff=malloc(fs(v)*sizeof(int16_t)); + l=c_alloc(buff,fb(v),fs(v)); + memcpy(buff,fv(v),fs(v)*sizeof(int16_t)); + } + + i_analyze_rift_f(rv(root),cv(l), + rs(root),cs(l), + end,endL, + &matchA,&matchB,&matchC); + +#ifdef NOISY + fprintf(stderr,"matching rootF: matchA:%ld matchB:%ld matchC:%ld\n", + matchA,matchB,matchC); +#endif + + if(matchA){ + /* a problem with root */ + if(matchA>0){ + /* dropped bytes; add back from v */ + if(callback)(*callback)(end+rb(root),PARANOIA_CB_FIXUP_DROPPED); + if(end+rb(root)<p->root.returnedlimit) + break; + c_insert(rc(root),end,cv(l)+endL,matchA); + }else{ + /* duplicate bytes; drop from root */ + if(callback)(*callback)(end+rb(root),PARANOIA_CB_FIXUP_DUPED); + if(end+rb(root)<p->root.returnedlimit) + break; + c_remove(rc(root),end,-matchA); + } + }else if(matchB){ + /* a problem with the fragment */ + if(matchB>0){ + /* dropped bytes */ + if(callback)(*callback)(end+rb(root),PARANOIA_CB_FIXUP_DROPPED); + c_insert(l,endL,rv(root)+end,matchB); + }else{ + /* duplicate bytes */ + if(callback)(*callback)(end+rb(root),PARANOIA_CB_FIXUP_DUPED); + c_remove(l,endL,-matchB); + } + }else if(matchC){ + /* Uhh... problem with both */ + + /* Set 'disagree' flags in root */ + if(end+rb(root)<p->root.returnedlimit) + break; + c_overwrite(rc(root),end,cv(l)+endL,matchC); + }else{ + analyze_rift_silence_f(rv(root),cv(l), + rs(root),cs(l), + end,endL, + &matchA,&matchB); + if(matchA){ + /* silence in root */ + /* Can only do this if we haven't already returned data */ + if(end+rb(root)>=p->root.returnedlimit){ + c_remove(rc(root),end,-1); + } + + }else if(matchB){ + /* silence in fragment; lose it */ + + if(l)i_cblock_destructor(l); + free_v_fragment(v); + return(1); + + }else{ + /* Could not determine nature of difficulty... + report and bail */ + + /*RRR(*callback)(post,PARANOIA_CB_XXX);*/ + } + break; + } + /* not the most efficient way, but it will do for now */ + i_paranoia_overlap(rv(root),cv(l), + begin,beginL, + rs(root),cs(l), + NULL,&end); + } + + /* if this extends our range, let's glom */ + { + long sizeA=rs(root); + long sizeB; + long vecbegin; + int16_t *vector; + + if(l){ + sizeB=cs(l); + vector=cv(l); + vecbegin=cb(l); + }else{ + sizeB=fs(v); + vector=fv(v); + vecbegin=fb(v); + } + + if(sizeB-offset>sizeA || v->lastsector){ + if(v->lastsector){ + root->lastsector=1; + } + + if(end<sizeA)c_remove(rc(root),end,-1); + + if(sizeB-offset-end)c_append(rc(root),vector+end+offset, + sizeB-offset-end); + + i_silence_test(root); + + /* add offset into dynoverlap stats */ + offset_add_value(p,&p->stage2,offset+vecbegin-rb(root),callback); + } + } + if(l)i_cblock_destructor(l); + free_v_fragment(v); + return(1); + + }else{ + /* D'oh. No match. What to do with the fragment? */ + if(fe(v)+dynoverlap<re(root) && !root->silenceflag){ + /* It *should* have matched. No good; free it. */ + free_v_fragment(v); + } + /* otherwise, we likely want this for an upcoming match */ + /* we don't free the sort info (if it was collected) */ + return(0); + + } + } +} + +static int i_init_root(root_block *root, v_fragment *v,long begin, + void(*callback)(long,int)){ + if(fb(v)<=begin && fe(v)>begin){ + + root->lastsector=v->lastsector; + root->returnedlimit=begin; + + if(rv(root)){ + i_cblock_destructor(rc(root)); + rc(root)=NULL; + } + + { + int16_t *buff=malloc(fs(v)*sizeof(int16_t)); + memcpy(buff,fv(v),fs(v)*sizeof(int16_t)); + root->vector=c_alloc(buff,fb(v),fs(v)); + } + + i_silence_test(root); + + return(1); + }else + return(0); +} + +static int vsort(const void *a,const void *b){ + return((*(v_fragment **)a)->begin-(*(v_fragment **)b)->begin); +} + +static int i_stage2(cdrom_paranoia *p,long beginword,long endword, + void(*callback)(long,int)){ + + int flag=1,ret=0; + root_block *root=&(p->root); + +#ifdef NOISY + fprintf(stderr,"Fragments:%ld\n",p->fragments->active); + fflush(stderr); +#endif + + /* even when the 'silence flag' is lit, we try to do non-silence + matching in the event that there are still audio vectors with + content to be sunk before the silence */ + + while(flag){ + /* loop through all the current fragments */ + v_fragment *first=v_first(p); + long active=p->fragments->active,count=0; + v_fragment *list[active]; + + while(first){ + v_fragment *next=v_next(first); + list[count++]=first; + first=next; + } + + flag=0; + if(count){ + /* sorted in ascending order of beginning */ + qsort(list,active,sizeof(v_fragment *),&vsort); + + /* we try a nonzero based match even if in silent mode in + the case that there are still cached vectors to sink + behind continent->ocean boundary */ + + for(count=0;count<active;count++){ + first=list[count]; + if(first->one){ + if(rv(root)==NULL){ + if(i_init_root(&(p->root),first,beginword,callback)){ + free_v_fragment(first); + flag=1; + ret++; + } + }else{ + if(i_stage2_each(root,first,callback)){ + ret++; + flag=1; + } + } + } + } + + /* silence handling */ + if(!flag && p->root.silenceflag){ + for(count=0;count<active;count++){ + first=list[count]; + if(first->one){ + if(rv(root)!=NULL){ + if(i_silence_match(root,first,callback)){ + ret++; + flag=1; + } + } + } + } + } + } + } + return(ret); +} + +static void i_end_case(cdrom_paranoia *p,long endword, + void(*callback)(long,int)){ + + root_block *root=&p->root; + + /* have an 'end' flag; if we've just read in the last sector in a + session, set the flag. If we verify to the end of a fragment + which has the end flag set, we're done (set a done flag). Pad + zeroes to the end of the read */ + + if(root->lastsector==0)return; + if(endword<re(root))return; + + { + long addto=endword-re(root); + char *temp=calloc(addto,sizeof(char)*2); + + c_append(rc(root),(void *)temp,addto); + free(temp); + + /* trash da cache */ + paranoia_resetcache(p); + + } +} + +/* We want to add a sector. Look through the caches for something that + spans. Also look at the flags on the c_block... if this is an + obliterated sector, get a bit of a chunk past the obliteration. */ + +/* Not terribly smart right now, actually. We can probably find + *some* match with a cache block somewhere. Take it and continue it + through the skip */ + +static void verify_skip_case(cdrom_paranoia *p,void(*callback)(long,int)){ + + root_block *root=&(p->root); + c_block *graft=NULL; + int vflag=0; + int gend=0; + long post; + +#ifdef NOISY + fprintf(stderr,"\nskipping\n"); +#endif + + if(rv(root)==NULL){ + post=0; + }else{ + post=re(root); + } + if(post==-1)post=0; + + if(callback)(*callback)(post,PARANOIA_CB_SKIP); + + /* We want to add a sector. Look for a c_block that spans, + preferrably a verified area */ + + { + c_block *c=c_first(p); + while(c){ + long cbegin=cb(c); + long cend=ce(c); + if(cbegin<=post && cend>post){ + long vend=post; + + if(c->flags[post-cbegin]&4){ + /* verified area! */ + while(vend<cend && (c->flags[vend-cbegin]&4))vend++; + if(!vflag || vend>vflag){ + graft=c; + gend=vend; + } + vflag=1; + }else{ + /* not a verified area */ + if(!vflag){ + while(vend<cend && (c->flags[vend-cbegin]&4)==0)vend++; + if(graft==NULL || gend>vend){ + /* smallest unverified area */ + graft=c; + gend=vend; + } + } + } + } + c=c_next(c); + } + + if(graft){ + long cbegin=cb(graft); + long cend=ce(graft); + + while(gend<cend && (graft->flags[gend-cbegin]&4))gend++; + gend=prna_min(gend+OVERLAP_ADJ,cend); + + if(rv(root)==NULL){ + int16_t *buff=malloc(cs(graft)); + memcpy(buff,cv(graft),cs(graft)); + rc(root)=c_alloc(buff,cb(graft),cs(graft)); + }else{ + c_append(rc(root),cv(graft)+post-cbegin, + gend-post); + } + + root->returnedlimit=re(root); + return; + } + } + + /* No? Fine. Great. Write in some zeroes :-P */ + { + void *temp=calloc(CD_FRAMESIZE_RAW,sizeof(int16_t)); + + if(rv(root)==NULL){ + rc(root)=c_alloc(temp,post,CD_FRAMESIZE_RAW); + }else{ + c_append(rc(root),temp,CD_FRAMESIZE_RAW); + free(temp); + } + root->returnedlimit=re(root); + } +} + +/**** toplevel ****************************************/ + +void paranoia_free(cdrom_paranoia *p){ + paranoia_resetall(p); + sort_free(p->sortcache); + free(p); +} + +void paranoia_modeset(cdrom_paranoia *p,int enable){ + p->enable=enable; +} + +#if 0 +long paranoia_seek(cdrom_paranoia *p,long seek,int mode){ + long sector; + long ret; + switch(mode){ + case SEEK_SET: + sector=seek; + break; + case SEEK_END: + sector=cdda_disc_lastsector(p->d)+seek; + break; + default: + sector=p->cursor+seek; + break; + } + + if(cdda_sector_gettrack(p->d,sector)==-1)return(-1); + + i_cblock_destructor(p->root.vector); + p->root.vector=NULL; + p->root.lastsector=0; + p->root.returnedlimit=0; + + ret=p->cursor; + p->cursor=sector; + + i_paranoia_firstlast(p); + + /* Evil hack to fix pregap patch for NEC drives! To be rooted out in a10 */ + p->current_firstsector=sector; + + return(ret); +} +#endif + +/* returns last block read, -1 on error */ +c_block *i_read_c_block(cdrom_paranoia *p,long beginword,long endword, + void(*callback)(long,int)){ + +/* why do it this way? We need to read lots of sectors to kludge + around stupid read ahead buffers on cheap drives, as well as avoid + expensive back-seeking. We also want to 'jiggle' the start address + to try to break borderline drives more noticeably (and make broken + drives with unaddressable sectors behave more often). */ + + long readat,firstread; + long totaltoread=p->readahead; + long sectatonce=p->d->nsectors; + long driftcomp=(float)p->dyndrift/CD_FRAMEWORDS+.5; + c_block *new=NULL; + root_block *root=&p->root; + int16_t *buffer=NULL; + char *flags=NULL; + long sofar; + long dynoverlap=(p->dynoverlap+CD_FRAMEWORDS-1)/CD_FRAMEWORDS; + long anyflag=0; + + /* What is the first sector to read? want some pre-buffer if + we're not at the extreme beginning of the disc */ + + if(p->enable&(PARANOIA_MODE_VERIFY|PARANOIA_MODE_OVERLAP)){ + + /* we want to jitter the read alignment boundary */ + long target; + if(rv(root)==NULL || rb(root)>beginword) + target=p->cursor-dynoverlap; + else + target=re(root)/(CD_FRAMEWORDS)-dynoverlap; + + if(target+MIN_SECTOR_BACKUP>p->lastread && target<=p->lastread) + target=p->lastread-MIN_SECTOR_BACKUP; + + /* we want to jitter the read alignment boundary, as some + drives, beginning from a specific point, will tend to + lose bytes between sectors in the same place. Also, as + our vectors are being made up of multiple reads, we want + the overlap boundaries to move.... */ + + readat=(target&(~((long)JIGGLE_MODULO-1)))+p->jitter; + if(readat>target)readat-=JIGGLE_MODULO; + p->jitter++; + if(p->jitter>=JIGGLE_MODULO)p->jitter=0; + + }else{ + readat=p->cursor; + } + + readat+=driftcomp; + + if(p->enable&(PARANOIA_MODE_OVERLAP|PARANOIA_MODE_VERIFY)){ + flags=calloc(totaltoread*CD_FRAMEWORDS,1); + new=new_c_block(p); + recover_cache(p); + }else{ + /* in the case of root it's just the buffer */ + paranoia_resetall(p); + new=new_c_block(p); + } + + buffer=malloc(totaltoread*CD_FRAMESIZE_RAW); + sofar=0; + firstread=-1; + + /* actual read loop */ + + while(sofar<totaltoread){ + long secread=sectatonce; + long adjread=readat; + long thisread; + + /* don't under/overflow the audio session */ + if(adjread<p->current_firstsector){ + secread-=p->current_firstsector-adjread; + adjread=p->current_firstsector; + } + if(adjread+secread-1>p->current_lastsector) + secread=p->current_lastsector-adjread+1; + + if(sofar+secread>totaltoread)secread=totaltoread-sofar; + + if(secread>0){ + + if(firstread<0)firstread=adjread; + if((thisread=cdda_read(p->d,buffer+sofar*CD_FRAMEWORDS,adjread, + secread))<secread){ + + if(thisread<0)thisread=0; + + /* Uhhh... right. Make something up. But don't make us seek + backward! */ + + if(callback)(*callback)((adjread+thisread)*CD_FRAMEWORDS,PARANOIA_CB_READERR); + memset(buffer+(sofar+thisread)*CD_FRAMEWORDS,0, + CD_FRAMESIZE_RAW*(secread-thisread)); + if(flags)memset(flags+(sofar+thisread)*CD_FRAMEWORDS,2, + CD_FRAMEWORDS*(secread-thisread)); + } + if(thisread!=0)anyflag=1; + + if(flags && sofar!=0){ + /* Don't verify across overlaps that are too close to one + another */ + int i=0; + for(i=-MIN_WORDS_OVERLAP/2;i<MIN_WORDS_OVERLAP/2;i++) + flags[sofar*CD_FRAMEWORDS+i]|=1; + } + + p->lastread=adjread+secread; + + if(adjread+secread-1==p->current_lastsector) + new->lastsector=-1; + + if(callback)(*callback)((adjread+secread-1)*CD_FRAMEWORDS,PARANOIA_CB_READ); + + sofar+=secread; + readat=adjread+secread; + }else + if(readat<p->current_firstsector) + readat+=sectatonce; /* due to being before the readable area */ + else + break; /* due to being past the readable area */ + } + + if(anyflag){ + new->vector=buffer; + new->begin=firstread*CD_FRAMEWORDS-p->dyndrift; + new->size=sofar*CD_FRAMEWORDS; + new->flags=(unsigned char*)flags; + }else{ + if(new)free_c_block(new); + free(buffer); + free(flags); + new=NULL; + } + return(new); +} + +/* The returned buffer is *not* to be freed by the caller. It will + persist only until the next call to paranoia_read() for this p */ + +int16_t *paranoia_read(cdrom_paranoia *p, void(*callback)(long,int)){ + return paranoia_read_limited(p,callback,20); +} + + /* I added max_retry functionality this way in order to avoid + breaking any old apps using the nerw libs. cdparanoia 9.8 will + need the updated libs, but nothing else will require it. */ +int16_t *paranoia_read_limited(cdrom_paranoia *p, void(*callback)(long,int), + int max_retries){ + + long beginword=p->cursor*(CD_FRAMEWORDS); + long endword=beginword+CD_FRAMEWORDS; + long retry_count=0,lastend=-2; + root_block *root=&p->root; + + if(beginword>p->root.returnedlimit)p->root.returnedlimit=beginword; + lastend=re(root); + + /* First, is the sector we want already in the root? */ + while(rv(root)==NULL || + rb(root)>beginword || + (re(root)<endword+(MAX_SECTOR_OVERLAP*CD_FRAMEWORDS) && + p->enable&(PARANOIA_MODE_VERIFY|PARANOIA_MODE_OVERLAP)) || + re(root)<endword){ + + /* Nope; we need to build or extend the root verified range */ + + if(p->enable&(PARANOIA_MODE_VERIFY|PARANOIA_MODE_OVERLAP)){ + i_paranoia_trim(p,beginword,endword); + recover_cache(p); + if(rb(root)!=-1 && p->root.lastsector) + i_end_case(p,endword+(MAX_SECTOR_OVERLAP*CD_FRAMEWORDS), + callback); + else + i_stage2(p,beginword, + endword+(MAX_SECTOR_OVERLAP*CD_FRAMEWORDS), + callback); + }else + i_end_case(p,endword+(MAX_SECTOR_OVERLAP*CD_FRAMEWORDS), + callback); /* only trips if we're already done */ + + if(!(rb(root)==-1 || rb(root)>beginword || + re(root)<endword+(MAX_SECTOR_OVERLAP*CD_FRAMEWORDS))) + break; + + /* Hmm, need more. Read another block */ + + { + c_block *new=i_read_c_block(p,beginword,endword,callback); + + if(new){ + if(p->enable&(PARANOIA_MODE_OVERLAP|PARANOIA_MODE_VERIFY)){ + + if(p->enable&PARANOIA_MODE_VERIFY) + i_stage1(p,new,callback); + else{ + /* just make v_fragments from the boundary information. */ + long begin=0,end=0; + + while(begin<cs(new)){ + while(end<cs(new)&&(new->flags[begin]&1))begin++; + end=begin+1; + while(end<cs(new)&&(new->flags[end]&1)==0)end++; + { + new_v_fragment(p,new,begin+cb(new), + end+cb(new), + (new->lastsector && cb(new)+end==ce(new))); + } + begin=end; + } + } + + }else{ + + if(p->root.vector)i_cblock_destructor(p->root.vector); + free_elem(new->e,0); + p->root.vector=new; + + i_end_case(p,endword+(MAX_SECTOR_OVERLAP*CD_FRAMEWORDS), + callback); + + } + } + } + + /* Are we doing lots of retries? **************************************/ + + /* Check unaddressable sectors first. There's no backoff here; + jiggle and minimum backseek handle that for us */ + + if(rb(root)!=-1 && lastend+588<re(root)){ /* If we've not grown + half a sector */ + lastend=re(root); + retry_count=0; + }else{ + /* increase overlap or bail */ + retry_count++; + + /* The better way to do this is to look at how many actual + matches we're getting and what kind of gap */ + + if(retry_count%5==0){ + if(p->dynoverlap==MAX_SECTOR_OVERLAP*CD_FRAMEWORDS || + retry_count==max_retries){ + if(!(p->enable&PARANOIA_MODE_NEVERSKIP))verify_skip_case(p,callback); + retry_count=0; + }else{ + if(p->stage1.offpoints!=-1){ /* hack */ + p->dynoverlap*=1.5; + if(p->dynoverlap>MAX_SECTOR_OVERLAP*CD_FRAMEWORDS) + p->dynoverlap=MAX_SECTOR_OVERLAP*CD_FRAMEWORDS; + if(callback)(*callback)(p->dynoverlap,PARANOIA_CB_OVERLAP); + } + } + } + } + } + p->cursor++; + + return(rv(root)+(beginword-rb(root))); +} + +/* a temporary hack */ +void paranoia_overlapset(cdrom_paranoia *p, long overlap){ + p->dynoverlap=overlap*CD_FRAMEWORDS; + p->stage1.offpoints=-1; +} diff --git a/pccts/Makefile.am b/pccts/Makefile.am new file mode 100644 index 0000000..02a4f1a --- /dev/null +++ b/pccts/Makefile.am @@ -0,0 +1,3 @@ +SUBDIRS = antlr dlg + +EXTRA_DIST = h diff --git a/pccts/Makefile.in b/pccts/Makefile.in new file mode 100644 index 0000000..05a3129 --- /dev/null +++ b/pccts/Makefile.in @@ -0,0 +1,500 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = pccts +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AO_CFLAGS = @AO_CFLAGS@ +AO_LIBS = @AO_LIBS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COND_MP3_FALSE = @COND_MP3_FALSE@ +COND_MP3_TRUE = @COND_MP3_TRUE@ +COND_OGG_FALSE = @COND_OGG_FALSE@ +COND_OGG_TRUE = @COND_OGG_TRUE@ +COND_PCCTS_FALSE = @COND_PCCTS_FALSE@ +COND_PCCTS_TRUE = @COND_PCCTS_TRUE@ +COND_SCSILIB_FALSE = @COND_SCSILIB_FALSE@ +COND_SCSILIB_TRUE = @COND_SCSILIB_TRUE@ +COND_TOC2MP3_FALSE = @COND_TOC2MP3_FALSE@ +COND_TOC2MP3_TRUE = @COND_TOC2MP3_TRUE@ +COND_XDAO_FALSE = @COND_XDAO_FALSE@ +COND_XDAO_TRUE = @COND_XDAO_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ +GTKMM2_CFLAGS = @GTKMM2_CFLAGS@ +GTKMM2_LIBS = @GTKMM2_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LAME_CFLAGS = @LAME_CFLAGS@ +LAME_LIBS = @LAME_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBGUIMM2_CFLAGS = @LIBGUIMM2_CFLAGS@ +LIBGUIMM2_LIBS = @LIBGUIMM2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAD_CFLAGS = @MAD_CFLAGS@ +MAD_LIBS = @MAD_LIBS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIGCPP2_CFLAGS = @SIGCPP2_CFLAGS@ +SIGCPP2_LIBS = @SIGCPP2_LIBS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +VORBISFILE_CFLAGS = @VORBISFILE_CFLAGS@ +VORBISFILE_LIBS = @VORBISFILE_LIBS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +antlr_path = @antlr_path@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +dao_src = @dao_src@ +datadir = @datadir@ +dlg_path = @dlg_path@ +en_cdrdao = @en_cdrdao@ +en_cue2toc = @en_cue2toc@ +en_toc2cue = @en_toc2cue@ +en_toc2mp3 = @en_toc2mp3@ +en_xdao = @en_xdao@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydefs = @mydefs@ +oldincludedir = @oldincludedir@ +pcctsinc = @pcctsinc@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +scsilib_dir = @scsilib_dir@ +scsilib_incl = @scsilib_incl@ +scsilib_libs = @scsilib_libs@ +scsilib_objs = @scsilib_objs@ +sharedstatedir = @sharedstatedir@ +sound_if_obj = @sound_if_obj@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +thread_libs = @thread_libs@ +SUBDIRS = antlr dlg +EXTRA_DIST = h +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu pccts/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu pccts/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-recursive ctags ctags-recursive \ + distclean distclean-generic distclean-recursive distclean-tags \ + distdir dvi dvi-am html html-am info info-am install \ + install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + installdirs-am maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/pccts/antlr/Makefile.am b/pccts/antlr/Makefile.am new file mode 100644 index 0000000..cd906e1 --- /dev/null +++ b/pccts/antlr/Makefile.am @@ -0,0 +1,8 @@ +noinst_PROGRAMS = antlr + +antlr_SOURCES = antlr.c dumpcycles.c err.c fset.c hash.c misc.c scan.c bits.c dumpnode.c fcache.c gen.c lex.c mrhoist.c build.c egman.c fset2.c globals.c main.c pred.c set.c generic.h hash.h mode.h proto.h stdpccts.h syn.h tokens.h + +AM_CFLAGS = -DUSER_ZZSYN -DZZLEXBUFSIZE=32000 + +INCLUDES = -I../h + diff --git a/pccts/antlr/Makefile.in b/pccts/antlr/Makefile.in new file mode 100644 index 0000000..47b5528 --- /dev/null +++ b/pccts/antlr/Makefile.in @@ -0,0 +1,460 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = antlr$(EXEEXT) +subdir = pccts/antlr +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am_antlr_OBJECTS = antlr.$(OBJEXT) dumpcycles.$(OBJEXT) err.$(OBJEXT) \ + fset.$(OBJEXT) hash.$(OBJEXT) misc.$(OBJEXT) scan.$(OBJEXT) \ + bits.$(OBJEXT) dumpnode.$(OBJEXT) fcache.$(OBJEXT) \ + gen.$(OBJEXT) lex.$(OBJEXT) mrhoist.$(OBJEXT) build.$(OBJEXT) \ + egman.$(OBJEXT) fset2.$(OBJEXT) globals.$(OBJEXT) \ + main.$(OBJEXT) pred.$(OBJEXT) set.$(OBJEXT) +antlr_OBJECTS = $(am_antlr_OBJECTS) +antlr_LDADD = $(LDADD) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(antlr_SOURCES) +DIST_SOURCES = $(antlr_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AO_CFLAGS = @AO_CFLAGS@ +AO_LIBS = @AO_LIBS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COND_MP3_FALSE = @COND_MP3_FALSE@ +COND_MP3_TRUE = @COND_MP3_TRUE@ +COND_OGG_FALSE = @COND_OGG_FALSE@ +COND_OGG_TRUE = @COND_OGG_TRUE@ +COND_PCCTS_FALSE = @COND_PCCTS_FALSE@ +COND_PCCTS_TRUE = @COND_PCCTS_TRUE@ +COND_SCSILIB_FALSE = @COND_SCSILIB_FALSE@ +COND_SCSILIB_TRUE = @COND_SCSILIB_TRUE@ +COND_TOC2MP3_FALSE = @COND_TOC2MP3_FALSE@ +COND_TOC2MP3_TRUE = @COND_TOC2MP3_TRUE@ +COND_XDAO_FALSE = @COND_XDAO_FALSE@ +COND_XDAO_TRUE = @COND_XDAO_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ +GTKMM2_CFLAGS = @GTKMM2_CFLAGS@ +GTKMM2_LIBS = @GTKMM2_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LAME_CFLAGS = @LAME_CFLAGS@ +LAME_LIBS = @LAME_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBGUIMM2_CFLAGS = @LIBGUIMM2_CFLAGS@ +LIBGUIMM2_LIBS = @LIBGUIMM2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAD_CFLAGS = @MAD_CFLAGS@ +MAD_LIBS = @MAD_LIBS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIGCPP2_CFLAGS = @SIGCPP2_CFLAGS@ +SIGCPP2_LIBS = @SIGCPP2_LIBS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +VORBISFILE_CFLAGS = @VORBISFILE_CFLAGS@ +VORBISFILE_LIBS = @VORBISFILE_LIBS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +antlr_path = @antlr_path@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +dao_src = @dao_src@ +datadir = @datadir@ +dlg_path = @dlg_path@ +en_cdrdao = @en_cdrdao@ +en_cue2toc = @en_cue2toc@ +en_toc2cue = @en_toc2cue@ +en_toc2mp3 = @en_toc2mp3@ +en_xdao = @en_xdao@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydefs = @mydefs@ +oldincludedir = @oldincludedir@ +pcctsinc = @pcctsinc@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +scsilib_dir = @scsilib_dir@ +scsilib_incl = @scsilib_incl@ +scsilib_libs = @scsilib_libs@ +scsilib_objs = @scsilib_objs@ +sharedstatedir = @sharedstatedir@ +sound_if_obj = @sound_if_obj@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +thread_libs = @thread_libs@ +antlr_SOURCES = antlr.c dumpcycles.c err.c fset.c hash.c misc.c scan.c bits.c dumpnode.c fcache.c gen.c lex.c mrhoist.c build.c egman.c fset2.c globals.c main.c pred.c set.c generic.h hash.h mode.h proto.h stdpccts.h syn.h tokens.h +AM_CFLAGS = -DUSER_ZZSYN -DZZLEXBUFSIZE=32000 +INCLUDES = -I../h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu pccts/antlr/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu pccts/antlr/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +antlr$(EXEEXT): $(antlr_OBJECTS) $(antlr_DEPENDENCIES) + @rm -f antlr$(EXEEXT) + $(LINK) $(antlr_LDFLAGS) $(antlr_OBJECTS) $(antlr_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/antlr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bits.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/build.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumpcycles.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dumpnode.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/egman.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/err.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fcache.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fset.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fset2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gen.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/globals.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lex.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mrhoist.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pred.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstPROGRAMS ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/pccts/antlr/antlr.c b/pccts/antlr/antlr.c new file mode 100644 index 0000000..01245f9 --- /dev/null +++ b/pccts/antlr/antlr.c @@ -0,0 +1,3565 @@ +/* + * A n t l r T r a n s l a t i o n H e a d e r + * + * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001 + * Purdue University Electrical Engineering + * With AHPCRC, University of Minnesota + * ANTLR Version 1.33MR32 + * + * ..\bin\antlr -gh antlr.g + * + */ + +#define ANTLR_VERSION 13332 +#include "pcctscfg.h" +#include "pccts_stdio.h" + +#include "pcctscfg.h" +#include "set.h" +#include <ctype.h> +#include "syn.h" +#include "hash.h" +#include "generic.h" +#define zzcr_attr(attr,tok,t) {(attr)->left = 0; (attr)->right = 0;} +#define zzSET_SIZE 20 +#include "antlr.h" +#include "tokens.h" +#include "dlgdef.h" +#include "mode.h" + +/* MR23 In order to remove calls to PURIFY use the antlr -nopurify option */ + +#ifndef PCCTS_PURIFY +#define PCCTS_PURIFY(r,s) memset((char *) &(r),'\0',(s)); +#endif + +ANTLR_INFO + + +/* MR20 G. Hobbelt For Borland C++ 4.x & 5.x compiling with ALL warnings enabled */ +#if defined(__TURBOC__) +#pragma warn -aus /* unused assignment of 'xxx' */ +#endif + + +#ifdef __USE_PROTOS +static void chkToken(char *, char *, char *, int); +#else +static void chkToken(); +#endif + +#ifdef __USE_PROTOS +static int isDLGmaxToken(char *Token); /* MR3 */ +#else +static int isDLGmaxToken(); /* MR3 */ +#endif + +static int class_nest_level = 0; + +/* MR20 G. Hobbelt extern definitions moved to antlr.h */ + + + +void +#ifdef __USE_PROTOS +grammar(void) +#else +grammar() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + Graph g; + { + zzBLOCK(zztasp2); + zzMake0; + { + for (;;) { + if ( !((setwd1[LA(1)]&0x1))) break; + if ( (LA(1)==94) ) { + zzmatch(94); zzCONSUME; + zzmatch(Action); + + if ( HdrAction==NULL ) { + HdrAction = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char)); + require(HdrAction!=NULL, "rule grammar: cannot allocate header action"); + strcpy(HdrAction, LATEXT(1)); + } + else warn("additional #header statement ignored"); + zzCONSUME; + + } + else { + if ( (LA(1)==95) ) { + zzmatch(95); zzCONSUME; + zzmatch(Action); + + if ( FirstAction==NULL ) { + FirstAction = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char)); + require(FirstAction!=NULL, "rule grammar: cannot allocate #first action"); + strcpy(FirstAction, LATEXT(1)); + } else { + warn("additional #first statement ignored"); + }; + zzCONSUME; + + } + else { + if ( (LA(1)==96) ) { + zzmatch(96); zzCONSUME; + zzmatch(QuotedTerm); + + if ( GenCC ) { + warn("#parser meta-op incompatible with -CC; ignored"); + } + else { + if ( strcmp(ParserName,"zzparser")==0 ) { + ParserName=StripQuotes(mystrdup(LATEXT(1))); + if ( RulePrefix[0]!='\0' ) + { + warn("#parser meta-op incompatible with '-gp prefix'; '-gp' ignored"); + RulePrefix[0]='\0'; + } + } + else warn("additional #parser statement ignored"); + } + zzCONSUME; + + } + else { + if ( (LA(1)==97) ) { + zzmatch(97); zzCONSUME; + zzmatch(QuotedTerm); + { + char *fname; + zzantlr_state st; FILE *f; struct zzdlg_state dst; + UserTokenDefsFile = mystrdup(LATEXT(1)); + zzsave_antlr_state(&st); + zzsave_dlg_state(&dst); + fname = mystrdup(LATEXT(1)); + f = fopen(StripQuotes(fname), "r"); + if ( f==NULL ) {warn(eMsg1("cannot open token defs file '%s'", fname+1));} + else { + ANTLRm(enum_file(fname+1), f, PARSE_ENUM_FILE); + UserDefdTokens = 1; + } + zzrestore_antlr_state(&st); + zzrestore_dlg_state(&dst); + } + zzCONSUME; + + } + else break; /* MR6 code for exiting loop "for sure" */ + } + } + } + zzLOOP(zztasp2); + } + zzEXIT(zztasp2); + } + } + { + zzBLOCK(zztasp2); + zzMake0; + { + for (;;) { + if ( !((setwd1[LA(1)]&0x2))) break; + if ( (LA(1)==Action) ) { + zzmatch(Action); + { + UserAction *ua = newUserAction(LATEXT(1)); + ua->file = action_file; ua->line = action_line; + if ( class_nest_level>0 ) list_add(&class_before_actions, ua); + else list_add(&BeforeActions, ua); + } + zzCONSUME; + + } + else { + if ( (LA(1)==108) ) { + laction(); + } + else { + if ( (LA(1)==109) ) { + lmember(); + } + else { + if ( (LA(1)==110) ) { + lprefix(); + } + else { + if ( (LA(1)==116) ) { + aLexclass(); + } + else { + if ( (LA(1)==120) ) { + token(); + } + else { + if ( (LA(1)==117) ) { + error(); + } + else { + if ( (LA(1)==118) ) { + tclass(); + } + else { + if ( (LA(1)==111) ) { + aPred(); + } + else { + if ( (LA(1)==133) ) { + default_exception_handler(); + } + else { + if ( (LA(1)==99) ) { + class_def(); + } + else { + if ( (LA(1)==98) ) { + zzmatch(98); + + if ( class_nest_level==0 ) + warn("missing class definition for trailing '}'"); + class_nest_level--; + zzCONSUME; + + } + else break; /* MR6 code for exiting loop "for sure" */ + } + } + } + } + } + } + } + } + } + } + } + zzLOOP(zztasp2); + } + zzEXIT(zztasp2); + } + } + rule(); + g=zzaArg(zztasp1,3); SynDiag = (Junction *) zzaArg(zztasp1,3 ).left; + { + zzBLOCK(zztasp2); + zzMake0; + { + for (;;) { + if ( !((setwd1[LA(1)]&0x4))) break; + if ( (LA(1)==NonTerminal) ) { + rule(); + if ( zzaArg(zztasp2,1 ).left!=NULL ) { + g.right = NULL; + +/* MR21a */ /* Avoid use of a malformed graph when CannotContinue */ + /* MR21a */ /* is already set */ + /* MR21a */ + /* MR21a */ if (! (CannotContinue && g.left == NULL)) { + /* MR21a */ g = Or(g, zzaArg(zztasp2,1)); + /* MR21a */ } + /* MR21a */ } + } + else { + if ( (LA(1)==116) ) { + aLexclass(); + } + else { + if ( (LA(1)==120) ) { + token(); + } + else { + if ( (LA(1)==117) ) { + error(); + } + else { + if ( (LA(1)==118) ) { + tclass(); + } + else { + if ( (LA(1)==111) ) { + aPred(); + } + else { + if ( (LA(1)==99) ) { + class_def(); + } + else { + if ( (LA(1)==98) ) { + zzmatch(98); + + if ( class_nest_level==0 ) + warn("missing class definition for trailing '}'"); + class_nest_level--; + zzCONSUME; + + } + else break; /* MR6 code for exiting loop "for sure" */ + } + } + } + } + } + } + } + zzLOOP(zztasp2); + } + zzEXIT(zztasp2); + } + } + { + zzBLOCK(zztasp2); + zzMake0; + { + for (;;) { + if ( !((setwd1[LA(1)]&0x8))) break; + if ( (LA(1)==Action) ) { + zzmatch(Action); + { + UserAction *ua = newUserAction(LATEXT(1)); + ua->file = action_file; ua->line = action_line; + if ( class_nest_level>0 ) list_add(&class_after_actions, ua); + else list_add(&AfterActions, ua); + } + zzCONSUME; + + } + else { + if ( (LA(1)==108) ) { + laction(); + } + else { + if ( (LA(1)==109) ) { + lmember(); + } + else { + if ( (LA(1)==110) ) { + lprefix(); + } + else { + if ( (LA(1)==117) ) { + error(); + } + else { + if ( (LA(1)==118) ) { + tclass(); + } + else { + if ( (LA(1)==99) ) { + class_def(); + } + else { + if ( (LA(1)==111) ) { + aPred(); + } + else { + if ( (LA(1)==98) ) { + zzmatch(98); + + if ( class_nest_level==0 ) + warn("missing class definition for trailing '}'"); + class_nest_level--; + zzCONSUME; + + } + else break; /* MR6 code for exiting loop "for sure" */ + } + } + } + } + } + } + } + } + zzLOOP(zztasp2); + } + zzEXIT(zztasp2); + } + } + zzmatch(Eof); zzCONSUME; + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + CannotContinue=TRUE; + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd1, 0x10); + } +} + +void +#ifdef __USE_PROTOS +class_def(void) +#else +class_def() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + int go=1; char name[MaxRuleName+1]; + zzmatch(99); zzCONSUME; + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==NonTerminal) ) { + zzmatch(NonTerminal); + if(go) strncpy(name,LATEXT(1),MaxRuleName); + zzCONSUME; + + } + else { + if ( (LA(1)==TokenTerm) ) { + zzmatch(TokenTerm); + if(go) strncpy(name,LATEXT(1),MaxRuleName); + zzCONSUME; + + } + else {zzFAIL(1,zzerr1,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + + if ( CurrentClassName[0]!='\0' && strcmp(CurrentClassName,name)!=0 + && GenCC ) { + err("only one grammar class allowed in this release"); + go = 0; + } + else strcpy(CurrentClassName, name); + if ( !GenCC ) { err("class meta-op used without C++ option"); } + { + zzBLOCK(zztasp2); + zzMake0; + { + while ( (setwd1[LA(1)]&0x20) ) { + zzsetmatch(zzerr2, zzerr3); + if (ClassDeclStuff == NULL) { + /* MR10 */ ClassDeclStuff=(char *)calloc(MaxClassDeclStuff+1,sizeof(char)); + /* MR10 */ }; + /* MR10 */ strncat(ClassDeclStuff," ",MaxClassDeclStuff); + /* MR10 */ strncat(ClassDeclStuff,LATEXT(1),MaxClassDeclStuff); + /* MR22 */ do { + /* MR22 */ if (0 == strcmp(LATEXT(1),"public")) break; + /* MR22 */ if (0 == strcmp(LATEXT(1),"private")) break; + /* MR22 */ if (0 == strcmp(LATEXT(1),"protected")) break; + /* MR22 */ if (0 == strcmp(LATEXT(1),"virtual")) break; + /* MR22 */ if (0 == strcmp(LATEXT(1),",")) break; + /* MR22 */ if (0 == strcmp(LATEXT(1),":")) break; + /* MR22 */ if (BaseClassName != NULL) break; + /* MR22 */ BaseClassName=(char *)calloc(strlen(LATEXT(1))+1,sizeof(char)); + /* MR22 */ require(BaseClassName!=NULL, "rule grammar: cannot allocate base class name"); + /* MR22 */ strcpy(BaseClassName,LATEXT(1)); + /* MR22 */ } while (0); + /* MR10 */ + zzCONSUME; + + zzLOOP(zztasp2); + } + zzEXIT(zztasp2); + } + } + zzmatch(102); + + no_classes_found = 0; + if ( class_nest_level>=1 ) {warn("cannot have nested classes");} + else class_nest_level++; + zzCONSUME; + + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + CannotContinue=TRUE; + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd1, 0x40); + } +} + +void +#ifdef __USE_PROTOS +rule(void) +#else +rule() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + + + ExceptionGroup *eg; + RuleEntry *q; Junction *p; Graph r; int f, l; ECnode *e; + set toksrefd, rulesrefd; + char *pdecl=NULL, *ret=NULL, *a; CurRetDef = CurParmDef = NULL; + CurExGroups = NULL; + CurElementLabels = NULL; + CurAstLabelsInActions = NULL; /* MR27 */ + /* We want a new element label hash table for each rule */ + if ( Elabel!=NULL ) killHashTable(Elabel); + Elabel = newHashTable(); + attribsRefdFromAction = empty; + zzmatch(NonTerminal); + q=NULL; + if ( hash_get(Rname, LATEXT(1))!=NULL ) { + err(eMsg1("duplicate rule definition: '%s'",LATEXT(1))); + CannotContinue=TRUE; + } + else + { + q = (RuleEntry *)hash_add(Rname, + LATEXT(1), + (Entry *)newRuleEntry(LATEXT(1))); + CurRule = q->str; + } + CurRuleNode = q; + f = CurFile; l = zzline; + NumRules++; + zzCONSUME; + + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==103) ) { + zzmatch(103); + if ( q!=NULL ) q->noAST = TRUE; + zzCONSUME; + + } + else { + if ( (setwd1[LA(1)]&0x80) ) { + } + else {zzFAIL(1,zzerr4,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + { + zzBLOCK(zztasp2); + zzMake0; + { + ; + if ( (setwd2[LA(1)]&0x1) ) { + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (LA(1)==104) ) { + zzmatch(104); zzCONSUME; + } + else { + if ( (LA(1)==PassAction) ) { + } + else {zzFAIL(1,zzerr5,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp3); + } + } + zzmatch(PassAction); + pdecl = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char)); + require(pdecl!=NULL, "rule rule: cannot allocate param decl"); + strcpy(pdecl, LATEXT(1)); + CurParmDef = pdecl; + zzCONSUME; + + } + else { + if ( (setwd2[LA(1)]&0x2) ) { + } + else {zzFAIL(1,zzerr6,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==105) ) { + zzmatch(105); zzCONSUME; + zzmatch(PassAction); + ret = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char)); + require(ret!=NULL, "rule rule: cannot allocate ret type"); + strcpy(ret, LATEXT(1)); + CurRetDef = ret; + zzCONSUME; + + } + else { + if ( (setwd2[LA(1)]&0x4) ) { + } + else {zzFAIL(1,zzerr7,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==QuotedTerm) ) { + zzmatch(QuotedTerm); + if ( q!=NULL ) q->egroup=mystrdup(LATEXT(1)); + zzCONSUME; + + } + else { + if ( (LA(1)==106) ) { + } + else {zzFAIL(1,zzerr8,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + + if ( GenEClasseForRules && q!=NULL ) { + e = newECnode; + require(e!=NULL, "cannot allocate error class node"); + if ( q->egroup == NULL ) {a = q->str; a[0] = (char)toupper(a[0]);} + else a = q->egroup; + if ( Tnum( a ) == 0 ) + { + e->tok = addTname( a ); + list_add(&eclasses, (char *)e); + if ( q->egroup == NULL ) a[0] = (char)tolower(a[0]); + /* refers to itself */ + list_add(&(e->elist), mystrdup(q->str)); + } + else { + warn(eMsg1("default errclass for '%s' would conflict with token/errclass/tokclass",a)); + if ( q->egroup == NULL ) a[0] = (char)tolower(a[0]); + free((char *)e); + } + } + BlkLevel++; + if (BlkLevel >= MAX_BLK_LEVEL) fatal("Blocks nested too deeply"); + /* MR23 */ CurBlockID_array[BlkLevel] = CurBlockID; + /* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum; + zzmatch(106); + inAlt=1; + zzCONSUME; + + block( &toksrefd, &rulesrefd ); + r = makeBlk(zzaArg(zztasp1,7),0, NULL /* pFirstSetSymbol */ ); + CurRuleBlk = (Junction *)r.left; + CurRuleBlk->blockid = CurBlockID; + CurRuleBlk->jtype = RuleBlk; + if ( q!=NULL ) CurRuleBlk->rname = q->str; + CurRuleBlk->file = f; + CurRuleBlk->line = l; + CurRuleBlk->pdecl = pdecl; + CurRuleBlk->ret = ret; + CurRuleBlk->lock = makelocks(); + CurRuleBlk->pred_lock = makelocks(); + CurRuleBlk->tokrefs = toksrefd; + CurRuleBlk->rulerefs = rulesrefd; + p = newJunction(); /* add EndRule Node */ + ((Junction *)r.right)->p1 = (Node *)p; + r.right = (Node *) p; + p->jtype = EndRule; + p->lock = makelocks(); + p->pred_lock = makelocks(); + CurRuleBlk->end = p; + if ( q!=NULL ) q->rulenum = NumRules; + zzaArg(zztasp1,7) = r; + + /* MR23 */ CurBlockID_array[BlkLevel] = (-1); + /* MR23 */ CurAltNum_array[BlkLevel] = (-1); + --BlkLevel; + altFixup();leFixup();egFixup(); + zzmatch(107); + inAlt=0; + zzCONSUME; + + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==Action) ) { + zzmatch(Action); + a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char)); + require(a!=NULL, "rule rule: cannot allocate error action"); + strcpy(a, LATEXT(1)); + CurRuleBlk->erraction = a; + zzCONSUME; + + } + else { + if ( (setwd2[LA(1)]&0x8) ) { + } + else {zzFAIL(1,zzerr9,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + { + zzBLOCK(zztasp2); + zzMake0; + { + while ( (LA(1)==133) ) { + eg = exception_group(); + + if ( eg!=NULL ) { + list_add(&CurExGroups, (void *)eg); + if (eg->label == NULL || *eg->label=='\0' ) q->has_rule_exception = 1; + } + zzLOOP(zztasp2); + } + zzEXIT(zztasp2); + } + } + if ( q==NULL ) zzaArg(zztasp1,0 ).left = NULL; else zzaArg(zztasp1,0) = zzaArg(zztasp1,7); + CurRuleBlk->exceptions = CurExGroups; + CurRuleBlk->el_labels = CurElementLabels; + CurRuleNode->ast_labels_in_actions = CurAstLabelsInActions; + CurRuleNode = NULL; + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + CannotContinue=TRUE; + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd2, 0x10); + } +} + +void +#ifdef __USE_PROTOS +laction(void) +#else +laction() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + char *a; + zzmatch(108); zzCONSUME; + zzmatch(Action); + + a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char)); + require(a!=NULL, "rule laction: cannot allocate action"); + strcpy(a, LATEXT(1)); + list_add(&LexActions, a); + zzCONSUME; + + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + CannotContinue=TRUE; + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd2, 0x20); + } +} + +void +#ifdef __USE_PROTOS +lmember(void) +#else +lmember() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + char *a; + zzmatch(109); zzCONSUME; + zzmatch(Action); + + /* MR1 */ if (! GenCC) { + /* MR1 */ err("Use #lexmember only in C++ mode (to insert code in DLG class header"); + /* MR1 */ } else { + /* MR1 */ a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char)); + /* MR1 */ require(a!=NULL, "rule lmember: cannot allocate action"); + /* MR1 */ strcpy(a, LATEXT(1)); + /* MR1 */ list_add(&LexMemberActions, a); + /* MR1 */ }; + /* MR1 */ + zzCONSUME; + + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + CannotContinue=TRUE; + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd2, 0x40); + } +} + +void +#ifdef __USE_PROTOS +lprefix(void) +#else +lprefix() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + char *a; + zzmatch(110); zzCONSUME; + zzmatch(Action); + + /* MR1 */ if (! GenCC) { + /* MR1 */ err("Use #lexprefix only in C++ mode (to insert code in DLG class header"); + /* MR1 */ } else { + /* MR1 */ a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char)); + /* MR1 */ require(a!=NULL, "rule lprefix: cannot allocate action"); + /* MR1 */ strcpy(a, LATEXT(1)); + /* MR1 */ list_add(&LexPrefixActions, a); + /* MR1 */ }; + /* MR1 */ + zzCONSUME; + + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + CannotContinue=TRUE; + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd2, 0x80); + } +} + +void +#ifdef __USE_PROTOS +aPred(void) +#else +aPred() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + PredEntry *predEntry=NULL; + char *name=NULL; + Predicate *predExpr=NULL; + char *predLiteral=NULL; + int save_file; + int save_line; + int predExprPresent=0; + zzmatch(111); + + MR_usingPredNames=1; /* will need to use -mrhoist version of genPredTree */ + zzCONSUME; + + zzmatch(TokenTerm); + name=mystrdup(LATEXT(1)); + zzCONSUME; + + + /* don't free - referenced in predicates */ + + CurPredName=(char *)calloc(1,strlen(name) + 10); + strcat(CurPredName,"#pred "); + strcat(CurPredName,name); + + predEntry=(PredEntry *) hash_get(Pname,name); + if (predEntry != NULL) { + warnFL(eMsg1("#pred %s previously defined - ignored",name), + FileStr[action_file],action_line); + name=NULL; +}; + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==Pred) ) { + zzmatch(Pred); + predLiteral=mystrdup(LATEXT(1)); + save_line=action_line; + save_file=action_file; + zzCONSUME; + + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (setwd3[LA(1)]&0x1) ) { + predExpr = predOrExpr(); + + predExprPresent=1; + } + else { + if ( (setwd3[LA(1)]&0x2) ) { + } + else {zzFAIL(1,zzerr10,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp3); + } + } + if (predLiteral != NULL && name != NULL) { + + /* + * predExpr may be NULL due to syntax errors + * or simply omitted by the user + */ + + predEntry=newPredEntry(name); + predEntry->file=save_file; + predEntry->line=save_line; + predExpr=MR_predFlatten(predExpr); + predEntry->predLiteral=predLiteral; + if (! predExprPresent || predExpr == NULL) { + predExpr=new_pred(); + predExpr->expr=predLiteral; + predExpr->source=newActionNode(); + predExpr->source->action=predExpr->expr; + predExpr->source->rname=CurPredName; + predExpr->source->line=action_line; + predExpr->source->file=action_file; + predExpr->source->is_predicate=1; + predExpr->k=predicateLookaheadDepth(predExpr->source); + }; + predEntry->pred=predExpr; + hash_add(Pname,name,(Entry *)predEntry); + predExpr=NULL; + }; + predicate_free(predExpr); + } + else { + if ( (setwd3[LA(1)]&0x4) ) { + save_line=zzline; save_file=CurFile; + predExpr = predOrExpr(); + + if (predExpr != NULL && name != NULL) { + predEntry=newPredEntry(name); + predEntry->file=CurFile; + predEntry->line=zzline; + predExpr=MR_predFlatten(predExpr); + predEntry->pred=predExpr; + hash_add(Pname,name,(Entry *)predEntry); + predExpr=NULL; + }; + predicate_free(predExpr); + } + else {zzFAIL(1,zzerr11,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==107) ) { + zzmatch(107); zzCONSUME; + } + else { + if ( (setwd3[LA(1)]&0x8) ) { + } + else {zzFAIL(1,zzerr12,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + predicate_free(predExpr); + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd3, 0x10); + } +} + +Predicate * +#ifdef __USE_PROTOS +predOrExpr(void) +#else +predOrExpr() +#endif +{ + Predicate * _retv; + zzRULE; + zzBLOCK(zztasp1); + PCCTS_PURIFY(_retv,sizeof(Predicate * )) + zzMake0; + { + Predicate *ORnode; + Predicate *predExpr; + Predicate **tail=NULL; + predExpr = predAndExpr(); + + + ORnode=new_pred(); + ORnode->expr=PRED_OR_LIST; + if (predExpr != NULL) { + ORnode->down=predExpr; + tail=&predExpr->right; + }; + { + zzBLOCK(zztasp2); + zzMake0; + { + while ( (LA(1)==112) ) { + zzmatch(112); zzCONSUME; + predExpr = predAndExpr(); + + + if (predExpr != NULL) { + *tail=predExpr; + tail=&predExpr->right; + }; + zzLOOP(zztasp2); + } + zzEXIT(zztasp2); + } + } + + _retv=ORnode; + ORnode=NULL; + zzEXIT(zztasp1); + return _retv; +fail: + zzEXIT(zztasp1); + predicate_free(ORnode); + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd3, 0x20); + return _retv; + } +} + +Predicate * +#ifdef __USE_PROTOS +predAndExpr(void) +#else +predAndExpr() +#endif +{ + Predicate * _retv; + zzRULE; + zzBLOCK(zztasp1); + PCCTS_PURIFY(_retv,sizeof(Predicate * )) + zzMake0; + { + Predicate *ANDnode; + Predicate *predExpr; + Predicate **tail=NULL; + predExpr = predPrimary(); + + + ANDnode=new_pred(); + ANDnode->expr=PRED_AND_LIST; + if (predExpr != NULL) { + ANDnode->down=predExpr; + tail=&predExpr->right; + }; + { + zzBLOCK(zztasp2); + zzMake0; + { + while ( (LA(1)==113) ) { + zzmatch(113); zzCONSUME; + predExpr = predPrimary(); + + + if (predExpr != NULL) { + *tail=predExpr; + tail=&predExpr->right; + }; + zzLOOP(zztasp2); + } + zzEXIT(zztasp2); + } + } + + _retv=ANDnode; + ANDnode=NULL; + zzEXIT(zztasp1); + return _retv; +fail: + zzEXIT(zztasp1); + predicate_free(ANDnode); + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd3, 0x40); + return _retv; + } +} + +Predicate * +#ifdef __USE_PROTOS +predPrimary(void) +#else +predPrimary() +#endif +{ + Predicate * _retv; + zzRULE; + zzBLOCK(zztasp1); + PCCTS_PURIFY(_retv,sizeof(Predicate * )) + zzMake0; + { + + char *name=NULL; + PredEntry *predEntry=NULL; + Predicate *predExpr=NULL; + if ( (LA(1)==TokenTerm) ) { + zzmatch(TokenTerm); + name=mystrdup(LATEXT(1)); + zzCONSUME; + + + predEntry=(PredEntry *) hash_get(Pname,name); + if (predEntry == NULL) { + warnFL(eMsg1("no previously defined #pred with name \"%s\"",name), + FileStr[CurFile],zzline); + name=NULL; + _retv=NULL; + } else { + predExpr=predicate_dup(predEntry->pred); + predExpr->predEntry=predEntry; + _retv=predExpr; + }; + } + else { + if ( (LA(1)==114) ) { + zzmatch(114); zzCONSUME; + predExpr = predOrExpr(); + + zzmatch(115); + + _retv=predExpr; + zzCONSUME; + + } + else { + if ( (LA(1)==103) ) { + zzmatch(103); zzCONSUME; + predExpr = predPrimary(); + + + predExpr->inverted=!predExpr->inverted; + _retv=predExpr; + } + else {zzFAIL(1,zzerr13,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + } + zzEXIT(zztasp1); + return _retv; +fail: + zzEXIT(zztasp1); + + predicate_free(predExpr); + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd3, 0x80); + return _retv; + } +} + +void +#ifdef __USE_PROTOS +aLexclass(void) +#else +aLexclass() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + zzmatch(116); zzCONSUME; + zzmatch(TokenTerm); + lexclass(mystrdup(LATEXT(1))); + zzCONSUME; + + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + CannotContinue=TRUE; + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd4, 0x1); + } +} + +void +#ifdef __USE_PROTOS +error(void) +#else +error() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + char *t=NULL; ECnode *e; int go=1; TermEntry *p; + zzmatch(117); zzCONSUME; + { + zzBLOCK(zztasp2); + zzMake0; + { + ; + if ( (LA(1)==TokenTerm) ) { + zzmatch(TokenTerm); + t=mystrdup(LATEXT(1)); + zzCONSUME; + + } + else { + if ( (LA(1)==QuotedTerm) ) { + zzmatch(QuotedTerm); + t=mystrdup(LATEXT(1)); + zzCONSUME; + + } + else {zzFAIL(1,zzerr14,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + e = newECnode; + require(e!=NULL, "cannot allocate error class node"); + e->lexclass = CurrentLexClass; + if ( Tnum( (t=StripQuotes(t)) ) == 0 ) + { + if ( hash_get(Texpr, t) != NULL ) + warn(eMsg1("errclass name conflicts with regular expression '%s'",t)); + e->tok = addTname( t ); + set_orel(e->tok, &imag_tokens); + require((p=(TermEntry *)hash_get(Tname, t)) != NULL, + "hash table mechanism is broken"); + p->classname = 1; /* entry is errclass name, not token */ + list_add(&eclasses, (char *)e); + } + else + { + warn(eMsg1("redefinition of errclass or conflict w/token or tokclass '%s'; ignored",t)); + free( (char *)e ); + go=0; +} + zzmatch(102); zzCONSUME; + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==NonTerminal) ) { + zzmatch(NonTerminal); + if ( go ) t=mystrdup(LATEXT(1)); + zzCONSUME; + + } + else { + if ( (LA(1)==TokenTerm) ) { + zzmatch(TokenTerm); + if ( go ) t=mystrdup(LATEXT(1)); + zzCONSUME; + + } + else { + if ( (LA(1)==QuotedTerm) ) { + zzmatch(QuotedTerm); + if ( go ) t=mystrdup(LATEXT(1)); + zzCONSUME; + + } + else {zzFAIL(1,zzerr15,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + } + zzEXIT(zztasp2); + } + } + if ( go ) list_add(&(e->elist), t); + { + zzBLOCK(zztasp2); + zzMake0; + { + while ( (setwd4[LA(1)]&0x2) ) { + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (LA(1)==NonTerminal) ) { + zzmatch(NonTerminal); + if ( go ) t=mystrdup(LATEXT(1)); + zzCONSUME; + + } + else { + if ( (LA(1)==TokenTerm) ) { + zzmatch(TokenTerm); + if ( go ) t=mystrdup(LATEXT(1)); + zzCONSUME; + + } + else { + if ( (LA(1)==QuotedTerm) ) { + zzmatch(QuotedTerm); + if ( go ) t=mystrdup(LATEXT(1)); + zzCONSUME; + + } + else {zzFAIL(1,zzerr16,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + } + zzEXIT(zztasp3); + } + } + if ( go ) list_add(&(e->elist), t); + zzLOOP(zztasp2); + } + zzEXIT(zztasp2); + } + } + zzmatch(98); zzCONSUME; + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + CannotContinue=TRUE; + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd4, 0x4); + } +} + +void +#ifdef __USE_PROTOS +tclass(void) +#else +tclass() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + char *t=NULL; TCnode *e; int go=1,tok,totok; TermEntry *p = NULL; + char *term, *toterm; + char *akaString=NULL; int save_file = 0; int save_line = 0; + char *totext=NULL; + zzmatch(118); zzCONSUME; + zzmatch(TokenTerm); + t=mystrdup(LATEXT(1)); + zzCONSUME; + + e = newTCnode; + require(e!=NULL, "cannot allocate token class node"); + e->lexclass = CurrentLexClass; + if ( Tnum( t ) == 0 ) + { + e->tok = addTname( t ); + set_orel(e->tok, &imag_tokens); + set_orel(e->tok, &tokclasses); + require((p=(TermEntry *)hash_get(Tname, t)) != NULL, + "hash table mechanism is broken"); + p->classname = 1; /* entry is class name, not token */ + p->tclass = e; /* save ptr to this tclass def */ + list_add(&tclasses, (char *)e); + } + else + { + warn(eMsg1("redefinition of tokclass or conflict w/token '%s'; ignored",t)); + free( (char *)e ); + go=0; +} + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==114) ) { + zzmatch(114); zzCONSUME; + zzmatch(QuotedTerm); + akaString=mystrdup(StripQuotes(LATEXT(1))); + /* MR11 */ save_file=CurFile;save_line=zzline; + /* MR23 */ + zzCONSUME; + + zzmatch(115); zzCONSUME; + } + else { + if ( (LA(1)==102) ) { + } + else {zzFAIL(1,zzerr17,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + + /* MR23 */ if (p!= NULL && akaString != NULL) { + /* MR23 */ if (p->akaString != NULL) { + /* MR23 */ if (strcmp(p->akaString,akaString) != 0) { + /* MR23 */ warnFL(eMsg2("this #tokclass statment conflicts with a previous #tokclass %s(\"%s\") statement", + /* MR23 */ t,p->akaString), + /* MR23 */ FileStr[save_file],save_line); + /* MR23 */ }; + /* MR23 */ } else { + /* MR23 */ p->akaString=akaString; + /* MR23 */ }; + /* MR23 */ }; + /* MR23 */ + zzmatch(102); zzCONSUME; + { + zzBLOCK(zztasp2); + int zzcnt=1; + zzMake0; + { + do { + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (LA(1)==TokenTerm) ) { + zzmatch(TokenTerm); + if ( go ) { + term = (char *) hash_get(Tname, LATEXT(1)); + if ( term==NULL && UserDefdTokens ) { + err("implicit token definition not allowed with #tokdefs"); + go = 0; + } + else {t=mystrdup(LATEXT(1)); tok=addTname(LATEXT(1));} + } + zzCONSUME; + + { + zzBLOCK(zztasp4); + zzMake0; + { + if ( (LA(1)==119) ) { + zzmatch(119); zzCONSUME; + zzmatch(TokenTerm); + if ( go ) { + toterm = (char *) hash_get(Tname, LATEXT(1)); + if ( toterm==NULL && UserDefdTokens ) { + err("implicit token definition not allowed with #tokdefs"); + go = 0; + } else { + totext=mystrdup(LATEXT(1)); totok=addTname(LATEXT(1)); + } + } + zzCONSUME; + + } + else { + if ( (setwd4[LA(1)]&0x8) ) { + } + else {zzFAIL(1,zzerr18,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp4); + } + } + } + else { + if ( (LA(1)==QuotedTerm) ) { + zzmatch(QuotedTerm); + if ( go ) { + term = (char *) hash_get(Texpr, LATEXT(1)); + if ( term==NULL && UserDefdTokens ) { + err("implicit token definition not allowed with #tokdefs"); + go = 0; + } + else {t=mystrdup(LATEXT(1)); tok=addTexpr(LATEXT(1));} + } + zzCONSUME; + + } + else {zzFAIL(1,zzerr19,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp3); + } + } + if ( go ) { + if (totext == NULL) { + list_add(&(e->tlist), t); + } else { + list_add(&(e->tlist),".."); + list_add(&(e->tlist),t); + list_add(&(e->tlist),totext); + } + totext=NULL; + } + zzLOOP(zztasp2); + } while ( (setwd4[LA(1)]&0x10) ); + zzEXIT(zztasp2); + } + } + zzmatch(98); zzCONSUME; + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + CannotContinue=TRUE; + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd4, 0x20); + } +} + +void +#ifdef __USE_PROTOS +token(void) +#else +token() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + char *t=NULL, *e=NULL, *a=NULL; int tnum=0; + char *akaString=NULL; TermEntry *te;int save_file=0,save_line=0; + zzmatch(120); + tokenActionActive=1; + zzCONSUME; + + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==TokenTerm) ) { + zzmatch(TokenTerm); + t=mystrdup(LATEXT(1)); + zzCONSUME; + + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (LA(1)==114) ) { + zzmatch(114); zzCONSUME; + zzmatch(QuotedTerm); + akaString=mystrdup(StripQuotes(LATEXT(1))); + /* MR11 */ save_file=CurFile;save_line=zzline; + /* MR11 */ + zzCONSUME; + + zzmatch(115); zzCONSUME; + } + else { + if ( (setwd4[LA(1)]&0x40) ) { + } + else {zzFAIL(1,zzerr20,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp3); + } + } + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (LA(1)==121) ) { + zzmatch(121); zzCONSUME; + zzmatch(122); + tnum = atoi(LATEXT(1)); + zzCONSUME; + + } + else { + if ( (setwd4[LA(1)]&0x80) ) { + } + else {zzFAIL(1,zzerr21,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp3); + } + } + } + else { + if ( (setwd5[LA(1)]&0x1) ) { + } + else {zzFAIL(1,zzerr22,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==QuotedTerm) ) { + zzmatch(QuotedTerm); + e=mystrdup(LATEXT(1)); + zzCONSUME; + + } + else { + if ( (setwd5[LA(1)]&0x2) ) { + } + else {zzFAIL(1,zzerr23,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==Action) ) { + zzmatch(Action); + + a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char)); + require(a!=NULL, "rule token: cannot allocate action"); + strcpy(a, LATEXT(1)); + zzCONSUME; + + } + else { + if ( (setwd5[LA(1)]&0x4) ) { + } + else {zzFAIL(1,zzerr24,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==107) ) { + zzmatch(107); zzCONSUME; + } + else { + if ( (setwd5[LA(1)]&0x8) ) { + } + else {zzFAIL(1,zzerr25,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + chkToken(t, e, a, tnum); + if (t != NULL) { + te=(TermEntry *)hash_get(Tname,t); + if (te != NULL && akaString != NULL) { + if (te->akaString != NULL) { + if (strcmp(te->akaString,akaString) != 0) { + warnFL(eMsg2("this #token statment conflicts with a previous #token %s(\"%s\") statement", + t,te->akaString), + FileStr[save_file],save_line); + }; + } else { + te->akaString=akaString; + }; + }; + }; + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + CannotContinue=TRUE; + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd5, 0x10); + } +} + +void +#ifdef __USE_PROTOS +block(set * toksrefd,set * rulesrefd) +#else +block(toksrefd,rulesrefd) + set *toksrefd; +set *rulesrefd ; +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + + Graph g, b; + set saveblah; + int saveinalt = inAlt; + ExceptionGroup *eg; + * toksrefd = empty; + * rulesrefd = empty; + set_clr(AST_nodes_refd_in_actions); + CurBlockID++; + /* MR23 */ CurBlockID_array[BlkLevel] = CurBlockID; + CurAltNum = 1; + /* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum; + saveblah = attribsRefdFromAction; + attribsRefdFromAction = empty; + alt( toksrefd,rulesrefd ); + b = g = zzaArg(zztasp1,1); + + if ( ((Junction *)g.left)->p1->ntype == nAction ) + { + ActionNode *actionNode=(ActionNode *) + ( ( (Junction *)g.left) ->p1); + if (!actionNode->is_predicate ) + { + actionNode->init_action = TRUE; + /* MR12c */ if (actionNode->noHoist) { + /* MR12c */ errFL("<<nohoist>> appears as init-action - use <<>> <<nohoist>>", + /* MR12c */ FileStr[actionNode->file],actionNode->line); + /* MR12c */ }; + } + } + ((Junction *)g.left)->blockid = CurBlockID; + { + zzBLOCK(zztasp2); + zzMake0; + { + while ( (LA(1)==133) ) { + eg = exception_group(); + + + if ( eg!=NULL ) { + /* MR7 ***** eg->altID = makeAltID(CurBlockID,CurAltNum); *****/ + /* MR7 ***** CurAltStart->exception_label = eg->altID; *****/ + list_add(&CurExGroups, (void *)eg); + } + zzLOOP(zztasp2); + } + zzEXIT(zztasp2); + } + } + CurAltNum++; + /* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum; + { + zzBLOCK(zztasp2); + zzMake0; + { + while ( (LA(1)==123) ) { + zzmatch(123); + inAlt=1; + zzCONSUME; + + alt( toksrefd,rulesrefd ); + g = Or(g, zzaArg(zztasp2,2)); + + ((Junction *)g.left)->blockid = CurBlockID; + { + zzBLOCK(zztasp3); + zzMake0; + { + while ( (LA(1)==133) ) { + eg = exception_group(); + + + if ( eg!=NULL ) { + /* MR7 ***** eg->altID = makeAltID(CurBlockID,CurAltNum); *****/ + /* MR7 ***** CurAltStart->exception_label = eg->altID; *****/ + list_add(&CurExGroups, (void *)eg); + } + zzLOOP(zztasp3); + } + zzEXIT(zztasp3); + } + } + CurAltNum++; + /* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum; + zzLOOP(zztasp2); + } + zzEXIT(zztasp2); + } + } + zzaArg(zztasp1,0) = b; + attribsRefdFromAction = saveblah; inAlt = saveinalt; + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + CannotContinue=TRUE; + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd5, 0x20); + } +} + +void +#ifdef __USE_PROTOS +alt(set * toksrefd,set * rulesrefd) +#else +alt(toksrefd,rulesrefd) + set *toksrefd; +set *rulesrefd ; +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + int n=0; Graph g; int e_num=0, old_not=0; Node *node; set elems, dif; + int first_on_line = 1, use_def_MT_handler = 0; + g.left=NULL; g.right=NULL; + + CurAltStart = NULL; + elems = empty; + inAlt = 1; + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==88) ) { + zzmatch(88); + use_def_MT_handler = 1; + zzCONSUME; + + } + else { + if ( (setwd5[LA(1)]&0x40) ) { + } + else {zzFAIL(1,zzerr26,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + { + zzBLOCK(zztasp2); + zzMake0; + { + ; + while ( (setwd5[LA(1)]&0x80) ) { + { + zzBLOCK(zztasp3); + zzMake0; + { + old_not=0; + if ( (LA(1)==124) ) { + zzmatch(124); + old_not=1; + zzCONSUME; + + } + else { + if ( (setwd6[LA(1)]&0x1) ) { + } + else {zzFAIL(1,zzerr27,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp3); + } + } + node = element( old_not, first_on_line, use_def_MT_handler ); + + if ( node!=NULL && node->ntype!=nAction ) first_on_line = 0; + + if ( zzaArg(zztasp2,2 ).left!=NULL ) { + g = Cat(g, zzaArg(zztasp2,2)); + n++; + if ( node!=NULL ) { + if ( node->ntype!=nAction ) e_num++; + /* record record number of all rule and token refs */ + if ( node->ntype==nToken ) { + TokNode *tk = (TokNode *)((Junction *)zzaArg(zztasp2,2 ).left)->p1; + tk->elnum = e_num; + set_orel(e_num, &elems); + } + else if ( node->ntype==nRuleRef ) { + RuleRefNode *rn = (RuleRefNode *)((Junction *)zzaArg(zztasp2,2 ).left)->p1; + rn->elnum = e_num; + set_orel(e_num, rulesrefd); + } + } + } + zzLOOP(zztasp2); + } + zzEXIT(zztasp2); + } + } + if ( n == 0 ) g = emptyAlt(); + zzaArg(zztasp1,0) = g; + /* We want to reduce number of LT(i) calls and the number of + * local attribute variables in C++ mode (for moment, later we'll + * do for C also). However, if trees are being built, they + * require most of the attrib variables to create the tree nodes + * with; therefore, we gen a token ptr for each token ref in C++ + */ + if ( GenCC && !GenAST ) + { + /* This now free's the temp set -ATG 5/6/95 */ + set temp; + temp = set_and(elems, attribsRefdFromAction); + set_orin( toksrefd, temp); + set_free(temp); +} +else set_orin( toksrefd, elems); +if ( GenCC ) { + dif = set_dif(attribsRefdFromAction, elems); + if ( set_deg(dif)>0 ) + err("one or more $i in action(s) refer to non-token elements"); + set_free(dif); +} +set_free(elems); +set_free(attribsRefdFromAction); +inAlt = 0; + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + CannotContinue=TRUE; + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd6, 0x2); + } +} + +LabelEntry * +#ifdef __USE_PROTOS +element_label(void) +#else +element_label() +#endif +{ + LabelEntry * _retv; + zzRULE; + zzBLOCK(zztasp1); + PCCTS_PURIFY(_retv,sizeof(LabelEntry * )) + zzMake0; + { + TermEntry *t=NULL; LabelEntry *l=NULL; RuleEntry *r=NULL; char *lab; + zzmatch(LABEL); + lab = mystrdup(LATEXT(1)); + zzCONSUME; + + + UsedNewStyleLabel = 1; + if ( UsedOldStyleAttrib ) err("cannot mix with new-style labels with old-style $i"); + t = (TermEntry *) hash_get(Tname, lab); + if ( t==NULL ) t = (TermEntry *) hash_get(Texpr, lab); + if ( t==NULL ) r = (RuleEntry *) hash_get(Rname, lab); + if ( t!=NULL ) { + err(eMsg1("label definition clashes with token/tokclass definition: '%s'", lab)); + _retv = NULL; + } + else if ( r!=NULL ) { + err(eMsg1("label definition clashes with rule definition: '%s'", lab)); + _retv = NULL; + } + else { + /* we don't clash with anybody else */ + l = (LabelEntry *) hash_get(Elabel, lab); + if ( l==NULL ) { /* ok to add new element label */ + l = (LabelEntry *)hash_add(Elabel, + lab, + (Entry *)newLabelEntry(lab)); + /* add to list of element labels for this rule */ + list_add(&CurElementLabels, (void *)lab); + /* MR7 */ leAdd(l); /* list of labels waiting for exception group definitions */ + _retv = l; + } + else { + err(eMsg1("label definitions must be unique per rule: '%s'", lab)); + _retv = NULL; +} +} + zzmatch(106); zzCONSUME; + zzEXIT(zztasp1); + return _retv; +fail: + zzEXIT(zztasp1); + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd6, 0x4); + return _retv; + } +} + +Node * +#ifdef __USE_PROTOS +element(int old_not,int first_on_line,int use_def_MT_handler) +#else +element(old_not,first_on_line,use_def_MT_handler) + int old_not; +int first_on_line; +int use_def_MT_handler ; +#endif +{ + Node * _retv; + zzRULE; + zzBLOCK(zztasp1); + PCCTS_PURIFY(_retv,sizeof(Node * )) + zzMake0; + { + + Attrib blk; + Predicate *pred = NULL; + int local_use_def_MT_handler=0; + ActionNode *act; + RuleRefNode *rr; + set toksrefd, rulesrefd; + TermEntry *term; + TokNode *p=NULL; RuleRefNode *q; int approx=0; + LabelEntry *label=NULL; + int predMsgDone=0; + int semDepth=0; + int ampersandStyle; + int height; /* MR11 */ + int equal_height; /* MR11 */ + + char* pFirstSetSymbol = NULL; /* MR21 */ + + _retv = NULL; + if ( (setwd6[LA(1)]&0x8) ) { + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==LABEL) ) { + label = element_label(); + + } + else { + if ( (setwd6[LA(1)]&0x10) ) { + } + else {zzFAIL(1,zzerr28,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==TokenTerm) ) { + zzmatch(TokenTerm); + + term = (TermEntry *) hash_get(Tname, LATEXT(1)); + if ( term==NULL && UserDefdTokens ) { + err("implicit token definition not allowed with #tokdefs"); + zzaRet.left = zzaRet.right = NULL; + } + else { + zzaRet = buildToken(LATEXT(1)); + p=((TokNode *)((Junction *)zzaRet.left)->p1); + term = (TermEntry *) hash_get(Tname, LATEXT(1)); + require( term!= NULL, "hash table mechanism is broken"); + p->tclass = term->tclass; + p->complement = old_not; + if ( label!=NULL ) { + p->el_label = label->str; + label->elem = (Node *)p; + } + } + zzCONSUME; + + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (LA(1)==119) ) { + zzmatch(119); zzCONSUME; + { + zzBLOCK(zztasp4); + zzMake0; + { + if ( (LA(1)==QuotedTerm) ) { + zzmatch(QuotedTerm); + if ( p!=NULL ) setUpperRange(p, LATEXT(1)); + zzCONSUME; + + } + else { + if ( (LA(1)==TokenTerm) ) { + zzmatch(TokenTerm); + if ( p!=NULL ) setUpperRange(p, LATEXT(1)); + zzCONSUME; + + } + else {zzFAIL(1,zzerr29,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp4); + } + } + } + else { + if ( (setwd6[LA(1)]&0x20) ) { + } + else {zzFAIL(1,zzerr30,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp3); + } + } + + if ( p!=NULL && (p->upper_range!=0 || p->tclass || old_not) ) + list_add(&MetaTokenNodes, (void *)p); + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (LA(1)==125) ) { + zzmatch(125); + if ( p!=NULL ) p->astnode=ASTroot; + zzCONSUME; + + } + else { + if ( (setwd6[LA(1)]&0x40) ) { + if ( p!=NULL ) p->astnode=ASTchild; + } + else { + if ( (LA(1)==103) ) { + zzmatch(103); + if ( p!=NULL ) p->astnode=ASTexclude; + zzCONSUME; + + } + else {zzFAIL(1,zzerr31,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + } + zzEXIT(zztasp3); + } + } + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (LA(1)==88) ) { + zzmatch(88); + local_use_def_MT_handler = 1; + zzCONSUME; + + } + else { + if ( (setwd6[LA(1)]&0x80) ) { + } + else {zzFAIL(1,zzerr32,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp3); + } + } + + if ( p!=NULL && first_on_line ) { + CurAltStart = (Junction *)zzaRet.left; + altAdd(CurAltStart); /* MR7 */ + p->altstart = CurAltStart; + } + if ( p!=NULL ) + p->use_def_MT_handler = use_def_MT_handler || local_use_def_MT_handler; + _retv = (Node *)p; + } + else { + if ( (LA(1)==QuotedTerm) ) { + zzmatch(QuotedTerm); + + term = (TermEntry *) hash_get(Texpr, LATEXT(1)); + if ( term==NULL && UserDefdTokens ) { + err("implicit token definition not allowed with #tokdefs"); + zzaRet.left = zzaRet.right = NULL; + } + else { + zzaRet = buildToken(LATEXT(1)); p=((TokNode *)((Junction *)zzaRet.left)->p1); + p->complement = old_not; + if ( label!=NULL ) { + p->el_label = label->str; + label->elem = (Node *)p; + } + } + zzCONSUME; + + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (LA(1)==119) ) { + zzmatch(119); zzCONSUME; + { + zzBLOCK(zztasp4); + zzMake0; + { + if ( (LA(1)==QuotedTerm) ) { + zzmatch(QuotedTerm); + if ( p!=NULL ) setUpperRange(p, LATEXT(1)); + zzCONSUME; + + } + else { + if ( (LA(1)==TokenTerm) ) { + zzmatch(TokenTerm); + if ( p!=NULL ) setUpperRange(p, LATEXT(1)); + zzCONSUME; + + } + else {zzFAIL(1,zzerr33,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp4); + } + } + } + else { + if ( (setwd7[LA(1)]&0x1) ) { + } + else {zzFAIL(1,zzerr34,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp3); + } + } + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (LA(1)==125) ) { + zzmatch(125); + if ( p!=NULL ) p->astnode=ASTroot; + zzCONSUME; + + } + else { + if ( (setwd7[LA(1)]&0x2) ) { + if ( p!=NULL ) p->astnode=ASTchild; + } + else { + if ( (LA(1)==103) ) { + zzmatch(103); + if ( p!=NULL ) p->astnode=ASTexclude; + zzCONSUME; + + } + else {zzFAIL(1,zzerr35,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + } + zzEXIT(zztasp3); + } + } + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (LA(1)==88) ) { + zzmatch(88); + local_use_def_MT_handler = 1; + zzCONSUME; + + } + else { + if ( (setwd7[LA(1)]&0x4) ) { + } + else {zzFAIL(1,zzerr36,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp3); + } + } + + if ( p!=NULL && (p->upper_range!=0 || p->tclass || old_not) ) + list_add(&MetaTokenNodes, (void *)p); + + if ( first_on_line ) { + CurAltStart = (Junction *)zzaRet.left; + altAdd(CurAltStart); /* MR7 */ + p->altstart = CurAltStart; + } + if ( p!=NULL ) + p->use_def_MT_handler = use_def_MT_handler || local_use_def_MT_handler; + _retv = (Node *)p; + } + else { + if ( (LA(1)==WildCard) ) { + if ( old_not ) warn("~ WILDCARD is an undefined operation (implies 'nothing')"); + zzmatch(WildCard); + zzaRet = buildWildCard(LATEXT(1)); p=((TokNode *)((Junction *)zzaRet.left)->p1); + zzCONSUME; + + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (LA(1)==125) ) { + zzmatch(125); + p->astnode=ASTroot; + zzCONSUME; + + } + else { + if ( (setwd7[LA(1)]&0x8) ) { + p->astnode=ASTchild; + } + else { + if ( (LA(1)==103) ) { + zzmatch(103); + p->astnode=ASTexclude; + zzCONSUME; + + } + else {zzFAIL(1,zzerr37,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + } + zzEXIT(zztasp3); + } + } + list_add(&MetaTokenNodes, (void *)p); + + if ( first_on_line ) { + CurAltStart = (Junction *)zzaRet.left; + altAdd(CurAltStart); /* MR7 */ + p->altstart = CurAltStart; + if ( label!=NULL ) { + p->el_label = label->str; + label->elem = (Node *)p; + } + } + _retv = (Node *)p; + } + else { + if ( (LA(1)==NonTerminal) ) { + if ( old_not ) warn("~ NONTERMINAL is an undefined operation"); + zzmatch(NonTerminal); + zzaRet = buildRuleRef(LATEXT(1)); + zzCONSUME; + + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (LA(1)==103) ) { + zzmatch(103); + q = (RuleRefNode *) ((Junction *)zzaRet.left)->p1; + q->astnode=ASTexclude; + zzCONSUME; + + } + else { + if ( (setwd7[LA(1)]&0x10) ) { + } + else {zzFAIL(1,zzerr38,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp3); + } + } + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (setwd7[LA(1)]&0x20) ) { + { + zzBLOCK(zztasp4); + zzMake0; + { + if ( (LA(1)==104) ) { + zzmatch(104); zzCONSUME; + } + else { + if ( (LA(1)==PassAction) ) { + } + else {zzFAIL(1,zzerr39,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp4); + } + } + zzmatch(PassAction); + addParm(((Junction *)zzaRet.left)->p1, LATEXT(1)); + zzCONSUME; + + } + else { + if ( (setwd7[LA(1)]&0x40) ) { + } + else {zzFAIL(1,zzerr40,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp3); + } + } + rr=(RuleRefNode *) ((Junction *)zzaRet.left)->p1; + { + zzBLOCK(zztasp3); + zzMake0; + { + char *a; + if ( (LA(1)==105) ) { + zzmatch(105); zzCONSUME; + zzmatch(PassAction); + + a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char)); + require(a!=NULL, "rule element: cannot allocate assignment"); + strcpy(a, LATEXT(1)); + rr->assign = a; + zzCONSUME; + + } + else { + if ( (setwd7[LA(1)]&0x80) ) { + } + else {zzFAIL(1,zzerr41,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp3); + } + } + + if ( label!=NULL ) { + rr->el_label = label->str; + label->elem = (Node *)rr; + } + if ( first_on_line ) { + CurAltStart = (Junction *)zzaRet.left; + altAdd(CurAltStart); /* MR7 */ + ((RuleRefNode *)((Junction *)zzaRet.left)->p1)->altstart = CurAltStart; + } + _retv = (Node *)rr; + } + else {zzFAIL(1,zzerr42,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + } + } + zzEXIT(zztasp2); + } + } + } + else { + if ( (LA(1)==Action) ) { + if ( old_not ) warn("~ ACTION is an undefined operation"); + zzmatch(Action); + zzaArg(zztasp1,0) = buildAction(LATEXT(1),action_file,action_line, 0); + zzCONSUME; + + if ( first_on_line ) { /* MR7 */ + CurAltStart = (Junction *)zzaArg(zztasp1,0 ).left; /* MR7 */ + altAdd(CurAltStart); /* MR7 */ + }; + _retv = (Node *) ((Junction *)zzaArg(zztasp1,0 ).left)->p1; + } + else { + if ( (LA(1)==Pred) ) { + if ( old_not ) warn("~ SEMANTIC-PREDICATE is an undefined operation"); + zzmatch(Pred); + zzaArg(zztasp1,0) = buildAction(LATEXT(1),action_file,action_line, 1); + zzCONSUME; + + act = (ActionNode *) ((Junction *)zzaArg(zztasp1,0 ).left)->p1; + if (numericActionLabel) { /* MR10 */ + list_add(&NumericPredLabels,act); /* MR10 */ + numericActionLabel=0; /* MR10 */ + }; /* MR10 */ + { + zzBLOCK(zztasp2); + zzMake0; + { + char *a; + if ( (LA(1)==PassAction) ) { + zzmatch(PassAction); + + a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char)); + require(a!=NULL, "rule element: cannot allocate predicate fail action"); + strcpy(a, LATEXT(1)); + act->pred_fail = a; + zzCONSUME; + + } + else { + if ( (setwd8[LA(1)]&0x1) ) { + } + else {zzFAIL(1,zzerr43,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + if ( first_on_line ) { /* MR7 */ + CurAltStart = (Junction *)zzaArg(zztasp1,0 ).left; /* MR7 */ + altAdd(CurAltStart); /* MR7 */ + }; + _retv = (Node *)act; + } + else { + if ( (setwd8[LA(1)]&0x2) ) { + if ( old_not ) warn("~ BLOCK is an undefined operation"); + BlkLevel++; + if (BlkLevel >= MAX_BLK_LEVEL) fatal("Blocks nested too deeply"); + /* MR23 */ CurBlockID_array[BlkLevel] = CurBlockID; + /* MR23 */ CurAltNum_array[BlkLevel] = CurAltNum; + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==Pragma) ) { + zzmatch(Pragma); zzCONSUME; + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (LA(1)==126) ) { + zzmatch(126); + approx=LL_k; + zzCONSUME; + + } + else { + if ( (LA(1)==127) ) { + zzmatch(127); + approx = 1; + zzCONSUME; + + } + else { + if ( (LA(1)==128) ) { + zzmatch(128); + approx = 2; + zzCONSUME; + + } + else {zzFAIL(1,zzerr44,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + } + zzEXIT(zztasp3); + } + } + } + else { + if ( (setwd8[LA(1)]&0x4) ) { + } + else {zzFAIL(1,zzerr45,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==FirstSetSymbol) ) { + zzmatch(FirstSetSymbol); zzCONSUME; + zzmatch(114); zzCONSUME; + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (LA(1)==NonTerminal) ) { + zzmatch(NonTerminal); + + /* MR21 */ pFirstSetSymbol = (char *) calloc(strlen(LATEXT(1))+1, + /* MR21 */ sizeof(char)); + /* MR21 */ require(pFirstSetSymbol!=NULL, + /* MR21 */ "cannot allocate first set name"); + /* MR21 */ strcpy(pFirstSetSymbol, LATEXT(1)); + /* MR21 */ + zzCONSUME; + + } + else { + if ( (LA(1)==TokenTerm) ) { + zzmatch(TokenTerm); + + /* MR21 */ pFirstSetSymbol = (char *) calloc(strlen(LATEXT(1))+1, + /* MR21 */ sizeof(char)); + /* MR21 */ require(pFirstSetSymbol!=NULL, + /* MR21 */ "cannot allocate first set name"); + /* MR21 */ strcpy(pFirstSetSymbol, LATEXT(1)); + /* MR21 */ + zzCONSUME; + + } + else {zzFAIL(1,zzerr46,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp3); + } + } + zzmatch(115); zzCONSUME; + } + else { + if ( (setwd8[LA(1)]&0x8) ) { + } + else {zzFAIL(1,zzerr47,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==114) ) { + zzmatch(114); zzCONSUME; + block( &toksrefd,&rulesrefd ); + zzmatch(115); + blk = zzaRet = zzaArg(zztasp2,2); + /* MR23 */ CurBlockID_array[BlkLevel] = (-1); + /* MR23 */ CurAltNum_array[BlkLevel] = (-1); + --BlkLevel; + zzCONSUME; + + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (LA(1)==129) ) { + zzmatch(129); + zzaRet = makeLoop(zzaRet,approx,pFirstSetSymbol); + zzCONSUME; + + } + else { + if ( (LA(1)==130) ) { + zzmatch(130); + zzaRet = makePlus(zzaRet,approx,pFirstSetSymbol); + zzCONSUME; + + } + else { + if ( (LA(1)==131) ) { + zzmatch(131); zzCONSUME; + { + zzBLOCK(zztasp4); + zzMake0; + { + if ( (setwd8[LA(1)]&0x10) ) { + { + zzBLOCK(zztasp5); + zzMake0; + { + if ( (LA(1)==132) ) { + zzmatch(132); + ampersandStyle=0; + zzCONSUME; + + } + else { + if ( (LA(1)==113) ) { + zzmatch(113); + ampersandStyle=1; + zzCONSUME; + + } + else {zzFAIL(1,zzerr48,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp5); + } + } + zzmatch(Pred); + zzaRet = buildAction(LATEXT(1),action_file,action_line,1); + zzCONSUME; + + act = (ActionNode *) ((Junction *)zzaRet.left)->p1; + semDepth=predicateLookaheadDepth(act); + if (numericActionLabel) { /* MR10 */ + list_add(&NumericPredLabels,act); /* MR10 */ + numericActionLabel=0; /* MR10 */ + }; /* MR10 */ + { + zzBLOCK(zztasp5); + zzMake0; + { + char *a; + if ( (LA(1)==PassAction) ) { + zzmatch(PassAction); + + a = (char *)calloc(strlen(LATEXT(1))+1, sizeof(char)); + require(a!=NULL, "rule element: cannot allocate predicate fail action"); + strcpy(a, LATEXT(1)); + act->pred_fail = a; + zzCONSUME; + + } + else { + if ( (setwd8[LA(1)]&0x20) ) { + } + else {zzFAIL(1,zzerr49,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp5); + } + } + if ( first_on_line) { /* MR7 */ + CurAltStart=(Junction *)zzaRet.left; /* MR7 */ + altAdd(CurAltStart); /* MR7 */ + }; + _retv = (Node *)act; + + pred = computePredFromContextGuard(blk,&predMsgDone); /* MR10 */ + if ( pred==NULL) { /* MR10 */ + if ( !predMsgDone) err("invalid or missing context guard"); /* MR10 */ + predMsgDone=1; /* MR10 */ + } else { /* MR10 */ + act->guardNodes=(Junction *)blk.left; /* MR11 */ + pred->expr = act->action; + pred->source = act; + /* MR10 */ pred->ampersandStyle = ampersandStyle; /* 0 means (g)? => ... 1 means (g)? && ... */ + /* MR13 */ if (pred->tcontext != NULL) { + /* MR13 */ height=MR_max_height_of_tree(pred->tcontext); + /* MR13 */ equal_height=MR_all_leaves_same_height(pred->tcontext,height); + /* MR13 */ if (! equal_height) { + /* MR13 */ errFL("in guarded predicates all tokens in the guard must be at the same height", + /* MR13 */ FileStr[act->file],act->line); + /* MR13 */ }; + /* MR13 */ } + /* MR10 */ if (ampersandStyle) { + /* MR10 */ act->ampersandPred = pred; + /* MR11 */ if (! HoistPredicateContext) { + /* MR11 */ errFL("without \"-prc on\" (guard)? && <<pred>>? ... doesn't make sense", + /* MR11 */ FileStr[act->file],act->line); + /* MR11 */ }; + /* MR10 */ } else { + /* MR10 */ act->guardpred = pred; + /* MR10 */ }; + /* MR10 */ if (pred->k != semDepth) { + /* MR10 */ warn(eMsgd2("length of guard (%d) does not match the length of semantic predicate (%d)", + /* MR10 */ pred->k,semDepth)); + /* MR10 */ }; + } + } + else { + if ( (setwd8[LA(1)]&0x40) ) { + zzaRet = makeBlk(zzaRet,approx,pFirstSetSymbol); + FoundGuessBlk = 1; + ((Junction *) ((Junction *)zzaRet.left)->p1)->guess=1; + if ( ! first_on_line ) { + err("(...)? predicate must be first element of production"); + } + } + else {zzFAIL(1,zzerr50,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp4); + } + } + } + else { + if ( (setwd8[LA(1)]&0x80) ) { + zzaRet = makeBlk(zzaRet,approx,pFirstSetSymbol); + } + else {zzFAIL(1,zzerr51,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + } + } + zzEXIT(zztasp3); + } + } + + if ( pred==NULL && !predMsgDone) { /* MR10 */ + ((Junction *)((Junction *)zzaRet.left)->p1)->blockid = CurBlockID; + ((Junction *)((Junction *)zzaRet.left)->p1)->tokrefs = toksrefd; + ((Junction *)((Junction *)zzaRet.left)->p1)->rulerefs = rulesrefd; + if ( first_on_line ) { /* MR7 */ + CurAltStart = (Junction *)((Junction *)((Junction *)zzaRet.left)->p1); /* MR7 */ + altAdd(CurAltStart); /* MR7 */ + }; /* MR7 */ + _retv = (Node *) ((Junction *)zzaRet.left)->p1; + } + } + else { + if ( (LA(1)==102) ) { + zzmatch(102); zzCONSUME; + block( &toksrefd,&rulesrefd ); + zzaRet = makeOpt(zzaArg(zztasp2,2),approx,pFirstSetSymbol); + /* MR23 */ CurBlockID_array[BlkLevel] = (-1); + /* MR23 */ CurAltNum_array[BlkLevel] = (-1); + --BlkLevel; + zzmatch(98); + + ((Junction *)((Junction *)zzaRet.left)->p1)->blockid = CurBlockID; + ((Junction *)((Junction *)zzaRet.left)->p1)->tokrefs = toksrefd; + ((Junction *)((Junction *)zzaRet.left)->p1)->rulerefs = rulesrefd; + zzCONSUME; + + if ( first_on_line ) { /* MR7 */ + CurAltStart = (Junction *) ((Junction *)((Junction *)zzaRet.left)->p1); /* MR7 */ + altAdd(CurAltStart); /* MR7 */ + }; + _retv = (Node *) ((Junction *)zzaRet.left)->p1; + } + else {zzFAIL(1,zzerr52,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + } + else { + if ( (LA(1)==129) ) { + zzmatch(129); + warn("don't you want a ')' with that '*'?"); CannotContinue=TRUE; + zzCONSUME; + + } + else { + if ( (LA(1)==130) ) { + zzmatch(130); + warn("don't you want a ')' with that '+'?"); CannotContinue=TRUE; + zzCONSUME; + + } + else { + if ( (LA(1)==105) ) { + zzmatch(105); + warn("'>' can only appear after a nonterminal"); CannotContinue=TRUE; + zzCONSUME; + + } + else { + if ( (LA(1)==PassAction) ) { + zzmatch(PassAction); + warn("[...] out of context 'rule > [...]'"); + CannotContinue=TRUE; + zzCONSUME; + + } + else {zzFAIL(1,zzerr53,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + } + } + } + } + } + } + zzEXIT(zztasp1); + return _retv; +fail: + zzEXIT(zztasp1); + CannotContinue=TRUE; + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd9, 0x1); + return _retv; + } +} + +void +#ifdef __USE_PROTOS +default_exception_handler(void) +#else +default_exception_handler() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + DefaultExGroup = exception_group(); + + zzEXIT(zztasp1); + return; + /* fail: */ + zzEXIT(zztasp1); + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd9, 0x2); + } +} + +ExceptionGroup * +#ifdef __USE_PROTOS +exception_group(void) +#else +exception_group() +#endif +{ + ExceptionGroup * _retv; + zzRULE; + zzBLOCK(zztasp1); + PCCTS_PURIFY(_retv,sizeof(ExceptionGroup * )) + zzMake0; + { + ExceptionHandler *h; LabelEntry *label=NULL; /* MR6 */ + FoundException = 1; FoundExceptionGroup = 1; + zzmatch(133); + _retv = (ExceptionGroup *)calloc(1, sizeof(ExceptionGroup)); + zzCONSUME; + + { + zzBLOCK(zztasp2); + zzMake0; + { + char *p; + if ( (LA(1)==PassAction) ) { + zzmatch(PassAction); + + p = LATEXT(1)+1; + p[strlen(p)-1] = '\0'; /* kill trailing space */ + label = (LabelEntry *) hash_get(Elabel, LATEXT(1)+1); + if ( label==NULL ) + { + err(eMsg1("unknown label in exception handler: '%s'", LATEXT(1)+1)); + } + zzCONSUME; + + } + else { + if ( (setwd9[LA(1)]&0x4) ) { + } + else {zzFAIL(1,zzerr54,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + { + zzBLOCK(zztasp2); + zzMake0; + { + while ( (LA(1)==135) ) { + h = exception_handler(); + + list_add(&(_retv->handlers), (void *)h); + zzLOOP(zztasp2); + } + zzEXIT(zztasp2); + } + } + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==134) ) { + zzmatch(134); zzCONSUME; + zzmatch(106); zzCONSUME; + zzmatch(Action); + { + ExceptionHandler *eh = (ExceptionHandler *) + calloc(1, sizeof(ExceptionHandler)); + char *a = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char)); + require(eh!=NULL, "exception: cannot allocate handler"); + require(a!=NULL, "exception: cannot allocate action"); + strcpy(a, LATEXT(1)); + eh->action = a; + eh->signalname = (char *) calloc(strlen("default")+1, sizeof(char)); + require(eh->signalname!=NULL, "exception: cannot allocate sig name"); + strcpy(eh->signalname, "default"); + list_add(&(_retv->handlers), (void *)eh); + } + zzCONSUME; + + } + else { + if ( (setwd9[LA(1)]&0x8) ) { + } + else {zzFAIL(1,zzerr55,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + + if ( label!=NULL ) { + /* Record ex group in sym tab for this label */ + if ( label->ex_group!=NULL ) { + err(eMsg1("duplicate exception handler for label '%s'",label->str)); + } else { + label->ex_group = _retv; + /* Label the exception group itself */ + _retv->label = label->str; + /* Make the labelled element pt to the exception also */ + /* MR6 */ if (label->elem == NULL) { + /* MR6 */ err(eMsg1("reference in exception handler to undefined label '%s'",label->str)); + /* MR6 */ } else { + switch ( label->elem->ntype ) { + case nRuleRef : + { + RuleRefNode *r = (RuleRefNode *)label->elem; + r->ex_group = _retv; + break; + } + case nToken : + { + TokNode *t = (TokNode *)label->elem; + t->ex_group = _retv; + break; + } + } /* end switch */ + /* MR6 */ }; /* end test on label->elem */ + } /* end test on label->ex_group */ + + } /* end test on exception label */ + +/* MR7 */ + /* MR7 */ if (BlkLevel == 1 && label == NULL) { + /* MR7 */ _retv->forRule=1; + /* MR7 */ } else if (label == NULL) { + /* MR7 */ _retv->altID = makeAltID(CurBlockID_array[BlkLevel], CurAltNum_array[BlkLevel]); + /* MR7 */ egAdd(_retv); + /* MR7 */ } else { + /* MR7 */ _retv->labelEntry=label; + /* MR7 */ }; + /* MR7 */ + /* MR7 */ /* You may want to remove this exc from the rule list */ + /* MR7 */ /* and handle at the labeled element site. */ + /* MR7 */ + /* MR7 */ if (label != NULL) { + /* MR7 */ _retv = NULL; + /* MR7 */ }; + zzEXIT(zztasp1); + return _retv; +fail: + zzEXIT(zztasp1); + CannotContinue=TRUE; + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd9, 0x10); + return _retv; + } +} + +ExceptionHandler * +#ifdef __USE_PROTOS +exception_handler(void) +#else +exception_handler() +#endif +{ + ExceptionHandler * _retv; + zzRULE; + zzBLOCK(zztasp1); + PCCTS_PURIFY(_retv,sizeof(ExceptionHandler * )) + zzMake0; + { + ; + zzmatch(135); + + _retv = (ExceptionHandler *)calloc(1, sizeof(ExceptionHandler)); + require(_retv!=NULL, "exception: cannot allocate handler"); + zzCONSUME; + + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==NonTerminal) ) { + zzmatch(NonTerminal); + + _retv->signalname = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char)); + require(_retv->signalname!=NULL, "exception: cannot allocate sig name"); + strcpy(_retv->signalname, LATEXT(1)); + zzCONSUME; + + } + else { + if ( (LA(1)==TokenTerm) ) { + zzmatch(TokenTerm); + + _retv->signalname = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char)); + require(_retv->signalname!=NULL, "exception: cannot allocate sig name"); + strcpy(_retv->signalname, LATEXT(1)); + zzCONSUME; + + } + else {zzFAIL(1,zzerr56,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + zzmatch(106); zzCONSUME; + { + zzBLOCK(zztasp2); + zzMake0; + { + _retv->action = NULL; + if ( (LA(1)==Action) ) { + zzmatch(Action); + + _retv->action = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char)); + require(_retv->action!=NULL, "exception: cannot allocate action"); + strcpy(_retv->action, LATEXT(1)); + zzCONSUME; + + } + else { + if ( (setwd9[LA(1)]&0x20) ) { + } + else {zzFAIL(1,zzerr57,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + zzEXIT(zztasp1); + return _retv; +fail: + zzEXIT(zztasp1); + CannotContinue=TRUE; + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd9, 0x40); + return _retv; + } +} + +void +#ifdef __USE_PROTOS +enum_file(char * fname) +#else +enum_file(fname) + char *fname ; +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + if ( (setwd9[LA(1)]&0x80) ) { + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==143) ) { + zzmatch(143); zzCONSUME; + zzmatch(ID); zzCONSUME; + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (LA(1)==149) ) { + zzmatch(149); zzCONSUME; + zzmatch(ID); zzCONSUME; + } + else { + if ( (setwd10[LA(1)]&0x1) ) { + } + else {zzFAIL(1,zzerr58,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp3); + } + } + } + else { + if ( (setwd10[LA(1)]&0x2) ) { + } + else {zzFAIL(1,zzerr59,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==151) ) { + { + zzBLOCK(zztasp3); + int zzcnt=1; + zzMake0; + { + do { + enum_def( fname ); + zzLOOP(zztasp3); + } while ( (LA(1)==151) ); + zzEXIT(zztasp3); + } + } + } + else { + if ( (LA(1)==149) ) { + defines( fname ); + } + else {zzFAIL(1,zzerr60,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + } + else { + if ( (LA(1)==Eof) ) { + } + else {zzFAIL(1,zzerr61,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd10, 0x4); + } +} + +void +#ifdef __USE_PROTOS +defines(char * fname) +#else +defines(fname) + char *fname ; +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + int v; int maxt=(-1); char *t; + { + zzBLOCK(zztasp2); + int zzcnt=1; + zzMake0; + { + do { + zzmatch(149); zzCONSUME; + zzmatch(ID); + t = mystrdup(LATEXT(1)); + zzCONSUME; + + zzmatch(INT); + + v = atoi(LATEXT(1)); + /* fprintf(stderr, "#token %s=%d\n", t, v);*/ + + /* MR2 Andreas Magnusson (Andreas.Magnusson@mailbox.swipnet.se) */ + /* MR2 Fix to bug introduced by 1.33MR1 for #tokdefs */ + /* MR2 Don't let #tokdefs be confused by */ + /* MR2 DLGminToken and DLGmaxToken */ + + if ( ! isDLGmaxToken(t)) { /* MR2 */ + TokenNum = v; + if ( v>maxt ) maxt=v; + if ( Tnum( t ) == 0 ) { + addForcedTname( t, v ); + } else { + warnFL(eMsg1("redefinition of token %s; ignored",t), fname,zzline); + }; +}; + zzCONSUME; + + zzLOOP(zztasp2); + } while ( (LA(1)==149) ); + zzEXIT(zztasp2); + } + } + TokenNum = maxt + 1; + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd10, 0x8); + } +} + +void +#ifdef __USE_PROTOS +enum_def(char * fname) +#else +enum_def(fname) + char *fname ; +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + int v= 0; int maxt=(-1); char *t; + zzmatch(151); zzCONSUME; + zzmatch(ID); zzCONSUME; + zzmatch(152); zzCONSUME; + zzmatch(ID); + t = mystrdup(LATEXT(1)); + zzCONSUME; + + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==153) ) { + zzmatch(153); zzCONSUME; + zzmatch(INT); + v=atoi(LATEXT(1)); + zzCONSUME; + + } + else { + if ( (setwd10[LA(1)]&0x10) ) { + v++; + } + else {zzFAIL(1,zzerr62,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + + /* fprintf(stderr, "#token %s=%d\n", t, v);*/ + TokenNum = v; + if ( v>maxt ) maxt=v; /* MR3 */ + if ( Tnum( t ) == 0 ) addForcedTname( t, v ); + else { + warnFL(eMsg1("redefinition of token %s; ignored",t), fname,zzline); + } + { + zzBLOCK(zztasp2); + zzMake0; + { + while ( (LA(1)==154) ) { + zzmatch(154); zzCONSUME; + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (LA(1)==ID)&&(isDLGmaxToken(LATEXT(1))) ) { + if (!(isDLGmaxToken(LATEXT(1))) ) {zzfailed_pred(" isDLGmaxToken(LATEXT(1))",0 /* report */, { 0; /* no user action */ } );} + zzmatch(ID); zzCONSUME; + { + zzBLOCK(zztasp4); + zzMake0; + { + if ( (LA(1)==153) ) { + zzmatch(153); zzCONSUME; + zzmatch(INT); zzCONSUME; + } + else { + if ( (setwd10[LA(1)]&0x20) ) { + } + else {zzFAIL(1,zzerr63,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp4); + } + } + } + else { + if ( (LA(1)==ID) ) { + zzmatch(ID); + t = mystrdup(LATEXT(1)); + zzCONSUME; + + { + zzBLOCK(zztasp4); + zzMake0; + { + if ( (LA(1)==153) ) { + zzmatch(153); zzCONSUME; + zzmatch(INT); + v=atoi(LATEXT(1)); + zzCONSUME; + + } + else { + if ( (setwd10[LA(1)]&0x40) ) { + v++; + } + else {zzFAIL(1,zzerr64,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp4); + } + } + + /* fprintf(stderr, "#token %s=%d\n", t, v);*/ + TokenNum = v; + if ( v>maxt ) maxt=v; /* MR3 */ + if ( Tnum( t ) == 0 ) addForcedTname( t, v ); + else { + warnFL(eMsg1("redefinition of token %s; ignored",t), fname,zzline); + } + } + else { + if ( (setwd10[LA(1)]&0x80) ) { + } + else {zzFAIL(1,zzerr65,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + } + zzEXIT(zztasp3); + } + } + zzLOOP(zztasp2); + } + zzEXIT(zztasp2); + } + } + zzmatch(155); zzCONSUME; + zzmatch(156); + TokenNum = maxt + 1; + zzCONSUME; + + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd11, 0x1); + } +} + + +/* MR2 Andreas Magnusson (Andreas.Magnusson@mailbox.swipnet.se) */ +/* MR2 Fix to bug introduced by 1.33MR1 for #tokdefs */ +/* MR2 Don't let #tokdefs be confused by */ +/* MR2 DLGminToken and DLGmaxToken */ + +/* semantic check on DLGminToken and DLGmaxmaxToken in #tokdefs */ + +#ifdef __USE_PROTOS +static int isDLGmaxToken(char *Token) +#else +static int isDLGmaxToken(Token) +char * Token; +#endif +{ +static char checkStr1[] = "DLGmaxToken"; +static char checkStr2[] = "DLGminToken"; + + if (strcmp(Token, checkStr1) == 0) +return 1; +else if (strcmp(Token, checkStr2) == 0) +return 1; +else +return 0; +} + +/* semantics of #token */ +static void +#ifdef __USE_PROTOS +chkToken(char *t, char *e, char *a, int tnum) +#else +chkToken(t,e,a,tnum) +char *t, *e, *a; +int tnum; +#endif +{ +TermEntry *p; + + /* check to see that they don't try to redefine a token as a token class */ +if ( t!=NULL ) { +p = (TermEntry *) hash_get(Tname, t); +if ( p!=NULL && p->classname ) { + err(eMsg1("redefinition of #tokclass '%s' to #token not allowed; ignored",t)); + if ( a!=NULL ) free((char *)a); + return; +} +} + + if ( t==NULL && e==NULL ) { /* none found */ +err("#token requires at least token name or rexpr"); +} +else if ( t!=NULL && e!=NULL ) { /* both found */ +if ( UserDefdTokens ) { /* if #tokdefs, must not define new */ + p = (TermEntry *) hash_get(Tname, t); + if ( p == NULL) { + err(eMsg1("new token definition '%s' not allowed - only #token with name already defined by #tokdefs file allowed",t)); + return; + }; +} +Tklink(t, e); +if ( a!=NULL ) { + if ( hasAction(e) ) { + err(eMsg1("redefinition of action for %s; ignored",e)); + } + else setHasAction(e, a); +} +} +else if ( t!=NULL ) { /* only one found */ +if ( UserDefdTokens ) { + p = (TermEntry *) hash_get(Tname, t); + if (p == NULL) { + err(eMsg1("new token definition '%s' not allowed - only #token with name already defined by #tokdefs file allowed",t)); + }; + return; +} +if ( Tnum( t ) == 0 ) addTname( t ); +else { + err(eMsg1("redefinition of token %s; ignored",t)); +} +if ( a!=NULL ) { + err(eMsg1("action cannot be attached to a token name (%s); ignored",t)); + free((char *)a); +} +} +else if ( e!=NULL ) { +if ( Tnum( e ) == 0 ) addTexpr( e ); +else { + if ( hasAction(e) ) { + err(eMsg1("redefinition of action for expr %s; ignored",e)); + } + else if ( a==NULL ) { + err(eMsg1("redefinition of expr %s; ignored",e)); + } +} +if ( a!=NULL ) setHasAction(e, a); +} + + /* if a token type number was specified, then add the token ID and 'tnum' +* pair to the ForcedTokens list. (only applies if an id was given) +*/ +if ( t!=NULL && tnum>0 ) +{ +if ( set_el(tnum, reserved_positions) ) +{ + err(eMsgd("a token has already been forced to token number %d; ignored", tnum)); +} +else +{ + list_add(&ForcedTokens, newForcedToken(t,tnum)); + set_orel(tnum, &reserved_positions); +} +} +} + +static int +#ifdef __USE_PROTOS +match_token(char *s, char **nxt) +#else +match_token(s,nxt) +char *s; +char **nxt; +#endif +{ + if ( !(*s>='A' && *s<='Z') ) return 0; + s++; + while ( (*s>='a' && *s<='z') || + (*s>='A' && *s<='Z') || + (*s>='0' && *s<='9') || + *s=='_' ) + { + s++; + } + if ( *s!=' ' && *s!='}' ) return 0; + *nxt = s; + return 1; +} + +static int +#ifdef __USE_PROTOS +match_rexpr(char *s, char **nxt) +#else +match_rexpr(s,nxt) +char *s; +char **nxt; +#endif +{ + if ( *s!='"' ) return 0; + s++; + while ( *s!='"' ) + { + if ( *s=='\n' || *s=='\r' ) /* MR13 */ + warn("eoln found in regular expression"); + if ( *s=='\\' ) s++; + s++; + } + *nxt = s+1; + return 1; +} + +/* +* Walk a string "{ A .. Z }" where A..Z is a space separated list +* of token references (either labels or reg exprs). Return a +* string "inlineX_set" for some unique integer X. Basically, +* we pretend as if we had seen "#tokclass inlineX { A .. Z }" +* on the input stream outside of an action. +*/ +char * +#ifdef __USE_PROTOS +inline_set(char *s) +#else +inline_set(s) +char *s; +#endif +{ + char *nxt; + fprintf(stderr, "found consumeUntil( {...} )\n"); + while ( *s==' ' || *s=='\t' || *s=='\n' || *s=='\r' ) {s++;} + if ( *s!='{' ) + { + err("malformed consumeUntil( {...} ); missing '{'"); + return "bad_set"; + } + s++; + while ( *s==' ' || *s=='\t' || *s=='\n' || *s=='\r' ) {s++;} + while ( *s!='}' ) + { + if ( match_token(s,&nxt) ) fprintf(stderr, "found token %s\n", s); + else if ( match_rexpr(s,&nxt) ) fprintf(stderr, "found rexpr %s\n", s); + else { + err("invalid element in consumeUntil( {...} )"); + return "bad_set"; + } + s = nxt; + while ( *s==' ' || *s=='\t' || *s=='\n' || *s=='\r' ) {s++;} + } + return "inlineX_set"; +} + +/* ANTLR-specific syntax error message generator +* (define USER_ZZSYN when compiling so don't get 2 definitions) +*/ +void +#ifdef __USE_PROTOS +zzsyn(char *text, int tok, char *egroup, SetWordType *eset, int etok, +int k, char *bad_text) +#else +zzsyn(text, tok, egroup, eset, etok, k, bad_text) +char *text, *egroup, *bad_text; +int tok; +int etok; +int k; +SetWordType *eset; +#endif +{ +fprintf(stderr, ErrHdr, FileStr[CurFile]!=NULL?FileStr[CurFile]:"stdin", zzline); +fprintf(stderr, " syntax error at \"%s\"", (tok==zzEOF_TOKEN)?"EOF":text); +if ( !etok && !eset ) {fprintf(stderr, "\n"); return;} +if ( k==1 ) fprintf(stderr, " missing"); +else +{ +fprintf(stderr, "; \"%s\" not", bad_text); +if ( zzset_deg(eset)>1 ) fprintf(stderr, " in"); +} +if ( zzset_deg(eset)>0 ) zzedecode(eset); +else fprintf(stderr, " %s", zztokens[etok]); +if ( strlen(egroup) > (size_t)0 ) fprintf(stderr, " in %s", egroup); +fprintf(stderr, "\n"); +} diff --git a/pccts/antlr/bits.c b/pccts/antlr/bits.c new file mode 100644 index 0000000..7da2a42 --- /dev/null +++ b/pccts/antlr/bits.c @@ -0,0 +1,1026 @@ +/* bits.c -- manage creation and output of bit sets used by the parser. + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2001 + */ + +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> +#include <assert.h> +#include "pcctscfg.h" +#include "set.h" +#include "syn.h" +#include "hash.h" +#include "generic.h" +#include "dlgdef.h" + +/* char is only thing that is pretty much always known == 8 bits + * This allows output of antlr (set stuff, anyway) to be androgynous (portable) + */ +typedef unsigned char SetWordType; +#define BitsPerByte 8 +#define BitsPerWord BitsPerByte*sizeof(SetWordType) + +static SetWordType *setwd = NULL; +int setnum = -1; +int wordnum = 0; + +int esetnum = 0; + +/* Used to convert native wordsize, which ANTLR uses (via set.c) to manipulate sets, + to bytes that are most portable size-wise. + */ +void +#ifdef __USE_PROTOS +DumpIntAsChars( FILE *f, char *format, unsigned wd ) +#else +DumpIntAsChars( f, format, wd ) +FILE *f; +char *format; +unsigned wd; +#endif +{ + int i; + /* uses max of 32 bit unsigned integer for the moment */ + static unsigned long byte_mask[sizeof(unsigned long)] = + { 0xFF, 0xFF00UL, 0xFF0000UL, 0xFF000000UL }; /* MR20 G. Hobbelt */ +/* 0xFF00000000, 0xFF0000000000, 0xFF000000000000, 0xFF00000000000000 };*/ + + /* for each byte in the word */ + assert(sizeof(unsigned) <= 4); /* M20 G. Hobbelt Sanity check */ + for (i=0; i<sizeof(unsigned); i++) + { + /* mask out the ith byte and shift down to the first 8 bits */ + fprintf(f, format, (wd&byte_mask[i])>>(i*BitsPerByte)); + if ( i<sizeof(unsigned)-1) fprintf(f, ","); + } +} + +/* Create a new setwd (ignoring [Ep] token on end) */ +void +#ifdef __USE_PROTOS +NewSetWd( void ) +#else +NewSetWd( ) +#endif +{ + SetWordType *p; + + if ( setwd == NULL ) + { + setwd = (SetWordType *) calloc(TokenNum, sizeof(SetWordType)); + require(setwd!=NULL, "NewSetWd: cannot alloc set wd\n"); + } + for (p = setwd; p<&(setwd[TokenNum]); p++) {*p=0;} + wordnum++; +} + +void +#ifdef __USE_PROTOS +DumpSetWd( void ) +#else +DumpSetWd( ) +#endif +{ + if ( GenCC ) DumpSetWdForCC(); + else DumpSetWdForC(); +} + +/* Dump the current setwd to ErrFile. 0..MaxTokenVal */ +void +#ifdef __USE_PROTOS +DumpSetWdForC( void ) +#else +DumpSetWdForC( ) +#endif +{ + int i,c=1; + + if ( setwd==NULL ) return; + fprintf(DefFile, "extern SetWordType setwd%d[];\n", wordnum); + fprintf(ErrFile, + "SetWordType setwd%d[%d] = {", wordnum, TokenNum-1); + for (i=0; i<TokenNum-1; i++) + { + DAWDLE; + if ( i!=0 ) fprintf(ErrFile, ","); + if ( c == 8 ) {fprintf(ErrFile, "\n\t"); c=1;} else c++; + fprintf(ErrFile, "0x%x", setwd[i]); + } + fprintf(ErrFile, "};\n"); +} + +/* Dump the current setwd to Parser.C file. 0..MaxTokenVal; + * Only used if -CC on. + */ +void +#ifdef __USE_PROTOS +DumpSetWdForCC( void ) +#else +DumpSetWdForCC( ) +#endif +{ + int i,c=1; + + if ( setwd==NULL ) return; + fprintf(Parser_h, "\tstatic SetWordType setwd%d[%d];\n", wordnum, TokenNum-1); + fprintf(Parser_c, + "SetWordType %s::setwd%d[%d] = {", CurrentClassName, wordnum, + TokenNum-1); + for (i=0; i<TokenNum-1; i++) + { + DAWDLE; + if ( i!=0 ) fprintf(Parser_c, ","); + if ( c == 8 ) {fprintf(Parser_c, "\n\t"); c=1;} else c++; + fprintf(Parser_c, "0x%x", setwd[i]); + } + fprintf(Parser_c, "};\n"); +} + +/* Make a new set. Dump old setwd and create new setwd if current setwd is full */ +void +#ifdef __USE_PROTOS +NewSet( void ) +#else +NewSet( ) +#endif +{ + setnum++; + if ( setnum==BitsPerWord ) /* is current setwd full? */ + { + DumpSetWd(); NewSetWd(); setnum = 0; + } +} + +/* s is a set of tokens. Turn on bit at each token position in set 'setnum' */ +void +#ifdef __USE_PROTOS +FillSet( set s ) +#else +FillSet( s ) +set s; +#endif +{ + SetWordType mask=(((unsigned)1)<<setnum); + unsigned int e; + + while ( !set_nil(s) ) + { + e = set_int(s); + set_rm(e, s); + setwd[e] |= mask; + } +} + + /* E r r o r C l a s s S t u f f */ + +/* compute the FIRST of a rule for the error class stuff */ +static set +#ifdef __USE_PROTOS +Efirst( char *rule, ECnode *eclass ) +#else +Efirst( rule, eclass ) +char *rule; +ECnode *eclass; +#endif +{ + set rk, a; + Junction *r; + RuleEntry *q = (RuleEntry *) hash_get(Rname, rule); + + if ( q == NULL ) + { + warnNoFL(eMsg2("undefined rule '%s' referenced in errclass '%s'; ignored", + rule, TokenString(eclass->tok))); + return empty; + } + r = RulePtr[q->rulenum]; + r->end->halt = TRUE; /* don't let reach fall off end of rule here */ + rk = empty; + REACH(r, 1, &rk, a); + r->end->halt = FALSE; + return a; +} + +/* + * scan the list of tokens/eclasses/nonterminals filling the new eclass + * with the set described by the list. Note that an eclass can be + * quoted to allow spaces etc... However, an eclass must not conflict + * with a reg expr found elsewhere. The reg expr will be taken over + * the eclass name. + */ +static void +#ifdef __USE_PROTOS +doEclass( char *eclass ) +#else +doEclass( eclass ) +char *eclass; +#endif +{ + TermEntry *q; + ECnode *p; + TCnode *tcnode; + ListNode *e; + unsigned int t; + unsigned deg=0; + set a; + require(eclass!=NULL, "doEclass: NULL eset"); + + p = (ECnode *) eclass; + lexmode(p->lexclass); /* switch to lexclass where errclass is defined */ + p->eset = empty; + for (e = (p->elist)->next; e!=NULL; e=e->next) + { + q = NULL; /* MR23 */ + + if ( islower( *((char *)e->elem) ) ) /* is it a rule ref? (alias FIRST request) */ + { + a = Efirst((char *)e->elem, p); + set_orin(&p->eset, a); + deg += set_deg(a); + set_free( a ); + continue; + } + else if ( *((char *)e->elem)=='"' ) + { + t = 0; + q = (TermEntry *) hash_get(Texpr, (char *) e->elem); + if ( q == NULL ) + { + /* if quoted and not an expr look for eclass name */ + e->elem=(void *)StripQuotes((char *)e->elem); + q = (TermEntry *) hash_get(Tname, (char *) e->elem); + if ( q != NULL ) t = q->token; + } + else t = q->token; + } + else /* labelled token/eclass/tokclass */ + { + q = (TermEntry *) hash_get(Tname, (char *)e->elem); + if ( q != NULL ) + { + if ( strcmp((char *)e->elem, TokenString(p->tok))==0 ) + { + warnNoFL(eMsg1("self-referential error class '%s'; ignored", + (char *)e->elem)); + continue; + } + else + t = q->token; + } + else t=0; + } + if ( t!=0 ) + { + if (isTermEntryTokClass(q)) { /* MR23 */ + tcnode = q->tclass; /* MR23 */ + set_orin(&p->eset, tcnode->tset); /* MR23 */ + deg = set_deg(p->eset); /* MR23 */ + } /* MR23 */ + else { + set_orel(t, &p->eset); + deg++; + } + } + else warnNoFL(eMsg2("undefined token '%s' referenced in errclass '%s'; ignored", + (char *)e->elem, TokenString(p->tok))); + } + p->setdeg = deg; +} + +void +#ifdef __USE_PROTOS +ComputeErrorSets( void ) +#else +ComputeErrorSets( ) +#endif +{ +#ifdef __cplusplus + list_apply(eclasses, (void (*)(void *)) doEclass); +#else +#ifdef __USE_PROTOS + list_apply(eclasses, (void (*)(void *)) doEclass); +#else + list_apply(eclasses, doEclass); +#endif +#endif +} + +void +#ifdef __USE_PROTOS +ComputeTokSets( void ) +#else +ComputeTokSets( ) +#endif +{ + ListNode *t, *e = NULL, *e1, *e2; + int something_changed; + int i; + TCnode *p; + TermEntry *q, *q1, *q2; + + if ( tclasses == NULL ) return; + + /* turn lists of token/tokclass references into sets */ + for (t = tclasses->next; t!=NULL; t=t->next) + { + p = (TCnode *) t->elem; + + /* if wild card, then won't have entries in tclass, assume all_tokens */ + if ( p->tok == WildCardToken ) + { + p->tset = set_dup(all_tokens); + continue; + } + + lexmode(p->lexclass); /* switch to lexclass where tokclass is defined */ + p->tset = empty; + + /* instantiate all tokens/token_classes into the tset */ + for (e = (p->tlist)->next; e!=NULL; e=e->next) + { + char *tokstr; + tokstr = (char *)e->elem; + if ( *tokstr == '"' ) { + q = (TermEntry *) hash_get(Texpr, tokstr); + require(q!=NULL, "ComputeTokSets: no token def"); + set_orel(q->token, &p->tset); + } else if (tokstr[0] == '.') { + e1=e->next; + e2=e1->next; + e=e2; + q1= (TermEntry *) hash_get(Tname, (char *)e1->elem); + require(q1!=NULL, "ComputeTokSets: no token def"); + q2= (TermEntry *) hash_get(Tname, (char *)e2->elem); + require(q2!=NULL, "ComputeTokSets: no token def"); + + if (set_el(q1->token,imag_tokens)) { +errNoFL(eMsg2("can't define #tokclass %s using #tokclass or #errclass %s", + TokenString(p->tok),(char *)e1->elem) ); + } + if (set_el(q2->token,imag_tokens)) { +errNoFL(eMsg2("can't define #tokclass %s using #tokclass or #errclass %s", + TokenString(p->tok),(char *)e2->elem) ); + } + if (q1->token > q2->token) { +errNoFL(eMsg3("for #tokclass %s %s..%s - first token number > second token number", + TokenString(p->tok),(char *)e1->elem,(char *)e2->elem) ); + for (i=q2->token; i<=q1->token; i++) { set_orel(i, &p->tset); } + } else { + for (i=q1->token; i<=q2->token; i++) { set_orel(i, &p->tset); } + } + } else { + q = (TermEntry *) hash_get(Tname, tokstr); + require(q!=NULL, "ComputeTokSets: no token def"); + set_orel(q->token, &p->tset); + } + } + } + + /* Go thru list of tokclasses again looking for tokclasses in sets */ +again: + something_changed = 0; + for (t = tclasses->next; t!=NULL; t=t->next) + { + set tcl; + p = (TCnode *) t->elem; + tcl = set_and(p->tset, tokclasses); + if ( !set_nil(tcl) ) + { + int tk; + /* replace refs to tokclasses with the associated set of tokens */ + something_changed = 1; + while ( !set_nil(tcl) ) + { + tk = set_int(tcl); /* grab one of the tok class refs */ + set_rm(tk, tcl); + if ( p->tok != tk ) /* tokclass ref to yourself? */ + { + q = (TermEntry *) hash_get(Tname, TokenString(tk)); + require(q!=NULL, "#tokclass not in hash table"); + set_orin(&p->tset, q->tclass->tset); + } + set_rm(tk, p->tset); /* remove ref that we replaced */ + } + } + set_free(tcl); + } + if ( something_changed ) goto again; +} + +void +#ifdef __USE_PROTOS +DumpRemainingTokSets(void) +#else +DumpRemainingTokSets() +#endif +{ + TCnode *p; + ListNode *t; + + /* Go thru tclasses (for the last time) and dump the sets not dumped + * during code gen; yes, this is a bogus way to do this, but ComputeTokSets() + * can't dump the defs as the error file and tok file has not been created + * yet etc... + */ + if ( tclasses==NULL ) return; + for (t = tclasses->next; t!=NULL; t=t->next) + { + unsigned e; + p = (TCnode *) t->elem; + if ( p->dumped ) continue; + e = DefErrSet(&(p->tset), 0, TokenString(p->tok)); + p->dumped = 1; + p->setnum = e; + } +} + + +/* replace a subset of an error set with an error class name if a subset is found + * repeat process until no replacements made + */ +void +#ifdef __USE_PROTOS +SubstErrorClass( set *f ) +#else +SubstErrorClass( f ) +set *f; +#endif +{ + int max, done = 0; + ListNode *p; + ECnode *ec, *maxclass = NULL; + set a; + require(f!=NULL, "SubstErrorClass: NULL eset"); + + if ( eclasses == NULL ) return; + while ( !done ) + { + max = 0; + maxclass = NULL; + for (p=eclasses->next; p!=NULL; p=p->next) /* chk all error classes */ + { + ec = (ECnode *) p->elem; + if ( ec->setdeg > max ) + { + if ( set_sub(ec->eset, *f) || set_equ(ec->eset, *f) ) + {maxclass = ec; max=ec->setdeg;} + } + } + if ( maxclass != NULL ) /* if subset found, replace with token */ + { + a = set_dif(*f, maxclass->eset); + set_orel((unsigned)maxclass->tok, &a); + set_free(*f); + *f = a; + } + else done = 1; + } +} + +int +#ifdef __USE_PROTOS +DefErrSet1(int nilOK, set *f, int subst, char *name ) +#else +DefErrSet1(nilOK, f, subst, name ) +int nilOK; +set *f; +int subst; /* should be substitute error classes? */ +char *name; +#endif +{ + if ( GenCC ) return DefErrSetForCC1(nilOK, f, subst, name, "_set"); + else return DefErrSetForC1(nilOK, f, subst, name, "_set"); +} + +int +#ifdef __USE_PROTOS +DefErrSet( set *f, int subst, char *name ) +#else +DefErrSet( f, subst, name ) +set *f; +int subst; /* should be substitute error classes? */ +char *name; +#endif +{ + return DefErrSet1(0,f,subst,name); +} + +int +#ifdef __USE_PROTOS +DefErrSetWithSuffix(int nilOK, set *f, int subst, char *name, const char* suffix) +#else +DefErrSetWithSuffix(nilOK, f, subst, name, suffix ) +int nilOK; +set *f; +int subst; /* should be substitute error classes? */ +char *name; +char *suffix; +#endif +{ + if ( GenCC ) return DefErrSetForCC1(nilOK, f, subst, name, suffix ); + else return DefErrSetForC1(nilOK, f, subst, name, suffix); +} + +/* Define a new error set. WARNING...set-implementation dependent. + */ +int +#ifdef __USE_PROTOS +DefErrSetForC1(int nilOK, set *f, int subst, char * name, const char * suffix) +#else +DefErrSetForC1(nilOK, f, subst, name, suffix) +int nilOK; /* MR13 */ +set *f; +int subst; /* should be substitute error classes? */ +char *name; +const char *suffix; +#endif +{ + unsigned *p, *endp; + int e=1; + + if (!nilOK) require(!set_nil(*f), "DefErrSetForC1: nil set to dump?"); + + if ( subst ) SubstErrorClass(f); + p = f->setword; + endp = &(f->setword[f->n]); + esetnum++; + if ( name!=NULL ) + fprintf(DefFile, "extern SetWordType %s%s[];\n", name, suffix); + else + fprintf(DefFile, "extern SetWordType zzerr%d[];\n", esetnum); + if ( name!=NULL ) { + fprintf(ErrFile, "SetWordType %s%s[%d] = {", + name, + suffix, + NumWords(TokenNum-1)*sizeof(unsigned)); + } + else { + fprintf(ErrFile, "SetWordType zzerr%d[%d] = {", + esetnum, + NumWords(TokenNum-1)*sizeof(unsigned)); + } + while ( p < endp ) + { + if ( e > 1 ) fprintf(ErrFile, ", "); + DumpIntAsChars(ErrFile, "0x%x", *p++); + if ( e == 3 ) + { + DAWDLE; + if ( p < endp ) fprintf(ErrFile, ","); + fprintf(ErrFile, "\n\t"); + e=1; + } + else e++; + } + fprintf(ErrFile, "};\n"); + + return esetnum; +} + +int +#ifdef __USE_PROTOS +DefErrSetForC( set *f, int subst, char *name ) +#else +DefErrSetForC( f, subst, name ) +set *f; +int subst; /* should be substitute error classes? */ +char *name; +#endif +{ + return DefErrSetForC1(0,f,subst,name, "_set"); +} + +/* Define a new error set. WARNING...set-implementation dependent; + * Only used when -CC on. + */ + +int +#ifdef __USE_PROTOS +DefErrSetForCC1(int nilOK, set *f, int subst, char *name, const char *suffix ) +#else +DefErrSetForCC1(nilOK, f, subst, name, suffix ) +int nilOK; /* MR13 */ +set *f; +int subst; /* should be substitute error classes? */ +char *name; +const char *suffix; +#endif +{ + unsigned *p, *endp; + int e=1; + + if (!nilOK) require(!set_nil(*f), "DefErrSetForCC1: nil set to dump?"); + + if ( subst ) SubstErrorClass(f); + p = f->setword; + endp = &(f->setword[f->n]); + esetnum++; + + if ( name!=NULL ) { + fprintf(Parser_h, "\tstatic SetWordType %s%s[%d];\n", name, suffix, + NumWords(TokenNum-1)*sizeof(unsigned)); + fprintf(Parser_c, "SetWordType %s::%s%s[%d] = {", + CurrentClassName, + name, + suffix, + NumWords(TokenNum-1)*sizeof(unsigned)); + } + else { + fprintf(Parser_c, "SetWordType %s::err%d[%d] = {", + CurrentClassName, + esetnum, + NumWords(TokenNum-1)*sizeof(unsigned)); + fprintf(Parser_h, "\tstatic SetWordType err%d[%d];\n", esetnum, + NumWords(TokenNum-1)*sizeof(unsigned)); + } + + while ( p < endp ) + { + if ( e > 1 ) fprintf(Parser_c, ", "); + DumpIntAsChars(Parser_c, "0x%x", *p++); + if ( e == 3 ) + { + if ( p < endp ) fprintf(Parser_c, ","); + fprintf(Parser_c, "\n\t"); + e=1; + } + else e++; + } + fprintf(Parser_c, "};\n"); + + return esetnum; +} + +int +#ifdef __USE_PROTOS +DefErrSetForCC( set *f, int subst, char *name ) +#else +DefErrSetForCC( f, subst, name ) +set *f; +int subst; /* should be substitute error classes? */ +char *name; +#endif +{ + return DefErrSetForCC1(0,f,subst,name, "_set"); +} + +void +#ifdef __USE_PROTOS +GenParser_c_Hdr(void) +#else +GenParser_c_Hdr() +#endif +{ + int i,j; + TermEntry *te; + char * hasAkaName = NULL; /* MR23 */ + + hasAkaName = (char *) malloc(TokenNum+1); /* MR23 */ + require(hasAkaName!=NULL, "Cannot alloc hasAkaName\n"); /* MR23 */ + for (i = 0; i < TokenNum; i++) hasAkaName[i]='0'; /* MR23 */ + hasAkaName[TokenNum] = 0; /* MR23 */ + + fprintf(Parser_c, "/*\n"); + fprintf(Parser_c, " * %s: P a r s e r S u p p o r t\n", CurrentClassName); + fprintf(Parser_c, " *\n"); + fprintf(Parser_c, " * Generated from:"); + for (i=0; i<NumFiles; i++) fprintf(Parser_c, " %s", FileStr[i]); + fprintf(Parser_c, "\n"); + fprintf(Parser_c, " *\n"); + fprintf(Parser_c, " * Terence Parr, Russell Quong, Will Cohen, and Hank Dietz: 1989-2001\n"); + fprintf(Parser_c, " * Parr Research Corporation\n"); + fprintf(Parser_c, " * with Purdue University Electrical Engineering\n"); + fprintf(Parser_c, " * with AHPCRC, University of Minnesota\n"); + fprintf(Parser_c, " * ANTLR Version %s\n", Version); + fprintf(Parser_c, " */\n\n"); + + if ( FirstAction != NULL ) dumpAction(FirstAction,Parser_c, 0, -1, 0, 1); /* MR11 MR15b */ + + fprintf(Parser_c, "#define ANTLR_VERSION %s\n", VersionDef); + + fprintf(Parser_c, "#include \"pcctscfg.h\"\n"); + fprintf(Parser_c, "#include \"pccts_stdio.h\"\n"); + fprintf(Parser_c, "#define ANTLR_SUPPORT_CODE\n"); + if ( UserTokenDefsFile != NULL ) + fprintf(Parser_c, "#include %s\n", UserTokenDefsFile); + else + fprintf(Parser_c, "#include \"%s\"\n", DefFileName); + + fprintf(Parser_c, "#include \"%s.h\"\n\n", CurrentClassName); + + fprintf(Parser_c, "const ANTLRChar *%s::tokenName(int tok) ", /* MR1 */ + CurrentClassName); /* MR1 */ + fprintf(Parser_c, " { return _token_tbl[tok]; }\n"); /* MR1 */ /* MR10 */ + /* Dump a Parser::tokens for each automaton */ + fprintf(Parser_c, "\nconst ANTLRChar *%s::_token_tbl[]={\n", + CurrentClassName); /* MR20 */ + fprintf(Parser_c, "\t/* 00 */\t\"Invalid\""); + + for (i=1; i<TokenNum-1; i++) + { + DAWDLE; + if ( i == EpToken ) continue; + /* remapped to invalid token? */ + if ( TokenInd!=NULL && TokenInd[i]>=LastTokenCounted ) + { + fprintf(Parser_c, ",\n\t/* %02d */\t\"invalid\"", i); + continue; + } + if ( TokenString(i) != NULL ) { + te=(TermEntry *) hash_get(Tname,TokenString(i)); /* MR11 */ + if (te == NULL || te->akaString == NULL) { /* MR11 */ + fprintf(Parser_c, ",\n\t/* %02d */\t\"%s\"", i, TokenString(i)); + } else { + hasAkaName[i] = '1'; /* MR23 */ + fprintf(Parser_c, ",\n\t/* %02d */\t\"%s\"", i, te->akaString); /* MR11 */ + } + } + else + { + /* look in all lexclasses for the reg expr */ + for (j=0; j<NumLexClasses; j++) + { + lexmode(j); + if ( ExprString(i) != NULL ) + { + fprintf(Parser_c, ",\n\t/* %02d */\t", i); + dumpExpr(Parser_c, ExprString(i)); + break; + } + } + if ( j>=NumLexClasses ) + { + if ( UserDefdTokens ) + { + fprintf(Parser_c, ",\n\t/* %02d */\t\"\"", i); + } + else + fatal_internal(eMsgd("No label or expr for token %d",i)); + } + } + } + fprintf(Parser_c, "\n};\n"); + + /* Build constructors */ + fprintf(Parser_c, "\n%s::", CurrentClassName); + fprintf(Parser_c, "%s(ANTLRTokenBuffer *input) : %s(input,%d,%d,%d,%d)\n", + CurrentClassName, + (BaseClassName == NULL ? "ANTLRParser" : BaseClassName), + OutputLL_k, + FoundGuessBlk, + DemandLookahead, + NumWords(TokenNum-1)*sizeof(unsigned)); + fprintf(Parser_c, "{\n"); + fprintf(Parser_c, "\ttoken_tbl = _token_tbl;\n"); + if (TraceGen) { + fprintf(Parser_c, "\ttraceOptionValueDefault=1;\t\t// MR10 turn trace ON\n"); + } else { + fprintf(Parser_c, "\ttraceOptionValueDefault=0;\t\t// MR10 turn trace OFF\n"); + }; + fprintf(Parser_c, "}\n\n"); + free ( (void *) hasAkaName); +} + +void +#ifdef __USE_PROTOS +GenParser_h_Hdr(void) +#else +GenParser_h_Hdr() +#endif +{ + int i; + + fprintf(Parser_h, "/*\n"); + fprintf(Parser_h, " * %s: P a r s e r H e a d e r \n", CurrentClassName); + fprintf(Parser_h, " *\n"); + fprintf(Parser_h, " * Generated from:"); + for (i=0; i<NumFiles; i++) fprintf(Parser_h, " %s", FileStr[i]); + fprintf(Parser_h, "\n"); + fprintf(Parser_h, " *\n"); + fprintf(Parser_h, " * Terence Parr, Russell Quong, Will Cohen, and Hank Dietz: 1989-2001\n"); + fprintf(Parser_h, " * Parr Research Corporation\n"); + fprintf(Parser_h, " * with Purdue University Electrical Engineering\n"); + fprintf(Parser_h, " * with AHPCRC, University of Minnesota\n"); + fprintf(Parser_h, " * ANTLR Version %s\n", Version); + fprintf(Parser_h, " */\n\n"); + + if ( FirstAction != NULL ) dumpAction( FirstAction, Parser_h, 0, -1, 0, 1); /* MR11 MR15b */ + + fprintf(Parser_h, "#ifndef %s_h\n", CurrentClassName); + fprintf(Parser_h, "#define %s_h\n\n", CurrentClassName); + + fprintf(Parser_h, "#ifndef ANTLR_VERSION\n"); + fprintf(Parser_h, "#define ANTLR_VERSION %s\n",VersionDef); + fprintf(Parser_h, "#endif\n\n"); + + if ( GenAST ) fprintf(Parser_h, "class ASTBase;\n"); + if (TraceGen) { + fprintf(Parser_h,"#ifndef zzTRACE_RULES\n"); /* MR20 */ + fprintf(Parser_h,"#define zzTRACE_RULES\n"); /* MR20 */ + fprintf(Parser_h,"#endif\n"); /* MR22 */ + }; + fprintf(Parser_h, "#include \"%s\"\n\n", APARSER_H); + + if ( HdrAction != NULL ) dumpAction( HdrAction, Parser_h, 0, -1, 0, 1); + +/* MR10 */ if (ClassDeclStuff == NULL) { +/* MR10 */ fprintf(Parser_h, "class %s : public ANTLRParser {\n", CurrentClassName); +/* MR10 */ } else { +/* MR10 */ fprintf(Parser_h, "class %s %s {\n",CurrentClassName,ClassDeclStuff); +/* MR10 */ }; + + fprintf(Parser_h, "public:\n"); /* MR1 */ + fprintf(Parser_h, "\tstatic const ANTLRChar *tokenName(int tk);\n");/* MR1 */ + fprintf(Parser_h, "\tenum { SET_SIZE = %i };\n",TokenNum-1); /* MR21 */ + fprintf(Parser_h, "protected:\n"); + fprintf(Parser_h, "\tstatic const ANTLRChar *_token_tbl[];\n"); /* MR20 */ + fprintf(Parser_h, "private:\n"); +} + +/* Currently, this is only used in !GenCC mode */ +void +#ifdef __USE_PROTOS +GenErrHdr( void ) +#else +GenErrHdr( ) +#endif +{ + int i, j; + TermEntry *te; + + fprintf(ErrFile, "/*\n"); + fprintf(ErrFile, " * A n t l r S e t s / E r r o r F i l e H e a d e r\n"); + fprintf(ErrFile, " *\n"); + fprintf(ErrFile, " * Generated from:"); + for (i=0; i<NumFiles; i++) fprintf(ErrFile, " %s", FileStr[i]); + fprintf(ErrFile, "\n"); + fprintf(ErrFile, " *\n"); + fprintf(ErrFile, " * Terence Parr, Russell Quong, Will Cohen, and Hank Dietz: 1989-2001\n"); + fprintf(ErrFile, " * Parr Research Corporation\n"); + fprintf(ErrFile, " * with Purdue University Electrical Engineering\n"); + fprintf(ErrFile, " * With AHPCRC, University of Minnesota\n"); + fprintf(ErrFile, " * ANTLR Version %s\n", Version); + fprintf(ErrFile, " */\n\n"); + + if ( FirstAction != NULL ) dumpAction( FirstAction, ErrFile, 0, -1, 0, 1); /* MR11 MR15b */ + + fprintf(ErrFile, "#define ANTLR_VERSION %s\n", VersionDef); + + fprintf(ErrFile, "#include \"pcctscfg.h\"\n"); + fprintf(ErrFile, "#include \"pccts_stdio.h\"\n"); + if ( strcmp(ParserName, DefaultParserName)!=0 ) + fprintf(ErrFile, "#define %s %s\n", DefaultParserName, ParserName); + if ( strcmp(ParserName, DefaultParserName)!=0 ) + fprintf(ErrFile, "#include \"%s\"\n", RemapFileName); + if ( HdrAction != NULL ) dumpAction( HdrAction, ErrFile, 0, -1, 0, 1 ); + if ( FoundGuessBlk ) + { + fprintf(ErrFile, "#define ZZCAN_GUESS\n"); + fprintf(ErrFile, "#include \"pccts_setjmp.h\"\n"); + } + if (TraceGen) { + fprintf(ErrFile,"#ifndef zzTRACE_RULES\n"); /* MR20 */ + fprintf(ErrFile,"#define zzTRACE_RULES\n"); /* MR20 */ + fprintf(ErrFile,"#endif\n"); /* MR22 */ + }; + + if ( OutputLL_k > 1 ) fprintf(ErrFile, "#define LL_K %d\n", OutputLL_k); +#ifdef DUM + if ( LexGen ) fprintf(ErrFile, "#define zzEOF_TOKEN %d\n", (TokenInd!=NULL?TokenInd[EofToken]:EofToken)); +#endif + fprintf(ErrFile, "#define zzSET_SIZE %d\n", NumWords(TokenNum-1)*sizeof(unsigned)); + if ( DemandLookahead ) fprintf(ErrFile, "#define DEMAND_LOOK\n"); + fprintf(ErrFile, "#include \"antlr.h\"\n"); + if ( GenAST ) fprintf(ErrFile, "#include \"ast.h\"\n"); + + if ( UserDefdTokens ) fprintf(ErrFile, "#include %s\n", UserTokenDefsFile); + /* still need this one as it has the func prototypes */ + fprintf(ErrFile, "#include \"%s\"\n", DefFileName); + fprintf(ErrFile, "#include \"dlgdef.h\"\n"); + fprintf(ErrFile, "#include \"err.h\"\n\n"); + + /* Dump a zztokens for each automaton */ + if ( strcmp(ParserName, DefaultParserName)!=0 ) + { + fprintf(ErrFile, "ANTLRChar *%s_zztokens[%d]={\n", ParserName, TokenNum-1); + } + else + { + fprintf(ErrFile, "ANTLRChar *zztokens[%d]={\n", TokenNum-1); + } + fprintf(ErrFile, "\t/* 00 */\t\"Invalid\""); + for (i=1; i<TokenNum-1; i++) + { + DAWDLE; + if ( i == EpToken ) continue; + /* remapped to invalid token? */ + if ( TokenInd!=NULL && TokenInd[i]>=LastTokenCounted ) + { + fprintf(ErrFile, ",\n\t/* %02d */\t\"invalid\"", i); + continue; + } + if ( TokenString(i) != NULL ) { + te=(TermEntry *) hash_get(Tname,TokenString(i)); /* MR11 */ + if (te == NULL || te->akaString == NULL) { /* MR11 */ + fprintf(ErrFile, ",\n\t/* %02d */\t\"%s\"", i, TokenString(i)); + } else { + fprintf(ErrFile, ",\n\t/* %02d */\t\"%s\"", i, te->akaString); /* MR11 */ + } + } + else + { + /* look in all lexclasses for the reg expr */ + for (j=0; j<NumLexClasses; j++) + { + lexmode(j); + if ( ExprString(i) != NULL ) + { + fprintf(ErrFile, ",\n\t/* %02d */\t", i); + dumpExpr(ErrFile, ExprString(i)); + break; + } + } + if ( j>=NumLexClasses ) + { + if ( UserDefdTokens ) + { + fprintf(ErrFile, ",\n\t/* %02d */\t\"\"", i); + } + else + fatal_internal(eMsgd("No label or expr for token %d",i)); + } + } + } + fprintf(ErrFile, "\n};\n"); +} + +void +#ifdef __USE_PROTOS +dumpExpr( FILE *f, char *e ) +#else +dumpExpr( f, e ) +FILE *f; +char *e; +#endif +{ + while ( *e!='\0' ) + { + if ( *e=='\\' && *(e+1)=='\\' ) + {putc('\\', f); putc('\\', f); e+=2;} + else if ( *e=='\\' && *(e+1)=='"' ) + {putc('\\', f); putc('"', f); e+=2;} + else if ( *e=='\\' ) {putc('\\', f); putc('\\', f); e++;} + else {putc(*e, f); e++;} + } +} + +int +#ifdef __USE_PROTOS +isTermEntryTokClass(TermEntry *te) +#else +isTermEntryTokClass(te) +TermEntry *te; +#endif +{ + ListNode *t; + TCnode *p; + TermEntry *q; + char *tokstr; + + if (tclasses == NULL) return 0; + + for (t = tclasses->next; t!=NULL; t=t->next) + { + p = (TCnode *) t->elem; + tokstr = TokenString(p->tok); + lexmode(p->lexclass); /* switch to lexclass where tokclass is defined */ + q = (TermEntry *) hash_get(Tname, tokstr); + if (q == te) return 1; + } + return 0; +} diff --git a/pccts/antlr/build.c b/pccts/antlr/build.c new file mode 100644 index 0000000..8b198c9 --- /dev/null +++ b/pccts/antlr/build.c @@ -0,0 +1,813 @@ +/* + * build.c -- functions associated with building syntax diagrams. + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2001 + */ + +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> +#include "pcctscfg.h" +#include "set.h" +#include "syn.h" +#include "hash.h" +#include "generic.h" +#include "dlgdef.h" + +#define SetBlk(g, t, approx, first_set_symbol) { \ + ((Junction *)g.left)->jtype = t; \ + ((Junction *)g.left)->approx = approx; \ + ((Junction *)g.left)->pFirstSetSymbol = first_set_symbol; \ + ((Junction *)g.left)->end = (Junction *) g.right; \ + ((Junction *)g.right)->jtype = EndBlk;} + +/* Add the parameter string 'parm' to the parms field of a block-type junction + * g.left points to the sentinel node on a block. i.e. g.left->p1 points to + * the actual junction with its jtype == some block-type. + */ +void +#ifdef __USE_PROTOS +addParm( Node *p, char *parm ) +#else +addParm( p, parm ) +Node *p; +char *parm; +#endif +{ + char *q = (char *) malloc( strlen(parm) + 1 ); + require(p!=NULL, "addParm: NULL object\n"); + require(q!=NULL, "addParm: unable to alloc parameter\n"); + + strcpy(q, parm); + if ( p->ntype == nRuleRef ) + { + ((RuleRefNode *)p)->parms = q; + } + else if ( p->ntype == nJunction ) + { + ((Junction *)p)->parm = q; /* only one parameter allowed on subrules */ + } + else fatal_internal("addParm: invalid node for adding parm"); +} + +/* + * Build an action node for the syntax diagram + * + * buildAction(ACTION) ::= --o-->ACTION-->o-- + * + * Where o is a junction node. + */ +Graph +#ifdef __USE_PROTOS +buildAction( char *action, int file, int line, int is_predicate ) +#else +buildAction( action, file, line, is_predicate ) +char *action; +int file; +int line; +int is_predicate; +#endif +{ + Junction *j1, *j2; + Graph g; + ActionNode *a; + require(action!=NULL, "buildAction: invalid action"); + + j1 = newJunction(); + j2 = newJunction(); + a = newActionNode(); + a->action = (char *) malloc( strlen(action)+1 ); + require(a->action!=NULL, "buildAction: cannot alloc space for action\n"); + strcpy(a->action, action); + j1->p1 = (Node *) a; + a->next = (Node *) j2; + a->is_predicate = is_predicate; + + if (is_predicate) { + PredEntry *predEntry; + char *t; + char *key; + char *u; + int inverted=0; + + t=key=(char *)calloc(1,strlen(a->action)+1); + + for (u=a->action; *u != '\0' ; u++) { + if (*u != ' ') { + if (t==key && *u=='!') { + inverted=!inverted; + } else { + *t++=*u; + }; + }; + }; + + *t='\0'; + + + predEntry=(PredEntry *)hash_get(Pname,key); + a->predEntry=predEntry; + if (predEntry != NULL) a->inverted=inverted; + } else { +/* MR12c */ char *strStart=a->action; +/* MR12c */ char *strEnd; +/* MR12c */ strEnd=strStart+strlen(strStart)-1; +/* MR12c */ for ( ; strEnd >= strStart && isspace(*strEnd); strEnd--) *strEnd=0; +/* MR12c */ while (*strStart != '\0' && isspace(*strStart)) strStart++; +/* MR12c */ if (ci_strequ(strStart,"nohoist")) { +/* MR12c */ a->noHoist=1; +/* MR12c */ } + } + + g.left = (Node *) j1; g.right = (Node *) j2; + a->file = file; + a->line = line; + a->rname = CurRule; /* MR10 */ + return g; +} + +/* + * Build a token node for the syntax diagram + * + * buildToken(TOKEN) ::= --o-->TOKEN-->o-- + * + * Where o is a junction node. + */ +Graph +#ifdef __USE_PROTOS +buildToken( char *text ) +#else +buildToken( text ) +char *text; +#endif +{ + Junction *j1, *j2; + Graph g; + TokNode *t; + require(text!=NULL, "buildToken: invalid token name"); + + j1 = newJunction(); + j2 = newJunction(); + t = newTokNode(); + t->altstart = CurAltStart; + if ( *text == '"' ) {t->label=FALSE; t->token = addTexpr( text );} + else {t->label=TRUE; t->token = addTname( text );} + j1->p1 = (Node *) t; + t->next = (Node *) j2; + g.left = (Node *) j1; g.right = (Node *) j2; + return g; +} + +/* + * Build a wild-card node for the syntax diagram + * + * buildToken(TOKEN) ::= --o-->'.'-->o-- + * + * Where o is a junction node. + */ +Graph +#ifdef __USE_PROTOS +buildWildCard( char *text ) +#else +buildWildCard( text ) +char *text; +#endif +{ + Junction *j1, *j2; + Graph g; + TokNode *t; + TCnode *w; + TermEntry *p; + require(text!=NULL, "buildWildCard: invalid token name"); + + j1 = newJunction(); + j2 = newJunction(); + t = newTokNode(); + + /* If the ref a wild card, make a token class for it */ + if ( Tnum(WildCardString) == 0 ) + { + w = newTCnode; + w->tok = addTname( WildCardString ); + set_orel(w->tok, &imag_tokens); + set_orel(w->tok, &tokclasses); + WildCardToken = w->tok; + require((p=(TermEntry *)hash_get(Tname, WildCardString)) != NULL, + "hash table mechanism is broken"); + p->classname = 1; /* entry is class name, not token */ + p->tclass = w; /* save ptr to this tclass def */ + list_add(&tclasses, (char *)w); + } + else { + p=(TermEntry *)hash_get(Tname, WildCardString); + require( p!= NULL, "hash table mechanism is broken"); + w = p->tclass; + } + + t->token = w->tok; + t->wild_card = 1; + t->tclass = w; + + t->altstart = CurAltStart; + j1->p1 = (Node *) t; + t->next = (Node *) j2; + g.left = (Node *) j1; g.right = (Node *) j2; + return g; +} + +void +#ifdef __USE_PROTOS +setUpperRange(TokNode *t, char *text) +#else +setUpperRange(t, text) +TokNode *t; +char *text; +#endif +{ + require(t!=NULL, "setUpperRange: NULL token node"); + require(text!=NULL, "setUpperRange: NULL token string"); + + if ( *text == '"' ) {t->upper_range = addTexpr( text );} + else {t->upper_range = addTname( text );} +} + +/* + * Build a rule reference node of the syntax diagram + * + * buildRuleRef(RULE) ::= --o-->RULE-->o-- + * + * Where o is a junction node. + * + * If rule 'text' has been defined already, don't alloc new space to store string. + * Set r->text to point to old copy in string table. + */ +Graph +#ifdef __USE_PROTOS +buildRuleRef( char *text ) +#else +buildRuleRef( text ) +char *text; +#endif +{ + Junction *j1, *j2; + Graph g; + RuleRefNode *r; + RuleEntry *p; + require(text!=NULL, "buildRuleRef: invalid rule name"); + + j1 = newJunction(); + j2 = newJunction(); + r = newRNode(); + r->altstart = CurAltStart; + r->assign = NULL; + if ( (p=(RuleEntry *)hash_get(Rname, text)) != NULL ) r->text = p->str; + else r->text = mystrdup( text ); + j1->p1 = (Node *) r; + r->next = (Node *) j2; + g.left = (Node *) j1; g.right = (Node *) j2; + return g; +} + +/* + * Or two subgraphs into one graph via: + * + * Or(G1, G2) ::= --o-G1-o-- + * | ^ + * v | + * o-G2-o + * + * Set the altnum of junction starting G2 to 1 + altnum of junction starting G1. + * If, however, the G1 altnum is 0, make it 1 and then + * make G2 altnum = G1 altnum + 1. + */ +Graph +#ifdef __USE_PROTOS +Or( Graph g1, Graph g2 ) +#else +Or( g1, g2 ) +Graph g1; +Graph g2; +#endif +{ + Graph g; + require(g1.left != NULL, "Or: invalid graph"); + require(g2.left != NULL && g2.right != NULL, "Or: invalid graph"); + + ((Junction *)g1.left)->p2 = g2.left; + ((Junction *)g2.right)->p1 = g1.right; + /* set altnums */ + if ( ((Junction *)g1.left)->altnum == 0 ) ((Junction *)g1.left)->altnum = 1; + ((Junction *)g2.left)->altnum = ((Junction *)g1.left)->altnum + 1; + g.left = g2.left; + g.right = g1.right; + return g; +} + +/* + * Catenate two subgraphs + * + * Cat(G1, G2) ::= --o-G1-o-->o-G2-o-- + * Cat(NULL,G2)::= --o-G2-o-- + * Cat(G1,NULL)::= --o-G1-o-- + */ +Graph +#ifdef __USE_PROTOS +Cat( Graph g1, Graph g2 ) +#else +Cat( g1, g2 ) +Graph g1; +Graph g2; +#endif +{ + Graph g; + + if ( g1.left == NULL && g1.right == NULL ) return g2; + if ( g2.left == NULL && g2.right == NULL ) return g1; + ((Junction *)g1.right)->p1 = g2.left; + g.left = g1.left; + g.right = g2.right; + return g; +} + +/* + * Make a subgraph an optional block + * + * makeOpt(G) ::= --o-->o-G-o-->o-- + * | ^ + * v | + * o-------o + * + * Note that this constructs {A|B|...|Z} as if (A|B|...|Z|) was found. + * + * The node on the far right is added so that every block owns its own + * EndBlk node. + */ +Graph +#ifdef __USE_PROTOS +makeOpt( Graph g1, int approx, char * pFirstSetSymbol ) +#else +makeOpt( g1, approx, pFirstSetSymbol ) +Graph g1; +int approx; +char * pFirstSetSymbol; +#endif +{ + Junction *j1,*j2,*p; + Graph g; + require(g1.left != NULL && g1.right != NULL, "makeOpt: invalid graph"); + + j1 = newJunction(); + j2 = newJunction(); + ((Junction *)g1.right)->p1 = (Node *) j2; /* add node to G at end */ + + /* MR21 + * + * There is code in genBlk which recognizes the node created + * by emptyAlt() as a special case and bypasses it. We don't + * want this to happen for the optBlk. + */ + + g = emptyAlt3(); /* MR21 */ + if ( ((Junction *)g1.left)->altnum == 0 ) ((Junction *)g1.left)->altnum = 1; + ((Junction *)g.left)->altnum = ((Junction *)g1.left)->altnum + 1; + for(p=(Junction *)g1.left; p->p2!=NULL; p=(Junction *)p->p2) + {;} /* find last alt */ + p->p2 = g.left; /* add optional alternative */ + ((Junction *)g.right)->p1 = (Node *)j2; /* opt alt points to EndBlk */ + g1.right = (Node *)j2; + SetBlk(g1, aOptBlk, approx, pFirstSetSymbol); + j1->p1 = g1.left; /* add generic node in front */ + g.left = (Node *) j1; + g.right = g1.right; + return g; +} + +/* + * Make a graph into subblock + * + * makeBlk(G) ::= --o-->o-G-o-->o-- + * + * The node on the far right is added so that every block owns its own + * EndBlk node. + */ +Graph +#ifdef __USE_PROTOS +makeBlk( Graph g1, int approx, char * pFirstSetSymbol ) +#else +makeBlk( g1, approx, pFirstSetSymbol ) +Graph g1; +int approx; +char * pFirstSetSymbol; +#endif +{ + Junction *j,*j2; + Graph g; + require(g1.left != NULL && g1.right != NULL, "makeBlk: invalid graph"); + + j = newJunction(); + j2 = newJunction(); + ((Junction *)g1.right)->p1 = (Node *) j2; /* add node to G at end */ + g1.right = (Node *)j2; + SetBlk(g1, aSubBlk, approx, pFirstSetSymbol); + j->p1 = g1.left; /* add node in front */ + g.left = (Node *) j; + g.right = g1.right; + + return g; +} + +/* + * Make a subgraph into a loop (closure) block -- (...)* + * + * makeLoop(G) ::= |---| + * v | + * --o-->o-->o-G-o-->o-- + * | ^ + * v | + * o-----------o + * + * After making loop, always place generic node out front. It becomes + * the start of enclosing block. The aLoopBlk is the target of the loop. + * + * Loop blks have TWO EndBlk nodes--the far right and the node that loops back + * to the aLoopBlk node. Node with which we can branch past loop == aLoopBegin and + * one which is loop target == aLoopBlk. + * The branch-past (initial) aLoopBegin node has end + * pointing to the last EndBlk node. The loop-target node has end==NULL. + * + * Loop blocks have a set of locks (from 1..CLL_k) on the aLoopBlk node. + */ +Graph +#ifdef __USE_PROTOS +makeLoop( Graph g1, int approx, char * pFirstSetSymbol ) +#else +makeLoop( g1, approx, pFirstSetSymbol) +Graph g1; +int approx; +char * pFirstSetSymbol; +#endif +{ + Junction *back, *front, *begin; + Graph g; + require(g1.left != NULL && g1.right != NULL, "makeLoop: invalid graph"); + + back = newJunction(); + front = newJunction(); + begin = newJunction(); + g = emptyAlt3(); + ((Junction *)g1.right)->p2 = g1.left; /* add loop branch to G */ + ((Junction *)g1.right)->p1 = (Node *) back; /* add node to G at end */ + ((Junction *)g1.right)->jtype = EndBlk; /* mark 1st EndBlk node */ + ((Junction *)g1.left)->jtype = aLoopBlk; /* mark 2nd aLoopBlk node */ + ((Junction *)g1.left)->end = (Junction *) g1.right; + ((Junction *)g1.left)->lock = makelocks(); + ((Junction *)g1.left)->pred_lock = makelocks(); + g1.right = (Node *) back; + begin->p1 = (Node *) g1.left; + g1.left = (Node *) begin; + begin->p2 = (Node *) g.left; /* make bypass arc */ + ((Junction *)g.right)->p1 = (Node *) back; + SetBlk(g1, aLoopBegin, approx, pFirstSetSymbol); + front->p1 = g1.left; /* add node to front */ + g1.left = (Node *) front; + + return g1; +} + +/* + * Make a subgraph into a plus block -- (...)+ -- 1 or more times + * + * makePlus(G) ::= |---| + * v | + * --o-->o-G-o-->o-- + * + * After making loop, always place generic node out front. It becomes + * the start of enclosing block. The aPlusBlk is the target of the loop. + * + * Plus blks have TWO EndBlk nodes--the far right and the node that loops back + * to the aPlusBlk node. + * + * Plus blocks have a set of locks (from 1..CLL_k) on the aPlusBlk node. + */ +Graph +#ifdef __USE_PROTOS +makePlus( Graph g1, int approx, char * pFirstSetSymbol) +#else +makePlus( g1, approx, pFirstSetSymbol) +Graph g1; +int approx; +char * pFirstSetSymbol; +#endif +{ + int has_empty_alt_already = 0; + Graph g; + Junction *j2, *j3, *first_alt; + Junction *last_alt=NULL, *p; + require(g1.left != NULL && g1.right != NULL, "makePlus: invalid graph"); + + first_alt = (Junction *)g1.left; + j2 = newJunction(); + j3 = newJunction(); + if ( ((Junction *)g1.left)->altnum == 0 ) ((Junction *)g1.left)->altnum = 1; + ((Junction *)g1.right)->p2 = g1.left; /* add loop branch to G */ + ((Junction *)g1.right)->p1 = (Node *) j2; /* add node to G at end */ + ((Junction *)g1.right)->jtype = EndBlk; /* mark 1st EndBlk node */ + g1.right = (Node *) j2; + SetBlk(g1, aPlusBlk, approx, pFirstSetSymbol); + ((Junction *)g1.left)->lock = makelocks(); + ((Junction *)g1.left)->pred_lock = makelocks(); + j3->p1 = g1.left; /* add node to front */ + g1.left = (Node *) j3; + + /* add an optional branch which is the "exit" branch of loop */ + /* FIRST, check to ensure that there does not already exist + * an optional path. + */ + /* find last alt */ + for(p=first_alt; p!=NULL; p=(Junction *)p->p2) + { + if ( p->p1->ntype == nJunction && + p->p1!=NULL && + ((Junction *)p->p1)->jtype==Generic && + ((Junction *)p->p1)->p1!=NULL && + ((Junction *)((Junction *)p->p1)->p1)->jtype==EndBlk ) + { + has_empty_alt_already = 1; + } + last_alt = p; + } + if ( !has_empty_alt_already ) + { + require(last_alt!=NULL, "last_alt==NULL; bad (..)+"); + g = emptyAlt(); + last_alt->p2 = g.left; + ((Junction *)g.right)->p1 = (Node *) j2; + + /* make sure lookahead computation ignores this alt for + * FIRST("(..)+"); but it's still used for computing the FIRST + * of each alternative. + */ + ((Junction *)g.left)->ignore = 1; + } + + return g1; +} + +/* + * Return an optional path: --o-->o-- + */ + +Graph +#ifdef __USE_PROTOS +emptyAlt( void ) +#else +emptyAlt( ) +#endif +{ + Junction *j1, *j2; + Graph g; + + j1 = newJunction(); + j2 = newJunction(); + j1->p1 = (Node *) j2; + g.left = (Node *) j1; + g.right = (Node *) j2; + + return g; +} + +/* MR21 + * + * There is code in genBlk which recognizes the node created + * by emptyAlt() as a special case and bypasses it. We don't + * want this to happen for the optBlk. + */ + +Graph +#ifdef __USE_PROTOS +emptyAlt3( void ) +#else +emptyAlt3( ) +#endif +{ + Junction *j1, *j2, *j3; + Graph g; + + j1 = newJunction(); + j2 = newJunction(); + j3 = newJunction(); + j1->p1 = (Node *) j2; + j2->p1 = (Node *) j3; + g.left = (Node *) j1; + g.right = (Node *) j3; + + return g; +} + +/* N o d e A l l o c a t i o n */ + +TokNode * +#ifdef __USE_PROTOS +newTokNode( void ) +#else +newTokNode( ) +#endif +{ + static TokNode *FreeList = NULL; + TokNode *p, *newblk; + + if ( FreeList == NULL ) + { + newblk = (TokNode *)calloc(TokenBlockAllocSize, sizeof(TokNode)); + if ( newblk == NULL ) + fatal_internal(eMsg1("out of memory while building rule '%s'",CurRule)); + for (p=newblk; p<&(newblk[TokenBlockAllocSize]); p++) + { + p->next = (Node *)FreeList; /* add all new token nodes to FreeList */ + FreeList = p; + } + } + p = FreeList; + FreeList = (TokNode *)FreeList->next;/* remove a TokNode node */ + p->next = NULL; /* NULL the ptr we used */ + memset( (char *) p, 0, sizeof(TokNode)); /* MR10 */ + p->ntype = nToken; + p->rname = CurRule; + p->file = CurFile; + p->line = zzline; + p->altstart = NULL; + + return p; +} + +RuleRefNode * +#ifdef __USE_PROTOS +newRNode( void ) +#else +newRNode( ) +#endif +{ + static RuleRefNode *FreeList = NULL; + RuleRefNode *p, *newblk; + + if ( FreeList == NULL ) + { + newblk = (RuleRefNode *)calloc(RRefBlockAllocSize, sizeof(RuleRefNode)); + if ( newblk == NULL ) + fatal_internal(eMsg1("out of memory while building rule '%s'",CurRule)); + for (p=newblk; p<&(newblk[RRefBlockAllocSize]); p++) + { + p->next = (Node *)FreeList; /* add all new rref nodes to FreeList */ + FreeList = p; + } + } + p = FreeList; + FreeList = (RuleRefNode *)FreeList->next;/* remove a Junction node */ + p->next = NULL; /* NULL the ptr we used */ + memset( (char *) p, 0, sizeof(RuleRefNode)); /* MR10 */ + p->ntype = nRuleRef; + p->rname = CurRule; + p->file = CurFile; + p->line = zzline; + p->astnode = ASTinclude; + p->altstart = NULL; + + return p; +} + +static int junctionSeqNumber=0; /* MR10 */ + +Junction * +#ifdef __USE_PROTOS +newJunction( void ) +#else +newJunction( ) +#endif +{ + static Junction *FreeList = NULL; + Junction *p, *newblk; + + if ( FreeList == NULL ) + { + newblk = (Junction *)calloc(JunctionBlockAllocSize, sizeof(Junction)); + if ( newblk == NULL ) + fatal_internal(eMsg1("out of memory while building rule '%s'",CurRule)); + for (p=newblk; p<&(newblk[JunctionBlockAllocSize]); p++) + { + p->p1 = (Node *)FreeList; /* add all new Junction nodes to FreeList */ + FreeList = p; + } + } + p = FreeList; + FreeList = (Junction *)FreeList->p1;/* remove a Junction node */ + p->p1 = NULL; /* NULL the ptr we used */ + memset( (char *) p, 0, sizeof(Junction)); /* MR10 */ + p->ntype = nJunction; + p->visited = 0; + p->jtype = Generic; + p->rname = CurRule; + p->file = CurFile; + p->line = zzline; + p->exception_label = NULL; + p->fset = (set *) calloc(CLL_k+1, sizeof(set)); + require(p->fset!=NULL, "cannot allocate fset in newJunction"); + p->seq=++junctionSeqNumber; /* MR10 */ + + return p; +} + +ActionNode * +#ifdef __USE_PROTOS +newActionNode( void ) +#else +newActionNode( ) +#endif +{ + static ActionNode *FreeList = NULL; + ActionNode *p, *newblk; + + if ( FreeList == NULL ) + { + newblk = (ActionNode *)calloc(ActionBlockAllocSize, sizeof(ActionNode)); + if ( newblk == NULL ) + fatal_internal(eMsg1("out of memory while building rule '%s'",CurRule)); + for (p=newblk; p<&(newblk[ActionBlockAllocSize]); p++) + { + p->next = (Node *)FreeList; /* add all new Action nodes to FreeList */ + FreeList = p; + } + } + p = FreeList; + FreeList = (ActionNode *)FreeList->next;/* remove an Action node */ + memset( (char *) p, 0, sizeof(ActionNode)); /* MR10 */ + p->ntype = nAction; + p->next = NULL; /* NULL the ptr we used */ + p->done = 0; + p->pred_fail = NULL; + p->guardpred = NULL; + p->ampersandPred = NULL; + return p; +} + +/* + * allocate the array of locks (1..CLL_k) used to inhibit infinite recursion. + * Infinite recursion can occur in (..)* blocks, FIRST calcs and FOLLOW calcs. + * Therefore, we need locks on aLoopBlk, RuleBlk, EndRule nodes. + * + * if ( lock[k]==TRUE ) then we have been here before looking for k tokens + * of lookahead. + */ +char * +#ifdef __USE_PROTOS +makelocks( void ) +#else +makelocks( ) +#endif +{ + char *p = (char *) calloc(CLL_k+1, sizeof(char)); + require(p!=NULL, "cannot allocate lock array"); + + return p; +} + +#if 0 +** #ifdef __USE_PROTOS +** void my_memset(char *p,char value,int count) +** #else +** void my_memset(p,value,count) +** char *p; +** char value; +** int count; +** #endif +** { +** int i; +** +** for (i=0; i<count; i++) { +** p[i]=value; +** }; +** } +#endif diff --git a/pccts/antlr/dumpcycles.c b/pccts/antlr/dumpcycles.c new file mode 100644 index 0000000..dbdca8d --- /dev/null +++ b/pccts/antlr/dumpcycles.c @@ -0,0 +1,67 @@ +#include <stdio.h> +#include <ctype.h> + +#include "set.h" +#include "syn.h" +#include "hash.h" +#include "generic.h" + +void +#ifdef __USE_PROTOS +dumpcycles(void) +#else +dumpcycles() +#endif +{ + Cycle *c; + CacheEntry *f; + ListNode *p; + int i=0; + int k; + int degree; + + for (k=1; k <= CLL_k; k++) { + if (Cycles[k] == NULL) continue; + + for (p = Cycles[k]->next; p!=NULL; p=p->next) { + c = (Cycle *) p->elem; + degree=set_deg(c->cyclicDep); + fprintf(stderr,"Cycle %d: (degree %d) %s -->\n", i++, degree, RulePtr[c->croot]->rname); + fprintf(stderr," *self*\n"); + MR_dumpRuleSet(c->cyclicDep); + fprintf(stderr,"\n"); + f = (CacheEntry *) + hash_get(Fcache,Fkey(RulePtr[c->croot]->rname,'o',k)); + if (f == NULL) { + fprintf(stderr," *** FOLLOW(%s) must be in cache but isn't ***\n", + RulePtr[c->croot]->rname); + }; + }; + }; +} + +void +#ifdef __USE_PROTOS +dumpfostack(int k) +#else +dumpfostack(k) +int k; +#endif +{ + int i=0; + int *pi; + + fprintf(stderr,"\n"); + if (FoStack[k] == NULL) { + fprintf(stderr,"FoStack[%d] is null\n",k); + }; + if (FoTOS[k] == NULL) { + fprintf(stderr,"FoTOS[%d] is null\n",k); + } + if (FoTOS[k] != NULL && FoStack[k] != NULL) { + for (pi=FoStack[k]; pi <= FoTOS[k]; pi++) { + i++; + fprintf(stderr,"#%d rule %d %s\n",i,*pi,RulePtr[*pi]->rname); + } + } +} diff --git a/pccts/antlr/dumpnode.c b/pccts/antlr/dumpnode.c new file mode 100644 index 0000000..c657747 --- /dev/null +++ b/pccts/antlr/dumpnode.c @@ -0,0 +1,423 @@ +#include <stdio.h> +#include <ctype.h> + +#include "set.h" +#include "syn.h" +#include "hash.h" +#include "generic.h" + +#ifdef __USE_PROTOS +void dumpset1(set s) +#else +void dumpset1(s) + set s; +#endif +{ + if (set_nil(s)) { + fprintf(stderr,"{}"); + } else { + s_fprT(stderr,s); + }; +} + +#ifdef __USE_PROTOS +void dumpset(set s) +#else +void dumpset(s) + set s; +#endif +{ + dumpset1(s); + fprintf(stderr,"\n"); +} + +#ifdef __USE_PROTOS +int isEndRule(Node * p) +#else +int isEndRule(p) + Node * p; +#endif +{ + int result=0; + if ( p->ntype == nJunction && + ( (Junction *) p)->jtype == EndRule) { + result=1; + }; + return result; +} + +#ifdef __USE_PROTOS +void dumppred1(int depth,Predicate *p) +#else +void dumppred1(depth,p) + int depth; + Predicate *p; +#endif +{ + int i; + int k; + + for (i=0; i<depth ; i++) { + fprintf(stderr," "); + }; + if (p->expr == PRED_AND_LIST || + p->expr == PRED_OR_LIST) { + fprintf(stderr," %s", (p->expr == NULL ? "null expr" : p->expr)); + if (p->inverted) fprintf(stderr," predicate inverted !"); + if (p->redundant) { + fprintf(stderr," Redundant!"); + }; + if (p->isConst) fprintf(stderr," const %d !",p->constValue); + fprintf(stderr,"\n"); + } else { + fprintf(stderr,"predicate k=%d",p->k); + k=set_int(p->completionSet); + if (k >= 0) { + fprintf(stderr," Incomplete Set=%d !",k); + }; + k=set_int(p->completionTree); + if (k >= 0) { + fprintf(stderr," Incomplete Tree=%d !",k); + }; + if (p->redundant) { + fprintf(stderr," Redundant!"); + }; + fprintf(stderr," \"%s\" (%x)", (p->expr == NULL ? "null expr" : p->expr) ,(unsigned)p); + if (p->source != NULL) { + fprintf(stderr,"line %d",p->source->line); + }; + if (p->inverted) fprintf(stderr," predicate inverted !"); + fprintf(stderr,"\n"); + for (i=0; i<depth ; i++) { + fprintf(stderr," "); + }; + fprintf(stderr,"scontext: "); + dumpset(p->scontext[1]); + for (i=0; i<depth ; i++) { + fprintf(stderr," "); + }; + fprintf(stderr,"tcontext: "); + preorder(p->tcontext); + fprintf(stderr,"\n"); + }; + fprintf(stderr,"\n"); + if (p->down != NULL) { + dumppred1(depth+1,p->down); + }; + if (p->right != NULL) { + dumppred1(depth,p->right); + }; +} + +#ifdef __USE_PROTOS +void dumppred(Predicate *p) +#else +void dumppred(p) + Predicate *p; +#endif +{ + fprintf(stderr,"---------------------------------\n"); + dumppred1(0,p); + fprintf(stderr,"\n"); +} + +#ifdef __USE_PROTOS +void dumppredtree(Predicate *p) +#else +void dumppredtree(p) + Predicate *p; +#endif +{ + fprintf(stderr,"predicate k=%d \"%s\" line %d\n",p->k,p->expr,p->source->line); + dumpset(p->scontext[1]); +} + +#ifdef __USE_PROTOS +void dumppredexpr(Predicate *p) +#else +void dumppredexpr(p) + Predicate *p; +#endif +{ + fprintf(stderr," pred expr \"%s\"\n",p->expr); +} + +#ifdef __USE_PROTOS +void dt(Tree *t) +#else +void dt(t) + Tree *t; +#endif +{ + MR_dumpTreeF(stderr,0,t,5); +} + +#ifdef __USE_PROTOS +void d(Node * p) +#else +void d(p) + Node * p; +#endif +{ + + Junction *j; + RuleRefNode *r; + TokNode *t; + ActionNode *a; + + if (p==NULL) { + fprintf(stderr,"dumpNode: Node is NULL"); + return; + }; + + switch (p->ntype) { + case nJunction : + j = (Junction *) p; + fprintf(stderr, "Junction (#%d in rule %s line %d) ",j->seq,j->rname,j->line); + if (j->guess) fprintf(stderr,"guess block "); + switch (j->jtype ) { + case aSubBlk : + fprintf(stderr,"aSubBlk"); + break; + case aOptBlk : + fprintf(stderr,"aOptBlk"); + break; + case aLoopBegin : + fprintf(stderr,"aLoopBeginBlk"); + break; + case aLoopBlk : + fprintf(stderr,"aLoopBlk"); + break; + case aPlusBlk : + fprintf(stderr,"aPlusBlk"); + break; + case EndBlk : + fprintf(stderr,"EndBlk"); + break; + case RuleBlk : + fprintf(stderr,"RuleBlk"); + break; + case Generic : + fprintf(stderr,"Generic"); + break; + case EndRule : + fprintf(stderr,"EndRule"); + break; + }; + if (j->halt) fprintf(stderr," halt!"); + if (j->p1) fprintf(stderr," p1 valid"); + if (j->p2) { + if (j->p2->ntype == nJunction) { + fprintf(stderr," (p2=#%d)",( (Junction *) j->p2)->seq); + } else { + fprintf(stderr," (p2 valid)"); + }; + }; + if (j->ignore) fprintf(stderr, " ignore/plus-block-bypass"); + if (j->fset != NULL && set_deg(*j->fset) != 0) { + fprintf(stderr,"\nfset:\n"); + dumpset(*j->fset); + }; + if (j->ftree != NULL) { + fprintf(stderr,"\nftree:\n"); + preorder(j->ftree); + }; + fprintf(stderr,"\n"); + break; + case nRuleRef : + r = (RuleRefNode *) p; + fprintf(stderr, "RuleRefNode (in rule %s line %d) to rule %s\n", r->rname,r->line,r->text); + break; + case nToken : + t = (TokNode *) p; + fprintf(stderr, "TokNode (in rule %s line %d) token %s\n",t->rname,t->line,TerminalString(t->token)); + break; + case nAction : + a =(ActionNode *) p; + if (a->is_predicate) { + fprintf(stderr, "Predicate (in rule %s line %d) %s",a->rname,a->line,a->action); + if (a->inverted) fprintf(stderr," action inverted !"); + if (a->guardpred != NULL) { + fprintf(stderr," guarded"); + dumppredexpr(a->guardpred); + if (a->ampersandPred) { + fprintf(stderr," \"&&\" style"); + } else { + fprintf(stderr," \"=>\" style"); + }; + }; + if (a->predEntry != NULL) fprintf(stderr," predEntry \"%s\" ",a->predEntry->str); + fprintf(stderr,"\n"); + } else if (a->init_action) { + fprintf(stderr, "Init-Action (in rule %s line %d) %s\n",a->rname,a->line,a->action); + } else { + fprintf(stderr, "Action (in rule %s line %d) %s\n",a->rname,a->line,a->action); + }; + break; + }; +} + +#ifdef __USE_PROTOS +Node * dp1(Node * p) +#else +Node * dp1(p) + Node * p; +#endif +{ + Node *result=NULL; + + if (p->ntype == nJunction) { + result=( (Junction *) p )->p1; + d(result); + } else { + fprintf(stderr,"dp1: Not a Junction node"); + }; + return result; +} + +#ifdef __USE_PROTOS +Node * dp2(Node * p) +#else +Node * dp2(p) + Node * p; +#endif +{ + Node *result=NULL; + + if (p->ntype == nJunction) { + result=( (Junction *) p )->p2; + d(result); + } else { + fprintf(stderr,"dp2: Not a Junction node"); + }; + return result; +} + +#ifdef __USE_PROTOS +Node * dn(Node * p) +#else +Node * dn(p) + Node * p; +#endif + +{ + Node *result=NULL; + + if (p->ntype == nRuleRef) { + result=( (RuleRefNode *)p )->next; + } else if (p->ntype == nAction) { + result=( (ActionNode *)p )->next; + } else if (p->ntype == nToken) { + result=( (TokNode *)p )->next; + } else { + fprintf(stderr,"No next field: Neither a RuleRefNode, ActionNode, nor TokNode"); + }; + if (result != NULL) d(result); + return result; +} + +#ifdef __USE_PROTOS +void df(Node * p) +#else +void df(p) + Node * p; +#endif +{ + int count=0; + Node *next; + + fprintf(stderr,"\n#%d ",++count); + d(p); + + for (next=p; next != NULL && !isEndRule(next) ; ) { + fprintf(stderr,"#%d ",++count); + if (next->ntype == nJunction) { + next=dp1(next); + } else { + next=dn(next); + }; + }; +} + +#ifdef __USE_PROTOS +Node * dfn(Node * p,int target) +#else +Node * dfn(p,target) + Node * p; + int target; +#endif +{ + Node *result=NULL; + int count=0; + Node *next; + + fprintf(stderr,"#%d ",++count); + d(p); + + for (next=p; next != NULL && !isEndRule(next) ; ) { + fprintf(stderr,"#%d ",++count); + if (next->ntype == nJunction) { + next=dp1(next); + } else { + next=dn(next); + }; + if (count == target) { + result=next; + break; + }; + }; + return result; +} + + +static int findnodeMatch; + +#ifdef __USE_PROTOS +Junction *findnode1(Node *n) +#else +Junction *findnode1(n) + Node *n; +#endif +{ + Node *next; + Junction *j; + Junction *match; + + if (n == NULL) return NULL; + if (n->ntype == nJunction) { + j=(Junction *) n; + if (j->seq == findnodeMatch) return j; + if (j->jtype == EndRule) return NULL; + if (j->jtype != RuleBlk && j->jtype != EndBlk) { + if (j->p2 != NULL && !j->ignore) { + match=findnode1(j->p2); + if (match != NULL) return match; + }; + }; + }; + next=MR_advance(n); + return findnode1(next); +} + +#ifdef __USE_PROTOS +Junction *findnode(int match) +#else +Junction *findnode(match) + int match; +#endif +{ + Junction *j; + Junction *result=NULL; + + findnodeMatch=match; + + for (j=SynDiag; j != NULL; j=(Junction *)j->p2) { + require (j->ntype == nJunction && j->jtype == RuleBlk,"Not a rule block"); + result=findnode1( (Node *) j); + if (result != NULL) break; + }; + if (result != NULL) { + d( (Node *) result); + }; + return result; +} diff --git a/pccts/antlr/egman.c b/pccts/antlr/egman.c new file mode 100644 index 0000000..ba26b32 --- /dev/null +++ b/pccts/antlr/egman.c @@ -0,0 +1,328 @@ +/* + * egman.c + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33MR10 + * 2001 + * + */ + +#include <stdio.h> +#include <stdlib.h> + +#include "set.h" +#include "syn.h" +#include "hash.h" +#include "generic.h" +#include "proto.h" + +static ExceptionGroup **egArray=NULL; /* ExceptionGroup by BlkLevel */ +static LabelEntry **leArray=NULL; /* LabelEntry by BlkLevel */ +static Junction **altArray=NULL; /* start of alternates */ +static int arraySize=0; +static int highWater=0; +static ExceptionGroup *lastEG=NULL; /* used in altFixup() */ +static int lastBlkLevel=0; /* used in altFixup() */ + +#ifdef __USE_PROTOS +static void arrayCheck(void); +#else +static void arrayCheck(); +#endif + +/* Called to add an exception group for an alternative EG */ + +#ifdef __USE_PROTOS +void egAdd(ExceptionGroup * eg) +#else +void egAdd(eg) +ExceptionGroup *eg; +#endif +{ + int i; + + ExceptionGroup *nextEG; + ExceptionGroup *innerEG; + + LabelEntry *nextLE; + LabelEntry *innerLE; + + Junction *nextAlt; + Junction *innerAlt; + + lastEG=eg; + lastBlkLevel=BlkLevel; + + arrayCheck(); + eg->pendingLink=egArray[BlkLevel]; + egArray[BlkLevel]=eg; + + /* EG for alternates already have their altID filled in */ + + for (i=BlkLevel+1; i<=highWater ; i++) { + for (innerEG=egArray[i]; innerEG != NULL ; innerEG=nextEG) { + nextEG=innerEG->pendingLink; + innerEG->pendingLink=NULL; + innerEG->outerEG=eg; + }; + egArray[i]=NULL; + }; + + /* + * for patching up the LabelEntry you might use an EG for the + * current alternative - unlike patching up an alternative EG + * i.e. start the loop at BlkLevel rather than (BlkLevel+1) + * fill it in only if the EG and the LE are for the very + * same alternative if they're at the same BlkLevel + * it's easier to leave the LE on this list (filled in) rather than + * trying to selectively remove it. It will eventually be + * removed anyway when the BlkLevel gets small enough. + */ + + for (i=BlkLevel; i<=highWater ; i++) { + for (innerLE=leArray[i]; innerLE != NULL ; innerLE=nextLE) { + nextLE=innerLE->pendingLink; + if (BlkLevel != i || + innerLE->curAltNum == CurAltNum_array[BlkLevel]) { + if (innerLE->outerEG == NULL) { + innerLE->outerEG=eg; + }; + }; + }; + if (BlkLevel != i) leArray[i]=NULL; + }; + +/* + * For the start of alternatives it is necessary to make a + * distinction between the exception group for the current + * alternative and the "fallback" EG for the block which + * contains the alternative + * + * The fallback outerEG is used to handle the case where + * no alternative of a block matches. In that case the + * signal is "NoViableAlt" (or "NoSemViableAlt" and the + * generator needs the EG of the block CONTAINING the + * current one. + * + * rule: ( ( ( a + * | b + * ) + * | c + * ) + * | d + * ); + */ + + for (i=BlkLevel; i <= highWater ; i++) { + for (innerAlt=altArray[i]; innerAlt != NULL ; innerAlt=nextAlt) { + nextAlt=innerAlt->pendingLink; + + /* first fill in the EG for the current alternative */ + /* but leave it on the list in order to get the fallback EG */ + /* if the EG is at the same LEVEL as the alternative then */ + /* fill it in only if in the very same alternative */ + /* */ + /* rule: ( a */ + /* | b */ + /* | c exception ... */ + /* ) */ + /* */ + /* if the EG is outside the alternative (e.g. BlkLevel < i) */ + /* then it doesn't matter about the alternative */ + /* */ + /* rule: ( a */ + /* | b */ + /* | c */ + /* ) exception ... */ + /* */ + +#if 0 + printf("BlkLevel=%d i=%d altnum=%d CurAltNum=%d altID=%s\n", + BlkLevel,i,innerAlt->curAltNum,CurAltNum_array[BlkLevel],eg->altID); +#endif + if (BlkLevel != i || + innerAlt->curAltNum == CurAltNum_array[BlkLevel]) { + if (innerAlt->exception_label == NULL) { + innerAlt->exception_label=eg->altID; + }; + }; + + /* ocurs at a later pass then for the exception_label */ + /* if an outerEG has been found then fill in the outer EG */ + /* remove if from the list when the BlkLevel gets smaller */ + + if (BlkLevel != i) { + if (innerAlt->outerEG == NULL) { + innerAlt->outerEG=eg; + }; + }; + }; + if (BlkLevel != i) altArray[i]=NULL; + }; +} + +#ifdef __USE_PROTOS +void leAdd(LabelEntry * le) +#else +void leAdd(le) +LabelEntry *le; +#endif + +{ + arrayCheck(); + le->pendingLink=leArray[BlkLevel]; + le->curAltNum=CurAltNum_array[BlkLevel]; + leArray[BlkLevel]=le; +} + +#ifdef __USE_PROTOS +void altAdd(Junction *alt) +#else +void altAdd(alt) +Junction *alt; +#endif + +{ + arrayCheck(); +#if 0 + printf("BlkLevel=%d CurAltNum=%d\n", + BlkLevel,CurAltNum_array[BlkLevel]); +#endif + alt->curAltNum=CurAltNum_array[BlkLevel]; + alt->pendingLink=altArray[BlkLevel]; + altArray[BlkLevel]=alt; +} + +static void +#ifdef __USE_PROTOS +arrayCheck(void) +#else +arrayCheck() +#endif +{ + ExceptionGroup **egArrayNew; + LabelEntry **leArrayNew; + Junction **altArrayNew; + int arraySizeNew; + int i; + + if (BlkLevel > highWater) highWater=BlkLevel; + + if (BlkLevel >= arraySize) { + arraySizeNew=BlkLevel+5; /* MR20 */ + egArrayNew=(ExceptionGroup **) + calloc(arraySizeNew,sizeof(ExceptionGroup *)); + leArrayNew=(LabelEntry **) + calloc(arraySizeNew,sizeof(LabelEntry *)); + altArrayNew=(Junction **) + calloc(arraySizeNew,sizeof(Junction *)); + for (i=0; i<arraySize ; i++) { + egArrayNew[i]=egArray[i]; + leArrayNew[i]=leArray[i]; + altArrayNew[i]=altArray[i]; + }; + arraySize=arraySizeNew; + if (egArray != NULL) free( (char *) egArray); + if (leArray != NULL) free( (char *) leArray); + if (altArray != NULL) free( (char *) altArray); + egArray=egArrayNew; + leArray=leArrayNew; + altArray=altArrayNew; + }; +} + +/* always call leFixup() BEFORE egFixup() */ + +void +#ifdef __USE_PROTOS +egFixup(void) +#else +egFixup() +#endif +{ + int i; + ExceptionGroup *nextEG; + ExceptionGroup *innerEG; + + for (i=1; i<=highWater ; i++) { + for (innerEG=egArray[i]; innerEG != NULL ; innerEG=nextEG) { + nextEG=innerEG->pendingLink; + innerEG->pendingLink=NULL; + }; + egArray[i]=NULL; + }; + lastEG=NULL; + lastBlkLevel=0; +} + +/* always call leFixup() BEFORE egFixup() */ + +#ifdef __USE_PROTOS +void leFixup(void) +#else +void leFixup() +#endif +{ + + int i; + LabelEntry *nextLE; + LabelEntry *innerLE; + + for (i=BlkLevel; i<=highWater ; i++) { + for (innerLE=leArray[i]; innerLE != NULL ; innerLE=nextLE) { + nextLE=innerLE->pendingLink; + innerLE->pendingLink=NULL; + }; + leArray[i]=NULL; + }; +} + +/* always call altFixup() BEFORE egFixup() */ + +#ifdef __USE_PROTOS +void altFixup(void) +#else +void altFixup() +#endif +{ + + int i; + Junction *nextAlt; + Junction *innerAlt; + + for (i=BlkLevel; i<=highWater ; i++) { + for (innerAlt=altArray[i]; innerAlt != NULL ; innerAlt=nextAlt) { + + /* if an outerEG has been found then fill in the outer EG */ + + if (lastBlkLevel <= i) { + if (innerAlt->outerEG == NULL) { + innerAlt->outerEG=lastEG; + }; + }; + nextAlt=innerAlt->pendingLink; + innerAlt->pendingLink=NULL; + }; + altArray[i]=NULL; + }; +} + diff --git a/pccts/antlr/err.c b/pccts/antlr/err.c new file mode 100644 index 0000000..635b2c5 --- /dev/null +++ b/pccts/antlr/err.c @@ -0,0 +1,538 @@ +/* + * A n t l r S e t s / E r r o r F i l e H e a d e r + * + * Generated from: antlr.g + * + * Terence Parr, Russell Quong, Will Cohen, and Hank Dietz: 1989-2001 + * Parr Research Corporation + * with Purdue University Electrical Engineering + * With AHPCRC, University of Minnesota + * ANTLR Version 1.33MR32 + */ + +#define ANTLR_VERSION 13332 +#include "pcctscfg.h" +#include "pccts_stdio.h" + +#include "pcctscfg.h" +#include "set.h" +#include <ctype.h> +#include "syn.h" +#include "hash.h" +#include "generic.h" +#define zzcr_attr(attr,tok,t) +#define zzSET_SIZE 20 +#include "antlr.h" +#include "tokens.h" +#include "dlgdef.h" +#include "err.h" + +ANTLRChar *zztokens[157]={ + /* 00 */ "Invalid", + /* 01 */ "Eof", + /* 02 */ "QuotedTerm", + /* 03 */ "\\n|\\r|\\r\\n", + /* 04 */ "\\(\\n|\\r|\\r\\n)", + /* 05 */ "\\~[]", + /* 06 */ "~[\\n\\r\"\\]+", + /* 07 */ "\"", + /* 08 */ "\\n|\\r|\\r\\n", + /* 09 */ "\\(\\n|\\r|\\r\\n)", + /* 10 */ "\\~[]", + /* 11 */ "~[\\n\\r\"\\]+", + /* 12 */ "'", + /* 13 */ "\\n|\\r|\\r\\n", + /* 14 */ "\\~[]", + /* 15 */ "~[\\n\\r'\\]+", + /* 16 */ "\\*/", + /* 17 */ "\\*", + /* 18 */ "\\n|\\r|\\r\\n", + /* 19 */ "~[\\n\\r\\*]+", + /* 20 */ "\\*/", + /* 21 */ "\\*", + /* 22 */ "\\n|\\r|\\r\\n", + /* 23 */ "~[\\n\\r\\*]+", + /* 24 */ "\\n|\\r|\\r\\n", + /* 25 */ "~[\\n\\r]+", + /* 26 */ "\\n|\\r|\\r\\n", + /* 27 */ "~[\\n\\r]+", + /* 28 */ "\\n|\\r|\\r\\n", + /* 29 */ "~[\\n\\r]+", + /* 30 */ "\\*/", + /* 31 */ "\\*", + /* 32 */ "\\n|\\r|\\r\\n", + /* 33 */ "~[\\n\\r\\*]+", + /* 34 */ "Action", + /* 35 */ "Pred", + /* 36 */ "PassAction", + /* 37 */ "consumeUntil\\( [\\ \\t]* \\{~[\\}]+\\} [\\ \\t]* \\)", + /* 38 */ "consumeUntil\\( ~[\\)]+ \\)", + /* 39 */ "\\n|\\r|\\r\\n", + /* 40 */ "\\>", + /* 41 */ "$", + /* 42 */ "$$", + /* 43 */ "$\\[\\]", + /* 44 */ "$\\[", + /* 45 */ "$[0-9]+", + /* 46 */ "$[0-9]+.", + /* 47 */ "$[0-9]+.[0-9]+", + /* 48 */ "$[_a-zA-Z][_a-zA-Z0-9]*", + /* 49 */ "#0", + /* 50 */ "#\\[\\]", + /* 51 */ "#\\(\\)", + /* 52 */ "#[0-9]+", + /* 53 */ "#line[\\ \\t]* [0-9]+ {[\\ \\t]* \"~[\"]+\" ([\\ \\t]* [0-9]*)* } (\\n|\\r|\\r\\n)", + /* 54 */ "#line ~[\\n\\r]* (\\n|\\r|\\r\\n)", + /* 55 */ "#[_a-zA-Z][_a-zA-Z0-9]*", + /* 56 */ "#\\[", + /* 57 */ "#\\(", + /* 58 */ "#", + /* 59 */ "\\)", + /* 60 */ "\\[", + /* 61 */ "\\(", + /* 62 */ "\\\\]", + /* 63 */ "\\\\)", + /* 64 */ "\\>", + /* 65 */ "'", + /* 66 */ "\"", + /* 67 */ "\\$", + /* 68 */ "\\#", + /* 69 */ "\\(\\n|\\r|\\r\\n)", + /* 70 */ "\\~[\\]\\)>$#]", + /* 71 */ "/", + /* 72 */ "/\\*", + /* 73 */ "\\*/", + /* 74 */ "//", + /* 75 */ "~[\\n\\r\\)\\(\\$#\\>\\]\\[\"'/]+", + /* 76 */ "[\\t\\ ]+", + /* 77 */ "\\n|\\r|\\r\\n", + /* 78 */ "\\[", + /* 79 */ "\\<\\<", + /* 80 */ "\"", + /* 81 */ "/\\*", + /* 82 */ "\\*/", + /* 83 */ "//", + /* 84 */ "#line[\\ \\t]* [0-9]+ {[\\ \\t]* \"~[\"]+\" ([\\ \\t]* [0-9]*)* } (\\n|\\r|\\r\\n)", + /* 85 */ "#line ~[\\n\\r]* (\\n|\\r|\\r\\n)", + /* 86 */ "\\>\\>", + /* 87 */ "WildCard", + /* 88 */ "\\@", + /* 89 */ "LABEL", + /* 90 */ "grammar-element", + /* 91 */ "meta-symbol", + /* 92 */ "Pragma", + /* 93 */ "FirstSetSymbol", + /* 94 */ "{\\}#header", + /* 95 */ "{\\}#first", + /* 96 */ "{\\}#parser", + /* 97 */ "{\\}#tokdefs", + /* 98 */ "\\}", + /* 99 */ "class", + /* 100 */ "NonTerminal", + /* 101 */ "TokenTerm", + /* 102 */ "\\{", + /* 103 */ "!", + /* 104 */ "\\<", + /* 105 */ "\\>", + /* 106 */ ":", + /* 107 */ ";", + /* 108 */ "{\\}#lexaction", + /* 109 */ "{\\}#lexmember", + /* 110 */ "{\\}#lexprefix", + /* 111 */ "{\\}#pred", + /* 112 */ "\\|\\|", + /* 113 */ "&&", + /* 114 */ "\\(", + /* 115 */ "\\)", + /* 116 */ "{\\}#lexclass", + /* 117 */ "{\\}#errclass", + /* 118 */ "{\\}#tokclass", + /* 119 */ "..", + /* 120 */ "{\\}#token", + /* 121 */ "=", + /* 122 */ "[0-9]+", + /* 123 */ "\\|", + /* 124 */ "\\~", + /* 125 */ "^", + /* 126 */ "approx", + /* 127 */ "LL\\(1\\)", + /* 128 */ "LL\\(2\\)", + /* 129 */ "\\*", + /* 130 */ "\\+", + /* 131 */ "?", + /* 132 */ "=>", + /* 133 */ "exception", + /* 134 */ "default", + /* 135 */ "catch", + /* 136 */ "{\\}#[A-Za-z0-9_]*", + /* 137 */ "[\\t\\ ]+", + /* 138 */ "\\n|\\r|\\r\\n", + /* 139 */ "//", + /* 140 */ "/\\*", + /* 141 */ "#ifdef", + /* 142 */ "#if", + /* 143 */ "#ifndef", + /* 144 */ "#else", + /* 145 */ "#endif", + /* 146 */ "#undef", + /* 147 */ "#import", + /* 148 */ "ID", + /* 149 */ "#define", + /* 150 */ "INT", + /* 151 */ "enum", + /* 152 */ "\\{", + /* 153 */ "=", + /* 154 */ ",", + /* 155 */ "\\}", + /* 156 */ ";" +}; +SetWordType zzerr1[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr2[20] = {0xfc,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xf3, + 0xbf,0xff,0xff,0xff, 0xff,0xff,0xff,0x1f}; +SetWordType zzerr3[20] = {0xfc,0xff,0xff,0xff, 0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xfb, + 0x3b,0xf7,0xf7,0xc7, 0xff,0xff,0xff,0x1f}; +SetWordType zzerr4[20] = {0x4,0x0,0x0,0x0, 0x10,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x80,0x7,0x0,0x0, 0x0,0x0,0x0,0x0}; +SetWordType setwd1[157] = {0x0,0x50,0xa0,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x6a,0x20,0xa0,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x0,0x0,0x20,0x20,0x21, + 0x21,0x21,0x21,0x6e,0x6e,0x64,0x20,0x0, + 0x20,0xa0,0xa0,0xa0,0x20,0x6a,0x6a,0x6a, + 0x6e,0x20,0x20,0x20,0x20,0x66,0x6e,0x6e, + 0x20,0x66,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x62,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, + 0x20,0x20,0x20,0x20,0x20,0x20}; +SetWordType zzerr5[20] = {0x0,0x0,0x0,0x0, 0x10,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x0,0x1,0x0,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr6[20] = {0x4,0x0,0x0,0x0, 0x10,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x0,0x7,0x0,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr7[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x0,0x6,0x0,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr8[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x0,0x4,0x0,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr9[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x1c,0xf0,0x70,0x1, 0x20,0x0,0x0,0x0}; +SetWordType setwd2[157] = {0x0,0xf8,0x6,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0xf8,0x0,0x1,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0xf8,0xf8,0xf8,0x0,0x0, + 0x0,0x1,0x2,0x6,0x0,0xf8,0xf8,0xf8, + 0xf8,0x0,0x0,0x0,0x0,0xf8,0xf8,0xf8, + 0x0,0xf8,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0xe8,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0}; +SetWordType zzerr10[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0xbc,0xf8,0x74,0x1, 0x20,0x0,0x0,0x0}; +SetWordType zzerr11[20] = {0x0,0x0,0x0,0x0, 0x8,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0xa0,0x0,0x4,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr12[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x1c,0xf8,0x70,0x1, 0x20,0x0,0x0,0x0}; +SetWordType zzerr13[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0xa0,0x0,0x4,0x0, 0x0,0x0,0x0,0x0}; +SetWordType setwd3[157] = {0x0,0xfa,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0xfa,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0xfa,0xfa,0xfa,0x5,0x0, + 0x5,0x0,0x0,0x0,0xe2,0xfa,0xfa,0xfa, + 0xfa,0xc0,0x80,0x5,0xe0,0xfa,0xfa,0xfa, + 0x0,0xfa,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0xfa,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0}; +SetWordType zzerr14[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x20,0x0,0x0,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr15[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr16[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr17[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x40,0x0,0x4,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr18[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x24,0x0,0x80,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr19[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x20,0x0,0x0,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr20[20] = {0x6,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x1c,0xf8,0x74,0x3, 0x20,0x0,0x0,0x0}; +SetWordType zzerr21[20] = {0x6,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x1c,0xf8,0x70,0x3, 0x20,0x0,0x0,0x0}; +SetWordType setwd4[157] = {0x0,0xe5,0xda,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0xe5,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0xed,0xe5,0xe7,0x1a,0x0, + 0x0,0x0,0x0,0x0,0xc0,0xe5,0xe5,0xe5, + 0xe5,0x0,0x0,0x0,0x0,0xe5,0xe5,0xe5, + 0x0,0xe5,0x40,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0xe5,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0}; +SetWordType zzerr22[20] = {0x6,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x3c,0xf8,0x70,0x1, 0x20,0x0,0x0,0x0}; +SetWordType zzerr23[20] = {0x6,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x1c,0xf8,0x70,0x1, 0x20,0x0,0x0,0x0}; +SetWordType zzerr24[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x1c,0xf8,0x70,0x1, 0x20,0x0,0x0,0x0}; +SetWordType zzerr25[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x1c,0xf8,0x70,0x1, 0x20,0x0,0x0,0x0}; +SetWordType zzerr26[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x5, + 0x4,0x8,0x8,0x18, 0x20,0x0,0x0,0x0}; +SetWordType setwd5[157] = {0x0,0x1f,0xc1,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0xdf,0xc0,0xc0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0xc0,0x0,0xc0,0x0,0x0,0xc0,0xc0,0x0, + 0x0,0x0,0x0,0x7f,0x1f,0xdf,0xc0,0xc0, + 0x0,0x0,0xc0,0x0,0x67,0x1f,0x1f,0x1f, + 0x1f,0x0,0x0,0xc0,0x60,0x1f,0x1f,0x1f, + 0x0,0x1f,0x0,0x0,0x40,0xc0,0x0,0x0, + 0x0,0x0,0xc0,0xc0,0x0,0x0,0x5f,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0}; +SetWordType zzerr27[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4, + 0x0,0x0,0x0,0x10, 0x0,0x0,0x0,0x0}; +SetWordType zzerr28[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x80,0x2, + 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr29[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x20,0x0,0x0,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr30[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xd, + 0x0,0x0,0x80,0x0, 0x20,0x0,0x0,0x0}; +SetWordType zzerr31[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xd, + 0x0,0x0,0x0,0x0, 0x20,0x0,0x0,0x0}; +SetWordType zzerr32[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x5, + 0x4,0x8,0x8,0x18, 0x20,0x0,0x0,0x0}; +SetWordType zzerr33[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x20,0x0,0x0,0x0, 0x0,0x0,0x0,0x0}; +SetWordType setwd6[157] = {0x0,0x0,0xfd,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0xe1,0xe1,0xe1,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0xfd,0x60,0xe9,0x0,0x0,0xe1,0xe1,0x0, + 0x0,0x0,0x0,0xe2,0x0,0xfd,0xfd,0xe1, + 0x20,0x0,0xe1,0x0,0xe2,0x0,0x0,0x0, + 0x0,0x0,0x0,0xe1,0xe2,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0xe2,0xe0,0x20,0x0, + 0x0,0x0,0xe1,0xe1,0x0,0x0,0xe2,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0}; +SetWordType zzerr34[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xd, + 0x0,0x0,0x80,0x0, 0x20,0x0,0x0,0x0}; +SetWordType zzerr35[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xd, + 0x0,0x0,0x0,0x0, 0x20,0x0,0x0,0x0}; +SetWordType zzerr36[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x5, + 0x4,0x8,0x8,0x18, 0x20,0x0,0x0,0x0}; +SetWordType zzerr37[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xc, + 0x0,0x0,0x0,0x0, 0x20,0x0,0x0,0x0}; +SetWordType zzerr38[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4, + 0x84,0x9,0x8,0x18, 0x20,0x0,0x0,0x0}; +SetWordType zzerr39[20] = {0x0,0x0,0x0,0x0, 0x10,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x0,0x1,0x0,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr40[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4, + 0x4,0x9,0x8,0x18, 0x20,0x0,0x0,0x0}; +SetWordType zzerr41[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4, + 0x4,0x8,0x8,0x18, 0x20,0x0,0x0,0x0}; +SetWordType zzerr42[20] = {0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x80,0x0, + 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0}; +SetWordType setwd7[157] = {0x0,0x0,0xdf,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0xdf,0xdf,0xff,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0xdf,0x3,0xdf,0x0,0x0,0xdf,0xdf,0x0, + 0x0,0x0,0x0,0xdf,0x0,0xdf,0xdf,0xdf, + 0x1,0x30,0xdf,0x0,0xdf,0x0,0x0,0x0, + 0x0,0x0,0x0,0xdf,0xdf,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0xdf,0xdf,0x1,0x0, + 0x0,0x0,0xdf,0xdf,0x0,0x0,0xdf,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0}; +SetWordType zzerr43[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4, + 0x4,0x8,0x8,0x18, 0x20,0x0,0x0,0x0}; +SetWordType zzerr44[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0xc0, 0x1,0x0,0x0,0x0}; +SetWordType zzerr45[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x30, + 0x40,0x0,0x4,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr46[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr47[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x20, + 0x40,0x0,0x4,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr48[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x0,0x0,0x2,0x0, 0x10,0x0,0x0,0x0}; +SetWordType zzerr49[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4, + 0x4,0x8,0x8,0x18, 0x20,0x0,0x0,0x0}; +SetWordType zzerr50[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4, + 0x4,0x8,0xa,0x18, 0x30,0x0,0x0,0x0}; +SetWordType zzerr51[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4, + 0x4,0x8,0x8,0x18, 0x28,0x0,0x0,0x0}; +SetWordType zzerr52[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x40,0x0,0x4,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr53[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x4, + 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0}; +SetWordType setwd8[157] = {0x0,0x0,0xe1,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0xe1,0xe1,0xe1,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0xe1,0x0,0xe1,0x0,0x0,0xe3,0xe7,0x0, + 0x0,0x0,0x0,0xe1,0x0,0xe1,0xe1,0xef, + 0x0,0x0,0xe1,0x0,0xe1,0x0,0x0,0x0, + 0x0,0x0,0x10,0xef,0xe1,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0xe1,0xe1,0x0,0x0, + 0x0,0x0,0xe1,0xe1,0x0,0x10,0xe1,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0}; +SetWordType zzerr54[20] = {0x2,0x0,0x0,0x0, 0x14,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x1c,0xf8,0x78,0x9, 0xe0,0x0,0x0,0x0}; +SetWordType zzerr55[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x1c,0xf8,0x78,0x9, 0x60,0x0,0x0,0x0}; +SetWordType zzerr56[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x30,0x0,0x0,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr57[20] = {0x2,0x0,0x0,0x0, 0x4,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x1c,0xf8,0x78,0x9, 0xe0,0x0,0x0,0x0}; +SetWordType setwd9[157] = {0x0,0x7c,0x1,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x7f,0x1,0x1,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x1,0x0,0x1,0x0,0x0,0x1,0x1,0x0, + 0x0,0x0,0x0,0x7f,0x7e,0x7f,0x1,0x1, + 0x0,0x0,0x1,0x0,0x7d,0x7e,0x7e,0x7e, + 0x7e,0x0,0x0,0x1,0x7d,0x7e,0x7e,0x7e, + 0x0,0x7e,0x0,0x0,0x7d,0x1,0x0,0x0, + 0x0,0x0,0x1,0x1,0x0,0x0,0x7f,0x64, + 0x64,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x80,0x0,0x0,0x0,0x0,0x0,0x80,0x0, + 0x80,0x0,0x0,0x0,0x0,0x0}; +SetWordType zzerr58[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0, 0x0,0x0,0xa0,0x0}; +SetWordType zzerr59[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0, 0x0,0x80,0xa0,0x0}; +SetWordType zzerr60[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0, 0x0,0x0,0xa0,0x0}; +SetWordType zzerr61[20] = {0x2,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0, 0x0,0x80,0xa0,0x0}; +SetWordType zzerr62[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xe}; +SetWordType zzerr63[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xe}; +SetWordType zzerr64[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0xe}; +SetWordType zzerr65[20] = {0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, 0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0, 0x0,0x0,0x10,0xc}; +SetWordType setwd10[157] = {0x0,0xc,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x3,0x0, + 0x3,0x0,0x0,0xf0,0xf0,0x0}; +SetWordType setwd11[157] = {0x0,0x1,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0, + 0x1,0x0,0x0,0x0,0x0,0x0}; diff --git a/pccts/antlr/fcache.c b/pccts/antlr/fcache.c new file mode 100644 index 0000000..566d817 --- /dev/null +++ b/pccts/antlr/fcache.c @@ -0,0 +1,123 @@ +/* + * fcache.c + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33MR10 + * + */ + +#include <stdio.h> +#include <ctype.h> + +#include "pcctscfg.h" + +#include "set.h" +#include "syn.h" +#include "hash.h" +#include "generic.h" + +#ifdef __USE_PROTOS +CacheEntry *dumpFcache1(char *prev) +#else +CacheEntry *dumpFcache1(prev) + char *prev; +#endif +{ + Entry **table=Fcache; + + int low=0; + int hi=0; + + CacheEntry *least=NULL; + + Entry **p; + + for (p=table; p<&(table[HashTableSize]); p++) { + + CacheEntry *q =(CacheEntry *) *p; + + if ( q != NULL && low==0 ) low = p-table; + while ( q != NULL ) { + if (strcmp(q->str,prev) > 0) { + if (least == NULL) { + least=q; + } else { + if (strcmp(q->str,least->str) < 0) { + least=q; + }; + }; + }; + q = q->next; + }; + + if ( *p != NULL ) hi = p-table; + } + return least; +} + +#ifdef __USE_PROTOS +void reportFcache(CacheEntry *q) +#else +void reportFcache(q) + CacheEntry *q; +#endif +{ + char *qstr; + + fprintf(stdout,"\nrule "); + for (qstr=q->str; *qstr != '*' ; qstr++) { + fprintf(stdout,"%c",*qstr); + }; + + qstr++; + if (*qstr == 'i') fprintf(stdout," First["); + if (*qstr == 'o') fprintf(stdout," Follow["); + qstr++; + fprintf(stdout,"%s]",qstr); + if (q->incomplete) fprintf(stdout," *** incomplete ***"); + fprintf(stdout,"\n"); + MR_dumpTokenSet(stdout,1,q->fset); +} + +void +#ifdef __USE_PROTOS +DumpFcache(void) +#else +DumpFcache() +#endif +{ + + char *prev=""; + int n=0; + CacheEntry *next; + + fprintf(stdout,"\n\nDump of First/Follow Cache\n"); + + for(;;) { + next=dumpFcache1(prev); + if (next == NULL) break; + reportFcache(next); + ++n; + prev=next->str; + }; + fprintf(stdout,"\nEnd dump of First/Follow Cache\n"); +} diff --git a/pccts/antlr/fset.c b/pccts/antlr/fset.c new file mode 100644 index 0000000..17e1899 --- /dev/null +++ b/pccts/antlr/fset.c @@ -0,0 +1,1555 @@ +/* + * fset.c + * + * Compute FIRST and FOLLOW sets. + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2001 + */ + +#include <stdio.h> +#include <stdlib.h> + +#include "pcctscfg.h" + +#include "set.h" +#include "syn.h" +#include "hash.h" +#include "generic.h" +#include "dlgdef.h" +#include "limits.h" + +#ifdef __USE_PROTOS +static void ensure_predicates_cover_ambiguous_lookahead_sequences + (Junction *, Junction *, char *, Tree *); +#else +static void ensure_predicates_cover_ambiguous_lookahead_sequences(); +#endif + +/* + * What tokens are k tokens away from junction q? + * + * Follow both p1 and p2 paths (unless RuleBlk) to collect the tokens k away from this + * node. + * We lock the junction according to k--the lookahead. If we have been at this + * junction before looking for the same, k, number of lookahead tokens, we will + * do it again and again...until we blow up the stack. Locks are only used on aLoopBlk, + * RuleBlk, aPlusBlk and EndRule junctions to remove/detect infinite recursion from + * FIRST and FOLLOW calcs. + * + * If p->jtype == EndRule we are going to attempt a FOLLOW. (FOLLOWs are really defined + * in terms of FIRST's, however). To proceed with the FOLLOW, p->halt cannot be + * set. p->halt is set to indicate that a reference to the current rule is in progress + * and the FOLLOW is not desirable. + * + * If we attempt a FOLLOW and find that there is no FOLLOW or REACHing beyond the EndRule + * junction yields an empty set, replace the empty set with EOF. No FOLLOW means that + * only EOF can follow the current rule. This normally occurs only on the start symbol + * since all other rules are referenced by another rule somewhere. + * + * Normally, both p1 and p2 are followed. However, checking p2 on a RuleBlk node is + * the same as checking the next rule which is clearly incorrect. + * + * Cycles in the FOLLOW sense are possible. e.g. Fo(c) requires Fo(b) which requires + * Fo(c). Both Fo(b) and Fo(c) are defined to be Fo(b) union Fo(c). Let's say + * Fo(c) is attempted first. It finds all of the FOLLOW symbols and then attempts + * to do Fo(b) which finds of its FOLLOW symbols. So, we have: + * + * Fo(c) + * / \ + * a set Fo(b) + * / \ + * a set Fo(c) .....Hmmmm..... Infinite recursion! + * + * The 2nd Fo(c) is not attempted and Fo(b) is left deficient, but Fo(c) is now + * correctly Fo(c) union Fo(b). We wish to pick up where we left off, so the fact + * that Fo(b) terminated early means that we lack Fo(c) in the Fo(b) set already + * laying around. SOOOOoooo, we track FOLLOW cycles. All FOLLOW computations are + * cached in a hash table. After the sequence of FOLLOWs finish, we reconcile all + * cycles --> correct all Fo(rule) sets in the cache. + * + * Confused? Good! Read my MS thesis [Purdue Technical Report TR90-30]. + * TJP 8/93 -- can now read PhD thesis from Purdue. + * + * Also, FIRST sets are cached in the hash table. Keys are (rulename,Fi/Fo,k). + * Only FIRST sets, for which the FOLLOW is not included, are stored. + * + * SPECIAL CASE of (...)+ blocks: + * I added an optional alt so that the alts could see what + * was behind the (...)+ block--thus using enough lookahead + * to branch out rather than just enough to distinguish + * between alts in the (...)+. However, when the FIRST("(...)+") is + * is needed, must not use this last "optional" alt. This routine + * turns off this path by setting a new 'ignore' flag for + * the alt and then resetting it afterwards. + */ + +set +#ifdef __USE_PROTOS +rJunc( Junction *p, int k, set *rk ) +#else +rJunc( p, k, rk ) +Junction *p; +int k; +set *rk; +#endif +{ + set a, b; + + require(p!=NULL, "rJunc: NULL node"); + require(p->ntype==nJunction, "rJunc: not junction"); + +#ifdef DBG_LL1 + if ( p->jtype == RuleBlk ) fprintf(stderr, "FIRST(%s,%d) \n",((Junction *)p)->rname,k); + else fprintf(stderr, "rJunc: %s in rule %s\n", + decodeJType[p->jtype], ((Junction *)p)->rname); +#endif + /* if this is one of the added optional alts for (...)+ then return */ + + /* no need to pop backtrace - hasn't been pushed */ + + if ( p->ignore ) return empty; + + if (MR_MaintainBackTrace) MR_pointerStackPush(&MR_BackTraceStack,p); + +/* MR14 */ if (AlphaBetaTrace && p->alpha_beta_guess_end) { +/* MR14 */ warnFL( +/* MR14 */ "not possible to compute follow set for alpha in an \"(alpha)? beta\" block. ", +/* MR14 */ FileStr[p->file],p->line); +/* MR14 */ MR_alphaBetaTraceReport(); +/* MR14 */ }; + +/* MR14 */ if (p->alpha_beta_guess_end) { +/* MR14 */ if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack); +/* MR14 */ return empty; +/* MR14 */ } + + /* locks are valid for aLoopBlk,aPlusBlk,RuleBlk,EndRule junctions only */ + if ( p->jtype==aLoopBlk || p->jtype==RuleBlk || + p->jtype==aPlusBlk || p->jtype==EndRule ) + { + require(p->lock!=NULL, "rJunc: lock array is NULL"); + if ( p->lock[k] ) + { + if ( p->jtype == EndRule ) /* FOLLOW cycle? */ + { +#ifdef DBG_LL1 + fprintf(stderr, "FOLLOW cycle to %s: panic!\n", p->rname); +#endif + if (! MR_AmbSourceSearch) RegisterCycle(p->rname, k); + } + if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack); + return empty; + } + if ( p->jtype == RuleBlk && + p->end->halt && + ! MR_AmbSourceSearch) /* check for FIRST cache */ + { + CacheEntry *q = (CacheEntry *) hash_get(Fcache, Fkey(p->rname,'i',k)); + if ( q != NULL ) + { + set_orin(rk, q->rk); + if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack); + return set_dup( q->fset ); + } + } + if ( p->jtype == EndRule && + !p->halt && /* MR11 was using cache even when halt set */ + ! MR_AmbSourceSearch) /* FOLLOW set cached already? */ + { + CacheEntry *q = (CacheEntry *) hash_get(Fcache, Fkey(p->rname,'o',k)); + if ( q != NULL ) + { +#ifdef DBG_LL1 + fprintf(stderr, "cache for FOLLOW(%s,%d):", p->rname,k); + s_fprT(stderr, q->fset); + if ( q->incomplete ) fprintf(stderr, " (incomplete)"); + fprintf(stderr, "\n"); +#endif + if ( !q->incomplete ) + { + if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack); + return set_dup( q->fset ); + } + } + } + p->lock[k] = TRUE; /* This rule is busy */ + } + + a = b = empty; + + if ( p->jtype == EndRule ) + { + if (p->halt ) /* don't want FOLLOW here? */ /* unless MR10 hoisting */ + { + p->lock[k] = FALSE; + set_orel(k, rk); /* indicate this k value needed */ + if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack); + return empty; + } + if (! MR_AmbSourceSearch) FoPush(p->rname, k); /* Attempting FOLLOW */ + if ( p->p1 == NULL ) set_orel((TokenInd!=NULL?TokenInd[EofToken]:EofToken), &a);/* if no FOLLOW assume EOF */ +#ifdef DBG_LL1 + fprintf(stderr, "-->FOLLOW(%s,%d)\n", p->rname,k); +#endif + } + + if ( p->p1 != NULL ) { +/* MR14 */ if (p->guess) { +/* MR14 */ if (p->guess_analysis_point == NULL) { +/* MR14 */ Node * guess_point; +/* MR14 */ guess_point=(Node *)analysis_point(p); +/* MR14 */ if (guess_point == (Node *)p) { +/* MR14 */ guess_point=p->p1; +/* MR14 */ } +/* MR14 */ p->guess_analysis_point=guess_point; +/* MR14 */ } +/* MR14 */ REACH(p->guess_analysis_point, k, rk, a); + } else { + REACH(p->p1, k, rk, a); + } + } + + /* C a c h e R e s u l t s */ + + if ( p->jtype == RuleBlk && p->end->halt && ! MR_AmbSourceSearch) /* can save FIRST set? */ + { + CacheEntry *q = newCacheEntry( Fkey(p->rname,'i',k) ); + /*fprintf(stderr, "Caching %s FIRST %d\n", p->rname, k);*/ + hash_add(Fcache, Fkey(p->rname,'i',k), (Entry *)q); + q->fset = set_dup( a ); + q->rk = set_dup( *rk ); + } + + if ( p->jtype == EndRule && + !p->halt && /* MR11 was using cache even with halt set */ + ! MR_AmbSourceSearch) /* just completed FOLLOW? */ + { + /* Cache Follow set */ + CacheEntry *q = (CacheEntry *) hash_get(Fcache, Fkey(p->rname,'o',k)); + if ( q==NULL ) + { + q = newCacheEntry( Fkey(p->rname,'o',k) ); + hash_add(Fcache, Fkey(p->rname,'o',k), (Entry *)q); + } + /*fprintf(stderr, "Caching %s FOLLOW %d\n", p->rname, k);*/ + if ( set_nil(a) && !q->incomplete ) + { + /* Don't ever save a nil set as complete. + * Turn it into an eof set. + */ + set_orel(EofToken, &a); + } + set_orin(&(q->fset), a); + FoPop( k ); + if ( FoTOS[k] == NULL && Cycles[k] != NULL ) ResolveFoCycles(k); +#ifdef DBG_LL1 + fprintf(stderr, "saving FOLLOW(%s,%d):", p->rname, k); + s_fprT(stderr, q->fset); + if ( q->incomplete ) fprintf(stderr, " (incomplete)"); + fprintf(stderr, "\n"); +#endif + } + + if (p->jtype != RuleBlk && p->p2 != NULL && /* MR14 */ ! p->guess) { + REACH(p->p2, k, rk, b); + } + + if ( p->jtype==aLoopBlk || p->jtype==RuleBlk || + p->jtype==aPlusBlk || p->jtype==EndRule ) + p->lock[k] = FALSE; /* unlock node */ + + set_orin(&a, b); + set_free(b); + if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack); + return a; +} + +set +#ifdef __USE_PROTOS +rRuleRef( RuleRefNode *p, int k, set *rk_out ) +#else +rRuleRef( p, k, rk_out ) +RuleRefNode *p; +int k; +set *rk_out; +#endif +{ + set rk; + Junction *r; + int k2; + set a, rk2, b; + int save_halt; + RuleEntry *q = (RuleEntry *) hash_get(Rname, p->text); + require(p!=NULL, "rRuleRef: NULL node"); + require(p->ntype==nRuleRef, "rRuleRef: not rule ref"); + +#ifdef DBG_LL1 + fprintf(stderr, "rRuleRef: %s\n", p->text); +#endif + + if (MR_MaintainBackTrace) MR_pointerStackPush(&MR_BackTraceStack,p); + + if ( q == NULL ) + { + warnFL( eMsg1("rule %s not defined",p->text), FileStr[p->file], p->line ); + REACH(p->next, k, rk_out, a); + if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack); + return a; + } + rk2 = empty; + +/* MR9 Problems with rule references in guarded predicates */ +/* MR9 Perhaps can use hash table to find rule ? */ + +/* MR9 */ if (RulePtr == NULL) { +/* MR9 */ fatalFL(eMsg2("Rule %s uses rule %s via RulePtr before it has been initialized", +/* MR9 */ p->rname,q->str),FileStr[p->file],p->line); +/* MR9 */ }; + + r = RulePtr[q->rulenum]; + if ( r->lock[k] ) + { + errNoFL( eMsg2("infinite left-recursion to rule %s from rule %s", + r->rname, p->rname) ); + + if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack); + + return empty; + } + + save_halt = r->end->halt; + r->end->halt = TRUE; /* don't let reach fall off end of rule here */ + rk = empty; + REACH(r, k, &rk, a); + r->end->halt = save_halt; + while ( !set_nil(rk) ) { + k2 = set_int(rk); /* MR11 this messes up the ambiguity search routine */ + set_rm(k2, rk); + REACH(p->next, k2, &rk2, b); /* MR11 by changing the value of k */ + set_orin(&a, b); + set_free(b); + } + set_free(rk); /* this has no members, but free it's memory */ + set_orin(rk_out, rk2); /* remember what we couldn't do */ + set_free(rk2); + if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack); + return a; +} + +/* + * Return FIRST sub k ( token_node ) + * + * TJP 10/11/93 modified this so that token nodes that are actually + * ranges (T1..T2) work. + */ +set +#ifdef __USE_PROTOS +rToken( TokNode *p, int k, set *rk ) +#else +rToken( p, k, rk ) +TokNode *p; +int k; +set *rk; +#endif +{ + set a; + + require(p!=NULL, "rToken: NULL node"); + require(p->ntype==nToken, "rToken: not token node"); + +#ifdef DBG_LL1 + fprintf(stderr, "rToken: %s\n", (TokenString(p->token)!=NULL)?TokenString(p->token): + ExprString(p->token)); +#endif + + + if (MR_MaintainBackTrace) MR_pointerStackPush(&MR_BackTraceStack,p); + + if (MR_AmbSourceSearch && (k-1) == 0) { + + set localConstrain; + set intersection; + + localConstrain=fset[maxk-k+1]; + + if (! set_nil(p->tset)) { + intersection=set_and(localConstrain,p->tset); + if (! set_nil(intersection)) { + MR_backTraceReport(); + }; + set_free(intersection); + } else { + if (set_el( (unsigned) p->token,localConstrain)) { + MR_backTraceReport(); + } + }; + }; + + if ( k-1 == 0 ) { + + if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack); + + if ( !set_nil(p->tset) ) { + return set_dup(p->tset); + } else { + return set_of(p->token); + }; + } + + REACH(p->next, k-1, rk, a); + + if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack); + + return a; +} + +set +#ifdef __USE_PROTOS +rAction( ActionNode *p, int k, set *rk ) +#else +rAction( p, k, rk ) +ActionNode *p; +int k; +set *rk; +#endif +{ + set a; + + require(p!=NULL, "rJunc: NULL node"); + require(p->ntype==nAction, "rJunc: not action"); + +/* MR11 */ if (p->is_predicate && p->ampersandPred != NULL) { +/* MR11 */ Predicate *pred=p->ampersandPred; +/* MR11 */ if (k <= pred->k) { +/* MR11 */ REACH(p->guardNodes,k,rk,a); +/* MR11 */ return a; +/* MR11 */ }; +/* MR11 */ }; + + /* it might be a good idea when doing an MR_AmbSourceSearch + to *not* look behind predicates under some circumstances + we'll look into that later + */ + + REACH(p->next, k, rk, a); /* ignore actions */ + return a; +} + + /* A m b i g u i t y R e s o l u t i o n */ + + +void +#ifdef __USE_PROTOS +dumpAmbigMsg( set *fset, FILE *f, int want_nls ) +#else +dumpAmbigMsg( fset, f, want_nls ) +set *fset; +FILE *f; +int want_nls; +#endif +{ + int i; + + set copy; /* MR11 */ + + if ( want_nls ) fprintf(f, "\n\t"); + else fprintf(f, " "); + + for (i=1; i<=CLL_k; i++) + { + copy=set_dup(fset[i]); /* MR11 */ + + if ( i>1 ) + { + if ( !want_nls ) fprintf(f, ", "); + } + if ( set_deg(copy) > 3 && elevel == 1 ) + { + int e,m; + fprintf(f, "{"); + for (m=1; m<=3; m++) + { + e=set_int(copy); + fprintf(f, " %s", TerminalString(e)); + set_rm(e, copy); + } + fprintf(f, " ... }"); + } + else s_fprT(f, copy); + if ( want_nls ) fprintf(f, "\n\t"); + set_free(copy); + } + fprintf(f, "\n"); + +} + +static void +#ifdef __USE_PROTOS +verify_context(Predicate *predicate) +#else +verify_context(predicate) +Predicate *predicate; +#endif +{ + if ( predicate == NULL ) return; + + if ( predicate->expr == PRED_OR_LIST || + predicate->expr == PRED_AND_LIST ) + { + verify_context(predicate->down); + verify_context(predicate->right); /* MR10 */ + return; + } + + if ( !predicate->source->ctxwarned && predicate->source->guardpred==NULL && + ((predicate->k > 1 && + !is_single_tuple(predicate->tcontext)) || + ( predicate->k == 1 && + set_deg(predicate->scontext[1])>1 )) ) + { + +/* MR9 Suppress annoying messages caused by our own clever(?) fix */ + + fprintf(stderr, ErrHdr, FileStr[predicate->source->file], + predicate->source->line); + fprintf(stderr, " warning: predicate applied for >1 lookahead %d-sequences\n", predicate->k); + fprintf(stderr, ErrHdr, FileStr[predicate->source->file], + predicate->source->line); + fprintf(stderr, " predicate text: \"%s\"\n", + (predicate->expr == NULL ? "(null)" : predicate->expr) ); + fprintf(stderr, ErrHdr, FileStr[predicate->source->file], + predicate->source->line); + fprintf(stderr, " You may only want one lookahead %d-sequence to apply\n", predicate->k); + fprintf(stderr, ErrHdr, FileStr[predicate->source->file], + predicate->source->line); + fprintf(stderr, " Try using a context guard '(...)? =>'\n"); + predicate->source->ctxwarned = 1; + } + verify_context(predicate->right); /* MR10 */ +} + +/* + * If delta is the set of ambiguous lookahead sequences, then make sure that + * the predicate(s) for productions alt1,alt2 cover the sequences in delta. + * + * For example, + * a : <<PRED1>>? (A B|A C) + * | b + * ; + * b : <<PRED2>>? A B + * | A C + * ; + * + * This should give a warning that (A C) predicts both productions and alt2 + * does not have a predicate in the production that generates (A C). + * + * The warning detection is simple. Let delta = LOOK(alt1) intersection LOOK(alt2). + * Now, if ( delta set-difference context(predicates-for-alt1) != empty then + * alt1 does not "cover" all ambiguous sequences. + * + * If ambig is nonempty, then ambig in LL(k) sense -> use tree info; else use fset + * info. Actually, sets are used only if k=1 for this grammar. + */ +static void +#ifdef __USE_PROTOS +ensure_predicates_cover_ambiguous_lookahead_sequences + ( Junction *alt1, Junction *alt2, char *sub, Tree *ambig ) +#else +ensure_predicates_cover_ambiguous_lookahead_sequences( alt1, alt2, sub, ambig ) +Junction *alt1; +Junction *alt2; +char *sub; +Tree *ambig; +#endif +{ + if ( !ParseWithPredicates ) return; + + if ( ambig!=NULL ) + { + Tree *non_covered = NULL; + if ( alt1->predicate!=NULL ) + non_covered = tdif(ambig, alt1->predicate, alt1->fset, alt2->fset); + if ( (non_covered!=NULL || alt1->predicate==NULL) && WarningLevel>1 ) + { + fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line); + fprintf(stderr, " warning: alt %d %shas no predicate to resolve ambiguity", + alt1->altnum, sub); + if ( alt1->predicate!=NULL && non_covered!=NULL ) + { + fprintf(stderr, " upon"); + preorder(non_covered); + } + else if ( alt1->predicate==NULL ) + { + fprintf(stderr, " upon"); + preorder(ambig->down); + } + fprintf(stderr, "\n"); + } + Tfree(non_covered); + non_covered = NULL; + if ( alt2->predicate!=NULL ) + non_covered = tdif(ambig, alt2->predicate, alt1->fset, alt2->fset); + if ( (non_covered!=NULL || alt2->predicate==NULL) && WarningLevel>1 ) + { + fprintf(stderr, ErrHdr, FileStr[alt2->file], alt2->line); + fprintf(stderr, " warning: alt %d %shas no predicate to resolve ambiguity", + alt2->altnum, sub); + if ( alt2->predicate!=NULL && non_covered!=NULL ) + { + fprintf(stderr, " upon"); + preorder(non_covered); + } + else if ( alt2->predicate==NULL ) + { + fprintf(stderr, " upon"); + preorder(ambig->down); + } + fprintf(stderr, "\n"); + } + Tfree(non_covered); + } + else if ( !set_nil(alt1->fset[1]) ) + { + set delta, non_covered; + delta = set_and(alt1->fset[1], alt2->fset[1]); + non_covered = set_dif(delta, covered_set(alt1->predicate)); + if ( set_deg(non_covered)>0 && WarningLevel>1 ) + { + fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line); + fprintf(stderr, " warning: alt %d %shas no predicate to resolve ambiguity", + alt1->altnum, sub); + if ( alt1->predicate!=NULL ) + { + fprintf(stderr, " upon "); + s_fprT(stderr, non_covered); + } + fprintf(stderr, "\n"); + } + set_free( non_covered ); + non_covered = set_dif(delta, covered_set(alt2->predicate)); + if ( set_deg(non_covered)>0 && WarningLevel>1 ) + { + fprintf(stderr, ErrHdr, FileStr[alt2->file], alt2->line); + fprintf(stderr, " warning: alt %d %shas no predicate to resolve ambiguity", + alt2->altnum, sub); + if ( alt2->predicate!=NULL ) + { + fprintf(stderr, " upon "); + s_fprT(stderr, non_covered); + } + fprintf(stderr, "\n"); + } + set_free( non_covered ); + set_free( delta ); + } + else fatal_internal("productions have no lookahead in predicate checking routine"); +} + +#ifdef __USE_PROTOS +void MR_doPredicatesHelp(int inGuessBlock,Junction *alt1,Junction *alt2,int jtype,char *sub) +#else +void MR_doPredicatesHelp(inGuessBlock,alt1,alt2,jtype,sub) + int inGuessBlock; + Junction *alt1; + Junction *alt2; + int jtype; + char *sub; +#endif +{ + Predicate *p1; + Predicate *p2; + + Junction *parentRule=MR_nameToRuleBlk(alt1->rname); + + if (inGuessBlock && WarningLevel <= 1) return; + + /* let antlr give the usual error message */ + + if (alt1->predicate == NULL && alt2->predicate == NULL) return; + + if ( (jtype == RuleBlk || jtype == aSubBlk) + && (alt1->predicate == NULL && alt2->predicate != NULL)) { + fprintf(stderr, ErrHdr, FileStr[parentRule->file],parentRule->line); + fprintf(stderr," warning: alt %d line %d and alt %d line %d of %s\n%s%s%s", + alt1->altnum, + alt1->line, + alt2->altnum, + alt2->line, + sub, + " These alts have ambig lookahead sequences resolved by a predicate for\n", + " the second choice. The second choice may not be reachable.\n", + " You may want to use a complementary predicate or rearrange the alts\n" + ); + return; + }; + + /* first do the easy comparison. then do the hard one */ + + if (MR_comparePredicates(alt1->predicate,alt2->predicate)) { + + if (jtype == aLoopBegin || jtype == aPlusBlk ) { + + /* I'm not sure this code is reachable. + Predicates following a (...)+ or (...)* block are probably + considered validation predicates and therefore not + participate in the predication expression + */ + + fprintf(stderr, ErrHdr,FileStr[parentRule->file],parentRule->line); + fprintf(stderr," warning: %s of %s in rule %s\n (file %s alt %d line %d and alt %d line %d)\n%s", + "the predicates used to disambiguate optional/exit paths of ", + sub, + CurRule, + FileStr[alt1->file], + alt1->altnum, + alt1->line, + alt2->altnum, + alt2->line, + " are identical and have no resolving power\n"); + } else { + fprintf(stderr, ErrHdr, FileStr[parentRule->file], parentRule->line); + fprintf(stderr," warning: %s rule %s\n (file %s alt %d line %d and alt %d line %d)\n%s", + "the predicates used to disambiguate", + CurRule, + FileStr[alt1->file], + alt1->altnum, + alt1->line, + alt2->altnum, + alt2->line, + " are identical and have no resolving power\n"); + }; + } else { + p1=predicate_dup_without_context(alt1->predicate); + p1=MR_unfold(p1); + MR_clearPredEntry(p1); + MR_simplifyInverted(p1,0); + p1=MR_predSimplifyALL(p1); + p2=predicate_dup_without_context(alt2->predicate); + p2=MR_unfold(p2); + MR_clearPredEntry(p2); + MR_simplifyInverted(p2,0); + p2=MR_predSimplifyALL(p2); + if (MR_comparePredicates(p1,p2)) { + if (jtype == aLoopBegin || jtype == aPlusBlk ) { + fprintf(stderr, ErrHdr, FileStr[parentRule->file], parentRule->line); + fprintf(stderr," warning: %s of %s in rule %s\n (file %s alt %d line %d and alt %d line %d)\n%s%s", + "the predicates used to disambiguate optional/exit paths of ", + sub, + CurRule, + FileStr[alt1->file], + alt1->altnum, + alt1->line, + alt2->altnum, + alt2->line, + " are identical when compared without context and may have no\n", + " resolving power for some lookahead sequences.\n"); + } else { + fprintf(stderr, ErrHdr, FileStr[parentRule->file], parentRule->line); + fprintf(stderr," warning: %s rule %s\n (file %s alt %d line %d and alt %d line %d)\n%s%s", + "the predicates used to disambiguate", + CurRule, + FileStr[alt1->file], + alt1->altnum, + alt1->line, + alt2->altnum, + alt2->line, + " are identical when compared without context and may have no\n", + " resolving power for some lookahead sequences.\n"); + }; + if (InfoP) { + fprintf(output,"\n#if 0\n\n"); + fprintf(output,"The following predicates are identical when compared without\n"); + fprintf(output," lookahead context information. For some ambiguous lookahead\n"); + fprintf(output," sequences they may not have any power to resolve the ambiguity.\n"); + fprintf(output,"\n"); + + fprintf(output,"Choice 1: %s alt %d line %d file %s\n\n", + MR_ruleNamePlusOffset( (Node *) alt1), + alt1->altnum, + alt1->line, + FileStr[alt1->file]); + fprintf(output," The original predicate for choice 1 with available context information:\n\n"); + MR_dumpPred1(2,alt1->predicate,1); + fprintf(output," The predicate for choice 1 after expansion (but without context information):\n\n"); + MR_dumpPred1(2,p1,0); + if (p1 == NULL) { + Predicate *phelp; + fprintf(output," The predicate for choice 1 after expansion (but before simplification)\n\n"); + phelp=predicate_dup_without_context(alt1->predicate); + phelp=MR_unfold(phelp); + MR_clearPredEntry(phelp); + MR_simplifyInverted(phelp,0); + phelp=MR_predSimplifyALLX(phelp,1); + MR_dumpPred1(2,phelp,0); + predicate_free(phelp); + }; + fprintf(output,"\n"); + + fprintf(output,"Choice 2: %s alt %d line %d file %s\n\n", + MR_ruleNamePlusOffset( (Node *) alt2), + alt2->altnum, + alt2->line, + FileStr[alt2->file]); + fprintf(output," The original predicate for choice 2 with available context information:\n\n"); + MR_dumpPred1(1,alt2->predicate,1); + fprintf(output," The predicate for choice 2 after expansion (but without context information):\n\n"); + MR_dumpPred1(1,p2,0); + if (p2 == NULL) { + Predicate *phelp; + fprintf(output," The predicate for choice 2 after expansion (but before simplification)\n\n"); + phelp=predicate_dup_without_context(alt2->predicate); + phelp=MR_unfold(phelp); + MR_clearPredEntry(phelp); + MR_simplifyInverted(phelp,0); + phelp=MR_predSimplifyALLX(phelp,1); + MR_dumpPred1(2,phelp,0); + predicate_free(phelp); + }; + fprintf(output,"\n#endif\n"); + }; + } else if (MR_secondPredicateUnreachable(p1,p2)) { + if (jtype == aLoopBegin || jtype == aPlusBlk ) { + fprintf(stderr, ErrHdr, FileStr[parentRule->file], parentRule->line); + fprintf(stderr," warning: %s of %s in rule %s\n (file %s alt %d line %d and alt %d line %d)\n%s%s", + "the predicate used to disambiguate the first choice of the optional/exit paths of ", + sub, + CurRule, + FileStr[alt1->file], + alt1->altnum, + alt1->line, + alt2->altnum, + alt2->line, + " appears to \"cover\" the second predicate when compared without context.\n", + " The second predicate may have no resolving power for some lookahead sequences.\n"); + } else { + fprintf(stderr, ErrHdr, FileStr[parentRule->file], parentRule->line); + fprintf(stderr," warning: %s rule %s\n (file %s alt %d line %d and alt %d line %d)\n%s%s", + "the predicate used to disambiguate the first choice of", + CurRule, + FileStr[alt1->file], + alt1->altnum, + alt1->line, + alt2->altnum, + alt2->line, + " appears to \"cover\" the second predicate when compared without context.\n", + " The second predicate may have no resolving power for some lookahead sequences.\n"); + }; + if (InfoP) { + fprintf(output,"\n#if 0\n\n"); + fprintf(output,"The first predicate appears to \"cover\" the second predicate when they\n"); + fprintf(output," are compared without lookahead context information. For some ambiguous\n"); + fprintf(output," lookahead sequences the second predicate may not have any power to\n"); + fprintf(output," resolve the ambiguity.\n"); + fprintf(output,"\n"); + fprintf(output,"Choice 1: %s alt %d line %d file %s\n\n", + MR_ruleNamePlusOffset( (Node *) alt1), + alt1->altnum, + alt1->line, + FileStr[alt1->file]); + fprintf(output," The original predicate for choice 1 with available context information:\n\n"); + MR_dumpPred1(2,alt1->predicate,1); + fprintf(output," The predicate for choice 1 after expansion (but without context information):\n\n"); + MR_dumpPred1(2,p1,0); + if (p1 == NULL) { + Predicate *phelp; + fprintf(output," The predicate for choice 1 after expansion (but before simplification)\n\n"); + phelp=predicate_dup_without_context(alt1->predicate); + phelp=MR_unfold(phelp); + MR_clearPredEntry(phelp); + MR_simplifyInverted(phelp,0); + phelp=MR_predSimplifyALLX(phelp,1); + MR_dumpPred1(2,phelp,0); + predicate_free(phelp); + }; + fprintf(output,"\n"); + + fprintf(output,"Choice 2: %s alt %d line %d file %s\n\n", + MR_ruleNamePlusOffset( (Node *) alt2), + alt2->altnum, + alt2->line, + FileStr[alt2->file]); + fprintf(output," The original predicate for choice 2 with available context information:\n\n"); + MR_dumpPred1(1,alt2->predicate,1); + fprintf(output," The predicate for choice 2 after expansion (but without context information):\n\n"); + MR_dumpPred1(1,p2,0); + if (p2 == NULL) { + Predicate *phelp; + fprintf(output," The predicate for choice 2 after expansion (but before simplification)\n\n"); + phelp=predicate_dup_without_context(alt2->predicate); + phelp=MR_unfold(phelp); + MR_clearPredEntry(phelp); + MR_simplifyInverted(phelp,0); + phelp=MR_predSimplifyALLX(phelp,1); + MR_dumpPred1(2,phelp,0); + predicate_free(phelp); + }; + fprintf(output,"\n#endif\n"); + }; + }; + predicate_free(p1); + predicate_free(p2); + }; +} + +static int totalOverflow=0; /* MR9 */ + +void +#ifdef __USE_PROTOS +HandleAmbiguity( Junction *block, Junction *alt1, Junction *alt2, int jtype ) +#else +HandleAmbiguity( block, alt1, alt2, jtype ) +Junction *block; +Junction *alt1; +Junction *alt2; +int jtype; +#endif +{ + unsigned **ftbl; + set *fset, b; + int i, numAmbig,n2; + Tree *ambig=NULL, *t, *u; + char *sub = ""; + long n; + int thisOverflow=0; /* MR9 */ + long set_deg_value; /* MR10 */ + long threshhold; /* MR10 */ + + require(block!=NULL, "NULL block"); + require(block->ntype==nJunction, "invalid block"); + + /* These sets are used to constrain LL_k set, but are made CLL_k long anyway */ + fset = (set *) calloc(CLL_k+1, sizeof(set)); + require(fset!=NULL, "cannot allocate fset"); + ftbl = (unsigned **) calloc(CLL_k+1, sizeof(unsigned *)); + require(ftbl!=NULL, "cannot allocate ftbl"); + + /* create constraint table and count number of possible ambiguities (use<=LL_k) */ + for (n=1,i=1; i<=CLL_k; i++) + { + b = set_and(alt1->fset[i], alt2->fset[i]); +/* MR9 */ set_deg_value = set_deg(b); +/* MR10 */ if (n > 0) { +/* MR10 */ threshhold = LONG_MAX / n; +/* MR10 */ if (set_deg_value <= threshhold) { +/* MR10 */ n *= set_deg_value; +/* MR10 */ } else { +/* MR10 */ n=LONG_MAX; +/* MR9 */ if (totalOverflow == 0) { +#if 0 + /* MR10 comment this out because it just makes users worry */ + +/* MR9 */ warnNoFL("Overflow in computing number of possible ambiguities in HandleAmbiguity\n"); +#endif +/* MR9 */ }; +/* MR9 */ thisOverflow++; +/* MR9 */ totalOverflow++; +/* MR9 */ }; +/* MR10 */ } else { +/* MR10 */ n *= set_deg_value; +/* MR9 */ }; + fset[i] = set_dup(b); + ftbl[i] = set_pdq(b); + set_free(b); + } + + switch ( jtype ) + { + case aSubBlk: sub = "of (..) "; break; + case aOptBlk: sub = "of {..} "; break; + case aLoopBegin: sub = "of (..)* "; break; + case aLoopBlk: sub = "of (..)* "; break; + case aPlusBlk: sub = "of (..)+ "; break; + case RuleBlk: sub = "of the rule itself "; break; + default : sub = ""; break; + } + + /* If the block is marked as a compressed lookahead only block, then + * simply return; ambiguity warning is given only at warning level 2. + */ + if ( block->approx>0 ) + { + if ( ParseWithPredicates ) + { + if (alt1->predicate != NULL) predicate_free(alt1->predicate); /* MR12 */ + if (alt2->predicate != NULL) predicate_free(alt2->predicate); /* MR12 */ + + require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty"); + alt1->predicate = MR_find_predicates_and_supp((Node *)alt1->p1); + require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty"); + require (MR_predicate_context_completed(alt1->predicate),"predicate alt 1 not completed"); + alt1->predicate=MR_predSimplifyALL(alt1->predicate); + + require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty"); + alt2->predicate = MR_find_predicates_and_supp((Node *)alt2->p1); + require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty"); + require (MR_predicate_context_completed(alt2->predicate),"predicate alt 2 not completed"); + alt2->predicate=MR_predSimplifyALL(alt2->predicate); + + MR_doPredicatesHelp(0,alt1,alt2,jtype,sub); + + if ( HoistPredicateContext + && (alt1->predicate!=NULL||alt2->predicate!=NULL) ) + { + verify_context(alt1->predicate); + verify_context(alt2->predicate); + } + + if ( HoistPredicateContext + && (alt1->predicate!=NULL||alt2->predicate!=NULL) + && WarningLevel>1 ) + ensure_predicates_cover_ambiguous_lookahead_sequences(alt1, alt2, sub, ambig); + } + + if ( WarningLevel>1 ) + { + fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line); + if ( jtype == aLoopBegin || jtype == aPlusBlk ) + fprintf(stderr, " warning: optional/exit path and alt(s) %sambiguous upon", sub); + else + fprintf(stderr, " warning(approx): alts %d and %d %sambiguous upon", + alt1->altnum, alt2->altnum, sub); + dumpAmbigMsg(fset, stderr, 0); + MR_traceAmbSource(fset,alt1,alt2); + } + for (i=1; i<=CLL_k; i++) set_free( fset[i] ); + free((char *)fset); + for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] ); + free((char *)ftbl); + return; + } + + /* if all sets have degree 1 for k<LL_k, then must be ambig upon >=1 permutation; + * don't bother doing full LL(k) analysis. + * (This "if" block handles the LL(1) case) + */ + + n2 = 0; + for (i=1; i<LL_k; i++) n2 += set_deg(alt1->fset[i])+set_deg(alt2->fset[i]); + + /* here STARTS the special case in which the lookahead sets for alt1 and alt2 + all have degree 1 for k<LL_k (including LL_k=1) + */ + + if ( n2==2*(LL_k-1) ) + { + + /* TJP: added to fix the case where LL(1) and syntactic predicates didn't + * work. It now recognizes syntactic predicates, but does not like combo: + * LL(1)/syn/sem predicates. (10/24/93) + */ + + if ( first_item_is_guess_block_extra((Junction *)alt1->p1)!=NULL ) + { + if ( WarningLevel==1 ) + { + for (i=1; i<=CLL_k; i++) set_free( fset[i] ); + free((char *)fset); + for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] ); + free((char *)ftbl); + return; + } + + fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line); + if ( jtype == aLoopBegin || jtype == aPlusBlk ) + fprintf(stderr, " warning: optional/exit path and alt(s) %sambiguous upon", sub); + else + fprintf(stderr, " warning: alts %d and %d %sambiguous upon", + alt1->altnum, alt2->altnum, sub); + dumpAmbigMsg(fset, stderr, 0); + MR_traceAmbSource(fset,alt1,alt2); + } + + ambig = NULL; + if ( LL_k>1 ) ambig = make_tree_from_sets(alt1->fset, alt2->fset); + if ( ParseWithPredicates ) + { + if (alt1->predicate != NULL) predicate_free(alt1->predicate); /* MR12 */ + if (alt2->predicate != NULL) predicate_free(alt2->predicate); /* MR12 */ + + require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty"); + alt1->predicate = MR_find_predicates_and_supp((Node *)alt1->p1); + require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty"); + require (MR_predicate_context_completed(alt1->predicate),"predicate alt 1 not completed"); + alt1->predicate=MR_predSimplifyALL(alt1->predicate); + + require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty"); + alt2->predicate = MR_find_predicates_and_supp((Node *)alt2->p1); + require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty"); + require (MR_predicate_context_completed(alt2->predicate),"predicate alt 2 not completed"); + alt2->predicate=MR_predSimplifyALL(alt2->predicate); + + MR_doPredicatesHelp(0,alt1,alt2,jtype,sub); + + if ( HoistPredicateContext && (alt1->predicate!=NULL||alt2->predicate!=NULL) ) + { + verify_context(alt1->predicate); + verify_context(alt2->predicate); + } + if (HoistPredicateContext&&(alt1->predicate!=NULL||alt2->predicate!=NULL) && WarningLevel>1) + ensure_predicates_cover_ambiguous_lookahead_sequences(alt1, alt2, sub, ambig); + if ( WarningLevel == 1 && + (alt1->predicate!=NULL||alt2->predicate!=NULL)) + { + for (i=1; i<=CLL_k; i++) set_free( fset[i] ); + free((char *)fset); + for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] ); + free((char *)ftbl); + Tfree(ambig); + return; + } + } +/* end TJP (10/24/93) */ + + fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line); + if ( jtype == aLoopBegin || jtype == aPlusBlk ) + fprintf(stderr, " warning: optional/exit path and alt(s) %sambiguous upon", sub); + else + fprintf(stderr, " warning: alts %d and %d %sambiguous upon", + alt1->altnum, alt2->altnum, sub); + if ( elevel == 3 && LL_k>1 ) + { + preorder(ambig); + fprintf(stderr, "\n"); + for (i=1; i<=CLL_k; i++) set_free( fset[i] ); + free((char *)fset); + for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] ); + free((char *)ftbl); + Tfree(ambig); + return; + }; + + Tfree(ambig); + dumpAmbigMsg(fset, stderr, 0); + + /* because this is a special case in which both alt1 and alt2 have + lookahead sets of degree 1 for k<LL_k (including k=1) the linear + lookahead style search is adequate + */ + + MR_traceAmbSource(fset,alt1,alt2); + + for (i=1; i<=CLL_k; i++) set_free( fset[i] ); + free((char *)fset); + for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] ); + free((char *)ftbl); + return; + } + + /* here ENDS the special case in which the lookahead sets for alt1 and alt2 + all have degree 1 for k<LL_k (including LL_k=1) + */ + + /* in case tree construction runs out of memory, set info to make good err msg */ + + CurAmbigAlt1 = alt1->altnum; + CurAmbigAlt2 = alt2->altnum; + CurAmbigbtype = sub; + CurAmbigfile = alt1->file; + CurAmbigline = alt1->line; + + /* Don't do full LL(n) analysis if (...)? block because the block, + by definition, defies LL(n) analysis. + If guess (...)? block and ambiguous then don't remove anything from + 2nd alt to resolve ambig. + Want to predict with LL sup 1 ( n ) decision not LL(n) if guess block + since it is much cheaper than LL(n). LL sup 1 ( n ) "covers" the LL(n) + lookahead information. + + Note: LL(n) context cannot be computed for semantic predicates when + followed by (..)?. + + If (..)? then we scream "AAAHHHH! No LL(n) analysis will help" + + Is 'ambig' always defined if we enter this if? I hope so + because the 'ensure...()' func references it. TJP Nov 1993. + */ + + /* THM MR30: Instead of using first_item_is_guss_block we use + first_item_is_guess_block_extra which will look inside a + loop block for a guess block. In other words ( (...)? )*. + It there is an ambiguity in this circumstance then we suppress + the normal methods of resolving ambiguities. + */ + + if ( first_item_is_guess_block_extra((Junction *)alt1->p1)!=NULL ) + { + if ( ParseWithPredicates ) + { + if (alt1->predicate != NULL) predicate_free(alt1->predicate); /* MR12 */ + if (alt2->predicate != NULL) predicate_free(alt2->predicate); /* MR12 */ + require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty"); + alt1->predicate = MR_find_predicates_and_supp((Node *)alt1->p1); + require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty"); + require (MR_predicate_context_completed(alt1->predicate),"predicate alt 1 not completed"); + alt1->predicate=MR_predSimplifyALL(alt1->predicate); + + require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty"); + alt2->predicate = MR_find_predicates_and_supp((Node *)alt2->p1); + require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty"); + require (MR_predicate_context_completed(alt2->predicate),"predicate alt 2 not completed"); + alt2->predicate=MR_predSimplifyALL(alt2->predicate); + + MR_doPredicatesHelp(1,alt1,alt2,jtype,sub); + + if ( HoistPredicateContext && (alt1->predicate!=NULL||alt2->predicate!=NULL) ) + { + verify_context(alt1->predicate); + verify_context(alt2->predicate); + } + if ( HoistPredicateContext && (alt1->predicate!=NULL||alt2->predicate!=NULL) && WarningLevel>1 ) + ensure_predicates_cover_ambiguous_lookahead_sequences(alt1, alt2, sub, ambig); + if ( WarningLevel==1 && + (alt1->predicate!=NULL||alt2->predicate!=NULL)) + { + for (i=1; i<=CLL_k; i++) set_free( fset[i] ); + free((char *)fset); + for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] ); + free((char *)ftbl); + return; + } + } + + if ( WarningLevel>1 ) + { + fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line); + if ( jtype == aLoopBegin || jtype == aPlusBlk ) + fprintf(stderr, " warning: optional/exit path and alt(s) %sambiguous upon", sub); + else + fprintf(stderr, " warning: alts %d and %d %sambiguous upon", + alt1->altnum, alt2->altnum, sub); + dumpAmbigMsg(fset, stderr, 0); + MR_traceAmbSource(fset,alt1,alt2); + } + + for (i=1; i<=CLL_k; i++) set_free( fset[i] ); + free((char *)fset); + for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] ); + free((char *)ftbl); + return; + } + + /* Not resolved with (..)? block. Do full LL(n) analysis */ + + /* ambig is the set of k-tuples truly in common between alt 1 and alt 2 */ + /* MR11 VerifyAmbig once used fset destructively */ + + ambig = VerifyAmbig(alt1, alt2, ftbl, fset, &t, &u, &numAmbig); + + /* are all things in intersection really ambigs? */ + + if (thisOverflow || numAmbig < n ) /* MR9 */ + { + Tree *v; + + /* remove ambig permutation from 2nd alternative to resolve ambig; + * We want to compute the set of artificial tuples, arising from + * LL sup 1 (n) compression, that collide with real tuples from the + * 2nd alternative. This is the set of "special case" tuples that + * the LL sup 1 (n) decision template maps incorrectly. + */ + + /* when generating code in genExpr() it does + * + * if ( genExprSets(j->fset) && !genExprTree(j->ftree)) {... + * + * Sooooo the j->ftree is the tree of alt2 + * after removal of conflicts, not alt1 ! + */ + + if ( ambig!=NULL ) + { + /* at the top of ambig is an ALT node */ + + for (v=ambig->down; v!=NULL; v=v->right) + { + u = trm_perm(u, v); /* remove v FROM u */ + } +/* fprintf(stderr, "after rm alt2:"); preorder(u); fprintf(stderr, "\n");*/ + } + Tfree( t ); + alt1->ftree = tappend(alt1->ftree, u); + alt1->ftree = tleft_factor(alt1->ftree); + } + + if ( ambig==NULL ) + { + for (i=1; i<=CLL_k; i++) set_free( fset[i] ); + free((char *)fset); + for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] ); + free((char *)ftbl); + return; + } + + ambig = tleft_factor(ambig); + +/* TJP: + * At this point, we surely have an LL(k) ambiguity. Check for predicates + */ + if ( ParseWithPredicates ) + { + if (alt1->predicate != NULL) predicate_free(alt1->predicate); /* MR12 */ + if (alt2->predicate != NULL) predicate_free(alt2->predicate); /* MR12 */ + require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty"); + alt1->predicate = MR_find_predicates_and_supp((Node *)alt1->p1); + require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty"); + require (MR_predicate_context_completed(alt1->predicate),"predicate alt 1 not completed"); + alt1->predicate=MR_predSimplifyALL(alt1->predicate); + + require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty"); + alt2->predicate = MR_find_predicates_and_supp((Node *)alt2->p1); + require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty"); + require (MR_predicate_context_completed(alt2->predicate),"predicate alt 2 not completed"); + alt2->predicate=MR_predSimplifyALL(alt2->predicate); + + MR_doPredicatesHelp(0,alt1,alt2,jtype,sub); + + if ( HoistPredicateContext && (alt1->predicate!=NULL||alt2->predicate!=NULL) ) + { + verify_context(alt1->predicate); + verify_context(alt2->predicate); + } + if ( HoistPredicateContext && (alt1->predicate!=NULL||alt2->predicate!=NULL) && WarningLevel>1 ) + ensure_predicates_cover_ambiguous_lookahead_sequences(alt1, alt2, sub, ambig); + if ( WarningLevel==1 && + (alt1->predicate!=NULL||alt2->predicate!=NULL)) + { + + /* We found at least one pred for at least one of the alts; + * If warnings are low, just return. + */ + + Tfree(ambig); + for (i=1; i<=CLL_k; i++) set_free( fset[i] ); + free((char *)fset); + for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] ); + free((char *)ftbl); + return; + } + /* else we're gonna give a warning */ + } +/* end TJP addition */ + + fprintf(stderr, ErrHdr, FileStr[alt1->file], alt1->line); + if ( jtype == aLoopBegin || jtype == aPlusBlk ) + fprintf(stderr, " warning: optional/exit path and alt(s) %sambiguous upon", sub); + else + fprintf(stderr, " warning: alts %d and %d %sambiguous upon", + alt1->altnum, alt2->altnum, sub); + if ( elevel == 3 ) + { + preorder(ambig->down); /* <===== k>1 ambiguity message data */ + fprintf(stderr, "\n"); + } else { + MR_skipped_e3_report=1; + dumpAmbigMsg(fset, stderr, 0); + }; + + MR_traceAmbSourceK(ambig,alt1,alt2); /* <====== k>1 ambiguity aid */ + + Tfree(ambig); + + for (i=1; i<=CLL_k; i++) set_free( fset[i] ); + free((char *)fset); + for (i=1; i<=CLL_k; i++) free( (char *)ftbl[i] ); + free((char *)ftbl); +} + +/* Don't analyze alpha block of (alpha)?beta; if (alpha)? then analyze + * Return the 1st node of the beta block if present else return j. + */ +Junction * +#ifdef __USE_PROTOS +analysis_point( Junction *j ) +#else +analysis_point( j ) +Junction *j; +#endif +{ + Junction *gblock; + + /* MR13b When there was an action/predicate preceding a guess block + the guess block became invisible at the analysis_point. + + first_item_is_guess_block accepts any kind of node, + despite the fact that the formal is a junction. But + I don't want to have to change it all over the place + until I know it works. + */ + + if ( j->ntype != nJunction && j->ntype != nAction) return j; + + gblock = first_item_is_guess_block((Junction *)j); + + if ( gblock!=NULL ) + { + Junction *past = gblock->end; + Junction *p; + require(past!=NULL, "analysis_point: no end block on (...)? block"); + + for (p=(Junction *)past->p1; p!=NULL; ) + { + if ( p->ntype==nAction ) + { + p=(Junction *)((ActionNode *)p)->next; + continue; + } + if ( p->ntype!=nJunction ) + { + past->alpha_beta_guess_end=1; /* MR14 */ + return (Junction *)past->p1; + } + if ( p->jtype==EndBlk || p->jtype==EndRule ) + { + return j; + } +/* MR6 */ +/* MR6 A guess block is of the form "(alpha)? beta" or "(alpha)?". */ +/* MR6 When beta is omitted (second form) this means "(alpha)? alpha". */ +/* MR6 The program does not store another copy of alpha in this case. */ +/* MR6 During analysis when the program needs to know what follows the */ +/* MR6 guess clause. It calls this routine. */ +/* MR6 */ +/* MR6 If it is of the form "(alpha)? beta" it returns a pointer to beta.*/ +/* MR6 */ +/* MR6 If it is of the form "(alpha)?" it returns a pointer to the guess */ +/* MR6 block itself thereby reusing the junction tree. */ +/* MR6 */ +/* MR6 It works by searching the "next in sequence" chain (skipping actions) */ +/* MR6 searching for a RuleRef or Token node. (Those are the only 4 kinds */ +/* MR6 of nodes: Junctions, RuleRef, Token, and Action.) */ +/* MR6 */ +/* MR6 This won't work for the special case "(alpha)? ()" because it has no */ +/* MR6 rule references or token nodes. It eventually encounters a */ +/* MR6 junction of type EndBlk or EndRule and says to its caller: nothing */ +/* MR6 more here to analyze - must be of the form "(alpha)?". */ +/* MR6 */ +/* MR6 In the case of "(alpha)? ()" it should return a pointer to "()" */ +/* MR6 */ +/* MR6 I think. */ +/* MR6 */ + if ( p->jtype!=Generic) { /* MR6 */ + past->alpha_beta_guess_end=1; /* MR14 */ + return (Junction *)past->p1; /* MR6 */ + }; /* MR6 */ + p=(Junction *)p->p1; + } + } + return j; +} + +set +#ifdef __USE_PROTOS +First( Junction *j, int k, int jtype, int *max_k ) +#else +First( j, k, jtype, max_k ) +Junction *j; +int k; +int jtype; +int *max_k; +#endif +{ + Junction *alt1, *alt2; + set a, rk, fCurBlk; + int savek; + int p1, p2; + + int save_maintainBackTrace; + + require(j->ntype==nJunction, "First: non junction passed"); + + /* C o m p u t e F I R S T s e t w i t h k l o o k a h e a d */ + fCurBlk = rk = empty; + for (alt1=j; alt1!=NULL; alt1 = (Junction *)alt1->p2 ) + { + Junction * p = NULL; + Junction * p1junction = NULL; + p = analysis_point((Junction *)alt1->p1); + p1junction = (Junction *) (alt1->p1); +#if 0 + if (p != p1junction) { + fprintf(stdout,"Analysis point for #%d is #%d", p1junction->seq, p->seq); /* debug */ + } +#endif + REACH(p, k, &rk, alt1->fset[k]); + require(set_nil(rk), "rk != nil"); + set_free(rk); + set_orin(&fCurBlk, alt1->fset[k]); + } + + /* D e t e c t A m b i g u i t i e s */ + *max_k = 1; + for (p1=1,alt1=j; alt1!=NULL; alt1 = (Junction *)alt1->p2, p1++) + { + for (p2=1,alt2=(Junction *)alt1->p2; alt2!=NULL; alt2 = (Junction *)alt2->p2, p2++) + { + savek = k; + a = set_and(alt1->fset[k], alt2->fset[k]); + while ( !set_nil(a) ) + { + /* if we have hit the max k requested, just give warning */ + if ( j->approx==k ) { + } + + if ( k==CLL_k ) + { +#ifdef NOT_USED +*** int save_LL_k = LL_k; +*** int save_CLL_k = CLL_k; +*** /* Get new LL_k from interactive feature if enabled */ +*** if ( AImode ) +*** AmbiguityDialog(j, jtype, alt1, alt2, &CLL_k, &LL_k); +#endif + *max_k = CLL_k; + save_maintainBackTrace=MR_MaintainBackTrace; + if (AlphaBetaTrace) MR_MaintainBackTrace=0; + HandleAmbiguity(j, alt1, alt2, jtype); + MR_MaintainBackTrace=save_maintainBackTrace; + break; + } + else + { + Junction *p = analysis_point((Junction *)alt1->p1); + Junction *q = analysis_point((Junction *)alt2->p1); + k++; /* attempt ambig alts again with more lookahead */ + + REACH(p, k, &rk, alt1->fset[k]); + require(set_nil(rk), "rk != nil"); + REACH(q, k, &rk, alt2->fset[k]); + require(set_nil(rk), "rk != nil"); + set_free(a); + a = set_and(alt1->fset[k], alt2->fset[k]); + if ( k > *max_k ) *max_k = k; + } + } + set_free(a); + k = savek; + } + } + + return fCurBlk; +} diff --git a/pccts/antlr/fset2.c b/pccts/antlr/fset2.c new file mode 100644 index 0000000..5393a9e --- /dev/null +++ b/pccts/antlr/fset2.c @@ -0,0 +1,2250 @@ +/* + * fset2.c + * + * Compute FIRST sets for full LL(k) + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2001 + */ + +#include <stdio.h> +#include "pcctscfg.h" +#include <stdlib.h> + +#ifdef PCCTS_USE_STDARG +#include <stdarg.h> +#else +#include <varargs.h> +#endif + +#include "set.h" +#include "syn.h" +#include "hash.h" +#include "generic.h" +#include "dlgdef.h" + +/* ick! globals. Used by permute() to track which elements of a set have been used */ + +static int *findex; +set *fset; /* MR11 make global */ +static unsigned **ftbl; +static set *constrain; /* pts into fset. constrains tToken() to 'constrain' */ +int ConstrainSearch; +int maxk; /* set to initial k upon tree construction request */ + /* MR11 make global */ +static Tree *FreeList = NULL; + +#ifdef __USE_PROTOS +static int tmember_of_context(Tree *, Predicate *); +#else +static int tmember_of_context(); +#endif + +#if TREE_DEBUG +set set_of_tnodes_in_use; +int stop_on_tnode_seq_number=(-1); /* (-1) to disable */ +#endif + +/* Do root + * Then each sibling + */ + +void +#ifdef __USE_PROTOS +preorder( Tree *tree ) +#else +preorder( tree ) +Tree *tree; +#endif +{ + if ( tree == NULL ) return; + if ( tree->down != NULL ) fprintf(stderr, " ("); + if ( tree->token == ALT ) fprintf(stderr, " ALT"); + else fprintf(stderr, " %s", TerminalString(tree->token)); + if ( tree->token==EpToken ) fprintf(stderr, "(%d)", tree->v.rk); + preorder(tree->down); + if ( tree->down != NULL ) fprintf(stderr, " )"); + preorder(tree->right); +} + +#ifdef __USE_PROTOS +int MR_tree_matches_constraints(int k,set * constrain,Tree *t) +#else +int MR_tree_matches_constraints(k,constrain,t) + int k; + set * constrain; + Tree * t; +#endif +{ + int i; + Tree *u; + + if (k == 0) return 1; + + /* for testing guard predicates: if the guard tree is shorter + than the constraint then it is a match. The reason is that + a guard of (A B) should be equivalent to a guard of (A B . . .) + where "." matches every token. Thus a match which runs out + of tree before constraint is a match. + */ + + if (t == NULL) return 1; + require (set_deg(constrain[0]) == 1, + "MR_tree_matches_constraints: set_deg != 1"); + i=set_int(constrain[0]); + if (t->token != i) return 0; + if (k-1 == 0) return 1; + for (u=t->down; u != NULL; u=u->right) { + if (MR_tree_matches_constraints(k-1,&constrain[1],u)) { + return 1; + }; + }; + return 0; +} + +/* check the depth of each primary sibling to see that it is exactly + * k deep. e.g.; + * + * ALT + * | + * A ------- B + * | | + * C -- D E + * + * Remove all branches <= k deep. + * + * Added by TJP 9-23-92 to make the LL(k) constraint mechanism to work. + */ + +static int pruneCount=0; +static int prunePeak=200; + +Tree * +#ifdef __USE_PROTOS +prune( Tree *t, int k ) +#else +prune( t, k ) +Tree *t; +int k; +#endif +{ + pruneCount++; + if (pruneCount > prunePeak+100) { + prunePeak=pruneCount; +#if 0 +*** fprintf(stderr,"pruneCount=%d\n",pruneCount); +/*** preorder(t); ***/ +*** fprintf(stderr,"\n",pruneCount); +#endif + }; + if ( t == NULL ) { + pruneCount--; + return NULL; + }; + if ( t->token == ALT ) fatal_internal("prune: ALT node in FIRST tree"); + if ( t->right!=NULL ) t->right = prune(t->right, k); + if ( k>1 ) + { + if ( t->down!=NULL ) t->down = prune(t->down, k-1); + if ( t->down == NULL ) + { + Tree *r = t->right; + t->right = NULL; + Tfree(t); + pruneCount--; + return r; + } + } + pruneCount--; + return t; +} + +/* build a tree (root child1 child2 ... NULL) */ +#ifdef PCCTS_USE_STDARG +Tree *tmake(Tree *root, ...) +#else +Tree *tmake(va_alist) +va_dcl +#endif +{ + Tree *w; + va_list ap; + Tree *child, *sibling=NULL, *tail=NULL; +#ifndef PCCTS_USE_STDARG + Tree *root; +#endif + +#ifdef PCCTS_USE_STDARG + va_start(ap, root); +#else + va_start(ap); + root = va_arg(ap, Tree *); +#endif + child = va_arg(ap, Tree *); + while ( child != NULL ) + { +#ifdef DUM + /* added "find end of child" thing TJP March 1994 */ + for (w=child; w->right!=NULL; w=w->right) {;} /* find end of child */ +#else + w = child; +#endif + + if ( sibling == NULL ) {sibling = child; tail = w;} + else {tail->right = child; tail = w;} + child = va_arg(ap, Tree *); + } + + /* was "root->down = sibling;" */ + if ( root==NULL ) root = sibling; + else root->down = sibling; + + va_end(ap); + return root; +} + +Tree * +#ifdef __USE_PROTOS +tnode( int tok ) +#else +tnode( tok ) +int tok; +#endif +{ + Tree *p, *newblk; + static int n=0; + + if ( FreeList == NULL ) + { + /*fprintf(stderr, "tnode: %d more nodes\n", TreeBlockAllocSize);*/ + if ( TreeResourceLimit > 0 ) + { + if ( (n+TreeBlockAllocSize) >= TreeResourceLimit ) + { + fprintf(stderr, ErrHdr, FileStr[CurAmbigfile], CurAmbigline); + fprintf(stderr, " hit analysis resource limit while analyzing alts %d and %d %s\n", + CurAmbigAlt1, + CurAmbigAlt2, + CurAmbigbtype); + exit(PCCTS_EXIT_FAILURE); + } + } + newblk = (Tree *)calloc(TreeBlockAllocSize, sizeof(Tree)); + if ( newblk == NULL ) + { + fprintf(stderr, ErrHdr, FileStr[CurAmbigfile], CurAmbigline); + fprintf(stderr, " out of memory while analyzing alts %d and %d %s\n", + CurAmbigAlt1, + CurAmbigAlt2, + CurAmbigbtype); + exit(PCCTS_EXIT_FAILURE); + } + n += TreeBlockAllocSize; + for (p=newblk; p<&(newblk[TreeBlockAllocSize]); p++) + { + p->right = FreeList; /* add all new Tree nodes to Free List */ + FreeList = p; + } + } + p = FreeList; + FreeList = FreeList->right; /* remove a tree node */ + p->right = NULL; /* zero out ptrs */ + p->down = NULL; + p->token = tok; + + TnodesAllocated++; /* MR10 */ + TnodesInUse++; /* MR10 */ + if (TnodesInUse > TnodesPeak) TnodesPeak=TnodesInUse; /* MR10 */ + +#ifdef TREE_DEBUG + require(!p->in_use, "tnode: node in use!"); + p->in_use = 1; + p->seq=TnodesAllocated; + set_orel( (unsigned) TnodesAllocated,&set_of_tnodes_in_use); + if (stop_on_tnode_seq_number == p->seq) { + fprintf(stderr,"\n*** just allocated tnode #%d ***\n", + stop_on_tnode_seq_number); + }; +#endif + return p; +} + +static Tree * +#ifdef __USE_PROTOS +eofnode( int k ) +#else +eofnode( k ) +int k; +#endif +{ + Tree *t=NULL; + int i; + + for (i=1; i<=k; i++) + { + t = tmake(tnode((TokenInd!=NULL?TokenInd[EofToken]:EofToken)), t, NULL); + } + return t; +} + + + +void +#ifdef __USE_PROTOS +_Tfree( Tree *t ) +#else +_Tfree( t ) +Tree *t; +#endif +{ + if ( t!=NULL ) + { +#ifdef TREE_DEBUG + if (t->seq == stop_on_tnode_seq_number) { + fprintf(stderr,"\n*** just freed tnode #%d ***\n",t->seq); + }; + require(t->in_use, "_Tfree: node not in use!"); + t->in_use = 0; + set_rm( (unsigned) t->seq,set_of_tnodes_in_use); +#endif + t->right = FreeList; + FreeList = t; + TnodesInUse--; /* MR10 */ + } +} + +/* tree duplicate */ +Tree * +#ifdef __USE_PROTOS +tdup( Tree *t ) +#else +tdup( t ) +Tree *t; +#endif +{ + Tree *u; + + if ( t == NULL ) return NULL; + u = tnode(t->token); + u->v.rk = t->v.rk; + u->right = tdup(t->right); + u->down = tdup(t->down); + return u; +} + +/* tree duplicate (assume tree is a chain downwards) */ +Tree * +#ifdef __USE_PROTOS +tdup_chain( Tree *t ) +#else +tdup_chain( t ) +Tree *t; +#endif +{ + Tree *u; + + if ( t == NULL ) return NULL; + u = tnode(t->token); + u->v.rk = t->v.rk; + u->down = tdup(t->down); + return u; +} + +Tree * +#ifdef __USE_PROTOS +tappend( Tree *t, Tree *u ) +#else +tappend( t, u ) +Tree *t; +Tree *u; +#endif +{ + Tree *w; + +/*** fprintf(stderr, "tappend("); + *** preorder(t); fprintf(stderr, ","); + *** preorder(u); fprintf(stderr, " )\n"); +*/ + if ( t == NULL ) return u; + if ( t->token == ALT && t->right == NULL ) return tappend(t->down, u); + for (w=t; w->right!=NULL; w=w->right) {;} + w->right = u; + return t; +} + +/* dealloc all nodes in a tree */ +void +#ifdef __USE_PROTOS +Tfree( Tree *t ) +#else +Tfree( t ) +Tree *t; +#endif +{ + if ( t == NULL ) return; + Tfree( t->down ); + Tfree( t->right ); + _Tfree( t ); +} + +/* find all children (alts) of t that require remaining_k nodes to be LL_k + * tokens long. + * + * t-->o + * | + * a1--a2--...--an <-- LL(1) tokens + * | | | + * b1 b2 ... bn <-- LL(2) tokens + * | | | + * . . . + * . . . + * z1 z2 ... zn <-- LL(LL_k) tokens + * + * We look for all [Ep] needing remaining_k nodes and replace with u. + * u is not destroyed or actually used by the tree (a copy is made). + */ +Tree * +#ifdef __USE_PROTOS +tlink( Tree *t, Tree *u, int remaining_k ) +#else +tlink( t, u, remaining_k ) +Tree *t; +Tree *u; +int remaining_k; +#endif +{ + Tree *p; + require(remaining_k!=0, "tlink: bad tree"); + + if ( t==NULL ) return NULL; + /*fprintf(stderr, "tlink: u is:"); preorder(u); fprintf(stderr, "\n");*/ + if ( t->token == EpToken && t->v.rk == remaining_k ) + { + require(t->down==NULL, "tlink: invalid tree"); + if ( u == NULL ) { +/* MR10 */ Tree *tt=t->right; +/* MR10 */ _Tfree(t); +/* MR10 */ return tt; + }; + p = tdup( u ); + p->right = t->right; + _Tfree( t ); + return p; + } + t->down = tlink(t->down, u, remaining_k); + t->right = tlink(t->right, u, remaining_k); + return t; +} + +/* remove as many ALT nodes as possible while still maintaining semantics */ +Tree * +#ifdef __USE_PROTOS +tshrink( Tree *t ) +#else +tshrink( t ) +Tree *t; +#endif +{ + if ( t == NULL ) return NULL; + t->down = tshrink( t->down ); + t->right = tshrink( t->right ); + if ( t->down == NULL ) + { + if ( t->token == ALT ) + { + Tree *u = t->right; + _Tfree(t); + return u; /* remove useless alts */ + } + return t; + } + + /* (? (ALT (? ...)) s) ==> (? (? ...) s) where s = sibling, ? = match any */ + if ( t->token == ALT && t->down->right == NULL) + { + Tree *u = t->down; + u->right = t->right; + _Tfree( t ); + return u; + } + /* (? (A (ALT t)) s) ==> (? (A t) s) where A is a token; s,t siblings */ + if ( t->token != ALT && t->down->token == ALT && t->down->right == NULL ) + { + Tree *u = t->down->down; + _Tfree( t->down ); + t->down = u; + return t; + } + return t; +} + +Tree * +#ifdef __USE_PROTOS +tflatten( Tree *t ) +#else +tflatten( t ) +Tree *t; +#endif +{ + if ( t == NULL ) return NULL; + t->down = tflatten( t->down ); + t->right = tflatten( t->right ); + if ( t->down == NULL ) return t; + + if ( t->token == ALT ) + { + Tree *u; + /* find tail of children */ + for (u=t->down; u->right!=NULL; u=u->right) {;} + u->right = t->right; + u = t->down; + _Tfree( t ); + return u; + } + return t; +} + +Tree * +#ifdef __USE_PROTOS +tJunc( Junction *p, int k, set *rk ) +#else +tJunc( p, k, rk ) +Junction *p; +int k; +set *rk; +#endif +{ + Tree *t=NULL, *u=NULL; + Junction *alt; + Tree *tail=NULL, *r; + +#ifdef DBG_TRAV + fprintf(stderr, "tJunc(%d): %s in rule %s\n", k, + decodeJType[p->jtype], ((Junction *)p)->rname); +#endif + +/* MR14 */ if (AlphaBetaTrace && p->alpha_beta_guess_end) { +/* MR14 */ warnFL( +/* MR14 */ "not possible to compute follow set for alpha in an \"(alpha)? beta\" block. ", +/* MR14 */ FileStr[p->file],p->line); +/* MR14 */ MR_alphaBetaTraceReport(); +/* MR14 */ }; + +/* MR14 */ if (p->alpha_beta_guess_end) { +/* MR14 */ return NULL; +/* MR14 */ } + + if ( p->jtype==aLoopBlk || p->jtype==RuleBlk || + p->jtype==aPlusBlk || p->jtype==aSubBlk || p->jtype==aOptBlk ) + { + if ( p->jtype!=aSubBlk && p->jtype!=aOptBlk ) { + require(p->lock!=NULL, "rJunc: lock array is NULL"); + if ( p->lock[k] ) return NULL; + p->lock[k] = TRUE; + } + +/* MR10 */ if (MR_MaintainBackTrace) { +/* MR10 */ if (p->jtype != Generic) MR_pointerStackPush(&MR_BackTraceStack,p); +/* MR10 */ }; + + TRAV(p->p1, k, rk, tail); + +/* MR10 */ if (MR_MaintainBackTrace) { +/* MR10 */ if (p->jtype != Generic) MR_pointerStackPop(&MR_BackTraceStack); +/* MR10 */ }; + + if ( p->jtype==RuleBlk ) {p->lock[k] = FALSE; return tail;} + r = tmake(tnode(ALT), tail, NULL); + for (alt=(Junction *)p->p2; alt!=NULL; alt = (Junction *)alt->p2) + { + /* if this is one of the added optional alts for (...)+ then break */ + if ( alt->ignore ) break; + + if ( tail==NULL ) {TRAV(alt->p1, k, rk, tail); r->down = tail;} + else + { +/* MR10 */ if (MR_MaintainBackTrace) { +/* MR10 */ if (p->jtype != Generic) MR_pointerStackPush(&MR_BackTraceStack,p); +/* MR10 */ }; + + TRAV(alt->p1, k, rk, tail->right); + +/* MR10 */ if (MR_MaintainBackTrace) { +/* MR10 */ if (p->jtype != Generic) MR_pointerStackPop(&MR_BackTraceStack); +/* MR10 */ }; + if ( tail->right != NULL ) tail = tail->right; + } + } + if ( p->jtype!=aSubBlk && p->jtype!=aOptBlk ) p->lock[k] = FALSE; +#ifdef DBG_TREES + fprintf(stderr, "blk(%s) returns:",((Junction *)p)->rname); preorder(r); fprintf(stderr, "\n"); +#endif + if ( r->down == NULL ) {_Tfree(r); return NULL;} + return r; + } + + if ( p->jtype==EndRule ) + { + if ( p->halt ) /* don't want FOLLOW here? */ + { +/**** if ( ContextGuardTRAV ) return NULL; ****/ + set_orel( (unsigned) k, rk); /* indicate this k value needed */ /* MR10 cast */ + t = tnode(EpToken); + t->v.rk = k; + return t; + } + require(p->lock!=NULL, "rJunc: lock array is NULL"); + if ( p->lock[k] ) return NULL; + /* if no FOLLOW assume k EOF's */ + if ( p->p1 == NULL ) return eofnode(k); + p->lock[k] = TRUE; + } + +/* MR14 */ if (p->p1 != NULL && p->guess && p->guess_analysis_point == NULL) { +/* MR14 */ Node * guess_point; +/* MR14 */ guess_point=(Node *)analysis_point(p); +/* MR14 */ if (guess_point == (Node *)p) { +/* MR14 */ guess_point=p->p1; +/* MR14 */ } +/* MR14 */ p->guess_analysis_point=guess_point; +/* MR14 */ } + + if ( p->p2 == NULL ) + { + +/* MR10 */ if (MR_MaintainBackTrace) { +/* MR10 */ if (p->jtype != Generic) MR_pointerStackPush(&MR_BackTraceStack,p); +/* MR10 */ }; + +/* M14 */ if (p->guess_analysis_point != NULL) { +/* M14 */ TRAV(p->guess_analysis_point, k, rk,t); +/* M14 */ } else { + TRAV(p->p1, k, rk,t); +/* M14 */ } + +/* MR10 */ if (MR_MaintainBackTrace) { +/* MR10 */ if (p->jtype != Generic) MR_pointerStackPop(&MR_BackTraceStack); +/* MR10 */ }; + + if ( p->jtype==EndRule ) p->lock[k]=FALSE; + return t; + } + +/* MR10 */ if (MR_MaintainBackTrace) { +/* MR10 */ if (p->jtype != Generic) MR_pointerStackPush(&MR_BackTraceStack,p); +/* MR10 */ }; + +/* M14 */ if (p->guess_analysis_point != NULL) { +/* M14 */ TRAV(p->guess_analysis_point, k, rk,t); +/* M14 */ } else { + TRAV(p->p1, k, rk,t); +/* M14 */ } + +/* MR10 */ if (MR_MaintainBackTrace) { +/* MR10 */ if (p->jtype != Generic) MR_pointerStackPop(&MR_BackTraceStack); +/* MR10 */ }; + + if ( p->jtype!=RuleBlk && /* MR14 */ !p->guess) TRAV(p->p2, k, rk, u); + + if ( p->jtype==EndRule ) p->lock[k] = FALSE;/* unlock node */ + + if ( t==NULL ) return tmake(tnode(ALT), u, NULL); + return tmake(tnode(ALT), t, u, NULL); +} + +Tree * +#ifdef __USE_PROTOS +tRuleRef( RuleRefNode *p, int k, set *rk_out ) +#else +tRuleRef( p, k, rk_out ) +RuleRefNode *p; +int k; +set *rk_out; +#endif +{ + int k2; + Tree *t=NULL, *u=NULL; + Junction *r; + set rk, rk2; + int save_halt; + RuleEntry *q = (RuleEntry *) hash_get(Rname, p->text); + +#ifdef DBG_TRAV + fprintf(stderr, "tRuleRef: %s\n", p->text); +#endif + if ( q == NULL ) + { + TRAV(p->next, k, rk_out, t);/* ignore undefined rules */ + return t; + } + rk = rk2 = empty; + if (RulePtr == NULL) fatal("RulePtr==NULL"); + r = RulePtr[q->rulenum]; + if ( r->lock[k] ) return NULL; + save_halt = r->end->halt; + r->end->halt = TRUE; /* don't let reach fall off end of rule here */ + +/* MR10 */ if (MR_MaintainBackTrace) { +/* MR10 */ MR_pointerStackPush(&MR_BackTraceStack,p); +/* MR10 */ }; + + TRAV(r, k, &rk, t); + +/* MR10 */ if (MR_MaintainBackTrace) { +/* MR10 */ MR_pointerStackPop(&MR_BackTraceStack); +/* MR10 */ }; + + r->end->halt = save_halt; +#ifdef DBG_TREES + fprintf(stderr, "after ruleref, t is:"); preorder(t); fprintf(stderr, "\n"); +#endif + t = tshrink( t ); + while ( !set_nil(rk) ) { /* any k left to do? if so, link onto tree */ + k2 = set_int(rk); + set_rm(k2, rk); + +/* MR10 */ if (MR_MaintainBackTrace) { +/* MR10 */ MR_pointerStackPush(&MR_BackTraceStack,p); +/* MR10 */ }; + + TRAV(p->next, k2, &rk2, u); + +/* MR10 */ if (MR_MaintainBackTrace) { +/* MR10 */ MR_pointerStackPop(&MR_BackTraceStack); +/* MR10 */ }; + + t = tlink(t, u, k2); /* any alts missing k2 toks, add u onto end */ + Tfree(u); /* MR10 */ + } + set_free(rk); /* rk is empty, but free it's memory */ + set_orin(rk_out, rk2); /* remember what we couldn't do */ + set_free(rk2); + return t; +} + +Tree * +#ifdef __USE_PROTOS +tToken( TokNode *p, int k, set *rk ) +#else +tToken( p, k, rk ) +TokNode *p; +int k; +set *rk; +#endif +{ + Tree *t=NULL, *tset=NULL, *u; + + if (ConstrainSearch) { + if (MR_AmbSourceSearch) { + require(constrain>=fset&&constrain<=&(fset[CLL_k]),"tToken: constrain is not a valid set"); + } else { + require(constrain>=fset&&constrain<=&(fset[LL_k]),"tToken: constrain is not a valid set"); + }; + constrain = &fset[maxk-k+1]; + } + +#ifdef DBG_TRAV + fprintf(stderr, "tToken(%d): %s\n", k, TerminalString(p->token)); + if ( ConstrainSearch ) { + fprintf(stderr, "constrain is:"); s_fprT(stderr, *constrain); fprintf(stderr, "\n"); + } +#endif + + /* is it a meta token (set of tokens)? */ + + if ( !set_nil(p->tset) ) + { + unsigned e=0; + set a; + Tree *n, *tail = NULL; + + if ( ConstrainSearch ) { + a = set_and(p->tset, *constrain); + if (set_nil(a)) { /* MR10 */ + set_free(a); /* MR11 */ + return NULL; /* MR10 */ + }; /* MR10 */ + } else { + a = set_dup(p->tset); + }; + + for (; !set_nil(a); set_rm(e, a)) + { + e = set_int(a); + n = tnode(e); + if ( tset==NULL ) { tset = n; tail = n; } + else { tail->right = n; tail = n; } + } + set_free( a ); + } + else if ( ConstrainSearch && !set_el(p->token, *constrain) ) + { +/* fprintf(stderr, "ignoring token %s(%d)\n", TerminalString(p->token), + k);*/ + return NULL; + } + else { + tset = tnode( p->token ); + }; + +/* MR10 */ if (MR_MaintainBackTrace) { +/* MR10 */ if (k == 1) { +/* MR10 */ MR_pointerStackPush(&MR_BackTraceStack,p); +/* MR13 */ if (MR_SuppressSearch) { +/* MR13 */ MR_suppressSearchReport(); +/* MR13 */ } else { +/* MR10 */ MR_backTraceReport(); +/* MR13 */ }; +/* MR10 */ MR_pointerStackPop(&MR_BackTraceStack); +/* MR11 */ Tfree(tset); +/* MR11 */ return NULL; +/* MR10 */ }; +/* MR10 */ }; + + if ( k == 1 ) return tset; + + if (MR_MaintainBackTrace) { + MR_pointerStackPush(&MR_BackTraceStack,p); + }; + + TRAV(p->next, k-1, rk, t); + + if (MR_MaintainBackTrace) { + Tfree(t); + Tfree(tset); + MR_pointerStackPop(&MR_BackTraceStack); + return NULL; + }; + + /* here, we are positive that, at least, this tree will not contribute + * to the LL(2) tree since it will be too shallow, IF t==NULL. + * If doing a context guard walk, then don't prune. + */ + if ( t == NULL && !ContextGuardTRAV ) /* tree will be too shallow */ + { + if ( tset!=NULL ) Tfree( tset ); + return NULL; + } +#ifdef DBG_TREES + fprintf(stderr, "tToken(%d)->next:",k); preorder(t); fprintf(stderr, "\n"); +#endif + + /* if single token root, then just make new tree and return */ + /* MR10 - set_nil(p->tset) isn't a good test because of ConstraintSearch */ + + if (tset->right == NULL) return tmake(tset, t, NULL); /* MR10 */ + + /* here we must make a copy of t as a child of each element of the tset; + * e.g., "T1..T3 A" would yield ( nil ( T1 A ) ( T2 A ) ( T3 A ) ) + */ + for (u=tset; u!=NULL; u=u->right) + { + /* make a copy of t and hook it onto bottom of u */ + u->down = tdup(t); + } + Tfree( t ); +#ifdef DBG_TREES + fprintf(stderr, "range is:"); preorder(tset); fprintf(stderr, "\n"); +#endif + return tset; +} + +Tree * +#ifdef __USE_PROTOS +tAction( ActionNode *p, int k, set *rk ) +#else +tAction( p, k, rk ) +ActionNode *p; +int k; +set *rk; +#endif +{ + Tree *t=NULL; + set *save_fset=NULL; + int i; + + /* fprintf(stderr, "tAction\n"); */ + +/* An MR_SuppressSearch is looking for things that can be + reached even when the predicate is false. + + There are three kinds of predicates: + plain: r1: <<p>>? r2 + guarded: r1: (A)? => <<p>>? r2 + ampersand style: r1: (A)? && <<p>>? r2 + + Of the three kinds of predicates, only a guard predicate + has things which are reachable even when the predicate + is false. To be reachable the constraint must *not* + match the guard. + +*/ + + if (p->is_predicate && MR_SuppressSearch) { + + Predicate *pred=p->guardpred; + + if (pred == NULL) { + t=NULL; + goto EXIT; + }; + constrain = &fset[maxk-k+1]; + if (pred->k == 1) { + set dif; + dif=set_dif(*constrain,pred->scontext[1]); + if (set_nil(dif)) { + set_free(dif); + t=NULL; + goto EXIT; + }; + set_free(dif); + } else { + if (MR_tree_matches_constraints(k,constrain,pred->tcontext)) { + t=NULL; + goto EXIT; + }; + } + }; + + /* The ampersand predicate differs from the + other predicates because its first set + is a subset of the first set behind the predicate + + r1: (A)? && <<p>>? r2 ; + r2: A | B; + + In this case first[1] of r1 is A, even + though first[1] of r2 is {A B}. + */ + + if (p->is_predicate && p->ampersandPred != NULL) { + + Predicate *pred=p->ampersandPred; + Tree *tAND; + Tree *tset; + + if (k <= pred->k) { + if (MR_MaintainBackTrace) MR_pointerStackPush(&MR_BackTraceStack,p); + TRAV(p->guardNodes,k,rk,t); + if (MR_MaintainBackTrace) MR_pointerStackPop(&MR_BackTraceStack); + return t; + } else { + require (k>1,"tAction for ampersandpred: k <= 1"); + if (ConstrainSearch) { + if (MR_AmbSourceSearch) { + require(constrain>=fset&&constrain<=&(fset[CLL_k]), + "tToken: constrain is not a valid set"); + } else { + require(constrain>=fset&&constrain<=&(fset[LL_k]), + "tToken: constrain is not a valid set"); + }; + save_fset=(set *) calloc (CLL_k+1,sizeof(set)); + require (save_fset != NULL,"tAction save_fset alloc"); + for (i=1; i <= CLL_k ; i++) { + save_fset[i]=set_dup(fset[i]); + }; + if (pred->k == 1) { + constrain = &fset[maxk-k+1]; + set_andin(constrain,pred->scontext[1]); + if (set_nil(*constrain)) { + t=NULL; + goto EXIT; + }; + } else { + constrain = &fset[maxk-k+1]; + if (! MR_tree_matches_constraints(pred->k,constrain,pred->tcontext)) { + t=NULL; + goto EXIT; + }; /* end loop on i */ + }; /* end loop on pred scontext/tcontext */ + }; /* end if on k > pred->k */ + }; /* end if on constrain search */ + + TRAV(p->next,k,rk,t); + + if (t != NULL) { + t=tshrink(t); + t=tflatten(t); + t=tleft_factor(t); + if (pred->tcontext != NULL) { + tAND=MR_computeTreeAND(t,pred->tcontext); + } else { + tset=MR_make_tree_from_set(pred->scontext[1]); + tAND=MR_computeTreeAND(t,tset); + Tfree(tset); + }; + Tfree(t); + t=tAND; + }; + goto EXIT; + + }; /* end if on ampersand predicate */ + + TRAV(p->next,k,rk,t); + +EXIT: + if (save_fset != NULL) { + for (i=1 ; i <= CLL_k ; i++) { + set_free(fset[i]); + fset[i]=save_fset[i]; + }; + free ( (char *) save_fset); + }; + return t; +} + +/* see if e exists in s as a possible input permutation (e is always a chain) */ + +int +#ifdef __USE_PROTOS +tmember( Tree *e, Tree *s ) +#else +tmember( e, s ) +Tree *e; +Tree *s; +#endif +{ + if ( e==NULL||s==NULL ) return 0; +/** fprintf(stderr, "tmember("); +*** preorder(e); fprintf(stderr, ","); +*** preorder(s); fprintf(stderr, " )\n"); +*/ + if ( s->token == ALT && s->right == NULL ) return tmember(e, s->down); + if ( e->token!=s->token ) + { + if ( s->right==NULL ) return 0; + return tmember(e, s->right); + } + if ( e->down==NULL && s->down == NULL ) return 1; + if ( tmember(e->down, s->down) ) return 1; + if ( s->right==NULL ) return 0; + return tmember(e, s->right); +} + +/* see if e exists in s as a possible input permutation (e is always a chain); + * Only check s to the depth of e. In other words, 'e' can be a shorter + * sequence than s. + */ +int +#ifdef __USE_PROTOS +tmember_constrained( Tree *e, Tree *s) +#else +tmember_constrained( e, s ) +Tree *e; +Tree *s; +#endif +{ + if ( e==NULL||s==NULL ) return 0; +/** fprintf(stderr, "tmember_constrained("); +*** preorder(e); fprintf(stderr, ","); +*** preorder(s); fprintf(stderr, " )\n"); +**/ + if ( s->token == ALT && s->right == NULL ) + return tmember_constrained(e, s->down); + if ( e->token!=s->token ) + { + if ( s->right==NULL ) return 0; + return tmember_constrained(e, s->right); + } + if ( e->down == NULL ) return 1; /* if s is matched to depth of e return */ + if ( tmember_constrained(e->down, s->down) ) return 1; + if ( s->right==NULL ) return 0; + return tmember_constrained(e, s->right); +} + +/* combine (? (A t) ... (A u) ...) into (? (A t u)) */ +Tree * +#ifdef __USE_PROTOS +tleft_factor( Tree *t ) +#else +tleft_factor( t ) +Tree *t; +#endif +{ + Tree *u, *v, *trail, *w; + + /* left-factor what is at this level */ + if ( t == NULL ) return NULL; + for (u=t; u!=NULL; u=u->right) + { + trail = u; + v=u->right; + while ( v!=NULL ) + { + if ( u->token == v->token ) + { + if ( u->down!=NULL ) + { + for (w=u->down; w->right!=NULL; w=w->right) {;} + w->right = v->down; /* link children together */ + } + else u->down = v->down; + trail->right = v->right; /* unlink factored node */ + _Tfree( v ); + v = trail->right; + } + else {trail = v; v=v->right;} + } + } + /* left-factor what is below */ + for (u=t; u!=NULL; u=u->right) u->down = tleft_factor( u->down ); + return t; +} + +/* remove the permutation p from t if present */ +Tree * +#ifdef __USE_PROTOS +trm_perm( Tree *t, Tree *p ) +#else +trm_perm( t, p ) +Tree *t; +Tree *p; +#endif +{ + /* + fprintf(stderr, "trm_perm("); + preorder(t); fprintf(stderr, ","); + preorder(p); fprintf(stderr, " )\n"); + */ + if ( t == NULL || p == NULL ) return NULL; + if ( t->token == ALT ) + { + t->down = trm_perm(t->down, p); + if ( t->down == NULL ) /* nothing left below, rm cur node */ + { + Tree *u = t->right; + _Tfree( t ); + return trm_perm(u, p); + } + t->right = trm_perm(t->right, p); /* look for more instances of p */ + return t; + } + if ( p->token != t->token ) /* not found, try a sibling */ + { + t->right = trm_perm(t->right, p); + return t; + } + t->down = trm_perm(t->down, p->down); + if ( t->down == NULL ) /* nothing left below, rm cur node */ + { + Tree *u = t->right; + _Tfree( t ); + return trm_perm(u, p); + } + t->right = trm_perm(t->right, p); /* look for more instances of p */ + return t; +} + +/* add the permutation 'perm' to the LL_k sets in 'fset' */ +void +#ifdef __USE_PROTOS +tcvt( set *fset, Tree *perm ) +#else +tcvt( fset, perm ) +set *fset; +Tree *perm; +#endif +{ + if ( perm==NULL ) return; + set_orel(perm->token, fset); + tcvt(fset+1, perm->down); +} + +/* for each element of ftbl[k], make it the root of a tree with permute(ftbl[k+1]) + * as a child. + */ +Tree * +#ifdef __USE_PROTOS +permute( int k, int max_k ) +#else +permute( k, max_k ) +int k, max_k; +#endif +{ + Tree *t, *u; + + if ( k>max_k ) return NULL; + if ( ftbl[k][findex[k]] == nil ) return NULL; + t = permute(k+1, max_k); + if ( t==NULL&&k<max_k ) /* no permutation left below for k+1 tokens? */ + { + findex[k+1] = 0; + (findex[k])++; /* try next token at this k */ + return permute(k, max_k); + } + + u = tmake(tnode(ftbl[k][findex[k]]), t, NULL); + if ( k == max_k ) (findex[k])++; + return u; +} + +/* Compute LL(k) trees for alts alt1 and alt2 of p. + * function result is tree of ambiguous input permutations + * + * ALGORITHM may change to look for something other than LL_k size + * trees ==> maxk will have to change. + */ +Tree * +#ifdef __USE_PROTOS +VerifyAmbig( Junction *alt1, Junction *alt2, unsigned **ft, set *fs, Tree **t, Tree **u, int *numAmbig ) +#else +VerifyAmbig( alt1, alt2, ft, fs, t, u, numAmbig ) +Junction *alt1; +Junction *alt2; +unsigned **ft; +set *fs; +Tree **t; +Tree **u; +int *numAmbig; +#endif +{ + set rk; + Tree *perm, *ambig=NULL; + Junction *p; + int k; + int tnodes_at_start=TnodesAllocated; + int tnodes_at_end; + int tnodes_used; + set *save_fs; + int j; + + save_fs=(set *) calloc(CLL_k+1,sizeof(set)); + require(save_fs != NULL,"save_fs calloc"); + + for (j=0; j <= CLL_k ; j++) save_fs[j]=set_dup(fs[j]); + + maxk = LL_k; /* NOTE: for now, we look for LL_k */ + ftbl = ft; + fset = fs; + constrain = &(fset[1]); + findex = (int *) calloc(LL_k+1, sizeof(int)); + if ( findex == NULL ) + { + fprintf(stderr, ErrHdr, FileStr[CurAmbigfile], CurAmbigline); + fprintf(stderr, " out of memory while analyzing alts %d and %d of %s\n", + CurAmbigAlt1, + CurAmbigAlt2, + CurAmbigbtype); + exit(PCCTS_EXIT_FAILURE); + } + for (k=1; k<=LL_k; k++) findex[k] = 0; + + rk = empty; + ConstrainSearch = 1; /* consider only tokens in ambig sets */ + + p = analysis_point((Junction *)alt1->p1); + TRAV(p, LL_k, &rk, *t); + *t = tshrink( *t ); + *t = tflatten( *t ); + *t = tleft_factor( *t ); /* MR10 */ + *t = prune(*t, LL_k); + *t = tleft_factor( *t ); + +/*** fprintf(stderr, "after shrink&flatten&prune&left_factor:"); preorder(*t); fprintf(stderr, "\n");*/ + if ( *t == NULL ) + { +/*** fprintf(stderr, "TreeIncomplete --> no LL(%d) ambiguity\n", LL_k);*/ + Tfree( *t ); /* kill if impossible to have ambig */ + *t = NULL; + } + + p = analysis_point((Junction *)alt2->p1); + + TRAV(p, LL_k, &rk, *u); + *u = tshrink( *u ); + *u = tflatten( *u ); + *t = tleft_factor( *t ); /* MR10 */ + *u = prune(*u, LL_k); + *u = tleft_factor( *u ); +/* fprintf(stderr, "after shrink&flatten&prune&lfactor:"); preorder(*u); fprintf(stderr, "\n");*/ + if ( *u == NULL ) + { +/* fprintf(stderr, "TreeIncomplete --> no LL(%d) ambiguity\n", LL_k);*/ + Tfree( *u ); + *u = NULL; + } + + for (k=1; k<=LL_k; k++) set_clr( fs[k] ); + + ambig = tnode(ALT); + k = 0; + if ( *t!=NULL && *u!=NULL ) + { + while ( (perm=permute(1,LL_k))!=NULL ) + { +/* fprintf(stderr, "chk perm:"); preorder(perm); fprintf(stderr, "\n");*/ + if ( tmember(perm, *t) && tmember(perm, *u) ) + { +/* fprintf(stderr, "ambig upon"); preorder(perm); fprintf(stderr, "\n");*/ + + k++; + perm->right = ambig->down; + ambig->down = perm; + tcvt(&(fs[1]), perm); + } + else Tfree( perm ); + } + } + + for (j=0; j <= CLL_k ; j++) fs[j]=save_fs[j]; + free( (char *) save_fs); + + tnodes_at_end=TnodesAllocated; + tnodes_used=tnodes_at_end - tnodes_at_start; + + if (TnodesReportThreshold > 0 && tnodes_used > TnodesReportThreshold) { + fprintf(stdout,"There were %d tuples whose ambiguity could not be resolved by full lookahead\n",k); + fprintf(stdout,"There were %d tnodes created to resolve ambiguity between:\n\n",tnodes_used); + fprintf(stdout," Choice 1: %s line %d file %s\n", + MR_ruleNamePlusOffset( (Node *) alt1),alt1->line,FileStr[alt1->file]); + fprintf(stdout," Choice 2: %s line %d file %s\n", + MR_ruleNamePlusOffset( (Node *) alt2),alt2->line,FileStr[alt2->file]); + for (j=1; j <= CLL_k ; j++) { + fprintf(stdout,"\n Intersection of lookahead[%d] sets:\n",j); + MR_dumpTokenSet(stdout,2,fs[j]); + }; + fprintf(stdout,"\n"); + }; + + *numAmbig = k; + if ( ambig->down == NULL ) {_Tfree(ambig); ambig = NULL;} + free( (char *)findex ); +/* fprintf(stderr, "final ambig:"); preorder(ambig); fprintf(stderr, "\n");*/ + return ambig; +} + +static Tree * +#ifdef __USE_PROTOS +bottom_of_chain( Tree *t ) +#else +bottom_of_chain( t ) +Tree *t; +#endif +{ + if ( t==NULL ) return NULL; + for (; t->down != NULL; t=t->down) {;} + return t; +} + +/* + * Make a tree from k sets where the degree of the first k-1 sets is 1. + */ +Tree * +#ifdef __USE_PROTOS +make_tree_from_sets( set *fset1, set *fset2 ) +#else +make_tree_from_sets( fset1, fset2 ) +set *fset1; +set *fset2; +#endif +{ + set inter; + int i; + Tree *t=NULL, *n, *u; + unsigned *p,*q; + require(LL_k>1, "make_tree_from_sets: LL_k must be > 1"); + + /* do the degree 1 sets first */ + for (i=1; i<=LL_k-1; i++) + { + inter = set_and(fset1[i], fset2[i]); + require(set_deg(inter)==1, "invalid set to tree conversion"); + n = tnode(set_int(inter)); + if (t==NULL) t=n; else tmake(t, n, NULL); + set_free(inter); + } + + /* now add the chain of tokens at depth k */ + u = bottom_of_chain(t); + inter = set_and(fset1[LL_k], fset2[LL_k]); + if ( (q=p=set_pdq(inter)) == NULL ) fatal_internal("Can't alloc space for set_pdq"); + /* first one is linked to bottom, then others are sibling linked */ + n = tnode(*p++); + u->down = n; + u = u->down; + while ( *p != nil ) + { + n = tnode(*p); + u->right = n; + u = u->right; + p++; + } + free((char *)q); + + return t; +} + +/* create and return the tree of lookahead k-sequences that are in t, but not + * in the context of predicates in predicate list p. + */ +Tree * +#ifdef __USE_PROTOS +tdif( Tree *ambig_tuples, Predicate *p, set *fset1, set *fset2 ) +#else +tdif( ambig_tuples, p, fset1, fset2 ) +Tree *ambig_tuples; +Predicate *p; +set *fset1; +set *fset2; +#endif +{ + unsigned **ft; + Tree *dif=NULL; + Tree *perm; + set b; + int i,k; + + if ( p == NULL ) return tdup(ambig_tuples); + + ft = (unsigned **) calloc(CLL_k+1, sizeof(unsigned *)); + require(ft!=NULL, "cannot allocate ft"); + for (i=1; i<=CLL_k; i++) + { + b = set_and(fset1[i], fset2[i]); + ft[i] = set_pdq(b); + set_free(b); + } + findex = (int *) calloc(LL_k+1, sizeof(int)); + if ( findex == NULL ) + { + fatal_internal("out of memory in tdif while checking predicates"); + } + for (k=1; k<=LL_k; k++) findex[k] = 0; + +#ifdef DBG_TRAV + fprintf(stderr, "tdif_%d[", p->k); + preorder(ambig_tuples); + fprintf(stderr, ","); + preorder(p->tcontext); + fprintf(stderr, "] ="); +#endif + + ftbl = ft; + while ( (perm=permute(1,p->k))!=NULL ) + { +#ifdef DBG_TRAV + fprintf(stderr, "test perm:"); preorder(perm); fprintf(stderr, "\n"); +#endif + if ( tmember_constrained(perm, ambig_tuples) && + !tmember_of_context(perm, p) ) + { +#ifdef DBG_TRAV + fprintf(stderr, "satisfied upon"); preorder(perm); fprintf(stderr, "\n"); +#endif + k++; + if ( dif==NULL ) dif = perm; + else + { + perm->right = dif; + dif = perm; + } + } + else Tfree( perm ); + } + +#ifdef DBG_TRAV + preorder(dif); + fprintf(stderr, "\n"); +#endif + + for (i=1; i<=CLL_k; i++) free( (char *)ft[i] ); + free((char *)ft); + free((char *)findex); + + return dif; +} + +/* is lookahead sequence t a member of any context tree for any + * predicate in p? + */ +static int +#ifdef __USE_PROTOS +tmember_of_context( Tree *t, Predicate *p ) +#else +tmember_of_context( t, p ) +Tree *t; +Predicate *p; +#endif +{ + for (; p!=NULL; p=p->right) + { + if ( p->expr==PRED_AND_LIST || p->expr==PRED_OR_LIST ) + return tmember_of_context(t, p->down); + if ( tmember_constrained(t, p->tcontext) ) return 1; + if ( tmember_of_context(t, p->down) ) return 1; + } + return 0; +} + +int +#ifdef __USE_PROTOS +is_single_tuple( Tree *t ) +#else +is_single_tuple( t ) +Tree *t; +#endif +{ + if ( t == NULL ) return 0; + if ( t->right != NULL ) return 0; + if ( t->down == NULL ) return 1; + return is_single_tuple(t->down); +} + + +/* MR10 Check that a context guard contains only allowed things */ +/* MR10 (mainly token references). */ + +#ifdef __USE_PROTOS +int contextGuardOK(Node *p,int h,int *hmax) +#else +int contextGuardOK(p,h,hmax) + Node *p; + int h; + int *hmax; +#endif +{ + Junction *j; + TokNode *tn; + + if (p == NULL) return 1; + if (p->ntype == nToken) { + h++; + if (h > *hmax) *hmax=h; + tn=(TokNode *)p; + if (tn->el_label != NULL) { + warnFL(eMsg1("a label (\"%s\") for a context guard element is meaningless",tn->el_label), + FileStr[p->file],p->line); + }; + return contextGuardOK( ( (TokNode *) p)->next,h,hmax); + } else if (p->ntype == nAction) { + goto Fail; + } else if (p->ntype == nRuleRef) { + goto Fail; + } else { + require (p->ntype == nJunction,"Unexpected ntype"); + j=(Junction *) p; + if (j->jtype != Generic && + j->jtype != aSubBlk && /* pretty sure this one is allowed */ +/**** j->jtype != aOptBlk && ****/ /* pretty sure this one is allowed */ /* MR11 not any more ! */ + j->jtype != EndBlk) { + errFL("A context guard may not contain an option block: {...} or looping block: (...)* or (...)+", + FileStr[p->file],p->line); + contextGuardOK(j->p1,h,hmax); + return 0; + }; + /* do both p1 and p2 so use | rather than || */ + return contextGuardOK(j->p2,h,hmax) | contextGuardOK(j->p1,h,hmax); + }; +Fail: + errFL("A context guard may contain only Token references - guard will be ignored", + FileStr[p->file],p->line); + contextGuardOK( ( (ActionNode *) p)->next,h,hmax); + return 0; +} + +/* + * Look at a (...)? generalized-predicate context-guard and compute + * either a lookahead set (k==1) or a lookahead tree for k>1. The + * k level is determined by the guard itself rather than the LL_k + * variable. For example, ( A B )? is an LL(2) guard and ( ID )? + * is an LL(1) guard. For the moment, you can only have a single + * tuple in the guard. Physically, the block must look like this + * --o-->TOKEN-->o-->o-->TOKEN-->o-- ... -->o-->TOKEN-->o-- + * An error is printed for any other type. + */ +Predicate * +#ifdef __USE_PROTOS +computePredFromContextGuard(Graph blk,int *msgDone) /* MR10 */ +#else +computePredFromContextGuard(blk,msgDone) /* MR10 */ + Graph blk; + int *msgDone; /* MR10 */ +#endif +{ + Junction *junc = (Junction *)blk.left, *p; + Tree *t=NULL; + Predicate *pred = NULL; + set scontext, rk; + int ok; + int hmax=0; + + require(junc!=NULL && junc->ntype == nJunction, "bad context guard"); + +/* MR10 Check for anything other than Tokens and generic junctions */ + + *msgDone=0; /* MR10 */ + ok=contextGuardOK( (Node *)junc,0,&hmax); /* MR10 */ + if (! ok) { /* MR10 */ + *msgDone=1; /* MR10 */ + return NULL; /* MR10 */ + }; /* MR10 */ + if (hmax == 0) { +errFL("guard is 0 tokens long",FileStr[junc->file],junc->line); /* MR11 */ + *msgDone=1; + return NULL; + }; + if (hmax > CLL_k) { /* MR10 */ +errFL(eMsgd2("guard is %d tokens long - lookahead is limited to max(k,ck)==%d", /* MR10 */ + hmax,CLL_k), /* MR10 */ + FileStr[junc->file],junc->line); /* MR10 */ + *msgDone=1; /* MR10 */ + return NULL; /* MR10 */ + }; /* MR10 */ + + rk = empty; + p = junc; + pred = new_pred(); + pred->k = hmax; /* MR10 should be CLL_k, not LLK ? */ + if (hmax > 1 ) /* MR10 was LL_k */ + { + ConstrainSearch = 0; + ContextGuardTRAV = 1; + TRAV(p, hmax, &rk, t); /* MR10 was LL_k */ + ContextGuardTRAV = 0; + set_free(rk); + t = tshrink( t ); + t = tflatten( t ); + t = tleft_factor( t ); +/* + fprintf(stderr, "ctx guard:"); + preorder(t); + fprintf(stderr, "\n"); +*/ + pred->tcontext = t; + } + else + { + REACH(p, 1, &rk, scontext); + require(set_nil(rk), "rk != nil"); + set_free(rk); +/* + fprintf(stderr, "LL(1) ctx guard is:"); + s_fprT(stderr, scontext); + fprintf(stderr, "\n"); +*/ + pred->scontext[1] = scontext; + } + + list_add(&ContextGuardPredicateList,pred); /* MR13 */ + + return pred; +} + +/* MR13 + When the context guard is originally computed the + meta-tokens are not known. +*/ + +#ifdef __USE_PROTOS +void recomputeContextGuard(Predicate *pred) +#else +void recomputeContextGuard(pred) + Predicate *pred; +#endif +{ + Tree * t=NULL; + set scontext; + set rk; + ActionNode * actionNode; + Junction * p; + + actionNode=pred->source; + require (actionNode != NULL,"context predicate's source == NULL"); + + p=actionNode->guardNodes; + require (p != NULL,"context predicate's guardNodes == NULL"); + + rk = empty; + if (pred->k > 1 ) + { + ConstrainSearch = 0; + ContextGuardTRAV = 1; + TRAV(p, pred->k, &rk, t); + ContextGuardTRAV = 0; + set_free(rk); + t = tshrink( t ); + t = tflatten( t ); + t = tleft_factor( t ); + Tfree(pred->tcontext); + pred->tcontext = t; + } + else + { + REACH(p, 1, &rk, scontext); + require(set_nil(rk), "rk != nil"); + set_free(rk); + set_free(pred->scontext[1]); + pred->scontext[1] = scontext; + } +} + +/* MR11 - had enough of flags yet ? */ + +int MR_AmbSourceSearch=0; +int MR_AmbSourceSearchGroup=0; +int MR_AmbSourceSearchChoice=0; +int MR_AmbSourceSearchLimit=0; +int MR_matched_AmbAidRule=0; + +static set *matchSets[2]={NULL,NULL}; +static int *tokensInChain=NULL; +static Junction *MR_AmbSourceSearchJ[2]; + +void MR_traceAmbSourceKclient() +{ + int i; + set *save_fset; + int save_ConstrainSearch; + set incomplete; + Tree *t; + + if (matchSets[0] == NULL) { + matchSets[0]=(set *) calloc (CLL_k+1,sizeof(set)); + require (matchSets[0] != NULL,"matchSets[0] alloc"); + matchSets[1]=(set *) calloc (CLL_k+1,sizeof(set)); + require (matchSets[1] != NULL,"matchSets[1] alloc"); + }; + + for (i=1 ; i <= MR_AmbSourceSearchLimit ; i++) { + set_clr(matchSets[0][i]); + set_orel( (unsigned) tokensInChain[i], + &matchSets[0][i]); + set_clr(matchSets[1][i]); + set_orel( (unsigned) tokensInChain[i], + &matchSets[1][i]); + }; + + save_fset=fset; + save_ConstrainSearch=ConstrainSearch; + + + + for (i=0 ; i < 2 ; i++) { + +#if 0 +** fprintf(stdout," Choice:%d Depth:%d ",i+1,MR_AmbSourceSearchLimit); +** fprintf(stdout,"("); +** for (j=1 ; j <= MR_AmbSourceSearchLimit ; j++) { +** if (j != 1) fprintf(stdout," "); +** fprintf(stdout,"%s",TerminalString(tokensInChain[j])); +** }; +** fprintf(stdout,")\n\n"); +#endif + + fset=matchSets[i]; + + MR_AmbSourceSearch=1; + MR_MaintainBackTrace=1; + MR_AmbSourceSearchChoice=i; + ConstrainSearch=1; + + maxk = MR_AmbSourceSearchLimit; + + incomplete=empty; + t=NULL; + + constrain = &(fset[1]); + MR_pointerStackReset(&MR_BackTraceStack); + + TRAV(MR_AmbSourceSearchJ[i],maxk,&incomplete,t); + + Tfree(t); + + require (set_nil(incomplete),"MR_traceAmbSourceK TRAV incomplete"); + require (MR_BackTraceStack.count == 0,"K: MR_BackTraceStack.count != 0"); + + set_free(incomplete); + }; + + ConstrainSearch=save_ConstrainSearch; + fset=save_fset; + MR_AmbSourceSearch=0; + MR_MaintainBackTrace=0; + MR_AmbSourceSearchChoice=0; +} + +#ifdef __USE_PROTOS +Tree *tTrunc(Tree *t,int depth) +#else +Tree *tTrunc(t,depth) + Tree *t; +#endif +{ + Tree *u; + + require ( ! (t == NULL && depth > 0),"tree too short"); + + if (depth == 0) return NULL; + + if (t->token == ALT) { + u=tTrunc(t->down,depth); + } else { + u=tnode(t->token); + u->down=tTrunc(t->down,depth-1); + }; + if (t->right != NULL) u->right=tTrunc(t->right,depth); + return u; +} + +#ifdef __USE_PROTOS +void MR_iterateOverTree(Tree *t,int chain[]) +#else +void MR_iterateOverTree(t,chain) + Tree *t; + int chain[]; +#endif +{ + if (t == NULL) return; + chain[0]=t->token; + if (t->down != NULL) { + MR_iterateOverTree(t->down,&chain[1]); + } else { + MR_traceAmbSourceKclient(); + }; + MR_iterateOverTree(t->right,&chain[0]); + chain[0]=0; +} + +#ifdef __USE_PROTOS +void MR_traceAmbSourceK(Tree *t,Junction *alt1,Junction *alt2) +#else +void MR_traceAmbSourceK(t,alt1,alt2) + Tree *t; + Junction *alt1; + Junction *alt2; +#endif +{ + int i; + int depth; + int maxDepth; + Tree *truncatedTree; + + if (MR_AmbAidRule == NULL) return; + + if ( ! ( + strcmp(MR_AmbAidRule,alt1->rname) == 0 || + strcmp(MR_AmbAidRule,alt2->rname) == 0 || + MR_AmbAidLine==alt1->line || + MR_AmbAidLine==alt2->line + ) + ) return; + + MR_matched_AmbAidRule++; + + /* there are no token sets in trees, only in TokNodes */ + + MR_AmbSourceSearchJ[0]=analysis_point( (Junction *) alt1->p1); + MR_AmbSourceSearchJ[1]=analysis_point( (Junction *) alt2->p1); + + if (tokensInChain == NULL) { + tokensInChain=(int *) calloc (CLL_k+1,sizeof(int)); + require (tokensInChain != NULL,"tokensInChain alloc"); + }; + + MR_AmbSourceSearchGroup=0; + + fprintf(stdout,"\n"); + fprintf(stdout," Ambiguity Aid "); + fprintf(stdout, + (MR_AmbAidDepth <= LL_k ? + "(-k %d -aa %s %s -aad %d)\n\n" : + "(-k %d -aa %s %s [-k value limits -aad %d])\n\n"), + LL_k, + MR_AmbAidRule, + (MR_AmbAidMultiple ? "-aam" : ""), + MR_AmbAidDepth); + + for (i=0 ; i < 2 ; i++) { + fprintf(stdout," Choice %d: %-25s line %d file %s\n", + (i+1), + MR_ruleNamePlusOffset( (Node *) MR_AmbSourceSearchJ[i]), + MR_AmbSourceSearchJ[i]->line, + FileStr[MR_AmbSourceSearchJ[i]->file]); + }; + + fprintf(stdout,"\n"); + + if (MR_AmbAidDepth < LL_k) { + maxDepth=MR_AmbAidDepth; + } else { + maxDepth=LL_k; + }; + + for (depth=1 ; depth <= maxDepth; depth++) { + MR_AmbSourceSearchLimit=depth; + if (depth < LL_k) { + truncatedTree=tTrunc(t,depth); + truncatedTree=tleft_factor(truncatedTree); + MR_iterateOverTree(truncatedTree,&tokensInChain[1]); /* <===== */ + Tfree(truncatedTree); + } else { + MR_iterateOverTree(t,tokensInChain); /* <===== */ + }; + fflush(stdout); + fflush(stderr); + }; + + fprintf(stdout,"\n"); + MR_AmbSourceSearch=0; + MR_MaintainBackTrace=0; + MR_AmbSourceSearchGroup=0; + MR_AmbSourceSearchChoice=0; + MR_AmbSourceSearchLimit=0; + +} + + +/* this if for k=1 grammars only + + this is approximate only because of the limitations of linear + approximation lookahead. Don't want to do a k=3 search when + the user only specified a ck=3 grammar +*/ + +#ifdef __USE_PROTOS +void MR_traceAmbSource(set *matchSets,Junction *alt1, Junction *alt2) +#else +void MR_traceAmbSource(matchSets,alt1,alt2) + set *matchSets; + Junction *alt1; + Junction *alt2; +#endif +{ + set *save_fset; + Junction *p[2]; + int i; + int j; + set *dup_matchSets; + set intersection; + set incomplete; + set tokensUsed; + int depth; + + if (MR_AmbAidRule == NULL) return; + if ( ! ( + strcmp(MR_AmbAidRule,alt1->rname) == 0 || + strcmp(MR_AmbAidRule,alt2->rname) == 0 || + MR_AmbAidLine==alt1->line || + MR_AmbAidLine==alt2->line + ) + ) return; + + MR_matched_AmbAidRule++; + + save_fset=fset; + + dup_matchSets=(set *) calloc(CLL_k+1,sizeof(set)); + require (dup_matchSets != NULL,"Can't allocate dup_matchSets"); + + p[0]=analysis_point( (Junction *) alt1->p1); + p[1]=analysis_point( (Junction *) alt2->p1); + + fprintf(stdout,"\n"); + + fprintf(stdout," Ambiguity Aid "); + fprintf(stdout, + (MR_AmbAidDepth <= CLL_k ? + "(-ck %d -aa %s %s -aad %d)\n\n" : + "(-ck %d -aa %s %s [-ck value limits -aad %d])\n\n"), + CLL_k, + MR_AmbAidRule, + (MR_AmbAidMultiple ? "-aam" : ""), + MR_AmbAidDepth); + + for (i=0 ; i < 2 ; i++) { + fprintf(stdout," Choice %d: %-25s line %d file %s\n", + (i+1), + MR_ruleNamePlusOffset( (Node *) p[i]), + p[i]->line,FileStr[p[i]->file]); + }; + + for (j=1; j <= CLL_k ; j++) { + fprintf(stdout,"\n Intersection of lookahead[%d] sets:\n",j); + intersection=set_and(alt1->fset[j],alt2->fset[j]); + MR_dumpTokenSet(stdout,2,intersection); + set_free(intersection); + }; + + fprintf(stdout,"\n"); + + require (1 <= MR_AmbAidDepth && MR_AmbAidDepth <= CLL_k, + "illegal MR_AmbAidDepth"); + + MR_AmbSourceSearchGroup=0; + for (depth=1; depth <= MR_AmbAidDepth; depth++) { + MR_AmbSourceSearchLimit=depth; + for (i=0 ; i < 2 ; i++) { + +/*** fprintf(stdout," Choice:%d Depth:%d\n\n",i+1,depth); ***/ + + for (j=0 ; j <= CLL_k ; j++) { dup_matchSets[j]=set_dup(matchSets[j]); }; + fset=dup_matchSets; + + fflush(output); + fflush(stdout); + + MR_AmbSourceSearch=1; + MR_MaintainBackTrace=1; + MR_AmbSourceSearchChoice=i; + + maxk = depth; + tokensUsed=empty; + incomplete=empty; + + constrain = &(fset[1]); + MR_pointerStackReset(&MR_BackTraceStack); + + REACH(p[i],depth,&incomplete,tokensUsed); + + fflush(output); + fflush(stdout); + + require (set_nil(incomplete),"MR_traceAmbSource REACH incomplete"); + require (MR_BackTraceStack.count == 0,"1: MR_BackTraceStack.count != 0"); + + set_free(incomplete); + set_free(tokensUsed); + + for (j=0 ; j <= CLL_k ; j++) { set_free(dup_matchSets[j]); }; + }; + }; + + fprintf(stdout,"\n"); + + MR_AmbSourceSearch=0; + MR_MaintainBackTrace=0; + MR_AmbSourceSearchGroup=0; + MR_AmbSourceSearchChoice=0; + MR_AmbSourceSearchLimit=0; + + fset=save_fset; + free ( (char *) dup_matchSets); +} + +static int itemCount; + +void MR_backTraceDumpItemReset() { + itemCount=0; +} + +#ifdef __USE_PROTOS +void MR_backTraceDumpItem(FILE *f,int skip,Node *n) +#else +void MR_backTraceDumpItem(f,skip,n) + FILE *f; + int skip; + Node *n; +#endif +{ + TokNode *tn; + RuleRefNode *rrn; + Junction *j; + ActionNode *a; + + switch (n->ntype) { + case nToken: + itemCount++; if (skip) goto EXIT; + tn=(TokNode *)n; + if (set_nil(tn->tset)) { + fprintf(f," %2d #token %-23s",itemCount,TerminalString(tn->token)); + } else { + fprintf(f," %2d #tokclass %-20s",itemCount,TerminalString(tn->token)); + }; + break; + case nRuleRef: + itemCount++; if (skip) goto EXIT; + rrn=(RuleRefNode *)n; + fprintf(f," %2d to %-27s",itemCount,rrn->text); + break; + case nAction: + a=(ActionNode *)n; + goto EXIT; + case nJunction: + + j=(Junction *)n; + + switch (j->jtype) { + case aSubBlk: + if (j->guess) { + itemCount++; if (skip) goto EXIT; + fprintf(f," %2d %-30s",itemCount,"in (...)? block at"); + break; + }; +/****** fprintf(f," %2d %-32s",itemCount,"in (...) block at"); *******/ +/****** break; *******/ + goto EXIT; + case aOptBlk: + itemCount++; if (skip) goto EXIT; + fprintf(f," %2d %-30s",itemCount,"in {...} block"); + break; + case aLoopBlk: + itemCount++; if (skip) goto EXIT; + fprintf(f," %2d %-30s",itemCount,"in (...)* block"); + break; + case EndBlk: + if (j->alpha_beta_guess_end) { + itemCount++; if (skip) goto EXIT; + fprintf(f," %2d %-30s",itemCount,"end (...)? block at"); + break; + }; + goto EXIT; +/****** fprintf(f," %2d %-32s",itemCount,"end of a block at"); *****/ +/****** break; *****/ + case RuleBlk: + itemCount++; if (skip) goto EXIT; + fprintf(f," %2d %-30s",itemCount,j->rname); + break; + case Generic: + goto EXIT; + case EndRule: + itemCount++; if (skip) goto EXIT; + fprintf (f," %2d end %-26s",itemCount,j->rname); + break; + case aPlusBlk: + itemCount++; if (skip) goto EXIT; + fprintf(f," %2d %-30s",itemCount,"in (...)+ block"); + break; + case aLoopBegin: + goto EXIT; + }; + break; + }; + fprintf(f," %-23s line %-4d %s\n",MR_ruleNamePlusOffset(n),n->line,FileStr[n->file]); +EXIT: + return; +} + + +static PointerStack previousBackTrace={0,0,NULL}; + +#ifdef __USE_PROTOS +void MR_backTraceReport(void) +#else +void MR_backTraceReport() +#endif +{ + int i; + int match = 0; + int limitMatch; + + Node *p; + TokNode *tn; + set remainder; + int depth; + + /* Even when doing a k=2 search this routine can get + called when there is only 1 token on the stack. + This is because something like rRuleRef can change + the search value of k from 2 to 1 temporarily. + It does this because the it wants to know the k=1 + first set before it does a k=2 search + */ + + depth=0; + for (i=0; i < MR_BackTraceStack.count ; i++) { + p=(Node *) MR_BackTraceStack.data[i]; + if (p->ntype == nToken) depth++; + }; + +/* MR14 */ if (MR_AmbSourceSearch) { +/* MR14 */ require (depth <= MR_AmbSourceSearchLimit,"depth > MR_AmbSourceSearchLimit"); +/* MR14 */ } + + /* MR23 THM - Traceback report was being called at the wrong time for -alpha reports */ + /* Reported by Arpad Beszedes (beszedes@inf.u-szeged.hu) */ + + if (MR_AmbSourceSearchLimit == 0 || depth < MR_AmbSourceSearchLimit) { + return; + }; + + MR_backTraceDumpItemReset(); + + limitMatch=MR_BackTraceStack.count; + if (limitMatch > previousBackTrace.count) { + limitMatch=previousBackTrace.count; + }; + + for (match=0; match < limitMatch; match++) { + if (MR_BackTraceStack.data[match] != + previousBackTrace.data[match]) { + break; + }; + }; + + /* not sure at the moment why there would be duplicates */ + + if (match != MR_BackTraceStack.count) { + + fprintf(stdout," Choice:%d Depth:%d Group:%d", + (MR_AmbSourceSearchChoice+1), + MR_AmbSourceSearchLimit, + ++MR_AmbSourceSearchGroup); + + depth=0; + fprintf(stdout," ("); + for (i=0; i < MR_BackTraceStack.count ; i++) { + p=(Node *) MR_BackTraceStack.data[i]; + if (p->ntype != nToken) continue; + tn=(TokNode *)p; + if (depth != 0) fprintf(stdout," "); + fprintf(stdout,TerminalString(tn->token)); + depth++; + if (! MR_AmbAidMultiple) { + if (set_nil(tn->tset)) { + set_rm( (unsigned) tn->token,fset[depth]); + } else { + remainder=set_dif(fset[depth],tn->tset); + set_free(fset[depth]); + fset[depth]=remainder; + }; + }; + }; + fprintf(stdout,")\n"); + + for (i=0; i < MR_BackTraceStack.count ; i++) { + MR_backTraceDumpItem(stdout, (i<match) ,(Node *) MR_BackTraceStack.data[i]); + }; + fprintf(stdout,"\n"); + fflush(stdout); + + MR_pointerStackReset(&previousBackTrace); + + for (i=0; i < MR_BackTraceStack.count ; i++) { + MR_pointerStackPush(&previousBackTrace,MR_BackTraceStack.data[i]); + }; + + }; +} + +#ifdef __USE_PROTOS +void MR_setConstrainPointer(set * newConstrainValue) +#else +void MR_setConstrainPointer(newConstrainValue) + set * newConstrainValue; +#endif +{ + constrain=newConstrainValue; +} diff --git a/pccts/antlr/gen.c b/pccts/antlr/gen.c new file mode 100644 index 0000000..7940eca --- /dev/null +++ b/pccts/antlr/gen.c @@ -0,0 +1,4797 @@ +/* + * gen.c + * + * Generate C code (ANSI, K&R, C++) + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2001 + */ + +#include <stdio.h> +#include <stdlib.h> +#include <ctype.h> +#include "pcctscfg.h" +#include "set.h" +#include "syn.h" +#include "hash.h" +#include "generic.h" +#include "dlgdef.h" + +#define NumExprPerLine 4 +static int on1line=0; +static set tokensRefdInBlock; + + /* T r a n s l a t i o n T a b l e s */ + +/* C_Trans[node type] == pointer to function that knows how to translate that node. */ +#ifdef __cplusplus +void (*C_Trans[NumNodeTypes+1])(...) = { + NULL, + NULL, /* See next table. +Junctions have many types */ + (void (*)(...)) genRuleRef, + (void (*)(...)) genToken, + (void (*)(...)) genAction + }; +#else +void (*C_Trans[NumNodeTypes+1])() = { + NULL, + NULL, /* See next table. +Junctions have many types */ + genRuleRef, + genToken, + genAction + }; +#endif + +/* C_JTrans[Junction type] == pointer to function that knows how to translate that + * kind of junction node. + */ +#ifdef __cplusplus +void (*C_JTrans[NumJuncTypes+1])(...) = { + NULL, + (void (*)(...)) genSubBlk, + (void (*)(...)) genOptBlk, + (void (*)(...)) genLoopBlk, + (void (*)(...)) genEndBlk, + (void (*)(...)) genRule, + (void (*)(...)) genJunction, + (void (*)(...)) genEndRule, + (void (*)(...)) genPlusBlk, + (void (*)(...)) genLoopBegin + }; +#else +void (*C_JTrans[NumJuncTypes+1])() = { + NULL, + genSubBlk, + genOptBlk, + genLoopBlk, + genEndBlk, + genRule, + genJunction, + genEndRule, + genPlusBlk, + genLoopBegin + }; +#endif + +#define PastWhiteSpace(s) while (*(s) == ' ' || *(s) == '\t') {s++;} + +static int tabs = 0; + +/* MR6 Got tired of text running off page when using standard tab stops */ + +#define TAB { int i; \ + if (TabWidth==0) { \ + for (i=0; i<tabs; i++) fputc('\t', output); \ + } else { \ + for (i=0; i<tabs*TabWidth; i++) fputc(' ',output); \ + }; \ + } + +static void +#ifdef __USE_PROTOS +tab( void ) +#else +tab( ) +#endif +TAB + +#ifdef __USE_PROTOS +static char *tokenFollowSet(TokNode *); +static ActionNode *findImmedAction( Node * ); +static void dumpRetValAssign(char *, char *, RuleRefNode *); /* MR30 */ +static void dumpAfterActions(FILE *output); +static set ComputeErrorSet(Junction *, int, int); +static void makeErrorClause(Junction *, set, int, int); +static void DumpFuncHeader( Junction *, RuleEntry * ); +static int has_guess_block_as_first_item(Junction *); +static int genExprSets(set *, int); +static void genExprTree( Tree *t, int k ); +static void genExprTreeOriginal( Tree *t, int k ); /* MR10 */ +static char * findOuterHandlerLabel(ExceptionGroup *eg); /* MR7 */ +static void OutLineInfo(FILE *file,int line,char *fileName); /* MR14 */ +#else +static char *tokenFollowSet(); +static ActionNode *findImmedAction(); +static void dumpRetValAssign(); +static void dumpAfterActions(); +static set ComputeErrorSet(); +static void makeErrorClause(); +static void DumpFuncHeader(); +static int has_guess_block_as_first_item(); +static int genExprSets(); +static void genExprTree(); +static void genExprTreeOriginal(); /* MR10 */ +static char * findOuterHandlerLabel(); /* MR7 */ +static void OutLineInfo(); /* MR14 */ +#endif + +#define gen(s) {tab(); fprintf(output, s);} +#define gen1(s,a) {tab(); fprintf(output, s,a);} +#define gen2(s,a,b) {tab(); fprintf(output, s,a,b);} +#define gen3(s,a,b,c) {tab(); fprintf(output, s,a,b,c);} +#define gen4(s,a,b,c,d) {tab(); fprintf(output, s,a,b,c,d);} +#define gen5(s,a,b,c,d,e) {tab(); fprintf(output, s,a,b,c,d,e);} +#define gen6(s,a,b,c,d,e,f) {tab(); fprintf(output, s,a,b,c,d,e,f);} +#define gen7(s,a,b,c,d,e,f,g) {tab(); fprintf(output, s,a,b,c,d,e,f,g);} + +#define _gen(s) {fprintf(output, s);} +#define _gen1(s,a) {fprintf(output, s,a);} +#define _gen2(s,a,b) {fprintf(output, s,a,b);} +#define _gen3(s,a,b,c) {fprintf(output, s,a,b,c);} +#define _gen4(s,a,b,c,d){fprintf(output, s,a,b,c,d);} +#define _gen5(s,a,b,c,d,e){fprintf(output, s,a,b,c,d,e);} +#define _gen6(s,a,b,c,d,e,f){fprintf(output, s,a,b,c,d,e,f);} +#define _gen7(s,a,b,c,d,e,f,g){fprintf(output, s,a,b,c,d,e,f,g);} + + +/* MR11 a convenient place to set a break point */ + +#ifdef __USE_PROTOS +void MR_break(void) +#else +void MR_break() +#endif +{ + return; +} + +/* MR10 genTraceOut(Junction *) */ + +#ifdef __USE_PROTOS +static void genTraceOut(Junction *q) +#else +static void genTraceOut(q) + Junction *q; +#endif +{ + if ( TraceGen ) { + if ( GenCC ) {gen1("zzTRACEOUT(\"%s\");\n", q->rname);} + else gen1("zzTRACEOUT((ANTLRChar *)\"%s\");\n", q->rname); + } +} + +static void +#ifdef __USE_PROTOS +warn_about_using_gk_option(void) +#else +warn_about_using_gk_option() +#endif +{ + static int warned_already=0; + + if ( !DemandLookahead || warned_already ) return; + warned_already = 1; + warnNoFL("-gk option could cause trouble for <<...>>? predicates"); +} + +void +#ifdef __USE_PROTOS +freeBlkFsets( Junction *q ) +#else +freeBlkFsets( q ) +Junction *q; +#endif +{ + int i; + Junction *alt; + require(q!=NULL, "freeBlkFsets: invalid node"); + + for (alt=q; alt != NULL; alt= (Junction *) alt->p2 ) + { + for (i=1; i<=CLL_k; i++) set_free(alt->fset[i]); + } +} + +/* + * Generate a local variable allocation for each token references + * in this block. + */ +static void +#ifdef __USE_PROTOS +genTokenPointers( Junction *q ) +#else +genTokenPointers( q ) +Junction *q; +#endif +{ + /* Rule refs are counted and can be referenced, but their + * value is not set to anything useful ever. + * + * The ptrs are to be named _tij where i is the current level + * and j is the element number within an alternative. + */ + int first=1, t=0; + set a; + tokensRefdInBlock = q->tokrefs; + + if ( set_deg(q->tokrefs) == 0 ) return; + a = set_dup(q->tokrefs); + gen("ANTLRTokenPtr "); + for (; !set_nil(a); set_rm(t, a)) + { + t = set_int(a); + if ( first ) first = 0; + else _gen(","); + if ( !DontCopyTokens ) _gen2("_tv%d%d,", BlkLevel, t); + _gen2("_t%d%d", BlkLevel, t); + if ( !DontCopyTokens ) {_gen2("= &_tv%d%d", BlkLevel, t);} + else _gen("=NULL"); + } + _gen(";\n"); + set_free(a); +} + +static int +#ifdef __USE_PROTOS +hasDefaultException(ExceptionGroup *eg) +#else +hasDefaultException(eg) +ExceptionGroup *eg; +#endif +{ + ListNode *q; + + for (q = eg->handlers->next; q!=NULL; q=q->next) + { + ExceptionHandler *eh = (ExceptionHandler *)q->elem; + if ( strcmp("default", eh->signalname)==0 ) { + return 1; + } + } + return 0; +} +static void +#ifdef __USE_PROTOS +dumpException(ExceptionGroup *eg, int no_default_case) +#else +dumpException(eg, no_default_case) +ExceptionGroup *eg; +int no_default_case; +#endif +{ + char *outerLabel; /* MR7 */ + int altHandler=0; /* MR7 */ + int namedHandler=0; /* MR7 */ + + outerLabel=findOuterHandlerLabel(eg); /* MR7 */ + + if (eg->label != NULL) { /* MR7 */ + namedHandler=1; /* MR7 */ + } else if (eg->forRule) { /* MR7 */ + /* nothing */ /* MR20 */ + } else { /* MR7 */ + altHandler=1; /* MR7 */ + }; /* MR7 */ + +#if 0 +** if (! eg->used) { /* MR7 */ +** warnFL("exception group never used", /* MR7 */ +** FileStr[eg->altstart->file],eg->altstart->line); /* MR7 */ +** }; /* MR7 */ +#endif + + if (namedHandler) { /* MR7 */ + gen1("switch ( _signal ) { /* [%s] */\n",eg->label); /* MR7 */ + } else { /* MR7 */ + gen("switch ( _signal ) {\n"); /* MR7 */ + gen("case NoSignal: break; /* MR7 */\n"); /* MR7 */ + }; /* MR7 */ + { + ListNode *q; + for (q = eg->handlers->next; q!=NULL; q=q->next) + { + ExceptionHandler *eh = (ExceptionHandler *)q->elem; + if ( strcmp("default", eh->signalname)==0 ) { + gen("default :\n"); + tabs++; + dumpAction(eh->action, output, tabs, -1, 1, 1); + gen("_signal=NoSignal; /* MR7 */\n"); /* MR7 */ + gen("break; /* MR7 */\n"); /* MR7 */ + tabs--; + gen("}\n"); + + /* copied from later code in dumpException */ /* MR7 */ + + if (namedHandler) { /* MR7 */ + gen("if (_signal != NoSignal)"); /* MR7 */ + _gen1(" goto %s_handler; /* MR7 */\n",outerLabel);/* MR7 */ + } else if (altHandler) { /* MR7 */ + gen1("goto %s_handler; /* MR7 */\n",outerLabel); /* MR7 */ + }; + return; + } + gen1("case %s :\n", eh->signalname); + tabs++; + if ( eh->action != NULL ) + { + dumpAction(eh->action, output, tabs, -1, 1, 1); + gen("break; /* MR7 */\n"); /* MR7 */ + } + tabs--; + } + } + if ( no_default_case ) return; + + gen("default :\n"); + tabs++; /* MR7 */ + gen("break; /* MR7 */\n"); /* MR7 */ + tabs--; /* MR7 */ + + tabs++; +/***** gen("*_retsignal = _signal;\n"); *****/ + + tabs--; + gen("}\n"); + + if (namedHandler) { /* MR7 */ + gen("if (_signal != NoSignal)"); /* MR7 */ + _gen1(" goto %s_handler; /* MR7 */\n",outerLabel); /* MR7 */ + } else if (altHandler) { /* MR7 */ + gen1("goto %s_handler; /* MR7 */\n",outerLabel); /* MR7 */ + }; + +} + +static void +#ifdef __USE_PROTOS +dumpExceptions(ListNode *list) +#else +dumpExceptions(list) +ListNode *list; +#endif +{ + ListNode *p; + + for (p = list->next; p!=NULL; p=p->next) + { + ExceptionGroup *eg = (ExceptionGroup *) p->elem; + _gen2("%s%s_handler:\n", + eg->label==NULL?"":eg->label, + eg->altID==NULL?"":eg->altID); + if ( eg->altID!=NULL ) dumpException(eg, 0); + else { + /* This must be the rule exception handler */ + dumpException(eg, 1); + if ( !hasDefaultException(eg) ) + { + gen("default :\n"); + tabs++; + gen("zzdflthandlers(_signal,_retsignal);\n"); + tabs--; + gen("}\n"); + } + } + } +} + +/* For each element label that is found in a rule, generate a unique + * Attribute (and AST pointer if GenAST) variable. + */ +void +#ifdef __USE_PROTOS +genElementLabels(ListNode *list) +#else +genElementLabels(list) +ListNode *list; +#endif +{ + int first=1; + ListNode *p; + + if ( GenCC ) {gen("ANTLRTokenPtr");} + else {gen("Attrib");} + for (p = list->next; p!=NULL; p=p->next) + { + char *ep = (char *)p->elem; + if ( first ) first = 0; + else _gen(","); + if ( GenCC ) {_gen1(" %s=NULL",ep);} + else {_gen1(" %s",ep);} + } + _gen(";\n"); + + if ( !GenAST ) return; + + first = 1; + gen("AST"); + for (p = list->next; p!=NULL; p=p->next) + { + char *ep = (char *)p->elem; + if ( first ) first = 0; + else _gen(","); + _gen1(" *%s_ast=NULL",ep); + } + _gen(";\n"); +} + +/* + * Generate a local variable allocation for each token or rule reference + * in this block. + */ +static void +#ifdef __USE_PROTOS +genASTPointers( Junction *q ) +#else +genASTPointers( q ) +Junction *q; +#endif +{ + int first=1, t; + set a; + + a = set_or(q->tokrefs, q->rulerefs); + if ( set_deg(a) > 0 ) + { + gen("AST "); + for (; !set_nil(a); set_rm(t, a)) + { + t = set_int(a); + if ( first ) first = 0; + else _gen(","); + _gen2("*_ast%d%d=NULL", BlkLevel, t); + } + set_free(a); + } + _gen(";\n"); +} + +static void +#ifdef __USE_PROTOS +BLOCK_Head( void ) +#else +BLOCK_Head( ) +#endif +{ + gen("{\n"); + tabs++; + if ( !GenCC ) gen1("zzBLOCK(zztasp%d);\n", BlkLevel); +} + +static void +#ifdef __USE_PROTOS +BLOCK_Tail( void ) +#else +BLOCK_Tail( ) +#endif +{ + if ( !GenCC ) gen1("zzEXIT(zztasp%d);\n", BlkLevel); + if ( !GenCC ) gen("}\n"); + tabs--; + gen("}\n"); +} + +static void +#ifdef __USE_PROTOS +BLOCK_Preamble( Junction *q ) +#else +BLOCK_Preamble( q ) +Junction *q; +#endif +{ + ActionNode *a; + Junction *begin; + + BLOCK_Head(); + if ( GenCC ) genTokenPointers(q); + if ( GenCC&&GenAST ) genASTPointers(q); + if ( q->jtype == aPlusBlk ) gen("int zzcnt=1;\n"); + if ( q->parm != NULL && !q->predparm ) gen1("zzaPush(%s);\n", q->parm) + else if ( !GenCC ) gen("zzMake0;\n"); + if ( !GenCC ) gen("{\n"); + if ( q->jtype == aLoopBegin ) begin = (Junction *) ((Junction *)q->p1); + else begin = q; + if ( has_guess_block_as_first_item(begin) ) + { + gen("zzGUESS_BLOCK\n"); + } + if ( q->jtype == aLoopBegin ) + a = findImmedAction( ((Junction *)q->p1)->p1 ); /* look at aLoopBlk */ + else + a = findImmedAction( q->p1 ); + if ( a!=NULL && !a->is_predicate) { +/* MR21 */ if (!a->noHoist) dumpActionPlus(a, a->action, output, tabs, a->file, a->line, 1); + a->done = 1; /* remove action. We have already handled it */ + } +} + +void +#ifdef __USE_PROTOS +genCombinedPredTreeContextOrig( Predicate *p ) +#else +genCombinedPredTreeContextOrig( p ) +Predicate *p; +#endif +{ + static set *ctx=NULL; /* genExprSets() is destructive, make copy*/ + require(p!=NULL, "can't make context tree for NULL pred tree"); + +#ifdef DBG_PRED + fprintf(stderr, "enter genCombinedPredTreeContextOrig(%s,0x%x) with sets:\n", p->expr, p); + s_fprT(stderr, p->scontext[1]); + fprintf(stderr, "\n"); +#endif + if ( p->down == NULL ) + { +/*** if ( p->k>1 && p->tcontext!=NULL ) ***/ + if ( p->tcontext!=NULL ) + { + _gen("("); + genExprTree(p->tcontext, 1); + _gen(")"); + } +/*** else if ( p->k==1 && set_deg(p->scontext[1])>0 ) ***/ + else if ( set_deg(p->scontext[1])>0 ) + { + if ( ctx==NULL ) ctx = (set *)calloc(CLL_k+1, sizeof(set)); + require(ctx!=NULL, "ctx cannot allocate"); + ctx[0]=empty; + ctx[1]=set_dup(p->scontext[1]); + _gen("("); + genExprSets(&(ctx[0]), p->k); + _gen(")"); + set_free(ctx[1]); + } + else if ( p->expr==PRED_AND_LIST || p->expr==PRED_OR_LIST ) { + fatal_internal("pred tree is orphan OR or AND list"); + } + else { + if (! HoistPredicateContext) { + _gen(" 1 /* no context: prc is off */ "); + } else { + fatal_internal("pred tree context is empty"); + }; + } + return; + } + +/* MR10 - make AND just like OR */ + + if ( p->expr == PRED_AND_LIST ) + { + Predicate *list = p->down; + for (; list!=NULL; list=list->right) + { + genCombinedPredTreeContextOrig(list); + if ( list->right!=NULL ) _gen("|| /* MR10 was wrong */ "); + }; + return; + } + + if ( p->expr == PRED_OR_LIST ) + { + Predicate *list = p->down; + for (; list!=NULL; list=list->right) + { + genCombinedPredTreeContextOrig(list); + if ( list->right!=NULL ) _gen("||"); + }; + return; + }; + + fatal("pred tree is really wacked"); +} + +/* [genCombinedPredTreeContext] */ + +void +#ifdef __USE_PROTOS +genCombinedPredTreeContext( Predicate *p ) +#else +genCombinedPredTreeContext( p ) +Predicate *p; +#endif +{ + Tree *t; + int predDepth=0; + + if (0 && ! MR_usingPredNames && ! MRhoisting) { + genCombinedPredTreeContextOrig(p); + } else { +/* MR13 */ MR_pred_depth(p,&predDepth); +/* MR13 */ if (predDepth == 1) { +/* MR13 */ +/* MR13 */ set scontext[2]; +/* MR13 */ scontext[0]=empty; +/* MR13 */ scontext[1]=MR_compute_pred_set(p); +/* MR13 */ if (set_nil(scontext[1])) { +/* MR13 */ _gen(" 1 /* MR12 no context (-prc off) */ "); +/* MR13 */ } else { +/* MR13 */ _gen("("); +/* MR13 */ genExprSets(&scontext[0], 1); +/* MR13 */ set_free(scontext[1]); +/* MR13 */ _gen(")"); +/* MR13 */ }; + + } else { + t=MR_compute_pred_tree_context(p); + if (t == NULL) { + _gen(" 1 /* MR12 no context (-prc off) */ "); + } else { + _gen("("); + genExprTree(t, 1); + Tfree(t); /* MR10 */ + _gen(")"); + }; + }; + }; +} + +/* [genPredTreeGate] */ + +void +#ifdef __USE_PROTOS +genPredTreeGate( Predicate *p, int in_and_expr ) +#else +genPredTreeGate( p, in_and_expr ) +Predicate *p; +int in_and_expr; +#endif +{ + if ( in_and_expr ) + { + _gen("!("); + genCombinedPredTreeContext(p); + _gen(")||"); + if ( p->down!=NULL ) _gen("\n"); + } + else + { + _gen("("); + genCombinedPredTreeContext(p); + _gen(")&&"); + if ( p->down!=NULL ) _gen("\n"); + } +} + +#ifdef __USE_PROTOS +void genPredEntry(Predicate *p,int outer) +#else +void genPredEntry(p,outer) + Predicate *p; + int outer; +#endif +{ + int inverted=0; + Predicate *q; + int localOuter=outer; + int needRP=0; + + if (p == NULL) return; + + if (p->predEntry != NULL && p->predEntry->predLiteral != NULL) { + if (p->inverted != p->predEntry->pred->inverted) { + _gen("! /* inverted pred */ ("); + needRP=1; + } else { + if (!localOuter) _gen("("); + needRP=1; + }; + dumpAction(p->predEntry->predLiteral,output,0,p->source->file,p->source->line,0); + if (needRP) _gen(")"); + return; + }; + + inverted=p->inverted; + + if (inverted) { + _gen(" ! /* inverted pred */ ("); + localOuter=1; + }; + + if (p->expr == PRED_OR_LIST) { + if (!localOuter) _gen("("); + for (q=p->down; q != NULL ; q=q->right) { + genPredEntry(q,0); + if (q->right != NULL) _gen(" || "); + }; + if (!localOuter) _gen(")"); + } else if (p->expr == PRED_AND_LIST) { + if (!localOuter) _gen("("); + for (q=p->down; q != NULL ; q=q->right) { + genPredEntry(q,0); + if (q->right != NULL) _gen(" && "); + }; + if (!localOuter) _gen(")"); + } else { + if (!localOuter) _gen("("); + require (p->source != NULL,"predEntry->source == NULL"); + require (p->source->inverted == 0,"dumpPredEntry p->source->inverted != 0"); + dumpAction(p->source->action,output,0,p->source->file,p->source->line,0); + if (!localOuter) _gen(")"); + }; + + if (inverted) { + _gen(")"); + } +} + +void +#ifdef __USE_PROTOS +dumpPredAction(ActionNode *anode, + char *s,FILE *output,int tabs,int file,int line,int final_newline) +#else +dumpPredAction(anode, + s,output,tabs,file,line,final_newline) + + ActionNode *anode; + char *s; + FILE *output; + int tabs; + int file; + int line; + int final_newline; +#endif +{ + PredEntry *predEntry=anode->predEntry; + int inverted=anode->inverted; + Predicate *workPred; + + if (predEntry == NULL) { + + /* inline predicate literal */ + + require(inverted == 0,"dumpPredAction action->inverted"); + dumpAction(s,output,tabs,file,line,final_newline); + + } else { + + /* a reference to a predicate - possibly with an inverted source */ + + if (predEntry->predLiteral != NULL) { + if (inverted) _gen("! /* inverted pred */ ("); + dumpAction(predEntry->predLiteral,output,0,anode->file,anode->line,0); + if (inverted) _gen(")"); + } else { + workPred=predicate_dup(predEntry->pred); + if (inverted) workPred->inverted=!workPred->inverted; + genPredEntry(workPred,1); + predicate_free(workPred); + }; + }; +} + +/* [genPred] */ + +void +#ifdef __USE_PROTOS +genPred(Predicate *p, Node *j,int suppress_sva) +#else +genPred(p,j,suppress_sva) + Predicate *p; + Node *j; + int suppress_sva; +#endif +{ + if ( FoundException && !suppress_sva) {_gen("(_sva=(");} /* MR11 suppress_sva */ + else {_gen("(");} + if ( GenLineInfo && j->file != -1 ) _gen("\n"); + if (p->source != NULL && p->source->ampersandPred != NULL) { + if (p->source->ampersandPred->k == 1) { + + set ctx[2]; + + ctx[0]=empty; + ctx[1]=set_dup(p->source->ampersandPred->scontext[1]); + + _gen("("); + genExprSets(&(ctx[0]), p->k); + _gen(") && "); + set_free(ctx[1]); + } else { + _gen("( "); + genExprTree(p->source->ampersandPred->tcontext,1); + _gen(" ) && "); + }; + }; + + dumpPredAction((ActionNode *)p->source, + p->expr, output, 0, -1 /*indicates no line info*/, j->line, 0); + + if ( FoundException && !suppress_sva) /* MR11 suppress_sva */ + {_gen("),_sva)");} /* MR10 - get red of "meant ==" messages */ + else {_gen(")");} +} + +void +#ifdef __USE_PROTOS +MR_distinctORcontextOpt(Predicate *p,Node *j,int in_and_expr) +#else +MR_distinctORcontextOpt(p,j,in_and_expr) + Predicate *p; + Node *j; + int in_and_expr; +#endif +{ + Predicate *q; + + _gen(" /* MR10 Distinct OR context optimization */ \n"); + + if (in_and_expr) { + gen("zzpf=0,\n"); + for (q=p->down; q != NULL; q=q->right) { + gen("( "); + genCombinedPredTreeContext(q); + _gen(" && (zzpf=1, "); + genPred(q,j,0); + _gen(" )) ||\n"); + }; + gen("!zzpf)"); + } else { + require (0, + "MR_distinctORcontextOpt: can't get here when using MR_predSimplify"); +#if 0 +** for (q=p->down; q != NULL; q=q->right) { +** gen("( "); +** genCombinedPredTreeContext(q); +** _gen(" && "); +** genPred(q,j); +** if (q->right != NULL) { +** _gen(" ) ||\n"); +** }; +** }; +** gen(")"); +#endif + }; +} + +void +#ifdef __USE_PROTOS +genPredTreeOrig( Predicate *p, Node *j, int in_and_expr ) +#else +genPredTreeOrig( p, j, in_and_expr ) +Predicate *p; +Node *j; +int in_and_expr; +#endif +{ + +/* MR10 */ int allHaveContext=1; +/* MR10 */ int noneHaveContext=1; + +/* MR10 */ MR_predContextPresent(p,&allHaveContext,&noneHaveContext); + + if ( ! noneHaveContext ) /* MR10 context guards ignored when -prc off */ + { + _gen("("); + genPredTreeGate(p, in_and_expr); + } + + /* if leaf node, just gen predicate */ + + if ( p->down==NULL ) + { + genPred(p,j,0); + if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */ + return; + } + + /* if AND list, do both preds (only two possible) */ + if ( p->expr == PRED_AND_LIST ) + { +#if 0 +** _gen("("); +** genPredTreeOrig(p->down, j, 1); +** _gen("&&"); +** genPredTreeOrig(p->down->right, j, 1); +** _gen(")"); +** if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */ +** return; +#endif + /* MR11 - make it work with AND with more than two children - like OR */ + + Predicate *list; + _gen("("); + list = p->down; + for (; list!=NULL; list=list->right) + { + genPredTreeOrig(list, j, 1); + if ( list->right!=NULL ) _gen("&&"); + } + _gen(")"); + if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */ + return; + }; + + if ( p->expr == PRED_OR_LIST ) + { + Predicate *list; + _gen("("); + list = p->down; + for (; list!=NULL; list=list->right) + { + genPredTreeOrig(list, j, 0); + if ( list->right!=NULL ) _gen("||"); + } + _gen(")"); + if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */ + return; + } + + fatal_internal("genPredTreeOrig: predicate tree is wacked"); +} + +#if 0 +** Predicate member dummyPredDepth is no longer used in MR10 +** but we might need it again in the future +** +** if (MRhoisting) { +** if ( !noneHaveContext && +** ! in_and_expr && +** p->source != NULL && +** p->source->dummyPredicateDepth > 0 && +** p->down == NULL) { +** _gen("("); +** genCombinedPredTreeContext(p); +** _gen(" )\n"); +** return; +** }; +** }; +#endif + +/* [genPredTree] */ + +/* in_and_expr + + what to do if the context is wrong + what to do if the context is correct but the predicate is false + + remember: if the context is wrong it's the same as if the + predicate is true as far as enabling an alternative + + Consider (AND p q r) + + if in an ... && ... expression then you don't want + the entire predicate chain to fail just because the + context for one component is wrong: so return true + + Consider (OR p q r) + + if in an ... || ... expression then you don't want + the entire predicate chain to succeed just because + the context for one component is correct when the + corresponding test is false: so return false when + the context is correct but the test is false. +*/ + +void +#ifdef __USE_PROTOS +genPredTree( Predicate *p, Node *j, int in_and_expr, int suppress_sva ) +#else +genPredTree( p, j, in_and_expr, suppress_sva) + Predicate *p; + Node *j; + int in_and_expr; + int suppress_sva; +#endif +{ + + int allHaveContext=1; + int noneHaveContext=1; + Tree *groupTree; + Tree *oneTree; + Predicate *q; + int identicalORcontextOptimization=0; + int identicalANDcontextOptimization=0; + + if (0 && !MR_usingPredNames && !MRhoisting) { + genPredTreeOrig(p,j,in_and_expr); + return; + }; + + MR_predContextPresent(p,&allHaveContext,&noneHaveContext); + + if ( ! noneHaveContext ) { /* MR10 context guards ignored when -prc off */ + + _gen("("); + + /* MR10 optimize OR predicates which are all leaves */ + + if (p->expr == PRED_OR_LIST && MR_allPredLeaves(p->down)) { + groupTree=MR_compute_pred_tree_context(p); + for (q=p->down ; q != NULL ; q=q->right) { + oneTree=MR_compute_pred_tree_context(q); + if (! MR_tree_equ(groupTree,oneTree)) { + Tfree(oneTree); + break; + }; + Tfree(oneTree); + }; + Tfree(groupTree); + if (q == NULL) { + _gen("/* MR10 individual OR gates suppressed when all predicates are leaves"); + _gen(" with identical context */\n"); + genPredTreeGate(p,in_and_expr); /* use the parent's in_and_expr for this gate */ + identicalORcontextOptimization=1; + } else { + MR_distinctORcontextOpt(p,j,in_and_expr); + return; + }; + } else if (p->expr == PRED_AND_LIST && MR_allPredLeaves(p->down)) { + + /* MR12 optimize AND predicates which are all leaves */ + + groupTree=MR_compute_pred_tree_context(p); + for (q=p->down ; q != NULL ; q=q->right) { + oneTree=MR_compute_pred_tree_context(q); + if (! MR_tree_equ(groupTree,oneTree)) { + Tfree(oneTree); + break; + }; + Tfree(oneTree); + }; + Tfree(groupTree); + if (q == NULL) { + _gen("/* MR12 individual AND gates suppressed when all predicates are leaves"); + _gen(" with identical context */\n"); + genPredTreeGate(p,in_and_expr); /* use the parent's in_and_expr for this gate */ + identicalANDcontextOptimization=1; + } else { + genPredTreeGate(p, in_and_expr); + }; + } else { + genPredTreeGate(p, in_and_expr); + }; + } + + /* if leaf node, just gen predicate */ + + if ( p->down==NULL ) + { + genPred(p,j,suppress_sva); + if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */ + return; + } + + /* if AND list, do both preds (only two possible) */ + /* MR10 not any more ! */ + + if ( p->expr == PRED_AND_LIST ) + { + Predicate *list; + _gen("("); + list = p->down; + for (; list != NULL; list=list->right) { + if (identicalANDcontextOptimization) { + genPred(list, j,suppress_sva); + } else { + genPredTree(list, j, 1, suppress_sva); /* in and context */ + }; + if ( list->right!=NULL ) _gen("&&"); + }; + _gen(")"); + if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */ + return; + } + + if ( p->expr == PRED_OR_LIST ) + { + Predicate *list; + _gen("("); + list = p->down; + for (; list!=NULL; list=list->right) + { + if (identicalORcontextOptimization) { + genPred(list, j,suppress_sva); + } else { + genPredTree(list, j, 0, suppress_sva); + }; + if ( list->right!=NULL ) _gen("||"); + } + _gen(")"); + if ( ! noneHaveContext ) _gen(")"); /* MR10 context guards ignored when -prc off */ + return; + } + + fatal_internal("predicate tree is wacked"); +} + +/* [genPredTreeMainXX] */ + +Predicate * /* MR10 */ +#ifdef __USE_PROTOS +genPredTreeMainXX( Predicate *p, Node *j ,int in_and_expr) +#else +genPredTreeMainXX( p, j ,in_and_expr) + Predicate *p; + Node *j; + int in_and_expr; +#endif +{ + + int allHaveContext=1; + int noneHaveContext=1; + +#if 0 + fprintf(stderr,"Pred before\n"); + dumppred(p); + fprintf(stderr,"\n"); + fprintf(stderr,"Pred after\n"); + dumppred(p); + fprintf(stderr,"\n"); +#endif + + p=MR_predSimplifyALL(p); /* MR10 */ + + require (MR_predicate_context_completed(p),"predicate context is not complete"); + + MR_cleanup_pred_trees(p); /* MR10 */ + + MR_predContextPresent(p,&allHaveContext,&noneHaveContext); + if (!noneHaveContext & !allHaveContext) { + warnFL("predicate contains elements both with and without context", + FileStr[j->file],j->line); + }; + + if (InfoP) { + _gen("\n#if 0\n\n"); + MR_dumpPred(p,1); + _gen("#endif\n"); + }; + genPredTree(p,j,in_and_expr,0); + return p; +} + +Predicate * /* MR10 */ +#ifdef __USE_PROTOS +genPredTreeMain( Predicate *p, Node *j) +#else +genPredTreeMain( p, j) + Predicate *p; + Node *j; +#endif +{ + return genPredTreeMainXX(p,j,1); +} + +static void +#ifdef __USE_PROTOS +genExprTreeOriginal( Tree *t, int k ) +#else +genExprTreeOriginal( t, k ) +Tree *t; +int k; +#endif +{ + require(t!=NULL, "genExprTreeOriginal: NULL tree"); + + if ( t->token == ALT ) + { + _gen("("); genExprTreeOriginal(t->down, k); _gen(")"); + if ( t->right!=NULL ) + { + _gen("||"); + on1line++; + if ( on1line > NumExprPerLine ) { on1line=0; _gen("\n"); } + _gen("("); genExprTreeOriginal(t->right, k); _gen(")"); + } + return; + } + if ( t->down!=NULL ) _gen("("); + _gen1("LA(%d)==",k); + if ( TokenString(t->token) == NULL ) _gen1("%d", t->token) + else _gen1("%s", TokenString(t->token)); + if ( t->down!=NULL ) + { + _gen("&&"); + on1line++; + if ( on1line > NumExprPerLine ) { on1line=0; _gen("\n"); } + _gen("("); genExprTreeOriginal(t->down, k+1); _gen(")"); + } + if ( t->down!=NULL ) _gen(")"); + if ( t->right!=NULL ) + { + _gen("||"); + on1line++; + if ( on1line > NumExprPerLine ) { on1line=0; _gen("\n"); } + _gen("("); genExprTreeOriginal(t->right, k); _gen(")"); + } +} + +#ifdef __USE_PROTOS +static void MR_LAtokenString(int k,int token) +#else +static void MR_LAtokenString(k,token) + int k; + int token; +#endif +{ + char *ts; + + ts=TokenString(token); + if (ts == NULL) { + _gen2(" LA(%d)==%d",k,token); + } else { + _gen2(" LA(%d)==%s",k,ts); + }; +} + + +#ifdef __USE_PROTOS +static int MR_countLeaves(Tree *t) +#else +static int MR_countLeaves(t) + Tree *t; +#endif +{ + if (t == NULL) return 0; + if (t->token == ALT) { + return MR_countLeaves(t->down)+MR_countLeaves(t->right); + } else { + return 1+MR_countLeaves(t->down)+MR_countLeaves(t->right); + }; +} + +#ifdef __USE_PROTOS +static void MR_genOneLine(Tree *tree,int k) +#else +static void MR_genOneLine(tree,k) + Tree *tree; + int k; +#endif +{ + if (tree == NULL) return; + if (tree->token == ALT) { + MR_genOneLine(tree->down,k); + } else { + MR_LAtokenString(k,tree->token); + if (tree->down != NULL && + tree->down->right == NULL) { + _gen(" &&"); + MR_genOneLine(tree->down,k+1); + } else if (tree->down != NULL) { + _gen(" && ("); + MR_genOneLine(tree->down,k+1); + _gen(")"); + }; + }; + if (tree->right != NULL) { + _gen(" ||"); + MR_genOneLine(tree->right,k); + }; +} + +static int across; +static int depth; +static int lastkonline; + +#ifdef __USE_PROTOS +static void MR_genMultiLine(Tree *tree,int k) +#else +static void MR_genMultiLine(tree,k) + Tree *tree; + int k; +#endif +{ + int i; + + if (tree == NULL) return; + if (tree->token == ALT) { + MR_genMultiLine(tree,k); + } else { + MR_LAtokenString(k,tree->token); + lastkonline=k; + across++; + if (tree->down != NULL && tree->down->right == NULL) { + if (across > 3) { + _gen("\n"); + across=0; + lastkonline=0; + for (i=0 ; i < depth+k ; i++) _gen(" "); + _gen("&&"); + } else { + _gen(" &&"); + }; + MR_genMultiLine(tree->down,k+1); + } else if (tree->down != NULL) { + _gen("\n"); + lastkonline=0; + across=0; + for (i=0 ; i < depth+k ; i++) _gen(" "); + _gen("&& ("); + MR_genMultiLine(tree->down,k+1); + _gen(")"); + }; + }; + if (tree->right != NULL) { + if (k < lastkonline) { + _gen("\n"); + across=0; + lastkonline=0; + for (i=0; i < depth+k-1 ; i++) _gen(" "); + _gen("||"); + } else if (across > 3 ) { + _gen("\n"); + across=0; + lastkonline=0; + for (i=0; i < depth+k ; i++) _gen(" "); + _gen("||"); + } else { + _gen(" ||"); + }; + MR_genMultiLine(tree->right,k); + }; +} + +#ifdef __USE_PROTOS +static void genExprTree(Tree *tree,int k) +#else +static void genExprTree(tree,k) + Tree *tree; + int k; +#endif +{ + int count; + +#if 0 + /* MR20 THM This was probably an error. + The routine should probably reference that static + "across" and this declaration hides it. + */ + + int across; +#endif + + require (tree != NULL,"genExprTree: tree is NULL"); + require (k > 0,"genExprTree: k <= 0"); + + if (0 && !MRhoisting) { /* MR11 make new version standard */ + genExprTreeOriginal(tree,k); + } else { + count=MR_countLeaves(tree); + if (count < 5) { + MR_genOneLine(tree,k); + } else { + _gen("\n"); + across=0; + depth=0; + lastkonline=0; + MR_genMultiLine(tree,k); + _gen("\n"); + }; + }; +} + + +/* + * Generate LL(k) type expressions of the form: + * + * (LA(1) == T1 || LA(1) == T2 || ... || LA(1) == Tn) && + * (LA(2) == T1 || LA(2) == T2 || ... || LA(2) == Tn) && + * ..... + * (LA(k) == T1 || LA(k) == T2 || ... || LA(k) == Tn) + * + * If GenExprSetsOpt generate: + * + * (setwdi[LA(1)]&(1<<j)) && (setwdi[LA(2)]&(1<<j)) ... + * + * where n is set_deg(expr) and Ti is some random token and k is the last nonempty + * set in fset <=CLL_k. + * k=1..CLL_k where CLL_k >= 1. + * + * This routine is visible only to this file and cannot answer a TRANS message. + * + */ + +/* [genExpr] */ + +static int +#ifdef __USE_PROTOS +genExpr( Junction *j ) +#else +genExpr( j ) +Junction *j; +#endif +{ + int max_k; + + /* if full LL(k) is sufficient, then don't use approximate (-ck) lookahead + * from CLL_k..LL_k + */ + { + int limit; + if ( j->ftree!=NULL ) limit = LL_k; + else limit = CLL_k; + max_k = genExprSets(j->fset, limit); + } + + /* Do tests for real tuples from other productions that conflict with + * artificial tuples generated by compression (using sets of tokens + * rather than k-trees). + */ + if ( j->ftree != NULL ) + { + _gen(" && !("); genExprTree(j->ftree, 1); _gen(")"); + } + + if ( ParseWithPredicates && j->predicate!=NULL ) + { + Predicate *p = j->predicate; + warn_about_using_gk_option(); + _gen("&&"); + j->predicate=genPredTreeMain(p, (Node *)j); /* MR10 */ + } + + return max_k; +} + +static int +#ifdef __USE_PROTOS +genExprSets( set *fset, int limit ) +#else +genExprSets( fset, limit ) +set *fset; +int limit; +#endif +{ + int k = 1; + int max_k = 0; + unsigned *e, *g, firstTime=1; + + if (set_nil(fset[1])) { + _gen(" 0 /* MR13 empty set expression - undefined rule ? infinite left recursion ? */ "); + MR_BadExprSets++; + }; + + if ( GenExprSetsOpt ) + { + while ( k <= limit && !set_nil(fset[k]) ) /* MR11 */ + { + if ( set_deg(fset[k])==1 ) /* too simple for a set? */ + { + int e; + _gen1("(LA(%d)==",k); + e = set_int(fset[k]); + if ( TokenString(e) == NULL ) _gen1("%d)", e) + else _gen1("%s)", TokenString(e)); + } + else + { + NewSet(); + FillSet( fset[k] ); + _gen3("(setwd%d[LA(%d)]&0x%x)", wordnum, k, 1<<setnum); + } + if ( k>max_k ) max_k = k; + if ( k == CLL_k ) break; + k++; + if ( k<=limit && !set_nil(fset[k]) ) _gen(" && "); /* MR11 */ + on1line++; + if ( on1line > NumExprPerLine ) { on1line=0; _gen("\n"); } + } + return max_k; + } + + while ( k<= limit && !set_nil(fset[k]) ) /* MR11 */ + { + if ( (e=g=set_pdq(fset[k])) == NULL ) fatal_internal("genExpr: cannot allocate IF expr pdq set"); + for (; *e!=nil; e++) + { + if ( !firstTime ) _gen(" || ") else { _gen("("); firstTime = 0; } + on1line++; + if ( on1line > NumExprPerLine ) { on1line=0; _gen("\n"); } + _gen1("LA(%d)==",k); + if ( TokenString(*e) == NULL ) _gen1("%d", *e) + else _gen1("%s", TokenString(*e)); + } + free( (char *)g ); + _gen(")"); + if ( k>max_k ) max_k = k; + if ( k == CLL_k ) break; + k++; + if ( k <= limit && !set_nil(fset[k]) ) { firstTime=1; _gen(" && "); } /* MR11 */ + on1line++; + if ( on1line > NumExprPerLine ) { on1line=0; _gen("\n"); } + } + return max_k; +} + +/* + * Generate code for any type of block. If the last alternative in the block is + * empty (not even an action) don't bother doing it. This permits us to handle + * optional and loop blocks as well. + * + * Only do this block, return after completing the block. + * This routine is visible only to this file and cannot answer a TRANS message. + */ +static set +#ifdef __USE_PROTOS +genBlk( Junction *q, int jtype, int *max_k, int *need_right_curly, int * lastAltEmpty /* MR23 */) +#else +genBlk( q, jtype, max_k, need_right_curly, lastAltEmpty /* MR23 */) +Junction *q; +int jtype; +int *max_k; +int *need_right_curly; +int *lastAltEmpty; /* MR23 */ +#endif +{ + set f; + Junction *alt; + int a_guess_in_block = 0; + require(q!=NULL, "genBlk: invalid node"); + require(q->ntype == nJunction, "genBlk: not junction"); + *need_right_curly=0; + *lastAltEmpty = 0; /* MR23 */ + if ( q->p2 == NULL ) /* only one alternative? Then don't need if */ + { + if (first_item_is_guess_block((Junction *)q->p1)!=NULL ) + { + if (jtype != aLoopBlk && jtype != aOptBlk && jtype != aPlusBlk) { + warnFL("(...)? as only alternative of block is unnecessary", FileStr[q->file], q->line); + }; + gen("zzGUESS\n"); /* guess anyway to make output code consistent */ +/* MR10 disable */ /**** gen("if ( !zzrv )\n"); ****/ +/* MR10 */ gen("if ( !zzrv ) {\n"); tabs++; (*need_right_curly)++; + }; + TRANS(q->p1); + return empty; /* no decision to be made-->no error set */ + } + + f = First(q, 1, jtype, max_k); + for (alt=q; alt != NULL; alt= (Junction *) alt->p2 ) + { + if ( alt->p2 == NULL ) /* chk for empty alt */ + { + Node *p = alt->p1; + if ( p->ntype == nJunction ) + { + /* we have empty alt */ +/* MR23 + There is a conflict between giving good error information for non-exceptions + and making life easy for those using parser exception handling. Consider: + + r: { A } b; + b: B; + + with input "C" + + Before MR21 the error message would be "expecting B - found C". After MR21 + the error message would be "expcect A, B - found C". This was good, but it + caused problems for those using parser exceptions because the reference to + B was generated inside the {...} where B really wasn't part of the block. + + In MR23 this has been changed for the case where exceptions are in use to + not generate the extra check in the tail of the {A} block. +*/ + + +/* MR23 */ if (isEmptyAlt( ((Junction *)p)->p1, (Node *)q->end)) { +/* MR23 */ *lastAltEmpty = 1; +/* MR23 */ if (FoundException) { +/* MR23 */ /* code to restore state if a prev alt didn't follow guess */ +/* MR23 */ if ( a_guess_in_block && jtype != aPlusBlk) { +/* MR23 */ gen("if ( !zzrv ) zzGUESS_DONE; /* MR28 */\n"); +/* MR23 */ } +/* MR23 */ break; +/* MR23 */ }; +/* MR28 */ if (jtype == aPlusBlk) { +/* MR28 */ break; +/* MR28 */ } +/* MR23 */ } + } + } /* end of for loop on alt */ + +/* MR10 */ if (alt->p2 == NULL && +/* MR10 */ ( q->jtype == aSubBlk || q->jtype == RuleBlk) ) { +/* MR10 */ if (first_item_is_guess_block(alt)) { +/* MR10 */ warnFL("(...)? as last alternative of block is unnecessary", +/* MR10 */ FileStr[alt->file],alt->line); +/* MR10 */ }; +/* MR10 */ }; + + if ( alt != q ) gen("else ") + else + { + if ( DemandLookahead ) { + if ( !GenCC ) {gen1("LOOK(%d);\n", *max_k);} + else gen1("look(%d);\n", *max_k); + } + } + + if ( alt!=q ) + { + _gen("{\n"); + tabs++; + (*need_right_curly)++; + /* code to restore state if a prev alt didn't follow guess */ + if ( a_guess_in_block ) + gen("if ( !zzrv ) zzGUESS_DONE;\n"); + } + if ( first_item_is_guess_block((Junction *)alt->p1)!=NULL ) + { + a_guess_in_block = 1; + gen("zzGUESS\n"); + } + gen("if ( "); + if ( first_item_is_guess_block((Junction *)alt->p1)!=NULL ) _gen("!zzrv && "); + genExpr(alt); + _gen(" ) "); + _gen("{\n"); + tabs++; + TRANS(alt->p1); + --tabs; + gen("}\n"); +/* MR10 */ if (alt->p2 == NULL) { +/* MR10 */ if (first_item_is_guess_block(alt)) { +/* MR10 */ gen("/* MR10 */ else {\n"); +/* MR10 */ tabs++; +/* MR10 */ (*need_right_curly)++; +/* MR10 */ /* code to restore state if a prev alt didn't follow guess */ +/* MR10 */ gen("/* MR10 */ if ( !zzrv ) zzGUESS_DONE;\n"); +/* MR10 */ gen("/* MR10 */ if (0) {} /* last alternative of block is guess block */\n"); +/* MR10 */ }; +/* MR10 */ }; + } + return f; +} + +static int +#ifdef __USE_PROTOS +has_guess_block_as_first_item( Junction *q ) +#else +has_guess_block_as_first_item( q ) +Junction *q; +#endif +{ + Junction *alt; + + for (alt=q; alt != NULL; alt= (Junction *) alt->p2 ) + { + if ( first_item_is_guess_block((Junction *)alt->p1)!=NULL ) return 1; + } + return 0; +} + +static int +#ifdef __USE_PROTOS +has_guess_block_as_last_item( Junction *q ) +#else +has_guess_block_as_last_item( q ) +Junction *q; +#endif +{ + Junction *alt; + + if (q == NULL) return 0; + for (alt=q; alt->p2 != NULL && !( (Junction *) alt->p2)->ignore; alt= (Junction *) alt->p2 ) {}; + return first_item_is_guess_block( (Junction *) alt->p1) != NULL; +} + +/* MR30 See description of first_item_is_guess_block for background */ + +Junction * +#ifdef __USE_PROTOS +first_item_is_guess_block_extra(Junction *q ) +#else +first_item_is_guess_block_extra(q) +Junction *q; +#endif +{ + while ( q!=NULL && + ( ( q->ntype==nAction ) || + ( q->ntype==nJunction && + (q->jtype==Generic || q->jtype == aLoopBlk) + ) + ) + ) + { + if ( q->ntype==nJunction ) q = (Junction *)q->p1; + else q = (Junction *) ((ActionNode *)q)->next; + } + + if ( q==NULL ) return NULL; + if ( q->ntype!=nJunction ) return NULL; + if ( q->jtype!=aSubBlk ) return NULL; + if ( !q->guess ) return NULL; + + return q; +} + +/* return NULL if 1st item of alt is NOT (...)? block; else return ptr to aSubBlk node + * of (...)?; This function ignores actions and predicates. + */ + +Junction * +#ifdef __USE_PROTOS +first_item_is_guess_block( Junction *q ) +#else +first_item_is_guess_block( q ) +Junction *q; +#endif +{ + Junction * qOriginal = q; /* DEBUG */ + + /* MR14 Couldn't find aSubBlock which was a guess block when it lay + behind aLoopBlk. The aLoopBlk only appear in conjunction with + aLoopBegin, but the routine didn't know that. I think. + + MR14a Added extra parentheses to clarify precedence + + MR30 This appears to have been a mistake. The First set was then + computed incorrectly for: + + r : ( (A)? B + | C + )* + + The routine analysis_point was seeing the guess block when + it was still analyzing the loopBegin block. As a consequence, + when it looked for the analysis_point it was processing the B, but + skipping over the C alternative altogether because it thought + it was looking at a guess block, not realizing there was a loop + block in front of the loopBegin. + + loopBegin loopBlk subBlk/guess A G EB G B EB EB EB ER + | | | ^ ^ + | | | | + | +-> G C G ----------------------+ | + | | + +--- G G G -------------------------------------+ + + Reported by Arpad Beszedes (beszedes@inf.u-szeged.hu). + + MR30 This is still more complicated. This fix caused ambiguity messages + to be reported for "( (A B)? )* A B" but not for "( (A B)? )+". Why is + there a difference when these are outwardly identical ? It is because the + start of a (...)* block is represented by two nodes: a loopBegin block + followed by a loopBlock whereas the start of a (...)+ block is + represented as a single node: a plusBlock. So if first_item_is_guess_block + is called when the current node is a loopBegin it starts with the + loop block rather than the the sub block which follows the loop block. + However, we can't just skip past the loop block because some routines + depend on the old implementation. So, we provide a new implementation + which does skip the loopBlock. However, which should be called when ? + I'm not sure, but my guess is that first_item_is_guess_block_extra (the + new one) should only be called for the ambiguity routines. + + */ + + while ( q!=NULL && + ( ( q->ntype==nAction ) || + ( q->ntype==nJunction && + (q->jtype==Generic /*** || q->jtype == aLoopBlk ***/ ) /*** MR30 Undo MR14 change ***/ + ) + ) + ) + { + if ( q->ntype==nJunction ) q = (Junction *)q->p1; + else q = (Junction *) ((ActionNode *)q)->next; + } + + if ( q==NULL ) return NULL; + if ( q->ntype!=nJunction ) return NULL; + if ( q->jtype!=aSubBlk ) return NULL; + if ( !q->guess ) return NULL; + + return q; +} + +/* MR1 */ +/* MR1 10-Apr-97 MR1 Routine to stringize failed semantic predicates msgs */ +/* MR1 */ + +#define STRINGIZEBUFSIZE 1024 + +static char stringizeBuf[STRINGIZEBUFSIZE]; +char * +#ifdef __USE_PROTOS +stringize(char * s) +#else +stringize(s) +char *s; +#endif + +{ + char *p; + char *stop; + + p=stringizeBuf; + stop=&stringizeBuf[1015]; + + if (s != 0) { + while (*s != 0) { + if (p >= stop) { + goto stringizeStop; + } else if (*s == '\n') { + *p++='\\'; + *p++='n'; + *p++='\\'; + *p++=*s++; + } else if (*s == '\\') { + *p++=*s; + *p++=*s++; + } else if (*s == '\"') { + *p++='\\'; + *p++=*s++; + while (*s != 0) { + if (p >= stop) { + goto stringizeStop; + } else if (*s == '\n') { + *p++='\\'; + *p++=*s++; + } else if (*s == '\\') { + *p++=*s++; + *p++=*s++; + } else if (*s == '\"') { + *p++='\\'; + *p++=*s++; + break; + } else { + *p++=*s++; + }; + }; + } else if (*s == '\'') { + *p++=*s++; + while (*s != 0) { + if (p >= stop) { + goto stringizeStop; + } else if (*s == '\'') { + *p++=*s++; + break; + } else if (*s == '\\') { + *p++=*s++; + *p++=*s++; + } else if (*s == '\"') { + *p++='\\'; + *p++=*s++; + break; + } else { + *p++=*s++; + }; + }; + } else { + *p++=*s++; + }; + }; + }; + goto stringizeExit; +stringizeStop: + *p++='.'; + *p++='.'; + *p++='.'; +stringizeExit: + *p=0; + return stringizeBuf; +} + +#ifdef __USE_PROTOS +int isNullAction(char *s) +#else +int isNullAction(s) + char *s; +#endif +{ + char *p; + for (p=s; *p != '\0' ; p++) { + if (*p != ';' && *p !=' ') return 0; + }; + return 1; +} +/* MR1 */ +/* MR1 End of Routine to stringize code for failed predicates msgs */ +/* MR1 */ + +/* Generate an action. Don't if action is NULL which means that it was already + * handled as an init action. + */ +void +#ifdef __USE_PROTOS +genAction( ActionNode *p ) +#else +genAction( p ) +ActionNode *p; +#endif +{ + require(p!=NULL, "genAction: invalid node and/or rule"); + require(p->ntype==nAction, "genAction: not action"); + + if ( !p->done ) /* MR10 */ /* MR11 */ + { + if ( p->is_predicate) + { + if ( p->guardpred != NULL ) + { + Predicate *guardDup=predicate_dup(p->guardpred); /* MR10 */ + gen("if (!"); + guardDup=genPredTreeMain(guardDup, (Node *)p); + predicate_free(guardDup); + } +/* MR10 */ else if (p->ampersandPred != NULL) { +/* MR10 */ gen("if (!"); +/* MR10 */ p->ampersandPred=genPredTreeMain(p->ampersandPred, (Node *)p); +/* MR10 */ } + else + { + gen("if (!("); + /* make sure that '#line n' is on front of line */ + if ( GenLineInfo && p->file != -1 ) _gen("\n"); + dumpPredAction(p,p->action, output, 0, p->file, p->line, 0); + _gen(")"); + } + +/* MR23 Change failed predicate macro to have three arguments: + + macro arg 1: The stringized predicate itself + macro arg 2: 0 => no user-defined error action + 1 => user-defined error action + macro arg 3: The user-defined error action + + This gives the user more control of the error action. +*/ + tabs++; + gen3(") {zzfailed_pred(\"%s\",%s, { %s } );}\n", /* MR23 */ + stringize(p->action), /* MR23 */ + (p->pred_fail == NULL ? /* MR23/MR27 */ + "0 /* report */" : "1 /* user action */"), /* MR23/MR27 */ + (p->pred_fail == NULL ? /* MR23 */ + "0; /* no user action */" : p->pred_fail)); /* MR23 */ + tabs--; + } + else /* not a predicate */ + { + if (! isNullAction(p->action) && !p->noHoist) { + if ( FoundGuessBlk ) { + if ( GenCC ) { + gen("if ( !guessing ) {\n"); + } else { + gen("zzNON_GUESS_MODE {\n"); + }; + }; + dumpActionPlus(p, p->action, output, tabs, p->file, p->line, 1); /* MR21 */ + if ( FoundGuessBlk ) gen("}\n"); + }; + } + } + TRANS(p->next) +} + +/* + * if invoking rule has !noAST pass zzSTR to rule ref and zzlink it in + * else pass addr of temp root ptr (&_ast) (don't zzlink it in). + * + * if ! modifies rule-ref, then never link it in and never pass zzSTR. + * Always pass address of temp root ptr. + */ +void +#ifdef __USE_PROTOS +genRuleRef( RuleRefNode *p ) +#else +genRuleRef( p ) +RuleRefNode *p; +#endif +{ + Junction *q; + char *handler_id = ""; + RuleEntry *r, *r2; + char *parm = "", *exsig = ""; + + int genRuleRef_emittedGuessGuard=0; /* MR10 */ + + require(p!=NULL, "genRuleRef: invalid node and/or rule"); + require(p->ntype==nRuleRef, "genRuleRef: not rule reference"); + + if ( p->altstart!=NULL && p->altstart->exception_label!=NULL ) + handler_id = p->altstart->exception_label; + + r = (RuleEntry *) hash_get(Rname, p->text); + if ( r == NULL ) + { + warnFL( eMsg1("rule %s not defined", + p->text), FileStr[p->file], p->line ); + return; + } + +/* MR8 5-Aug-97 Reported by S.Bochnak@microtool.com.pl */ +/* Don't do assign when no return values declared */ +/* Move definition of q up and use it to guard p->assign */ + + q = RulePtr[r->rulenum]; /* find definition of ref'd rule */ /* MR8 */ + + r2 = (RuleEntry *) hash_get(Rname, p->rname); + if ( r2 == NULL ) {warnNoFL("Rule hash table is screwed up beyond belief"); return;} + + OutLineInfo(output,p->line,FileStr[p->file]); + + if ( GenCC && GenAST ) { + gen("_ast = NULL;\n"); + } + + if ( FoundGuessBlk && p->assign!=NULL && q->ret != NULL ) { /* MR8 */ + if ( GenCC ) { + gen("if ( !guessing ) {\n"); + } else { + gen("zzNON_GUESS_MODE {\n"); + }; + tabs++; /* MR11 */ + genRuleRef_emittedGuessGuard=1; /* MR11 */ + }; + + if ( FoundException ) exsig = "&_signal"; + + tab(); + if ( GenAST ) + { + if ( GenCC ) { +/**** if ( r2->noAST || p->astnode==ASTexclude ) +****/ + { +/**** _gen("_ast = NULL;\n"); +****/ + parm = "&_ast"; + } +/*** we always want to set just a pointer now, then set correct +pointer after + + else { + _gen("_astp = +(_tail==NULL)?(&_sibling):(&(_tail->_right));\n"); + parm = "_astp"; + } +****/ + } + else { + if ( r2->noAST || p->astnode==ASTexclude ) + { + _gen("_ast = NULL; "); + parm = "&_ast"; + } + else parm = "zzSTR"; + } + if ( p->assign!=NULL && q->ret!=NULL ) /* MR8 */ + { + if ( !hasMultipleOperands(p->assign) ) {_gen1("%s = ",p->assign);} /* MR23 */ + else _gen1("{ struct _rv%d _trv; _trv = ", r->rulenum); + } + if ( FoundException ) { + _gen5("%s%s(%s,&_signal%s%s); ", + RulePrefix, + p->text, + parm, + (p->parms!=NULL)?",":"", + (p->parms!=NULL)?p->parms:""); + if ( p->ex_group!=NULL ) { + _gen("\n"); + gen("if (_signal) {\n"); + tabs++; + dumpException(p->ex_group, 0); + tabs--; + gen("}"); + } + else { + _gen1("if (_signal) goto %s_handler;", handler_id); + } + } + else { + _gen5("%s%s(%s%s%s);", + RulePrefix, + p->text, + parm, + (p->parms!=NULL)?",":"", + (p->parms!=NULL)?p->parms:""); + } + if ( GenCC && (r2->noAST || p->astnode==ASTexclude) ) + { + /* rule has a ! or element does */ + /* still need to assign to #i so we can play with it */ + _gen("\n"); + gen2("_ast%d%d = (AST *)_ast;", BlkLevel-1, p->elnum); + } + else if ( !r2->noAST && p->astnode == ASTinclude ) + { + /* rule doesn't have a ! and neither does element */ +/* MR10 */ if (FoundGuessBlk && !genRuleRef_emittedGuessGuard) { +/* MR10 */ _gen("\n"); +/* MR10 */ if (GenCC) gen ("if (!guessing) { /* MR10 */") +/* MR10 */ else gen ("if (!zzguessing) { /* MR10 */\n"); +/* MR10 */ tabs++; +/* MR10 */ }; + if ( GenCC ) { + _gen("\n"); + gen("if ( _tail==NULL ) _sibling = _ast; else _tail->setRight(_ast);\n"); + gen2("_ast%d%d = (AST *)_ast;\n", BlkLevel-1, p->elnum); + tab(); + } + else _gen(" "); + if ( GenCC ) { + _gen("ASTBase::"); } + else _gen("zz"); + _gen("link(_root, &_sibling, &_tail);"); + +/* MR10 */ if (FoundGuessBlk && !genRuleRef_emittedGuessGuard) { /* MR10 */ +/* MR10 */ _gen("\n"); +/* MR10 */ tabs--; +/* MR10 */ if (GenCC) gen ("}; /* MR10 */") +/* MR10 */ else gen ("}; /* MR10 */"); +/* MR10 */ }; + } + } + else + { + if ( p->assign!=NULL && q->ret!=NULL ) /* MR8 */ + { + if ( !hasMultipleOperands(p->assign) ) {_gen1("%s = ",p->assign);} /* MR23 */ + else _gen1("{ struct _rv%d _trv; _trv = ", r->rulenum); + } + if ( FoundException ) { + _gen4("%s%s(&_signal%s%s); ", + RulePrefix, + p->text, + (p->parms!=NULL)?",":"", + (p->parms!=NULL)?p->parms:""); + if ( p->ex_group!=NULL ) { + _gen("\n"); + gen("if (_signal) {\n"); + tabs++; + dumpException(p->ex_group, 0); + tabs--; + gen("}"); + } + else { + _gen1("if (_signal) goto %s_handler;", handler_id); + } + } + else { + _gen3("%s%s(%s);", + RulePrefix, + p->text, + (p->parms!=NULL)?p->parms:""); + } + if ( p->assign!=NULL && q->ret!=NULL ) _gen("\n"); /* MR8 */ + } + + if ( p->assign!=NULL && q->ret!=NULL) { /* MR8 */ + if ( hasMultipleOperands(p->assign) ) /* MR23 */ + { + _gen("\n"); + dumpRetValAssign(p->assign, q->ret, p); /* MR30 */ + _gen("}"); + } + } + _gen("\n"); + + /* Handle element labels now */ + if ( p->el_label!=NULL ) + { + if ( GenAST ) + { + if ( GenCC ) { + gen3("%s_ast = _ast%d%d;\n", p->el_label, BlkLevel-1, p->elnum); + } + else {gen1("%s_ast = zzastCur;\n", p->el_label);} + } + else if (!GenCC ) { + gen1("%s = zzaCur;\n", p->el_label); + } + } + + if ( FoundGuessBlk && p->assign!=NULL && q->ret!=NULL ) { /* MR8 */ + /* in guessing mode, don't branch to handler upon error */ + tabs--; /* MR11 */ + gen("} else {\n"); + tabs++; /* MR11 */ + if ( FoundException ) { + gen6("%s%s(%s%s&_signal%s%s);\n", + RulePrefix, + p->text, + parm, + (*parm!='\0')?",":"", + (p->parms!=NULL)?",":"", + (p->parms!=NULL)?p->parms:""); + } + else { + gen5("%s%s(%s%s%s);\n", + RulePrefix, + p->text, + parm, + (p->parms!=NULL && *parm!='\0')?",":"", + (p->parms!=NULL)?p->parms:""); + } + tabs--; /* MR11 */ + gen("}\n"); + } + TRANS(p->next) +} + +/* + * Generate code to match a token. + * + * Getting the next token is tricky. We want to ensure that any action + * following a token is executed before the next GetToken(); + */ +void +#ifdef __USE_PROTOS +genToken( TokNode *p ) +#else +genToken( p ) +TokNode *p; +#endif +{ + RuleEntry *r; + char *handler_id = ""; + ActionNode *a; + char *set_name; + char *set_nameErrSet; + int complement; + int ast_label_in_action = 0; /* MR27 */ + int pushedCmodeAST = 0; /* MR27 */ + + require(p!=NULL, "genToken: invalid node and/or rule"); + require(p->ntype==nToken, "genToken: not token"); + if ( p->altstart!=NULL && p->altstart->exception_label!=NULL ) + handler_id = p->altstart->exception_label; + + r = (RuleEntry *) hash_get(Rname, p->rname); + if ( r == NULL ) {warnNoFL("Rule hash table is screwed up beyond belief"); return;} + +/* + * MR27 Has the element label been referenced as an AST (with the # operator) ? + * If so, then we'll want to build the AST even though the user has used + * the ! operator. + */ +/* MR27 */ if (GenAST && p->el_label != NULL) { +/* MR27 */ ast_label_in_action = list_search_cstring(r->ast_labels_in_actions, +/* MR27 */ p->el_label); +/* MR27 */ } + + OutLineInfo(output,p->line,FileStr[p->file]); + + if ( !set_nil(p->tset) ) /* implies '.', ~Tok, or tokenclass */ + { + unsigned e; + unsigned eErrSet = 0; + set b; + set bErrSet; /* MR23 */ + b = set_dup(p->tset); + bErrSet = set_dup(p->tset); /* MR23 */ + complement = p->complement; /* MR23 */ + if ( p->tclass!=NULL && complement == 0 /* MR23 */) { /* token class not complemented*/ + static char buf[MaxRuleName+20]; /* MR23 */ + static char bufErrSet[MaxRuleName+20]; /* MR23 */ + if ( p->tclass->dumped ) { + e = p->tclass->setnum; + eErrSet = p->tclass->setnumErrSet; + } + else { + e = DefErrSet(&b, 0, TokenString(p->token)); + eErrSet = DefErrSetWithSuffix(0, &bErrSet, 1, TokenString(p->token), "_errset"); + p->tclass->dumped = 1; /* indicate set has been created */ + p->tclass->setnum = e; + p->tclass->setnumErrSet = eErrSet; /* MR23 */ + } + sprintf(buf, "%s_set", TokenString(p->token)); + sprintf(bufErrSet, "%s_errset", TokenString(p->token)); /* MR23 */ + set_name = buf; + set_nameErrSet = bufErrSet; /* MR23 */ + } + + /* MR23 - Forgot about the case of ~TOKCLASS. */ + + else if ( p->tclass!=NULL && complement != 0 /* MR23 */) + { + static char buf[MaxRuleName+20]; /* MR23 */ + static char bufErrSet[MaxRuleName+20]; /* MR23 */ + if ( p->tclass->dumpedComplement ) { + e = p->tclass->setnumComplement; + eErrSet = p->tclass->setnumErrSetComplement; + } + else { + e = DefErrSetWithSuffix(0, &b, 0, TokenString(p->token), "_setbar"); + eErrSet = DefErrSetWithSuffix(0, &bErrSet, 1, TokenString(p->token), "_errsetbar"); + p->tclass->dumpedComplement = 1; /* indicate set has been created */ + p->tclass->setnumComplement = e; + p->tclass->setnumErrSetComplement = eErrSet; /* MR23 */ + } + sprintf(buf, "%s_setbar", TokenString(p->token)); + sprintf(bufErrSet, "%s_errsetbar", TokenString(p->token)); /* MR23 */ + set_name = buf; + set_nameErrSet = bufErrSet; /* MR23 */ + } + else { /* wild card */ + static char buf[sizeof("zzerr")+10]; + static char bufErrSet[sizeof("zzerr")+10]; + int n = DefErrSet( &b, 0, NULL ); + int nErrSet = DefErrSetWithSuffix(0, &bErrSet, 1, NULL, "_set"); + if ( GenCC ) sprintf(buf, "err%d", n); + else sprintf(buf, "zzerr%d", n); + if ( GenCC ) sprintf(bufErrSet, "err%d", nErrSet); + else sprintf(bufErrSet, "zzerr%d", nErrSet); + set_name = buf; + set_nameErrSet = bufErrSet; + } + + if ( !FoundException ) { +/* MR23 */ gen2("zzsetmatch(%s, %s);", set_name, set_nameErrSet); + } + else if ( p->ex_group==NULL ) { + if ( p->use_def_MT_handler ) + gen3("zzsetmatch_wdfltsig(%s,(ANTLRTokenType)%d,%s);", + set_name, + p->token, + tokenFollowSet(p)) + else + gen2("zzsetmatch_wsig(%s, %s_handler);", + set_name, + handler_id); + } + else + { + gen1("if ( !_setmatch_wsig(%s) ) {\n", set_name); + tabs++; +/* MR6 */ if (FoundGuessBlk) { +/* MR6 */ if ( GenCC ) {gen("if ( guessing ) goto fail;\n");} +/* MR6 */ else gen("if ( zzguessing ) goto fail;\n"); +/* MR6 */ }; + gen("_signal=MismatchedToken;\n"); + dumpException(p->ex_group, 0); + tabs--; + gen("}\n"); + } + set_free(b); + set_free(bErrSet); + } + else if ( TokenString(p->token)!=NULL ) + { + if ( FoundException ) { + if ( p->use_def_MT_handler ) + gen2("zzmatch_wdfltsig(%s,%s);",TokenString(p->token),tokenFollowSet(p)) + else if ( p->ex_group==NULL ) + { + gen2("zzmatch_wsig(%s, %s_handler);", + TokenString(p->token), + handler_id); + } + else + { +/* MR6 */ if (GenCC) { +/* MR6 */ gen1("if ( !_match_wsig(%s) ) {\n", TokenString(p->token)); +/* MR6 */ } else { +/* MR6 */ gen1("if ( !_zzmatch_wsig(%s) ) {\n", TokenString(p->token)); +/* MR6 */ }; + tabs++; +/* MR6 */ if (FoundGuessBlk) { +/* MR6 */ if ( GenCC ) {gen("if ( guessing ) goto fail;\n");} +/* MR6 */ else gen("if ( zzguessing ) goto fail;\n"); +/* MR6 */ }; + gen("_signal=MismatchedToken;\n"); + dumpException(p->ex_group, 0); + tabs--; + gen("}\n"); + } + } + else gen1("zzmatch(%s);", TokenString(p->token)); + } + else { + if ( FoundException ) { + if ( p->use_def_MT_handler ) + gen2("zzmatch_wdfltsig((ANTLRTokenType)%d,%s);", + p->token,tokenFollowSet(p)) + else + gen2("zzmatch_wsig(%d,%s_handler);",p->token,handler_id); + } + else {gen1("zzmatch(%d);", p->token);} + } + + a = findImmedAction( p->next ); + /* generate the token labels */ + if ( GenCC && p->elnum>0 ) + { + /* If building trees in C++, always gen the LT() assigns */ + if ( set_el(p->elnum, tokensRefdInBlock) || GenAST ) + { +/* MR10 */ if ( FoundGuessBlk ) { +/* MR10 */ gen("\n"); +/* MR10 */ if (p->label_used_in_semantic_pred) { +/* MR10 */ gen2(" _t%d%d = (ANTLRTokenPtr)LT(1); /* MR10 */\n", BlkLevel-1, p->elnum); +/* MR10 */ } else { +/* MR10 */ gen("if ( !guessing ) {\n"); tab(); +/* MR10 */ _gen2(" _t%d%d = (ANTLRTokenPtr)LT(1);\n", BlkLevel-1, p->elnum); +/* MR10 */ gen("}\n"); +/* MR10 */ }; +/* MR10 */ } else { +/* MR10 */ _gen2(" _t%d%d = (ANTLRTokenPtr)LT(1);", BlkLevel-1, p->elnum); +/* MR10 */ }; +/* MR10 */ + } + +/* + * MR23 labase is never used in the C++ runtime library. + * and this code is generated only in C++ mode + */ + +/*** if ( LL_k>1 ) / * MR23 disabled */ +/*** if ( !DemandLookahead ) _gen(" labase++;"); / * MR23 disabled */ +/*** _gen("\n"); / * MR23 disabled */ +/*** tab(); / * MR23 disabled */ + } + if ( GenAST ) + { + if ( FoundGuessBlk && + (ast_label_in_action || !(p->astnode == ASTexclude || r->noAST)) ) + { + if ( GenCC ) {_gen("if ( !guessing ) {\n"); tab();} + else {_gen("zzNON_GUESS_MODE {\n"); tab();} + } + +/* MR27 addition when labels referenced when operator ! used */ + + pushedCmodeAST = 0; /* MR27 */ + if (ast_label_in_action && (p->astnode == ASTexclude || r->noAST)) { + _gen("\n"); + if (GenCC) { +/* MR13 */ if (NewAST) { +/* MR13 */ gen4("_ast%d%d = newAST(_t%d%d); /* MR27 */\n", BlkLevel-1, p->elnum, BlkLevel-1, p->elnum); +/* MR13 */ } else { +/* MR13 */ gen4("_ast%d%d = new AST(_t%d%d); /* MR27 */\n", BlkLevel-1, p->elnum, BlkLevel-1, p->elnum); +/* MR13 */ } + } + else { + pushedCmodeAST = 1; + gen("zzastPush(zzmk_ast(zzastnew(),zzaCur)); /* MR27 */"); + } + } + +/* end MR27 addition for labels referenced when operator ! used */ + + if (!r->noAST ) + { + if (GenCC && !(p->astnode == ASTexclude) ) { + _gen("\n"); +/* MR13 */ if (NewAST) { +/* MR13 */ gen4("_ast%d%d = newAST(_t%d%d);\n", BlkLevel-1, p->elnum, BlkLevel-1, p->elnum); +/* MR13 */ } else { +/* MR13 */ gen4("_ast%d%d = new AST(_t%d%d);\n", BlkLevel-1, p->elnum, BlkLevel-1, p->elnum); +/* MR13 */ } + tab(); + } + if ( GenCC && !(p->astnode == ASTexclude) ) + {_gen2("_ast%d%d->", BlkLevel-1, p->elnum);} + else _gen(" "); + if ( p->astnode==ASTchild ) { + if ( !GenCC ) _gen("zz"); + _gen("subchild(_root, &_sibling, &_tail);"); + } + else if ( p->astnode==ASTroot ) { + if ( !GenCC ) _gen("zz"); + _gen("subroot(_root, &_sibling, &_tail);"); + } + if ( GenCC && !(p->astnode == ASTexclude) ) { + _gen("\n"); + tab(); + } + } + else if ( !GenCC ) { + if (! pushedCmodeAST) _gen(" zzastDPush;"); + } + if ( FoundGuessBlk && + (ast_label_in_action || !(p->astnode == ASTexclude || r->noAST)) ) + {gen("}\n"); tab();} + } + + /* Handle element labels now */ + if ( p->el_label!=NULL ) + { + int done_NON_GUESSMODE=0; + + _gen("\n"); + +/* MR10 */ /* do Attrib / Token ptr for token label used in semantic pred */ +/* MR10 */ /* for these cases do assign even in guess mode */ +/* MR10 */ +/* MR10 */ if (p->label_used_in_semantic_pred) { +/* MR10 */ if ( GenCC ) { +/* MR10 */ if ( set_el(p->elnum, tokensRefdInBlock) || GenAST ) { +/* MR10 */ gen3("%s = _t%d%d;", p->el_label, BlkLevel-1, p->elnum); +/* MR10 */ } else { +/* MR10 */ gen1("%s = (ANTLRTokenPtr)LT(1);\n", p->el_label); +/* MR10 */ }; +/* MR10 */ } else { +/* MR10 */ gen1("%s = zzaCur;", p->el_label); +/* MR10 */ }; +/* MR10 */ if (FoundGuessBlk) _gen(" /* MR10 */"); +/* MR10 */ _gen("\n"); +/* MR10 */ }; + + /* Do Attrib / Token ptr */ + +/* MR10 */ if (! p->label_used_in_semantic_pred) { +/* MR10 */ +/* MR10 */ if ( FoundGuessBlk ) { +/* MR10 */ if (! done_NON_GUESSMODE) { +/* MR10 */ done_NON_GUESSMODE=1; +/* MR10 */ if ( GenCC ) {gen("if ( !guessing ) {\n"); tab();} +/* MR10 */ else {gen("zzNON_GUESS_MODE {\n"); tab();} +/* MR10 */ }; +/* MR10 */ }; +/* MR10 */ +/* MR10 */ if ( GenCC ) { +/* MR10 */ if ( set_el(p->elnum, tokensRefdInBlock) || GenAST ) { +/* MR10 */ gen3("%s = _t%d%d;\n", p->el_label, BlkLevel-1, p->elnum); +/* MR10 */ } else { +/* MR10 */ gen1("%s = (ANTLRTokenPtr)LT(1);\n", p->el_label); +/* MR10 */ }; +/* MR10 */ } else { +/* MR10 */ gen1("%s = zzaCur;\n", p->el_label); +/* MR10 */ }; +/* MR10 */ }; + + /* Do AST ptr */ + + if (GenAST && (ast_label_in_action || !(p->astnode == ASTexclude || r->noAST) )) /* MR27 */ + { + +/* MR10 */ if ( FoundGuessBlk ) { +/* MR10 */ if (! done_NON_GUESSMODE) { +/* MR10 */ done_NON_GUESSMODE=1; +/* MR10 */ if ( GenCC ) {gen("if ( !guessing ) {\n"); tab();} +/* MR10 */ else {gen("zzNON_GUESS_MODE {\n"); tab();} +/* MR10 */ }; +/* MR10 */ }; + + if ( GenCC ) { + gen3("%s_ast = _ast%d%d;\n", p->el_label, BlkLevel-1, p->elnum); + } + else {gen1("%s_ast = zzastCur;\n", p->el_label);} + } + +/* MR10 */ if (done_NON_GUESSMODE) { +/* MR10 */ gen("}\n"); tab(); +/* MR10 */ }; + + } + + /* Handle any actions immediately following action */ + if ( a != NULL ) /* MR10 */ /* MR11 */ + { + /* delay next token fetch until after action */ + _gen("\n"); + if ( a->is_predicate) + { +#if 0 +/* Disabled in MR30 ************************************************************ + And moved into genAction + ***************************************************************************** +*/ + + gen("if (!("); + + /* make sure that '#line n' is on front of line */ /* MR14 */ + if ( GenLineInfo && p->file != -1 ) _gen("\n"); /* MR14 */ + dumpPredAction(a,a->action, output, 0, a->file, a->line, 0); + +/* MR23 Change failed predicate macro to have three arguments: + + macro arg 1: The stringized predicate itself + macro arg 2: 0 => no user-defined error action + 1 => user-defined error action + macro arg 3: The user-defined error action + + This gives the user more control of the error action. +*/ + _gen(")) \n"); + tabs++; + gen3(" {zzfailed_pred(\"%s\",%s,{ %s } );}\n", /* MR23 */ + stringize(a->action), /* MR23 */ + (a->pred_fail == NULL ? /* MR23/MR27 */ + "0 /* report */" : "1 /* user action */"), /* MR23/MR27 */ + (a->pred_fail == NULL ? /* MR23 */ + "0; /* no user action */" : a->pred_fail)); /* MR23 */ + tabs--; +/* Disabled in MR30 ************************************************************ + And moved into genAction + ***************************************************************************** +*/ +#endif + } + else /* MR9 a regular action - not a predicate action */ + { + +/* MR23: Search an action which is not a predicate for LT(i), + LA(i), or LATEXT(i) in order to warn novice users that + it refers to the previous matched token, not the next + one. This is different than the case for semantic + predicates. +*/ + +/* MR23 */ if (GenCC) { +/* MR23 */ if (strstr(a->action, "LT(") != NULL) LTinTokenAction = 1; +/* MR23 */ } +/* MR23 */ else { +/* MR23 */ if (strstr(a->action, "LA(") != NULL) LTinTokenAction = 1; +/* MR23 */ if (strstr(a->action, "LATEXT(") != NULL) LTinTokenAction = 1; +/* MR23 */ } + + if ( FoundGuessBlk ) { + if ( GenCC ) {gen("if ( !guessing ) {\n");} + else gen("zzNON_GUESS_MODE {\n"); + } + dumpActionPlus(a, a->action, output, tabs, a->file, a->line, 1); /* MR21 */ + if ( FoundGuessBlk ) gen("}\n"); + a->done = 1; /* MR30 */ + } +/*** a->done = 1; MR30 Moved up into then branch for true actions, but not predicates ***/ + if ( !DemandLookahead ) { + if ( GenCC ) { + if ( FoundException && p->use_def_MT_handler ) gen("if (!_signal)"); + _gen(" consume();") + if ( FoundException && p->use_def_MT_handler ) + _gen(" _signal=NoSignal;"); + _gen("\n"); + } + else + { + if ( FoundException && p->use_def_MT_handler ) _gen("if (!_signal)"); + _gen(" zzCONSUME;\n"); + if ( FoundException && p->use_def_MT_handler ) _gen(" _signal=NoSignal;"); + _gen("\n"); + } + } + else gen("\n"); + if (a->done) { /* MR30 */ + TRANS( a->next ); /* MR30 */ + } /* MR30 */ + else { /* MR30 */ + TRANS( p->next ); /* MR30 */ + } /* MR30 */ + } + else + { + if ( !DemandLookahead ) { + if ( GenCC ) { + if (FoundException && p->use_def_MT_handler) _gen("if (!_signal)"); + _gen(" consume();") + if (FoundException&&p->use_def_MT_handler) _gen(" _signal=NoSignal;"); + _gen("\n"); + } + else { + if (FoundException && p->use_def_MT_handler) _gen("if (!_signal)"); + _gen(" zzCONSUME;"); + if ( FoundException && p->use_def_MT_handler ) _gen(" _signal=NoSignal;"); + _gen("\n"); + } + } + else _gen("\n"); + TRANS(p->next); + } +} + +/* MR21 + * + * There was a bug in the code generation for {...} which causes it + * to omit the optional tokens from the error messages. The easiest + * way to fix this was to make the opt block look like a sub block: + * + * { a | b | c } + * + * becomes (internally): + * + * ( a | b | c | ) + * + * The code for genOptBlk is now identical to genSubBlk except for + * cosmetic changes. + */ + +void +#ifdef __USE_PROTOS +genOptBlk( Junction *q ) +#else +genOptBlk( q ) +Junction *q; +#endif +{ + int max_k; + set f; + int need_right_curly; + set savetkref; + int lastAltEmpty; /* MR23 */ + savetkref = tokensRefdInBlock; + require(q->ntype == nJunction, "genOptBlk: not junction"); + require(q->jtype == aOptBlk, "genOptBlk: not opt block"); + + OutLineInfo(output,q->line,FileStr[q->file]); + BLOCK_Preamble(q); + BlkLevel++; + BlockPreambleOption(q,q->pFirstSetSymbol); /* MR21 */ + f = genBlk(q, aOptBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */); +/* MR23 + Bypass error clause generation when exceptions are used in {...} block + See multi-line note in genBlk near call to isEmptyAlt. +*/ + if (! FoundException) { + if ( q->p2 != NULL ) {tab(); makeErrorClause(q,f,max_k,0 /* use plus block bypass ? */ );} + } + else { + gen("/* MR23 skip error clause for {...} when exceptions in use */\n"); + } + { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} } + freeBlkFsets(q); + --BlkLevel; + BLOCK_Tail(); + + if ( q->guess ) + { + gen("zzGUESS_DONE\n"); + } + + /* must duplicate if (alpha)?; one guesses (validates), the + * second pass matches */ + if ( q->guess && analysis_point(q)==q ) + { + OutLineInfo(output,q->line,FileStr[q->file]); + BLOCK_Preamble(q); + BlkLevel++; + f = genBlk(q, aSubBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */); + if ( q->p2 != NULL ) {tab(); makeErrorClause(q,f,max_k,0 /* use plus block bypass ? */ );} + { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} } + freeBlkFsets(q); + --BlkLevel; + BLOCK_Tail(); + } + + tokensRefdInBlock = savetkref; + if (q->end->p1 != NULL) TRANS(q->end->p1); +} + +/* + * Generate code for a loop blk of form: + * + * |---| + * v | + * --o-G-o-->o-- + */ +void +#ifdef __USE_PROTOS +genLoopBlk( Junction *begin, Junction *q, Junction *start, int max_k ) +#else +genLoopBlk( begin, q, start, max_k ) +Junction *begin; +Junction *q; +Junction *start; /* where to start generating code from */ +int max_k; +#endif +{ + set f; + int need_right_curly; + set savetkref; + Junction *guessBlock; /* MR10 */ + int singleAlt; /* MR10 */ + int lastAltEmpty; /* MR23 */ + + savetkref = tokensRefdInBlock; + require(q->ntype == nJunction, "genLoopBlk: not junction"); + require(q->jtype == aLoopBlk, "genLoopBlk: not loop block"); + + if ( q->visited ) return; + q->visited = TRUE; + + /* first_item_is_guess_block doesn't care what kind of node it is */ + + guessBlock=first_item_is_guess_block( (Junction *) q->p1); /* MR10 */ + singleAlt=q->p2==NULL; /* MR10 */ + + if (singleAlt && !guessBlock) /* MR10 */ /* only one alternative? */ + { + if ( DemandLookahead ) { + if ( !GenCC ) {gen1("LOOK(%d);\n", max_k);} + else gen1("look(%d);\n", max_k); + } + gen("while ( "); + if ( begin!=NULL ) genExpr(begin); + else genExpr(q); + /* if no predicates have been hoisted for this single alt (..)* + * do so now + */ + require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty"); + if ( ParseWithPredicates && begin->predicate==NULL ) + { + Predicate *a = MR_find_predicates_and_supp((Node *)q->p1); + require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty"); + + if ( a!=NULL ) + { + _gen("&&"); + a=genPredTreeMain(a, (Node *)q); /* MR10 */ + } +/* MR10 */ if (MRhoisting) { +/* MR10 */ predicate_free(a); +/* MR10 */ }; + } + _gen(" ) {\n"); + tabs++; + TRANS(q->p1); + if ( !GenCC ) gen1("zzLOOP(zztasp%d);\n", BlkLevel-1); + if ( DemandLookahead ) { + if ( !GenCC ) {gen1("LOOK(%d);\n", max_k);} + else gen1("look(%d);\n", max_k); + } + --tabs; + gen("}\n"); + freeBlkFsets(q); + q->visited = FALSE; + tokensRefdInBlock = savetkref; + return; + } + gen("for (;;) {\n"); /* MR20 G. Hobbelt */ + tabs++; +/* MR6 */ +/* MR6 "begin" can never be null when called from genLoopBegin */ +/* MR6 because q==(Junction *)begin->p1 and we know q is valid */ +/* MR6 */ +/* MR6 from genLoopBegin: */ +/* MR6 */ +/* MR6 if ( LL_k>1 && !set_nil(q->fset[2]) ) */ +/* MR6 genLoopBlk( q, (Junction *)q->p1, q, max_k ); */ +/* MR6 else genLoopBlk( q, (Junction *)q->p1, NULL, max_k ); */ +/* MR6 */ + if ( begin!=NULL ) + { + if ( DemandLookahead ) + { + if ( !GenCC ) {gen1("LOOK(%d);\n", max_k);} + else gen1("look(%d);\n", max_k); + } + /* The bypass arc of the (...)* predicts what to do when you fail, but + * ONLY after having tested the loop start expression. To avoid this, + * we simply break out of the (...)* loop when we find something that + * is not in the prediction of the loop (all alts thereof). + */ + gen("if ( !("); + +/*** TJP says: It used to use the prediction expression for the bypass arc + of the (...)*. HOWEVER, if a non LL^1(k) decision was found, this + thing would miss the ftree stored in the aLoopBegin node and generate + an LL^1(k) decision anyway. + + *** genExpr((Junction *)begin->p2); + ***/ + + genExpr((Junction *)begin); + _gen(")) break;\n"); + + } + + /* generate code for terminating loop (this is optional branch) */ + + f = genBlk(q, aLoopBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */); + set_free(f); + freeBlkFsets(q); + + /* generate code for terminating loop (this is optional branch) */ + +/* MR6 */ +/* MR6 30-May-97 Bug reported by Manuel Ornato */ +/* MR6 A definite bug involving the exit from a loop block */ +/* MR6 In 1.23 and later versions (including 1.33) Instead */ +/* MR6 exiting the block and reporting a syntax error the */ +/* MR6 code loops forever. */ +/* MR6 Looking at 1.20 which generates proper code it is not */ +/* MR6 clear which of two changes should be undone. */ +/* MR6 This is my best guess. */ +/* MR6 From earlier MR6 note we know that begin can never be */ +/* MR6 null when genLoopBlk called from genLoopBegin */ +/* MR6 */ +/* MR6 */ if ( begin==NULL) { +/* MR6 */ /* code for exiting loop "for sure" */ +/* MR6 */ gen("/* Suppressed by MR6 */ /*** else break; ***/\n"); +/* MR6 */ }; + +/* MR10 */if (singleAlt && guessBlock) { +/* MR10 */ tabs--; +/* MR6 */ gen("} else break; /* MR6 code for exiting loop \"for sure\" */\n"); +/* MR10 */ need_right_curly--; +/* MR10 */ } else { +/* MR6 */ gen("else break; /* MR6 code for exiting loop \"for sure\" */\n"); +/* MR10 */ }; + + { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} } + if ( !GenCC ) gen1("zzLOOP(zztasp%d);\n", BlkLevel-1); + --tabs; + gen("}\n"); + q->visited = FALSE; + tokensRefdInBlock = savetkref; +} + +/* + * Generate code for a loop blk of form: + * + * |---| + * v | + * --o-->o-->o-G-o-->o-- + * | ^ + * v | + * o-----------o + * + * q->end points to the last node (far right) in the blk. + * + * Note that q->end->jtype must be 'EndBlk'. + * + * Generate code roughly of the following form: + * + * do { + * ... code for alternatives ... + * } while ( First Set of aLoopBlk ); + * + * OR if > 1 alternative + * + * do { + * ... code for alternatives ... + * else break; + * } while ( 1 ); + */ +void +#ifdef __USE_PROTOS +genLoopBegin( Junction *q ) +#else +genLoopBegin( q ) +Junction *q; +#endif +{ + set f; + int i; + int max_k; + set savetkref; + savetkref = tokensRefdInBlock; + require(q!=NULL, "genLoopBegin: invalid node and/or rule"); + require(q->ntype == nJunction, "genLoopBegin: not junction"); + require(q->jtype == aLoopBegin, "genLoopBegin: not loop block"); + require(q->p2!=NULL, "genLoopBegin: invalid Loop Graph"); + + OutLineInfo(output,q->line,FileStr[q->file]); + + BLOCK_Preamble(q); + BlkLevel++; + BlockPreambleOption(q,q->pFirstSetSymbol); /* MR21 */ + f = First(q, 1, aLoopBegin, &max_k); + /* If not simple LL(1), must specify to start at LoopBegin, not LoopBlk */ + if ( LL_k>1 && !set_nil(q->fset[2]) ) + genLoopBlk( q, (Junction *)q->p1, q, max_k ); + else genLoopBlk( q, (Junction *)q->p1, NULL, max_k ); + + for (i=1; i<=CLL_k; i++) set_free(q->fset[i]); + for (i=1; i<=CLL_k; i++) set_free(((Junction *)q->p2)->fset[i]); + --BlkLevel; + BLOCK_Tail(); + set_free(f); + tokensRefdInBlock = savetkref; +/* MR21 */ if (MR_BlkErr) { +/* MR21 */ set f, fArray[2]; +/* MR21 */ f = ComputeErrorSet(q,1,0 /* use plus block bypass ? */ ); +/* MR21 */ fArray[0]= empty; +/* MR21 */ fArray[1]= set_dup(f); +/* MR21 */ gen("if ("); +/* MR21 */ genExprSets(fArray,1); /* note: destroys set arguments */ +/* MR21 */ _gen(") { /* MR21 option -mrblksynerr */\n"); +/* MR21 */ tabs++; +/* MR21 */ tab(); +/* MR21 */ _gen("/* nothing */ }\n"); +/* MR21 */ tab(); +/* MR21 */ makeErrorClause(q,f,1,0 /* use plus block bypass ? */ ); /* frees set */ +/* MR21 */ tabs--; +/* MR21 */ }; + if (q->end->p1 != NULL) TRANS(q->end->p1); +} + +/* + * Generate code for a loop blk of form: + * + * |---| + * v | + * --o-G-o-->o-- + * + * q->end points to the last node (far right) in the blk. + * Note that q->end->jtype must be 'EndBlk'. + * + * Generate code roughly of the following form: + * + * do { + * ... code for alternatives ... + * } while ( First Set of aPlusBlk ); + * + * OR if > 1 alternative + * + * do { + * ... code for alternatives ... + * else if not 1st time through, break; + * } while ( 1 ); + */ +void +#ifdef __USE_PROTOS +genPlusBlk( Junction *q ) +#else +genPlusBlk( q ) +Junction *q; +#endif +{ + int max_k; + set f; + int need_right_curly; + int lastAltEmpty; /* MR23 */ + set savetkref; + Junction *guessBlock; /* MR10 */ + int singleAlt; /* MR10 */ + + savetkref = tokensRefdInBlock; + require(q!=NULL, "genPlusBlk: invalid node and/or rule"); + require(q->ntype == nJunction, "genPlusBlk: not junction"); + require(q->jtype == aPlusBlk, "genPlusBlk: not Plus block"); + require(q->p2 != NULL, "genPlusBlk: not a valid Plus block"); + + if ( q->visited ) return; + q->visited = TRUE; + OutLineInfo(output,q->line,FileStr[q->file]); + BLOCK_Preamble(q); + BlkLevel++; + + BlockPreambleOption((Junction *)q, q->pFirstSetSymbol); /* MR21 */ + + /* first_item_is_guess_block doesn't care what kind of node it is */ + + guessBlock=first_item_is_guess_block( (Junction *)q->p1); /* MR10 */ + + /* if the ignore flag is set on the 2nd alt and that alt is empty, + * then it is the implied optional alternative that we added for (...)+ + * and, hence, only 1 alt. + */ + +/* MR10 Reported by Pulkkinen Esa (esap@cs.tut.fi) + * Outer code for guess blocks ignored when there is only one alt + * for a (...)+ block. + * Force use of regular code rather than "optimized" code for that case + */ + + singleAlt=( ( (Junction *) q->p2)->p2 == NULL) && + ( ( (Junction *) q->p2)->ignore ); /* only one alternative? */ + + if (singleAlt && !guessBlock) /* MR10 */ + { + + Predicate *a=NULL; + /* if the only alt has a semantic predicate, hoist it; must test before + * entering loop. + */ + if ( ParseWithPredicates ) + { + require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty"); + a = MR_find_predicates_and_supp((Node *)q); + require(MR_PredRuleRefStack.count == 0,"PredRuleRef stack not empty"); + + if ( a!=NULL ) { + gen("if ("); + a=genPredTreeMain(a, (Node *)q); /* MR10 */ + _gen(") {\n"); + } + } + gen("do {\n"); + tabs++; + TRANS(q->p1); + if ( !GenCC ) gen1("zzLOOP(zztasp%d);\n", BlkLevel-1); + f = First(q, 1, aPlusBlk, &max_k); + if ( DemandLookahead ) { + if ( !GenCC ) {gen1("LOOK(%d);\n", max_k);} + else gen1("look(%d);\n", max_k); + } + --tabs; + gen("} while ( "); + if ( q->parm!=NULL && q->predparm ) _gen1("(%s) && ", q->parm); + genExpr(q); + if ( ParseWithPredicates && a!=NULL ) + { + if (! MR_comparePredicates(q->predicate,a)) { + _gen("&&"); + a=genPredTreeMain(a, (Node *)q); /* MR10 */ + }; + } + _gen(" );\n"); + if ( ParseWithPredicates && a!=NULL ) gen("}\n"); + --BlkLevel; + BLOCK_Tail(); + q->visited = FALSE; + freeBlkFsets(q); + set_free(f); + tokensRefdInBlock = savetkref; +/* MR21 */ if (MR_BlkErr) { +/* MR21 */ set f, fArray[2]; +/* MR21 */ f = ComputeErrorSet(q,1,1 /* use plus block bypass ? */ ); +/* MR21 */ fArray[0]= empty; +/* MR21 */ fArray[1]= set_dup(f); +/* MR21 */ gen("if ("); +/* MR21 */ genExprSets(fArray,1); /* note: destroys set arguments */ +/* MR21 */ _gen(") { /* MR21 option -mrblksynerr */\n"); +/* MR21 */ tabs++; +/* MR21 */ tab(); +/* MR21 */ _gen("/* nothing */ }\n"); +/* MR21 */ tab(); +/* MR21 */ makeErrorClause(q,f,1,1 /* use plus block bypass ? */ ); /* frees set */ +/* MR21 */ tabs--; +/* MR21 */ }; + if (q->end->p1 != NULL) TRANS(q->end->p1); +/* MR10 */ if (MRhoisting) { +/* MR10 */ predicate_free(a); +/* MR10 */ }; + return; + } + gen("do {\n"); + tabs++; + f = genBlk(q, aPlusBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */); +/* MR6 */ +/* MR6 Sinan Karasu (sinan@tardis.ds.boeing.com) */ +/* MR6 Failed to turn off guess mode when leaving block */ +/* MR6 */ +/* MR6 */ if ( has_guess_block_as_last_item(q) ) { +/* MR10 */ gen("/* MR10 ()+ */ else {\n"); +/* MR10 */ tabs++; +/* MR10 */ need_right_curly++; +/* MR10 */ gen("/* MR10 ()+ */ if ( !zzrv ) zzGUESS_DONE;\n"); +/* MR6 */ gen("/* MR10 ()+ */ if ( zzcnt > 1 ) break;\n"); +/* MR10 */ } else { +/* MR10 */ gen("/* MR10 ()+ */ else {\n"); +/* MR10 */ tabs++; +/* MR10 */ need_right_curly++; +/* MR10 */ gen("if ( zzcnt > 1 ) break;\n"); +/* MR10 */ }; + +/* MR21 */ if (MR_BlkErr && 1 >= max_k) { +/* MR21 */ set f; +/* MR21 */ f = ComputeErrorSet(q,1,0 /* use plus block bypass ? */ ); +/* MR21 */ tabs++; +/* MR21 */ tab(); +/* MR21 */ makeErrorClause(q,f,1,0 /* use plus block bypass ? */ ); /* frees set */ +/* MR21 */ tabs--; +/* MR21 */ } +/* MR21 */ else { + tab(); + makeErrorClause(q,f,max_k,1 /* use plus block bypass ? */); + /* MR21 I think this generates the wrong set ? */ + /* MR21 because it includes the plus block bypass ? */ + /* MR21 but I'm afraid to change it without additional checking */ + } + + { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} } + freeBlkFsets(q); + gen("zzcnt++;"); + if ( !GenCC ) _gen1(" zzLOOP(zztasp%d);", BlkLevel-1); + _gen("\n"); + if ( DemandLookahead ) { + if ( !GenCC ) {gen1("LOOK(%d);\n", max_k);} + else gen1("look(%d);\n", max_k); + } + --tabs; + if ( q->parm!=NULL && q->predparm ) {gen1("} while (%s);\n", q->parm);} + else gen("} while ( 1 );\n"); + --BlkLevel; + BLOCK_Tail(); + q->visited = FALSE; + tokensRefdInBlock = savetkref; +/* MR21 */ if (MR_BlkErr) { +/* MR21 */ set f, fArray[2]; +/* MR21 */ f = ComputeErrorSet(q,1,1 /* use plus block bypass ? */ ); +/* MR21 */ fArray[0]= empty; +/* MR21 */ fArray[1]= set_dup(f); +/* MR21 */ gen("if ("); +/* MR21 */ genExprSets(fArray,1); /* note: destroys set arguments */ +/* MR21 */ _gen(") { /* MR21 option -mrblksynerr */\n"); +/* MR21 */ tabs++; +/* MR21 */ tab(); +/* MR21 */ _gen("/* nothing */ }\n"); +/* MR21 */ tab(); +/* MR21 */ makeErrorClause(q,f,1,1 /* use plus block bypass ? */ ); /* frees set */ +/* MR21 */ tabs--; +/* MR21 */ }; + if (q->end->p1 != NULL) TRANS(q->end->p1); +} + +/* + * Generate code for a sub blk of alternatives of form: + * + * --o-G1--o-- + * | ^ + * v /| + * o-G2-o| + * | ^ + * v | + * .......... + * | ^ + * v / + * o-Gn-o + * + * q points to the 1st junction of blk (upper-left). + * q->end points to the last node (far right) in the blk. + * Note that q->end->jtype must be 'EndBlk'. + * The last node in every alt points to q->end. + * + * Generate code of the following form: + * if ( First(G1) ) { + * ...code for G1... + * } + * else if ( First(G2) ) { + * ...code for G2... + * } + * ... + * else { + * ...code for Gn... + * } + */ + +void +#ifdef __USE_PROTOS +genSubBlk( Junction *q ) +#else +genSubBlk( q ) +Junction *q; +#endif +{ + int max_k; + set f; + int need_right_curly; + int lastAltEmpty; /* MR23 */ + set savetkref; + savetkref = tokensRefdInBlock; + require(q->ntype == nJunction, "genSubBlk: not junction"); + require(q->jtype == aSubBlk, "genSubBlk: not subblock"); + + OutLineInfo(output,q->line,FileStr[q->file]); + BLOCK_Preamble(q); + BlkLevel++; + BlockPreambleOption(q,q->pFirstSetSymbol); /* MR21 */ + f = genBlk(q, aSubBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */); + +/* MR23 + Bypass error clause generation when exceptions are used in a sub block + in which the last alternative is epsilon. Example: "(A | B | )". + See multi-line note in genBlk near call to isEmptyAlt. +*/ + if (FoundException && lastAltEmpty) { + gen("/* MR23 skip error clause for (...| epsilon) when exceptions in use */\n"); + } + else { + if ( q->p2 != NULL ) {tab(); makeErrorClause(q,f,max_k,0 /* use plus block bypass ? */ );} + } + + { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} } + freeBlkFsets(q); + --BlkLevel; + BLOCK_Tail(); + + if ( q->guess ) + { + gen("zzGUESS_DONE\n"); + } + + /* must duplicate if (alpha)?; one guesses (validates), the + * second pass matches */ + if ( q->guess && analysis_point(q)==q ) + { + OutLineInfo(output,q->line,FileStr[q->file]); + BLOCK_Preamble(q); + BlkLevel++; + f = genBlk(q, aSubBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */); + if ( q->p2 != NULL ) {tab(); makeErrorClause(q,f,max_k,0 /* use plus block bypass ? */);} + { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} } + freeBlkFsets(q); + --BlkLevel; + BLOCK_Tail(); + } + + tokensRefdInBlock = savetkref; + if (q->end->p1 != NULL) TRANS(q->end->p1); +} + +static int TnodesAllocatedPrevRule=0; + +/* + * Generate code for a rule. + * + * rule--> o-->o-Alternatives-o-->o + * Or, + * rule--> o-->o-Alternative-o-->o + * + * The 1st junction is a RuleBlk. The second can be a SubBlk or just a junction + * (one alternative--no block), the last is EndRule. + * The second to last is EndBlk if more than one alternative exists in the rule. + * + * To get to the init-action for a rule, we must bypass the RuleBlk, + * and possible SubBlk. + * Mark any init-action as generated so genBlk() does not regenerate it. + */ +void +#ifdef __USE_PROTOS +genRule( Junction *q ) +#else +genRule( q ) +Junction *q; +#endif +{ + + const char * returnValueInitializer; + +do { /* MR10 Change recursion into iteration */ + + int max_k; + set follow, rk, f; + ActionNode *a; + RuleEntry *r; + int lastAltEmpty; /* MR23 */ + static int file = -1; + int need_right_curly; + require(q->ntype == nJunction, "genRule: not junction"); + require(q->jtype == RuleBlk, "genRule: not rule"); + +/* MR14 */ require (MR_BackTraceStack.count == 0,"-alpha MR_BackTraceStack.count != 0"); +/* MR14 */ MR_pointerStackReset(&MR_BackTraceStack); +/* MR14 */ if (AlphaBetaTrace) MR_MaintainBackTrace=1; + + CurRule=q->rname; /* MR11 */ + + r = (RuleEntry *) hash_get(Rname, q->rname); + if ( r == NULL ) warnNoFL("Rule hash table is screwed up beyond belief"); + if ( q->file != file ) /* open new output file if need to */ + { +/* MR6 */ +/* MR6 Simpler to debug when output goes to stdout rather than a file */ +/* MR6 */ +/* MR6 */ if (UseStdout) { +/* MR6 */ output = stdout; +/* MR6 */ } else { +/* MR6 */ if ( output != NULL) fclose( output ); +/* MR6 */ output = fopen(OutMetaName(outname(FileStr[q->file])), "w"); +/* MR6 */ }; + require(output != NULL, "genRule: can't open output file"); + +#ifdef SPECIAL_FOPEN + special_fopen_actions(OutMetaName(outname(FileStr[q->file]))); /* MR1 */ +#endif + if ( file == -1 ) genHdr1(q->file); + else genHdr(q->file); + file = q->file; + } + + if (InfoM) { + fprintf(stderr," rule %s\n",q->rname); + fflush(output); + }; + +#if 0 + if (strcmp(q->rname,"***debug***") == 0) { + fprintf(stderr,"***debug*** %s reached\n",q->rname); + MR_break(); + }; +#endif + + DumpFuncHeader(q,r); + tabs++; + + /* MR23 + + If there is a single return value then it can be initialized in + the declaration using assignment syntax. If there are multiple + return values then antlr creates a struct and initialization takes + place element by element for each element of the struct. For + multiple elements the initialization is by assignment so we have + to wait until all declarations are done before emitting that code - + because of restrictions in C which don't exist in C++. + + In the past (before MR23) the only kind of initialization was + the PURIFY macro which was just a memset() of 0. Now we allow + the user to specify an initial value. PURIFY is still used in C + mode because C does not have constructors. However, PURIFY is + not used in C++ mode because it might overwrite information created + by elements which have their own ctor. + + */ + + if ( q->ret!=NULL ) + { + if ( hasMultipleOperands(q->ret) ) /* MR23 */ + { + + /* Emit initialization code later. */ + + gen1("struct _rv%d _retv;\n",r->rulenum); + } + else + { + /* Emit initialization code now. */ + + tab(); + DumpType(q->ret, output); + returnValueInitializer = getInitializer(q->ret); + if (returnValueInitializer == NULL) { /* MR23 */ + gen(" _retv;\n"); /* MR1 MR3 */ + } /* MR23 */ + else { /* MR23 */ + gen1(" _retv = %s;\n", returnValueInitializer); /* MR23 */ + } /* MR23 */ + } + } + + OutLineInfo(output,q->line,FileStr[q->file]); + + if (InfoM) { + fflush(output); + }; + + gen("zzRULE;\n"); + if ( FoundException ) + { + gen("int _sva=1;\n"); + } + if ( GenCC && GenAST ) + gen("ASTBase *_ast = NULL, *_sibling = NULL, *_tail = NULL;\n"); + if ( GenCC ) genTokenPointers(q); + if ( GenCC&&GenAST ) genASTPointers(q); + if ( q->el_labels!=NULL ) genElementLabels(q->el_labels); + if ( FoundException ) gen("int _signal=NoSignal;\n"); + + if ( !GenCC ) gen1("zzBLOCK(zztasp%d);\n", BlkLevel); + +/* MR10 */ /* move zzTRACEIN to before init action */ + +/* MR10 */ if ( TraceGen ) { +/* MR10 */ if ( GenCC ) {gen1("zzTRACEIN(\"%s\");\n", q->rname);} +/* MR10 */ else gen1("zzTRACEIN((ANTLRChar *)\"%s\");\n", q->rname); +/* MR10 */ } + +/* MR7 Moved PURIFY() to after all local variables have been declared */ +/* MR7 so that the generated code is valid C as well as C++ */ +/* MR7 Jan Mikkelsen 10-June-1997 */ + + + /* + MR23 Do the PURIFY macro only for C mode. + C++ users should use constructors or initialization expressions. + */ + + if ( q->ret != NULL ) /* MR7 */ + { /* MR7 */ + if (hasMultipleOperands(q->ret)) { /* MR23 */ + if (PURIFY == TRUE) { + gen1("PCCTS_PURIFY(_retv,sizeof(struct _rv%d))\n",r->rulenum); /* MR23 */ + } + } /* MR7 */ + else { /* MR7 */ + + /* MR23 + If there were only one return value operand and + it had an initializer then it would have been + initiailized in the declaration. + */ + + returnValueInitializer = getInitializer(q->ret); /* MR23 */ + if (returnValueInitializer == NULL) { /* MR23 */ + if (PURIFY == TRUE) { + gen("PCCTS_PURIFY(_retv,sizeof("); /* MR23 */ + DumpType(q->ret, output); /* MR7 */ + gen("))\n"); /* MR7 */ + } + } /* MR23 */ + } /* MR7 */ + + if (hasMultipleOperands(q->ret)) { /* MR23 */ + DumpInitializers(output, r, q->ret); /* MR23 */ + } + + } + if ( !GenCC ) gen("zzMake0;\n"); + if ( FoundException ) gen("*_retsignal = NoSignal;\n"); + + if ( !GenCC ) gen("{\n"); + + if ( has_guess_block_as_first_item((Junction *)q->p1) ) + { + gen("zzGUESS_BLOCK\n"); + } + + /* L o o k F o r I n i t A c t i o n */ + if ( ((Junction *)q->p1)->jtype == aSubBlk ) + a = findImmedAction( ((Junction *)q->p1)->p1 ); + else + a = findImmedAction( q->p1 ); /* only one alternative in rule */ + if ( a!=NULL && !a->is_predicate) + { + /* MR21 */ if (!a->noHoist) dumpActionPlus(a, a->action, output, tabs, a->file, a->line, 1); + a->done = 1; /* ignore action. We have already handled it */ + } + + BlkLevel++; + q->visited = TRUE; /* mark RULE as visited for FIRST/FOLLOW */ + BlockPreambleOption((Junction *)q->p1, NULL); /* MR21 */ + f = genBlk((Junction *)q->p1, RuleBlk, &max_k, &need_right_curly, &lastAltEmpty /* MR23 */); + if ( q->p1 != NULL ) + if ( ((Junction *)q->p1)->p2 != NULL ) + {tab(); makeErrorClause((Junction *)q->p1,f,max_k,0 /* use plus block bypass ? */);} + { int i; for (i=1; i<=need_right_curly; i++) {tabs--; gen("}\n");} } + freeBlkFsets((Junction *)q->p1); + q->visited = FALSE; + --BlkLevel; + if ( !GenCC ) gen1("zzEXIT(zztasp%d);\n", BlkLevel); + + genTraceOut(q); + + if ( q->ret!=NULL ) gen("return _retv;\n") else gen("return;\n"); + /* E r r o r R e c o v e r y */ + NewSet(); + rk = empty; + +/* MR14 */ if (r->dontComputeErrorSet) { +/* MR14 */ follow=empty; + } else { + MR_pointerStackReset(&MR_BackTraceStack); /* MR14 */ + MR_ErrorSetComputationActive=1; + REACH(q->end, 1, &rk, follow); + MR_ErrorSetComputationActive=0; + require (MR_BackTraceStack.count == 0,"K: MR_BackTraceStack.count != 0"); + } + + FillSet( follow ); + set_free( follow ); + + /* MR20 G. Hobbelt + Isn't it so that "fail:" is ONLY referenced when: + + !FoundException || FoundGuessBlk ? + + Therefore add the "if" around this piece of code generation... + + Should guessing mode also use _handler label instead of "fail" + when exception handling is active? gen can automatically put + "if (guessing)" there so as to skip all kinds of user code. + + */ + + if ( !FoundException || FoundGuessBlk ) /* MR20 G. Hobbelt */ + { /* MR20 G. Hobbelt */ + _gen("fail:\n"); + if ( !GenCC ) gen("zzEXIT(zztasp1);\n"); + if ( FoundGuessBlk ) { + if ( !GenCC ) {gen("if ( zzguessing ) zzGUESS_FAIL;\n");} + else gen("if ( guessing ) zzGUESS_FAIL;\n"); + } + if ( q->erraction!=NULL ) + dumpAction(q->erraction, output, tabs, q->file, q->line, 1); + if ( GenCC ) + { + gen1("syn(zzBadTok, %s, zzMissSet, zzMissTok, zzErrk);\n", + r->egroup==NULL?"(ANTLRChar *)\"\"":r->egroup); + } + else + { + gen1("zzsyn(zzMissText, zzBadTok, %s, zzMissSet, zzMissTok, zzErrk, zzBadText);\n", + r->egroup==NULL?"(ANTLRChar *)\"\"":r->egroup); + } + gen3("%sresynch(setwd%d, 0x%x);\n", GenCC?"":"zz", wordnum, 1<<setnum); + + if ( q->ret!=NULL ) { + genTraceOut(q); + gen("return _retv;\n"); + } else if ( q->exceptions!=NULL ) { + genTraceOut(q); + gen("return;\n"); + } else if (!FoundException) { /* MR10 */ + genTraceOut(q); /* MR10 */ + }; + + } /* MR20 G. Hobbelt */ + + if ( !GenCC ) gen("}\n"); + + /* Gen code for exception handlers */ + /* make sure each path out contains genTraceOut() */ + + if ( q->exceptions!=NULL ) + { + + gen("/* exception handlers */\n"); + + dumpExceptions(q->exceptions); + + if ( !r->has_rule_exception ) + { + _gen("_handler:\n"); + gen("zzdflthandlers(_signal,_retsignal);\n"); + } +/* MR20 G. Gobbelt The label "adios" is never referenced */ + +#if 0 + _gen("_adios:\n"); +#endif + if ( q->ret!=NULL ) { + genTraceOut(q); + gen("return _retv;\n"); + } + else { + genTraceOut(q); + gen("return;\n"); + } + } + else if ( FoundException ) + { + _gen("_handler:\n"); + gen("zzdflthandlers(_signal,_retsignal);\n"); + +/* MR1 */ +/* MR1 7-Apr-97 Fix suggested by: John Bair (jbair@iftime.com) */ +/* MR1 */ + + if ( q->ret != NULL) { /* MR1 */ + genTraceOut(q); /* MR10 */ + gen("return _retv;\n"); /* MR1 */ + } else { /* MR1 */ + genTraceOut(q); /* MR10 */ + gen("return;\n") ; /* MR1 */ + }; /* MR1 */ + } + + tabs--; + gen("}\n"); + +/* MR10 Tired of looking at stacks that are as deep as the number of */ +/* MR10 rules. Changes recursion to iteration. */ + + MR_releaseResourcesUsedInRule( (Node *) q ); /* MR10 */ + + if (InfoT) { + fprintf(output,"\n/* tnodes created for rule %s: %d */\n", + q->rname, (TnodesAllocated-TnodesAllocatedPrevRule) ); + }; + + TnodesAllocatedPrevRule=TnodesAllocated; + + if (q->p2 == NULL) dumpAfterActions( output ); + q=(Junction *)q->p2; + require(q==NULL || q->jtype==RuleBlk,"RuleBlk p2 does not point to another RuleBlk"); + +} while (q != NULL); + +/**** The old code ****/ +/**** if ( q->p2 != NULL ) {TRANS(q->p2);} ****/ /* generate code for next rule too */ +/**** else dumpAfterActions( output ); ****/ + +} + + +/* This is for the function definition, not the declaration. */ + +static void +#ifdef __USE_PROTOS +DumpFuncHeader( Junction *q, RuleEntry *r ) +#else +DumpFuncHeader( q, r ) +Junction *q; +RuleEntry *r; +#endif +{ +/* */ +/* MR1 10-Apr-97 MR1 Simplify insertion of commas in function header */ +/* */ + int needComma; /* MR1 */ + + + /* A N S I */ + _gen("\n"); + if ( q->ret!=NULL ) + { + if ( hasMultipleOperands(q->ret) ) /* MR23 */ + { + if (GenCC) gen2("%s::_rv%d\n", CurrentClassName, r->rulenum) + else gen1("struct _rv%d\n",r->rulenum); + } + else + { + DumpType(q->ret, output); + gen("\n"); + } + } + else + { + _gen("void\n"); + } +/* MR1 */ +/* MR1 10-Apr-97 133MR1 Replace __STDC__ with __USE_PROTOS */ +/* MR1 */ + if ( !GenCC ) _gen("#ifdef __USE_PROTOS\n"); /* MR1 */ + if ( !GenCC ) gen2("%s%s(", RulePrefix, q->rname) + else gen3("%s::%s%s(", CurrentClassName, RulePrefix,q->rname); + + /* If we generate C++ method names, we must hide default arguments */ + /* which can appear in the parameter declaration list. */ + /* NOTICE: this is done only here, for the method definition, but */ + /* not for the method declaration inside the class */ + /* definition. This is exactly the behaviour defined in */ + /* C++ standard for default paramters. */ + + DumpANSIFunctionArgDef(output,q, 0 /* emit initializers ? */); + _gen("\n"); + + if ( GenCC ) { + gen("{\n"); + return; + } + + /* K & R */ + gen("#else\n"); + gen2("%s%s(", RulePrefix, q->rname); + needComma=0; /* MR1 */ + if ( GenAST ) /* MR1 */ + { /* MR1 */ + _gen("_root"); /* MR1 */ + needComma=1; /* MR1 */ + } /* MR1 */ + if ( FoundException ) /* MR1 */ + { /* MR1 */ + if (needComma) {_gen(",");needComma=0;}; /* MR1 */ + _gen("_retsignal"); /* MR1 */ + needComma=1; /* MR1 */ + } /* MR1 */ +/* MR5 Change below by Jan Mikkelsen (janm@zeta.org.au) 26-May-97 MR5 */ + DumpListOfParmNames( q->pdecl, output, needComma ); /* MR5 */ + gen(")\n"); + if ( GenAST ) gen("AST **_root;\n"); + if ( FoundException ) gen("int *_retsignal;\n"); + DumpOldStyleParms( q->pdecl, output ); + gen("#endif\n"); + gen("{\n"); +} + +void +#ifdef __USE_PROTOS +DumpANSIFunctionArgDef(FILE *f, Junction *q, int bInitializer) +#else +DumpANSIFunctionArgDef(f,q,bInitializer) +FILE *f; +Junction *q; +int bInitializer; +#endif +{ + if ( GenAST ) + { + if ( GenCC ) {fprintf(f,"ASTBase **_root");} + else fprintf(f,"AST**_root"); + if ( !FoundException && q->pdecl!=NULL ) fprintf(f,","); + } + if ( FoundException ) + { + if ( GenAST ) fprintf(f,","); + fprintf(f,"int *_retsignal"); + if ( q->pdecl!=NULL ) { + fprintf(f,","); + } + } + if ( q->pdecl!=NULL ) { + DumpFormals(f, q->pdecl, bInitializer); /* MR23 */ + } + else { + if ( !GenAST && !FoundException ) { + fprintf(f,"void"); + } + } + fprintf(f,")"); +} + +void +#ifdef __USE_PROTOS +genJunction( Junction *q ) +#else +genJunction( q ) +Junction *q; +#endif +{ + require(q->ntype == nJunction, "genJunction: not junction"); + require(q->jtype == Generic, "genJunction: not generic junction"); + + if ( q->p1 != NULL ) TRANS(q->p1); + if ( q->p2 != NULL ) TRANS(q->p2); +} + +void +#ifdef __USE_PROTOS +genEndBlk( Junction *q ) +#else +genEndBlk( q ) +Junction *q; +#endif +{ +} + +void +#ifdef __USE_PROTOS +genEndRule( Junction *q ) +#else +genEndRule( q ) +Junction *q; +#endif +{ +} + +void +#ifdef __USE_PROTOS +genHdr( int file ) +#else +genHdr( file ) +int file; +#endif +{ + int i; + + _gen("/*\n"); + _gen(" * A n t l r T r a n s l a t i o n H e a d e r\n"); + _gen(" *\n"); + _gen(" * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001\n"); + _gen(" * Purdue University Electrical Engineering\n"); + _gen(" * With AHPCRC, University of Minnesota\n"); + _gen1(" * ANTLR Version %s\n", Version); + _gen(" *\n"); +/* MR10 */ _gen(" * "); +/* MR10 */ for (i=0 ; i < Save_argc ; i++) { +/* MR10 */ _gen(" "); +/* MR10 */ _gen(Save_argv[i]); +/* MR10 */ }; + _gen("\n"); + _gen(" *\n"); + _gen(" */\n\n"); + if (FirstAction != NULL ) dumpAction( FirstAction, output, 0, -1, 0, 1); /* MR11 MR15b */ + _gen1("#define ANTLR_VERSION %s\n", VersionDef); + _gen("#include \"pcctscfg.h\"\n"); + _gen("#include \"pccts_stdio.h\"\n"); + if ( strcmp(ParserName, DefaultParserName)!=0 ) + _gen2("#define %s %s\n", DefaultParserName, ParserName); + if ( strcmp(ParserName, DefaultParserName)!=0 ) + {_gen1("#include \"%s\"\n", RemapFileName);} + OutLineInfo(output,1,FileStr[file]); + if ( GenCC ) { + if ( UserTokenDefsFile != NULL ) + fprintf(output, "#include %s\n", UserTokenDefsFile); + else + fprintf(output, "#include \"%s\"\n", DefFileName); + } + + if ( HdrAction != NULL ) dumpAction( HdrAction, output, 0, -1, 0, 1); + if ( !GenCC && FoundGuessBlk ) + { + _gen("#define ZZCAN_GUESS\n"); + _gen("#include \"pccts_setjmp.h\"\n"); /* MR15 K.J. Cummings (cummings@peritus.com) */ + } + if ( FoundException ) + { + _gen("#define EXCEPTION_HANDLING\n"); + _gen1("#define NUM_SIGNALS %d\n", NumSignals); + } + if ( !GenCC && OutputLL_k > 1 ) _gen1("#define LL_K %d\n", OutputLL_k); + if ( GenAST&&!GenCC ) _gen("#define GENAST\n\n"); + if ( GenAST ) { + if ( GenCC ) {_gen1("#include \"%s\"\n\n", ASTBASE_H);} + else _gen("#include \"ast.h\"\n\n"); + } + if ( !GenCC && DemandLookahead ) _gen("#define DEMAND_LOOK\n\n"); +#ifdef DUM + if ( !GenCC && LexGen ) { + _gen1("#define zzEOF_TOKEN %d\n", (TokenInd!=NULL?TokenInd[EofToken]:EofToken)); + } +#endif + /* ###WARNING: This will have to change when SetWordSize changes */ + if ( !GenCC ) _gen1("#define zzSET_SIZE %d\n", NumWords(TokenNum-1)*sizeof(unsigned)); + if (TraceGen) { + _gen("#ifndef zzTRACE_RULES\n"); /* MR20 */ + _gen("#define zzTRACE_RULES\n"); /* MR20 */ + _gen("#endif\n"); /* MR22 */ + }; + if ( !GenCC ) {_gen("#include \"antlr.h\"\n");} + else { + _gen1("#include \"%s\"\n", APARSER_H); + _gen1("#include \"%s.h\"\n", CurrentClassName); + } + if ( !GenCC ) { + if ( UserDefdTokens ) + {_gen1("#include %s\n", UserTokenDefsFile);} + /* still need this one as it has the func prototypes */ + _gen1("#include \"%s\"\n", DefFileName); + } + /* still need this one as it defines the DLG interface */ + if ( !GenCC ) _gen("#include \"dlgdef.h\"\n"); + if ( LexGen && GenCC ) _gen1("#include \"%s\"\n", DLEXERBASE_H); + if ( GenCC ) _gen1("#include \"%s\"\n", ATOKPTR_H); + if ( !GenCC && LexGen ) _gen1("#include \"%s\"\n", ModeFileName); + +/* MR10 Ofer Ben-Ami (gremlin@cs.huji.ac.il) */ +/* MR10 Finally, a definition of the Purify macro */ + + if (PURIFY == TRUE) { /* MR23 */ + _gen("\n/* MR23 In order to remove calls to PURIFY use the antlr"); /* MR23 */ + _gen(" -nopurify option */\n\n"); /* MR23 */ + _gen("#ifndef PCCTS_PURIFY\n"); + _gen("#define PCCTS_PURIFY(r,s) memset((char *) &(r),'\\0',(s));\n"); + _gen("#endif\n\n"); + } /* MR23 */ +} + +void +#ifdef __USE_PROTOS +genHdr1( int file ) +#else +genHdr1( file ) +int file; +#endif +{ + ListNode *p; + + genHdr(file); + if ( GenAST ) + { + if ( !GenCC ) { + _gen("#include \"ast.c\"\n"); + _gen("zzASTgvars\n\n"); + } + } + if ( !GenCC ) _gen("ANTLR_INFO\n"); + if ( BeforeActions != NULL ) + { + for (p = BeforeActions->next; p!=NULL; p=p->next) + { + UserAction *ua = (UserAction *)p->elem; + dumpAction( ua->action, output, 0, ua->file, ua->line, 1); + } + } + + if ( !FoundException ) return; + + if ( GenCC ) + { + _gen1("\nvoid %s::\n", CurrentClassName); + _gen("zzdflthandlers( int _signal, int *_retsignal )\n"); + _gen("{\n"); + } + else + { + _gen("\nvoid\n"); +/* MR1 */ +/* MR1 10-Apr-97 133MR1 Replace __STDC__ with __USE_PROTOS */ +/* MR1 */ + _gen("#ifdef __USE_PROTOS\n"); /* MR1 */ + _gen("zzdflthandlers( int _signal, int *_retsignal )\n"); + _gen("#else\n"); + _gen("zzdflthandlers( _signal, _retsignal )\n"); + _gen("int _signal;\n"); + _gen("int *_retsignal;\n"); + _gen("#endif\n"); + _gen("{\n"); + } + tabs++; + if ( DefaultExGroup!=NULL ) + { + dumpException(DefaultExGroup, 1); + if ( !hasDefaultException(DefaultExGroup) ) + { + gen("default :\n"); + tabs++; + gen("*_retsignal = _signal;\n"); + tabs--; + gen("}\n"); + } + } + else { + gen("*_retsignal = _signal;\n"); + } + + tabs--; + _gen("}\n\n"); +} + +void +#ifdef __USE_PROTOS +genStdPCCTSIncludeFile( FILE *f,char *gate ) /* MR10 */ +#else +genStdPCCTSIncludeFile( f , gate) /* MR10 */ +FILE *f; +char * gate; /* MR10 */ +#endif +{ +/* MR10 Ramanathan Santhanam (ps@kumaran.com) */ +/* MR10 Same preprocessor symbol use to gate stdpccts.h */ +/* MR10 even when two grammars are in use. */ +/* MR10 Derive gate symbol from -fh filename */ + + if (gate == NULL) { + fprintf(f,"#ifndef STDPCCTS_H\n"); /* MR10 */ + fprintf(f,"#define STDPCCTS_H\n"); /* MR10 */ + } else { + fprintf(f,"#ifndef STDPCCTS_%s_H\n",gate); /* MR10 */ + fprintf(f,"#define STDPCCTS_%s_H\n",gate); /* MR10 */ + }; + fprintf(f,"/*\n"); + if (gate == NULL) { + fprintf(f," * %s -- P C C T S I n c l u d e\n", stdpccts); + } else { + fprintf(f," * Standard PCCTS include file with -fh %s -- P C C T S I n c l u d e\n", stdpccts); + } + fprintf(f," *\n"); + fprintf(f," * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001\n"); + fprintf(f," * Purdue University Electrical Engineering\n"); + fprintf(f," * With AHPCRC, University of Minnesota\n"); + fprintf(f," * ANTLR Version %s\n", Version); + fprintf(f," */\n\n"); + + fprintf(f,"#ifndef ANTLR_VERSION\n"); + fprintf(f,"#define ANTLR_VERSION %s\n", VersionDef); + fprintf(f,"#endif\n\n"); + + if (FirstAction != NULL ) dumpAction(FirstAction, f, 0, -1, 0, 1); /* MR11 */ + + fprintf(f,"#include \"pcctscfg.h\"\n"); + fprintf(f,"#include \"pccts_stdio.h\"\n"); + if ( GenCC ) + { + if ( UserDefdTokens ) + fprintf(f, "#include %s\n", UserTokenDefsFile); + else { + fprintf(f, "#include \"%s\"\n", DefFileName); + } + + fprintf(f, "#include \"%s\"\n", ATOKEN_H); + + if ( HdrAction != NULL ) dumpAction( HdrAction, f, 0, -1, 0, 1); + + fprintf(f, "#include \"%s\"\n", ATOKENBUFFER_H); + + if ( OutputLL_k > 1 ) fprintf(f,"static const unsigned LL_K=%d;\n", OutputLL_k); + if ( GenAST ) { + fprintf(f, "#include \"%s\"\n", ASTBASE_H); + } + + if (TraceGen) { + fprintf(f,"#ifndef zzTRACE_RULES\n"); /* MR20 */ + fprintf(f,"#define zzTRACE_RULES\n"); /* MR20 */ + fprintf(f,"#endif\n"); /* MR22 */ + }; + + fprintf(f,"#include \"%s\"\n", APARSER_H); + fprintf(f,"#include \"%s.h\"\n", CurrentClassName); + if ( LexGen ) fprintf(f,"#include \"%s\"\n", DLEXERBASE_H); + fprintf(f, "#endif\n"); + return; + } + + if ( strcmp(ParserName, DefaultParserName)!=0 ) + fprintf(f, "#define %s %s\n", DefaultParserName, ParserName); + if ( strcmp(ParserName, DefaultParserName)!=0 ) + fprintf(f, "#include \"%s\"\n", RemapFileName); + if ( UserTokenDefsFile != NULL ) + fprintf(f, "#include %s\n", UserTokenDefsFile); + if ( HdrAction != NULL ) dumpAction( HdrAction, f, 0, -1, 0, 1); + if ( FoundGuessBlk ) + { + fprintf(f,"#define ZZCAN_GUESS\n"); + fprintf(f,"#include \"pccts_setjmp.h\"\n"); + } + if (TraceGen) { + fprintf(f,"#ifndef zzTRACE_RULES\n"); /* MR20 */ + fprintf(f,"#define zzTRACE_RULES\n"); /* MR20 */ + fprintf(f,"#endif\n"); /* MR22 */ + }; + if ( OutputLL_k > 1 ) fprintf(f,"#define LL_K %d\n", OutputLL_k); + if ( GenAST ) fprintf(f,"#define GENAST\n"); + if ( FoundException ) + { +/* MR1 7-Apr-97 1.33MR1 */ +/* MR1 Fix suggested by: */ +/* MR1 Francois-Xavier Fontaine (fontaine_f@istvax.ist.lu) */ + + fprintf(f,"#define EXCEPTION_HANDLING\n"); /* MR1 */ + fprintf(f,"#define NUM_SIGNALS %d\n", NumSignals); /* MR1 */ + } + if ( DemandLookahead ) fprintf(f,"#define DEMAND_LOOK\n"); +#ifdef DUM + if ( LexGen ) fprintf(f, "#define zzEOF_TOKEN %d\n", (TokenInd!=NULL?TokenInd[EofToken]:EofToken)); +#endif + /* ###WARNING: This will have to change when SetWordSize changes */ + fprintf(f, "#define zzSET_SIZE %d\n", NumWords(TokenNum-1)*sizeof(unsigned)); + if (TraceGen) { + fprintf(f,"#ifndef zzTRACE_RULES\n"); /* MR20 */ + fprintf(f,"#define zzTRACE_RULES\n"); /* MR20 */ + fprintf(f,"#endif\n"); /* MR22 */ + }; + fprintf(f,"#include \"antlr.h\"\n"); + if ( GenAST ) fprintf(f,"#include \"ast.h\"\n"); + if ( UserDefdTokens ) + fprintf(f, "#include %s\n", UserTokenDefsFile); + /* still need this one as it has the func prototypes */ + fprintf(f, "#include \"%s\"\n", DefFileName); + /* still need this one as it defines the DLG interface */ + fprintf(f,"#include \"dlgdef.h\"\n"); + /* don't need this one unless DLG is used */ + if ( LexGen ) fprintf(f,"#include \"%s\"\n", ModeFileName); + fprintf(f,"#endif\n"); +} + +/* dump action 's' to file 'output' starting at "local" tab 'tabs' + Dump line information in front of action if GenLineInfo is set + If file == -1 then GenLineInfo is ignored. + The user may redefine the LineInfoFormatStr to his/her liking + most compilers will like the default, however. + + June '93; changed so that empty lines are left alone so that + line information is correct for the compiler/debuggers. +*/ +void +#ifdef __USE_PROTOS +dumpAction( char *s, FILE *output, int tabs, int file, int line, +int final_newline ) +#else +dumpAction( s, output, tabs, file, line, final_newline ) +char *s; +FILE *output; +int tabs; +int file; +int line; +int final_newline; +#endif +{ + int inDQuote, inSQuote; + require(s!=NULL, "dumpAction: NULL action"); + require(output!=NULL, eMsg1("dumpAction: output FILE is NULL for %s",s)); + + if ( GenLineInfo && file != -1 ) + { + OutLineInfo(output,line,FileStr[file]); + } + PastWhiteSpace( s ); + /* don't print a tab if first non-white char is a # (preprocessor command) */ + if ( *s!='#' ) {TAB;} + inDQuote = inSQuote = FALSE; + while ( *s != '\0' ) + { + if ( *s == '\\' ) + { + fputc( *s++, output ); /* Avoid '"' Case */ + if ( *s == '\0' ) return; + if ( *s == '\'' ) fputc( *s++, output ); + if ( *s == '\"' ) fputc( *s++, output ); + } + if ( *s == '\'' ) + { + if ( !inDQuote ) inSQuote = !inSQuote; + } + if ( *s == '"' ) + { + if ( !inSQuote ) inDQuote = !inDQuote; + } + if ( *s == '\n' ) + { + fputc('\n', output); + s++; + PastWhiteSpace( s ); + if ( *s == '}' ) + { + --tabs; + TAB; + fputc( *s++, output ); + continue; + } + if ( *s == '\0' ) return; + if ( *s != '#' ) /* #define, #endif etc.. start at col 1 */ + { + TAB; + } + } + if ( *s == '}' && !(inSQuote || inDQuote) ) + { + --tabs; /* Indent one fewer */ + } + if ( *s == '{' && !(inSQuote || inDQuote) ) + { + tabs++; /* Indent one more */ + } + fputc( *s, output ); + s++; + } + if ( final_newline ) fputc('\n', output); +} + +static void +#ifdef __USE_PROTOS +dumpAfterActions( FILE *output ) +#else +dumpAfterActions( output ) +FILE *output; +#endif +{ + ListNode *p; + require(output!=NULL, "dumpAfterActions: output file was NULL for some reason"); + if ( AfterActions != NULL ) + { + for (p = AfterActions->next; p!=NULL; p=p->next) + { + UserAction *ua = (UserAction *)p->elem; + dumpAction( ua->action, output, 0, ua->file, ua->line, 1); + } + } + fclose( output ); +} + +/* + * Find the next action in the stream of execution. Do not pass + * junctions with more than one path leaving them. + * Only pass generic junctions. + * + * Scan forward while (generic junction with p2==NULL) + * If we stop on an action, return ptr to the action + * else return NULL; + */ +static ActionNode * +#ifdef __USE_PROTOS +findImmedAction( Node *q ) +#else +findImmedAction( q ) +Node *q; +#endif +{ + Junction *j; + require(q!=NULL, "findImmedAction: NULL node"); + require(q->ntype>=1 && q->ntype<=NumNodeTypes, "findImmedAction: invalid node"); + + while ( q->ntype == nJunction ) + { + j = (Junction *)q; + if ( j->jtype != Generic || j->p2 != NULL ) return NULL; + q = j->p1; + if ( q == NULL ) return NULL; + } + if ( q->ntype == nAction ) return (ActionNode *)q; + return NULL; +} + +static void +#ifdef __USE_PROTOS +dumpRetValAssign( char *retval, char *ret_def, RuleRefNode * ruleRef /* MR30 */) +#else +dumpRetValAssign( retval, ret_def, ruleRef /* MR30 */) +char *retval; +char *ret_def; +RuleRefNode *ruleRefNode; +#endif +{ + char *q = ret_def; + + tab(); + while ( *retval != '\0' && *q != '\0') + { + while ( isspace((*retval)) ) retval++; + while ( *retval!=',' && *retval!='\0' ) fputc(*retval++, output); + fprintf(output, " = _trv."); + + DumpNextNameInDef(&q, output); + while ( isspace(*q) ) q++; + fputc(';', output); fputc(' ', output); + if ( *retval == ',' ) retval++; + } + if (*retval == '\0' && *q != '\0') { +/* MR30 */ errFL("Fewer output values than output formals for rule reference", +/* MR30 */ FileStr[ruleRef->file],ruleRef->line); + } + if (*retval != '\0' && *q == '\0') { +/* MR30 */ errFL("More output actuals than output formals for rule reference", +/* MR30 */ FileStr[ruleRef->file],ruleRef->line); + } +} + +/* This function computes the set of tokens that can possibly be seen k + * tokens in the future from point j + */ + +static set +#ifdef __USE_PROTOS +ComputeErrorSet( Junction *j, int k, int usePlusBlockBypass) +#else +ComputeErrorSet( j, k, usePlusBlockBypass ) +Junction *j; +int k; +int usePlusBlockBypass; +#endif +{ + Junction *alt1; + set a, rk, f; + require(j->ntype==nJunction, "ComputeErrorSet: non junction passed"); + + f = rk = empty; + for (alt1=j; alt1!=NULL; alt1 = (Junction *)alt1->p2) + { + if (alt1->ignore && ! usePlusBlockBypass) continue; /* MR21 - Ignore aPlusBlk forward p2 */ + REACH(alt1->p1, k, &rk, a); + require(set_nil(rk), "ComputeErrorSet: rk != nil"); + set_free(rk); + set_orin(&f, a); + set_free(a); + } + return f; +} + +static char * +#ifdef __USE_PROTOS +tokenFollowSet(TokNode *p) +#else +tokenFollowSet(p) +TokNode *p; +#endif +{ + static char buf[100]; + set rk, a; + int n; + rk = empty; + + REACH(p->next, 1, &rk, a); + require(set_nil(rk), "rk != nil"); + set_free(rk); + n = DefErrSet( &a, 0, NULL ); + set_free(a); + if ( GenCC ) + sprintf(buf, "err%d", n); + else + sprintf(buf, "zzerr%d", n); + return buf; +} + +static void +#ifdef __USE_PROTOS +makeErrorClause( Junction *q, set f, int max_k, int usePlusBlockBypass ) +#else +makeErrorClause( q, f, max_k, usePlusBlockBypass ) +Junction *q; +set f; +int max_k; +int usePlusBlockBypass; +#endif +{ + char * handler_id=""; /* MR7 */ + int nilf=0; /* MR13 */ + RuleEntry *ruleEntry; /* MR14 */ + + if ( FoundException ) + { + _gen("else {\n"); + tabs++; + if ( FoundGuessBlk ) + { + if ( GenCC ) {gen("if ( guessing ) goto fail;\n");} + else gen("if ( zzguessing ) goto fail;\n"); + } + gen("if (_sva) _signal=NoViableAlt;\n"); + gen("else _signal=NoSemViableAlt;\n"); + if (q->outerEG != NULL) { + handler_id=q->outerEG->altID; +#if 0 + } else { + printf("q->curAltNum=%d q->exception_label=%s\n",q->curAltNum,q->exception_label); + gen("*** DEBUG *** outerEG==NULL\n"); +#endif + }; + gen1("goto %s_handler; /* MR7 */\n",handler_id); /* MR7 */ + tabs--; + gen("}\n"); + return; + } + + if ( max_k == 1 ) + { +/* MR13 */ nilf=set_nil(f); + if ( GenCC ) { + _gen1("else {FAIL(1,err%d", DefErrSet1(1,&f,1,NULL)); + } else { + _gen1("else {zzFAIL(1,zzerr%d", DefErrSet1(1,&f,1,NULL)); + }; + set_free(f); + } + else + { + int i; + set_free(f); + if ( GenCC ) {_gen1("else {FAIL(%d", max_k);} + else _gen1("else {zzFAIL(%d", max_k); + + ruleEntry = (RuleEntry *) hash_get(Rname,q->rname); + + for (i=1; i<=max_k; i++) + { +/* MR14 */ if (ruleEntry->dontComputeErrorSet) { +/* MR14 */ f=empty; + } else { + f = ComputeErrorSet(q, i, usePlusBlockBypass /* use plus block bypass ? */ ); + } + + if ( GenCC ) {_gen1(",err%d", DefErrSet( &f, 1, NULL ));} + else _gen1(",zzerr%d", DefErrSet( &f, 1, NULL )); + + set_free(f); + } + } + _gen(",&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;}\n"); +/* MR13 */ if (nilf) { +/* MR13 */ errFL("empty error set for alt - probably because of undefined rule or infinite left recursion", +/* MR13 */ FileStr[q->file],q->line); +/* MR13 */ gen(" /* MR13 empty error set for this alt - undef rule ? infinite left recursion ? */"); +/* MR13 */ }; +} + +static /* MR7 */ +#ifdef __USE_PROTOS +char * findOuterHandlerLabel(ExceptionGroup *eg) /* MR7 */ +#else +char * findOuterHandlerLabel(eg) /* MR7 */ +ExceptionGroup *eg; /* MR7 */ +#endif +{ + char *label=NULL; /* MR7 */ + ExceptionGroup *outerEG; /* MR7 */ + + if (eg->forRule == 0) { /* MR7 */ + if (eg->labelEntry != NULL) { /* MR7 */ + outerEG=eg->labelEntry->outerEG; /* MR7 */ + if (outerEG != NULL) { /* MR7 */ + label=outerEG->altID; /* MR7 */ + outerEG->used=1; /* MR7 */ + }; /* MR7 */ + } else if (eg->outerEG != NULL) { /* MR7 */ + outerEG=eg->outerEG; /* MR7 */ + label=outerEG->altID; /* MR7 */ + outerEG->used=1; /* MR7 */ + }; /* MR7 */ + }; /* MR7 */ + return (label==NULL ? "" : label); /* MR7 */ +} /* MR7 */ + +/*** debug ***/ +#if 0 +** static /* MR7 */ +** #ifdef __USE_PROTOS +** char * findOuterAltHandlerLabel(Junction *startJ) /* MR7 */ +** #else +** char * findOuterAltHandlerLabel(startJ) /* MR7 */ +** Junction *startJ; /* MR7 */ +** #endif +** { /* MR7 */ +** char *label=NULL; /* MR7 */ +** Junction *alt; /* MR7 */ +** /* MR7 */ +** for (alt=startJ; alt != NULL; alt=alt->outerAltstart) { /* MR7 */ +** label=alt->exception_label; /* MR7 */ +** if (label != NULL) break; /* MR7 */ +** }; /* MR7 */ +** return (label==NULL ? "" : label); /* MR7 */ +** } /* MR7 */ +#endif + +#ifdef __USE_PROTOS +static void OutLineInfo(FILE *file,int line,char *fileName) +#else +static void OutLineInfo(file,line,fileName) + FILE * file; + int line; + char * fileName; +#endif +{ + static char * prevFileName=NULL; + static char * prevFileNameMS=NULL; + + char * p; + char * q; + + if (! GenLineInfo) return; + + if (!GenLineInfoMS) { + fprintf(file, LineInfoFormatStr,line,fileName); + } else { + if (fileName == prevFileName) { + fprintf(file, LineInfoFormatStr,line,prevFileNameMS); + } else { + if (prevFileNameMS != NULL) free (prevFileNameMS); + prevFileNameMS=(char *)calloc(1,strlen(fileName)+1); + require(prevFileNameMS != NULL,"why not do this in calloc wrapper"); + q=prevFileNameMS; + for (p=fileName; *p != 0; p++) { + *q=*p; + if (*q == '\\') *q='/'; + q++; + } + } + prevFileName=fileName; + }; +} + +#if 0 + +/* MR21 */ + +#ifdef __USE_PROTOS +void OutFirstSetSymbol(Junction *q, char * pSymbol) +#else +void OutFirstSetSymbol(q, pSymbol) + Junction* q; + char * pSymbol +#endif +{ + + set f; + if (pSymbol == NULL) return; + gen1("/** #FirstSetSymbol(%s) **/\n",pSymbol); + f = ComputeErrorSet(q, 1, 0 /* use plus block bypass ? */); + DefErrSetWithSuffix (0 /* nil ok */, &f,0 /* no substitute */, pSymbol, ""); + set_free(f); +} +#endif + +/* MR21 */ + +#ifdef __USE_PROTOS +void BlockPreambleOption(Junction *q, char * pSymbol) +#else +void BlockPreambleOption(q, pSymbol) + Junction* q; + char * pSymbol; +#endif +{ + set f = empty; + if (pSymbol != NULL) { + f = ComputeErrorSet(q, 1, 0 /* use plus block bypass ? */); + gen1("/** #FirstSetSymbol(%s) **/\n",pSymbol); + DefErrSetWithSuffix (0 /* nil ok */, &f,0 /* no substitute */, pSymbol, ""); + } + set_free(f); +} + +/* MR21 */ + +void +#ifdef __USE_PROTOS +dumpActionPlus(ActionNode *a, char *s, FILE *output, int tabs, int file, int line, +int final_newline ) +#else +dumpActionPlus(a, s, output, tabs, file, line, final_newline ) +ActionNode *a; +char *s; +FILE *output; +int tabs; +int file; +int line; +int final_newline; +#endif +{ + dumpAction(s,output,tabs,file,line,final_newline); +} + + +#if 0 +** #ifdef __USE_PROTOS +** void MR_ErrorSets(Junction *q, int max_k, int usePlusBlockBypass) +** #else +** void MR_ErrorSets(q, max_k, usePlusBlockBypass) +** Junction *q; +** int max_k; +** int usePlusBlockBypass; +** #endif +** { +** int k; +** set setResult; +** Junction* alt1; +** Junction* p; +** set rk; +** +** require (max_k <= CLL_k, "k > CLL_k"); +** +** +** for (k = 1; k <= CLL_k; k++) {set_clr(q->fset[k]); } +** +** for (k = 1; k <= max_k; k++) { +** for (alt1=q; alt1 != NULL; alt1 = (Junction *)alt1->p2) +** { +** if (alt1->ignore && ! usePlusBlockBypass) continue; +** p = analysis_point((Junction *)alt1->p1); +** REACH(p, k, &rk, setResult); +** require(set_nil(rk), "rk != nil"); +** set_orin(&q->fset[k], setResult); +** } +** } +** } +#endif + + +#ifdef __USE_PROTOS +void DumpInitializers(FILE* output, RuleEntry *r, char * pReturn) +#else +void DumpInitializers(output, r, pReturn) +FILE* output; +RuleEntry *r; +char * pReturn; +#endif +{ + char *p = pReturn; + char *pDataType; + char *pSymbol; + char *pEqualSign; + char *pValue; + char *pSeparator; + int nest = 0; + char *q; + + require(pReturn!=NULL, "DumpInitializer: invalid string"); + + while (*p != 0) { + p = endFormal(p, + &pDataType, + &pSymbol, + &pEqualSign, + &pValue, + &pSeparator, + &nest); + if (nest != 0) return; + if (pValue != NULL) { + tab(); + q = strBetween(pSymbol, pEqualSign, pSeparator); + fprintf(output, "_retv.%s", q); + q = strBetween(pValue, NULL, pSeparator); + fprintf(output, " = %s;\n", q); + } + } +} + +#ifdef __USE_PROTOS +void DumpFormals(FILE* output, char * pReturn, int bInitializer) +#else +void DumpFormals(output, pReturn, bInitializer) +FILE* output; +char * pReturn; +int bInitializer; +#endif +{ + char *p = pReturn; + char *pDataType; + char *pSymbol; + char *pEqualSign; + char *pValue; + char *pSeparator; + int nest = 0; + char *q; + int count = 0; + + require(pReturn!=NULL, "DumpFormals: invalid string"); + + while (*p != 0) { + p = endFormal(p, + &pDataType, + &pSymbol, + &pEqualSign, + &pValue, + &pSeparator, + &nest); + if (nest != 0) return; + if (count > 0) fprintf(output,","); + if (pDataType != NULL && pSymbol != NULL) { + q = strBetween(pDataType, pSymbol, pSeparator); + fprintf(output, "%s", q); + q = strBetween(pSymbol, pEqualSign, pSeparator); + fprintf(output," %s",q); + if (pValue != NULL) { + q = strBetween(pValue, NULL, pSeparator); + if (bInitializer != 0) { + fprintf(output, " = %s", q); + } + } + } + count++; + } +} + +/* MR23 Check for empty alt in a more intelligent way. + Previously, an empty alt for genBlk had to point directly + to the endBlock. This did not work once I changed {...} + blocks to look like (...|...| epsilon) since there were + intervening generics. This fixes the problem for this + particular case. Things like actions or empty blocks of + various kinds will still cause problems, but I wasnt't + prepared to handle pathological cases like (A|()*). It + does handle (A | ()), which is a recommended idiom for + epsilon. + + Actually, this isn't quite correct since it doesn't handle + the case of the ignore bit in the plus block bypass, but + I'm too tired to figure out the correct fix, and will just + work around it. +*/ + +#ifdef __USE_PROTOS +int isEmptyAlt(Node * alt, Node * endBlock) +#else +int isEmptyAlt(alt, endBlock) +Node * alt; +Node * endBlock; +#endif +{ + Node * n = alt; + Junction * j; + while (n != endBlock) { + switch (n->ntype) { + + case nRuleRef: + return 0; + + case nToken: + return 0; + + case nAction: + return 0; + + case nJunction: + goto JUNCTION; + + default: + fatal_internal("Invalid node type"); + return 0; + } +JUNCTION: + j = (Junction *) n; + + switch (j->jtype) { + case Generic: + { + n = j->p1; + goto NEXT; + } + + case aSubBlk: + { + n = j->p1; /* MR26 */ + goto NEXT; /* MR26 */ + } + + case EndBlk: + return 0; + + case EndRule: + return 1; + + default: + return 0; + } +NEXT: continue; + } + return 1; +} diff --git a/pccts/antlr/generic.h b/pccts/antlr/generic.h new file mode 100644 index 0000000..db5d711 --- /dev/null +++ b/pccts/antlr/generic.h @@ -0,0 +1,286 @@ +/* + * generic.h -- generic include stuff for new PCCTS ANTLR. + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2001 + */ + +#define StrSame 0 + +#define DefaultParserName "zzparser" + +/* MR9 JVincent@novell.com Allow user to override default ZZLEXBUFSIZE */ +/* MR11 thm Raise antlr's own default ZZLEXBUFSIZE to 8k */ +/* MR22 thm Raise antlr's own default ZZLEXBUFSIZE to 32k */ + +#ifndef ZZLEXBUFSIZE +#define ZZLEXBUFSIZE 32000 +#endif + +/* Tree/FIRST/FOLLOW defines -- valid only after all grammar has been read */ +#define ALT TokenNum+1 +#define SET TokenNum+2 +#define TREE_REF TokenNum+3 + + /* E r r o r M a c r o s */ + +#define fatal(err) fatalFL(err, __FILE__, __LINE__) +#define fatal_internal(err) fatal_intern(err, __FILE__, __LINE__) + + +#define eMsg1(s,a) eMsg3(s,a,NULL,NULL) +#define eMsg2(s,a,b) eMsg3(s,a,b,NULL) + + /* S a n i t y C h e c k i n g */ + +#ifndef require +#define require(expr, err) {if ( !(expr) ) fatal_internal(err);} +#endif + + /* L i s t N o d e s */ + +typedef struct _ListNode { + void *elem; /* pointer to any kind of element */ + struct _ListNode *next; + } ListNode; + +/* Define a Cycle node which is used to track lists of cycles for later + * reconciliation by ResolveFoCycles(). + */ +typedef struct _c { + int croot; /* cycle root */ + set cyclicDep; /* cyclic dependents */ + unsigned deg; /* degree of FOLLOW set of croot */ + } Cycle; + +typedef struct _e { + int tok; /* error class name == TokenStr[tok] */ + ListNode *elist; /* linked list of elements in error set */ + set eset; + int setdeg; /* how big is the set */ + int lexclass; /* which lex class is it in? */ + } ECnode; + +typedef struct _TCnode { + int tok; /* token class name */ + ListNode *tlist; /* linked list of elements in token set */ + set tset; + int lexclass; /* which lex class is it in? */ + unsigned char dumped; /* this def has been been dumped */ + unsigned char dumpedComplement; /* this def has been been dumped */ + unsigned setnum; /* which set number is this guy? (if dumped) */ + unsigned setnumComplement; /* MR23 */ + unsigned setnumErrSet; /* MR23 which set is this #tokclass error set (if dumped) */ + unsigned setnumErrSetComplement; /* MR23 */ + } TCnode; + +typedef struct _ft { + char *token; /* id of token type to remap */ + int tnum; /* move token type to which token position */ + } ForcedToken; + +typedef struct _ContextGuardPredicates { /* MR13 */ + Predicate *pred; /* MR13 */ + } ContextGuardPredicates; /* MR13 */ + +#define newListNode (ListNode *) calloc(1, sizeof(ListNode)); +#define newCycle (Cycle *) calloc(1, sizeof(Cycle)); +#define newECnode (ECnode *) calloc(1, sizeof(ECnode)); +#define newTCnode (TCnode *) calloc(1, sizeof(TCnode)); + + + /* H a s h T a b l e E n t r i e s */ + +typedef struct _t { /* Token name or expression */ + char *str; + struct _t *next; + int token; /* token number */ + unsigned char classname; /* is it a err/tok class name or token */ + TCnode *tclass; /* ptr to token class */ + char *action; + char *akaString; + } TermEntry; + +typedef struct _r { /* Rule name and ptr to start of rule */ + char *str; + struct _t *next; + int rulenum; /* RulePtr[rulenum]== ptr to RuleBlk junction */ + unsigned char noAST;/* gen AST construction code? (def==gen code) */ + char *egroup; /* which error group (err reporting stuff) */ +#if 0 + /* MR27 This appears to never be used. Delete this code later. */ + + ListNode *el_labels;/* list of element labels ref in all of rule */ +#endif + ListNode *ast_labels_in_actions; /* MR27 */ + unsigned char has_rule_exception; + char dontComputeErrorSet; /* MR14 - don't compute error set + special for rule in alpha part of + (alpha)? beta block */ + } RuleEntry; + +typedef struct _f { /* cache Fi/Fo set */ + char *str; /* key == (rulename, computation, k) */ + struct _f *next; + set fset; /* First/Follow of rule */ + set rk; /* set of k's remaining to be done after ruleref */ + int incomplete; /* only w/FOLLOW sets. Use only if complete */ + } CacheEntry; + +typedef struct _LabelEntry { /* element labels */ + char *str; + struct _f *next; + Node *elem; /* which element does it point to? */ + ExceptionGroup *ex_group; + /* Is there an exception attached to label? */ + ExceptionGroup *outerEG; /* MR7 */ + /* next EG if ex_group doesn't catch it MR7 */ + struct _LabelEntry *pendingLink; /* MR7 */ + /* too lazy to use ListNode ? MR7 */ + int curAltNum; /* MR7 */ + } LabelEntry; + +typedef struct _SignalEntry { + char *str; + struct _f *next; + int signum; /* unique signal number */ + } SignalEntry; + +typedef struct _PredEntry { /* MR11 predicate name and ptr to string */ + char *str; + struct _PredEntry *next; + int file; + int line; + Predicate *pred; + char *predLiteral; + } PredEntry; + +typedef struct _PointerStack { /* MR10 */ + int count; + int size; + void **data; + } PointerStack; + +#define newTermEntry(s) (TermEntry *) newEntry(s, sizeof(TermEntry)) +#define newRuleEntry(s) (RuleEntry *) newEntry(s, sizeof(RuleEntry)) +#define newCacheEntry(s) (CacheEntry *) newEntry(s, sizeof(CacheEntry)) +#define newLabelEntry(s) (LabelEntry *) newEntry(s, sizeof(LabelEntry)) +#define newSignalEntry(s) (SignalEntry *) newEntry(s, sizeof(SignalEntry)) +#define newPredEntry(s) (PredEntry *) newEntry(s,sizeof(PredEntry)) + +typedef struct _UserAction { + char *action; + int file, line; + } UserAction; + + + /* L e x i c a l C l a s s */ + +/* to switch lex classes, switch ExprStr and Texpr (hash table) */ +typedef struct _lc { + char *classnum, **exprs; + Entry **htable; + } LClass; + +typedef struct _exprOrder { + char *expr; + int lclass; + } Expr; + + +typedef Graph Attrib; + + /* M a x i m u m s */ + +/* MR20 Note G. Hobbelt These values are superceded by values in hash.h */ + +#ifndef HashTableSize +#define HashTableSize 253 +#endif +#ifndef StrTableSize +#define StrTableSize 15000 /* all tokens, nonterminals, rexprs stored here */ +#endif +#define MaxLexClasses 50 /* how many automatons */ +/* TokenStart and EofToken are ignored if #tokdefs meta-op is used */ +#define TokenStart 2 /* MUST be in 1 + EofToken */ +#define EofToken 1 /* Always predefined to be 1 */ + +#ifndef MaxNumFiles +#define MaxNumFiles 99 +#endif + +/**** MR9 JVincent@novell.com Move to pcctscfg.h */ +/**** #define MaxFileName 300 ****/ /* MR9 Move to pcctscfg.h */ /* largest file name size */ + +#define MaxRuleName 100 /* largest rule name size */ +#define TSChunk 100 /* how much to expand TokenStr/ExprStr each time */ +#define TIChunk TSChunk /* expand TokenInd by same as TokenStr to mirror them */ +#define FoStackSize 100 /* deepest FOLLOW recursion possible */ + +#define MaxClassDeclStuff 256 /* MR10 */ + +#define NumPredefinedSignals 3 + + /* S t a n d a r d S i g n a l s */ + +#define sigNoSignal 0 +#define sigMismatchedToken 1 +#define sigNoViableAlt 2 +#define sigNoSemViableAlt 3 + + + +/* AST token types */ +#define ASTexclude 0 +#define ASTchild 1 +#define ASTroot 2 +#define ASTinclude 3 /* include subtree made by rule ref */ + + +#define PredictionVariable "zzpr_expr" +#define PredictionLexClassSuffix "_zzpred" + +#define WildCardString "WildCard" + +#if 0 + /* Removed in version 1.33MR19 + Don't understand why this never caused problems before + */ + + /********************************************************* + #ifndef ANTLRm + #define ANTLRm(st, f, _m) zzbufsize = ZZLEXBUFSIZE;\ + zzmode(_m); \ + zzenterANTLR(f); \ + st; ++zzasp; \ + zzleaveANTLR(f); + #endif + *********************************************************/ +#endif + +#include "proto.h" +#include "pcctscfg.h" /* MR14 */ +#include <string.h> diff --git a/pccts/antlr/globals.c b/pccts/antlr/globals.c new file mode 100644 index 0000000..89b3f04 --- /dev/null +++ b/pccts/antlr/globals.c @@ -0,0 +1,484 @@ +/* + * globals.c -- File containing all variables/tables visible to all files. + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2001 + */ + +#include <stdio.h> + +#include "pcctscfg.h" + +#include "set.h" +#include "syn.h" +#include "hash.h" +#include "generic.h" + +char Version[] = "1.33MR32" ; /* PCCTS version number */ /* MRXXX */ +char VersionDef[] = "13332"; /* same (except int equiv for preproc symbol) */ /* MRXXX */ + +char LexStartSymbol[] = "START";/* Name of starting lexical class/automaton */ +char *RemapFileName = "remap.h"; +char *DlgFileName = "parser.dlg"; +char *DefFileName = "tokens.h"; +char *ErrFileName = "err.c"; +char *ModeFileName = "mode.h"; +char *StdMsgName = NULL; + +char *ParserName = DefaultParserName; + +/* list of PCCTS supplied support symbols; these are renamed when more than + * one ANTLR-generated parsers are linked together to avoid name conflicts. + * Can't use '##' ANSIC preprocessor concat operator with K&R and: + * #define zzskip zzparser ## skip + * will not work for ANSI/C++ as 'zzparserskip' is created w/o zzparser + * being substituted--ack!!! + */ +char *StandardSymbols[] = { +/* ANTLR stuff */ + "zzStackOvfMsg", + "zzasp", + "zzaStack", + "inf_tokens", + "inf_text", + "inf_text_buffer", + "inf_text_buffer_ptr", + "inf_text_buffer_size", + "inf_labase", + "inf_last", + "inf_lap", + "zztokenLA", + "zztextLA", + "zzlap", + "zzlabase", + "zztoktext", + "zztoken", + "zzdirty", + "zzguessing", + "zzguess_start", + "zzresynch", + "zzinf_tokens", + "zzinf_text", + "zzinf_text_buffer", + "zzinf_labase", + "zzinf_last", + "zzfill_inf_look", + "zzFAIL", + "zzsave_antlr_state", + "zzrestore_antlr_state", + "zzsyn", + "zzset_el", + "zzset_deg", + "zzedecode", + "_zzsetmatch", + "_zzmatch", + "_inf_zzgettok", + "zzconsumeUntil", + "zzconsumeUntilToken", + "_zzmatch_wsig", + "_zzsetmatch_wsig", + "_zzmatch_wdfltsig", + "_zzsetmatch_wdfltsig", + "zzdflthandlers", +/* DLG stuff */ + "zzreal_line", + "zzcharfull", + "zzerr", + "zzlextext", + "zzbegexpr", + "zzendexpr", + "zzbufsize", + "zzbegcol", + "zzendcol", + "zzline", + "zzchar", + "zzbufovf", + "zzrdstream", + "zzrdfunc", + "zzrdstr", + "zzclose_stream", + "zzsave_dlg_state", + "zzrestore_dlg_state", + "zzmode", + "zzskip", + "zzmore", + "zzreplchar", + "zzreplstr", + "zzgettok", + "zzadvance", + "zzerrstd", + "zzerr_in", + "zzconstr_attr", + "zzempty_attr", + "zzerraction", + "zztokens", /* list of token regular expressions */ + "dfa", + "accepts", + "actions", + "zzTraceOptionValue", /* MR10 */ + "zzTraceGuessOptionValue", /* MR10 */ + "zzTraceCurrentRuleName", /* MR10 */ + "zzTraceDepth", /* MR10 */ + "zzGuessSeq", /* MR10 */ + "zzSyntaxErrCount", /* MR11 */ + "zzLexErrCount", /* MR11 */ + "zzTraceGuessDone", /* MR13 - BJS */ + "zzTraceGuessFail", /* MR13 - BJS */ + "zzTraceGuessOption", /* MR13 - BJS */ + "zzTraceIn", /* MR13 - BJS */ + "zzTraceOption", /* MR13 - BJS */ + "zzTraceOut", /* MR13 - BJS */ + "zzTraceReset", /* MR13 - BJS */ + NULL /* must be present */ +}; + +/* list of PCCTS supplied support functions; these are renamed when more than + * one ANTLR-generated parsers are linked together to avoid name conflicts. + */ +char *ASTSymbols[] = { + "AST", + "zzast_sp", + "zzastStack", + "zzlink", + "zzastnew", + "zzsubchild", + "zzsubroot", + "zzpre_ast", + "zzfree_ast", + "zztmake", + "zzdup_ast", + "zztfree", + "zzdouble_link", + NULL /* must be present */ +}; + +/* Current ambiguity examination information */ +int CurAmbigAlt1, CurAmbigAlt2, CurAmbigline, CurAmbigfile; +char *CurAmbigbtype; + + + /* M e t h o d T a b l e s */ +/* + * The following tables are used to fill syntax diagram nodes with the correct + * function pointers for computing FIRST sets and printing themselves. + */ + +/* fpTraverse[node type] == pointer to function that calculates trees + * representing the FIRST sets for that node (maintains spatial info). + * We use 'struct _tree' not 'tree' due to a g++ 2.4.3 bug. + */ +#ifdef __cplusplus +struct _tree *(*fpTraverse[NumNodeTypes+1])(... /* Node *, int, set * */) = { + NULL, + (struct _tree *(*)(...)) tJunc, + (struct _tree *(*)(...)) tRuleRef, + (struct _tree *(*)(...)) tToken, + (struct _tree *(*)(...)) tAction +}; +#else +Tree *(*fpTraverse[NumNodeTypes+1])() = { + NULL, + tJunc, + tRuleRef, + tToken, + tAction +}; +#endif + +/* fpReach[node type] == pointer to function that calculates FIRST set for + * that node. (r stands for reach). We use 'struct _set' not 'set' + * due to a g++ 2.4.3 bug. + */ +#ifdef __cplusplus +struct _set (*fpReach[NumNodeTypes+1])(... /* Node *, int, set * */) = { + NULL, + (struct _set (*)(...)) rJunc, + (struct _set (*)(...)) rRuleRef, + (struct _set (*)(...)) rToken, + (struct _set (*)(...)) rAction +}; +#else +set (*fpReach[NumNodeTypes+1])() = { + NULL, + rJunc, + rRuleRef, + rToken, + rAction +}; +#endif + +/* fpPrint[node type] == pointer to function that knows how to print that node. */ +#ifdef __cplusplus +void (*fpPrint[NumNodeTypes+1])(... /* Node * */) = { + NULL, + (void (*)(...)) pJunc, + (void (*)(...)) pRuleRef, + (void (*)(...)) pToken, + (void (*)(...)) pAction +}; +#else +void (*fpPrint[NumNodeTypes+1])() = { + NULL, + pJunc, + pRuleRef, + pToken, + pAction +}; +#endif + +char *decodeJType[] = { + "invalid", + "aSubBlk", + "aOptBlk", + "aLoopBlk", + "EndBlk", + "RuleBlk", + "Generic", + "EndRule", + "aPlusBlk", + "aLoopBegin" +}; + + + /* H a s h T a b l e s */ + +Entry **Tname, /* Table of all token names (maps name to tok num)*/ + **Texpr, /* Table of all token expressions + (maps expr to tok num) */ + **Rname, /* Table of all Rules (has ptr to start of rule) */ + **Fcache, /* Cache of First/Follow Computations */ + **Tcache; /* Tree cache; First/Follow for permute trees */ +Entry **Elabel; /* Table of all element label names */ +Entry **Sname; /* Signal names */ +Entry **Pname; /* symbolic predicate names MR11 */ + + + /* V a r i a b l e s */ + +int Save_argc; /* MR10 */ +char **Save_argv; /* MR10 */ +int EpToken=0; /* Imaginary Epsilon token number */ +int WildCardToken=0; +int CurFile= -1; /* Index into FileStr table */ +char *CurPredName=NULL; /* MR11 */ +char *CurRule=NULL; /* Pointer to current rule name */ +int CurRuleDebug=0; /* MR13 debug flag */ +RuleEntry *CurRuleNode=NULL;/* Pointer to current rule node in syntax tree */ +char *CurRetDef=NULL; /* Pointer to current return type definition */ +char *CurParmDef=NULL; /* Pointer to current parameter definition */ +Junction *CurRuleBlk=NULL; /* Pointer to current block node for enclosing block */ +ListNode *CurExGroups=NULL; /* Current list of exception groups for rule/alts */ +ListNode *CurElementLabels=NULL; +ListNode *CurAstLabelsInActions=NULL; /* MR27 */ + +/* MR10 used by <<>>? to set "label_used_in_semantic_pred" */ +/* MR10 this will force LT(i) assignment even in guess mode */ + +ListNode *CurActionLabels=NULL; /* MR10 Element Labels appearing in last action */ +int numericActionLabel=0 ; /* MR10 << ... $1 ... >> or << ... $1 ... >>? */ +ListNode *NumericPredLabels=NULL; /* MR10 << ... $1 ... >>? ONLY */ +ListNode *ContextGuardPredicateList=NULL; /* MR13 for re-evaluating predicates + after meta tokens are defined */ + +int CurBlockID=0; /* Unique int for each block */ +int CurAltNum=0; +Junction *CurAltStart = NULL; /* Junction node that starts the alt */ +Junction *OuterAltStart = NULL; /* For chaining exception groups MR7 */ +int NumRules=0; /* Rules are from 1 to n */ +FILE *output=NULL; /* current parser output file */ +FILE *input=NULL; /* current grammar input file */ +char *FileStr[MaxNumFiles];/* Ptr to array of file names on command-line */ +int NumFiles=0; /* current grammar file number */ +#ifdef __cplusplus +void (**fpTrans)(...), /* array of ptrs to funcs that translate nodes */ + (**fpJTrans)(...); /* ... that translate junctions */ +#else +void (**fpTrans)(), /* array of ptrs to funcs that translate nodes */ + (**fpJTrans)(); /* ... that translate junctions */ +#endif +int **FoStack; /* Array of LL_k ptrs to stacks of rule numbers */ +int **FoTOS; /* FOLLOW stack top-of-stack pointers */ +Junction *SynDiag = NULL; /* Pointer to start of syntax diagram */ +int BlkLevel=1; /* Current block level. Set by antlr.g, used by + * scanner to translate $i.j attributes */ +set reserved_positions; /* set of token positions reserved by '#token T=i' cmds */ +set all_tokens; /* set of all token types */ +set imag_tokens; /* set of all imaginary token types (EpToken, errclasses...) */ +set tokclasses; /* set of all token class token types */ +ListNode *ForcedTokens = 0; /* list of token_id/token_num pairs to remap */ +ListNode *MetaTokenNodes=NULL; /* list of meta token refs such as token classes etc... */ +int *TokenInd=NULL; /* an indirection level between token num and position + * of that token def in TokenStr and ExprStr */ +int LastTokenCounted=0; /* ==TokenNum if no token renumbering (same as old TokenNum) */ +int TokenNum=TokenStart; +char **TokenStr=NULL; /* map token # to token name */ +char **ExprStr=NULL; /* map token # to expr */ +Junction **RulePtr=NULL; /* map rule # to RuleBlk node of rule */ +ListNode *ExprOrder=NULL; /* list of exprs as they are found in grammar */ +ListNode *BeforeActions=NULL;/* list of grammar actions before rules */ +ListNode *AfterActions=NULL;/* list of grammar actions after rules */ +ListNode *LexActions=NULL; /* list of lexical actions */ + +/* MR1 */ +/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */ +/* MR1 via #lexmember <<....>> */ +/* MR1 via #lexprefix <<....>> */ +/* MR1 */ + +ListNode *LexMemberActions=NULL;/* list of lexical header member decl MR1 */ +ListNode *LexPrefixActions=NULL;/* list of lexical header #include decl MR1 */ +ListNode **Cycles=NULL; /* list of cycles (for each k) found when + doing FOLLOWs */ +ListNode *eclasses=NULL; /* list of error classes */ +ListNode *tclasses=NULL; /* list of token classes */ +LClass lclass[MaxLexClasses]; /* array of lex class definitions */ +int CurrentLexClass; /* index into lclass */ +int NumLexClasses=0; /* in range 1..MaxLexClasses (init 0) */ + +char *HdrAction=NULL; /* action defined with #header */ +char *FirstAction=NULL; /* action defined with #first MR11 */ +FILE *ErrFile; /* sets and error recovery stuff */ +FILE *DefFile=NULL; /* list of tokens, return value structs, setwd defs */ +FILE *MRinfoFile=NULL; /* MR10 information file */ +int MRinfo=0; /* MR10 */ +int MRinfoSeq=0; /* MR10 */ +int InfoP=0; /* MR10 predicates */ +int InfoT=0; /* MR10 tnodes */ +int InfoF=0; /* MR10 first/follow sets */ +int InfoM=0; /* MR10 monitor progress */ +int InfoO=0; /* MR12 orphan rules */ +int TnodesInUse=0; /* MR10 */ +int TnodesPeak=0; /* MR10 */ +int TnodesAllocated=0; /* MR10 */ +int TnodesReportThreshold=0; /* MR11 */ +int PotentialSuppression=0; /* MR10 */ +int PotentialDummy=0; /* MR10 */ +int CannotContinue=FALSE; +int OutputLL_k = 1; /* LL_k for parsing must be power of 2 */ +int action_file; /* used to track start of action */ +int action_line; +int FoundGuessBlk=0; /* there is a (...)? block somewhere in grammar */ +int FoundException=0; /* there is an exception somewhere in grammar */ +/* MR6 Distinguish between @ operator and real exception */ +/* MR6 by keeping separate flags for @ operator and real exceptions */ +int FoundAtOperator=0; /* MR6 */ +int FoundExceptionGroup=0; /* MR6 */ +int pLevel=0; /* print Level */ +int pAlt1,pAlt2; /* print "==>" in front of these alts */ + +/* C++ output stuff */ +FILE *Parser_h, /* where subclass of ANTLRParser goes */ + *Parser_c; /* where code for subclass of ANTLRParser goes */ +char Parser_h_Name[MaxFileName+1] = ""; +char Parser_c_Name[MaxFileName+1] = ""; +char MRinfoFile_Name[MaxFileName+1] = ""; /* MR10 */ +char *ClassDeclStuff=NULL; /* MR10 */ +char *BaseClassName=NULL; /* MR22 */ +/* list of actions inside the #class {...} defs */ +ListNode *class_before_actions=NULL; +ListNode *class_after_actions=NULL; + +char CurrentClassName[MaxRuleName]=""; +int no_classes_found=1; +char *UserTokenDefsFile; +int UserDefdTokens=0; /* found #tokdefs? */ +char *OutputDirectory=TopDirectory; +ExceptionGroup *DefaultExGroup = NULL; +int NumSignals = NumPredefinedSignals; +int ContextGuardTRAV=0; + +char *MR_AmbAidRule=NULL; /* MR11 */ +int MR_AmbAidLine=0; /* MR11 */ +int MR_AmbAidDepth=0; /* MR11 */ +int MR_AmbAidMultiple=0; /* MR11 */ +int MR_skipped_e3_report=0; /* MR11 */ +int MR_usingPredNames=0; /* MR11 */ +int MR_BadExprSets=0; /* MR13 */ +int MR_Inhibit_Tokens_h_Gen=0; /* MR13 */ +int NewAST=0; /* MR13 */ +int tmakeInParser=0; /* MR23 */ +int AlphaBetaTrace=0; /* MR14 */ +int MR_BlkErr=0; /* MR21 */ +int MR_AlphaBetaMessageCount=0; /* MR14 */ +int MR_AlphaBetaWarning=0; /* MR14 */ +int MR_ErrorSetComputationActive=0; /* MR14 */ +int MR_MaintainBackTrace=0; /* MR14 */ +set MR_CompromisedRules; /* MR14 */ + +Junction *MR_RuleBlkWithHalt; /* MR10 */ + + /* C m d - L i n e O p t i o n s */ + +int LL_k=1; /* how many tokens of full lookahead */ +int CLL_k= -1; /* how many tokens of compressed lookahead */ +int PrintOut = FALSE; /* print out the grammar */ +int PrintAnnotate = FALSE;/* annotate printout with FIRST sets */ +int CodeGen=TRUE; /* Generate output code? */ +int LexGen=TRUE; /* Generate lexical files? (tokens.h, parser.dlg) */ +int GenAST=FALSE; /* Generate AST's? */ +int GenANSI=FALSE; /* Generate ANSI code where necessary */ +int GenExprSetsOpt=TRUE;/* use sets not (LA(1)==tok) expression lists */ +int GenCR=FALSE; /* Generate cross reference? */ +int GenLineInfo=FALSE; /* Generate # line "file" stuff? */ +int GenLineInfoMS=FALSE;/* Like -gl but replace "\" with "/" for MS C/C++ systems */ +int TraceGen=FALSE; /* Generate code to trace rule invocation */ +int elevel=1; /* error level for ambiguity messages */ +int GenEClasseForRules=0;/* don't generate eclass for each rule */ +int TreeResourceLimit= -1;/* don't limit tree resource */ +int DemandLookahead = 0;/* demand/delayed lookahead or not */ +char *RulePrefix = ""; /* prefix each generated rule with this */ +char *stdpccts = "stdpccts.h";/* where to generate std pccts include file */ +int GenStdPccts = 0; /* don't gen stdpccts.h? */ +int ParseWithPredicates = 1; +int WarningLevel = 1; +int UseStdout = 0; /* MR6 */ +int TabWidth = 2; /* MR6 */ /* MR27 */ +int HoistPredicateContext = 0; +int MRhoisting = 0; /* MR9 */ +int MRhoistingk = 0; /* MR13 */ +int MR_debugGenRule=0; /* MR11 */ + +int GenCC = 0; /* Generate C++ output */ + +PointerStack MR_BackTraceStack={0,0,NULL}; /* MR10 */ +PointerStack MR_PredRuleRefStack={0,0,NULL}; /* MR10 */ +PointerStack MR_RuleBlkWithHaltStack={0,0,NULL}; /* MR10 */ + +/* DontCopyTokens and Pragma_DupLabeledTokens were a bad idea. I've just + turned them off rather than backpatching the code. Who knows? We + may need them in the future. + */ +int DontCopyTokens = 1; /* in C++, don't copy ANTLRToken passed to ANTLR */ + +/* Remember if LT(i), LA(i), or LATEXT(i) used in an action which is not + a predicate. If so, give a warning for novice users. +*/ + +int LTinTokenAction = 0; /* MR23 */ +int PURIFY = 1; /* MR23 */ + +int CurBlockID_array[MAX_BLK_LEVEL]; /* MR23 */ +int CurAltNum_array[MAX_BLK_LEVEL]; /* MR23 */ diff --git a/pccts/antlr/hash.c b/pccts/antlr/hash.c new file mode 100644 index 0000000..083f941 --- /dev/null +++ b/pccts/antlr/hash.c @@ -0,0 +1,221 @@ +/* + * hash.c + * + * Manage hash tables. + * + * The following functions are visible: + * + * char *mystrdup(char *); Make space and copy string + * Entry **newHashTable(); Create and return initialized hash table + * Entry *hash_add(Entry **, char *, Entry *) + * Entry *hash_get(Entry **, char *) + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2001 + */ + +#include <stdio.h> +#include "pcctscfg.h" +#include "hash.h" + +#ifdef __USE_PROTOS +#include <stdlib.h> +#else +#ifdef VAXC +#include <stdlib.h> +#else +#include <malloc.h> +#endif +#endif +#include <string.h> + +#define StrSame 0 + +#define fatal(err) \ + {fprintf(stderr, "%s(%d):", __FILE__, __LINE__); \ + fprintf(stderr, " %s\n", err); exit(PCCTS_EXIT_FAILURE);} +#define require(expr, err) {if ( !(expr) ) fatal(err);} + +static unsigned size = HashTableSize; +static char *strings = NULL; +static char *strp; +static unsigned strsize = StrTableSize; + +/* create the hash table and string table for terminals (string table only once) */ +Entry ** +#ifdef __USE_PROTOS +newHashTable( void ) +#else +newHashTable( ) +#endif +{ + Entry **table; + + table = (Entry **) calloc(size, sizeof(Entry *)); + require( table != NULL, "cannot allocate hash table"); + if ( strings == NULL ) + { + strings = (char *) calloc(strsize, sizeof(char)); + require( strings != NULL, "cannot allocate string table"); + strp = strings; + } + return table; +} + +void +#ifdef __USE_PROTOS +killHashTable( Entry **table ) +#else +killHashTable( table ) +Entry **table; +#endif +{ + /* for now, just free table, forget entries */ + free( (char *) table ); /* MR10 cast */ +} + +/* Given a table, add 'rec' with key 'key' (add to front of list). return ptr to entry */ +Entry * +#ifdef __USE_PROTOS +hash_add( Entry **table, char *key, Entry *rec ) +#else +hash_add( table, key, rec ) +Entry **table; +char *key; +Entry *rec; +#endif +{ + unsigned h=0; + char *p=key; + require(table!=NULL && key!=NULL && rec!=NULL, "add: invalid addition"); + + Hash(p,h,size); + rec->next = table[h]; /* Add to singly-linked list */ + table[h] = rec; + return rec; +} + +/* Return ptr to 1st entry found in table under key (return NULL if none found) */ +Entry * +#ifdef __USE_PROTOS +hash_get( Entry **table, char *key ) +#else +hash_get( table, key ) +Entry **table; +char *key; +#endif +{ + unsigned h=0; + char *p=key; + Entry *q; +/* require(table!=NULL && key!=NULL, "get: invalid table and/or key");*/ + if ( !(table!=NULL && key!=NULL) ) *((char *) 34) = 3; + + Hash(p,h,size); + for (q = table[h]; q != NULL; q = q->next) + { + if ( strcmp(key, q->str) == StrSame ) return( q ); + } + return( NULL ); +} + +#ifdef DEBUG_HASH +void +#ifdef __USE_PROTOS +hashStat( Entry **table ) +#else +hashStat( table ) +Entry **table; +#endif +{ + static unsigned short count[20]; + int i,n=0,low=0, hi=0; + Entry **p; + float avg=0.0; + + for (i=0; i<20; i++) count[i] = 0; + for (p=table; p<&(table[size]); p++) + { + Entry *q = *p; + int len; + + if ( q != NULL && low==0 ) low = p-table; + len = 0; + if ( q != NULL ) fprintf(stderr, "[%d]", p-table); + while ( q != NULL ) + { + len++; + n++; + fprintf(stderr, " %s", q->str); + q = q->next; + if ( q == NULL ) fprintf(stderr, "\n"); + } + count[len]++; + if ( *p != NULL ) hi = p-table; + } + + fprintf(stderr, "Storing %d recs used %d hash positions out of %d\n", + n, size-count[0], size); + fprintf(stderr, "%f %% utilization\n", + ((float)(size-count[0]))/((float)size)); + for (i=0; i<20; i++) + { + if ( count[i] != 0 ) + { + avg += (((float)(i*count[i]))/((float)n)) * i; + fprintf(stderr, "Bucket len %d == %d (%f %% of recs)\n", + i, count[i], ((float)(i*count[i]))/((float)n)); + } + } + fprintf(stderr, "Avg bucket length %f\n", avg); + fprintf(stderr, "Range of hash function: %d..%d\n", low, hi); +} +#endif + +/* Add a string to the string table and return a pointer to it. + * Bump the pointer into the string table to next avail position. + */ +char * +#ifdef __USE_PROTOS +mystrdup( char *s ) +#else +mystrdup( s ) +char *s; +#endif +{ + char *start=strp; + require(s!=NULL, "mystrdup: NULL string"); + + while ( *s != '\0' ) + { + require( strp <= &(strings[strsize-2]), + "string table overflow\nIncrease StrTableSize in hash.h and recompile hash.c\n"); + *strp++ = *s++; + } + *strp++ = '\0'; + + return( start ); +} diff --git a/pccts/antlr/hash.h b/pccts/antlr/hash.h new file mode 100644 index 0000000..8295c2c --- /dev/null +++ b/pccts/antlr/hash.h @@ -0,0 +1,73 @@ +/* + * hash.h -- define hash table entries, sizes, hash function... + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2001 + */ + + /* H a s h T a b l e S t u f f */ + +#ifndef HashTableSize +#define HashTableSize 553 +#endif + +#ifndef StrTableSize +#ifdef PC32 +#define StrTableSize 1000000 +#endif +#endif + +#ifndef StrTableSize +#ifdef PC +#define StrTableSize 655200 +#endif +#endif + +#ifndef StrTableSize +#define StrTableSize 1000000 +#endif + +typedef struct _entry { /* Minimum hash table entry -- superclass */ + char *str; + struct _entry *next; + } Entry; + +/* Hash 's' using 'size', place into h (s is modified) */ +#define Hash(s,h,size) \ + {while ( *s != '\0' ) h = (h<<1) + *s++; \ + h %= size;} + +#ifdef __USE_PROTOS +Entry *hash_get(Entry **, char *), + **newHashTable(void), + *hash_add(Entry **, char *, Entry *); + +void killHashTable(Entry **); + +#else +Entry *hash_get(), **newHashTable(), *hash_add(); +void killHashTable(); /* MR9 23-Sep-97 */ +#endif diff --git a/pccts/antlr/lex.c b/pccts/antlr/lex.c new file mode 100644 index 0000000..21fcc2e --- /dev/null +++ b/pccts/antlr/lex.c @@ -0,0 +1,878 @@ +/* + * lex.c -- Generate all of the lexical type files: parser.dlg tokens.h + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2001 + */ + +#include <stdio.h> +#include <ctype.h> +/* MR1 */ +/* MR1 10-Apr-97 MR1 Replace use of __STDC__ with __USE_PROTOS */ +/* MR1 */ +#include "pcctscfg.h" +#include "set.h" +#include "syn.h" +#include "hash.h" +#include "generic.h" + +#define DLGErrorString "invalid token" + +/* Generate a complete lexical description of the lexemes found in the grammar */ +void +#ifdef __USE_PROTOS +genLexDescr( void ) +#else +genLexDescr( ) +#endif +{ + ListNode *p; + FILE *dlgFile = fopen(OutMetaName(DlgFileName), "w"); + require(dlgFile!=NULL, eMsg1("genLexFile: cannot open %s", OutMetaName(DlgFileName)) ); +#ifdef SPECIAL_FOPEN + special_fopen_actions(OutMetaName(DlgFileName)); /* MR1 */ +#endif + fprintf(dlgFile, "<<\n"); + fprintf(dlgFile, "/* %s -- DLG Description of scanner\n", DlgFileName); + fprintf(dlgFile, " *\n"); + fprintf(dlgFile, " * Generated from:"); + {int i; for (i=0; i<NumFiles; i++) fprintf(dlgFile, " %s", FileStr[i]);} + fprintf(dlgFile, "\n"); + fprintf(dlgFile, " *\n"); + fprintf(dlgFile, " * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001\n"); + fprintf(dlgFile, " * Purdue University Electrical Engineering\n"); + fprintf(dlgFile, " * With AHPCRC, University of Minnesota\n"); + fprintf(dlgFile, " * ANTLR Version %s\n", Version); + fprintf(dlgFile, " */\n\n"); + if (FirstAction != NULL ) dumpAction( FirstAction, dlgFile, 0, -1, 0, 1 ); /* MR11 MR15b */ + fprintf(dlgFile, "#define ANTLR_VERSION %s\n", VersionDef); + if ( GenCC ) + { + if ( !UserDefdTokens ) fprintf(dlgFile, "#include \"%s\"\n", DefFileName); + else fprintf(dlgFile, "#include %s\n", UserTokenDefsFile); + fprintf(dlgFile, "#include \"%s\"\n", ATOKEN_H); + if ( GenAST ) fprintf(dlgFile, "#include \"%s\"\n", ASTBASE_H); + if ( HdrAction != NULL ) dumpAction( HdrAction, dlgFile, 0, -1, 0, 1 ); + } + else + { + fprintf(dlgFile, "#include \"pcctscfg.h\"\n"); + fprintf(dlgFile, "#include \"pccts_stdio.h\"\n"); + if ( strcmp(ParserName, DefaultParserName)!=0 ) + fprintf(dlgFile, "#define %s %s\n", DefaultParserName, ParserName); + if ( strcmp(ParserName, DefaultParserName)!=0 ) + fprintf(dlgFile, "#include \"%s\"\n", RemapFileName); + if ( HdrAction != NULL ) dumpAction( HdrAction, dlgFile, 0, -1, 0, 1 ); + if ( FoundGuessBlk ) + { + fprintf(dlgFile, "#define ZZCAN_GUESS\n"); + fprintf(dlgFile, "#include \"pccts_setjmp.h\"\n"); + } + if ( OutputLL_k > 1 ) fprintf(dlgFile, "#define LL_K %d\n", OutputLL_k); + if ( DemandLookahead ) fprintf(dlgFile, "#define DEMAND_LOOK\n"); + if (TraceGen) { + fprintf(dlgFile,"#ifndef zzTRACE_RULES\n"); /* MR20 */ + fprintf(dlgFile,"#define zzTRACE_RULES\n"); /* MR20 */ + fprintf(dlgFile,"#endif\n"); /* MR22 */ + }; + fprintf(dlgFile, "#include \"antlr.h\"\n"); + if ( GenAST ) { + fprintf(dlgFile, "#include \"ast.h\"\n"); + } + if ( UserDefdTokens ) + fprintf(dlgFile, "#include %s\n", UserTokenDefsFile); + /* still need this one as it has the func prototypes */ + fprintf(dlgFile, "#include \"%s\"\n", DefFileName); + fprintf(dlgFile, "#include \"dlgdef.h\"\n"); + fprintf(dlgFile, "LOOKAHEAD\n"); + fprintf(dlgFile, "\n"); + fprintf(dlgFile, "void\n"); + fprintf(dlgFile, "#ifdef __USE_PROTOS\n"); + fprintf(dlgFile, "zzerraction(void)\n"); + fprintf(dlgFile, "#else\n"); + fprintf(dlgFile, "zzerraction()\n"); + fprintf(dlgFile, "#endif\n"); + fprintf(dlgFile, "{\n"); + fprintf(dlgFile, "\t(*zzerr)(\"%s\");\n", DLGErrorString); + fprintf(dlgFile, "\tzzadvance();\n"); + fprintf(dlgFile, "\tzzskip();\n"); + fprintf(dlgFile, "}\n"); + } + fprintf(dlgFile, ">>\n\n"); + + /* dump all actions */ + +/* MR1 */ +/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */ +/* MR1 via <<%%lexmember ....>> & <<%%lexprefix ...>> */ +/* MR1 */ + if (LexActions != NULL) { + for (p = LexActions->next; p!=NULL; p=p->next) + { +/* MR1 */ fprintf(dlgFile, "<<%%%%lexaction\n"); + dumpAction( (char *)p->elem, dlgFile, 0, -1, 0, 1 ); + fprintf(dlgFile, ">>\n\n"); + } + }; + +/* MR1 */ if (GenCC) { +/* MR1 */ fprintf(dlgFile,"<<%%%%parserclass %s>>\n\n",CurrentClassName); +/* MR1 */ }; + +/* MR1 */ if (LexPrefixActions != NULL) { +/* MR1 */ for (p = LexPrefixActions->next; p!=NULL; p=p->next) +/* MR1 */ { +/* MR1 */ fprintf(dlgFile, "<<%%%%lexprefix\n"); +/* MR1 */ dumpAction( (char *)p->elem, dlgFile, 0, -1, 0, 1 ); +/* MR1 */ fprintf(dlgFile, ">>\n\n"); +/* MR1 */ } +/* MR1 */ }; + +/* MR1 */ if (LexMemberActions != NULL) { +/* MR1 */ for (p = LexMemberActions->next; p!=NULL; p=p->next) +/* MR1 */ { +/* MR1 */ fprintf(dlgFile, "<<%%%%lexmember\n"); +/* MR1 */ dumpAction( (char *)p->elem, dlgFile, 0, -1, 0, 1 ); +/* MR1 */ fprintf(dlgFile, ">>\n\n"); +/* MR1 */ } +/* MR1 */ }; + + /* dump all regular expression rules/actions (skip sentinel node) */ + if ( ExprOrder == NULL ) { + warnNoFL("no regular expressions found in grammar"); + } + else dumpLexClasses(dlgFile); + fprintf(dlgFile, "%%%%\n"); + fclose( dlgFile ); +} + +/* For each lexical class, scan ExprOrder looking for expressions + * in that lexical class. Print out only those that match. + * Each element of the ExprOrder list has both an expr and an lclass + * field. + */ +void +#ifdef __USE_PROTOS +dumpLexClasses( FILE *dlgFile ) +#else +dumpLexClasses( dlgFile ) +FILE *dlgFile; +#endif +{ + int i; + TermEntry *t; + ListNode *p; + Expr *q; + + for (i=0; i<NumLexClasses; i++) + { + fprintf(dlgFile, "\n%%%%%s\n\n", lclass[i].classnum); + for (p=ExprOrder->next; p!=NULL; p=p->next) + { + q = (Expr *) p->elem; + if ( q->lclass != i ) continue; + lexmode(i); + t = (TermEntry *) hash_get(Texpr, q->expr); + require(t!=NULL, eMsg1("genLexDescr: rexpr %s not in hash table",q->expr) ); + if ( t->token == EpToken ) continue; + fprintf(dlgFile, "%s\n\t<<\n", StripQuotes(q->expr)); + /* replace " killed by StripQuotes() */ + q->expr[ strlen(q->expr) ] = '"'; + if ( !GenCC ) { + if ( TokenString(t->token) != NULL ) + fprintf(dlgFile, "\t\tNLA = %s;\n", TokenString(t->token)); + else + fprintf(dlgFile, "\t\tNLA = %d;\n", t->token); + } + if ( t->action != NULL ) dumpAction( t->action, dlgFile, 2,-1,0,1 ); + if ( GenCC ) { + if ( TokenString(t->token) != NULL ) + fprintf(dlgFile, "\t\treturn %s;\n", TokenString(t->token)); + else + fprintf(dlgFile, "\t\treturn (ANTLRTokenType)%d;\n", t->token); + } + fprintf(dlgFile, "\t>>\n\n"); + } + } +} + +/* Strip the leading path (if any) from a filename */ +char * +#ifdef __USE_PROTOS +StripPath( char *fileName ) +#else +StripPath( fileName ) +char *fileName; +#endif +{ + char *p; + static char dirSym[2] = DirectorySymbol; + + if(NULL != (p = strrchr(fileName, dirSym[0]))) + p++; + else + p = fileName; + + return(p); +} + +/* Generate a list of #defines && list of struct definitions for + * aggregate retv's */ +void +#ifdef __USE_PROTOS +genDefFile( void ) +#else +genDefFile( ) +#endif +{ + int i; + + /* If C++ mode and #tokdef used, then don't need anything in here since + * C++ puts all definitions in the class file name. + */ + if ( GenCC && UserTokenDefsFile ) return; + if ( MR_Inhibit_Tokens_h_Gen) return; + + DefFile = fopen(OutMetaName(DefFileName), "w"); + require(DefFile!=NULL, eMsg1("genDefFile: cannot open %s", OutMetaName(DefFileName)) ); +#ifdef SPECIAL_FOPEN + special_fopen_actions(OutMetaName(DefFileName)); /* MR1 */ +#endif + fprintf(DefFile, "#ifndef %s\n", StripPath(gate_symbol(DefFileName))); + fprintf(DefFile, "#define %s\n", StripPath(gate_symbol(DefFileName))); + + fprintf(DefFile, "/* %s -- List of labelled tokens and stuff\n", DefFileName); + fprintf(DefFile, " *\n"); + fprintf(DefFile, " * Generated from:"); + for (i=0; i<NumFiles; i++) fprintf(DefFile, " %s", FileStr[i]); + fprintf(DefFile, "\n"); + fprintf(DefFile, " *\n"); + fprintf(DefFile, " * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001\n"); + fprintf(DefFile, " * Purdue University Electrical Engineering\n"); + fprintf(DefFile, " * ANTLR Version %s\n", Version); + fprintf(DefFile, " */\n"); + + if ( !GenCC && LexGen ) { + fprintf(DefFile,"#define zzEOF_TOKEN %d\n", + TokenInd!=NULL?TokenInd[EofToken]:EofToken); + } + + if ( !UserDefdTokens ) + { + int first=1; + + if ( GenCC ) fprintf(DefFile, "enum ANTLRTokenType {\n"); + for (i=1; i<TokenNum; i++) + { + /* Don't do EpToken or expr w/o labels */ + if ( TokenString(i)!=NULL && i != EpToken ) + { + TermEntry *p; + + if ( WarningLevel>1 ) + { + int j; + /* look in all lexclasses for the reg expr */ + +/* MR10 Derek Pappas */ +/* MR10 A #tokclass doesn't have associated regular expressiones */ +/* MR10 so don't warn user about it's omission */ + + p = (TermEntry *) hash_get(Tname, TokenString(i)); + + if (p != NULL && ! p->classname) { + for (j=0; j<NumLexClasses; j++) + { + lexmode(j); + if ( ExprString(i)!=NULL ) break; + } + if ( j>=NumLexClasses ) + { + warnNoFL(eMsg1("token label has no associated rexpr: %s",TokenString(i))); + } + }; + } + require((p=(TermEntry *)hash_get(Tname, TokenString(i))) != NULL, + "token not in sym tab when it should be"); + if ( !p->classname ) + { + if ( GenCC ) { + if ( !first ) fprintf(DefFile, ",\n"); + first = 0; + fprintf(DefFile, "\t%s=%d", TokenString(i), i); + } + else + fprintf(DefFile, "#define %s %d\n", TokenString(i), i); + } + } + } +/* MR1 */ +/* MR1 10-Apr-97 133MR1 Prevent use of varying sizes of integer */ +/* MR1 for the enum ANTLRTokenType */ +/* MR1 */ + if ( GenCC ) { /* MR1 */ + if ( !first ) fprintf(DefFile, ",\n"); /* MR14 */ + fprintf(DefFile, "\tDLGminToken=0"); /* MR1 */ + fprintf(DefFile, ",\n\tDLGmaxToken=9999};\n"); /* MR1 */ + }; /* MR1 */ + } + + if ( !GenCC ) GenRulePrototypes(DefFile, SynDiag); + + fprintf(DefFile, "\n#endif\n"); +} + +void +#ifdef __USE_PROTOS +GenRemapFile( void ) +#else +GenRemapFile( ) +#endif +{ + if ( strcmp(ParserName, DefaultParserName)!=0 ) + { + FILE *f; + int i; + + f = fopen(OutMetaName(RemapFileName), "w"); + require(f!=NULL, eMsg1("GenRemapFile: cannot open %s", OutMetaName(RemapFileName)) ); +#ifdef SPECIAL_FOPEN + special_fopen_actions(OutMetaName(RemapFileName)); /* MR1 */ +#endif + fprintf(f, "/* %s -- List of symbols to remap\n", RemapFileName); + fprintf(f, " *\n"); + fprintf(f, " * Generated from:"); + for (i=0; i<NumFiles; i++) fprintf(f, " %s", FileStr[i]); + fprintf(f, "\n"); + fprintf(f, " *\n"); + fprintf(f, " * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001\n"); + fprintf(f, " * Purdue University Electrical Engineering\n"); + fprintf(f, " * ANTLR Version %s\n", Version); + fprintf(f, " */\n"); + + GenRuleFuncRedefs(f, SynDiag); + GenPredefinedSymbolRedefs(f); + if ( GenAST ) GenASTSymbolRedefs(f); + GenSetRedefs(f); + + fclose(f); + } +} + +/* Generate a bunch of #defines that rename all functions to be "ParserName_func" */ +void +#ifdef __USE_PROTOS +GenRuleFuncRedefs( FILE *f, Junction *p ) +#else +GenRuleFuncRedefs( f, p ) +FILE *f; +Junction *p; +#endif +{ + fprintf(f, "\n/* rename rule functions to be 'ParserName_func' */\n"); + while ( p!=NULL ) + { + fprintf(f, "#define %s %s_%s\n", p->rname, ParserName, p->rname); + p = (Junction *)p->p2; + } +} + +/* Generate a bunch of #defines that rename all standard symbols to be + * "ParserName_symbol". The list of standard symbols to change is in + * globals.c. + */ +void +#ifdef __USE_PROTOS +GenPredefinedSymbolRedefs( FILE *f ) +#else +GenPredefinedSymbolRedefs( f ) +FILE *f; +#endif +{ + char **p; + + fprintf(f, "\n/* rename PCCTS-supplied symbols to be 'ParserName_symbol' */\n"); + for (p = &StandardSymbols[0]; *p!=NULL; p++) + { + fprintf(f, "#define %s %s_%s\n", *p, ParserName, *p); + } +} + +/* Generate a bunch of #defines that rename all AST symbols to be + * "ParserName_symbol". The list of AST symbols to change is in + * globals.c. + */ +void +#ifdef __USE_PROTOS +GenASTSymbolRedefs( FILE *f ) +#else +GenASTSymbolRedefs( f ) +FILE *f; +#endif +{ + char **p; + + fprintf(f, "\n/* rename PCCTS-supplied AST symbols to be 'ParserName_symbol' */\n"); + for (p = &ASTSymbols[0]; *p!=NULL; p++) + { + fprintf(f, "#define %s %s_%s\n", *p, ParserName, *p); + } +} + +/* redefine all sets generated by ANTLR; WARNING: 'zzerr', 'setwd' must match + * use in bits.c (DumpSetWd() etc...) + */ +void +#ifdef __USE_PROTOS +GenSetRedefs( FILE *f ) +#else +GenSetRedefs( f ) +FILE *f; +#endif +{ + int i; + + for (i=1; i<=wordnum; i++) + { + fprintf(f, "#define setwd%d %s_setwd%d\n", i, ParserName, i); + } + for (i=1; i<=esetnum; i++) + { + fprintf(f, "#define zzerr%d %s_err%d\n", i, ParserName, i); + } +} + +/* Find all return types/parameters that require structs and def + * all rules with ret types. + * + * This is for the declaration, not the definition. + */ +void +#ifdef __USE_PROTOS +GenRulePrototypes( FILE *f, Junction *p ) +#else +GenRulePrototypes( f, p ) +FILE *f; +Junction *p; +#endif +{ + int i; + + i = 1; + while ( p!=NULL ) + { + if ( p->ret != NULL ) + { +/* MR23 */ if ( hasMultipleOperands(p->ret) ) + { + DumpRetValStruct(f, p->ret, i); + } + fprintf(f, "\n#ifdef __USE_PROTOS\n"); +/* MR23 */ if ( hasMultipleOperands(p->ret) ) + { + fprintf(f, "extern struct _rv%d", i); + } + else + { + fprintf(f, "extern "); + DumpType(p->ret, f); + } + fprintf(f, " %s%s(", RulePrefix, p->rname); + DumpANSIFunctionArgDef(f,p,1 /* emit initializers ? */); + fprintf(f, ";\n"); + fprintf(f, "#else\n"); +/* MR23 */ if ( hasMultipleOperands(p->ret) ) + { + fprintf(f, "extern struct _rv%d", i); + } + else + { + fprintf(f, "extern "); + DumpType(p->ret, f); + } + fprintf(f, " %s%s();\n", RulePrefix, p->rname); + fprintf(f, "#endif\n"); + } + else + { + fprintf(f, "\n#ifdef __USE_PROTOS\n"); + fprintf(f, "void %s%s(", RulePrefix, p->rname); + DumpANSIFunctionArgDef(f,p, 1 /* emit initializers ? */ ); + fprintf(f, ";\n"); +#ifdef OLD + if ( p->pdecl != NULL || GenAST ) + { + if ( GenAST ) { + fprintf(f, "AST **%s",(p->pdecl!=NULL)?",":""); + } + if ( p->pdecl!=NULL ) fprintf(f, "%s", p->pdecl); + } + else fprintf(f, "void"); + fprintf(f, ");\n"); +#endif + fprintf(f, "#else\n"); + fprintf(f, "extern void %s%s();\n", RulePrefix, p->rname); + fprintf(f, "#endif\n"); + } + i++; + p = (Junction *)p->p2; + } +} + +/* Define all rules in the class.h file; generate any required + * struct definitions first, however. + */ +void +#ifdef __USE_PROTOS +GenRuleMemberDeclarationsForCC( FILE *f, Junction *q ) +#else +GenRuleMemberDeclarationsForCC( f, q ) +FILE *f; +Junction *q; +#endif +{ + Junction *p = q; + int i; + + fprintf(f, "private:\n"); + + /* Dump dflt handler declaration */ + fprintf(f, "\tvoid zzdflthandlers( int _signal, int *_retsignal );\n\n"); + + fprintf(f, "public:\n"); + + /* Dump return value structs */ + i = 1; + while ( p!=NULL ) + { + if ( p->ret != NULL ) + { +/* MR23 */ if ( hasMultipleOperands(p->ret) ) + { + DumpRetValStruct(f, p->ret, i); + } + } + i++; + p = (Junction *)p->p2; + } + + /* Dump member func defs && CONSTRUCTOR */ + fprintf(f, "\t%s(ANTLRTokenBuffer *input);\n", CurrentClassName); +/* + fprintf(f, "\t%s(ANTLRTokenBuffer *input, ANTLRTokenType eof);\n", + CurrentClassName); +*/ + + i = 1; + p = q; + while ( p!=NULL ) + { + if ( p->ret != NULL ) + { +/* MR23 */ if ( hasMultipleOperands(p->ret) ) + { + fprintf(f, "\tstruct _rv%d", i); + } + else + { + fprintf(f, "\t"); + DumpType(p->ret, f); + } + fprintf(f, " %s%s(",RulePrefix,p->rname); + DumpANSIFunctionArgDef(f,p, 1 /* emit initializers ? */ ); + fprintf(f, ";\n"); +#ifdef OLD + if ( p->pdecl != NULL || GenAST ) + { + if ( GenAST ) fprintf(f, "ASTBase **%s",(p->pdecl!=NULL)?",":""); + if ( p->pdecl!=NULL ) fprintf(f, "%s", p->pdecl); + } + fprintf(f, ");\n"); +#endif + } + else + { + fprintf(f, "\tvoid %s%s(",RulePrefix,p->rname); + DumpANSIFunctionArgDef(f,p, 1 /* emit initializers ? */); + fprintf(f, ";\n"); +#ifdef OLD + if ( p->pdecl != NULL || GenAST ) + { + if ( GenAST ) fprintf(f, "ASTBase **%s",(p->pdecl!=NULL)?",":""); + if ( p->pdecl!=NULL ) fprintf(f, "%s", p->pdecl); + } + fprintf(f, ");\n"); +#endif + } + i++; + p = (Junction *)p->p2; + } +} + +/* Given a list of ANSI-style parameter declarations, print out a + * comma-separated list of the symbols (w/o types). + * Basically, we look for a comma, then work backwards until start of + * the symbol name. Then print it out until 1st non-alnum char. Now, + * move on to next parameter. + * + */ + +/* MR5 Jan Mikkelsen 26-May-97 - added initalComma parameter */ + +void +#ifdef __USE_PROTOS +DumpListOfParmNames(char *pdecl, FILE *output, int initialComma) /* MR5 */ +#else +DumpListOfParmNames(pdecl, output, initialComma) /* MR5 */ +char *pdecl; /* MR5 */ +FILE *output; /* MR5 */ +int initialComma; /* MR5 */ +#endif +{ + int firstTime = 1, done = 0; + require(output!=NULL, "DumpListOfParmNames: NULL parm"); + + if ( pdecl == NULL ) return; + while ( !done ) + { + if ( !firstTime || initialComma ) putc(',', output); /* MR5 */ + done = DumpNextNameInDef(&pdecl, output); + firstTime = 0; + } +} + +/* given a list of parameters or return values, dump the next + * name to output. Return 1 if last one just printed, 0 if more to go. + */ + +/* MR23 Total rewrite */ + +int +#ifdef __USE_PROTOS +DumpNextNameInDef( char **q, FILE *output ) +#else +DumpNextNameInDef( q, output ) +char **q; +FILE *output; +#endif +{ + char *p; + char *t; + char *pDataType; + char *pSymbol; + char *pEqualSign; + char *pValue; + char *pSeparator; + int nest = 0; + + p = endFormal(*q, + &pDataType, + &pSymbol, + &pEqualSign, + &pValue, + &pSeparator, + &nest); + + /* MR26 Handle rule arguments such as: IIR_Bool (IIR_Decl::*contstraint)() + For this we need to strip off anything which follows the symbol. + */ + +/* MR26 */ t = pSymbol; +/* MR26 */ if (t != NULL) { +/* MR26 */ for (t = pSymbol; *t != 0; t++) { +/* MR26 */ if (! (isalpha(*t) || isdigit(*t) || *t == '_' || *t == '$')) break; +/* MR26 */ } +/* MR26 */ } +/* MR26 */ fprintf(output,strBetween(pSymbol, t, pSeparator)); + + *q = p; + return (*pSeparator == 0); +} + +/* Given a list of ANSI-style parameter declarations, dump K&R-style + * declarations, one per line for each parameter. Basically, convert + * comma to semi-colon, newline. + */ +void +#ifdef __USE_PROTOS +DumpOldStyleParms( char *pdecl, FILE *output ) +#else +DumpOldStyleParms( pdecl, output ) +char *pdecl; +FILE *output; +#endif +{ + require(output!=NULL, "DumpOldStyleParms: NULL parm"); + + if ( pdecl == NULL ) return; + while ( *pdecl != '\0' ) + { + if ( *pdecl == ',' ) + { + pdecl++; + putc(';', output); putc('\n', output); + while ( *pdecl==' ' || *pdecl=='\t' || *pdecl=='\n' ) pdecl++; + } + else {putc(*pdecl, output); pdecl++;} + } + putc(';', output); + putc('\n', output); +} + +/* Take in a type definition (type + symbol) and print out type only */ +/* MR23 Total rewrite */ + +void +#ifdef __USE_PROTOS +DumpType( char *s, FILE *f ) +#else +DumpType( s, f ) +char *s; +FILE *f; +#endif +{ + char *p; + char *pDataType; + char *pSymbol; + char *pEqualSign; + char *pValue; + char *pSeparator; + int nest = 0; + + require(s!=NULL, "DumpType: invalid type string"); + + p = endFormal(s, + &pDataType, + &pSymbol, + &pEqualSign, + &pValue, + &pSeparator, + &nest); + fprintf(f,strBetween(pDataType, pSymbol, pSeparator)); +} + +/* check to see if string e is a word in string s */ +int +#ifdef __USE_PROTOS +strmember( char *s, char *e ) +#else +strmember( s, e ) +char *s; +char *e; +#endif +{ + register char *p; + require(s!=NULL&&e!=NULL, "strmember: NULL string"); + + if ( *e=='\0' ) return 1; /* empty string is always member */ + do { + while ( *s!='\0' && !isalnum(*s) && *s!='_' ) + ++s; + p = e; + while ( *p!='\0' && *p==*s ) {p++; s++;} + if ( *p=='\0' ) { + if ( *s=='\0' ) return 1; + if ( !isalnum (*s) && *s != '_' ) return 1; + } + while ( isalnum(*s) || *s == '_' ) + ++s; + } while ( *s!='\0' ); + return 0; +} + +#if 0 + +/* MR23 Replaced by hasMultipleOperands() */ + +int +#ifdef __USE_PROTOS +HasComma( char *s ) +#else +HasComma( s ) +char *s; +#endif +{ + while (*s!='\0') + if ( *s++ == ',' ) return 1; + return 0; +} +#endif + + +/* MR23 Total rewrite */ + +void +#ifdef __USE_PROTOS +DumpRetValStruct( FILE *f, char *ret, int i ) +#else +DumpRetValStruct( f, ret, i ) +FILE *f; +char *ret; +int i; +#endif +{ + char *p = ret; + char *pDataType; + char *pSymbol; + char *pEqualSign; + char *pValue; + char *pSeparator; + int nest = 0; + + fprintf(f, "\nstruct _rv%d {\n", i); + while (*p != 0 && nest == 0) { + p = endFormal(p, + &pDataType, + &pSymbol, + &pEqualSign, + &pValue, + &pSeparator, + &nest); + fprintf(f,"\t"); + fprintf(f,strBetween(pDataType, pSymbol, pSeparator)); + fprintf(f," "); + fprintf(f,strBetween(pSymbol, pEqualSign, pSeparator)); + fprintf(f,";\n"); + } + fprintf(f,"};\n"); +} + +/* given "s" yield s -- DESTRUCTIVE (we modify s if starts with " else return s) */ +char * +#ifdef __USE_PROTOS +StripQuotes( char *s ) +#else +StripQuotes( s ) +char *s; +#endif +{ + if ( *s == '"' ) + { + s[ strlen(s)-1 ] = '\0'; /* remove last quote */ + return( s+1 ); /* return address past initial quote */ + } + return( s ); +} diff --git a/pccts/antlr/main.c b/pccts/antlr/main.c new file mode 100644 index 0000000..3eb8b9d --- /dev/null +++ b/pccts/antlr/main.c @@ -0,0 +1,1746 @@ +/* + * main.c -- main program for PCCTS ANTLR. + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2001 + */ + +/* To set a breakpoint just before exit look for "cleanUp". */ + +#include <stdio.h> + +#include "pcctscfg.h" +#include "stdpccts.h" + +#define MAX_INT_STACK 50 +static int istack[MAX_INT_STACK]; /* Int stack */ +static int isp = MAX_INT_STACK; + +static int DontAcceptFiles = 0; /* if stdin, don't read files */ +static int DontAcceptStdin = 0; /* if files seen first, don't accept stdin */ + +static int tnodes_used_in_guard_predicates_etc; /* MR10 */ + + /* C m d - L i n e O p t i o n S t r u c t & F u n c s */ + +typedef struct _Opt { + char *option; + int arg; +#ifdef __cplusplus + void (*process)(...); +#else + void (*process)(); +#endif + char *descr; + } Opt; + +#ifdef __USE_PROTOS +extern void ProcessArgs(int, char **, Opt *); +#else +extern void ProcessArgs(); +#endif + +#ifdef __USE_PROTOS +int ci_strequ(char *a,char *b) +#else +int ci_strequ(a,b) + char *a; + char *b; +#endif +{ + for ( ;*a != 0 && *b != 0; a++, b++) { + if (toupper(*a) != toupper(*b)) return 0; + } + return (*a == *b); +} + +static void +#ifdef __USE_PROTOS +pStdin( void ) +#else +pStdin( ) +#endif +{ + if ( DontAcceptStdin ) + { + warnNoFL("'-' (stdin) ignored as files were specified first"); + return; + } + + require(NumFiles<MaxNumFiles,"exceeded max # of input files"); + FileStr[NumFiles++] = "stdin"; + DontAcceptFiles = 1; +} + +static void +#ifdef __USE_PROTOS +pFile( char *s ) +#else +pFile( s ) +char *s; +#endif +{ + if ( *s=='-' ) { warnNoFL( eMsg1("invalid option: '%s'",s) ); return; } + if ( DontAcceptFiles ) + { + warnNoFL(eMsg1("file '%s' ignored as '-' (stdin option) was specified first",s)); + return; + } + + require(NumFiles<MaxNumFiles,"exceeded max # of input files"); + FileStr[NumFiles++] = s; + DontAcceptStdin = 1; +} + +/* MR14 + Allow input to be a file containing a list of files + Bernard Giroud (b_giroud@decus.ch) +*/ + +static void +#ifdef __USE_PROTOS +pFileList( char *s, char *t ) +#else +pFileList( s, t ) +char *s; +char *t; +#endif +{ +#define MaxFLArea 1024 + FILE *fl; + static char Fn_in_Fl[MaxFLArea] = ""; + char one_fn[MaxFileName]; + char *flp = &Fn_in_Fl[0]; + int fnl, left = MaxFLArea, i; + + if ( *t=='-' ) { warnNoFL( eMsg1("invalid option: '%s'",t) ); return; } + if ( DontAcceptFiles ) + { + warnNoFL(eMsg1("file '%s' ignored as '-' (stdin option) was specified first",t)); + return; + } + + if ((fl = fopen(t, "r")) == NULL) + { + warnNoFL(eMsg1("file '%s' can't be opened", t)); + return; + } + for (;;) + { + if (fgets(one_fn, 128 - 1, fl) == NULL) + break; + fnl = strlen(one_fn); + require(fnl<=left, "no more room in File List Area"); + /* drop the trailing LF */ + if (one_fn[fnl - 1] == 0x0a) one_fn[fnl - 1] = ' '; + strcat(Fn_in_Fl, one_fn); + left = left - fnl; + require(NumFiles<MaxNumFiles,"exceeded max # of input files"); + FileStr[NumFiles++] = flp; + flp = flp + fnl; + } + fclose(fl); + for (i=0;i < MaxFLArea;i++) if (Fn_in_Fl[i] == ' ') Fn_in_Fl[i] = '\0'; + DontAcceptStdin = 1; +} + +static void +#ifdef __USE_PROTOS +pLLK( char *s, char *t ) +#else +pLLK( s, t ) +char *s; +char *t; +#endif +{ + LL_k = atoi(t); + if ( LL_k <= 0 ) { + warnNoFL("must have at least one token of lookahead (setting to 1)"); + LL_k = 1; + } +} + +static void +#ifdef __USE_PROTOS +pCk( char *s, char *t ) +#else +pCk( s, t ) +char *s; +char *t; +#endif +{ + CLL_k = atoi(t); + if ( CLL_k <= 0 ) { + warnNoFL("must have at least one token of look-ahead (setting to 1)"); + CLL_k = 1; + } +} + +static void /* MR6 */ +#ifdef __USE_PROTOS +pTab( char *s, char *t ) /* MR6 */ +#else +pTab( s, t ) /* MR6 */ +char *s; /* MR6 */ +char *t; /* MR6 */ +#endif +{ /* MR6 */ + TabWidth = atoi(t); /* MR6 */ + if ( TabWidth < 0 || TabWidth > 8 ) { /* MR6 */ + warnNoFL("tab width must be between 1 and 8"); /* MR6 */ + TabWidth=0; /* MR6 */ + } /* MR6 */ +} /* MR6 */ + +static int ambAidDepthSpecified=0; /* MR11 */ + +static void /* MR11 */ +#ifdef __USE_PROTOS +pAAd( char *s, char *t ) /* MR11 */ +#else +pAAd( s, t ) /* MR11 */ +char *s; /* MR11 */ +char *t; /* MR11 */ +#endif +{ /* MR11 */ + ambAidDepthSpecified=1; /* MR11 */ + MR_AmbAidDepth = atoi(t); /* MR11 */ +} /* MR11 */ + +static void /* MR11 */ +#ifdef __USE_PROTOS +pTreport( char *s, char *t ) /* MR11 */ +#else +pTreport( s, t ) /* MR11 */ + char *s; /* MR11 */ + char *t; /* MR11 */ +#endif +{ /* MR11 */ + TnodesReportThreshold = atoi(t); /* MR11 */ +} /* MR11 */ + +#ifdef __USE_PROTOS +void chkGTFlag(void) /* 7-Apr-97 MR1 */ +#else +void chkGTFlag() /* 7-Apr-97 MR1 */ +#endif +{ + if ( !GenAST ) + warn("#-variable or other AST item referenced w/o -gt option"); +} + + +#ifdef __USE_PROTOS +static void pInfo(char *s, char *t) /* MR10 */ +#else +static void pInfo(s,t) /* MR10 */ + char *s; + char *t; +#endif +{ + char *p; + int q; + for (p=t; *p != 0; p++) { + q=tolower(*p); + if (q=='t') { + InfoT=1; + } else if (q=='p') { + InfoP=1; + } else if (q=='m') { + InfoM=1; + } else if (q=='o') { + InfoO=1; + } else if (q=='0') { + ; /* nothing */ + } else if (q=='f') { + InfoF=1; + } else { + warnNoFL(eMsgd("unrecognized -info option \"%c\"",(int)*p)); + }; + }; +} + +#ifdef __USE_PROTOS +static void pCGen(void) { CodeGen = FALSE; LexGen = FALSE; } +static void pLGen(void) { LexGen = FALSE; } +static void pXTGen(void){ MR_Inhibit_Tokens_h_Gen = TRUE; } +static void pTGen(void) { TraceGen = TRUE; } +static void pSGen(void) { GenExprSetsOpt = FALSE; } +static void pPrt(void) { PrintOut = TRUE; pCGen(); pLGen(); } +static void pPrtA(void) { PrintOut = TRUE; PrintAnnotate = TRUE; pCGen(); pLGen(); } +static void pAst(void) { GenAST = TRUE; } +static void pANSI(void) { GenANSI = TRUE; } +static void pCr(void) { GenCR = TRUE; } +static void pNOPURIFY(void) { PURIFY = FALSE; } +/*static void pCt(void) { warnNoFL("-ct option is now the default"); }*/ +static void pLI(void) { GenLineInfo = TRUE; GenLineInfoMS = FALSE; } /* MR14 */ +static void pLIms(void) { GenLineInfo = TRUE; GenLineInfoMS = TRUE; } /* MR14 */ +static void pFr(char *s, char *t) {RemapFileName = t;} +static void pFe(char *s, char *t) {ErrFileName = t;} +static void pFl(char *s, char *t) {DlgFileName = t;} +static void pFm(char *s, char *t) {ModeFileName = t;} +static void pFt(char *s, char *t) {DefFileName = t;} + +static void pE1(void) { elevel = 1; } +static void pE2(void) { elevel = 2; } +static void pE3(void) { elevel = 3; } +static void pEGen(void) { GenEClasseForRules = 1; } +static void pDL(void) + { + DemandLookahead = 1; + if ( GenCC ) { + warnNoFL("-gk does not work currently in C++ mode; -gk turned off"); + DemandLookahead = 0; + } + } + +static void pAA(char *s,char *t) {MR_AmbAidRule = t;} /* MR11 */ +static void pAAm(char *s){MR_AmbAidMultiple = 1;} /* MR11 */ +static void pGHdr(void) { GenStdPccts = 1; } +static void pFHdr(char *s, char *t) { stdpccts = t; pGHdr(); } +static void pW1(void) { WarningLevel = 1; } +static void pNewAST(void) { NewAST = 1; } /* MR13 */ +static void ptmakeInParser(void) { tmakeInParser = 1; } /* MR23 */ +static void pAlpha(void) { AlphaBetaTrace = 1; } /* MR14 */ +static void pMR_BlkErr(void) { MR_BlkErr = 1; } /* MR21 */ +static void pStdout(void) {UseStdout = 1; } /* MR6 */ +static void pW2(void) { WarningLevel = 2; } +static void pCC(void) { GenCC = TRUE; } +#else +static void pCGen() { CodeGen = FALSE; LexGen = FALSE; } +static void pLGen() { LexGen = FALSE; } +static void pXTGen(){ MR_Inhibit_Tokens_h_Gen = TRUE; } /* MR14 */ +static void pTGen() { TraceGen = TRUE; } +static void pSGen() { GenExprSetsOpt = FALSE; } +static void pPrt() { PrintOut = TRUE; pCGen(); pLGen(); } +static void pPrtA() { PrintOut = TRUE; PrintAnnotate = TRUE; pCGen(); pLGen(); } +static void pAst() { GenAST = TRUE; } +static void pANSI() { GenANSI = TRUE; } +static void pCr() { GenCR = TRUE; } +static void pNOPURIFY() { PURIFY = FALSE; } + +/*static void pCt() { warnNoFL("-ct option is now the default"); }*/ +static void pLI() { GenLineInfo = TRUE; GenLineInfoMS = FALSE; } /* MR14 */ +static void pLIms() { GenLineInfo = TRUE; GenLineInfoMS = TRUE; } /* MR14 */ +static void pFr(s,t) char *s, *t; {RemapFileName = t;} +static void pFe(s,t) char *s, *t; {ErrFileName = t;} +static void pFl(s,t) char *s, *t; {DlgFileName = t;} +static void pFm(s,t) char *s, *t; {ModeFileName = t;} +static void pFt(s,t) char *s, *t; {DefFileName = t;} + +static void pE1() { elevel = 1; } +static void pE2() { elevel = 2; } +static void pE3() { elevel = 3; } +static void pEGen() { GenEClasseForRules = 1; } +static void pDL() + { + DemandLookahead = 1; + if ( GenCC ) { + warnNoFL("-gk does not work currently in C++ mode; -gk turned off"); + DemandLookahead = 0; + } + } + +static void pAA(s,t) char *s; char *t; {MR_AmbAidRule = t;} /* MR11 BJS 20-Mar-98 */ +static void pAAm(s) char *s; {MR_AmbAidMultiple = 1;} /* MR11 BJS 20-Mar-98 */ +static void pGHdr() { GenStdPccts = 1; } +static void pFHdr(s,t) char *s, *t; { stdpccts = t; pGHdr(); } +static void pW1() { WarningLevel = 1; } +static void pNewAST() { NewAST = 1; } /* MR13 */ +static void ptmakeInParser() { tmakeInParser = 1; } /* MR23 */ +static void pAlpha() { AlphaBetaTrace = 1; } /* MR14 */ +static void pMR_BlkErr() { MR_BlkErr = 1; } /* MR21 */ +static void pStdout() {UseStdout = 1; } /* MR6 */ +static void pW2() { WarningLevel = 2; } +static void pCC() { GenCC = TRUE; } +#endif + +static void +#ifdef __USE_PROTOS +pPre( char *s, char *t ) +#else +pPre( s, t ) +char *s; +char *t; +#endif +{ + RulePrefix = t; +} + +static void +#ifdef __USE_PROTOS +pOut( char *s, char *t ) +#else +pOut( s, t ) +char *s; +char *t; +#endif +{ + OutputDirectory = t; +} + +static void +#ifdef __USE_PROTOS +pPred( void ) +#else +pPred( ) +#endif +{ + warnNoFL("-pr is no longer used (predicates employed if present); see -prc, -mrhoist, -mrhoistk"); +/* +** if ( DemandLookahead ) +** warnNoFL("-gk conflicts with -pr; -gk turned off"); +** DemandLookahead = 0; +** HoistPredicateContext = 0; +*/ +} + +static void +#ifdef __USE_PROTOS +pPredCtx( char *s, char *t ) +#else +pPredCtx(s,t) +char *s; +char *t; +#endif +{ + if ( ci_strequ(t,"on")) HoistPredicateContext = 1; + else if ( ci_strequ(t,"off")) HoistPredicateContext = 0; + if ( DemandLookahead ) + { + warnNoFL("-gk incompatible with semantic predicate usage; -gk turned off"); + DemandLookahead = 0; + } +} + +static void +#ifdef __USE_PROTOS +pMRhoist( char *s, char *t ) +#else +pMRhoist(s,t) +char *s; +char *t; +#endif +{ + if ( ci_strequ(t,"on")) MRhoisting = 1; + else if ( ci_strequ(t,"off")==0 ) MRhoisting = 0; + if (MRhoisting) { + fprintf(stderr,"Maintenance Release style hoisting enabled for predicates with lookahead depth = 1\n"); + fprintf(stderr," No longer considered experimental\n"); + fprintf(stderr," Can't consider suppression for predicates with lookahead depth > 1\n"); + fprintf(stderr," Implies -prc on but does *not* imply -mrhoistk for k>1 predicates\n"); + fprintf(stderr," This is a reminder, not a warning or error.\n"); + }; +} + +static void +#ifdef __USE_PROTOS +pMRhoistk( char *s, char *t ) +#else +pMRhoistk(s,t) +char *s; +char *t; +#endif +{ + if ( ci_strequ(t,"on")) MRhoistingk = 1; + else if ( ci_strequ(t,"off")==0 ) MRhoistingk = 0; + if (MRhoistingk) { + fprintf(stderr,"EXPERIMENTAL Maintenance Release style hoisting enabled\n"); + fprintf(stderr," Applies to predicates with lookahead depth > 1\n"); + fprintf(stderr," Implies -prc on and -mrhoist on\n"); + }; +} + +static void +#ifdef __USE_PROTOS +pTRes( char *s, char *t ) +#else +pTRes( s, t ) +char *s; +char *t; +#endif +{ + TreeResourceLimit = atoi(t); + if ( TreeResourceLimit <= 0 ) + { + warnNoFL("analysis resource limit (# of tree nodes) must be greater than 0"); + TreeResourceLimit = -1; /* set to no limit */ + } +} + +Opt options[] = { +#ifdef __cplusplus + { "-CC", 0, (void (*)(...)) pCC, "Generate C++ output (default=FALSE)"}, + { "-ck", 1, (void (*)(...)) pCk, "Set compressed lookahead depth; fast approximate lookahead"}, + { "-cr", 0, (void (*)(...)) pCr, "Generate cross reference (default=FALSE)"}, + { "-e1", 0, (void (*)(...)) pE1, "Ambiguities/errors shown in low detail (default)"}, + { "-e2", 0, (void (*)(...)) pE2, "Ambiguities/errors shown in more detail"}, + { "-e3", 0, (void (*)(...)) pE3, + "Ambiguities for k>1 grammars shown with exact tuples (not lookahead sets)"}, + { "-f", 1, (void (*)(...)) pFileList,"Read names of grammar files from specified file"}, /* MR14 */ + { "-fe", 1, (void (*)(...)) pFe, "Rename err.c"}, + { "-fh", 1, (void (*)(...)) pFHdr, "Rename stdpccts.h header (turns on -gh)"}, + { "-fl", 1, (void (*)(...)) pFl, "Rename lexical output--parser.dlg"}, + { "-fm", 1, (void (*)(...)) pFm, "Rename mode.h"}, + { "-fr", 1, (void (*)(...)) pFr, "Rename remap.h"}, + { "-ft", 1, (void (*)(...)) pFt, "Rename tokens.h"}, + { "-ga", 0, (void (*)(...)) pANSI, "Generate ANSI-compatible code (default=FALSE)"}, + { "-gc", 0, (void (*)(...)) pCGen, "Do not generate output parser code (default=FALSE)"}, + { "-gd", 0, (void (*)(...)) pTGen, "Generate code to trace rule invocation (default=FALSE)"}, + { "-ge", 0, (void (*)(...)) pEGen, "Generate an error class for each non-terminal (default=FALSE)"}, + { "-gh", 0, (void (*)(...)) pGHdr, "Generate stdpccts.h for non-ANTLR-generated-files to include"}, + { "-gk", 0, (void (*)(...)) pDL, "Generate parsers that delay lookahead fetches until needed"}, + { "-gl", 0, (void (*)(...)) pLI, "Generate line info about grammar actions in parser"}, + { "-glms", 0, (void (*)(...)) pLIms,"Like -gl but replace '\\' with '/' in #line filenames for MS C/C++ systems"}, + { "-gp", 1, (void (*)(...)) pPre, "Prefix all generated rule functions with a string"}, + { "-gs", 0, (void (*)(...)) pSGen, "Do not generate sets for token expression lists (default=FALSE)"}, + { "-gt", 0, (void (*)(...)) pAst, "Generate code for Abstract-Syntax-Trees (default=FALSE)"}, + { "-gx", 0, (void (*)(...)) pLGen, "Do not generate lexical (dlg-related) files (default=FALSE)"}, + { "-gxt",0, (void (*)(...)) pXTGen, "Do not generate tokens.h (default=FALSE)"}, + { "-k", 1, (void (*)(...)) pLLK, "Set full LL(k) lookahead depth (default==1)"}, + { "-o", 1, (void (*)(...)) pOut, OutputDirectoryOption}, + { "-p", 0, (void (*)(...)) pPrt, "Print out the grammar w/o actions (default=no)"}, + { "-pa", 0, (void (*)(...)) pPrtA, "Print out the grammar w/o actions & w/FIRST sets (default=no)"}, + { "-pr",0, (void (*)(...)) pPred, "no longer used; predicates employed if present"}, + { "-prc", 1, (void (*)(...)) pPredCtx,"Turn on/off computation of context for hoisted predicates"}, + { "-rl", 1, (void (*)(...)) pTRes, "Limit max # of tree nodes used by grammar analysis"}, + { "-stdout",0, (void (*)(...)) pStdout,"Send grammar.c/grammar.cpp to stdout"}, /* MR6 */ + { "-tab", 1, (void (*)(...)) pTab, "Width of tabs (1 to 8) for grammar.c/grammar.cpp files"}, /* MR6 */ + { "-w1", 0, (void (*)(...)) pW1, "Set the warning level to 1 (default)"}, + { "-w2", 0, (void (*)(...)) pW2, "Ambiguities yield warnings even if predicates or (...)? block"}, + { "-", 0, (void (*)(...)) pStdin, "Read grammar from stdin" }, + { "-mrhoist",1, (void (*)(...)) pMRhoist, /* MR9 */ + "Turn on/off k=1 Maintenance Release style hoisting"}, /* MR9 */ + { "-mrhoistk",1, (void (*)(...)) pMRhoistk, /* MR9 */ + "Turn on/off EXPERIMENTAL k>1 Maintenance Release style hoisting"}, /* MR13 */ + { "-aa" , 1, (void (*)(...)) pAA, "Ambiguity aid for a rule (rule name or line number)"}, /* MR11 */ + { "-aam" , 0, (void (*)(...)) pAAm, + "Lookahead token may appear multiple times in -aa listing"}, /* MR11 */ + { "-aad" , 1, (void (*)(...)) pAAd, + "Limits exp growth of -aa listing - default=1 (max=ck value)"}, /* MR11 */ + { "-info", 1, (void (*)(...)) pInfo, + "Extra info: p=pred t=tnodes f=first/follow m=monitor o=orphans 0=noop"}, /* MR12 */ + { "-treport",1,(void (*)(...)) pTreport, + "Report when tnode usage exceeds value during ambiguity resolution"}, /* MR11 */ + { "-newAST", 0, (void (*)(...)) pNewAST, + "In C++ mode use \"newAST(...)\" rather than \"new AST(...)\""}, /* MR13 */ + { "-tmake", 0, (void (*)(...)) ptmakeInParser, + "In C++ mode use parser's tmake method rather than \"ASTBase::tmake(...)\""}, /* MR23 */ + { "-alpha",0,(void (*)(...)) pAlpha, + "Provide additional information for \"(alpha)? beta\" error messages"}, /* MR14 */ + { "-mrblkerr",0,(void (*)(...)) pMR_BlkErr, /* MR21 */ + "EXPERIMENTAL change to (...)* and (...)+ syntax error sets"}, /* MR21 */ + { "-nopurify",0,(void (*)(...)) pNOPURIFY, + "Don't use the notorious PURIFY macro (replaced by MR23 initial value syntax) to zero return arguments of rules"}, /* MR23 */ + { "*", 0, (void (*)(...)) pFile, "" }, /* anything else is a file */ +#else + { "-CC", 0, pCC, "Generate C++ output (default=FALSE)"}, + { "-cr", 0, pCr, "Generate cross reference (default=FALSE)"}, + { "-ck", 1, pCk, "Set compressed lookahead depth; fast approximate lookahead"}, + { "-e1", 0, pE1, "Ambiguities/errors shown in low detail (default)"}, + { "-e2", 0, pE2, "Ambiguities/errors shown in more detail"}, + { "-e3", 0, pE3, "Ambiguities for k>1 grammars shown with exact tuples (not lookahead sets)"}, + { "-f", 1, pFileList,"Read names of grammar files from specified file"}, /* MR14 */ + { "-fe", 1, pFe, "Rename err.c"}, + { "-fh", 1, pFHdr, "Rename stdpccts.h header (turns on -gh)"}, + { "-fl", 1, pFl, "Rename lexical output--parser.dlg"}, + { "-fm", 1, pFm, "Rename mode.h"}, + { "-fr", 1, pFr, "Rename remap.h"}, + { "-ft", 1, pFt, "Rename tokens.h"}, + { "-ga", 0, pANSI, "Generate ANSI-compatible code (default=FALSE)"}, + { "-gc", 0, pCGen, "Do not generate output parser code (default=FALSE)"}, + { "-gd", 0, pTGen, "Generate code to trace rule invocation (default=FALSE)"}, + { "-ge", 0, pEGen, "Generate an error class for each non-terminal (default=FALSE)"}, + { "-gh", 0, pGHdr, "Generate stdpccts.h for non-ANTLR-generated-files to include"}, + { "-gk", 0, pDL, "Generate parsers that delay lookahead fetches until needed"}, + { "-gl", 0, pLI, "Generate line info about grammar actions in C parser"}, + { "-glms", 0, pLIms,"Like -gl but replace '\\' with '/' in #line filenames for MS C/C++ systems"}, + { "-gp", 1, pPre, "Prefix all generated rule functions with a string"}, + { "-gs", 0, pSGen, "Do not generate sets for token expression lists (default=FALSE)"}, + { "-gt", 0, pAst, "Generate code for Abstract-Syntax-Trees (default=FALSE)"}, + { "-gx", 0, pLGen, "Do not generate lexical (dlg-related) files (default=FALSE)"}, + { "-gxt",0, pXTGen, "Do not generate tokens.h (default=FALSE)"}, + { "-k", 1, pLLK, "Set full LL(k) lookahead depth (default==1)"}, + { "-o", 1, pOut, OutputDirectoryOption}, + { "-p", 0, pPrt, "Print out the grammar w/o actions (default=no)"}, + { "-pa", 0, pPrtA, "Print out the grammar w/o actions & w/FIRST sets (default=no)"}, + { "-pr",0, pPred, "no longer used; predicates employed if present"}, + { "-prc", 1, pPredCtx,"Turn on/off computation of context for hoisted predicates"}, + { "-rl", 1, pTRes, "Limit max # of tree nodes used by grammar analysis"}, + { "-stdout",0, pStdout, "Send grammar.c/grammar.cpp to stdout"}, /* MR6 */ + { "-tab", 1, pTab, "Width of tabs (1 to 8) for grammar.c/grammar.cpp files"}, /* MR6 */ + { "-w1", 0, pW1, "Set the warning level to 1 (default)"}, + { "-w2", 0, pW2, "Ambiguities yield warnings even if predicates or (...)? block"}, + { "-mrhoist",1,pMRhoist, /* MR9 */ + "Turn on/off k=1 Maintenance Release style hoisting"}, /* MR9 */ + { "-mrhoistk",1,pMRhoistk, /* MR13 */ + "Turn on/off k>1 EXPERIMENTAL Maintenance Release style hoisting"}, /* MR13 */ + { "-aa" ,1,pAA, "Ambiguity aid for a rule (rule name or line number)"}, /* MR11 */ + { "-aam" ,0,pAAm, + "Lookahead token may appear multiple times in -aa listing"}, /* MR11 */ + { "-aad" ,1,pAAd, + "Limits exp growth of -aa listing - default=1 (max=ck value)"}, /* MR11 */ + { "-info",1,pInfo, + "Extra info: p=pred t=tnodes f=first/follow m=monitor o=orphans 0=noop"}, /* MR11 */ + { "-treport",1,pTreport, + "Report when tnode usage exceeds value during ambiguity resolution"}, /* MR11 */ + { "-newAST", 0, pNewAST, + "In C++ mode use \"newAST(...)\" rather than \"new AST(...)\""}, /* MR13 */ + { "-tmake", 0, ptmakeInParser, + "In C++ mode use parser's tmake method rather than \"ASTBase::tmake(...)\""}, /* MR23 */ + { "-alpha",0, pAlpha, + "Provide additional information for \"(alpha)? beta\" error messages"}, /* MR14 */ + { "-mrblkerr",0,pMR_BlkErr, /* MR21 */ + "EXPERIMENTAL change to (...)* and (...)+ syntax error sets"}, /* MR21 */ + { "-nopurify",0,pNOPURIFY, + "Don't use the notorious PURIFY macro (replaced by MR23 initial value syntax) to zero return arguments of rules"}, /* MR23 */ + { "-", 0, pStdin, "Read grammar from stdin" }, + { "*", 0, pFile, "" }, /* anything else is a file */ +#endif + { NULL, 0, NULL } + }; + +void readDescr(); +void cleanUp(); + +#ifdef __USE_PROTOS +static void buildRulePtr( void ); +static void help( void ); +static void init( void ); +static void CompleteTokenSetRefs( void ); +static void ensure_no_C_file_collisions(char *); +static void CompleteContextGuards(void); +#else +static void buildRulePtr( ); +static void help( ); +static void init( ); +static void CompleteTokenSetRefs( ); +static void ensure_no_C_file_collisions(); +static void CompleteContextGuards(); +#endif + +static void +#ifdef __USE_PROTOS /* <BJS> */ +report_numericPredLabels(ActionNode *a) +#else +report_numericPredLabels(a) +ActionNode *a; +#endif +{ /* MR10 */ + warnFL("numeric references to attributes (e.g. $i or $i.j) in semantic pred will be null during guess mode", /* MR10 */ + FileStr[a->file],a->line); /* MR10 */ +} /* MR10 */ + + /* M a i n */ + +int +#ifdef __USE_PROTOS +main( int argc, char *argv[] ) +#else +main( argc, argv ) +int argc; +char *argv[]; +#endif +{ + int i; + static char EPSTR[] = "[Ep]"; + + Save_argc=argc; /* MR10 */ + Save_argv=argv; /* MR10 */ + +/* malloc_debug(8);*/ + +#ifdef SPECIAL_INITS + special_inits(); /* MR1 */ +#endif + fprintf(stderr, "Antlr parser generator Version %s 1989-2001\n", Version); + if ( argc == 1 ) { help(); zzDIE; } + ProcessArgs(argc-1, &(argv[1]), options); + +/* MR14 */ if (MR_AmbAidRule && AlphaBetaTrace) { +/* MR14 */ fatal("Can't specify both -aa (ambiguity aid) and -alpha (\"(alpha)? beta\" aid)"); +/* MR14 */ } + + if (MRhoistingk) { /* MR13 */ + HoistPredicateContext=1; /* MR13 */ + MRhoisting=1; /* MR13 */ + }; /* MR13 */ + if (MRhoisting && ! HoistPredicateContext) { +/*** warnNoFL("Using \"-mrhoist\" forces \"-prc on\""); ***/ + HoistPredicateContext=1; + }; + if (HoistPredicateContext && ! MRhoisting) { + warnNoFL("When using predicate context (-prc on) -mrhoist on is recommended"); + } + /* Fix lookahead depth */ + /* Compressed lookahead must always be larger than or equal to full lookahead */ + if ( CLL_k < LL_k && CLL_k>0 ) + { + warnNoFL("must have compressed lookahead >= full LL(k) lookahead (setting -ck to -k)"); + CLL_k = LL_k; + } + if ( CLL_k == -1 ) CLL_k = LL_k; + OutputLL_k = CLL_k; + if ( ((CLL_k-1)&CLL_k)!=0 ) { /* output ll(k) must be power of 2 */ + int n; + for(n=1; n<CLL_k; n<<=1) {;} + OutputLL_k = n; + }; + + if (MR_BlkErr) { + warnNoFL("The -mrblkerr option is EXPERIMENTAL"); + if (LL_k > 1) { + warnNoFL("The -mrblkerr option is designed only for k=1 ck=1 grammars"); + } + }; + + if ( ! ambAidDepthSpecified) { + MR_AmbAidDepth=1; + } else { + if (MR_AmbAidDepth > CLL_k || MR_AmbAidDepth <= 0) { + warnNoFL(eMsgd( + "Ambiguity aid depth (\"-aad ...\") must be a number between 1 and max(k,ck)=%d",CLL_k)); + MR_AmbAidDepth=1; + }; + if (MR_AmbAidDepth == 0) { + MR_AmbAidDepth=2; + }; + }; + + if (MR_AmbAidRule != NULL) MR_AmbAidLine=atoi(MR_AmbAidRule); + + fpTrans = &(C_Trans[0]); /* Translate to C Language */ + fpJTrans = &(C_JTrans[0]); + init(); + lexclass(LexStartSymbol); + + readDescr(); + LastTokenCounted = TokenNum; + RemapForcedTokens(); + if ( CannotContinue ) {cleanUp(); zzDIE;} + if ( GenCC && no_classes_found ) fatal("required grammar class not found (exiting...)"); + if ( WarningLevel>1 && HdrAction == NULL ) + warnNoFL("no #header action was found"); + if ( FoundAtOperator && ! FoundExceptionGroup) { + warnNoFL("found the exception operator '@' - but no exception group was found"); + }; + EpToken = addTname(EPSTR); /* add imaginary token epsilon */ + set_orel(EpToken, &imag_tokens); + + /* this won't work for hand-built scanners since EofToken is not + * known. Forces EOF to be token type 1. + */ + set_orel(EofToken, &imag_tokens); + + set_size(NumWords(TokenNum-1)); + + /* compute the set of all known token types + * It represents the set of tokens from 1 to last_token_num + the + * reserved positions above that (if any). Don't include the set of + * imaginary tokens such as the token/error classes or EOF. + */ + { + set a; + a = set_dup(reserved_positions); + for (i=1; i<TokenNum; i++) { set_orel(i, &a); } + all_tokens = set_dif(a, imag_tokens); + set_free(a); + } + + ComputeTokSets(); /* Compute #tokclass sets */ + CompleteTokenSetRefs(); /* Change complex nodes in syn diag */ + CompleteContextGuards(); /* MR13 */ + + if ( CodeGen ) genDefFile(); /* create tokens.h */ + if ( LexGen ) genLexDescr(); /* create parser.dlg */ + + if ( GenStdPccts ) + { + FILE *f = fopen(OutMetaName(stdpccts), "w"); + if ( f==NULL ) {warnNoFL( eMsg1("can't create %s",OutMetaName(stdpccts)) );} + else + { +#ifdef SPECIAL_FOPEN + special_fopen_actions(OutMetaName(stdpccts)); /* MR1 */ +#endif + if (strcmp(stdpccts,"stdpccts.h") == 0) { /* MR10 */ + genStdPCCTSIncludeFile(f,NULL); /* MR10 */ + } else { /* MR10 */ + genStdPCCTSIncludeFile(f,pcctsBaseName(stdpccts)); /* MR32 */ + }; + fclose(f); + } + } + + buildRulePtr(); /* create mapping from rule # to RuleBlk junction */ + ComputeErrorSets(); + FoLink( (Node *)SynDiag ); /* add follow links to end of all rules */ + + if ( GenCR ) GenCrossRef( SynDiag ); + + if ( CodeGen ) + { + if ( SynDiag == NULL ) + { + warnNoFL("no grammar description recognized"); + cleanUp(); + zzDIE; + } + else if ( !GenCC ) { + ErrFile = fopen(OutMetaName(ErrFileName), "w"); + require(ErrFile != NULL, "main: can't open err file"); +#ifdef SPECIAL_FOPEN + special_fopen_actions(OutMetaName(ErrFileName)); /* MR1 */ +#endif + NewSetWd(); + GenErrHdr(); + TRANS(SynDiag); /* Translate to the target language */ + DumpSetWd(); + DumpRemainingTokSets(); + fclose( ErrFile ); + } + else { + strcpy(Parser_h_Name, CurrentClassName); + strcat(Parser_h_Name, ".h"); + strcpy(Parser_c_Name, CurrentClassName); + strcat(Parser_c_Name, CPP_FILE_SUFFIX); + ensure_no_C_file_collisions(Parser_c_Name); + Parser_h = fopen(OutMetaName(Parser_h_Name), "w"); + require(Parser_h != NULL, "main: can't open class Parserx.h file"); +#ifdef SPECIAL_FOPEN + special_fopen_actions(OutMetaName(Parser_h_Name)); /* MR1 */ +#endif + Parser_c = fopen(OutMetaName(Parser_c_Name), "w"); + require(Parser_c != NULL, "main: can't open class Parserx.c file"); +#ifdef SPECIAL_FOPEN + special_fopen_actions(OutMetaName(Parser_c_Name)); /* MR1 */ +#endif + GenParser_h_Hdr(); + if ( class_before_actions != NULL ) + { + ListNode *p; + for (p = class_before_actions->next; p!=NULL; p=p->next) + { + UserAction *ua = (UserAction *)p->elem; + dumpAction( ua->action, Parser_h, 0, ua->file, ua->line, 1); + } + } + GenParser_c_Hdr(); + fprintf(Parser_h, "protected:\n"); /* MR20 */ + NewSetWd(); + TRANS(SynDiag); /* Translate to the target language */ + DumpSetWd(); + GenRuleMemberDeclarationsForCC(Parser_h, SynDiag); + if ( class_after_actions != NULL ) + { + ListNode *p; + for (p = class_after_actions->next; p!=NULL; p=p->next) + { + UserAction *ua = (UserAction *)p->elem; + dumpAction( ua->action, Parser_h, 0, ua->file, ua->line, 1); + } + } + DumpRemainingTokSets(); + fprintf(Parser_h, "};\n"); + fprintf(Parser_h, "\n#endif /* %s_h */\n", CurrentClassName); + fclose( Parser_h ); + fclose( Parser_c ); + } + } + + MR_orphanRules(stderr); + if (LTinTokenAction && WarningLevel >= 2) { + if (GenCC) { + warnNoFL("At least one <<action>> following a token match contains a reference to LT(...)\n this will reference the immediately preceding token,\n not the one which follows as is the case with semantic predicates."); + } + warnNoFL("At least one <<action>> following a token match contains a reference to LA(...) or LATEXT(...)\n this will reference the immediately preceding token,\n not the one which follows as is the case with semantic predicates."); + } + + if ( PrintOut ) + { + if ( SynDiag == NULL ) {warnNoFL("no grammar description recognized");} + else PRINT(SynDiag); + } + +#ifdef DBG_LL1 +#endif + GenRemapFile(); /* create remap.h */ +/* MR10 */ if (FoundGuessBlk) { +#ifdef __cplusplus__ +/* MR10 */ list_apply(NumericPredLabels, (void (*)(void *))report_numericPredLabels); +#else +#ifdef __USE_PROTOS +/* MR10 */ list_apply(NumericPredLabels, (void (*)(void *))report_numericPredLabels); +#else +/* MR10 */ list_apply(NumericPredLabels,report_numericPredLabels); +#endif +#endif +/* MR10 */ }; + + if (InfoT && TnodesAllocated > 0) { + if (TnodesPeak > 10000) { + fprintf(stdout,"\nTree Nodes: peak %dk created %dk lost %d\n", + (TnodesPeak/1000), + (TnodesAllocated/1000), + TnodesInUse-tnodes_used_in_guard_predicates_etc); + } else { + fprintf(stdout,"\nTree Nodes: peak %d created %d lost %d\n", + TnodesPeak, + TnodesAllocated, + TnodesInUse-tnodes_used_in_guard_predicates_etc); + }; + }; + if (InfoF) { + DumpFcache(); + }; + if (MR_skipped_e3_report) { + fprintf(stderr,"note: use -e3 to get exact information on ambiguous tuples\n"); + }; + if (MR_BadExprSets != 0) { + fprintf(stderr,"note: Unreachable C or C++ code was generated for empty expression sets,\n"); + fprintf(stderr," probably due to undefined rules or infinite left recursion.\n"); + fprintf(stderr," To locate: search the generated code for \"empty set expression\"\n"); + }; + if (MR_AmbAidRule != NULL && MR_matched_AmbAidRule==0) { + RuleEntry *q = (RuleEntry *) hash_get(Rname,MR_AmbAidRule); + if (MR_AmbAidLine == 0 && q == NULL) { + warnNoFL(eMsg2("there is no rule \"%s\" so \"-aa %s\" will never match", + MR_AmbAidRule,MR_AmbAidRule)); + } else { + warnNoFL(eMsg1("there was no ambiguity that matched \"-aa %s\"",MR_AmbAidRule)); + }; + }; + if (AlphaBetaTrace) { + + if (MR_AlphaBetaMessageCount == 0) { + fprintf(stderr,"note: there were no messages about \"(alpha)? beta\" blocks added to the generated code\n"); + } else { + fprintf(stderr,"note: there were %d messages about \"(alpha)? beta\" blocks added to the generated code\n", + MR_AlphaBetaMessageCount); + } + + if (set_null(MR_CompromisedRules)) { + fprintf(stderr,"note: the list of rules with compromised follow sets is empty\n"); + } else { + fprintf(stderr,"note: the following is a list of rules which *may* have incorrect\n"); + fprintf(stderr," follow sets computed as a result of an \"(alpha)? beta\" block\n"); + fprintf(stderr,"\n"); + MR_dumpRuleSet(MR_CompromisedRules); + fprintf(stderr,"\n"); + } + } + cleanUp(); + exit(PCCTS_EXIT_SUCCESS); + return 0; /* MR11 make compilers happy */ +} + +static void +#ifdef __USE_PROTOS +init( void ) +#else +init( ) +#endif +{ + SignalEntry *q; + + Tname = newHashTable(); + Rname = newHashTable(); + Fcache = newHashTable(); + Tcache = newHashTable(); + Sname = newHashTable(); + Pname = newHashTable(); /* MR11 */ + + /* Add default signal names */ + q = (SignalEntry *)hash_add(Sname, + "NoViableAlt", + (Entry *)newSignalEntry("NoViableAlt")); + require(q!=NULL, "cannot alloc signal entry"); + q->signum = sigNoViableAlt; + q = (SignalEntry *)hash_add(Sname, + "MismatchedToken", + (Entry *)newSignalEntry("MismatchedToken")); + require(q!=NULL, "cannot alloc signal entry"); + q->signum = sigMismatchedToken; + q = (SignalEntry *)hash_add(Sname, + "NoSemViableAlt", + (Entry *)newSignalEntry("NoSemViableAlt")); + require(q!=NULL, "cannot alloc signal entry"); + q->signum = sigNoSemViableAlt; + + reserved_positions = empty; + all_tokens = empty; + imag_tokens = empty; + tokclasses = empty; + TokenStr = (char **) calloc(TSChunk, sizeof(char *)); + require(TokenStr!=NULL, "main: cannot allocate TokenStr"); + FoStack = (int **) calloc(CLL_k+1, sizeof(int *)); + require(FoStack!=NULL, "main: cannot allocate FoStack"); + FoTOS = (int **) calloc(CLL_k+1, sizeof(int *)); + require(FoTOS!=NULL, "main: cannot allocate FoTOS"); + Cycles = (ListNode **) calloc(CLL_k+1, sizeof(ListNode *)); + require(Cycles!=NULL, "main: cannot allocate Cycles List"); + MR_CompromisedRules=empty; /* MR14 */ +} + +static void +#ifdef __USE_PROTOS +help( void ) +#else +help( ) +#endif +{ + Opt *p = options; + fprintf(stderr, "antlr [options] f1 f2 ... fn\n"); + while ( *(p->option) != '*' ) + { + fprintf(stderr, " %-9s%s %s\n", + p->option, + (p->arg)?"___":" ", + p->descr); + p++; + } +} + +/* The RulePtr array is filled in here. RulePtr exists primarily + * so that sets of rules can be maintained for the FOLLOW caching + * mechanism found in rJunc(). RulePtr maps a rule num from 1 to n + * to a pointer to its RuleBlk junction where n is the number of rules. + */ +static void +#ifdef __USE_PROTOS +buildRulePtr( void ) +#else +buildRulePtr( ) +#endif +{ + int r=1; + Junction *p = SynDiag; + RulePtr = (Junction **) calloc(NumRules+1, sizeof(Junction *)); + require(RulePtr!=NULL, "cannot allocate RulePtr array"); + + while ( p!=NULL ) + { + require(r<=NumRules, "too many rules???"); + RulePtr[r++] = p; + p = (Junction *)p->p2; + } +} + +void +#ifdef __USE_PROTOS +dlgerror(const char *s) +#else +dlgerror(s) +char *s; +#endif +{ + fprintf(stderr, ErrHdr, FileStr[CurFile], zzline); + fprintf(stderr, " lexical error: %s (text was '%s')\n", + ((s == NULL) ? "Lexical error" : s), zzlextext); +} + +void +#ifdef __USE_PROTOS +readDescr( void ) +#else +readDescr( ) +#endif +{ + zzerr = dlgerror; + input = NextFile(); + if ( input==NULL ) fatal("No grammar description found (exiting...)"); + ANTLR(grammar(), input); + tnodes_used_in_guard_predicates_etc=TnodesInUse; /* MR10 */ +} + +FILE * +#ifdef __USE_PROTOS +NextFile( void ) +#else +NextFile( ) +#endif +{ + FILE *f; + + for (;;) + { + CurFile++; + if ( CurFile >= NumFiles ) return(NULL); + if ( ci_strequ(FileStr[CurFile],"stdin")) return stdin; + f = fopen(FileStr[CurFile], "r"); + if ( f == NULL ) + { + warnNoFL( eMsg1("file %s doesn't exist; ignored", FileStr[CurFile]) ); + } + else + { + return(f); + } + } +} + +/* + * Return a string corresponding to the output file name associated + * with the input file name passed in. + * + * Observe the following rules: + * + * f.e --> f".c" + * f --> f".c" + * f. --> f".c" + * f.e.g --> f.e".c" + * + * Where f,e,g are arbitrarily long sequences of characters in a file + * name. + * + * In other words, if a ".x" appears on the end of a file name, make it + * ".c". If no ".x" appears, append ".c" to the end of the file name. + * + * C++ mode using .cpp not .c. + * + * Use malloc() for new string. + */ + +char * +#ifdef __USE_PROTOS +outname( char *fs ) +#else +outname( fs ) +char *fs; +#endif +{ + if ( GenCC) { + return outnameX(fs,CPP_FILE_SUFFIX); + } else { + return outnameX(fs,".c"); + }; +} + +char * +#ifdef __USE_PROTOS +outnameX( char *fs ,char *suffix) +#else +outnameX( fs , suffix ) +char *fs; +char *suffix; +#endif +{ + static char buf[MaxFileName+1]; + char *p; + require(fs!=NULL&&*fs!='\0', "outname: NULL filename"); + + p = buf; + strcpy(buf, fs); + while ( *p != '\0' ) {p++;} /* Stop on '\0' */ + while ( *p != '.' && p != buf ) {--p;} /* Find '.' */ + if ( p != buf ) *p = '\0'; /* Found '.' */ + require(strlen(buf) + 2 < (size_t)MaxFileName, "outname: filename too big"); + strcat(buf,suffix); + return( buf ); +} + +void +#ifdef __USE_PROTOS +fatalFL( char *err_, char *f, int l ) +#else +fatalFL( err_, f, l ) +char *err_; +char *f; +int l; +#endif +{ + fprintf(stderr, ErrHdr, f, l); + fprintf(stderr, " %s\n", err_); + cleanUp(); + exit(PCCTS_EXIT_FAILURE); +} + +void +#ifdef __USE_PROTOS +fatal_intern( char *err_, char *f, int l ) +#else +fatal_intern( err_, f, l ) +char *err_; +char *f; +int l; +#endif +{ + fprintf(stderr, ErrHdr, f, l); + fprintf(stderr, " #$%%*&@# internal error: %s\n", err_); + fprintf(stderr, ErrHdr, f, l); + fprintf(stderr, " [complain to nearest government official\n"); + fprintf(stderr, ErrHdr, f, l); + fprintf(stderr, " or send hate-mail to parrt@parr-research.com;\n"); + fprintf(stderr, ErrHdr, f, l); + fprintf(stderr, " please pray to the ``bug'' gods that there is a trival fix.]\n"); + cleanUp(); + exit(PCCTS_EXIT_FAILURE); +} + +void +#ifdef __USE_PROTOS +cleanUp( void ) +#else +cleanUp( ) +#endif +{ + if ( DefFile != NULL) fclose( DefFile ); +} + +/* sprintf up to 3 strings */ +char * +#ifdef __USE_PROTOS +eMsg3( char *s, char *a1, char *a2, char *a3 ) +#else +eMsg3( s, a1, a2, a3 ) +char *s; +char *a1; +char *a2; +char *a3; +#endif +{ + static char buf[250]; /* DANGEROUS as hell !!!!!! */ + + sprintf(buf, s, a1, a2, a3); + return( buf ); +} + +/* sprintf a decimal */ +char * +#ifdef __USE_PROTOS +eMsgd( char *s, int d ) +#else +eMsgd( s, d ) +char *s; +int d; +#endif +{ + static char buf[250]; /* DANGEROUS as hell !!!!!! */ + + sprintf(buf, s, d); + return( buf ); +} + +char * +#ifdef __USE_PROTOS +eMsgd2( char *s, int d1,int d2) +#else +eMsgd2( s, d1, d2 ) +char *s; +int d1; +int d2; +#endif +{ + static char buf[250]; /* DANGEROUS as hell !!!!!! */ + + sprintf(buf, s, d1, d2); + return( buf ); +} + +void +#ifdef __USE_PROTOS +s_fprT( FILE *f, set e ) +#else +s_fprT( f, e ) +FILE *f; +set e; +#endif +{ + register unsigned *p; + unsigned *q; + + if ( set_nil(e) ) return; + if ( (q=p=set_pdq(e)) == NULL ) fatal_internal("Can't alloc space for set_pdq"); + fprintf(f, "{"); + while ( *p != nil ) + { + fprintf(f, " %s", TerminalString(*p)); + p++; + } + fprintf(f, " }"); + free((char *)q); +} + +/* Return the token name or regular expression for a token number. */ +char * +#ifdef __USE_PROTOS +TerminalString( int token ) +#else +TerminalString( token ) +int token; +#endif +{ + int j; + static char imag_name[20]; + + /* look in all lexclasses for the token */ + if ( TokenString(token) != NULL ) return TokenString(token); + for (j=0; j<NumLexClasses; j++) + { + lexmode(j); + if ( ExprString(token) != NULL ) return ExprString(token); + } + + if (1) { + sprintf(imag_name,"UnknownToken#%d",token); /* MR13 */ + return imag_name; /* MR13 */ + } + + require(j<NumLexClasses, eMsgd("No label or expr for token %d",token)); + return "invalid"; +} + + /* S i m p l e I n t S t a c k */ + +void +#ifdef __USE_PROTOS +pushint( int i ) +#else +pushint( i ) +int i; +#endif +{ + require(isp>0, "pushint: stack overflow"); + istack[--isp] = i; +} + +int +#ifdef __USE_PROTOS +popint( void ) +#else +popint( ) +#endif +{ + require(isp<MAX_INT_STACK, "popint: stack underflow"); + return istack[isp++]; +} + +int +#ifdef __USE_PROTOS +istacksize( void ) +#else +istacksize( ) +#endif +{ + return MAX_INT_STACK-isp; +} + +void +#ifdef __USE_PROTOS +istackreset( void ) +#else +istackreset( ) +#endif +{ + isp = MAX_INT_STACK; +} + +int +#ifdef __USE_PROTOS +istackempty( void ) +#else +istackempty( ) +#endif +{ + return isp==MAX_INT_STACK; +} + +int +#ifdef __USE_PROTOS +topint( void ) +#else +topint( ) +#endif +{ + require(isp<MAX_INT_STACK, "topint: stack underflow"); + return istack[isp]; +} + +void +#ifdef __USE_PROTOS +ProcessArgs( int argc, char **argv, Opt *options ) +#else +ProcessArgs( argc, argv, options ) +int argc; +char **argv; +Opt *options; +#endif +{ + Opt *p; + require(argv!=NULL, "ProcessArgs: command line NULL"); + + while ( argc-- > 0 ) + { + p = options; + while ( p->option != NULL ) + { + if ( strcmp(p->option, "*") == 0 || + ci_strequ(p->option, *argv) == 1 ) + { + if ( p->arg ) + { +/* MR9 26-Sep-97 Check for argv valid */ + if (argc-- > 0) { + (*p->process)( *argv, *(argv+1) ); + argv++; + } else { +fprintf(stderr,"error: required argument for option %s omitted\n",*argv); +exit(PCCTS_EXIT_FAILURE); + }; + } + else + (*p->process)( *argv ); + break; + } + p++; + } + argv++; + } +} + +static void +#ifdef __USE_PROTOS +CompleteContextGuards(void) +#else +CompleteContextGuards() +#endif +{ + ListNode * p; + Predicate * pred; + + if (ContextGuardPredicateList == NULL) return; + + for (p=ContextGuardPredicateList->next; p != NULL; p=p->next) { + pred=(Predicate *)p->elem; + recomputeContextGuard(pred); + } +} + +/* Go back into the syntax diagram and compute all meta tokens; i.e. + * turn all '.', ranges, token class refs etc... into actual token sets + */ +static void +#ifdef __USE_PROTOS +CompleteTokenSetRefs(void) +#else +CompleteTokenSetRefs() +#endif +{ + ListNode *p; + + if ( MetaTokenNodes==NULL ) return; + for (p = MetaTokenNodes->next; p!=NULL; p=p->next) + { + set a,b; + + TokNode *q = (TokNode *)p->elem; + if ( q->wild_card ) + { + q->tset = all_tokens; + } + else if ( q->tclass!=NULL ) + { + if ( q->complement ) q->tset = set_dif(all_tokens, q->tclass->tset); + else q->tset = q->tclass->tset; + } + else if ( q->upper_range!=0 ) + { + /* we have a range on our hands: make a set from q->token .. q->upper_range */ + int i; + a = empty; + for (i=q->token; i<=q->upper_range; i++) { set_orel(i, &a); } /* MR13 */ + +/* MR13 */ if (q->complement) { +/* MR13 */ q->tset = set_dif(all_tokens, a); +/* MR13 */ set_free(a); +/* MR13 */ } else { +/* MR13 */ q->tset = a; +/* MR13 */ } + + } + + /* at this point, it can only be a complemented single token */ + else if ( q->complement ) + { + a = set_of(q->token); + b = set_dif(all_tokens, a); + set_free(a); + q->tset=b; + } + else fatal("invalid meta token"); + } +} + +/* MR10: Jeff Vincent + MR10: Changed to remove directory information from n only if + MR10: if OutputDirectory was changed by user (-o option) +*/ + +char * +#ifdef __USE_PROTOS +OutMetaName(char *n) +#else +OutMetaName(n) +char *n; +#endif +{ + static char *dir_sym = DirectorySymbol; + static char newname[MaxFileName+1]; + char *p; + + /* If OutputDirectory is same as TopDirectory (platform default) then leave n alone. */ + if (strcmp(OutputDirectory, TopDirectory) == 0) /* TopDirectory is "." on Unix. */ + return n; + + /* p will point to filename without path information */ + if ((p = strrchr(n, *dir_sym)) != NULL) /* Directory symbol is "/" on Unix. */ + p++; + else + p = n; + + /* Copy new output directory into newname[] */ + strcpy(newname, OutputDirectory); + + /* if new output directory does not have trailing dir_sym, add it! */ + if (newname[strlen(newname)-1] != *dir_sym) { + strcat(newname, dir_sym); + } + strcat(newname, p); + return newname; +} + +char * +#ifdef __USE_PROTOS +pcctsBaseName(char *n) /* MR32 */ +#else +pcctsBaseName(n) +char *n; +#endif +{ + static char newname[MaxFileName+1]; + static char* dir_sym = DirectorySymbol; + int count = 0; + char *p; + + p = n; + + while ( *p != '\0' ) {p++;} /* go to end of string */ + while ( (*p != *dir_sym) && (p != n) ) {--p;} /* Find last DirectorySymbol */ + while ( *p == *dir_sym) p++; /* step forward if we're on a dir symbol */ + while ( *p != '\0' && *p != '.') + { + newname[count++] = *p; + p++; + } /* create a new name */ + newname[count] = '\0'; + return newname; +} + +static void +#ifdef __USE_PROTOS +ensure_no_C_file_collisions(char *class_c_file) +#else +ensure_no_C_file_collisions(class_c_file) +char *class_c_file; +#endif +{ + int i; + + for (i=0; i<NumFiles; i++) + { + +#ifdef PCCTS_CASE_INSENSITIVE_FILE_NAME + /* assume that file names are case insensitive */ + if ( STRICMP(outname(FileStr[i]), class_c_file)==0 ) +#else + if ( strcmp(outname(FileStr[i]), class_c_file)==0 ) +#endif + { + fatal(eMsg1("class def output file conflicts with parser output file: %s", + outname(FileStr[i]))); + } + } +} + +void +#ifdef __USE_PROTOS +warnNoFL(char *err) +#else +warnNoFL(err) +char *err; +#endif +{ + fprintf(stderr, "warning: %s\n", err); +} + +void +#ifdef __USE_PROTOS +warnFL(char *err,char *f,int l) +#else +warnFL(err,f,l) +char *f; +int l; +char *err; +#endif +{ + fprintf(stderr, ErrHdr, f, l); + fprintf(stderr, " warning: %s\n", err); +} + +void +#ifdef __USE_PROTOS +warn(char *err) +#else +warn(err) +char *err; +#endif +{ + /* back up the file number if we hit an error at the end of the last file */ + if ( CurFile >= NumFiles && CurFile >= 1 ) CurFile--; + fprintf(stderr, ErrHdr, FileStr[CurFile], zzline); + fprintf(stderr, " warning: %s\n", err); +} + +void +#ifdef __USE_PROTOS +warnNoCR( char *err ) +#else +warnNoCR( err ) +char *err; +#endif +{ + /* back up the file number if we hit an error at the end of the last file */ + if ( CurFile >= NumFiles && CurFile >= 1 ) CurFile--; + fprintf(stderr, ErrHdr, FileStr[CurFile], zzline); + fprintf(stderr, " warning: %s", err); +} + +void +#ifdef __USE_PROTOS +errNoFL(char *err) +#else +errNoFL(err) +char *err; +#endif +{ + fprintf(stderr, "error: %s\n", err); +} + +void +#ifdef __USE_PROTOS +errFL(char *err,char *f,int l) +#else +errFL(err,f,l) +char *err; +char *f; +int l; +#endif +{ + fprintf(stderr, ErrHdr, f, l); + fprintf(stderr, " error: %s\n", err); +} + +void +#ifdef __USE_PROTOS +err(char *err) +#else +err(err) +char *err; +#endif +{ + /* back up the file number if we hit an error at the end of the last file */ + if ( CurFile >= NumFiles && CurFile >= 1 ) CurFile--; + fprintf(stderr, ErrHdr, FileStr[CurFile], zzline); + fprintf(stderr, " error: %s\n", err); +} + +void +#ifdef __USE_PROTOS +errNoCR( char *err ) +#else +errNoCR( err ) +char *err; +#endif +{ + /* back up the file number if we hit an error at the end of the last file */ + if ( CurFile >= NumFiles && CurFile >= 1 ) CurFile--; + fprintf(stderr, ErrHdr, FileStr[CurFile], zzline); + fprintf(stderr, " error: %s", err); +} + +UserAction * +#ifdef __USE_PROTOS +newUserAction(char *s) +#else +newUserAction(s) +char *s; +#endif +{ + UserAction *ua = (UserAction *) calloc(1, sizeof(UserAction)); + require(ua!=NULL, "cannot allocate UserAction"); + + ua->action = (char *) calloc(strlen(LATEXT(1))+1, sizeof(char)); + strcpy(ua->action, s); + return ua; +} + +/* Added by TJP September 1994 */ +/* Take in file.h and return file_h; names w/o '.'s are left alone */ +char * +#ifdef __USE_PROTOS +gate_symbol(char *name) +#else +gate_symbol(name) +char *name; +#endif +{ + static char buf[100]; + char *p; + sprintf(buf, "%s", name); + + for (p=buf; *p!='\0'; p++) + { + if ( *p=='.' ) *p = '_'; + } + return buf; +} + +char * +#ifdef __USE_PROTOS +makeAltID(int blockid, int altnum) +#else +makeAltID(blockid, altnum) +int blockid; +int altnum; +#endif +{ + static char buf[100]; + char *p; + sprintf(buf, "_blk%d_alt%d", blockid, altnum); + p = (char *)malloc(strlen(buf)+1); + strcpy(p, buf); + return p; +} diff --git a/pccts/antlr/misc.c b/pccts/antlr/misc.c new file mode 100644 index 0000000..9cad6c0 --- /dev/null +++ b/pccts/antlr/misc.c @@ -0,0 +1,1864 @@ +/* + * misc.c + * + * Manage tokens, regular expressions. + * Print methods for debugging + * Compute follow lists onto tail ends of rules. + * + * The following functions are visible: + * + * int addTname(char *); Add token name + * int addTexpr(char *); Add token expression + * int Tnum(char *); Get number of expr/token + * void Tklink(char *, char *); Link a name with an expression + * int hasAction(expr); Does expr already have action assigned? + * void setHasAction(expr); Indicate that expr now has an action + * Entry *newEntry(char *,int); Create new table entry with certain size + * void list_add(ListNode **list, char *e) + * void list_free(ListNode **list, int freeData); *** MR10 *** + * void list_apply(ListNode *list, void (*f)()) + * void lexclass(char *m); switch to new/old lexical class + * void lexmode(int i); switch to old lexical class i + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2001 + */ + +#include <stdio.h> +#include "pcctscfg.h" +#include "set.h" +#include "syn.h" +#include "hash.h" +#include "generic.h" +#include "dlgdef.h" +#include <ctype.h> + +static int tsize=TSChunk; /* size of token str arrays */ + +static void +#ifdef __USE_PROTOS +RemapForcedTokensInSyntaxDiagram(Node *); +#else +RemapForcedTokensInSyntaxDiagram(); +#endif + + /* T o k e n M a n i p u l a t i o n */ + +/* + * add token 't' to the TokenStr/Expr array. Make more room if necessary. + * 't' is either an expression or a token name. + * + * There is only one TokenStr array, but multiple ExprStr's. Therefore, + * for each lex class (element of lclass) we must extend the ExprStr array. + * ExprStr's and TokenStr are always all the same size. + * + * Also, there is a Texpr hash table for each automaton. + */ +static void +#ifdef __USE_PROTOS +Ttrack( char *t ) +#else +Ttrack( t ) +char *t; +#endif +{ + if ( TokenNum >= tsize ) /* terminal table overflow? */ + { + char **p; + int i, more, j; + + more = TSChunk * (1 + ((TokenNum-tsize) / TSChunk)); + tsize += more; + TokenStr = (char **) realloc((char *)TokenStr, tsize*sizeof(char *)); + require(TokenStr != NULL, "Ttrack: can't extend TokenStr"); + for (i=0; i<NumLexClasses; i++) + { + lclass[i].exprs = (char **) + realloc((char *)lclass[i].exprs, tsize*sizeof(char *)); + require(lclass[i].exprs != NULL, "Ttrack: can't extend ExprStr"); + for (p= &lclass[i].exprs[tsize-more],j=1; j<=more; j++) *p++ = NULL; + } + for (p= &TokenStr[tsize-more],i=1; i<=more; i++) *p++ = NULL; + lexmode( CurrentLexClass ); /* reset ExprStr in case table moved */ + } + /* note: we use the actual ExprStr/TokenStr array + * here as TokenInd doesn't exist yet + */ + if ( *t == '"' ) ExprStr[TokenNum] = t; + else TokenStr[TokenNum] = t; +} + +static Expr * +#ifdef __USE_PROTOS +newExpr( char *e ) +#else +newExpr( e ) +char *e; +#endif +{ + Expr *p = (Expr *) calloc(1, sizeof(Expr)); + require(p!=NULL, "newExpr: cannot alloc Expr node"); + + p->expr = e; + p->lclass = CurrentLexClass; + return p; +} + +/* switch to lexical class/mode m. This amounts to creating a new + * lex mode if one does not already exist and making ExprStr point + * to the correct char string array. We must also switch Texpr tables. + * + * BTW, we need multiple ExprStr arrays because more than one automaton + * may have the same label for a token, but with different expressions. + * We need to track an expr for each automaton. If we disallowed this + * feature, only one ExprStr would be required. + */ +void +#ifdef __USE_PROTOS +lexclass( char *m ) +#else +lexclass( m ) +char *m; +#endif +{ + int i; + TermEntry *p; + static char EOFSTR[] = "\"@\""; + + if ( hash_get(Tname, m) != NULL ) + { + warn(eMsg1("lexclass name conflicts with token/errclass label '%s'",m)); + } + /* does m already exist? */ + i = LexClassIndex(m); + if ( i != -1 ) {lexmode(i); return;} + /* must make new one */ + NumLexClasses++; + CurrentLexClass = NumLexClasses-1; + require(NumLexClasses<=MaxLexClasses, "number of allowable lexclasses exceeded\nIncrease MaxLexClasses in generic.h and recompile all C files"); + lclass[CurrentLexClass].classnum = m; + lclass[CurrentLexClass].exprs = (char **) calloc(tsize, sizeof(char *)); + require(lclass[CurrentLexClass].exprs!=NULL, + "lexclass: cannot allocate ExprStr"); + lclass[CurrentLexClass].htable = newHashTable(); + ExprStr = lclass[CurrentLexClass].exprs; + Texpr = lclass[CurrentLexClass].htable; + /* define EOF for each automaton */ + p = newTermEntry( EOFSTR ); + p->token = EofToken; /* couldn't have remapped tokens yet, use EofToken */ + hash_add(Texpr, EOFSTR, (Entry *)p); + list_add(&ExprOrder, (void *)newExpr(EOFSTR)); + /* note: we use the actual ExprStr array + * here as TokenInd doesn't exist yet + */ + ExprStr[EofToken] = EOFSTR; +} + +void +#ifdef __USE_PROTOS +lexmode( int i ) +#else +lexmode( i ) +int i; +#endif +{ + require(i<NumLexClasses, "lexmode: invalid mode"); + ExprStr = lclass[i].exprs; + Texpr = lclass[i].htable; + CurrentLexClass = i; +} + +/* return index into lclass array of lexical class. return -1 if nonexistent */ +int +#ifdef __USE_PROTOS +LexClassIndex( char *cl ) +#else +LexClassIndex( cl ) +char *cl; +#endif +{ + int i; + + for (i=0; i<NumLexClasses; i++) + { + if ( strcmp(lclass[i].classnum, cl) == 0 ) return i; + } + return -1; +} + +int +#ifdef __USE_PROTOS +hasAction( char *expr ) +#else +hasAction( expr ) +char *expr; +#endif +{ + TermEntry *p; + require(expr!=NULL, "hasAction: invalid expr"); + + p = (TermEntry *) hash_get(Texpr, expr); + require(p!=NULL, eMsg1("hasAction: expr '%s' doesn't exist",expr)); + return (p->action!=NULL); +} + +void +#ifdef __USE_PROTOS +setHasAction( char *expr, char *action ) +#else +setHasAction( expr, action ) +char *expr; +char *action; +#endif +{ + TermEntry *p; + require(expr!=NULL, "setHasAction: invalid expr"); + + p = (TermEntry *) hash_get(Texpr, expr); + require(p!=NULL, eMsg1("setHasAction: expr '%s' doesn't exist",expr)); + p->action = action; +} + +ForcedToken * +#ifdef __USE_PROTOS +newForcedToken(char *token, int tnum) +#else +newForcedToken(token, tnum) +char *token; +int tnum; +#endif +{ + ForcedToken *ft = (ForcedToken *) calloc(1, sizeof(ForcedToken)); + require(ft!=NULL, "out of memory"); + ft->token = token; + ft->tnum = tnum; + return ft; +} + +/* + * Make a token indirection array that remaps token numbers and then walk + * the appropriate symbol tables and SynDiag to change token numbers + */ +void +#ifdef __USE_PROTOS +RemapForcedTokens(void) +#else +RemapForcedTokens() +#endif +{ + ListNode *p; + ForcedToken *q; + int max_token_number=0; /* MR9 23-Sep-97 Removed "unsigned" */ + int i; + + if ( ForcedTokens == NULL ) return; + + /* find max token num */ + for (p = ForcedTokens->next; p!=NULL; p=p->next) + { + q = (ForcedToken *) p->elem; + if ( q->tnum > max_token_number ) max_token_number = q->tnum; + } + fprintf(stderr, "max token number is %d\n", max_token_number); + + /* make token indirection array */ + TokenInd = (int *) calloc(max_token_number+1, sizeof(int)); + LastTokenCounted = TokenNum; + TokenNum = max_token_number+1; + require(TokenInd!=NULL, "RemapForcedTokens: cannot allocate TokenInd"); + + /* fill token indirection array and change token id htable ; swap token indices */ + for (i=1; i<TokenNum; i++) TokenInd[i] = i; + for (p = ForcedTokens->next; p!=NULL; p=p->next) + { + TermEntry *te; + int old_pos, t; + + q = (ForcedToken *) p->elem; + fprintf(stderr, "%s forced to %d\n", q->token, q->tnum); + te = (TermEntry *) hash_get(Tname, q->token); + require(te!=NULL, "RemapForcedTokens: token not in hash table"); + old_pos = te->token; + fprintf(stderr, "Before: TokenInd[old_pos==%d] is %d\n", old_pos, TokenInd[old_pos]); + fprintf(stderr, "Before: TokenInd[target==%d] is %d\n", q->tnum, TokenInd[q->tnum]); + q = (ForcedToken *) p->elem; + t = TokenInd[old_pos]; + TokenInd[old_pos] = q->tnum; + TokenInd[q->tnum] = t; + te->token = q->tnum; /* update token type id symbol table */ + fprintf(stderr, "After: TokenInd[old_pos==%d] is %d\n", old_pos, TokenInd[old_pos]); + fprintf(stderr, "After: TokenInd[target==%d] is %d\n", q->tnum, TokenInd[q->tnum]); + + /* Change the token number in the sym tab entry for the exprs + * at the old position of the token id and the target position + */ + /* update expr at target (if any) of forced token id */ + if ( q->tnum < TokenNum ) /* is it a valid position? */ + { + for (i=0; i<NumLexClasses; i++) + { + if ( lclass[i].exprs[q->tnum]!=NULL ) + { + /* update the symbol table for this expr */ + TermEntry *e = (TermEntry *) hash_get(lclass[i].htable, lclass[i].exprs[q->tnum]); + require(e!=NULL, "RemapForcedTokens: expr not in hash table"); + e->token = old_pos; + fprintf(stderr, "found expr '%s' at target %d in lclass[%d]; changed to %d\n", + lclass[i].exprs[q->tnum], q->tnum, i, old_pos); + } + } + } + /* update expr at old position (if any) of forced token id */ + for (i=0; i<NumLexClasses; i++) + { + if ( lclass[i].exprs[old_pos]!=NULL ) + { + /* update the symbol table for this expr */ + TermEntry *e = (TermEntry *) hash_get(lclass[i].htable, lclass[i].exprs[old_pos]); + require(e!=NULL, "RemapForcedTokens: expr not in hash table"); + e->token = q->tnum; + fprintf(stderr, "found expr '%s' for id %s in lclass[%d]; changed to %d\n", + lclass[i].exprs[old_pos], q->token, i, q->tnum); + } + } + } + + /* Update SynDiag */ + RemapForcedTokensInSyntaxDiagram((Node *)SynDiag); +} + +static void +#ifdef __USE_PROTOS +RemapForcedTokensInSyntaxDiagram(Node *p) +#else +RemapForcedTokensInSyntaxDiagram(p) +Node *p; +#endif +{ + Junction *j = (Junction *) p; + RuleRefNode *r = (RuleRefNode *) p; + TokNode *t = (TokNode *)p; + + if ( p==NULL ) return; + require(p->ntype>=1 && p->ntype<=NumNodeTypes, "Remap...: invalid diagram node"); + switch ( p->ntype ) + { + case nJunction : + if ( j->visited ) return; + if ( j->jtype == EndRule ) return; + j->visited = TRUE; + RemapForcedTokensInSyntaxDiagram( j->p1 ); + RemapForcedTokensInSyntaxDiagram( j->p2 ); + j->visited = FALSE; + return; + case nRuleRef : + RemapForcedTokensInSyntaxDiagram( r->next ); + return; + case nToken : + if ( t->remapped ) return; /* we've been here before */ + t->remapped = 1; + fprintf(stderr, "remapping %d to %d\n", t->token, TokenInd[t->token]); + t->token = TokenInd[t->token]; + RemapForcedTokensInSyntaxDiagram( t->next ); + return; + case nAction : + RemapForcedTokensInSyntaxDiagram( ((ActionNode *)p)->next ); + return; + default : + fatal_internal("invalid node type"); + } +} + +/* + * Add a token name. Return the token number associated with it. If it already + * exists, then return the token number assigned to it. + * + * Track the order in which tokens are found so that the DLG output maintains + * that order. It also lets us map token numbers to strings. + */ +int +#ifdef __USE_PROTOS +addTname( char *token ) +#else +addTname( token ) +char *token; +#endif +{ + TermEntry *p; + require(token!=NULL, "addTname: invalid token name"); + + if ( (p=(TermEntry *)hash_get(Tname, token)) != NULL ) return p->token; + p = newTermEntry( token ); + Ttrack( p->str ); + p->token = TokenNum++; + hash_add(Tname, token, (Entry *)p); + return p->token; +} + +/* This is the same as addTname except we force the TokenNum to be tnum. + * We don't have to use the Forced token stuff as no tokens will have + * been defined with #tokens when this is called. This is only called + * when a #tokdefs meta-op is used. + */ +int +#ifdef __USE_PROTOS +addForcedTname( char *token, int tnum ) +#else +addForcedTname( token, tnum ) +char *token; +int tnum; +#endif +{ + TermEntry *p; + require(token!=NULL, "addTname: invalid token name"); + + if ( (p=(TermEntry *)hash_get(Tname, token)) != NULL ) return p->token; + p = newTermEntry( token ); + Ttrack( p->str ); + p->token = tnum; + hash_add(Tname, token, (Entry *)p); + return p->token; +} + +/* + * Add a token expr. Return the token number associated with it. If it already + * exists, then return the token number assigned to it. + */ +int +#ifdef __USE_PROTOS +addTexpr( char *expr ) +#else +addTexpr( expr ) +char *expr; +#endif +{ + TermEntry *p; + require(expr!=NULL, "addTexpr: invalid regular expression"); + + if ( (p=(TermEntry *)hash_get(Texpr, expr)) != NULL ) return p->token; + p = newTermEntry( expr ); + Ttrack( p->str ); + /* track the order in which they occur */ + list_add(&ExprOrder, (void *)newExpr(p->str)); + p->token = TokenNum++; + hash_add(Texpr, expr, (Entry *)p); + return p->token; +} + +/* return the token number of 'term'. Return 0 if no 'term' exists */ +int +#ifdef __USE_PROTOS +Tnum( char *term ) +#else +Tnum( term ) +char *term; +#endif +{ + TermEntry *p; + require(term!=NULL, "Tnum: invalid terminal"); + + if ( *term=='"' ) p = (TermEntry *) hash_get(Texpr, term); + else p = (TermEntry *) hash_get(Tname, term); + if ( p == NULL ) return 0; + else return p->token; +} + +/* associate a Name with an expr. If both have been already assigned + * token numbers, then an error is reported. Add the token or expr + * that has not been added if no error. This 'represents' the #token + * ANTLR pseudo-op. If both have not been defined, define them both + * linked to same token number. + */ +void +#ifdef __USE_PROTOS +Tklink( char *token, char *expr ) +#else +Tklink( token, expr ) +char *token; +char *expr; +#endif +{ + TermEntry *p, *q; + require(token!=NULL && expr!=NULL, "Tklink: invalid token name and/or expr"); + + p = (TermEntry *) hash_get(Tname, token); + q = (TermEntry *) hash_get(Texpr, expr); + if ( p != NULL && q != NULL ) /* both defined */ + { + warn( eMsg2("token name %s and rexpr %s already defined; ignored", + token, expr) ); + return; + } + if ( p==NULL && q==NULL ) /* both not defined */ + { + int t = addTname( token ); + q = newTermEntry( expr ); + hash_add(Texpr, expr, (Entry *)q); + q->token = t; + /* note: we use the actual ExprStr array + * here as TokenInd doesn't exist yet + */ + ExprStr[t] = q->str; + /* track the order in which they occur */ + list_add(&ExprOrder, (void *)newExpr(q->str)); + return; + } + if ( p != NULL ) /* one is defined, one is not */ + { + q = newTermEntry( expr ); + hash_add(Texpr, expr, (Entry *)q); + q->token = p->token; + ExprStr[p->token] = q->str; /* both expr and token str defined now */ + list_add(&ExprOrder, (void *)newExpr(q->str)); + } + else /* trying to associate name with expr here*/ + { + p = newTermEntry( token ); + hash_add(Tname, token, (Entry *)p); + p->token = q->token; + TokenStr[p->token] = p->str;/* both expr and token str defined now */ + } +} + +/* + * Given a string, this function allocates and returns a pointer to a + * hash table record of size 'sz' whose "str" pointer is reset to a position + * in the string table. + */ +Entry * +#ifdef __USE_PROTOS +newEntry( char *text, int sz ) +#else +newEntry( text, sz ) +char *text; +int sz; +#endif +{ + Entry *p; + require(text!=NULL, "new: NULL terminal"); + + if ( (p = (Entry *) calloc(1,sz)) == 0 ) + { + fatal_internal("newEntry: out of memory for terminals\n"); + exit(PCCTS_EXIT_FAILURE); + } + p->str = mystrdup(text); + + return(p); +} + +/* + * add an element to a list. + * + * Any non-empty list has a sentinel node whose 'elem' pointer is really + * a pointer to the last element. (i.e. length(list) = #elemIn(list)+1). + * Elements are appended to the list. + */ +void +#ifdef __USE_PROTOS +list_add( ListNode **list, void *e ) +#else +list_add( list, e ) +ListNode **list; +void *e; +#endif +{ + ListNode *p, *tail; + require(e!=NULL, "list_add: attempting to add NULL list element"); + + p = newListNode; + require(p!=NULL, "list_add: cannot alloc new list node"); + p->elem = e; + if ( *list == NULL ) + { + ListNode *sentinel = newListNode; + require(sentinel!=NULL, "list_add: cannot alloc sentinel node"); + *list=sentinel; + sentinel->next = p; + sentinel->elem = (char *)p; /* set tail pointer */ + } + else /* find end of list */ + { + tail = (ListNode *) (*list)->elem; /* get tail pointer */ + tail->next = p; + (*list)->elem = (char *) p; /* reset tail */ + } +} + +/* MR10 list_free() frees the ListNode elements in the list */ +/* MR10 if freeData then free the data elements of the list too */ + +void +#ifdef __USE_PROTOS +list_free(ListNode **list,int freeData) +#else +list_free(list,freeData) + ListNode **list; + int freeData; +#endif +{ + ListNode *p; + ListNode *next; + + if (list == NULL) return; + if (*list == NULL) return; + for (p=*list; p != NULL; p=next) { + next=p->next; + if (freeData && p->elem != NULL) { + free( (char *) p->elem); + }; + free( (char *) p); + }; + *list=NULL; +} + +void +#ifdef __USE_PROTOS +list_apply( ListNode *list, void (*f)(void *) ) +#else +list_apply( list, f ) +ListNode *list; +void (*f)(); +#endif +{ + ListNode *p; + require(f!=NULL, "list_apply: NULL function to apply"); + + if ( list == NULL ) return; + for (p = list->next; p!=NULL; p=p->next) (*f)( p->elem ); +} + +/* MR27 */ + +#ifdef __USE_PROTOS +int list_search_cstring(ListNode *list, char * cstring) +#else +int list_search_cstring(list, cstring) + ListNode * list; + char * cstring; +#endif +{ + ListNode *p; + if (list == NULL ) return 0; + for (p = list->next; p!=NULL; p=p->next) { + if (p->elem == NULL) continue; + if (0 == strcmp((char *) p->elem , cstring)) return 1; + } + return 0; +} + + /* F O L L O W C y c l e S t u f f */ + +/* make a key based upon (rulename, computation, k value). + * Computation values are 'i'==FIRST, 'o'==FOLLOW. + */ + +/* MR10 Make the key all characters so it can be read easily */ +/* MR10 by a simple dump program. Also, separates */ +/* MR10 'o' and 'i' from rule name */ + +char * +#ifdef __USE_PROTOS +Fkey( char *rule, int computation, int k ) +#else +Fkey( rule, computation, k ) +char *rule; +int computation; +int k; +#endif +{ + static char key[MaxRuleName+2+2+1]; /* MR10 */ + int i; + + if ( k > 99 ) /* MR10 */ + fatal("k>99 is too big for this implementation of ANTLR!\n"); /* MR10 */ + if ( (i=strlen(rule)) > MaxRuleName ) /* MR10 */ + fatal( eMsgd("rule name > max of %d\n", MaxRuleName) ); /* MR10 */ + strcpy(key,rule); + +/* MR10 */ key[i]='*'; +/* MR10 */ key[i+1] = (char) computation; /* MR20 G. Hobbelt */ +/* MR10 */ if (k < 10) { +/* MR10 */ key[i+2] = (char) ( '0' + k); +/* MR10 */ key[i+3] = '\0'; +/* MR10 */ } else { +/* MR10 */ key[i+2] = (char) ( '0' + k/10); +/* MR10 */ key[i+3] = (char) ( '0' + k % 10); +/* MR10 */ key[i+4] = '\0'; +/* MR10 */ }; + + return key; +} + +/* Push a rule onto the kth FOLLOW stack */ +void +#ifdef __USE_PROTOS +FoPush( char *rule, int k ) +#else +FoPush( rule, k ) +char *rule; +int k; +#endif +{ + RuleEntry *r; + require(rule!=NULL, "FoPush: tried to push NULL rule"); + require(k<=CLL_k, "FoPush: tried to access non-existent stack"); + + /*fprintf(stderr, "FoPush(%s)\n", rule);*/ + r = (RuleEntry *) hash_get(Rname, rule); + if ( r == NULL ) {fatal_internal( eMsg1("rule %s must be defined but isn't", rule) );} + if ( FoStack[k] == NULL ) /* Does the kth stack exist yet? */ + { + /*fprintf(stderr, "allocating FoStack\n");*/ + FoStack[k] = (int *) calloc(FoStackSize, sizeof(int)); + require(FoStack[k]!=NULL, "FoPush: cannot allocate FOLLOW stack\n"); + } + if ( FoTOS[k] == NULL ) + { + FoTOS[k]=FoStack[k]; + *(FoTOS[k]) = r->rulenum; + } + else + { +#ifdef MEMCHK + require(valid(FoStack[k]), "FoPush: invalid FoStack"); +#endif + if ( FoTOS[k] >= &(FoStack[k][FoStackSize-1]) ) + fatal( eMsgd("exceeded max depth of FOLLOW recursion (%d)\n", + FoStackSize) ); + require(FoTOS[k]>=FoStack[k], + eMsg1("FoPush: FoStack stack-ptr is playing out of its sandbox", + rule)); + ++(FoTOS[k]); + *(FoTOS[k]) = r->rulenum; + } + { + /* +**** int *p; +**** fprintf(stderr, "FoStack[k=%d]:\n", k); +**** for (p=FoStack[k]; p<=FoTOS[k]; p++) +**** { +**** fprintf(stderr, "\t%s\n", RulePtr[*p]->rname); +**** } + */ + } +} + +/* Pop one rule off of the FOLLOW stack. TOS ptr is NULL if empty. */ +void +#ifdef __USE_PROTOS +FoPop( int k ) +#else +FoPop( k ) +int k; +#endif +{ + require(k<=CLL_k, "FoPop: tried to access non-existent stack"); + /*fprintf(stderr, "FoPop\n");*/ + require(FoTOS[k]>=FoStack[k]&&FoTOS[k]<=&(FoStack[k][FoStackSize-1]), + "FoPop: FoStack stack-ptr is playing out of its sandbox"); + if ( FoTOS[k] == FoStack[k] ) FoTOS[k] = NULL; + else (FoTOS[k])--; +} + +/* Compute FOLLOW cycle. + * Mark all FOLLOW sets for rules in cycle as incomplete. + * Then, save cycle on the cycle list (Cycles) for later resolution. + * The Cycle is stored in the form: + * (head of cycle==croot, rest of rules in cycle==cyclicDep) + * + * e.g. (Fo means "FOLLOW of", "-->" means requires or depends on) + * + * Fo(x)-->Fo(a)-->Fo(b)-->Fo(c)-->Fo(x) + * ^----Infinite recursion (cycle) + * + * the cycle would be: x -> {a,b,c} or stored as (x,{a,b,c}). Fo(x) depends + * on the FOLLOW of a,b, and c. The root of a cycle is always complete after + * Fo(x) finishes. Fo(a,b,c) however are not. It turns out that all rules + * in a FOLLOW cycle have the same FOLLOW set. + */ +void +#ifdef __USE_PROTOS +RegisterCycle( char *rule, int k ) +#else +RegisterCycle( rule, k ) +char *rule; +int k; +#endif +{ + CacheEntry *f; + Cycle *c; + int *p; + RuleEntry *r; + require(rule!=NULL, "RegisterCycle: tried to register NULL rule"); + require(k<=CLL_k, "RegisterCycle: tried to access non-existent stack"); + + /*fprintf(stderr, "RegisterCycle(%s)\n", rule);*/ + /* Find cycle start */ + r = (RuleEntry *) hash_get(Rname, rule); + require(r!=NULL,eMsg1("rule %s must be defined but isn't", rule)); + require(FoTOS[k]>=FoStack[k]&&FoTOS[k]<=&(FoStack[k][FoStackSize-1]), + eMsg1("RegisterCycle(%s): FoStack stack-ptr is playing out of its sandbox", + rule)); +/*** if ( FoTOS[k]<FoStack[k]||FoTOS[k]>&(FoStack[k][FoStackSize-1]) ) +**** { +**** fprintf(stderr, "RegisterCycle(%s): FoStack stack-ptr is playing out of its sandbox\n", +**** rule); +**** fprintf(stderr, "RegisterCycle: sp==0x%x out of bounds 0x%x...0x%x\n", +**** FoTOS[k], FoStack[k], &(FoStack[k][FoStackSize-1])); +**** exit(PCCTS_EXIT_FAILURE); +**** } +****/ + +#ifdef MEMCHK + require(valid(FoStack[k]), "RegisterCycle: invalid FoStack"); +#endif + for (p=FoTOS[k]; *p != r->rulenum && p >= FoStack[k]; --p) {;} + require(p>=FoStack[k], "RegisterCycle: FoStack is screwed up beyond belief"); + if ( p == FoTOS[k] ) return; /* don't worry about cycles to oneself */ + + /* compute cyclic dependents (rules in cycle except head) */ + c = newCycle; + require(c!=NULL, "RegisterCycle: couldn't alloc new cycle"); + c->cyclicDep = empty; + c->croot = *p++; /* record root of cycle */ + for (; p<=FoTOS[k]; p++) + { + /* Mark all dependent rules as incomplete */ + f = (CacheEntry *) hash_get(Fcache, Fkey(RulePtr[*p]->rname,'o',k)); + if ( f==NULL ) + { + f = newCacheEntry( Fkey(RulePtr[*p]->rname,'o',k) ); + hash_add(Fcache, Fkey(RulePtr[*p]->rname,'o',k), (Entry *)f); + } + f->incomplete = TRUE; + + set_orel(*p, &(c->cyclicDep)); /* mark rule as dependent of croot */ + } + list_add(&(Cycles[k]), (void *)c); +} + +/* make all rules in cycle complete + * + * while ( some set has changed ) do + * for each cycle do + * if degree of FOLLOW set for croot > old degree then + * update all FOLLOW sets for rules in cyclic dependency + * change = TRUE + * endif + * endfor + * endwhile + */ +void +#ifdef __USE_PROTOS +ResolveFoCycles( int k ) +#else +ResolveFoCycles( k ) +int k; +#endif +{ + ListNode *p, *q; + Cycle *c; + int changed = 1; + CacheEntry *f,*g; + int r; +/* int i; */ /* MR10 not useful */ + unsigned d; + + unsigned *cursor; /* MR10 */ + unsigned *origin; /* MR10 */ + + /*fprintf(stderr, "Resolving following cycles for %d\n", k);*/ + while ( changed ) + { + changed = 0; +/* MR10 i = 0; */ + for (p = Cycles[k]->next; p!=NULL; p=p->next) + { + c = (Cycle *) p->elem; + /*fprintf(stderr, "cycle %d: %s -->", i++, RulePtr[c->croot]->rname);*/ + /*s_fprT(stderr, c->cyclicDep);*/ + /*fprintf(stderr, "\n");*/ + f = (CacheEntry *) + hash_get(Fcache, Fkey(RulePtr[c->croot]->rname,'o',k)); + require(f!=NULL, eMsg1("FOLLOW(%s) must be in cache but isn't", RulePtr[c->croot]->rname) ); + if ( (d=set_deg(f->fset)) > c->deg ) + { + /*fprintf(stderr, "Fo(%s) has changed\n", RulePtr[c->croot]->rname);*/ + changed = 1; + c->deg = d; /* update cycle FOLLOW set degree */ + +/* MR10 */ origin=set_pdq(c->cyclicDep); +/* MR10 */ for (cursor=origin; *cursor != nil; cursor++) { +/* MR10 */ r=*cursor; + +/******** while ( !set_nil(c->cyclicDep) ) { *****/ +/******** r = set_int(c->cyclicDep); *****/ +/******** set_rm(r, c->cyclicDep); *****/ + + /*fprintf(stderr, "updating Fo(%s)\n", RulePtr[r]->rname);*/ + g = (CacheEntry *) + hash_get(Fcache, Fkey(RulePtr[r]->rname,'o',k)); + require(g!=NULL, eMsg1("FOLLOW(%s) must be in cache but isn't", RulePtr[r]->rname) ); + set_orin(&(g->fset), f->fset); + g->incomplete = FALSE; + } +/* MR10 */ free( (char *) origin); +/* MR10 */ origin=NULL; + } + } +/* MR10 - this if statement appears to be meaningless since i is always 0 */ +/* MR10 if ( i == 1 ) changed = 0; */ /* if only 1 cycle, no need to repeat */ + } + /* kill Cycle list */ + for (q = Cycles[k]->next; q != NULL; q=p) + { + p = q->next; + set_free( ((Cycle *)q->elem)->cyclicDep ); + free((char *)q); + } + free( (char *)Cycles[k] ); + Cycles[k] = NULL; +} + + + /* P r i n t i n g S y n t a x D i a g r a m s */ + +static void +#ifdef __USE_PROTOS +pBlk( Junction *q, int btype ) +#else +pBlk( q, btype ) +Junction *q; +int btype; +#endif +{ + int k,a; + Junction *alt, *p; + + q->end->pvisited = TRUE; + if ( btype == aLoopBegin ) + { + require(q->p2!=NULL, "pBlk: invalid ()* block"); + PRINT(q->p1); + alt = (Junction *)q->p2; + PRINT(alt->p1); + if ( PrintAnnotate ) + { + printf(" /* Opt "); + k = 1; + while ( !set_nil(alt->fset[k]) ) + { + s_fprT(stdout, alt->fset[k]); + if ( k++ == CLL_k ) break; + if ( !set_nil(alt->fset[k]) ) printf(", "); + } + printf(" */\n"); + } + return; + } + for (a=1,alt=q; alt != NULL; alt= (Junction *) alt->p2, a++) + { + if ( alt->p1 != NULL ) PRINT(alt->p1); + if ( PrintAnnotate ) + { + printf( " /* [%d] ", alt->altnum); + k = 1; + while ( !set_nil(alt->fset[k]) ) + { + s_fprT(stdout, alt->fset[k]); + if ( k++ == CLL_k ) break; + if ( !set_nil(alt->fset[k]) ) printf(", "); + } + if ( alt->p2 == NULL && btype == aOptBlk ) + printf( " (optional branch) */\n"); + else printf( " */\n"); + } + + /* ignore implied empty alt of Plus blocks */ + if ( alt->p2 != NULL && ((Junction *)alt->p2)->ignore ) break; + + if ( alt->p2 != NULL && !(((Junction *)alt->p2)->p2==NULL && btype == aOptBlk) ) + { + if ( pLevel == 1 ) + { + printf("\n"); + if ( a+1==pAlt1 || a+1==pAlt2 ) printf("=>"); + printf("\t"); + } + else printf(" "); + printf("|"); + if ( pLevel == 1 ) + { + p = (Junction *) ((Junction *)alt->p2)->p1; + while ( p!=NULL ) + { + if ( p->ntype==nAction ) + { + p=(Junction *)((ActionNode *)p)->next; + continue; + } + if ( p->ntype!=nJunction ) + { + break; + } + if ( p->jtype==EndBlk || p->jtype==EndRule ) + { + p = NULL; + break; + } + p = (Junction *)p->p1; + } + if ( p==NULL ) printf("\n\t"); /* Empty alt? */ + } + } + } + q->end->pvisited = FALSE; +} + +/* How to print out a junction */ +void +#ifdef __USE_PROTOS +pJunc( Junction *q ) +#else +pJunc( q ) +Junction *q; +#endif +{ + int dum_k; + int doing_rule; + require(q!=NULL, "pJunc: NULL node"); + require(q->ntype==nJunction, "pJunc: not junction"); + + if ( q->pvisited == TRUE ) return; + q->pvisited = TRUE; + switch ( q->jtype ) + { + case aSubBlk : + if ( PrintAnnotate ) First(q, 1, q->jtype, &dum_k); + if ( q->end->p1 != NULL && ((Junction *)q->end->p1)->ntype==nJunction && + ((Junction *)q->end->p1)->jtype == EndRule ) doing_rule = 1; + else doing_rule = 0; + pLevel++; + if ( pLevel==1 ) + { + if ( pAlt1==1 ) printf("=>"); + printf("\t"); + } + else printf(" "); + if ( doing_rule ) + { + if ( pLevel==1 ) printf(" "); + pBlk(q,q->jtype); + } + else { + printf("("); + if ( pLevel==1 ) printf(" "); + pBlk(q,q->jtype); + if ( pLevel>1 ) printf(" "); + printf(")"); + } + if ( q->guess ) printf("?"); + pLevel--; + if ( PrintAnnotate ) freeBlkFsets(q); + if ( q->end->p1 != NULL ) PRINT(q->end->p1); + break; + case aOptBlk : + if ( PrintAnnotate ) First(q, 1, q->jtype, &dum_k); + pLevel++; + if ( pLevel==1 ) + { + if ( pAlt1==1 ) printf("=>"); + printf("\t"); + } + else printf(" "); + printf("{"); + if ( pLevel==1 ) printf(" "); + pBlk(q,q->jtype); + if ( pLevel>1 ) printf(" "); + else printf("\n\t"); + printf("}"); + pLevel--; + if ( PrintAnnotate ) freeBlkFsets(q); + if ( q->end->p1 != NULL ) PRINT(q->end->p1); + break; + case aLoopBegin : + if ( PrintAnnotate ) First(q, 1, q->jtype, &dum_k); + pLevel++; + if ( pLevel==1 ) + { + if ( pAlt1==1 ) printf("=>"); + printf("\t"); + } + else printf(" "); + printf("("); + if ( pLevel==1 ) printf(" "); + pBlk(q,q->jtype); + if ( pLevel>1 ) printf(" "); + else printf("\n\t"); + printf(")*"); + pLevel--; + if ( PrintAnnotate ) freeBlkFsets(q); + if ( q->end->p1 != NULL ) PRINT(q->end->p1); + break; + case aLoopBlk : + if ( PrintAnnotate ) First(q, 1, q->jtype, &dum_k); + pBlk(q,q->jtype); + if ( PrintAnnotate ) freeBlkFsets(q); + break; + case aPlusBlk : + if ( PrintAnnotate ) First(q, 1, q->jtype, &dum_k); + pLevel++; + if ( pLevel==1 ) + { + if ( pAlt1==1 ) printf("=>"); + printf("\t"); + } + else printf(" "); + printf("("); + if ( pLevel==1 ) printf(" "); + pBlk(q,q->jtype); + if ( pLevel>1 ) printf(" "); + printf(")+"); + pLevel--; + if ( PrintAnnotate ) freeBlkFsets(q); + if ( q->end->p1 != NULL ) PRINT(q->end->p1); + break; + case EndBlk : + break; + case RuleBlk : + printf( "\n%s :\n", q->rname); + PRINT(q->p1); + if ( q->p2 != NULL ) PRINT(q->p2); + break; + case Generic : + if ( q->p1 != NULL ) PRINT(q->p1); + q->pvisited = FALSE; + if ( q->p2 != NULL ) PRINT(q->p2); + break; + case EndRule : + printf( "\n\t;\n"); + break; + } + q->pvisited = FALSE; +} + +/* How to print out a rule reference node */ +void +#ifdef __USE_PROTOS +pRuleRef( RuleRefNode *p ) +#else +pRuleRef( p ) +RuleRefNode *p; +#endif +{ + require(p!=NULL, "pRuleRef: NULL node"); + require(p->ntype==nRuleRef, "pRuleRef: not rule ref node"); + + printf( " %s", p->text); + PRINT(p->next); +} + +/* How to print out a terminal node */ +void +#ifdef __USE_PROTOS +pToken( TokNode *p ) +#else +pToken( p ) +TokNode *p; +#endif +{ + require(p!=NULL, "pToken: NULL node"); + require(p->ntype==nToken, "pToken: not token node"); + + if ( p->wild_card ) printf(" ."); + printf( " %s", TerminalString(p->token)); + PRINT(p->next); +} + +/* How to print out a terminal node */ +void +#ifdef __USE_PROTOS +pAction( ActionNode *p ) +#else +pAction( p ) +ActionNode *p; +#endif +{ + require(p!=NULL, "pAction: NULL node"); + require(p->ntype==nAction, "pAction: not action node"); + + PRINT(p->next); +} + + /* F i l l F o l l o w L i s t s */ + +/* + * Search all rules for all rule reference nodes, q to rule, r. + * Add q->next to follow list dangling off of rule r. + * i.e. + * + * r: -o-R-o-->o--> Ptr to node following rule r in another rule + * | + * o--> Ptr to node following another reference to r. + * + * This is the data structure employed to avoid FOLLOW set computation. We + * simply compute the FIRST (reach) of the EndRule Node which follows the + * list found at the end of all rules which are referenced elsewhere. Rules + * not invoked by other rules have no follow list (r->end->p1==NULL). + * Generally, only start symbols are not invoked by another rule. + * + * Note that this mechanism also gives a free cross-reference mechanism. + * + * The entire syntax diagram is layed out like this: + * + * SynDiag + * | + * v + * o-->R1--o + * | + * o-->R2--o + * | + * ... + * | + * o-->Rn--o + * + */ +void +#ifdef __USE_PROTOS +FoLink( Node *p ) +#else +FoLink( p ) +Node *p; +#endif +{ + RuleEntry *q; + Junction *j = (Junction *) p; + RuleRefNode *r = (RuleRefNode *) p; + + if ( p==NULL ) return; + require(p->ntype>=1 && p->ntype<=NumNodeTypes, + eMsgd("FoLink: invalid diagram node: ntype==%d",p->ntype)); + switch ( p->ntype ) + { + case nJunction : + if ( j->fvisited ) return; + if ( j->jtype == EndRule ) return; + j->fvisited = TRUE; + FoLink( j->p1 ); + FoLink( j->p2 ); +/* MR14 */ +/* MR14 */ /* Need to determine whether the guess block is an */ +/* MR14 */ /* of the form (alpha)? beta before follow sets are */ +/* MR14 */ /* computed. This is necessary to solve problem */ +/* MR14 */ /* of doing follow on the alpha of an (alpha)? beta block. */ +/* MR14 */ +/* MR14 */ /* This is performed by analysis_point as a side-effect. */ +/* MR14 */ +/* MR14 */ +/* MR14 */ if (j->jtype == aSubBlk && j->guess) { +/* MR14 */ Junction *ignore; +/* MR14 */ ignore=analysis_point(j); +/* MR14 */ } +/* MR14 */ + return; + case nRuleRef : + if ( r->linked ) return; + q = (RuleEntry *) hash_get(Rname, r->text); + if ( q == NULL ) + { + warnFL( eMsg1("rule %s not defined",r->text), FileStr[r->file], r->line ); + } + else + { + if ( r->parms!=NULL && RulePtr[q->rulenum]->pdecl==NULL ) + { + warnFL( eMsg1("rule %s accepts no parameter(s)", r->text), + FileStr[r->file], r->line ); + } + if ( r->parms==NULL && RulePtr[q->rulenum]->pdecl!=NULL ) + { + warnFL( eMsg1("rule %s requires parameter(s)", r->text), + FileStr[r->file], r->line ); + } + if ( r->assign!=NULL && RulePtr[q->rulenum]->ret==NULL ) + { + warnFL( eMsg1("rule %s yields no return value(s)", r->text), + FileStr[r->file], r->line ); + } + if ( r->assign==NULL && RulePtr[q->rulenum]->ret!=NULL ) + { + warnFL( eMsg1("rule %s returns a value(s)", r->text), + FileStr[r->file], r->line ); + } + if ( !r->linked ) + { + addFoLink( r->next, r->rname, RulePtr[q->rulenum] ); + r->linked = TRUE; + } + } + FoLink( r->next ); + return; + case nToken : + FoLink( ((TokNode *)p)->next ); + return; + case nAction : + FoLink( ((ActionNode *)p)->next ); + return; + default : + fatal_internal("invalid node type"); + } +} + +/* + * Add a reference to the end of a rule. + * + * 'r' points to the RuleBlk node in a rule. r->end points to the last node + * (EndRule jtype) in a rule. + * + * Initial: + * r->end --> o + * + * After: + * r->end --> o-->o--> Ptr to node following rule r in another rule + * | + * o--> Ptr to node following another reference to r. + * + * Note that the links are added to the head of the list so that r->end->p1 + * always points to the most recently added follow-link. At the end, it should + * point to the last reference found in the grammar (starting from the 1st rule). + */ +void +#ifdef __USE_PROTOS +addFoLink( Node *p, char *rname, Junction *r ) +#else +addFoLink( p, rname, r ) +Node *p; +char *rname; +Junction *r; +#endif +{ + Junction *j; + require(r!=NULL, "addFoLink: incorrect rule graph"); + require(r->end!=NULL, "addFoLink: incorrect rule graph"); + require(r->end->jtype==EndRule, "addFoLink: incorrect rule graph"); + require(p!=NULL, "addFoLink: NULL FOLLOW link"); + + j = newJunction(); + j->rname = rname; /* rname on follow links point to target rule */ + j->p1 = p; /* link to other rule */ + j->p2 = (Node *) r->end->p1;/* point to head of list */ + r->end->p1 = (Node *) j; /* reset head to point to new node */ +} + +void +#ifdef __USE_PROTOS +GenCrossRef( Junction *p ) +#else +GenCrossRef( p ) +Junction *p; +#endif +{ + set a; + Junction *j; + RuleEntry *q; + unsigned e; + require(p!=NULL, "GenCrossRef: why are you passing me a null grammar?"); + + printf("Cross Reference:\n\n"); + a = empty; + for (; p!=NULL; p = (Junction *)p->p2) + { + printf("Rule %20s referenced by {", p->rname); + /* make a set of rules for uniqueness */ + for (j = (Junction *)(p->end)->p1; j!=NULL; j = (Junction *)j->p2) + { + q = (RuleEntry *) hash_get(Rname, j->rname); + require(q!=NULL, "GenCrossRef: FoLinks are screwed up"); + set_orel(q->rulenum, &a); + } + for (; !set_nil(a); set_rm(e, a)) + { + e = set_int(a); + printf(" %s", RulePtr[e]->rname); + } + printf(" }\n"); + } + set_free( a ); +} + +/* + The single argument is a pointer to the start of an element of a + C++ style function prototypet list. Given a pointer to the start of + an formal we must locate the comma (or the end of the string) + and locate the datatype, formal name, and initial value expression. + + The function returns a pointer to the character following the comma + which terminates the formal declaration, or a pointer to the end of + the string if none was found. + + I thought we were parsing specialists, how come I'm doing this by + hand written code ? + + Examples of input: + + Foo f, + Foo f = Foo(1), + Foo f = Foo(1,2), + Foo f = &farray[1,2], + Foo f = ",", + Foo f = ',', + TFoo<int,char> f = TFoo<int,char>(1,2), + + A non-zero value for nesting indicates a problem matching '(' and ')', + '[' and ']', '<' and '>', '{' and '}', or improperly terminated string + or character literal. + +*/ + + +/* + * Don't care if it is a valid string literal or not, just find the end + * Start with pointer to leading "\"" + */ + +#ifdef __USE_PROTOS +char * skipStringLiteral(char *pCurrent) +#else +char * skipStringLiteral(pCurrent) +char *pCurrent; +#endif +{ + char *p = pCurrent; + if (*p == 0) return p; + require (*p == '\"', "skipStringLiteral") + p++; + for (p = p; *p != 0; p++) { + if (*p == '\\') { + p++; + if (*p == 0) break; + p++; + } + if (*p == '\"') { + p++; + break; + } + } + return p; +} + +/* + * Don't care if it is a valid character literal or not, just find the end + * Start with pointer to leading "'" + */ + +#ifdef __USE_PROTOS +char * skipCharLiteral(char *pStart) +#else +char * skipCharLiteral(pStart) + char *pStart; +#endif +{ + char *p = pStart; + if (*p == 0) return p; + require (*p == '\'', "skipCharLiteral") + p++; + for (p = p; *p != 0; p++) { + if (*p == '\\') { + p++; + if (*p == 0) break; + p++; + } + if (*p == '\'') { + p++; + break; + } + } + return p; +} + +#ifdef __USE_PROTOS +char * skipSpaces(char *pStart) +#else +char * skipSpaces(pStart) +char * pStart; +#endif +{ + char *p = pStart; + while (*p != 0 && isspace(*p)) p++; + return p; +} + +#ifdef __USE_PROTOS +char * skipToSeparatorOrEqualSign(char *pStart, int *pNest) +#else +char * skipToSeparatorOrEqualSign(pStart, pNest) +char *pStart; +int *pNest; +#endif +{ + char *p = pStart; + + int nest = 0; + + *pNest = (-1); + + while (*p != 0) { + switch (*p) { + + case '(' : + case '[' : + case '<' : + case '{' : + nest++; + p++; + break; + + case ')' : + case ']' : + case '>' : + case '}' : + nest--; + p++; + break; + + case '"' : + p = skipStringLiteral(p); + break; + + case '\'' : + p = skipCharLiteral(p); + break; + + case '\\': + p++; + if (*p == 0) goto EXIT; + p++; + break; + + case ',': + case '=': + if (nest == 0) goto EXIT; + p++; + break; + + default: + p++; + } + } +EXIT: + *pNest = nest; + return p; +} + +#ifdef __USE_PROTOS +char * skipToSeparator(char *pStart, int *pNest) +#else +char * skipToSeparator(pStart, pNest) +char *pStart; +int *pNest; +#endif +{ + char * p = pStart; + for ( ; ; ) { + p = skipToSeparatorOrEqualSign(p, pNest); + if (*pNest != 0) return p; + if (*p == ',') return p; + if (*p == 0) return p; + p++; + } +} + +/* skip to just past the "=" separating the declaration from the initialization value */ + +#ifdef __USE_PROTOS +char * getInitializer(char *pStart) +#else +char * getInitializer(pStart) +char * pStart; +#endif +{ + char *p; + char *pDataType; + char *pSymbol; + char *pEqualSign; + char *pValue; + char *pSeparator; + int nest = 0; + + require(pStart!=NULL, "getInitializer: invalid string"); + + p = endFormal(pStart, + &pDataType, + &pSymbol, + &pEqualSign, + &pValue, + &pSeparator, + &nest); + if (nest != 0) return NULL; + if (pEqualSign == NULL) return NULL; + if (pValue == NULL) return NULL; + return strBetween(pValue, NULL, pSeparator); +} + +/* + Examines the string from pStart to pEnd-1. + If the string has 0 length or is entirely white space + returns 1. Otherwise 0. +*/ + +#ifdef __USE_PROTOS +int isWhiteString(const char *pStart, const char *pEnd) +#else +int isWhiteString(pStart, pEnd) +const char *pStart; +const char *pEnd; +#endif +{ + const char *p; + for (p = pStart; p < pEnd; p++) { + if (! isspace(*p)) return 0; + } + return 1; +} + +/* + This replaces HasComma() which couldn't distinguish + + foo ["a,b"] + + from: + + foo[a,b] + +*/ + +#ifdef __USE_PROTOS +int hasMultipleOperands(char *pStart) +#else +int hasMultipleOperands(pStart) +char *pStart; +#endif +{ + char *p = pStart; + int nest = 0; + + p = skipSpaces(p); + if (*p == 0) return 0; + p = skipToSeparator(p, &nest); + if (nest == 0 && *p == ',') return 1; + return 0; +} + + +#define MAX_STR_BETWEEN_WORK_AREA 1000 + +static char strBetweenWorkArea[MAX_STR_BETWEEN_WORK_AREA]; + + +/* + strBetween(pStart, pNext, pStop) + + Creates a null terminated string by copying the text between two pointers + to a work area. The start of the string is pStart. The end of the string + is the character before pNext, or if pNext is null then the character before + pStop. Trailing spaces are not included in the copy operation. + + This is used when a string contains several parts. The pNext part may be + optional. The pStop will stop the scan when the optional part is not present + (is a null pointer). +*/ + +#ifdef __USE_PROTOS +char *strBetween(char *pStart, char *pNext, char *pStop) +#else +char *strBetween(pStart, pNext, pStop) +char *pStart; +char *pNext; +char *pStop; +#endif +{ + char *p; + char *q = strBetweenWorkArea; + const char *pEnd; + + pEnd = (pNext != NULL) ? pNext : pStop; + + require (pEnd != NULL, "pEnd == NULL"); + require (pEnd >= pStart, "pEnd < pStart"); + for (pEnd--; pEnd >= pStart; pEnd--) { /* MR31 */ + if (! isspace(*pEnd)) break; + } + for (p = pStart; + p <= pEnd && q < &strBetweenWorkArea[MAX_STR_BETWEEN_WORK_AREA-2]; + p++, q++) { + *q = *p; + } + *q = 0; + return strBetweenWorkArea; +} + +/* + function Returns pointer to character following separator at + value which to continue search for next formal. If at the + end of the string a pointer to the null byte at the + end of the string is returned. + + pStart Pointer to the starting position of the formal list + + This may be the middle of a longer string, for example + when looking for the end of formal #3 starting from + the middle of the complete formal list. + + ppDataType Returns a pointer to the start of the data type in the + formal. Example: pointer to "Foo". + + ppSymbol Returns a pointer to the start of the formal symbol. + Example: pointer to "f". + + ppEqualSign Returns a pointer to the equal sign separating the + formal symbol from the initial value. If there is + no "=" then this will be NULL. + + ppValue Returns a pointer to the initial value part of the + formal declaration. Example: pointer to "&farray[1,2]" + + ppSeparator Returns a pointer to the character which terminated the + scan. This should be a pointer to a comma or a null + byte which terminates the string. + + pNest Returns the nesting level when a separator was found. + This is non-zero for any kind of error. This is zero + for a successful parse of this portion of the formal + list. + +*/ + +#ifdef __USE_PROTOS +char * endFormal(char *pStart, + char **ppDataType, + char **ppSymbol, + char **ppEqualSign, + char **ppValue, + char **ppSeparator, + int *pNest) +#else +char * endFormal(pStart, + ppDataType, + ppSymbol, + ppEqualSign, + ppValue, + ppSeparator, + pNest) +char *pStart; +char **ppDataType; +char **ppSymbol; +char **ppEqualSign; +char **ppValue; +char **ppSeparator; +int *pNest; + +#endif +{ + char *p = pStart; + char *q; + + *ppDataType = NULL; + *ppSymbol = NULL; + *ppEqualSign = NULL; + *ppValue = NULL; + *ppSeparator = NULL; + + *pNest = 0; + + /* The first non-blank is the start of the datatype */ + + p = skipSpaces(p); + if (*p == 0) goto EXIT; + *ppDataType = p; + + /* We are not looking for the symbol, we are looking + for the separator that follows the symbol. Then + we'll back up. + + Search for the ',' or '=" or null terminator. + */ + + p = skipToSeparatorOrEqualSign(p, pNest); + + if (*pNest != 0) goto EXIT; + + /* + Work backwards to find start of symbol + Skip spaces between the end of symbol and separator + Assume that there are no spaces in the formal, but + there is a space preceding the formal + */ + + for (q = &p[-1]; q >= *ppDataType; q--) { + if (! isspace(*q)) break; + } + if (q < *ppDataType) goto EXIT; + + /* + MR26 Handle things like: IIR_Bool (IIR_Decl::*constraint)() + Backup until we hit the end of a symbol string, then find the + start of the symbol string. This wont' work for functions + with prototypes, but works for the most common cases. For + others, use typedef names. + */ + +/* MR26 */ for (q = q; q >= *ppDataType; q--) { +/* MR26 */ if (isalpha(*q) || isdigit(*q) || *q == '_' || *q == '$') break; +/* MR26 */ } +/* MR26 */ if (q < *ppDataType) goto EXIT; + + for (q = q; q >= *ppDataType; q--) { + if ( ! (isalpha(*q) || isdigit(*q) || *q == '_' || *q == '$')) break; + } + + *ppSymbol = &q[1]; + + if (*p == ',' || *p == 0) { + *ppSeparator = p; + goto EXIT; + } + + *ppEqualSign = p; + p = skipSpaces(++p); + *ppValue = p; + if (*p == 0) goto EXIT; + + + while (*p != 0 && *pNest == 0 && *p != ',') { + p = skipToSeparator(p, pNest); + } + if (*pNest == 0) *ppSeparator = p; + +EXIT: + if (*p == ',') p++; + return p; +} diff --git a/pccts/antlr/mode.h b/pccts/antlr/mode.h new file mode 100644 index 0000000..592e811 --- /dev/null +++ b/pccts/antlr/mode.h @@ -0,0 +1,12 @@ +#define START 0 +#define STRINGS 1 +#define ACTION_STRINGS 2 +#define ACTION_CHARS 3 +#define ACTION_COMMENTS 4 +#define TOK_DEF_COMMENTS 5 +#define TOK_DEF_CPP_COMMENTS 6 +#define ACTION_CPP_COMMENTS 7 +#define CPP_COMMENTS 8 +#define COMMENTS 9 +#define ACTIONS 10 +#define PARSE_ENUM_FILE 11 diff --git a/pccts/antlr/mrhoist.c b/pccts/antlr/mrhoist.c new file mode 100644 index 0000000..2439f37 --- /dev/null +++ b/pccts/antlr/mrhoist.c @@ -0,0 +1,3030 @@ +/* + * mrhoist.c + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33MR10 + * + */ + +#include <stdio.h> + +#include "pcctscfg.h" + +#include "set.h" +#include "syn.h" +#include "hash.h" +#include "generic.h" +#include "dlgdef.h" +#include <ctype.h> + +#ifdef __USE_PROTOS +void dumppred(Predicate *); +#else +void dumppred(); +#endif + +/* + Try to determine whether predicate "first" is true for + all cases where "second" is true. Comparison takes place + without regard to context. + Assumes that predicate symbols have been expanded. + Assumes that there are no NAND or NOR nodes + +*/ + +#ifdef __USE_PROTOS +int MR_secondPredicateUnreachable(Predicate *first,Predicate *second) +#else +int MR_secondPredicateUnreachable(first,second) + Predicate *first; + Predicate *second; +#endif +{ + Predicate *f; + Predicate *s; + + if (first == NULL) { + return 1; + } else if (second == NULL) { + return 0; + } else if (first->down == NULL && second->down == NULL) { + if (first->source == second->source && + first->inverted == second->inverted) { + return 1; /* look identical - will never reach alt2 */ + } else { + return 0; /* look different */ + }; + } else if (first->down == NULL && second->down != NULL) { + + if (second->expr == PRED_AND_LIST) { + + /* unreachable if first covers any child of second */ + + for (s=second->down; s != NULL; s=s->right) { + if (MR_secondPredicateUnreachable(first,s)) { + return 1; + }; + }; + return 0; + } else if (second->expr == PRED_OR_LIST) { + + /* unreachable if first covers every child of second */ + + for (s=second->down; s != NULL; s=s->right) { + if (!MR_secondPredicateUnreachable(first,s)) { + return 0; + }; + }; + return 1; + } else { + require (0,"Illegal pred->expr"); + return 0; /* MR20 Make compiler happy */ + }; + } else if (first->down != NULL && second->down == NULL) { + if (first->expr == PRED_AND_LIST) { + + /* unreachable if every child of first covers second */ + + for (f=first->down; f != NULL; f=f->right) { + if (!MR_secondPredicateUnreachable(f,second)) { + return 0; + }; + }; + return 1; + } else if (first->expr == PRED_OR_LIST) { + + /* unreachable if any child of first covers second */ + + for (f=first->down; f != NULL; f=f->right) { + if (MR_secondPredicateUnreachable(f,second)) { + return 1; + }; + }; + return 0; + } else { + require (0,"Illegal predicate->expr"); + return 0; /* MR20 Make compiler happy */ + }; + } else { + + if (first->expr == PRED_AND_LIST && second->expr == PRED_AND_LIST) { + + /* unreachable if each child of first covers at least one child of second */ + + for (f=first->down; f != NULL ; f=f->right) { + for (s=second->down; s != NULL ; s=s->right) { + if (MR_secondPredicateUnreachable(f,s)) goto A_next_f; + }; + return 0; +A_next_f: + continue; + }; + return 1; + + } else if (first->expr == PRED_AND_LIST && second->expr == PRED_OR_LIST) { + + /* unreachable if each child of first covers ALL of second's children */ + + for (f=first->down; f != NULL ; f=f->right) { + for (s=second->down; s != NULL ; s=s->right) { + if (!MR_secondPredicateUnreachable(f,s)) return 0; + }; + }; + return 1; + + } else if (first->expr == PRED_OR_LIST && second->expr == PRED_AND_LIST) { + + /* unreachable if any child of second is covered by any child of first */ + + for (f=first->down; f != NULL ; f=f->right) { + for (s=second->down; s != NULL ; s=s->right) { + if (MR_secondPredicateUnreachable(f,s)) return 1; + }; + }; + return 0; + + } else if (first->expr == PRED_OR_LIST && second->expr == PRED_OR_LIST) { + + /* unreachable if every child of second is covered by some child of first */ + + for (f=first->down; f != NULL ; f=f->right) { + for (s=second->down; s != NULL ; s=s->right) { + if (MR_secondPredicateUnreachable(f,s)) goto B_next_f; + }; + return 0; +B_next_f: + continue; + }; + return 1; + + } else { + require (0,"Illegal predicate->expr"); + return 0; /* MR20 Make compiler happy */ + }; + }; + return 0; /* MR20 MSVC 5.0 complains about missing return statement */ +} + +#ifdef __USE_PROTOS +void MR_xxxIndent(FILE *f,int depth) +#else +void MR_xxxIndent(f,depth) + FILE *f; + int depth; +#endif +{ + int i; + + for (i=0; i<depth ; i++) { + fprintf(f," "); + }; +} + +#ifdef __USE_PROTOS +void MR_stderrIndent(int depth) +#else +void MR_stderrIndent(depth) + int depth; +#endif +{ + MR_xxxIndent(stderr,depth); +} + +#ifdef __USE_PROTOS +void MR_outputIndent(int depth) +#else +void MR_outputIndent(depth) + int depth; +#endif +{ + MR_xxxIndent(output,depth); +} + +#ifdef __USE_PROTOS +void MR_set_reuse(set *s) +#else +void MR_set_reuse(s) + set *s; +#endif +{ + set_free(*s); + *s=empty; +} + +#ifdef __USE_PROTOS +void MR_dumpPredRuleRefStack(FILE *iounit,int indent) +#else +void MR_dumpPredRuleRefStack(iounit,indent) + FILE *iounit; + int indent; +#endif +{ + int i; + int j; + int count=MR_PredRuleRefStack.count; + RuleRefNode *rrn=NULL; + Junction *lastOne; + + if (count == 0) { + fprintf(iounit,"empty\n"); + return; + }; + for (i=0; i < count; i++) { + rrn=(RuleRefNode *) MR_PredRuleRefStack.data[i]; + for (j=0; j<indent; j++) fprintf(iounit," "); + fprintf(iounit,"#%-2d in rule %s (line %d %s) to rule %s\n", + i,rrn->rname,rrn->line,FileStr[rrn->file],rrn->text); + }; + lastOne=MR_ruleReferenced(rrn); + if (lastOne != NULL) { + for (j=0; j<indent; j++) fprintf(iounit," "); + fprintf(iounit,"#%-2d in rule %s (line %d %s)\n", + count,lastOne->rname,lastOne->line,FileStr[lastOne->file]); + }; +} + +#ifdef __USE_PROTOS +void MR_dumpTreeF(FILE *f,int depth,Tree *tree,int across) +#else +void MR_dumpTreeF(f,depth,tree,across) + FILE *f; + Tree *tree; + int depth; + int across; +#endif +{ + int newAcross=across; + + if (tree == NULL ) return; + if (tree->down != NULL ) { + fprintf(output,"\n"); + MR_outputIndent(depth); + fprintf(output, "(root ="); + }; + if (tree->token == ALT ) { + fprintf(output," %-16s","Alt"); + } else if (tree->token==EpToken ) { + fprintf(output,"(%d)%13s",tree->v.rk," "); + } else { + fprintf(output," %-16s",TerminalString(tree->token)); + }; + if (tree->down != NULL) { + fprintf(output,"\n"); + MR_outputIndent(depth+1); + MR_dumpTreeF(f,depth+1,tree->down,1); + newAcross=0; + fprintf(output,"\n"); + MR_outputIndent(depth); + fprintf(output,")"); + }; + if (newAcross > 3) { + fprintf(output,"\n"); + MR_outputIndent(depth); + newAcross=0; + }; + MR_dumpTreeF(f,depth,tree->right,newAcross+1); +} + +#ifdef __USE_PROTOS +void MR_dumpTreeX(int depth,Tree *tree,int across) +#else +void MR_dumpTreeX(depth,tree,across) + Tree *tree; + int depth; + int across; +#endif +{ + MR_dumpTreeF(output,depth,tree,across); +} + +#ifdef __USE_PROTOS +void MR_dumpTokenSet(FILE *f,int depth,set s) +#else +void MR_dumpTokenSet(f,depth,s) + FILE *f; + int depth; + set s; +#endif +{ + int i; + int j; + + unsigned *pdq; + + if (set_nil(s)) { + fprintf(f,"\n"); + MR_xxxIndent(f,depth+1); + fprintf(f,"nil\n"); + return; + }; + + pdq=set_pdq(s); + require(pdq != NULL,"set_pdq failed"); + i=0; + for (i=0 ; ; i=i+4) { + fprintf(f,"\n"); + MR_xxxIndent(f,depth+1); + for (j=0; j < 4 ; j++) { + if (pdq[i+j] == nil) break; + fprintf(f," %-16s",TerminalString(pdq[i+j])); + }; + if (pdq[i+j] == nil) break; + }; + fprintf(f,"\n"); + free( (char *) pdq); +} + +#ifdef __USE_PROTOS +void MR_dumpPred1(int depth,Predicate *p,int withContext) +#else +void MR_dumpPred1(depth,p,withContext) + int depth; + Predicate *p; + int withContext; +#endif +{ + unsigned k; + + if (p == NULL) { + MR_outputIndent(depth); + fprintf(output,"The predicate is empty (or always true)\n\n"); + return; + }; + if (p->down != NULL) { + MR_outputIndent(depth); + if (p->inverted) { + + /* MR14a Left out print expression in fprintf + Reported by Manuel Kessler (mlkessle@cip.physik.uni-wuerzburg.de) + */ + + if (p->expr == PRED_AND_LIST) fprintf(output,"%s NAND (not AND) expr\n\n",p->expr); + if (p->expr == PRED_OR_LIST) fprintf(output,"%s NOR (not OR) expr\n\n",p->expr); + } else { + fprintf(output,"%s expr\n\n",p->expr); + }; + } else { + MR_outputIndent(depth); + fprintf(output,"pred %s <<%s>>?\n", + (p->inverted ? " *not*" : ""), + (p->expr == NULL ? "null expr" : p->expr)); + MR_outputIndent(depth+1); + fprintf(output," "); + fprintf(output," depth=k=%d",p->k); + if (p->source != NULL && p->source->guardpred) { + fprintf(output," (\"=>\" guard)"); + } + if (p->source != NULL && p->source->ampersandPred != NULL) { + fprintf(output," (\"&&\" guard)"); + }; + k=set_int(p->completionSet); + if (k != nil) { + fprintf(output," Incomplete Set at k=%d !",k); + }; + k=set_int(p->completionTree); + if (k != nil) { + fprintf(output," Incomplete Tree at k=%d !",k); + }; + if (p->source != NULL) { + fprintf(output," rule %s line %d %s", + p->source->rname,p->source->line,FileStr[p->source->file]); + }; + fprintf(output,"\n"); + if (withContext && + (HoistPredicateContext || + ! set_nil(p->scontext[1]) || + p->tcontext != NULL)) { + if (p->k == 1) { + MR_outputIndent(depth+1); + fprintf(output,"set context: "); + MR_dumpTokenSet(output,depth+1,p->scontext[1]); + } + if (p->k != 1) { + MR_outputIndent(depth+1); + fprintf(output,"tree context:"); + if (p->tcontext == NULL) { + fprintf(output," null"); + } else { + MR_dumpTreeX(depth+2,p->tcontext,0); + }; + fprintf(output,"\n"); + }; + }; + fprintf(output,"\n"); + }; + if (p->down != NULL) { + MR_dumpPred1(depth+1,p->down,withContext); + }; + if (p->right != NULL) { + MR_dumpPred1(depth,p->right,withContext); + }; +} + +#ifdef __USE_PROTOS +void MR_dumpPred(Predicate *p,int withContext) +#else +void MR_dumpPred(p,withContext) + Predicate *p; + int withContext; +#endif +{ + MR_dumpPred1(0,p,withContext); +} + +#ifdef __USE_PROTOS +Tree * MR_make_tree_from_set(set s) +#else +Tree * MR_make_tree_from_set(s) + set s; +#endif +{ + Tree *t=NULL; + Tree *node; + Tree **tp=&t; + int i; + + unsigned *pdq=set_pdq(s); + + if (pdq != NULL) { + for (i=0 ; pdq[i] != nil ; i++) { + node=tnode( (int) pdq[i]); + *tp=node; + tp=&(node->right); + }; + *tp=NULL; + free ( (char *) pdq); + }; + return t; +} + +#ifdef __USE_PROTOS +void MR_check_pred_too_long(Predicate *p,set completion) +#else +void MR_check_pred_too_long(p,completion) + Predicate *p; + set completion; +#endif +{ + if (p != NULL && + p->source != NULL && + ! p->source->predTooLong) { + if ( !set_nil(completion)) { + p->source->predTooLong=1; +warnFL("It is unusual (but ok) for a semantic predicate to test context past the end of its own rule", + FileStr[p->source->file],p->source->line); + }; + }; +} + +#ifdef __USE_PROTOS +int MR_predicate_context_completed(Predicate *p) +#else +int MR_predicate_context_completed(p) + Predicate *p; +#endif +{ + if (p == NULL) return 1; + if (p->expr != PRED_AND_LIST && + p->expr != PRED_OR_LIST) { + if ( ! set_nil(p->completionSet)) return 0; + if ( ! set_nil(p->completionTree)) return 0; + }; + return MR_predicate_context_completed(p->down) & + MR_predicate_context_completed(p->right); +} + +#ifdef __USE_PROTOS +Node * MR_advance(Node *n) +#else +Node * MR_advance(n) + Node *n; +#endif +{ + if (n == NULL) return NULL; + switch (n->ntype) { + case nJunction: return ((Junction *)n)->p1; + case nToken: return ((TokNode *)n)->next; + case nRuleRef: return ((RuleRefNode *)n)->next; + case nAction: return ((ActionNode *)n)->next; + default: return NULL; + }; + return NULL; /* MSVC 5.0 complains about missing return statement */ +} + +#ifdef __USE_PROTOS +Junction * MR_find_endRule(Node *n) +#else +Junction * MR_find_endRule(n) + Node *n; +#endif +{ + Node *next; + if (n == NULL) return NULL; + for (next=n; next != NULL; next=MR_advance(next)) { + if (next->ntype == nJunction && + ( (Junction *) next)->jtype == EndRule) { + break; + }; + }; + return (Junction *)next; +} + +/* + Intersection: a branch which is shorter is chosen + over one which is longer: (A B C) intersect (A B) yields (A B). + + AND: a branch which is longer is chosen over the one + which is shorter: (A B C) AND (A B) yields (A B C) + +*/ + +#ifdef __USE_PROTOS +Tree *MR_computeTreeIntersection(Tree *l,Tree *r) +#else +Tree *MR_computeTreeIntersection(l,r) + Tree *l; + Tree *r; +#endif +{ + Tree *result=NULL; + Tree **tail; + Tree *p; + Tree *q; + Tree *match; + + if (l == NULL || r == NULL) return NULL; + for (p=l; p != NULL; p=p->right) { + require(p->token != EpToken,"MR_computeTreeIntersection: p->EpToken unexpected\n"); + require (p->token != ALT,"MR_computeTreeIntersection: p->ALT unexpected\n"); + }; + for (q=r; q != NULL; q=q->right) { + require(q->token != EpToken,"MR_computeTreeIntersection: q->EpToken unexpected\n"); + require(q->token != ALT,"MR_computeTreeIntersection: q->ALT unexpected\n"); + }; + + result=tnode(ALT); + tail=&(result->down); + + for (p=l; p != NULL ; p=p->right) { + for (q=r; q != NULL ; q=q->right) { + if (p->token == q->token) { + match=tnode(p->token); + match->down=MR_computeTreeIntersection(p->down,q->down); + *tail=match; + tail=&(match->right); + }; + }; + }; + + *tail=NULL; + result=tshrink(result); + result=tflatten( result ); + result=tleft_factor( result ); + return result; +} + +/* the predicates which are ANDed together have a common + context: they must all have common roots. Thus the + AND operation is more like an OR operation because + branches which are longer are grafted onto shorter + branches of the AND tree. For instance combining + (A B C) with (A B C D) gives (A B C D). There + should never be a case of (A B C) and (A B D) because + they have the same context. + + Actually, this may not be true once one throws in + guard predicates which are defined by the user, not + the context. +*/ + +/* requires input trees to be in "canonical" format */ + +#ifdef __USE_PROTOS +Tree *MR_computeTreeAND(Tree *l,Tree *r) +#else +Tree *MR_computeTreeAND(l,r) + Tree *l; + Tree *r; +#endif +{ + Tree *result=NULL; + Tree **tail; + Tree *p; + Tree *q; + Tree *match; + + if (l == NULL) return tdup(r); + if (r == NULL) return tdup(l); + + for (p=l; p != NULL; p=p->right) { +/**** require(p->token != EpToken,"MR_computeTreeAND: p->EpToken unexpected\n"); ****/ + require (p->token != ALT,"MR_computeTreeAND: p->ALT unexpected\n"); + }; + for (q=r; q != NULL; q=q->right) { +/**** require(q->token != EpToken,"MR_computeTreeAND: q->EpToken unexpected\n"); ****/ + require(q->token != ALT,"MR_computeTreeAND: q->ALT unexpected\n"); + }; + + result=tnode(ALT); + tail=&(result->down); + + for (p=l; p != NULL ; p=p->right) { + for (q=r; q != NULL ; q=q->right) { + if (p->token == q->token) { + match=tnode(p->token); + match->down=MR_computeTreeAND(p->down,q->down); + *tail=match; + tail=&(match->right); + }; + }; + }; + + *tail=NULL; + result=tshrink(result); + result=tflatten( result ); + result=tleft_factor( result ); + return result; +} + +#ifdef __USE_PROTOS +void MR_union_plain_sets1(Predicate *p,set *theUnion) +#else +void MR_union_plain_sets1(p,theUnion) + Predicate *p; + set *theUnion; +#endif +{ + if (p == NULL) return; + MR_union_plain_sets1(p->down,theUnion); + MR_union_plain_sets1(p->right,theUnion); + set_orin(theUnion,p->plainSet); + return; +} + +#ifdef __USE_PROTOS +set MR_union_plain_sets(Predicate *p) +#else +set MR_union_plain_sets(p) + Predicate *p; +#endif +{ + set theUnion; + + theUnion=empty; + + MR_union_plain_sets1(p,&theUnion); + return theUnion; +} + +/* does NOT left factor: do not want to merge + (A B) with (A) to get (A B) + in fact the opposite: (A B) with (A) gives (A) +*/ + +#ifdef __USE_PROTOS +Tree *MR_compute_pred_tree_ctxXX(Predicate *p) +#else +Tree *MR_compute_pred_tree_ctxXX(p) + Predicate *p; +#endif +{ + Tree *result=NULL; + Predicate *q; + Tree *t; + + if (p == NULL) return NULL; + +/* this appears strange: why do we OR the context + of and AND predicate ? It is because of the way + that predicates are evaluated: if the context is + wrong then it's the same as if the predicate was + true. That means that even when one leg of an + AND has unmatched context, if the other leg has + matched context and is true then the predicate + succeeds. It's only when all the legs have unmatched + context that this one can skip evaluation of the + predicates. +*/ + if (p->expr == PRED_OR_LIST || + p->expr == PRED_AND_LIST) { + for (q=p->down; q != NULL ; q=q->right) { + t=MR_compute_pred_tree_ctxXX(q); + result=tappend(result,t); + t=NULL; + }; + + result=tshrink(result); + result=tflatten( result ); + +/* does NOT left factor: do not want to merge + (A B) with (A) to get (A B) + in fact the opposite: (A B) with (A) gives (A) +*/ + +/**** result=tleft_factor( result ); ****/ + return result; + }; + +#if 0 +** if (p->expr == PRED_AND_LIST) { +** +** Predicate *l; +** Predicate *r; +** Tree *l1; +** Tree *r1; +** Tree *prevl1; +** +** l=p->down; +** require (l->right != NULL,"MR_compute_pred_tree - AND has only one child"); +** +**/* l1 and r1 should already be in "canonical" format */ +** +** l1=MR_compute_pred_tree(l); +** for (r=l->right; r != NULL; r=r->right) { +** r1=MR_compute_pred_tree(r); +** prevl1=l1; +** l1=MR_computeTreeAND(l1,r1); +** Tfree(r1); +** Tfree(prevl1); +** }; +** +**/* result from computeTreeAND should be in "canonical" format */ +** +** result=l1; +** +**/* result of MR_computeTreeAND should be in "canonical" format */ +** +** return result; +** }; +#endif + + if (p->k == 1) { + result=MR_make_tree_from_set(p->scontext[1]); + } else { + result=tdup(p->tcontext); + result=MR_remove_epsilon_from_tree(result); + result=tshrink(result); + result=tflatten(result); + result=tleft_factor(result); + }; + return result; +} + +#ifdef __USE_PROTOS +void MR_pred_depth(Predicate *p,int *maxDepth) +#else +void MR_pred_depth(p,maxDepth) + Predicate *p; + int *maxDepth; +#endif +{ + if (p == NULL) return; + if (p->expr != PRED_OR_LIST && + p->expr != PRED_AND_LIST) { + if (p->k > *maxDepth) *maxDepth=p->k; + }; + MR_pred_depth(p->down,maxDepth); + MR_pred_depth(p->right,maxDepth); +} + +/* this computes the OR of all the contexts */ + +#ifdef __USE_PROTOS +set MR_compute_pred_set(Predicate *p) +#else +set MR_compute_pred_set(p) + Predicate *p; +#endif +{ + set result; + Predicate *q; + + result=empty; + + if (p == NULL) return empty; + + if (p->expr == PRED_OR_LIST || + p->expr == PRED_AND_LIST) { /* yes, I do mean PRED_AND_LIST ! */ + /* remember: r1: (A)? => <<p>>? r2; */ + /* r2: (B)? => <<q>>? r3; */ + set t; + + t=empty; + result=empty; + + for (q=p->down; q != NULL; q=q->right) { + t=MR_compute_pred_set(q); + set_orin(&result,t); + set_free(t); + }; + return result; + } else if (p->k > 1) { + return empty; + } else { + return set_dup(p->scontext[1]); + }; +} + +#ifdef __USE_PROTOS +set MR_First(int ck,Junction *j,set *incomplete) +#else +set MR_First(ck,j,incomplete) + int ck; + Junction *j; + set *incomplete; +#endif +{ + Junction *p; + set tokensUsed; + + tokensUsed=empty; + + require(j->ntype==nJunction, "MR_First: non junction passed"); + + p = analysis_point((Junction *)j->p1); + + REACH(p,ck,incomplete,tokensUsed); + + return tokensUsed; +} + +#ifdef __USE_PROTOS +void MR_cleanup_pred_trees(Predicate *p) +#else +void MR_cleanup_pred_trees(p) + Predicate *p; +#endif +{ + Tree *t; + + if (p == NULL) return; + if (p->expr != PRED_OR_LIST && + p->expr != PRED_AND_LIST) { + t=p->tcontext; + t=tshrink(t); + t=tflatten(t); + t=tleft_factor(t); + p->tcontext=t; + }; + MR_cleanup_pred_trees(p->down); + MR_cleanup_pred_trees(p->right); +} + +/* does NOT return canonical tree */ + +#ifdef __USE_PROTOS +Tree * MR_remove_epsilon_from_tree(Tree *t) +#else +Tree * MR_remove_epsilon_from_tree(t) + Tree *t; +#endif +{ + if (t == NULL) return NULL; + + /* I think ALT can be ignored as a special case */ + + if (t->token != EpToken) { + t->down=MR_remove_epsilon_from_tree(t->down); + t->right=MR_remove_epsilon_from_tree(t->right); + return t; + } else { + Tree *u; + u=MR_remove_epsilon_from_tree(t->right); + t->right=NULL; + Tfree(t); + return u; + }; +} + +#ifdef __USE_PROTOS +void MR_complete_set(int predDepth,set *tokensUsed,set *incomplete) +#else +void MR_complete_set(predDepth,tokensUsed,incomplete) + int predDepth; + set *tokensUsed; + set *incomplete; +#endif +{ + int i; + RuleRefNode *ruleRef; + set rk2; + set b; + int k2; + Junction *save_MR_RuleBlkWithHalt; + + if (set_int(*incomplete) > (unsigned) predDepth) { + return; + }; + + require(MR_PredRuleRefStack.count == MR_RuleBlkWithHaltStack.count, + "RuleRefStack and RuleBlkWithHaltStack not same size"); + + require(MR_RuleBlkWithHalt == NULL || + (MR_RuleBlkWithHalt->jtype == RuleBlk && MR_RuleBlkWithHalt->end->halt == TRUE), + "RuleBlkWithHalt has no halt set"); + + save_MR_RuleBlkWithHalt=MR_RuleBlkWithHalt; + + if (MR_RuleBlkWithHalt != NULL) { + MR_RuleBlkWithHalt->end->halt=FALSE; + }; + + for (i=MR_PredRuleRefStack.count-1; i >= 0 ; i--) { + ruleRef=(RuleRefNode *)MR_PredRuleRefStack.data[i]; + if (ruleRef == NULL) continue; + + MR_RuleBlkWithHalt=(Junction *)MR_RuleBlkWithHaltStack.data[i]; + if (MR_RuleBlkWithHalt != NULL) MR_RuleBlkWithHalt->end->halt=TRUE; + + rk2=empty; + b=empty; + + while ( !set_nil(*incomplete) ) { + k2=set_int(*incomplete); + if (k2 > predDepth) break; /* <=== another exit from loop */ + set_rm(k2,*incomplete); + REACH(ruleRef->next,k2,&rk2,b); + set_orin(tokensUsed,b); + set_free(b); + }; + + if (MR_RuleBlkWithHalt != NULL) MR_RuleBlkWithHalt->end->halt=FALSE; + + set_orin(incomplete,rk2); /* remember what we couldn't do */ + set_free(rk2); + if (set_int(*incomplete) > (unsigned) predDepth) break; /* <=== another exit from loop */ + }; + + MR_RuleBlkWithHalt=save_MR_RuleBlkWithHalt; + if (MR_RuleBlkWithHalt != NULL) { + MR_RuleBlkWithHalt->end->halt=TRUE; + }; +} + +#ifdef __USE_PROTOS +void MR_complete_tree(int predDepth,Tree **t,set *incomplete) +#else +void MR_complete_tree(predDepth,t,incomplete) + int predDepth; + Tree **t; + set *incomplete; +#endif +{ + int i; + RuleRefNode *ruleRef; + set rk2; + Tree *u; + unsigned k2; + Junction *save_MR_RuleBlkWithHalt; + int saveConstrainSearch; + + if (set_int(*incomplete) > (unsigned) predDepth) { + return; + }; + + require(MR_PredRuleRefStack.count == MR_RuleBlkWithHaltStack.count, + "RuleRefStack and RuleBlkWithHaltStack not same size"); + + require(MR_RuleBlkWithHalt == NULL || + (MR_RuleBlkWithHalt->jtype == RuleBlk && MR_RuleBlkWithHalt->end->halt == TRUE), + "RuleBlkWithHalt has no halt set"); + + save_MR_RuleBlkWithHalt=MR_RuleBlkWithHalt; + saveConstrainSearch=ConstrainSearch; + ConstrainSearch=0; + + if (MR_RuleBlkWithHalt != NULL) { + MR_RuleBlkWithHalt->end->halt=FALSE; + }; + + for (i=MR_PredRuleRefStack.count-1; i >= 0 ; i--) { + ruleRef=(RuleRefNode *)MR_PredRuleRefStack.data[i]; + if (ruleRef == NULL) continue; + + MR_RuleBlkWithHalt=(Junction *)MR_RuleBlkWithHaltStack.data[i]; + + if (MR_RuleBlkWithHalt != NULL) MR_RuleBlkWithHalt->end->halt=TRUE; + + rk2=empty; + + while ( !set_nil(*incomplete) ) { + k2 = set_int(*incomplete); + if (k2 > (unsigned) predDepth) break; /* <=== another exit from loop */ + set_rm(k2,*incomplete); + u = NULL; + + TRAV(ruleRef->next,k2,&rk2,u); + + /* any subtrees missing k2 tokens, add u onto end */ + + *t=tlink(*t,u,k2); + Tfree(u); + } + + set_orin(incomplete,rk2); /* remember what we couldn't do */ + set_free(rk2); + + if (MR_RuleBlkWithHalt != NULL) MR_RuleBlkWithHalt->end->halt=FALSE; + + if (set_int(*incomplete) > (unsigned) predDepth) break; /* <=== another exit from loop */ + }; + + MR_RuleBlkWithHalt=save_MR_RuleBlkWithHalt; + + if (MR_RuleBlkWithHalt != NULL) { + MR_RuleBlkWithHalt->end->halt=TRUE; + }; + ConstrainSearch=saveConstrainSearch; +} + +#ifdef __USE_PROTOS +void MR_complete_predicates(int predDepth,Predicate *pred) +#else +void MR_complete_predicates(predDepth,pred) + int predDepth; + Predicate *pred; +#endif +{ + if (pred == NULL) return; + if (pred->expr != PRED_AND_LIST && + pred->expr != PRED_OR_LIST) { + MR_complete_set(predDepth,&(pred->scontext[1]),&(pred->completionSet)); + MR_complete_tree(predDepth,&(pred->tcontext),&(pred->completionTree)); + }; + MR_complete_predicates(predDepth,pred->down); + MR_complete_predicates(predDepth,pred->right); +} + +#ifdef __USE_PROTOS +Junction * MR_junctionWithoutP2(Junction *j) +#else +Junction * MR_junctionWithoutP2(j) + Junction *j; +#endif +{ + Junction *thisAlt; + +/* don't want to follow p2 to the next alternative of this rule */ +/* insert a generic node with null p2 if necessary */ +/* however FIRST requires a junction */ + + thisAlt=j; + if (thisAlt->p2 != NULL) { + if (thisAlt->p1->ntype == nJunction) { + thisAlt=(Junction *) thisAlt->p1; + } else { + thisAlt=newJunction(); + thisAlt->p1=j->p1; + thisAlt->rname=j->rname; + thisAlt->file=j->file; + thisAlt->line=j->line; + j->p1=(Node *)thisAlt; + }; + }; + return thisAlt; +} + +#ifdef __USE_PROTOS +int MR_tree_equ(Tree *big, Tree *small) { +#else +int MR_tree_equ(big,small) + Tree *big; + Tree *small; +{ +#endif + + Tree *b; + Tree *s; + int bcount=0; + int scount=0; + + if (small == NULL && big == NULL) return 1; + if (small == NULL) return 0; + if (big == NULL) return 0; + + if (small->token == ALT) { + require(small->right == NULL, + "MR_tree_equ: small: ALT node has siblings"); + return MR_tree_equ(big,small->down); + }; + if (big->token == ALT) { + require(big->right == NULL, + "MR_tree_equ: big: ALT node has siblings"); + return MR_tree_equ(big->down,small); + }; + for (s=small; s != NULL; s=s->right) { + scount++; + require(s->token != EpToken,"MR_tree_equ: s->EpToken unexpected\n"); + }; + for (b=big; b != NULL; b=b->right) { + bcount++; + require(b->token != EpToken,"MR_tree_equ: b->EpToken unexpected\n"); + }; + + if (bcount != scount) return 0; + + for (s=small; s != NULL; s=s->right) { + for (b=big; b!= NULL; b=b->right) { + if (s->token == b->token) { + if (MR_tree_equ(b->down,s->down)) goto next_s; + }; + }; + return 0; +next_s: + continue; + }; + return 1; +} + +/* this does not compare sources - only contexts ! */ + +#ifdef __USE_PROTOS +int MR_identicalContext(Predicate *p,Predicate *q) +#else +int MR_identicalContext(p,q) + Predicate *p; + Predicate *q; +#endif +{ + if (p->k != q->k) return 0; + require ( (p->tcontext == NULL) == (q->tcontext == NULL), + "tcontext inconsistent"); + if (p->k == 1) { + return set_equ(p->scontext[1],q->scontext[1]); + } else { + return MR_tree_equ(p->tcontext,q->tcontext); + }; +} + +#ifdef __USE_PROTOS +void MR_reportSetSuppression(int predDepth, + set predSet,set plainSet,Junction *jPred,Junction *jPlain,Predicate *p) +#else +void MR_reportSetSuppression(predDepth,predSet,plainSet,jPred,jPlain,p) + int predDepth; + set predSet; + set plainSet; + Junction *jPred; + Junction *jPlain; + Predicate *p; +#endif +{ + if (InfoP) { + fprintf(output,"\n#if 0\n\n"); + fprintf(output,"Hoisting of predicate suppressed by alternative without predicate.\n"); + fprintf(output,"The alt without the predicate includes all cases where the predicate is false.\n\n"); + fprintf(output," WITH predicate: line %d %s\n",jPred->line,FileStr[jPred->file]); + if (jPlain != NULL) { + fprintf(output," WITHOUT predicate: line %d %s\n",jPlain->line,FileStr[jPlain->file]); + } else { + fprintf(output," WITHOUT predicate: all alternatives without predicates (combined)\n"); + }; + if (predDepth == 1) { + fprintf(output,"\nThe context set for the predicate:\n"); + MR_dumpTokenSet(output,1,predSet); + }; + fprintf(output,"\nThe lookahead set for the alt WITHOUT the semantic predicate:\n"); + MR_dumpTokenSet(output,1,plainSet); + fprintf(output,"\nThe predicate:\n\n"); + MR_dumpPred1(1,p,1); + fprintf(output,"Chain of referenced rules:\n\n"); + MR_dumpPredRuleRefStack(output,4); + fprintf(output,"\n#endif\n"); + }; +} + +#ifdef __USE_PROTOS +void MR_reportSetRestriction(int predDepth,set predSet,set plainSet, + Junction *jPred,Junction *jPlain,Predicate *origPred,Predicate *newPred) +#else +void MR_reportSetRestriction(predDepth,predSet,plainSet,jPred,jPlain,origPred,newPred) + int predDepth; + set predSet; + set plainSet; + Junction *jPred; + Junction *jPlain; + Predicate *origPred; + Predicate *newPred; +#endif +{ + set intersect; + + intersect=empty; + + if (! InfoP) return; + fprintf(output,"\n#if 0\n\n"); + fprintf(output,"Restricting the context of a predicate because of overlap in the lookahead set\n"); + fprintf(output," between the alternative with the semantic predicate and one without\n"); + fprintf(output,"Without this restriction the alternative without the predicate could not\n"); + fprintf(output," be reached when input matched the context of the predicate and the predicate\n"); + fprintf(output," was false.\n\n"); + + fprintf(output," WITH predicate: line %d %s\n",jPred->line,FileStr[jPred->file]); + if (jPlain != NULL) { + fprintf(output," WITHOUT predicate: line %d %s\n",jPlain->line,FileStr[jPlain->file]); + } else { + fprintf(output," WITHOUT predicate: all alternatives without predicates (combined)\n"); + }; + if (predDepth == 1) { + fprintf(output,"\nThe original context set for the predicate:\n"); + MR_dumpTokenSet(output,1,predSet); + }; + fprintf(output,"\nThe lookahead set for the alt WITHOUT the semantic predicate:\n"); + MR_dumpTokenSet(output,1,plainSet); + if (predDepth == 1) { + fprintf(output,"\nThe intersection of the two sets\n"); + intersect=set_and(predSet,plainSet); + MR_dumpTokenSet(output,1,intersect); + set_free(intersect); + }; + fprintf(output,"\nThe original predicate:\n\n"); + MR_dumpPred1(1,origPred,1); + fprintf(output,"The new (modified) form of the predicate:\n\n"); + MR_dumpPred1(1,newPred,1); + fprintf(output,"#endif\n"); +} + +/* don't use Pass3 by itself unless you know that inverted is not important */ + +#ifdef __USE_PROTOS +Predicate * MR_removeRedundantPredPass3(Predicate *p) +#else +Predicate * MR_removeRedundantPredPass3(p) + Predicate *p; +#endif +{ + Predicate *q; + + if (p == NULL) return NULL; + p->right=MR_removeRedundantPredPass3(p->right); + p->down=MR_removeRedundantPredPass3(p->down); + if (p->redundant) { + q=p->right; + p->right=NULL; + predicate_free(p); + return q; + }; + if (p->expr == PRED_AND_LIST || + p->expr == PRED_OR_LIST) { + if (p->down == NULL) { + q=p->right; + p->right=NULL; + predicate_free(p); + return q; + }; + if (p->down != NULL && p->down->right == NULL) { + q=p->down; + q->right=p->right; + p->right=NULL; + p->down=NULL; + return q; + }; + }; + return p; +} + +#ifdef __USE_PROTOS +void MR_removeRedundantPredPass2(Predicate *p) +#else +void MR_removeRedundantPredPass2(p) + Predicate *p; +#endif +{ + Predicate *q; + + if (p == NULL) return; + + if (p->expr == PRED_AND_LIST) { + for (q=p->down ; q != NULL ; q=q->right) { + MR_removeRedundantPredPass2(q); + if (q->isConst) { + if (q->constValue == 0) { + p->isConst=1; + p->constValue=0; + return; + } else { + q->redundant=1; + }; + }; + }; + }; + + if (p->expr == PRED_OR_LIST) { + for (q=p->down ; q != NULL ; q=q->right) { + MR_removeRedundantPredPass2(q); + if (q->isConst) { + if (q->constValue == 0) { + q->redundant=1; + } else { + p->isConst=1; + p->constValue=1; + return; + }; + }; + }; + }; + + return; +} + +#if 0 + this totally ignores the implications of guarded predicates + in which the part after the guard could possibly cover a predicate. + that would be much harder: + + rule : (A)? => <<p>>? sub1; /* 1 */ + | (B)? => <<r>>? sub2 /* 2 */ + sub1 : (A)? => <<q>>? A B /* 3 */ + | B /* 4 - suppresses line 2 */ + ; +#endif + +#ifdef __USE_PROTOS +void MR_apply_restriction1(Predicate *pred,set *plainSet,int *changed) +#else +void MR_apply_restriction1(pred,plainSet,changed) + Predicate *pred; + set *plainSet; + int *changed; +#endif +{ + if (pred == NULL) return; + MR_apply_restriction1(pred->right,plainSet,changed); + if (pred->down != NULL) { + MR_apply_restriction1(pred->down,plainSet,changed); + } else { + set t; + if (pred->k == 1) { + t=set_dif(pred->scontext[1],*plainSet); + if (*changed == 0 && + !set_equ(t,pred->scontext[1])) { + *changed=1; + }; + if (set_nil(t)) { + pred->redundant=1; + }; + set_free(pred->scontext[1]); + pred->scontext[1]=t; + }; + }; +} + +#ifdef __USE_PROTOS +void MR_orin_plainSet(Predicate *p,set plainSet) +#else +void MR_orin_plainSet(p,plainSet) + Predicate *p; + set plainSet; +#endif +{ + if (p == NULL) return; + MR_orin_plainSet(p->down,plainSet); + MR_orin_plainSet(p->right,plainSet); + set_orin(&p->plainSet,plainSet); +} + +Predicate *PRED_SUPPRESS; + +#ifdef __USE_PROTOS +Predicate * MR_find_in_aSubBlk(Junction *alt) +#else +Predicate * MR_find_in_aSubBlk(alt) + Junction *alt; +#endif +{ + Predicate *root=NULL; + Predicate **tail=NULL; + + Junction *p; + + int nAlts=0; + Junction **jList; + Predicate **predList; + int *matchList; + set predSet; + int i; + int j; + int m; + int predDepth; + set incomplete; + set union_plainSet; + set setChange; + int changed; + Predicate *newPred; + set setDif; + Predicate *origPred; + int depth1=1; /* const int */ + set *plainContext; + set plainSet; + + predSet=empty; + incomplete=empty; + union_plainSet=empty; + setChange=empty; + setDif=empty; + plainSet=empty; + + if (PRED_SUPPRESS == NULL) { + PRED_SUPPRESS=new_pred(); + PRED_SUPPRESS->expr="Predicate Suppressed"; + }; + + /* this section just counts the number of "interesting" alternatives */ + /* in order to allocate arrays */ + + for (p=alt; p!=NULL; p=(Junction *)p->p2) { + /* ignore empty alts */ + if ( p->p1->ntype != nJunction || + ((Junction *)p->p1)->jtype != EndBlk ) { + nAlts++; + }; + }; + + /* if this is a (...)+ block then don't count the last alt because + it can't be taken until at least one time through the block. + In other words it isn't a real choice until the (...)+ is entered + at which point the hoisting issue is moot. + Maybe look at "ignore" instead ? + */ + + if (alt->jtype == aPlusBlk) { + nAlts--; + }; + + jList=(Junction **)calloc(nAlts,sizeof(Junction *)); + require(jList!=NULL,"cannot allocate MR_find_in_aSubBlk jList"); + + plainContext=(set *)calloc(nAlts,sizeof(set)); + require(plainContext!=NULL,"cannot allocate MR_find_in_aSubBlk plainContext"); + for (m=0; m < nAlts; m++) plainContext[m]=empty; + + predList=(Predicate **)calloc(nAlts,sizeof(Predicate *)); + require(predList!=NULL,"cannot allocate MR_find_in_aSubBlk predList"); + + matchList=(int *)calloc(nAlts,sizeof(int)); + require(matchList!=NULL,"cannot allocate MR_find_in_aSubBlk matchList"); + + /* this section just fills in the arrays previously allocated */ + /* the most interesting one is matchList[] */ + /* */ + /* bit 0 => this alt has a semantic pred which is "covered" */ + /* by an alt without a semantic pred. Don't hoist. */ + + for (i=0,p=alt; + p!=NULL && i<nAlts; + i++,p=(Junction *)p->p2) { + + /* ignore empty alts */ + + if ( p->p1->ntype != nJunction || + ((Junction *)p->p1)->jtype != EndBlk ) { + jList[i]=MR_junctionWithoutP2(p); + predList[i]=find_predicates(p->p1); /* should be jList ????? */ + if (predList[i] != NULL) { + MR_cleanup_pred_trees(predList[i]); /* flatten & left factor */ + plainContext[i]=MR_union_plain_sets(predList[i]); + } else { + MR_set_reuse(&plainSet); + MR_set_reuse(&incomplete); + plainSet=MR_First(depth1,jList[i],&incomplete); + MR_complete_set(depth1,&plainSet,&incomplete); + require(set_nil(incomplete),"couldn't complete k=1"); + plainContext[i]=plainSet; + plainSet=empty; + }; + set_orin(&union_plainSet,plainContext[i]); + }; + }; + + if (nAlts == 1) { + goto EXIT_SIMPLE; + }; + +/* + * Looking for cases where alt i has a semantic pred and alt j does not. + * Don't care about cases where lookahead for semantic predicates overlap + * because normal predicate hoisting does the correct thing automatically. + * Don't care about cases where lookahead for alts without semantic predicates + * overlap because normal prediction does the correct thing automatically. + * + * When we find such a case check for one of three subcases: + * + * 1. if lookahead for alt i is contained in the lookahead for any + * alt j then ignore semantic predicate of alt i + * 2. if lookahead for alt i is not contained in the lookahead for + * any alt j then add add predicate i to the OR list to be hoisted + * 3. if lookahead for alt i overlaps the lookahead for some alt j then + * add a dummy semantic predicate for alt j + * + * There is an implicit assumption that the context of all alternatives following + * the rule being processed here are identical (but may vary from hoist to + * hoist depending on the place where the rule was invoked that led to hoisting + * these predicates. In othere words in the fragment: + * + * ( <<a>>? a1 a2 a3 | <<b>>? b1 b2 b3 ) + * + * both a3 and b3 have the same follow sets because they are both at the end of + * alternatives in the same block. + */ + + for (i=0; i < nAlts; i++) { + if (jList[i] == NULL) continue; + if (predList[i] == NULL) continue; + + /* if the predicate depth turns out to be one token only */ + /* then it is can be easily represented as a set and */ + /* compared to the junction set create by MR_First() */ + + predDepth=0; + MR_pred_depth(predList[i],&predDepth); + require (predDepth >= 1,"MR_find_in_aSubBlk: pred depth < 1"); + require (predDepth <= CLL_k,"MR_find_in_aSubBlk: predDepth > CLL_k"); + + /* complete predicates to predDepth + If completed to depth=1 then the context would be incomplete. + The context would be truncated and the predicate simplify routine + would have incomplete information. It would lead to + either false matches of failure to find true matches. + */ + + MR_complete_predicates(predDepth,predList[i]); + + if (predList[i] != NULL) { + MR_cleanup_pred_trees(predList[i]); /* flatten & left factor */ + }; + + /* If the predicate depth is 1 then it is possible to suppress + a predicate completely using a single plain alt. Check for suppression + by a single plain alt first because it gives better messages. If that + fails try the union of all the plain alts. + */ + + if (predDepth == 1) { + + MR_set_reuse(&predSet); + predSet=MR_compute_pred_set(predList[i]); /* ignores k>1 predicates */ + + for (j=0; j < nAlts; j++) { + if (jList[j] == NULL) continue; + if (j == i) continue; + + MR_set_reuse(&setDif); + setDif=set_dif(predSet,plainContext[j]); + if (set_nil(setDif)) { + matchList[i] |= 1; + MR_reportSetSuppression(predDepth,predSet,plainContext[j],jList[i],jList[j],predList[i]); + predicate_free(predList[i]); + predList[i]=PRED_SUPPRESS; + goto next_i; + }; + + }; /* end loop on j */ + + changed=0; + + /* predicate_dup is only to give good error messages */ + /* remember to do a predicate_free() */ + + origPred=predicate_dup(predList[i]); + MR_apply_restriction1(predList[i],&union_plainSet,&changed); + if (changed) { + + /* don't use Pass3 by itself unless you know that inverted is not important */ + + newPred=MR_removeRedundantPredPass3(predList[i]); + newPred=MR_predSimplifyALL(newPred); + if (newPred == NULL) { + matchList[i] |= 1; + MR_reportSetSuppression(predDepth,predSet,union_plainSet,jList[i], + NULL,origPred); + predList[i]=PRED_SUPPRESS; + } else { + MR_reportSetRestriction(predDepth,predSet,union_plainSet,jList[i], + NULL,origPred,newPred); + predList[i]=newPred; + }; + }; + predicate_free(origPred); + origPred=NULL; + }; + + /* + If the predicate depth is > 1 then it can't be suppressed completely + because the code doesn't support inspection of such things. They're + much messier than k=1 sets. + */ + + if (predDepth > 1 ) { + + changed=0; + + /* predicate_dup is only to give good error messages */ + /* remember to do a predicate_free() */ + + origPred=predicate_dup(predList[i]); + MR_apply_restriction1(predList[i],&union_plainSet,&changed); + if (changed) { + newPred=MR_removeRedundantPredPass3(predList[i]); + newPred=MR_predSimplifyALL(newPred); + if (newPred == NULL) { + matchList[i] |= 1; + MR_reportSetSuppression(predDepth,predSet,union_plainSet,jList[i], + NULL,origPred); + predList[i]=PRED_SUPPRESS; + } else { + MR_reportSetRestriction(predDepth,predSet,union_plainSet,jList[i], + NULL,origPred,newPred); + predList[i]=newPred; + }; + }; + predicate_free(origPred); + origPred=NULL; + }; +next_i: + continue; + }; + +EXIT_SIMPLE: + + root = new_pred(); + root->expr=PRED_OR_LIST; + tail = &(root->down); + + for (i=0 ; i< nAlts ; i++) { + if (jList[i] == NULL) continue; + + if (predList[i] == NULL) { + continue; + } else if ( (matchList[i] & 1) != 0) { + if (predList[i] != PRED_SUPPRESS) { + predicate_free(predList[i]); + }; + continue; + }; + + /* make an OR list of predicates */ + + *tail=predList[i]; + tail=&(predList[i]->right); + }; + + /* if just one pred, remove OR root */ + + if (root->down == NULL) { + predicate_free(root); + root=NULL; + } else if (root->down->right == NULL) { + Predicate *p=root->down; + root->down=NULL; + predicate_free(root); + root=p; + } + + root=MR_predSimplifyALL(root); + + MR_orin_plainSet(root,union_plainSet); + + set_free(predSet); + set_free(union_plainSet); + set_free(incomplete); + set_free(setChange); + set_free(setDif); + + for (m=0; m < nAlts; m++) set_free(plainContext[m]); + + free ( (char *) jList); + free ( (char *) predList); + free ( (char *) matchList); + free ( (char *) plainContext); + + return root; +} + +#ifdef __USE_PROTOS +void MR_predContextPresent(Predicate *p,int *allHaveContext,int *noneHaveContext) +#else +void MR_predContextPresent(p,allHaveContext,noneHaveContext) + Predicate *p; + int *allHaveContext; + int *noneHaveContext; +#endif +{ + if (p == NULL) return; + MR_predContextPresent(p->right,allHaveContext,noneHaveContext); + if (p->expr != PRED_AND_LIST && + p->expr != PRED_OR_LIST) { + if (set_nil(p->scontext[1]) == 0 || + (p->tcontext != NULL)) { + *noneHaveContext=0; + } else { + *allHaveContext=0; + }; + }; + MR_predContextPresent(p->down,allHaveContext,noneHaveContext); +} + +#ifdef __USE_PROTOS +int MR_pointerStackPush(PointerStack *ps,void *dataPointer) +#else +int MR_pointerStackPush(ps,dataPointer) + PointerStack *ps; + void *dataPointer; +#endif +{ + void **newStack; + int newSize; + int i; + + if (ps->count == ps->size) { + newSize=20+ps->size*2; + newStack=(void **)calloc(newSize,sizeof(void *)); + require (newStack != NULL,"cannot allocate PointerStack"); + for (i=0; i < ps->size; i++) { + newStack[i]=ps->data[i]; + }; + if (ps->data != NULL) free( (char *) ps->data); + ps->data=newStack; + ps->size=newSize; + }; + ps->data[ps->count]=dataPointer; + ps->count++; + return ps->count-1; +} + +#ifdef __USE_PROTOS +void * MR_pointerStackPop(PointerStack *ps) +#else +void * MR_pointerStackPop(ps) + PointerStack *ps; +#endif +{ + void *dataPointer; + + require(ps->count > 0,"MR_pointerStackPop underflow"); + + dataPointer=ps->data[ps->count-1]; + ps->data[ps->count-1]=NULL; + (ps->count)--; + return dataPointer; +} + +#ifdef __USE_PROTOS +void * MR_pointerStackTop(PointerStack *ps) +#else +void * MR_pointerStackTop(ps) + PointerStack *ps; +#endif +{ + require(ps->count > 0,"MR_pointerStackTop underflow"); + return ps->data[ps->count-1]; +} + +#ifdef __USE_PROTOS +void MR_pointerStackReset(PointerStack *ps) +#else +void MR_pointerStackReset(ps) + PointerStack *ps; +#endif +{ + int i; + if (ps->data != NULL) { + for (i=0; i < ps->count ; i++) { + ps->data[i]=NULL; + }; + }; + ps->count=0; +} + +#ifdef __USE_PROTOS +Junction *MR_nameToRuleBlk(char *name) +#else +Junction *MR_nameToRuleBlk(name) + char *name; +#endif +{ + RuleEntry *q; + + require (RulePtr != NULL,"MR_nameToRule: RulePtr not initialized"); + + if (name == NULL) return NULL; + + q = (RuleEntry *) hash_get(Rname,name); + + if ( q == NULL ) { + return NULL; + } else { + return RulePtr[q->rulenum]; + }; +} + +#ifdef __USE_PROTOS +Junction * MR_ruleReferenced(RuleRefNode *rrn) +#else +Junction * MR_ruleReferenced(rrn) + RuleRefNode *rrn; +#endif +{ + return MR_nameToRuleBlk(rrn->text); +} + +#ifdef __USE_PROTOS +void MR_comparePredLeaves(Predicate *me,Predicate *myParent,Predicate *him,Predicate *hisParent) +#else +void MR_comparePredLeaves(me,myParent,him,hisParent) + Predicate *me; + Predicate *myParent; + Predicate *him; + Predicate *hisParent; +#endif +{ + if (me == NULL) return; + if (me == him) { + MR_comparePredLeaves(me->right,myParent,him,hisParent); + return; + } else if (me->expr == PRED_AND_LIST || + me->expr == PRED_OR_LIST) { + MR_comparePredLeaves(me->down,me,him,hisParent); + MR_comparePredLeaves(me->right,myParent,him,hisParent); + return; + } else { + if (me->source != NULL) { + + /* predicate->invert can be set only in the predEntry predicates */ + /* thus they are only visible after the predEntry predicates have been "unfolded" */ + + int sameSource=(me->source == him->source); + int sameInvert=1 & + (1 + me->inverted + him->inverted + me->source->inverted + him->source->inverted); + int samePredEntry=(me->source->predEntry != NULL + && him->source->predEntry != NULL + && me->source->predEntry == him->source->predEntry); + if (sameInvert && (sameSource || samePredEntry)) { + if (MR_identicalContext(me,him)) { + + /* identical predicates */ + + if (hisParent->expr == PRED_OR_LIST && + myParent->expr == PRED_OR_LIST) { + me->redundant=1; + } else if (hisParent->expr == PRED_AND_LIST && + myParent->expr == PRED_AND_LIST) { + me->redundant=1; + } else if ( (hisParent->expr == PRED_OR_LIST && + myParent->expr == PRED_AND_LIST) + || + (hisParent->expr == PRED_AND_LIST && + myParent->expr == PRED_OR_LIST) + ) { + myParent->redundant=1; + } else { + require (0,"MR_comparePredLeaves: not both PRED_LIST"); + }; + }; + }; /* end same source or same predEntrr with same invert sense */ + + /* same predEntry but opposite invert sense */ + + if (!sameInvert && (sameSource || samePredEntry)) { + if (MR_identicalContext(me,him)) { + if (hisParent->expr == PRED_OR_LIST && + myParent->expr == PRED_OR_LIST) { + myParent->isConst=1; + myParent->constValue=1; + } else if (hisParent->expr == PRED_AND_LIST && + myParent->expr == PRED_AND_LIST) { + myParent->isConst=1; + myParent->constValue=0; + } else if ( (hisParent->expr == PRED_OR_LIST && + myParent->expr == PRED_AND_LIST) + || + (hisParent->expr == PRED_AND_LIST && + myParent->expr == PRED_OR_LIST) + ) { + me->redundant=1; + } else { + require (0,"MR_comparePredLeaves: not both PRED_LIST"); + }; + }; + }; /* end same predEntry with opposite invert sense */ + }; + + MR_comparePredLeaves(me->right,myParent,him,hisParent); + return; + }; +} + +#ifdef __USE_PROTOS +void MR_removeRedundantPredPass1(Predicate *me,Predicate *myParent) +#else +void MR_removeRedundantPredPass1(me,myParent) + Predicate *me; + Predicate *myParent; +#endif +{ + if (me == NULL) return; + if (me->redundant) { + MR_removeRedundantPredPass1(me->right,myParent); + return; + }; + if (me->expr == PRED_AND_LIST || + me->expr == PRED_OR_LIST) { + MR_removeRedundantPredPass1(me->down,me); + MR_removeRedundantPredPass1(me->right,myParent); + } else { + require (me->source != NULL,"me->source == NULL"); + if (myParent != NULL) { + MR_comparePredLeaves(myParent->down,myParent,me,myParent); + }; + MR_removeRedundantPredPass1(me->right,myParent); + }; +} + +/* pretty much ignores things with the inverted bit set */ + +#ifdef __USE_PROTOS +Predicate *MR_predFlatten(Predicate *p) +#else +Predicate *MR_predFlatten(p) + Predicate *p; +#endif +{ + if (p == NULL) return NULL; + if (p->expr == PRED_OR_LIST + || p->expr == PRED_AND_LIST) { + + Predicate *child; + Predicate *gchild; + Predicate **tail; + Predicate *next; + char *PRED_XXX_LIST=p->expr; + + require (p->down != NULL,"MR_predFlatten AND/OR no child"); + + + p->down=MR_predFlatten(p->down); + p->right=MR_predFlatten(p->right); + child=p->down; + if (child->right == NULL) { + child->right=p->right; + p->right=NULL; + p->down=NULL; + if (p->inverted) child->inverted=!child->inverted; + predicate_free(p); + return child; + }; + + /* make a single list of all children and grandchildren */ + + tail=&(p->down); + for (child=p->down; child != NULL; child=next) { + if (child->expr != PRED_XXX_LIST + || child->inverted + || child->predEntry != NULL) { + *tail=child; + tail=&(child->right); + next=child->right; + } else { + for (gchild=child->down; + gchild != NULL; + gchild=gchild->right) { + *tail=gchild; + tail=&(gchild->right); + }; + next=child->right; + child->right=NULL; + child->down=NULL; + predicate_free(child); + }; + }; + *tail=NULL; + return p; + } else { + p->right=MR_predFlatten(p->right); + return p; + }; +} + +static char *alwaysFalseWarning=NULL; + +#ifdef __USE_PROTOS +Predicate *checkPredicateConflict(Predicate *p) +#else +Predicate *checkPredicateConflict(p) + Predicate *p; +#endif +{ + if (p->isConst) { + if (p->constValue == 1) { + predicate_free(p); + return NULL; + } else { + if (InfoP && !p->conflictReported) { + p->conflictReported=1; + fprintf(output,"\n#if 0\n\n"); + fprintf(output,"The following predicate expression will always be false:\n\n"); + MR_dumpPred1(1,p,1); + fprintf(output,"\n#endif\n"); + }; + + if (alwaysFalseWarning != CurRule) { + alwaysFalseWarning=CurRule; + if (InfoP) { + warnNoFL(eMsg1("one (or more) predicate expression hoisted into rule \"%s\" are always false \ +- see output file for more information",CurRule)); + } else { + warnNoFL(eMsg1("one (or more) predicate expressions hoisted into rule \"%s\" are always false \ +- use \"-info p\" for more information",CurRule)); + }; + }; + }; + }; + return p; +} + + +#ifdef __USE_PROTOS +int MR_countPredNodes(Predicate *p) +#else +int MR_countPredNodes(p) + Predicate *p; +#endif +{ + if (p == NULL) return 0; + return 1 + MR_countPredNodes(p->down) + MR_countPredNodes(p->right); +} + +#ifdef __USE_PROTOS +Predicate *MR_predSimplifyALLX(Predicate *p,int skipPass3) +#else +Predicate *MR_predSimplifyALLX(p,skipPass3) + Predicate *p; + int skipPass3; +#endif +{ + int countBefore; + int countAfter; + + countAfter=MR_countPredNodes(p); + + do { + if (p == NULL) return NULL; + if (p->right == NULL && p->down == NULL) return p; + countBefore=countAfter; + MR_simplifyInverted(p,0); + p=MR_predFlatten(p); + MR_removeRedundantPredPass1(p,NULL); + MR_removeRedundantPredPass2(p); + if (! skipPass3) { + p=checkPredicateConflict(p); + p=MR_removeRedundantPredPass3(p); + }; + countAfter=MR_countPredNodes(p); + } while (countBefore != countAfter); + + return p; +} + +#ifdef __USE_PROTOS +Predicate *MR_predSimplifyALL(Predicate *p) +#else +Predicate *MR_predSimplifyALL(p) + Predicate *p; +#endif +{ + return MR_predSimplifyALLX(p,0); +} + +#ifdef __USE_PROTOS +void MR_releaseResourcesUsedInRule(Node *n) +#else +void MR_releaseResourcesUsedInRule(n) + Node *n; +#endif +{ + Node *next; + Junction *j; + int i; + + if (n == NULL) return; + if (n->ntype == nJunction) { + j=(Junction *) n; + + if (j->predicate != NULL) { + predicate_free(j->predicate); + j->predicate=NULL; + }; + for (i=0; i< CLL_k; i++) { + set_free(j->fset[i]); + j->fset[i]=empty; + }; + if (j->ftree != NULL) { + Tfree(j->ftree); + j->ftree=NULL; + }; + if (j->jtype == EndRule) return; + if (j->jtype != RuleBlk && j->jtype != EndBlk) { + if (j->p2 != NULL && !j->ignore) { /* MR11 */ + MR_releaseResourcesUsedInRule(j->p2); + }; + }; + }; + next=MR_advance(n); + MR_releaseResourcesUsedInRule(next); +} + +#ifdef __USE_PROTOS +int MR_allPredLeaves(Predicate *p) +#else +int MR_allPredLeaves(p) + Predicate *p; +#endif +{ + Predicate *q; + + if (p == NULL) return 1; + + for (q=p; q != NULL; q=q->right) { + if (q->down != NULL) return 0; + }; + return 1; +} + +/* make sure it works for the last rule in a file */ + +#ifdef __USE_PROTOS +int MR_offsetFromRule(Node *n) +#else +int MR_offsetFromRule(n) + Node *n; +#endif +{ + Junction *j; + int offset=(-1); + + for (j=SynDiag; j != NULL; j=(Junction *)j->p2) { + + require (j->ntype == nJunction && j->jtype == RuleBlk,"Not a rule block"); + + if (n->file < j->file) { + return offset; + }; + if (n->file == j->file) { + if (n->line < j->line) { + return (offset < 0) ? 0 : offset; + } else { + offset=n->line - j->line; + if (offset == 0) return 0; + }; + }; + }; + return offset; +} + +#define ruleNameMax 50 + +static char ruleNameStatic1[ruleNameMax]; +static char ruleNameStatic2[ruleNameMax+10]; + +#ifdef __USE_PROTOS +char * MR_ruleNamePlusOffset(Node *n) +#else +char * MR_ruleNamePlusOffset(n) + Node *n; +#endif +{ + int offset=MR_offsetFromRule(n); + + strncpy(ruleNameStatic1,n->rname,ruleNameMax); + if (offset < 0) { + sprintf(ruleNameStatic2,"%s/?",ruleNameStatic1); + } else { + sprintf(ruleNameStatic2,"%s/%d",ruleNameStatic1,offset+1); + }; + return ruleNameStatic2; +} + +#ifdef __USE_PROTOS +int MR_max_height_of_tree(Tree *t) +#else +int MR_max_height_of_tree(t) + Tree *t; +#endif +{ + int h; + int height=0; + Tree *u; + + if (t == NULL) return 0; + + require (t->token != ALT && t->token != EpToken,"MR_max_height_of_tree ALT or EpToken"); + + for (u=t; u != NULL; u=u->right) { + h=MR_max_height_of_tree(u->down)+1; + if (h > height) height=h; + }; + return height; +} + +#ifdef __USE_PROTOS +int MR_all_leaves_same_height(Tree *t,int depth) +#else +int MR_all_leaves_same_height(t,depth) + Tree *t; + int depth; +#endif +{ + if (t == NULL) { + return (depth==0); + }; + + require (t->token != ALT && t->token != EpToken,"MR_all_leaves_same_height ALT or EpToken"); + + if (depth == 0) { + return 0; + } else { + if ( ! MR_all_leaves_same_height(t->down,depth-1)) { + return 0; + }; + if (t->right == NULL) { + return 1; + } else { + return MR_all_leaves_same_height(t->right,depth); + }; + }; +} + +#ifdef __USE_PROTOS +void MR_projectTreeOntoSet(Tree *tree,int ck,set *ckset) +#else +void MR_projectTreeOntoSet(tree,ck,ckset) + Tree *tree; + int ck; + set *ckset; +#endif +{ + if (tree == NULL) return; + + require(tree->token != EpToken,"MR_projectTreeOntoSet: EpToken unexpected\n"); + + MR_projectTreeOntoSet(tree->right,ck,ckset); + if (tree->token == ALT) { + MR_projectTreeOntoSet(tree->down,ck,ckset); + } else { + if (ck > 1) { + MR_projectTreeOntoSet(tree->down,ck-1,ckset); + } else { + set_orel(tree->token,ckset); + }; + }; +} + +#ifdef __USE_PROTOS +int MR_comparePredicates(Predicate *a,Predicate *b) +#else +int MR_comparePredicates(a,b) + Predicate *a; + Predicate *b; +#endif +{ + Predicate *p; + Predicate *q; + + if (a == b) return 1; + if (a == NULL || b == NULL ) return 0; + if (a->down == NULL && b->down == NULL) { + + /* predicate->invert can be set only in the predEntry predicates */ + /* thus they are only visible after the predEntry predicates have been "unfolded" */ + + int sameSource=(a->source == b->source); + int sameInvert= 1 & (1 +a->inverted + b->inverted + + a->source->inverted + b->source->inverted); + int samePredEntry=(a->source->predEntry != NULL + && b->source->predEntry != NULL + && a->source->predEntry == b->source->predEntry); + if (sameInvert && (sameSource || samePredEntry)) { + if (MR_identicalContext(a,b)) { + return 1; + }; + }; + return 0; + }; + if (a->down == NULL || b->down == NULL) return 0; + if (a->expr != b->expr) return 0; + + for (p=a->down; p != NULL; p=p->right) { + for (q=b->down; q != NULL; q=q->right) { + if (MR_comparePredicates(p,q)) goto NEXT_P; + }; + return 0; +NEXT_P: + continue; + }; + return 1; +} + +/* + * action->inverted can be set only when a predicate symbol appears in + * a rule: "rule : <<!XXX>>? X". It cannot be set under any + * other circumstances. In particular it cannot be set by + * "#pred NotA !A" or by "#pred Nota <<!A>>?". The first case + * creates a predEntry and the predicate expression of that predEntry + * has inverted set. In the second case, the code for handling "!" + * is only present in buildAction, which is not called by the #pred + * semantic routines, only when a <<...>>? is recognized as part of + * a rule definition. + * + * predicate->inverted can only be set by a predicate created by a #pred + * expression, such as "#pred NotA !A" or "#pred NotXY ! (X && Y) or + * "#pred XbarY !(X && Y)". In particular, it cannot be set by any + * predicate expression occurring under any other circumstances. + * The #pred predicate expresssions are stored with in predEntry->pred + * and do not normally appear anywhere else until the predicates are + * "unfolded" in order to recognize redundancies, conflicts, and + * tautologies. + * + * The unfold routine expands all references to #pred expressions. + * + * The simplifyInvert goes through and propagates the invert bit so that + * all OR and AND nodes are un-inverted. + * + * Note that !(A and B) => (!A or !B) + * !(A or B) => (!A and !B) + * + * MR_unfold() is called to expand predicate symbols by replacing predicates + * that reference predicate entries with the copies of the predicate entries. + * Each reference receives a duplicate of the original. This is necessary + * because the next phase involves simplification and removal of redundant + * predicate nodes. Anyway, the point I'm making is that predicate->invert + * should not be set in any predicate until it has been expanded. + * + * This is a recursive structure, but there is no need for "recursive expansion" + * by which I mean a predicate symbol refers to other predicate symbols which + * must also be expanded. + * + * Recursive expansion is *not* performed by this routine because it is not + * necessary. Expansion of references is performed by predPrimary when + * a new predicate symbol is created by referring to others in the pred expr. + */ + +#ifdef __USE_PROTOS +Predicate *MR_unfold(Predicate *pred) +#else +Predicate *MR_unfold(pred) + Predicate *pred; +#endif +{ + Predicate *result; + + if (pred == NULL) return NULL; + + pred->right=MR_unfold(pred->right); + + if (pred->down == NULL) { + if (pred->source->predEntry != NULL) { + if (pred->source->predEntry->pred == NULL) { + ; /* do nothing */ /* a reference to a literal #pred (perhaps with "!" */ + } else { + result=predicate_dup_without_context(pred->source->predEntry->pred); + if (pred->inverted) { + result->inverted=!result->inverted; + }; + if (pred->source->inverted) { + result->inverted=!result->inverted; + }; + result->right=pred->right; + pred->right=NULL; + predicate_free(pred); +/*** result=MR_unfold(result); *** not necessary */ /* recursive expansion */ + return result; + }; + } else { + ; /* do nothing */ /* an inline literal predicate */ + }; + } else { + pred->down=MR_unfold(pred->down); + }; + return pred; +} + +/* this should be called immediately after MR_unfold() and + at no other times +*/ + +#ifdef __USE_PROTOS +void MR_simplifyInverted(Predicate *pred,int inverted) +#else +void MR_simplifyInverted(pred,inverted) + Predicate *pred; + int inverted; +#endif +{ + int newInverted; + + if (pred == NULL) return; + + MR_simplifyInverted(pred->right,inverted); + + newInverted= 1 & (inverted + pred->inverted); + + if (pred->down == NULL) { + pred->inverted=newInverted; + } else { + if (newInverted != 0) { + if (pred->expr == PRED_AND_LIST) { + pred->expr=PRED_OR_LIST; + } else { + pred->expr=PRED_AND_LIST; + }; + }; + pred->inverted=0; + MR_simplifyInverted(pred->down,newInverted); + }; +} + +/* only remove it from AND and OR nodes, not leaves */ + +#ifdef __USE_PROTOS +void MR_clearPredEntry(Predicate *p) +#else +void MR_clearPredEntry(p) + Predicate *p; +#endif +{ + if (p == NULL) return; + MR_clearPredEntry(p->down); + MR_clearPredEntry(p->right); + if (p->down != NULL) p->predEntry=NULL; +} + + +#ifdef __USE_PROTOS +void MR_orphanRules(FILE *f) +#else +void MR_orphanRules(f) + FILE *f; +#endif +{ + set a; + Junction *p; + unsigned e; + RuleEntry *re; + + a=empty; + + if (! InfoO) return; + + for (p=SynDiag; p!=NULL; p = (Junction *)p->p2) { + if ( (Junction *) (p->end)->p1 == NULL) { + re=(RuleEntry *) hash_get(Rname,p->rname); + require (re != NULL,"RuleEntry == NULL"); + set_orel(re->rulenum, &a); + } + } + + if (set_deg(a) > 1) { + fprintf(f,"note: Start rules: {"); + for (; !set_nil(a); set_rm(e,a)) { + e=set_int(a); + fprintf(f," %s",RulePtr[e]->rname); + }; + fprintf(f," }\n"); + }; + set_free( a ); +} + +/* merge (X Y) and (X) to create (X) */ + +static int *mergeChain; +static Tree *mergeTree; + +#ifdef __USE_PROTOS +Tree *MR_merge_tree_contexts_client(Tree *t,int chain[]) +#else +Tree *MR_merge_tree_contexts_client(t,chain) + Tree *t; + int chain[]; +#endif +{ + if (t == NULL) return NULL; + if (chain[0] == 0) { + Tree *u=t->right; + t->right=NULL; + Tfree(t); + return MR_merge_tree_contexts_client(u,&chain[0]); + } + if (chain[0] == t->token) { + t->down=MR_merge_tree_contexts_client(t->down,&chain[1]); + }; + t->right=MR_merge_tree_contexts_client(t->right,&chain[0]); + return t; +} + +#ifdef __USE_PROTOS +void MR_iterateOverTreeContexts(Tree *t,int chain[]) +#else +void MR_iterateOverTreeContexts(t,chain) + Tree *t; + int chain[]; +#endif +{ + if (t == NULL) return; + chain[0]=t->token; + if (t->down != NULL) { + MR_iterateOverTreeContexts(t->down,&chain[1]); + } else { + MR_merge_tree_contexts_client(mergeTree,mergeChain); + }; + MR_iterateOverTreeContexts(t->right,&chain[0]); + chain[0]=0; +} + +#ifdef __USE_PROTOS +Tree *MR_merge_tree_contexts(Tree *t) +#else +Tree *MR_merge_tree_contexts(t) + Tree *t; +#endif +{ + int h=MR_max_height_of_tree(t); + + mergeTree=t; + mergeChain=(int *) calloc(h+1,sizeof(int)); + require (mergeChain != NULL,"MR_merge_tree_contexts: can't alloc chain"); + MR_iterateOverTreeContexts(t,mergeChain); + t=tshrink(t); + t=tflatten(t); + t=tleft_factor(t); + free ( (char *) mergeChain); + mergeChain=NULL; + return t; +} + +#ifdef __USE_PROTOS +Tree *MR_compute_pred_tree_context(Predicate *p) +#else +Tree *MR_compute_pred_tree_context(p) + Predicate *p; +#endif +{ + Tree *t; + + t=MR_compute_pred_tree_ctxXX(p); + MR_merge_tree_contexts(t); + return t; +} + +#ifdef __USE_PROTOS +void MR_guardPred_plainSet(ActionNode *anode,Predicate *pred) +#else +void MR_guardPred_plainSet(anode,pred) + ActionNode *anode; + Predicate *pred; +#endif +{ + Junction *j; + Predicate *workPred; + set maskSet; + + maskSet=empty; + + if (!MRhoisting) return; + + /* it doesn't really matter whether the predicate has + depth k=1 or k>1 because we're not really looking + at the predicate itself, just the stuff "behind" + the predicate. + */ + + /* shouldn't have to worry about REACHing off the end + of the rule containing the predicate because the + Rule->end->halt should have been set already by the + the code which handles RuleRef nodes. + + We don't want to REACH off the end of the rule because + this would give the "global" follow context rather than + the "local" context. + + r1a : (A)? => <<p>>? r2 (A|B) + r1b : (A)? => <<p>>? r2 (A|C) + r2 : (); + + For r1a we want follow of predicate = {A B} + we want plainSet = {B} + For r1b we want follow of predicate = {A C} + we want plainSet = {C} + */ + + require (anode->next->ntype == nJunction,"MR_guardpred_plainSet not Junction"); + j=(Junction *)(anode->next); + + workPred=predicate_dup_without_context(pred); + workPred->k=1; + workPred->scontext[1]=MR_First(1,j, &(workPred->completionSet) ); + MR_complete_predicates(1,workPred); + if (pred->k == 1) { + maskSet=pred->scontext[1]; + } else { + MR_projectTreeOntoSet(pred->tcontext,1,&maskSet); + } + pred->plainSet=set_dif(workPred->scontext[1],maskSet); + predicate_free(workPred); +} + +/*******************************************************************************/ + +static Tree * suppressTree; +static int * suppressChain; /* element 0 not used */ +static set * suppressSets; +static Node * suppressNode; +static int suppressChainLength; +int MR_SuppressSearch=0; +static int suppressSucceeded; +static Predicate * suppressPredicate; + +#ifdef __USE_PROTOS +int MR_isChain(Tree *t) +#else +int MR_isChain(t) + Tree *t; +#endif +{ + Tree *u; + + for (u=t; u != NULL; u=u->down) { + if (u->right != NULL) return 0; + } + return 1; +} + +#ifdef __USE_PROTOS +int MR_suppressK_client(Tree *tree,int tokensInChain[]) +#else +int MR_suppressK_client(tree,tokensInChain) + Tree *tree; + int tokensInChain[]; +#endif +{ + int i; + set *save_fset; + int save_ConstrainSearch; + set incomplete; + Tree *t; + + suppressSucceeded=0; /* volatile */ + + if (suppressSets == NULL) { + suppressSets=(set *) calloc (CLL_k+1,sizeof(set)); + require (suppressSets != NULL,"MR_suppressK_client: suppressSets alloc"); + }; + + for (suppressChainLength=1; + tokensInChain[suppressChainLength+1] != 0; + suppressChainLength++) {}; + + require (suppressChainLength != 0,"MR_suppressK_client: chain empty"); + + for (i=1 ; i <= suppressChainLength ; i++) { + set_clr(suppressSets[i]); + set_orel( (unsigned) tokensInChain[i], + &suppressSets[i]); + }; + + save_fset=fset; + save_ConstrainSearch=ConstrainSearch; + + fset=suppressSets; + + MR_SuppressSearch=1; + MR_AmbSourceSearch=1; + MR_MaintainBackTrace=1; + ConstrainSearch=1; + + maxk = suppressChainLength; + + incomplete=empty; + t=NULL; + +/*** constrain = &(fset[1]); ***/ + + MR_setConstrainPointer(&(fset[1])); /* MR18 */ + + MR_pointerStackReset(&MR_BackTraceStack); + + TRAV(suppressNode,maxk,&incomplete,t); + + Tfree(t); + + require (set_nil(incomplete),"MR_suppressK_client TRAV incomplete"); + require (MR_BackTraceStack.count == 0, + "MR_suppressK_client: MR_BackTraceStack.count != 0"); + set_free(incomplete); + + ConstrainSearch=save_ConstrainSearch; + fset=save_fset; + + MR_AmbSourceSearch=0; + MR_MaintainBackTrace=0; + MR_SuppressSearch=0; + return suppressSucceeded; +} + +#ifdef __USE_PROTOS +Tree * MR_iterateOverTreeSuppressK(Tree *t,int chain[]) +#else +Tree * MR_iterateOverTreeSuppressK(t,chain) + Tree *t; + int chain[]; +#endif +{ + if (t == NULL) return NULL; + t->right=MR_iterateOverTreeSuppressK(t->right,&chain[0]); + chain[0]=t->token; + if (t->down != NULL) { + t->down=MR_iterateOverTreeSuppressK(t->down,&chain[1]); + if (t->down == NULL) { + Tree *u=t->right; + t->right=NULL; + Tfree(t); + chain[0]=0; + return u; + }; + } else { + MR_suppressK_client(suppressTree,suppressChain); + if (suppressSucceeded) { + Tree *u=t->right; + t->right=NULL; + Tfree(t); + chain[0]=0; + return u; + }; + }; + chain[0]=0; + return t; +} + +/* @@@ */ + +#ifdef __USE_PROTOS +Predicate * MR_suppressK(Node *j,Predicate *p) +#else +Predicate * MR_suppressK(j,p) + Node *j; + Predicate *p; +#endif +{ + Predicate *result; + int guardPred=0; + int ampersandPred=0; + Node *nodePrime; + + if (! MRhoistingk) { + return p; + } + + if (! MRhoisting) return p; + if (CLL_k == 1) return p; + + if (suppressChain == NULL) { + suppressChain=(int *) calloc(CLL_k+2,sizeof(int)); + require (suppressChain != NULL,"MR_suppressK: can't allocate chain"); + } + + if (p == NULL) return NULL; + + if (j->ntype == nJunction) { + nodePrime=(Node *) MR_junctionWithoutP2( (Junction *) j); + } else { + nodePrime=j; + }; + + p->down=MR_suppressK(j,p->down); + p->right=MR_suppressK(j,p->right); + if (p->down != NULL) { + result=p; + goto EXIT; + }; + if (p->k == 1) { + result=p; + goto EXIT; + }; + + if (p->source != NULL) { + if (p->source->guardpred != NULL) guardPred=1; + if (p->source->ampersandPred != NULL) ampersandPred=1; + } + + suppressPredicate=p; + suppressNode=nodePrime; /* was j*/ + + suppressTree=p->tcontext; + + if (guardPred || ampersandPred) { + p->tcontext=MR_iterateOverTreeSuppressK(suppressTree,&suppressChain[1]); + if (p->tcontext == NULL) { + predicate_free(p); + result=NULL; + goto EXIT; + }; + } else { + if (MR_isChain(p->tcontext)) { + p->tcontext=MR_iterateOverTreeSuppressK(suppressTree,&suppressChain[1]); + if (p->tcontext == NULL) { + predicate_free(p); + result=NULL; + goto EXIT; + }; + } + } + result=p; +EXIT: + return result; +} + +#ifdef __USE_PROTOS +void MR_suppressSearchReport(void) +#else +void MR_suppressSearchReport() +#endif +{ + int i; + Node *p; + TokNode *tn; + int depth; + set setAnd; + + /* number of tokens in back trace stack matches length of chain */ + + depth=0; + for (i=0; i < MR_BackTraceStack.count ; i++) { + p=(Node *) MR_BackTraceStack.data[i]; + if (p->ntype == nToken) depth++; + }; + + require (depth == suppressChainLength,"depth > suppressChainLength"); + + /* token codes match chain */ + + depth=0; + for (i=0; i < MR_BackTraceStack.count ; i++) { + p=(Node *) MR_BackTraceStack.data[i]; + if (p->ntype != nToken) continue; + tn=(TokNode *) p; + depth++; + if (set_nil(tn->tset)) { + require(set_el( (unsigned) tn->token,fset[depth]), + "MR_suppressSearchReport: no match to #token in chain"); + } else { + setAnd=set_and(fset[depth],tn->tset); + require(!set_nil(setAnd), + "MR_suppressSearchReport: no match to #token set in chain"); + set_free(setAnd); + }; + }; + + /* have a match - now remove it from the predicate */ + + suppressSucceeded=1; + + if (suppressSucceeded) { + fprintf(output,"\n"); + fprintf(output,"#if 0\n"); + fprintf(output,"\n"); + fprintf(output,"Part (or all) of predicate with depth > 1 suppressed by "); + fprintf(output,"alternative without predicate\n\n"); + MR_dumpPred(suppressPredicate,1); + fprintf(output,"The token sequence which is suppressed:"); + fprintf(output," ("); + for (i=1; i <= suppressChainLength; i++) { + fprintf(output," %s",TerminalString(suppressChain[i])); + }; + fprintf(output," )\n"); + fprintf(output,"The sequence of references which generate that sequence of tokens:\n\n"); + + MR_backTraceDumpItemReset(); + + for (i=0; i < MR_BackTraceStack.count ; i++) { + MR_backTraceDumpItem(output,0,(Node *) MR_BackTraceStack.data[i]); + }; + fprintf(output,"\n"); + fprintf(output,"#endif\n"); + } +} + +#ifdef __USE_PROTOS +void MR_markCompromisedRule(Node *n) +#else +void MR_markCompromisedRule(n) + Node *n; +#endif +{ + RuleEntry *q; + Node *mark=NULL; + Junction *j; + + if (n->ntype == nRuleRef) { + mark=(Node *) MR_ruleReferenced( (RuleRefNode *) n); + } else if (n->ntype == nToken) { + mark=n; + } else if (n->ntype == nJunction) { + j=(Junction *)n; + switch (j->jtype) { + case aOptBlk: + case aLoopBlk: + case RuleBlk: + case EndRule: + case aPlusBlk: + case aLoopBegin: + mark=n; + break; + default: + break; + }; + } + + if (mark == NULL) return; + + require (RulePtr != NULL,"RulePtr not initialized"); + + q = (RuleEntry *) hash_get(Rname,mark->rname); + require (q != NULL,"RuleEntry not found"); + set_orel(q->rulenum,&MR_CompromisedRules); +} + +#ifdef __USE_PROTOS +void MR_alphaBetaTraceReport(void) +#else +void MR_alphaBetaTraceReport() +#endif +{ + int i; + + if (! AlphaBetaTrace) return; + + MR_AlphaBetaMessageCount++; + + fprintf(output,"\n"); + fprintf(output,"#if 0\n"); + fprintf(output,"\n"); + fprintf(output,"Trace of references leading to attempt to compute the follow set of\n"); + fprintf(output,"alpha in an \"(alpha)? beta\" block. It is not possible for antlr to\n"); + fprintf(output,"compute this follow set because it is not known what part of beta has\n"); + fprintf(output,"already been matched by alpha and what part remains to be matched.\n"); + fprintf(output,"\n"); + fprintf(output,"Rules which make use of the incorrect follow set will also be incorrect\n"); + fprintf(output,"\n"); + + MR_backTraceDumpItemReset(); + + for (i=0; i < MR_BackTraceStack.count ; i++) { + MR_backTraceDumpItem(output,0,(Node *) MR_BackTraceStack.data[i]); + if (i < MR_BackTraceStack.count-1) { + MR_markCompromisedRule( (Node *) MR_BackTraceStack.data[i]); + }; + }; + fprintf(output,"\n"); + fprintf(output,"#endif\n"); +} + +#ifdef __USE_PROTOS +void MR_dumpRuleSet(set s) +#else +void MR_dumpRuleSet(s) + set s; +#endif +{ + unsigned *cursor; + unsigned *origin=set_pdq(s); + + require(origin != NULL,"set_pdq failed"); + + if (RulePtr == NULL) { + fprintf(stderr,"RulePtr[] not yet initialized"); + } else { + for (cursor=origin; *cursor != nil ; cursor++) { +/**** if (cursor != origin) fprintf(stderr,","); ****/ + fprintf(stderr," %s",RulePtr[*cursor]->rname); + fprintf(stderr,"\n"); + }; + free( (char *) origin); + }; +} diff --git a/pccts/antlr/pred.c b/pccts/antlr/pred.c new file mode 100644 index 0000000..12150b5 --- /dev/null +++ b/pccts/antlr/pred.c @@ -0,0 +1,819 @@ +/* + * pred.c -- source for predicate detection, manipulation + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2001 + */ + +#include <stdio.h> +#include "pcctscfg.h" +#include "set.h" +#include "syn.h" +#include "hash.h" +#include "generic.h" +#include "dlgdef.h" +#include <ctype.h> + +#ifdef __USE_PROTOS +static void complete_context_sets(RuleRefNode *, Predicate *); +static void complete_context_trees(RuleRefNode *, Predicate *); +#else +static void complete_context_sets(); +static void complete_context_trees(); +#endif + +char *PRED_AND_LIST = "AND"; +char *PRED_OR_LIST = "OR"; + +/* + * In C mode, return the largest constant integer found as the + * sole argument to LATEXT(i). + * + * In C++ mode, return the largest constant integer found as the + * sole argument to LT(i) given that the char before is nonalpha. + */ + +int +#ifdef __USE_PROTOS +predicateLookaheadDepth(ActionNode *a) +#else +predicateLookaheadDepth(a) +ActionNode *a; +#endif +{ + int max_k=0; + + if (a->predEntry != NULL) { + MR_pred_depth(a->predEntry->pred,&max_k); + goto PREDENTRY_EXIT; + } + + if ( GenCC ) + { + /* scan for LT(i) */ + int k = 0; + char *p = a->action; + while ( p!=NULL ) + { + p = strstr(p, "LT("); + if ( p!=NULL ) + { + if ( p>=a->action && !isalpha(*(p-1)) ) + { + k = atoi(p+strlen("LT(")); + if ( k>max_k ) max_k=k; + } + p += strlen("LT("); + } + } + } + else { + /* scan for LATEXT(i) */ + int k = 0; + char *p = a->action; + while ( p!=NULL ) + { + p = strstr(p, "LATEXT("); + if ( p!=NULL ) + { + p += strlen("LATEXT("); + k = atoi(p); + if ( k>max_k ) max_k=k; + } + } + } + + if ( max_k==0 && CLL_k > 1) /* MR27 Don't warn if max(k,ck) == 1 */ + { + if ( !a->frmwarned ) + { + a->frmwarned = 1; + warnFL(eMsg1("predicate: %s missing, bad, or with i=0; assuming i=1", + GenCC?"LT(i)":"LATEXT(i)"), + FileStr[a->file], a->line); + } + max_k = 1; + } + +/* MR10 */ if ( max_k > CLL_k) { +/* MR10 */ if ( !a->frmwarned ) +/* MR10 */ { +/* MR10 */ a->frmwarned = 1; +/* MR11 */ errFL(eMsgd2("predicate refers to lookahead token %d. Semantic lookahead is limited to max(k,ck)==%d", +/* MR10 */ max_k,CLL_k), +/* MR10 */ FileStr[a->file],a->line); +/* MR10 */ if (max_k >= OutputLL_k) { +/* MR10 */ if (!GenCC) { +/* MR10 */ errFL(eMsgd(" the lookahead buffer size in C mode is %d token(s) (including the one just recognized)", +/* MR10 */ OutputLL_k), +/* MR10 */ FileStr[a->file],a->line); +/* MR10 */ }; +/* MR10 */ }; +/* MR10 */ }; +/* MR10 */ max_k= CLL_k; +/* MR10 */ }; + +PREDENTRY_EXIT: + return max_k; +} + +/* Find all predicates in a block of alternatives. DO NOT find predicates + * behind the block because that predicate could depend on things set in + * one of the nonoptional blocks + */ + +Predicate * +#ifdef __USE_PROTOS +find_in_aSubBlk( Junction *alt ) +#else +find_in_aSubBlk( alt ) +Junction *alt; +#endif +{ + Predicate *a, *head=NULL, *tail=NULL, *root=NULL; + Junction *p = alt; + + if (MRhoisting) { + return MR_find_in_aSubBlk(alt); + }; + for (; p!=NULL; p=(Junction *)p->p2) + { + /* ignore empty alts */ + if ( p->p1->ntype != nJunction || + ((Junction *)p->p1)->jtype != EndBlk ) + { + a = find_predicates(p->p1); /* get preds for this alt */ + if ( a==NULL ) continue; + + /* make an OR list of predicates */ + if ( head==NULL ) + { + root = new_pred(); + root->expr = PRED_OR_LIST; + head = tail = a; + root->down = head; + } + else { + tail->right = a; + a->left = tail; + a->up = tail->up; + tail = a; + } + } + } + + /* if just one pred, remove OR root */ + if ( root!=NULL && root->down->right == NULL ) + { + Predicate *d = root->down; + free( (char *) root); + return d; + } + + return root; +} + +Predicate * +#ifdef __USE_PROTOS +find_in_aOptBlk( Junction *alt ) +#else +find_in_aOptBlk( alt ) +Junction *alt; +#endif +{ + return find_in_aSubBlk( alt ); +} + +Predicate * +#ifdef __USE_PROTOS +find_in_aLoopBegin( Junction *alt ) +#else +find_in_aLoopBegin( alt ) +Junction *alt; +#endif +{ + return find_in_aSubBlk( (Junction *) alt->p1 ); /* get preds in alts */ +} + +Predicate * +#ifdef __USE_PROTOS +find_in_aPlusBlk( Junction *alt ) +#else +find_in_aPlusBlk( alt ) +Junction *alt; +#endif +{ + require(alt!=NULL&&alt->p2!=NULL, "invalid aPlusBlk"); + return find_in_aSubBlk( alt ); +} + +/* Look for a predicate; + * + * Do not pass anything but Junction nodes; no Actions, Tokens, RuleRefs. + * This means that a "hoisting distance" of zero is the only distance + * allowable. Init actions are ignored. + * + * WARNING: + * Assumes no (..)? block after predicate for the moment. + * Does not check to see if pred is in production that can generate + * a sequence contained in the set of ambiguous tuples. + * + * Return the predicate found if any. + */ + + +Predicate * +#ifdef __USE_PROTOS +find_predicates( Node *alt ) +#else +find_predicates( alt ) +Node *alt; +#endif +{ +#ifdef DBG_PRED + Junction *j; + RuleRefNode *r; + TokNode *t; +#endif + Predicate *pred; + + if ( alt==NULL ) return NULL; + +#ifdef DBG_PRED + switch ( alt->ntype ) + { + case nJunction : + j = (Junction *) alt; + fprintf(stderr, "Junction(in %s)", j->rname); + switch ( j->jtype ) + { + case aSubBlk : + fprintf(stderr,"aSubBlk\n"); + break; + case aOptBlk : + fprintf(stderr,"aOptBlk\n"); + break; + case aLoopBegin : + fprintf(stderr,"aLoopBeginBlk\n"); + break; + case aLoopBlk : + fprintf(stderr,"aLoopBlk\n"); + break; + case aPlusBlk : + fprintf(stderr,"aPlusBlk\n"); + break; + case EndBlk : + fprintf(stderr,"EndBlk\n"); + break; + case RuleBlk : + fprintf(stderr,"RuleBlk\n"); + break; + case Generic : + fprintf(stderr,"Generic\n"); + break; + case EndRule : + fprintf(stderr,"EndRule\n"); + break; + } + break; + case nRuleRef : + r = (RuleRefNode *) alt; + fprintf(stderr, "RuleRef(in %s)\n", r->rname); + break; + case nToken : + t = (TokNode *) alt; + fprintf(stderr, "TokenNode(in %s)%s\n", t->rname, TokenString(t->token)); + break; + case nAction : + fprintf(stderr, "Action\n"); + break; + } +#endif + + switch ( alt->ntype ) + { + case nJunction : + { + Predicate *a, *b; + Junction *p = (Junction *) alt; + + /* lock nodes */ + if ( p->jtype==aLoopBlk || p->jtype==RuleBlk || + p->jtype==aPlusBlk || p->jtype==EndRule ) + { + require(p->pred_lock!=NULL, "rJunc: lock array is NULL"); + if ( p->pred_lock[1] ) + { + return NULL; + } + p->pred_lock[1] = TRUE; + } + + switch ( p->jtype ) + { + case aSubBlk : + a = find_in_aSubBlk(p); + return a; /* nothing is visible past this guy */ + case aOptBlk : + a = find_in_aOptBlk(p); + return a; + case aLoopBegin : + a = find_in_aLoopBegin(p); + return a; + case aLoopBlk : + a = find_in_aSubBlk(p); + p->pred_lock[1] = FALSE; + return a; + case aPlusBlk : + a = find_in_aPlusBlk(p); + p->pred_lock[1] = FALSE; + return a; /* nothing is visible past this guy */ + case RuleBlk : + a = find_predicates(p->p1); + p->pred_lock[1] = FALSE; + return a; + case Generic : + a = find_predicates(p->p1); + b = find_predicates(p->p2); + if ( p->pred_lock!=NULL ) p->pred_lock[1] = FALSE; + if ( a==NULL ) return b; + if ( b==NULL ) return a; + /* otherwise OR the two preds together */ + { + fatal_internal("hit unknown situation during predicate hoisting"); + } + case EndBlk : + case EndRule : /* Find no predicates after a rule ref */ + return NULL; + default: + fatal_internal("this cannot be printed\n"); + break; + } + } + case nAction : + { + ActionNode *p = (ActionNode *) alt; + if ( p->noHoist) return NULL; /* MR12c */ + if ( p->init_action ) return find_predicates(p->next); + if ( p->is_predicate ) + { + Tree *t=NULL; +#ifdef DBG_PRED + fprintf(stderr, "predicate: <<%s>>?\n", p->action); +#endif + if ( p->guardpred!=NULL ) + { + pred = predicate_dup(p->guardpred); + MR_guardPred_plainSet(p,pred); /* MR12c */ + } + else + { + pred = new_pred(); + pred->k = predicateLookaheadDepth(p); + pred->source = p; + pred->expr = p->action; + if ( HoistPredicateContext && pred->k > 1 ) + { + /* MR30 No need to use first_item_is_guess_block_extra + since we know this is an action, not a (...)* or + (...)+ block. + */ + + if ( first_item_is_guess_block((Junction *)p->next) ) + { + warnFL("cannot compute context of predicate in front of (..)? block", + FileStr[p->file], p->line); + } + else + { + ConstrainSearch = 0; +/* MR11 */ if (p->ampersandPred != NULL) { +/* MR11 */ TRAV(p, +/* MR11 */ pred->k, +/* MR11 */ &(pred->completionTree), t); +/* MR11 */ } else { + TRAV(p->next, + pred->k, + &(pred->completionTree), t); + }; + pred->tcontext = t; + MR_check_pred_too_long(pred,pred->completionTree); +#ifdef DBG_PRED + fprintf(stderr, "LL(%d) context:", pred->k); + preorder(t); + fprintf(stderr, "\n"); +#endif + } + } + else if ( HoistPredicateContext && pred->k == 1 ) + { + pred->scontext[1] = empty; + /* MR30 No need to use first_item_is_guess_block_extra + since we know this is an action. + */ + if ( first_item_is_guess_block((Junction *)p->next) ) + { + warnFL("cannot compute context of predicate in front of (..)? block", + FileStr[p->file], p->line); + } + else + { + REACH((Junction *)p->next, + 1, + &(pred->completionSet), + pred->scontext[1]); + MR_check_pred_too_long(pred,pred->completionSet); +#ifdef DBG_PRED + fprintf(stderr, "LL(1) context:"); + s_fprT(stderr, pred->scontext[1]); + fprintf(stderr, "\n"); +#endif + } + } + } + { + Predicate *d = find_predicates(p->next); + Predicate *root; + +/* Warning: Doesn't seem like the up pointers will all be set correctly; + * TJP: that's ok, we're not using them now. + */ + if ( d!=NULL ) + { + root = new_pred(); + root->expr = PRED_AND_LIST; + root->down = pred; + pred->right = d; + pred->up = root; + d->left = pred; + d->up = pred->up; + return root; + } + } + return pred; + } + return NULL; + } + case nRuleRef : + { + Predicate *a; + RuleRefNode *p = (RuleRefNode *) alt; + Junction *r; + Junction *save_MR_RuleBlkWithHalt; + + RuleEntry *q = (RuleEntry *) hash_get(Rname, p->text); + if ( q == NULL ) + { + warnFL( eMsg1("rule %s not defined",p->text), FileStr[p->file], p->line ); + return NULL; + } + r = RulePtr[q->rulenum]; + if ( r->pred_lock[1] ) + { + /* infinite left-recursion; ignore 'cause LL sup 1 (k) analysis + * must have seen it earlier. + */ + return NULL; + } + + /* MR10 There should only be one halt set at a time. */ + /* MR10 Life would have been easier with a global variable */ + /* MR10 (at least for this particular need) */ + /* MR10 Unset the old one and set the new one, later undo. */ + + require(r->end->halt == FALSE,"should only have one halt at a time"); + +/* MR10 */ require(MR_RuleBlkWithHalt == NULL || +/* MR10 */ (MR_RuleBlkWithHalt->jtype == RuleBlk && MR_RuleBlkWithHalt->end->halt == TRUE), +/* MR10 */ "RuleBlkWithHalt->end not RuleBlk or does not have halt set"); +/* MR10 */ if (MR_RuleBlkWithHalt != NULL) { +/* MR10 */ MR_RuleBlkWithHalt->end->halt=FALSE; +/* MR10 */ }; + +/*** fprintf(stderr,"\nSetting halt on junction #%d\n",r->end->seq); ***/ + + require(r->end->halt == FALSE,"rule->end->halt already set"); + + save_MR_RuleBlkWithHalt=MR_RuleBlkWithHalt; + +/* MR10 */ MR_pointerStackPush(&MR_RuleBlkWithHaltStack,MR_RuleBlkWithHalt); +/* MR10 */ MR_pointerStackPush(&MR_PredRuleRefStack,p); + + r->end->halt = TRUE; +/* MR10 */ MR_RuleBlkWithHalt=r; + + a = find_predicates((Node *)r); + + require(r->end->halt == TRUE,"rule->end->halt not set"); + r->end->halt = FALSE; + +/* MR10 */ MR_pointerStackPop(&MR_PredRuleRefStack); +/* MR10 */ MR_RuleBlkWithHalt=(Junction *) MR_pointerStackPop(&MR_RuleBlkWithHaltStack); + + require (MR_RuleBlkWithHalt==save_MR_RuleBlkWithHalt, + "RuleBlkWithHaltStack not consistent"); + +/* MR10 */ require(MR_RuleBlkWithHalt == NULL || +/* MR10 */ (MR_RuleBlkWithHalt->jtype == RuleBlk && MR_RuleBlkWithHalt->end->halt == FALSE), +/* MR10 */ "RuleBlkWithHalt->end not RuleBlk or has no halt set"); +/* MR10 */ if (MR_RuleBlkWithHalt != NULL) { +/* MR10 */ MR_RuleBlkWithHalt->end->halt=TRUE; +/* MR10 */ }; + +/*** fprintf(stderr,"\nRestoring halt on junction #%d\n",r->end->seq); ***/ + + if ( a==NULL ) return NULL; + + /* attempt to compute the "local" FOLLOW just like in normal lookahead + * computation if needed + */ + + complete_context_sets(p,a); + complete_context_trees(p,a); + +/* MR10 */ MR_cleanup_pred_trees(a); + + return a; + } + case nToken : + break; + } + + return NULL; +} + +#ifdef __USE_PROTOS +Predicate *MR_find_predicates_and_supp(Node *alt) +#else +Predicate *MR_find_predicates_and_supp(alt) + Node *alt; +#endif +{ + Predicate *p; + + p=find_predicates(alt); + p=MR_suppressK(alt,p); + return p; +} + +Predicate * +#ifdef __USE_PROTOS +new_pred( void ) +#else +new_pred( ) +#endif +{ + Predicate *p = (Predicate *) calloc(1,sizeof(Predicate)); /* MR10 */ + require(p!=NULL, "new_pred: cannot alloc predicate"); + p->scontext[0]=empty; + p->scontext[1]=empty; + p->completionTree=empty; + p->completionSet=empty; + p->plainSet=empty; + return p; +} + +static void +#ifdef __USE_PROTOS +complete_context_sets( RuleRefNode *p, Predicate *a ) +#else +complete_context_sets( p, a ) +RuleRefNode *p; +Predicate *a; +#endif +{ + set rk2, b; + int k2; + +#ifdef DBG_PRED + fprintf(stderr, "enter complete_context_sets\n"); +#endif + for (; a!=NULL; a=a->right) + { + if ( a->expr == PRED_AND_LIST || a->expr == PRED_OR_LIST ) + { + complete_context_sets(p,a->down); + continue; + } + rk2 = b = empty; + while ( !set_nil(a->completionSet) ) + { + k2 = set_int(a->completionSet); + set_rm(k2, a->completionSet); + + REACH(p->next, k2, &rk2, b); + set_orin(&(a->scontext[1]), b); + set_free(b); + } + + set_orin(&(a->completionSet), rk2);/* remember what we couldn't do */ + set_free(rk2); +#ifdef DBG_PRED + fprintf(stderr, "LL(1) context for %s(addr 0x%x) after ruleref:", a->expr, a); + s_fprT(stderr, a->scontext[1]); + fprintf(stderr, "\n"); +#endif +/* complete_context_sets(p, a->down);*/ + } +#ifdef DBG_PRED + fprintf(stderr, "exit complete_context_sets\n"); +#endif +} + +static void +#ifdef __USE_PROTOS +complete_context_trees( RuleRefNode *p, Predicate *a ) +#else +complete_context_trees( p, a ) +RuleRefNode *p; +Predicate *a; +#endif +{ + set rk2; + int k2; + Tree *u; + +#ifdef DBG_PRED + fprintf(stderr, "enter complete_context_trees\n"); +#endif + for (; a!=NULL; a=a->right) + { + if ( a->expr == PRED_AND_LIST || a->expr == PRED_OR_LIST ) + { + complete_context_trees(p, a->down); + continue; + } + rk2 = empty; + + /* any k left to do? if so, link onto tree */ + while ( !set_nil(a->completionTree) ) + { + k2 = set_int(a->completionTree); + set_rm(k2, a->completionTree); + u = NULL; + + TRAV(p->next, k2, &rk2, u); + + /* any subtrees missing k2 tokens, add u onto end */ + a->tcontext = tlink(a->tcontext, u, k2); + Tfree(u); /* MR10 */ + } + set_orin(&(a->completionTree), rk2);/* remember what we couldn't do */ + set_free(rk2); +#ifdef DBG_PRED + fprintf(stderr, "LL(i<%d) context after ruleref:", LL_k); + preorder(a->tcontext); + fprintf(stderr, "\n"); +#endif +/* complete_context_trees(p, a->down);*/ + } +#ifdef DBG_PRED + fprintf(stderr, "exit complete_context_trees\n"); +#endif +} + +/* Walk a list of predicates and return the set of all tokens in scontext[1]'s */ +set +#ifdef __USE_PROTOS +covered_set( Predicate *p ) +#else +covered_set( p ) +Predicate *p; +#endif +{ + set a; + + a = empty; + for (; p!=NULL; p=p->right) + { + if ( p->expr == PRED_AND_LIST || p->expr == PRED_OR_LIST ) + { + set_orin(&a, covered_set(p->down)); + continue; + } + set_orin(&a, p->scontext[1]); + set_orin(&a, covered_set(p->down)); + } + return a; +} + +/* MR10 predicate_free() + MR10 Don't free the leaf nodes since they are part of the action node +*/ + +#ifdef __USE_PROTOS +void predicate_free(Predicate *p) +#else +void predicate_free(p) + Predicate *p; +#endif +{ + if (p == NULL) return; + predicate_free(p->right); + predicate_free(p->down); + if (p->cloned || + p->source == NULL || + p->source->guardpred == NULL || + p->expr == PRED_AND_LIST || + p->expr == PRED_OR_LIST) { + set_free(p->scontext[1]); + set_free(p->completionSet); + set_free(p->completionTree); + set_free(p->plainSet); + Tfree(p->tcontext); + free( (char *) p); + } else { + p->right=NULL; + p->down=NULL; /* MR13 *** debug */ + }; +} + +/* MR10 predicate_dup() */ + +#ifdef __USE_PROTOS +Predicate * predicate_dup_xxx(Predicate *p,int contextToo) +#else +Predicate * predicate_dup_xxx(p,contextToo) + Predicate *p; + int contextToo; +#endif +{ + Predicate *q; + + if (p == NULL) return NULL; + q=new_pred(); + q->down=predicate_dup(p->down); + q->right=predicate_dup(p->right); + + /* + don't replicate expr - it is read-only + and address comparison is used to look + for identical predicates. + */ + + q->expr=p->expr; + q->k=p->k; + q->source=p->source; + q->cloned=1; + q->ampersandStyle=p->ampersandStyle; + q->inverted=p->inverted; + q->predEntry=p->predEntry; + q->plainSet=set_dup(p->plainSet); + + if (contextToo) { + q->tcontext=tdup(p->tcontext); + q->scontext[0]=set_dup(p->scontext[0]); + q->scontext[1]=set_dup(p->scontext[1]); + q->completionTree=set_dup(p->completionTree); + q->completionSet=set_dup(p->completionSet); + }; + + /* don't need to dup "redundant" */ + + return q; + +} + +#ifdef __USE_PROTOS +Predicate * predicate_dup_without_context(Predicate *p) +#else +Predicate * predicate_dup_without_context(p) + Predicate *p; +#endif +{ + return predicate_dup_xxx(p,0); +} + +#ifdef __USE_PROTOS +Predicate * predicate_dup(Predicate *p) +#else +Predicate * predicate_dup(p) + Predicate *p; +#endif +{ + return predicate_dup_xxx(p,1); +} + diff --git a/pccts/antlr/proto.h b/pccts/antlr/proto.h new file mode 100644 index 0000000..930b2de --- /dev/null +++ b/pccts/antlr/proto.h @@ -0,0 +1,852 @@ +/* + * proto.h -- function prototypes + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2001 + */ + + /* V a r i a b l e s */ + +extern int tp; +extern Junction *SynDiag; +extern char Version[]; +extern char VersionDef[]; +#ifdef __cplusplus +extern void (*fpPrint[])(...); +#else +extern void (*fpPrint[])(); +#endif +#ifdef __cplusplus +extern struct _set (*fpReach[])(...); +#else +extern struct _set (*fpReach[])(); +#endif +#ifdef __cplusplus +extern struct _tree *(*fpTraverse[])(...); +#else +extern struct _tree *(*fpTraverse[])(); +#endif +#ifdef __cplusplus +extern void (**fpTrans)(...); +#else +extern void (**fpTrans)(); +#endif +#ifdef __cplusplus +extern void (**fpJTrans)(...); +#else +extern void (**fpJTrans)(); +#endif +#ifdef __cplusplus +extern void (*C_Trans[NumNodeTypes+1])(...); +#else +extern void (*C_Trans[])(); +#endif +#ifdef __cplusplus +extern void (*C_JTrans[NumJuncTypes+1])(...); +#else +extern void (*C_JTrans[])(); +#endif +extern int BlkLevel; +extern int CurFile; +extern char *CurPredName; +extern char *CurRule; +extern int CurRuleDebug; /* MR13 */ +extern Junction *CurRuleBlk; +extern RuleEntry *CurRuleNode; +extern ListNode *CurElementLabels; +extern ListNode *CurAstLabelsInActions; /* MR27 */ +extern ListNode *ContextGuardPredicateList; /* MR13 */ +extern ListNode *CurActionLabels; +extern int numericActionLabel; /* MR10 << ... $1 ... >> or << ... $1 ... >>? */ +extern ListNode *NumericPredLabels; /* MR10 << ... $1 ... >>? ONLY */ +extern char *FileStr[]; +extern int NumFiles; +extern int EpToken; +extern int WildCardToken; +extern Entry **Tname, + **Texpr, + **Rname, + **Fcache, + **Tcache, + **Elabel, + **Sname, + **Pname; /* MR11 */ +extern ListNode *ExprOrder; +extern ListNode **Cycles; +extern int TokenNum; +extern int LastTokenCounted; +extern ListNode *BeforeActions, *AfterActions, *LexActions; + +/* MR1 */ +/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */ +/* MR1 via #lexmember <<....>> & #lexprefix <<...>> */ +/* MR1 */ + +extern ListNode *LexMemberActions; /* MR1 */ +extern ListNode *LexPrefixActions; /* MR1 */ + +extern set *fset; /* for constrained search */ /* MR11 */ +extern int maxk; /* for constrained search */ /* MR11 */ +extern int Save_argc; /* MR10 */ +extern char **Save_argv; /* MR10 */ +extern ListNode *eclasses, *tclasses; +extern char *HdrAction; +extern char *FirstAction; /* MR11 */ +extern FILE *ErrFile; +extern char *RemapFileName; +extern char *ErrFileName; +extern char *DlgFileName; +extern char *DefFileName; +extern char *ModeFileName; +extern char *StdMsgName; +extern int NumRules; +extern Junction **RulePtr; +extern int LL_k; +extern int CLL_k; +extern char *decodeJType[]; +extern int PrintOut; +extern int PrintAnnotate; +extern int CodeGen; +extern int LexGen; +extern int esetnum; +extern int setnum; +extern int wordnum; +extern int GenAST; +extern int GenANSI; +extern int **FoStack; +extern int **FoTOS; +extern int GenExprSetsOpt; +extern FILE *DefFile; +extern int CannotContinue; +extern int GenCR; +extern int GenLineInfo; +extern int GenLineInfoMS; +extern int action_file, action_line; +extern int TraceGen; +extern int CurAmbigAlt1, CurAmbigAlt2, CurAmbigline, CurAmbigfile; +extern char *CurAmbigbtype; +extern int elevel; +extern int GenEClasseForRules; +extern FILE *input, *output; +extern char **TokenStr, **ExprStr; +extern int CurrentLexClass, NumLexClasses; +extern LClass lclass[]; +extern char LexStartSymbol[]; +extern char *CurRetDef; +extern char *CurParmDef; +extern int OutputLL_k; +extern int TreeResourceLimit; +extern int DemandLookahead; +extern char *RulePrefix; +extern int GenStdPccts; +extern char *stdpccts; +extern int ParseWithPredicates; +extern int ConstrainSearch; +extern int PURIFY; /* MR23 */ + +extern set MR_CompromisedRules; /* MR14 */ +extern int MR_AmbSourceSearch; /* MR11 */ +extern int MR_SuppressSearch; /* MR13 */ +extern int MR_AmbSourceSearchGroup; /* MR11 */ +extern int MR_AmbSourceSearchChoice; /* MR11 */ +extern int MR_AmbSourceSearchLimit; /* MR11 */ +extern int MR_usingPredNames; /* MR11 */ +extern int MR_ErrorSetComputationActive; /* MR14 */ +extern char *MR_AmbAidRule; /* MR11 */ +extern int MR_AmbAidLine; /* MR11 */ +extern int MR_AmbAidMultiple; /* MR11 */ +extern int MR_AmbAidDepth; /* MR11 */ +extern int MR_skipped_e3_report; /* MR11 */ +extern int MR_matched_AmbAidRule; /* MR11 */ +extern int MR_Inhibit_Tokens_h_Gen; /* MR13 */ +extern int NewAST; /* MR13 */ +extern int tmakeInParser; /* MR23 */ +extern int AlphaBetaTrace; /* MR14 */ +extern int MR_BlkErr; /* MR21 */ +extern int MR_AlphaBetaWarning; /* MR14 */ +extern int MR_AlphaBetaMessageCount; /* MR14 */ +extern int MR_MaintainBackTrace; /* MR14 */ +extern int MR_BadExprSets; /* MR13 */ +extern int FoundGuessBlk; +extern int FoundException; +extern int FoundAtOperator; /* MR6 */ +extern int FoundExceptionGroup; /* MR6 */ +extern int WarningLevel; +extern int UseStdout; /* MR6 */ +extern int TabWidth; /* MR6 */ +extern int pLevel; +extern int pAlt1; +extern int pAlt2; +extern int AImode; +extern int HoistPredicateContext; +extern int MRhoisting; /* MR9 */ +extern int MRhoistingk; /* MR13 */ +extern int MR_debugGenRule; /* MR11 */ +extern int GenCC; +extern char *ParserName; +extern char *StandardSymbols[]; +extern char *ASTSymbols[]; +extern set reserved_positions; +extern set all_tokens; +extern set imag_tokens; +extern set tokclasses; +extern ListNode *ForcedTokens; +extern int *TokenInd; +extern FILE *Parser_h, *Parser_c; +extern char CurrentClassName[]; +extern int no_classes_found; +extern char Parser_h_Name[]; +extern char Parser_c_Name[]; +extern char MRinfoFile_Name[]; /* MR10 */ +extern FILE *MRinfoFile; /* MR10 */ +extern int MRinfo; /* MR10 */ +extern int MRinfoSeq; /* MR10 */ +extern int InfoP; /* MR10 */ +extern int InfoT; /* MR10 */ +extern int InfoF; /* MR10 */ +extern int InfoM; /* MR10 */ +extern int InfoO; /* MR12 */ +extern int PotentialSuppression; /* MR10 */ +extern int PotentialDummy; /* MR10 */ +extern int TnodesInUse; /* MR10 */ +extern int TnodesPeak; /* MR10 */ +extern int TnodesReportThreshold; /* MR11 */ +extern int TnodesAllocated; /* MR10 */ +extern char *ClassDeclStuff; /* MR10 */ +extern char *BaseClassName; /* MR22 */ +extern ListNode *class_before_actions, *class_after_actions; +extern char *UserTokenDefsFile; +extern int UserDefdTokens; +extern ListNode *MetaTokenNodes; +extern char *OutputDirectory; +extern int DontCopyTokens; +extern int LTinTokenAction; /* MR23 */ +extern set AST_nodes_refd_in_actions; +extern ListNode *CurExGroups; +extern int CurBlockID; +extern int CurAltNum; +extern Junction *CurAltStart; +extern Junction *OuterAltStart; /* chain exception groups MR7 */ +extern ExceptionGroup *DefaultExGroup; +extern int NumSignals; +extern int ContextGuardTRAV; +extern Junction *MR_RuleBlkWithHalt; /* MR10 */ +extern PointerStack MR_BackTraceStack; /* MR10 */ +extern PointerStack MR_PredRuleRefStack; /* MR10 */ +extern PointerStack MR_RuleBlkWithHaltStack; /* MR10 */ + +/* */ +/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */ +/* MR1 in DLG action */ +/* */ +extern int tokenActionActive; /* MR1 */ + +extern char *PRED_OR_LIST; /* MR10 */ +extern char *PRED_AND_LIST; /* MR10 */ + +#ifdef __VMS +#define STRICMP strcasecmp /* MR21 */ +#else +#define STRICMP stricmp /* MR21 */ +#endif + +/* MR26 */ +#ifdef PCCTS_USE_STDARG +extern Tree *tmake(Tree *root, ...); +#else +extern Tree *tmake(); +#endif + +#ifdef __USE_PROTOS +extern int STRICMP(const char*, const char*); +extern void istackreset(void); +extern int istacksize(void); +extern void pushint(int); +extern int popint( void ); +extern int istackempty( void ); +extern int topint( void ); +extern void NewSetWd( void ); +extern void DumpSetWd( void ); +extern void DumpSetWdForC( void ); +extern void DumpSetWdForCC( void ); +extern void NewSet( void ); +extern void FillSet( set ); +extern void ComputeErrorSets( void ); +extern void ComputeTokSets( void ); +extern void SubstErrorClass( set * ); +extern int DefErrSet( set *, int, char * ); +extern int DefErrSetForC( set *, int, char * ); +extern int DefErrSetForCC( set *, int, char * ); +extern int DefErrSet1(int, set *, int, char *); /* MR21 */ +extern int DefErrSetForC1(int, set *, int, char *, const char* ); /* MR21 */ +extern int DefErrSetForCC1(int, set *, int, char *, const char* ); /* MR21 */ +extern int DefErrSetWithSuffix(int, set *, int, char *, const char *); /* MR21 */ +extern void GenErrHdr( void ); +extern void dumpExpr( FILE *, char * ); +extern void addParm( Node *, char * ); +extern Graph buildAction( char *, int, int, int ); +extern Graph buildToken( char * ); +extern Graph buildWildCard( char * ); +extern Graph buildRuleRef( char * ); +extern Graph Or( Graph, Graph ); +extern Graph Cat( Graph, Graph ); +extern Graph makeOpt( Graph, int, char *); +extern Graph makeBlk( Graph, int, char *); +extern Graph makeLoop( Graph, int, char *); +extern Graph makePlus( Graph, int, char *); +extern Graph emptyAlt( void ); +extern Graph emptyAlt3( void ); +extern TokNode * newTokNode( void ); +extern RuleRefNode * newRNode( void ); +extern Junction * newJunction( void ); +extern ActionNode * newActionNode( void ); +extern char * makelocks( void ); +extern void preorder( Tree * ); +extern Tree * tnode( int ); +extern void _Tfree( Tree * ); +extern Tree * tdup( Tree * ); +extern int is_single_tuple( Tree * ); +extern Tree * tappend( Tree *, Tree * ); +extern void Tfree( Tree * ); +extern Tree * tlink( Tree *, Tree *, int ); +extern Tree * tshrink( Tree * ); +extern Tree * tflatten( Tree * ); +extern Tree * tJunc( Junction *, int, set * ); +extern Tree * tRuleRef( RuleRefNode *, int, set * ); +extern Tree * tToken( TokNode *, int, set * ); +extern Tree * tAction( ActionNode *, int, set * ); +extern int tmember( Tree *, Tree * ); +extern int tmember_constrained( Tree *, Tree * ); +extern Tree * tleft_factor( Tree * ); +extern Tree * trm_perm( Tree *, Tree * ); +extern void tcvt( set *, Tree * ); +extern Tree * permute( int, int ); +extern Tree * VerifyAmbig( Junction *, Junction *, unsigned **, set *, Tree **, Tree **, int * ); +extern set rJunc( Junction *, int, set * ); +extern set rRuleRef( RuleRefNode *, int, set * ); +extern set rToken( TokNode *, int, set * ); +extern set rAction( ActionNode *, int, set * ); +extern void HandleAmbiguity( Junction *, Junction *, Junction *, int ); +extern set First( Junction *, int, int, int * ); +extern void freeBlkFsets( Junction * ); +extern void genAction( ActionNode * ); +extern void genRuleRef( RuleRefNode * ); +extern void genToken( TokNode * ); +extern void genOptBlk( Junction * ); +extern void genLoopBlk( Junction *, Junction *, Junction *, int ); +extern void genLoopBegin( Junction * ); +extern void genPlusBlk( Junction * ); +extern void genSubBlk( Junction * ); +extern void genRule( Junction * ); +extern void genJunction( Junction * ); +extern void genEndBlk( Junction * ); +extern void genEndRule( Junction * ); +extern void genHdr( int ); +extern void genHdr1( int ); +extern void dumpAction( char *, FILE *, int, int, int, int ); +extern void dumpActionPlus(ActionNode*, char *, FILE *, int, int, int, int ); /* MR21 */ +extern Entry ** newHashTable( void ); +extern Entry * hash_add( Entry **, char *, Entry * ); +extern Entry * hash_get( Entry **, char * ); +extern void hashStat( Entry ** ); +extern char * mystrdup( char * ); +extern void genLexDescr( void ); +extern void dumpLexClasses( FILE * ); +extern void genDefFile( void ); +extern void DumpListOfParmNames( char *, FILE *, int ); /* MR5 janm 26-May-97 */ +extern int DumpNextNameInDef( char **, FILE * ); +extern void DumpOldStyleParms( char *, FILE * ); +extern void DumpType( char *, FILE * ); +extern int strmember( char *, char * ); +/* extern int HasComma( char * ); MR23 Replaced by hasMultipleOperands() */ +extern void DumpRetValStruct( FILE *, char *, int ); +extern char * StripQuotes( char * ); +extern int main( int, char *[] ); +extern void readDescr( void ); +extern FILE * NextFile( void ); +extern char * outnameX( char *, char *); +extern char * outname( char * ); +extern void fatalFL( char *, char *, int ); +extern void fatal_intern( char *, char *, int ); +extern void cleanUp( void ); +extern char * eMsg3( char *, char *, char *, char * ); +extern char * eMsgd( char *, int ); +extern char * eMsgd2( char *, int, int ); +extern void s_fprT( FILE *, set ); +extern char * TerminalString( int ); +extern void lexclass( char * ); +extern void lexmode( int ); +extern int LexClassIndex( char * ); +extern int hasAction( char * ); +extern void setHasAction( char *, char * ); +extern int addTname( char * ); +extern int addTexpr( char * ); +extern int Tnum( char * ); +extern void Tklink( char *, char * ); +extern Entry * newEntry( char *, int ); +extern void list_add( ListNode **, void * ); +extern void list_free( ListNode **, int freeData ); /* MR10 */ +extern void list_apply( ListNode *, void (*)(void *) ); +extern int list_search_cstring (ListNode *, char *); /* MR27 */ +extern char * Fkey( char *, int, int ); +extern void FoPush( char *, int ); +extern void FoPop( int ); +extern void RegisterCycle( char *, int ); +extern void ResolveFoCycles( int ); +extern void pJunc( Junction * ); +extern void pRuleRef( RuleRefNode * ); +extern void pToken( TokNode * ); +extern void pAction( ActionNode * ); +extern void FoLink( Node * ); +extern void addFoLink( Node *, char *, Junction * ); +extern void GenCrossRef( Junction * ); +extern void defErr( char *, long, long, long, long, long, long ); +extern void genStdPCCTSIncludeFile(FILE *,char *); /* MR10 */ +extern char * pcctsBaseName(char *); /* MR32 */ +extern Predicate *find_predicates(Node *); /* MR10 */ +extern Predicate *MR_find_predicates_and_supp(Node *); /* MR13 */ +extern int predicateLookaheadDepth(ActionNode *); /* MR10 */ +extern void predicate_free(Predicate *); /* MR10 */ +extern Predicate * predicate_dup(Predicate *); /* MR10 */ +extern Predicate * predicate_dup_without_context(Predicate *); /* MR11 */ +extern void GenRulePrototypes(FILE *, Junction *); +extern Junction *first_item_is_guess_block(Junction *); +extern Junction *first_item_is_guess_block_extra(Junction * q); /* MR30 */ +extern Junction *analysis_point(Junction *); +extern Tree *make_tree_from_sets(set *, set *); +extern Tree *tdup_chain(Tree *); +extern Tree *tdif(Tree *, Predicate *, set *, set *); +extern set covered_set(Predicate *); +extern void AmbiguityDialog(Junction *, int, Junction *, Junction *, int *, int *); +extern void dumpAmbigMsg(set *, FILE *, int); +extern void GenRuleFuncRedefs(FILE *, Junction *); +extern void GenPredefinedSymbolRedefs(FILE *); +extern void GenASTSymbolRedefs(FILE *); +extern void GenRemapFile(void); +extern void GenSetRedefs(FILE *); +extern ForcedToken *newForcedToken(char *, int); +extern void RemapForcedTokens(void); +extern char *TokenOrExpr(int); +extern void setUpperRange(TokNode *, char *); +extern void GenParser_c_Hdr(void); +extern void GenParser_h_Hdr(void); +extern void GenRuleMemberDeclarationsForCC(FILE *, Junction *); +extern int addForcedTname( char *, int ); +extern char *OutMetaName(char *); +extern void OutFirstSetSymbol(Junction *q, char *); /* MR21 */ +extern void warnNoFL(char *err); +extern void warnFL(char *err,char *f,int l); +extern void warn(char *err); +extern void warnNoCR( char *err ); +extern void errNoFL(char *err); +extern void errFL(char *err,char *f,int l); +extern void err(char *err); +extern void errNoCR( char *err ); +extern void genPredTree( Predicate *p, Node *j, int ,int); +extern UserAction *newUserAction(char *); +extern char *gate_symbol(char *name); +extern char *makeAltID(int blockid, int altnum); +extern void DumpRemainingTokSets(void); +extern void DumpANSIFunctionArgDef(FILE *f, Junction *q, int bInit); /* MR23 */ +extern void DumpFormals(FILE *, char *, int bInit); /* MR23 */ +extern char* hideDefaultArgs(const char* pdecl); /* MR22 VHS */ +extern Predicate *computePredFromContextGuard(Graph,int *msgDone); /* MR21 */ +extern void recomputeContextGuard(Predicate *); /* MR13 */ +extern Predicate *new_pred(void); +extern void chkGTFlag(void); +extern void leAdd(LabelEntry *); /* MR7 */ +extern void leFixup(void); /* MR7 */ +extern void egAdd(ExceptionGroup *); /* MR7 */ +extern void egFixup(void); /* MR7 */ +extern void altAdd(Junction *); /* MR7 */ +extern void altFixup(void); /* MR7 */ +extern Predicate * MR_find_in_aSubBlk(Junction *alt); /* MR10 */ +extern Predicate * MR_predFlatten(Predicate *p); /* MR10 */ +extern Predicate * MR_predSimplifyALL(Predicate *p); /* MR10 */ +extern Predicate * MR_predSimplifyALLX(Predicate *p,int skipPass3); /* MR10 */ +extern int MR_allPredLeaves(Predicate *p); /* MR10 */ +extern void MR_cleanup_pred_trees(Predicate *p); /* MR10 */ +extern int MR_predicate_context_completed(Predicate *p); /* MR10 */ +extern void MR_check_pred_too_long(Predicate *p,set completion); /* MR10 */ +extern Tree * MR_remove_epsilon_from_tree(Tree *t); /* MR10 */ +extern Tree * MR_computeTreeAND(Tree *l,Tree *r); /* MR10 */ +extern int MR_tree_equ(Tree *big, Tree *small); /* MR10 */ +extern set MR_First(int ck,Junction *j,set *incomplete); /* MR10 */ +extern set MR_compute_pred_set(Predicate *p); /* MR10 */ +extern Tree * MR_compute_pred_tree_context(Predicate *p); /* MR10 */ +extern int MR_pointerStackPush(PointerStack *,void *); /* MR10 */ +extern void * MR_pointerStackPop(PointerStack *); /* MR10 */ +extern void * MR_pointerStackTop(PointerStack *); /* MR10 */ +extern void MR_pointerStackReset(PointerStack *); /* MR10 */ +extern void MR_backTraceReport(void); /* MR10 */ +extern void MR_alphaBetaTraceReport(void); /* MR14 */ +extern void MR_dumpRuleSet(set); /* MR14 */ +extern void MR_predContextPresent(Predicate *p,int *,int *); /* MR10 */ +extern void MR_dumpPred(Predicate *p,int withContext); /* MR10 */ +extern void MR_dumpPred1(int,Predicate *p,int withContext); /* MR10 */ +extern void MR_xxxIndent(FILE *f,int depth); /* MR11 */ +extern void MR_outputIndent(int depth); /* MR11 */ +extern void MR_stderrIndent(int depth); /* MR11 */ +extern Junction * MR_ruleReferenced(RuleRefNode *rrn); /* MR10 */ +extern Junction * MR_nameToRuleBlk(char *); /* MR10 */ +extern void MR_releaseResourcesUsedInRule(Node *); /* MR10 */ +extern void MR_dumpTreeX(int depth,Tree *t,int across); /* MR10 */ +extern void MR_dumpTreeF(FILE *f,int depth,Tree *t,int across); /* MR10 */ +extern void DumpFcache(void); /* MR10 */ +extern void MR_dumpTokenSet(FILE *f,int depth,set s); /* MR10 */ +extern void MR_traceAmbSource(set *,Junction *,Junction *); /* MR11 */ +extern void MR_traceAmbSourceK(Tree *,Junction *a1,Junction *a2); /* MR11 */ +extern void MR_traceAmbSourceKclient(void); /* MR20 */ +extern Node *MR_advance(Node *); /* MR11 */ +extern int MR_offsetFromRule(Node *); /* MR11 */ +extern char *MR_ruleNamePlusOffset(Node *); /* MR11 */ +extern int MR_max_height_of_tree(Tree *); /* MR11 */ +extern int MR_all_leaves_same_height(Tree *,int); /* MR11 */ +extern void MR_projectTreeOntoSet(Tree *t,int k,set *); /* MR11 */ +extern Tree *MR_make_tree_from_set(set); /* MR11 */ +extern Predicate *MR_removeRedundantPredPass3(Predicate *); /* MR11 */ +extern void MR_pred_depth(Predicate *,int *); /* MR11 */ +extern int MR_comparePredicates(Predicate *,Predicate *); /* MR11 */ +extern Predicate * MR_unfold(Predicate *); /* MR11 */ +extern void MR_simplifyInverted(Predicate *,int); /* MR11 */ +extern int MR_secondPredicateUnreachable /* MR11 */ + (Predicate *first,Predicate *second); /* MR11 */ +extern void MR_clearPredEntry(Predicate *); /* MR11 */ +extern void MR_orphanRules(FILE *); /* MR12 */ +extern void MR_merge_contexts(Tree *); /* MR12 */ +extern int ci_strequ(char *,char *); /* MR12 */ +extern void MR_guardPred_plainSet(ActionNode *anode,Predicate *); /* MR12c */ +extern void MR_suppressSearchReport(void); /* MR12c */ +extern Predicate * MR_suppressK(Node *,Predicate *); /* MR13 */ +extern void MR_backTraceDumpItem(FILE *,int skip,Node *n); /* MR13 */ +extern void MR_backTraceDumpItemReset(void); /* MR13 */ +extern Junction * MR_junctionWithoutP2(Junction *); /* MR13 */ +extern void MR_setConstrainPointer(set *); /* MR18 */ +extern void BlockPreambleOption(Junction *q, char * pSymbol); /* MR23 */ +extern char* getInitializer(char *); /* MR23 */ +extern char *endFormal(char *pStart, /* MR23 */ + char **ppDataType, /* MR23 */ + char **ppSymbol, /* MR23 */ + char **ppEqualSign, /* MR23 */ + char **ppValue, /* MR23 */ + char **ppSeparator, /* MR23 */ + int *pNext); /* MR23 */ +extern char *strBetween(char *pStart, /* MR23 */ + char *pNext, /* MR23 */ + char *pStop); /* MR23 */ +extern int hasMultipleOperands(char *); /* MR23 */ +extern void DumpInitializers(FILE*, RuleEntry*, char*); /* MR23 */ +extern int isTermEntryTokClass(TermEntry *); /* MR23 */ +extern int isEmptyAlt(Node *, Node *); /* MR23 */ +#else +extern int STRICMP(); +extern void istackreset(); +extern int istacksize(); +extern void pushint(); +extern int popint(); +extern int istackempty(); +extern int topint(); +extern void NewSetWd(); +extern void DumpSetWd(); +extern void DumpSetWdForC(); +extern void DumpSetWdForCC(); +extern void NewSet(); +extern void FillSet(); +extern void ComputeErrorSets(); +extern void ComputeTokSets(); +extern void SubstErrorClass(); +extern int DefErrSet(); +extern int DefErrSetForC(); +extern int DefErrSetForCC(); +extern int DefErrSet1(); +extern int DefErrSetForC1(); +extern int DefErrSetForCC1(); +extern int DefErrSetWithSuffix(); /* MR21 */ +extern void GenErrHdr(); +extern void dumpExpr(); +extern void addParm(); +extern Graph buildAction(); +extern Graph buildToken(); +extern Graph buildWildCard(); +extern Graph buildRuleRef(); +extern Graph Or(); +extern Graph Cat(); +extern Graph makeOpt(); +extern Graph makeBlk(); +extern Graph makeLoop(); +extern Graph makePlus(); +extern Graph emptyAlt(); +extern Graph emptyAlt3(); +extern TokNode * newTokNode(); +extern RuleRefNode * newRNode(); +extern Junction * newJunction(); +extern ActionNode * newActionNode(); +extern char * makelocks(); +extern void preorder(); +extern Tree * tnode(); +extern void _Tfree(); +extern Tree * tdup(); +extern int is_single_tuple(); +extern Tree * tappend(); +extern void Tfree(); +extern Tree * tlink(); +extern Tree * tshrink(); +extern Tree * tflatten(); +extern Tree * tJunc(); +extern Tree * tRuleRef(); +extern Tree * tToken(); +extern Tree * tAction(); +extern int tmember(); +extern int tmember_constrained(); +extern Tree * tleft_factor(); +extern Tree * trm_perm(); +extern void tcvt(); +extern Tree * permute(); +extern Tree * VerifyAmbig(); +extern set rJunc(); +extern set rRuleRef(); +extern set rToken(); +extern set rAction(); +extern void HandleAmbiguity(); +extern set First(); +extern void freeBlkFsets(); +extern void genAction(); +extern void genRuleRef(); +extern void genToken(); +extern void genOptBlk(); +extern void genLoopBlk(); +extern void genLoopBegin(); +extern void genPlusBlk(); +extern void genSubBlk(); +extern void genRule(); +extern void genJunction(); +extern void genEndBlk(); +extern void genEndRule(); +extern void genHdr(); +extern void genHdr1(); +extern void dumpAction(); +extern void dumpActionPlus(); /* MR21 */ +extern Entry ** newHashTable(); +extern Entry * hash_add(); +extern Entry * hash_get(); +extern void hashStat(); +extern char * mystrdup(); +extern void genLexDescr(); +extern void dumpLexClasses(); +extern void genDefFile(); +extern void DumpListOfParmNames(); /* MR5 janm 26-May-97 */ +extern int DumpNextNameInDef(); +extern void DumpOldStyleParms(); +extern void DumpType(); +extern int strmember(); +/* extern int HasComma(); MR23 Replaced by hasMultipleOperands() */ +extern void DumpRetValStruct(); +extern char * StripQuotes(); +extern int main(); +extern void readDescr(); +extern FILE * NextFile(); +extern char * outnameX(); +extern char * outname(); +extern void fatalFL(); +extern void fatal_intern(); +extern void cleanUp(); +extern char * eMsg3(); +extern char * eMsgd(); +extern char * eMsgd2(); +extern void s_fprT(); +extern char * TerminalString(); +extern void lexclass(); +extern void lexmode(); +extern int LexClassIndex(); +extern int hasAction(); +extern void setHasAction(); +extern int addTname(); +extern int addTexpr(); +extern int Tnum(); +extern void Tklink(); +extern Entry * newEntry(); +extern void list_add(); +extern void list_free(); /* MR10 */ +extern void list_apply(); +extern int list_search_cstring (); /* MR27 */ +extern char * Fkey(); +extern void FoPush(); +extern void FoPop(); +extern void RegisterCycle(); +extern void ResolveFoCycles(); +extern void pJunc(); +extern void pRuleRef(); +extern void pToken(); +extern void pAction(); +extern void FoLink(); +extern void addFoLink(); +extern void GenCrossRef(); +extern void defErr(); +extern void genStdPCCTSIncludeFile(); +extern char * pcctsBaseName(); /* MR32 */ +extern Predicate *find_predicates(); +extern Predicate *MR_find_predicates_and_supp(); /* MR13 */ +extern int predicateLookaheadDepth(); /* MR10 */ +extern void predicate_free(); /* MR10 */ +extern Predicate * predicate_dup(); /* MR10 */ +extern Predicate * predicate_dup_without_context(); /* MR11 */ +extern void GenRulePrototypes(); +extern Junction *first_item_is_guess_block(); +extern Junction *first_item_is_guess_block_extra(); /* MR30 */ +extern Junction *analysis_point(); +extern Tree *make_tree_from_sets(); +extern Tree *tdup_chain(); +extern Tree *tdif(); +extern set covered_set(); +extern void AmbiguityDialog(); +extern void dumpAmbigMsg(); +extern void GenRuleFuncRedefs(); +extern void GenPredefinedSymbolRedefs(); +extern void GenASTSymbolRedefs(); +extern void GenRemapFile(); +extern void GenSetRedefs(); +extern ForcedToken *newForcedToken(); +extern void RemapForcedTokens(); +extern char *TokenOrExpr(); +extern void setUpperRange(); +extern void GenParser_c_Hdr(); +extern void GenParser_h_Hdr(); +extern void GenRuleMemberDeclarationsForCC(); +extern int addForcedTname(); +extern char *OutMetaName(); +extern void OutFirstSetSymbol(); /* MR21 */ +extern void warnNoFL(); +extern void warnFL(); +extern void warn(); +extern void warnNoCR(); +extern void errNoFL(); +extern void errFL(); +extern void err(); +extern void errNoCR(); +extern void genPredTree(); +extern UserAction *newUserAction(); +extern char *gate_symbol(); +extern char *makeAltID(); +extern void DumpRemainingTokSets(); +extern void DumpANSIFunctionArgDef(); +extern void DumpFormals(); /* MR23 */ +extern char* hideDefaultArgs(); /* MR22 VHS */ +extern Predicate *computePredFromContextGuard(); +extern void recomputeContextGuard(); /* MR13 */ +extern Predicate *new_pred(); +extern void chkGTFlag(); +extern void leAdd(); /* MR7 */ +extern void leFixup(); /* MR7 */ +extern void egAdd(); /* MR7 */ +extern void egFixup(); /* MR7 */ +extern void altAdd(); /* MR7 */ +extern void altFixup(); /* MR7 */ +extern Predicate * MR_find_in_aSubBlk(); /* MR10 */ +extern Predicate * MR_predFlatten(); /* MR10 */ +extern Predicate * MR_predSimplifyALL(); /* MR10 */ +extern Predicate * MR_predSimplifyALLX(); /* MR10 */ +extern void MR_cleanup_pred_trees(); /* MR10 */ +extern int MR_allPredLeaves(); /* MR10 */ +extern int MR_predicate_context_completed(); /* MR10 */ +extern void MR_check_pred_too_long(); /* MR10 */ +extern Tree * MR_remove_epsilon_from_tree(); /* MR10 */ +extern Tree * MR_computeTreeAND(); /* MR10 */ +extern int MR_tree_equ(); /* MR10 */ +extern set MR_First(); /* MR10 */ +extern set MR_compute_pred_set(); /* MR10 */ +extern Tree * MR_compute_pred_tree_context(); /* MR10 */ +extern int MR_pointerStackPush(); /* MR10 */ +extern void * MR_pointerStackPop(); /* MR10 */ +extern void * MR_pointerStackTop(); /* MR10 */ +extern void MR_pointerStackReset(); /* MR10 */ +extern void MR_backTraceReport(); /* MR10 */ +extern void MR_alphaBetaTraceReport(); /* MR14 */ +extern void MR_dumpRuleSet(); /* MR14 */ +extern void MR_predContextPresent(); /* MR10 */ +extern void MR_dumpPred(); /* MR10 */ +extern void MR_dumpPred1(); /* MR10 */ +extern void MR_xxxIndent(); /* MR11 */ +extern void MR_stderrIndent(); /* MR11 */ +extern void MR_outputIndent(); /* MR11 */ +extern Junction * MR_ruleReferenced(); /* MR10 */ +extern void MR_releaseResourcesUsedInRule(); /* MR10 */ +extern void MR_dumpTreeX(); /* MR10 */ +extern void MR_dumpTreeF(); /* MR10 */ +extern void DumpFcache(); /* MR10 */ +extern void MR_dumpTokenSet(); /* MR10 */ +extern void MR_traceAmbSource(); /* MR11 */ +extern Node *MR_advance(); /* MR11 */ +extern int MR_offsetFromRule(); /* MR11 */ +extern char *MR_ruleNamePlusOffset(); /* MR11 */ +extern void MR_traceAmbSourceK(); /* MR11 */ +extern void MR_traceAmbSourceKclient(); /* [i_a] added */ +extern int MR_max_height_of_tree(); /* MR11 */ +extern int MR_all_leaves_same_height(); /* MR11 */ +extern void MR_projectTreeOntoSet(); /* MR11 */ +extern Tree *MR_make_tree_from_set(); /* MR11 */ +extern Predicate *MR_removeRedundantPredPass3(); /* MR11 */ +extern void MR_pred_depth(); /* MR11 */ +extern int MR_comparePredicates(); /* MR11 */ +extern Predicate * MR_unfold(); /* MR11 */ +extern void MR_simplifyInverted(); /* MR11 */ +extern int MR_secondPredicateUnreachable(); /* MR11 */ +extern Junction * MR_nameToRuleBlk(); /* MR10 */ +extern void MR_clearPredEntry(); /* MR11 */ +extern void MR_orphanRules(); /* MR12 */ +extern void MR_merge_contexts(); /* MR12 */ +extern int ci_strequ(); /* MR12 */ +extern void MR_guardPred_plainSet(); /* MR12c */ +extern void MR_suppressSearchReport(); /* MR12c */ +extern Predicate * MR_suppressK(); /* MR13 */ +extern void MR_backTraceDumpItem(); /* MR13 */ +extern void MR_backTraceDumpItemReset(); /* MR13 */ +extern Junction * MR_junctionWithoutP2(); /* MR13 */ +extern void MR_setConstrainPointer(); /* MR18 */ +extern void BlockPreambleOption(); /* MR23 */ +extern char* getInitializer(); /* MR23 */ +extern int hasMultipleOperands(); /* MR23 */ +extern char *endFormal(); /* MR23 */ +extern char *strBetween(); /* MR23 */ +extern void DumpInitializers(); /* MR23 */ +extern int isTermEntryTokClass(); /* MR23 */ +extern int isEmptyAlt(); + +#endif + +#ifdef __USE_PROTOS +#include <stdlib.h> +#endif + +/* MR20 G. Hobbelt Create proper externs for dlg variables */ + +extern set attribsRefdFromAction; +extern int inAlt; +extern int UsedOldStyleAttrib; +extern int UsedNewStyleLabel; + +#define MAX_BLK_LEVEL 100 /* MR23 */ +extern int CurBlockID_array[MAX_BLK_LEVEL]; /* MR23 */ +extern int CurAltNum_array[MAX_BLK_LEVEL]; /* MR23 */ diff --git a/pccts/antlr/scan.c b/pccts/antlr/scan.c new file mode 100644 index 0000000..f909430 --- /dev/null +++ b/pccts/antlr/scan.c @@ -0,0 +1,5735 @@ + +/* parser.dlg -- DLG Description of scanner + * + * Generated from: antlr.g + * + * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001 + * Purdue University Electrical Engineering + * With AHPCRC, University of Minnesota + * ANTLR Version 1.33MR32 + */ + +#define ANTLR_VERSION 13332 +#include "pcctscfg.h" +#include "pccts_stdio.h" + +#include "pcctscfg.h" +#include "set.h" +#include <ctype.h> +#include "syn.h" +#include "hash.h" +#include "generic.h" +#define zzcr_attr(attr,tok,t) +#include "antlr.h" +#include "tokens.h" +#include "dlgdef.h" +LOOKAHEAD + +void +#ifdef __USE_PROTOS +zzerraction(void) +#else +zzerraction() +#endif +{ + (*zzerr)("invalid token"); + zzadvance(); + zzskip(); +} +/* + * D L G tables + * + * Generated from: parser.dlg + * + * 1989-2001 by Will Cohen, Terence Parr, and Hank Dietz + * Purdue University Electrical Engineering + * DLG Version 1.33MR32 + */ + +#include "mode.h" + + + + +/* maintained, but not used for now */ +set AST_nodes_refd_in_actions = set_init; +int inAlt = 0; +set attribsRefdFromAction = set_init; /* MR20 */ +int UsedOldStyleAttrib = 0; +int UsedNewStyleLabel = 0; +#ifdef __USE_PROTOS +char *inline_set(char *); +#else +char *inline_set(); +#endif + +/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */ +/* MR1 in DLG action */ + +int tokenActionActive=0; /* MR1 */ + + + + + +static char * +#ifdef __USE_PROTOS +getFileNameFromTheLineInfo(char *toStr, char *fromStr) +#else +getFileNameFromTheLineInfo(toStr, fromStr) +char *toStr, *fromStr; +#endif +{ + int i, j, k; + + if (!fromStr || !toStr) return toStr; + + /* find the first " */ + + for (i=0; + (i<MaxFileName) && + (fromStr[i] != '\n') && + (fromStr[i] != '\r') && + (fromStr[i] != '\"'); + i++) /* nothing */ ; + + if ( (i == MaxFileName) || + (fromStr[i] == '\n') || + (fromStr[i] == '\r') ) { + return toStr; +} + + /* find the second " */ + + for (j=i+1; +(j<MaxFileName) && +(fromStr[j] != '\n') && +(fromStr[j] != '\r') && +(fromStr[j] != '\"'); +j++) /* nothing */ ; + + if ((j == MaxFileName) || +(fromStr[j] == '\n') || +(fromStr[j] == '\r') ) { + return toStr; +} + + /* go back until the last / or \ */ + + for (k=j-1; +(fromStr[k] != '\"') && +(fromStr[k] != '/') && +(fromStr[k] != '\\'); +k--) /* nothing */ ; + + /* copy the string after " / or \ into toStr */ + + for (i=k+1; fromStr[i] != '\"'; i++) { +toStr[i-k-1] = fromStr[i]; +} + + toStr[i-k-1] = '\0'; + + return toStr; +} + +/* MR14 end of a block to support #line in antlr source code */ + + + + +#ifdef __USE_PROTOS +void mark_label_used_in_sem_pred(LabelEntry *le) /* MR10 */ +#else +void mark_label_used_in_sem_pred(le) /* MR10 */ +LabelEntry *le; +#endif +{ + TokNode *tn; + require (le->elem->ntype == nToken,"mark_label_used... ntype != nToken"); + tn=(TokNode *)le->elem; + require (tn->label != 0,"mark_label_used... TokNode has no label"); + tn->label_used_in_semantic_pred=1; +} + +static void act1() +{ + NLA = Eof; + /* L o o k F o r A n o t h e r F i l e */ + { + FILE *new_input; + new_input = NextFile(); + if ( new_input == NULL ) { NLA=Eof; return; } + fclose( input ); + input = new_input; + zzrdstream( input ); + zzskip(); /* Skip the Eof (@) char i.e continue */ + } + } + + +static void act2() +{ + NLA = 76; + zzskip(); + } + + +static void act3() +{ + NLA = 77; + zzline++; zzskip(); + } + + +static void act4() +{ + NLA = 78; + zzmode(ACTIONS); zzmore(); + istackreset(); + pushint(']'); + } + + +static void act5() +{ + NLA = 79; + action_file=CurFile; action_line=zzline; + zzmode(ACTIONS); zzmore(); + list_free(&CurActionLabels,0); /* MR10 */ + numericActionLabel=0; /* MR10 */ + istackreset(); + pushint('>'); + } + + +static void act6() +{ + NLA = 80; + zzmode(STRINGS); zzmore(); + } + + +static void act7() +{ + NLA = 81; + zzmode(COMMENTS); zzskip(); + } + + +static void act8() +{ + NLA = 82; + warn("Missing /*; found dangling */"); zzskip(); + } + + +static void act9() +{ + NLA = 83; + zzmode(CPP_COMMENTS); zzskip(); + } + + +static void act10() +{ + NLA = 84; + + zzline = atoi(zzbegexpr+5) - 1; zzline++; zzmore(); + getFileNameFromTheLineInfo(FileStr[CurFile], zzbegexpr); + } + + +static void act11() +{ + NLA = 85; + + zzline++; zzmore(); + } + + +static void act12() +{ + NLA = 86; + warn("Missing <<; found dangling >>"); zzskip(); + } + + +static void act13() +{ + NLA = WildCard; + } + + +static void act14() +{ + NLA = 88; + FoundException = 1; /* MR6 */ + FoundAtOperator = 1; + } + + +static void act15() +{ + NLA = Pragma; + } + + +static void act16() +{ + NLA = FirstSetSymbol; + } + + +static void act17() +{ + NLA = 94; + } + + +static void act18() +{ + NLA = 95; + } + + +static void act19() +{ + NLA = 96; + } + + +static void act20() +{ + NLA = 97; + } + + +static void act21() +{ + NLA = 98; + } + + +static void act22() +{ + NLA = 99; + } + + +static void act23() +{ + NLA = 102; + } + + +static void act24() +{ + NLA = 103; + } + + +static void act25() +{ + NLA = 104; + } + + +static void act26() +{ + NLA = 105; + } + + +static void act27() +{ + NLA = 106; + } + + +static void act28() +{ + NLA = 107; + } + + +static void act29() +{ + NLA = 108; + } + + +static void act30() +{ + NLA = 109; + } + + +static void act31() +{ + NLA = 110; + } + + +static void act32() +{ + NLA = 111; + } + + +static void act33() +{ + NLA = 112; + } + + +static void act34() +{ + NLA = 113; + } + + +static void act35() +{ + NLA = 114; + } + + +static void act36() +{ + NLA = 115; + } + + +static void act37() +{ + NLA = 116; + } + + +static void act38() +{ + NLA = 117; + } + + +static void act39() +{ + NLA = 118; + } + + +static void act40() +{ + NLA = 119; + } + + +static void act41() +{ + NLA = 120; + } + + +static void act42() +{ + NLA = 121; + } + + +static void act43() +{ + NLA = 122; + } + + +static void act44() +{ + NLA = 123; + } + + +static void act45() +{ + NLA = 124; + } + + +static void act46() +{ + NLA = 125; + } + + +static void act47() +{ + NLA = 126; + } + + +static void act48() +{ + NLA = 127; + } + + +static void act49() +{ + NLA = 128; + } + + +static void act50() +{ + NLA = 129; + } + + +static void act51() +{ + NLA = 130; + } + + +static void act52() +{ + NLA = 131; + } + + +static void act53() +{ + NLA = 132; + } + + +static void act54() +{ + NLA = 133; + } + + +static void act55() +{ + NLA = 134; + } + + +static void act56() +{ + NLA = 135; + } + + +static void act57() +{ + NLA = NonTerminal; + + while ( zzchar==' ' || zzchar=='\t' ) { + zzadvance(); + } + if ( zzchar == ':' && inAlt ) NLA = LABEL; + } + + +static void act58() +{ + NLA = TokenTerm; + + while ( zzchar==' ' || zzchar=='\t' ) { + zzadvance(); + } + if ( zzchar == ':' && inAlt ) NLA = LABEL; + } + + +static void act59() +{ + NLA = 136; + warn(eMsg1("unknown meta-op: %s",LATEXT(1))); zzskip(); + } + +static unsigned char shift0[257] = { + 0, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 1, 2, 58, 58, 3, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 1, 40, 6, 9, 58, 58, 45, + 58, 46, 47, 8, 52, 58, 58, 18, 7, 16, + 14, 15, 16, 16, 16, 16, 16, 16, 16, 41, + 42, 5, 48, 17, 53, 19, 56, 56, 56, 56, + 56, 26, 56, 56, 56, 56, 56, 51, 56, 56, + 56, 56, 56, 56, 29, 56, 56, 56, 56, 56, + 56, 56, 4, 20, 58, 50, 57, 58, 23, 31, + 38, 34, 13, 35, 24, 33, 11, 55, 36, 10, + 25, 12, 32, 21, 55, 22, 27, 28, 54, 55, + 55, 43, 30, 55, 39, 44, 37, 49, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58 +}; + + +static void act60() +{ + NLA = Eof; + } + + +static void act61() +{ + NLA = QuotedTerm; + zzmode(START); + } + + +static void act62() +{ + NLA = 3; + + zzline++; + warn("eoln found in string"); + zzskip(); + } + + +static void act63() +{ + NLA = 4; + zzline++; zzmore(); + } + + +static void act64() +{ + NLA = 5; + zzmore(); + } + + +static void act65() +{ + NLA = 6; + zzmore(); + } + +static unsigned char shift1[257] = { + 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 2, 5, 5, 3, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 1, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 +}; + + +static void act66() +{ + NLA = Eof; + } + + +static void act67() +{ + NLA = 7; + zzmode(ACTIONS); zzmore(); + } + + +static void act68() +{ + NLA = 8; + + zzline++; + warn("eoln found in string (in user action)"); + zzskip(); + } + + +static void act69() +{ + NLA = 9; + zzline++; zzmore(); + } + + +static void act70() +{ + NLA = 10; + zzmore(); + } + + +static void act71() +{ + NLA = 11; + zzmore(); + } + +static unsigned char shift2[257] = { + 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 2, 5, 5, 3, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 1, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 +}; + + +static void act72() +{ + NLA = Eof; + } + + +static void act73() +{ + NLA = 12; + zzmode(ACTIONS); zzmore(); + } + + +static void act74() +{ + NLA = 13; + + zzline++; + warn("eoln found in char literal (in user action)"); + zzskip(); + } + + +static void act75() +{ + NLA = 14; + zzmore(); + } + + +static void act76() +{ + NLA = 15; + zzmore(); + } + +static unsigned char shift3[257] = { + 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 2, 5, 5, 3, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 1, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 +}; + + +static void act77() +{ + NLA = Eof; + } + + +static void act78() +{ + NLA = 16; + zzmode(ACTIONS); zzmore(); + } + + +static void act79() +{ + NLA = 17; + zzmore(); + } + + +static void act80() +{ + NLA = 18; + zzline++; zzmore(); DAWDLE; + } + + +static void act81() +{ + NLA = 19; + zzmore(); + } + +static unsigned char shift4[257] = { + 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 3, 5, 5, 4, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 1, 5, 5, 5, 5, 2, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 +}; + + +static void act82() +{ + NLA = Eof; + } + + +static void act83() +{ + NLA = 20; + zzmode(PARSE_ENUM_FILE); + zzmore(); + } + + +static void act84() +{ + NLA = 21; + zzmore(); + } + + +static void act85() +{ + NLA = 22; + zzline++; zzmore(); DAWDLE; + } + + +static void act86() +{ + NLA = 23; + zzmore(); + } + +static unsigned char shift5[257] = { + 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 3, 5, 5, 4, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 1, 5, 5, 5, 5, 2, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 +}; + + +static void act87() +{ + NLA = Eof; + } + + +static void act88() +{ + NLA = 24; + zzline++; zzmode(PARSE_ENUM_FILE); zzskip(); DAWDLE; + } + + +static void act89() +{ + NLA = 25; + zzskip(); + } + +static unsigned char shift6[257] = { + 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 1, 3, 3, 2, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3 +}; + + +static void act90() +{ + NLA = Eof; + } + + +static void act91() +{ + NLA = 26; + zzline++; zzmode(ACTIONS); zzmore(); DAWDLE; + } + + +static void act92() +{ + NLA = 27; + zzmore(); + } + +static unsigned char shift7[257] = { + 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 1, 3, 3, 2, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3 +}; + + +static void act93() +{ + NLA = Eof; + } + + +static void act94() +{ + NLA = 28; + zzline++; zzmode(START); zzskip(); DAWDLE; + } + + +static void act95() +{ + NLA = 29; + zzskip(); + } + +static unsigned char shift8[257] = { + 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 1, 3, 3, 2, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, + 3, 3, 3, 3, 3, 3, 3 +}; + + +static void act96() +{ + NLA = Eof; + } + + +static void act97() +{ + NLA = 30; + zzmode(START); zzskip(); + } + + +static void act98() +{ + NLA = 31; + zzskip(); + } + + +static void act99() +{ + NLA = 32; + zzline++; zzskip(); DAWDLE; + } + + +static void act100() +{ + NLA = 33; + zzskip(); + } + +static unsigned char shift9[257] = { + 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 3, 5, 5, 4, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 1, 5, 5, 5, 5, 2, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 5, 5, 5, 5, 5, 5, 5 +}; + + +static void act101() +{ + NLA = Eof; + } + + +static void act102() +{ + NLA = Action; + /* these do not nest */ + zzmode(START); + NLATEXT[0] = ' '; + NLATEXT[1] = ' '; + zzbegexpr[0] = ' '; + zzbegexpr[1] = ' '; + if ( zzbufovf ) { + err( eMsgd("action buffer overflow; size %d",ZZLEXBUFSIZE)); + } + +/* MR1 10-Apr-97 MR1 Previously unable to put right shift operator */ + /* MR1 in DLG action */ + /* MR1 Doesn't matter what kind of action it is - reset*/ + + tokenActionActive=0; /* MR1 */ + } + + +static void act103() +{ + NLA = Pred; + /* these do not nest */ + zzmode(START); + NLATEXT[0] = ' '; + NLATEXT[1] = ' '; + zzbegexpr[0] = '\0'; + if ( zzbufovf ) { + err( eMsgd("predicate buffer overflow; size %d",ZZLEXBUFSIZE)); + }; +#ifdef __cplusplus__ + /* MR10 */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred); +#else +#ifdef __STDC__ + /* MR10 */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred); +#else +#ifdef __USE_PROTOS + /* MRxx */ list_apply(CurActionLabels, (void (*)(void *))mark_label_used_in_sem_pred); +#else + /* MR10 */ list_apply(CurActionLabels,mark_label_used_in_sem_pred); +#endif +#endif +#endif + } + + +static void act104() +{ + NLA = PassAction; + if ( topint() == ']' ) { + popint(); + if ( istackempty() ) /* terminate action */ + { + zzmode(START); + NLATEXT[0] = ' '; + zzbegexpr[0] = ' '; + if ( zzbufovf ) { + err( eMsgd("parameter buffer overflow; size %d",ZZLEXBUFSIZE)); + } + } + else { + /* terminate $[..] and #[..] */ + if ( GenCC ) zzreplstr("))"); + else zzreplstr(")"); + zzmore(); + } + } + else if ( topint() == '|' ) { /* end of simple [...] */ + popint(); + zzmore(); + } + else zzmore(); + } + + +static void act105() +{ + NLA = 37; + + zzmore(); + zzreplstr(inline_set(zzbegexpr+ + strlen("consumeUntil("))); + } + + +static void act106() +{ + NLA = 38; + zzmore(); + } + + +static void act107() +{ + NLA = 39; + zzline++; zzmore(); DAWDLE; + } + + +static void act108() +{ + NLA = 40; + zzmore(); + } + + +static void act109() +{ + NLA = 41; + zzmore(); + } + + +static void act110() +{ + NLA = 42; + if ( !GenCC ) {zzreplstr("zzaRet"); zzmore();} + else err("$$ use invalid in C++ mode"); + } + + +static void act111() +{ + NLA = 43; + if ( !GenCC ) {zzreplstr("zzempty_attr"); zzmore();} + else err("$[] use invalid in C++ mode"); + } + + +static void act112() +{ + NLA = 44; + + pushint(']'); + if ( !GenCC ) zzreplstr("zzconstr_attr("); + else err("$[..] use invalid in C++ mode"); + zzmore(); + } + + +static void act113() +{ + NLA = 45; + { + static char buf[100]; + numericActionLabel=1; /* MR10 */ + if ( strlen(zzbegexpr)>(size_t)85 ) + fatal("$i attrib ref too big"); + set_orel(atoi(zzbegexpr+1), &attribsRefdFromAction); + if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%d,%s)", + BlkLevel-1,zzbegexpr+1); + else sprintf(buf,"_t%d%s", + BlkLevel-1,zzbegexpr+1); + zzreplstr(buf); + zzmore(); + UsedOldStyleAttrib = 1; + if ( UsedNewStyleLabel ) + err("cannot mix old-style $i with new-style labels"); + } + } + + +static void act114() +{ + NLA = 46; + { + static char buf[100]; + numericActionLabel=1; /* MR10 */ + if ( strlen(zzbegexpr)>(size_t)85 ) + fatal("$i.field attrib ref too big"); + zzbegexpr[strlen(zzbegexpr)-1] = ' '; + set_orel(atoi(zzbegexpr+1), &attribsRefdFromAction); + if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%d,%s).", + BlkLevel-1,zzbegexpr+1); + else sprintf(buf,"_t%d%s.", + BlkLevel-1,zzbegexpr+1); + zzreplstr(buf); + zzmore(); + UsedOldStyleAttrib = 1; + if ( UsedNewStyleLabel ) + err("cannot mix old-style $i with new-style labels"); + } + } + + +static void act115() +{ + NLA = 47; + { + static char buf[100]; + static char i[20], j[20]; + char *p,*q; + numericActionLabel=1; /* MR10 */ + if (strlen(zzbegexpr)>(size_t)85) fatal("$i.j attrib ref too big"); + for (p=zzbegexpr+1,q= &i[0]; *p!='.'; p++) { + if ( q == &i[20] ) + fatalFL("i of $i.j attrib ref too big", + FileStr[CurFile], zzline ); + *q++ = *p; + } + *q = '\0'; + for (p++, q= &j[0]; *p!='\0'; p++) { + if ( q == &j[20] ) + fatalFL("j of $i.j attrib ref too big", + FileStr[CurFile], zzline ); + *q++ = *p; + } + *q = '\0'; + if ( !GenCC ) sprintf(buf,"zzaArg(zztasp%s,%s)",i,j); + else sprintf(buf,"_t%s%s",i,j); + zzreplstr(buf); + zzmore(); + UsedOldStyleAttrib = 1; + if ( UsedNewStyleLabel ) + err("cannot mix old-style $i with new-style labels"); + } + } + + +static void act116() +{ + NLA = 48; + { static char buf[300]; LabelEntry *el; + zzbegexpr[0] = ' '; + if ( CurRule != NULL && + strcmp(CurRule, &zzbegexpr[1])==0 ) { + if ( !GenCC ) zzreplstr("zzaRet"); + } + else if ( CurRetDef != NULL && + strmember(CurRetDef, &zzbegexpr[1])) { + if ( hasMultipleOperands( CurRetDef ) ) { + require (strlen(zzbegexpr)<=(size_t)285, + "$retval attrib ref too big"); + sprintf(buf,"_retv.%s",&zzbegexpr[1]); + zzreplstr(buf); + } + else zzreplstr("_retv"); + } + else if ( CurParmDef != NULL && + strmember(CurParmDef, &zzbegexpr[1])) { + ; + } + else if ( Elabel==NULL ) { + { err("$-variables in actions outside of rules are not allowed"); } + } else if ( (el=(LabelEntry *)hash_get(Elabel, &zzbegexpr[1]))!=NULL ) { + /* MR10 */ + /* MR10 */ /* element labels might exist without an elem when */ + /* MR10 */ /* it is a forward reference (to a rule) */ + /* MR10 */ + /* MR10 */ if ( GenCC && (el->elem == NULL || el->elem->ntype==nRuleRef) ) + /* MR10 */ { err(eMsg1("There are no token ptrs for rule references: '$%s'",&zzbegexpr[1])); } + /* MR10 */ + /* MR10 */ if ( !GenCC && (el->elem == NULL || el->elem->ntype==nRuleRef) && GenAST) { + /* MR10 */ err("You can no longer use attributes returned by rules when also using ASTs"); + /* MR10 */ err(" Use upward inheritance (\"rule >[Attrib a] : ... <<$a=...>>\")"); + /* MR10 */ }; + /* MR10 */ + /* MR10 */ /* keep track of <<... $label ...>> for semantic predicates in guess mode */ + /* MR10 */ /* element labels contain pointer to the owners node */ + /* MR10 */ + /* MR10 */ if (el->elem != NULL && el->elem->ntype == nToken) { + /* MR10 */ list_add(&CurActionLabels,el); + /* MR10 */ }; +} +else +warn(eMsg1("$%s not parameter, return value, (defined) element label",&zzbegexpr[1])); +} +zzmore(); + } + + +static void act117() +{ + NLA = 49; + zzreplstr("(*_root)"); zzmore(); chkGTFlag(); + } + + +static void act118() +{ + NLA = 50; + if ( GenCC ) { + if (NewAST) zzreplstr("(newAST)"); + else zzreplstr("(new AST)");} + else {zzreplstr("zzastnew()");} zzmore(); + chkGTFlag(); + } + + +static void act119() +{ + NLA = 51; + zzreplstr("NULL"); zzmore(); chkGTFlag(); + } + + +static void act120() +{ + NLA = 52; + { + static char buf[100]; + if ( strlen(zzbegexpr)>(size_t)85 ) + fatal("#i AST ref too big"); + if ( GenCC ) sprintf(buf,"_ast%d%s",BlkLevel-1,zzbegexpr+1); + else sprintf(buf,"zzastArg(%s)",zzbegexpr+1); + zzreplstr(buf); + zzmore(); + set_orel(atoi(zzbegexpr+1), &AST_nodes_refd_in_actions); + chkGTFlag(); + } + } + + +static void act121() +{ + NLA = 53; + + zzline = atoi(zzbegexpr+5) - 1; zzline++; zzmore(); + getFileNameFromTheLineInfo(FileStr[CurFile], zzbegexpr); + } + + +static void act122() +{ + NLA = 54; + + zzline++; zzmore(); + } + + +static void act123() +{ + NLA = 55; + + if ( !(strcmp(zzbegexpr, "#ifdef")==0 || + strcmp(zzbegexpr, "#if")==0 || + strcmp(zzbegexpr, "#else")==0 || + strcmp(zzbegexpr, "#endif")==0 || + strcmp(zzbegexpr, "#ifndef")==0 || + strcmp(zzbegexpr, "#define")==0 || + strcmp(zzbegexpr, "#pragma")==0 || + strcmp(zzbegexpr, "#undef")==0 || + strcmp(zzbegexpr, "#import")==0 || + strcmp(zzbegexpr, "#line")==0 || + strcmp(zzbegexpr, "#include")==0 || + strcmp(zzbegexpr, "#error")==0) ) + { + static char buf[100]; + sprintf(buf, "%s_ast", zzbegexpr+1); + /* MR27 */ list_add(&CurAstLabelsInActions, mystrdup(zzbegexpr+1)); + zzreplstr(buf); + chkGTFlag(); + } + zzmore(); + } + + +static void act124() +{ + NLA = 56; + + pushint(']'); + if ( GenCC ) { + if (NewAST) zzreplstr("(newAST("); + else zzreplstr("(new AST("); } + else zzreplstr("zzmk_ast(zzastnew(),"); + zzmore(); + chkGTFlag(); + } + + +static void act125() +{ + NLA = 57; + + pushint('}'); + if ( GenCC ) { + if (tmakeInParser) { + zzreplstr("tmake("); + } + else { + zzreplstr("ASTBase::tmake("); + } + } + else { + zzreplstr("zztmake("); + } + zzmore(); + chkGTFlag(); + } + + +static void act126() +{ + NLA = 58; + zzmore(); + } + + +static void act127() +{ + NLA = 59; + + if ( istackempty() ) + zzmore(); + else if ( topint()==')' ) { + popint(); + } + else if ( topint()=='}' ) { + popint(); + /* terminate #(..) */ + zzreplstr(", NULL)"); + } + zzmore(); + } + + +static void act128() +{ + NLA = 60; + + pushint('|'); /* look for '|' to terminate simple [...] */ + zzmore(); + } + + +static void act129() +{ + NLA = 61; + + pushint(')'); + zzmore(); + } + + +static void act130() +{ + NLA = 62; + zzreplstr("]"); zzmore(); + } + + +static void act131() +{ + NLA = 63; + zzreplstr(")"); zzmore(); + } + + +static void act132() +{ + NLA = 64; + if (! tokenActionActive) zzreplstr(">"); /* MR1 */ + zzmore(); /* MR1 */ + } + + +static void act133() +{ + NLA = 65; + zzmode(ACTION_CHARS); zzmore(); + } + + +static void act134() +{ + NLA = 66; + zzmode(ACTION_STRINGS); zzmore(); + } + + +static void act135() +{ + NLA = 67; + zzreplstr("$"); zzmore(); + } + + +static void act136() +{ + NLA = 68; + zzreplstr("#"); zzmore(); + } + + +static void act137() +{ + NLA = 69; + zzline++; zzmore(); + } + + +static void act138() +{ + NLA = 70; + zzmore(); + } + + +static void act139() +{ + NLA = 71; + zzmore(); + } + + +static void act140() +{ + NLA = 72; + zzmode(ACTION_COMMENTS); zzmore(); + } + + +static void act141() +{ + NLA = 73; + warn("Missing /*; found dangling */ in action"); zzmore(); + } + + +static void act142() +{ + NLA = 74; + zzmode(ACTION_CPP_COMMENTS); zzmore(); + } + + +static void act143() +{ + NLA = 75; + zzmore(); + } + +static unsigned char shift10[257] = { + 0, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 16, 19, 33, 33, 20, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 16, 33, 28, 27, 21, 33, 33, + 30, 15, 18, 32, 33, 33, 33, 25, 31, 23, + 24, 24, 24, 24, 24, 24, 24, 24, 24, 33, + 33, 33, 33, 1, 2, 33, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 11, 26, 26, 26, + 26, 26, 22, 29, 3, 33, 26, 33, 26, 26, + 4, 26, 10, 26, 26, 26, 13, 26, 26, 14, + 9, 6, 5, 26, 26, 26, 7, 12, 8, 26, + 26, 26, 26, 26, 17, 33, 34, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33 +}; + + +static void act144() +{ + NLA = Eof; + ; + } + + +static void act145() +{ + NLA = 137; + zzskip(); + } + + +static void act146() +{ + NLA = 138; + zzline++; zzskip(); + } + + +static void act147() +{ + NLA = 139; + zzmode(TOK_DEF_CPP_COMMENTS); zzmore(); + } + + +static void act148() +{ + NLA = 140; + zzmode(TOK_DEF_COMMENTS); zzskip(); + } + + +static void act149() +{ + NLA = 141; + zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); + } + + +static void act150() +{ + NLA = 142; + zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); + } + + +static void act151() +{ + NLA = 143; + ; + } + + +static void act152() +{ + NLA = 144; + zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); + } + + +static void act153() +{ + NLA = 145; + zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); + } + + +static void act154() +{ + NLA = 146; + zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); + } + + +static void act155() +{ + NLA = 147; + zzmode(TOK_DEF_CPP_COMMENTS); zzskip(); + } + + +static void act156() +{ + NLA = 149; + } + + +static void act157() +{ + NLA = 151; + } + + +static void act158() +{ + NLA = 152; + } + + +static void act159() +{ + NLA = 153; + } + + +static void act160() +{ + NLA = 154; + } + + +static void act161() +{ + NLA = 155; + } + + +static void act162() +{ + NLA = 156; + } + + +static void act163() +{ + NLA = INT; + } + + +static void act164() +{ + NLA = ID; + } + +static unsigned char shift11[257] = { + 0, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 1, 2, 27, 27, 3, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 1, 27, 27, 6, 27, 27, 27, + 27, 27, 27, 5, 27, 22, 27, 27, 4, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 27, + 24, 27, 21, 27, 27, 27, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, + 26, 26, 27, 27, 27, 27, 26, 27, 26, 26, + 26, 9, 10, 8, 26, 26, 7, 26, 26, 12, + 15, 11, 17, 16, 26, 18, 13, 19, 14, 26, + 26, 26, 26, 26, 20, 27, 23, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, + 27, 27, 27, 27, 27, 27, 27 +}; + +#define DfaStates 436 +typedef unsigned short DfaState; + +static DfaState st0[60] = { + 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, + 11, 11, 11, 12, 13, 13, 13, 14, 15, 16, + 17, 11, 11, 18, 11, 11, 19, 11, 11, 19, + 11, 11, 11, 11, 20, 11, 11, 21, 22, 23, + 24, 25, 26, 11, 27, 28, 29, 30, 31, 32, + 33, 34, 35, 36, 11, 11, 19, 436, 436, 436 +}; + +static DfaState st1[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st2[60] = { + 436, 2, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st3[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st4[60] = { + 436, 436, 37, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st5[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st6[60] = { + 436, 436, 436, 436, 436, 38, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st7[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st8[60] = { + 436, 436, 436, 436, 436, 436, 436, 39, 40, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st9[60] = { + 436, 436, 436, 436, 436, 436, 436, 41, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st10[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 42, 43, 43, 44, 43, 43, 43, 436, 436, 436, + 436, 45, 43, 43, 43, 43, 46, 43, 47, 43, + 43, 43, 43, 48, 43, 49, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st11[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st12[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 51, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st13[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 13, 13, 13, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st14[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 52, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st15[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 53, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st16[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st17[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 54, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st18[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 55, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st19[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 56, 56, 56, 56, 56, 56, 56, 436, 436, 436, + 436, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 436, 56, 436, + 436, 436, 436, 56, 436, 436, 436, 436, 436, 436, + 436, 56, 436, 436, 56, 56, 56, 56, 436, 436 +}; + +static DfaState st20[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 57, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st21[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st22[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 58, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 59, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st23[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st24[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st25[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st26[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st27[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 60, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st28[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 61, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st29[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st30[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st31[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 62, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st32[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st33[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st34[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 56, 56, 56, 56, 56, 56, 56, 436, 436, 436, + 436, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 436, 56, 436, + 436, 436, 436, 56, 436, 436, 436, 436, 436, 436, + 436, 63, 436, 436, 56, 56, 56, 56, 436, 436 +}; + +static DfaState st35[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st36[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st37[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st38[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st39[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st40[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st41[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st42[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 64, 43, 65, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st43[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st44[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 66, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st45[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 67, 68, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st46[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 69, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st47[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 70, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st48[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 71, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st49[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 72, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st50[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st51[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 73, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st52[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st53[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st54[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 74, 43, 43, 44, 43, 43, 43, 436, 436, 436, + 436, 45, 43, 43, 43, 43, 46, 43, 47, 43, + 43, 43, 43, 48, 43, 49, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st55[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 75, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st56[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 56, 56, 56, 56, 56, 56, 56, 436, 436, 436, + 436, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 436, 56, 436, + 436, 436, 436, 56, 436, 436, 436, 436, 436, 436, + 436, 56, 436, 436, 56, 56, 56, 56, 436, 436 +}; + +static DfaState st57[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 76, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st58[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 77, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st59[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 78, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st60[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st61[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st62[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st63[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 56, 56, 56, 56, 56, 56, 56, 436, 436, 436, + 436, 56, 56, 56, 56, 56, 56, 56, 56, 56, + 56, 56, 56, 56, 56, 56, 56, 436, 56, 436, + 436, 436, 436, 56, 436, 436, 79, 436, 436, 436, + 436, 56, 436, 436, 56, 56, 56, 56, 436, 436 +}; + +static DfaState st64[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 80, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st65[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 81, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st66[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 82, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st67[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 83, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 84, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st68[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 85, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st69[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 86, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st70[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 87, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st71[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 88, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st72[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 89, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st73[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 90, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st74[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 65, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st75[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 91, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st76[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 92, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st77[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 93, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st78[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 94, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st79[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 95, 96, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st80[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 97, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st81[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 98, 43, 99, 43, 100, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 101, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st82[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 102, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st83[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 103, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st84[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 104, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st85[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 105, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st86[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 106, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st87[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 107, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 108, 43, 43, 436, 109, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st88[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 110, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st89[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 111, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st90[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 112, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st91[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 113, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st92[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 114, 50, 50, 50, 436, 436 +}; + +static DfaState st93[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 115, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st94[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 116, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st95[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 117, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st96[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 118, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st97[60] = { + 436, 119, 120, 121, 122, 122, 122, 122, 122, 122, + 123, 123, 123, 123, 124, 124, 124, 122, 122, 122, + 122, 123, 123, 123, 123, 123, 123, 123, 123, 123, + 123, 123, 123, 123, 123, 123, 123, 122, 123, 122, + 122, 122, 122, 123, 122, 122, 122, 122, 122, 122, + 122, 123, 122, 122, 123, 123, 123, 123, 122, 436 +}; + +static DfaState st98[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 125, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st99[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 126, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st100[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 127, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st101[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 128, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st102[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 129, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st103[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st104[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 130, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st105[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 131, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st106[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 132, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st107[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 133, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st108[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 134, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st109[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 135, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st110[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 136, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st111[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 137, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st112[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 138, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st113[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 139, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st114[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 140, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st115[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st116[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st117[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st118[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st119[60] = { + 436, 119, 120, 121, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 141, 141, 141, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 436 +}; + +static DfaState st120[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st121[60] = { + 436, 436, 142, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st122[60] = { + 436, 122, 120, 121, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 436 +}; + +static DfaState st123[60] = { + 436, 122, 120, 121, 122, 122, 122, 122, 122, 122, + 123, 123, 123, 123, 123, 123, 123, 122, 122, 122, + 122, 123, 123, 123, 123, 123, 123, 123, 123, 123, + 123, 123, 123, 123, 123, 123, 123, 122, 123, 122, + 122, 122, 122, 123, 122, 122, 122, 122, 122, 122, + 122, 123, 122, 122, 123, 123, 123, 123, 122, 436 +}; + +static DfaState st124[60] = { + 436, 143, 144, 145, 122, 122, 146, 122, 122, 122, + 123, 123, 123, 123, 124, 124, 124, 122, 122, 122, + 122, 123, 123, 123, 123, 123, 123, 123, 123, 123, + 123, 123, 123, 123, 123, 123, 123, 122, 123, 122, + 122, 122, 122, 123, 122, 122, 122, 122, 122, 122, + 122, 123, 122, 122, 123, 123, 123, 123, 122, 436 +}; + +static DfaState st125[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 147, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st126[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 148, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st127[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 149, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st128[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 150, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st129[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 151, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st130[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 152, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st131[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 153, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st132[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 154, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st133[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st134[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 155, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st135[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 156, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st136[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 157, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st137[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st138[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 158, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st139[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st140[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 159, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st141[60] = { + 436, 143, 144, 145, 122, 122, 146, 122, 122, 122, + 122, 122, 122, 122, 141, 141, 141, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 436 +}; + +static DfaState st142[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st143[60] = { + 436, 143, 120, 121, 122, 122, 146, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 436 +}; + +static DfaState st144[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st145[60] = { + 436, 436, 160, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st146[60] = { + 436, 161, 162, 163, 161, 161, 122, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, 161, 436 +}; + +static DfaState st147[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 164, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st148[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 165, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st149[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 166, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st150[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 167, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st151[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 168, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st152[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st153[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st154[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 169, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st155[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 170, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st156[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 171, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st157[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st158[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 172, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st159[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st160[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st161[60] = { + 436, 161, 162, 163, 161, 161, 173, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, + 161, 161, 161, 161, 161, 161, 161, 161, 161, 436 +}; + +static DfaState st162[60] = { + 436, 174, 174, 174, 174, 174, 175, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 436 +}; + +static DfaState st163[60] = { + 436, 174, 176, 174, 174, 174, 175, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 436 +}; + +static DfaState st164[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 177, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st165[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 178, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st166[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 179, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st167[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 180, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st168[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 181, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st169[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 182, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st170[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st171[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 183, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st172[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 184, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st173[60] = { + 436, 185, 144, 145, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 186, 186, 186, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 436 +}; + +static DfaState st174[60] = { + 436, 174, 174, 174, 174, 174, 175, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 436 +}; + +static DfaState st175[60] = { + 436, 187, 188, 189, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 190, 190, 190, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st176[60] = { + 436, 174, 174, 174, 174, 174, 175, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 174, + 174, 174, 174, 174, 174, 174, 174, 174, 174, 436 +}; + +static DfaState st177[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 191, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st178[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 192, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st179[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 193, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st180[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st181[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st182[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 194, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st183[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st184[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 50, 50, 50, 50, 50, 50, 50, 436, 436, 436, + 436, 50, 50, 50, 50, 50, 50, 50, 50, 50, + 50, 50, 50, 50, 50, 50, 50, 436, 50, 436, + 436, 436, 436, 50, 436, 436, 436, 436, 436, 436, + 436, 50, 436, 436, 50, 50, 50, 50, 436, 436 +}; + +static DfaState st185[60] = { + 436, 185, 144, 145, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 186, 186, 186, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 436 +}; + +static DfaState st186[60] = { + 436, 185, 144, 145, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 186, 186, 186, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 436 +}; + +static DfaState st187[60] = { + 436, 187, 188, 189, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 190, 190, 190, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st188[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st189[60] = { + 436, 436, 195, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st190[60] = { + 436, 187, 188, 189, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 190, 190, 190, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st191[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st192[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st193[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st194[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 196, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st195[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st196[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 197, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st197[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 198, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st198[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 199, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st199[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 200, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st200[60] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 43, 43, 43, 43, 43, 43, 43, 436, 436, 436, + 436, 43, 43, 43, 43, 43, 43, 43, 43, 43, + 43, 43, 43, 43, 43, 43, 43, 436, 43, 436, + 436, 436, 436, 43, 436, 436, 436, 436, 436, 436, + 436, 43, 436, 436, 43, 43, 43, 43, 436, 436 +}; + +static DfaState st201[7] = { + 202, 203, 204, 205, 206, 207, 436 +}; + +static DfaState st202[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st203[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st204[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st205[7] = { + 436, 436, 208, 436, 436, 436, 436 +}; + +static DfaState st206[7] = { + 436, 209, 210, 211, 209, 209, 436 +}; + +static DfaState st207[7] = { + 436, 436, 436, 436, 436, 207, 436 +}; + +static DfaState st208[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st209[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st210[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st211[7] = { + 436, 436, 212, 436, 436, 436, 436 +}; + +static DfaState st212[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st213[7] = { + 214, 215, 216, 217, 218, 219, 436 +}; + +static DfaState st214[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st215[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st216[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st217[7] = { + 436, 436, 220, 436, 436, 436, 436 +}; + +static DfaState st218[7] = { + 436, 221, 222, 223, 221, 221, 436 +}; + +static DfaState st219[7] = { + 436, 436, 436, 436, 436, 219, 436 +}; + +static DfaState st220[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st221[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st222[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st223[7] = { + 436, 436, 224, 436, 436, 436, 436 +}; + +static DfaState st224[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st225[7] = { + 226, 227, 228, 229, 230, 231, 436 +}; + +static DfaState st226[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st227[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st228[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st229[7] = { + 436, 436, 232, 436, 436, 436, 436 +}; + +static DfaState st230[7] = { + 436, 233, 233, 233, 233, 233, 436 +}; + +static DfaState st231[7] = { + 436, 436, 436, 436, 436, 231, 436 +}; + +static DfaState st232[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st233[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st234[7] = { + 235, 236, 237, 238, 239, 237, 436 +}; + +static DfaState st235[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st236[7] = { + 436, 436, 240, 436, 436, 436, 436 +}; + +static DfaState st237[7] = { + 436, 436, 237, 436, 436, 237, 436 +}; + +static DfaState st238[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st239[7] = { + 436, 436, 436, 241, 436, 436, 436 +}; + +static DfaState st240[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st241[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st242[7] = { + 243, 244, 245, 246, 247, 245, 436 +}; + +static DfaState st243[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st244[7] = { + 436, 436, 248, 436, 436, 436, 436 +}; + +static DfaState st245[7] = { + 436, 436, 245, 436, 436, 245, 436 +}; + +static DfaState st246[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st247[7] = { + 436, 436, 436, 249, 436, 436, 436 +}; + +static DfaState st248[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st249[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st250[5] = { + 251, 252, 253, 254, 436 +}; + +static DfaState st251[5] = { + 436, 436, 436, 436, 436 +}; + +static DfaState st252[5] = { + 436, 436, 436, 436, 436 +}; + +static DfaState st253[5] = { + 436, 255, 436, 436, 436 +}; + +static DfaState st254[5] = { + 436, 436, 436, 254, 436 +}; + +static DfaState st255[5] = { + 436, 436, 436, 436, 436 +}; + +static DfaState st256[5] = { + 257, 258, 259, 260, 436 +}; + +static DfaState st257[5] = { + 436, 436, 436, 436, 436 +}; + +static DfaState st258[5] = { + 436, 436, 436, 436, 436 +}; + +static DfaState st259[5] = { + 436, 261, 436, 436, 436 +}; + +static DfaState st260[5] = { + 436, 436, 436, 260, 436 +}; + +static DfaState st261[5] = { + 436, 436, 436, 436, 436 +}; + +static DfaState st262[5] = { + 263, 264, 265, 266, 436 +}; + +static DfaState st263[5] = { + 436, 436, 436, 436, 436 +}; + +static DfaState st264[5] = { + 436, 436, 436, 436, 436 +}; + +static DfaState st265[5] = { + 436, 267, 436, 436, 436 +}; + +static DfaState st266[5] = { + 436, 436, 436, 266, 436 +}; + +static DfaState st267[5] = { + 436, 436, 436, 436, 436 +}; + +static DfaState st268[7] = { + 269, 270, 271, 272, 273, 271, 436 +}; + +static DfaState st269[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st270[7] = { + 436, 436, 274, 436, 436, 436, 436 +}; + +static DfaState st271[7] = { + 436, 436, 271, 436, 436, 271, 436 +}; + +static DfaState st272[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st273[7] = { + 436, 436, 436, 275, 436, 436, 436 +}; + +static DfaState st274[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st275[7] = { + 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st276[36] = { + 277, 278, 279, 280, 281, 279, 279, 279, 279, 279, + 279, 279, 279, 279, 279, 282, 279, 279, 283, 284, + 285, 286, 287, 279, 279, 279, 279, 288, 289, 290, + 291, 292, 293, 279, 279, 436 +}; + +static DfaState st277[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st278[36] = { + 436, 294, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st279[36] = { + 436, 436, 279, 436, 279, 279, 279, 279, 279, 279, + 279, 279, 279, 279, 279, 436, 279, 279, 436, 436, + 436, 436, 436, 279, 279, 279, 279, 436, 436, 436, + 436, 436, 279, 279, 279, 436 +}; + +static DfaState st280[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st281[36] = { + 436, 436, 279, 436, 279, 295, 279, 279, 279, 279, + 279, 279, 279, 279, 279, 436, 279, 279, 436, 436, + 436, 436, 436, 279, 279, 279, 279, 436, 436, 436, + 436, 436, 279, 279, 279, 436 +}; + +static DfaState st282[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st283[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st284[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st285[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 296, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st286[36] = { + 436, 436, 436, 436, 297, 297, 297, 297, 297, 297, + 297, 297, 297, 297, 297, 436, 436, 436, 436, 436, + 436, 298, 299, 300, 300, 436, 297, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st287[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st288[36] = { + 436, 436, 436, 436, 301, 301, 301, 301, 301, 301, + 301, 301, 301, 301, 302, 303, 436, 436, 436, 436, + 436, 436, 304, 305, 306, 436, 301, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st289[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st290[36] = { + 436, 307, 308, 309, 308, 308, 308, 308, 308, 308, + 308, 308, 308, 308, 308, 308, 308, 308, 310, 311, + 312, 313, 308, 308, 308, 308, 308, 314, 308, 308, + 308, 308, 308, 308, 308, 436 +}; + +static DfaState st291[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st292[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 315, 316, 436, 436, 436 +}; + +static DfaState st293[36] = { + 436, 436, 279, 436, 279, 279, 279, 279, 279, 279, + 279, 279, 279, 279, 279, 436, 279, 279, 436, 436, + 436, 436, 436, 279, 279, 279, 279, 436, 436, 436, + 436, 317, 279, 279, 279, 436 +}; + +static DfaState st294[36] = { + 436, 436, 318, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st295[36] = { + 436, 436, 279, 436, 279, 279, 319, 279, 279, 279, + 279, 279, 279, 279, 279, 436, 279, 279, 436, 436, + 436, 436, 436, 279, 279, 279, 279, 436, 436, 436, + 436, 436, 279, 279, 279, 436 +}; + +static DfaState st296[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st297[36] = { + 436, 436, 436, 436, 320, 320, 320, 320, 320, 320, + 320, 320, 320, 320, 320, 436, 436, 436, 436, 436, + 436, 436, 436, 320, 320, 436, 320, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st298[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st299[36] = { + 436, 436, 436, 321, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st300[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 300, 300, 322, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st301[36] = { + 436, 436, 436, 436, 323, 323, 323, 323, 323, 323, + 323, 323, 323, 323, 323, 436, 436, 436, 436, 436, + 436, 436, 436, 323, 323, 436, 323, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st302[36] = { + 436, 436, 436, 436, 323, 323, 323, 323, 323, 323, + 323, 323, 323, 324, 323, 436, 436, 436, 436, 436, + 436, 436, 436, 323, 323, 436, 323, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st303[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 325, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st304[36] = { + 436, 436, 436, 326, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st305[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 306, 306, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st306[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 306, 306, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st307[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st308[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st309[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st310[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st311[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st312[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 327, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st313[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st314[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st315[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st316[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st317[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st318[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st319[36] = { + 436, 436, 279, 436, 279, 279, 279, 328, 279, 279, + 279, 279, 279, 279, 279, 436, 279, 279, 436, 436, + 436, 436, 436, 279, 279, 279, 279, 436, 436, 436, + 436, 436, 279, 279, 279, 436 +}; + +static DfaState st320[36] = { + 436, 436, 436, 436, 320, 320, 320, 320, 320, 320, + 320, 320, 320, 320, 320, 436, 436, 436, 436, 436, + 436, 436, 436, 320, 320, 436, 320, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st321[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st322[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 329, 329, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st323[36] = { + 436, 436, 436, 436, 323, 323, 323, 323, 323, 323, + 323, 323, 323, 323, 323, 436, 436, 436, 436, 436, + 436, 436, 436, 323, 323, 436, 323, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st324[36] = { + 436, 436, 436, 436, 323, 323, 330, 323, 323, 323, + 323, 323, 323, 323, 323, 436, 436, 436, 436, 436, + 436, 436, 436, 323, 323, 436, 323, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st325[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st326[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st327[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st328[36] = { + 436, 436, 279, 436, 279, 279, 279, 279, 331, 279, + 279, 279, 279, 279, 279, 436, 279, 279, 436, 436, + 436, 436, 436, 279, 279, 279, 279, 436, 436, 436, + 436, 436, 279, 279, 279, 436 +}; + +static DfaState st329[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 329, 329, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st330[36] = { + 436, 436, 436, 436, 323, 323, 323, 323, 323, 323, + 332, 323, 323, 323, 323, 436, 436, 436, 436, 436, + 436, 436, 436, 323, 323, 436, 323, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st331[36] = { + 436, 436, 279, 436, 279, 279, 279, 279, 279, 333, + 279, 279, 279, 279, 279, 436, 279, 279, 436, 436, + 436, 436, 436, 279, 279, 279, 279, 436, 436, 436, + 436, 436, 279, 279, 279, 436 +}; + +static DfaState st332[36] = { + 436, 334, 334, 334, 335, 335, 335, 335, 335, 335, + 335, 335, 335, 335, 335, 334, 336, 334, 334, 337, + 338, 334, 334, 339, 339, 334, 335, 334, 334, 334, + 334, 334, 334, 334, 334, 436 +}; + +static DfaState st333[36] = { + 436, 436, 279, 436, 279, 279, 279, 279, 279, 279, + 340, 279, 279, 279, 279, 436, 279, 279, 436, 436, + 436, 436, 436, 279, 279, 279, 279, 436, 436, 436, + 436, 436, 279, 279, 279, 436 +}; + +static DfaState st334[36] = { + 436, 334, 334, 334, 334, 334, 334, 334, 334, 334, + 334, 334, 334, 334, 334, 334, 334, 334, 334, 337, + 338, 334, 334, 334, 334, 334, 334, 334, 334, 334, + 334, 334, 334, 334, 334, 436 +}; + +static DfaState st335[36] = { + 436, 334, 334, 334, 335, 335, 335, 335, 335, 335, + 335, 335, 335, 335, 335, 334, 334, 334, 334, 337, + 338, 334, 334, 335, 335, 334, 335, 334, 334, 334, + 334, 334, 334, 334, 334, 436 +}; + +static DfaState st336[36] = { + 436, 334, 334, 334, 334, 334, 334, 334, 334, 334, + 334, 334, 334, 334, 334, 334, 336, 334, 334, 337, + 338, 334, 334, 341, 341, 334, 334, 334, 334, 334, + 334, 334, 334, 334, 334, 436 +}; + +static DfaState st337[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st338[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 342, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st339[36] = { + 436, 334, 334, 334, 335, 335, 335, 335, 335, 335, + 335, 335, 335, 335, 335, 334, 343, 334, 334, 344, + 345, 334, 334, 339, 339, 334, 335, 334, 346, 334, + 334, 334, 334, 334, 334, 436 +}; + +static DfaState st340[36] = { + 436, 436, 279, 436, 279, 279, 279, 279, 279, 279, + 279, 347, 279, 279, 279, 436, 279, 279, 436, 436, + 436, 436, 436, 279, 279, 279, 279, 436, 436, 436, + 436, 436, 279, 279, 279, 436 +}; + +static DfaState st341[36] = { + 436, 334, 334, 334, 334, 334, 334, 334, 334, 334, + 334, 334, 334, 334, 334, 334, 343, 334, 334, 344, + 345, 334, 334, 341, 341, 334, 334, 334, 346, 334, + 334, 334, 334, 334, 334, 436 +}; + +static DfaState st342[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st343[36] = { + 436, 334, 334, 334, 334, 334, 334, 334, 334, 334, + 334, 334, 334, 334, 334, 334, 343, 334, 334, 337, + 338, 334, 334, 334, 334, 334, 334, 334, 346, 334, + 334, 334, 334, 334, 334, 436 +}; + +static DfaState st344[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st345[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 348, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st346[36] = { + 436, 349, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 350, + 351, 349, 349, 349, 349, 349, 349, 349, 334, 349, + 349, 349, 349, 349, 349, 436 +}; + +static DfaState st347[36] = { + 436, 436, 279, 436, 279, 279, 352, 279, 279, 279, + 279, 279, 279, 279, 279, 436, 279, 279, 436, 436, + 436, 436, 436, 279, 279, 279, 279, 436, 436, 436, + 436, 436, 279, 279, 279, 436 +}; + +static DfaState st348[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st349[36] = { + 436, 349, 349, 349, 349, 349, 349, 349, 349, 349, + 349, 349, 349, 349, 349, 349, 349, 349, 349, 350, + 351, 349, 349, 349, 349, 349, 349, 349, 353, 349, + 349, 349, 349, 349, 349, 436 +}; + +static DfaState st350[36] = { + 436, 354, 354, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354, 355, 354, + 354, 354, 354, 354, 354, 436 +}; + +static DfaState st351[36] = { + 436, 354, 354, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354, 354, 356, + 354, 354, 354, 354, 354, 354, 354, 354, 355, 354, + 354, 354, 354, 354, 354, 436 +}; + +static DfaState st352[36] = { + 436, 436, 279, 436, 279, 279, 279, 279, 279, 279, + 279, 279, 357, 279, 279, 436, 279, 279, 436, 436, + 436, 436, 436, 279, 279, 279, 279, 436, 436, 436, + 436, 436, 279, 279, 279, 436 +}; + +static DfaState st353[36] = { + 436, 334, 334, 334, 334, 334, 334, 334, 334, 334, + 334, 334, 334, 334, 334, 334, 358, 334, 334, 344, + 345, 334, 334, 359, 359, 334, 334, 334, 334, 334, + 334, 334, 334, 334, 334, 436 +}; + +static DfaState st354[36] = { + 436, 354, 354, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354, 355, 354, + 354, 354, 354, 354, 354, 436 +}; + +static DfaState st355[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 360, 436, 436, 361, + 362, 436, 436, 363, 363, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st356[36] = { + 436, 354, 354, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354, 354, 354, + 354, 354, 354, 354, 354, 354, 354, 354, 355, 354, + 354, 354, 354, 354, 354, 436 +}; + +static DfaState st357[36] = { + 436, 436, 279, 436, 279, 279, 279, 279, 279, 279, + 279, 279, 279, 364, 279, 436, 279, 279, 436, 436, + 436, 436, 436, 279, 279, 279, 279, 436, 436, 436, + 436, 436, 279, 279, 279, 436 +}; + +static DfaState st358[36] = { + 436, 334, 334, 334, 334, 334, 334, 334, 334, 334, + 334, 334, 334, 334, 334, 334, 358, 334, 334, 344, + 345, 334, 334, 359, 359, 334, 334, 334, 334, 334, + 334, 334, 334, 334, 334, 436 +}; + +static DfaState st359[36] = { + 436, 334, 334, 334, 334, 334, 334, 334, 334, 334, + 334, 334, 334, 334, 334, 334, 358, 334, 334, 344, + 345, 334, 334, 359, 359, 334, 334, 334, 334, 334, + 334, 334, 334, 334, 334, 436 +}; + +static DfaState st360[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 360, 436, 436, 361, + 362, 436, 436, 363, 363, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st361[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st362[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 365, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st363[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 360, 436, 436, 361, + 362, 436, 436, 363, 363, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st364[36] = { + 436, 436, 279, 436, 279, 279, 279, 279, 279, 279, + 279, 279, 279, 279, 366, 436, 279, 279, 436, 436, + 436, 436, 436, 279, 279, 279, 279, 436, 436, 436, + 436, 436, 279, 279, 279, 436 +}; + +static DfaState st365[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st366[36] = { + 436, 436, 279, 436, 279, 279, 279, 279, 279, 279, + 279, 279, 279, 279, 279, 367, 279, 279, 436, 436, + 436, 436, 436, 279, 279, 279, 279, 436, 436, 436, + 436, 436, 279, 279, 279, 436 +}; + +static DfaState st367[36] = { + 436, 368, 368, 368, 368, 368, 368, 368, 368, 368, + 368, 368, 368, 368, 368, 368, 369, 370, 436, 368, + 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, + 368, 368, 368, 368, 368, 436 +}; + +static DfaState st368[36] = { + 436, 368, 368, 368, 368, 368, 368, 368, 368, 368, + 368, 368, 368, 368, 368, 368, 368, 368, 371, 368, + 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, + 368, 368, 368, 368, 368, 436 +}; + +static DfaState st369[36] = { + 436, 368, 368, 368, 368, 368, 368, 368, 368, 368, + 368, 368, 368, 368, 368, 368, 369, 370, 371, 368, + 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, + 368, 368, 368, 368, 368, 436 +}; + +static DfaState st370[36] = { + 436, 372, 372, 372, 372, 372, 372, 372, 372, 372, + 372, 372, 372, 372, 372, 372, 372, 372, 373, 372, + 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, + 372, 372, 372, 372, 368, 436 +}; + +static DfaState st371[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st372[36] = { + 436, 372, 372, 372, 372, 372, 372, 372, 372, 372, + 372, 372, 372, 372, 372, 372, 372, 372, 373, 372, + 372, 372, 372, 372, 372, 372, 372, 372, 372, 372, + 372, 372, 372, 372, 374, 436 +}; + +static DfaState st373[36] = { + 436, 375, 375, 375, 375, 375, 375, 375, 375, 375, + 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, + 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, + 375, 375, 375, 375, 376, 436 +}; + +static DfaState st374[36] = { + 436, 368, 368, 368, 368, 368, 368, 368, 368, 368, + 368, 368, 368, 368, 368, 368, 377, 368, 378, 368, + 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, + 368, 368, 368, 368, 368, 436 +}; + +static DfaState st375[36] = { + 436, 375, 375, 375, 375, 375, 375, 375, 375, 375, + 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, + 375, 375, 375, 375, 375, 375, 375, 375, 375, 375, + 375, 375, 375, 375, 376, 436 +}; + +static DfaState st376[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 379, 436, 380, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st377[36] = { + 436, 368, 368, 368, 368, 368, 368, 368, 368, 368, + 368, 368, 368, 368, 368, 368, 377, 368, 378, 368, + 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, + 368, 368, 368, 368, 368, 436 +}; + +static DfaState st378[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st379[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 379, 436, 380, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st380[36] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436 +}; + +static DfaState st381[28] = { + 382, 383, 384, 385, 386, 436, 387, 388, 388, 388, + 389, 388, 388, 388, 388, 388, 388, 388, 388, 388, + 390, 391, 392, 393, 394, 395, 388, 436 +}; + +static DfaState st382[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st383[28] = { + 436, 383, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st384[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st385[28] = { + 436, 436, 396, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st386[28] = { + 436, 436, 436, 436, 397, 398, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st387[28] = { + 436, 436, 436, 436, 436, 436, 436, 399, 436, 400, + 401, 436, 436, 436, 402, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st388[28] = { + 436, 436, 436, 436, 436, 436, 436, 403, 403, 403, + 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, + 436, 436, 436, 436, 436, 403, 403, 436 +}; + +static DfaState st389[28] = { + 436, 436, 436, 436, 436, 436, 436, 403, 403, 403, + 403, 404, 403, 403, 403, 403, 403, 403, 403, 403, + 436, 436, 436, 436, 436, 403, 403, 436 +}; + +static DfaState st390[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st391[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st392[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st393[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st394[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st395[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 395, 436, 436 +}; + +static DfaState st396[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st397[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st398[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st399[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 405, 436, + 436, 436, 436, 436, 436, 406, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st400[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 407, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st401[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 408, 409, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st402[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 410, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st403[28] = { + 436, 436, 436, 436, 436, 436, 436, 403, 403, 403, + 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, + 436, 436, 436, 436, 436, 403, 403, 436 +}; + +static DfaState st404[28] = { + 436, 436, 436, 436, 436, 436, 436, 403, 403, 403, + 403, 403, 403, 403, 411, 403, 403, 403, 403, 403, + 436, 436, 436, 436, 436, 403, 403, 436 +}; + +static DfaState st405[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 412, + 436, 413, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st406[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 414, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st407[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 415, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st408[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 416, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st409[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 417, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st410[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 418, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st411[28] = { + 436, 436, 436, 436, 436, 436, 436, 403, 403, 403, + 403, 403, 403, 403, 403, 419, 403, 403, 403, 403, + 436, 436, 436, 436, 436, 403, 403, 436 +}; + +static DfaState st412[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 420, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st413[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 421, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st414[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 422, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st415[28] = { + 436, 436, 436, 436, 436, 436, 436, 423, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st416[28] = { + 436, 436, 436, 436, 436, 436, 436, 424, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st417[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 425, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st418[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 426, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st419[28] = { + 436, 436, 436, 436, 436, 436, 436, 403, 403, 403, + 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, + 436, 436, 436, 436, 436, 403, 403, 436 +}; + +static DfaState st420[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 427, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st421[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 428, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st422[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 429, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st423[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 430, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st424[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 431, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st425[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st426[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 432, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st427[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st428[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 433, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st429[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 434, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st430[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 435, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st431[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st432[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st433[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st434[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + +static DfaState st435[28] = { + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436, 436, 436, + 436, 436, 436, 436, 436, 436, 436, 436 +}; + + +DfaState *dfa[436] = { + st0, + st1, + st2, + st3, + st4, + st5, + st6, + st7, + st8, + st9, + st10, + st11, + st12, + st13, + st14, + st15, + st16, + st17, + st18, + st19, + st20, + st21, + st22, + st23, + st24, + st25, + st26, + st27, + st28, + st29, + st30, + st31, + st32, + st33, + st34, + st35, + st36, + st37, + st38, + st39, + st40, + st41, + st42, + st43, + st44, + st45, + st46, + st47, + st48, + st49, + st50, + st51, + st52, + st53, + st54, + st55, + st56, + st57, + st58, + st59, + st60, + st61, + st62, + st63, + st64, + st65, + st66, + st67, + st68, + st69, + st70, + st71, + st72, + st73, + st74, + st75, + st76, + st77, + st78, + st79, + st80, + st81, + st82, + st83, + st84, + st85, + st86, + st87, + st88, + st89, + st90, + st91, + st92, + st93, + st94, + st95, + st96, + st97, + st98, + st99, + st100, + st101, + st102, + st103, + st104, + st105, + st106, + st107, + st108, + st109, + st110, + st111, + st112, + st113, + st114, + st115, + st116, + st117, + st118, + st119, + st120, + st121, + st122, + st123, + st124, + st125, + st126, + st127, + st128, + st129, + st130, + st131, + st132, + st133, + st134, + st135, + st136, + st137, + st138, + st139, + st140, + st141, + st142, + st143, + st144, + st145, + st146, + st147, + st148, + st149, + st150, + st151, + st152, + st153, + st154, + st155, + st156, + st157, + st158, + st159, + st160, + st161, + st162, + st163, + st164, + st165, + st166, + st167, + st168, + st169, + st170, + st171, + st172, + st173, + st174, + st175, + st176, + st177, + st178, + st179, + st180, + st181, + st182, + st183, + st184, + st185, + st186, + st187, + st188, + st189, + st190, + st191, + st192, + st193, + st194, + st195, + st196, + st197, + st198, + st199, + st200, + st201, + st202, + st203, + st204, + st205, + st206, + st207, + st208, + st209, + st210, + st211, + st212, + st213, + st214, + st215, + st216, + st217, + st218, + st219, + st220, + st221, + st222, + st223, + st224, + st225, + st226, + st227, + st228, + st229, + st230, + st231, + st232, + st233, + st234, + st235, + st236, + st237, + st238, + st239, + st240, + st241, + st242, + st243, + st244, + st245, + st246, + st247, + st248, + st249, + st250, + st251, + st252, + st253, + st254, + st255, + st256, + st257, + st258, + st259, + st260, + st261, + st262, + st263, + st264, + st265, + st266, + st267, + st268, + st269, + st270, + st271, + st272, + st273, + st274, + st275, + st276, + st277, + st278, + st279, + st280, + st281, + st282, + st283, + st284, + st285, + st286, + st287, + st288, + st289, + st290, + st291, + st292, + st293, + st294, + st295, + st296, + st297, + st298, + st299, + st300, + st301, + st302, + st303, + st304, + st305, + st306, + st307, + st308, + st309, + st310, + st311, + st312, + st313, + st314, + st315, + st316, + st317, + st318, + st319, + st320, + st321, + st322, + st323, + st324, + st325, + st326, + st327, + st328, + st329, + st330, + st331, + st332, + st333, + st334, + st335, + st336, + st337, + st338, + st339, + st340, + st341, + st342, + st343, + st344, + st345, + st346, + st347, + st348, + st349, + st350, + st351, + st352, + st353, + st354, + st355, + st356, + st357, + st358, + st359, + st360, + st361, + st362, + st363, + st364, + st365, + st366, + st367, + st368, + st369, + st370, + st371, + st372, + st373, + st374, + st375, + st376, + st377, + st378, + st379, + st380, + st381, + st382, + st383, + st384, + st385, + st386, + st387, + st388, + st389, + st390, + st391, + st392, + st393, + st394, + st395, + st396, + st397, + st398, + st399, + st400, + st401, + st402, + st403, + st404, + st405, + st406, + st407, + st408, + st409, + st410, + st411, + st412, + st413, + st414, + st415, + st416, + st417, + st418, + st419, + st420, + st421, + st422, + st423, + st424, + st425, + st426, + st427, + st428, + st429, + st430, + st431, + st432, + st433, + st434, + st435 +}; + + +DfaState accepts[437] = { + 0, 1, 2, 3, 3, 4, 25, 6, 0, 50, + 59, 57, 57, 43, 26, 13, 14, 0, 57, 58, + 57, 21, 57, 23, 24, 27, 28, 44, 0, 35, + 36, 42, 45, 46, 58, 51, 52, 3, 5, 9, + 7, 8, 59, 59, 59, 59, 59, 59, 59, 59, + 57, 57, 12, 40, 59, 57, 58, 57, 57, 57, + 33, 34, 53, 58, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 57, 59, 57, 57, 57, 57, 0, + 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, + 57, 57, 57, 57, 57, 0, 0, 59, 59, 59, + 59, 59, 59, 32, 59, 59, 59, 59, 59, 59, + 59, 59, 57, 57, 57, 22, 56, 48, 49, 0, + 11, 11, 0, 59, 59, 59, 59, 59, 59, 59, + 59, 59, 59, 41, 59, 59, 59, 18, 57, 47, + 57, 0, 11, 0, 10, 10, 0, 59, 59, 59, + 59, 59, 15, 19, 59, 59, 59, 17, 57, 55, + 10, 0, 11, 11, 59, 59, 59, 59, 59, 59, + 20, 59, 57, 0, 0, 0, 11, 59, 59, 59, + 37, 38, 59, 39, 54, 0, 0, 0, 10, 10, + 0, 31, 29, 30, 59, 10, 59, 59, 59, 59, + 16, 0, 60, 61, 62, 62, 0, 65, 62, 64, + 63, 63, 63, 0, 66, 67, 68, 68, 0, 71, + 68, 70, 69, 69, 69, 0, 72, 73, 74, 74, + 0, 76, 74, 75, 0, 77, 79, 81, 80, 80, + 78, 80, 0, 82, 84, 86, 85, 85, 83, 85, + 0, 87, 88, 88, 89, 88, 0, 90, 91, 91, + 92, 91, 0, 93, 94, 94, 95, 94, 0, 96, + 98, 100, 99, 99, 97, 99, 0, 101, 108, 143, + 104, 143, 129, 127, 107, 107, 109, 128, 126, 134, + 0, 133, 139, 143, 102, 143, 107, 116, 110, 112, + 113, 123, 123, 125, 124, 117, 120, 132, 138, 130, + 131, 137, 137, 135, 136, 142, 140, 141, 103, 143, + 116, 111, 114, 123, 123, 119, 118, 137, 143, 115, + 123, 143, 123, 143, 0, 123, 0, 122, 122, 123, + 143, 0, 122, 0, 121, 121, 0, 143, 121, 0, + 122, 122, 143, 0, 0, 0, 122, 143, 0, 0, + 0, 121, 121, 0, 143, 121, 143, 0, 0, 0, + 0, 106, 0, 106, 0, 0, 0, 0, 105, 0, + 105, 0, 144, 145, 146, 146, 0, 0, 164, 164, + 158, 159, 160, 161, 162, 163, 146, 147, 148, 0, + 0, 0, 0, 164, 164, 150, 0, 0, 0, 0, + 0, 164, 0, 0, 0, 0, 0, 0, 0, 157, + 0, 0, 0, 0, 0, 152, 0, 149, 0, 0, + 0, 153, 154, 151, 155, 156, 0 +}; + +void (*actions[165])() = { + zzerraction, + act1, + act2, + act3, + act4, + act5, + act6, + act7, + act8, + act9, + act10, + act11, + act12, + act13, + act14, + act15, + act16, + act17, + act18, + act19, + act20, + act21, + act22, + act23, + act24, + act25, + act26, + act27, + act28, + act29, + act30, + act31, + act32, + act33, + act34, + act35, + act36, + act37, + act38, + act39, + act40, + act41, + act42, + act43, + act44, + act45, + act46, + act47, + act48, + act49, + act50, + act51, + act52, + act53, + act54, + act55, + act56, + act57, + act58, + act59, + act60, + act61, + act62, + act63, + act64, + act65, + act66, + act67, + act68, + act69, + act70, + act71, + act72, + act73, + act74, + act75, + act76, + act77, + act78, + act79, + act80, + act81, + act82, + act83, + act84, + act85, + act86, + act87, + act88, + act89, + act90, + act91, + act92, + act93, + act94, + act95, + act96, + act97, + act98, + act99, + act100, + act101, + act102, + act103, + act104, + act105, + act106, + act107, + act108, + act109, + act110, + act111, + act112, + act113, + act114, + act115, + act116, + act117, + act118, + act119, + act120, + act121, + act122, + act123, + act124, + act125, + act126, + act127, + act128, + act129, + act130, + act131, + act132, + act133, + act134, + act135, + act136, + act137, + act138, + act139, + act140, + act141, + act142, + act143, + act144, + act145, + act146, + act147, + act148, + act149, + act150, + act151, + act152, + act153, + act154, + act155, + act156, + act157, + act158, + act159, + act160, + act161, + act162, + act163, + act164 +}; + +static DfaState dfa_base[] = { + 0, + 201, + 213, + 225, + 234, + 242, + 250, + 256, + 262, + 268, + 276, + 381 +}; + +static unsigned char *b_class_no[] = { + shift0, + shift1, + shift2, + shift3, + shift4, + shift5, + shift6, + shift7, + shift8, + shift9, + shift10, + shift11 +}; + + + +#define ZZSHIFT(c) (b_class_no[zzauto][1+c]) +#define MAX_MODE 12 +#include "dlgauto.h" diff --git a/pccts/antlr/set.c b/pccts/antlr/set.c new file mode 100644 index 0000000..63447f5 --- /dev/null +++ b/pccts/antlr/set.c @@ -0,0 +1,816 @@ +/* set.c + + The following is a general-purpose set library originally developed + by Hank Dietz and enhanced by Terence Parr to allow dynamic sets. + + Sets are now structs containing the #words in the set and + a pointer to the actual set words. + + Generally, sets need not be explicitly allocated. They are + created/extended/shrunk when appropriate (e.g. in set_of()). + HOWEVER, sets need to be destroyed (free()ed) when they go out of scope + or are otherwise no longer needed. A routine is provided to + free a set. + + Sets can be explicitly created with set_new(s, max_elem). + + Sets can be declared to have minimum size to reduce realloc traffic. + Default minimum size = 1. + + Sets can be explicitly initialized to have no elements (set.n == 0) + by using the 'empty' initializer: + + Examples: + set a = empty; -- set_deg(a) == 0 + + return( empty ); + + Example set creation and destruction: + + set + set_of2(e,g) + unsigned e,g; + { + set a,b,c; + + b = set_of(e); -- Creates space for b and sticks in e + set_new(c, g); -- set_new(); set_orel() ==> set_of() + set_orel(g, &c); + a = set_or(b, c); + . + . + . + set_free(b); + set_free(c); + return( a ); + } + + 1987 by Hank Dietz + + Modified by: + Terence Parr + Purdue University + October 1989 + + Made it smell less bad to C++ 7/31/93 -- TJP +*/ + +#include <stdio.h> +#include "pcctscfg.h" +#ifdef __STDC__ +#include <stdlib.h> +#else +#include <malloc.h> +#endif +#include <string.h> + +#include "set.h" + +#define MIN(i,j) ( (i) > (j) ? (j) : (i)) +#define MAX(i,j) ( (i) < (j) ? (j) : (i)) + +/* elems can be a maximum of 32 bits */ +static unsigned bitmask[] = { + 0x00000001, 0x00000002, 0x00000004, 0x00000008, + 0x00000010, 0x00000020, 0x00000040, 0x00000080, + 0x00000100, 0x00000200, 0x00000400, 0x00000800, + 0x00001000, 0x00002000, 0x00004000, 0x00008000, +#if !defined(PC) || defined(PC32) + 0x00010000, 0x00020000, 0x00040000, 0x00080000, + 0x00100000, 0x00200000, 0x00400000, 0x00800000, + 0x01000000, 0x02000000, 0x04000000, 0x08000000, + 0x10000000, 0x20000000, 0x40000000, 0x80000000 +#endif +}; + +set empty = set_init; +static unsigned min=1; + +#define StrSize 200 + +#ifdef MEMCHK +#define CHK(a) \ + if ( a.setword != NULL ) \ + if ( !valid(a.setword) ) \ + {fprintf(stderr, "%s(%d): invalid set\n",__FILE__,__LINE__); exit(-1);} +#else +#define CHK(a) +#endif + +/* + * Set the minimum size (in words) of a set to reduce realloc calls + */ +void +#ifdef __USE_PROTOS +set_size( unsigned n ) +#else +set_size( n ) +unsigned n; +#endif +{ + min = n; +} + +unsigned int +#ifdef __USE_PROTOS +set_deg( set a ) +#else +set_deg( a ) +set a; +#endif +{ + /* Fast compute degree of a set... the number + of elements present in the set. Assumes + that all word bits are used in the set + and that SETSIZE(a) is a multiple of WORDSIZE. + */ + register unsigned *p = &(a.setword[0]); + register unsigned *endp = NULL; /* MR27 Avoid false memory check report */ + register unsigned degree = 0; + + CHK(a); + if ( a.n == 0 ) return(0); + endp = &(a.setword[a.n]); + while ( p < endp ) + { + register unsigned t = *p; + register unsigned *b = &(bitmask[0]); + do { + if (t & *b) ++degree; + } while (++b < &(bitmask[WORDSIZE])); + p++; + } + + return(degree); +} + +set +#ifdef __USE_PROTOS +set_or( set b, set c ) +#else +set_or( b, c ) +set b; +set c; +#endif +{ + /* Fast set union operation */ + /* resultant set size is max(b, c); */ + set *big; + set t; + unsigned int m,n; + register unsigned *r, *p, *q, *endp; + + CHK(b); CHK(c); + t = empty; + if (b.n > c.n) {big= &b; m=b.n; n=c.n;} else {big= &c; m=c.n; n=b.n;} + set_ext(&t, m); + r = t.setword; + + /* Or b,c until max of smaller set */ + q = c.setword; + p = b.setword; + endp = &(b.setword[n]); + while ( p < endp ) *r++ = *p++ | *q++; + + /* Copy rest of bigger set into result */ + p = &(big->setword[n]); + endp = &(big->setword[m]); + while ( p < endp ) *r++ = *p++; + + return(t); +} + +set +#ifdef __USE_PROTOS +set_and( set b, set c ) +#else +set_and( b, c ) +set b; +set c; +#endif +{ + /* Fast set intersection operation */ + /* resultant set size is min(b, c); */ + set t; + unsigned int n; + register unsigned *r, *p, *q, *endp; + + CHK(b); CHK(c); + t = empty; + n = (b.n > c.n) ? c.n : b.n; + if ( n == 0 ) return t; /* TJP 4-27-92 fixed for empty set */ + set_ext(&t, n); + r = t.setword; + + /* & b,c until max of smaller set */ + q = c.setword; + p = b.setword; + endp = &(b.setword[n]); + while ( p < endp ) *r++ = *p++ & *q++; + + return(t); +} + +set +#ifdef __USE_PROTOS +set_dif( set b, set c ) +#else +set_dif( b, c ) +set b; +set c; +#endif +{ + /* Fast set difference operation b - c */ + /* resultant set size is size(b) */ + set t; + unsigned int n; + register unsigned *r, *p, *q, *endp; + + CHK(b); CHK(c); + t = empty; + n = (b.n <= c.n) ? b.n : c.n ; + if ( b.n == 0 ) return t; /* TJP 4-27-92 fixed for empty set */ + /* WEC 12-1-92 fixed for c.n = 0 */ + set_ext(&t, b.n); + r = t.setword; + + /* Dif b,c until smaller set size */ + q = c.setword; + p = b.setword; + endp = &(b.setword[n]); + while ( p < endp ) *r++ = *p++ & (~ *q++); + + /* Copy rest of b into result if size(b) > c */ + if ( b.n > n ) + { + p = &(b.setword[n]); + endp = &(b.setword[b.n]); + while ( p < endp ) *r++ = *p++; + } + + return(t); +} + +set +#ifdef __USE_PROTOS +set_of( unsigned b ) +#else +set_of( b ) +unsigned b; +#endif +{ + /* Fast singleton set constructor operation */ + static set a; + + if ( b == nil ) return( empty ); + set_new(a, b); + a.setword[DIVWORD(b)] = bitmask[MODWORD(b)]; + + return(a); +} + +/* + * Extend (or shrink) the set passed in to have n words. + * + * if n is smaller than the minimum, boost n to have the minimum. + * if the new set size is the same as the old one, do nothing. + * + * TJP 4-27-92 Fixed so won't try to alloc 0 bytes + */ +void +#ifdef __USE_PROTOS +set_ext( set *a, unsigned int n ) +#else +set_ext( a, n ) +set *a; +unsigned int n; +#endif +{ + register unsigned *p; + register unsigned *endp; + unsigned int size; + + CHK((*a)); + if ( a->n == 0 ) + { + if ( n == 0 ) return; + if (a->setword != NULL) { + free (a->setword); /* MR20 */ + } + a->setword = (unsigned *) calloc(n, BytesPerWord); + if ( a->setword == NULL ) + { + fprintf(stderr, "set_ext(%d words): cannot allocate set\n", n); + exit(-1); + } + a->n = n; + return; + } + if ( n < min ) n = min; + if ( a->n == n || n == 0 ) return; + size = a->n; + a->n = n; + a->setword = (unsigned *) realloc( (char *)a->setword, (n*BytesPerWord) ); + if ( a->setword == NULL ) + { + fprintf(stderr, "set_ext(%d words): cannot allocate set\n", n); + exit(-1); + } + + p = &(a->setword[size]); /* clear from old size to new size */ + endp = &(a->setword[a->n]); + do { + *p++ = 0; + } while ( p < endp ); +} + +set +#ifdef __USE_PROTOS +set_not( set a ) +#else +set_not( a ) +set a; +#endif +{ + /* Fast not of set a (assumes all bits used) */ + /* size of resultant set is size(a) */ + /* ~empty = empty cause we don't know how bit to make set */ + set t; + register unsigned *r; + register unsigned *p = a.setword; + register unsigned *endp = &(a.setword[a.n]); + + CHK(a); + t = empty; + if ( a.n == 0 ) return( empty ); + set_ext(&t, a.n); + r = t.setword; + + do { + *r++ = (~ *p++); + } while ( p < endp ); + + return(t); +} + +int +#ifdef __USE_PROTOS +set_equ( set a, set b ) +#else +set_equ( a, b ) +set a; +set b; +#endif +{ +/* 8-Nov-97 Make it work with sets of different sizes */ +/* Easy to understand, too. Probably faster. */ +/* Check for a equal to b */ + + unsigned int count; /* MR11 */ + unsigned int i; /* MR11 */ + + CHK(a); CHK(b); + + count=MIN(a.n,b.n); + if (count == 0) return 1; + for (i=0; i < count; i++) { + if (a.setword[i] != b.setword[i]) return 0; + }; + if (a.n < b.n) { + for (i=count; i < b.n; i++) { + if (b.setword[i] != 0) return 0; + } + return 1; + } else if (a.n > b.n) { + for (i=count; i < a.n; i++) { + if (a.setword[i] != 0) return 0; + } + return 1; + } else { + return 1; + }; +} + +int +#ifdef __USE_PROTOS +set_sub( set a, set b ) +#else +set_sub( a, b ) +set a; +set b; +#endif +{ + +/* 8-Nov-97 Make it work with sets of different sizes */ +/* Easy to understand, too. Probably faster. */ +/* Check for a is a PROPER subset of b */ + + unsigned int count; + unsigned int i; + + CHK(a); CHK(b); + + if (a.n == 0) return 1; + count=MIN(a.n,b.n); + for (i=0; i < count; i++) { + if (a.setword[i] & ~b.setword[i]) return 0; + }; + if (a.n <= b.n) { + return 1; + } else { + for (i=count; i<a.n ; i++) { + if (a.setword[i]) return 0; + }; + }; + return 1; +} + +unsigned +#ifdef __USE_PROTOS +set_int( set b ) +#else +set_int( b ) +set b; +#endif +{ + /* Fast pick any element of the set b */ + register unsigned *p = b.setword; + register unsigned *endp = &(b.setword[b.n]); + + CHK(b); + if ( b.n == 0 ) return( nil ); + + do { + if (*p) { + /* Found a non-empty word of the set */ + register unsigned i = ((p - b.setword) << LogWordSize); + register unsigned t = *p; + p = &(bitmask[0]); + while (!(*p & t)) { + ++i; ++p; + } + return(i); + } + } while (++p < endp); + + /* Empty -- only element it contains is nil */ + return(nil); +} + +int +#ifdef __USE_PROTOS +set_el( unsigned b, set a ) +#else +set_el( b, a ) +unsigned b; +set a; +#endif +{ + CHK(a); + /* nil is an element of every set */ + if (b == nil) return(1); + if ( a.n == 0 || NumWords(b) > a.n ) return(0); + + /* Otherwise, we have to check */ + return( a.setword[DIVWORD(b)] & bitmask[MODWORD(b)] ); +} + +int +#ifdef __USE_PROTOS +set_nil( set a ) +#else +set_nil( a ) +set a; +#endif +{ + /* Fast check for nil set */ + register unsigned *p = a.setword; + register unsigned *endp; + + CHK(a); + if ( a.n == 0 ) return(1); + endp = &(a.setword[a.n]); + + /* The set is not empty if any word used to store + the set is non-zero. This means one must be a + bit careful about doing things like negation. + */ + do { + if (*p) return(0); + } while (++p < endp); + + return(1); +} + +char * +#ifdef __USE_PROTOS +set_str( set a ) +#else +set_str( a ) +set a; +#endif +{ + /* Fast convert set a into ASCII char string... + assumes that all word bits are used in the set + and that SETSIZE is a multiple of WORDSIZE. + Trailing 0 bits are removed from the string. + if no bits are on or set is empty, "" is returned. + */ + register unsigned *p = a.setword; + register unsigned *endp = &(a.setword[a.n]); + static char str_tmp[StrSize+1]; + register char *q = &(str_tmp[0]); + + CHK(a); + if ( a.n==0 ) {*q=0; return( &(str_tmp[0]) );} + do { + register unsigned t = *p; + register unsigned *b = &(bitmask[0]); + do { + *(q++) = (char) ((t & *b) ? '1' : '0'); + } while (++b < &(bitmask[WORDSIZE])); + } while (++p < endp); + + /* Trim trailing 0s & NULL terminate the string */ + while ((q > &(str_tmp[0])) && (*(q-1) != '1')) --q; + *q = 0; + + return(&(str_tmp[0])); +} + +set +#ifdef __USE_PROTOS +set_val( register char *s ) +#else +set_val( s ) +register char *s; +#endif +{ + /* Fast convert set ASCII char string into a set. + If the string ends early, the remaining set bits + are all made zero. + The resulting set size is just big enough to hold all elements. + */ + static set a; + register unsigned *p, *endp; + + set_new(a, strlen(s)); + p = a.setword; + endp = &(a.setword[a.n]); + do { + register unsigned *b = &(bitmask[0]); + /* Start with a word with no bits on */ + *p = 0; + do { + if (*s) { + if (*s == '1') { + /* Turn-on this bit */ + *p |= *b; + } + ++s; + } + } while (++b < &(bitmask[WORDSIZE])); + } while (++p < endp); + + return(a); +} + +/* + * Or element e into set a. a can be empty. + */ +void +#ifdef __USE_PROTOS +set_orel( unsigned e, set *a ) +#else +set_orel( e, a ) +unsigned e; +set *a; +#endif +{ + CHK((*a)); + if ( e == nil ) return; + if ( NumWords(e) > a->n ) set_ext(a, NumWords(e)); + a->setword[DIVWORD(e)] |= bitmask[MODWORD(e)]; +} + +/* + * Or set b into set a. a can be empty. does nothing if b empty. + */ +void +#ifdef __USE_PROTOS +set_orin( set *a, set b ) +#else +set_orin( a, b ) +set *a; +set b; +#endif +{ + /* Fast set union operation */ + /* size(a) is max(a, b); */ + unsigned int m; + register unsigned *p, + *q = b.setword, + *endq; /* MR20 */ + + CHK((*a)); CHK(b); + if ( b.n == 0 ) return; + endq = &(b.setword[b.n]); /* MR20 */ + m = (a->n > b.n) ? a->n : b.n; + set_ext(a, m); + p = a->setword; + do { + *p++ |= *q++; + } while ( q < endq ); +} + +/* + * And set b into set a. a can be empty. does nothing if b empty. + */ +void +#ifdef __USE_PROTOS +set_andin( set *a, set b ) +#else +set_andin( a, b ) +set *a; +set b; +#endif +{ + /* Fast set intersection operation */ + /* size(a) is max(a, b); */ + unsigned int m; + register unsigned *p, + *q = b.setword, + *endq = &(b.setword[b.n]); + + CHK((*a)); CHK(b); + if ( b.n == 0 ) return; + m = (a->n > b.n) ? a->n : b.n; + set_ext(a, m); + p = a->setword; + do { + *p++ &= *q++; + } while ( q < endq ); +} + +void +#ifdef __USE_PROTOS +set_rm( unsigned e, set a ) +#else +set_rm( e, a ) +unsigned e; +set a; +#endif +{ + /* Does not effect size of set */ + CHK(a); + if ( (e == nil) || (NumWords(e) > a.n) ) return; + a.setword[DIVWORD(e)] ^= (a.setword[DIVWORD(e)]&bitmask[MODWORD(e)]); +} + +void +#ifdef __USE_PROTOS +set_clr( set a ) +#else +set_clr( a ) +set a; +#endif +{ + /* Does not effect size of set */ + register unsigned *p = a.setword; + register unsigned *endp; + + CHK(a); + if ( a.n == 0 ) return; + endp = &(a.setword[a.n]); + do { + *p++ = 0; + } while ( p < endp ); +} + +set +#ifdef __USE_PROTOS +set_dup( set a ) +#else +set_dup( a ) +set a; +#endif +{ + set b; + register unsigned *p, + *q = a.setword, + *endq; /* MR20 */ + + CHK(a); + b = empty; + if ( a.n == 0 ) return( empty ); + endq = &(a.setword[a.n]); /* MR20 */ + set_ext(&b, a.n); + p = b.setword; + do { + *p++ = *q++; + } while ( q < endq ); + + return(b); +} + +/* + * Return a nil terminated list of unsigned ints that represents all + * "on" bits in the bit set. + * + * e.g. {011011} --> {1, 2, 4, 5, nil} + * + * _set_pdq and set_pdq are useful when an operation is required on each element + * of a set. Normally, the sequence is: + * + * while ( set_deg(a) > 0 ) { + * e = set_int(a); + * set_rm(e, a); + * ...process e... + * } + * Now, + * + * t = e = set_pdq(a); + * while ( *e != nil ) { + * ...process *e... + * e++; + * } + * free( t ); + * + * We have saved many set calls and have not destroyed set a. + */ +void +#ifdef __USE_PROTOS +_set_pdq( set a, register unsigned *q ) +#else +_set_pdq( a, q ) +set a; +register unsigned *q; +#endif +{ + register unsigned *p = a.setword, + *endp = &(a.setword[a.n]); + register unsigned e=0; + + CHK(a); + /* are there any space (possibility of elements)? */ + if ( a.n == 0 ) return; + do { + register unsigned t = *p; + register unsigned *b = &(bitmask[0]); + do { + if ( t & *b ) *q++ = e; + ++e; + } while (++b < &(bitmask[WORDSIZE])); + } while (++p < endp); + *q = nil; +} + +/* + * Same as _set_pdq except allocate memory. set_pdq is the natural function + * to use. + */ +unsigned * +#ifdef __USE_PROTOS +set_pdq( set a ) +#else +set_pdq( a ) +set a; +#endif +{ + unsigned *q; + int max_deg; + + CHK(a); + max_deg = WORDSIZE*a.n; + /* assume a.n!=0 & no elements is rare, but still ok */ + if ( a.n == 0 ) return(NULL); + q = (unsigned *) malloc((max_deg+1)*BytesPerWord); + if ( q == NULL ) return( NULL ); + _set_pdq(a, q); + return( q ); +} + +/* a function that produces a hash number for the set + */ +unsigned int +#ifdef __USE_PROTOS +set_hash( set a, register unsigned int mod ) +#else +set_hash( a, mod ) +set a; +register unsigned int mod; +#endif +{ + /* Fast hash of set a (assumes all bits used) */ + register unsigned *p = &(a.setword[0]); + register unsigned *endp = &(a.setword[a.n]); + register unsigned i = 0; + + CHK(a); + while (p<endp){ + i += (*p); + ++p; + } + + return(i % mod); +} diff --git a/pccts/antlr/stdpccts.h b/pccts/antlr/stdpccts.h new file mode 100644 index 0000000..3134eb0 --- /dev/null +++ b/pccts/antlr/stdpccts.h @@ -0,0 +1,31 @@ +#ifndef STDPCCTS_H +#define STDPCCTS_H +/* + * stdpccts.h -- P C C T S I n c l u d e + * + * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001 + * Purdue University Electrical Engineering + * With AHPCRC, University of Minnesota + * ANTLR Version 1.33MR32 + */ + +#ifndef ANTLR_VERSION +#define ANTLR_VERSION 13332 +#endif + +#include "pcctscfg.h" +#include "pccts_stdio.h" + +#include "pcctscfg.h" +#include "set.h" +#include <ctype.h> +#include "syn.h" +#include "hash.h" +#include "generic.h" +#define zzcr_attr(attr,tok,t) +#define zzSET_SIZE 20 +#include "antlr.h" +#include "tokens.h" +#include "dlgdef.h" +#include "mode.h" +#endif diff --git a/pccts/antlr/syn.h b/pccts/antlr/syn.h new file mode 100644 index 0000000..87d725e --- /dev/null +++ b/pccts/antlr/syn.h @@ -0,0 +1,390 @@ +/* + * syn.h + * + * This file includes definitions and macros associated with syntax diagrams + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2001 + */ + +#include "set.h" + +#define NumNodeTypes 4 +#define NumJuncTypes 9 + +/* List the different node types */ +#define nJunction 1 +#define nRuleRef 2 +#define nToken 3 +#define nAction 4 + +/* Different types of junctions */ +#define aSubBlk 1 +#define aOptBlk 2 +#define aLoopBlk 3 +#define EndBlk 4 +#define RuleBlk 5 +#define Generic 6 /* just a junction--no unusual characteristics */ +#define EndRule 7 +#define aPlusBlk 8 +#define aLoopBegin 9 + +typedef int NodeType; + +#define TreeBlockAllocSize 500 +#define JunctionBlockAllocSize 200 +#define ActionBlockAllocSize 50 +#define RRefBlockAllocSize 100 +#define TokenBlockAllocSize 100 + +#ifdef __cplusplus +class ActionNode; +class Junction; +#endif + +/* note that 'right' is used by the tree node allocator as a ptr for linked list */ +typedef struct _tree { + struct _tree *down, *right; + int token; + union { + int rk; /* if token==EpToken, => how many more tokens req'd */ + struct _tree *tref; /* if token==TREE_REF */ + set sref; /* if token==SET */ + } v; +#ifdef TREE_DEBUG + int in_use; + int seq; +#endif + } Tree; + + +/* a predicate is defined to be a predicate action and a token tree with + * context info (if used); later, this struct may include the + * "hoisting distance" when we hoist past tokens. + * + * A tree is used to indicate && vs || + * + * p + * | + * q--r + * + * indicates p && (q||r). + * + * If expr is PRED_AND_LIST or PRED_OR_LIST, then it's an operation node + * and indicates the start of an && or || list. + */ + +typedef struct _Predicate { + struct _Predicate *down, *right; /* these have to be first */ + struct _Predicate *up, *left; /* doubly-link me */ + char *expr; + Tree *tcontext; /* used if lookahead depth of > one is needed (tree) */ + int k; /* lookahead depth for this tcontext */ + set scontext[2];/* used if lookahead depth of one is needed (set) */ + /* scontext[0] is not used; only needed so genExprSets() + routine works (it expects an array) + */ + set completionTree; /* which lookahead depths are required to complete tcontext? */ + set completionSet; /* MR10 separate completion set for sets and trees */ + struct _PredEntry *predEntry; /* MR11 */ + +#ifdef __cplusplus + ActionNode *source; /* where did this predicate come from? */ +#else + struct _anode *source; /* where did this predicate come from? */ +#endif + + char cloned; /* MR10 don't want to free original guard pred */ + char redundant; /* MR10 predicate tree simplification */ + char ampersandStyle; /* MR10 (g)? && <<p>>? */ + char inverted; /* MR11 ! predName */ + char isConst; /* MR11 */ + char constValue; /* MR11 */ + char conflictReported; /* MR11 */ + + set plainSet; /* MR12b */ + + /*** remember to change new_predicate() and predicate_dup() when changing this ***/ + +} Predicate; + +typedef struct _ExceptionHandler { + char *signalname; + char *action; + } ExceptionHandler; + +typedef struct _ExceptionGroup { + struct _ListNode *handlers; /* list of ExceptionHandler's */ + char *label; /* label==""; implies not attached to any + * particular rule ref. + */ + char *altID; /* which alt did it come from (blk#:alt#) */ + + struct _ExceptionGroup *pendingLink; /* for alternative EG MR7 */ + struct _ExceptionGroup *outerEG; /* for alternative EG MR7 */ + struct _LabelEntry *labelEntry; /* for alternative EG MR7 */ + int forRule; /* MR7 */ + int used; /* MR7 */ + } ExceptionGroup ; + + +#define TokenString(_i) ((TokenInd!=NULL)?TokenStr[TokenInd[_i]]:TokenStr[_i]) +#define ExprString(_i) ((TokenInd!=NULL)?ExprStr[TokenInd[_i]]:ExprStr[_i]) + + + /* M e s s a g e P a s s i n g T o N o d e s */ + +/* + * assumes a 'Junction *r' exists. This macro calls a function with + * the pointer to the node to operate on and a pointer to the rule + * in which it is enclosed. + */ +#define TRANS(p) {if ( (p)==NULL ) fatal("TRANS: NULL object"); \ + if ( (p)->ntype == nJunction ) (*(fpJTrans[((Junction *)(p))->jtype]))( p );\ + else (*(fpTrans[(p)->ntype]))( p );} + +#define PRINT(p) {if ( (p)==NULL ) fatal("PRINT: NULL object");\ + (*(fpPrint[(p)->ntype]))( p );} + +#define REACH(p,k,rk,a) {if ( (p)==NULL ) fatal("REACH: NULL object");\ + (a) = (*(fpReach[(p)->ntype]))( p, k, rk );} + +#define TRAV(p,k,rk,a) {if ( (p)==NULL ) {\ + if ( ContextGuardTRAV ) (a)=NULL; \ + else fatal("TRAV: NULL object");\ + } \ + else (a) = (*(fpTraverse[(p)->ntype]))( p, k, rk );} + +/** +*** #define TRAV(p,k,rk,a) {if ( (p)==NULL ) fatal("TRAV: NULL object");\ +*** (a) = (*(fpTraverse[(p)->ntype]))( p, k, rk );} +**/ + +/* All syntax diagram nodes derive from Node -- superclass + */ +#ifdef __cplusplus +class Node { +public: + NodeType ntype; + char *rname; /* what rule does this element live in? */ + int file; /* index in FileStr */ + int line; /* line number that element occurs on */ + }; +#else +typedef struct _node { + NodeType ntype; + char *rname; /* what rule does this element live in? */ + int file; /* index in FileStr */ + int line; /* line number that element occurs on */ + } Node; +#endif + +#ifdef __cplusplus +class ActionNode : public Node { +public: +#else +typedef struct _anode { + NodeType ntype; + char *rname; /* what rule does this action live in? */ + int file; /* index in FileStr (name of file with action) */ + int line; /* line number that action occurs on */ +#endif + Node *next; + char *action; + int is_predicate; /* true if action is a <<...>>? predicate action */ + int done; /* don't dump if action dumped (used for predicates) */ + int init_action; /* is this the 1st action of 1st prod of block? */ + char *pred_fail; /* what to do/print when predicate fails */ + Predicate *guardpred; /* if '(context)? =>' was present, already done */ + unsigned char frmwarned;/* have we dumped a warning for pred yet? */ + unsigned char ctxwarned;/* have we dumped a warning for pred yet? */ + unsigned char predTooLong; /* MR10 have we dumped warning for pred yet */ + unsigned char noHoist; /* MR12 literally "noHoist" */ + Predicate *ampersandPred; /* MR10 (g)? && <<p>>? expr */ +#ifdef __cplusplus + Junction *guardNodes; /* MR11 */ +#else + struct _junct *guardNodes; /* MR11 */ +#endif + struct _PredEntry *predEntry; /* MR11 */ + int inverted; /* MR11 <<!predSymbol>>? */ +#ifdef __cplusplus + }; +#else + } ActionNode; +#endif + +#ifdef __cplusplus +class TokNode : public Node { +public: +#else +typedef struct _toknode { + NodeType ntype; + char *rname; /* name of rule it's in */ + int file; /* index in FileStr (name of file with rule) */ + int line; /* line number that token occurs on */ +#endif + Node *next; + int token; + int astnode; /* leaf/root/excluded (used to build AST's) */ + unsigned char label;/* token label or expression ? */ + unsigned char remapped; + /* used if token id's are forced to certain positions; + * a function walks the tree reassigning token numbers */ + int upper_range; /* MR13 - was char */ + /* used only if Token is of type T1..T2; in this case, + * use token..upper_range as the range; else + * upper_range must be 0 */ + unsigned char wild_card; + /* indicates that the token is the "." wild-card; + * field token is ignored if wild_card is set + */ + unsigned int elnum; /* element number within the alternative */ +#ifdef __cplusplus + Junction *altstart; /* pointer to node that starts alt */ +#else + struct _junct *altstart; /* pointer to node that starts alt */ +#endif + struct _TCnode *tclass; /* token class if tokclass ref */ + set tset; /* set of tokens represented by meta token */ + char *el_label; /* el_label:toknode */ + unsigned char complement; /* complement the set? */ + ExceptionGroup *ex_group; /* any exception[el_label] attached? */ + unsigned char use_def_MT_handler; + unsigned char label_used_in_semantic_pred; /* MR10 */ +#ifdef __cplusplus + }; +#else + } TokNode; +#endif + +#ifdef __cplusplus +class RuleRefNode : public Node { +public: +#else +typedef struct _rrnode { + NodeType ntype; + char *rname; /* name of rule it's in */ + int file; /* index in FileStr (name of file with rule) + it's in */ + int line; /* line number that rule ref occurs on */ +#endif + Node *next; + char *text; /* reference to which rule */ + char *parms; /* point to parameters of rule invocation + (if present) */ + char *assign; /* point to left-hand-side of assignment + (if any) */ + int linked; /* Has a FoLink already been established? */ + int astnode; /* excluded? (used to build AST's) */ + unsigned int elnum; /* element number within the alternative */ +#ifdef __cplusplus + Junction *altstart; +#else + struct _junct *altstart; +#endif + char *el_label; /* el_label:rrnode */ + ExceptionGroup *ex_group; /* any exception[el_label] attached? */ +#ifdef __cplusplus + }; +#else + } RuleRefNode; +#endif + +#ifdef __cplusplus +class Junction : public Node { +public: +#else +typedef struct _junct { + NodeType ntype; + char *rname; /* name of rule junction is in */ + int file; /* index in FileStr (name of file with rule) + if blk == RuleBlk */ + int line; /* line number that rule occurs on */ +#endif + int seq; /* MR10 sequence number */ + char ignore; /* used by FIRST computation to ignore + empty alt added for the (...)+ blks */ + char visited; /* used by recursive routines to avoid + infinite recursion */ + char pvisited; /* used by print routines to avoid + infinite recursion */ + char fvisited; /* used by FoLink() to avoid + infinite recursion */ + char *lock; /* used by REACH to track infinite recursion */ + char *pred_lock; /* used by find_predicates to track infinite recursion */ + int altnum; /* used in subblocks. altnum==0 means not an + alt of subrule */ + int jtype; /* annotation for code-gen/FIRST/FOLLOW. + Junction type */ +#ifdef __cplusplus + Junction *end; /* pointer to node with EndBlk in it + if blk == a block type */ +#else + struct _junct *end; /* pointer to node with EndBlk in it + if blk == a block type */ +#endif + Node *p1, *p2; + char halt; /* never move past a junction with halt==TRUE */ /* MR10 was int */ + char *pdecl; /* point to declaration of parameters on rule + (if present) */ + char *parm; /* point to parameter of block invocation + (if present) */ + char predparm; /* indicates that the 'parm' is a predicate + * to be used in the while loop generated + * for blocks */ /* MR10 was int */ + char *ret; /* point to return type of rule (if present) */ + char *erraction; /* point to error action (if present) */ + int blockid; /* this is a unique ID */ + char *exception_label; /* goto label for this alt */ + set *fset; /* used for code generation */ + Tree *ftree; /* used for code generation */ + Predicate *predicate;/* predicate that can be used to disambiguate */ + char guess; /* true if (...)? block */ + char alpha_beta_guess_end; /* MR14 1 => end block of guess sub block */ + Node *guess_analysis_point; /* MR14 */ + char approx; /* limit block to use linear approx lookahead? */ + set tokrefs; /* if ith element of alt is tokref then i is member */ + set rulerefs; /* if ith element of alt is rule ref then i is member */ + struct _ListNode *exceptions; /* list of exceptions groups for rule */ + struct _ListNode *el_labels; /* list of element labels for rule */ + ExceptionGroup *outerEG; /* MR7 */ + int curAltNum; /* MR7 */ + char* pFirstSetSymbol; /* #pragma FirstSetSymbol(Foo) MR21 */ +#ifdef __cplusplus + Junction *pendingLink; /* MR7 */ +#else + struct _junct *pendingLink; /* MR7 */ +#endif + char overlap_warning; /* MR10 */ +#ifdef __cplusplus + }; +#else + } Junction; +#endif + +typedef struct { Node *left, *right;} Graph; + diff --git a/pccts/antlr/tokens.h b/pccts/antlr/tokens.h new file mode 100644 index 0000000..17e6ea7 --- /dev/null +++ b/pccts/antlr/tokens.h @@ -0,0 +1,246 @@ +#ifndef tokens_h +#define tokens_h +/* tokens.h -- List of labelled tokens and stuff + * + * Generated from: antlr.g + * + * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001 + * Purdue University Electrical Engineering + * ANTLR Version 1.33MR32 + */ +#define zzEOF_TOKEN 1 +#define Eof 1 +#define QuotedTerm 2 +#define Action 34 +#define Pred 35 +#define PassAction 36 +#define WildCard 87 +#define LABEL 89 +#define Pragma 92 +#define FirstSetSymbol 93 +#define NonTerminal 100 +#define TokenTerm 101 +#define ID 148 +#define INT 150 + +#ifdef __USE_PROTOS +void grammar(void); +#else +extern void grammar(); +#endif + +#ifdef __USE_PROTOS +void class_def(void); +#else +extern void class_def(); +#endif + +#ifdef __USE_PROTOS +void rule(void); +#else +extern void rule(); +#endif + +#ifdef __USE_PROTOS +void laction(void); +#else +extern void laction(); +#endif + +#ifdef __USE_PROTOS +void lmember(void); +#else +extern void lmember(); +#endif + +#ifdef __USE_PROTOS +void lprefix(void); +#else +extern void lprefix(); +#endif + +#ifdef __USE_PROTOS +void aPred(void); +#else +extern void aPred(); +#endif + +#ifdef __USE_PROTOS +extern Predicate * predOrExpr(void); +#else +extern Predicate * predOrExpr(); +#endif + +#ifdef __USE_PROTOS +extern Predicate * predAndExpr(void); +#else +extern Predicate * predAndExpr(); +#endif + +#ifdef __USE_PROTOS +extern Predicate * predPrimary(void); +#else +extern Predicate * predPrimary(); +#endif + +#ifdef __USE_PROTOS +void aLexclass(void); +#else +extern void aLexclass(); +#endif + +#ifdef __USE_PROTOS +void error(void); +#else +extern void error(); +#endif + +#ifdef __USE_PROTOS +void tclass(void); +#else +extern void tclass(); +#endif + +#ifdef __USE_PROTOS +void token(void); +#else +extern void token(); +#endif + +#ifdef __USE_PROTOS +void block(set * toksrefd,set * rulesrefd); +#else +extern void block(); +#endif + +#ifdef __USE_PROTOS +void alt(set * toksrefd,set * rulesrefd); +#else +extern void alt(); +#endif + +#ifdef __USE_PROTOS +extern LabelEntry * element_label(void); +#else +extern LabelEntry * element_label(); +#endif + +#ifdef __USE_PROTOS +extern Node * element(int old_not,int first_on_line,int use_def_MT_handler); +#else +extern Node * element(); +#endif + +#ifdef __USE_PROTOS +void default_exception_handler(void); +#else +extern void default_exception_handler(); +#endif + +#ifdef __USE_PROTOS +extern ExceptionGroup * exception_group(void); +#else +extern ExceptionGroup * exception_group(); +#endif + +#ifdef __USE_PROTOS +extern ExceptionHandler * exception_handler(void); +#else +extern ExceptionHandler * exception_handler(); +#endif + +#ifdef __USE_PROTOS +void enum_file(char * fname); +#else +extern void enum_file(); +#endif + +#ifdef __USE_PROTOS +void defines(char * fname); +#else +extern void defines(); +#endif + +#ifdef __USE_PROTOS +void enum_def(char * fname); +#else +extern void enum_def(); +#endif + +#endif +extern SetWordType zzerr1[]; +extern SetWordType zzerr2[]; +extern SetWordType zzerr3[]; +extern SetWordType zzerr4[]; +extern SetWordType setwd1[]; +extern SetWordType zzerr5[]; +extern SetWordType zzerr6[]; +extern SetWordType zzerr7[]; +extern SetWordType zzerr8[]; +extern SetWordType zzerr9[]; +extern SetWordType setwd2[]; +extern SetWordType zzerr10[]; +extern SetWordType zzerr11[]; +extern SetWordType zzerr12[]; +extern SetWordType zzerr13[]; +extern SetWordType setwd3[]; +extern SetWordType zzerr14[]; +extern SetWordType zzerr15[]; +extern SetWordType zzerr16[]; +extern SetWordType zzerr17[]; +extern SetWordType zzerr18[]; +extern SetWordType zzerr19[]; +extern SetWordType zzerr20[]; +extern SetWordType zzerr21[]; +extern SetWordType setwd4[]; +extern SetWordType zzerr22[]; +extern SetWordType zzerr23[]; +extern SetWordType zzerr24[]; +extern SetWordType zzerr25[]; +extern SetWordType zzerr26[]; +extern SetWordType setwd5[]; +extern SetWordType zzerr27[]; +extern SetWordType zzerr28[]; +extern SetWordType zzerr29[]; +extern SetWordType zzerr30[]; +extern SetWordType zzerr31[]; +extern SetWordType zzerr32[]; +extern SetWordType zzerr33[]; +extern SetWordType setwd6[]; +extern SetWordType zzerr34[]; +extern SetWordType zzerr35[]; +extern SetWordType zzerr36[]; +extern SetWordType zzerr37[]; +extern SetWordType zzerr38[]; +extern SetWordType zzerr39[]; +extern SetWordType zzerr40[]; +extern SetWordType zzerr41[]; +extern SetWordType zzerr42[]; +extern SetWordType setwd7[]; +extern SetWordType zzerr43[]; +extern SetWordType zzerr44[]; +extern SetWordType zzerr45[]; +extern SetWordType zzerr46[]; +extern SetWordType zzerr47[]; +extern SetWordType zzerr48[]; +extern SetWordType zzerr49[]; +extern SetWordType zzerr50[]; +extern SetWordType zzerr51[]; +extern SetWordType zzerr52[]; +extern SetWordType zzerr53[]; +extern SetWordType setwd8[]; +extern SetWordType zzerr54[]; +extern SetWordType zzerr55[]; +extern SetWordType zzerr56[]; +extern SetWordType zzerr57[]; +extern SetWordType setwd9[]; +extern SetWordType zzerr58[]; +extern SetWordType zzerr59[]; +extern SetWordType zzerr60[]; +extern SetWordType zzerr61[]; +extern SetWordType zzerr62[]; +extern SetWordType zzerr63[]; +extern SetWordType zzerr64[]; +extern SetWordType zzerr65[]; +extern SetWordType setwd10[]; +extern SetWordType setwd11[]; diff --git a/pccts/dlg/Makefile.am b/pccts/dlg/Makefile.am new file mode 100644 index 0000000..8a608b0 --- /dev/null +++ b/pccts/dlg/Makefile.am @@ -0,0 +1,7 @@ +noinst_PROGRAMS = dlg + +dlg_SOURCES = automata.c dlg_a.c dlg_p.c err.c main.c output.c relabel.c set.c support.c dlg.h mode.h stdpccts.h tokens.h + +AM_CFLAGS = -DUSER_ZZSYN -DZZLEXBUFSIZE=32000 + +INCLUDES = -I../h diff --git a/pccts/dlg/Makefile.in b/pccts/dlg/Makefile.in new file mode 100644 index 0000000..ad1d7c6 --- /dev/null +++ b/pccts/dlg/Makefile.in @@ -0,0 +1,446 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = dlg$(EXEEXT) +subdir = pccts/dlg +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am_dlg_OBJECTS = automata.$(OBJEXT) dlg_a.$(OBJEXT) dlg_p.$(OBJEXT) \ + err.$(OBJEXT) main.$(OBJEXT) output.$(OBJEXT) \ + relabel.$(OBJEXT) set.$(OBJEXT) support.$(OBJEXT) +dlg_OBJECTS = $(am_dlg_OBJECTS) +dlg_LDADD = $(LDADD) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(dlg_SOURCES) +DIST_SOURCES = $(dlg_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AO_CFLAGS = @AO_CFLAGS@ +AO_LIBS = @AO_LIBS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COND_MP3_FALSE = @COND_MP3_FALSE@ +COND_MP3_TRUE = @COND_MP3_TRUE@ +COND_OGG_FALSE = @COND_OGG_FALSE@ +COND_OGG_TRUE = @COND_OGG_TRUE@ +COND_PCCTS_FALSE = @COND_PCCTS_FALSE@ +COND_PCCTS_TRUE = @COND_PCCTS_TRUE@ +COND_SCSILIB_FALSE = @COND_SCSILIB_FALSE@ +COND_SCSILIB_TRUE = @COND_SCSILIB_TRUE@ +COND_TOC2MP3_FALSE = @COND_TOC2MP3_FALSE@ +COND_TOC2MP3_TRUE = @COND_TOC2MP3_TRUE@ +COND_XDAO_FALSE = @COND_XDAO_FALSE@ +COND_XDAO_TRUE = @COND_XDAO_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ +GTKMM2_CFLAGS = @GTKMM2_CFLAGS@ +GTKMM2_LIBS = @GTKMM2_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LAME_CFLAGS = @LAME_CFLAGS@ +LAME_LIBS = @LAME_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBGUIMM2_CFLAGS = @LIBGUIMM2_CFLAGS@ +LIBGUIMM2_LIBS = @LIBGUIMM2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAD_CFLAGS = @MAD_CFLAGS@ +MAD_LIBS = @MAD_LIBS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIGCPP2_CFLAGS = @SIGCPP2_CFLAGS@ +SIGCPP2_LIBS = @SIGCPP2_LIBS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +VORBISFILE_CFLAGS = @VORBISFILE_CFLAGS@ +VORBISFILE_LIBS = @VORBISFILE_LIBS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +antlr_path = @antlr_path@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +dao_src = @dao_src@ +datadir = @datadir@ +dlg_path = @dlg_path@ +en_cdrdao = @en_cdrdao@ +en_cue2toc = @en_cue2toc@ +en_toc2cue = @en_toc2cue@ +en_toc2mp3 = @en_toc2mp3@ +en_xdao = @en_xdao@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydefs = @mydefs@ +oldincludedir = @oldincludedir@ +pcctsinc = @pcctsinc@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +scsilib_dir = @scsilib_dir@ +scsilib_incl = @scsilib_incl@ +scsilib_libs = @scsilib_libs@ +scsilib_objs = @scsilib_objs@ +sharedstatedir = @sharedstatedir@ +sound_if_obj = @sound_if_obj@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +thread_libs = @thread_libs@ +dlg_SOURCES = automata.c dlg_a.c dlg_p.c err.c main.c output.c relabel.c set.c support.c dlg.h mode.h stdpccts.h tokens.h +AM_CFLAGS = -DUSER_ZZSYN -DZZLEXBUFSIZE=32000 +INCLUDES = -I../h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu pccts/dlg/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu pccts/dlg/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstPROGRAMS: + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) +dlg$(EXEEXT): $(dlg_OBJECTS) $(dlg_DEPENDENCIES) + @rm -f dlg$(EXEEXT) + $(LINK) $(dlg_LDFLAGS) $(dlg_OBJECTS) $(dlg_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/automata.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dlg_a.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dlg_p.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/err.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/output.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/relabel.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/support.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstPROGRAMS ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/pccts/dlg/automata.c b/pccts/dlg/automata.c new file mode 100644 index 0000000..194e206 --- /dev/null +++ b/pccts/dlg/automata.c @@ -0,0 +1,353 @@ +/* Automata conversion functions for DLG + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * DLG 1.33 + * Will Cohen + * With mods by Terence Parr; AHPCRC, University of Minnesota + * 1989-2001 + */ + +#include <stdio.h> +#include "pcctscfg.h" +#include "dlg.h" +#ifdef MEMCHK +#include "trax.h" +#else +#ifdef __STDC__ +#include <stdlib.h> +#else +#include <malloc.h> +#endif /* __STDC__ */ +#endif + +#define hash_list struct _hash_list_ +hash_list{ + hash_list *next; /* next thing in list */ + dfa_node *node; + }; + +int dfa_allocated = 0; /* keeps track of number of dfa nodes */ +dfa_node **dfa_array; /* root of binary tree that stores dfa array */ +dfa_node *dfa_model_node; +hash_list *dfa_hash[HASH_SIZE]; /* used to quickly find */ + /* desired dfa node */ + +void +#ifdef __USE_PROTOS +make_dfa_model_node(int width) +#else +make_dfa_model_node(width) +int width; +#endif +{ + register int i; + dfa_model_node = (dfa_node*) malloc(sizeof(dfa_node) + + sizeof(int)*width); + dfa_model_node->node_no = -1; /* impossible value for real dfa node */ + dfa_model_node->dfa_set = 0; + dfa_model_node->alternatives = FALSE; + dfa_model_node->done = FALSE; + dfa_model_node->nfa_states = empty; + for(i = 0; i<width; i++){ + dfa_model_node->trans[i] = NIL_INDEX; + } +} + + +/* adds a new nfa to the binary tree and returns a pointer to it */ +dfa_node * +#ifdef __USE_PROTOS +new_dfa_node(set nfa_states) +#else +new_dfa_node(nfa_states) +set nfa_states; +#endif +{ + register int j; + register dfa_node *t; + static int dfa_size=0; /* elements dfa_array[] can hold */ + + ++dfa_allocated; + if (dfa_size<=dfa_allocated){ + /* need to redo array */ + if (!dfa_array){ + /* need some to do inital allocation */ + dfa_size=dfa_allocated+DFA_MIN; + dfa_array=(dfa_node **) malloc(sizeof(dfa_node*)* + dfa_size); + }else{ + /* need more space */ + dfa_size=2*(dfa_allocated+1); + dfa_array=(dfa_node **) realloc(dfa_array, + sizeof(dfa_node*)*dfa_size); + } + } + /* fill out entry in array */ + t = (dfa_node*) malloc(sizeof(nfa_node)+sizeof(int)*class_no); + *t = *dfa_model_node; + for (j=0; j<class_no; ++j) + t->trans[j] = NIL_INDEX; + t->node_no = dfa_allocated; + t->nfa_states = set_dup(nfa_states); + dfa_array[dfa_allocated] = t; + return t; +} + + +/* past a pointer to the start start of the nfa graph + * nfa_to_dfa convers this graph to dfa. The function returns + * a pointer to the first dfa state. + * NOTE: The function that prints out the table will have to figure out how + * to find the other dfa states given the first dfa_state and the number of dfa + * nodes allocated + */ +dfa_node ** +#ifdef __USE_PROTOS +nfa_to_dfa(nfa_node *start) +#else +nfa_to_dfa(start) +nfa_node *start; +#endif +{ + register dfa_node *d_state, *trans_d_state; + register int a; + set t; + int last_done; + unsigned *nfa_list; + unsigned *reach_list; + + reach_list = (unsigned *) malloc((2+nfa_allocated)*sizeof(unsigned)); + if (!start) return NULL; + t = set_of(NFA_NO(start)); + _set_pdq(t,reach_list); + closure(&t,reach_list); + /* Make t a dfa state */ + d_state = dfastate(t); + last_done = DFA_NO(d_state); + + do { + /* Mark dfa state x as "done" */ + d_state->done = TRUE; + nfa_list = set_pdq(d_state->nfa_states); + for (a = 0; a<class_no; ++a) { + /* Add NFA states reached by a from d_state */ + reach(nfa_list,a,reach_list); + /* Were any states found? */ + if ((*reach_list)!=nil) { + /* was t=empty; */ + set_free(t); + /* yes, compute closure */ + closure(&t,reach_list); + /* Make DFA state of it ... */ + trans_d_state = dfastate(t); + /* And make transition x->t, labeled with a */ + d_state->trans[a] = DFA_NO(trans_d_state); + d_state->alternatives = TRUE; + } + } + free(nfa_list); + ++last_done; /* move forward in queue */ + /* And so forth until nothing isn't done */ + d_state = DFA(last_done); + } while (last_done<=dfa_allocated); + + free(reach_list); + set_free(t); + + /* returns pointer to the array that holds the automaton */ + return dfa_array; +} + +void +#ifdef __USE_PROTOS +clear_hash(void) +#else +clear_hash() +#endif +{ + register int i; + + for(i=0; i<HASH_SIZE; ++i) + dfa_hash[i] = 0; +} + +#if HASH_STAT +void +#ifdef __USE_PROTOS +fprint_hash_stats(FILE *f) +#else +fprint_hash_stats(f) +FILE *f; +#endif +{ + register hash_list *p; + register int i,j; + register total; + + total=0; + for(i=0; i<HASH_SIZE; ++i){ + j=0; + p = dfa_hash[i]; + while(p){ + ++j; + p = p->next; + } + total+=j; + fprintf(f,"bin[%d] has %d\n",i,j); + } + fprintf(f,"total = %d\n",total); +} +#endif + +/* Returns a pointer to a dfa node that has the same nfa nodes in it. + * This may or maynot be a newly created node. + */ +dfa_node * +#ifdef __USE_PROTOS +dfastate(set nfa_states) +#else +dfastate(nfa_states) +set nfa_states; +#endif +{ + register hash_list *p; + int bin; + + /* hash using set and see if it exists */ + bin = set_hash(nfa_states,HASH_SIZE); + p = dfa_hash[bin]; + while(p && !set_equ(nfa_states,(p->node)->nfa_states)){ + p = p->next; + } + if(!p){ + /* next state to add to hash table */ + p = (hash_list*)malloc(sizeof(hash_list)); + p->node = new_dfa_node(nfa_states); + p->next = dfa_hash[bin]; + dfa_hash[bin] = p; + } + return (p->node); +} + + +/* this reach assumes the closure has been done already on set */ +int +#ifdef __USE_PROTOS +reach(unsigned *nfa_list, register int a, unsigned *reach_list) +#else +reach(nfa_list, a, reach_list) +unsigned *nfa_list; +register int a; +unsigned *reach_list; +#endif +{ + register unsigned *e; + register nfa_node *node; + int t=0; + + e = nfa_list; + if (e){ + while (*e != nil){ + node = NFA(*e); + if (set_el(a,node->label)){ + t=1; + *reach_list=NFA_NO(node->trans[0]); + ++reach_list; + } + ++e; + } + } + *reach_list=nil; + return t; +} + +/* finds all the nodes that can be reached by epsilon transitions + from the set of a nodes and returns puts them back in set b */ +set +#ifdef __USE_PROTOS +closure(set *b, unsigned *reach_list) +#else +closure(b, reach_list) +set *b; +unsigned *reach_list; +#endif +{ + register nfa_node *node,*n; /* current node being examined */ + register unsigned *e; + + ++operation_no; +#if 0 + t = e = set_pdq(*b); +#else + e=reach_list; +#endif + while (*e != nil){ + node = NFA(*e); + set_orel(NFA_NO(node),b); + /* mark it done */ + node->nfa_set = operation_no; + if ((n=node->trans[0]) != NIL_INDEX && set_nil(node->label) && + (n->nfa_set != operation_no)){ + /* put in b */ + set_orel(NFA_NO(n),b); + close1(n,operation_no,b); + } + if ((n=node->trans[1]) != NIL_INDEX && + (n->nfa_set != operation_no)){ + /* put in b */ + set_orel(NFA_NO(node->trans[1]),b); + close1(n,operation_no,b); + } + ++e; + } +#if 0 + free(t); +#endif + return *b; +} + +#ifdef __USE_PROTOS +void close1(nfa_node *node, int o, set *b) +#else +void close1(node,o,b) +nfa_node *node; +int o; /* marker to avoid cycles */ +set *b; +#endif +{ + register nfa_node *n; /* current node being examined */ + + /* mark it done */ + node->nfa_set = o; + if ((n=node->trans[0]) != NIL_INDEX && set_nil(node->label) && + (n->nfa_set != o)){ + /* put in b */ + set_orel(NFA_NO(n),b); + close1(n,o,b); + } + if ((n=node->trans[1]) != NIL_INDEX && + (n->nfa_set != o)){ + /* put in b */ + set_orel(NFA_NO(node->trans[1]),b); + close1(n,o,b); + } +} diff --git a/pccts/dlg/dlg.h b/pccts/dlg/dlg.h new file mode 100644 index 0000000..38ab01a --- /dev/null +++ b/pccts/dlg/dlg.h @@ -0,0 +1,250 @@ +/* dlg header file + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * DLG 1.33 + * Will Cohen + * With mods by Terence Parr; AHPCRC, University of Minnesota + * 1989-2001 + */ + +/* MR1 Move pcctscfg.h to top of file */ + +#include "pcctscfg.h" + +/* turn off warnings for unreferenced labels */ + +#ifdef _MSC_VER +#pragma warning(disable:4102) +#endif + +#include "set.h" + +#define TRUE 1 +#define FALSE 0 + +/***** output related stuff *******************/ +#define IN input_stream +#define OUT output_stream + +#define MAX_MODES 50 /* number of %%names allowed */ +#define MAX_ON_LINE 10 + +#define NFA_MIN 64 /* minimum nfa_array size */ +#define DFA_MIN 64 /* minimum dfa_array size */ + +#define DEFAULT_CLASSNAME "DLGLexer" + +/* these macros allow the size of the character set to be easily changed */ +/* NOTE: do NOT change MIN_CHAR since EOF is the lowest char, -1 */ +#define MIN_CHAR (-1) /* lowest possible character possible on input */ +#define MAX_CHAR 255 /* highest possible character possible on input */ +#define CHAR_RANGE (1+(MAX_CHAR) - (MIN_CHAR)) + +/* indicates that the not an "array" reference */ +#define NIL_INDEX 0 + +/* size of hash table used to find dfa_states quickly */ +#define HASH_SIZE 211 + +#define nfa_node struct _nfa_node +nfa_node { + int node_no; + int nfa_set; + int accept; /* what case to use */ + nfa_node *trans[2]; + set label; /* one arc always labelled with epsilon */ +}; + +#define dfa_node struct _dfa_node +dfa_node { + int node_no; + int dfa_set; + int alternatives; /* used for interactive mode */ + /* are more characters needed */ + int done; + set nfa_states; + int trans[1];/* size of transition table depends on + * number of classes required for automata. + */ + + +}; + +/******** macros for accessing the NFA and DFA nodes ****/ +#define NFA(x) (nfa_array[x]) +#define DFA(x) (dfa_array[x]) +#define DFA_NO(x) ( (x) ? (x)->node_no : NIL_INDEX) +#define NFA_NO(x) ( (x) ? (x)->node_no : NIL_INDEX) + +/******** wrapper for memory checking ***/ +/*#define malloc(x) dlg_malloc((x),__FILE__,__LINE__)*/ + +/*#define calloc(x,y) dlg_calloc((x),(y),__FILE__,__LINE__)*/ + +/******** antlr attributes *************/ +typedef struct { + unsigned char letter; + nfa_node *l,*r; + set label; + } Attrib; + +#define zzcr_attr(attr, token, text) { \ + (attr)->letter = text[0]; (attr)->l = NULL; \ + (attr)->r = NULL; (attr)->label = empty; \ +} +#define zzd_attr(a) set_free((a)->label); + +/******************** Variable ******************************/ +extern char program[]; /* tells what program this is */ +extern char version[]; /* tells what version this is */ +extern char *file_str[]; /* file names being used */ +extern int err_found; /* flag to indicate error occured */ +extern int action_no; /* last action function printed */ +extern int func_action; /* should actions be turned into functions?*/ +extern set used_chars; /* used to label trans. arcs */ +extern set used_classes; /* classes or chars used to label trans. arcs */ +extern int class_no; /* number of classes used */ +extern set class_sets[]; /* shows char. in each class */ +extern set normal_chars; /* mask off unused portion of set */ +extern int comp_level; /* what compression level to use */ +extern int interactive; /* interactive scanner (avoid lookahead)*/ +extern int mode_counter; /* keeps track of the number of %%name */ +extern int dfa_basep[]; /* start of each group of dfa */ +extern int dfa_class_nop[];/* number of transistion arcs in */ + /* each dfa in each mode */ +extern int nfa_allocated; +extern int dfa_allocated; +extern nfa_node **nfa_array; /* start of nfa "array" */ +extern dfa_node **dfa_array; /* start of dfa "array" */ +extern int operation_no; /* unique number for each operation */ +extern FILE *input_stream; /* where description read from */ +extern FILE *output_stream; /* where to put the output */ +extern FILE *mode_stream; /* where to put the mode output */ +extern FILE *class_stream; +extern char *mode_file; /* name of file for mode output */ +extern int gen_ansi; /* produce ansi compatible code */ +extern int case_insensitive;/* ignore case of input spec. */ +extern int warn_ambig; /* show if regular expressions ambiguous */ +extern int gen_cpp; +extern char *cl_file_str; +extern int firstLexMember; /* MR1 */ +extern char *OutputDirectory; +extern char *class_name; + +/******************** Functions ******************************/ +#ifdef __USE_PROTOS +extern char *dlg_malloc(int, char *, int); /* wrapper malloc */ +extern char *dlg_calloc(int, int, char *, int); /* wrapper calloc */ +extern int reach(unsigned *, register int, unsigned *); +extern set closure(set *, unsigned *); +extern dfa_node *new_dfa_node(set); +extern nfa_node *new_nfa_node(void); +extern dfa_node *dfastate(set); +extern dfa_node **nfa_to_dfa(nfa_node *); +extern void internal_error(char *, char *, int); /* MR9 23-Sep-97 */ +extern FILE *read_stream(char *); /* opens file for reading */ +extern FILE *write_stream(char *); /* opens file for writing */ +extern void make_nfa_model_node(void); +extern void make_dfa_model_node(int); +extern char *ClassName(char *); +extern char *OutMetaName(char *); +extern void error(char*, int); +extern void warning(char*, int); +extern void p_head(void); +extern void p_class_hdr(void); +extern void p_includes(void); +extern void p_tables(void); +extern void p_tail(void); /* MR1 */ +extern void p_class_def1(void); /* MR1 */ +extern void new_automaton_mode(void); /* MR1 */ +extern int relabel(nfa_node *,int); /* MR1 */ +extern void p_shift_table(int); /* MR1 */ +extern void p_bshift_table(void); /* MR1 */ +extern void p_class_table(void); /* MR1 */ +extern void p_mode_def(char *,int); /* MR1 */ +extern void init(void); /* MR1 */ +extern void p_class_def2(void); /* MR1 */ +extern void clear_hash(void); /* MR1 */ +extern void p_alternative_table(void); /* MR1 */ +extern void p_node_table(void); /* MR1 */ +extern void p_dfa_table(void); /* MR1 */ +extern void p_accept_table(void); /* MR1 */ +extern void p_action_table(void); /* MR1 */ +extern void p_base_table(void); /* MR1 */ +extern void p_single_node(int,int); /* MR1 */ +extern char * minsize(int); /* MR1 */ +extern void close1(nfa_node *,int,set *); /* MR1 */ +extern void partition(nfa_node *,int); /* MR1 */ +extern void intersect_nfa_labels(nfa_node *,set *); /* MR1 */ +extern void r_intersect(nfa_node *,set *); /* MR1 */ +extern void label_node(nfa_node *); /* MR1 */ +extern void label_with_classes(nfa_node *); /* MR1 */ + +#else +extern char *dlg_malloc(); /* wrapper malloc */ +extern char *dlg_calloc(); /* wrapper calloc */ +extern int reach(); +extern set closure(); +extern dfa_node *new_dfa_node(); +extern nfa_node *new_nfa_node(); +extern dfa_node *dfastate(); +extern dfa_node **nfa_to_dfa(); +extern void internal_error(); /* MR9 23-Sep-97 */ +extern FILE *read_stream(); /* opens file for reading */ +extern FILE *write_stream(); /* opens file for writing */ +extern void make_nfa_model_node(); +extern void make_dfa_model_node(); +extern char *ClassName(); +extern char *OutMetaName(); +extern void error(); +extern void warning(); +extern void p_head(); /* MR9 */ +extern void p_class_hdr(); /* MR9 */ +extern void p_includes(); /* MR9 */ +extern void p_tables(); /* MR9 */ +extern void p_tail(); /* MR1 */ +extern void p_class_def1(); /* MR1 */ +extern void new_automaton_mode(); /* MR1 */ +extern int relabel(); /* MR1 */ +extern void p_shift_table(); /* MR1 */ +extern void p_bshift_table(); /* MR1 */ +extern void p_class_table(); /* MR1 */ +extern void p_mode_def(); /* MR1 */ +extern void init(); /* MR1 */ +extern void p_class_def2(); /* MR1 */ +extern void clear_hash(); /* MR1 */ +extern void p_alternative_table(); /* MR1 */ +extern void p_node_table(); /* MR1 */ +extern void p_dfa_table(); /* MR1 */ +extern void p_accept_table(); /* MR1 */ +extern void p_action_table(); /* MR1 */ +extern void p_base_table(); /* MR1 */ +extern void p_single_node(); /* MR1 */ +extern char * minsize(); /* MR1 */ +extern void close1(); /* MR1 */ +extern void partition(); /* MR1 */ +extern void intersect_nfa_labels(); /* MR1 */ +extern void r_intersect(); /* MR1 */ +extern void label_node(); /* MR1 */ +extern void label_with_classes(); /* MR1 */ + +#endif diff --git a/pccts/dlg/dlg_a.c b/pccts/dlg/dlg_a.c new file mode 100644 index 0000000..7cdba86 --- /dev/null +++ b/pccts/dlg/dlg_a.c @@ -0,0 +1,1414 @@ + +/* parser.dlg -- DLG Description of scanner + * + * Generated from: dlg_p.g + * + * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001 + * Purdue University Electrical Engineering + * With AHPCRC, University of Minnesota + * ANTLR Version 1.33MR32 + */ + +#define ANTLR_VERSION 13332 +#include "pcctscfg.h" +#include "pccts_stdio.h" + +#include <ctype.h> +#include "dlg.h" +#include "antlr.h" +#include "tokens.h" +#include "dlgdef.h" +LOOKAHEAD + +void +#ifdef __USE_PROTOS +zzerraction(void) +#else +zzerraction() +#endif +{ + (*zzerr)("invalid token"); + zzadvance(); + zzskip(); +} +/* + * D L G tables + * + * Generated from: parser.dlg + * + * 1989-2001 by Will Cohen, Terence Parr, and Hank Dietz + * Purdue University Electrical Engineering + * DLG Version 1.33MR32 + */ + +#include "mode.h" + + + + +int func_action; /* should actions be turned into functions?*/ +int lex_mode_counter = 0; /* keeps track of the number of %%names */ +/* MR1 */ +/* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */ +/* MR1 via <<%%lexmember...>> */ +/* MR1 */ +int lexMember = 0; /* <<%%lexmemeber ...>> MR1 */ +int lexAction = 0; /* <<%%lexaction ...>> MR1 */ +int parserClass = 0; /* <<%%parserclass ...>> MR1 */ +int lexPrefix = 0; /* <<%%lexprefix ...>> MR1 */ +char theClassName[100]; /* MR11 */ +char *pClassName=theClassName; /* MR11 */ +int firstLexMember=1; /* MR1 */ + +#ifdef __USE_PROTOS +void xxputc(int c) { /* MR1 */ +#else + void xxputc(c) /* MR1 */ + int c; /* MR1 */ + { /* MR1 */ +#endif + if (parserClass) { /* MR1 */ + *pClassName++=c; /* MR1 */ + *pClassName=0; /* MR1 */ + } else if (lexMember || lexPrefix) { /* MR1 */ + if (class_stream != NULL) fputc(c,class_stream); /* MR1 */ + } else { /* MR1 */ + fputc(c,OUT); /* MR1 */ + }; /* MR1 */ + } /* MR1 */ + +#ifdef __USE_PROTOS + void xxprintf(char *format,char *string) { /* MR1 */ +#else + void xxprintf(format,string) /* MR1 */ + char *format; /* MR1 */ + char *string; /* MR1 */ + { /* MR1 */ +#endif + if (lexMember || lexPrefix || parserClass) { /* MR1 */ + if (class_stream != NULL) /* MR1 */ + fprintf(class_stream,format,string); /* MR1 */ + } else { /* MR1 */ + fprintf(OUT,format,string); /* MR1 */ + }; /* MR1 */ + } /* MR1 */ + +static void act1() +{ + NLA = 1; + } + + +static void act2() +{ + NLA = 2; + zzskip(); + } + + +static void act3() +{ + NLA = 3; + zzline++; zzskip(); DAWDLE; + } + + +static void act4() +{ + NLA = L_EOF; + } + + +static void act5() +{ + NLA = PER_PER; + } + + +static void act6() +{ + NLA = NAME_PER_PER; + p_mode_def(&zzlextext[2],lex_mode_counter++); + } + + +static void act7() +{ + NLA = LEXMEMBER; + lexMember=1; /* MR1 */ + if (firstLexMember != 0) { /* MR1 */ + firstLexMember=0; /* MR1 */ + p_class_def1(); /* MR1 */ + }; /* MR1 */ + zzmode(ACT); /* MR1 */ + } + + +static void act8() +{ + NLA = LEXACTION; + lexAction=1;zzmode(ACT); + } + + +static void act9() +{ + NLA = PARSERCLASS; + parserClass=1; /* MR1 */ + zzmode(ACT); /* MR1 */ + } + + +static void act10() +{ + NLA = LEXPREFIX; + lexPrefix=1;zzmode(ACT); + } + + +static void act11() +{ + NLA = ACTION; + if (func_action) + fprintf(OUT,"\n%s %sact%d()\n{ ", + gen_cpp?"ANTLRTokenType":"static void", + gen_cpp?ClassName("::"):"", ++action_no); + zzmode(ACT); zzskip(); + } + + +static void act12() +{ + NLA = GREAT_GREAT; + } + + +static void act13() +{ + NLA = L_BRACE; + } + + +static void act14() +{ + NLA = R_BRACE; + } + + +static void act15() +{ + NLA = L_PAR; + } + + +static void act16() +{ + NLA = R_PAR; + } + + +static void act17() +{ + NLA = L_BRACK; + } + + +static void act18() +{ + NLA = R_BRACK; + } + + +static void act19() +{ + NLA = ZERO_MORE; + } + + +static void act20() +{ + NLA = ONE_MORE; + } + + +static void act21() +{ + NLA = OR; + } + + +static void act22() +{ + NLA = RANGE; + } + + +static void act23() +{ + NLA = NOT; + } + + +static void act24() +{ + NLA = OCTAL_VALUE; + {int t; sscanf(&zzlextext[1],"%o",&t); zzlextext[0] = t;} + } + + +static void act25() +{ + NLA = HEX_VALUE; + {int t; sscanf(&zzlextext[3],"%x",&t); zzlextext[0] = t;} + } + + +static void act26() +{ + NLA = DEC_VALUE; + {int t; sscanf(&zzlextext[1],"%d",&t); zzlextext[0] = t;} + } + + +static void act27() +{ + NLA = TAB; + zzlextext[0] = '\t'; + } + + +static void act28() +{ + NLA = NL; + zzlextext[0] = '\n'; + } + + +static void act29() +{ + NLA = CR; + zzlextext[0] = '\r'; + } + + +static void act30() +{ + NLA = BS; + zzlextext[0] = '\b'; + } + + +static void act31() +{ + NLA = CONTINUATION; + zzline++; zzskip(); + } + + +static void act32() +{ + NLA = LIT; + zzlextext[0] = zzlextext[1]; + } + + +static void act33() +{ + NLA = REGCHAR; + } + +static unsigned char shift0[257] = { + 0, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 1, 2, 40, 40, 1, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 1, 40, 40, 40, 40, 4, 40, + 40, 30, 31, 34, 35, 40, 37, 40, 40, 23, + 24, 24, 24, 24, 24, 24, 24, 25, 25, 40, + 40, 26, 40, 27, 40, 3, 21, 21, 21, 21, + 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, + 22, 22, 22, 22, 22, 22, 22, 22, 22, 20, + 22, 22, 32, 39, 33, 40, 22, 40, 11, 9, + 12, 21, 6, 19, 22, 22, 14, 22, 22, 5, + 8, 16, 15, 17, 22, 10, 18, 13, 22, 22, + 22, 7, 22, 22, 28, 36, 29, 38, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40, 40, 40, 40, + 40, 40, 40, 40, 40, 40, 40 +}; + + +static void act34() +{ + NLA = 1; + error("unterminated action", zzline); zzmode(START); + } + + +static void act35() +{ + NLA = ACTION; + if (func_action) fprintf(OUT,"}\n\n"); + zzmode(START); + /* MR1 */ + /* MR1 11-Apr-97 Provide mechanism for inserting code into DLG class */ + /* MR1 via <<%%lexmember ...>> */ + /* MR1 This is a consequence of not saving actions */ + /* MR1 */ + /* MR1 */ parserClass=0; + /* MR1 */ lexPrefix=0; + /* MR1 */ lexAction=0; + /* MR1 */ lexMember=0; + } + + +static void act36() +{ + NLA = 34; + xxputc(zzlextext[0]); zzskip(); + } + + +static void act37() +{ + NLA = 35; + xxputc('>'); zzskip(); + } + + +static void act38() +{ + NLA = 36; + xxputc('\\'); zzskip(); + } + + +static void act39() +{ + NLA = 37; + xxputc(zzlextext[0]); ++zzline; zzskip(); + } + + +static void act40() +{ + NLA = 38; + zzmode(ACTION_COMMENTS); /* MR1 */ + xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */ + } + + +static void act41() +{ + NLA = 39; + zzmode(ACTION_CPP_COMMENTS); /* MR1 */ + xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */ + } + + +static void act42() +{ + NLA = 40; + xxputc(zzlextext[0]); zzskip(); + } + +static unsigned char shift1[257] = { + 0, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 3, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 5, 6, 6, 6, 6, 4, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 1, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 2, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6 +}; + + +static void act43() +{ + NLA = 1; + } + + +static void act44() +{ + NLA = 41; + zzmode(ACT); /* MR1 */ + xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */ + } + + +static void act45() +{ + NLA = 42; + zzline++; xxputc(zzlextext[0]); zzskip(); + } + + +static void act46() +{ + NLA = 43; + xxputc(zzlextext[0]); zzskip(); + } + +static unsigned char shift2[257] = { + 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 3, 4, 4, 3, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 1, 4, 4, 4, 4, 2, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4 +}; + + +static void act47() +{ + NLA = 1; + } + + +static void act48() +{ + NLA = 44; + zzmode(ACT); zzline++; /* MR1 */ + xxprintf("%s", &(zzlextext[0])); zzskip(); /* MR1 */ + } + + +static void act49() +{ + NLA = 45; + xxputc(zzlextext[0]); zzskip(); + } + +static unsigned char shift3[257] = { + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 1, 2, 2, 1, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2 +}; + +#define DfaStates 94 +typedef unsigned char DfaState; + +static DfaState st0[42] = { + 1, 2, 3, 4, 5, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 6, 6, 6, 6, 6, 6, 7, 8, 9, 10, + 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 6, 94 +}; + +static DfaState st1[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st2[42] = { + 94, 21, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st3[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st4[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st5[42] = { + 94, 94, 94, 94, 22, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st6[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st7[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 23, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st8[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 24, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st9[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st10[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st11[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st12[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st13[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st14[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st15[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st16[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st17[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st18[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st19[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st20[42] = { + 94, 25, 26, 25, 25, 25, 25, 25, 25, 27, + 28, 25, 25, 29, 25, 25, 30, 25, 25, 25, + 25, 25, 25, 31, 32, 32, 25, 25, 25, 25, + 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, + 25, 94 +}; + +static DfaState st21[42] = { + 94, 21, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st22[42] = { + 94, 94, 94, 94, 94, 33, 33, 33, 33, 33, + 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, + 33, 33, 33, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st23[42] = { + 94, 94, 94, 94, 34, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st24[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st25[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st26[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st27[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st28[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st29[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st30[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st31[42] = { + 94, 94, 94, 94, 94, 94, 94, 35, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 35, 94, 94, 36, 36, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st32[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 37, 37, 37, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st33[42] = { + 94, 94, 94, 94, 94, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st34[42] = { + 94, 94, 94, 94, 39, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st35[42] = { + 94, 94, 94, 94, 94, 94, 40, 94, 94, 40, + 94, 40, 40, 94, 94, 94, 94, 94, 94, 40, + 94, 40, 94, 40, 40, 40, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st36[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 36, 36, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st37[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 37, 37, 37, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st38[42] = { + 94, 94, 94, 94, 94, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 38, 38, 38, 38, + 38, 38, 38, 38, 38, 38, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st39[42] = { + 94, 94, 94, 94, 94, 41, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 42, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st40[42] = { + 94, 94, 94, 94, 94, 94, 40, 94, 94, 40, + 94, 40, 40, 94, 94, 94, 94, 94, 94, 40, + 94, 40, 94, 40, 40, 40, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st41[42] = { + 94, 94, 94, 94, 94, 94, 43, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st42[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 44, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st43[42] = { + 94, 94, 94, 94, 94, 94, 94, 45, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st44[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 46, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st45[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 47, 94, + 94, 48, 94, 94, 94, 94, 94, 49, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st46[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 50, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st47[42] = { + 94, 94, 94, 94, 94, 94, 51, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st48[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 52, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st49[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 53, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st50[42] = { + 94, 94, 94, 94, 94, 94, 54, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st51[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 55, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st52[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 56, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st53[42] = { + 94, 94, 94, 94, 94, 94, 57, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st54[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 58, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st55[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 59, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st56[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 60, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st57[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 61, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st58[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 62, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st59[42] = { + 94, 94, 94, 94, 94, 94, 63, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st60[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 64, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st61[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 65, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st62[42] = { + 94, 94, 94, 94, 94, 66, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st63[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 67, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st64[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 68, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st65[42] = { + 94, 94, 94, 94, 94, 94, 94, 69, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st66[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 70, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st67[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st68[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st69[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st70[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 71, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st71[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 72, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st72[42] = { + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94 +}; + +static DfaState st73[8] = { + 74, 75, 76, 77, 78, 79, 79, 94 +}; + +static DfaState st74[8] = { + 94, 94, 94, 94, 94, 94, 94, 94 +}; + +static DfaState st75[8] = { + 94, 80, 94, 94, 94, 94, 94, 94 +}; + +static DfaState st76[8] = { + 94, 81, 94, 94, 94, 94, 94, 94 +}; + +static DfaState st77[8] = { + 94, 94, 94, 94, 94, 94, 94, 94 +}; + +static DfaState st78[8] = { + 94, 94, 94, 94, 82, 83, 94, 94 +}; + +static DfaState st79[8] = { + 94, 94, 94, 94, 94, 94, 94, 94 +}; + +static DfaState st80[8] = { + 94, 94, 94, 94, 94, 94, 94, 94 +}; + +static DfaState st81[8] = { + 94, 94, 94, 94, 94, 94, 94, 94 +}; + +static DfaState st82[8] = { + 94, 94, 94, 94, 94, 94, 94, 94 +}; + +static DfaState st83[8] = { + 94, 94, 94, 94, 94, 94, 94, 94 +}; + +static DfaState st84[6] = { + 85, 86, 87, 88, 87, 94 +}; + +static DfaState st85[6] = { + 94, 94, 94, 94, 94, 94 +}; + +static DfaState st86[6] = { + 94, 94, 89, 94, 94, 94 +}; + +static DfaState st87[6] = { + 94, 94, 94, 94, 94, 94 +}; + +static DfaState st88[6] = { + 94, 94, 94, 94, 94, 94 +}; + +static DfaState st89[6] = { + 94, 94, 94, 94, 94, 94 +}; + +static DfaState st90[4] = { + 91, 92, 93, 94 +}; + +static DfaState st91[4] = { + 94, 94, 94, 94 +}; + +static DfaState st92[4] = { + 94, 94, 94, 94 +}; + +static DfaState st93[4] = { + 94, 94, 94, 94 +}; + + +DfaState *dfa[94] = { + st0, + st1, + st2, + st3, + st4, + st5, + st6, + st7, + st8, + st9, + st10, + st11, + st12, + st13, + st14, + st15, + st16, + st17, + st18, + st19, + st20, + st21, + st22, + st23, + st24, + st25, + st26, + st27, + st28, + st29, + st30, + st31, + st32, + st33, + st34, + st35, + st36, + st37, + st38, + st39, + st40, + st41, + st42, + st43, + st44, + st45, + st46, + st47, + st48, + st49, + st50, + st51, + st52, + st53, + st54, + st55, + st56, + st57, + st58, + st59, + st60, + st61, + st62, + st63, + st64, + st65, + st66, + st67, + st68, + st69, + st70, + st71, + st72, + st73, + st74, + st75, + st76, + st77, + st78, + st79, + st80, + st81, + st82, + st83, + st84, + st85, + st86, + st87, + st88, + st89, + st90, + st91, + st92, + st93 +}; + + +DfaState accepts[95] = { + 0, 1, 2, 3, 4, 33, 33, 33, 33, 13, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 0, 2, 5, 11, 12, 32, 31, 30, 29, 27, + 28, 24, 26, 6, 0, 0, 24, 26, 6, 0, + 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 7, 8, 10, + 0, 0, 9, 0, 34, 36, 38, 39, 42, 42, + 35, 37, 41, 40, 0, 43, 46, 46, 45, 44, + 0, 47, 48, 49, 0 +}; + +void (*actions[50])() = { + zzerraction, + act1, + act2, + act3, + act4, + act5, + act6, + act7, + act8, + act9, + act10, + act11, + act12, + act13, + act14, + act15, + act16, + act17, + act18, + act19, + act20, + act21, + act22, + act23, + act24, + act25, + act26, + act27, + act28, + act29, + act30, + act31, + act32, + act33, + act34, + act35, + act36, + act37, + act38, + act39, + act40, + act41, + act42, + act43, + act44, + act45, + act46, + act47, + act48, + act49 +}; + +static DfaState dfa_base[] = { + 0, + 73, + 84, + 90 +}; + +static unsigned char *b_class_no[] = { + shift0, + shift1, + shift2, + shift3 +}; + + + +#define ZZSHIFT(c) (b_class_no[zzauto][1+c]) +#define MAX_MODE 4 +#include "dlgauto.h" diff --git a/pccts/dlg/dlg_p.c b/pccts/dlg/dlg_p.c new file mode 100644 index 0000000..fbe36fe --- /dev/null +++ b/pccts/dlg/dlg_p.c @@ -0,0 +1,943 @@ +/* + * A n t l r T r a n s l a t i o n H e a d e r + * + * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001 + * Purdue University Electrical Engineering + * With AHPCRC, University of Minnesota + * ANTLR Version 1.33MR32 + * + * ..\bin\antlr dlg_p.g -gh + * + */ + +#define ANTLR_VERSION 13332 +#include "pcctscfg.h" +#include "pccts_stdio.h" + +#include <ctype.h> +#include "dlg.h" +#define zzSET_SIZE 8 +#include "antlr.h" +#include "tokens.h" +#include "dlgdef.h" +#include "mode.h" + +/* MR23 In order to remove calls to PURIFY use the antlr -nopurify option */ + +#ifndef PCCTS_PURIFY +#define PCCTS_PURIFY(r,s) memset((char *) &(r),'\0',(s)); +#endif + +ANTLR_INFO + + +/* MR20 G. Hobbelt +Fix for Borland C++ 4.x & 5.x compiling with ALL warnings enabled +*/ + +#ifdef __TURBOC__ +#pragma warn -aus /* unused assignment of 'xxx' */ +#endif + +int action_no = 0; /* keep track of actions outputed */ +int nfa_allocated = 0; /* keeps track of number of nfa nodes */ +nfa_node **nfa_array = NULL;/* root of binary tree that stores nfa array */ +nfa_node nfa_model_node; /* model to initialize new nodes */ +set used_chars; /* used to label trans. arcs */ +set used_classes; /* classes or chars used to label trans. arcs */ +set normal_chars; /* mask to get rid elements that aren't used +in set */ +int flag_paren = FALSE; +int flag_brace = FALSE; +int mode_counter = 0; /* keep track of number of %%names */ + + + +void +#ifdef __USE_PROTOS +grammar(void) +#else +grammar() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + p_head(); p_class_hdr(); func_action = FALSE; + { + zzBLOCK(zztasp2); + zzMake0; + { + while ( (setwd1[LA(1)]&0x1) ) { + { + zzBLOCK(zztasp3); + zzMake0; + { + if ( (LA(1)==LEXACTION) ) { + zzmatch(LEXACTION); zzCONSUME; + } + else { + if ( (LA(1)==LEXMEMBER) ) { + zzmatch(LEXMEMBER); zzCONSUME; + } + else { + if ( (LA(1)==LEXPREFIX) ) { + zzmatch(LEXPREFIX); zzCONSUME; + } + else { + if ( (LA(1)==PARSERCLASS) ) { + zzmatch(PARSERCLASS); zzCONSUME; + } + else { + if ( (LA(1)==ACTION) ) { + } + else {zzFAIL(1,zzerr1,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + } + } + } + zzEXIT(zztasp3); + } + } + zzmatch(ACTION); zzCONSUME; + zzLOOP(zztasp2); + } + zzEXIT(zztasp2); + } + } + if ( gen_cpp ) p_includes(); + start_states(); + func_action = FALSE; p_tables(); p_tail(); + { + zzBLOCK(zztasp2); + zzMake0; + { + while ( (LA(1)==ACTION) ) { + zzmatch(ACTION); zzCONSUME; + zzLOOP(zztasp2); + } + zzEXIT(zztasp2); + } + } + zzmatch(1); + if (firstLexMember != 0) p_class_def1(); + zzCONSUME; + + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd1, 0x2); + } +} + +void +#ifdef __USE_PROTOS +start_states(void) +#else +start_states() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==PER_PER) ) { + zzmatch(PER_PER); zzCONSUME; + do_conversion(); + } + else { + if ( (LA(1)==NAME_PER_PER) ) { + zzmatch(NAME_PER_PER); zzCONSUME; + do_conversion(); + { + zzBLOCK(zztasp3); + zzMake0; + { + while ( (LA(1)==NAME_PER_PER) ) { + zzmatch(NAME_PER_PER); zzCONSUME; + do_conversion(); + zzLOOP(zztasp3); + } + zzEXIT(zztasp3); + } + } + } + else {zzFAIL(1,zzerr2,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + zzmatch(PER_PER); zzCONSUME; + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd1, 0x4); + } +} + +void +#ifdef __USE_PROTOS +do_conversion(void) +#else +do_conversion() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + new_automaton_mode(); func_action = TRUE; + rule_list(); + + dfa_class_nop[mode_counter] = + relabel(zzaArg(zztasp1,1 ).l,comp_level); + if (comp_level) + p_shift_table(mode_counter); + dfa_basep[mode_counter] = dfa_allocated+1; + make_dfa_model_node(dfa_class_nop[mode_counter]); + nfa_to_dfa(zzaArg(zztasp1,1 ).l); + ++mode_counter; + func_action = FALSE; +#ifdef HASH_STAT + fprint_hash_stats(stderr); +#endif + zzEXIT(zztasp1); + return; + } +} + +void +#ifdef __USE_PROTOS +rule_list(void) +#else +rule_list() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + if ( (setwd1[LA(1)]&0x10) ) { + rule(); + zzaRet.l=zzaArg(zztasp1,1 ).l; zzaRet.r=zzaArg(zztasp1,1 ).r; + { + zzBLOCK(zztasp2); + zzMake0; + { + while ( (setwd1[LA(1)]&0x20) ) { + rule(); + {nfa_node *t1; + t1 = new_nfa_node(); + (t1)->trans[0]=zzaRet.l; + (t1)->trans[1]=zzaArg(zztasp2,1 ).l; + /* all accept nodes "dead ends" */ + zzaRet.l=t1; zzaRet.r=NULL; + } + zzLOOP(zztasp2); + } + zzEXIT(zztasp2); + } + } + } + else { + if ( (setwd1[LA(1)]&0x40) ) { + zzaRet.l = new_nfa_node(); zzaRet.r = NULL; + warning("no regular expressions", zzline); + } + else {zzFAIL(1,zzerr3,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd1, 0x80); + } +} + +void +#ifdef __USE_PROTOS +rule(void) +#else +rule() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + if ( (setwd2[LA(1)]&0x1) ) { + reg_expr(); + zzmatch(ACTION); + if (zzaArg(zztasp1,1 ).r != NULL) { + zzaRet.l=zzaArg(zztasp1,1 ).l; zzaRet.r=zzaArg(zztasp1,1 ).r; (zzaArg(zztasp1,1 ).r)->accept=action_no; + } + zzCONSUME; + + } + else { + if ( (LA(1)==ACTION) ) { + zzmatch(ACTION); + zzaRet.l = NULL; zzaRet.r = NULL; + error("no expression for action ", zzline); + zzCONSUME; + + } + else {zzFAIL(1,zzerr4,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd2, 0x2); + } +} + +void +#ifdef __USE_PROTOS +reg_expr(void) +#else +reg_expr() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + and_expr(); + zzaRet.l=zzaArg(zztasp1,1 ).l; zzaRet.r=zzaArg(zztasp1,1 ).r; + { + zzBLOCK(zztasp2); + zzMake0; + { + while ( (LA(1)==OR) ) { + zzmatch(OR); zzCONSUME; + and_expr(); + {nfa_node *t1, *t2; + t1 = new_nfa_node(); t2 = new_nfa_node(); + (t1)->trans[0]=zzaRet.l; + (t1)->trans[1]=zzaArg(zztasp2,2 ).l; + /* MR23 */ if (zzaRet.r != NULL) (zzaRet.r)->trans[1]=t2; + if (zzaArg(zztasp2,2 ).r) { + (zzaArg(zztasp2,2 ).r)->trans[1]=t2; /* MR20 */ + } + zzaRet.l=t1; zzaRet.r=t2; + } + zzLOOP(zztasp2); + } + zzEXIT(zztasp2); + } + } + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd2, 0x4); + } +} + +void +#ifdef __USE_PROTOS +and_expr(void) +#else +and_expr() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + repeat_expr(); + + zzaRet.l=zzaArg(zztasp1,1 ).l; zzaRet.r=zzaArg(zztasp1,1 ).r; + { + zzBLOCK(zztasp2); + zzMake0; + { + while ( (setwd2[LA(1)]&0x8) ) { + repeat_expr(); + if (zzaRet.r != NULL) { + (zzaRet.r)->trans[1]=zzaArg(zztasp2,1 ).l; + zzaRet.r=zzaArg(zztasp2,1 ).r; + } + zzLOOP(zztasp2); + } + zzEXIT(zztasp2); + } + } + zzEXIT(zztasp1); + return; + } +} + +void +#ifdef __USE_PROTOS +repeat_expr(void) +#else +repeat_expr() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + if ( (setwd2[LA(1)]&0x20) ) { + expr(); + zzaRet.l=zzaArg(zztasp1,1 ).l; zzaRet.r=zzaArg(zztasp1,1 ).r; + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==ZERO_MORE) ) { + zzmatch(ZERO_MORE); + { nfa_node *t1,*t2; + /* MR23 */ if (zzaRet.r != NULL) (zzaRet.r)->trans[0] = zzaRet.l; + t1 = new_nfa_node(); t2 = new_nfa_node(); + t1->trans[0]=zzaRet.l; + t1->trans[1]=t2; + /* MR23 */ if (zzaRet.r != NULL) (zzaRet.r)->trans[1]=t2; + zzaRet.l=t1;zzaRet.r=t2; + } + zzCONSUME; + + } + else { + if ( (LA(1)==ONE_MORE) ) { + zzmatch(ONE_MORE); + if (zzaRet.r != NULL) (zzaRet.r)->trans[0] = zzaRet.l; + zzCONSUME; + + } + else { + if ( (setwd2[LA(1)]&0x40) ) { + } + else {zzFAIL(1,zzerr5,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + } + zzEXIT(zztasp2); + } + } + } + else { + if ( (LA(1)==ZERO_MORE) ) { + zzmatch(ZERO_MORE); + error("no expression for *", zzline); + zzCONSUME; + + } + else { + if ( (LA(1)==ONE_MORE) ) { + zzmatch(ONE_MORE); + error("no expression for +", zzline); + zzCONSUME; + + } + else {zzFAIL(1,zzerr6,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + } + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd2, 0x80); + } +} + +void +#ifdef __USE_PROTOS +expr(void) +#else +expr() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + zzaRet.l = new_nfa_node(); + zzaRet.r = new_nfa_node(); + if ( (LA(1)==L_BRACK) ) { + zzmatch(L_BRACK); zzCONSUME; + atom_list(); + zzmatch(R_BRACK); + + /* MR23 */ if (zzaRet.l != NULL) { + (zzaRet.l)->trans[0] = zzaRet.r; + (zzaRet.l)->label = set_dup(zzaArg(zztasp1,2 ).label); + set_orin(&used_chars,(zzaRet.l)->label); + } + zzCONSUME; + + } + else { + if ( (LA(1)==NOT) ) { + zzmatch(NOT); zzCONSUME; + zzmatch(L_BRACK); zzCONSUME; + atom_list(); + zzmatch(R_BRACK); + + /* MR23 */ if (zzaRet.l != NULL) { + (zzaRet.l)->trans[0] = zzaRet.r; + (zzaRet.l)->label = set_dif(normal_chars,zzaArg(zztasp1,3 ).label); + set_orin(&used_chars,(zzaRet.l)->label); + } + zzCONSUME; + + } + else { + if ( (LA(1)==L_PAR) ) { + zzmatch(L_PAR); zzCONSUME; + reg_expr(); + zzmatch(R_PAR); + + /* MR23 */ if (zzaRet.l != NULL) { + (zzaRet.l)->trans[0] = zzaArg(zztasp1,2 ).l; + if (zzaArg(zztasp1,2 ).r) { + (zzaArg(zztasp1,2 ).r)->trans[1] = zzaRet.r; /* MR20 */ + } + } + zzCONSUME; + + } + else { + if ( (LA(1)==L_BRACE) ) { + zzmatch(L_BRACE); zzCONSUME; + reg_expr(); + zzmatch(R_BRACE); + + /* MR23 */ if (zzaRet.l != NULL) { + (zzaRet.l)->trans[0] = zzaArg(zztasp1,2 ).l; + (zzaRet.l)->trans[1] = zzaRet.r; + if (zzaArg(zztasp1,2 ).r) { + (zzaArg(zztasp1,2 ).r)->trans[1] = zzaRet.r; /* MR20 */ + } + } + zzCONSUME; + + } + else { + if ( (setwd3[LA(1)]&0x1) ) { + atom(); + + /* MR23 */ if (zzaRet.l != NULL) { + (zzaRet.l)->trans[0] = zzaRet.r; + (zzaRet.l)->label = set_dup(zzaArg(zztasp1,1 ).label); + set_orin(&used_chars,(zzaRet.l)->label); + } + } + else {zzFAIL(1,zzerr7,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + } + } + } + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd3, 0x2); + } +} + +void +#ifdef __USE_PROTOS +atom_list(void) +#else +atom_list() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + set_free(zzaRet.label); + { + zzBLOCK(zztasp2); + zzMake0; + { + while ( (setwd3[LA(1)]&0x4) ) { + near_atom(); + set_orin(&(zzaRet.label),zzaArg(zztasp2,1 ).label); + zzLOOP(zztasp2); + } + zzEXIT(zztasp2); + } + } + zzEXIT(zztasp1); + return; + } +} + +void +#ifdef __USE_PROTOS +near_atom(void) +#else +near_atom() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + register int i; + register int i_prime; + anychar(); + zzaRet.letter=zzaArg(zztasp1,1 ).letter; zzaRet.label=set_of(zzaArg(zztasp1,1 ).letter); + i_prime = zzaArg(zztasp1,1 ).letter + MIN_CHAR; + if (case_insensitive && islower(i_prime)) + set_orel(toupper(i_prime)-MIN_CHAR, + &(zzaRet.label)); + if (case_insensitive && isupper(i_prime)) + set_orel(tolower(i_prime)-MIN_CHAR, + &(zzaRet.label)); + { + zzBLOCK(zztasp2); + zzMake0; + { + if ( (LA(1)==RANGE) ) { + zzmatch(RANGE); zzCONSUME; + anychar(); + if (case_insensitive){ + i_prime = zzaRet.letter+MIN_CHAR; + zzaRet.letter = (islower(i_prime) ? + toupper(i_prime) : i_prime)-MIN_CHAR; + i_prime = zzaArg(zztasp2,2 ).letter+MIN_CHAR; + zzaArg(zztasp2,2 ).letter = (islower(i_prime) ? + toupper(i_prime) : i_prime)-MIN_CHAR; + } + /* check to see if range okay */ + { + int debugLetter1 = zzaRet.letter; + int debugLetter2 = zzaArg(zztasp2,2 ).letter; + } + if (zzaRet.letter > zzaArg(zztasp2,2 ).letter + && zzaArg(zztasp2,2 ).letter != 0xff){ /* MR16 */ + error("invalid range ", zzline); + } + for (i=zzaRet.letter; i<= (int)zzaArg(zztasp2,2 ).letter; ++i){ + set_orel(i,&(zzaRet.label)); + i_prime = i+MIN_CHAR; + if (case_insensitive && islower(i_prime)) + set_orel(toupper(i_prime)-MIN_CHAR, + &(zzaRet.label)); + if (case_insensitive && isupper(i_prime)) + set_orel(tolower(i_prime)-MIN_CHAR, + &(zzaRet.label)); + } + } + else { + if ( (setwd3[LA(1)]&0x10) ) { + } + else {zzFAIL(1,zzerr8,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + zzEXIT(zztasp2); + } + } + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd3, 0x20); + } +} + +void +#ifdef __USE_PROTOS +atom(void) +#else +atom() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + register int i_prime; + anychar(); + zzaRet.label = set_of(zzaArg(zztasp1,1 ).letter); + i_prime = zzaArg(zztasp1,1 ).letter + MIN_CHAR; + if (case_insensitive && islower(i_prime)) + set_orel(toupper(i_prime)-MIN_CHAR, + &(zzaRet.label)); + if (case_insensitive && isupper(i_prime)) + set_orel(tolower(i_prime)-MIN_CHAR, + &(zzaRet.label)); + zzEXIT(zztasp1); + return; + } +} + +void +#ifdef __USE_PROTOS +anychar(void) +#else +anychar() +#endif +{ + zzRULE; + zzBLOCK(zztasp1); + zzMake0; + { + if ( (LA(1)==REGCHAR) ) { + zzmatch(REGCHAR); + zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR; + zzCONSUME; + + } + else { + if ( (LA(1)==OCTAL_VALUE) ) { + zzmatch(OCTAL_VALUE); + zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR; + zzCONSUME; + + } + else { + if ( (LA(1)==HEX_VALUE) ) { + zzmatch(HEX_VALUE); + zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR; + zzCONSUME; + + } + else { + if ( (LA(1)==DEC_VALUE) ) { + zzmatch(DEC_VALUE); + zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR; + zzCONSUME; + + } + else { + if ( (LA(1)==TAB) ) { + zzmatch(TAB); + zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR; + zzCONSUME; + + } + else { + if ( (LA(1)==NL) ) { + zzmatch(NL); + zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR; + zzCONSUME; + + } + else { + if ( (LA(1)==CR) ) { + zzmatch(CR); + zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR; + zzCONSUME; + + } + else { + if ( (LA(1)==BS) ) { + zzmatch(BS); + zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR; + zzCONSUME; + + } + else { + if ( (LA(1)==LIT) ) { + zzmatch(LIT); + zzaRet.letter = zzaArg(zztasp1,1 ).letter - MIN_CHAR; + zzCONSUME; + + } + else { + if ( (LA(1)==L_EOF) ) { + zzmatch(L_EOF); + zzaRet.letter = 0; + zzCONSUME; + + } + else {zzFAIL(1,zzerr9,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk); goto fail;} + } + } + } + } + } + } + } + } + } + zzEXIT(zztasp1); + return; +fail: + zzEXIT(zztasp1); + /* empty action */ + zzsyn(zzMissText, zzBadTok, (ANTLRChar *)"", zzMissSet, zzMissTok, zzErrk, zzBadText); + zzresynch(setwd3, 0x80); + } +} + +/* adds a new nfa to the binary tree and returns a pointer to it */ +nfa_node * +#ifdef __USE_PROTOS +new_nfa_node(void) +#else +new_nfa_node() +#endif +{ + register nfa_node *t; + static int nfa_size=0; /* elements nfa_array[] can hold */ + + ++nfa_allocated; + if (nfa_size<=nfa_allocated){ + /* need to redo array */ + if (!nfa_array){ + /* need some to do inital allocation */ + nfa_size=nfa_allocated+NFA_MIN; + nfa_array=(nfa_node **) malloc(sizeof(nfa_node*)* + nfa_size); + }else{ + /* need more space */ + nfa_size=2*(nfa_allocated+1); + nfa_array=(nfa_node **) realloc(nfa_array, + sizeof(nfa_node*)*nfa_size); + } + } + /* fill out entry in array */ + t = (nfa_node*) malloc(sizeof(nfa_node)); + nfa_array[nfa_allocated] = t; + *t = nfa_model_node; + t->node_no = nfa_allocated; + return t; +} + + +/* initialize the model node used to fill in newly made nfa_nodes */ +void +#ifdef __USE_PROTOS +make_nfa_model_node(void) +#else +make_nfa_model_node() +#endif +{ + nfa_model_node.node_no = -1; /* impossible value for real nfa node */ + nfa_model_node.nfa_set = 0; + nfa_model_node.accept = 0; /* error state default*/ + nfa_model_node.trans[0] = NULL; + nfa_model_node.trans[1] = NULL; + nfa_model_node.label = empty; +} + +#if defined(DEBUG) || defined(_DEBUG) + +/* print out the pointer value and the node_number */ +void +#ifdef __USE_PROTOS +fprint_dfa_pair(FILE *f, nfa_node *p) +#else +fprint_dfa_pair(f, p) +FILE *f; +nfa_node *p; +#endif +{ + if (p){ + fprintf(f, "%x (%d)", p, p->node_no); + }else{ + fprintf(f, "(nil)"); + } +} + +/* print out interest information on a set */ +void +#ifdef __USE_PROTOS +fprint_set(FILE *f, set s) +#else +fprint_set(f,s) +FILE *f; +set s; +#endif +{ + unsigned int *x; + + fprintf(f, "n = %d,", s.n); + if (s.setword){ + fprintf(f, "setword = %x, ", s.setword); + /* print out all the elements in the set */ + x = set_pdq(s); + while (*x!=nil){ + fprintf(f, "%d ", *x); + ++x; + } + }else{ + fprintf(f, "setword = (nil)"); + } +} + +/* code to be able to dump out the nfas +return 0 if okay dump +return 1 if screwed up +*/ +int +#ifdef __USE_PROTOS +dump_nfas(int first_node, int last_node) +#else +dump_nfas(first_node, last_node) +int first_node; +int last_node; +#endif +{ + register int i; + nfa_node *t; + + for (i=first_node; i<=last_node; ++i){ + t = NFA(i); + if (!t) break; + fprintf(stderr, "nfa_node %d {\n", t->node_no); + fprintf(stderr, "\n\tnfa_set = %d\n", t->nfa_set); + fprintf(stderr, "\taccept\t=\t%d\n", t->accept); + fprintf(stderr, "\ttrans\t=\t("); + fprint_dfa_pair(stderr, t->trans[0]); + fprintf(stderr, ","); + fprint_dfa_pair(stderr, t->trans[1]); + fprintf(stderr, ")\n"); + fprintf(stderr, "\tlabel\t=\t{ "); + fprint_set(stderr, t->label); + fprintf(stderr, "\t}\n"); + fprintf(stderr, "}\n\n"); + } + return 0; +} +#endif + +/* DLG-specific syntax error message generator +* (define USER_ZZSYN when compiling so don't get 2 definitions) +*/ +void +#ifdef __USE_PROTOS +zzsyn(char *text, int tok, char *egroup, SetWordType *eset, int etok, int k, char *bad_text) +#else +zzsyn(text, tok, egroup, eset, etok, k, bad_text) +char *text, *egroup, *bad_text; +int tok; +int etok; +int k; +SetWordType *eset; +#endif +{ +fprintf(stderr, ErrHdr, file_str[0]!=NULL?file_str[0]:"stdin", zzline); +fprintf(stderr, " syntax error at \"%s\"", (tok==zzEOF_TOKEN)?"EOF":text); +if ( !etok && !eset ) {fprintf(stderr, "\n"); return;} +if ( k==1 ) fprintf(stderr, " missing"); +else +{ +fprintf(stderr, "; \"%s\" not", bad_text); +if ( zzset_deg(eset)>1 ) fprintf(stderr, " in"); +} +if ( zzset_deg(eset)>0 ) zzedecode(eset); +else fprintf(stderr, " %s", zztokens[etok]); +if ( strlen(egroup) > (size_t)0 ) fprintf(stderr, " in %s", egroup); +fprintf(stderr, "\n"); +} diff --git a/pccts/dlg/err.c b/pccts/dlg/err.c new file mode 100644 index 0000000..03bb181 --- /dev/null +++ b/pccts/dlg/err.c @@ -0,0 +1,99 @@ +/* + * A n t l r S e t s / E r r o r F i l e H e a d e r + * + * Generated from: dlg_p.g + * + * Terence Parr, Russell Quong, Will Cohen, and Hank Dietz: 1989-2001 + * Parr Research Corporation + * with Purdue University Electrical Engineering + * With AHPCRC, University of Minnesota + * ANTLR Version 1.33MR32 + */ + +#define ANTLR_VERSION 13332 +#include "pcctscfg.h" +#include "pccts_stdio.h" + +#include <ctype.h> +#include "dlg.h" +#define zzSET_SIZE 8 +#include "antlr.h" +#include "tokens.h" +#include "dlgdef.h" +#include "err.h" + +ANTLRChar *zztokens[46]={ + /* 00 */ "Invalid", + /* 01 */ "@", + /* 02 */ "[\\r\\t\\ ]+", + /* 03 */ "\\n", + /* 04 */ "L_EOF", + /* 05 */ "PER_PER", + /* 06 */ "NAME_PER_PER", + /* 07 */ "LEXMEMBER", + /* 08 */ "LEXACTION", + /* 09 */ "PARSERCLASS", + /* 10 */ "LEXPREFIX", + /* 11 */ "ACTION", + /* 12 */ "GREAT_GREAT", + /* 13 */ "L_BRACE", + /* 14 */ "R_BRACE", + /* 15 */ "L_PAR", + /* 16 */ "R_PAR", + /* 17 */ "L_BRACK", + /* 18 */ "R_BRACK", + /* 19 */ "ZERO_MORE", + /* 20 */ "ONE_MORE", + /* 21 */ "OR", + /* 22 */ "RANGE", + /* 23 */ "NOT", + /* 24 */ "OCTAL_VALUE", + /* 25 */ "HEX_VALUE", + /* 26 */ "DEC_VALUE", + /* 27 */ "TAB", + /* 28 */ "NL", + /* 29 */ "CR", + /* 30 */ "BS", + /* 31 */ "CONTINUATION", + /* 32 */ "LIT", + /* 33 */ "REGCHAR", + /* 34 */ "\\>", + /* 35 */ "\\\\>", + /* 36 */ "\\", + /* 37 */ "\\n", + /* 38 */ "/\\*", + /* 39 */ "//", + /* 40 */ "~[]", + /* 41 */ "\\*/", + /* 42 */ "[\\n\\r]", + /* 43 */ "~[]", + /* 44 */ "[\\n\\r]", + /* 45 */ "~[]" +}; +SetWordType zzerr1[8] = {0x80,0xf,0x0,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr2[8] = {0x60,0x0,0x0,0x0, 0x0,0x0,0x0,0x0}; +SetWordType zzerr3[8] = {0x70,0xa8,0x9a,0x7f, 0x3,0x0,0x0,0x0}; +SetWordType setwd1[46] = {0x0,0x6,0x0,0x0,0x30,0xc8,0xc8, + 0x1,0x1,0x1,0x1,0x35,0x0,0x30,0x0, + 0x30,0x0,0x30,0x0,0x30,0x30,0x0,0x0, + 0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30, + 0x0,0x30,0x30,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0}; +SetWordType zzerr4[8] = {0x10,0xa8,0x9a,0x7f, 0x3,0x0,0x0,0x0}; +SetWordType zzerr5[8] = {0x10,0xe8,0xbb,0x7f, 0x3,0x0,0x0,0x0}; +SetWordType zzerr6[8] = {0x10,0xa0,0x9a,0x7f, 0x3,0x0,0x0,0x0}; +SetWordType setwd2[46] = {0x0,0x0,0x0,0x0,0xeb,0x2,0x2, + 0x0,0x0,0x0,0x0,0xd6,0x0,0xeb,0xd4, + 0xeb,0xd4,0xeb,0x0,0xcb,0xcb,0xd0,0x0, + 0xeb,0xeb,0xeb,0xeb,0xeb,0xeb,0xeb,0xeb, + 0x0,0xeb,0xeb,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0}; +SetWordType zzerr7[8] = {0x10,0xa0,0x82,0x7f, 0x3,0x0,0x0,0x0}; +SetWordType zzerr8[8] = {0x10,0x0,0x44,0x7f, 0x3,0x0,0x0,0x0}; +SetWordType zzerr9[8] = {0x10,0x0,0x0,0x7f, 0x3,0x0,0x0,0x0}; +SetWordType setwd3[46] = {0x0,0x0,0x0,0x0,0xf7,0x0,0x0, + 0x0,0x0,0x0,0x0,0xc2,0x0,0xc2,0xc2, + 0xc2,0xc2,0xc2,0xb8,0xc2,0xc2,0xc2,0x80, + 0xc2,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7,0xf7, + 0x0,0xf7,0xf7,0x0,0x0,0x0,0x0,0x0, + 0x0,0x0,0x0,0x0,0x0,0x0,0x0}; diff --git a/pccts/dlg/main.c b/pccts/dlg/main.c new file mode 100644 index 0000000..342d771 --- /dev/null +++ b/pccts/dlg/main.c @@ -0,0 +1,281 @@ +/* Main function for dlg version + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * DLG 1.33 + * Will Cohen + * With mods by Terence Parr; AHPCRC, University of Minnesota + * 1989-2001 + */ + +#include <stdio.h> +#include "stdpccts.h" + +char program[] = "dlg"; +char version[] = "1.33MR32"; /* MRXXX */ +int numfiles = 0; +char *file_str[2] = {NULL, NULL}; +char *mode_file = "mode.h"; +char *class_name = DEFAULT_CLASSNAME; +char *OutputDirectory = TopDirectory; + +/* Option variables */ +int comp_level = 0; +int interactive = FALSE; +int case_insensitive = FALSE; +int warn_ambig = FALSE; +int gen_cpp = FALSE; + +#ifdef __USE_PROTOS +static int ci_strequ(char *a,char *b) +#else +static int ci_strequ(a,b) + char *a; + char *b; +#endif +{ + for ( ;*a != 0 && *b != 0; a++, b++) { + if (toupper(*a) != toupper(*b)) return 0; + } + return (*a == *b); +} + +/* Option List Stuff */ +#ifdef __USE_PROTOS +void p_comp0(void) {comp_level = 0;} +void p_comp1(void) {comp_level = 1;} +void p_comp2(void) {comp_level = 2;} +void p_stdio(void) { file_str[numfiles++] = NULL;} +void p_file(char *s) { file_str[numfiles++] = s;} +void p_cl_name(char *s, char *t) + { + if ( gen_cpp ) { + class_name = t; + } + else { + warning("-cl only valid in C++ mode; -cl ignored...",0); + } + } +void p_mode_file(char *s, char *t){mode_file=t;} +void p_outdir(char *s,char *t) {OutputDirectory=t;} +void p_ansi(void) {gen_ansi = TRUE;} +void p_interactive(void) {interactive = TRUE;} +void p_case_s(void) { case_insensitive = FALSE; } +void p_case_i(void) { case_insensitive = TRUE; } +void p_warn_ambig(void) { warn_ambig = TRUE; } +void p_cpp(void) { gen_cpp = TRUE; } +#else +void p_comp0() {comp_level = 0;} +void p_comp1() {comp_level = 1;} +void p_comp2() {comp_level = 2;} +void p_stdio() { file_str[numfiles++] = NULL;} +void p_file(s) char *s; { file_str[numfiles++] = s;} +void p_cl_name(s,t) + char *s, *t; + { + if ( gen_cpp ) { + class_name = t; + } + else { + warning("-cl only valid in C++ mode; -cl ignored...",0); + } + } +void p_mode_file(s,t) char *s,*t;{mode_file=t;} +void p_outdir(s,t) char *s,*t;{OutputDirectory=t;} +void p_ansi() {gen_ansi = TRUE;} +void p_interactive() {interactive = TRUE;} +void p_case_s() { case_insensitive = FALSE; } +void p_case_i() { case_insensitive = TRUE; } +void p_warn_ambig() { warn_ambig = TRUE; } +void p_cpp() { gen_cpp = TRUE; } +#endif + +#ifdef __cplusplus +typedef void (*WildFunc)(...); +#else +typedef void (*WildFunc)(); +#endif + +typedef struct { + char *option; + int arg; + WildFunc process; + char *descr; + } Opt; + +Opt options[] = { + { "-CC", 0, (WildFunc)p_cpp, "Generate C++ output" }, + { "-C0", 0, (WildFunc)p_comp0, "No compression (default)" }, + { "-C1", 0, (WildFunc)p_comp1, "Compression level 1" }, + { "-C2", 0, (WildFunc)p_comp2, "Compression level 2" }, + { "-ga", 0, (WildFunc)p_ansi, "Generate ansi C"}, + { "-Wambiguity", 0, (WildFunc)p_warn_ambig, "Warn if expressions ambiguous"}, + { "-m", 1, (WildFunc)p_mode_file, "Rename lexical mode output file"}, + { "-i", 0, (WildFunc)p_interactive, "Build interactive scanner (not valid for C++ mode)"}, + { "-ci", 0, (WildFunc)p_case_i, "Make lexical analyzer case insensitive"}, + { "-cl", 1, (WildFunc)p_cl_name, "Rename lexer class (DLGLexer); only used for -CC"}, + { "-cs", 0, (WildFunc)p_case_s, "Make lexical analyzer case sensitive (default)"}, + { "-o", 1, (WildFunc)p_outdir, OutputDirectoryOption}, + { "-", 0, (WildFunc)p_stdio, "Use standard i/o rather than file"}, + { "*", 0, (WildFunc)p_file, ""}, /* anything else is a file */ + { NULL, 0, NULL } + }; + +#ifdef __USE_PROTOS +void ProcessArgs(int argc, char **argv, Opt *options) +#else +void ProcessArgs(argc, argv, options) +int argc; +char **argv; +Opt *options; +#endif +{ + Opt *p; + + while ( argc-- > 0 ) + { + p = options; + while ( p->option != NULL ) + { + if ( strcmp(p->option, "*") == 0 || + ci_strequ(p->option,*argv) ) + { + if ( p->arg ) + { + (*p->process)( *argv, *(argv+1) ); + argv++; + argc--; + } + else + (*p->process)( *argv ); + break; + } + p++; + } + argv++; + } +} + +#ifdef __USE_PROTOS +int main(int argc, char *argv[]) +#else +int main(argc, argv) +int argc; +char *argv[]; +#endif +{ + init(); + fprintf(stderr, "%s Version %s 1989-2001\n", &(program[0]), + &(version[0])); + if ( argc == 1 ) + { + Opt *p = options; + fprintf(stderr, "%s [options] f1 f2 ... fn\n",argv[0]); + while ( *(p->option) != '*' ) + { + fprintf(stderr, "\t%s %s\t%s\n", + p->option, + (p->arg)?"___":" ", + p->descr); + p++; + } + }else{ + ProcessArgs(argc-1, &(argv[1]), options); + if (interactive && gen_cpp) { + fprintf(stderr,"\n"); +/*** MR21a This statement is wrong ! ***/ +#if 0 +*** fprintf(stderr,"Interactive lexer option (\"-i\") has no effect when in C++ mode\n"); +*** fprintf(stderr,"because of extra buffering provided by ANTLRTokenBuffer class.\n"); +*** fprintf(stderr,"\n"); +#endif + } + input_stream = read_stream(file_str[0]); + if (input_stream) { + /* don't overwrite unless input okay */ + if ( gen_cpp ) { + output_stream = write_stream(ClassName(CPP_FILE_SUFFIX)); + if ( file_str[1]!=NULL ) { + warning("output file implicit in C++ mode; ignored...",0); + } + class_stream = write_stream(ClassName(".h")); + mode_stream = class_stream; + } + else { + output_stream = write_stream(file_str[1]); + mode_stream = write_stream(mode_file); + } + } + /* make sure that error reporting routines in grammar + know what the file really is */ + /* make sure that reading and writing somewhere */ + if (input_stream && output_stream && mode_stream){ + ANTLR(grammar(), input_stream); + } + p_class_def2(); /* MR1 */ + } + if ( output_stream!=NULL ) fclose(output_stream); + if ( !gen_cpp && mode_stream!=NULL ) fclose(mode_stream); + if ( class_stream!=NULL ) fclose(class_stream); + exit(PCCTS_EXIT_SUCCESS); + return 0; /* get rid of warning message MR1 */ +} + +/* initialize all the variables */ +void +#ifdef __USE_PROTOS +init(void) +#else +init() +#endif +{ + register int i; + +#ifdef SPECIAL_INITS + special_inits(); /* MR1 */ +#endif + used_chars = empty; + used_classes = empty; + /* make the valid character set */ + normal_chars = empty; + /* NOTE: MIN_CHAR is EOF */ + /* NOTE: EOF is not quite a valid char, it is special. Skip it*/ + for (i = 1; i<CHAR_RANGE; ++i){ + set_orel(i,&normal_chars); + } + make_nfa_model_node(); + clear_hash(); + /* NOTE: need to set this flag before the lexer starts getting */ + /* tokens */ + func_action = FALSE; +} + +/* stuff that needs to be reset when a new automaton is being built */ +void +#ifdef __USE_PROTOS +new_automaton_mode(void) /* MR1 */ +#else +new_automaton_mode() /* MR1 */ +#endif +{ + set_free(used_chars); + clear_hash(); +} diff --git a/pccts/dlg/mode.h b/pccts/dlg/mode.h new file mode 100644 index 0000000..5dc2c28 --- /dev/null +++ b/pccts/dlg/mode.h @@ -0,0 +1,4 @@ +#define START 0 +#define ACT 1 +#define ACTION_COMMENTS 2 +#define ACTION_CPP_COMMENTS 3 diff --git a/pccts/dlg/output.c b/pccts/dlg/output.c new file mode 100644 index 0000000..53bf241 --- /dev/null +++ b/pccts/dlg/output.c @@ -0,0 +1,850 @@ +/* output.c, output generator for dlg + * + * Output Notes: + * + * DfaStates == number of dfa nodes in automaton (just a #define) + * DfaState == type large enough to index every node in automaton + * <256 unsigned char, <65536 unsigned short, etc. + * + * Thus, the elements in each of the automaton states (st%d) are type DfaState + * and are size appropriately, since they must be able to index the next + * automaton state. + * + * dfa[] == a linear array that points to all the automaton states (st%d) + * (dfa_base[] should be the same, but isn't right now) + * + * accepts[] == Taking a closer look at this one, it probably shouldn't be type + * DfaState because there is no real requirement that the number of + * accepts states is less than the number of dfa state. However, if + * the number of accept states was more than the number of DFA states + * then the lexical specification would be really ambiguous. + * + * Another note. Is that is should be possible to fold accepts[] and + * actions[] together. If this is done, I would suggest get rid of + * accept[] and make actions[] have an entry for each state (st%d) in + * the automaton. + * + * dfa_base[] == starting location for each lexical mode. This should be + * Dfastate type (but isn't right now), since it points to the states + * in the automaton. + * + * dfa_class_no[] == indicates the number of columns each lexical mode has. + * + * b_class_no[] == pointer to the start of the translation array used to + * convert from input character to character class. This could cause + * problems if there are more than 256 classes + * + * shift%d[] == the actual translation arrays that convert the input character + * into the character class. These will have to change if there are + * more than 256 character classes. + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * DLG 1.33 + * Will Cohen + * With mods by Terence Parr; AHPCRC, University of Minnesota + * 1989-2001 + */ + +#include <stdio.h> +#include <string.h> +#include "dlg.h" +#ifdef MEMCHK +#include "trax.h" +#else +#ifdef __STDC__ +#include <stdlib.h> +#else +#include <malloc.h> +#endif /* __STDC__ */ +#endif + +static char *mode_name[MAX_MODES]; +static int mode_number[MAX_MODES]; +static int cur_mode=0; + +int operation_no = 0; /* used to mark nodes so that infinite loops avoided */ +int dfa_basep[MAX_MODES]; /* start of each group of states */ +int dfa_class_nop[MAX_MODES]; /* number of elements in each group of states*/ + +int gen_ansi = FALSE; /* allows ansi code to be generated */ + +FILE *input_stream; /* where to read description from */ +FILE *output_stream; /* where to put the output */ +FILE *mode_stream; /* where to put the mode.h stuff */ +FILE *class_stream; /* where to put the scan.h stuff (if gen_cpp) */ + +/* NOTE: This section is MACHINE DEPENDENT */ +#define DIF_SIZE 4 +#if defined(PC) && !defined(PC32) +unsigned long typesize[DIF_SIZE] = { 0x7f, 0x7fff, 0x7ffful, 0x7ffffffful }; /* MR20 */ +char t0[] = "unsigned char"; +char t1[] = "unsigned short"; +char t2[] = "unsigned int"; +char t3[] = "unsigned long"; +char *typevar[DIF_SIZE] = { t0, t1, t2, t3}; +#else +unsigned long typesize[DIF_SIZE] = { 0x7f, 0x7fff, 0x7ffffffful, 0x7ffffffful }; /* MR20 */ +char t0[] = "unsigned char"; +char t1[] = "unsigned short"; +char t2[] = "unsigned int"; +char t3[] = "unsigned long"; +char *typevar[DIF_SIZE] = { t0, t1, t2, t3}; +#endif + +/* Added by TJP August 1994 */ +/* Take in MyLexer and return MyLexer_h */ + +static char * +#ifdef __USE_PROTOS +gate_symbol(char *name) +#else +gate_symbol(name) +char *name; +#endif +{ + static char buf[100]; + sprintf(buf, "%s_h", name); + return buf; +} + +/* Added by TJP August 1994 */ +static char * +#ifdef __USE_PROTOS +mystrdup(char *s) +#else +mystrdup(s) +char *s; +#endif +{ + char *p = (char *)malloc(strlen(s)+1); + strcpy(p, s); + return p; +} + +#ifdef __USE_PROTOS +void p_class_hdr(void) +#else +void p_class_hdr() +#endif +{ + if ( class_stream == NULL ) return; + fprintf(class_stream, "#ifndef %s\n", gate_symbol(ClassName(""))); + fprintf(class_stream, "#define %s\n", gate_symbol(ClassName(""))); + fprintf(class_stream, "/*\n"); + fprintf(class_stream, " * D L G L e x e r C l a s s D e f i n i t i o n\n"); + fprintf(class_stream, " *\n"); + fprintf(class_stream, " * Generated from:"); + fprintf(class_stream, " %s", file_str[0]); + fprintf(class_stream, "\n"); + fprintf(class_stream, " *\n"); + fprintf(class_stream, " * 1989-2001 by Will Cohen, Terence Parr, and Hank Dietz\n"); + fprintf(class_stream, " * Purdue University Electrical Engineering\n"); + fprintf(class_stream, " * DLG Version %s\n", version); + fprintf(class_stream, " */\n\n"); + fprintf(class_stream, "\n"); + fprintf(class_stream, "#include \"%s\"\n", DLEXERBASE_H); +} + +/* MR1 */ +/* MR1 16-Apr-97 Split printing of class header up into several parts */ +/* MR1 so that #lexprefix <<...>>and #lexmember <<...>> */ +/* MR1 can be inserted in the appropriate spots */ +/* MR1 */ + +#ifdef __USE_PROTOS +void p_class_def1(void) +#else +void p_class_def1() +#endif +{ + if ( class_stream == NULL ) return; + fprintf(class_stream, "\nclass %s : public DLGLexerBase {\n", ClassName("")); + fprintf(class_stream, "public:\n"); +} + +#ifdef __USE_PROTOS +void p_class_def2(void) +#else +void p_class_def2() +#endif +{ + int i, m; + if ( class_stream == NULL ) return; + fprintf(class_stream, "public:\n"); + fprintf(class_stream, "\tstatic const int MAX_MODE;\n"); + fprintf(class_stream, "\tstatic const int DfaStates;\n"); + for (i=0; i<cur_mode; i++) { + fprintf(class_stream, "\tstatic const int %s;\n", mode_name[i]); + } + + fprintf(class_stream, "\ttypedef %s DfaState;\n\n", minsize(dfa_allocated)); + fprintf(class_stream, "\t%s(DLGInputStream *in,\n",ClassName("")); + fprintf(class_stream, "\t\tunsigned bufsize=2000)\n"); + fprintf(class_stream, "\t\t: DLGLexerBase(in, bufsize, %d)\n", interactive); + fprintf(class_stream, "\t{\n"); + fprintf(class_stream, "\t;\n"); + fprintf(class_stream, "\t}\n"); + fprintf(class_stream, "\tvoid mode(int);\n"); + fprintf(class_stream, "\tANTLRTokenType nextTokenType(void);\n"); + fprintf(class_stream, "\tvoid advance(void);\n"); + fprintf(class_stream, "protected:\n"); + for (i=1; i<=action_no; ++i) { + fprintf(class_stream, "\tANTLRTokenType act%d();\n", i); + } + + for(m=0; m<(mode_counter-1); ++m){ + for(i=dfa_basep[m]; i<dfa_basep[m+1]; ++i) + fprintf(class_stream, "\tstatic DfaState st%d[%d];\n", i-1, dfa_class_nop[m]+1); + } + for(i=dfa_basep[m]; i<=dfa_allocated; ++i) + fprintf(class_stream, "\tstatic DfaState st%d[%d];\n", i-1, dfa_class_nop[m]+1); + + fprintf(class_stream, "\tstatic DfaState *dfa[%d];\n", dfa_allocated); + fprintf(class_stream, "\tstatic DfaState dfa_base[];\n"); +/* fprintf(class_stream, "\tstatic int dfa_base_no[];\n"); */ + fprintf(class_stream, "\tstatic unsigned char *b_class_no[];\n"); + fprintf(class_stream, "\tstatic DfaState accepts[%d];\n",dfa_allocated+1); + fprintf(class_stream, "\tstatic DLGChar alternatives[%d];\n",dfa_allocated+1); + /* WARNING: should be ANTLRTokenType for action table, but g++ 2.5.6 is hosed */ + fprintf(class_stream, "\tstatic ANTLRTokenType (%s::*actions[%d])();\n", ClassName(""), action_no+1); + for(m=0; m<mode_counter; ++m) { + fprintf(class_stream, "\tstatic unsigned char shift%d[%d];\n", + m, CHAR_RANGE); + } + if (comp_level) + fprintf(class_stream, "\tint ZZSHIFT(int c) { return b_class_no[automaton][1+c]; }\n"); + else + fprintf(class_stream, "\tint ZZSHIFT(int c) { return 1+c; }\n"); + +/* MR1 */ +/* MR1 11-APr-97 Kludge to allow inclusion of user-defined code in */ +/* MR1 DLGLexer class header */ +/* MR1 Deprecated in favor of 133MR1 addition #lexmember <<>> */ +/* MR1 */ +/* MR1 */ fprintf(class_stream,"//\n"); +/* MR1 */ fprintf(class_stream, +/* MR1 */ "// 133MR1 Deprecated feature to allow inclusion of "); +/* MR1 */ fprintf(class_stream, +/* MR1 */ "user-defined code in DLG class header\n"); +/* MR1 */ fprintf(class_stream,"//\n"); +/* MR1 */ +/* MR1 */ fprintf(class_stream,"#ifdef DLGLexerIncludeFile\n"); +/* MR1 */ fprintf(class_stream,"#include DLGLexerIncludeFile\n"); +/* MR1 */ fprintf(class_stream,"#endif\n"); + + fprintf(class_stream, "};\n"); + + fprintf(class_stream, "typedef ANTLRTokenType (%s::*Ptr%sMemberFunc)();\n", + ClassName(""), ClassName("")); + + fprintf(class_stream, "#endif\n"); +} + +/* generate required header on output */ + +#ifdef __USE_PROTOS +void p_head(void) +#else +void p_head() +#endif +{ + fprintf(OUT, "/*\n"); + fprintf(OUT, " * D L G tables\n"); + fprintf(OUT, " *\n"); + fprintf(OUT, " * Generated from:"); + fprintf(OUT, " %s", file_str[0]); + fprintf(OUT, "\n"); + fprintf(OUT, " *\n"); + fprintf(OUT, " * 1989-2001 by Will Cohen, Terence Parr, and Hank Dietz\n"); + fprintf(OUT, " * Purdue University Electrical Engineering\n"); + fprintf(OUT, " * DLG Version %s\n", version); + fprintf(OUT, " */\n\n"); + if ( gen_cpp) fprintf(OUT, "#include \"pcctscfg.h\"\n"); + if ( gen_cpp ) fprintf(OUT, "#include \"pccts_stdio.h\"\n"); + if ( !gen_cpp ) fprintf(OUT, "#include \"%s\"\n\n", mode_file); + fprintf(OUT,"\n"); +} + +#ifdef __USE_PROTOS +void p_includes(void) +#else +void p_includes() +#endif +{ + fprintf(OUT, "#include \"%s\"\n", APARSER_H); + fprintf(OUT, "#include \"%s\"\n", DLEXERBASE_H); + fprintf(OUT, "#include \"%s\"\n", ClassName(".h")); +} + +/* generate code to tie up any loose ends */ + +#ifdef __USE_PROTOS +void p_tail(void) /* MR1 */ +#else +void p_tail() /* MR1 */ +#endif +{ + if ( gen_cpp ) { + if ( strcmp(ClassName(""), DEFAULT_CLASSNAME)!=0 ) + fprintf(OUT, "#define DLGLexer %s\n", ClassName("")); + fprintf(OUT, "#include \"%s\"\n", DLEXER_H); /* MR23 Rename DLexer.cpp to DLexer.h */ + return; + } + fprintf(OUT, "\n"); + fprintf(OUT, "\n"); + if (comp_level) + fprintf(OUT, "#define ZZSHIFT(c) (b_class_no[zzauto][1+c])\n"); + else + fprintf(OUT, "#define ZZSHIFT(c) (1+c)\n"); + if ( !gen_cpp ) fprintf(OUT, "#define MAX_MODE %d\n",mode_counter); + fprintf(OUT, "#include \"dlgauto.h\"\n"); +} + + +/* output the table of DFA for general use */ + +#ifdef __USE_PROTOS +void p_tables() +#else +void p_tables() +#endif +{ + if ( !gen_cpp ) { + fprintf(OUT, "#define DfaStates\t%d\n", dfa_allocated); + fprintf(OUT, "typedef %s DfaState;\n\n", minsize(dfa_allocated)); + } + + if ( gen_cpp ) { + int i; + fprintf(OUT, "\n"); + fprintf(OUT, "const int %s::MAX_MODE=%d;\n", + ClassName(""), + mode_counter); + fprintf(OUT, "const int %s::DfaStates=%d;\n", + ClassName(""), + dfa_allocated); + for (i=0; i<cur_mode; i++) { + fprintf(OUT, "const int %s::%s=%d;\n", + ClassName(""), mode_name[i], mode_number[i]); + } + fprintf(OUT, "\n"); + } + + p_node_table(); + p_dfa_table(); + p_accept_table(); + p_action_table(); + p_base_table(); + p_class_table(); + if (comp_level) + p_bshift_table(); + if (interactive || gen_cpp ) + p_alternative_table(); +} + + +/* figures out the smallest variable type that will hold the transitions + */ + +#ifdef __USE_PROTOS +char *minsize(int elements) +#else +char *minsize(elements) +int elements; +#endif +{ + int i = 0; + + while ((unsigned long) elements > typesize[i]) /* MR20 */ + ++i; + return typevar[i]; +} + + +#ifdef __USE_PROTOS +void p_node_table(void) +#else +void p_node_table() +#endif +{ + register int i; + register int m = 0; + + for(m=0; m<(mode_counter-1); ++m){ + for(i=dfa_basep[m]; i<dfa_basep[m+1]; ++i) + p_single_node(i,dfa_class_nop[m]); + } + for(i=dfa_basep[m]; i<=dfa_allocated; ++i) + p_single_node(i,dfa_class_nop[m]); +} + + +#ifdef __USE_PROTOS +void p_single_node(int i,int classes) +#else +void p_single_node(i,classes) +int i,classes; +#endif +{ + register int j; + register int trans, items_on_line; + +#if 1 + /* extra state (classes+1) for invalid characters */ + fprintf(OUT, "%sDfaState %sst%d[%d] = {\n ", + gen_cpp?ClassName("::"):"static ", + gen_cpp?ClassName("::"):"",(i-1), (classes+1)); +#else + fprintf(OUT, "static DfaState st%d[%d] = {\n ", (i-1), classes); +#endif + items_on_line = MAX_ON_LINE; + for(j=0; j<classes; ++j){ + DAWDLE; + trans = DFA(i)->trans[j]; + if (trans == NIL_INDEX) + trans = dfa_allocated+1; + /* all of DFA moved down one in array */ + fprintf(OUT, "%d", trans-1); + fprintf(OUT, ", "); + if (!(--items_on_line)){ + fprintf(OUT, "\n "); + items_on_line = MAX_ON_LINE; + } + } +#if 1 + /* put in jump to error state */ + fprintf(OUT, "%d\n};\n\n", dfa_allocated); +#else + fprintf(OUT, "\n};\n\n"); +#endif +} + + +#ifdef __USE_PROTOS +void p_dfa_table(void) +#else +void p_dfa_table() +#endif +{ + register int i; + + fprintf(OUT, "\n%sDfaState *%sdfa[%d] = {\n", + gen_cpp?ClassName("::"):"",gen_cpp?ClassName("::"):"", dfa_allocated); + for (i=0; i<(dfa_allocated-1); ++i){ + fprintf(OUT, "\tst%d,\n", i); + } + fprintf(OUT, "\tst%d\n", i); + fprintf(OUT, "};\n\n"); +} + + +#ifdef __USE_PROTOS +void p_accept_table(void) +#else +void p_accept_table() +#endif +{ + register int i = 1; + register int items_on_line = 0; + int true_interactive = TRUE; + + /* make sure element for one past (zzerraction) -WEC 12/16/92 */ + fprintf(OUT,"\n%sDfaState %saccepts[%d] = {\n ", + gen_cpp?ClassName("::"):"", + gen_cpp?ClassName("::"):"", + dfa_allocated+1); + /* don't do anything if no dfa nodes */ + if (i>dfa_allocated) goto skip_accepts; + for (;;) { + int accept=0; /* MR14a - Manuel Kessler (mlkessle@cip.physik.uni-wuerzburg.de) */ + set accept_set; + set nfa_states; + unsigned int *t, *nfa_i; + unsigned int *q, *regular_expr; + + accept_set = empty; + nfa_states = DFA(i)->nfa_states; + t = nfa_i = set_pdq(nfa_states); + /* NOTE: picks lowest accept because accepts monotonic */ + /* with respect to nfa node numbers and set_pdq */ + /* returns in that order */ + while((*nfa_i != nil) && (!(accept = NFA(*nfa_i)->accept))){ + nfa_i++; + } + + /* figure out if more than one accept state there */ + if (warn_ambig ){ + set_orel(accept, &accept_set); + while(*nfa_i != nil){ + set_orel(NFA(*nfa_i)->accept, &accept_set); + nfa_i++; + } + /* remove error action from consideration */ + set_rm(0, accept_set); + + if( set_deg(accept_set)>1){ + fprintf(stderr, "dlg warning: ambiguous regular expression "); + q = regular_expr = set_pdq(accept_set); + while(*regular_expr != nil){ + fprintf(stderr," %d ", *regular_expr); + ++regular_expr; + } + fprintf(stderr, "\n"); + free(q); + } + } + + if ((DFA(i)->alternatives) && (accept != 0)){ + true_interactive = FALSE; + } + fprintf(OUT, "%d, ", accept); + + /* free up memory before we "break" below -ATG 4/6/95 */ + free(t); + set_free(accept_set); + + if ((++i)>dfa_allocated) + break; + if ((++items_on_line)>=MAX_ON_LINE){ + fprintf(OUT,"\n "); + items_on_line = 0; + } +/* + free(t); + set_free(accept_set); +*/ + } + /* make sure element for one past (zzerraction) -WEC 12/16/92 */ +skip_accepts: + fprintf(OUT, "0\n};\n\n"); +} + + +#ifdef __USE_PROTOS +void p_action_table(void) +#else +void p_action_table() +#endif +{ + register int i; + char* theClassName = ClassName(""); + + if ( gen_cpp ) + fprintf(OUT, "Ptr%sMemberFunc %s::actions[%d] = {\n", theClassName, + theClassName, action_no+1); + else + fprintf(OUT, "void (*actions[%d])() = {\n", action_no+1); + if ( gen_cpp ) +/* fprintf(OUT, "\t(Ptr%sMemberFunc)&%s::erraction,\n", theClassName, theClassName);*/ + fprintf(OUT, "\t&%s::erraction,\n", theClassName); + else + fprintf(OUT, "\tzzerraction,\n"); + for (i=1; i<action_no; ++i) { + if ( gen_cpp ) +/* fprintf(OUT,"\t(Ptr%sMemberFunc)&%s::act%d,\n", theClassName, theClassName, i);*/ + fprintf(OUT,"\t&%s::act%d,\n", theClassName, i); + else + fprintf(OUT,"\tact%d,\n", i); + DAWDLE; + } + if ( gen_cpp ) +/* fprintf(OUT,"\t(Ptr%sMemberFunc)&%s::act%d\n", theClassName, theClassName, i);*/ + fprintf(OUT,"\t&%s::act%d\n", theClassName, i); + else + fprintf(OUT,"\tact%d\n", i); + fprintf(OUT, "};\n\n"); +} + + +#ifdef __USE_PROTOS +void p_shift_table(int m) /* MR1 */ +#else +void p_shift_table(m) /* MR1 */ +int m; +#endif +{ + register int i = 0, j; + register int items_on_line = 0; + + fprintf(OUT, "%s unsigned char %sshift%d[%d] = {\n ", + gen_cpp?"":"static", + gen_cpp?ClassName("::"):"", m, CHAR_RANGE); + for (;;) { + /* find which partition character i is in */ + for (j=0; j<dfa_class_nop[mode_counter]; ++j){ + if (set_el(i,class_sets[j])) + break; + } + fprintf(OUT,"%d",j); + if ((++i)>=CHAR_RANGE) + break; + fprintf(OUT,", "); + if ((++items_on_line)>=MAX_ON_LINE){ + fprintf(OUT,"\n "); + items_on_line = 0; + } + } + fprintf(OUT, "\n};\n\n"); +} + + +#ifdef __USE_PROTOS +void p_base_table(void) +#else +void p_base_table() +#endif +{ + register int m; + + fprintf(OUT, "%sDfaState %sdfa_base[] = {\n", + gen_cpp?ClassName("::"):"static ", + gen_cpp?ClassName("::"):""); + for(m=0; m<(mode_counter-1); ++m) + fprintf(OUT, "\t%d,\n", dfa_basep[m]-1); + fprintf(OUT, "\t%d\n};\n\n", dfa_basep[m]-1); +} + + +#ifdef __USE_PROTOS +void p_class_table(void) /* MR1 */ +#else +void p_class_table() /* MR1 */ +#endif +{ +#if 0 + register int m; + + fprintf(OUT,"%s int %sdfa_class_no[] = {\n", + gen_cpp?"":"static", + gen_cpp?ClassName("::"):""); + for(m=0; m<(mode_counter-1); ++m) + fprintf(OUT,"\t%d,\n", dfa_class_nop[m]); + fprintf(OUT,"\t%d\n};\n\n", dfa_class_nop[m]); +#endif +} + + +#ifdef __USE_PROTOS +void p_bshift_table(void) /* MR1 */ +#else +void p_bshift_table() /* MR1 */ +#endif +{ + register int m; + + fprintf(OUT,"%s unsigned char *%sb_class_no[] = {\n", + gen_cpp?"":"static", + gen_cpp?ClassName("::"):""); + for(m=0; m<(mode_counter-1); ++m) + fprintf(OUT, "\tshift%d,\n", m); + fprintf(OUT, "\tshift%d\n};\n\n", m); +} + + +#ifdef __USE_PROTOS +void p_alternative_table(void) /* MR1 */ +#else +void p_alternative_table() /* MR1 */ +#endif +{ + register int i; + + if ( !gen_cpp ) fprintf(OUT, "#define ZZINTERACTIVE\n\n"); + if ( gen_cpp ) + fprintf(OUT, "DLGChar %salternatives[%d] = {\n", /* mr23 vhs %sDfaStates+1 */ + ClassName("::"), + dfa_allocated+1); /* vhs ClassName("::")); */ + else + fprintf(OUT, "static %s zzalternatives[DfaStates+1] = {\n", + minsize(dfa_allocated)); + + for(i=1; i<=dfa_allocated; ++i) + fprintf(OUT, "\t%d,\n", DFA(i)->alternatives); + fprintf(OUT, "/* must have 0 for zzalternatives[DfaStates] */\n"); + fprintf(OUT, "\t0\n};\n\n"); +} + + +#ifdef __USE_PROTOS +void p_mode_def(char *s,int m) /* MR1 */ +#else +void p_mode_def(s,m) /* MR1 */ +char *s; +int m; +#endif +{ + if ( gen_cpp ) + { + mode_name[cur_mode] = mystrdup(s); + mode_number[cur_mode] = m; + cur_mode++; + } + else + fprintf(mode_stream, "#define %s %d\n", s, m); +} + +#ifdef __USE_PROTOS +char * ClassName(char *suffix) +#else +char * ClassName(suffix) +char *suffix; +#endif +{ + static char buf[200]; + extern char *class_name; + + sprintf(buf, "%s%s", class_name, suffix); + return buf; +} + +#ifdef DEBUG + +/* print out a particular nfa node that is pointed to by p */ + +#ifdef __USE_PROTOS +void p_nfa_node(nfa_node *p) +#else +void p_nfa_node(p) +nfa_node *p; +#endif +{ + register nfa_node *t; + + if (p != NIL_INDEX){ + printf("NFA state : %d\naccept state : %d\n", + NFA_NO(p),p->accept); + if (p->trans[0] != NIL_INDEX){ + printf("trans[0] => %d on ", NFA_NO(p->trans[0])); + p_set(p->label); + printf("\n"); + } + else + printf("trans[0] => nil\n"); + if (p->trans[1] != NIL_INDEX) + printf("trans[1] => %d on epsilon\n", + NFA_NO(p->trans[1])); + else + printf("trans[1] => nil\n"); + printf("\n"); + } +} +#endif + +#ifdef DEBUG + +/* code to print out special structures when using a debugger */ + +#ifdef __USE_PROTOS +void p_nfa(p) +#else +void p_nfa(nfa_node *p) +nfa_node *p; /* state number also index into array */ +#endif +{ +/* each node has a marker on it so it only gets printed once */ + + operation_no++; /* get new number */ + s_p_nfa(p); +} + +#ifdef __USE_PROTOS +void s_p_nfa(nfa_node *p) +#else +void s_p_nfa(p) +nfa_node *p; /* state number also index into array */ +#endif +{ + if ((p != NIL_INDEX) && (p->nfa_set != operation_no)){ + /* so it is only printed once */ + p->nfa_set = operation_no; + p_nfa_node(p); + s_p_nfa(p->trans[0]); + s_p_nfa(p->trans[1]); + } +} + +#ifdef __USE_PROTOS +void p_dfa_node(dfa_node *p) +#else +void p_dfa_node(p) +dfa_node *p; +#endif +{ + int i; + + if (p != NIL_INDEX){ + printf("DFA state :%d\n",NFA_NO(p)); + if (p->done) + printf("done\n"); + else + printf("undone\n"); + printf("from nfa states : "); + p_set(p->nfa_states); + printf("\n"); + /* NOTE: trans arcs stored as ints rather than pointer*/ + for (i=0; i<class_no; i++){ + printf("%d ",p->trans[i]); + } + printf("\n\n"); + } +} + +#ifdef __USE_PROTOS +void p_dfa(void) +#else +void p_dfa() +#endif +{ +/* prints out all the dfa nodes actually allocated */ + + int i; + + for (i = 1; i<=dfa_allocated; i++) + p_dfa_node(NFA(i)); +} + + +/* print out numbers in the set label */ + +#ifdef __USE_PROTOS +void p_set(set label) +#else +void p_set(label) +set label; +#endif +{ + unsigned *t, *e; + + if (set_nil(label)){ + printf("epsilon\n"); + }else{ + t = e = set_pdq(label); + while(*e != nil){ + printf("%d ", (*e+MIN_CHAR)); + e++; + } + printf("\n"); + free(t); + } + +} +#endif diff --git a/pccts/dlg/relabel.c b/pccts/dlg/relabel.c new file mode 100644 index 0000000..393ad0b --- /dev/null +++ b/pccts/dlg/relabel.c @@ -0,0 +1,217 @@ +/* This group of functions does the character class compression. + It goes over the dfa and relabels the arcs with the partitions + of characters in the NFA. The partitions are stored in the + array class. + + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * DLG 1.33 + * Will Cohen + * With mods by Terence Parr; AHPCRC, University of Minnesota + * 1989-2001 + */ + +#include <stdio.h> +#include "dlg.h" +#ifdef MEMCHK +#include "trax.h" +#else +#ifdef __STDC__ +#include <stdlib.h> +#else +#include <malloc.h> +#endif /* __STDC__ */ +#endif + +int class_no = CHAR_RANGE; /* number of classes for labels */ +int first_el[CHAR_RANGE]; /* first element in each class partition */ +set class_sets[CHAR_RANGE]; /* array holds partitions from class */ + /* compression */ + +/* goes through labels on NFA graph and partitions the characters into + * character classes. This reduces the amount of space required for each + * dfa node, since only one arc is required each class instead of one arc + * for each character + * level: + * 0 no compression done + * 1 remove unused characters from classes + * 2 compress equivalent characters into same class + * + * returns the number of character classes required + */ +#ifdef __USE_PROTOS +int relabel(nfa_node* start,int level) +#else +int relabel(start,level) +int level; +nfa_node *start; +#endif +{ + if (level){ + set_free(used_classes); + partition(start,level); + label_with_classes(start); + }else{ + /* classes equivalent to all characters in alphabet */ + class_no = CHAR_RANGE; + } + return class_no; +} + +/* makes character class sets for new labels */ +#ifdef __USE_PROTOS +void partition(nfa_node* start,int level) +#else +void partition(start,level) +nfa_node *start; /* beginning of nfa graph */ +int level; /* compression level to uses */ +#endif +{ + set current_class; + set unpart_chars; + set temp; + + unpart_chars = set_dup(used_chars); +#if 0 + /* EOF (-1+1) alway in class 0 */ + class_sets[0] = set_of(0); + first_el[0] = 0; + used_classes = set_of(0); + temp = set_dif(unpart_chars, class_sets[0]); + set_free(unpart_chars); + unpart_chars = temp; + class_no = 1; +#else + class_no = 0; +#endif + while (!set_nil(unpart_chars)){ + /* don't look for equivalent labels if c <= 1 */ + if (level <= 1){ + current_class = set_of(set_int(unpart_chars)); + }else{ + current_class = set_dup(unpart_chars); + intersect_nfa_labels(start,¤t_class); + } + set_orel(class_no,&used_classes); + first_el[class_no] = set_int(current_class); + class_sets[class_no] = current_class; + temp = set_dif(unpart_chars,current_class); + set_free(unpart_chars); + unpart_chars = temp; + ++class_no; + } + + /* free unpart_chars -ATG 5/6/95 */ + set_free(unpart_chars); + +#if 0 + /* group all the other unused characters into a class */ + set_orel(class_no,&used_classes); + first_el[class_no] = set_int(current_class); + class_sets[class_no] = set_dif(normal_chars,used_chars); + ++class_no; +#endif +} + + +/* given pointer to beginning of graph and recursively walks it trying + * to find a maximal partition. This partion in returned in maximal_class + */ +#ifdef __USE_PROTOS +void intersect_nfa_labels(nfa_node* start,set* maximal_class) +#else +void intersect_nfa_labels(start,maximal_class) +nfa_node *start; +set *maximal_class; +#endif +{ + /* pick a new operation number */ + ++operation_no; + r_intersect(start,maximal_class); +} + +#ifdef __USE_PROTOS +void r_intersect(nfa_node* start,set* maximal_class) +#else +void r_intersect(start,maximal_class) +nfa_node *start; +set * maximal_class; +#endif +{ + set temp; + + if(start && start->nfa_set != operation_no) + { + start->nfa_set = operation_no; + temp = set_and(*maximal_class,start->label); + if (!set_nil(temp)) + { + set_free(*maximal_class); + *maximal_class = temp; + }else{ + set_free(temp); + } + r_intersect(start->trans[0],maximal_class); + r_intersect(start->trans[1],maximal_class); + } +} + + +/* puts class labels in place of old character labels */ +#ifdef __USE_PROTOS +void label_with_classes(nfa_node* start) +#else +void label_with_classes(start) +nfa_node *start; +#endif +{ + ++operation_no; + label_node(start); +} + +#ifdef __USE_PROTOS +void label_node(nfa_node *start) +#else +void label_node(start) +nfa_node *start; +#endif +{ + set new_label; + register int i; + + /* only do node if it hasn't been done before */ + if (start && start->nfa_set != operation_no){ + start->nfa_set = operation_no; + new_label = empty; + for (i = 0; i<class_no; ++i){ + /* if one element of class in old_label, + all elements are. */ + if (set_el(first_el[i],start->label)) + set_orel(i,&new_label); + } + set_free(start->label); + start->label = new_label; + /* do any nodes that can be reached from this one */ + label_node(start->trans[0]); + label_node(start->trans[1]); + } +} diff --git a/pccts/dlg/set.c b/pccts/dlg/set.c new file mode 100644 index 0000000..63447f5 --- /dev/null +++ b/pccts/dlg/set.c @@ -0,0 +1,816 @@ +/* set.c + + The following is a general-purpose set library originally developed + by Hank Dietz and enhanced by Terence Parr to allow dynamic sets. + + Sets are now structs containing the #words in the set and + a pointer to the actual set words. + + Generally, sets need not be explicitly allocated. They are + created/extended/shrunk when appropriate (e.g. in set_of()). + HOWEVER, sets need to be destroyed (free()ed) when they go out of scope + or are otherwise no longer needed. A routine is provided to + free a set. + + Sets can be explicitly created with set_new(s, max_elem). + + Sets can be declared to have minimum size to reduce realloc traffic. + Default minimum size = 1. + + Sets can be explicitly initialized to have no elements (set.n == 0) + by using the 'empty' initializer: + + Examples: + set a = empty; -- set_deg(a) == 0 + + return( empty ); + + Example set creation and destruction: + + set + set_of2(e,g) + unsigned e,g; + { + set a,b,c; + + b = set_of(e); -- Creates space for b and sticks in e + set_new(c, g); -- set_new(); set_orel() ==> set_of() + set_orel(g, &c); + a = set_or(b, c); + . + . + . + set_free(b); + set_free(c); + return( a ); + } + + 1987 by Hank Dietz + + Modified by: + Terence Parr + Purdue University + October 1989 + + Made it smell less bad to C++ 7/31/93 -- TJP +*/ + +#include <stdio.h> +#include "pcctscfg.h" +#ifdef __STDC__ +#include <stdlib.h> +#else +#include <malloc.h> +#endif +#include <string.h> + +#include "set.h" + +#define MIN(i,j) ( (i) > (j) ? (j) : (i)) +#define MAX(i,j) ( (i) < (j) ? (j) : (i)) + +/* elems can be a maximum of 32 bits */ +static unsigned bitmask[] = { + 0x00000001, 0x00000002, 0x00000004, 0x00000008, + 0x00000010, 0x00000020, 0x00000040, 0x00000080, + 0x00000100, 0x00000200, 0x00000400, 0x00000800, + 0x00001000, 0x00002000, 0x00004000, 0x00008000, +#if !defined(PC) || defined(PC32) + 0x00010000, 0x00020000, 0x00040000, 0x00080000, + 0x00100000, 0x00200000, 0x00400000, 0x00800000, + 0x01000000, 0x02000000, 0x04000000, 0x08000000, + 0x10000000, 0x20000000, 0x40000000, 0x80000000 +#endif +}; + +set empty = set_init; +static unsigned min=1; + +#define StrSize 200 + +#ifdef MEMCHK +#define CHK(a) \ + if ( a.setword != NULL ) \ + if ( !valid(a.setword) ) \ + {fprintf(stderr, "%s(%d): invalid set\n",__FILE__,__LINE__); exit(-1);} +#else +#define CHK(a) +#endif + +/* + * Set the minimum size (in words) of a set to reduce realloc calls + */ +void +#ifdef __USE_PROTOS +set_size( unsigned n ) +#else +set_size( n ) +unsigned n; +#endif +{ + min = n; +} + +unsigned int +#ifdef __USE_PROTOS +set_deg( set a ) +#else +set_deg( a ) +set a; +#endif +{ + /* Fast compute degree of a set... the number + of elements present in the set. Assumes + that all word bits are used in the set + and that SETSIZE(a) is a multiple of WORDSIZE. + */ + register unsigned *p = &(a.setword[0]); + register unsigned *endp = NULL; /* MR27 Avoid false memory check report */ + register unsigned degree = 0; + + CHK(a); + if ( a.n == 0 ) return(0); + endp = &(a.setword[a.n]); + while ( p < endp ) + { + register unsigned t = *p; + register unsigned *b = &(bitmask[0]); + do { + if (t & *b) ++degree; + } while (++b < &(bitmask[WORDSIZE])); + p++; + } + + return(degree); +} + +set +#ifdef __USE_PROTOS +set_or( set b, set c ) +#else +set_or( b, c ) +set b; +set c; +#endif +{ + /* Fast set union operation */ + /* resultant set size is max(b, c); */ + set *big; + set t; + unsigned int m,n; + register unsigned *r, *p, *q, *endp; + + CHK(b); CHK(c); + t = empty; + if (b.n > c.n) {big= &b; m=b.n; n=c.n;} else {big= &c; m=c.n; n=b.n;} + set_ext(&t, m); + r = t.setword; + + /* Or b,c until max of smaller set */ + q = c.setword; + p = b.setword; + endp = &(b.setword[n]); + while ( p < endp ) *r++ = *p++ | *q++; + + /* Copy rest of bigger set into result */ + p = &(big->setword[n]); + endp = &(big->setword[m]); + while ( p < endp ) *r++ = *p++; + + return(t); +} + +set +#ifdef __USE_PROTOS +set_and( set b, set c ) +#else +set_and( b, c ) +set b; +set c; +#endif +{ + /* Fast set intersection operation */ + /* resultant set size is min(b, c); */ + set t; + unsigned int n; + register unsigned *r, *p, *q, *endp; + + CHK(b); CHK(c); + t = empty; + n = (b.n > c.n) ? c.n : b.n; + if ( n == 0 ) return t; /* TJP 4-27-92 fixed for empty set */ + set_ext(&t, n); + r = t.setword; + + /* & b,c until max of smaller set */ + q = c.setword; + p = b.setword; + endp = &(b.setword[n]); + while ( p < endp ) *r++ = *p++ & *q++; + + return(t); +} + +set +#ifdef __USE_PROTOS +set_dif( set b, set c ) +#else +set_dif( b, c ) +set b; +set c; +#endif +{ + /* Fast set difference operation b - c */ + /* resultant set size is size(b) */ + set t; + unsigned int n; + register unsigned *r, *p, *q, *endp; + + CHK(b); CHK(c); + t = empty; + n = (b.n <= c.n) ? b.n : c.n ; + if ( b.n == 0 ) return t; /* TJP 4-27-92 fixed for empty set */ + /* WEC 12-1-92 fixed for c.n = 0 */ + set_ext(&t, b.n); + r = t.setword; + + /* Dif b,c until smaller set size */ + q = c.setword; + p = b.setword; + endp = &(b.setword[n]); + while ( p < endp ) *r++ = *p++ & (~ *q++); + + /* Copy rest of b into result if size(b) > c */ + if ( b.n > n ) + { + p = &(b.setword[n]); + endp = &(b.setword[b.n]); + while ( p < endp ) *r++ = *p++; + } + + return(t); +} + +set +#ifdef __USE_PROTOS +set_of( unsigned b ) +#else +set_of( b ) +unsigned b; +#endif +{ + /* Fast singleton set constructor operation */ + static set a; + + if ( b == nil ) return( empty ); + set_new(a, b); + a.setword[DIVWORD(b)] = bitmask[MODWORD(b)]; + + return(a); +} + +/* + * Extend (or shrink) the set passed in to have n words. + * + * if n is smaller than the minimum, boost n to have the minimum. + * if the new set size is the same as the old one, do nothing. + * + * TJP 4-27-92 Fixed so won't try to alloc 0 bytes + */ +void +#ifdef __USE_PROTOS +set_ext( set *a, unsigned int n ) +#else +set_ext( a, n ) +set *a; +unsigned int n; +#endif +{ + register unsigned *p; + register unsigned *endp; + unsigned int size; + + CHK((*a)); + if ( a->n == 0 ) + { + if ( n == 0 ) return; + if (a->setword != NULL) { + free (a->setword); /* MR20 */ + } + a->setword = (unsigned *) calloc(n, BytesPerWord); + if ( a->setword == NULL ) + { + fprintf(stderr, "set_ext(%d words): cannot allocate set\n", n); + exit(-1); + } + a->n = n; + return; + } + if ( n < min ) n = min; + if ( a->n == n || n == 0 ) return; + size = a->n; + a->n = n; + a->setword = (unsigned *) realloc( (char *)a->setword, (n*BytesPerWord) ); + if ( a->setword == NULL ) + { + fprintf(stderr, "set_ext(%d words): cannot allocate set\n", n); + exit(-1); + } + + p = &(a->setword[size]); /* clear from old size to new size */ + endp = &(a->setword[a->n]); + do { + *p++ = 0; + } while ( p < endp ); +} + +set +#ifdef __USE_PROTOS +set_not( set a ) +#else +set_not( a ) +set a; +#endif +{ + /* Fast not of set a (assumes all bits used) */ + /* size of resultant set is size(a) */ + /* ~empty = empty cause we don't know how bit to make set */ + set t; + register unsigned *r; + register unsigned *p = a.setword; + register unsigned *endp = &(a.setword[a.n]); + + CHK(a); + t = empty; + if ( a.n == 0 ) return( empty ); + set_ext(&t, a.n); + r = t.setword; + + do { + *r++ = (~ *p++); + } while ( p < endp ); + + return(t); +} + +int +#ifdef __USE_PROTOS +set_equ( set a, set b ) +#else +set_equ( a, b ) +set a; +set b; +#endif +{ +/* 8-Nov-97 Make it work with sets of different sizes */ +/* Easy to understand, too. Probably faster. */ +/* Check for a equal to b */ + + unsigned int count; /* MR11 */ + unsigned int i; /* MR11 */ + + CHK(a); CHK(b); + + count=MIN(a.n,b.n); + if (count == 0) return 1; + for (i=0; i < count; i++) { + if (a.setword[i] != b.setword[i]) return 0; + }; + if (a.n < b.n) { + for (i=count; i < b.n; i++) { + if (b.setword[i] != 0) return 0; + } + return 1; + } else if (a.n > b.n) { + for (i=count; i < a.n; i++) { + if (a.setword[i] != 0) return 0; + } + return 1; + } else { + return 1; + }; +} + +int +#ifdef __USE_PROTOS +set_sub( set a, set b ) +#else +set_sub( a, b ) +set a; +set b; +#endif +{ + +/* 8-Nov-97 Make it work with sets of different sizes */ +/* Easy to understand, too. Probably faster. */ +/* Check for a is a PROPER subset of b */ + + unsigned int count; + unsigned int i; + + CHK(a); CHK(b); + + if (a.n == 0) return 1; + count=MIN(a.n,b.n); + for (i=0; i < count; i++) { + if (a.setword[i] & ~b.setword[i]) return 0; + }; + if (a.n <= b.n) { + return 1; + } else { + for (i=count; i<a.n ; i++) { + if (a.setword[i]) return 0; + }; + }; + return 1; +} + +unsigned +#ifdef __USE_PROTOS +set_int( set b ) +#else +set_int( b ) +set b; +#endif +{ + /* Fast pick any element of the set b */ + register unsigned *p = b.setword; + register unsigned *endp = &(b.setword[b.n]); + + CHK(b); + if ( b.n == 0 ) return( nil ); + + do { + if (*p) { + /* Found a non-empty word of the set */ + register unsigned i = ((p - b.setword) << LogWordSize); + register unsigned t = *p; + p = &(bitmask[0]); + while (!(*p & t)) { + ++i; ++p; + } + return(i); + } + } while (++p < endp); + + /* Empty -- only element it contains is nil */ + return(nil); +} + +int +#ifdef __USE_PROTOS +set_el( unsigned b, set a ) +#else +set_el( b, a ) +unsigned b; +set a; +#endif +{ + CHK(a); + /* nil is an element of every set */ + if (b == nil) return(1); + if ( a.n == 0 || NumWords(b) > a.n ) return(0); + + /* Otherwise, we have to check */ + return( a.setword[DIVWORD(b)] & bitmask[MODWORD(b)] ); +} + +int +#ifdef __USE_PROTOS +set_nil( set a ) +#else +set_nil( a ) +set a; +#endif +{ + /* Fast check for nil set */ + register unsigned *p = a.setword; + register unsigned *endp; + + CHK(a); + if ( a.n == 0 ) return(1); + endp = &(a.setword[a.n]); + + /* The set is not empty if any word used to store + the set is non-zero. This means one must be a + bit careful about doing things like negation. + */ + do { + if (*p) return(0); + } while (++p < endp); + + return(1); +} + +char * +#ifdef __USE_PROTOS +set_str( set a ) +#else +set_str( a ) +set a; +#endif +{ + /* Fast convert set a into ASCII char string... + assumes that all word bits are used in the set + and that SETSIZE is a multiple of WORDSIZE. + Trailing 0 bits are removed from the string. + if no bits are on or set is empty, "" is returned. + */ + register unsigned *p = a.setword; + register unsigned *endp = &(a.setword[a.n]); + static char str_tmp[StrSize+1]; + register char *q = &(str_tmp[0]); + + CHK(a); + if ( a.n==0 ) {*q=0; return( &(str_tmp[0]) );} + do { + register unsigned t = *p; + register unsigned *b = &(bitmask[0]); + do { + *(q++) = (char) ((t & *b) ? '1' : '0'); + } while (++b < &(bitmask[WORDSIZE])); + } while (++p < endp); + + /* Trim trailing 0s & NULL terminate the string */ + while ((q > &(str_tmp[0])) && (*(q-1) != '1')) --q; + *q = 0; + + return(&(str_tmp[0])); +} + +set +#ifdef __USE_PROTOS +set_val( register char *s ) +#else +set_val( s ) +register char *s; +#endif +{ + /* Fast convert set ASCII char string into a set. + If the string ends early, the remaining set bits + are all made zero. + The resulting set size is just big enough to hold all elements. + */ + static set a; + register unsigned *p, *endp; + + set_new(a, strlen(s)); + p = a.setword; + endp = &(a.setword[a.n]); + do { + register unsigned *b = &(bitmask[0]); + /* Start with a word with no bits on */ + *p = 0; + do { + if (*s) { + if (*s == '1') { + /* Turn-on this bit */ + *p |= *b; + } + ++s; + } + } while (++b < &(bitmask[WORDSIZE])); + } while (++p < endp); + + return(a); +} + +/* + * Or element e into set a. a can be empty. + */ +void +#ifdef __USE_PROTOS +set_orel( unsigned e, set *a ) +#else +set_orel( e, a ) +unsigned e; +set *a; +#endif +{ + CHK((*a)); + if ( e == nil ) return; + if ( NumWords(e) > a->n ) set_ext(a, NumWords(e)); + a->setword[DIVWORD(e)] |= bitmask[MODWORD(e)]; +} + +/* + * Or set b into set a. a can be empty. does nothing if b empty. + */ +void +#ifdef __USE_PROTOS +set_orin( set *a, set b ) +#else +set_orin( a, b ) +set *a; +set b; +#endif +{ + /* Fast set union operation */ + /* size(a) is max(a, b); */ + unsigned int m; + register unsigned *p, + *q = b.setword, + *endq; /* MR20 */ + + CHK((*a)); CHK(b); + if ( b.n == 0 ) return; + endq = &(b.setword[b.n]); /* MR20 */ + m = (a->n > b.n) ? a->n : b.n; + set_ext(a, m); + p = a->setword; + do { + *p++ |= *q++; + } while ( q < endq ); +} + +/* + * And set b into set a. a can be empty. does nothing if b empty. + */ +void +#ifdef __USE_PROTOS +set_andin( set *a, set b ) +#else +set_andin( a, b ) +set *a; +set b; +#endif +{ + /* Fast set intersection operation */ + /* size(a) is max(a, b); */ + unsigned int m; + register unsigned *p, + *q = b.setword, + *endq = &(b.setword[b.n]); + + CHK((*a)); CHK(b); + if ( b.n == 0 ) return; + m = (a->n > b.n) ? a->n : b.n; + set_ext(a, m); + p = a->setword; + do { + *p++ &= *q++; + } while ( q < endq ); +} + +void +#ifdef __USE_PROTOS +set_rm( unsigned e, set a ) +#else +set_rm( e, a ) +unsigned e; +set a; +#endif +{ + /* Does not effect size of set */ + CHK(a); + if ( (e == nil) || (NumWords(e) > a.n) ) return; + a.setword[DIVWORD(e)] ^= (a.setword[DIVWORD(e)]&bitmask[MODWORD(e)]); +} + +void +#ifdef __USE_PROTOS +set_clr( set a ) +#else +set_clr( a ) +set a; +#endif +{ + /* Does not effect size of set */ + register unsigned *p = a.setword; + register unsigned *endp; + + CHK(a); + if ( a.n == 0 ) return; + endp = &(a.setword[a.n]); + do { + *p++ = 0; + } while ( p < endp ); +} + +set +#ifdef __USE_PROTOS +set_dup( set a ) +#else +set_dup( a ) +set a; +#endif +{ + set b; + register unsigned *p, + *q = a.setword, + *endq; /* MR20 */ + + CHK(a); + b = empty; + if ( a.n == 0 ) return( empty ); + endq = &(a.setword[a.n]); /* MR20 */ + set_ext(&b, a.n); + p = b.setword; + do { + *p++ = *q++; + } while ( q < endq ); + + return(b); +} + +/* + * Return a nil terminated list of unsigned ints that represents all + * "on" bits in the bit set. + * + * e.g. {011011} --> {1, 2, 4, 5, nil} + * + * _set_pdq and set_pdq are useful when an operation is required on each element + * of a set. Normally, the sequence is: + * + * while ( set_deg(a) > 0 ) { + * e = set_int(a); + * set_rm(e, a); + * ...process e... + * } + * Now, + * + * t = e = set_pdq(a); + * while ( *e != nil ) { + * ...process *e... + * e++; + * } + * free( t ); + * + * We have saved many set calls and have not destroyed set a. + */ +void +#ifdef __USE_PROTOS +_set_pdq( set a, register unsigned *q ) +#else +_set_pdq( a, q ) +set a; +register unsigned *q; +#endif +{ + register unsigned *p = a.setword, + *endp = &(a.setword[a.n]); + register unsigned e=0; + + CHK(a); + /* are there any space (possibility of elements)? */ + if ( a.n == 0 ) return; + do { + register unsigned t = *p; + register unsigned *b = &(bitmask[0]); + do { + if ( t & *b ) *q++ = e; + ++e; + } while (++b < &(bitmask[WORDSIZE])); + } while (++p < endp); + *q = nil; +} + +/* + * Same as _set_pdq except allocate memory. set_pdq is the natural function + * to use. + */ +unsigned * +#ifdef __USE_PROTOS +set_pdq( set a ) +#else +set_pdq( a ) +set a; +#endif +{ + unsigned *q; + int max_deg; + + CHK(a); + max_deg = WORDSIZE*a.n; + /* assume a.n!=0 & no elements is rare, but still ok */ + if ( a.n == 0 ) return(NULL); + q = (unsigned *) malloc((max_deg+1)*BytesPerWord); + if ( q == NULL ) return( NULL ); + _set_pdq(a, q); + return( q ); +} + +/* a function that produces a hash number for the set + */ +unsigned int +#ifdef __USE_PROTOS +set_hash( set a, register unsigned int mod ) +#else +set_hash( a, mod ) +set a; +register unsigned int mod; +#endif +{ + /* Fast hash of set a (assumes all bits used) */ + register unsigned *p = &(a.setword[0]); + register unsigned *endp = &(a.setword[a.n]); + register unsigned i = 0; + + CHK(a); + while (p<endp){ + i += (*p); + ++p; + } + + return(i % mod); +} diff --git a/pccts/dlg/stdpccts.h b/pccts/dlg/stdpccts.h new file mode 100644 index 0000000..3ce42d9 --- /dev/null +++ b/pccts/dlg/stdpccts.h @@ -0,0 +1,26 @@ +#ifndef STDPCCTS_H +#define STDPCCTS_H +/* + * stdpccts.h -- P C C T S I n c l u d e + * + * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001 + * Purdue University Electrical Engineering + * With AHPCRC, University of Minnesota + * ANTLR Version 1.33MR32 + */ + +#ifndef ANTLR_VERSION +#define ANTLR_VERSION 13332 +#endif + +#include "pcctscfg.h" +#include "pccts_stdio.h" + +#include <ctype.h> +#include "dlg.h" +#define zzSET_SIZE 8 +#include "antlr.h" +#include "tokens.h" +#include "dlgdef.h" +#include "mode.h" +#endif diff --git a/pccts/dlg/support.c b/pccts/dlg/support.c new file mode 100644 index 0000000..e41c5e8 --- /dev/null +++ b/pccts/dlg/support.c @@ -0,0 +1,240 @@ +/* + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * DLG 1.33 + * Will Cohen + * With mods by Terence Parr; AHPCRC, University of Minnesota + * 1989-2001 + */ + +#include <stdio.h> +#include <string.h> +#include "dlg.h" +#ifdef MEMCHK +#include "trax.h" +#else +#ifdef __STDC__ +#include <stdlib.h> +#else +#include <malloc.h> +#endif /* __STDC__ */ +#endif + +int err_found = 0; /* indicates whether problem found */ + +#ifdef __USE_PROTOS +void internal_error(char *s, char *file,int line) /* MR9 23-Sep-97 */ +#else +void internal_error(s,file,line) /* MR9 23-Sep-97 */ +char *s,*file; +int line; +#endif +{ + fprintf(stderr,s,file,line); + exit(PCCTS_EXIT_FAILURE); +} + +#ifdef __USE_PROTOS +char *dlg_malloc(int bytes,char *file,int line) +#else +char *dlg_malloc(bytes,file,line) +int bytes; +char *file; +int line; +#endif +{ + char *t; + + t = (char *) malloc(bytes); + if (!t){ + /* error */ + internal_error("%s(%d): unable to allocate memory\n", + file,line); + } + return t; +} + + +#ifdef __USE_PROTOS +char *dlg_calloc(int n,int bytes,char *file,int line) +#else +char *dlg_calloc(n,bytes,file,line) +int n,bytes; +char *file; +int line; +#endif +{ + char *t; + + t = (char *) calloc(n,bytes); + if (!t){ + /* error */ + internal_error("%s(%d): unable to allocate memory\n", + file,line); + } + return t; +} + + +#ifdef __USE_PROTOS +FILE *read_stream(char *name) +#else +FILE *read_stream(name) +char *name; +#endif +{ + FILE *f; + + if (name){ + if (name[0] == '-') { + fprintf(stderr, "dlg: invalid option: '%s'\n", name); + f = NULL; + }else{ + f = fopen(name, "r"); + if (f == NULL){ + /* couldn't open file */ + fprintf(stderr, + "dlg: Warning: Can't read file %s.\n", + name); + } + } + }else{ + /* open stdin if nothing there */ + f = stdin; + } + return f; +} + +#ifdef __USE_PROTOS +FILE *write_stream(char *name) +#else +FILE *write_stream(name) +char *name; +#endif +{ + FILE *f; + + if (name){ + if (name[0] == '-') { + fprintf(stderr, "dlg: invalid option: '%s'\n", name); + f = NULL; + }else{ + f = fopen(OutMetaName(name), "w"); + if (f == NULL){ + /* couldn't open file */ + fprintf(stderr, + "dlg: Warning: Can't write to file %s.\n", + name); + } + else +#ifdef SPECIAL_FOPEN + special_fopen_actions(OutMetaName(name)); /* MR1 */ +#else + ; /* MR1 */ +#endif + } + }else{ + /* open stdout if nothing there */ + f = stdout; + } + return f; +} + + +#ifdef __USE_PROTOS +void fatal(char *message,int line_no) +#else +void fatal(message,line_no) +char *message; +int line_no; +#endif +{ + fprintf(stderr,ErrHdr, + (file_str[0] ? file_str[0] : "stdin"), line_no); + fprintf(stderr, " Fatal: %s\n", message); + exit(PCCTS_EXIT_FAILURE); +} + +#ifdef __USE_PROTOS +void error(char *message,int line_no) +#else +void error(message,line_no) +char *message; +int line_no; +#endif +{ + fprintf(stderr,ErrHdr, + (file_str[0] ? file_str[0] : "stdin"), line_no); + fprintf(stderr, " Error: %s\n", message); + err_found = 1; +} + +#ifdef __USE_PROTOS +void warning(char *message,int line_no) +#else +void warning(message,line_no) +char *message; +int line_no; +#endif +{ + fprintf(stderr,ErrHdr, + (file_str[0] ? file_str[0] : "stdin"), line_no); + fprintf(stderr, " Warning: %s\n", message); +} + +/* MR10: Jeff Vincent + MR10: Changed to remove directory information from n only if + MR10: if OutputDirectory was changed by user (-o option) +*/ + +#ifdef __USE_PROTOS +char *OutMetaName(char *n) +#else +char *OutMetaName(n) +char *n; +#endif +{ + static char *dir_sym = DirectorySymbol; + static char newname[MaxFileName+1]; + char *p; + + /* If OutputDirectory is same as TopDirectory (platform default) then leave n alone. */ + if (strcmp(OutputDirectory, TopDirectory) == 0) + return n; + + /* p will point to filename without path information */ + if ((p = strrchr(n, *dir_sym)) != NULL) + p++; + else + p = n; + + /* Copy new output directory into newname[] */ + strcpy(newname, OutputDirectory); + + /* if new output directory does not have trailing dir_sym, add it! */ + if (newname[strlen(newname)-1] != *dir_sym) + strcat(newname, dir_sym); + + /* contatenate FILE NAME ONLY to new output directory */ + strcat(newname, p); + + return newname; +} diff --git a/pccts/dlg/tokens.h b/pccts/dlg/tokens.h new file mode 100644 index 0000000..217d4a2 --- /dev/null +++ b/pccts/dlg/tokens.h @@ -0,0 +1,133 @@ +#ifndef tokens_h +#define tokens_h +/* tokens.h -- List of labelled tokens and stuff + * + * Generated from: dlg_p.g + * + * Terence Parr, Will Cohen, and Hank Dietz: 1989-2001 + * Purdue University Electrical Engineering + * ANTLR Version 1.33MR32 + */ +#define zzEOF_TOKEN 1 +#define L_EOF 4 +#define PER_PER 5 +#define NAME_PER_PER 6 +#define LEXMEMBER 7 +#define LEXACTION 8 +#define PARSERCLASS 9 +#define LEXPREFIX 10 +#define ACTION 11 +#define GREAT_GREAT 12 +#define L_BRACE 13 +#define R_BRACE 14 +#define L_PAR 15 +#define R_PAR 16 +#define L_BRACK 17 +#define R_BRACK 18 +#define ZERO_MORE 19 +#define ONE_MORE 20 +#define OR 21 +#define RANGE 22 +#define NOT 23 +#define OCTAL_VALUE 24 +#define HEX_VALUE 25 +#define DEC_VALUE 26 +#define TAB 27 +#define NL 28 +#define CR 29 +#define BS 30 +#define CONTINUATION 31 +#define LIT 32 +#define REGCHAR 33 + +#ifdef __USE_PROTOS +void grammar(void); +#else +extern void grammar(); +#endif + +#ifdef __USE_PROTOS +void start_states(void); +#else +extern void start_states(); +#endif + +#ifdef __USE_PROTOS +void do_conversion(void); +#else +extern void do_conversion(); +#endif + +#ifdef __USE_PROTOS +void rule_list(void); +#else +extern void rule_list(); +#endif + +#ifdef __USE_PROTOS +void rule(void); +#else +extern void rule(); +#endif + +#ifdef __USE_PROTOS +void reg_expr(void); +#else +extern void reg_expr(); +#endif + +#ifdef __USE_PROTOS +void and_expr(void); +#else +extern void and_expr(); +#endif + +#ifdef __USE_PROTOS +void repeat_expr(void); +#else +extern void repeat_expr(); +#endif + +#ifdef __USE_PROTOS +void expr(void); +#else +extern void expr(); +#endif + +#ifdef __USE_PROTOS +void atom_list(void); +#else +extern void atom_list(); +#endif + +#ifdef __USE_PROTOS +void near_atom(void); +#else +extern void near_atom(); +#endif + +#ifdef __USE_PROTOS +void atom(void); +#else +extern void atom(); +#endif + +#ifdef __USE_PROTOS +void anychar(void); +#else +extern void anychar(); +#endif + +#endif +extern SetWordType zzerr1[]; +extern SetWordType zzerr2[]; +extern SetWordType zzerr3[]; +extern SetWordType setwd1[]; +extern SetWordType zzerr4[]; +extern SetWordType zzerr5[]; +extern SetWordType zzerr6[]; +extern SetWordType setwd2[]; +extern SetWordType zzerr7[]; +extern SetWordType zzerr8[]; +extern SetWordType zzerr9[]; +extern SetWordType setwd3[]; diff --git a/pccts/h/AParser.cpp b/pccts/h/AParser.cpp new file mode 100644 index 0000000..3621085 --- /dev/null +++ b/pccts/h/AParser.cpp @@ -0,0 +1,871 @@ +/* ANTLRParser.C + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +#include "pcctscfg.h" + +#include "pccts_stdlib.h" +#include "pccts_stdarg.h" +#include "pccts_string.h" +#include "pccts_stdio.h" + +PCCTS_NAMESPACE_STD + +/* I have to put this here due to C++ limitation + * that you can't have a 'forward' decl for enums. + * I hate C++!!!!!!!!!!!!!!! + * Of course, if I could use real templates, this would go away. + */ +// MR1 +// MR1 10-Apr-97 133MR1 Prevent use of varying sizes for the +// MR1 ANTLRTokenType enum +// MR1 + +enum ANTLRTokenType { TER_HATES_CPP=0, ITS_TOO_COMPLICATED=9999}; // MR1 + +#define ANTLR_SUPPORT_CODE + +#include ATOKEN_H +#include ATOKENBUFFER_H +#include APARSER_H + +static const int zzINF_DEF_TOKEN_BUFFER_SIZE = 2000; /* MR14 */ +static const int zzINF_BUFFER_TOKEN_CHUNK_SIZE = 1000; /* MR14 */ + + /* L o o k a h e a d M a c r o s */ + +/* maximum of 32 bits/unsigned int and must be 8 bits/byte; + * we only use 8 bits of it. + */ +SetWordType ANTLRParser::bitmask[sizeof(SetWordType)*8] = { + 0x00000001, 0x00000002, 0x00000004, 0x00000008, + 0x00000010, 0x00000020, 0x00000040, 0x00000080 +}; + +char ANTLRParser::eMsgBuffer[500] = ""; + +ANTLRParser:: +~ANTLRParser() +{ + delete [] token_type; + delete [] zzFAILtext; // MR16 Manfred Kogler +} + +ANTLRParser:: +ANTLRParser(ANTLRTokenBuffer *_inputTokens, + int k, + int use_inf_look, + int dlook, + int ssize) +{ + LLk = k; + can_use_inf_look = use_inf_look; +/* MR14 */ if (dlook != 0) { +/* MR14 */ panic("ANTLRParser::ANTLRParser - Demand lookahead not supported in C++ mode"); +/* MR14 */ +/* MR14 */ }; + demand_look = 0; /* demand_look = dlook; */ + bsetsize = ssize; + guessing = 0; + token_tbl = NULL; + eofToken = (ANTLRTokenType)1; + + // allocate lookahead buffer + token_type = new ANTLRTokenType[LLk]; + lap = 0; + labase = 0; +#ifdef ZZDEFER_FETCH + stillToFetch = 0; // MR19 +#endif + dirty = 0; + inf_labase = 0; // MR7 + inf_last = 0; // MR7 + /* prime lookahead buffer, point to inputTokens */ + this->inputTokens = _inputTokens; + this->inputTokens->setMinTokens(k); + _inputTokens->setParser(this); // MR1 + resynchConsumed=1; // MR8 + zzFAILtext=NULL; // MR9 + traceOptionValueDefault=0; // MR10 + traceReset(); // MR10 + zzGuessSeq=0; // MR10 + syntaxErrCount=0; // MR11 +} + +void ANTLRParser::init() +{ + prime_lookahead(); + resynchConsumed=1; // MR8 + traceReset(); // MR10 +} + +void ANTLRParser::traceReset() +{ + traceOptionValue=traceOptionValueDefault; + traceGuessOptionValue=1; + traceCurrentRuleName=NULL; + traceDepth=0; +} + + +#ifdef _MSC_VER // MR23 +//Turn off warning: +//interaction between '_setjmp' and C++ object destruction is non-portable +#pragma warning(disable : 4611) +#endif +int ANTLRParser:: +guess(ANTLRParserState *st) +{ + saveState(st); + guessing = 1; + return setjmp(guess_start.state); +} +#ifdef _MSC_VER // MR23 +#pragma warning(default: 4611) +#endif + +void ANTLRParser:: +saveState(ANTLRParserState *buf) +{ + buf->guess_start = guess_start; + buf->guessing = guessing; + buf->inf_labase = inf_labase; + buf->inf_last = inf_last; + buf->dirty = dirty; + buf->traceOptionValue=traceOptionValue; /* MR10 */ + buf->traceGuessOptionValue=traceGuessOptionValue; /* MR10 */ + buf->traceCurrentRuleName=traceCurrentRuleName; /* MR10 */ + buf->traceDepth=traceDepth; /* MR10 */ +} + +void ANTLRParser:: +restoreState(ANTLRParserState *buf) +{ + int i; + int prevTraceOptionValue; + + guess_start = buf->guess_start; + guessing = buf->guessing; + inf_labase = buf->inf_labase; + inf_last = buf->inf_last; + dirty = buf->dirty; + + // restore lookahead buffer from k tokens before restored TokenBuffer position + // if demand_look, then I guess we don't look backwards for these tokens. + for (i=1; i<=LLk; i++) token_type[i-1] = + inputTokens->bufferedToken(i-LLk)->getType(); + lap = 0; + labase = 0; + + /* MR10 */ + + prevTraceOptionValue=traceOptionValue; + traceOptionValue=buf->traceOptionValue; + if ( (prevTraceOptionValue > 0) != + (traceOptionValue > 0)) { + if (traceCurrentRuleName != NULL) { /* MR21 */ + if (traceOptionValue > 0) { + /* MR23 */ printMessage(stderr, + "trace enable restored in rule %s depth %d\n", + traceCurrentRuleName, + traceDepth); + }; + if (traceOptionValue <= 0) { + /* MR23 */ printMessage(stderr, + "trace disable restored in rule %s depth %d\n", + traceCurrentRuleName, /* MR21 */ + traceDepth); + }; + } + }; + traceGuessOptionValue=buf->traceGuessOptionValue; + traceCurrentRuleName=buf->traceCurrentRuleName; + traceDepth=buf->traceDepth; + traceGuessDone(buf); +} + +/* Get the next symbol from the input stream; put it into lookahead buffer; + * fill token_type[] fast reference cache also. NLA is the next place where + * a lookahead ANTLRAbstractToken should go. + */ +void ANTLRParser:: +consume() +{ + +#ifdef ZZDEBUG_CONSUME_ACTION + zzdebug_consume_action(); +#endif + +// MR19 V.H. Simonis +// Defer Fetch feature +// Moves action of consume() into LA() function + +#ifdef ZZDEFER_FETCH + stillToFetch++; +#else + NLA = inputTokens->getToken()->getType(); + dirty--; + lap = (lap+1)&(LLk-1); +#endif + +} + +_ANTLRTokenPtr ANTLRParser:: +LT(int i) +{ + +// MR19 V.H. Simonis +// Defer Fetch feature +// Moves action of consume() into LA() function + +#ifdef ZZDEFER_FETCH + undeferFetch(); +#endif + +#ifdef DEBUG_TOKENBUFFER + if ( i >= inputTokens->bufferSize() || inputTokens->minTokens() < LLk ) /* MR20 Was "<=" */ + { + char buf[2000]; /* MR20 Was "static" */ + sprintf(buf, "The minimum number of tokens you requested that the\nANTLRTokenBuffer buffer is not enough to satisfy your\nLT(%d) request; increase 'k' argument to constructor for ANTLRTokenBuffer\n", i); + panic(buf); + } +#endif + return inputTokens->bufferedToken(i-LLk); +} + +void +ANTLRParser:: +look(int k) +{ + int i, c = k - (LLk-dirty); + for (i=1; i<=c; i++) consume(); +} + +/* fill the lookahead buffer up with k symbols (even if DEMAND_LOOK); + */ +void +ANTLRParser:: +prime_lookahead() +{ + int i; + for(i=1;i<=LLk; i++) consume(); + dirty=0; + // lap = 0; // MR14 Sinan Karasu (sinan.karasu@boeing.com) + // labase = 0; // MR14 + labase=lap; // MR14 +} + +/* check to see if the current input symbol matches '_t'. + * During NON demand lookahead mode, dirty will always be 0 and + * hence the extra code for consuming tokens in _match is never + * executed; the same routine can be used for both modes. + */ +int ANTLRParser:: +_match(ANTLRTokenType _t, ANTLRChar **MissText, + ANTLRTokenType *MissTok, _ANTLRTokenPtr *BadTok, + SetWordType **MissSet) +{ + if ( dirty==LLk ) { + consume(); + } + if ( LA(1)!=_t ) { + *MissText=NULL; + *MissTok= _t; + *BadTok = LT(1); + *MissSet=NULL; + return 0; + } + dirty++; + labase = (labase+1)&(LLk-1); // labase maintained even if !demand look + return 1; +} + +/* check to see if the current input symbol matches '_t'. + * Used during exception handling. + */ +int ANTLRParser:: +_match_wsig(ANTLRTokenType _t) +{ + if ( dirty==LLk ) { + consume(); + } + if ( LA(1)!=_t ) return 0; + dirty++; + labase = (labase+1)&(LLk-1); // labase maintained even if !demand look + return 1; +} + +/* check to see if the current input symbol matches any token in a set. + * During NON demand lookahead mode, dirty will always be 0 and + * hence the extra code for consuming tokens in _match is never + * executed; the same routine can be used for both modes. + */ +int ANTLRParser:: +_setmatch(SetWordType *tset, ANTLRChar **MissText, + ANTLRTokenType *MissTok, _ANTLRTokenPtr *BadTok, + SetWordType **MissSet, SetWordType *tokclassErrset) +{ + if ( dirty==LLk ) { + consume(); + } + if ( !set_el(LA(1), tset) ) { + *MissText=NULL; /* MR23 */ + *MissTok=(ANTLRTokenType) 0; /* MR23 */ + *BadTok=LT(1); /* MR23 */ + *MissSet=tokclassErrset; /* MR23 */ + return 0; + } + dirty++; + labase = (labase+1)&(LLk-1); // labase maintained even if !demand look + return 1; +} + +int ANTLRParser:: +_setmatch_wsig(SetWordType *tset) +{ + if ( dirty==LLk ) { + consume(); + } + if ( !set_el(LA(1), tset) ) return 0; + dirty++; + labase = (labase+1)&(LLk-1); // labase maintained even if !demand look + return 1; +} + + /* Exception handling routines */ +// +// 7-Apr-97 133MR1 +// Change suggested by Eli Sternheim (eli@interhdl.com) +// +void ANTLRParser:: +consumeUntil(SetWordType *st) +{ + ANTLRTokenType tmp; // MR1 + const int Eof=1; // MR1 + while ( !set_el( (tmp=LA(1)), st) && tmp!=Eof) { consume(); } // MR1 +} + +// +// 7-Apr-97 133MR1 +// Change suggested by Eli Sternheim (eli@interhdl.com) +// +void ANTLRParser:: +consumeUntilToken(int t) +{ + int tmp; // MR1 + const int Eof=1; // MR1 + while ( (tmp=LA(1)) !=t && tmp!=Eof) { consume(); } // MR1 +} + + + /* Old error stuff */ + +void ANTLRParser:: +resynch(SetWordType *wd,SetWordType mask) +{ + +/* MR8 S.Bochnak@microtool.com.pl */ +/* MR8 Change file scope static "consumed" to instance var */ + + /* if you enter here without having consumed a token from last resynch + * force a token consumption. + */ +/* MR8 */ if ( !resynchConsumed ) {consume(); resynchConsumed=1; return;} + + /* if current token is in resynch set, we've got what we wanted */ + +/* MR8 */ if ( wd[LA(1)]&mask || LA(1) == eofToken ) {resynchConsumed=0; return;} + + /* scan until we find something in the resynch set */ + + while ( !(wd[LA(1)]&mask) && LA(1) != eofToken ) {consume();} + +/* MR8 */ resynchConsumed=1; +} + +/* standard error reporting function that assumes DLG-based scanners; + * you should redefine in subclass to change it or if you use your + * own scanner. + */ + +/* MR23 THM There appears to be a parameter "badText" passed to syn() + which is not present in the parameter list. This may be + because in C mode there is no attribute function which + returns the text, so the text representation of the token + must be passed explicitly. I think. +*/ + +void ANTLRParser:: +syn(_ANTLRTokenPtr /*tok MR23*/, ANTLRChar *egroup, SetWordType *eset, + ANTLRTokenType etok, int k) +{ + int line; + + line = LT(1)->getLine(); + + syntaxErrCount++; /* MR11 */ + + /* MR23 If the token is not an EOF token, then use the ->getText() value. + + If the token is the EOF token the text returned by ->getText() + may be garbage. If the text from the token table is "@" use + "<eof>" instead, because end-users don't know what "@" means. + If the text is not "@" then use that text, which must have been + supplied by the grammar writer. + */ + const char * errorAt = LT(1)->getText(); + if (LA(1) == eofToken) { + errorAt = parserTokenName(LA(1)); + if (errorAt[0] == '@') errorAt = "<eof>"; + } + /* MR23 */ printMessage(stderr, "line %d: syntax error at \"%s\"", + line, errorAt); + if ( !etok && !eset ) {/* MR23 */ printMessage(stderr, "\n"); return;} + if ( k==1 ) /* MR23 */ printMessage(stderr, " missing"); + else + { + /* MR23 */ printMessage(stderr, "; \"%s\" not", LT(k)->getText()); // MR23 use LT(k) since k>1 + if ( set_deg(eset)>1 ) /* MR23 */ printMessage(stderr, " in"); + } + if ( set_deg(eset)>0 ) edecode(eset); + else /* MR23 */ printMessage(stderr, " %s", token_tbl[etok]); + if ( strlen(egroup) > 0 ) /* MR23 */ printMessage(stderr, " in %s", egroup); + /* MR23 */ printMessage(stderr, "\n"); +} + +/* is b an element of set p? */ +int ANTLRParser:: +set_el(ANTLRTokenType b, SetWordType *p) +{ + return( p[DIVWORD(b)] & bitmask[MODWORD(b)] ); +} + +int ANTLRParser:: +set_deg(SetWordType *a) +{ + /* Fast compute degree of a set... the number + of elements present in the set. Assumes + that all word bits are used in the set + */ + register SetWordType *p = a; + register SetWordType *endp = &(a[bsetsize]); + register int degree = 0; + + if ( a == NULL ) return 0; + while ( p < endp ) + { + register SetWordType t = *p; + register SetWordType *b = &(bitmask[0]); + do { + if (t & *b) ++degree; + } while (++b < &(bitmask[sizeof(SetWordType)*8])); + p++; + } + + return(degree); +} + +void ANTLRParser:: +edecode(SetWordType *a) +{ + register SetWordType *p = a; + register SetWordType *endp = &(p[bsetsize]); + register unsigned e = 0; + + if ( set_deg(a)>1 ) /* MR23 */ printMessage(stderr, " {"); + do { + register SetWordType t = *p; + register SetWordType *b = &(bitmask[0]); + do { + if ( t & *b ) /* MR23 */ printMessage(stderr, " %s", token_tbl[e]); + e++; + } while (++b < &(bitmask[sizeof(SetWordType)*8])); + } while (++p < endp); + if ( set_deg(a)>1 ) /* MR23 */ printMessage(stderr, " }"); +} + +/* input looks like: + * zzFAIL(k, e1, e2, ...,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText,&zzErrk) + * where the zzMiss stuff is set here to the token that did not match + * (and which set wasn't it a member of). + */ + +// MR9 29-Sep-97 Stan Bochnak (S.Bochnak@microTool.com.pl) +// MR9 Original fix to static allocated text didn't +// MR9 work because a pointer to it was passed back +// MR9 to caller. Replace with instance variable. + +const int SETWORDCOUNT=20; + +void +ANTLRParser::FAIL(int k, ...) +{ +// +// MR1 10-Apr-97 +// + + if (zzFAILtext == NULL) zzFAILtext=new char [1000]; // MR9 + SetWordType **f=new SetWordType *[SETWORDCOUNT]; // MR1 // MR9 + SetWordType **miss_set; + ANTLRChar **miss_text; + _ANTLRTokenPtr *bad_tok; + ANTLRChar **bad_text; +// +// 7-Apr-97 133MR1 +// err_k is passed as a "int *", not "unsigned *" +// + int *err_k; // MR1 + int i; + va_list ap; + + va_start(ap, k); + + zzFAILtext[0] = '\0'; + if ( k > SETWORDCOUNT ) panic("FAIL: overflowed buffer"); + for (i=1; i<=k; i++) /* collect all lookahead sets */ + { + f[i-1] = va_arg(ap, SetWordType *); + } + for (i=1; i<=k; i++) /* look for offending token */ + { + if ( i>1 ) strcat(zzFAILtext, " "); + strcat(zzFAILtext, LT(i)->getText()); + if ( !set_el(LA(i), f[i-1]) ) break; + } + miss_set = va_arg(ap, SetWordType **); + miss_text = va_arg(ap, ANTLRChar **); + bad_tok = va_arg(ap, _ANTLRTokenPtr *); + bad_text = va_arg(ap, ANTLRChar **); + err_k = va_arg(ap, int *); // MR1 + if ( i>k ) + { + /* bad; lookahead is permutation that cannot be matched, + * but, the ith token of lookahead is valid at the ith position + * (The old LL sub 1 (k) versus LL(k) parsing technique) + */ + *miss_set = NULL; + *miss_text = LT(1)->getText(); + *bad_tok = LT(1); + *bad_text = (*bad_tok)->getText(); + *err_k = k; +// +// MR4 20-May-97 erroneously deleted contents of f[] +// MR4 reported by Bruce Guenter (bruceg@qcc.sk.ca) +// MR1 10-Apr-97 release temporary storage +// + delete [] f; // MR1 + return; // MR1 + } +/* MR23 printMessage(stderr, "%s not in %dth set\n", zztokens[LA(i)], i);*/ + *miss_set = f[i-1]; + *miss_text = zzFAILtext; + *bad_tok = LT(i); + *bad_text = (*bad_tok)->getText(); + if ( i==1 ) *err_k = 1; + else *err_k = k; +// +// MR4 20-May-97 erroneously deleted contents of f[] +// MR4 reported by Bruce Guenter (bruceg@qcc.sk.ca) +// MR1 10-Apr-97 release temporary storage +// + delete [] f; // MR1 + return; // MR1 +} + +int ANTLRParser:: +_match_wdfltsig(ANTLRTokenType tokenWanted, SetWordType *whatFollows) +{ + if ( dirty==LLk ) consume(); + + if ( LA(1)!=tokenWanted ) + { + syntaxErrCount++; /* MR11 */ + /* MR23 */ printMessage(stderr, + "line %d: syntax error at \"%s\" missing %s\n", + LT(1)->getLine(), + (LA(1)==eofToken && LT(1)->getText()[0] == '@')?"<eof>":LT(1)->getText(), /* MR21a */ + token_tbl[tokenWanted]); + consumeUntil( whatFollows ); + return 0; + } + else { + dirty++; + labase = (labase+1)&(LLk-1); // labase maintained even if !demand look +/* if ( !demand_look ) consume(); */ + return 1; + } +} + + +int ANTLRParser:: +_setmatch_wdfltsig(SetWordType *tokensWanted, + ANTLRTokenType tokenTypeOfSet, + SetWordType *whatFollows) +{ + if ( dirty==LLk ) consume(); + if ( !set_el(LA(1), tokensWanted) ) + { + syntaxErrCount++; /* MR11 */ + /* MR23 */ printMessage(stderr, + "line %d: syntax error at \"%s\" missing %s\n", + LT(1)->getLine(), + (LA(1)==eofToken && LT(1)->getText()[0] == '@')?"<eof>":LT(1)->getText(), /* MR21a */ + token_tbl[tokenTypeOfSet]); + consumeUntil( whatFollows ); + return 0; + } + else { + dirty++; + labase = (labase+1)&(LLk-1); // labase maintained even if !demand look +/* if ( !demand_look ) consume(); */ + return 1; + } +} + +char *ANTLRParser:: +eMsgd(char *err,int d) +{ + sprintf(eMsgBuffer, err, d); // dangerous, but I don't care + return eMsgBuffer; +} + +char *ANTLRParser:: +eMsg(char *err, char *s) +{ + sprintf(eMsgBuffer, err, s); + return eMsgBuffer; +} + +char *ANTLRParser:: +eMsg2(char *err,char *s, char *t) +{ + sprintf(eMsgBuffer, err, s, t); + return eMsgBuffer; +} + +void ANTLRParser:: +panic(const char *msg) // MR20 const +{ + /* MR23 */ printMessage(stderr, "ANTLR panic: %s\n", msg); + exit(PCCTS_EXIT_FAILURE); // MR1 +} + +const ANTLRChar *ANTLRParser:: // MR1 +parserTokenName(int tok) { // MR1 + return token_tbl[tok]; // MR1 +} // MR1 + +void ANTLRParser::traceGuessDone(const ANTLRParserState *state) { + + int doIt=0; + + if (traceCurrentRuleName == NULL) return; + + if (traceOptionValue <= 0) { + doIt=0; + } else if (traceGuessOptionValue <= 0) { + doIt=0; + } else { + doIt=1; + }; + + if (doIt) { + /* MR23 */ printMessage(stderr,"guess done - returning to rule %s {\"%s\"} at depth %d", + state->traceCurrentRuleName, + LT(1)->getType() == eofToken ? "@" : LT(1)->getText(), + state->traceDepth); + if (state->guessing != 0) { + /* MR23 */ printMessage(stderr," (guess mode continues - an enclosing guess is still active)"); + } else { + /* MR23 */ printMessage(stderr," (guess mode ends)"); + }; + /* MR23 */ printMessage(stderr,"\n"); + }; +} + +void ANTLRParser::traceGuessFail() { + + int doIt=0; + + if (traceCurrentRuleName == NULL) return; /* MR21 */ + + if (traceOptionValue <= 0) { + doIt=0; + } else if (guessing && traceGuessOptionValue <= 0) { + doIt=0; + } else { + doIt=1; + }; + + if (doIt) { + /* MR23 */ printMessage(stderr,"guess failed in %s\n",traceCurrentRuleName); + }; +} + +/* traceOption: + zero value turns off trace +*/ + +void ANTLRParser::tracein(const ANTLRChar * rule) { + + int doIt=0; + + traceDepth++; + traceCurrentRuleName=rule; + + if (traceOptionValue <= 0) { + doIt=0; + } else if (guessing && traceGuessOptionValue <= 0) { + doIt=0; + } else { + doIt=1; + }; + + if (doIt) { + /* MR23 */ printMessage(stderr,"enter rule %s {\"%s\"} depth %d", + rule, + LT(1)->getType() == eofToken ? "@" : LT(1)->getText(), + traceDepth); + if (guessing) /* MR23 */ printMessage(stderr," guessing"); + /* MR23 */ printMessage(stderr,"\n"); + }; + return; +} + +void ANTLRParser::traceout(const ANTLRChar * rule) { + + int doIt=0; + + traceDepth--; + + if (traceOptionValue <= 0) { + doIt=0; + } else if (guessing && traceGuessOptionValue <= 0) { + doIt=0; + } else { + doIt=1; + }; + + if (doIt) { + /* MR23 */ printMessage(stderr,"exit rule %s {\"%s\"} depth %d", + rule, + LT(1)->getType() == eofToken ? "@" : LT(1)->getText(), + traceDepth+1); + if (guessing) /* MR23 */ printMessage(stderr," guessing"); + /* MR23 */ printMessage(stderr,"\n"); + }; +} + +int ANTLRParser::traceOption(int delta) { + + int prevValue=traceOptionValue; + + traceOptionValue=traceOptionValue+delta; + + if (traceCurrentRuleName != NULL) { + if (prevValue <= 0 && traceOptionValue > 0) { + /* MR23 */ printMessage(stderr,"trace enabled in rule %s depth %d\n",traceCurrentRuleName,traceDepth); + }; + if (prevValue > 0 && traceOptionValue <= 0) { + /* MR23 */ printMessage(stderr,"trace disabled in rule %s depth %d\n",traceCurrentRuleName,traceDepth); + }; + }; + + return prevValue; +} + +int ANTLRParser::traceGuessOption(int delta) { + + int prevValue=traceGuessOptionValue; + + traceGuessOptionValue=traceGuessOptionValue+delta; + + if (traceCurrentRuleName != NULL) { + if (prevValue <= 0 && traceGuessOptionValue > 0) { + /* MR23 */ printMessage(stderr,"guess trace enabled in rule %s depth %d\n",traceCurrentRuleName,traceDepth); + }; + if (prevValue > 0 && traceGuessOptionValue <= 0) { + /* MR23 */ printMessage(stderr,"guess trace disabled in rule %s depth %d\n",traceCurrentRuleName,traceDepth); + }; + }; + return prevValue; +} + +// MR19 V.H. Simonis Defer Fetch feature + +void ANTLRParser::undeferFetch() +{ + +#ifdef ZZDEFER_FETCH + if (stillToFetch) { + for (int stillToFetch_x = 0; stillToFetch_x < stillToFetch; ++stillToFetch_x) { + NLA = inputTokens->getToken()->getType(); + dirty--; + lap = (lap+1)&(LLk-1); + } + stillToFetch = 0; + } +#else + return; +#endif + +} + +int ANTLRParser::isDeferFetchEnabled() +{ +#ifdef ZZDEFER_FETCH + return 1; +#else + return 0; +#endif +} + +//MR23 +int ANTLRParser::printMessage(FILE* pFile, const char* pFormat, ...) +{ + va_list marker; + va_start( marker, pFormat ); + int iRet = printMessageV(pFile, pFormat, marker); + va_end( marker ); + return iRet; +} + +int ANTLRParser::printMessageV(FILE* pFile, const char* pFormat, va_list arglist) // MR23 +{ + return vfprintf(pFile, pFormat, arglist); +} + +// MR23 Move semantic predicate error handling from macro to virtual function +// +// Called by the zzfailed_pred + +void ANTLRParser::failedSemanticPredicate(const char* predicate) +{ + printMessage(stdout,"line %d: semantic error; failed predicate: '%s'\n", + LT(1)->getLine(), predicate); +} diff --git a/pccts/h/AParser.h b/pccts/h/AParser.h new file mode 100644 index 0000000..8272e08 --- /dev/null +++ b/pccts/h/AParser.h @@ -0,0 +1,376 @@ +/* ANTLRParser.h + * + * Define the generic ANTLRParser superclass, which is subclassed to + * define an actual parser. + * + * Before entry into this file: ANTLRTokenType must be set. + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +#ifndef APARSER_H_GATE +#define APARSER_H_GATE + +#include "pcctscfg.h" + +#include "pccts_stdio.h" +#include "pccts_setjmp.h" + +PCCTS_NAMESPACE_STD + +#include ATOKEN_H +#include ATOKENBUFFER_H + +#ifdef ZZCAN_GUESS +#ifndef ZZINF_LOOK +#define ZZINF_LOOK +#endif +#endif + + +#define NLA (token_type[lap&(LLk-1)])/* --> next LA */ + +typedef unsigned char SetWordType; + +/* Define external bit set stuff (for SetWordType) */ +#define EXT_WORDSIZE (sizeof(char)*8) +#define EXT_LOGWORDSIZE 3 + + /* s y n t a c t i c p r e d i c a t e s t u f f */ + +#ifndef zzUSER_GUESS_HOOK +#define zzUSER_GUESS_HOOK(seqFrozen,zzrv) +#endif + +#ifndef zzUSER_GUESS_DONE_HOOK +#define zzUSER_GUESS_DONE_HOOK(seqFrozen) +#endif + +/* MR14 Add zzUSER_GUESS_FAIL_HOOK and related code */ + +#define zzUSER_GUESS_FAIL_HOOK_INTERNAL zzUSER_GUESS_FAIL_HOOK(SeqFrozen) +#ifndef zzUSER_GUESS_FAIL_HOOK +#define zzUSER_GUESS_FAIL_HOOK(zzGuessSeq) +#endif + + +typedef struct _zzjmp_buf { + jmp_buf state; + } zzjmp_buf; + +/* these need to be macros not member functions */ +#define zzGUESS_BLOCK ANTLRParserState zzst; int zzrv; int _marker; int zzGuessSeqFrozen; +#define zzNON_GUESS_MODE if ( !guessing ) +#define zzGUESS_FAIL guess_fail(); + +/* Note: zzGUESS_DONE does not execute longjmp() */ + +#define zzGUESS_DONE {zzrv=1; inputTokens->rewind(_marker); guess_done(&zzst);zzUSER_GUESS_DONE_HOOK(zzGuessSeqFrozen) } +#define zzGUESS saveState(&zzst); \ + guessing = 1; \ + zzGuessSeqFrozen = ++zzGuessSeq; \ + _marker = inputTokens->mark(); \ + zzrv = setjmp(guess_start.state); \ + zzUSER_GUESS_HOOK(zzGuessSeqFrozen,zzrv) \ + if ( zzrv ) zzGUESS_DONE + +#define zzTRACEdata const ANTLRChar *zzTracePrevRuleName = NULL; + +#ifndef zzTRACEIN +#define zzTRACEIN(r) zzTracePrevRuleName=traceCurrentRuleName;tracein(r); +#endif +#ifndef zzTRACEOUT +#define zzTRACEOUT(r) traceout(r);traceCurrentRuleName=zzTracePrevRuleName; +#endif + + /* a n t l r p a r s e r d e f */ + +struct ANTLRParserState { + /* class variables */ + zzjmp_buf guess_start; + int guessing; + + int inf_labase; + int inf_last; + + int dirty; + + int traceOptionValue; // MR10 + int traceGuessOptionValue; // MR10 + const ANTLRChar *traceCurrentRuleName; // MR10 + int traceDepth; // MR10 + +}; + +/* notes: + * + * multiple inheritance is a cool way to include what stuff is needed + * in this structure (like guess stuff). however, i'm not convinced that + * multiple inheritance works correctly on all platforms. not that + * much space is used--just include all possibly useful members. + * + * the class should also be a template with arguments for the lookahead + * depth and so on. that way, more than one parser can be defined (as + * each will probably have different lookahead requirements). however, + * am i sure that templates work? no, i'm not sure. + * + * no attributes are maintained and, hence, the 'asp' variable is not + * needed. $i can still be referenced, but it refers to the token + * associated with that rule element. question: where are the token's + * stored if not on the software stack? in local variables created + * and assigned to by antlr. + */ +class ANTLRParser { +protected: + /* class variables */ + static SetWordType bitmask[sizeof(SetWordType)*8]; + static char eMsgBuffer[500]; + +protected: + int LLk; // number of lookahead symbols (old LL_K) + int demand_look; + ANTLRTokenType eofToken; // when do I stop during resynch()s + int bsetsize; // size of bitsets created by ANTLR in + // units of SetWordType + + ANTLRTokenBuffer *inputTokens; //place to get input tokens + + zzjmp_buf guess_start; // where to jump back to upon failure + int guessing; // if guessing (using (...)? predicate) + + // infinite lookahead stuff + int can_use_inf_look; // set by subclass (generated by ANTLR) + int inf_lap; + int inf_labase; + int inf_last; + int *_inf_line; + + const ANTLRChar **token_tbl; // pointer to table of token type strings MR20 const + + int dirty; // used during demand lookahead + + ANTLRTokenType *token_type; // fast reference cache of token.getType() +// ANTLRLightweightToken **token; // the token with all its attributes + int lap; + int labase; +#ifdef ZZDEFER_FETCH + int stillToFetch; // MR19 V.H. Simonis +#endif + +private: + void fill_inf_look(); + +protected: + virtual void guess_fail() { // MR9 27-Sep-97 make virtual + traceGuessFail(); // MR10 + longjmp(guess_start.state, 1); } // MR9 + virtual void guess_done(ANTLRParserState *st) { // MR9 27-Sep-97 make virtual + restoreState(st); } // MR9 + virtual int guess(ANTLRParserState *); // MR9 27-Sep-97 make virtual + void look(int); + int _match(ANTLRTokenType, ANTLRChar **, ANTLRTokenType *, + _ANTLRTokenPtr *, SetWordType **); + int _setmatch(SetWordType *, ANTLRChar **, ANTLRTokenType *, + _ANTLRTokenPtr *, SetWordType **, + SetWordType * tokclassErrset /* MR23 */); + int _match_wsig(ANTLRTokenType); + int _setmatch_wsig(SetWordType *); + virtual void consume(); + virtual void resynch(SetWordType *wd,SetWordType mask); // MR21 + void prime_lookahead(); + virtual void tracein(const ANTLRChar *r); // MR10 + virtual void traceout(const ANTLRChar *r); // MR10 + static unsigned MODWORD(unsigned x) {return x & (EXT_WORDSIZE-1);} // x % EXT_WORDSIZE // MR9 + static unsigned DIVWORD(unsigned x) {return x >> EXT_LOGWORDSIZE;} // x / EXT_WORDSIZE // MR9 + int set_deg(SetWordType *); + int set_el(ANTLRTokenType, SetWordType *); + virtual void edecode(SetWordType *); // MR1 + virtual void FAIL(int k, ...); // MR1 + int traceOptionValue; // MR10 + int traceGuessOptionValue; // MR10 + const ANTLRChar *traceCurrentRuleName; // MR10 + int traceDepth; // MR10 + void traceReset(); // MR10 + virtual void traceGuessFail(); // MR10 + virtual void traceGuessDone(const ANTLRParserState *); // MR10 + int zzGuessSeq; // MR10 + +public: + ANTLRParser(ANTLRTokenBuffer *, + int k=1, + int use_inf_look=0, + int demand_look=0, + int bsetsize=1); + virtual ~ANTLRParser(); + + virtual void init(); + + ANTLRTokenType LA(int i) + { +// +// MR14 demand look will always be 0 for C++ mode +// +//// return demand_look ? token_type[(labase+(i)-1)&(LLk-1)] : +//// token_type[(lap+(i)-1)&(LLk-1)]; + +// MR19 V.H. Simonis Defer fetch feature + +#ifdef ZZDEFER_FETCH + undeferFetch(); +#endif + return token_type[(lap+(i)-1)&(LLk-1)]; + } + _ANTLRTokenPtr LT(int i); + + void setEofToken(ANTLRTokenType t) { eofToken = t; } + ANTLRTokenType getEofToken() const { return eofToken; } // MR14 + + void noGarbageCollectTokens() { inputTokens->noGarbageCollectTokens(); } + void garbageCollectTokens() { inputTokens->garbageCollectTokens(); } + + virtual void syn(_ANTLRTokenPtr tok, ANTLRChar *egroup, + SetWordType *eset, ANTLRTokenType etok, int k); + virtual void saveState(ANTLRParserState *); // MR9 27-Sep-97 make virtual + virtual void restoreState(ANTLRParserState *); // MR9 27-Sep-97 make virtual + + virtual void panic(const char *msg); // MR20 const + + static char *eMsgd(char *,int); + static char *eMsg(char *,char *); + static char *eMsg2(char *,char *,char *); + + virtual int printMessage(FILE* pFile, const char* pFormat, ...); // MR23 + virtual int printMessageV(FILE* pFile, const char* pFormat, va_list arglist); // MR23 + + void consumeUntil(SetWordType *st); + void consumeUntilToken(int t); + + virtual int _setmatch_wdfltsig(SetWordType *tokensWanted, + ANTLRTokenType tokenTypeOfSet, + SetWordType *whatFollows); + virtual int _match_wdfltsig(ANTLRTokenType tokenWanted, + SetWordType *whatFollows); + + const ANTLRChar * parserTokenName(int tok); // MR1 + + int traceOptionValueDefault; // MR11 + int traceOption(int delta); // MR11 + int traceGuessOption(int delta); // MR11 + +// MR8 5-Aug-97 S.Bochnak@microtool.com.pl +// MR8 Move resynch static local variable +// MR8 to class instance + + int syntaxErrCount; // MR12 + ANTLRTokenStream *getLexer() const { // MR12 + return inputTokens ? inputTokens->getLexer() : 0; } // MR12 +protected: // MR8 + int resynchConsumed; // MR8 + char *zzFAILtext; // workarea required by zzFAIL // MR9 + void undeferFetch(); // MR19 V.H. Simonis + int isDeferFetchEnabled(); // MR19 V.H. Simonis + virtual void failedSemanticPredicate(const char* predicate); /* MR23 */ +}; + +#define zzmatch(_t) \ + if ( !_match((ANTLRTokenType)_t, &zzMissText, &zzMissTok, \ + (_ANTLRTokenPtr *) &zzBadTok, &zzMissSet) ) goto fail; + +#define zzmatch_wsig(_t,handler) \ + if ( !_match_wsig((ANTLRTokenType)_t) ) if ( guessing ) zzGUESS_FAIL else {_signal=MismatchedToken; goto handler;} + +#define zzsetmatch(_ts,_tokclassErrset) \ + if ( !_setmatch(_ts, &zzMissText, &zzMissTok, \ + (_ANTLRTokenPtr *) &zzBadTok, &zzMissSet, _tokclassErrset) ) goto fail; + +#define zzsetmatch_wsig(_ts, handler) \ + if ( !_setmatch_wsig(_ts) ) if ( guessing ) zzGUESS_FAIL else {_signal=MismatchedToken; goto handler;} + +/* For the dflt signal matchers, a FALSE indicates that an error occurred + * just like the other matchers, but in this case, the routine has already + * recovered--we do NOT want to consume another token. However, when + * the match was successful, we do want to consume hence _signal=0 so that + * a token is consumed by the "if (!_signal) consume(); _signal=NoSignal;" + * preamble. + */ +#define zzsetmatch_wdfltsig(tokensWanted, tokenTypeOfSet, whatFollows) \ + if ( !_setmatch_wdfltsig(tokensWanted, tokenTypeOfSet, whatFollows) ) \ + _signal = MismatchedToken; + +#define zzmatch_wdfltsig(tokenWanted, whatFollows) \ + if ( !_match_wdfltsig(tokenWanted, whatFollows) ) _signal = MismatchedToken; + + +// MR1 10-Apr-97 zzfailed_pred() macro does not backtrack in guess mode. +// MR1 Identification and correction due to J. Lilley +// +// MR23 Call virtual method to report error. +// MR23 Provide more control over failed predicate action +// without any need for user to worry about guessing internals. + +#ifndef zzfailed_pred +#define zzfailed_pred(_p,_hasuseraction,_useraction) \ + if (guessing) { \ + zzGUESS_FAIL; \ + } else { \ + zzfailed_pred_action(_p,_hasuseraction,_useraction) \ + } +#endif + +// MR23 Provide more control over failed predicate action +// without any need for user to worry about guessing internals. +// _hasuseraction == 0 => no user specified error action +// _hasuseraction == 1 => user specified error action + +#ifndef zzfailed_pred_action +#define zzfailed_pred_action(_p,_hasuseraction,_useraction) \ + if (_hasuseraction) { _useraction } else { failedSemanticPredicate(_p); } +#endif + +#define zzRULE \ + SetWordType *zzMissSet=NULL; ANTLRTokenType zzMissTok=(ANTLRTokenType)0; \ + _ANTLRTokenPtr zzBadTok=NULL; ANTLRChar *zzBadText=(ANTLRChar *)""; \ + int zzErrk=1,zzpf=0; \ + zzTRACEdata \ + ANTLRChar *zzMissText=(ANTLRChar *)""; + +#endif + + /* S t a n d a r d E x c e p t i o n S i g n a l s */ + +#define NoSignal 0 +#define MismatchedToken 1 +#define NoViableAlt 2 +#define NoSemViableAlt 3 + +/* MR7 Allow more control over signalling */ +/* by adding "Unwind" and "SetSignal" */ + +#define Unwind 4 +#define setSignal(newValue) *_retsignal=_signal=(newValue) +#define suppressSignal *_retsignal=_signal=0 +#define exportSignal *_retsignal=_signal diff --git a/pccts/h/ASTBase.cpp b/pccts/h/ASTBase.cpp new file mode 100644 index 0000000..ba08616 --- /dev/null +++ b/pccts/h/ASTBase.cpp @@ -0,0 +1,256 @@ +/* Abstract syntax tree manipulation functions + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +#include "pcctscfg.h" + +#include "pccts_stdio.h" +#include "pccts_stdarg.h" + +PCCTS_NAMESPACE_STD + +#define ANTLR_SUPPORT_CODE + +#include "ASTBase.h" + +/* ensure that tree manipulation variables are current after a rule + * reference + */ +void +ASTBase::link(ASTBase **_root, ASTBase **_sibling, ASTBase **_tail) +{ + if ( *_sibling == NULL ) return; + if ( *_root == NULL ) *_root = *_sibling; + else if ( *_root != *_sibling ) (*_root)->_down = *_sibling; + if ( *_tail==NULL ) *_tail = *_sibling; + while ( (*_tail)->_right != NULL ) *_tail = (*_tail)->_right; +} + +/* add a child node to the current sibling list */ +void +ASTBase::subchild(ASTBase **_root, ASTBase **_sibling, ASTBase **_tail) +{ + if ( *_tail != NULL ) (*_tail)->_right = this; + else { + *_sibling = this; + if ( *_root != NULL ) (*_root)->_down = *_sibling; + } + *_tail = this; + if ( *_root == NULL ) *_root = *_sibling; +} + +/* make a new AST node. Make the newly-created + * node the root for the current sibling list. If a root node already + * exists, make the newly-created node the root of the current root. + */ +void +ASTBase::subroot(ASTBase **_root, ASTBase **_sibling, ASTBase **_tail) +{ + if ( *_root != NULL ) + if ( (*_root)->_down == *_sibling ) *_sibling = *_tail = *_root; + *_root = this; + (*_root)->_down = *_sibling; +} + +/* Apply preorder_action(), etc.. to root then each sibling */ +// +// 7-Apr-97 133MR1 +// Fix suggested by Ron House (house@helios.usq.edu.au) +// +void +ASTBase::preorder(void* pData /*= NULL*/ /* MR23 */) +{ + ASTBase *tree = this; + + while ( tree!= NULL ) + { + if ( tree->_down != NULL ) { + tree->preorder_before_action(pData); // MR1 + }; + tree->preorder_action(pData); + if ( tree->_down!=NULL ) + { + tree->_down->preorder(pData); + tree->preorder_after_action(pData); // MR1 + } + tree = tree->_right; + } +} + +/* free all AST nodes in tree; apply func to each before freeing */ +void +ASTBase::destroy() +{ + ASTBase* tree = this; + while (tree) { + if (tree->_down) tree->_down->destroy(); + + ASTBase* cur = tree; + tree = tree->_right; + delete cur; + } +} + +/* build a tree (root child1 child2 ... NULL) + * If root is NULL, simply make the children siblings and return ptr + * to 1st sibling (child1). If root is not single node, return NULL. + * + * Siblings that are actually siblins lists themselves are handled + * correctly. For example #( NULL, #( NULL, A, B, C), D) results + * in the tree ( NULL A B C D ). + * + * Requires at least two parameters with the last one being NULL. If + * both are NULL, return NULL. + */ +ASTBase * +ASTBase::tmake(ASTBase *root, ...) +{ + va_list ap; + register ASTBase *child, *sibling=NULL, *tail=NULL /*MR23*/, *w; + + va_start(ap, root); + + if ( root != NULL ) + if ( root->_down != NULL ) { + root->reportOverwriteOfDownPointer(); /* MR21 Report problem which almost always an error */ + return NULL; + } + child = va_arg(ap, ASTBase *); + while ( child != NULL ) + { + for (w=child; w->_right!=NULL; w=w->_right) {;} /* find end of child */ + if ( sibling == NULL ) {sibling = child; tail = w;} + else {tail->_right = child; tail = w;} + child = va_arg(ap, ASTBase *); + } + if ( root==NULL ) root = sibling; + else root->_down = sibling; + va_end(ap); + return root; +} + +#ifndef PCCTS_NOT_USING_SOR + +/* tree duplicate */ +// forgot to check for NULL this (TJP July 23,1995) +ASTBase * +ASTBase::dup() +{ + ASTBase *u, *t=this; + + if ( t == NULL ) return NULL; +/* + u = new ASTBase; + *u = *t; +*/ + u = (ASTBase *)this->shallowCopy(); + if ( t->_right!=NULL ) u->_right = t->_right->dup(); + else u->_right = NULL; + if ( t->_down!=NULL ) u->_down = t->_down->dup(); + else u->_down = NULL; + return u; +} +#endif + +// +// 7-Apr-97 133MR1 +// Fix suggested by Asgeir Olafsson (olafsson@cstar.ac.com) +// +/* tree duplicate */ + +#ifndef PCCTS_NOT_USING_SOR + +ASTBase * +ASTDoublyLinkedBase::dup() +{ + ASTDoublyLinkedBase *u, *t=this; + + if ( t == NULL ) return NULL; + u = (ASTDoublyLinkedBase *)this->shallowCopy(); + u->_up = NULL; /* set by calling invocation */ + u->_left = NULL; + if (t->_right!=NULL) { // MR1 + u->_right=t->_right->dup(); // MR1 + ((ASTDoublyLinkedBase *)u->_right)->_left = u; // MR1 + } else { // MR1 + u->_right = NULL; // MR1 + }; // MR1 + if (t->_down!=NULL) { // MR1 + u->_down = t->_down->dup(); // MR1 + ((ASTDoublyLinkedBase *)u->_down)->_up = u; // MR1 + } else { // MR1 + u->_down = NULL; // MR1 + }; // MR1 + return u; +} + +#endif + +/* + * Set the 'up', and 'left' pointers of all nodes in 't'. + * Initial call is double_link(your_tree, NULL, NULL). + */ +void +ASTDoublyLinkedBase::double_link(ASTBase *left, ASTBase *up) +{ + ASTDoublyLinkedBase *t = this; + + t->_left = (ASTDoublyLinkedBase *) left; + t->_up = (ASTDoublyLinkedBase *) up; + if (t->_down != NULL) + ((ASTDoublyLinkedBase *)t->_down)->double_link(NULL, t); + if (t->_right != NULL) + ((ASTDoublyLinkedBase *)t->_right)->double_link(t, up); +} + +// MR21 ASTBase::reportOverwriteOfDownPointer + +void ASTBase::reportOverwriteOfDownPointer() +{ + panic("Attempt to overwrite down pointer in ASTBase::tmake"); +} + +// MR21 ASTBase::panic + +void ASTBase::panic(const char *msg) +{ + /* MR23 */ printMessage(stderr,"ASTBase panic: %s\n", msg); + exit(PCCTS_EXIT_FAILURE); +} + +#ifdef PCCTS_NOT_USING_SOR +//MR23 +int ASTBase::printMessage(FILE* pFile, const char* pFormat, ...) +{ + va_list marker; + va_start( marker, pFormat ); + int iRet = vfprintf(pFile, pFormat, marker); + va_end( marker ); + return iRet; +} +#endif diff --git a/pccts/h/ASTBase.h b/pccts/h/ASTBase.h new file mode 100644 index 0000000..9085fe5 --- /dev/null +++ b/pccts/h/ASTBase.h @@ -0,0 +1,122 @@ +/* Abstract syntax tree + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +#ifndef ASTBase_H +#define ASTBase_H + +#include "pcctscfg.h" + +#include "pccts_stdio.h" +#include "pccts_stdlib.h" + +PCCTS_NAMESPACE_STD + +#ifndef PCCTS_NOT_USING_SOR +#include "PCCTSAST.h" +#endif + +/* + * Notes: + * + * To specify a copy constructor, subclass one of these classes and + * give the copy constructor. To use dup(), you must define shallowCopy(). + * shallowCopy() can use either a copy constructor or just copy the node + * itself. + */ + +#ifdef PCCTS_NOT_USING_SOR +class DllExportPCCTS ASTBase { +#else +class DllExportPCCTS ASTBase : public PCCTS_AST { +#endif + +protected: + ASTBase *_right, *_down; + +public: + +#ifdef PCCTS_NOT_USING_SOR + ASTBase *right() { return _right; } + ASTBase *down() { return _down; } + void setRight(ASTBase *t) { _right = (ASTBase *)t; } + void setDown(ASTBase *t) { _down = (ASTBase *)t; } +#else + PCCTS_AST *right() { return _right; } // define the SORCERER interface + PCCTS_AST *down() { return _down; } + void setRight(PCCTS_AST *t) { _right = (ASTBase *)t; } + void setDown(PCCTS_AST *t) { _down = (ASTBase *)t; } +#endif + ASTBase() { _right = _down = NULL; } + virtual ~ASTBase() { ; } +#ifndef PCCTS_NOT_USING_SOR + virtual ASTBase *dup(); +#endif + void destroy(); + void preorder(void* pData = NULL /* MR23 */); + static ASTBase *tmake(ASTBase *, ...); + static void link(ASTBase **, ASTBase **, ASTBase **); + void subchild(ASTBase **, ASTBase **, ASTBase **); + void subroot(ASTBase **, ASTBase **, ASTBase **); + virtual void preorder_action(void* /*pData*/ = NULL /* MR23 */) { ; } + virtual void preorder_before_action(void* /*pData*/ = NULL /* MR23 */) { /* MR23 */ printMessage(stdout, " ("); } + virtual void preorder_after_action(void* /*pData*/ = NULL /* MR23 */) { /* MR23 */ printMessage(stdout, " )"); } + virtual void panic(const char *msg); /* MR21 */ + virtual void reportOverwriteOfDownPointer(); /* MR21 */ +#ifdef PCCTS_NOT_USING_SOR + virtual int printMessage(FILE* pFile, const char* pFormat, ...); // MR23 +#endif +}; + +class DllExportPCCTS ASTDoublyLinkedBase : public ASTBase { +protected: + ASTDoublyLinkedBase *_left, *_up; + +public: + void double_link(ASTBase *left, ASTBase *up); + +#ifndef PCCTS_NOT_USING_SOR + virtual ASTBase *dup(); +#endif + +#ifdef PCCTS_NOT_USING_SOR + ASTBase *left() { return _left; } + ASTBase *up() { return _up; } + void setLeft(ASTBase *t) { _left = (ASTDoublyLinkedBase *)t; } // MR6 + void setUp(ASTBase *t) { _up = (ASTDoublyLinkedBase *)t; } // MR6 +#else + PCCTS_AST *left() { return _left; } + PCCTS_AST *up() { return _up; } + void setLeft(PCCTS_AST *t) { _left = (ASTDoublyLinkedBase *)t; } // MR6 + void setUp(PCCTS_AST *t) { _up = (ASTDoublyLinkedBase *)t; } // MR6 +#endif + +}; + +class AST; // announce that this class will be coming along shortly +#endif diff --git a/pccts/h/ATokPtr.h b/pccts/h/ATokPtr.h new file mode 100644 index 0000000..d3387dd --- /dev/null +++ b/pccts/h/ATokPtr.h @@ -0,0 +1,88 @@ +/* ATokPtr.h + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Written by Russell Quong June 30, 1995 + * Adapted by Terence Parr to ANTLR stuff + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +#ifndef ATokPtr_h +#define ATokPtr_h + +#include "pcctscfg.h" + +#include "pccts_stdio.h" + +PCCTS_NAMESPACE_STD + +// pointer to a reference counted object +// robust in that an unused ANTLRTokenPtr can point to NULL. + +class ANTLRAbstractToken; + +class DllExportPCCTS ANTLRTokenPtr { +public: + ANTLRTokenPtr(ANTLRAbstractToken *addr=NULL){ptr_ = addr; ref();} + ANTLRTokenPtr(const ANTLRTokenPtr &lhs) {ptr_ = lhs.ptr_; lhs.ref();} + ~ANTLRTokenPtr(); + + // use ANTLRTokenPtr as a pointer to ANTLRToken +// +// 8-Apr-97 MR1 Make operator -> a const member function +// as well as some other member functions +// + ANTLRAbstractToken *operator-> () const { return ptr_; } // MR1 +// +// 7-Apr-97 133MR1 +// Fix suggested by Andreas Magnusson +// (Andreas.Magnusson@mailbox.swipnet.se) + void operator = (const ANTLRTokenPtr & lhs); // MR1 + void operator = (ANTLRAbstractToken *addr); + int operator != (const ANTLRTokenPtr &q) const // MR1 // MR11 unsigned -> int + { return this->ptr_ != q.ptr_; } + int operator == (const ANTLRTokenPtr &q) const // MR1 // MR11 unsigned -> int + { return this->ptr_ == q.ptr_; } + int operator == (const ANTLRAbstractToken *addr) const // MR11 + { return this->ptr_ == addr; } + int operator != (const ANTLRAbstractToken *addr) const // MR11 + { return this->ptr_ != addr; } + + void ref() const; + void deref(); + +protected: + ANTLRAbstractToken *ptr_; +}; + +//typedef ANTLRTokenPtr _ANTLRTokenPtr; + +/* + * Since you cannot redefine operator->() to return one of the user's + * token object types, we must down cast. This is a drag. Here's + * a macro that helps. template: "mytoken(a-smart-ptr)->myfield". + */ +#define mytoken(tk) ((ANTLRToken *)(tk.operator->())) + +#endif diff --git a/pccts/h/ATokPtrImpl.h b/pccts/h/ATokPtrImpl.h new file mode 100644 index 0000000..b76f61f --- /dev/null +++ b/pccts/h/ATokPtrImpl.h @@ -0,0 +1,88 @@ +/* + * ATokPtrImpl.h (formerly ATokPtr.cpp) + * + * This is #included in ATokBuffer.cpp for historical reasons. + * It has been renamed because of problems with the .cpp extension + * when used with IDE. + * + * + * ANTLRToken MUST be defined before entry to this file. + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Written by Russell Quong June 30, 1995 + * Adapted by Terence Parr to ANTLR stuff + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +#include "pcctscfg.h" + +PCCTS_NAMESPACE_STD + +#include "ATokPtr.h" + +void ANTLRTokenPtr::ref() const +{ + if (ptr_ != NULL) { + ptr_->ref(); + } +} + +void ANTLRTokenPtr::deref() +{ + if (ptr_ != NULL) + { + ptr_->deref(); + if ( ptr_->nref()==0 ) + { + delete ptr_; + ptr_ = NULL; + } + } +} + +ANTLRTokenPtr::~ANTLRTokenPtr() +{ + deref(); +} + +// +// 8-Apr-97 MR1 Make operator -> a const member function +// as weall as some other member functions +// +void ANTLRTokenPtr::operator = (const ANTLRTokenPtr & lhs) // MR1 +{ + lhs.ref(); // protect against "xp = xp"; ie same underlying object + deref(); + ptr_ = lhs.ptr_; +} + +void ANTLRTokenPtr::operator = (ANTLRAbstractToken *addr) +{ + if (addr != NULL) { + addr->ref(); + } + deref(); + ptr_ = addr; +} diff --git a/pccts/h/AToken.h b/pccts/h/AToken.h new file mode 100644 index 0000000..a636012 --- /dev/null +++ b/pccts/h/AToken.h @@ -0,0 +1,325 @@ +/* ANTLRToken.h + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +#ifndef ATOKEN_H_GATE +#define ATOKEN_H_GATE + +#include "pcctscfg.h" + +#include "pccts_string.h" +#include "pccts_stdio.h" +#include "pccts_stdlib.h" +#include "pccts_stdarg.h" // MR23 + +PCCTS_NAMESPACE_STD + +// MR9 RJV (JVincent@novell.com) Not needed for variable length strings + +//// MR9 #ifndef ANTLRCommonTokenTEXTSIZE +//// MR9 #define ANTLRCommonTokenTEXTSIZE 100 +//// MR9 #endif + + +/* must define what a char looks like; can make this a class too */ +typedef char ANTLRChar; + +/* D E F I N E S M A R T P O I N T E R S */ + +//#include ATOKPTR_H not tested yet, leave out +class ANTLRAbstractToken; +typedef ANTLRAbstractToken *_ANTLRTokenPtr; + +class ANTLRAbstractToken { +public: + virtual ~ANTLRAbstractToken() {;} + virtual ANTLRTokenType getType() const = 0; + virtual void setType(ANTLRTokenType t) = 0; + virtual int getLine() const = 0; + virtual void setLine(int line) = 0; + virtual ANTLRChar *getText() const = 0; + virtual void setText(const ANTLRChar *) = 0; + + /* This function will disappear when I can use templates */ + virtual ANTLRAbstractToken *makeToken(ANTLRTokenType tt, + ANTLRChar *text, + int line) = 0; + + /* define to satisfy ANTLRTokenBuffer's need to determine whether or + not a token object can be destroyed. If nref()==0, no one has + a reference, and the object may be destroyed. This function defaults + to 1, hence, if you use deleteTokens() message with a token object + not derived from ANTLRCommonRefCountToken, the parser will compile + but will not delete objects after they leave the token buffer. + */ + + virtual unsigned nref() const { return 1; } // MR11 + virtual void ref() {;} + virtual void deref() {;} + + virtual void panic(const char *msg) // MR20 const + { + /* MR23 */ printMessage(stderr, "ANTLRAbstractToken panic: %s\n", msg); + exit(PCCTS_EXIT_FAILURE); + } + + virtual int printMessage(FILE* pFile, const char* pFormat, ...) // MR23 + { + va_list marker; + va_start( marker, pFormat ); + int iRet = vfprintf(pFile, pFormat, marker); + va_end( marker ); + return iRet; + } +}; + +/* This class should be subclassed. It cannot store token type or text */ + +class ANTLRRefCountToken : public ANTLRAbstractToken { +public: +#ifdef DBG_REFCOUNTTOKEN + static int ctor; + static int dtor; +#endif +protected: + unsigned refcnt_; +#ifdef DBG_REFCOUNTTOKEN + char object[200]; +#endif + +public: + + // MR23 - No matter what you do, you're hammered. + // Don't give names to formals something breaks. + // Give names to formals and don't use them it breaks. + +#ifndef DBG_REFCOUNTTOKEN + ANTLRRefCountToken(ANTLRTokenType /* t MR23 */, const ANTLRChar * /* s MR23 */) +#else + ANTLRRefCountToken(ANTLRTokenType t, const ANTLRChar * s) +#endif + +#ifndef DBG_REFCOUNTTOKEN + { + refcnt_ = 0; + } +#else + { + ctor++; + refcnt_ = 0; + if ( t==1 ) sprintf(object,"tok_EOF"); + else sprintf(object,"tok_%s",s); + /* MR23 */ printMessage(stderr, "ctor %s #%d\n",object,ctor); + } +#endif + ANTLRRefCountToken() +#ifndef DBG_REFCOUNTTOKEN + { refcnt_ = 0; } +#else + { + ctor++; + refcnt_ = 0; + sprintf(object,"tok_blank"); + /* MR23 */ printMessage(stderr, "ctor %s #%d\n",object,ctor); + } + virtual ~ANTLRRefCountToken() + { + dtor++; + if ( dtor>ctor ) /* MR23 */ printMessage(stderr, "WARNING: dtor>ctor\n"); + /* MR23 */ printMessage(stderr, "dtor %s #%d\n", object, dtor); + object[0]='\0'; + } +#endif + + // reference counting stuff needed by ANTLRTokenPtr. + // User should not access these; for C++ language reasons, we had + // to make these public. Yuck. + + void ref() { refcnt_++; } + void deref() { refcnt_--; } + unsigned nref() const { return refcnt_; } // MR11 + + virtual ANTLRAbstractToken *makeToken(ANTLRTokenType /*tt MR23*/, + ANTLRChar * /*txt MR23*/, + int /*line MR23*/) + { + panic("call to ANTLRRefCountToken::makeToken()\n"); + return NULL; + } +}; + +class ANTLRCommonNoRefCountToken : public ANTLRAbstractToken { +protected: + ANTLRTokenType _type; + int _line; + ANTLRChar *_text; // MR9 RJV + +public: + ANTLRCommonNoRefCountToken(ANTLRTokenType t, const ANTLRChar *s) + { setType(t); _line = 0; _text = NULL; setText(s); } + ANTLRCommonNoRefCountToken() + { setType((ANTLRTokenType)0); _line = 0; _text = NULL; setText(""); } + + ~ANTLRCommonNoRefCountToken() { if (_text) delete [] _text; } // MR9 RJV: Added Destructor to remove string + + ANTLRTokenType getType() const { return _type; } + void setType(ANTLRTokenType t) { _type = t; } + virtual int getLine() const { return _line; } + void setLine(int line) { _line = line; } + ANTLRChar *getText() const { return _text; } + int getLength() const { return strlen(getText()); } // MR11 + +// MR9 RJV: Added code for variable length strings to setText() + + void setText(const ANTLRChar *s) + { if (s != _text) { + if (_text) delete [] _text; + if (s != NULL) { + _text = new ANTLRChar[strlen(s)+1]; + if (_text == NULL) panic("ANTLRCommonNoRefCountToken::setText new failed"); + strcpy(_text,s); + } else { + _text = new ANTLRChar[1]; + if (_text == NULL) panic("ANTLRCommonNoRefCountToken::setText new failed"); + strcpy(_text,""); + }; + }; + } + + virtual ANTLRAbstractToken *makeToken(ANTLRTokenType tt, + ANTLRChar *txt, + int line) + { + ANTLRAbstractToken *t = new ANTLRCommonNoRefCountToken; + t->setType(tt); t->setText(txt); t->setLine(line); + return t; + } + +// MR9 THM Copy constructor required when heap allocated string is used with copy semantics + + ANTLRCommonNoRefCountToken (const ANTLRCommonNoRefCountToken& from) : + ANTLRAbstractToken(from) { + setType(from._type); + setLine(from._line); + _text=NULL; + setText(from._text); + }; + +// MR9 THM operator =() required when heap allocated string is used with copy semantics + + virtual ANTLRCommonNoRefCountToken& operator =(const ANTLRCommonNoRefCountToken& rhs) { + +////// MR15 WatCom can't hack use of operator =() +////// Use this: *( (ANTRLAbstractToken *) this)=rhs; + + *( (ANTLRAbstractToken *) this ) = rhs; + + setType(rhs._type); + setLine(rhs._line); + setText(rhs._text); + return *this; + }; +}; + +class ANTLRCommonToken : public ANTLRRefCountToken { +protected: + ANTLRTokenType _type; + int _line; + ANTLRChar *_text; // MR9 RJV:Added + +public: + ANTLRCommonToken(ANTLRTokenType t, const ANTLRChar *s) : ANTLRRefCountToken(t,s) + { setType(t); _line = 0; _text = NULL; setText(s); } // MR9 + ANTLRCommonToken() + { setType((ANTLRTokenType)0); _line = 0; _text = NULL; setText(""); } // MR9 + + virtual ~ANTLRCommonToken() { if (_text) delete [] _text; } // MR9 RJV: Added Destructor to remove string + + ANTLRTokenType getType() const { return _type; } + void setType(ANTLRTokenType t) { _type = t; } + virtual int getLine() const { return _line; } + void setLine(int line) { _line = line; } + ANTLRChar *getText() const { return _text; } + int getLength() const { return strlen(getText()); } // MR11 + +// MR9 RJV: Added code for variable length strings to setText() + + void setText(const ANTLRChar *s) + { if (s != _text) { + if (_text) delete [] _text; + if (s != NULL) { + _text = new ANTLRChar[strlen(s)+1]; + if (_text == NULL) panic("ANTLRCommonToken::setText new failed"); + strcpy(_text,s); + } else { + _text = new ANTLRChar[1]; + if (_text == NULL) panic("ANTLRCommonToken::setText new failed"); + strcpy(_text,""); + }; + }; + } + + virtual ANTLRAbstractToken *makeToken(ANTLRTokenType tt, + ANTLRChar *txt, + int line) + { + ANTLRAbstractToken *t = new ANTLRCommonToken(tt,txt); + t->setLine(line); + return t; + } + +// MR9 THM Copy constructor required when heap allocated string is used with copy semantics + + ANTLRCommonToken (const ANTLRCommonToken& from) : + ANTLRRefCountToken(from) { + setType(from._type); + setLine(from._line); + _text=NULL; + setText(from._text); + }; + +// MR9 THM operator =() required when heap allocated string is used with copy semantics + + virtual ANTLRCommonToken& operator =(const ANTLRCommonToken& rhs) { + +////// MR15 WatCom can't hack use of operator =() +////// Use this instead: *( (ANTRLRRefCountToken *) this)=rhs; + + *( (ANTLRRefCountToken *) this) = rhs; + + setType(rhs._type); + setLine(rhs._line); + setText(rhs._text); + return *this; + }; +}; + +// used for backward compatibility +typedef ANTLRCommonToken ANTLRCommonBacktrackingToken; + +#endif diff --git a/pccts/h/ATokenBuffer.cpp b/pccts/h/ATokenBuffer.cpp new file mode 100644 index 0000000..f012161 --- /dev/null +++ b/pccts/h/ATokenBuffer.cpp @@ -0,0 +1,374 @@ +/* ANTLRTokenBuffer.cpp + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +typedef int ANTLRTokenType; // fool AToken.h into compiling + +class ANTLRParser; /* MR1 */ + +#define ANTLR_SUPPORT_CODE + +#include "pcctscfg.h" + +#include ATOKENBUFFER_H +#include APARSER_H // MR23 + +typedef ANTLRAbstractToken *_ANTLRTokenPtr; + +#if defined(DBG_TBUF)||defined(DBG_TBUF_MARK_REW) +static unsigned char test[1000]; +#endif + +#ifdef DBG_REFCOUNTTOKEN +int ANTLRRefCountToken::ctor = 0; /* MR23 */ +int ANTLRRefCountToken::dtor = 0; /* MR23 */ +#endif + +ANTLRTokenBuffer:: +ANTLRTokenBuffer(ANTLRTokenStream *_input, int _k, int _chunk_size_formal) /* MR14 */ +{ + this->input = _input; + this->k = _k; + buffer_size = chunk_size = _chunk_size_formal; + buffer = (_ANTLRTokenPtr *) + calloc(chunk_size+1,sizeof(_ANTLRTokenPtr )); + if ( buffer == NULL ) { + panic("cannot alloc token buffer"); + } + buffer++; // leave the first elem empty so tp-1 is valid ptr + + tp = &buffer[0]; + last = tp-1; + next = &buffer[0]; + num_markers = 0; + end_of_buffer = &buffer[buffer_size-1]; + threshold = &buffer[(int)(buffer_size/2)]; // MR23 - Used to be 1.0/2.0 ! + _deleteTokens = 1; // assume we delete tokens + parser=NULL; // MR5 - uninitialized reference +} + +static void f() {;} +ANTLRTokenBuffer:: +~ANTLRTokenBuffer() +{ + f(); + // Delete all remaining tokens (from 0..last inclusive) + if ( _deleteTokens ) + { + _ANTLRTokenPtr *z; + for (z=buffer; z<=last; z++) + { + (*z)->deref(); +// z->deref(); +#ifdef DBG_REFCOUNTTOKEN + /* MR23 */ printMessage(stderr, "##########dtor: deleting token '%s' (ref %d)\n", + ((ANTLRCommonToken *)*z)->getText(), (*z)->nref()); +#endif + if ( (*z)->nref()==0 ) + { + delete (*z); + } + } + } + + if ( buffer!=NULL ) free((char *)(buffer-1)); +} + +#if defined(DBG_TBUF)||defined(DBG_TBUF_MARK_REW) +#include "pccts_stdio.h" +PCCTS_NAMESPACE_STD +#endif + +_ANTLRTokenPtr ANTLRTokenBuffer:: +getToken() +{ + if ( tp <= last ) // is there any buffered lookahead still to be read? + { + return *tp++; // read buffered lookahead + } + // out of buffered lookahead, get some more "real" + // input from getANTLRToken() + if ( num_markers==0 ) + { + if( next > threshold ) + { +#ifdef DBG_TBUF +/* MR23 */ printMessage(stderr,"getToken: next > threshold (high water is %d)\n", threshold-buffer); +#endif + makeRoom(); + } + } + else { + if ( next > end_of_buffer ) + { +#ifdef DBG_TBUF +/* MR23 */ printMessage(stderr,"getToken: next > end_of_buffer (size is %d)\n", buffer_size); +#endif + extendBuffer(); + } + } + *next = getANTLRToken(); + (*next)->ref(); // say we have a copy of this pointer in buffer + last = next; + next++; + tp = last; + return *tp++; +} + +void ANTLRTokenBuffer:: +rewind(int pos) +{ +#if defined(DBG_TBUF)||defined(DBG_TBUF_MARK_REW) + /* MR23 */ printMessage(stderr, "rewind(%d)[nm=%d,from=%d,%d.n=%d]\n", pos, num_markers, tp-buffer,pos,test[pos]); + test[pos]--; +#endif + tp = &buffer[pos]; + num_markers--; +} + +/* + * This function is used to specify that the token pointers read + * by the ANTLRTokenBuffer should be buffered up (to be reused later). + */ +int ANTLRTokenBuffer:: +mark() +{ +#if defined(DBG_TBUF)||defined(DBG_TBUF_MARK_REW) + test[tp-buffer]++; + /* MR23 */ printMessage(stderr,"mark(%d)[nm=%d,%d.n=%d]\n",tp-buffer,num_markers+1,tp-buffer,test[tp-buffer]); +#endif + num_markers++; + return tp - buffer; +} + +/* + * returns the token pointer n positions ahead. + * This implies that bufferedToken(1) gets the NEXT symbol of lookahead. + * This is used in conjunction with the ANTLRParser lookahead buffer. + * + * No markers are set or anything. A bunch of input is buffered--that's all. + * The tp pointer is left alone as the lookahead has not been advanced + * with getToken(). The next call to getToken() will find a token + * in the buffer and won't have to call getANTLRToken(). + * + * If this is called before a consume() is done, how_many_more_i_need is + * set to 'n'. + */ +_ANTLRTokenPtr ANTLRTokenBuffer:: +bufferedToken(int n) +{ +// int how_many_more_i_need = (last-tp < 0) ? n : n-(last-tp)-1; + int how_many_more_i_need = (tp > last) ? n : n-(last-tp)-1; + // Make sure that at least n tokens are available in the buffer +#ifdef DBG_TBUF + /* MR23 */ printMessage(stderr, "bufferedToken(%d)\n", n); +#endif + for (int i=1; i<=how_many_more_i_need; i++) + { + if ( next > end_of_buffer ) // buffer overflow? + { + extendBuffer(); + } + *next = getANTLRToken(); + (*next)->ref(); // say we have a copy of this pointer in buffer + last = next; + next++; + } + return tp[n - 1]; +} + +/* If no markers are set, the none of the input needs to be saved (except + * for the lookahead Token pointers). We save only k-1 token pointers as + * we are guaranteed to do a getANTLRToken() right after this because otherwise + * we wouldn't have needed to extend the buffer. + * + * If there are markers in the buffer, we need to save things and so + * extendBuffer() is called. + */ +void ANTLRTokenBuffer:: +makeRoom() +{ +#ifdef DBG_TBUF + /* MR23 */ printMessage(stderr, "in makeRoom.................\n"); + /* MR23 */ printMessage(stderr, "num_markers==%d\n", num_markers); +#endif +/* + if ( num_markers == 0 ) + { +*/ +#ifdef DBG_TBUF + /* MR23 */ printMessage(stderr, "moving lookahead and resetting next\n"); + + _ANTLRTokenPtr *r; + /* MR23 */ printMessage(stderr, "tbuf = ["); + for (r=buffer; r<=last; r++) + { + if ( *r==NULL ) /* MR23 */ printMessage(stderr, " xxx"); + else /* MR23 */ printMessage(stderr, " '%s'", ((ANTLRCommonToken *)*r)->getText()); + } + /* MR23 */ printMessage(stderr, " ]\n"); + + /* MR23 */ printMessage(stderr, + "before: tp=%d, last=%d, next=%d, threshold=%d\n",tp-buffer,last-buffer,next-buffer,threshold-buffer); +#endif + + // Delete all tokens from 0..last-(k-1) inclusive + if ( _deleteTokens ) + { + _ANTLRTokenPtr *z; + for (z=buffer; z<=last-(k-1); z++) + { + (*z)->deref(); +// z->deref(); +#ifdef DBG_REFCOUNTTOKEN + /* MR23 */ printMessage(stderr, "##########makeRoom: deleting token '%s' (ref %d)\n", + ((ANTLRCommonToken *)*z)->getText(), (*z)->nref()); +#endif + if ( (*z)->nref()==0 ) + { + delete (*z); + } + } + } + + // reset the buffer to initial conditions, but move k-1 symbols + // to the beginning of buffer and put new input symbol at k + _ANTLRTokenPtr *p = buffer, *q = last-(k-1)+1; +// ANTLRAbstractToken **p = buffer, **q = end_of_buffer-(k-1)+1; +#ifdef DBG_TBUF + /* MR23 */ printMessage(stderr, "lookahead buffer = ["); +#endif + for (int i=1; i<=(k-1); i++) + { + *p++ = *q++; +#ifdef DBG_TBUF + /* MR23 */ printMessage(stderr, + " '%s'", ((ANTLRCommonToken *)buffer[i-1])->getText()); +#endif + } +#ifdef DBG_TBUF + /* MR23 */ printMessage(stderr, " ]\n"); +#endif + next = &buffer[k-1]; + tp = &buffer[k-1]; // tp points to what will be filled in next + last = tp-1; +#ifdef DBG_TBUF + /* MR23 */ printMessage(stderr, + "after: tp=%d, last=%d, next=%d\n", + tp-buffer, last-buffer, next-buffer); +#endif +/* + } + else { + extendBuffer(); + } +*/ +} + +/* This function extends 'buffer' by chunk_size and returns with all + * pointers at the same relative positions in the buffer (the buffer base + * address could have changed in realloc()) except that 'next' comes + * back set to where the next token should be stored. All other pointers + * are untouched. + */ +void +ANTLRTokenBuffer:: +extendBuffer() +{ + int save_last = last-buffer, save_tp = tp-buffer, save_next = next-buffer; +#ifdef DBG_TBUF + /* MR23 */ printMessage(stderr, "extending physical buffer\n"); +#endif + buffer_size += chunk_size; + buffer = (_ANTLRTokenPtr *) + realloc((char *)(buffer-1), + (buffer_size+1)*sizeof(_ANTLRTokenPtr )); + if ( buffer == NULL ) { + panic("cannot alloc token buffer"); + } + buffer++; // leave the first elem empty so tp-1 is valid ptr + + tp = buffer + save_tp; // put the pointers back to same relative position + last = buffer + save_last; + next = buffer + save_next; + end_of_buffer = &buffer[buffer_size-1]; + threshold = &buffer[(int)(buffer_size*(1.0/2.0))]; + +/* + // zero out new token ptrs so we'll know if something to delete in buffer + ANTLRAbstractToken **p = end_of_buffer-chunk_size+1; + for (; p<=end_of_buffer; p++) *p = NULL; +*/ +} + +ANTLRParser * ANTLRTokenBuffer:: // MR1 +setParser(ANTLRParser *p) { // MR1 + ANTLRParser *old=parser; // MR1 + parser=p; // MR1 + input->setParser(p); // MR1 + return old; // MR1 +} // MR1 + // MR1 +ANTLRParser * ANTLRTokenBuffer:: // MR1 +getParser() { // MR1 + return parser; // MR1 +} // MR1 + +void ANTLRTokenBuffer::panic(const char *msg) // MR23 +{ + if (parser) //MR23 + parser->panic(msg); //MR23 + else //MR23 + exit(PCCTS_EXIT_FAILURE); +} + +//MR23 +int ANTLRTokenBuffer::printMessage(FILE* pFile, const char* pFormat, ...) +{ + va_list marker; + va_start( marker, pFormat ); + + int iRet = 0; + if (parser) + parser->printMessageV(pFile, pFormat, marker); + else + iRet = vfprintf(pFile, pFormat, marker); + + va_end( marker ); + return iRet; +} + +/* to avoid having to link in another file just for the smart token ptr + * stuff, we include it here. Ugh. + * + * MR23 This causes nothing but problems for IDEs. + * Change from .cpp to .h + * + */ + +#include ATOKPTR_IMPL_H diff --git a/pccts/h/ATokenBuffer.h b/pccts/h/ATokenBuffer.h new file mode 100644 index 0000000..a6bec63 --- /dev/null +++ b/pccts/h/ATokenBuffer.h @@ -0,0 +1,109 @@ +/* ANTLRTokenBuffer.h + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +#ifndef ATOKENBUFFER_H_GATE +#define ATOKENBUFFER_H_GATE + +#include "pcctscfg.h" + +#include "pccts_stdlib.h" + +PCCTS_NAMESPACE_STD + +#include ATOKEN_H +#include ATOKENSTREAM_H + +/* + * The parser is "attached" to an ANTLRTokenBuffer via interface + * functions: getToken() and bufferedToken(). The object that actually + * consumes characters and constructs tokens is connected to the + * ANTLRTokenBuffer via interface function ANTLRTokenStream::getToken(); + * where ANTLRTokenStream is really just a behavior (class with no data). + * C++ does not have this abstraction and hence we simply have come up + * with a fancy name for "void *". See the note in ANTLRTokenStream.h on + * the "behavior" of ANTLRTokenStream. + */ + +class ANTLRParser; // MR1 + +class DllExportPCCTS ANTLRTokenBuffer { +protected: + ANTLRTokenStream *input; // where do I get tokens + int buffer_size; + int chunk_size; + int num_markers; + int k; // Need at least this many tokens in buffer + _ANTLRTokenPtr *buffer; // buffer used for arbitrary lookahead + _ANTLRTokenPtr *tp; // pts into buffer; current token ptr + _ANTLRTokenPtr *last; // pts to last valid token in buffer + _ANTLRTokenPtr *next; // place to put token from getANTLRToken() + _ANTLRTokenPtr *end_of_buffer; + /* when you try to write a token past this and there are no markers + set, then move k-1 tokens back to the beginning of the buffer. + We want to stay away from the end of the buffer because we have + to extend it if a marker is set and we reach the end (we cannot + move tokens to the beginning of the buffer in this case). + */ + _ANTLRTokenPtr *threshold; + unsigned char _deleteTokens; + + // This function is filled in by the subclass; it initiates fetch of input + virtual _ANTLRTokenPtr getANTLRToken() { return input->getToken(); } + void makeRoom(); + void extendBuffer(); + +public: + ANTLRTokenBuffer(ANTLRTokenStream *in, int k=1, int chksz=50); + virtual ~ANTLRTokenBuffer(); + virtual _ANTLRTokenPtr getToken(); + virtual void rewind(int pos); + virtual int mark(); + virtual _ANTLRTokenPtr bufferedToken(int i); + + void noGarbageCollectTokens() { _deleteTokens=0; } + void garbageCollectTokens() { _deleteTokens=1; } + + virtual int bufferSize() { return buffer_size; } + virtual int minTokens() { return k; } + virtual void setMinTokens(int k_new) { k = k_new; } + + virtual void panic(const char *msg); /* MR20 const */ + + virtual int printMessage(FILE* pFile, const char* pFormat, ...); // MR23 + +protected: // MR1 + ANTLRParser *parser; // MR1 +public: // MR1 + ANTLRParser *setParser(ANTLRParser *p); // MR1 + ANTLRParser *getParser(); // MR1 + ANTLRTokenStream *getLexer() const { // MR12 + return input;} // MR12 +}; + +#endif diff --git a/pccts/h/ATokenStream.h b/pccts/h/ATokenStream.h new file mode 100644 index 0000000..bc7ea38 --- /dev/null +++ b/pccts/h/ATokenStream.h @@ -0,0 +1,52 @@ +/* ANTLRTokenStream.h + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +#ifndef ATOKENSTREAM_H_GATE +#define ATOKENSTREAM_H_GATE + +#include "pcctscfg.h" + +/* This is really a behavior or protocol; it merely indicates the behavior + * required of the input and output of an ANTLRTokenBuffer. You could + * subclass it, but you can also just pass any old pointer to ANTLRTokenBuffer + * with a type cast (in which case, your getANTLRToken() would have to + * explicitly cast the input pointer to your REAL type (typically your lexer)). + */ + +class ANTLRParser; // MR1 + +class DllExportPCCTS ANTLRTokenStream { +public: + virtual _ANTLRTokenPtr getToken() = 0; + virtual ~ANTLRTokenStream() {} + virtual ANTLRParser * setParser(ANTLRParser * /*p MR23*/) {return 0; }; // MR12 + virtual ANTLRParser * getParser() { return 0; }; // MR12 +}; + +#endif diff --git a/pccts/h/BufFileInput.cpp b/pccts/h/BufFileInput.cpp new file mode 100644 index 0000000..738d47c --- /dev/null +++ b/pccts/h/BufFileInput.cpp @@ -0,0 +1,100 @@ +// FILE: BufFileInput.cpp +// AUTHOR: Alexey Demakov (AVD) demakov@kazbek.ispras.ru +// CREATION: 26-JAN-1998 +// DESCRIPTION: File Input Stream with lookahead for Scanner. +// See file BufFileInput.h for details + +// Change History: +// +// 22-Jun-1998 assert.h -> PCCTS_ASSERT_H +// string.h -> PCCTS_STRING_H +// +// 28-May-1998 Add virtual destructor to release buffer. +// +// Add dummy definition for ANTLRTokenType +// to allow compilation without knowing +// token type codes. +// +// Manfred Kogler (km@cast.uni-linz.ac.at) +// (1.33MR14) +// +// 20-Jul-1998 MR14a - Reorder initialization list for ctor. +// + +enum ANTLRTokenType {TER_HATES_CPP=0, SO_DO_OTHERS=9999 }; + +#include "pcctscfg.h" +#include "pccts_assert.h" +#include "pccts_string.h" + +PCCTS_NAMESPACE_STD + +#include "BufFileInput.h" + +BufFileInput::BufFileInput( FILE *f, int buf_size ) +: input( f ), + buf( new int[buf_size] ), + size( buf_size ), + start( 0 ), + len( 0 ) +{ +} + +BufFileInput::~BufFileInput() +{ + delete [] buf; +} + +int BufFileInput::nextChar( void ) +{ + if( len > 0 ) + { + // get char from buffer + int c = buf[start]; + + if( c != EOF ) + { + start++; start %= size; + len--; + } + return c; + } else { + // get char from file + int c = getc( input ); + + if( c == EOF ) + { + // if EOF - put it in the buffer as indicator + buf[start] = EOF; + len++; + } + return c; + } +} + +int BufFileInput::lookahead( char* s ) +{ + int l = strlen( s ); + + assert( 0 < l && l <= size ); + + while( len < l ) + { + int c = getc( input ); + + buf[ (start+len) % size ] = c; + + len++; + + if( c == EOF ) return 0; + } + + for( int i = 0; i < l; i++ ) + { + if( s[i] != buf[ (start+i) % size ] ) return 0; + } + return 1; +} + +// End of file BufFileInput.cpp + diff --git a/pccts/h/BufFileInput.h b/pccts/h/BufFileInput.h new file mode 100644 index 0000000..d53340e --- /dev/null +++ b/pccts/h/BufFileInput.h @@ -0,0 +1,53 @@ +// FILE: BufFileInput.h +// AUTHOR: Alexey Demakov (AVD) demakov@kazbek.ispras.ru +// CREATION: 26-JAN-1998 +// DESCRIPTION: File Input Stream with lookahead for Scanner +// Tested under Win32 with ANTLR 1.33 MR10 and MSVC 5.0 + +// Change History: +// +// 28-May-1998 Add virtual destructor to release buffer +// Manfred Kogler (km@cast.uni-linz.ac.at) +// (1.33MR14) + +#ifndef BufFileInput_h +#define BufFileInput_h + +#include "pcctscfg.h" + +#include "pccts_stdio.h" + +PCCTS_NAMESPACE_STD + +#include "DLexerBase.h" + +class DllExportPCCTS BufFileInput : public DLGInputStream +{ +public: + // constructor + // f - input stream + // buf_size - size of buffer (maximal length for string in is_in) + + BufFileInput(FILE *f, int buf_size = 8 ); + + virtual ~BufFileInput(); + + // gets next char from stream + + virtual int nextChar( void ); + + // looks in stream and compares next l characters with s + // returns the result of comparision + + int lookahead( char* s ); + +private: + FILE *input; // input stream; + int* buf; // buffer + int size; // size of buffer + int start; // position of the first symbol in buffer + int len; // count of characters in buffers +}; + +#endif +// end of file BufFileInput.h diff --git a/pccts/h/CVS/Entries b/pccts/h/CVS/Entries new file mode 100644 index 0000000..83bfe40 --- /dev/null +++ b/pccts/h/CVS/Entries @@ -0,0 +1,41 @@ +/AParser.cpp/1.1/Mon Sep 26 21:57:27 2005// +/AParser.h/1.1/Mon Sep 26 21:57:27 2005// +/ASTBase.cpp/1.1/Mon Sep 26 21:57:27 2005// +/ASTBase.h/1.1/Mon Sep 26 21:57:27 2005// +/ATokPtr.h/1.1/Mon Sep 26 21:57:27 2005// +/ATokPtrImpl.h/1.1/Mon Sep 26 21:57:27 2005// +/AToken.h/1.1/Mon Sep 26 21:57:27 2005// +/ATokenBuffer.cpp/1.1/Mon Sep 26 21:57:27 2005// +/ATokenBuffer.h/1.1/Mon Sep 26 21:57:27 2005// +/ATokenStream.h/1.2/Thu Nov 3 01:43:58 2005// +/BufFileInput.cpp/1.1/Mon Sep 26 21:57:27 2005// +/BufFileInput.h/1.1/Mon Sep 26 21:57:27 2005// +/DLG_stream_input.h/1.1/Mon Sep 26 21:57:27 2005// +/DLexer.h/1.1/Mon Sep 26 21:57:27 2005// +/DLexerBase.cpp/1.1/Mon Sep 26 21:57:27 2005// +/DLexerBase.h/1.2/Thu Nov 3 01:43:58 2005// +/PBlackBox.h/1.1/Mon Sep 26 21:57:27 2005// +/PCCTSAST.cpp/1.1/Mon Sep 26 21:57:27 2005// +/PCCTSAST.h/1.1/Mon Sep 26 21:57:27 2005// +/SList.h/1.1/Mon Sep 26 21:57:27 2005// +/antlr.h/1.2/Thu Nov 3 01:32:48 2005// +/ast.h/1.1/Mon Sep 26 21:57:27 2005// +/charbuf.h/1.1/Mon Sep 26 21:57:27 2005// +/charptr.h/1.1/Mon Sep 26 21:57:27 2005// +/config.h/1.1/Mon Sep 26 21:57:27 2005// +/dlgauto.h/1.1/Mon Sep 26 21:57:27 2005// +/dlgdef.h/1.1/Mon Sep 26 21:57:27 2005// +/err.h/1.1/Mon Sep 26 21:57:27 2005// +/int.h/1.1/Mon Sep 26 21:57:27 2005// +/pccts_assert.h/1.1/Mon Sep 26 21:57:27 2005// +/pccts_iostream.h/1.1/Mon Sep 26 21:57:27 2005// +/pccts_istream.h/1.1/Mon Sep 26 21:57:27 2005// +/pccts_setjmp.h/1.1/Mon Sep 26 21:57:27 2005// +/pccts_stdarg.h/1.1/Mon Sep 26 21:57:27 2005// +/pccts_stdio.h/1.1/Mon Sep 26 21:57:27 2005// +/pccts_stdlib.h/1.1/Mon Sep 26 21:57:27 2005// +/pccts_string.h/1.1/Mon Sep 26 21:57:27 2005// +/pcctscfg.h/1.1/Mon Sep 26 21:57:27 2005// +/set.h/1.1/Mon Sep 26 21:57:27 2005// +/slist.cpp/1.1/Mon Sep 26 21:57:27 2005// +D diff --git a/pccts/h/CVS/Repository b/pccts/h/CVS/Repository new file mode 100644 index 0000000..c024087 --- /dev/null +++ b/pccts/h/CVS/Repository @@ -0,0 +1 @@ +cdrdao/pccts/h diff --git a/pccts/h/CVS/Root b/pccts/h/CVS/Root new file mode 100644 index 0000000..4457ce0 --- /dev/null +++ b/pccts/h/CVS/Root @@ -0,0 +1 @@ +poolshark@cdrdao.cvs.sourceforge.net:/cvsroot/cdrdao diff --git a/pccts/h/DLG_stream_input.h b/pccts/h/DLG_stream_input.h new file mode 100644 index 0000000..08f8a32 --- /dev/null +++ b/pccts/h/DLG_stream_input.h @@ -0,0 +1,98 @@ + +/************************************************************/ +/* */ +/* Predefined char stream: Input from (c++) stream. */ +/* */ +/* By Hubert Holin (Hubert.Holin@Bigfoot.com), 1998. */ +/* */ +/* This is completely free stuff, do whatever you want with */ +/* it (but then, I will take no responsability for whatever */ +/* may happen if you do either... caveat emptor!). */ +/* */ +/************************************************************/ + +#ifndef _DLG_STREAM_INPUT_H +#define _DLG_STREAM_INPUT_H + +#include "pccts_istream.h" + +PCCTS_NAMESPACE_STD + +#ifndef DLGX_H +#include "DLexerBase.h" +#endif + + +// NOTES: The semantics of the copy constructor +// and the affectation operator may be unwaranted... +// and the stream may not be reset. +// +// It would have been so much nicer for nextChar() +// to throw (of for the DLGInputStream to change status) +// upon hiting EOF than to return an "int"... + +template < + class E, + class T = ::std::char_traits<E> + > +class DLG_stream_input : public DLGInputStream +{ +public: + + DLG_stream_input(::std::basic_istream<E,T> * p_input_stream) + : input(p_input_stream) + { + // nothing to do! + }; + + DLG_stream_input(const DLG_stream_input & a_recopier) + : input(a_recopier.input) + { + // nothing to do! + }; + + virtual ~DLG_stream_input() + { + this->purge(); // bloody templarized lookup... + }; + + DLG_stream_input operator = (const DLG_stream_input & a_affecter) + { + if (this != &a_affecter) + { + input = a_affecter.input; + } + + return(*this); + }; + + virtual int nextChar() + { + E extracted_stuff; + + input->get(extracted_stuff); + + if (*input) + { + return(int(extracted_stuff)); + } + else + { + return(EOF); + } + }; + +protected: + + ::std::basic_istream<E,T> * input; + +private: + + void purge() + { + // nothing to do! + }; +}; + +#endif /* _DLG_STREAM_INPUT_H */ + diff --git a/pccts/h/DLexer.h b/pccts/h/DLexer.h new file mode 100644 index 0000000..c967065 --- /dev/null +++ b/pccts/h/DLexer.h @@ -0,0 +1,191 @@ +/* DLexer.h (formerly DLexer.cpp) + * + * This was renamed because the use of the .cpp extension caused problems + * with IDEs. + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +#define ZZINC {if ( track_columns ) (++_endcol);} + +#define ZZGETC {ch = input->nextChar(); cl = ZZSHIFT(ch);} + +#define ZZNEWSTATE (newstate = dfa[state][cl]) + +#ifndef ZZCOPY +#define ZZCOPY \ + /* Truncate matching buffer to size (not an error) */ \ + if (nextpos < lastpos){ \ + *(nextpos++) = ch; \ + }else{ \ + bufovf = 1; \ + } +#endif + +void DLGLexer:: +mode( int m ) +{ + /* points to base of dfa table */ + if (m<MAX_MODE){ + automaton = m; + /* have to redo class since using different compression */ + cl = ZZSHIFT(ch); + }else{ + sprintf((char *)ebuf,"Invalid automaton mode = %d ",m); + errstd(ebuf); + } +} + +ANTLRTokenType DLGLexer:: +nextTokenType(void) +{ + register int state, newstate; + /* last space reserved for the null char */ + register DLGChar *lastpos; + ANTLRTokenType tk; + +skip: + bufovf = 0; + lastpos = &_lextext[_bufsize-1]; + nextpos = _lextext; + _begcol = _endcol+1; +more: + _begexpr = nextpos; + if ( interactive ) { + /* interactive version of automaton */ + /* if there is something in ch, process it */ + state = newstate = dfa_base[automaton]; + if (charfull){ + ZZINC; + ZZCOPY; + ZZNEWSTATE; + } + while (alternatives[newstate]){ + state = newstate; + ZZGETC; + ZZINC; + ZZCOPY; + ZZNEWSTATE; + } + /* figure out if last character really part of token */ + if ((state != dfa_base[automaton]) && (newstate == DfaStates)){ + charfull = 1; + --nextpos; + }else{ + charfull = 0; + state = newstate; + } + *(nextpos) = '\0'; + /* Able to transition out of start state to some non err state?*/ + if ( state == dfa_base[automaton] ){ + /* make sure doesn't get stuck */ + advance(); + } + } + else { /* non-interactive version of automaton */ + if (!charfull) + advance(); + else + ZZINC; + state = dfa_base[automaton]; + while (ZZNEWSTATE != DfaStates) { + state = newstate; + ZZCOPY; + ZZGETC; + ZZINC; + } + charfull = 1; + if ( state == dfa_base[automaton] ){ + if (nextpos < lastpos){ + *(nextpos++) = ch; + }else{ + bufovf = 1; + } + *nextpos = '\0'; + /* make sure doesn't get stuck */ + advance(); + }else{ + *nextpos = '\0'; + } + } + if ( track_columns ) _endcol -= charfull; + _endexpr = nextpos -1; + add_erase = 0; +#ifdef OLD + tk = (ANTLRTokenType) + (*actions[accepts[state]])(this); // must pass this manually + // actions is not a [] of pointers + // to member functions. +#endif + tk = (this->*actions[accepts[state]])(); + +// MR1 +// MR1 11-Apr-97 Help for tracking DLG results +// MR1 + +#ifdef DEBUG_LEXER + +/* MR1 */ if (debugLexerFlag) { +/* MR1 */ if (parser != NULL) { +/* MR1 */ /* MR23 */ printMessage(stdout, "\ntoken name=%s",parser->parserTokenName(tk)); +/* MR1 */ } else { +/* MR1 */ /* MR23 */ printMessage(stdout, "\ntoken nnumber=%d",tk); +/* MR1 */ }; +/* MR1 */ /* MR23 */ printMessage(stdout, " lextext=(%s) mode=%d", +/* MR1 */ (_lextext[0]=='\n' && _lextext[1]==0) ? +/* MR1 */ "newline" : _lextext, +/* MR1 */ automaton); +/* MR1 */ if (interactive && !charfull) { +/* MR1 */ /* MR23 */ printMessage(stdout, " char=empty"); +/* MR1 */ } else { +/* MR1 */ if (ch=='\n') { +/* MR1 */ /* MR23 */ printMessage(stdout, " char=newline"); +/* MR1 */ } else { +/* MR1 */ /* MR23 */ printMessage(stdout, " char=(%c)",ch); +/* MR1 */ }; +/* MR1 */ }; +/* MR1 */ /* MR23 */ printMessage(stdout, " %s\n", +/* MR1 */ (add_erase==1 ? "skip()" : +/* MR1 */ add_erase==2 ? "more()" : +/* MR1 */ "")); +/* MR1 */ }; + +#endif + + switch (add_erase) { + case 1: goto skip; + case 2: goto more; + } + return tk; +} + +void DLGLexer:: +advance() +{ + if ( input==NULL ) err_in(); + ZZGETC; charfull = 1; ZZINC; +} diff --git a/pccts/h/DLexerBase.cpp b/pccts/h/DLexerBase.cpp new file mode 100644 index 0000000..66907f8 --- /dev/null +++ b/pccts/h/DLexerBase.cpp @@ -0,0 +1,302 @@ +/* DLGLexerBase.c + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +#include "pcctscfg.h" + +#include "pccts_stdio.h" +#include "pccts_stdlib.h" + +PCCTS_NAMESPACE_STD + +/* I have to put this here due to C++ limitation + * that you can't have a 'forward' decl for enums. + * I hate C++!!!!!!!!!!!!!!! + */ + +// MR1 +// MR1 10-Apr-97 133MR1 Prevent use of varying sizes for the +// MR1 ANTLRTokenType enum +// MR1 + +enum ANTLRTokenType { TER_HATES_CPP=0, ITS_UTTER_GARBAGE, // MR1 + WITH_SOME_GOOD_IDEAS=9999}; // MR1 + +#define ANTLR_SUPPORT_CODE + +#include "pcctscfg.h" +#include DLEXERBASE_H +#include APARSER_H // MR23 + +DLGLexerBase:: +DLGLexerBase(DLGInputStream *in, + unsigned bufsize, + int _interactive, + int _track_columns) +{ + this->_bufsize = bufsize; + this->_lextext = new DLGChar[_bufsize]; + if ( this->_lextext==NULL ) { + panic("text buffer is NULL"); + } + this->_begexpr = this->_endexpr = NULL; + this->ch = this->bufovf = 0; + this->nextpos = NULL; + this->cl = 0; + this->add_erase = 0; + this->input = in; + this->_begcol = 0; + this->_endcol = 0; + this->_line = 1; + this->charfull = 0; + this->automaton = 0; + this->token_to_fill = NULL; + this->interactive = _interactive; + this->track_columns = _track_columns; + this->debugLexerFlag = 0; // MR1 + this->parser = NULL; // MR1 + this->lexErrCount=0; // MR11 +} + +// MR19 THM + +void DLGLexerBase::reset() +{ + this->charfull = 0; + this->_begcol = 0; + this->_endcol = 0; + this->automaton = 0; + this->_line=1; + this->lexErrCount=0; +} + +void DLGLexerBase:: +setInputStream( DLGInputStream *in ) +{ + this->input = in; + _line = 1; + charfull = 0; +} + +/* saves dlg state, but not what feeds dlg (such as file position) */ +void DLGLexerBase:: +saveState(DLGState *state) +{ + state->input = input; + state->interactive = interactive; + state->track_columns = track_columns; + state->auto_num = automaton; + state->add_erase = add_erase; + state->lookc = ch; + state->char_full = charfull; + state->begcol = _begcol; + state->endcol = _endcol; + state->line = _line; + state->lextext = _lextext; + state->begexpr = _begexpr; + state->endexpr = _endexpr; + state->bufsize = _bufsize; + state->bufovf = bufovf; + state->nextpos = nextpos; + state->class_num = cl; + state->debugLexerFlag = debugLexerFlag; // MR1 + state->parser = parser; // MR1 +} + +void DLGLexerBase:: +restoreState(DLGState *state) +{ + input = state->input; + interactive = state->interactive; + track_columns = state->track_columns; + automaton = state->auto_num; + add_erase = state->add_erase; + ch = state->lookc; + charfull = state->char_full; + _begcol = state->begcol; + _endcol = state->endcol; + _line = state->line; + _lextext = state->lextext; + _begexpr = state->begexpr; + _endexpr = state->endexpr; + _bufsize = state->bufsize; + bufovf = state->bufovf; + nextpos = state->nextpos; + cl = state->class_num; + debugLexerFlag = state->debugLexerFlag; // MR1 + parser = state->parser; // MR1 +} + +/* erase what is currently in the buffer, and get a new reg. expr */ +void DLGLexerBase:: +skip() +{ + add_erase = 1; +} + +/* don't erase what is in the lextext buffer, add on to it */ +void DLGLexerBase:: +more() +{ + add_erase = 2; +} + +/* substitute c for the reg. expr last matched and is in the buffer */ +void DLGLexerBase:: +replchar(DLGChar c) +{ + /* can't allow overwriting null at end of string */ + if (_begexpr < &_lextext[_bufsize-1]){ + *_begexpr = c; + *(_begexpr+1) = '\0'; + } + _endexpr = _begexpr; + if (c != '\0') { + nextpos = _begexpr + 1; + } + else { + nextpos = _begexpr; /* MR30 Zero terminates string. */ + } +} + +/* replace the string s for the reg. expr last matched and in the buffer */ + +#ifdef _MSC_VER // MR23 +//Turn off "assignment within conditional expression" warning +#pragma warning(disable : 4706) +#endif +void DLGLexerBase:: +replstr(const DLGChar *s) /* MR20 const */ +{ + register DLGChar *l= &_lextext[_bufsize -1]; + + nextpos = _begexpr; + if (s){ + while ((nextpos <= l) && (*(nextpos++) = *(s++))){ + /* empty */ + } + /* correct for NULL at end of string */ + nextpos--; + } + if ((nextpos <= l) && (*(--s) == 0)){ + bufovf = 0; + }else{ + bufovf = 1; + } + *(nextpos) = '\0'; + _endexpr = nextpos - 1; +} +#ifdef _MSC_VER // MR23 +#pragma warning(default: 4706) +#endif + +void DLGLexerBase:: +errstd(const char *s) /* MR20 const */ +{ + lexErrCount++; /* MR11 */ + /* MR23 */ printMessage(stderr, + "%s near line %d (text was '%s')\n", + ((s == NULL) ? "Lexical error" : s), + _line,_lextext); +} + +int DLGLexerBase:: +err_in() +{ + /* MR23 */ printMessage(stderr,"No input stream, function, or string\n"); + /* return eof to get out gracefully */ + return EOF; +} + +ANTLRTokenType DLGLexerBase:: +erraction() +{ + errstd("invalid token"); + advance(); + skip(); + return (ANTLRTokenType) 0; // bogus, but satisfies compiler +} + +_ANTLRTokenPtr DLGLexerBase:: +getToken() +{ + if ( token_to_fill==NULL ) panic("NULL token_to_fill"); + ANTLRTokenType tt = nextTokenType(); + _ANTLRTokenPtr tk = token_to_fill->makeToken(tt, _lextext,_line); + return tk; +} + +void DLGLexerBase:: +panic(const char *msg) /* MR20 const */ +{ + if (parser) //MR23 + parser->panic(msg); //MR23 + else //MR23 + { + /* MR23 */ printMessage(stderr, "DLG panic: %s\n", msg); + // + // 7-Apr-97 133MR1 + // + exit(PCCTS_EXIT_FAILURE); // MR1 + } +} + +ANTLRParser * DLGLexerBase:: // MR1 +setParser(ANTLRParser *p) { // MR1 + ANTLRParser *oldValue=parser; // MR1 + parser=p; // MR1 + return oldValue; // MR1 +} // MR1 + // MR1 +ANTLRParser * DLGLexerBase:: // MR1 +getParser() { // MR1 + return parser; // MR1 +} // MR1 + // MR1 +int DLGLexerBase:: // MR1 +debugLexer(int newValue) { // MR1 + int oldValue=debugLexerFlag; // MR1 + debugLexerFlag=newValue; // MR1 + return oldValue; // MR1 +} // MR1 + +//MR23 +int DLGLexerBase::printMessage(FILE* pFile, const char* pFormat, ...) +{ + va_list marker; + va_start( marker, pFormat ); + + int iRet = 0; + if (parser) + parser->printMessageV(pFile, pFormat, marker); + else + iRet = vfprintf(pFile, pFormat, marker); + + va_end( marker ); + return iRet; +} diff --git a/pccts/h/DLexerBase.h b/pccts/h/DLexerBase.h new file mode 100644 index 0000000..3136d95 --- /dev/null +++ b/pccts/h/DLexerBase.h @@ -0,0 +1,201 @@ +/* DLGLexerBase.h + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +#ifndef DLGX_H +#define DLGX_H + +#include "pcctscfg.h" +#include "pccts_stdio.h" + +PCCTS_NAMESPACE_STD + +#include ATOKEN_H +#include ATOKENSTREAM_H + +class ANTLRParser; // MR1 + +/* must define what a char looks like; can make this a class too */ +typedef char DLGChar; + +/* Can have it as a class too: (ack this looks weird; is it right?) +class DllExportPCCTS DLGChar { +private: + int c; +public: + DLGChar(int ch) { c = ch; } + int atom() { return c; } +}; +*/ + +/* user must subclass this */ +class DllExportPCCTS DLGInputStream { +public: + virtual ~DLGInputStream() {} + virtual int nextChar() = 0; +}; + +/* Predefined char stream: Input from FILE */ +class DllExportPCCTS DLGFileInput : public DLGInputStream { +private: + int found_eof; + FILE *input; +public: + DLGFileInput(FILE *f) { input = f; found_eof = 0; } + virtual ~DLGFileInput() {} + int nextChar() { + int c; + if ( found_eof ) return EOF; + else { + c=getc(input); + if ( c==EOF ) found_eof = 1; + return c; + } + } + void DLGFileReset(FILE *f) {input=f; found_eof = 0; }; // MR11 +}; + +// MR9 Suggested by Bruce Guenter (bruceg@qcc.sk.ca) +// MR9 Make DLGStringInput const correct + +/* Predefined char stream: Input from string */ +class DllExportPCCTS DLGStringInput : public DLGInputStream { +private: + const DLGChar *input; // MR9 + const DLGChar *p; // MR9 +public: + DLGStringInput(const DLGChar *s) { input = s; p = &input[0];} // MR9 + ~DLGStringInput() {} + int nextChar() + { + if (*p) return (int) (unsigned char) *p++; // MR14 + else return EOF; + } + + void DLGStringReset(const DLGChar *s) {input=s; p= &input[0]; }; // MR11 // MR16 +}; + +class DllExportPCCTS DLGState { +public: + DLGInputStream *input; + int interactive; + int track_columns; + int auto_num; + int add_erase; + int lookc; + int char_full; + int begcol, endcol; + int line; + DLGChar *lextext, *begexpr, *endexpr; + int bufsize; + int bufovf; + DLGChar *nextpos; + int class_num; + int debugLexerFlag; // MR1 + ANTLRParser *parser; // MR1 +}; + +/* user must subclass this */ +class DllExportPCCTS DLGLexerBase : public ANTLRTokenStream { +public: + virtual ANTLRTokenType erraction(); + +protected: + DLGInputStream *input; + int interactive; + int track_columns; + DLGChar *_lextext; /* text of most recently matched token */ + DLGChar *_begexpr; /* beginning of last reg expr recogn. */ + DLGChar *_endexpr; /* beginning of last reg expr recogn. */ + int _bufsize; /* number of characters in lextext */ + int _begcol; /* column that first character of token is in*/ + int _endcol; /* column that last character of token is in */ + int _line; /* line current token is on */ + int ch; /* character to determine next state */ + int bufovf; /* indicates that buffer too small for text */ + int charfull; + DLGChar *nextpos; /* points to next available position in lextext*/ + int cl; + int automaton; + int add_erase; + DLGChar ebuf[70]; + _ANTLRTokenPtr token_to_fill; + + int debugLexerFlag; // MR1 + ANTLRParser *parser; // MR1 +public: + virtual _ANTLRTokenPtr getToken(); // MR12 public + virtual void advance(void) = 0; + void skip(void); /* erase lextext, look for antoher token */ + void more(void); /* keep lextext, look for another token */ + void mode(int k); /* switch to automaton 'k' */ + void saveState(DLGState *); + void restoreState(DLGState *); + virtual ANTLRTokenType nextTokenType(void)=0;/* get next token */ + void replchar(DLGChar c); /* replace last recognized reg. expr. with + a character */ + void replstr(const DLGChar *s); /* replace last recognized reg. expr. with + a string */ /* MR20 const */ + virtual int err_in(); // MR1 + virtual void errstd(const char *); // MR1 MR20 const + int line() { return _line; } + void set_line(int newValue) { _line=newValue; }; // MR1 + virtual void newline() { _line++; } + DLGChar *lextext() { return _lextext; } + + int begcol() { return _begcol; } + int endcol() { return _endcol; } + void set_begcol(int a) { _begcol=a; } + void set_endcol(int a) { _endcol=a; } + DLGChar *begexpr() { return _begexpr; } + DLGChar *endexpr() { return _endexpr; } + int bufsize() { return _bufsize; } + + void setToken(ANTLRAbstractToken *t) { token_to_fill = t; } + + void setInputStream(DLGInputStream *); + DLGLexerBase(DLGInputStream *in, + unsigned bufsize=2000, + int interactive=0, + int track_columns=0); + void reset(); // MR19 + virtual ~DLGLexerBase() { delete [] _lextext; } + virtual void panic(const char *msg); // MR1 MR20 const + void trackColumns() { + track_columns = 1; + this->_begcol = 0; + this->_endcol = 0; + }; + virtual ANTLRParser *setParser(ANTLRParser *p); // MR1 + virtual ANTLRParser *getParser(); // MR1 + virtual int debugLexer(int value); // MR1 + int lexErrCount; // MR12 + virtual int printMessage(FILE* pFile, const char* pFormat, ...); // MR23 +}; + +#endif diff --git a/pccts/h/PBlackBox.h b/pccts/h/PBlackBox.h new file mode 100644 index 0000000..39f7d57 --- /dev/null +++ b/pccts/h/PBlackBox.h @@ -0,0 +1,134 @@ +#ifndef PBLACKBOX_H +#define PBLACKBOX_H + +/* + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +/* Completely rewritten by Chris Uzdavinis (chris@atdesk.com) for MR23 */ + +#include "pcctscfg.h" + +#include "pccts_iostream.h" + +PCCTS_NAMESPACE_STD + +// MR20 Added #include for "DLexerBase.h" + +#include "DLexerBase.h" + +// +// The default buffer size of the lexer is given by the +// second argument of the lexer's ctor. It is optional +// and defaults to 2000 +// + +template<class Lexer, class Parser, class Token> +class DllExportPCCTS ParserBlackBox { +private: + // no copy construction allowed + ParserBlackBox(ParserBlackBox const &); + + // no copy assignment allowed + ParserBlackBox & operator=(ParserBlackBox const &); + +protected: + DLGFileInput *in; + Lexer *scan; + _ANTLRTokenPtr tok; + ANTLRTokenBuffer *pipe; + Parser *_parser; + FILE *file; + int openByBlackBox; /* MR21 Don't close what we haven't opened */ +public: + + ParserBlackBox(FILE *f) + : in(0) + , scan(0) + , tok(0) + , pipe(0) + , _parser(0) + , file(0) + , openByBlackBox(0) + { + if (f == NULL) + { + cerr << "invalid file pointer\n"; + } + else + { + openByBlackBox = 0; /* MR21a */ + file = f; + in = new DLGFileInput(f); + scan = new Lexer(in); + pipe = new ANTLRTokenBuffer(scan); + tok = new Token; + scan->setToken(tok); + _parser = new Parser(pipe); + _parser->init(); + } + } + ParserBlackBox(char *fname) + : in(0) + , scan(0) + , tok(0) + , pipe(0) + , _parser(0) + , file(0) + , openByBlackBox(0) + { + FILE *f = fopen(fname, "r"); + if ( f==NULL ) { + openByBlackBox = 0; + cerr << "cannot open " << fname << "\n"; return; + } + else { + openByBlackBox = 1; + file = f; + in = new DLGFileInput(f); + scan = new Lexer(in); + pipe = new ANTLRTokenBuffer(scan); + tok = new Token; + scan->setToken(tok); + _parser = new Parser(pipe); + _parser->init(); + } + } + + ~ParserBlackBox() + { + delete in; delete scan; delete pipe; delete _parser; delete tok; + if (1 == openByBlackBox) { + fclose(file); + } + } + + Parser *parser() { return _parser; } + Lexer *getLexer() { return scan; } +}; + +#endif diff --git a/pccts/h/PCCTSAST.cpp b/pccts/h/PCCTSAST.cpp new file mode 100644 index 0000000..f6b0295 --- /dev/null +++ b/pccts/h/PCCTSAST.cpp @@ -0,0 +1,684 @@ +/* + * PCCTSAST.C + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to SORCERER -- SORCERER is in the public + * domain. An individual or company may do whatever they wish with + * source code distributed with SORCERER or the code generated by + * SORCERER, including the incorporation of SORCERER, or its output, into + * commerical software. + * + * We encourage users to develop software with SORCERER. However, we do + * ask that credit is given to us for developing SORCERER. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like SORCERER and have developed a nice tool with the + * output, please mention that you developed it using SORCERER. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * SORCERER 1.00B14 and ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * AHPCRC, University of Minnesota + * 1992-2000 + */ + +#define ANTLR_SUPPORT_CODE + +#include "pcctscfg.h" + +#include "PCCTSAST.h" +#include "pccts_stdarg.h" + +PCCTS_NAMESPACE_STD + +#include <ctype.h> + +//#include "SList.h" + + /* String Scanning/Parsing Stuff */ + +const char *PCCTS_AST::scan_token_tbl[] = { /* MR20 const */ + "invalid", /* 0 */ + "LPAREN", /* 1 */ + "RPAREN", /* 2 */ + "PERCENT", /* 3 */ + "INT", /* 4 */ + "COLON", /* 5 */ + "POUND", /* 6 */ + "PERIOD", /* 7 */ +}; + +void PCCTS_AST:: +addChild(PCCTS_AST *t) +{ + if ( t==NULL ) return; + PCCTS_AST *s = down(); + if ( s!=NULL ) + { + while ( s->right()!=NULL ) s = s->right(); + s->setRight(t); + } + else + this->setDown(t); +} + +void PCCTS_AST:: +lisp(FILE *f) +{ + if ( down() != NULL ) /* MR23 */ printMessage(f," ("); + lisp_action(f); + if ( down()!=NULL ) down()->lisp(f); + if ( down() != NULL ) /* MR23 */ printMessage(f," )"); + if ( right()!=NULL ) right()->lisp(f); +} + +/* build a tree (root child1 child2 ... NULL) + * If root is NULL, simply make the children siblings and return ptr + * to 1st sibling (child1). If root is not single node, return NULL. + * + * Siblings that are actually sibling lists themselves are handled + * correctly. For example #( NULL, #( NULL, A, B, C), D) results + * in the tree ( NULL A B C D ). + * + * Requires at least two parameters with the last one being NULL. If + * both are NULL, return NULL. + * + * The down() and right() down/right pointers are used to make the tree. + */ +PCCTS_AST *PCCTS_AST:: +make(PCCTS_AST *rt, ...) +{ + va_list ap; + register PCCTS_AST *child, *sibling=NULL, *tail=NULL /*MR23*/, *w; + PCCTS_AST *root; + + va_start(ap, rt); + root = rt; + + if ( root != NULL ) + if ( root->down() != NULL ) return NULL; + child = va_arg(ap, PCCTS_AST *); + while ( child != NULL ) + { + /* find end of child */ + for (w=child; w->right()!=NULL; w=w->right()) {;} + if ( sibling == NULL ) {sibling = child; tail = w;} + else {tail->setRight(child); tail = w;} + child = va_arg(ap, PCCTS_AST *); + } + if ( root==NULL ) root = sibling; + else root->setDown(sibling); + va_end(ap); + return root; +} + +/* The following push and pop routines are only used by ast_find_all() */ + +void PCCTS_AST:: +_push(PCCTS_AST **st, int *sp, PCCTS_AST *e) +{ + (*sp)--; + require((*sp)>=0, "stack overflow"); + st[(*sp)] = e; +} + +PCCTS_AST *PCCTS_AST:: +_pop(PCCTS_AST **st, int *sp) +{ + PCCTS_AST *e = st[*sp]; + (*sp)++; + require((*sp)<=MaxTreeStackDepth, "stack underflow"); + return e; +} + +/* Find all occurrences of u in t. + * 'cursor' must be initialized to 't'. It eventually + * returns NULL when no more occurrences of 'u' are found. + */ +PCCTS_AST *PCCTS_AST:: +ast_find_all(PCCTS_AST *u, PCCTS_AST **cursor) +{ + PCCTS_AST *sib; + /*** static ***/ PCCTS_AST *template_stack[MaxTreeStackDepth]; /* MR23 Remove "static" */ + /*** static ***/ int tsp = MaxTreeStackDepth; /* MR23 Remove "static" */ + +////static int nesting = 0; /* MR23 Not referenced */ + + if ( *cursor == NULL ) return NULL; + if ( *cursor!=this ) sib = *cursor; + else { + /* else, first time--start at top of template 't' */ + tsp = MaxTreeStackDepth; + sib = this; + /* bottom of stack is always a NULL--"cookie" indicates "done" */ + _push(template_stack, &tsp, NULL); + } + +keep_looking: + if ( sib==NULL ) /* hit end of sibling list */ + { + sib = _pop(template_stack, &tsp); + if ( sib == NULL ) { *cursor = NULL; return NULL; } + } + + if ( sib->type() != u->type() ) + { + /* look for another match */ + if ( sib->down()!=NULL ) + { + if ( sib->right()!=NULL ) _push(template_stack, &tsp, sib->right()); + sib=sib->down(); + goto keep_looking; + } + /* nothing below to try, try next sibling */ + sib=sib->right(); + goto keep_looking; + } + + /* found a matching root node, try to match what's below */ + if ( match_partial(sib, u) ) + { + /* record sibling cursor so we can pick up next from there */ + if ( sib->down()!=NULL ) + { + if ( sib->right()!=NULL ) _push(template_stack, &tsp, sib->right()); + *cursor = sib->down(); + } + else if ( sib->right()!=NULL ) *cursor = sib->right(); + else *cursor = _pop(template_stack, &tsp); + return sib; + } + + /* no match, keep searching */ + if ( sib->down()!=NULL ) + { + if ( sib->right()!=NULL ) _push(template_stack, &tsp, sib->right()); + sib=sib->down(); + } + else sib = sib->right(); /* else, try to right if zip below */ + goto keep_looking; +} + +/* are two trees exactly alike? */ +int PCCTS_AST:: +match(PCCTS_AST *u) +{ + PCCTS_AST *t = this; + PCCTS_AST *sib; + + if ( u==NULL ) return 0; + + for (sib=t; sib!=NULL&&u!=NULL; sib=sib->right(), u=u->right()) + { + if ( sib->type() != u->type() ) return 0; + if ( sib->down()!=NULL ) + if ( !sib->down()->match(u->down()) ) return 0; + } + return 1; +} + +/* Is 'u' a subtree of 't' beginning at the root? */ +int PCCTS_AST:: +match_partial(PCCTS_AST *t, PCCTS_AST *u) +{ + PCCTS_AST *sib; + + if ( u==NULL ) return 1; + if ( t==NULL ) return 0; /* MR23 removed unreachable code */ + + for (sib=t; sib!=NULL&&u!=NULL; sib=sib->right(), u=u->right()) + { + if ( sib->type() != u->type() ) return 0; + if ( sib->down()!=NULL ) + if ( !match_partial(sib->down(), u->down()) ) return 0; + } + return 1; +} + +#ifdef _MSC_VER // MR23 +//Turn off "unreachable code" warning +#pragma warning(disable : 4702) +#endif +/* Walk the template tree 't' (matching against 'this'), filling in the + * 'labels' array, and setting 'n' according to how many labels were matched. + */ +int PCCTS_AST:: +scanmatch(ScanAST *t, PCCTS_AST **labels[], int *n) +{ + ScanAST *sib; + PCCTS_AST *u = this; + + if ( u==NULL ) return 0; + + for (sib=t; sib!=NULL&&u!=NULL; sib=sib->right(), u=u->right()) + { + /* make sure tokens match; token of '0' means wildcard match */ + if ( sib->type() != u->type() && sib->type()!=0 ) return 0; + /* we have a matched token here; set label pointers if exists */ + if ( sib->label_num>0 ) + { + require(labels!=NULL, "label found in template, but no array of labels"); + (*n)++; + *(labels[sib->label_num-1]) = u; + } + /* match what's below if something there and current node is not wildcard */ + if ( sib->down()!=NULL && sib->type()!=0 ) + { + if ( sib->down()==NULL ) + { + if ( u->down()!=NULL ) + return 0; + else + return 1; + } + if ( !u->down()->scanmatch(sib->down(), labels, n) ) return 0; + } + } + return 1; +} +#ifdef _MSC_VER // MR23 +#pragma warning(default : 4702) +#endif + +void PCCTS_AST:: +insert_after(PCCTS_AST *b) +{ + PCCTS_AST *end; + if ( b==NULL ) return; + /* find end of b's child list */ + for (end=b; end->right()!=NULL; end=end->right()) {;} + end->setRight(this->right()); + this->setRight(b); +} + +void PCCTS_AST:: +append(PCCTS_AST *b) +{ + PCCTS_AST *end; + require(b!=NULL, "append: NULL input tree"); + /* find end of child list */ + for (end=this; end->right()!=NULL; end=end->right()) {;} + end->setRight(b); +} + +PCCTS_AST *PCCTS_AST:: +tail() +{ + PCCTS_AST *end; + /* find end of child list */ + for (end=this; end->right()!=NULL; end=end->right()) {;} + return end; +} + +PCCTS_AST *PCCTS_AST:: +bottom() +{ + PCCTS_AST *end; + /* find end of child list */ + for (end=this; end->down()!=NULL; end=end->down()) {;} + return end; +} + +PCCTS_AST *PCCTS_AST:: +cut_between(PCCTS_AST *a, PCCTS_AST *b) +{ + PCCTS_AST *end, *ret; + if (a==NULL||b==NULL) return NULL; + /* find node pointing to b */ + for (end=a; end->right()!=NULL&&end->right()!=b; end=end->right()) + {;} + if (end->right()==NULL) return NULL; //ast_cut_between: a,b not connected + end->setRight(NULL); /* don't want it point to 'b' anymore */ + ret = a->right(); + a->setRight(b); + return ret; +} + +#ifdef NOT_YET +SList *PCCTS_AST:: +to_slist() +{ + SList *list = new SList; + PCCTS_AST *p; + + for (p=this; p!=NULL; p=p->right()) + { + list->add(p); + } + return list; +} +#endif + +void PCCTS_AST:: +tfree() +{ + PCCTS_AST *t = this; + if ( t->down()!=NULL ) t->down()->tfree(); + if ( t->right()!=NULL ) t->right()->tfree(); + delete t; +} + +int PCCTS_AST:: +nsiblings() +{ + PCCTS_AST *t = this; + int n=0; + + while ( t!=NULL ) + { + n++; + t = t->right(); + } + return n; +} + +PCCTS_AST *PCCTS_AST:: +sibling_index(int i) +{ + PCCTS_AST *t = this; + int j=1; + require(i>0, "sibling_index: i<=0"); + + while ( t!=NULL ) + { + if ( j==i ) return t; + j++; + t = t->right(); + } + return NULL; +} + +/* Assume this is a root node of a tree-- + * duplicate that node and what's below; ignore siblings of root node. + */ + +// MR9 23-Sep-97 RJV +// MR9 +// MR9 RJV: Original version only duplicated the node and down elements. +// MR9 Made copies of the pointers to sibling. +// MR9 Changed call "down()->deepCopy()" to "down()->deepCopyBushy()" +// MR9 + +PCCTS_AST *PCCTS_AST:: +deepCopy() +{ + PCCTS_AST *u = this->shallowCopy(); + if ( down()!=NULL ) u->setDown(down()->deepCopyBushy()); + u->setRight(NULL); + return u; +} + +/* Copy all nodes including siblings of root. */ +PCCTS_AST *PCCTS_AST:: +deepCopyBushy() +{ + PCCTS_AST *u = this->shallowCopy(); + /* copy the rest of the tree */ + if ( down()!=NULL ) u->setDown(down()->deepCopyBushy()); + if ( right()!=NULL ) u->setRight(right()->deepCopyBushy()); + return u; +} + +void PCCTS_AST:: +scanast_free(ScanAST *t) +{ + if ( t == NULL ) return; + scanast_free( t->down() ); + scanast_free( t->right() ); + free( (char *) t ); // MR1 +} + +/* + * scan + * + * This function is like scanf(): it attempts to match a template + * against an input tree. A variable number of tree pointers + * may be set according to the '%i' labels in the template string. + * For example: + * + * t->ast_scan("#( 6 #(5 %1:4 %2:3) #(1 %3:3 %4:3) )", + * &w, &x, &y, &z); + * + * Naturally, you'd want this converted from + * + * t->ast_scan("#( RangeOp #(Minus %1:IConst %2:Var) #(Plus %3:Var %4Var) )", + * &w, &x, &y, &z); + * + * by SORCERER. + * + * This function call must be done withing a SORCERER file because SORCERER + * must convert the token references to the associated token number. + * + * This functions parses the template and creates trees which are then + * matched against the input tree. The labels are set as they are + * encountered; hence, partial matches may leave some pointers set + * and some NULL. This routines initializes all argument pointers to NULL + * at the beginning. + * + * This function returns the number of labels matched. + */ +int PCCTS_AST:: +ast_scan(char *templ, ...) +{ + va_list ap; + ScanAST *tmpl; + int n, i, found=0; + PCCTS_AST ***label_ptrs=NULL; + + va_start(ap, templ); + + /* make a ScanAST tree out of the template */ + tmpl = stringparser_parse_scanast(templ, &n); + + /* make an array out of the labels */ + if ( n>0 ) + { + label_ptrs = (PCCTS_AST ***) calloc(n, sizeof(PCCTS_AST **)); + require(label_ptrs!=NULL, "scan: out of memory"); + for (i=1; i<=n; i++) + { + label_ptrs[i-1] = va_arg(ap, PCCTS_AST **); + *(label_ptrs[i-1]) = NULL; + } + } + + /* match the input tree against the template */ + scanmatch(tmpl, label_ptrs, &found); + + scanast_free(tmpl); + free( (char *) label_ptrs); // MR1 + + return found; +} + +ScanAST *PCCTS_AST:: +new_scanast(int tok) +{ + ScanAST *p = (ScanAST *) calloc(1, sizeof(ScanAST)); +// +// 7-Apr-97 133MR1 +// + if ( p == NULL ) + panic("out of memory\n"); // MR23 + p->_token = tok; + return p; +} + +ScanAST *PCCTS_AST:: +stringparser_parse_scanast(char *templ, int *num_labels) +{ + StringLexer lex; + StringParser parser; + ScanAST *t; + + stringlexer_init(&lex, templ); + stringparser_init(&parser, &lex); + t = stringparser_parse_tree(&parser); + *num_labels = parser.num_labels; + return t; +} + +void PCCTS_AST:: +stringparser_match(StringParser *parser, int token) +{ + if ( parser->token != token ) panic("bad tree in scan()"); +} + +/* + * Match a tree of the form: + * (root child1 child2 ... childn) + * or, + * node + * + * where the elements are integers or labeled integers. + */ +ScanAST *PCCTS_AST:: +stringparser_parse_tree(StringParser *parser) +{ + ScanAST *t=NULL, *root, *child, *last=NULL /*MR23*/; + + if ( parser->token != __POUND ) + { + return stringparser_parse_element(parser); + } + stringparser_match(parser,__POUND); + parser->token = stringscan_gettok(parser->lexer); + stringparser_match(parser,__LPAREN); + parser->token = stringscan_gettok(parser->lexer); + root = stringparser_parse_element(parser); + while ( parser->token != __RPAREN ) + { + child = stringparser_parse_element(parser); + if ( t==NULL ) { t = child; last = t; } + else { last->_right = child; last = child; } + } + stringparser_match(parser,__RPAREN); + parser->token = stringscan_gettok(parser->lexer); + root->_down = t; + return root; +} + +ScanAST *PCCTS_AST:: +stringparser_parse_element(StringParser *parser) +{ + char ebuf[100]; + int label = 0; + + if ( parser->token == __POUND ) + { + return stringparser_parse_tree(parser); + } + if ( parser->token == __PERCENT ) + { + parser->token = stringscan_gettok(parser->lexer); + stringparser_match(parser,__INT); + label = atoi(parser->lexer->text); + parser->num_labels++; + if ( label==0 ) panic("%%0 is an invalid label"); + parser->token = stringscan_gettok(parser->lexer); + stringparser_match(parser,__COLON); + parser->token = stringscan_gettok(parser->lexer); + /* can label tokens and wildcards */ + if ( parser->token != __INT && parser->token != __PERIOD ) + panic("can only label tokens"); + } + if ( parser->token == __INT ) + { + ScanAST *p = new_scanast(atoi(parser->lexer->text)); + parser->token = stringscan_gettok(parser->lexer); + p->label_num = label; + return p; + } + if ( parser->token == __PERIOD ) + { + ScanAST *p = new_scanast(0); /* token of 0 is wildcard */ + parser->token = stringscan_gettok(parser->lexer); + p->label_num = label; + return p; + } + sprintf(ebuf, "mismatch token in scan(): %s", scan_token_str(parser->token)); + panic(ebuf); + return NULL; +} + +void PCCTS_AST:: +stringparser_init(StringParser *parser, StringLexer *input) +{ + parser->lexer = input; + parser->token = stringscan_gettok(parser->lexer); + parser->num_labels = 0; +} + +void PCCTS_AST:: +stringlexer_init(StringLexer *scanner, char *input) +{ + scanner->text[0]='\0'; + scanner->input = input; + scanner->p = input; + stringscan_advance(scanner); +} + +void PCCTS_AST:: +stringscan_advance(StringLexer *scanner) +{ + if ( *(scanner->p) == '\0' ) scanner->c = __StringScanEOF; + scanner->c = *(scanner->p)++; +} + +int PCCTS_AST:: +stringscan_gettok(StringLexer *scanner) +{ + char *index = &scanner->text[0]; + char ebuf[100]; /* MR23 Remove static */ + + while ( isspace(scanner->c) ) { stringscan_advance(scanner); } + if ( isdigit(scanner->c) ) + { + int tok = __INT; + while ( isdigit(scanner->c) ) { + *index++ = (char) /* static_cast<char> */ (scanner->c); // MR23 + stringscan_advance(scanner); + } + *index = '\0'; + return tok; + } + switch ( scanner->c ) + { + case '#' : stringscan_advance(scanner); return __POUND; + case '(' : stringscan_advance(scanner); return __LPAREN; + case ')' : stringscan_advance(scanner); return __RPAREN; + case '%' : stringscan_advance(scanner); return __PERCENT; + case ':' : stringscan_advance(scanner); return __COLON; + case '.' : stringscan_advance(scanner); return __PERIOD; + case '\0' : return __StringScanEOF; + case __StringScanEOF : return __StringScanEOF; + default : + sprintf(ebuf, "invalid char in scan: '%c'", scanner->c); + panic(ebuf); + } + return __StringScanEOF; // never reached +} + +const char *PCCTS_AST:: /* MR20 const */ +scan_token_str(int t) +{ + if ( VALID_SCAN_TOKEN(t) ) return scan_token_tbl[t]; + else if ( t==__StringScanEOF ) return "<end-of-string>"; + else return "<invalid-token>"; +} + +//MR23 +int PCCTS_AST::printMessage(FILE* pFile, const char* pFormat, ...) +{ + va_list marker; + va_start( marker, pFormat ); + int iRet = vfprintf(pFile, pFormat, marker); + va_end( marker ); + return iRet; +} diff --git a/pccts/h/PCCTSAST.h b/pccts/h/PCCTSAST.h new file mode 100644 index 0000000..9fb3fd7 --- /dev/null +++ b/pccts/h/PCCTSAST.h @@ -0,0 +1,143 @@ +/* Abstract syntax tree + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +#ifndef PCCTSAST_H +#define PCCTSAST_H + +#include "pcctscfg.h" + +#include "pccts_stdio.h" +#include "pccts_stdlib.h" + +PCCTS_NAMESPACE_STD + +//class SList; + +#define StringScanMaxText 50 +#define MaxTreeStackDepth 400 + +// +// 7-Apr-97 133MR1 signed int not accepted by AT&T cfront +// +typedef struct stringlexer { + int c; // MR1 + char *input; + char *p; + char text[StringScanMaxText]; + } StringLexer; + +/* Define the structures needed for ast_scan() */ +typedef struct stringparser { + int token; + StringLexer *lexer; + int num_labels; + } StringParser; + +typedef struct _scanast { + struct _scanast *_right, *_down; + int _token; + int label_num; + int type() { return _token; } + struct _scanast *right() { return _right; } + struct _scanast *down() { return _down; } + } ScanAST; + +#define VALID_SCAN_TOKEN(t) (t>=__LPAREN && t<=__PERIOD) + +class DllExportPCCTS PCCTS_AST { +protected: + static const char *scan_token_tbl[]; /* MR20 const */ + enum { + __LPAREN=1, + __RPAREN=2, + __PERCENT=3, + __INT=4, + __COLON=5, + __POUND=6, + __PERIOD=7, + __StringScanEOF=-1}; + +protected: + const char *scan_token_str(int t); /* MR20 const */ + void stringlexer_init(StringLexer *scanner, char *input); + void stringparser_init(StringParser *, StringLexer *); + ScanAST *stringparser_parse_scanast(char *templ, int *n); + ScanAST *stringparser_parse_tree(StringParser *parser); + ScanAST *stringparser_parse_element(StringParser *parser); + void stringscan_advance(StringLexer *scanner); + int stringscan_gettok(StringLexer *scanner); + void _push(PCCTS_AST **st, int *sp, PCCTS_AST *e); + PCCTS_AST *_pop(PCCTS_AST **st, int *sp); + int match_partial(PCCTS_AST *t, PCCTS_AST *u); + int scanmatch(ScanAST *t, PCCTS_AST **labels[], int *n); + void scanast_free(ScanAST *t); + ScanAST *new_scanast(int tok); + void stringparser_match(StringParser *parser, int type); + virtual PCCTS_AST *deepCopyBushy(); + +public: + PCCTS_AST() {;} + virtual ~PCCTS_AST() {;} + + /* This group must be defined for SORCERER to work correctly */ + virtual PCCTS_AST *right() = 0; + virtual PCCTS_AST *down() = 0; + virtual void setRight(PCCTS_AST *t) = 0; + virtual void setDown(PCCTS_AST *t) = 0; +// we define these so ANTLR doesn't have to + virtual int type() { return 0; } + virtual void setType(int /*t MR23 */) {;} + virtual PCCTS_AST *shallowCopy() {panic("no shallowCopy() defined"); return NULL;} + + /* These are not needed by ANTLR, but are support functions */ + virtual PCCTS_AST *deepCopy(); // used by SORCERER in transform mode + virtual void addChild(PCCTS_AST *t); + virtual void lisp_action(FILE * /*f MR23 */) {;} + virtual void lisp(FILE *f); + static PCCTS_AST *make(PCCTS_AST *rt, ...); + virtual PCCTS_AST *ast_find_all(PCCTS_AST *u, PCCTS_AST **cursor); + virtual int match(PCCTS_AST *u); + virtual void insert_after(PCCTS_AST *b); + virtual void append(PCCTS_AST *b); + virtual PCCTS_AST *tail(); + virtual PCCTS_AST *bottom(); + static PCCTS_AST *cut_between(PCCTS_AST *a, PCCTS_AST *b); +// virtual SList *to_slist(); + virtual void tfree(); + int ast_scan(char *templ, ...); + virtual int nsiblings(); + virtual PCCTS_AST *sibling_index(int i); + + void require(int e,const char *err){ if ( !e ) panic(err); } /* MR20 const */ + virtual void panic(const char *err) // MR20 const + { /* MR23 */ printMessage(stderr, "PCCTS_AST: %s\n", err); exit(PCCTS_EXIT_FAILURE); } + virtual int printMessage(FILE* pFile, const char* pFormat, ...); // MR23 +}; + +#endif /* PCCTSAST_H */ diff --git a/pccts/h/SList.h b/pccts/h/SList.h new file mode 100644 index 0000000..34354cc --- /dev/null +++ b/pccts/h/SList.h @@ -0,0 +1,72 @@ +#ifndef SList_h +#define SList_h + +/* + * SList.h + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to SORCERER -- SORCERER is in the public + * domain. An individual or company may do whatever they wish with + * source code distributed with SORCERER or the code generated by + * SORCERER, including the incorporation of SORCERER, or its output, into + * commerical software. + * + * We encourage users to develop software with SORCERER. However, we do + * ask that credit is given to us for developing SORCERER. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like SORCERER and have developed a nice tool with the + * output, please mention that you developed it using SORCERER. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * PCCTS 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1992-2000 + */ + +#include "pcctscfg.h" + +#include "pccts_stdio.h" +#include "pccts_stdlib.h" + +PCCTS_NAMESPACE_STD + +#include "PCCTSAST.h" + +class PCCTS_AST; + +class SListNode { +protected: + void *_elem; /* pointer to any kind of element */ + SListNode *_next; +public: + SListNode() {_elem=_next=NULL;} + virtual ~SListNode() {_elem=_next=NULL;} + void *elem() { return _elem; } + void setElem(void *e) { _elem = e; } + void setNext(SListNode *t) { _next = t; } + SListNode *next() { return _next; } +}; + +class SList { + SListNode *head, *tail; +public: + SList() {head=tail=NULL;} + virtual ~SList() {head=tail=NULL;} + virtual void *iterate(SListNode **); + virtual void add(void *e); + virtual void lfree(); + virtual PCCTS_AST *to_ast(SList list); + virtual void require(int e,char *err){ if ( !e ) panic(err); } + virtual void panic(char *err){ /* MR23 */ printMessage(stderr, "SList panic: %s\n", err); exit(PCCTS_EXIT_FAILURE); } + virtual int printMessage(FILE* pFile, const char* pFormat, ...); // MR23 +}; + +#endif diff --git a/pccts/h/antlr.h b/pccts/h/antlr.h new file mode 100644 index 0000000..07323e6 --- /dev/null +++ b/pccts/h/antlr.h @@ -0,0 +1,807 @@ +/* antlr.h + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +#ifndef ANTLR_H +#define ANTLR_H + +#include "pcctscfg.h" + +#include "pccts_stdio.h" + +/* turn off warnings for unreferenced labels */ + +#ifdef _MSC_VER +#pragma warning(disable:4102) +#endif + +/* + * Define all of the stack setup and manipulation of $i, #i variables. + * + * Notes: + * The type 'Attrib' must be defined before entry into this .h file. + */ + + +#ifdef __USE_PROTOS +#include "pccts_stdlib.h" +#else +#ifdef VAXC +#include <stdlib.h> +#else +#include <malloc.h> +#endif +#endif +#include "pccts_string.h" + +#if 0 +#include "set.h" +#endif + + +typedef int ANTLRTokenType; +typedef unsigned char SetWordType; + +typedef char ANTLRChar; + + /* G u e s s S t u f f */ + +#ifdef ZZCAN_GUESS +#ifndef ZZINF_LOOK +#define ZZINF_LOOK +#endif +#endif + +#ifdef ZZCAN_GUESS +typedef struct _zzjmp_buf { + jmp_buf state; + } zzjmp_buf; +#endif + + +/* can make this a power of 2 for more efficient lookup */ + +#ifndef ZZLEXBUFSIZE +#define ZZLEXBUFSIZE 8000 /* MR22 raise from 2k to 8k */ +#endif + +#define zzOvfChk \ + if ( zzasp <= 0 ) \ + { \ + fprintf(stderr, zzStackOvfMsg, __FILE__, __LINE__); \ + exit(PCCTS_EXIT_FAILURE); \ + } + +#ifndef ZZA_STACKSIZE +#define ZZA_STACKSIZE 400 +#endif +#ifndef ZZAST_STACKSIZE +#define ZZAST_STACKSIZE 400 +#endif + +#ifndef zzfailed_pred +#ifdef ZZCAN_GUESS +#define zzfailed_pred(_p,_hasuseraction,_useraction) \ + if (zzguessing) { \ + zzGUESS_FAIL; \ + } else { \ + zzfailed_pred_action(_p,_hasuseraction,_useraction); \ + } +#else +#define zzfailed_pred(_p,_hasuseraction,_useraction) \ + zzfailed_pred_action(_p,_hasuseraction,_useraction); +#endif +#endif + +/* MR23 Provide more control over failed predicate action + without any need for user to worry about guessing internals. + _hasuseraction == 0 => no user specified error action + _hasuseraction == 1 => user specified error action +*/ + +#ifndef zzfailed_pred_action +#define zzfailed_pred_action(_p,_hasuseraction,_useraction) \ + if (_hasuseraction) { _useraction } \ + else { fprintf(stderr, "semantic error; failed predicate: '%s'\n",_p); } +#endif + +/* MR19 zzchar_t additions */ + +#ifdef LL_K +#define LOOKAHEAD \ + int zztokenLA[LL_K]; \ + zzchar_t zztextLA[LL_K][ZZLEXBUFSIZE]; \ + int zzlap = 0, zzlabase=0; /* labase only used for DEMAND_LOOK */ +#else +#define LOOKAHEAD \ + int zztoken; +#endif + +#ifndef zzcr_ast +#define zzcr_ast(ast,attr,tok,text) +#endif + +#ifdef DEMAND_LOOK +#define DemandLookData int zzdirty=1; +#else +#define DemandLookData +#endif + +#ifndef zzUSER_GUESS_HOOK +#define zzUSER_GUESS_HOOK(seqFrozen,zzrv) +#endif + +#ifndef zzUSER_GUESS_DONE_HOOK +#define zzUSER_GUESS_DONE_HOOK(seqFrozen) +#endif + + /* S t a t e S t u f f */ + +#ifdef ZZCAN_GUESS +#define zzGUESS_BLOCK zzantlr_state zzst; int zzrv; int zzGuessSeqFrozen; + +/* MR10 change zzGUESS: do zzGUESS_DONE when zzrv==1 after longjmp as in C++ mode */ + +#define zzGUESS zzsave_antlr_state(&zzst); \ + zzguessing = 1; \ + zzGuessSeqFrozen=++zzGuessSeq; \ + zzrv = setjmp(zzguess_start.state); \ + zzUSER_GUESS_HOOK(zzGuessSeqFrozen,zzrv) \ + if (zzrv) zzGUESS_DONE; +#ifdef zzTRACE_RULES +#define zzGUESS_FAIL { zzTraceGuessFail(); longjmp(zzguess_start.state, 1); } +#else +#define zzGUESS_FAIL longjmp(zzguess_start.state, 1) +#endif + +/* MR10 change zzGUESS_DONE: zzrv=1 to simulate longjmp() return value as in C++ mode */ + +#define zzGUESS_DONE { zzrestore_antlr_state(&zzst); zzrv=1; zzUSER_GUESS_DONE_HOOK(zzGuessSeqFrozen) } +#define zzNON_GUESS_MODE if ( !zzguessing ) +#define zzGuessData \ + zzjmp_buf zzguess_start; \ + int zzguessing; +#else +#define zzGUESS_BLOCK +#define zzGUESS +#define zzGUESS_FAIL +#define zzGUESS_DONE +#define zzNON_GUESS_MODE +#define zzGuessData +#endif + +typedef struct _zzantlr_state { +#ifdef ZZCAN_GUESS + zzjmp_buf guess_start; + int guessing; +#endif + int asp; + int ast_sp; +#ifdef ZZINF_LOOK + int inf_lap; /* not sure we need to save this one */ + int inf_labase; + int inf_last; + +/* MR6 Gunnar Rxnning (gunnar@candleweb.no) */ +/* MR6 Additional state needs to be saved/restored */ +/* MR6 Matching changes in err.h */ + + int *inf_tokens; /* MR6 */ + char **inf_text; /* MR6 */ + char *inf_text_buffer; /* MR6 */ + int *inf_line; /* MR6 */ +#endif +#ifdef DEMAND_LOOK + int dirty; +#endif + +#ifdef LL_K + int tokenLA[LL_K]; + char textLA[LL_K][ZZLEXBUFSIZE]; + int lap; + int labase; +#else + int token; + char text[ZZLEXBUFSIZE]; +#endif +#ifdef zzTRACE_RULES + int traceOptionValue; /* MR10 */ + int traceGuessOptionValue; /* MR10 */ + char *traceCurrentRuleName; /* MR10 */ + int traceDepth; /* MR10 */ +#endif + + } zzantlr_state; + +#ifdef zzTRACE_RULES +extern int zzTraceOptionValueDefault; +extern int zzTraceOptionValue; +extern int zzTraceGuessOptionValue; +extern char *zzTraceCurrentRuleName; +extern int zzTraceDepth; +#endif + +extern int zzGuessSeq; /* MR10 */ +extern int zzSyntaxErrCount; /* MR11 */ +extern int zzLexErrCount; /* MR11 */ + + /* I n f i n i t e L o o k a h e a d */ + + +#ifdef ZZINF_LOOK +#define InfLookData \ + int *zzinf_tokens; \ + char **zzinf_text; \ + char *zzinf_text_buffer; \ + int *zzinf_line; \ + int zzinf_labase; \ + int zzinf_last; +#else +#define InfLookData +#endif + +#ifdef ZZINF_LOOK + +#ifndef ZZINF_DEF_TEXT_BUFFER_SIZE +#define ZZINF_DEF_TEXT_BUFFER_SIZE 20000 +#endif +#ifndef ZZINF_DEF_TOKEN_BUFFER_SIZE +#define ZZINF_DEF_TOKEN_BUFFER_SIZE 2000 +#endif +/* WARNING!!!!!! + * ZZINF_BUFFER_TEXT_CHUNK_SIZE must be > sizeof(text) largest possible token. + */ +#ifndef ZZINF_BUFFER_TEXT_CHUNK_SIZE +#define ZZINF_BUFFER_TEXT_CHUNK_SIZE 5000 +#endif +#ifndef ZZINF_BUFFER_TOKEN_CHUNK_SIZE +#define ZZINF_BUFFER_TOKEN_CHUNK_SIZE 1000 +#endif + +#if ZZLEXBUFSIZE > ZZINF_BUFFER_TEXT_CHUNK_SIZE +#define ZZINF_BUFFER_TEXT_CHUNK_SIZE ZZLEXBUFSIZE+5 +#endif + +/* make inf_look user-access macros */ +#ifdef LL_K +#define ZZINF_LA_VALID(i) (((zzinf_labase+i-1)-LL_K+1) <= zzinf_last) +#define ZZINF_LA(i) zzinf_tokens[(zzinf_labase+i-1)-LL_K+1] +#define ZZINF_LATEXT(i) zzinf_text[(zzinf_labase+i-1)-LL_K+1] +/* MR6 In 1.33 vanilla the #define ZZINF_LINE(i) is was commented out */ +#define ZZINF_LINE(i) zzinf_line[(zzinf_labase+i-1)-LL_K+1] +#else +#define ZZINF_LA_VALID(i) (((zzinf_labase+i-1)) <= zzinf_last) +#define ZZINF_LA(i) zzinf_tokens[(zzinf_labase+i-1)] +#define ZZINF_LATEXT(i) zzinf_text[(zzinf_labase+i-1)] +#endif + +#define inf_zzgettok _inf_zzgettok() +extern void _inf_zzgettok(); + +#endif /* ZZINF_LOOK */ + + +#ifdef LL_K + +#ifdef __USE_PROTOS +#define ANTLR_INFO \ + Attrib zzempty_attr(void) {static Attrib a; return a;} \ + Attrib zzconstr_attr(int _tok, char *_text) \ + {Attrib a; zzcr_attr((&a),_tok,_text); return a;} \ + int zzasp=ZZA_STACKSIZE; \ + char zzStackOvfMsg[]="fatal: attrib/AST stack overflow %s(%d)!\n"; \ + Attrib zzaStack[ZZA_STACKSIZE]; DemandLookData \ + InfLookData \ + zzGuessData +#else +#define ANTLR_INFO \ + Attrib zzempty_attr() {static Attrib a; return a;} \ + Attrib zzconstr_attr(_tok, _text) int _tok; char *_text; \ + {Attrib a; zzcr_attr((&a),_tok,_text); return a;} \ + int zzasp=ZZA_STACKSIZE; \ + char zzStackOvfMsg[]="fatal: attrib/AST stack overflow %s(%d)!\n"; \ + Attrib zzaStack[ZZA_STACKSIZE]; DemandLookData \ + InfLookData \ + zzGuessData +#endif + +#else + +#ifdef __USE_PROTOS +#define ANTLR_INFO \ + Attrib zzempty_attr(void) {static Attrib a; return a;} \ + Attrib zzconstr_attr(int _tok, char *_text) \ + {Attrib a={0,0}; zzcr_attr((&a),_tok,_text); return a;} \ + int zzasp=ZZA_STACKSIZE; \ + char zzStackOvfMsg[]="fatal: attrib/AST stack overflow %s(%d)!\n"; \ + Attrib zzaStack[ZZA_STACKSIZE]; DemandLookData \ + InfLookData \ + zzGuessData +#else +#define ANTLR_INFO \ + Attrib zzempty_attr() {static Attrib a; return a;} \ + Attrib zzconstr_attr(_tok, _text) int _tok; char *_text; \ + {Attrib a; zzcr_attr((&a),_tok,_text); return a;} \ + int zzasp=ZZA_STACKSIZE; \ + char zzStackOvfMsg[]="fatal: attrib/AST stack overflow %s(%d)!\n"; \ + Attrib zzaStack[ZZA_STACKSIZE]; DemandLookData \ + InfLookData \ + zzGuessData +#endif + +#endif /* LL_k */ + + +#ifdef ZZINF_LOOK + +#ifdef LL_K +#ifdef DEMAND_LOOK +#define zzPrimeLookAhead {zzdirty=LL_K; zzlap = zzlabase = 0;} +#else +#define zzPrimeLookAhead {zzlap = zzlabase = 0; zzfill_inf_look();\ + {int _i; for(_i=1;_i<=LL_K; _i++) \ + {zzCONSUME;} zzlap = zzlabase = 0;}} +#endif + +#else /* LL_K */ + +#ifdef DEMAND_LOOK +#define zzPrimeLookAhead zzfill_inf_look(); zzdirty=1 +#else +#define zzPrimeLookAhead zzfill_inf_look(); inf_zzgettok + +#endif +#endif /* LL_K */ + +#else /* ZZINF_LOOK */ + +#ifdef LL_K +#ifdef DEMAND_LOOK +#define zzPrimeLookAhead {zzdirty=LL_K; zzlap = zzlabase = 0;} +#else +#define zzPrimeLookAhead {int _i; zzlap = 0; for(_i=1;_i<=LL_K; _i++) \ + {zzCONSUME;} zzlap = 0;} +#endif + +#else + +#ifdef DEMAND_LOOK +#define zzPrimeLookAhead zzdirty=1 +#else +#define zzPrimeLookAhead zzgettok() +#endif +#endif /* LL_K */ + +#endif /* ZZINF_LOOK */ + + +#ifdef LL_K +#define zzenterANTLRs(s) \ + zzlextext = &(zztextLA[0][0]); zzrdstr( s ); zzPrimeLookAhead; +#define zzenterANTLRf(f) \ + zzlextext = &(zztextLA[0][0]); zzrdfunc( f ); zzPrimeLookAhead; +#define zzenterANTLR(f) \ + zzlextext = &(zztextLA[0][0]); zzrdstream( f ); zzPrimeLookAhead; +#ifdef ZZINF_LOOK +#define zzleaveANTLR(f) free(zzinf_text_buffer); free(zzinf_text); free(zzinf_tokens); free(zzinf_line); +#define zzleaveANTLRf(f) free(zzinf_text_buffer); free(zzinf_text); free(zzinf_tokens); free(zzinf_line); +#define zzleaveANTLRs(f) free(zzinf_text_buffer); free(zzinf_text); free(zzinf_tokens); free(zzinf_line); +#else +#define zzleaveANTLR(f) +#define zzleaveANTLRf(f) +#define zzleaveANTLRs(f) +#endif + +#else + +#define zzenterANTLRs(s) \ + {static char zztoktext[ZZLEXBUFSIZE]; \ + zzlextext = zztoktext; zzrdstr( s ); zzPrimeLookAhead;} +#define zzenterANTLRf(f) \ + {static char zztoktext[ZZLEXBUFSIZE]; \ + zzlextext = zztoktext; zzrdfunc( f ); zzPrimeLookAhead;} +#define zzenterANTLR(f) \ + {static char zztoktext[ZZLEXBUFSIZE]; \ + zzlextext = zztoktext; zzrdstream( f ); zzPrimeLookAhead;} +#ifdef ZZINF_LOOK +#define zzleaveANTLR(f) free(zzinf_text_buffer); free(zzinf_text); free(zzinf_tokens); free(zzinf_line); +#define zzleaveANTLRf(f) free(zzinf_text_buffer); free(zzinf_text); free(zzinf_tokens); free(zzinf_line); +#define zzleaveANTLRs(f) free(zzinf_text_buffer); free(zzinf_text); free(zzinf_tokens); free(zzinf_line); +#else +#define zzleaveANTLR(f) +#define zzleaveANTLRf(f) +#define zzleaveANTLRs(f) +#endif + +#endif + +/* MR19 Paul D. Smith (psmith@baynetworks.com) + Need to adjust AST stack pointer at exit. + Referenced in ANTLRx macros. +*/ + +#ifdef GENAST +#define ZZAST_ADJUST ++zzast_sp; +#else +#define ZZAST_ADJUST +#endif + +#define ANTLR(st, f) zzbufsize = ZZLEXBUFSIZE; \ + zzenterANTLR(f); \ + { \ + zzBLOCK(zztasp1); \ + st; /* ++zzasp; Removed MR20 G. Hobbelt */ \ + /* ZZAST_ADJUST Removed MR20 G. Hobbelt */ \ + /* MR20 G. Hobbelt. Kill the top' attribute (+AST stack corr.) */ \ + zzEXIT_ANTLR(zztasp1 + 1); \ + } \ + zzleaveANTLR(f); + +#define ANTLRm(st, f, _m) zzbufsize = ZZLEXBUFSIZE; \ + zzmode(_m); \ + zzenterANTLR(f); \ + { \ + zzBLOCK(zztasp1); \ + st; /* ++zzasp; Removed MR20 G. Hobbelt */ \ + /* ZZAST_ADJUST Removed MR20 G. Hobbelt */ \ + /* MR20 G. Hobbelt. Kill the top' attribute (+AST stack corr.) */ \ + zzEXIT_ANTLR(zztasp1 + 1); \ + } \ + zzleaveANTLR(f); + +#define ANTLRf(st, f) zzbufsize = ZZLEXBUFSIZE; \ + zzenterANTLRf(f); \ + { \ + zzBLOCK(zztasp1); \ + st; /* ++zzasp; Removed MR20 G. Hobbelt */ \ + /* ZZAST_ADJUST Removed MR20 G. Hobbelt */ \ + /* MR20 G. Hobbelt. Kill the top' attribute (+AST stack corr.) */ \ + zzEXIT_ANTLR(zztasp1 + 1); \ + } \ + zzleaveANTLRf(f); + +#define ANTLRs(st, s) zzbufsize = ZZLEXBUFSIZE; \ + zzenterANTLRs(s); \ + { \ + zzBLOCK(zztasp1); \ + st; /* ++zzasp; Removed MR20 G. Hobbelt */ \ + /* ZZAST_ADJUST Removed MR20 G. Hobbelt */ \ + /* MR20 G. Hobbelt. Kill the top' attribute (+AST stack corr.) */ \ + zzEXIT_ANTLR(zztasp1 + 1); \ + } \ + zzleaveANTLRs(s); + +#ifdef LL_K +#define zztext (&(zztextLA[zzlap][0])) +#else +#define zztext zzlextext +#endif + + + /* A r g u m e n t A c c e s s */ + +#define zzaCur (zzaStack[zzasp]) +#define zzaRet (*zzaRetPtr) +#define zzaArg(v,n) zzaStack[v-n] +#define zzMakeAttr { zzNON_GUESS_MODE {zzOvfChk; --zzasp; zzcr_attr(&(zzaStack[zzasp]),LA(1),LATEXT(1));}} +#ifdef zzdef0 +#define zzMake0 { zzOvfChk; --zzasp; zzdef0(&(zzaStack[zzasp]));} +#else +#define zzMake0 { zzOvfChk; --zzasp;} +#endif +#define zzaPush(_v) { zzOvfChk; zzaStack[--zzasp] = _v;} +#ifndef zzd_attr +#define zzREL(t) zzasp=(t); /* Restore state of stack */ +#else +#define zzREL(t) for (; zzasp<(t); zzasp++) \ + { zzd_attr(&(zzaStack[zzasp])); } +#endif + + +#define zzsetmatch(_es,_tokclassErrset) \ + if ( !_zzsetmatch(_es, &zzBadText, &zzMissText, &zzMissTok, &zzBadTok, &zzMissSet, _tokclassErrset) ) goto fail; /* MR23 */ + +#ifdef ZZCAN_GUESS +#define zzsetmatch_wsig(_es, handler) \ + if ( !_zzsetmatch_wsig(_es) ) if (zzguessing) { zzGUESS_FAIL; } else {_signal=MismatchedToken; goto handler;} +#else +#define zzsetmatch_wsig(_es, handler) \ + if ( !_zzsetmatch_wsig(_es) ) {_signal=MismatchedToken; goto handler;} +#endif + +#ifdef __USE_PROTOS +extern int _zzsetmatch(SetWordType *, char **, char **, int *, int *, SetWordType **, SetWordType * /* MR23 */); +extern int _zzsetmatch_wsig(SetWordType *); +#else +extern int _zzsetmatch(); +extern int _zzsetmatch_wsig(); +#endif + +#define zzmatch(_t) \ + if ( !_zzmatch(_t, &zzBadText, &zzMissText, &zzMissTok, &zzBadTok, &zzMissSet) ) goto fail; + +#ifdef ZZCAN_GUESS +#define zzmatch_wsig(_t,handler) \ + if ( !_zzmatch_wsig(_t) ) if (zzguessing) { zzGUESS_FAIL; } else {_signal=MismatchedToken; goto handler;} +#else +#define zzmatch_wsig(_t,handler) \ + if ( !_zzmatch_wsig(_t) ) {_signal=MismatchedToken; goto handler;} +#endif + +#ifdef __USE_PROTOS +extern int _zzmatch(int, char **, char **, int *, int *, SetWordType **); +extern int _zzmatch_wsig(int); +#else +extern int _zzmatch(); +extern int _zzmatch_wsig(); +#endif + +#define zzmatch_wdfltsig(_t,_f) \ + if ( !_zzmatch_wdfltsig(_t,_f) ) _signal=MismatchedToken; +#define zzsetmatch_wdfltsig(tw,tt,wf) \ + if ( !_zzsetmatch_wdfltsig(tw,tt,wf) ) _signal=MismatchedToken; + +#ifdef __USE_PROTOS +extern int _zzmatch_wdfltsig(int, SetWordType *); +extern int _zzsetmatch_wdfltsig(SetWordType *tokensWanted, + int tokenTypeOfSet, + SetWordType *whatFollows); +#else +extern int _zzmatch_wdfltsig(); +extern int _zzsetmatch_wdfltsig(); +#endif + +#ifdef GENAST +#define zzRULE Attrib *zzaRetPtr = &(zzaStack[zzasp-1]); \ + SetWordType *zzMissSet=NULL; int zzMissTok=0; \ + int zzBadTok=0; char *zzBadText=""; \ + int zzErrk=1,zzpf=0; \ + zzTRACEdata \ + char *zzMissText=""; zzASTVars +#else +#define zzRULE Attrib *zzaRetPtr = &(zzaStack[zzasp-1]); \ + int zzBadTok=0; char *zzBadText=""; \ + int zzErrk=1,zzpf=0; \ + zzTRACEdata \ + SetWordType *zzMissSet=NULL; int zzMissTok=0; char *zzMissText="" +#endif + +#ifdef GENAST +#define zzBLOCK(i) int i = zzasp - 1; int zztsp = zzast_sp +#define zzEXIT(i) zzREL(i); zzastREL; zzNON_GUESS_MODE { zzastPush(*_root); } +#define zzEXIT_ANTLR(i) zzREL(i); zzastREL /* [i_a] added as we want this for the ANTLRx() macros */ +#define zzLOOP(i) zzREL(i); zzastREL +#else +#define zzBLOCK(i) int i = zzasp - 1 +#define zzEXIT(i) zzREL(i) +#define zzEXIT_ANTLR(i) zzREL(i) /* [i_a] added as we want this for the ANTLRx() macros */ +#define zzLOOP(i) zzREL(i) +#endif + +#ifdef LL_K + +#ifdef DEMAND_LOOK +#define LOOK(_k) {int i,stop=_k-(LL_K-zzdirty); for (i=1; i<=stop; i++) \ + zzCONSUME;} +#define zzCONSUME {zzgettok(); zzdirty--; \ + zzlap = (zzlap+1)&(LL_K-1); \ + zzlextext = &(zztextLA[zzlap][0]);} +#else +#ifdef ZZINF_LOOK +#define zzCONSUME {inf_zzgettok; \ + zzlap = (zzlap+1)&(LL_K-1); \ + zzlextext = &(zztextLA[zzlap][0]); \ + } +#else +#define zzCONSUME {zzgettok(); \ + zzlap = (zzlap+1)&(LL_K-1); \ + zzlextext = &(zztextLA[zzlap][0]);} +#endif /* ZZINF_LOOK */ +#endif /* DEMAND_LOOK */ + +#else /* LL_K */ + +#ifdef DEMAND_LOOK +#define LOOK(_k) if ( zzdirty) zzCONSUME; +#ifdef ZZINF_LOOK +#define zzCONSUME inf_zzgettok; zzdirty=0; +#else +#define zzCONSUME zzgettok(); zzdirty=0; +#endif /* ZZINF_LOOK */ + +#else /* DEMAND_LOOK */ + +#ifdef ZZINF_LOOK +#define zzCONSUME inf_zzgettok +#else +#define zzCONSUME zzgettok(); +#endif + +#endif /* DEMAND_LOOK */ + +#endif /* LL_K */ + +#ifdef LL_K +#define NLA zztokenLA[zzlap&(LL_K-1)] /* --> next LA */ +#define NLATEXT zztextLA[zzlap&(LL_K-1)] /* --> next text of LA */ +#ifdef DEMAND_LOOK +#define LA(i) zztokenLA[(zzlabase+(i)-1)&(LL_K-1)] +#define LATEXT(i) (&(zztextLA[(zzlabase+(i)-1)&(LL_K-1)][0])) +#else +#define LA(i) zztokenLA[(zzlap+(i)-1)&(LL_K-1)] +#define LATEXT(i) (&(zztextLA[(zzlap+(i)-1)&(LL_K-1)][0])) +#endif +#else +#define NLA zztoken +#define NLATEXT zztext +#define LA(i) zztoken +#define LATEXT(i) zztext +#endif + + + /* S t a n d a r d S i g n a l s */ + +#define NoSignal 0 +#define MismatchedToken 1 +#define NoViableAlt 2 +#define NoSemViableAlt 3 + +/* MR7 Allow more control over signalling */ +/* by adding "Unwind" and "zzsetSignal" */ + +#define Unwind 4 +#define zzsetSignal(newValue) *_retsignal=_signal=(newValue) +#define zzsuppressSignal *_retsignal=_signal=0 +#define zzexportSignal *_retsignal=_signal + + /* F u n c t i o n T r a c i n g */ + +#ifndef zzTRACE_RULES +#define zzTRACEdata +#else +#ifndef zzTRACEdata +#define zzTRACEdata ANTLRChar *zzTracePrevRuleName = NULL; +#endif +#endif + +#ifndef zzTRACEIN +#define zzTRACEIN(r) zzTracePrevRuleName=zzTraceCurrentRuleName;zzTraceIn(r); +#endif +#ifndef zzTRACEOUT +#define zzTRACEOUT(r) zzTraceOut(r);zzTraceCurrentRuleName=zzTracePrevRuleName; +#endif + +/* MR19 zzchar_t additions */ + +#ifndef zzchar_t +#ifdef ZZWCHAR_T +#define zzchar_t wchar_t +#else +#define zzchar_t char +#endif +#endif + + +/* MR26 */ + +#ifdef PCCTS_USE_STDARG +extern void zzFAIL(int k, ...); +#else +extern void zzFAIL(); +#endif + /* E x t e r n D e f s */ + +#ifdef __USE_PROTOS +extern Attrib zzempty_attr(void); +extern Attrib zzconstr_attr(int, char *); +extern void zzsyn(char *, int, char *, SetWordType *, int, int, char *); +extern int zzset_el(unsigned, SetWordType *); +extern int zzset_deg(SetWordType *); +extern void zzedecode(SetWordType *); + +extern void zzresynch(SetWordType *, SetWordType); +extern void zzsave_antlr_state(zzantlr_state *); +extern void zzrestore_antlr_state(zzantlr_state *); +extern void zzfill_inf_look(void); +extern void zzconsumeUntil(SetWordType *st); /* MR7 */ +extern void zzconsumeUntilToken(int t); /* MR7 */ +extern void zzTraceIn(char * ruleName); /* MR10 */ +extern void zzTraceOut(char * ruleName); /* MR10 */ +extern int zzTraceOption(int delta); /* MR10 */ +extern int zzTraceGuessOption(int delta); /* MR10 */ +extern void zzTraceReset(void); /* MR10 */ +extern void zzTraceGuessFail(void); /* MR10 */ +#ifdef EXCEPTION_HANDLING +extern void zzdflthandlers(int, int *); +#endif +#else +extern Attrib zzempty_attr(); +extern Attrib zzconstr_attr(); +extern void zzsyn(); +extern int zzset_el(); +extern int zzset_deg(); +extern void zzedecode(); +extern void zzresynch(); +extern void zzsave_antlr_state(); +extern void zzrestore_antlr_state(); +extern void zzfill_inf_look(); +extern void zzconsumeUntil(); /* MR7 */ +extern void zzconsumeUntilToken(); /* MR7 */ +extern void zzTraceIn(); /* MR10 */ +extern void zzTraceOut(); /* MR10 */ +extern int zzTraceOption(); /* MR10 */ +extern int zzTraceGuessOption(); /* MR10 */ +extern void zzTraceReset(); /* MR10 */ +extern void zzTraceGuessFail(); /* MR10 */ +#ifdef EXCEPTION_HANDLING +extern void zzdflthandlers(); +#endif +#endif + + /* G l o b a l V a r i a b l e s */ + +/* Define a parser; user should do a "#parser myname" in their grammar file */ +/*extern struct pccts_parser zzparser;*/ + +extern char *zztokens[]; +#ifdef LL_K +extern int zztokenLA[]; +extern zzchar_t zztextLA[][ZZLEXBUFSIZE]; +extern int zzlap; +extern int zzlabase; +#else +extern int zztoken; +#endif + +extern char zzStackOvfMsg[]; +extern int zzasp; +extern Attrib zzaStack[]; +#ifdef ZZINF_LOOK +extern int *zzinf_tokens; +extern char **zzinf_text; +extern char *zzinf_text_buffer; +extern int *zzinf_line; +extern int zzinf_labase; +extern int zzinf_last; +#endif +#ifdef DEMAND_LOOK +extern int zzdirty; +#endif +#ifdef ZZCAN_GUESS +extern int zzguessing; +extern zzjmp_buf zzguess_start; +#endif + +/* Define global veriables that refer to values exported by the scanner. + * These declarations duplicate those in dlgdef.h, but are needed + * if ANTLR is not to generate a .dlg file (-gx); PS, this is a hack. + */ +extern zzchar_t *zzlextext; /* text of most recently matched token */ +extern int zzbufsize; /* how long zzlextext is */ + +#endif diff --git a/pccts/h/ast.h b/pccts/h/ast.h new file mode 100644 index 0000000..911f913 --- /dev/null +++ b/pccts/h/ast.h @@ -0,0 +1,121 @@ +/* Abstract syntax tree + * + * Macros, definitions + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +#ifndef ZZAST_H +#define ZZAST_H + +#define zzastOvfChk \ + if ( zzast_sp <= 0 ) \ + { \ + fprintf(stderr, zzStackOvfMsg, __FILE__, __LINE__); \ + exit(PCCTS_EXIT_FAILURE); \ + } + +#ifndef USER_DEFINED_AST +#ifndef AST_FIELDS +#define AST_FIELDS +#endif + +typedef struct _ast { + struct _ast *right, *down; +#ifdef zzAST_DOUBLE + struct _ast *left, *up; +#endif + AST_FIELDS +} AST; + +#else + +#ifdef zzAST_DOUBLE +#define AST_REQUIRED_FIELDS struct _ast *right, *down, *left, *up; +#else +#define AST_REQUIRED_FIELDS struct _ast *right, *down; +#endif + +#endif + + +/* N o d e a c c e s s m a c r o s */ +#define zzchild(t) (((t)==NULL)? (AST *) NULL:(t->down)) /* MR19 */ +#define zzsibling(t) (((t)==NULL)? (AST *) NULL:(t->right)) /* MR19 */ + + +/* define global variables needed by #i stack */ +#define zzASTgvars \ + AST *zzastStack[ZZAST_STACKSIZE]; \ + int zzast_sp = ZZAST_STACKSIZE; + +#define zzASTVars AST *_ast = NULL, *_sibling = NULL, *_tail = NULL +#define zzSTR ( (_tail==NULL)?(&_sibling):(&(_tail->right)) ) +#define zzastCur (zzastStack[zzast_sp]) +#define zzastArg(i) (zzastStack[zztsp-i]) +#define zzastPush(p) zzastOvfChk; zzastStack[--zzast_sp] = p; +#define zzastDPush --zzast_sp +#define zzastMARK zztsp=zzast_sp; /* Save state of stack */ +#define zzastREL zzast_sp=zztsp; /* Return state of stack */ +#define zzrm_ast {zzfree_ast(*_root); _tail = _sibling = (*_root)=NULL;} + +extern int zzast_sp; +extern AST *zzastStack[]; + +/* MR26 */ + +#ifdef PCCTS_USE_STDARG +AST *zztmake(AST *, ...); +#else +AST *zztmake(); +#endif + +#ifdef __USE_PROTOS +void zzlink(AST **, AST **, AST **); +void zzsubchild(AST **, AST **, AST **); +void zzsubroot(AST **, AST **, AST **); +void zzpre_ast(AST *, void (*)(AST *), void (*)(AST *), void (*)(AST *)); +void zzfree_ast(AST *); +AST *zzdup_ast(AST *); +void zztfree(AST *); +void zzdouble_link(AST *, AST *, AST *); +AST *zzastnew(void); + +#else + +void zzlink(); +AST *zzastnew(); +void zzsubchild(); +void zzsubroot(); +void zzpre_ast(); +void zzfree_ast(); +AST *zzdup_ast(); +void zztfree(); +void zzdouble_link(); +#endif + +#endif diff --git a/pccts/h/charbuf.h b/pccts/h/charbuf.h new file mode 100644 index 0000000..e10ba67 --- /dev/null +++ b/pccts/h/charbuf.h @@ -0,0 +1,46 @@ +/* ANTLR attribute definition -- constant width text + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +#ifndef ZZCHARBUF_H +#define ZZCHARBUF_H + +#include "pcctscfg.h" + +#include "pccts_string.h" + +#ifndef D_TextSize +#define D_TextSize 30 +#endif + +typedef struct { char text[D_TextSize]; } Attrib; + +#define zzcr_attr(a,tok,t) strncpy((a)->text, t, D_TextSize-1); \ + (a)->text[D_TextSize-1] = '\0'; + +#endif diff --git a/pccts/h/charptr.h b/pccts/h/charptr.h new file mode 100644 index 0000000..2cc36d8 --- /dev/null +++ b/pccts/h/charptr.h @@ -0,0 +1,48 @@ +/* + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +/* + * WARNING!!!!: charptr.h does NOT make copies and the + * memory is freed after the attribute scope exits. + */ + +#ifndef ZZCHARPTR_H +#define ZZCHARPTR_H + +typedef char *Attrib; +#define zzdef0(a) {*(a)=NULL;} +/* MR8 Jens Tingleff (jensting@imaginet.fr) */ +/* Set memory pointer to null after free() */ +#define zzd_attr(a) {if ( *(a)!=NULL ) {free(*(a)); *(a)=NULL; }; } + +#ifdef __STDC__ +extern zzcr_attr(Attrib *,int,char *); +#endif + +#endif diff --git a/pccts/h/config.h b/pccts/h/config.h new file mode 100644 index 0000000..1cc4fbc --- /dev/null +++ b/pccts/h/config.h @@ -0,0 +1 @@ +#include "pcctscfg.h" diff --git a/pccts/h/dlgauto.h b/pccts/h/dlgauto.h new file mode 100644 index 0000000..2bf640b --- /dev/null +++ b/pccts/h/dlgauto.h @@ -0,0 +1,504 @@ +/* dlgauto.h automaton + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Will Cohen and Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +#ifndef ZZDEFAUTO_H +#define ZZDEFAUTO_H + +/* 10-Apr-97 133MR1 Uses __USE_PROTOS show should #include pcctscfg.h */ + +#include "pcctscfg.h" + +zzchar_t *zzlextext; /* text of most recently matched token */ +zzchar_t *zzbegexpr; /* beginning of last reg expr recogn. */ +zzchar_t *zzendexpr; /* beginning of last reg expr recogn. */ +int zzbufsize = 0; /* number of characters in zzlextext */ /* MR7 */ +int zzbegcol = 0; /* column that first character of token is in*/ +int zzendcol = 0; /* column that last character of token is in */ +int zzline = 1; /* line current token is on */ +int zzreal_line=1; /* line of 1st portion of token that is not skipped */ +int zzchar; /* character to determine next state */ +int zzbufovf; /* indicates that buffer too small for text */ +int zzcharfull = 0; +static zzchar_t *zznextpos;/* points to next available position in zzlextext*/ +static int zzclass; + +#ifdef __USE_PROTOS +void zzerrstd(const char *); +void (*zzerr)(const char *)=zzerrstd;/* pointer to error reporting function */ +extern int zzerr_in(void); +static int (*zzfunc_in)(void) = zzerr_in; /* MR20 */ +#else +void zzerrstd(); +void (*zzerr)()=zzerrstd; /* pointer to error reporting function */ +extern int zzerr_in(); +static int (*zzfunc_in)() = zzerr_in; /* MR20 */ +#endif + +static FILE *zzstream_in=0; +static zzchar_t *zzstr_in=0; + +#ifdef USER_ZZMODE_STACK +int zzauto = 0; +#else +static int zzauto = 0; +#endif +static int zzadd_erase; +static char zzebuf[70]; + +#ifdef ZZCOL +#define ZZINC (++zzendcol) +#else +#define ZZINC +#endif + + +#define ZZGETC_STREAM {zzchar = getc(zzstream_in); zzclass = ZZSHIFT(zzchar);} +#define ZZGETC_FUNC {zzchar = (*zzfunc_in)(); zzclass = ZZSHIFT(zzchar);} +#define ZZGETC_STR { \ + if (*zzstr_in){ \ + zzchar = *zzstr_in; \ + ++zzstr_in; \ + }else{ \ + zzchar = EOF; \ + } \ + zzclass = ZZSHIFT(zzchar); \ +} + +#define ZZNEWSTATE (newstate = dfa[state][zzclass]) + +#ifndef ZZCOPY +#define ZZCOPY \ + /* Truncate matching buffer to size (not an error) */ \ + if (zznextpos < lastpos){ \ + *(zznextpos++) = zzchar; \ + }else{ \ + zzbufovf = 1; \ + } +#endif + +void +#ifdef __USE_PROTOS +zzrdstream( FILE *f ) +#else +zzrdstream( f ) +FILE *f; +#endif +{ + /* make sure that it is really set to something, otherwise just + leave it be. + */ + if (f){ + /* make sure that there is always someplace to get input + before closing zzstream_in + */ +#if 0 + if (zzstream_in && zzstream_in!=stdin) fclose( zzstream_in ); +#endif + zzline = 1; + zzstream_in = f; + zzfunc_in = NULL; + zzstr_in = 0; + zzcharfull = 0; + } +} + +void +#ifdef __USE_PROTOS +zzrdfunc( int (*f)(void) ) +#else +zzrdfunc( f ) +int (*f)(); +#endif +{ + /* make sure that it is really set to something, otherwise just + leave it be. + */ + if (f){ + /* make sure that there is always someplace to get input + before closing zzstream_in + */ +#if 0 + if (zzstream_in && zzstream_in!=stdin) fclose( zzstream_in ); +#endif + zzline = 1; + zzstream_in = NULL; + zzfunc_in = f; + zzstr_in = 0; + zzcharfull = 0; + } +} + + +void +#ifdef __USE_PROTOS +zzrdstr( zzchar_t *s ) +#else +zzrdstr( s ) +zzchar_t *s; +#endif +{ + /* make sure that it is really set to something, otherwise just + leave it be. + */ + if (s){ + /* make sure that there is always someplace to get input + before closing zzstream_in + */ +#if 0 + if (zzstream_in && zzstream_in!=stdin) fclose( zzstream_in ); +#endif + zzline = 1; + zzstream_in = NULL; + zzfunc_in = 0; + zzstr_in = s; + zzcharfull = 0; + } +} + + +#ifdef __USE_PROTOS +void zzclose_stream(void) +#else +void zzclose_stream() +#endif +{ +#if 0 + fclose( zzstream_in ); + zzstream_in = NULL; + zzfunc_in = NULL; +#endif +} + +/* saves dlg state, but not what feeds dlg (such as file position) */ +void +#ifdef __USE_PROTOS +zzsave_dlg_state(struct zzdlg_state *state) +#else +zzsave_dlg_state(state) +struct zzdlg_state *state; +#endif +{ + state->stream = zzstream_in; + state->func_ptr = zzfunc_in; + state->str = zzstr_in; + state->auto_num = zzauto; + state->add_erase = zzadd_erase; + state->lookc = zzchar; + state->char_full = zzcharfull; + state->begcol = zzbegcol; + state->endcol = zzendcol; + state->line = zzline; + state->lextext = zzlextext; + state->begexpr = zzbegexpr; + state->endexpr = zzendexpr; + state->bufsize = zzbufsize; + state->bufovf = zzbufovf; + state->nextpos = zznextpos; + state->class_num = zzclass; +} + +void +#ifdef __USE_PROTOS +zzrestore_dlg_state(struct zzdlg_state *state) +#else +zzrestore_dlg_state(state) +struct zzdlg_state *state; +#endif +{ + zzstream_in = state->stream; + zzfunc_in = state->func_ptr; + zzstr_in = state->str; + zzauto = state->auto_num; + zzadd_erase = state->add_erase; + zzchar = state->lookc; + zzcharfull = state->char_full; + zzbegcol = state->begcol; + zzendcol = state->endcol; + zzline = state->line; + zzlextext = state->lextext; + zzbegexpr = state->begexpr; + zzendexpr = state->endexpr; + zzbufsize = state->bufsize; + zzbufovf = state->bufovf; + zznextpos = state->nextpos; + zzclass = state->class_num; +} + +void +#ifdef __USE_PROTOS +zzmode( int m ) +#else +zzmode( m ) +int m; +#endif +{ + /* points to base of dfa table */ + if (m<MAX_MODE){ + zzauto = m; + /* have to redo class since using different compression */ + zzclass = ZZSHIFT(zzchar); + }else{ + sprintf(zzebuf,"Invalid automaton mode = %d ",m); + zzerr(zzebuf); + } +} + +/* erase what is currently in the buffer, and get a new reg. expr */ + +#ifdef __USE_PROTOS +void zzskip(void) +#else +void zzskip() +#endif +{ + zzadd_erase = 1; +} + +/* don't erase what is in the zzlextext buffer, add on to it */ +#ifdef __USE_PROTOS +void zzmore() +#else +void zzmore() +#endif +{ + zzadd_erase = 2; +} + +/* substitute c for the reg. expr last matched and is in the buffer */ +#ifdef __USE_PROTOS +void +zzreplchar(zzchar_t c) +#else +void +zzreplchar(c) +zzchar_t c; +#endif +{ + /* can't allow overwriting null at end of string */ + if (zzbegexpr < &zzlextext[zzbufsize-1]){ + *zzbegexpr = c; + *(zzbegexpr+1) = '\0'; + } + zzendexpr = zzbegexpr; + if (c != '\0') { + zznextpos = zzbegexpr + 1; + } + else { + zznextpos = zzbegexpr; /* MR30 Zero terminates string. */ + } +} + +/* replace the string s for the reg. expr last matched and in the buffer */ +void +#ifdef __USE_PROTOS +zzreplstr(register zzchar_t *s) +#else +zzreplstr(s) +register zzchar_t *s; +#endif +{ + register zzchar_t *l= &zzlextext[zzbufsize -1]; + + zznextpos = zzbegexpr; + if (s){ + while ((zznextpos <= l) && (*(zznextpos++) = *(s++))!=0){ + /* empty */ + } + /* correct for NULL at end of string */ + zznextpos--; + } + if ((zznextpos <= l) && (*(--s) == 0)){ + zzbufovf = 0; + }else{ + zzbufovf = 1; + } + *(zznextpos) = '\0'; + zzendexpr = zznextpos - 1; +} + +#ifdef __USE_PROTOS +void zzgettok(void) +#else +void zzgettok() +#endif +{ + register int state, newstate; + /* last space reserved for the null char */ + zzchar_t *lastpos; /* MR27 Remove register since address operator used. */ + +skip: + zzreal_line = zzline; + zzbufovf = 0; + lastpos = &zzlextext[zzbufsize-1]; + zznextpos = zzlextext; + zzbegcol = zzendcol+1; +more: + zzbegexpr = zznextpos; +#ifdef ZZINTERACTIVE + /* interactive version of automaton */ + /* if there is something in zzchar, process it */ + state = newstate = dfa_base[zzauto]; + if (zzcharfull){ + ZZINC; + ZZCOPY; + ZZNEWSTATE; + } + if (zzstr_in) + while (zzalternatives[newstate]){ + state = newstate; + ZZGETC_STR; + ZZINC; + ZZCOPY; + ZZNEWSTATE; + } + else if (zzstream_in) + while (zzalternatives[newstate]){ + state = newstate; + ZZGETC_STREAM; + ZZINC; + ZZCOPY; + ZZNEWSTATE; + } + else if (zzfunc_in) + while (zzalternatives[newstate]){ + state = newstate; + ZZGETC_FUNC; + ZZINC; + ZZCOPY; + ZZNEWSTATE; + } + /* figure out if last character really part of token */ + if ((state != dfa_base[zzauto]) && (newstate == DfaStates)){ + zzcharfull = 1; + --zznextpos; + }else{ + zzcharfull = 0; + state = newstate; + } + *(zznextpos) = '\0'; + /* Able to transition out of start state to some non err state?*/ + if ( state == dfa_base[zzauto] ){ + /* make sure doesn't get stuck */ + zzadvance(); + } +#else + /* non-interactive version of automaton */ + if (!zzcharfull) + zzadvance(); + else + ZZINC; + state = dfa_base[zzauto]; + if (zzstr_in) + while (ZZNEWSTATE != DfaStates){ + state = newstate; + ZZCOPY; + ZZGETC_STR; + ZZINC; + } + else if (zzstream_in) + while (ZZNEWSTATE != DfaStates){ + state = newstate; + ZZCOPY; + ZZGETC_STREAM; + ZZINC; + } + else if (zzfunc_in) + while (ZZNEWSTATE != DfaStates){ + state = newstate; + ZZCOPY; + ZZGETC_FUNC; + ZZINC; + } + zzcharfull = 1; + if ( state == dfa_base[zzauto] ){ + if (zznextpos < lastpos){ + *(zznextpos++) = zzchar; + }else{ + zzbufovf = 1; + } + *zznextpos = '\0'; + /* make sure doesn't get stuck */ + zzadvance(); + }else{ + *zznextpos = '\0'; + } +#endif +#ifdef ZZCOL + zzendcol -= zzcharfull; +#endif + zzendexpr = zznextpos -1; + zzadd_erase = 0; + (*actions[accepts[state]])(); + switch (zzadd_erase) { + case 1: goto skip; + case 2: goto more; + } +} + +#ifdef __USE_PROTOS +void zzadvance(void) +#else +void zzadvance() +#endif +{ + if (zzstream_in) { ZZGETC_STREAM; zzcharfull = 1; ZZINC;} + if (zzfunc_in) { ZZGETC_FUNC; zzcharfull = 1; ZZINC;} + if (zzstr_in) { ZZGETC_STR; zzcharfull = 1; ZZINC;} + if (!(zzstream_in || zzfunc_in || zzstr_in)){ + zzerr_in(); + } +} + +void +#ifdef __USE_PROTOS +zzerrstd(const char *s) +#else +zzerrstd(s) +char *s; +#endif +{ + zzLexErrCount++; /* MR11 */ + fprintf(stderr, + "%s near line %d (text was '%s')\n", + ((s == NULL) ? "Lexical error" : s), + zzline,zzlextext); +} + +#ifdef __USE_PROTOS +int zzerr_in(void) +#else +int zzerr_in() +#endif +{ + fprintf(stderr,"No input stream, function, or string\n"); + /* return eof to get out gracefully */ + return EOF; +} + +#endif diff --git a/pccts/h/dlgdef.h b/pccts/h/dlgdef.h new file mode 100644 index 0000000..759bc0c --- /dev/null +++ b/pccts/h/dlgdef.h @@ -0,0 +1,128 @@ +/* dlgdef.h + * Things in scanner produced by dlg that should be visible to the outside + * world + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +#ifndef ZZDLGDEF_H +#define ZZDLGDEF_H + +#include "pcctscfg.h" + +#ifndef zzchar_t +#ifdef ZZWCHAR_T +#define zzchar_t wchar_t +#else +#define zzchar_t char +#endif +#endif + +struct zzdlg_state { + FILE *stream; +#ifdef __USE_PROTOS + int (*func_ptr)(void); +#else + int (*func_ptr)(); +#endif + zzchar_t *str; + int auto_num; + int add_erase; + int lookc; + int char_full; + int begcol, endcol; + int line; + zzchar_t *lextext, *begexpr, *endexpr; + int bufsize; + int bufovf; + zzchar_t *nextpos; + int class_num; +}; + +extern zzchar_t *zzlextext; /* text of most recently matched token */ +extern zzchar_t *zzbegexpr; /* beginning of last reg expr recogn. */ +extern zzchar_t *zzendexpr; /* beginning of last reg expr recogn. */ +extern int zzbufsize; /* how long zzlextext is */ +extern int zzbegcol; /* column that first character of token is in*/ +extern int zzendcol; /* column that last character of token is in */ +extern int zzline; /* line current token is on */ +extern int zzreal_line; /* line of 1st portion of token that is not skipped */ +extern int zzchar; /* character to determine next state */ +extern int zzbufovf; /* indicates that buffer too small for text */ +#ifdef __USE_PROTOS +extern void (*zzerr)(const char *);/* pointer to error reporting function */ +#else +extern void (*zzerr)(); +#endif + +#ifdef USER_ZZMODE_STACK +extern int zzauto; +#endif + +#ifdef __USE_PROTOS +extern void zzadvance(void); +extern void zzskip(void); /* erase zzlextext, look for antoher token */ +extern void zzmore(void); /* keep zzlextext, look for another token */ +extern void zzmode(int k); /* switch to automaton 'k' */ +extern void zzrdstream(FILE *);/* what stream to read from */ +extern void zzclose_stream(void);/* close the current input stream */ +extern void zzrdfunc(int (*)(void));/* what function to get char from */ +extern void zzrdstr( zzchar_t * ); +extern void zzgettok(void); /* get next token */ +extern void zzreplchar(zzchar_t c);/* replace last recognized reg. expr. with + a character */ +extern void zzreplstr(zzchar_t *s);/* replace last recognized reg. expr. with + a string */ +extern void zzsave_dlg_state(struct zzdlg_state *); +extern void zzrestore_dlg_state(struct zzdlg_state *); +extern int zzerr_in(void); +extern void zzerrstd(const char *); +extern void zzerraction(void); + +#else + +extern void zzadvance(); +extern void zzskip(); /* erase zzlextext, look for antoher token */ +extern void zzmore(); /* keep zzlextext, look for another token */ +extern void zzmode(/*k*/); /* switch to automaton 'k' */ +extern void zzrdstream(); /* what stream to read from */ +extern void zzclose_stream();/* close the current input stream */ +extern void zzrdfunc(); /* what function to get char from */ +extern void zzrdstr(); +extern void zzgettok(); /* get next token */ +extern void zzreplchar(); /* replace last recognized reg. expr. with + a character */ +extern void zzreplstr(); /* replace last recognized reg. expr. with + a string */ +extern void zzsave_dlg_state(); +extern void zzrestore_dlg_state(); +extern int zzerr_in(); +extern void zzerrstd(); +extern void zzerraction(); +#endif + +#endif diff --git a/pccts/h/err.h b/pccts/h/err.h new file mode 100644 index 0000000..cf91200 --- /dev/null +++ b/pccts/h/err.h @@ -0,0 +1,1170 @@ +/* + * err.h + * + * Standard error handling mechanism + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * Has grown to hold all kinds of stuff (err.h is increasingly misnamed) + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +#ifndef ERR_H +#define ERR_H + +#include "pcctscfg.h" +#include <stdlib.h> +#include <assert.h> + +/* */ +/* 7-Apr-97 133MR1 */ +/* Proper choice of STDC and cplusplus pre-processor symbols (?) */ +/* */ +#include "pccts_string.h" + +#ifdef PCCTS_USE_STDARG +#include "pccts_stdarg.h" +#else +#include <varargs.h> +#endif + +#ifdef DUM +/* Define usable bits per unsigned int word (used for set stuff) */ +#ifdef PC +#define BSETWORDSIZE 16 +#define BSETLOGWORDSIZE 4 +#else +#define BSETWORDSIZE 32 +#define BSETLOGWORDSIZE 5 +#endif +#endif + +#define BSETWORDSIZE 8 +#define BSETLOGWORDSIZE 3 /* SetWordType is 8bits */ + +#define BSETMODWORD(x) ((x) & (BSETWORDSIZE-1)) /* x % BSETWORDSIZE */ +#define BSETDIVWORD(x) ((x) >> BSETLOGWORDSIZE) /* x / BSETWORDSIZE */ + +/* This is not put into the global pccts_parser structure because it is + * hidden and does not need to be saved during a "save state" operation + */ +/* maximum of 32 bits/unsigned int and must be 8 bits/byte */ +static SetWordType bitmask[] = { + 0x00000001, 0x00000002, 0x00000004, 0x00000008, + 0x00000010, 0x00000020, 0x00000040, 0x00000080 +}; + +#ifdef zzTRACE_RULES +int zzTraceOptionValueDefault=1; +int zzTraceOptionValue=1; +int zzTraceGuessOptionValue=1; +char *zzTraceCurrentRuleName=NULL; +int zzTraceDepth=0; +#endif + +int zzGuessSeq=0; /* MR10 */ +int zzSyntaxErrCount=0; /* MR11 */ +int zzLexErrCount=0; /* MR11 */ + +void +#ifdef __USE_PROTOS +zzresynch(SetWordType *wd,SetWordType mask) +#else +zzresynch(wd,mask) +SetWordType *wd, mask; +#endif +{ + static int consumed = 1; + + /* if you enter here without having consumed a token from last resynch + * force a token consumption. + */ + if ( !consumed ) {zzCONSUME; consumed=1; return;} /* MR10 */ + + /* if current token is in resynch set, we've got what we wanted */ + if ( wd[LA(1)]&mask || LA(1) == zzEOF_TOKEN ) {consumed=0; return;} + + /* scan until we find something in the resynch set */ + while ( !(wd[LA(1)]&mask) && LA(1) != zzEOF_TOKEN ) {zzCONSUME;} + consumed=1; +} + +/* */ +/* 7-Apr-97 133MR1 for C++ and MR7 for C */ +/* Change suggested by Eli Sternheim (eli@interhdl.com) */ +/* */ + +void +#ifdef __USE_PROTOS +zzconsumeUntil(SetWordType *st) +#else +zzconsumeUntil(st) +SetWordType *st; +#endif +{ + int tmp; /* MR7 */ + while ( !zzset_el( (tmp=LA(1)), st) && tmp!=1 /* Eof */) { /* MR7 */ + zzCONSUME; } /* MR7 */ +} + +/* */ +/* 7-Apr-97 133MR1 for C++ and MR7 for C */ +/* Change suggested by Eli Sternheim (eli@interhdl.com) */ +/* */ + +void +#ifdef __USE_PROTOS +zzconsumeUntilToken(int t) +#else +zzconsumeUntilToken(t) +int t; +#endif +{ + int tmp; /* MR7 */ + while ( (tmp=LA(1)) !=t && tmp!=1 /* Eof */) { zzCONSUME; } /* MR7 */ +} + +/* input looks like: + * zzFAIL(k, e1, e2, ...,&zzMissSet,&zzMissText,&zzBadTok,&zzBadText) + * where the zzMiss stuff is set here to the token that did not match + * (and which set wasn't it a member of). + */ + +#ifdef PCCTS_USE_STDARG +void zzFAIL(int k, ...) +#else +void zzFAIL(va_alist) +va_dcl +#endif +{ +#ifdef LL_K + static char text[LL_K*ZZLEXBUFSIZE+1]; + SetWordType *f[LL_K]; +#else + static char text[ZZLEXBUFSIZE+1]; + SetWordType *f[1]; +#endif + SetWordType **miss_set; + char **miss_text; + int *bad_tok; + char **bad_text; + int *err_k; + int i; + va_list ap; +#ifndef PCCTS_USE_STDARG /* MR20 */ + int k; +#endif +#ifdef PCCTS_USE_STDARG /* MR20 */ + va_start(ap, k); +#else + va_start(ap); + k = va_arg(ap, int); /* how many lookahead sets? */ +#endif + assert(k <= sizeof(f)/sizeof(f[0])); /* MR20 G. Hobbelt */ + text[0] = '\0'; + for (i=1; i<=k; i++) /* collect all lookahead sets */ + { + f[i-1] = va_arg(ap, SetWordType *); + } + for (i=1; i<=k; i++) /* look for offending token */ + { + if ( i>1 ) strcat(text, " "); + strcat(text, LATEXT(i)); + if ( !zzset_el((unsigned)LA(i), f[i-1]) ) break; + } + miss_set = va_arg(ap, SetWordType **); + miss_text = va_arg(ap, char **); + bad_tok = va_arg(ap, int *); + bad_text = va_arg(ap, char **); + err_k = va_arg(ap, int *); + if ( i>k ) + { + /* bad; lookahead is permutation that cannot be matched, + * but, the ith token of lookahead is valid at the ith position + * (The old LL sub 1 (k) versus LL(k) parsing technique) + */ + *miss_set = NULL; + *miss_text = zzlextext; + *bad_tok = LA(1); + *bad_text = LATEXT(1); + *err_k = k; + return; + } +/* fprintf(stderr, "%s not in %dth set\n", zztokens[LA(i)], i);*/ + *miss_set = f[i-1]; + *miss_text = text; + *bad_tok = LA(i); + *bad_text = LATEXT(i); + if ( i==1 ) *err_k = 1; + else *err_k = k; +} + +#ifdef __USE_PROTOS +void zzTraceGuessDone(zzantlr_state *state) +#else +void zzTraceGuessDone(state) + zzantlr_state *state; +#endif +{ +#ifdef zzTRACE_RULES +#ifdef ZZCAN_GUESS + + int doIt=0; + + if (zzTraceCurrentRuleName == NULL) return; + + if (zzTraceOptionValue <= 0) { + doIt=0; + } else if (zzTraceGuessOptionValue <= 0) { + doIt=0; + } else { + doIt=1; + }; + + if (doIt) { + fprintf(stderr,"guess done - returning to rule %s {\"%s\"} at depth %d", + state->traceCurrentRuleName, + LATEXT(1), + state->traceDepth); + if (state->guessing != 0) { + fprintf(stderr," (guess mode continues - an enclosing guess is still active)"); + } else { + fprintf(stderr," (guess mode ends)"); + }; + fprintf(stderr,"\n"); + }; +#endif +#endif +} + +void +#ifdef __USE_PROTOS +zzsave_antlr_state(zzantlr_state *buf) +#else +zzsave_antlr_state(buf) +zzantlr_state *buf; +#endif +{ +#ifdef LL_K + int i; +#endif + +#ifdef ZZCAN_GUESS + buf->guess_start = zzguess_start; + buf->guessing = zzguessing; +#endif + buf->asp = zzasp; +#ifdef GENAST + buf->ast_sp = zzast_sp; +#endif +#ifdef ZZINF_LOOK + buf->inf_labase = zzinf_labase; + buf->inf_last = zzinf_last; + +/* MR6 Gunnar Rxnning (gunnar@candleweb.no) */ +/* MR6 Additional state needs to be saved/restored */ + + buf->inf_tokens = zzinf_tokens; /* MR6 */ + buf->inf_text = zzinf_text; /* MR6 */ + buf->inf_text_buffer = zzinf_text_buffer; /* MR6 */ + buf->inf_line = zzinf_line; /* MR6 */ + +#endif +#ifdef DEMAND_LOOK + buf->dirty = zzdirty; +#endif +#ifdef LL_K + for (i=0; i<LL_K; i++) buf->tokenLA[i] = zztokenLA[i]; + for (i=0; i<LL_K; i++) strcpy(buf->textLA[i], zztextLA[i]); + buf->lap = zzlap; + buf->labase = zzlabase; +#else + buf->token = zztoken; + strcpy(buf->text, zzlextext); +#endif +#ifdef zzTRACE_RULES + + /* MR10 */ + + buf->traceOptionValue=zzTraceOptionValue; + buf->traceGuessOptionValue=zzTraceGuessOptionValue; + buf->traceCurrentRuleName=zzTraceCurrentRuleName; + buf->traceDepth=zzTraceDepth; +#endif +} + +void +#ifdef __USE_PROTOS +zzrestore_antlr_state(zzantlr_state *buf) +#else +zzrestore_antlr_state(buf) +zzantlr_state *buf; +#endif +{ + +#ifdef zzTRACE_RULES + int prevTraceOptionValue; +#endif + +#ifdef LL_K + int i; +#endif + +#ifdef ZZCAN_GUESS + zzguess_start = buf->guess_start; + zzguessing = buf->guessing; +#endif + zzasp = buf->asp; +#ifdef GENAST + zzast_sp = buf->ast_sp; +#endif +#ifdef ZZINF_LOOK + zzinf_labase = buf->inf_labase; + zzinf_last = buf->inf_last; + +/* MR6 Gunnar Rxnning (gunnar@candleweb.no) */ +/* MR6 Additional state needs to be saved/restored */ + + zzinf_tokens = buf->inf_tokens; /* MR6 */ + zzinf_text = buf->inf_text; /* MR6 */ + zzinf_text_buffer = buf->inf_text_buffer; /* MR6 */ + zzinf_line = buf->inf_line; /* MR6 */ +#endif +#ifdef DEMAND_LOOK + zzdirty = buf->dirty; +#endif +#ifdef LL_K + for (i=0; i<LL_K; i++) zztokenLA[i] = buf->tokenLA[i]; + for (i=0; i<LL_K; i++) strcpy(zztextLA[i], buf->textLA[i]); + zzlap = buf->lap; + zzlabase = buf->labase; +#else + zztoken = buf->token; + strcpy(zzlextext, buf->text); +#endif +#ifdef zzTRACE_RULES + + prevTraceOptionValue=zzTraceOptionValue; + zzTraceOptionValue=buf->traceOptionValue; + if ( (prevTraceOptionValue > 0) != + (zzTraceOptionValue > 0)) { + if (zzTraceOptionValue > 0) { + fprintf(stderr,"trace enable restored in rule %s depth %d\n", + zzTraceCurrentRuleName,zzTraceDepth); + }; + if (zzTraceOptionValue <= 0) { + fprintf(stderr,"trace disable restored in rule %s depth %d\n", + zzTraceCurrentRuleName,zzTraceDepth); + }; + }; + + zzTraceOptionValue=buf->traceOptionValue; /* MR10 */ + zzTraceGuessOptionValue=buf->traceGuessOptionValue; /* MR10 */ + zzTraceCurrentRuleName=buf->traceCurrentRuleName; /* MR10 */ + zzTraceDepth=buf->traceDepth; /* MR10 */ + zzTraceGuessDone(buf); /* MR10 */ +#endif +} + +void +#ifdef __USE_PROTOS +zzedecode(SetWordType *a) +#else +zzedecode(a) +SetWordType *a; +#endif +{ + register SetWordType *p = a; + register SetWordType *endp = &(p[zzSET_SIZE]); + register unsigned e = 0; + + if ( zzset_deg(a)>1 ) fprintf(stderr, " {"); + do { + register SetWordType t = *p; + register SetWordType *b = &(bitmask[0]); + do { + if ( t & *b ) fprintf(stderr, " %s", zztokens[e]); + e++; + } while (++b < &(bitmask[sizeof(SetWordType)*8])); + } while (++p < endp); + if ( zzset_deg(a)>1 ) fprintf(stderr, " }"); +} + +#ifndef USER_ZZSYN +/* standard error reporting function */ +void +#ifdef __USE_PROTOS +zzsyn(char *text, int tok, char *egroup, SetWordType *eset, int etok, int k, char *bad_text) +#else +zzsyn(text, tok, egroup, eset, etok, k, bad_text) +char *text, *egroup, *bad_text; +int tok; +int etok; +int k; +SetWordType *eset; +#endif +{ + + zzSyntaxErrCount++; /* MR11 */ + fprintf(stderr, "line %d: syntax error at \"%s\"", zzline, (tok==zzEOF_TOKEN)?"EOF":bad_text); + if ( !etok && !eset ) {fprintf(stderr, "\n"); return;} + if ( k==1 ) fprintf(stderr, " missing"); + else + { + fprintf(stderr, "; \"%s\" not", bad_text); + if ( zzset_deg(eset)>1 ) fprintf(stderr, " in"); + } + if ( zzset_deg(eset)>0 ) zzedecode(eset); + else fprintf(stderr, " %s", zztokens[etok]); + if ( strlen(egroup) > 0 ) fprintf(stderr, " in %s", egroup); + fprintf(stderr, "\n"); +} +#endif + +/* is b an element of set p? */ +int +#ifdef __USE_PROTOS +zzset_el(unsigned b, SetWordType *p) +#else +zzset_el(b,p) +unsigned b; +SetWordType *p; +#endif +{ + return( p[BSETDIVWORD(b)] & bitmask[BSETMODWORD(b)] ); +} + +int +#ifdef __USE_PROTOS +zzset_deg(SetWordType *a) +#else +zzset_deg(a) +SetWordType *a; +#endif +{ + /* Fast compute degree of a set... the number + of elements present in the set. Assumes + that all word bits are used in the set + */ + register SetWordType *p = a; + register SetWordType *endp = &(a[zzSET_SIZE]); + register int degree = 0; + + if ( a == NULL ) return 0; + while ( p < endp ) + { + register SetWordType t = *p; + register SetWordType *b = &(bitmask[0]); + do { + if (t & *b) ++degree; + } while (++b < &(bitmask[sizeof(SetWordType)*8])); + p++; + } + + return(degree); +} + +#ifdef DEMAND_LOOK + +#ifdef LL_K +int +#ifdef __USE_PROTOS +_zzmatch(int _t, char **zzBadText, char **zzMissText, + int *zzMissTok, int *zzBadTok, + SetWordType **zzMissSet) +#else +_zzmatch(_t, zzBadText, zzMissText, zzMissTok, zzBadTok, zzMissSet) +int _t; +char **zzBadText; +char **zzMissText; +int *zzMissTok, *zzBadTok; +SetWordType **zzMissSet; +#endif +{ + if ( zzdirty==LL_K ) { + zzCONSUME; + } + if ( LA(1)!=_t ) { + *zzBadText = *zzMissText=LATEXT(1); + *zzMissTok= _t; *zzBadTok=LA(1); + *zzMissSet=NULL; + return 0; + } + zzMakeAttr + zzdirty++; + zzlabase++; + return 1; +} + +int +#ifdef __USE_PROTOS +_zzmatch_wsig(int _t) +#else +_zzmatch_wsig(_t) +int _t; +#endif +{ + if ( zzdirty==LL_K ) { + zzCONSUME; + } + if ( LA(1)!=_t ) { + return 0; + } + zzMakeAttr + zzdirty++; + zzlabase++; + return 1; +} + +#else + +int +#ifdef __USE_PROTOS +_zzmatch(int _t, char **zzBadText, char **zzMissText, + int *zzMissTok, int *zzBadTok, SetWordType **zzMissSet) +#else +_zzmatch(_t, zzBadText, zzMissText, zzMissTok, zzBadTok, zzMissSet) +int _t; +char **zzBadText; +char **zzMissText; +int *zzMissTok, *zzBadTok; +SetWordType **zzMissSet; +#endif +{ + if ( zzdirty ) {zzCONSUME;} + if ( LA(1)!=_t ) { + *zzBadText = *zzMissText=LATEXT(1); + *zzMissTok= _t; *zzBadTok=LA(1); + *zzMissSet=NULL; + return 0; + } + zzdirty = 1; + zzMakeAttr + return 1; +} + +int +#ifdef __USE_PROTOS +_zzmatch_wsig(int _t) +#else +_zzmatch_wsig(_t) +int _t; +#endif +{ + if ( zzdirty ) {zzCONSUME;} + if ( LA(1)!=_t ) { + return 0; + } + zzdirty = 1; + zzMakeAttr + return 1; +} + +#endif /*LL_K*/ + +#else + +int +#ifdef __USE_PROTOS +_zzmatch(int _t, char **zzBadText, char **zzMissText, + int *zzMissTok, int *zzBadTok, + SetWordType **zzMissSet) +#else +_zzmatch(_t, zzBadText, zzMissText, zzMissTok, zzBadTok, zzMissSet) +int _t; +char **zzBadText; +char **zzMissText; +int *zzMissTok, *zzBadTok; +SetWordType **zzMissSet; +#endif +{ + if ( LA(1)!=_t ) { + *zzBadText = *zzMissText=LATEXT(1); + *zzMissTok= _t; *zzBadTok=LA(1); + *zzMissSet=NULL; + return 0; + } + zzMakeAttr + return 1; +} + +int +#ifdef __USE_PROTOS +_zzmatch_wsig(int _t) +#else +_zzmatch_wsig(_t) +int _t; +#endif +{ + if ( LA(1)!=_t ) return 0; + zzMakeAttr + return 1; +} + +#endif /*DEMAND_LOOK*/ + +#ifdef ZZINF_LOOK +void +#ifdef __USE_PROTOS +_inf_zzgettok(void) +#else +_inf_zzgettok() +#endif +{ + if ( zzinf_labase >= zzinf_last ) + {NLA = zzEOF_TOKEN; strcpy(NLATEXT, "");} + else { + NLA = zzinf_tokens[zzinf_labase]; + zzline = zzinf_line[zzinf_labase]; /* wrong in 1.21 */ + strcpy(NLATEXT, zzinf_text[zzinf_labase]); + zzinf_labase++; + } +} +#endif + +#ifdef ZZINF_LOOK +/* allocate default size text,token and line arrays; + * then, read all of the input reallocing the arrays as needed. + * Once the number of total tokens is known, the LATEXT(i) array (zzinf_text) + * is allocated and it's pointers are set to the tokens in zzinf_text_buffer. + */ +void +#ifdef __USE_PROTOS +zzfill_inf_look(void) +#else +zzfill_inf_look() +#endif +{ + int tok, line; + int zzinf_token_buffer_size = ZZINF_DEF_TOKEN_BUFFER_SIZE; + int zzinf_text_buffer_size = ZZINF_DEF_TEXT_BUFFER_SIZE; + int zzinf_text_buffer_index = 0; + int zzinf_lap = 0; + + /* allocate text/token buffers */ + zzinf_text_buffer = (char *) malloc(zzinf_text_buffer_size); + if ( zzinf_text_buffer == NULL ) + { + fprintf(stderr, "cannot allocate lookahead text buffer (%d bytes)\n", + zzinf_text_buffer_size); + exit(PCCTS_EXIT_FAILURE); + } + zzinf_tokens = (int *) calloc(zzinf_token_buffer_size,sizeof(int)); + if ( zzinf_tokens == NULL ) + { + fprintf(stderr, "cannot allocate token buffer (%d tokens)\n", + zzinf_token_buffer_size); + exit(PCCTS_EXIT_FAILURE); + } + zzinf_line = (int *) calloc(zzinf_token_buffer_size,sizeof(int)); + if ( zzinf_line == NULL ) + { + fprintf(stderr, "cannot allocate line buffer (%d ints)\n", + zzinf_token_buffer_size); + exit(PCCTS_EXIT_FAILURE); + } + + /* get tokens, copying text to text buffer */ + zzinf_text_buffer_index = 0; + do { + zzgettok(); + line = zzreal_line; + while ( zzinf_lap>=zzinf_token_buffer_size ) + { + zzinf_token_buffer_size += ZZINF_BUFFER_TOKEN_CHUNK_SIZE; + zzinf_tokens = (int *) realloc(zzinf_tokens, + zzinf_token_buffer_size*sizeof(int)); + if ( zzinf_tokens == NULL ) + { + fprintf(stderr, "cannot allocate lookahead token buffer (%d tokens)\n", + zzinf_token_buffer_size); + exit(PCCTS_EXIT_FAILURE); + } + zzinf_line = (int *) realloc(zzinf_line, + zzinf_token_buffer_size*sizeof(int)); + if ( zzinf_line == NULL ) + { + fprintf(stderr, "cannot allocate lookahead line buffer (%d ints)\n", + zzinf_token_buffer_size); + exit(PCCTS_EXIT_FAILURE); + } + + } + while ( (zzinf_text_buffer_index+strlen(NLATEXT)+1) >= zzinf_text_buffer_size ) + { + zzinf_text_buffer_size += ZZINF_BUFFER_TEXT_CHUNK_SIZE; + zzinf_text_buffer = (char *) realloc(zzinf_text_buffer, + zzinf_text_buffer_size); + if ( zzinf_text_buffer == NULL ) + { + fprintf(stderr, "cannot allocate lookahead text buffer (%d bytes)\n", + zzinf_text_buffer_size); + exit(PCCTS_EXIT_FAILURE); + } + } + /* record token and text and line of input symbol */ + tok = zzinf_tokens[zzinf_lap] = NLA; + strcpy(&zzinf_text_buffer[zzinf_text_buffer_index], NLATEXT); + zzinf_text_buffer_index += strlen(NLATEXT)+1; + zzinf_line[zzinf_lap] = line; + zzinf_lap++; + } while (tok!=zzEOF_TOKEN); + zzinf_labase = 0; + zzinf_last = zzinf_lap-1; + + /* allocate ptrs to text of ith token */ + zzinf_text = (char **) calloc(zzinf_last+1,sizeof(char *)); + if ( zzinf_text == NULL ) + { + fprintf(stderr, "cannot allocate lookahead text buffer (%d)\n", + zzinf_text_buffer_size); + exit(PCCTS_EXIT_FAILURE); + } + zzinf_text_buffer_index = 0; + zzinf_lap = 0; + /* set ptrs so that zzinf_text[i] is the text of the ith token found on input */ + while (zzinf_lap<=zzinf_last) + { + zzinf_text[zzinf_lap++] = &zzinf_text_buffer[zzinf_text_buffer_index]; + zzinf_text_buffer_index += strlen(&zzinf_text_buffer[zzinf_text_buffer_index])+1; + } +} +#endif + +int +#ifdef __USE_PROTOS +_zzsetmatch(SetWordType *e, char **zzBadText, char **zzMissText, + int *zzMissTok, int *zzBadTok, + SetWordType **zzMissSet, + SetWordType *zzTokclassErrset /* MR23 */) +#else +_zzsetmatch(e, zzBadText, zzMissText, zzMissTok, zzBadTok, zzMissSet, zzTokclassErrset /* MR23 */) +SetWordType *e; +char **zzBadText; +char **zzMissText; +int *zzMissTok, *zzBadTok; +SetWordType **zzMissSet; +SetWordType *zzTokclassErrset; +#endif +{ +#ifdef DEMAND_LOOK +#ifdef LL_K + if ( zzdirty==LL_K ) {zzCONSUME;} +#else + if ( zzdirty ) {zzCONSUME;} +#endif +#endif + if ( !zzset_el((unsigned)LA(1), e) ) { + *zzBadText = LATEXT(1); *zzMissText=NULL; + *zzMissTok= 0; *zzBadTok=LA(1); + *zzMissSet=zzTokclassErrset; /* MR23 */ + return 0; + } + zzMakeAttr /* MR14 Ger Hobbelt (hobbelt@axa.nl) */ +#ifdef DEMAND_LOOK +#ifdef LL_K + zzdirty++; + zzlabase++; /* MR14 Ger Hobbelt (hobbelt@axa.nl) */ +#else + zzdirty = 1; +#endif +#endif + return 1; +} + +int +#ifdef __USE_PROTOS +_zzmatch_wdfltsig(int tokenWanted, SetWordType *whatFollows) +#else +_zzmatch_wdfltsig(tokenWanted, whatFollows) +int tokenWanted; +SetWordType *whatFollows; +#endif +{ +#ifdef DEMAND_LOOK +#ifdef LL_K + if ( zzdirty==LL_K ) { + zzCONSUME; + } +#else + if ( zzdirty ) {zzCONSUME;} +#endif +#endif + + if ( LA(1)!=tokenWanted ) + { + zzSyntaxErrCount++; /* MR11 */ + fprintf(stderr, + "line %d: syntax error at \"%s\" missing %s\n", + zzline, + (LA(1)==zzEOF_TOKEN)?"<eof>":(char *)LATEXT(1), + zztokens[tokenWanted]); + zzconsumeUntil( whatFollows ); + return 0; + } + else { + zzMakeAttr +#ifdef DEMAND_LOOK +#ifdef LL_K + zzdirty++; + zzlabase++; +#else + zzdirty = 1; +#endif +#else +/* zzCONSUME; consume if not demand lookahead */ +#endif + return 1; + } +} + +int +#ifdef __USE_PROTOS +_zzsetmatch_wdfltsig(SetWordType *tokensWanted, + int tokenTypeOfSet, + SetWordType *whatFollows) +#else +_zzsetmatch_wdfltsig(tokensWanted, tokenTypeOfSet, whatFollows) +SetWordType *tokensWanted; +int tokenTypeOfSet; +SetWordType *whatFollows; +#endif +{ +#ifdef DEMAND_LOOK +#ifdef LL_K + if ( zzdirty==LL_K ) {zzCONSUME;} +#else + if ( zzdirty ) {zzCONSUME;} +#endif +#endif + if ( !zzset_el((unsigned)LA(1), tokensWanted) ) + { + zzSyntaxErrCount++; /* MR11 */ + fprintf(stderr, + "line %d: syntax error at \"%s\" missing %s\n", + zzline, + (LA(1)==zzEOF_TOKEN)?"<eof>":(char *)LATEXT(1), + zztokens[tokenTypeOfSet]); + zzconsumeUntil( whatFollows ); + return 0; + } + else { + zzMakeAttr +#ifdef DEMAND_LOOK +#ifdef LL_K + zzdirty++; + zzlabase++; +#else + zzdirty = 1; +#endif +#else +/* zzCONSUME; consume if not demand lookahead */ +#endif + return 1; + } +} + +int +#ifdef __USE_PROTOS +_zzsetmatch_wsig(SetWordType *e) +#else +_zzsetmatch_wsig(e) +SetWordType *e; +#endif +{ +#ifdef DEMAND_LOOK +#ifdef LL_K + if ( zzdirty==LL_K ) {zzCONSUME;} +#else + if ( zzdirty ) {zzCONSUME;} +#endif +#endif + if ( !zzset_el((unsigned)LA(1), e) ) return 0; + zzMakeAttr /* MR14 Ger Hobbelt (hobbelt@axa.nl) */ +#ifdef DEMAND_LOOK +#ifdef LL_K + zzdirty++; + zzlabase++; /* MR14 Ger Hobbelt (hobbelt@axa.nl) */ +#else + zzdirty = 1; +#endif +#endif + return 1; +} + +#ifdef USER_ZZMODE_STACK +static int zzmstk[ZZMAXSTK] = { -1 }; +static int zzmdep = 0; +static char zzmbuf[70]; + +void +#ifdef __USE_PROTOS +zzmpush( int m ) +#else +zzmpush( m ) +int m; +#endif +{ + if(zzmdep == ZZMAXSTK - 1) { + sprintf(zzmbuf, "Mode stack overflow "); + zzerr(zzmbuf); + } else { + zzmstk[zzmdep++] = zzauto; + zzmode(m); + } +} + +void +#ifdef __USE_PROTOS +zzmpop( void ) +#else +zzmpop( ) +#endif +{ + if(zzmdep == 0) + { sprintf(zzmbuf, "Mode stack underflow "); + zzerr(zzmbuf); + } + else + { zzmdep--; + zzmode(zzmstk[zzmdep]); + } +} + +void +#ifdef __USE_PROTOS +zzsave_mode_stack( int modeStack[], int *modeLevel ) +#else +zzsave_mode_stack( modeStack, modeLevel ) +int modeStack[]; +int *modeLevel; +#endif +{ + int i; + memcpy(modeStack, zzmstk, sizeof(zzmstk)); + *modeLevel = zzmdep; + zzmdep = 0; + + return; +} + +void +#ifdef __USE_PROTOS +zzrestore_mode_stack( int modeStack[], int *modeLevel ) +#else +zzrestore_mode_stack( modeStack, modeLevel ) +int modeStack[]; +int *modeLevel; +#endif +{ + int i; + + memcpy(zzmstk, modeStack, sizeof(zzmstk)); + zzmdep = *modeLevel; + + return; +} +#endif /* USER_ZZMODE_STACK */ + +#ifdef __USE_PROTOS +void zzTraceReset(void) +#else +void zzTraceReset() +#endif +{ +#ifdef zzTRACE_RULES + zzTraceOptionValue=zzTraceOptionValueDefault; + zzTraceGuessOptionValue=1; + zzTraceCurrentRuleName=NULL; + zzTraceDepth=0; +#endif +} + +#ifdef __USE_PROTOS +void zzTraceGuessFail(void) +#else +void zzTraceGuessFail() +#endif +{ + +#ifdef zzTRACE_RULES +#ifdef ZZCAN_GUESS + + int doIt=0; + + if (zzTraceOptionValue <= 0) { + doIt=0; + } else if (zzguessing && zzTraceGuessOptionValue <= 0) { + doIt=0; + } else { + doIt=1; + }; + + if (doIt) { + fprintf(stderr,"guess failed\n"); + }; +#endif +#endif +} + +/* zzTraceOption: + zero value turns off trace +*/ + +#ifdef __USE_PROTOS +void zzTraceIn(char * rule) +#else +void zzTraceIn(rule) + char *rule; +#endif +{ +#ifdef zzTRACE_RULES + + int doIt=0; + + zzTraceDepth++; + zzTraceCurrentRuleName=rule; + + if (zzTraceOptionValue <= 0) { + doIt=0; +#ifdef ZZCAN_GUESS + } else if (zzguessing && zzTraceGuessOptionValue <= 0) { + doIt=0; +#endif + } else { + doIt=1; + }; + + if (doIt) { + fprintf(stderr,"enter rule %s {\"%s\"} depth %d", + rule, + LA(1)==1 ? "@" : (char *) LATEXT(1), /* MR19 */ + zzTraceDepth); +#ifdef ZZCAN_GUESS + if (zzguessing) fprintf(stderr," guessing"); +#endif + fprintf(stderr,"\n"); + }; +#endif + return; +} + +#ifdef __USE_PROTOS +void zzTraceOut(char * rule) +#else +void zzTraceOut(rule) + char *rule; +#endif +{ +#ifdef zzTRACE_RULES + int doIt=0; + + zzTraceDepth--; + + if (zzTraceOptionValue <= 0) { + doIt=0; +#ifdef ZZCAN_GUESS + } else if (zzguessing && zzTraceGuessOptionValue <= 0) { + doIt=0; +#endif + } else { + doIt=1; + }; + + if (doIt) { + fprintf(stderr,"exit rule %s {\"%s\"} depth %d", + rule, + LA(1)==1 ? "@" : (char *) LATEXT(1), /* MR19 */ + zzTraceDepth+1); +#ifdef ZZCAN_GUESS + if (zzguessing) fprintf(stderr," guessing"); +#endif + fprintf(stderr,"\n"); + }; +#endif +} + +#ifdef __USE_PROTOS +int zzTraceOption(int delta) +#else +int zzTraceOption(delta) + int delta; +#endif +{ +#ifdef zzTRACE_RULES + int prevValue=zzTraceOptionValue; + + zzTraceOptionValue=zzTraceOptionValue+delta; + + if (zzTraceCurrentRuleName != NULL) { + if (prevValue <= 0 && zzTraceOptionValue > 0) { + fprintf(stderr,"trace enabled in rule %s depth %d\n", + zzTraceCurrentRuleName,zzTraceDepth); + }; + if (prevValue > 0 && zzTraceOptionValue <= 0) { + fprintf(stderr,"trace disabled in rule %s depth %d\n", + zzTraceCurrentRuleName,zzTraceDepth); + }; + }; + return prevValue; +#else + return 0; +#endif +} + +#ifdef __USE_PROTOS +int zzTraceGuessOption(int delta) +#else +int zzTraceGuessOption(delta) + int delta; +#endif +{ +#ifdef zzTRACE_RULES +#ifdef ZZCAN_GUESS + int prevValue=zzTraceGuessOptionValue; + + zzTraceGuessOptionValue=zzTraceGuessOptionValue+delta; + + if (zzTraceCurrentRuleName != NULL) { + if (prevValue <= 0 && zzTraceGuessOptionValue > 0) { + fprintf(stderr,"guess trace enabled in rule %s depth %d\n", + zzTraceCurrentRuleName,zzTraceDepth); + }; + if (prevValue > 0 && zzTraceGuessOptionValue <= 0) { + fprintf(stderr,"guess trace disabled in rule %s depth %d\n", + zzTraceCurrentRuleName,zzTraceDepth); + }; + }; + return prevValue; +#else + return 0; +#endif +#else + return 0; +#endif +} + +#endif /* ERR_H */ diff --git a/pccts/h/int.h b/pccts/h/int.h new file mode 100644 index 0000000..cebe16c --- /dev/null +++ b/pccts/h/int.h @@ -0,0 +1,37 @@ +/* ANTLR attribute definition -- long integers + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * ANTLR 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +#ifndef ZZINT_H +#define ZZINT_H + +typedef long Attrib; + +#define zzcr_attr(a,tok,t) *(a) = atol(t); + +#endif diff --git a/pccts/h/pccts_assert.h b/pccts/h/pccts_assert.h new file mode 100644 index 0000000..13d133a --- /dev/null +++ b/pccts/h/pccts_assert.h @@ -0,0 +1,10 @@ +#ifndef __PCCTS_ASSERT_H__ +#define __PCCTS_ASSERT_H__ + +#ifdef PCCTS_USE_NAMESPACE_STD +#include <cassert> +#else +#include <assert.h> +#endif + +#endif diff --git a/pccts/h/pccts_iostream.h b/pccts/h/pccts_iostream.h new file mode 100644 index 0000000..24aee39 --- /dev/null +++ b/pccts/h/pccts_iostream.h @@ -0,0 +1,10 @@ +#ifndef __PCCTS_IOSTREAM_H__ +#define __PCCTS_IOSTREAM_H__ + +#ifdef PCCTS_USE_NAMESPACE_STD +#include <iostream> +#else +#include <iostream.h> +#endif + +#endif diff --git a/pccts/h/pccts_istream.h b/pccts/h/pccts_istream.h new file mode 100644 index 0000000..54e1461 --- /dev/null +++ b/pccts/h/pccts_istream.h @@ -0,0 +1,10 @@ +#ifndef __PCCTS_ISTREAM_H__ +#define __PCCTS_ISTREAM_H__ + +#ifdef PCCTS_USE_NAMESPACE_STD +#include <istream> +#else +#include <istream.h> +#endif + +#endif diff --git a/pccts/h/pccts_setjmp.h b/pccts/h/pccts_setjmp.h new file mode 100644 index 0000000..a6e925d --- /dev/null +++ b/pccts/h/pccts_setjmp.h @@ -0,0 +1,10 @@ +#ifndef __PCCTS_SETJMP_H__ +#define __PCCTS_SETJMP_H__ + +#ifdef PCCTS_USE_NAMESPACE_STD +#include <csetjmp> +#else +#include <setjmp.h> +#endif + +#endif diff --git a/pccts/h/pccts_stdarg.h b/pccts/h/pccts_stdarg.h new file mode 100644 index 0000000..25b3f1c --- /dev/null +++ b/pccts/h/pccts_stdarg.h @@ -0,0 +1,10 @@ +#ifndef __PCCTS_STDARG_H__ +#define __PCCTS_STDARG_H__ + +#ifdef PCCTS_USE_NAMESPACE_STD +#include <cstdarg> +#else +#include <stdarg.h> +#endif + +#endif diff --git a/pccts/h/pccts_stdio.h b/pccts/h/pccts_stdio.h new file mode 100644 index 0000000..0e9fc5b --- /dev/null +++ b/pccts/h/pccts_stdio.h @@ -0,0 +1,10 @@ +#ifndef __PCCTS_STDIO_H__ +#define __PCCTS_STDIO_H__ + +#ifdef PCCTS_USE_NAMESPACE_STD +#include <cstdio> +#else +#include <stdio.h> +#endif + +#endif diff --git a/pccts/h/pccts_stdlib.h b/pccts/h/pccts_stdlib.h new file mode 100644 index 0000000..d929e29 --- /dev/null +++ b/pccts/h/pccts_stdlib.h @@ -0,0 +1,10 @@ +#ifndef __PCCTS_STDLIB_H__ +#define __PCCTS_STDLIB_H__ + +#ifdef PCCTS_USE_NAMESPACE_STD +#include <cstdlib> +#else +#include <stdlib.h> +#endif + +#endif diff --git a/pccts/h/pccts_string.h b/pccts/h/pccts_string.h new file mode 100644 index 0000000..5ebd368 --- /dev/null +++ b/pccts/h/pccts_string.h @@ -0,0 +1,10 @@ +#ifndef __PCCTS_STRING_H__ +#define __PCCTS_STRING_H__ + +#ifdef PCCTS_USE_NAMESPACE_STD +#include <cstring> +#else +#include <string.h> +#endif + +#endif diff --git a/pccts/h/pcctscfg.h b/pccts/h/pcctscfg.h new file mode 100644 index 0000000..6463753 --- /dev/null +++ b/pccts/h/pcctscfg.h @@ -0,0 +1,359 @@ +#ifndef PCCTS_CONFIG_H +#define PCCTS_CONFIG_H +/* + * pcctscfg.h (formerly config.h) (for ANTLR, DLG, and SORCERER) + * + * This is a simple configuration file that doesn't have config stuff + * in it, but it's a start. + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to the Purdue Compiler Construction Tool + * Set (PCCTS) -- PCCTS is in the public domain. An individual or + * company may do whatever they wish with source code distributed with + * PCCTS or the code generated by PCCTS, including the incorporation of + * PCCTS, or its output, into commerical software. + * + * We encourage users to develop software with PCCTS. However, we do ask + * that credit is given to us for developing PCCTS. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like PCCTS and have developed a nice tool with the + * output, please mention that you developed it using PCCTS. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * Used by PCCTS 1.33 (SORCERER 1.00B11 and up) + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1989-2000 + */ + +/* This file knows about the following ``environments'' + UNIX (default) + DOS (use #define PC) + MAC (use #define MPW; has a few things for THINK C, Metrowerks) + MS/C++ (MR14 Microsoft Visual C++ environment uses symbol _MSC_VER) + + */ + +/* should test __STDC__ for 1, but some compilers don't set value, just def */ + +#ifndef __USE_PROTOS +#ifdef __STDC__ +#define __USE_PROTOS +#endif +#ifdef __cplusplus +#define __USE_PROTOS +#endif +#endif + +#ifdef PCCTS_USE_NAMESPACE_STD +#define PCCTS_NAMESPACE_STD namespace std {}; using namespace std; +#else +#define PCCTS_NAMESPACE_STD +#endif + +#include "pccts_stdio.h" +#include "pccts_stdlib.h" + +/* largest file name size */ + +#ifdef _MAX_PATH +#define MaxFileName _MAX_PATH /* MR9 RJV: MAX_PATH defined in stdlib.h (MSVC++ 5.0) */ +#else +#define MaxFileName 300 +#endif + +/* +* Define PC32 if in a 32-bit PC environment (e.g. extended DOS or Win32). +* The macros tested here are defined by Watcom, Microsoft, Borland, +* and djgpp, respectively, when they are used as 32-bit compilers. +* Users of these compilers *must* be sure to define PC in their +* makefiles for this to work correctly. +*/ +#ifdef PC +# if (defined(__WATCOMC__) || defined(_WIN32) || defined(__WIN32__) || \ + defined(__GNUC__) || defined(__GNUG__)) +# ifndef PC32 +# define PC32 +# endif +# endif +#endif + +/* MR1 10-Apr-97 Default for PC is short file names */ +/* MR1 Default for non-PC is long file names */ +/* MR1 Can override via command line option LONGFILENAMES */ + +#ifndef LONGFILENAMES +#ifndef PC +#define LONGFILENAMES +#endif +#endif + +#ifndef LONGFILENAMES +#define ATOKEN_H "AToken.h" +#define ATOKPTR_H "ATokPtr.h" +#define ATOKPTR_IMPL_H "ATokPtrIm.h" +#define ATOKENBUFFER_H "ATokBuf.h" +#define ATOKENBUFFER_C "ATokBuf.cpp" +#define ATOKENSTREAM_H "ATokStr.h" +#define APARSER_H "AParser.h" +#define APARSER_C "AParser.cpp" +#define ASTBASE_H "ASTBase.h" +#define ASTBASE_C "ASTBase.cpp" +#define PCCTSAST_C "PCCTSAST.cpp" +#define LIST_C "List.cpp" +#define DLEXERBASE_H "DLexBase.h" +#define DLEXERBASE_C "DLexBase.cpp" +#define DLEXER_H "DLexer.h" +#define STREESUPPORT_C "STreeSup.C" +#else +#define ATOKEN_H "AToken.h" +#define ATOKPTR_H "ATokPtr.h" +#define ATOKPTR_IMPL_H "ATokPtrImpl.h" +#define ATOKENBUFFER_H "ATokenBuffer.h" +#define ATOKENBUFFER_C "ATokenBuffer.cpp" +#define ATOKENSTREAM_H "ATokenStream.h" +#define APARSER_H "AParser.h" +#define APARSER_C "AParser.cpp" +#define ASTBASE_H "ASTBase.h" +#define ASTBASE_C "ASTBase.cpp" +#define PCCTSAST_C "PCCTSAST.cpp" +#define LIST_C "List.cpp" +#define DLEXERBASE_H "DLexerBase.h" +#define DLEXERBASE_C "DLexerBase.cpp" +#define DLEXER_H "DLexer.h" +#define STREESUPPORT_C "STreeSupport.cpp" +#endif + +/* SORCERER Stuff */ + +/* MR8 6-Aug-97 Change from ifdef PC to ifndef LONGFILENAMES */ + +#ifndef LONGFILENAMES +#define STPARSER_H "STreePar.h" +#define STPARSER_C "STreePar.C" +#else +#define STPARSER_H "STreeParser.h" +#define STPARSER_C "STreeParser.cpp" +#endif + +#ifdef MPW +#define CPP_FILE_SUFFIX ".cp" +#define CPP_FILE_SUFFIX_NO_DOT "cp" +#define OBJ_FILE_SUFFIX ".o" +#else +#ifdef PC +#define CPP_FILE_SUFFIX ".cpp" +#define CPP_FILE_SUFFIX_NO_DOT "cpp" +#define OBJ_FILE_SUFFIX ".obj" +#else +#ifdef __VMS +#define CPP_FILE_SUFFIX ".cpp" +#define CPP_FILE_SUFFIX_NO_DOT "cpp" +#define OBJ_FILE_SUFFIX ".obj" +#else +#define CPP_FILE_SUFFIX ".cpp" +#define CPP_FILE_SUFFIX_NO_DOT "cpp" +#define OBJ_FILE_SUFFIX ".o" +#endif +#endif +#endif + +/* User may redefine how line information looks */ /* make it #line MR7 */ +/* MR21 Use #ifndef */ + +#ifndef LineInfoFormatStr +#define LineInfoFormatStr "#line %d \"%s\"\n" +#endif + +#ifdef MPW /* Macintosh Programmer's Workshop */ +#define ErrHdr "File \"%s\"; Line %d #" +#else +#ifdef _MSC_VER /* MR14 Microsoft Visual C++ environment */ +#define ErrHdr "%s(%d) :" +#else +#define ErrHdr "%s, line %d:" /* default */ +#endif +#endif + +/* must assume old K&R cpp here, can't use #if defined(..)... */ + +#ifdef MPW +#define TopDirectory ":" +#define DirectorySymbol ":" +#define OutputDirectoryOption "Directory where all output files should go (default=\":\")" +#else +#ifdef PC +#define TopDirectory "." +#define DirectorySymbol "\\" +#define OutputDirectoryOption "Directory where all output files should go (default=\".\")" +#else +#ifdef __VMS +#define TopDirectory "[000000]" +#define DirectorySymbol "]" +#define OutputDirectoryOption "Directory where all output files should go (default=\"[]\")" +#else +#define TopDirectory "." +#define DirectorySymbol "/" +#define OutputDirectoryOption "Directory where all output files should go (default=\".\")" +#endif +#endif +#endif + +#ifdef MPW + +/* Make sure we have prototypes for all functions under MPW */ + +#include "pccts_string.h" +#include "pccts_stdlib.h" + +/* MR6 2-Jun-97 Fixes false dependency caused by VC++ #include scanner */ +/* MR6 Reported by Brad Schick (schick@interaccess.com) */ +#define MPW_CursorCtl_Header <CursorCtl.h> +#include MPW_CursorCtl_Header +#ifdef __cplusplus +extern "C" { +#endif +extern void fsetfileinfo (const char *filename, unsigned long newcreator, unsigned long newtype); +#ifdef __cplusplus +} +#endif + +/* File creators for various popular development environments */ + +#define MAC_FILE_CREATOR 'MPS ' /* MPW Text files */ +#if 0 +#define MAC_FILE_CREATOR 'KAHL' /* THINK C/Symantec C++ Text files */ +#endif +#if 0 +#define MAC_FILE_CREATOR 'CWIE' /* Metrowerks C/C++ Text files */ +#endif + +#endif + +#ifdef MPW +#define DAWDLE SpinCursor(1) +#else +#define DAWDLE +#endif + +#ifdef MPW +#define SPECIAL_INITS +#define SPECIAL_FOPEN +#endif + +#ifdef MPW +#ifdef __cplusplus +inline +#else +static +#endif +void special_inits() +{ + InitCursorCtl((acurHandle) 0); +} +#endif + +#ifdef MPW +#ifdef __cplusplus +inline +#else +static +#endif +void special_fopen_actions(char * s) +{ + fsetfileinfo (s, MAC_FILE_CREATOR, 'TEXT'); +} +#endif + +/* Define usable bits for set.c stuff */ +#define BytesPerWord sizeof(unsigned) +#define WORDSIZE (sizeof(unsigned)*8) +#define LogWordSize (WORDSIZE==16?4:5) + +#ifndef TRUE +#define TRUE 1 +#endif +#ifndef FALSE +#define FALSE 0 +#endif + +#if defined(VAXC) || defined(__VMS) +#include <ssdef.h> +#define PCCTS_EXIT_SUCCESS 1 +#define PCCTS_EXIT_FAILURE SS$_ABORT +#define zzDIE return SS$_ABORT; +#define zzDONE return 1; + +#else /* !VAXC and !__VMS */ + +#define PCCTS_EXIT_SUCCESS 0 +#define PCCTS_EXIT_FAILURE 1 +#define zzDIE return 1; +#define zzDONE return 0; + +#endif + +#ifdef USER_ZZMODE_STACK +# ifndef ZZSTACK_MAX_MODE +# define ZZSTACK_MAX_MODE 32 +# endif +# define ZZMAXSTK (ZZSTACK_MAX_MODE * 2) +#endif + +#ifndef DllExportPCCTS +#define DllExportPCCTS +#endif + +#ifdef PC +#ifndef PCCTS_CASE_INSENSITIVE_FILE_NAME +#define PCCTS_CASE_INSENSITIVE_FILE_NAME +#endif +#endif + +#ifdef PC32 +#ifndef PCCTS_CASE_INSENSITIVE_FILE_NAME +#define PCCTS_CASE_INSENSITIVE_FILE_NAME +#endif +#endif + +#ifdef __VMS +#ifndef PCCTS_CASE_INSENSITIVE_FILE_NAME +#define PCCTS_CASE_INSENSITIVE_FILE_NAME +#endif +#endif + +#ifdef __USE_PROTOS +#ifndef PCCTS_USE_STDARG +#define PCCTS_USE_STDARG +#endif +#endif + +#ifdef __STDC__ +#ifndef PCCTS_USE_STDARG +#define PCCTS_USE_STDARG +#endif +#endif + +#ifdef __cplusplus +#ifndef PCCTS_USE_STDARG +#define PCCTS_USE_STDARG +#endif +#endif + +#ifdef _MSC_VER +/*Turn off the warnings for: + unreferenced inline/local function has been removed +*/ +#pragma warning(disable : 4514) +/* function not expanded */ +#pragma warning(disable : 4710) +#endif + +#endif diff --git a/pccts/h/set.h b/pccts/h/set.h new file mode 100644 index 0000000..6b631f8 --- /dev/null +++ b/pccts/h/set.h @@ -0,0 +1,121 @@ +#ifndef __GATE_SET_H +#define __GATE_SET_H + +/* set.h + + The following is a general-purpose set library originally developed + by Hank Dietz and enhanced by Terence Parr to allow dynamic sets. + + Sets are now structs containing the #words in the set and + a pointer to the actual set words. + + 1987 by Hank Dietz + + Modified by: + Terence Parr + Purdue University + October 1989 + + Added ANSI prototyping Dec. 1992 -- TJP +*/ + +#include "pcctscfg.h" + +#ifdef NOT_USED /* SEE config.h */ +/* Define usable bits per unsigned int word */ +#ifdef PC +#define WORDSIZE 16 +#define LogWordSize 4 +#else +#define WORDSIZE 32 +#define LogWordSize 5 +#endif +#define BytesPerWord sizeof(unsigned) +#endif + +#define SETSIZE(a) ((a).n<<LogWordSize) /* Maximum items per set */ +#define MODWORD(x) ((x) & (WORDSIZE-1)) /* x % WORDSIZE */ +#define DIVWORD(x) ((x) >> LogWordSize) /* x / WORDSIZE */ +#define nil (~((unsigned) 0)) /* An impossible set member all bits on (big!) */ + +typedef struct _set { + unsigned int n; /* Number of words in set */ + unsigned *setword; + } set; + +#define set_init {0, NULL} +#define set_null(a) ((a).setword==NULL) + +#define NumBytes(x) (((x)>>3)+1) /* Num bytes to hold x */ +#define NumWords(x) ((((unsigned)(x))>>LogWordSize)+1) /* Num words to hold x */ + + +/* M a c r o s */ + +/* make arg1 a set big enough to hold max elem # of arg2 */ +#define set_new(a,_max) \ +if (((a).setword=(unsigned *)calloc(NumWords(_max),BytesPerWord))==NULL) \ + fprintf(stderr, "set_new: Cannot allocate set with max of %d\n", _max); \ + (a).n = NumWords(_max); + +#define set_free(a) \ + {if ( (a).setword != NULL ) free((char *)((a).setword)); \ + (a) = empty;} + +#ifdef __USE_PROTOS +extern void set_size( unsigned ); +extern unsigned int set_deg( set ); +extern set set_or( set, set ); +extern set set_and( set, set ); +extern set set_dif( set, set ); +extern set set_of( unsigned ); +extern void set_ext( set *, unsigned int ); +extern set set_not( set ); +extern int set_equ( set, set ); +extern int set_sub( set, set ); +extern unsigned set_int( set ); +extern int set_el( unsigned, set ); +extern int set_nil( set ); +extern char * set_str( set ); +extern set set_val( register char * ); +extern void set_orel( unsigned, set * ); +extern void set_orin( set *, set ); +extern void set_andin( set *, set ); +extern void set_rm( unsigned, set ); +extern void set_clr( set ); +extern set set_dup( set ); +extern void set_PDQ( set, register unsigned * ); +extern unsigned *set_pdq( set ); +extern void _set_pdq( set a, register unsigned *q ); +extern unsigned int set_hash( set, register unsigned int ); +#else +extern void set_size(); +extern unsigned int set_deg(); +extern set set_or(); +extern set set_and(); +extern set set_dif(); +extern set set_of(); +extern void set_ext(); +extern set set_not(); +extern int set_equ(); +extern int set_sub(); +extern unsigned set_int(); +extern int set_el(); +extern int set_nil(); +extern char * set_str(); +extern set set_val(); +extern void set_orel(); +extern void set_orin(); +extern void set_andin(); +extern void set_rm(); +extern void set_clr(); +extern set set_dup(); +extern void set_PDQ(); +extern unsigned *set_pdq(); +extern void _set_pdq(); +extern unsigned int set_hash(); +#endif + +extern set empty; + +#endif diff --git a/pccts/h/slist.cpp b/pccts/h/slist.cpp new file mode 100644 index 0000000..eceacc4 --- /dev/null +++ b/pccts/h/slist.cpp @@ -0,0 +1,116 @@ +/* + * SList.C + * + * SOFTWARE RIGHTS + * + * We reserve no LEGAL rights to SORCERER -- SORCERER is in the public + * domain. An individual or company may do whatever they wish with + * source code distributed with SORCERER or the code generated by + * SORCERER, including the incorporation of SORCERER, or its output, into + * commerical software. + * + * We encourage users to develop software with SORCERER. However, we do + * ask that credit is given to us for developing SORCERER. By "credit", + * we mean that if you incorporate our source code into one of your + * programs (commercial product, research project, or otherwise) that you + * acknowledge this fact somewhere in the documentation, research report, + * etc... If you like SORCERER and have developed a nice tool with the + * output, please mention that you developed it using SORCERER. In + * addition, we ask that this header remain intact in our source code. + * As long as these guidelines are kept, we expect to continue enhancing + * this system and expect to make other tools available as they are + * completed. + * + * PCCTS 1.33 + * Terence Parr + * Parr Research Corporation + * with Purdue University and AHPCRC, University of Minnesota + * 1992-2000 + */ + +#define ANTLR_SUPPORT_CODE + +#include "SList.h" +#include "pccts_stdarg.h" // MR23 + +/* Iterate over a list of elements; returns ptr to a new element + * in list upon every call and NULL when no more are left. + * Very useful like this: + * + * cursor = mylist; + * while ( (p=mylist->iterate(&cursor)) ) { + * // place with element p + * } + * + * The cursor must be initialized to point to the list to iterate over. + */ +void *SList:: +iterate(SListNode **cursor) +{ + void *e; + + if ( cursor == NULL || *cursor==NULL ) return NULL; + if ( head == *cursor ) { *cursor = (*cursor)->next(); } + e = (*cursor)->elem(); + (*cursor) = (*cursor)->next(); + return e; +} + +/* add an element to end of list. */ +void SList:: +add(void *e) +{ + SListNode *p, *tail=NULL; + require(e!=NULL, "slist_add: attempting to add NULL list element"); + + p = new SListNode; + require(p!=NULL, "add: cannot alloc new list node"); + p->setElem(e); + if ( head == NULL ) + { + head = tail = p; + } + else /* find end of list */ + { + tail->setNext(p); + tail = p; + } +} + +void SList:: +lfree() +{ + SListNode *p,*q; + + if ( head==NULL ) return; /* empty list */ + for (p = head; p!=NULL; p=q) + { + q = p->next(); + free(p); + } +} + +PCCTS_AST *SList:: +to_ast(SList list) +{ + PCCTS_AST *t=NULL, *last=NULL; + SListNode *p; + + for (p = head; p!=NULL; p=p->next()) + { + PCCTS_AST *u = (PCCTS_AST *)p->elem(); + if ( last==NULL ) last = t = u; + else { last->setRight(u); last = u; } + } + return t; +} + +// MR23 +int SList::printMessage(FILE* pFile, const char* pFormat, ...) +{ + va_list marker; + va_start( marker, pFormat ); + int iRet = vfprintf(pFile, pFormat, marker); + va_end( marker ); + return iRet; +} diff --git a/scsilib/.clean b/scsilib/.clean new file mode 100755 index 0000000..1fb2644 --- /dev/null +++ b/scsilib/.clean @@ -0,0 +1,8 @@ +#!/bin/sh +rm -rf */OBJ */*/OBJ libs/* incs/* +rm -f core */core */*/core +rm -f .EDT* */.EDT* */*/.EDT* +rm -f .vedt* */.vedt* */*/.vedt* +rm -f *.bak */*.bak */*/*.bak +rm -f */tags */*/tags +rm -f */TAGS */*/TAGS diff --git a/scsilib/.cvsignore b/scsilib/.cvsignore new file mode 100644 index 0000000..981d97c --- /dev/null +++ b/scsilib/.cvsignore @@ -0,0 +1,3 @@ +Gmake.linux +Makefile +rc.pp diff --git a/scsilib/ABOUT b/scsilib/ABOUT new file mode 100644 index 0000000..da2a4d3 --- /dev/null +++ b/scsilib/ABOUT @@ -0,0 +1,37 @@ +This package contains the following software: + +- cdda2wav (an digital CD audio extraction program) + By Heiko Ei�feldt <heiko@hexco.de> + +- cdrecord (a CD recording program) + By J�rg Schilling <schilling@fokus.fhg.de> + +- mkisofs (an ISO-9660 filesystem image creator) + By J�rg Schilling schilling@fokus.fhg.de and + by James Pearson <jcpearso@ge.ucl.ac.uk> + +- mkhybrid (an ISO-9660/HFS filesystem image creator) + Link to mkisofs + +- several diagnostic programs for ISO-9660 + + - devdump dump a device or file in hex + + - isodump dump a device or file based on ISO-9660 + + - isoinfo analyze or list an ISO-9660 image + + - isovfy verify an ISO-9660 image + +- readcd (a stripped down version of scgskeleton) + By J�rg Schilling schilling@fokus.fhg.de and + may be used to read data CD's, to write to DVD-RAM + and to copy Solaris boot CD's + +- scgcheck (a program to validate the correct behavior + By J�rg Schilling schilling@fokus.fhg.de and + of the low level libscg code and the SCSI transport + code of the underlying OS). + +- libscg (a highly portable SCSI transport library) + By J�rg Schilling schilling@fokus.fhg.de and diff --git a/scsilib/AN-2.0 b/scsilib/AN-2.0 new file mode 100644 index 0000000..c504298 --- /dev/null +++ b/scsilib/AN-2.0 @@ -0,0 +1,1607 @@ +NEW features of cdrtools-2.0: + +Please have a look at the German open Source Center BerliOS at www.berlios.de +BerliOS will continue to support free hosting of cryptography projects even +when US laws change and don't allow to host cryptography projects in the USA. +Also look at sourcewell.berlios.de, the first Open Source announcement service +that itself is implemented as Open Source project. + +***************** Important news **************************** + +For the 'Slottable Source Plugin Module' SSPM Features read README.SSPM + +***************** Please Test ********************************* + +All: + +- Now using the "Slottable Source" feature of the makefile system. + This is the fist modular reusable portable makefile standard + in the open source world. + + To see a new feature call: "make tinfo" + +- config.sub now recognises "parisc-unknown-linux-gnu" + +- Circumvent some problems with GCC-3.0 on Linux + +- Removed printf() definitions from schily.h to avoid type clashes + +- Support for SCO (Caldera) OpenUNIX (aka. UnixWare 8) + +- Better support for Darwin-1.3 and 1.4 + + This is: + + - enhanced makefile system + + - type casts needed for unusual types used on Darwin + (e.g. sizeof() returns long!) + +- Schily support includefiles rearranged to make portability even + easier. + +- mconfig.h now defines IS_SCHILY to signal users of the + Schily makefilesystem, that the Schily portability environment + is being used. + +- now includes the forgotten mkdep-sco.sh that helps to better + work around the SCO C-compiler. + +- timedefs.h modified. Now the last schily portability support include + file hast been reworked to make portability even much easier. + +- schily.h & standard.h have been modified to hopefully finally solve + all type clash problems with size_t & spawn*() + +- Compile support for QNX Neutrino + +- Now we hopefully have floating point support for _all_ platforms + even those without *cvt() and without __dtoa(). Thanks to a hint + from Thomas Langer <Langer.Thomas@gmx.net> we now use strtod.c + to gert a fallback __dtoa() + +- Added an autoconf test for rcmd() so cdrtools now should compile + again on BeOS and AmigaOS where no rcmd() is present. + +- fixed fexec.c to make it compile ion QNX + +- Now the complete libschily is included although it it not needed + for cdrtools. There are two reasons for doing this: + + - Cdrtools is _the_ program that is heavily tested on + many different platforms, so I will get reports for + compile problems this way. + + - cdrtools becomes a base docking platform for the SSPM + system this way. Now any of the Schily tools may be included + and compiled inside the base portability platform 'cdrtools'. + +- New supported architctures: + s390-linux-cc.rul parisc-linux-cc.rul parisc64-linux-cc.rul + +- Large File support for IRIX-6.2 (added autoconf test for -n32 cc option) + +- Large File support for IRIX-6.5 now everything works correctly if the + OS supports Large Files by default in 32 bit mode (uses fseeko()/ftello() + if present. This could only be done by massively changing the autoconf code + stolen from GNUtar. + +- Support for SGI IRIX platform ip17-irix + +- Support for SGI IRIX-6.5 + +- Try to support recent BeOS (again) + + - Workaround in libschily/comerr.c for the nonstandard + big negative errno values on BeOS + +- libschily now includes floating point printf() for BeOS + +- fileluopen.c from libschily now compiles on BeOS (without O_NDELAY) + +- workaround for the nonstandard negative errno values on BeOS + +- Schily makefile RULES for AmigaOS added + +- getpagesize() emulation for BeOS to make cdda2wav compile on BeOS + +- New rule allows automatic fallback to GCC if the configured + default compiler could not be found. + +- statdefs.h enhanced + +- Many corrections to give less warnings on SCO Openserver + +- Support for NT-5.1 (WIN XP) added os-cygwin_nt-5.1.id + +- VMS script build_all.com now includes astoll.c so compilation + on VMS should work again. + +- New macros for max/min values of int*_t in utypes.h + +- Limit the different handling of packed bitfields for AIX to AIX CC. + +- Unfortunately fragementation of cdrecord has begun. + I noticed this fact recently when people started to ask me + senseless things which turned out to be a result of + a modified cdrtools source that I have not ben aware of. + + One main goal of cdrtools is to provide a platform indepenant + user interface which cannot be achieved if people change important + parts os the user interface. + For this reason, I changed the license in hope that this will + help at least to keep the user interface the same on all + platforms and on all distributions. + + Please keep in mind that fragmentation in many cases increases + my workload. There is no real reason for a modification, + and (even worse) the people who create modifications do not help + to keep my workload low in order to help me (and Heiko and James) + with the cdrtools project. People should rather contribute to + the project. Cdrtools should be free and actively mantained + in future. With increasing workload, I don't know how to do this. + + +- Add hints that compiling on unknown platforms wil only work if + "smake" is used. + +- Autoconf code for Large file support now handles Linux system include + file bugs that prevented correct behavior on 64 Bit Linux systems. + + +- Better autoconf code for the problems with mlock() & HP-UX-10.20 + +- Better autocheck code for available C-compilers on HP-UX + Now even a fallback from GCC to CC works. + +- Some changes to make compilation on 64 bit systems more correct + +- Added support for GNU Hurd to the Schily Makefilesystem + +- Cast pointerdiffs to int for printf() %.*s format and/or include + workarounds for 64 bit problems in this area. + +- Several modifications to make OS/2 work again + (e.g. -lsocket added) + +- fexec.c now uses a configurable PATH environment separator + to allow PATH lookup on OS/2 + +- A 20 year old extension has been removed from format.c + This caused printf() to interpret %X as %lX. This caused noticable + problems on IA-64. It should have created problems on True64 + and on 64 bit Sparc programs too but was not directly visible + due to a different stack content. + +- remove #elif to avoid a GCC-3.x warning + +- config.sub now knows about IA64 architecture + +- Makefilesystem now spports compiler specific optimization flags + +- Align_test.c now creates a better include file (using more () to + make sure the compiler created correct code). + +- Makefilesystem changed $(MAKE) to "$(MAKE)" to allow spaces + in pathnames + +- Correct autoconf test for broken OS like MAC OS X that do not + allow local malloc() implementations due to linker bugs. + +- Add autoconf test for strange clock_t definition method on Linux + +- README.ATAPI enhanced for all platforms + +- README.ATAPI now contains a hint on how to use ATAPI drives on HP-UX-11.x + +- Support for FreeBSD on Ultrasparc added to the makefile system + +- *roff'd man pages in .../doc dir re-created + +- Try to work around a bug in OpenBSD. + OpenBSD defines EOF in ctype.h but POSIX only mentions an EOF definition + for stdio.h. If we include ctype.h bfore schily.h on OpenBSD while + stdio.h has not been included, this will fail. + +/*--------------------------------------------------------------------------*/ + +Libparanoia (Ported by J�rg Schilling, originated by Monty xiphmont@mit.edu): + +- The paranoia code from cdparanoia (written by Monty xiphmont@mit.edu) + has been converted into a portable library. + +/*--------------------------------------------------------------------------*/ + +Libedc (Optimized by J�rg Schilling, originated by Heiko Ei�feldt heiko@hexco.de): + +- Changed to allow compilation on K&R compilers too + +- Speedup by 300% + The speedup is nearly processor independant. + + Pentium-233 2443 sectors/s 32x + 333Mhz-UltraSparc-IIi 6402 sectors/s 85x + 900Mhz-UltraSparc-III+ 22813 sectors/s 304x + Athlon-1000 24378 sectors/s 325x + Athlon-1700 40168 sectors/s 535x + + Depending on the speed of gettimeofday(), these numbers may be up to 5% + too low. + +- Code is now put under GPL. + +/*--------------------------------------------------------------------------*/ + +Libscg: + +- Trying to add a workaround for just another bug in the + sg driver in the Linux kernel. If a TIMEOUT occurs, + the error code does not indicate a TIMEOUT. + +- Better scg_open() error messages when trying to do scanbus on Linux + and no /dev/sg* or /dev/pg* could be opened. + +- Output Request Sense buffer with -debug when the USCSI interface is + used on Solaris. + +- First attempt for support for the new IOKit SCSI interface on MaxOS X + Darwin-1.4 and newer with much much help from + Constantine Sapuntzakis <csapuntz@Stanford.EDU> + + Unfortunately there is not yet support for SCSI devices nor + is there support for standard Bus,Target,Lun device namings. + I hope that bot may be added in the future. + + Volunteers who like to help with the libscg interface stuff + for Darwin-1.4 are welcome. + +- Try to make scsi-beos.c compile on new BeOS version 5 + +- First attempt to integrate the AmigaOS SCSI transport interface code + from Thomas Langer <Langer.Thomas@gmx.net> + +- Massive modicifation of the support code for SCO OpenServer 5.x + + As the kernel implementation contains several bugs, + the new code will by default not check for hard disks in scan mode. + + The code checks the following environment variables: + + "LIBSCG_SCAN_ALL" To force scanning for all SCSI targets. + "LIBSCG_SCSIUSERCMD" use old SCSIUSERCMD ioctl() + "LIBSCG_MAX_DMA" override MAX_DMA value, value must be number in kB + "LIBSCG_ENABLE_USB" enable access of USB devices + +- Version -> 0.6 + +- Adding support for the CDROM_SEND_PACKET ioctl() from cdrom.c + + Thanks to Alexander Kern <alex.kern@gmx.de> for the idea and first + code fragments for supporting the CDROM_SEND_PACKET ioctl() from + the cdrom.c kernel driver. Please note that this interface in principle + is completely unneeded but the Linux kernel is just a cluster of + code and does not support planned orthogonal interface systems. + For this reason we need CDROM_SEND_PACKET in order to work around a + bug in the linux kernel that prevents to use PCATA drives because + the kernel panics if you try to put ide-scsi on top of the PCATA + driver. + + The code is currently in "status nascendi" but usable with some trade offs. + + To use: call e.g. + + cdrecord -scanbus dev=ATAPI: + + cdrecord -dao -v speed=24 dev=ATAPI:0,0 .... + + Be careful! This code is only needed in order to be able to use + PCATA CD-writers on notebooks because there is a severe kernel bug. + Unfortunately, this bug causes the kernel to hang (and force you + to reboot) if you try to call: + + cdrecord -scanbus + + without the dev=ATAPI: option. + + In this case cdrecord will hang infintely and unkillable + in open("/dev/sg1", 2) => you need to reboot :-( + + Repeat by: Insert a PCATA CD-Writer in a Sony VAIO notebook and run + cdrecord -scanbus. + +- Enhanced list of SCSI Error texts from SCSI standard from 29.5.2001 + +- New callback function to allow execption handling to be done after + the current SCSI command did finish. + +- scsi-aix.c now uses UIntptr_t in alignement macro. + +- Some 64 bit casts in the USCSI code from scsi-sun.c + + For hints on the Linux Packet code in ide-cdrom.c read README.ATAPI + +- Introduce a workaround for a conceptional Bug in the Linux kernel + SCSI implementation. + + Linux is unable to distinct between a target selection timeut (e.g. switched + off target) and a command timeout (e.g. command needs more time than expected). + + If the detected command time is < 1 second, libscg will now assume a dead target. + +- Fix a bug with ATAPI in scsi-vms.c - now the SCSI status byte is OK + Thanks To Eberhard Heuser + +- Allow up to 26 IDE controlers in scsi-vms.c - Thanks to Chip Dancy + +- Do not open all /dev/scg* devices on Solaris if not in Scanbus mode + +- Handle ENXIO in Solaris USCSI interface code as indicator for a + switched off device. + +- Max DMA size for Linux ATAPI Packet interface code corrected. + Max DMA is 128k-1 and not 128k. + +- Support for recently defined new SCSI target types found in SCSI + standard. + +- New help system that lists all SCSI low level transports for a specific + platform together with their properties. + +- Allow consistent usage of alternate SCSI transport layers. + + Now the Solaris USCSI implementation and the (SuSE) Linux ATA implementation + behave similar and both allow dev=<Transport> as well as dev=<Transport>: + for -scanbus, e.g. + + cdrecord dev=USCSI -scanbus + cdrecord dev=USCSI: -scanbus + cdrecord dev=ATAPI -scanbus + cdrecord dev=ATAPI: -scanbus + + all work the same way. + +- Small change for Linux device initialization by request of Linus Torvalds + + The purpose of this change is to support a new SCSI transport interface + for ATAPI in Linux that came up with the latest developer Linux kernels + (e.g. Linux-2.5.43). This interface allows to send SCSI commands directly + to ATAPI drives without using ide-scsi and sg, but it has several pitfalls. + + While Linux allows to use DMA when using ide-scsi and sg if the + sector size is 2048 and the transfer buffer starts page aligned, the new + direct interface never uses DMA (acording to Linus Torvalds). So if you + write audio CDs or data CDs in RAW mode, there is no difference. If you + write data CDs in TAO or DAO mode, using ide-scsi and sg allows much + higher write speed. Note that this may change in future.... + + Notes for use: + + - You need to specify something like dev=/dev/hdc + Note that this is unsupported by libscg. + + - As long as there is no safe way for libscg to find out early that + this new interface is used, libscg may hang a bit on open. + This is caused by the fact that libscg is forced to read + from the open filedscriptor to clean up old Linux sg driver + interfaces. This was never a problem with /dev/sg*, but + when doing the same thing, this causes libscg to read content + from /dev/hd* + + - There is (currently) no way for cdrecord to scan for ATAPI + devices when using this interface. + + As long as this is true, you may want to prefer to use + + cdrecord dev=ATAPI: -scanbus + and + cdrecord dev=ATAPI:0,0 ... + instead. + +- Fix scsi-unixware.c to allow multiple opens. + +- Fixed several typo's. + +- Avoid to read from the media (when using the new experimental + Linux ATAPI transport) while trying to clear old sg driver status. + +- Woraround for Linux kernel design bug: CDROM_SEND_PACKET sets errno + to EINVAL in case SCSI sense key is "Invalid command". + +/*--------------------------------------------------------------------------*/ + +Rscsi: + +- RSCSI now works if the target is a Win32 system. + This is not done by changing rscsi.c but by fixing a bug + in Cygwin! + + The fix to Cygwin's rshd is posted in + + http://sources.redhat.com/ml/cygwin-apps/2001-05/msg00000.html + + Thanks to egor duda <deo@logos-m.ru> + + NOTE that in a few weeks this patch will be integrated into Cygwin + and cdrecord/RSCSI will work out of the box on a recent Cygwin release. + +- Now prints user ID & user Name into DEBUG file + +- Now using signal safe read/write functions. + +- Code now checks for HAVE_NETDB_H (added by request of + "Thomas" <Langer.Thomas@gmx.de> to help with AmigaOS port) + This should indicate whether there is support for rcmd() + in the OS. + +- Make it compile on BeOS + +- changed because GNU Hurd has no MAXHOSTNAMELEN + +- Return "PIPE" for hostname comparison if called from e.g. 'sshd'. + +/*--------------------------------------------------------------------------*/ + +Cdrecord: + +- New option -overburn + + This option has been added as many people seem to be unabe to understand + that they are going to write more than the official disk capacity from + reading cdrecord's output. Oveburnung now is no more done by default! + + NOTE that there even are some drives that prevent you from writing + exactly the official size and stop several hundreds of sectors before. + +- Do not print a warning for writing more than 90 minutes if the media is + a DVD + +- Fix for a problem with setting high priority on Win32 systems. + Thanks to egor duda <deo@logos-m.ru> + +- Sony MMC drives now work in -multi session mode. + There was a bug in cdrecord that was accepted by all other drives. + The bug did cause a temporary bad setup to the drive. + +- I hope that the 90 minute CD capacity warning now will finally + disappear for DVD writers. + +- Old test code removed that prevented cdrecord from being able + to write manually configured indices. Note that the index lists + from the *.inf files with using the -useinfo option alway worked. + +- -force will force cdrecord to ingnore any failed forced OPC. + currently this is only done if the drive does not support + forced OPC. + +- Do forced OPC before blanking a CD-RW + +- Driveropts "burnproof" renamed to "burnfree". + This has been done as this technology now appears in the MMC standard. + +- Cdrecord now shows whether BURN-Free is active. This makes + sense as Ricoh's "Just-Link" is enabled by default. + Unfortunately, the way "Just-link" is implemented is not compliant + with the MMC standard. We will have to wait until I get the needed + information from Ricoh. + +- Support for MMC RAW mode writing. + + This allows to do disk at once recording on Philips drives that + do not support SAO. + + You may write audio tracks in RAW mode. There are some new + and most likely transient options: + + -raw16 Write 2352 Bytes sectors + P+Q Subchannel + + -raw96r Write 2352 Bytes sectors + P+W Subchannel (R-W in raw mode) + + -raw96p Write 2352 Bytes sectors + P+W Subchannel (R-W in packed mode) + + Indices are fully supported in RAW mode. + + MCN & ISRC are not yet suported in RAW mode, they are silently discarded. + + I know that cdrecord currently does not work in RAW/R96P mode. + It is not clear whether this is a bug in cdrecord or in the Plextor + firmware as I did not yet found another drive that claimes to support + RAW7R96P. + + If you find other problems in RAW mode or if you find + new bugs introduced in old write modes, please send a bug report. + +- Cdrecord now checks the properties of the writer. If a specific write + mode is not supported by the writer, cdrecord warns you and makes + a suggestion for a similar alternate write mode. + + With the curent structure of cdrecord, it is not possible to silently + e.g. change the write mode from -dao to -raw96r + +- MMC compliant drives are automatically scanned for supported write modes. + This should help to make cdrecord work without manual static configuration. + My hope is still to have no need to know all drive properties in + advance, so new drives will continue to work as long as they + are standard comliant enough for cdrecord. + + NOTE for GUI implementors: + + the line starting with the text: + + "Checking possible write modes:" + + will go away in the near future. + + The line starting with: + + "Supported modes:" + + will remain and should be checked for possible write modes. + +- Fixed a bug in the option checking that prevented to write + data CD's at all. + + Now only "RAW data" CD's are flagged as expected. + +- Fixed a bug in the Firmware bug recognition system. + This bug did prevent cdrecord to work with Philips drives + when writing in RAW mode. + +- New options -copy & -nocopy to allow to modify the 'copy' bit + in audio subchannel data. + +- -scms option added to the man page and online help. + +- New model to compute SCSI transfersizes + +- -xa1 -xa2 sector typedefinitions changed. + +- Debug messages while checking possible write modes of MMC + compliant made optional. + +- RAW writing scatter sector function made more general + +- New functions to convert between 2448 and 2368 byte sectors + + NOTE: Read README.raw + +- add a forgotten if (xdebug) in drv_mmc.c. + This caused a superfluous write mode debug message to be printed + +- do installation of exit handlers (to reset SCSI state) earlier + +- Cdrecord now does not exit with 0 anymore when interrupted with ^C + during the waittime before starting to write. + +- First CD-Text support (can only copy CD-Text information from master + disk) + + Writing of CD-Text is supported for all drives that support + CD-Text in SAO write mode and for all drives that support + to write in RAW/RAW96R mode (use -raw96r in this case). + + NOTE: Read README.cdtext + +- Circumvent a bug in the system include files from Linux that + makes printf() a macro and prevented compilation with GCC-3.0 + +- Added some #include <stdio.h> to substitute missing printf() definitions + +- SAO/R16 mode removed from tests, it may never occur. + +- Changed some .min defines in structs to .pmin to avoid K&R complier + problems + +- better FIFO debug messages + +- New driver config table for Taiyo Yuden EW-50. + This dive is like a Philips CDD-521 but has been reported to + swab audio data. + +- rscsi client code now uses buffered read to speed up on Cygwin + +- rscsi client code now uses signal safe read/write functions + +- Cdrecod now does not open/close the tray anymore if the disk + is going to be erased. + +- modify -version output if Clone writing support is present + +- A new driver has been added that first checks the media if the drive + supports to write CD & DVD. + +- Behaviour of the function that reads fs= tsize= and similar + corrected. + +- Modified driver interface for better DVD support + +- FIFO Code now checks for HAVE_FORK (added by request of + "Thomas" <Langer.Thomas@gmx.de> to help with AmigaOS port) + +- Better messages when trying to write more than the amount of data + that fits on a DVD. + +- The DVD driver now reports a DVD media back to the high level code. + +- correctly use the buffer capacity code from the driver instead + of the MMC-2 read buffer cap code directly + +- Support for the unusual not ready error code of the CyberDrive CW038D + +- CD-Text Code now also accepts Text File without 4 byte Size header + +- CD-Text file read code now is able to do CRC error correction + Note that only songle bit errors per 18 byte pack. + +- CD-text Autoring support: + + CD-text may now be based on fields found in the *.inf files + created by cdda2wav. + + To create a CD with CD-Text based on information from freedb.org + call: + + 1) cdda2wav -B -v255 -L + 2) cdrecord {-dao!-raw96r} -v -useinfo -text *.wav + + CD-text TODO: + + - Check whether the *.inf files are all from the same CD + and clear some CD-text fields that are only valid if + they relate to one CD only. + + - Add some more fields (mainly a dficiency of cdda2wav) + + - Support multi language text + + - Support character coding other than ISO-9959-1 + + CD-text may be based on fields found in the *.inf files + created by cdda2wav. + + NOTE: Read README.cdtext + +- better messages for CD manufacturer codes that are not in the + latest free Orange forum table. + +- Default usage code is now only 6 lines so the error message + does no longer scroll out the screen. If yu like to get the old + long usage information, call cdrecord -help + +- move 'dd' like number conversion stuff into getnum.c + +- Allow the /etc/default/cdrecord parsing code to be used by + readcd too (as documented in the man page) + +- First support for Plextor's VariRec feature in the PX-W4012 + I am not sure about the final user interface. + For now, call e.g. cdrecord speed=4 driveropts=varirec=-1 + for all audio CDs. Allowed varirec parameters are -2, -1, 0, 1, 2 + VariRec only works at write speed 4. + +- Print the actual current write speed in verbose mode. + +- DVD-R code (undisclosed) now supports: + Vendor_info : 'MATSHITA' + Identifikation : 'DVD-RAM LF-D310 ' + Revision : 'A116' + +- Support for SCMS from *.inf files + Note that you need to use cdda2wav/cdrecord that have fitting versions + because of this change. Otherwise cdrecord may add SCMS copy + protection. + +- RAW mode now honors COPY bit and SCMS coding. + +- Avoid coredump with "cdrecord textfile= non/existant ..." + +- Corrected printf() formats for verbose printing to hold enough + space for media > 1 GB (DVD) + +- Corrected printf() formats to make the write speed non-jumping. + +- If called from a GUI, cdrecord now reads from "stderr" if + the CD-input-data is from "stdin". + If it turns out that stderr is not open for reading, cdrecord + waits to receive a SIGUSR1 + +- Better printouts for the DISC-ids covered by the orange forum embargo. + +- DVD structure structure definition enhanced to reflect + current standard. + +- new option gracetime= + +- Try to abort DAO recording with a flush_buffer() if ^C is hit. + +- Try to make cdrecord behave more polite for platforms (like Cygwin) + that don't support large files when the DVD data to be written + is read from stdin. + + mkisofs ... | cdrecord ... - + + will now work for DVDs on non large file OS + +- Call flush buffer in silent mode to avoid error messages with + cdrecord -toc called on a CD-ROM drive. + +- Avoid core dump is a single .inf file is missing and -text + option is used. + +- Data structures modified to allow new features in the future. + +- Fixed a bug that caused cdrecord to ignore escaped file type + args if they looked like a valid option (e.g.): + + cdrecord dev=0,0 -dao -v -- speed=8 + + "speed=8" should be handled as if it was a filename but was + skipped. + +- Print write mode when starting to write. + I hope that this helps me to understand incorrect "bug reports" + from lazy people who do not include their cdrecord command line. + +- Printing ATIP information is now caused by a separate (internal) flag + and not ny a hack. + +- Do not allow to write to ultra low speed RW media if the drive + is not able to write at 2x or 1x. This may be circumvented + with -force. + +- Do not allow to write to high speed RW media if the drive is not + a high speed RW drive. This may be circumvented with -force. + +- Data structures modified to allow new features in the future. + + Trying to make driver interface simpler and cleaner. This resulted + in a major rewrite of the driver interface. + + - please test if multi session with TEAC CDR-50/CDR-55 + still works. + + As a lot has been changed in the driver interface, please test + if bugs have been introduced! + +- New test that prevents to write CD-RW media too slow + +- Display of current DVD write speed now correct and no more based on + single speed CD but on single speed DVD. + +- Moving SAO/RAW start code from cdrecord.c into drv_mmc.c + allows clean DVD-R/RW driver interface code. + Now cdrecord -dao will work correctly (as expected) even for DVDs + +- speed= option no longer defaults to speed=1 + Each driver now includes a default speed and a maximum speed. + If the maximum speed in the driver is wrong, use -force to overwrite. + + Please send feedback if my assumptions on write speed are wrong: + + - No drive using the Philips CDD-521 command set is faster + or slower than 2x + + - No drive using the Yamaha CDR-100 driver is faster than 4x + No drive using the Yamaha CDR-100 driver is slower than 2x + + - The Tayo Yuden CW-50 is 2x + + - The Kodak PCD-600 is 6x + +- Abort when the last track # of a multi session disk would be > 99 + +- Data structures modified to allow new features in the future. + +- Better bessages for CD-RW where the speed ofthe media does not match + the properties of the writer. + +- Avoid to reload media in -dummy RAW mode. + +- Correctly abort if there was a problem when writing CD-Text in the LEAD-IN. + +- Again: Data structures modified to allow new features in the future. + + This release uses the new data structurec to allow to write ISRC/MCN + in RAW mode. + +- Fixed a bug that caused cdrecord to write a wrong relative time + into the subchannel data when writing audio CDs in RAW mode. + This affected the pregap sectors if pregap size was != 0. + +- Allow cdrecord to write ISRC & MCN even in RAW mode. + +- Allow Simulation driver cdr_simul and dvd_simul to simulate any write + mode. + +- Simulation driver cdr_simul and dvd_simul changed so no reload on the + real background drive occurs. + +- Since last release , the new data structures allow to write + ISRC/MCN in RAW mode. This now makes RAW mode fully usable for + audio CDs. NOTE: if you find any problems with CDs written in SAO + mode, first try to write the same CD in RAW mode if your + drive supports to write in RAW mode. Tere are a lot of drives + that have rotten firmware and create broken CDs in DAO mode. + +- Support for Yahama Audio Master Quality Recording. + + This support is switched on via driveropts=audiomaster + + I am sorry, but I had to do major changes in the MMC + driver in order to be able to support Audio Master. + This may have affected all other driveropts= + too. Please test and keep in mind that I like to have + the mext major release in a few weeks. + + When audiomaster has been specified, BURN-Free recording + is disabled and - as the visible size of the medium + decreases - a second disk size check is done after + Audio Master has been turned on. + +- man page enhanced according to new features + +- Short Usage funtion now includes a hint on how to + obtain the list of possible driveropts= parameters + +- Include the tags + + "VARIREC ", "AUDIOMASTER ", "FORCESPEED " + + In the "Driver flags" line that is visible with + + cdrecord -checkdrive. + +- cdrecord driveropts=help now includes + + "varirec=" and "audiomaster" + + +- Support for writing data sectors in RAW mode has been added + to the GPL#ed version of cdrecord. + Note that writing data sectors in RAW mode is a highly CPU + intense task. For this reason, cdrecord first checks whether + it would be possible to do the requested job reliably. + If it is questionable whether the job could be done in the + desired speed, cdrecord aborts with a related message. + + The max theoretical speed (not including the writing load) + is printed in a new line starting with: "Encoding speed :". + Cdrecord allows half of this speed. + +- Allow RAW writing of data sectors to work correctly without + the need of specifying -data + +- Allow spaces as delimiters between different tags in a single + line in the file /etc/default/cdrecord + +- Support for Ricoh (and others) Just Link + + This support is switched on via driveropts=burnfree + + Note that Just Link is by default swichted on in the drive + but as Just Link may create CDs that are no 100% OK, + cdrecord now by default switches it off. Now you definitely + need to specify driveropts=burnfree to switch Just Link on + again. + + If you call cdrecord dev=... -checkdrive you will see + the TAG "BURNFREE" as a hint that either Burn-Proof or + Just Link is supported. + +- "Turning .... " messages for drive special functiions are + now printed to stdout + +- Limited display (once every 1 MB) of the drives internal buffer + RAM fill ratio. + +- Display the minimal drive buffer fill ratio a the end of the write + process. + +- Display number of predicted drive buffer underruns based on the + fill ratio of the drive buffer (incremented if fill ratio is < 5%). + +- Display average write speed at the end of the write process. + In dao mode, this includes the time needed to write the lead in and + thus is not 100& correct (value is too low). + +- Display of the number of times the Buffer underrun protection + has been active for drives where the manufacturer send me the needed + information (Ricoh, Yamaha, Aopen). It may work for other drives too + but there is no guarantee. + +- Fixed a bug in the driveropts= parsing routine. + +- New driveropts= option "forcespeed". Use with extreme care as this + will force several drives ((Ricoh, Yamaha, Aopen, ...) to write with + the selected high speed although the mediaum is too bad for this + operation. + +- New driveropts= option "tattooinfo". Use together with -checkrive + to retrieve the information about the picture size that will fit. + + The result will be someting like: + + DiskT@2 inner r: 265 + DiskT@2 outer r: 583 + DiskT@2 image size: 3744 x 318 pixel. + +- New driveropts= option "tattoofile=". Use together with -checkrive + to write an image of the right size to disk. + + Read README.DiskT@2 + +- Rearrange the order of the new statistics printing + +- Allow several of the new statistics to be printed even if cdrecord + aborts due to an error. + +- Let the old Philips drive use the common CD media 'reload' function. + +- Try to find out if a drive is MMC, MMC-2 or MMC-3 compliant. + - see cdrecord -checkdrive + +- Suppress printing oof the average write speed if the size of the + tracks is not known prior to start CD writing + +- ATIP printing (cdrecord -atip) enhanced to support Ultra high speed + CD-RW media. + +- Check whether somebody likes to write a Ultra high speed CD-RW on + an improper writer + +- Print MMC conformance level of the drive based on content of + SCSI mode page 2A. + +- Print more information for MMC-2 & MMC-3 drives with cdrecord -prcap + +- The new true CAV Plexwriter 482448 is now supported. + + Please note that it is not easy to write at 48x. You definitely need + a correct DMA setup to optimal values. + + Also note switching on Burn-Proof will reduce the max speed to 40x + so it may be that you don't need Burn-Proof if you simply reduce speed + to 40x manually + +- make sure that using both -copy and -useinfo will not result in unclear state + Instead the content of the *.inf files will be used + +- Simulation driver (cdr_simul / dvd_simul) now uses correct speed ratio + for DVDs + +- Simulation driver now supports fake "Next writable address" function. + +- On Linux usleep() is very unacurate, meter the real sleep time + and cumulate a correction value. This allows the simulation driver + to simulate the correct write speed. + +- Added a note to Heiko Ei�feldt's libedc when printing RAW encoding speed + +- Limit gracetime to 999 seconds and make output correct even for + times > 9 seconds. + +- Corrected a bug in the MMC driver that caused cdrecord to use the + wrong place for current speed when doing MMC/MMC-3 dependant stuff + +- cdrecord -prcap will now use the same format for MMC & MMC-3 drives + rsulting in a better readability. + +- Don't print write time statistics if writing did not yet start + +- Try to handle drives that don't support to write at speed 1 but + will fail if you try to call cdrecord speed=1 ... + +- New option -immed tells cdrecord to set the SCSI "IMMED" flag in certain + commands. + + This option is not needed if your PC has been configured correctly. + However, ATAPI drives usually cannnot do disconnect/reconnect. + As a result, the PC may hang with long lasting commands if the CD-writer + has been connected to the same IDE cable as the harddisk. A correct + solution would be to set up a correct cabling but there seem to be + notebooks around that have been set up the wrong way by the manufacturer. + As it is impossible to fix this problem in notebooks, -immed has been + added. Use this option with care and do not expect cdrecord to work + correctly if it has been called with -immed. + +- -force will not completely removeany speed restrictions for writing in RAW + mode. Instead, only the speed that a single CPU allows will be permitted + by cdrecord. This still has a high potential for a buffer underrun. + By default cdrecord still is limited to half the encoding speed that + a single CPU allows. Even this may result in a buffer underrun on Linux + as Linux does not use DMA for IDE when the sector size is != 2048 bytes + which is true in RAW write mode. + +- If the environment variable "CDR_FORCERAWSPEED" is set, this will have + the same results for RAW speed as using -force. However, -force has more + general effects and should be avoided. + +- Fixed a bug in fifo.c introduced with the driver interface change. + Now cdrecord compiles again on VMS (without FIFO). + Thanks to Eberhard Heuser. + +- Allow cdrecord to compile without libedc + Thanks to Eberhard Heuser. + +- Run read buffer capacity in silent mode. + This is needed because drives with buggy firmware like the CW-7585 + did cause hundreds of "command sequence erorrs" to be emmited when + trying to read the current drive buffer fill ratio. + +- Fixed man page to correctly call SAO mode SAO and not DAO. + +- Encoding speed is contend dependant. Initalize test buffer + before doing a libedc speed test to make the result independant + from grabage on the stack. + +- Support for libscg help system + +- Warn to use cdrecord blank=all if a drive rejects cdrecord blank=fast + +- Fixed a bug that became obvious with Yamaha AudioMaster mode and CD-Text + The problem was caused by the fact that cdrecord did not allow to overwrite + the lead in start time in cdrecord's internal data structures. + +- Fixed a bug with recognition of complete disks that came up after cdrecord + did allow to deal with >= 90 minute CD's. + +- Changed Text "BURN-Free was not used" to "BURN-Free was never needed" because + people did believe that the old text means that Burn-Proof has been disabled. + +- Man page now includes a hint that padsize is always using 2048 as sector size. + +- Fixed a bug with padsize=xxx if sector size was not 2048 bytes. + Cdrecord in this case did just divide the number of pad bytes by the + number of bytes in an output sized sector (e.g. 2448 or 2352 bytes). + This did result in a too low number of padding sectors. + The fix caused a complete rewrite of the pad size handling. + +- Treat packet mode similar to normal writing: Print Drive buffer fill ratio + and current write speed. + +- Treat padding similar to normal writing: Print Drive buffer fill ratio and + current write speed. + +- Make verbose printing consistent and non-jumping + +- A new experimental feature of the -immed flag is to + tell cdrecord to try to wait short times wile writing + to the media. This is expected to free the IDE bus if + the CD/DVD writer and the data source are connected to + the same IDE cable. In this case, the CD/DVD writer + would otherwise usually block the IDE bus for nearly + all the time making it impossible to fetch data from + the source drive. + + As this is an experimental feature, I would like to get feedback. + + +- #ifdef _POSIX_MEMLOCK/_POSIX_PRIORITY_SCHEDULING Tests now + POSIX 2001 compliant + +- Do not try to close fd if running on an OS that does not use an fd + to mmap() chared memory from anonymous pages. + +- Print Orange Forum embargo warning only if ATIP minutes == 97 + because some DVD writer return junk with read ATIP + +- New option minbuf= to choose the mininum drive buffer fill ratio + for the ATAPI wait option that is intended to forcibly free the + IDE bus to avoid buffer underruns with bad HW configurations. + The permitted range is 25..95 for 25%..95% buffer fill ratio. + +- minbuf= may switch on the ATAPI wait option without enabling + the SCSI Immed option. + +- Forcibly switch on -v for now if the ATAPI wait option has been + selected. This is needed because due to a bug, this option will + not work without -v + +- Make FIFO code work on AmigaOS + + +For Yamaha Disk Tatoo features read README.DiskT@2 + +/*--------------------------------------------------------------------------*/ + +Cdda2wav (By Heiko Ei�feldt heiko@hexco.de): + +- Changes to make cdda2wav compile better on Alpha/True64 + +- Restructured to better use the schily makefile portability structures. + +- Changed handling of Table of contents. Now the more informative + methods of Read full toc are being used in favor to the old SCSI readtoc + command. For Sony methods, the fallback is the old method. + The new methods are available on MMC drives and modern drives with + Sony command sets. It should enhance access to very weird multi session + cds. + + ************** + NOTE: If your drive still has problems to copy such non-CD's, there + is a simple hack to allow the disk to be copied on all drives: + + Use a (black) whiteboard pen (non-permanent) and paint on the + space directly outside the visible ring that is in the middle + of the non-CD. This is the space where the broken TOC from the + second session is located. + + After doing the copy please return the disk to the dealer and + tell the dealer that this is broken goods. This is the only way + to stop the big groups to defraud the customers. + ************* + +- Temporary hack to fix a bug in the ISRC code that caused the ISRC + string to be shortened by one character. + +- fixed ioctl handling of toc entries + +- checked ISRC retrieval (MMC + Plextor) + +- more checking for weird CDs with wrong track types + +- bugfix in setuid.c + +- read full toc method extended to a data track in the second + session for cd-extra/enhanced cd recognition + +- if the tracks in the TOC are labelled as data, this is checked + and corrected if untrue + +- show cd text disc identification, if one exist + +- a new perl script to generate a binary cdtext file for use with + cdrecord. This is currently very simple, but it enables you to + create cd-text enriched copies from non cd-text originals. + For a hint how to use the new perl script see the CD-text usage + notes above. + + +- New option -L to ask freedb.freedb.org for CDDB information. + This alllows to automatically create CD-Text CDs. + +- correct TOC endianess for FreeBSD ioctl interface. + +- Fixed a bug that caused cdda2wav to dump core with certain + CD-Text data. + +- new option -L changed. Now a numerical parameter (0 or 1) + defines the handling of multiple cddbp entries. + 0 enters user interactive mode. + 1 take the first entry unconditionally. + I still need a reasonable way for gui interaction in this case! + Proposals are welcome. + +- made cddbp handling for mixed mode cds more robust. + It is unclear yet, if data tracks have to be included in the + query. Anybody knows the definitive answer? + +- Better TOC ADDR/CRTL (red book) handling + +- Better method to scan for indices. + +- Support for SCMS in *.inf files + +- Better SUID/SGID handling + +- new script cddda2ogg + +- bugfix deemphasizing (thanks to Klaus Wolterec) + +- bugfix rounding error (creation of info files) + +- added AlbumPerformer entry in info files + +- integration of Monty's libparanoia + +- switch to J�rgs getargs option handling + +- Fix some bugs with option parsing introduced with the new option + parsing using getargs() + +- New option -version to make cdrtools behave similar + +- New option paraopts=opts for paranoia options. + +- Print Paranoia statistics result at end of every track. + +- prepare for better recording of discs with illegal TOCs + +- prepare for non-english cd_text languages + +- rewrite of the TOC handling code (now multisession capable + and much more robust) + +- add a fallback method (shmat()) for failed mmap() + +- linux bug workaround: open() sound device does block when device is busy. + +- several code cleanups, some 64-bit portability bugfixes + +- Fixed shell script 'cdda2mp3.new' to correctly use "#!/bin/sh" + +- Fixed a bug (introduced while converting to getargs()) that caused + cdda2wav to dump core on OS that implement read only text + correctly like Solaris does) if compled with gcc or Sun CC COPTX=-xstrconst + +- Remove old unused getopt() code. + +- Check DMA residual count + +- FreeBSD cooked ioctl() Byte swapping now finally OK? + +- Fixed a bug that caused cdda2wav to return wrong byteorder + on Big endian machines if -paranoia has been specified + +- fix several CDDB query bugs +- support CDDBP protocol 5 + +- customizable CDDBP server and port settings. + +- Fixed a bug in the paranoia calling code that caused + cdda2wav to try to access one sector too far on the media + if in paranoia mode. + +- Allow again compilation on FreeBSD + +- bugfix for CD Extra, when copyright messages were present + +- patch from Kyle to make CD extra handling more robust + +- bugfix for wrong warning message 'no generation of info files' + due to incomplete length + +- new verbose suboptions. Strings will finally replace the + tedious binary masks. For script compatibility the special + form of -v255 will be recognized for some releases. + -vhelp will show the new strings. +- reworked the toc display code to make it more orthogonal. + +- changed option 'speed-select' to 'speed' for better interoperability + +- Temporary added -v<number> for compatibility with old GUI programs. + Note: -v<number> is outdated and will be removed soon. + +- Implement a temporary compatibility bug for the -v option. + +- Support for libscg help system + +- Man page fixed + +- Fix for an uninitialized variable + +- New exit codes for xcdroast + +- Fix for a CDDB bug: need to use lead out start for play time + +- Fix for a CDDB bug: Allow whitepsace in Genre + +- Fix for a CDDB bug: need to count data tracks too + +/*--------------------------------------------------------------------------*/ + +Readcd: + +- better error recovery with -noerror + +- error handling increased + +- Handle signals and other aborts by restoring old drive state + +- Set PF bit with mode select. + +- New option -quiet to suppress primary SCSI error messages + in read CD error handling + This are the messages that are printed before entering the + retry mode. + +- Secondary SCSI error messages are now suppressed by default, + they may be turned on again with -verbose + This are the messages that are printed in -noerror + retry mode. + +- Better handling of C2 scans on unreadable data disks. + +- use comerrno() instead of comerr() if the drive is not ready + as errno is not valid after that test. + +- Enhanced output for C2 error scan. + +- Now use /etc/default/cdrecord as documented in the man page. + +- Better behavior with extreme badly readable media. + +- List number of completely unreadable sectors in addition to + the C2 error count. + +- Man page updated to contain all options + +- New option speed= to allow reading at slower speed and avoid read error + caused by vibrations of the media. + +- added new option -overhead to meter SCSI command execution overhead. + +/*--------------------------------------------------------------------------*/ + +Scgcheck: + +- Fixed Makefile so scgcheck now compiles on FreeBSD + +/*--------------------------------------------------------------------------*/ + +Mkisofs (By J�rg Schilling and James Pearson j.pearson@ge.ucl.ac.uk): + +- Man page updated and corrected. + +- Try to avoid the C-compiler warnings for getopt.c that are caused + by the non-confirming way of hacking used by FSF people + +- isoinfo now corectly displays file with filesize > 1 GB + +- isoinfo now implements a new option -s that displays the size + of the files in multiples of the sector size (2048 Bytes) + +- libhfs_iso reworked to use timedefs.h from schily portability support. + +- Better error messages for ISO and Rock Ridge directory sort problems + +- Preserves HFS file dates for AppleDouble, AppleSingle and NetaTalk files + +- Fixed a problem from an uninitialized variable in desktop.c + that caused random effects in Apple CD's + +- better documentation for README.sort/README.hide from James Pearson + +- Fixed a bug in sort code that caused the compare function to behave + symmetric when called c(a,b) vs. c(b,a) + +- First UDF support via -udf option - thanks to Ben Rudiak-Gould. + + Note that the UDF support is not what you might indend. It is currently + wired to the Joliet tree which is a bad idea. It also does not yet + support Symbolic Links, user ID's and similar. + +- Write messages with more correct size names for the floppy eltorito + boot images + +- Added a missing prototype in getopt.c + +- isodump.c isoinfo.c isovfy.c: + Correctly handle symlinks + use offsetof(struct iso_directory_record, name[0]) instead of + sizeof(struct iso_directory_record) - sizeof(idr->name) + +- Fixed a check in the Apple HFS code that used strcmp for + data that could contain null bytes. + +- Introduced many casts to enhance portability. + This was needed for GNU fnmatch.c and the HFS support lib libhfs_iso + +- Use Protoyped function definitions for hash.c to allow old UNIX variants + where sizeof(dev_t) is < sizeof(int) + +- Fixed a check in the Apple HFS code that used strcmp for + data that could contain null bytes. + +- Introduced many casts to enhance portability. + This was needed for GNU fnmatch.c and the HFS support lib libhfs_iso + +- Use Protoyped function definitions for hash.c to allow old UNIX variants + where sizeof(dev_t) is < sizeof(int) + +- Support generic boot code if session does not start at sector 0. + +- Fixed a minor bug with HFS labels & multi-session + Thanks to James Pearson + +- Only print a short Usage if mkisofs detected a usage error. + +- -z option now working to create CDs in a format with Linux proprietary + Rock Ridge extensions for transparent compression. + + This is a patch from H.P. Anvin. It makes only sense with Linux-2.4.14 + or later. + +- New option -debug + +- Correctly use stat()/lstat() with graft points + +- Fixed a bug with escape character handling in graft point handling. + +- Make the graft point a directory if the file it should point to + is a directory. + +- Correctly handle non-canonical filenames with graft points. + + .////././///test=OBJ/sparc-sunos5-cc/ will now work correctly + and not result in a corrupted ISO-Filesystem. + +- Canonicalize graft points so commands like: + + mkisofs -graft-points /a/b/././//=some_dir + and + mkisofs -graft-points /a/b/../c/=some_dir + + will not cause broken ISO images anymore. + +- Avoid unwanted information in debug information on disk. + +- Allow the -sort option to work with the Eltorito Boot Catalogue + +- Allow '-' to be part of the ISO-9660 filename if -no-iso-translate + has been specified. + Thanks for this hint from Georgy Salnikov (sge@nmr.nioch.nsc.ru) + from Novosibirsk, Russia. + +- Try to avoid an integer overflow with the -C option and DVDs + +- Try to fix (very old) rotten code in various files that did cause + integer overflows for files > 2 GB - 2kB. + + Inconsistent use of (always diferent) hand crufted code using + 2048, 2047, ... instead of SECTOR_SIZE, ISO_ROUND_UP(), ... + + Note that this is not only of interest for DVDs as mkisofs could + believe that > 2 GB of data would fit on a CD. + +- New code to print file type names. + +- Some more changes to reduce the probability of integer overflows + in size computations. + +- Fixed a bug in the code that removes sensitive information from + the command line. + +- Add text strings with descritpive text to the output_fragment structures + +- verbose > 1 (use -v) writes debug info for output fragments. + This uses the new strings introduced with the last version. + +- isoinfo now uses getargs() and includes -version and -help + options. + +- isoinfo now is able to find out that Joliet information is + present if the disk contains illegal Joliet UNICODE escape code. + This seem to happen with disks written with Adaptecs programs. + +- isoinfo has new option -debug that prints more information + from the Primary volume descriptor. + +- Support for Apple HFS on Mac OS X Thanks to James Pearson. + +- Support for more then 65535 directories as only the parent entries + need to fit into the path tables. + +- Full DVD-Video support thanks to Olaf Beck - olaf_sc@yahoo.com + +- Avoid a C-compler warning caused by mkisofs.h + +- Fixed a bug in the DEBUG code from the DVD-Video enhancements + +- Allow symlink targets to be up to 1024 bytes + +- devdump/isodump/isovfy now use getallargs() and implement -help/-version + +- If UDF but no Joliet is used, UDF filenames may be 255 chars long. + Note that this is still hack. + +- From James: New option -joliet-long to allow 103 UNICODE characters with + Joliet. This is not Joliet compliant but several other programs + also create long Joliet names. + +- Fixed a minor C non-compliance in ifo_read.c + +- Allow symlink targets to be up to 1024 bytes + +- devdump/isodump/isovfy now use getallargs() and implement -help/-version + +- If UDF but no Joliet is used, UDF filenames may be 255 chars long. + Note that this is still hack. + +- From James: New option -joliet-long to allow 103 UNICODE characters with + Joliet. This is not Joliet compliant but several other programs + also create long Joliet names. + +- Correct a minor problem with K&R compilers for the programs + in mkisofs/diag/ + +- Make fire PATH_MAX is defined in isoinfo.c too. + +- Make sure UDF directory permissions include 'execute permission'. + +- A patch from James that make mkisofs able to create a HFS volume < 4 GB. + +- Support for MS code page 1250 (Slavic/Central Europe) added. + Thanks to Petr Balas petr@balas.cz + +- A patch from James that make mkisofs able to create a HFS volume > 4 GB. + +- A new option -hfs-parms for better HFS support for HFS volumes > 4 GB + from James Pearson + +- Fixed several typos in the man page and the source + +- Belly based speudo fix for a problem with mkisofs -f (follow) + and symlinks to directories where directory content was + missing with the old version. The new version is most likely better + and we (James and I) could not find problems with the new version. + +- Make "HFS_TYPE" and "HFS_CREATOR" work as documented in ~/.mkisofsrc + +- Fixed a small typo in isofinfo.c + +- As mkisofs -f has bugs that cannot be fixed for this release, I decided + to mark the '-f' Option as non-functional. People who use it will be warned + that it does not work correctly. + +- Sort VIDEO_TS.IFO to be the first entry in VIDEO_TS/ woth -dvd-video + +- Disable Joliet if -dvd-video has been specified. This needs to be done to + allow the change above. + +- Correctly handle files > 1GB on the UDF filesystem. + Thanks to Wei DING <ding@memory-tech.co.jp> for the patch. + +- Add support for Code Page 1251 + +- Koi8-u added to libunls + +- Fix a nasty bug in the UDF handling part that caused mkisofs to + create completely broken filesystem images if directories have been + nested deeper than 8 and -D has not been specified. + +- Include a new piece of code that causes mkisofs to abort with an + error message if it turns out that the block numbers estimated + during the sizing phase do not match the block numbers in the + write phase. + +- Enabled a piece of code that has been introduced 2 years ago and that + causes mkisofs to prevent deep directory relocation if Rock Ridge + has not been spacified. + + If you like mkisofs not to omit the part of the directory tree that + is nested too deep, specify either -R, -r or -D. + + +TODO: + - read Joliet filenames with multi-session if no TRANS.TBL + or RR is present. I am looking for a volouteer for this task: + Peter Berendi <berendi2@webdesign.hu> announced that he likes + to be the volounteer for this task. + + Unfortunately, I did no hear again from him, but I got + a proposal from + "Krisztian Gede" <nameless@mail.datanet.hu> + who also likes to do the job. + + Note that this can never be 100% correct as there is no relation + between the names on the master (UNIX) filesystem, the ISO-9660 + names and the Joliet names. Only the Rock Ridge names are + untranslated with respect to the original files on the + master (UNIX) filesystem. + + - implement Yellow book compliant XA extended dir attributes + + - add libecc/edc for CDI and similar. + This may not be needed if we ise VCDimager and recent + cdrecord versions. + + +CYGWIN NT-4.0 NOTES: + +To compile on Cygwin32, get Cygwin and install it. +For more information read README.win32 + +The files are located on: + +ftp://ftp.berlios.de/pub/cdrecord/alpha ... + +NOTE: These tar archives are 100% ansi compatible. Solaris 2.x tar and GNU + tar may get some minor trouble. + +WARNING: Do not use 'mc' to extract the tar file! + All mc versions before 4.0.14 cannot extract symbolic links correctly. + +WARNING: Do not use 'winzip' to extract the tar file! + Winzip cannot extract symbolic links correctly. + +Joerg diff --git a/scsilib/AN-2.01 b/scsilib/AN-2.01 new file mode 100644 index 0000000..c967222 --- /dev/null +++ b/scsilib/AN-2.01 @@ -0,0 +1,1496 @@ +Please have a look at the German open Source Center BerliOS at www.berlios.de +BerliOS will continue to support free hosting of cryptography projects even +when US laws change and don't allow to host cryptography projects in the USA. +Also look at sourcewell.berlios.de, the first Open Source announcement service +that itself is implemented as Open Source project. + +***************** Important news **************************** + +For the 'Slottable Source Plugin Module' SSPM Features read README.SSPM + +***************** Please Test ********************************* + +NEW features of cdrtools-2.01: + + +All: + +- Support for the ELF format in BSDi 4.x + +- Allow floating point printing on OS/2. This has been possible + since 11/2001 but OS/2 has been forgotten. + +- Correct OS/2 ranlib handling + +- New architecture 9000-831-hp + +- Include +DAportable in HP-UX cc options + +- README.hpux enhanced to include hints on how to compile 64 bit + binaries. + +- Support for NetBSD on PPC (macppc-netbsd-cc) + +- portable getdomainname() replacement now supports to get the domainname + from /etc/resolv.conf. This allows usage even on OS/2 + +- Typo in DEFAULTS files fixed + +- New generic target for symlinks + +- New file rename.c for portability part of libschily + +- Better Next STep support: + + - Some workarounds for broken unistd.h + + - -lkvm removed from Next Step config. + + - waitdefs.h fixed for very old BSD based systems (~ 1980) + like Next STep + + - strdup() moved into portability part of libschily + + - fixed typo in fctldefs.h R_RDONLY -> O_RDONLY + + - New file ttydefs.h includes portability phrases from ved and bsh. + + - Added an autoconf test for buggy termios.h in Next Step. + Next STep provides fully functional termios.h but tcgetattt(), ... + is missing in libc. + + - Test for clock_t changed to deal with a bug in Next STep. + Next Step illegally needs sys/time.h for clock_t + + +- Make recently introduced symlink install use relative symlinks instead + of absolute symlinks. + +- Change autoconf/statdefs.h to support nanosecond support for SCO + UnixWare and FreeBSD + +- Call conf/mkdep-sco.sh via sh to be independent from 'x' bit. + +- libschily/rename.c fixed for SCO Openserver fo avoid warning + for redefinition of MAXPATHNAME + +- libschily/usleep.c fixed to avoid SCO Openserver warning about + non matchin prototype in system include files + +- Better Portability for SCO UnixWare + + - New platforms i486, i586, Pentium III, Pentium Pro + + - Let strdefs.h also include strings.h for strcasecmp() + + - Support for missing struct sockaddr_storage + + - Support for broken wait3() (returns wrong timings) + + - Changed broken portability Prototype support in libfile + to use 'makefiles / prototype.h' based system + + - Changed fileopen() and filereopen() to avoid fdopen() + provlems (does not accept mode string that does not + match fd flags) + +- Catch the case where somebody tries to compile on Solaris with + /usr/ucb in PATH before /opt/SUNWspro/bin and when calling 'cc' + results in: + /usr/ucb/cc: language optional software package not installed + +- Trying to make the source get accepted by 'cstyle'. + +- Changes in the general topic 'Stack Scanning' and the software signal + system handlecond()/raisecond() that make the software signal system + now usable on all platforms. + +- Trying to support DOS with the DJGPP compilation environment + Thanks to Alex Kopylov <reanimatolog@yandex.ru> for the first version + of the port and further helping. + + Note that in order to compile cdrtools on DOS/DJGPP you need smake-1.2a20 or newer. + GNU make does not seem to work for a DOS compilation. + +- New File README.msdos + +- New RULES for DOS/DJGPP + +- Make some vars in align_test.c static because Mac OS X creates unneeded + name space pollution. + +- DJGPP has no SIGBUS, use #ifdef in avoffset.c and align_test.c + +- Several changes with casting Null pointer constants to Null Pointers + if they are used as parameters in var arg lists (see below). + +- New gethostname() fallback emulation using uname(2). + +- Better rename(2) emulation for Platforms that don't have rename(). + +- niread()/niwrite()/nixread()/nixwrite() in libschily now resets errno + to the old value in case EINTR did occur. + +- README.msdos has been corrected according to a hint from Alex Kopylov + +- New macros to platform independently set up integers in little endian + format. This is needed to e.g. write PC disk labels from big endian + platforms. + +- Rules extended to support volume management libs + +- The install-sh script not takes care about UNIX variants like SCO UnixWare + and SCO OpenServer that allow to give away files via chown. + + If this works and /tmp has the sticky bit set, the root test was unable + to remove the test files later. For this reason, now a subdirectory + in /tmp is used. + + +- Support for the special .PHONY: target ---> needs smake-1.2a21 or newer + + This helps to deal with files like INSTALL operating systems + like Win32 and Mac OS that don't honor file name case and prevents + the file named INSTALL to get into trouble with 'make install' + + +- 'make install' now works on operating systems that require a '.exe' + suffix for executable binaries + +- Updated the file README.ATAPI + + Updated information for Linux, SCO-OpenServer, SCO-UnixWare, Win32 + and DOS + +- mconfig.h now supports make COPTX=-DNO_FORK & COPTX=-DNO_VFORK + +- snprintf() from libschily now correctly follows POSIX.1-2001 for maxlength == 0 + +- Workaround for a bug in the C-compiler from SCO-OpenServer. It + is not very probable that this causes problems with cdrecord. The + function getfp() did not return the correct Frame Pointer when called + as first function in another function as the compiler sdoes set up the + new stack frame after getfp() has been called. + +- New function filemopen(char *name, char *omode, mode_t mode) with additional + mode_t parameter. + +- update recent getargs() version from repository. This has been forgotten. + +- Add a workaround for a SCO OpenServer C-compiler bug. + The bug causes the first function in a function to be called + before the new stack frame has been established and did cause + scanning the stack frame to fail. + +- Make snprintf() POSIX compliant. + +- Many typos in the READMEs fixed, thanks to a hint from Stefano Allrath + +- New global method to handle PATH environment delimiters (":" on + POSIX systems and ";" on DOS). + +- New README.msdos reflecting new features of smake-1.2a23 on DOS/DJGPP + +- Some minor enhancements to the makefilesystem + +- Some minor changes for better compilation in SGI IRIX + +- Trying to start adding support for Win32/Mingw32 + +- New global #define NEED_O_BINARY to make using setmode() easier + +- New autoconf test for struct stat.st_fstype + +- New autoconf test for fnmatch() + +- New autoconf test for blksize_t/blkcnt_t + +- libscgily/stdio/io.h renamed to schilyio.h to avoid conflicts with + DOS. + +- Added a Note to README.linux: + + NOTE for all Linux 2.5.x versions and all Linux versions before 2.6.8: + + Linux did ship with defective kernel include files starting + with 2.5.x. These defective kernel include files did prevent + compilation. If you have problems compiling software and see + error messages related to include/scsi/scsi.h & include/scsi/sg.h + either upgrade to Linux-2.6.8 or newer or remove /usr/src/linux + +- Support added to the makefile system that allows compilation on + AMD x86_64 using non automake aware make programs like GNU make. + Note that smake ftp://ftp.berlios.de/pub/smake/alpha/ is able to compile + things even on unknown platforms as it includes auto make features. + + +Libparanoia (Ported by J�rg Schilling, originated by Monty xiphmont@mit.edu): + +- Included a bug fix from the libparanoia Author. + Correctly allocate some arrays. Note: on 32 Bit machines, this patch does + not result in a different binary but the code is now really correct. + +- New indentation is better conforming to 'cstyle' + +- Fixed a bug in libparanoia that prevented the statistics to show up + the number of 'skips' (the number of exhausted read retries) when + SKIP verification has been turned off. + +- modified to avoid GCCs shadowed variable warnings. + +- Try to use page aligned transfer buffers if possible. + +- Avoid buffer size problems wit non page aligned transfers on FreeBSD. + +- Avoid freeing pointers that are not from malloc() by copying the data + to a second allocated chunk of free()able space. This has been a bug + introduced while trying to handle buffer size problems with non page aligned + transfers on FreeBSD. + + +Libedc (Optimized by J�rg Schilling, originated by Heiko Ei�feldt heiko@hexco.de): + + +Libscg: + +- Reordered and restructured scsi-remote.c code to allow compilation on OS/2 + and hopefully other OS like BeOS + +- First attempt to support QNX. + Note that the sourcecode comes from QNX and it looks as if it + is buggy for commands that cause SCSI commands that result in + a Check Condition status. From looking at the source, the stack + gets overwritten in this case. + +- SCSI adaptation layer for SCO UnixWare rewritten to support + multiple opens and to better follow the libscg interface standard. + +- Second attempt to support QNX. + Make it compile + +- Check kernel level error return codes on SCO-UnixWare + +- Starting to support SCSI reset on SCO-UnixWare + +- Extensions to libscg related include files to support DVD+RW formatting + +- Make libscg work on SCO UnixWare if an application like cdrecord + has been installed suid root. + + Before, the called administration programs did not work if euid!=uid + +- Fixed a problem with possible garbage in the SCSI error string. + Thanks to Stefano Di Paola <stefano.dipaola1@tin.it> for reporting. + +- Fixed another printf buffer vulnerability in scsi-remote.c + +- New version of scsi-amigaos.c from Thomas Langer + +- Added a work around for a Solaris 9 x86 bug: + DKIOCINFO returns a max DMA size of 256 kB but only 68 kB will work. + Check max DMA size for a IDE disk to get a correct value.... + + For more information read the updated file README.solaris and the + new files README.solaris-x86-ata-DMA and README.solaris-x86-ATAPI-DMA + +- Changed scsi-os2.c to allow 'cdrecord -scanbus' to find targets with + target ids > 7. + +- Librscg now uses correct casting to a Null Pointer for execlp() as + NULL is a Null Pointer Constant but no Null Pointer. This could + make problems with some 64 bit architectures. + +- New driver scsi-dos.c acting as 16 bit DOS ASPI interface + Thanks to Alex Kopylov <reanimatolog@yandex.ru> for the first version + of the driver. + + Check his Web Page: http://bootcd.narod.ru/index_e.htm + it contains precompiled DOS binaries. + +- The driver scsi-dos.c has already been verified with 'scgcheck'. + +- scsi-os2.c and scsi-wnt.c now correctly return 0 from scg_send() if + the target is not valid. + +- scsi-wnt.c does now support multiple SCSI opens. + +- scsi-wnt.c does now correctly return SCG_NO_ERROR in case a SCSI command + returned CHECK CONDITION. + +- scg__open() now prints a warning if it has not compiled with the results + from a certified autoconf environment. + +- Introduced a fix to avoid the need for a #define ident prod_ident + for SCSI Inquiry data. This #define did cause problems with the + latest Sun Studio 8, C compilers + +- First attempt to support running cdrecord while the volume management is + active. + +- Increased version number to 0.8 + +- First attempt to work around the problems for suid programs introduced by + Sun with Solaris 9. Programs that like to issue a USCSI ioctl() need to be + root or get EPERM. Cdrecord did does up root privilleges eraly to avoid + security problems. + + libscg now selectively runs the USCSI ioctl() as root if the program is installed + suid root. + +- Fixed a bug in scsi-mac-iokit.c in scgo_havebus() that caused pxupgrade not + to work on MacOS X. + +- First attempt to support the SPTI Ioctl interface on Windows NT. + see also http://www.ste-home.de/cdrtools-spti/ + Thanks to Richard Stemmer, Jay A. Key and thomas podkanski + + This allows to use cdrtools on NT without the need to install ASPI in case + you are administrator when yu run a program. + + Please note that the use of SPTI is default. If you like to force using + ASPI, use dev=ASPI:b,t,l or dev=ASPI (in the -scanbus case). + If you like to force STPI, use dev=SPTI:b,t,l or dev=SPTI. + + Currently, the interface does not yet fully matches the scg interface standard. + +- Try to support the half hearted and badly designed /dev/hd* interface + from Linux-2.6 in a more usable way. + + The only reason for adding this kind of support is that the Linux kernel + hackers reject to fix the known DMA bugs in the already existing SCSI + transport interfaces in the Linux kernel. Using /dev/hd* is unfortunately + the only way to get DMA with sector size being 2352, 2448 or similar. + + Use cdrecord -scanbus dev=ATA and + cdrecord dev=ATA:1,0,0 + + Note: The Bus mapping function inside the kernel for this interface is + a dummy. For this reason, we need to do the mapping ourselves. + Busnumber is ("/dev/hd*"[7] - 'a') / 2 + Target is ("/dev/hd*"[7] - 'a') % 2 + + Also note that creating this interface in the Linux kernel was a waste of + time. It did need a lot of effort to be created. Instead of first adding + a new interface with a new broken DMA implementation and later fixing + the DMA bugs, it would have been better to just fix the DMA bugs + in ide-scsi.c + + Adding SCSI transport to something like /dev/hd* on an OS that includes + a generic SCSI transport driver is disregarding SCSI protocol layering. + A clean way to implement ATAPI on Linux would be to rather introduce a + SCSI hostadaptor driver that sends the SCSI commands via the + ATA hardware. + + Linux users should think about buying a CD writer for Linus Torvalds. + Maybe this could help to get better SCSI support in the Linux. Currently + Linus doesn't know anything about the CD-writing problems on Linux and + his contributions to CD-writing related issues in discussions are just + guesses that are not related to own experiences and understanding for + the matter :-( + + It seems that the Linux way of dealing with bugs is to implement a new + incompatible interface instead of fixing the known bugs from + old interfaces :-( + +- Allow cdrecord -scanbus dev=ASPI and cdrecord -scanbus dev=SPTI to work + on win32. + +- Correct a bug in the Win32 version analyze function that is needed to + use the correct SPTI interface. Unfortunately, the interface did + change with a NT-4.0 service pack. It is unclear whether the currently + used interface type is correct for all possible NT-4.0 variants. + +- For Win32, default to STPI only if on NT-5.x as there is a bug in some + UDMA implementations that causes blue screens. + +- The Mac OS X SCSI low level transport now roughly meets the interface standard. + For this reason, the file scsi-mac-iokit.c now is marked with Author "schily" + +- Indented according to the cstyle standard. + +- For win32, dev=ASPI:1,0 and dev=SPTI:1,0 work again + +- Trying to add a workaround for the Linux problem with USB where the + kernel issues a request sense even when there was only a DMA underrun + and the drive replies as expected with no-sense. Our problem in this + case is that we needed to ad another workaround because sometimes + Linux clears the status byte and we did assume a CHECK CONDITION in case + sense[0] was != 0. + +- Enhanced max # of SCSI busses to 256 for the Linux sg driver. + This was needed because of the (compared to Solaris) suboptimal + way of dealing with instance numbers on Linuux. + + While Solaris keeps a data base with instance numbers, disconnecting and + reconnecting a USB drive results in the USB device getting the same + SCSI address as before. + + As Linux does not have such a data base, disconnecting/reconnecting + a USB device has the unfortunate side effect of assigning a new and + different SCSI address with every USB connect. This also creates problems + when software likes to manage access rights to devices for non-root + users. + +- Win32 SPTI interface now also supports controllers with more than one + SCSI Bus. Thanks to Richard Stemmer + +- Fixed a bug in the Win32 SPTI/ASPI interface introduced with 2.01a28 + that caused core dumps because it did try to access data behind the end of the + sense data array in the ASPI cmd structure. + +- Scan /dev/hda../dev/hdz instead of /dev/hda../dev/hdt for dev=ATAPI on Linux. + +- Trying to write a better warning message for the dev=ATAPI: interface + on Linux (the related kernel interface is unmaintained and does + not support DMA at all). + +- Fixed a bug in Win-NT Version string handling in scsi-wnt.c + Thanks to Alex Kopylov <reanimatolog@yandex.ru> + This caused that libscg did not properly recognize NT-4.x with service pack 4 + to be equivalent to NT-5.0 (Win2k). + +- Trying to avoid using the WinNT-SPTI interface for NT-4.0 + +- Fixed a security bug in scsi-remote.c (the RSCSI client). + + +Rscsi: + +- Support for IPv6 + +- Workaround for missing struct sockaddr_storage on SCO UnixWare + +- Security update. Forbid to write arbitrary debug files, only allow + a debug file name that has been configured in /etc/default/rscsi. + Writing arbitrary files with a siud root program could be used to become + root on a local machine if you are already logged into that local machine. + +- README.rscsi typo's corrected. + + +Cdrecord: + +- Use correct set_mode_params() return value in deflt_writemodes_mmc() + +- Correct a debug printing to go to stderr instead of stdout. + +- Workaround for broken Firmware for LG (Lucky Goldstar) drives. + These drives have been unable to write Audio in TAO mode because + they have an illegal audio pause length default. + + Thanks to a hint from: Mark Vytlacil <markvyt@comcast.net> + +- Man page now correctly describes the data formats used with -xa1 & -xa2 + +- Use Prototypes for functions with enum parameter in fifo.c to avoid + warnings on SCO UnixWare + +- Trying to catch SIGHUP to avoid hung recorders after people + close X windows by accident (This in most cases happens because + some newer GUIs try try copy bad ideas from Microsoft like the 'x' + button on the top bar in the window. + +- Trying to print hints if the SCSI error core looks like a buffer + underrun occurred. + +- First (still mostly empty) driver for the Matsushita CW-7501 + +- First TAO writing support for the Matsushita CW-7501 + +- New option -setdropts to allow cdrecord to set driver specific + parameters and exit. + +- Added support to disable/enable the Plextor PowerRec feature. + Use driveropts=forcespeed + Be very careful as this will cause in badly readable disks. + The only senseful reason to use this feature is to run tests in + -dummy mode to check whether the system would be able to record + fast enough and to later buy High-Speed Media. + Note that documentation for the related SCSI command is not + oficially available and thus the information has been "guessed". + +- Added support to enable/disable the Plextor SpeedRead feature. + Use driveropts=speedread + to allow the drive to read CDs faster than 40x. + Be very careful as this may cause the media to break in the drive + while reading, resulting in a destroyed media and drive! + Note that documentation for the related SCSI command is not + oficially available and thus the information has been "guessed". + +- Added support to enable/disable the Plextor SingleSession feature. + Use driveropts=singlesession + This allows to read defective (illegal) media with extremely + non-standard additional TOC entries. You need to enable Single Session + mode before you insert the defective disk! + Note that documentation for the related SCSI command is not + oficially available and thus the information has been "guessed". + +- Added support to enable/disable the Plextor Hide CD-R feature. + Use driveropts=hidecdr + This allows to make CD-Rs look like CD-ROMs and applications believe + that the media in the drive is not a CD-R. + Note that documentation for the related SCSI command is not + oficially available and thus the information has been "guessed". + +- Added reading out "real" Burn-Proof counter for Plextor drives. + Note that documentation for the related SCSI command is not + oficially available and thus the information has been "guessed". + +- Try to do a more correct job when doing Buffer Underrun estimation + counts. + +- Make the explicit Buffer underrun error checking work for + Plextor drives too. + +- Fixed the command line parser for driveropts= parameters. + Before the fix, driveropts=noburnfree,hidecdr would result + in assuming: driveropts=noburnfree,nohidecdr + +- Now also supporting SAO/DAO write mode for the CW-7501 + +- New option -lock (similar to -load) that loads the media but leaves + the drive in locked status. + +- New driver interface to allow SAO recording for the CW-7501 + Simplified: "dummy" and "multi" Parameter information has been + moved into the track structure. + +- Removed the internal implication that -packet is a TAO write mode. + Please test! It may be that this did introduce bugs. + +- Try to avoid ANSI C arithmetic conformance change warnings from + SCO C-compiler by introducing proper casting. + +- Driver interface restructured to support aborting SAO recording + with the Sony CDU-948 + +- "Driver flags" printing corrected + +- Better behavior with CADDY drives and -load option + +- Fixed a bug that caused cdrecord not to abort if Tracks with unknown + length are present in RAW write mode. + +- Print extended Power Rec Speed information for Plextor drives. + +- CUE Sheet handling generalized to allow to implement SAO writing + for more drives. + +- Start supporting the Sony CDU-948 in SAO mode. Currently not yet working: + + - Multi-session + + - MCN/ISRC + +- Grace time handling restructured. The grate time waiting is now done + even before the forced blanking and it is made sure that the waiting + is done only once. + +- Several changes in the open source part are visible as a result of the + new DVD+RW / DVD+R support. + +- cdrecord-ProDVD now includes first DVD+RW and DVD+R support. + Check ftp://ftp.berlios.de/pub/cdrecord/ProDVD/ + on Thursday 24.4.2002 for the first binaries + +- Do not try to lower the possible number of open files in raise_fdlim() + anymore. + +- Check return code of driver's init function. + +- Better error messages from main write loop. + +- Write a hint that a user may have used a "preformatted" CD-RW if + read_next_writable_address fails for the "invisible" track + and tell him to run cdrecord blank=.... + +- Fixed a bug that caused cdrecord to prevent a 3rd session on a + multi session disk. This bug was introduced with the driver + restructuring a few releases before. + +- Better driver text strings for the driver IDs in the CD MMC drivers. + +- Move Plextor PowerRec speed info completely to the statistics _past_ + the recording activities. + +- Allow more nonstandard Cue sheets to be accepted by the Sony CDU-924 + and CDU-948. + +- Implement MMC-3 DVD+ Drive/Media recognition to avoid that cdrecord starts + to treat a DVD+ as a CD-R because the DVD+ drive identifies as CD-R/RW + DVD-ROM + with "no DVD media installed" from a MMC-2 viewpoint. + +- Added a note to the cdrecord man page how to use mkisofs + to allow cdrecord to knoe about track sizes in SAO or RAW mode. + +- Fixed a multi session bug that has been introduced with the DVD+R/RW + restructuring with cdrecord-2.01a11. This bug caused cdrecord to be unable + to start a track from a sector number != 0 in TAO mode. + +- Fixed a problem with cdrecord -msinfo introduced with the the DVD+R/RW + restructuring with cdrecord-2.01a11. The unwanted verbose printing has been + removed with this version. + +- New option -xa to create CD-ROM XA mode 2 form 1 sectors with 2048 bytes + of user data + +- New option -xamix to create mixed CD-ROM XA mode 2 form 1/2 sectors + with 2332 bytes of user supplied data. + +- Restructured sector types to make them usable: + + -mode2 CD-ROM data mode 2 - 2336 bytes + -xa CD-ROM XA mode 2 form 1 - 2048 bytes + -xa1 CD-ROM XA mode 2 form 1 - 2056 bytes + -xa2 CD-ROM XA mode 2 form 2 - 2324 bytes + -xamix CD-ROM XA mode 2 form 1/2 - 2332 bytes + + To write conforming CD-ROM XA multisession disks use cdrecord -multi -xa1 + together with mkisofs -XA -sectype xa1 + +- -cdi is now implemented how it should be: as a flat to change + the TOC type of a CD and not as a sector mode. + +- Track parsing completely restructured to allow new features. + One of the features is to write audio CDs from a pipe, + other features will follow. + +- Cdrecord now resets euid to the uid of the caller (if called suid root) + before it opens data files. + +- Fixed a bug that caused cdrecord to insert two grace wait periods + if a disk was blanked and rewritten in one call. + +- Allow cdrecord to copy audio CDs from a pipe from cdda2wav + without using an intermediate file on disk. + + To copy an audio CD from a pipe (without intermediate + files), first run + + cdda2wav dev=1,0 -vall cddb=0 -info-only + + and then run + + cdda2wav dev=1,0 -no-infofile -B -Oraw - | \ + cdrecord dev=2,0 -v -dao -audio -useinfo -text *.inf + + This will get all information (including track size info) + from the *.inf files and then read the audio data from + stdin. + + If you like to write from stdin, make sure that cdrecord + is called with a large enough fifo size (e.g. fs=128m), + reduce the write speed to a value below the read speed of + the source drive (e.g. speed=12), and switch the burn- + free option for the recording drive on by adding + driveropts=burnfree. + +- New option -abort allows you to send a write abort sequence to a drive. + This may help if other software did leave the drive in an unusable + condition. + +- New 'xio' module allows to open a file virtually more than once to + support CDRWIN CUE sheets in cdrecord. + +- Run Plextor Speedinfo SCSI command in silent mode as old Plextor drives + do not support this command. + +- Workaround for a Plextor (Premium only???) firmware bug that may result + in a B0 pointer A5:A5:A5 instead of FF:FF:FF. + + This made it impossible to blank a freshly written CD-RW witout reloading + the media. Now cdrecord does not check the disk size anymore if the number + of tracks to be written is 0. + +- First CDRWIN CUE sheet support. + + Cdrecord currently supports what is in the CUE sheet description in + the CDRWIN documentation (with a few exceptions). Note that the + examples in the rest of the CDRWIN man page are mostly illegal + if you compare them against the CDRWIN CUE sheet syntax documentation. + + These exceptions are currently in effect: + + - Only one FILE Line per CUE sheet file (This is compliant to the + CUE shet format documentation although the examples show CUE + files with more than one FILE line). NOTE that the CUE syntax has + been ill defined so that it would not make sense to e.g. use + more than one FILE line for audio CDs. + + - The AIFF File type is not implemented (because I have no documentation + for this audio file format). + + - The MP3 File type is not yet implemented. + + - The CDG data type keyword will not yet work + + - The CDI data type keyword will not yet work + + - Only a sector size of 2048 will work with MODE1 + + - Sectors with sector size 2336 will not yet work + + - POSTGAP will not yet work. + + Note that the CDRWIN CUE documentation is bad and it is unclear how + formless (non XA) MODE 2 sectors should be made. + + CDI is not a sector/track property but a disk property. + + The File type BINARY vs. MOTOROLA is unclear. + + To use the cue sheet feature call: + + cdrecord dev=.... -v -dao cuefile=xx.cue + + The main reason for implementing CUE sheet support was to allow to + write VCD/SVCD with cdrecord. It has currently tested with the + test SVCD from ftp://ftp.vcdimager.org/pub/vcdimager/examples/test_svcd/ + + Cdrecord should allow to write audio type CUE sheet based CDs also. + + +- Modified the notes close to the Copyright printing code in cdrecord.c + to make clear that this note is not a deviation from the GPL but just + a memorandum on how to understand the GPL. + +- Fixed a bug in file descriptor handling that caused cdrecord not + to continue at offset xxx in the file after a new track did start. + +- Added a forgotten feature in the CUE Sheet parser so it will now know that + WAVE files use swapped (intel) byte order. + +- Restructured the main program of cdrecord so that cdrecord overall + behaves similar to before when cue sheets are used. + e.g. cdrecord -eject cuefile=xxx did only eject the disk instead of + first writing and then ejecting. + +- Added some hints to the man page to make speed= handling clearer + +- Fixed some typos in the man page + +- Added the -format option to the man page + +- CD-Text handling reworked: + + CD-Text from textfile= or from CUE CDTEXTFILE wins over CD-Text + from *.inf files and over CUE SONGRITER. + +- CD-Text from CUE file (either CDTEXTFILE or SONGRITER) now needs + -text in addition in order to be not ignored. + +- Fixed a bug in the recognition for cdda2wav | cdrecord *.inf + that caused a message + WARNING: Stdin is connected to a terminal. + if not writing from a pipe. + +- Small fix in auinfo.c to again allow compilation on K&R systems + +- Typo fixes for the cdrecord man page + +- The clone write code is now part of the GPL'd source + Note that this part of the code is now more than 2 years old but previously + has been excluded from the publically visible part of the source. + + To understand how to use the clone mode read README.clone + +- New option ts= to set the SCSI transfer buffer size + +- Man page corrected to correctly mention current format for /etc/default/cdrecord + +- call setmode(fileno, O_BINARY) for DOS/DJGPP also + +- Better check if we use the FIFO to avoid core dumps with too small FIFO sizes. + +- Switch off FIFO of fifo size is < 2 * SCSI transferbuffer + +- Fixed a small bug in the man page (..sp instead of .sp). Thanks to Eric Raymond + for reporting! + +- Work around for a problem in the Plextor 708 firmware (at least 1.01..1.02) + that caused cdrecord to be unable to recognize that a DVD medium is present instead + of a CD medium. + +- Changed the GPL clarifications text in a way so Debian people still + agree with me that cdrecord is free software. The clarifications are + needed in order to tell people/companies (like Mr. Rosenkranzer, + RedHat & SuSE) who create broken branches from cdrecord that they are + not legally publishing their branches because they violate the + GPL � 2 Paragraph c) and GPL Preamble Section 6). + + If would be better if the named persons/companies would rather stay + in contact to the Authors, discuss things and contribute to the + community instead of creating useless/broken changes and in case + of SuSE Linux even creating hacks that introduce security risks. + + Note that now, RedHat Linux (enterprise server) or the SuSE Linux + are even more expensive than e.g. Solaris x86, see: + + http://www.osnews.com/story.php?news_id=5416&page=5 + Small Correction to this web page: Solaris x86 is free again for + personal use. + +- Extended the man page to make it more clear that all CD/DVD-writers + ever made use only SCSI commands. + +- Another change to the man page according to a hint from + Eric Raimond in order to get better compliance for troff -> "*ml" + converters. + +- Allow people who cannot provide an e-mail address or who + don't like to support their modifications to modify cdrecord + +- Some CUE sheet modifications in drv_mmc.c now made it into + the official SCCS history file. + +- Several fixes to avoid the need for a #define ident prod_ident + for SCSI Inquiry data. This #define did cause problems with the + latest Sun Studio 8, C compilers + +- Hack to work around a POSIX real time priotity design bug that + causes us to become root again on e.g. Linux in order to be able + to lower the priority of the FIFO background process. + +- Better documentation and EXAMPLE for -setdropts driveropts= + in the man page. + +- print a help message to direct the user to use -raw96r in case + the drive does not accept the cue sheet with -dao. + +- Mark all drives that cannot be accessed because the volume management is + running and no media is in the drive with '?' instead of '*', so they + may be distinct from non existing drives. + + Read README.volmgt for more information + +- Now works again suid root on Solaris 9 + +- Fixed a bug introduced in 2.01alpha by a source consolidation. + cdrecord -toc did not work anymore for CD-ROM readers + +- Updated README.audio + +- Make the CUE Sheet handling search for a file name from a FILE statement + also in the directory where the CUE sheet is found (in case there is no + slash (/) in the file name from 'FILE'). + +- Avoid coredumps when cdrecord is called with -xd and there is no known + driver for the current drive. + +- New option -tao is now needed if you like to write in TAO mode. + Cdrecord now does no longer writes if no write mode has been specified. + +- New option -sao as alias for -dao. As the official name for the write mode + is SAO, -sao is more correct than -dao. + +- Fixes for minor typos in cdrecord.1 + +- Fixed a bug with pad=xxx and pad sizes > 2 GB. + +- Trying to fix a bug introduced lately with the check for specified + write mode options. As a result, only TAO mode writing did work. + +- Better man page & online help for the ts= option. + +- Fixed a typo in the man page. + +- Better error messages when audio size is < 300 Sectors or needs padding. + Thanks to a hint from Stefano Allrath + +- cdrecord -scanbus now checks for 256 SCSI busses + +- cdrecord -scanbus now checks for 256 SCSI busses + This has already been announced for 2.01a28 but forgotten to include + +- Some Man Page Fixes trying to avoid coding problems for non 7-bit ACSII + +- Several typos in the man page fixed + +- Man page enhanced to include a better documentation for the driver= + option. + +- Several other enhancements to the man page + +- modified to avoid GCCs shadowed variable warnings. + +- Cdrecord now tolerates the OPC "error code" "Power calibration area almost full" + to not a real error. + +- Fix for a bug that caused cdrecord to be unable + to reload the media for some drives. + The fix helps with the following problem: + + Trying to clear drive status. + cdrecord: Drive needs to reload the media to return to proper status. + cdrecord: Cannot load media with this drive! + cdrecord: Try to load media by hand. + cdrecord: Cannot load media. + +- man page enhanced + +- Print the "Make sure you are root" only if root privilleges are missing. + +- Avoid warning for not working nice() on DOS + Thanks to Alex Kopylov <reanimatolog@yandex.ru> + +- -clone option documented in the man page. This has been forgotten before. + +- Several typos in the man page fixed + +- Do not try to call nice() on DOS/DJGPP + +- cdrecord now tries to check the DMA speed if the drive supports to read the + drive buffer. If the DMA speed is not sufficient, then cdrecord requires + that burnfree is activated. If the environment variable "CDR_FORCESPEED" + is set or -force has been specified, then cdrecord does not try to enforce + that the available DMA speed is 2x the expected write speed. + +- Make some symbols static to avoid problem with a badly designed libc on + OpenBSD that violates POSIX by pulluting the namespace with symbols + like 'pl'. + + +Cdda2wav (By Heiko Ei�feldt heiko@hexco.de): + +- fixed typo in cdda2ogg.1 + +- Do not use uname() but gethostname() for portability. + +- include unistd.h for abs() + +- old Toshiba's usable again + +- Multisession Non-CD-Extra disks now work again + Now also a lot more broken disks are readable again. + +- not using ioctl in signalhandler any more + +- trying to support sound on Win32 + +- Several changes (mostly OS/2 related) for more ask Heiko + +- bugfix add cdda2ogg manpage,and script and makefile install target + +- support BeOS shared memory and FIFO + +- support soundcard output under QNX + +- windows-users! Cygwin has fixed the bug introduced with 1.3.18. Please + upgrade to the new 1.5.3-1 release. + +- call setmode(fileno, O_BINARY) for DOS/DJGPP also + +- Now using the major() macro for some Linux duties. + + WARNING to creators of Linux distributions: + + It has _always_ been wrong to compile software only once for different + kernel versions (e.g. for compile Linux-2.4 and later install a + 2.2 kernel on the so created system). + + Now that Linux-2.6 introduces incompatible changes to kernel/user + interfaces, the resulting binaries will not work correctly anymore. + +- Made CD-Text handling reentrant to overcome a problem triggered by XCDRoast + +- Now works again suid root on Solaris 9 + +- Fix for a Bug that prevents paranoia statistics from being printed + because the paranoia statistics for the forked version has not been + inside the shared memory. + +- New paranoia sub option paraopts=overlap=xx + + This is mainly a bug fix for cdda2wav. Cdda2wav previously _always_ did + completely deactivate the dynamic overlapping from libparanoia. Instead, + it did set the overlapping to the statical value 0. + + If you omit paraopts=overlap=xx, cdda2wav will now use dynamic overlapping + with -paranoia. + + If you like the old behavior, use: paraopts=overlap=0 + +- New paranoia sub option paraopts=minoverlap=xx + This sets the minimum dynamic overlap + +- New paranoia sub option paraopts=maxoverlap=xx + This sets the maximum dynamic overlap + +- Better paranoia statistics output + +- Fixed a Problem with some Linux sound card drivers that caused cdda2wav to be + unable to output to the soundcard. + +- cdda2wav now checks /etc/default/cdrecord and accepts dev=plextor as + cdrecord does. + +- Trying to add verbose output that estimates the read quality with -paranoia + +- Trying to convert non-ascii characters in user & host names into '_' + for better cddb compatibility. + +- Some Man Page Fixes trying to avoid coding problems for non 7-bit ACSII + +- New option -scanbus + +- Removed some "historical junk" that caused cdda2wav to define a + compile time default input device. This conflicts with cdda2wav -scanbus + and is superfluous and contra productive since cdda2wav reads + /etc/default/cdrecord + +- cdda2wav has signed bitfields of size 1 :-( + +- Fixed a typo in cdda2ogg.1 + +- Bug fix from Heiko for index lists that contain offset values of -1 in the middle + +- Trying to handle interface setup more carefully if SCSI Generic is not + used. + +- Better Debug Code in setuid.c + +- Trying to fix a bug in UID handling on FreeBSD + Thanks to the bugs reports and help from Fabian Keil <fk@fabiankeil.de> + +- Try to workaround a bug in GCC that caused incorrect warnings + for "strict-aliasing rules" + + +Readcd: + +- First (hacky) implementation of a way to meter the read speed + as a function of the disk location modeled after a idea from + Markus Plail <cdrecord@gitteundmarkus.de> + + Call: + readcd dev=b,t,l meshpoints=1000 > outfile + then + gnuplot + gnuplot> plot "outfile" w l + + or + + gnuplot> replot "outfile" w l + + if you like to overlay graphs. + +- New option fs=# (same syntax as with cdrecord fs=#) to allow the + user to set the maximum transfer size even in non-interactive mode. + This may help is the OS (as it has been the case for Solaris 9 x86) + reports a wrong maximum DMA size or there is a bug in libscg. + +- Speed printing with meshpoints=# now is based on 1000 bytes == 1 kb + as documented in the SCSI standard. + +- Stop reading if the OS replies with a DMA residual count != 0 + +- New option -factor will cause the read speed values to be printed + be based on the single speed of the current medium. This is only + possible if readcd is able to find out the current medium type. + +- The clone read code is now part of the GPL'd source + Note that this part of the code is now more than 2 years old but previously + has been excluded from the publically visible part of the source. + + Clone writing has been designed to allow to copy complex structured media + like e.g. SVCDs without the need to first do a sector by sector analysis + on the source media. + + To understand how to use the clone mode read README.clone + +- New option ts= to set the SCSI transfer buffer size + +- call setmode(fileno, O_BINARY) for DOS/DJGPP also + +- Now works again suid root on Solaris 9 + +- Better man page & online help for the ts= option. + +- New option -scanbus + +- Fixed a bug with -scanbus (did not work correctly if /etc/default/cdrecord + exists). + +- Added an allocated list of defective sectors, that is printed to the end of + a read operation. + + +Scgcheck: + +- Trying to check if multiple scg_open() requests result in + usable interfaces. + +- Send more outout to stdout instead of stderr. + +- More correct test for max sense count. + +- Eject CD _after_ asking for it. + +- Abor further DMA residual tests if a basic DMA residual test fails. + +- Second open test enhanced. + +- A small fix to prevent a core dump caused by a problem on Mac OS X. + + +Scgskeleton: + +- New Skeleton program as sample and template for programs that like to + use libscg. + + This template has been included to help people like the Author of the + BTC firmware flash program to write simple portable applications that + send arbitrary SCSI commands to arbitrary drives. + + +Mkisofs (By J�rg Schilling and James Pearson j.pearson@ge.ucl.ac.uk): + +- First attempt to support ISO-9660:1999 (Version 2) via -iso-level 4 + This allows 207 chars in filenames if Rock Ridge is not used + ans 197 207 chars in filenames if Rock Ridge is used. + + Note that this as an absolutely nontrivial change. Problems may + even occur when not using -iso-level 4. Please test and report + problems. + + It is not clear whether mkisofs should characters in the range + outside 7-Bit ASCII. Currently, mkisofs allows any 7-Bit ASCII + character except '\0' and '/'. + +- Second attempt to support ISO-9660:1999 (Version 2) via -iso-level 4 + This allows 207 chars in filenames if Rock Ridge is not used + and 197 207 chars in filenames if Rock Ridge is used. + + In version 2.01a01 the extended VD used the wrong signature 1. + This has been corrected. + +- isoinfo is now able to recognize ISO-9660:1999 + +- Enhanced the filename length for graft points to 2x PATH_MAX + +- Abort with a warning message if the total size of the image data + created by mkisofs would differ from the size printed by -print-size + +- udf.c indented according to hints from the program 'cstyle' + +- UDF now uses the same 'now' timestamp as the ISO-9660 part of the FS. + +- New Stream File feature and new options: + + -stream-file-name + -stream-media-size + + This feature has been implemented after an idea from M.H. Voase. + Mkisofs had to be heavily modified to allow this feature. + + A typical usage would look like this: + + star -c . | mkisofs -stream-media-size 333000 | cdrecord dev=b,t,l -dao tsize=333000s - + + The maximum size of the tar archive is 332800 sectors. + Note that only plain vanilla ISO-9660 is possible in this mode. + + +- The final padding that is added by default is now 150 sectors + which is the required size of the track post gap on a CD. + +- Inter partition padding is now only chosen to make the next partition + start on a sector number that is a multiple of 16. + +- isoinfo now also prints root directory extent # in debug mode + +- First step to allow mkisofs to support Kodak Photo CD and + Kodak Picture CD format: + + Try to correctly support associated files in multi-session mode. + + +- Diagnostic programs modified to use ttydefs.h and to have better + portability for the built in "stty" features. + +- isoinfo now prints the ISO-9660 directory flags. + +- Make mkhybrid a symlink to mkisofs instead of a hardlink + + +- getopt.h/fnmatch.h changed to use 'makefiles / prototype.h' based + system instead FSD junk system + +- Removed FSF junk from getopt.c that either created problems + with SCO Unixware or did not compile on AIX + +- Prototype for DVDOpenFile() to avoid warning on SCO UnixWare + related to enum function parameter + +- Fixed a bug with split symbolic links found by Klaus Kopper + with the new debug messages introduced with mkisofs-2.01a04 + +- Changed #if __STDC__ to #ifdef PROTOTYPES for better portability + +- Now using character code translation for 8 Bit characters that + are used with -iso-level 4 (ISO-9660-1999). + +- Fixed a typo in the on-line Usage information for isoinfo + +- New options -XA & -xa + + -XA Generate XA iso-directory attributes with original owner + and mode information. + + -xa Generate XA iso-directory attributes with rationalized owner + and mode information (user/group == 0). + + In the first phase of the implementation you need to specify -R in + addition. + +- Try to support files >= 2 GB. + Note that mkisofs is not yet written cleanly so there may be problems + if files >= are used. In such a case, please report. + +- Create XA "CD-XA001" signature in PVD with -XA or -xa + + In the first phase of the implementation you need to specify -R in + addition to -XA or -xa or no XA signatures will be written. + +- Removed a debug statement that has been introduced to implement + support for filees >= 2GB. + +- This version of mkisofs allows to create sectors with 2056 bytes if the + option -XA or -xa has been used together with -sectype xa1. + This is 2048 bytes + sub-header. + +- -apple does no longer include -R or -r. + If you like to use -apple, you need to use -R/-r or -XA/-xa in addition. + +- New option -sectype SECTYPE / -s SECTYPE + + Possible parameters are: + + data 2048 bytes per sector - the old and current default + + xa1 2056 bytes per sector - this is what you need for a conforming + CD-ROM XA multi session CD. Use -sectype xa1 together with -XA + +- Fixed a bug in the Rock Ridge symlink handling with Continuation records + triggered by '/../' filename components. + Thanks to jmmikkel@bbn.com (Joanne M Mikkelson) + for the fix. + +- man page corrected + +- Moved Eltorito PVD before ISO-9660:1999 enhanced PCD to allow + bootable CD with ISO-9660:1999 + +- -sort file handling fixed: mkisofs now looks for SPACE/TAB whatever + comes last (as documented in the man page). + +- Better error message in case of a stat(2) buffer overflow (too long + filename). This release now prints the file name that caused the problem. + +- call setmode(fileno, O_BINARY) for DOS/DJGPP also + +- Added a NOTE regarding the SILO boot program for Linux sparc to the + man page. + +- Added support for Solaris x86 boot CDs. + This includes the following new options: + + - -sunx86-boot to create a fdisk & SVr4 partition table + + - -sunx86-label to set the "disk label" name for the + SVr4 partition table. + +- New file README.sunx86boot + +- The file README.sunx86boot has been reworked to make it more correct + and contain less typos. + +- Fixed a Rock-Ridge length handling bug in update_nlink()/increment_nlink() (tree.c) + that may have caused an endless loop. + +- "Total extents including sparc boot" Message is now correctly + "Total extents including %s boot" sparc/sunx86 + +- mkisofs now checks /etc/default/cdrecord and allows e.g. + "mkisofs -C 0,1234 dev=plextor ...." as cdrecord does + +- Unclean message ....extents written (%d Mb) changed to + ....extents written (%d MB) to avoid "MegaBit" confusion. + +- Minor change for old UNIX versions like SCO OpenServer to get + smooth compilation on system where mode_t is a short. + +- Fix for a bug in RockRidge name handling for long file names + that need to be split into more than one sector. + Thanks to Patrick Ohly <Patrick.Ohly@gmx.de> + +- Trying to fix a bug in the multi session time stamp comparing + functions. CE records have not been handled correctly here. + +- Support for PowerPC CHRP Boot added, thanks to + "Leigh Brown" <leigh@solinno.co.uk> + +- Support for -uid/-gid for UDF Filesystems added + +- isoinfo now is able to list ElTorito Boot information with -d + +- isoinfo now correctly shows long RR filenames from CE Extension records. + +- Fixed a bug in the PowerPC CHRP Boot, thanks to + "Leigh Brown" <leigh@solinno.co.uk> + +- New options -root & -old-root from Patrick Ohly + This allows mkisofs to be used for "incremental backups" where + each backup is put into a separate directory tree on the CD. + +- Default to System ID "UNIX" for unknown platforms instead of + uning LINUX. + +- Support System ID "SCO-OPENSERVER" and "SCO-UNIXWARE" + +- Better error message when a user tries to create a multi session image + out of a multi-volume image. + +- When doing malloc(), include Null Byte at end of TRANS_TBL data to + avoid memory size conflicts. + +- Fix for a core dump caused by a double free() when doing: + echo bar >/tmp/bar + echo foo/bar=/tmp/bar > /tmp/pathlist + env LD_PRELOAD=libumem.so.1 UMEM_DEBUG=default UMEM_LOGGING=transaction \ + mkisofs -hfs -graft-points -o /tmp/foo.raw -path-list=/tmp/pathlist + + Thanks to J�rgen Keil jk@tools.de + +- Fixed a typo in write.c "Padbock" -> "Padblock" + Thanks to Richard Dawe <rich@phekda.gotadsl.co.uk> + +- Trying to fix a problem with comparing relaxed ISO-9660 file names + that contain a ';' which normally is a separator for the ISO-9660 + version number. The fix is in hash.c, please test! + +- Avoid GCCs shadowed variable warnings. + +- Added a comment is in hope to prevent silly people from + e.g. SuSE (who did not yet learn C but believe that + they need to patch other peoples code) from changing a + valid cast into an illegal lhs cast expression. + The cast in the unodified version of write.c is the correct way to + handle the problem. + + It would save a lot of time if people from companies like SuSE + would remember the Open Source software development model and + contact the Author for help rather than introducing proprietary + changes that result in worse and incompatible software variants. + + The way, companies like SuSE deal with Open Source software just + proves that Jonathan Schwartz from Sun is not wrong when he calls + SuSE and RedHat proprietary software companies. Users from Open Source + software expect that companies like SuSE and RedHat are in close + contact with the software developers but they unfortunately are not. + They prefer to create proprietary variants that are usually much + worse than the original software. The only explanation I have for this + behaviour is that SuSE likes to deviate from RedHat and RedHat likes + to deviate from SuSE in hope to get customer retention this way. + While the last 150 years did prove that this proprietary method to + tie up customers works for a limited time, it did always fail after + some time. + +- Removed verbose output for Eltorito boot method when called with -quiet + +- The Eltorito boot catalog and the Eltorito boot files are now by default + sorted to the beginning of the filesystem image as sime BIOS versions don't + boot from locations beyond 512 MB. + +- All programs from mkisofs/diag now support libscg so you may now + use e.g. isoinfo to list end extract from CDs directly on platforms + that do not support a usual driver interface (like on Win32). + +- Set default SYSID to "DOS" for DJGPP + Thanks to Alex Kopylov <reanimatolog@yandex.ru> + +- devdump isodebug isodump isoinfo isovfy + now include libscg and allow to use SCSI devices as input + +- devdump isodebug isodump isoinfo isovfy + now implement a new option dev= to force to use the SCSI + interface from libscg. + +- isoinfo now correctly sets the filemode of stdout to O_BINARY + on DOS alike Platforms like Win32 & DJGPP + This affects the '-x pathname' option + Thanks to Alex Kopylov <reanimatolog@yandex.ru> + +- The options -H/-L/-P from mkisofs have been marked "outdated" + as they are reserved by POSIX.1-2001 for other purposes. + + Mkisofs-2.02 will start to implement the POSIX.1-2001 semantics for + these options. + +- The max. length for the strings in the Primary volume descriptor + is now also documented in the options section of the man page. + +- Speed up by 30% in the case that a directory contains many (> 5000) + pathological file name entries (that _all_ do not differ in 8.3). + +- A minor speed up in devdump & isodump was made by no longer calling + strlen() in the end condition of a for loop (this still was old + code from Eric). + +- fixed a bug with -dvd-video + The bug caused mkisofs not to find the IFO file when VIDEO_TS was not + the first entry in the unsorted source directory. + Thanks to a hint from Johan Borg borg@morth.org + +- The option -volset-size does no longer accept numbers > 1 + + This change was needed because Eric Youngdale did completely + missunderstand the ISO-9660 standard with respect to Volume Set + Sizes. + + A Volume Set is not a numbered set of CDs but a set of CDs that + contains a coherent directory tree that would not fit on a single + volume. + +- Fixed a typo in the mkisofs man page + +- man page enhanced to make clear that the options + -no-split-symlink-fields & -no-split-symlink-components + are most likely not needed as they have been introduced by Eric Youngdale + when serious bugs have been in mkisofs. + +- Changelog updated + +- Try to workaround a bug in GCC that caused incorrect warnings + for "strict-aliasing rules" + +TODO: + - read Joliet filenames with multi-session if no TRANS.TBL + or RR is present. I am looking for a volunteer for this task! + + Note that this can never be 100% correct as there is no relation + between the names on the master (UNIX) filesystem, the ISO-9660 + names and the Joliet names. Only the Rock Ridge names are + untranslated with respect to the original files on the + master (UNIX) filesystem. + + - add libecc/edc for CDI and similar. + + +CYGWIN NT-4.0 NOTES: + +To compile on Cygwin32, get Cygwin and install it. +For more information read README.win32 + +The files are located on: + +ftp://ftp.berlios.de/pub/cdrecord/alpha ... + +NOTE: These tar archives are 100% POSIX compatible. GNU tar may get some + minor trouble. If you like a 100% POSIX compliant tar, get star from + ftp://ftp.berlios.de/pub/star/ + +WARNING: Do not use 'winzip' to extract the tar file! + Winzip cannot extract symbolic links correctly. + +Joerg diff --git a/scsilib/BUILD b/scsilib/BUILD new file mode 100644 index 0000000..59ba1b8 --- /dev/null +++ b/scsilib/BUILD @@ -0,0 +1,335 @@ +Short overview for those who don't read manuals: + + Calling configure manually is outdated because this is a task of the + makefile system. + + There is no 'configure', simply call 'make' on the top level + directory. + + ***** If this does not work for you, read the rest if this file ***** + ***** If you have any problem, also first read the topic specific ***** + ***** README.* files (e.g. README.linux for Linux problems). ***** + + All results in general will be placed into a directory named + OBJ/<arch-name>/ in the current projects leaf directory. + + You **need** either my "smake" program, the SunPRO make + from /usr/bin/make (SunOS 4.x) or /usr/ccs/bin/make (SunOS 5.x) + or GNU make to compile this program. Read README.gmake for + more information on gmake and a list of the most annoying bugs in gmake. + + All other make programs are either not smart enough or have bugs. + + My "smake" source is at: + + ftp://ftp.berlios.de/pub/smake/alpha/ + + It is easy to compile and doesn't need a working make program + on your machine. If you don't have a working "make" program on the + machine where you like to compile "smake" read the file "BOOTSTRAP". + + If you have the choice between all three make programs, the + preference would be + + 1) smake (preferred) + 2) SunPRO make + 3) GNU make (this is the last resort) + + Important notice: "smake" that comes with SGI/IRIX will not work!!! + This is not the Schily "smake" but a dumb make program from SGI. + + ***** If you are on a platform that is not yet known by the ***** + ***** Schily makefilesystem you cannot use GNU make. ***** + ***** In this case, the automake features of smake are required. ***** + + Please read the README's for your operating system too. + + WARNING + Do not use 'mc' to extract the tar file! + All mc versions before 4.0.14 cannot extract symbolic links correctly. + + The versions of WinZip that support tar archives cannot be used too. + The reason is that they don't support symbolic links. + Star and Gnutar do support symbolic links even on win32 systems. + To support symbolic links on win32, you need to link with the + Cygwin32 POSIX library. + + To unpack an archive use: + + gzip -d < some-arch.tar.gz | tar -xpf - + + Replace 'star' by the actual archive name. + + If your Platform does not support hard links or symbolic links, you + first need to compile "star" and then call: + + star -xpz -copy-links < some-arch.tar.gz + + If your platform does not support hard links but supports + symbolic links, you only need to call the command above once. + If your platform does not support symbolic links, you need to call + the command twice because a symbolic link may occur in the archive + before the file it points to. + + + +Here comes the long form: + + +PREFACE: + + Calling configure manually is outdated because this is a task of the + makefile system. + + You don't have to call configure with this make file system. + + Calling 'make' or 'make all' on the top level directory will create + all needed targets. Calling 'make install' will install all needed + files. + + This program uses a new makefilesystem. This makefilesystem uses + techniques and ideas from the 1980s and 1990s, is designed in a + modular way and allows sources to be combined in a modular way. + For mor information on the modular features read README.SSPM. + + The makefilesystem is optimized for a program called 'smake' + Copyright 1985 by J�rg Schilling, but SunPro make (the make program + that comes with SunOS >= 4.0 and Solaris) as well as newer versions + of GNU make will work also. BSDmake could be made working, if it + supports pattern matching rules correctly. + + The makefile system allows simultaneous compilation on a wide + variety of target systems if the source tree is accessible via NFS. + + +Finding Compilation Results: + + To allow this, all binaries and results of a 'compilation' in any form + are placed in sub-directories. This includes automatically generated + include files. Results in general will be placed into + a directory named OBJ/<arch-name>/ in the current projects + leaf directory, libraries will be placed into a directory called + libs/<arch-name>/ that is located in the source tree root directory. + + <arch-name> will be something like 'sparc-sunos5-cc' + + This is the main reason why simultaneous compilation is possible on + all supported platforms if the source is mounted via NFS. + + +How to compile: + + To compile a system or sub-system, simply enter 'smake', 'make' or + 'Gmake'. Compilation may be initialized at any point of the source + tree of a system. If compilation is started in a sub tree, all objects + in that sub tree will be made. + + +How to install results: + + To install the product of a compilation in your system, call: + + smake install + + at top level. The binaries will usually be installed in + /opt/schily/bin. The directory /opt/<vendor-name>/ has been agreed + on by all major UNIX vendors in 1989. Unfortunately, still not all + vendors follow this agreement. + + If you want to change the default installation directory, edit the + appropriate (system dependent) files in the DEFAULTS directory + (e.g. DEFAULTS/Defaults.sunos5). + + ***** If "smake install" doesn't do anything, you are on a broken ***** + ***** File System. Remove the file INSTALL in this case (the FS ***** + ***** does not handle upper/lower case characters correctly). ***** + ***** This is true for all DOS based filesystems and for Apple's ***** + ***** HFS+ filesystem. ***** + + +Using a different installation directory: + + If your system does not yet use the standard installation path /opt + or if you don't like this installation directory, you can easily + change the installation directory. You may edit the DEFAULTS file + for your system and modify the macro INS_BASE. + + You may use a different installation directory without editing the + DEFAULTS files. If you like to install everything in /usr/local, call: + + + If your make program supports to propagate make macros to sub make programs + which is the case for recent smake releases as well as for a recent gnumake: + + smake INS_BASE=/usr/local install + or + gmake INS_BASE=/usr/local install + + If you make program doesn't propagate make macros (e.g. SunPRO make) call: + + env INS_BASE=/usr/local make -e install + + +Using a different C-compiler: + + If the configured default compiler is not present on the current machine, + the makefilesystem will try an automatic fallback to GCC. For this reason + in most cases you will not need to manually select a compiler. + + The default C-compiler can be modified in the files in the + DEFAULT directory. If you want to have a different compiler + for one compilation, call: + + make CCOM=gcc + or + make CCOM=cc + + This works even when your make program doesn't propagate make macros. + + +Creating 64 bit executables on Solaris: + + If you like to create 64 bit executables you always need first to + remove any old make results. This includes all autoconf results. In + order to make sure that the source tree is in a "clean" state, call: + + ./.clean + + at the top level directory. Then configure and compile everything by + calling: + + smake COPTX=-xarch=v9 LDOPTX=-xarch=v9 + + To do this with GCC, you need at least GCC-3.1. It is the first 64 bit + aware GCC. With GCC, call on Solaris: + + smake CCOM=gcc COPTX=-m64 LDOPTX=-m64 + + It is not clear if GCC already supports other platforms in 64 bit mode. + As all GCC versions before 3.1 did emit hundreds of compilation + warnings related to 64 bit bugs when compiling itself, there is little + hope that other platforms are already supported in 64 bit mode. + + +Getting help from make: + + For a list of targets call: + + make .help + + +Getting more information on the make file system: + + The man page makefiles.4 located in man/man4/makefiles.4 contains + the documentation on general use and for leaf makefiles. + + The man page makerules.4 located in man/man4/makerules.4 contains + the documentation for system programmers who want to modify + the make rules of the makefile system. + + For further information read + + ftp://ftp.berlios.de/pub/makefiles/PortableSoftware.ps.gz + + +Hints for compilation: + + The makefile system is optimized for 'smake'. Smake will give the + fastest processing and best debugging output. + + SunPro make will work as is. GNU make need some special preparation. + + Read README.gmake for more information on gmake. + + To use GNU make create a file called 'Gmake' in your search path + that contains: + + #!/bin/sh + MAKEPROG=gmake + export MAKEPROG + exec gmake "$@" + + and call 'Gmake' instead of gmake. On Linux there is no gmake, 'make' + on Linux is really a gmake. + + 'Gmake' and 'Gmake.linux' are part of this distribution. + + Some versions of gmake are very buggy. There are e.g. versions of gmake + on some architectures that will not correctly recognize the default + target. In this case call 'make all' or ../Gmake all'. + + Note that pseudo error messages from gmake similar to: + + gmake[1]: Entering directory `cdrtools-1.10/conf' + ../RULES/rules.cnf:58: ../incs/sparc-sunos5-cc/Inull: No such file or directory + ../RULES/rules.cnf:59: ../incs/sparc-sunos5-cc/rules.cnf: No such file or directory + + Are a result of a bug un GNU make. The make file system itself is + correct (as you could prove by using smake). + If your gmake version still has this bug, send a bug report to: + + "Paul D. Smith" <psmith@gnu.org> + + He is the current GNU make maintainer. + + If you like to use 'smake', please always compile it from source. + The packages are located on: + + ftp://ftp.berlios.de/pub/smake/alpha/ + + Smake has a -D flag to see the actual makefile source used + and a -d flag that gives easy to read debugging info. Use smake -xM + to get a makefile dependency list. Try smake -help + + +Compiling the project using engineering defaults: + + The defaults found in the directory DEFAULTS are configured to + give minimum warnings. This is made because many people will + be irritated by warning messages and because the GNU c-compiler + will give warnings for perfectly correct and portable c-code. + + If you want to port code to new platforms or do engineering + on the code, you should use the alternate set of defaults found + in the directory DEFAULTS_ENG. + You may do this permanently by renaming the directories or + for one compilation by calling: + + make DEFAULTSDIR=DEFAULTS_ENG + + +Compiling the project to allow debugging with dbx/gdb: + + If you like to compile with debugging information for dbx or gdb, + call: + + make clean + make COPTX=-g LDOPTX=-g + + + If you want to see an example, please have a look at the "star" + source. It may be found on: + + ftp://ftp.berlios.de/pub/star + + Have a look at the manual page, it is included in the distribution. + Install the manual page with + + make install first and include /opt/schily/man in your MANPATH + + Note that some systems (e.g. Solaris 2.x) require you either to call + /usr/lib/makewhatis /opt/schily/man or to call + + man -F <man-page-name> + +Author: + +Joerg Schilling +Seestr. 110 +D-13353 Berlin +Germany + +Email: joerg@schily.isdn.cs.tu-berlin.de, js@cs.tu-berlin.de + schilling@fokus.fhg.de + +Please mail bugs and suggestions to me. diff --git a/scsilib/COMPILE b/scsilib/COMPILE new file mode 100644 index 0000000..59ba1b8 --- /dev/null +++ b/scsilib/COMPILE @@ -0,0 +1,335 @@ +Short overview for those who don't read manuals: + + Calling configure manually is outdated because this is a task of the + makefile system. + + There is no 'configure', simply call 'make' on the top level + directory. + + ***** If this does not work for you, read the rest if this file ***** + ***** If you have any problem, also first read the topic specific ***** + ***** README.* files (e.g. README.linux for Linux problems). ***** + + All results in general will be placed into a directory named + OBJ/<arch-name>/ in the current projects leaf directory. + + You **need** either my "smake" program, the SunPRO make + from /usr/bin/make (SunOS 4.x) or /usr/ccs/bin/make (SunOS 5.x) + or GNU make to compile this program. Read README.gmake for + more information on gmake and a list of the most annoying bugs in gmake. + + All other make programs are either not smart enough or have bugs. + + My "smake" source is at: + + ftp://ftp.berlios.de/pub/smake/alpha/ + + It is easy to compile and doesn't need a working make program + on your machine. If you don't have a working "make" program on the + machine where you like to compile "smake" read the file "BOOTSTRAP". + + If you have the choice between all three make programs, the + preference would be + + 1) smake (preferred) + 2) SunPRO make + 3) GNU make (this is the last resort) + + Important notice: "smake" that comes with SGI/IRIX will not work!!! + This is not the Schily "smake" but a dumb make program from SGI. + + ***** If you are on a platform that is not yet known by the ***** + ***** Schily makefilesystem you cannot use GNU make. ***** + ***** In this case, the automake features of smake are required. ***** + + Please read the README's for your operating system too. + + WARNING + Do not use 'mc' to extract the tar file! + All mc versions before 4.0.14 cannot extract symbolic links correctly. + + The versions of WinZip that support tar archives cannot be used too. + The reason is that they don't support symbolic links. + Star and Gnutar do support symbolic links even on win32 systems. + To support symbolic links on win32, you need to link with the + Cygwin32 POSIX library. + + To unpack an archive use: + + gzip -d < some-arch.tar.gz | tar -xpf - + + Replace 'star' by the actual archive name. + + If your Platform does not support hard links or symbolic links, you + first need to compile "star" and then call: + + star -xpz -copy-links < some-arch.tar.gz + + If your platform does not support hard links but supports + symbolic links, you only need to call the command above once. + If your platform does not support symbolic links, you need to call + the command twice because a symbolic link may occur in the archive + before the file it points to. + + + +Here comes the long form: + + +PREFACE: + + Calling configure manually is outdated because this is a task of the + makefile system. + + You don't have to call configure with this make file system. + + Calling 'make' or 'make all' on the top level directory will create + all needed targets. Calling 'make install' will install all needed + files. + + This program uses a new makefilesystem. This makefilesystem uses + techniques and ideas from the 1980s and 1990s, is designed in a + modular way and allows sources to be combined in a modular way. + For mor information on the modular features read README.SSPM. + + The makefilesystem is optimized for a program called 'smake' + Copyright 1985 by J�rg Schilling, but SunPro make (the make program + that comes with SunOS >= 4.0 and Solaris) as well as newer versions + of GNU make will work also. BSDmake could be made working, if it + supports pattern matching rules correctly. + + The makefile system allows simultaneous compilation on a wide + variety of target systems if the source tree is accessible via NFS. + + +Finding Compilation Results: + + To allow this, all binaries and results of a 'compilation' in any form + are placed in sub-directories. This includes automatically generated + include files. Results in general will be placed into + a directory named OBJ/<arch-name>/ in the current projects + leaf directory, libraries will be placed into a directory called + libs/<arch-name>/ that is located in the source tree root directory. + + <arch-name> will be something like 'sparc-sunos5-cc' + + This is the main reason why simultaneous compilation is possible on + all supported platforms if the source is mounted via NFS. + + +How to compile: + + To compile a system or sub-system, simply enter 'smake', 'make' or + 'Gmake'. Compilation may be initialized at any point of the source + tree of a system. If compilation is started in a sub tree, all objects + in that sub tree will be made. + + +How to install results: + + To install the product of a compilation in your system, call: + + smake install + + at top level. The binaries will usually be installed in + /opt/schily/bin. The directory /opt/<vendor-name>/ has been agreed + on by all major UNIX vendors in 1989. Unfortunately, still not all + vendors follow this agreement. + + If you want to change the default installation directory, edit the + appropriate (system dependent) files in the DEFAULTS directory + (e.g. DEFAULTS/Defaults.sunos5). + + ***** If "smake install" doesn't do anything, you are on a broken ***** + ***** File System. Remove the file INSTALL in this case (the FS ***** + ***** does not handle upper/lower case characters correctly). ***** + ***** This is true for all DOS based filesystems and for Apple's ***** + ***** HFS+ filesystem. ***** + + +Using a different installation directory: + + If your system does not yet use the standard installation path /opt + or if you don't like this installation directory, you can easily + change the installation directory. You may edit the DEFAULTS file + for your system and modify the macro INS_BASE. + + You may use a different installation directory without editing the + DEFAULTS files. If you like to install everything in /usr/local, call: + + + If your make program supports to propagate make macros to sub make programs + which is the case for recent smake releases as well as for a recent gnumake: + + smake INS_BASE=/usr/local install + or + gmake INS_BASE=/usr/local install + + If you make program doesn't propagate make macros (e.g. SunPRO make) call: + + env INS_BASE=/usr/local make -e install + + +Using a different C-compiler: + + If the configured default compiler is not present on the current machine, + the makefilesystem will try an automatic fallback to GCC. For this reason + in most cases you will not need to manually select a compiler. + + The default C-compiler can be modified in the files in the + DEFAULT directory. If you want to have a different compiler + for one compilation, call: + + make CCOM=gcc + or + make CCOM=cc + + This works even when your make program doesn't propagate make macros. + + +Creating 64 bit executables on Solaris: + + If you like to create 64 bit executables you always need first to + remove any old make results. This includes all autoconf results. In + order to make sure that the source tree is in a "clean" state, call: + + ./.clean + + at the top level directory. Then configure and compile everything by + calling: + + smake COPTX=-xarch=v9 LDOPTX=-xarch=v9 + + To do this with GCC, you need at least GCC-3.1. It is the first 64 bit + aware GCC. With GCC, call on Solaris: + + smake CCOM=gcc COPTX=-m64 LDOPTX=-m64 + + It is not clear if GCC already supports other platforms in 64 bit mode. + As all GCC versions before 3.1 did emit hundreds of compilation + warnings related to 64 bit bugs when compiling itself, there is little + hope that other platforms are already supported in 64 bit mode. + + +Getting help from make: + + For a list of targets call: + + make .help + + +Getting more information on the make file system: + + The man page makefiles.4 located in man/man4/makefiles.4 contains + the documentation on general use and for leaf makefiles. + + The man page makerules.4 located in man/man4/makerules.4 contains + the documentation for system programmers who want to modify + the make rules of the makefile system. + + For further information read + + ftp://ftp.berlios.de/pub/makefiles/PortableSoftware.ps.gz + + +Hints for compilation: + + The makefile system is optimized for 'smake'. Smake will give the + fastest processing and best debugging output. + + SunPro make will work as is. GNU make need some special preparation. + + Read README.gmake for more information on gmake. + + To use GNU make create a file called 'Gmake' in your search path + that contains: + + #!/bin/sh + MAKEPROG=gmake + export MAKEPROG + exec gmake "$@" + + and call 'Gmake' instead of gmake. On Linux there is no gmake, 'make' + on Linux is really a gmake. + + 'Gmake' and 'Gmake.linux' are part of this distribution. + + Some versions of gmake are very buggy. There are e.g. versions of gmake + on some architectures that will not correctly recognize the default + target. In this case call 'make all' or ../Gmake all'. + + Note that pseudo error messages from gmake similar to: + + gmake[1]: Entering directory `cdrtools-1.10/conf' + ../RULES/rules.cnf:58: ../incs/sparc-sunos5-cc/Inull: No such file or directory + ../RULES/rules.cnf:59: ../incs/sparc-sunos5-cc/rules.cnf: No such file or directory + + Are a result of a bug un GNU make. The make file system itself is + correct (as you could prove by using smake). + If your gmake version still has this bug, send a bug report to: + + "Paul D. Smith" <psmith@gnu.org> + + He is the current GNU make maintainer. + + If you like to use 'smake', please always compile it from source. + The packages are located on: + + ftp://ftp.berlios.de/pub/smake/alpha/ + + Smake has a -D flag to see the actual makefile source used + and a -d flag that gives easy to read debugging info. Use smake -xM + to get a makefile dependency list. Try smake -help + + +Compiling the project using engineering defaults: + + The defaults found in the directory DEFAULTS are configured to + give minimum warnings. This is made because many people will + be irritated by warning messages and because the GNU c-compiler + will give warnings for perfectly correct and portable c-code. + + If you want to port code to new platforms or do engineering + on the code, you should use the alternate set of defaults found + in the directory DEFAULTS_ENG. + You may do this permanently by renaming the directories or + for one compilation by calling: + + make DEFAULTSDIR=DEFAULTS_ENG + + +Compiling the project to allow debugging with dbx/gdb: + + If you like to compile with debugging information for dbx or gdb, + call: + + make clean + make COPTX=-g LDOPTX=-g + + + If you want to see an example, please have a look at the "star" + source. It may be found on: + + ftp://ftp.berlios.de/pub/star + + Have a look at the manual page, it is included in the distribution. + Install the manual page with + + make install first and include /opt/schily/man in your MANPATH + + Note that some systems (e.g. Solaris 2.x) require you either to call + /usr/lib/makewhatis /opt/schily/man or to call + + man -F <man-page-name> + +Author: + +Joerg Schilling +Seestr. 110 +D-13353 Berlin +Germany + +Email: joerg@schily.isdn.cs.tu-berlin.de, js@cs.tu-berlin.de + schilling@fokus.fhg.de + +Please mail bugs and suggestions to me. diff --git a/scsilib/COPYING b/scsilib/COPYING new file mode 100644 index 0000000..d60c31a --- /dev/null +++ b/scsilib/COPYING @@ -0,0 +1,340 @@ + 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 + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program 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. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/scsilib/Changelog b/scsilib/Changelog new file mode 100644 index 0000000..f98f2d3 --- /dev/null +++ b/scsilib/Changelog @@ -0,0 +1,7752 @@ +***** Version 2.01 ******** + +Wed Sep 8 20:26:34 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.297 + * readcd.c 1.74 + * cdrecord.c 1.296 + Version -> 2.01 + +Sat Sep 4 22:28:05 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsidefs.h 1.28 + * scsisense.h 2.18 + * scsicdb.h 2.19 + * scsireg.h 1.31 + * scgcmd.h 2.22 + Cstyle + +Wed Aug 25 13:28:57 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.295 + Warnung fuer Linux-2.6.8.1 neu + +Tue Aug 24 01:11:42 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-remote.c 1.16 + Auch die euid auf pw->pw_uid setzen bevor exec(RSH gemacht wird + +Thu Aug 19 12:14:09 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.294 + Version -> 2.01a38 + +Thu Aug 19 12:08:26 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.293 + linuxcheck() im %I% verbessert ;-) + +Mon Aug 16 16:42:17 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.292 + Version -> 2.01a37 + SuSE Kommentar erweitert. + +Sun Aug 8 23:04:39 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_mmc.c 1.10 + struct features & struct profiles -> LOCAL + +Thu Aug 5 10:26:18 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.291 + Kommentar vor linuxcheck() erweitert + +Wed Aug 4 02:30:51 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.290 + Version -> 2.01a36 + max_dma ist nun 4/5 der DMA Speed statt 1/2 + Warnung wegen Linux-2.6 eingebaut + Warnung wegen SuSE Linux eingebaut + +Sat Jul 31 17:41:06 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.289 + Version -> 2.01a35 + Check auf dma_speed > 0, dma_speed Test nur wenn tracks > 0 + +Mon Jul 19 11:10:00 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.45 + SPTI nicht bei NT-4.0 als Default + +Sun Jul 18 01:26:08 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.288 + Version -> 2.01a34 + Mehr Tests auf Korektheit der Werte (sinnvoller Bereich in get_dmaspeed()) + dma_speed nur dann auswerten wenn > 0 + +Sun Jul 11 02:28:23 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.103 + CDR_FORCESPEED domumentiert + +Sun Jul 11 01:57:27 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * skel.c 1.3 + * readcd.c 1.73 + * xio.c 1.11 + -> NEED_O_BINARY + +Sun Jul 11 01:32:49 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * readcd.c 1.72 + * skel.c 1.2 + MINGW32 neu + +Sun Jul 11 01:30:12 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * xio.c 1.10 + setmode() auch bei MINGW32 + +Fri Jul 9 00:05:39 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.287 + Version -> 2.01a33 + get_dmaspeed() neu + kein nice() bei __DJGPP__ + +Fri Jun 18 17:46:20 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.44 + if (isdigit(vers) -> if (isdigit(vers[0]) (bug korrigiert + +Fri Jun 18 01:17:54 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvdplus.c 1.15 + * drv_dvd.c 1.118 + long dvd_next_addr -> LOCAL long dvd_next_addr + +Thu Jun 17 23:20:27 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsierrs.c 2.29 + * scsitransp.c 1.91 + Bitfeld Typen fuer printf() auf int casten wegen IRIX cc + +Thu Jun 17 11:24:48 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * readcd.c 1.71 + Verbose Ausgabe fuer Fehlerkorrekturen nochmals angepasst + +Sun Jun 13 16:28:28 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * readcd.c 1.70 + maxtry neu + +Sun Jun 13 16:00:20 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * readcd.c 1.69 + Ausgabe der maximale Anzahl der Retries + +Sat Jun 12 15:14:49 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvdplus.c 1.14 + * drv_dvd.c 1.117 + RAW & TAO Schreibmodi nach check_writemodes() loeschen damit niemand cdrecord -raw fuer DVDs aufruft + +Sat Jun 12 13:48:12 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-ata.c 1.7 + Warntext geaendert + +Fri Jun 11 16:49:15 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * readcd.c 1.68 + Version -> 2.01a32 + -scanbus funktioniert nun auch wenn dev= nicht angegeben und /etc/default/cdrecord vorhanden + Auflistung der defekten Sektoren in allozierter Liste + +Thu Jun 10 10:58:19 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.102 + Schreibfehler + +Wed Jun 2 22:54:33 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.101 + -clone dokumentiert + +Tue May 25 17:33:15 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * readcd.c 1.67 + Vsersion -> 2.01a31 + +Tue May 25 17:32:29 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * readcd.c 1.66 + -scanbus neu + +Tue May 25 01:36:00 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.161 + * scsi_cdr.c 1.137 + * drv_mmc.c 1.157 + write_buffer() neu und write_buffer() in drv_mmc.c -> yamaha_write_buffer() + +Thu May 20 16:42:12 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.83 + Kommentar gegen die Debian patches fuer /dev/hd* + +Thu May 20 16:24:11 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-ata.c 1.6 + Bis zu 25 /dev/hd%c Files oeffnen + +Thu May 20 16:14:33 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.82 + Kommentare um dumme Leute von SuSE davon abzuhalten wichtige Warnungen wegzupatchen + +Thu May 20 15:50:38 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.100 + Kommentar zu benoetigten Root Rechten neu + +Thu May 20 15:35:52 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.286 + Bessere Kommentare gegen SuSE die cdrecord nicht als root laufen lasse wollen + +Wed May 19 00:54:29 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.285 + Make sure you are root. nur ausgeben wenn euid != 0 + +Wed May 19 00:47:48 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.284 + Version -> 2.01a29 + reload geht nun auch fuer Notebook Laufwerke wieder + +Wed May 19 00:45:26 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.160 + * scsi_mmc.c 1.9 + print_format_capacities() neu + +Wed May 19 00:27:28 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.99 + Bessere beschreibung der Hintergruende fuer eine gute Wahl der FIFO Groesse (fs=) + +Mon May 17 00:38:17 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.98 + Bessere Dokumentation fuer DVD + +Mon May 17 00:18:21 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsilog.c 1.17 + Besserer Kommentar + +Sun May 16 23:46:51 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.156 + bei OPC "Power calibration area almost full" nicht als Fehler auffassen + +Sun May 16 17:01:24 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.97 + Bessere Dokumentation der driver= Option + +Sun May 16 01:37:11 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.96 + Diverse kleinere Schreibfehler beseitigt + +Sun May 16 01:26:52 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.95 + Ei�feldt -> Ei\*sfeldt + �sec -> \*msec + +Sat May 15 23:14:18 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * subchan.c 1.19 + index Variable -> curindex wegen GCC Shadow Warnung + +Sun May 9 17:59:31 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * skel.c 1.1 + date and time created 04/05/09 16:59:31 by joerg + +Fri Apr 23 00:51:24 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.43 + Padding fuer ASPI CMD Struktur damit auch 32 Byte Sense Daten von SPTI gehen + +Wed Apr 21 01:48:32 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.42 + Support fuer SPTI & Kontroller mit mehr als einem SCSI Bus + Bei SPTI ist SENSE_LEN max nun 32 + +Sun Apr 18 13:26:43 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.81 + MAX-SCG -> 256 wegen Linux USB Implementierung + +Fri Apr 16 15:29:34 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_scan.c 1.19 + Bis zu 256 Busse scannen. + +Thu Apr 15 16:35:46 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.283 + Version -> 2.01a28 + +Mon Apr 12 16:13:47 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.94 + Read Book -> Red Book + +Tue Apr 6 11:59:03 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.282 + Bessere Fehlermeldung bei fehlendem -pad/-shorttrack + +Mon Mar 15 01:59:49 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.281 + Kommentar fuer cuefile= & -raw + +Wed Mar 10 21:54:36 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * readcd.c 1.65 + * cdrecord.1 1.93 + * cdrecord.c 1.280 + ts= Doku besser + +Mon Mar 8 00:43:39 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.80 + Fehler if (sp->u_sense.cmd_sense != 0 -> if (sp->u_sense.cmd_sense[0] != 0 korrigiert + Wenn ASC/ASQ und auch alle zusaetzlichen Bits/Key in Byte 2 0 sind, dann loeschen wir CHECK CONDITION wieder + weil das ein Linux USB Problem ist wo z.B. wegen einem DMA Underrun REQUEST SENSE geschickt wurde + und das Laufwerk erwartungemaesz mit NO SENSE geantwortet hat + +Sun Mar 7 23:43:08 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.279 + Version -> 2.01a27 + +Thu Mar 4 09:24:11 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.278 + Bugfix: Nach Umstellung des Tests auf Schreibmodus Option ging nur noch TAO + +Wed Mar 3 01:27:14 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.115 + * cue.c 1.20 + * isosize.c 1.9 + * drv_simul.c 1.47 + * getnum.c 1.2 + * movesect.c 1.3 + Cstyle + +Tue Mar 2 21:02:42 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * misc.c 1.4 + * cue.c 1.19 + Copyright -> 2004 + +Tue Mar 2 02:53:06 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * modes.c 1.25 + * fifo.c 1.47 + * drv_mmc.c 1.155 + * drv_sony.c 1.70 + * drv_dvdplus.c 1.13 + * drv_7501.c 1.15 + * diskid.c 1.37 + * defaults.c 1.11 + * crc16.c 1.6 + * cdr_drv.c 1.36 + * clone.c 1.7 + * drv_philips.c 1.68 + * readcd.c 1.64 + * scsi_cdr.c 1.136 + * scsi_scan.c 1.18 + * iso9660.h 1.5 + * xio.h 1.2 + * cdtext.h 1.5 + Cstyle + +Tue Mar 2 01:13:42 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * wm_track.c 1.4 + Copyright -> 2004 + +Mon Mar 1 11:08:40 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.159 + * mmcvendor.h 1.3 + * scsilog.h 1.4 + * scsimmc.h 1.10 + * drv_jvc.c 1.80 + * scsi_mmc.c 1.8 + * cdtext.c 1.10 + * scsilog.c 1.16 + * auinfo.c 1.23 + * cdrecord.c 1.277 + * audiosize.c 1.19 + * sector.c 1.12 + * subchan.c 1.17 + * wm_packet.c 1.24 + * xio.c 1.8 + Cstyle + +Mon Mar 1 11:02:43 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsimmc.h 1.11 + * subchan.c 1.18 + * wm_packet.c 1.25 + * xio.c 1.9 + * sector.c 1.13 + Copyright -> 2004 + +Sun Feb 29 21:49:03 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.276 + Cstyle + +Sun Feb 29 18:19:58 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.275 + Version -> 2.01a26 + -tao/-sao neu + +Sun Feb 29 18:13:20 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.92 + -tao Option neu, -sao Option als Alias fuer -dao + +Sun Feb 22 16:41:57 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.91 + Schreibfehler + +Sun Feb 22 15:53:51 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * readcd.c 1.63 + * cdrecord.h 1.158 + * defaults.c 1.10 + cdr_defaults() Prototy -> neues defaults.h + +Sun Feb 22 15:53:00 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * defaults.h 1.1 + date and time created 04/02/22 15:53:00 by joerg + +Sun Feb 1 21:32:58 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * adip.h 1.1 + date and time created 04/02/01 21:32:58 by joerg + +Fri Jan 23 23:10:42 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.41 + dev=ATAPI:1,0 geht nun wieder + +Mon Jan 19 21:29:24 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.113 + * cdrecord.c 1.274 + * drv_dvdplus.c 1.12 + * wm_packet.c 1.23 + trackp[i].padsecs * secsize -> (Llong)trackp[i].padsecs * secsize, damit kein Integeroverflow mehr stattfindet + +Thu Jan 15 22:24:39 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.40 + w2k_or_newer() neu um bei NT-4.0 wegen DMA Problemen mit SPTI per Default mit ASPI zu betreiben + Debug prints fuer bessere Beurteilung der Funktionsweise + +Thu Jan 15 02:22:38 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-mac-iokit.c 1.9 + memset sense 0 wieder eingebaut bis endgueltig geklaert ist wie es sein sollte + +Thu Jan 15 01:55:36 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-hpux.c 1.31 + * scsi-linux-pg.c 1.43 + * scsi-vms.c 1.33 + * scsi-os2.c 1.25 + * scsi-wnt.c 1.39 + * scsi-remote.c 1.15 + * scsi-unixware.c 1.36 + * scsi-qnx.c 1.3 + * scsi-osf.c 1.26 + * scsi-sgi.c 1.36 + * scsi-bsd.c 1.42 + * scsi-bsd-os.c 1.28 + * scsi-beos.c 1.22 + Umbau fuer Cstyle + +Thu Jan 15 01:05:25 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-openserver.c 1.31 + Aenderungen fuer Cstyle + +Thu Jan 15 00:50:11 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-next.c 1.32 + * scsi-linux-ata.c 1.5 + Umbau wegen Cstyle + +Wed Jan 14 20:05:52 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.112 + Unbenutzte Variablen beseitigt + +Wed Jan 14 20:04:33 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sun.c 1.82 + Aumbau fuer Cstyle + +Wed Jan 14 19:57:28 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sun.c 1.81 + Ueberfluessige Variable sb beseitigt + +Wed Jan 14 18:54:48 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-apollo.c 1.5 + * scsi-amigaos.c 1.6 + * scsi-aix.c 1.36 + * scsi-linux-sg.c 1.79 + * scsiopen.c 1.95 + * scsitransp.c 1.90 + * scgsettarget.c 1.2 + * scsihelp.c 1.4 + Umbau fuer cstyle + +Wed Jan 14 15:37:47 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.78 + LF_ATA Flag neu + +Wed Jan 14 01:14:27 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-mac-iokit.c 1.8 + ux_errno wird nun korrekt gesetzt wenn ein Kommando schiefgeht + Die Sense Daten werden nicht mehr gel�scht + Author ist nun "schily", denn das Modul kommt nun teilweise dirch scgcheck + +Tue Jan 13 20:43:44 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-mac-iokit.c 1.7 + Umbau fuer Cstyle + +Mon Jan 12 00:36:04 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.154 + Besserer Kommentar bei den Profilen in identify + +Mon Jan 12 00:33:39 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdr_drv.c 1.35 + dp bei error() ueberpruefen um coredumps bei cdrecord -xd zu verhindern + +Sun Jan 11 18:42:14 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.77 + Versuch das /dev/hd* Interface von Linux-2.6 besser zu unterst�tzen. + +Sun Jan 11 16:18:48 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.76 + Kommentar verbessert + +Sun Jan 11 14:39:45 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.38 + w2kstyle_create() umgestellt und so repariert, dasy kein unzulaessiger Speicherzugriff mehr erfolgt + +Sun Jan 11 14:09:19 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.37 + loas_aspi() neu + +Sun Jan 11 13:28:56 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.36 + Aenderungen damit cdrecord -scanbus dev=ASPI geht + +Wed Jan 7 00:38:26 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.157 + * scsi_scan.c 1.17 + * scsi-mac-iokit.c 1.6 + * scsi-sun.c 1.80 + * scsi-wnt.c 1.34 + * scsitransp.c 1.89 + * cdrecord.c 1.273 + Copyright -> 2004 + +Wed Jan 7 00:20:32 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.35 + Anderer Version String fuer SPTI + +Wed Jan 7 00:03:55 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.272 + Version -> 2.01a24 + +Tue Jan 6 23:58:43 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cue.c 1.18 + Wenn FILE Anweisung im CUE Sheet keinen Slash (/) enthaelt, dann wird der Filename auch im Directory des CUE Sheets gesucht + +Tue Jan 6 23:52:52 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.88 + Version -> 0.8 + +Tue Jan 6 23:33:20 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.33 + Cstyle + +Tue Jan 6 23:21:14 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.32 + SPTI Unterdrueckung von nocht CD-ROM deaktiviert + +Tue Jan 6 23:10:18 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.31 + Erste Version mit SPTI Support + +Tue Jan 6 17:58:47 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-mac-iokit.c 1.5 + scgo_havebus() korrigiert (war immer FALSE) damit pxupgrade funktioniert + +Tue Jan 6 01:01:59 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.153 + cmd_dummy statt init_mmc in den Treiberstrukturen fuer CD-ROM Leser + +Sun Jan 4 15:26:25 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sun.c 1.79 + Erste Version einer UID Verwaltung die fuer Solaris 9 USCSI gebraucht wird + +Fri Jan 2 16:05:57 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sun.c 1.78 + Erste Version die mit Volume Management arbeitet + +Fri Jan 2 16:05:21 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.271 + Version -> 2.01a23 + +Fri Jan 2 16:05:06 2004 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_scan.c 1.16 + Hack fuer fd == -1 -> Kein Zugriff auf LW -> '?' statt '*' + +Tue Dec 30 14:20:00 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.270 + Schreibfehler will not not Korrigiert + +Mon Dec 29 15:25:05 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.90 + Bessere Beschreibung und Beispiel fuer -setdropts driveropts= + +Wed Dec 24 11:51:56 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.152 + Hinweis auf RAW bei nicht funktionierendem CUE Sheet + +Tue Dec 23 13:48:33 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.269 + Version -> 2.01a21 + Hack fuer POSIX_PRIORITY_SCHEDULING Bug (wir brauchen root Rechte um die Pri zu verringern) + +Sun Dec 21 14:29:21 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.89 + Neuer Absatz ueber ATAPI auf erster Seite. + +Thu Dec 18 17:10:58 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.87 + Aehnlicher Text wie in cdrecord.c wenn !defined(IS_SCHILY_XCONFIG) + +Thu Dec 18 17:10:26 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.268 + Neuer Text fuer modifizierte Versionen ohne Support + +Thu Dec 18 17:09:41 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.88 + .sp verschoben auf Wunsch von Eric Raymond + +Tue Dec 16 00:42:16 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.267 + Security Test Ausgabe nun auch ohne Root Zugriff sichtbar + +Mon Dec 15 16:40:59 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.266 + Ausgabe des Resultats des Security Checks + +Mon Dec 15 09:19:24 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.151 + Copyright -> 2003 + +Mon Dec 15 09:18:14 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.150 + Ein DVD Brenner wird nun auch erkannt wenn er nur MMC-3 und nicht MMC-2 konform ist + Hinweis auf ftp://ftp.berlios.de/pub/cdrecord/ProDVD/ + +Mon Dec 15 07:32:55 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.265 + comexit(0); nach "erstem" -force blank unit entfernt damit auch mit dem Ricoh-5125 Medien erweckt werden koennen + +Thu Dec 11 12:59:54 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsireg.h 1.30 + #ifdef __SCG_COMPAT_ zum enablen von info/ident/revision -> vendor_info/prod_ident/prod_revision + +Thu Dec 11 12:55:42 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_scan.c 1.15 + * scsi_cdr.c 1.135 + info -> vendor_info, ident -> prod_ident, revision -> prod_revision + +Wed Dec 10 00:42:39 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-dos.c 1.11 + Hinweis auf http://bootcd.narod.ru/ + +Wed Dec 10 00:40:49 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.264 + Hinweis auf ftp://ftp.berlios.de/pub/cdrecord/ProDVD/ + +Wed Dec 10 00:19:03 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.263 + Version -> 2.01a20 + FIFO Abschalten wenn fifosize < 2*bufsize + +Tue Dec 9 20:52:14 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.87 + ..sp -> .sp Schreibfehler + +Sun Nov 30 13:50:31 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-dos.c 1.10 + schcgeck funktioniert nun, kein DMAresid und max sense_count 18 + +Sun Nov 30 00:00:01 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * xio.c 1.7 + * readcd.c 1.62 + #include <io.h> auch fuer DJGPP + +Sat Nov 29 23:36:39 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-dos.c 1.9 + Srb.Type.ExecSCSICmd.SenseLen = DEF_SENSE_LEN; -> Srb.Type.ExecSCSICmd.SenseLen = (SENSE_LEN+2); + +Sat Nov 29 23:11:56 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * readcd.c 1.61 + Version -> 2.01a20 + +Sat Nov 29 23:10:16 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * xio.c 1.6 + setmode(fileno, O_BINARY) auch fuer DJGPP + +Sat Nov 29 23:10:00 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * readcd.c 1.60 + #include <io.h> fuer __CYGWIN32__/__EMX__ + setmode(fileno, O_BINARY) auch fuer DJGPP + +Sat Nov 29 23:03:06 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-dos.c 1.8 + Sense_len & sense_count korrekt beachten + SS_ERR -> vor die invalid Device & Cannot Select Bus cases im switch in send_cmd() + +Sat Nov 29 22:28:57 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-dos.c 1.7 + Schreibfehler is statt if beseitigt + +Sat Nov 29 19:11:41 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-os2.c 1.24 + Return (0) statt -1 bei FATAL Error in send_cmd() wenn kein gueltiges Target gesetzt ist + +Sat Nov 29 19:10:48 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-dos.c 1.6 + Neuer AspiLoaded Counter fuer mehrfaches Oeffnen + +Sat Nov 29 19:06:55 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.30 + Return (0) statt -1 bei FATAL Error in send_cmd() wenn kein gueltiges Target gesetzt ist + SS_ERR mit cp->SRB_TargStat != 0 ist nun SCG_NO_ERROR + AspiLoaded ist nun integer Counter damit mehrere open()s moeglich sind + +Sat Nov 29 19:04:36 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-dos.c 1.5 + Return (0) statt -1 bei FATAL Error in send_cmd() wenn kein gueltiges Target gesetzt ist + SS_ERR mit Srb.Type.ExecSCSICmd.TargStat != 0 ist nun SCG_NO_ERROR + +Sat Nov 29 18:58:35 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-dos.c 1.4 + Cstyle + +Sat Nov 29 18:30:44 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-dos.c 1.3 + Umbau auf _go32_dpmi_allocate_real_mode_callback_retf() + +Fri Nov 28 10:25:15 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-dos.c 1.2 + Callback Funktion neu + +Fri Nov 28 02:33:18 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.43 + scsi-dos.c neu + +Fri Nov 14 10:55:14 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-dos.c 1.1 + date and time created 03/11/14 10:55:14 by joerg + +Sun Nov 2 23:50:22 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.46 + fifo_percent() fragt nun (sp == NULL) ab um festzustellen of der FIFO aus ist + +Wed Oct 29 15:33:45 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-remote.c 1.14 + strcatl()/concat()/*execl() casten nun NULL im letzten Arg nach (char *)NULL + +Wed Oct 1 00:39:23 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.156 + Kommentar ueber minimale FIFO Groesse + +Sun Aug 24 13:15:10 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.86 + driveropts in /Etc/default/cdrecord dokumentiert + +Tue Jul 22 21:43:08 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.262 + Version -> 2.01a17 + +Mon Jul 21 00:06:31 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.155 + * cdrecord.1 1.85 + * cdrecord.c 1.261 + Neue Option ts= + +Fri Jul 18 10:04:20 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * readcd.c 1.59 + Version -> 2.01a17 + Teilweise #ifndef EXTVERS -> #ifdef CLONE_WRITE fuer genauere Beschreibung des Kodes + +Fri Jul 18 10:03:04 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.134 + Kommentar Hinweis in cdr_underrun() + +Fri Jul 11 11:43:25 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.84 + Schreibfehler + +Sun Jul 6 00:04:14 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-os2.c 1.23 + EIO statt EINVAL damit Scan fuer Targets > 7 klappt + +Sat Jun 21 21:42:56 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sun.c 1.77 + Workaround fuer Solaris 8 x86 Bug: DKIOCINFO liefert 256 kB DMAsize aber nur 68 kB geht bei ATAPI & DMA + +Sat Jun 21 19:42:26 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * readcd.c 1.58 + Neue Option -factor + +Fri Jun 20 22:47:08 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * readcd.c 1.57 + Neue Option ts= fuer Transfer size + +Fri Jun 20 22:32:59 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * readcd.c 1.56 + Residual count auswerten beim Lesen + +Fri Jun 20 22:21:33 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * readcd.c 1.55 + prstats_silent() Prototyp neu + Versuch damit klarzukommen dasz einige BS (UnixWare) nicht mit odd byte DMA bei ATAPI klarkommen (READ FULL TOC) + Ausgabe aller Lead out startzeiten bei -clone (READ FULL TOC) + Geschwindigkeitsangaben beziehen sich auf 1000 Byte == 1 kb + Hack to write empty disks geht mit end == 1 statt end == 0 + +Tue Jun 17 19:23:35 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.83 + Schreibfehler + +Tue Jun 17 19:18:00 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * auinfo.c 1.22 + samples -> nsamples wegen samples() Makro und K&R C + +Sat May 31 21:58:05 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-amigaos.c 1.5 + Neue Version von Thomas Langer + +Sat May 31 19:41:16 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-amigaos.c 1.4 + Eingerueckt nach cstyle + +Sat May 31 18:34:37 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.260 + GPL Hinweise besser formuliert, Schreibfehler in usage() beseitigt + +Sat May 31 18:10:38 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.82 + Schreibfehler berichtigt & -format dokumentiert + +Sat May 31 18:09:46 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * auinfo.c 1.21 + Fix fuer fehlerhafte Erkennung von *.inf Dateien die Meldung 'WARNING: Stdin is connected to a terminal.' verursacht + +Fri May 16 13:02:58 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-remote.c 1.13 + js_snprintf(devname, sizeof(devname), device); -> js_snprintf(devname, sizeof(devname), "%s", device); + +Wed May 14 18:59:12 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.259 + CD-Text -text Aktivierung durch trackp[MAX_TRACK+1].flags |= TI_TEXT + Kein CD-text mehr wenn track[0].flags & TI_TEXT schon gesetzt (durch textfile=) + +Wed May 14 18:57:53 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cue.c 1.17 + CD-Text aus CDTEXTFILE nur noch wenn trackp[MAX_TRACK+1].flags & TI_TEXT + +Wed May 14 18:56:55 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.81 + Neue erweiterte CD-Text Behandlung beschrieben + +Wed May 14 02:24:17 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.258 + Version -> 2.01a15, Diverse Umstellungen damit tracks == 0 Abfragen bei cuefile=xxx korrekt behandelt werden + +Wed May 14 02:21:07 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * xio.c 1.5 + while(pp) -> for (; pp; pp = pp->x_next) damit continue bei x_name == NULL nicht zur Endlosschleife wird + +Tue May 13 23:26:57 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.80 + speed= Behandlung besser erklaert und Schreibfehler + +Tue May 13 23:26:14 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cue.c 1.16 + TI_SWAB bei FILE ... WAVE setzen + +Tue May 13 13:07:03 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * xio.c 1.4 + pp->x_name == NULL voer strcmp geaendert + +Tue May 13 13:05:00 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * xio.c 1.3 + Neue Knoten korrekt in Liste ein und aushaengen + +Mon May 12 02:17:00 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.149 + Support fuer TM_QUADRO/TM_ALLOW_COPY neu + Hack fuer CUE Sheet Handling mit MODE2/CDI trackp[i].dbtype == DB_RAW + Fuer Lead-In/Lead-Out werden nun die Bits fuer Datengroesse wegmaskiert + +Mon May 12 01:39:30 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.257 + setleadinout() setzt nun trackp[tracks+1].tracktype aus trackp[tracks].tracktype + +Mon May 12 01:38:03 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cue.c 1.15 + Erste funktionierende Version + +Mon May 12 00:26:35 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvdplus.c 1.8 + Canot -> Cannot Schreibfehler beseitigt + +Mon May 12 00:25:29 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.154 + parsecue()/fparsecue() neu + +Mon May 12 00:22:57 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.256 + Version -> 2.01a14, Neue Option cuefile=, Kein Aufruf von checkdsize() wenn tracks == 0 (tsize == -150) + +Mon May 12 00:20:55 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.79 + einfache erste cuefile= Doku + +Sun May 11 21:47:29 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.153 + TI_QUADRO & is_quadro() neu + +Sun May 11 21:46:53 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * xio.c 1.2 + Schutz gegen Coredump wenn pp->x_name == NULL + +Sat May 10 16:15:14 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cue.c 1.14 + Erster Ansatz fuer parse_file() + +Sat May 10 15:05:46 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cue.c 1.13 + struct state neu + cueopen()/neednextitem()/needword()/needitem()/checkextra()/cueabort() neu + +Fri May 9 10:10:42 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cue.c 1.12 + keyw_t Arrays -> LOCAL + +Fri May 9 10:08:10 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cue.c 1.11 + Parser Funktionen -> LOCAL + +Fri May 9 10:00:21 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cue.c 1.10 + Erster Ansatz zum weiteren parsieren der Keywort Zeilen mit den Funktionen parse_*() + +Fri May 9 09:58:25 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdtext.c 1.9 + #include cdtext.h vor cdrecord.h wegen gettextptr() und den Typ textptr_t + +Fri May 9 09:57:08 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * auinfo.c 1.20 + * cdrecord.h 1.152 + gettextptr() ist nun nicht mehr LOCAL + +Fri May 9 09:56:24 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdtext.h 1.4 + #define CDTEXT_H fuer Erkennung dasz cdtext.h includiert wurde + +Thu May 8 20:13:07 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cue.c 1.9 + Umgestellt fuer mehr "Ordnung" + +Thu May 8 19:57:21 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cue.c 1.8 + Definitionen fuer alle Schluesselworte + +Thu May 8 19:44:42 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cue.c 1.7 + getlocal() beseitigt, parsecue()/fparsecue() neu + +Thu May 8 19:38:55 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsiopen.c 1.94 + js_snprintf(errs, slen, scgp->errstr) -> js_snprintf(errs, slen, "%s", scgp->errstr) + +Thu May 8 19:38:14 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.148 + get_speeds_plextor() geht nicht mit alten LW, daher Ausfuerung im silent Mode + +Thu May 8 00:45:07 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cue.c 1.6 + Reihenfolge der Keyworte Kommentar + +Wed May 7 23:46:01 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.151 + * wm_packet.c 1.22 + * fifo.c 1.45 + * cdrecord.c 1.255 + Umbau auf 'xio' + +Wed May 7 20:31:31 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * xio.h 1.1 + * xio.c 1.1 + date and time created 03/05/07 19:31:31 by joerg + +Tue May 6 23:57:09 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.150 + * cdrecord.1 1.78 + * cdrecord.c 1.254 + -abort Option neu + +Tue May 6 19:12:27 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cue.c 1.5 + Kommentar verbessert, lookup() mit table Parameter + +Tue May 6 00:35:47 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cue.c 1.4 + Kommentar verbessert + +Tue May 6 00:23:14 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cue.c 1.3 + Umbau auf Makefilesystem, ungetline()/getlocal() neu + +Sun May 4 18:41:33 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.77 + Beschreibung der Audio Kopie aus Pipe + +Sun May 4 18:36:46 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.253 + Version -> 2.01a13 + +Sun May 4 18:35:19 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.149 + * cdrecord.c 1.252 + * auinfo.c 1.19 + Neue Funktion auinfosize() fuer AudioCDs aus Pipe Brennen + +Sun May 4 15:46:38 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.251 + Neue Funktion opentracks() und Umstellung des Trackparsing + +Sun May 4 15:18:21 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.44 + STDIN wird nicht mehr geschossen damit Audio "On the Fly" moeglich wird + +Sun May 4 15:16:43 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.148 + Neues Track Flag TI_USEINFO, tracktype/dbtype nun Uchar + +Sun May 4 12:52:00 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.250 + setuid(getuid()) nachdem alle root Dinge erledigt sind (hoffentlich) + +Sat May 3 20:09:17 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.54 + * scsitransp.c 1.86 + scg_fprascii()/scg_prascii()/scg_sprascii() neu + +Sat May 3 19:39:32 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.249 + gracewait setzt nun didgrace auf TRUE um doppeltes Warten zu vermeiden + +Fri May 2 22:49:20 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-unixware.c 1.35 + Debug error() beseitigt + +Fri May 2 22:46:35 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-unixware.c 1.34 + xpopen() neu damit suid root Binaries gehen, denn /etc/scsi/pdiconfig geht nicht wenn euid != uid + +Tue Apr 29 22:59:14 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.248 + Version -> 2.01a11 + +Tue Apr 29 20:59:54 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.247 + * cdrecord.1 1.76 + Neue Optionen -xa/-xamix und -multi/-mode2/-xa1/-xa2/-cdi korrigiert + +Tue Apr 29 20:41:16 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.147 + Support fuer TAO -mode2 + +Tue Apr 29 20:40:26 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.147 + Definitionen fuer Daten Sektor Typen + +Tue Apr 29 00:27:20 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.146 + Bessere Ausgabe fuer formatierte RW Medien + +Tue Apr 29 00:26:27 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_mmc.c 1.7 + Ausgave des Current Profile auf separater Zeile + +Wed Apr 23 23:25:27 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvdplus.c 1.5 + Ungebrauchte Variablen beseitigt + +Wed Apr 23 23:20:27 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.133 + read_track_info() Bug gefixt (type Bits waren in cmd_cdb[2] statt cmd_cdb[1]) + +Wed Apr 23 23:19:24 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.246 + gracewait() umstrukturiert + +Wed Apr 23 23:18:13 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_mmc.c 1.6 + * drv_mmc.c 1.145 + * cdrecord.h 1.146 + print_profiles() neu + +Tue Apr 22 22:36:02 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.245 + Return Code von (*dp->cdr_init)(scgp, dp) auswerten + +Tue Apr 22 19:08:58 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.244 + raise_fdlim versucht nun nicht mehr z.B. ein Limit von 256 auf 109 zu "erhoehen". + +Tue Apr 22 17:47:29 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.144 + Fehlendes " ergaenzt + +Tue Apr 22 17:46:28 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.143 + Bessere Fehlermeldung fuer get next writable address auf formatierte CD-RW + +Tue Apr 22 17:42:06 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.243 + Mehr Fehlermeldungen wenn in der Hauptschleife Fehler auftreten. + +Tue Apr 22 01:08:46 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.242 + Version -> 2.01a11, gracewait() mit didgrace Parameter fuer Ausgabe ohne Warten + +Mon Apr 21 15:49:58 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.241 + Format Code mit #ifdef DRV_DVD auskommentiert + +Mon Apr 21 15:40:04 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.142 + CL_TYPE_* #defines neu fuer scsi_close_tr_session() + +Mon Apr 21 15:39:13 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.240 + -format & BOOL gracedone neu + +Mon Apr 21 15:23:22 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.145 + * scsi_cdr.c 1.132 + request_sense_b()/reserve_tr_rzone() neu + +Mon Apr 21 14:22:51 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.239 + Umbau auf gracewait() + +Sun Apr 20 16:26:57 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_mmc.c 1.5 + get_format_capacities() neu + +Sun Apr 20 16:22:26 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.141 + read_track_info() mit erweiterten Parametern (Type) -> TI_TYPE_TRACK + +Sun Apr 20 16:21:22 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.131 + read_track_info() mit erweiterten Parametern (Type), read_rzone_info() aus drv_dvd.c durch read_track_info() + +Sun Apr 20 16:20:40 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.144 + F_FORMAT neu, WM_FORMAT neu, DSF_DVD_PLUS_R/DSF_DVD_PLUS_RW/DSF_NEED_FORMAT neu + read_track_info() mit erweiterten Parametern (Type), read_rzone_info() aus drv_dvd.c durch read_track_info() + get_format_capacities()/read_format_capacities() neu + +Sun Apr 20 15:52:45 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsimmc.h 1.9 + struct disk_info um dbit & bg_format_stat erweitert + +Sun Apr 20 15:13:25 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsireg.h 1.29 + struct scsi_format_header um immed/tryout/ipattern Bits erweitert + struct scsi_format_cap_header neu + struct scsi_format_cap_desc neu + struct scsi_cap_data neu + +Sun Apr 20 15:04:56 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsicdb.h 2.18 + NACA Bit im Control Byte neu + +Fri Apr 18 16:53:04 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.106 + * drv_mmc.c 1.140 + * cdrecord.h 1.143 + * scsi_cdr.c 1.130 + read_dvd_structure() nun mit addr und layer Parameter + +Fri Apr 18 16:51:11 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_mmc.c 1.4 + Unbenutze & Uninitialisierte Variablen beseitigt + +Thu Apr 17 23:13:07 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdr_drv.c 1.34 + DVD+ Treiber neu + +Thu Apr 17 23:09:29 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.139 + Treibertexte besser eingerueckt + Umleitung auf DVD+ Treiber bei DVD+ Medium + Aufruf der dp->cdr_identify(scgp, dp, scgp->inq) Routine bei Weiterleitung auf DVD Treiber + +Thu Apr 17 09:45:56 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.69 + * drv_philips.c 1.67 + * cdr_drv.c 1.33 + * cdrecord.h 1.142 + * drv_simul.c 1.46 + * drv_dvd.c 1.105 + * drv_jvc.c 1.79 + * drv_7501.c 1.14 + * drv_mmc.c 1.138 + cdr_format() Funktion neu + +Thu Apr 17 02:32:05 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.137 + load_media() fuer get_curprofile() im Silent Mode, wenn es ein CD Brenner ist dann wird nicht der CD-ROM Treiber returniert + +Thu Apr 17 01:10:51 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.136 + SCSI-3/MMC-3 medien Tests neu um DVD+ zu erkennen + +Thu Apr 17 00:04:06 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_mmc.c 1.3 + Vermeiden von pname(profile) ohne #defne DRV_DVD + +Wed Apr 16 23:40:46 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.135 + mmc_getval() weiter nach hinten - nach Korrektur der Inquiry Daten fuer ATAPI + +Wed Apr 16 22:49:41 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.134 + Treiber ID Text (Kommentar) verbessert + +Wed Apr 16 22:42:59 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.68 + Cue sheet Option auf 3 setzen + +Wed Apr 16 22:40:00 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.75 + Hinweis auf mkisofs -print-size bei SAO/RAW + +Wed Apr 16 22:28:03 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdr_drv.c 1.32 + SCSI-3/mmc-3 Support fuer DVD + DDCD Erkennung mit get_proflist() + +Wed Apr 16 22:25:56 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsimmc.h 1.8 + struct rzone_info um lra_v erweitert + struct mmc_performance_header / struct mmc_performance / struct mmc_exceptions / struct mmc_write_speed / struct mmc_streaming neu + +Wed Apr 16 22:01:14 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.141 + get_proflist()/get_wproflist() aus scsi_mmc.c neu + +Wed Apr 16 22:00:33 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_mmc.c 1.2 + get_conflen()/get_profiles()/get_proflist()/get_wproflist() neu + +Wed Apr 16 00:49:27 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.133 + get_speeds_plextor() komplett in die Statistik Funktion verlagert + +Wed Apr 16 00:28:09 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_mmc.c 1.1 + date and time created 03/04/15 23:28:09 by joerg + +Wed Apr 16 00:28:00 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.140 + scsi_mmc.c Definitionen neu + +Wed Apr 16 00:12:54 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.132 + Trebertabellen aufgeraeumt + +Tue Apr 15 18:57:54 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.139 + track_base(tp) Makro repariert (tp)->track statt (tp)->trackno + +Tue Apr 15 10:01:43 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.104 + TAO Fake beseitigt + +Sun Apr 13 21:54:15 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.67 + #include timedefs.h fehlte + +Sun Apr 13 18:54:27 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.66 + Erste SAO Implementierung (ohne MCN/ISRC/multi-session) + +Sun Apr 13 17:15:15 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.103 + * drv_simul.c 1.45 + * drv_jvc.c 1.78 + * drv_mmc.c 1.131 + * drv_7501.c 1.13 + * cdrecord.c 1.238 + * cdrecord.h 1.138 + * drv_philips.c 1.66 + cdr_abort_session() neu + +Sun Apr 13 17:10:44 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.130 + "Selected write speed:" -> "Last selected write speed:" + +Sun Apr 13 13:59:26 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.129 + Intelligenteres scsi_load() kennt nun CDR_CADDYLOAD + +Sun Apr 13 13:54:27 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.65 + Yamaha CDR-100 nun mit scsi_load() + +Sun Apr 13 13:36:00 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.237 + Version -> 2.01a10, Neue Funktion print_drflags() + +Sun Apr 13 13:35:26 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.137 + Kommentar verbessert + +Sun Apr 13 12:28:01 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.236 + * scsi_cdr.c 1.128 + scsi_load()/scsi_unload() nun mit korrektem Return Wert (int statt BOOL) und Auswertung des Return Wertes in load_media()/unload_media() + +Fri Apr 11 15:31:30 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.129 + * drv_7501.c 1.12 + (*dp->cdr_gen_cue)() Aufruf nun ueber Pointer + +Fri Apr 11 15:27:44 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.102 + * drv_simul.c 1.44 + * drv_mmc.c 1.128 + * cdr_drv.c 1.31 + * cdrecord.h 1.136 + * drv_7501.c 1.11 + (*dp->cdr_send_cue)() nun mit cdr_t * Parameter + +Fri Apr 11 15:18:57 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_7501.c 1.10 + * drv_simul.c 1.43 + * drv_philips.c 1.64 + * drv_dvd.c 1.101 + * drv_mmc.c 1.127 + * drv_sony.c 1.65 + * drv_jvc.c 1.77 + * cdrecord.h 1.135 + * cdrecord.c 1.235 + Neue Funktion (*cdr_gen_cue)() + +Fri Apr 11 01:25:58 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.126 + get_speeds_plextor() nun mit 3 int * Parametern, Ausgabe der Maximalen Brenngeschwindigkeit in stats_mmc() + +Fri Apr 11 00:53:30 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.234 + * cdrecord.h 1.134 + is_sao() & TI_SAO neu, checktsize() ueberprueft nun ob ein Track mit unbekannter Laenge in SAO/RAW mode vorhanden ist und bricht ab + +Thu Apr 10 21:18:42 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.63 + * drv_simul.c 1.42 + * drv_7501.c 1.9 + * cdr_drv.c 1.30 + * cdrecord.h 1.133 + * drv_jvc.c 1.76 + * drv_dvd.c 1.100 + * drv_sony.c 1.64 + * scsi_cdr.c 1.127 + * drv_mmc.c 1.125 + * cdrecord.c 1.233 + cdr_check_recovery()/cdr_recover()/cdr_close_session() nun mit cdr_t * Parameter + +Thu Apr 10 19:19:22 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.132 + Kommentar eingerueckt + +Thu Apr 10 19:15:16 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.232 + * cdrecord.h 1.131 + * drv_sony.c 1.63 + * drv_simul.c 1.41 + * drv_philips.c 1.62 + * drv_mmc.c 1.124 + * drv_7501.c 1.8 + * drv_jvc.c 1.75 + * drv_dvd.c 1.99 + cdr_init() neu, cdr_speed_select() nun ohne "dummy" Parameter + +Thu Apr 10 15:32:14 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.123 + get_speeds_plextor() neu + +Sun Apr 6 15:49:07 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.74 + Neue driveropts= speedread/singlesession/hidecdr + +Sun Apr 6 15:48:07 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.231 + (*dp->cdr_set_speed_dummy)() Aufruf bei -setdropts zwischen cdr_opt1() und cdr_opt2() + +Sun Apr 6 15:45:45 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.122 + Support fuer Plextor PowerRec, SpeedReeed, SongleSession, HideCDR + +Sun Apr 6 02:19:35 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.230 + * cdrecord.h 1.130 + #defines und Auswertung fuer CDR_SINGLESESS/CDR_HIDE_CDR/CDR_SPEEDREAD neu + +Sat Apr 5 22:35:50 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.129 + * cdrecord.c 1.229 + * cdrecord.1 1.73 + Neue Option -setdropts + +Sat Apr 5 20:51:06 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.121 + mmc_load/mmc_unload() auskommentiert + +Sat Apr 5 20:46:51 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.120 + opt2_mmc() neu und Kode aus open_session_mmc() dorthin bewegt + +Sat Apr 5 20:43:36 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.126 + * cdrecord.c 1.228 + Bessere Buffer underrun Erkennung und Beschreibung + +Sat Apr 5 15:49:22 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.62 + * drv_mmc.c 1.119 + * drv_simul.c 1.40 + * drv_7501.c 1.7 + * cdrecord.c 1.227 + * drv_philips.c 1.61 + * drv_jvc.c 1.74 + * cdrecord.h 1.128 + * drv_dvd.c 1.97 + (*dp->cdr_opt2)(scgp, dp) neu + +Sat Apr 5 15:37:12 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.226 + Buffer Underrun Vorhersage verbessert (kein loeschen am Trackanfang & zusaetzlicher Test auf leres RAM) + +Sat Apr 5 01:42:33 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.118 + Read Burn Proof Counter fuer Plextor + +Fri Apr 4 23:48:28 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-unixware.c 1.33 + Reset Support neu + +Fri Apr 4 00:44:59 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.225 + -packet impliziert nun nicht mehr TAO + +Fri Apr 4 00:35:13 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_7501.c 1.6 + cw7501__do_cue() nun korrekt LOCAL + +Fri Apr 4 00:30:05 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * auinfo.c 1.18 + * subchan.c 1.16 + trackp->tracktype & TOC_MASK wegen TOCF_DUMMY/TOCF_MULTI + +Fri Apr 4 00:29:09 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.61 + * drv_simul.c 1.39 + * drv_7501.c 1.5 + * drv_philips.c 1.60 + * cdrecord.h 1.127 + * cdrecord.c 1.224 + * drv_mmc.c 1.117 + * drv_jvc.c 1.73 + * drv_dvd.c 1.96 + cdr_open_session()/cdr_fixate() ohne multi/dummy Parameter -> track[0].tracktype + +Thu Apr 3 22:49:10 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.72 + * drv_dvd.c 1.95 + * wm_packet.c 1.21 + * cdrecord.c 1.223 + Casting wegen Signed/Unsigned Arithmetik bei ANSI C + +Thu Apr 3 22:32:30 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.60 + * drv_7501.c 1.4 + * drv_simul.c 1.38 + * drv_dvd.c 1.94 + * drv_philips.c 1.59 + * drv_mmc.c 1.116 + * drv_jvc.c 1.71 + * cdrecord.c 1.222 + * cdrecord.h 1.126 + cdr_open_session()/cdr_fixate() Treiberinterface nun ohne toctype Parameter -> trackp[0]->tracktype + +Thu Apr 3 20:51:34 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.43 + int -> Uint wegen Ansi C Vergleich + +Thu Apr 3 20:46:46 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * clone.c 1.6 + first/last int -> Uint wegen Ansi C Vergleich + +Thu Apr 3 20:42:01 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * subchan.c 1.15 + j int -> Uint wegen Ansi C Vergleich + +Thu Apr 3 18:16:00 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.221 + Neue Option -lock + prtimediff() -> misc.c + Version -> 2.01a09 + +Thu Apr 3 18:15:00 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.72 + Neue Option -lock + +Thu Apr 3 18:14:43 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * misc.c 1.3 + prtimediff() aus cdrecord.c neu + +Thu Apr 3 18:14:05 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.115 + int/Uint Vergleiche gecastet + test auf tracksize < 0 vor do_cue() + Versuch zu erreichen dasz is_packet(trackp) nicht mehr is_tao(trackp) impliziert + +Thu Apr 3 18:11:45 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.125 + F_DLCK & prtimediff() neu + +Thu Apr 3 18:11:22 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_7501.c 1.3 + Support fuer SAO neu + +Sun Mar 30 22:16:25 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_7501.c 1.2 + Schreibsupport fuer TAO + +Sun Mar 30 13:50:02 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.220 + * drv_mmc.c 1.114 + Eingerueckt nach cstyle + +Sat Mar 29 20:27:16 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-unixware.c 1.32 + Auswertung von scbp->sc_comp_code und Setzten von sp->error + +Thu Mar 27 12:11:17 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * readcd.c 1.54 + meshpoints=# Option neu + +Thu Mar 27 01:15:30 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.219 + 2002 -> 2003 + +Thu Mar 27 01:03:48 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdr_drv.c 1.29 + cw7501 neu + +Thu Mar 27 01:02:47 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_7501.c 1.1 + date and time created 03/03/27 01:02:47 by joerg + +Thu Mar 27 00:53:40 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.218 + Version -> 2.01a07, Unterdrueckung von "Warning: blockdesc secsize %d differs from cap secsize %d\n" wenn scgp->cap->c_bsize == 0 + +Thu Mar 27 00:45:34 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.124 + Eingerueckt nach cstyle + +Thu Mar 27 00:43:06 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.113 + mmc_load()/mmc_unload() mit 2. Parameter cdr_t * + +Tue Mar 25 18:48:41 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-qnx.c 1.2 + sccsid -> __sccsid + +Mon Mar 24 23:25:04 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.217 + Version -> 2.01a06, Handler fuer SGIHUP/SIGTERM, cdr_underrun() neu + +Mon Mar 24 23:23:38 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.125 + * cdrecord.h 1.123 + cdr_underrun() neu + +Mon Mar 24 13:01:28 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-unixware.c 1.31 + Beseitigung von fdesc[MAX_SCG][MAX_TGT][MAX_LUN] und Verkleinerung von sdidevs[scg][tgt][lun] + Nun kann wirklich scg_open() mehrmals aufgerufen werden. + +Sun Mar 23 21:10:45 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-unixware.c 1.30 + valid/atapi/initiator -> flags mit SDI_* Bit #defines + +Sun Mar 23 17:33:07 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-unixware.c 1.29 + Besseres Verhalten fuer scgcheck + +Sun Mar 23 15:14:23 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-unixware.c 1.28 + Eingerueckt wegen cstyle(1) + +Sun Mar 23 14:12:01 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.42 + Support fuer QNX neu + +Sun Mar 23 14:11:14 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-qnx.c 1.1 + date and time created 03/03/23 14:11:14 by joerg + +Thu Mar 6 16:39:42 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.42 + faio_wait_on_buffer() mit Prototype implementierung wegen SCO cc + +Thu Mar 6 16:27:52 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.71 + Beschreibung fuer -xa1 -xa2, ... berichtigt + +Fri Feb 7 12:34:37 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.70 + Schreibfehler beseitigt + +Sun Feb 2 14:13:07 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-remote.c 1.12 + Umgestellt, damit es auch ohne rcmd() geht + +Tue Jan 28 01:19:39 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.112 + Workaround fuer LG TAO Audio Formware bug: audio_pause_len = 150 + +Tue Jan 7 14:09:28 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.124 + Ausgabe Save/Set Modepages auch auf stderr wie Rest der Zeile + +Tue Jan 7 14:08:43 2003 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.111 + set_mode_params() ist BOOL, daher ist Abfrage auf < 0 falsch + +Tue Dec 24 16:28:38 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.69 + Version -> 2.0 + +Tue Dec 24 14:16:34 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.216 + Mail Adresse -> schilling@fokus.fhg.de + Vermeidung von "Cannot write CD's >= 100 minutes.\n" bei DVDs + +Mon Dec 16 22:26:39 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.68 + Mailing Lists geupdated, Hinweis auf cddb= bei den cdda2wav Beispielen + +*************** Release 2.0 ******************* + +Sat Nov 30 17:43:51 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * readcd.c 1.53 + * cdrecord.c 1.215 + Version -> 2.0 + +Sat Nov 30 16:11:27 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.214 + DVD-Pro Check for Tracksize-known only if ntracks > 0 + +Sat Nov 30 13:01:27 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.110 + Allow Medium removal after load Media for DVD/CD recognition as drecord -checkdrive would otherwise lock the tray if it has been open before + +Sat Nov 30 12:55:17 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-osf.c 1.25 + Debug output with SCSI Status Byte + +Fri Nov 22 17:55:41 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.67 + RSH= und RSCSI= documented for ssh(1) RSCSI + +Fri Nov 22 17:40:35 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-remote.c 1.11 + Support for non-root rcmd() and ssh(2) + +Fri Nov 22 17:35:54 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.41 + AmigaOS Support with ix_vfork()/ix_vfork_resume() and separate var buf_idx_reader for vfork() + +Thu Nov 21 22:28:57 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.213 + New Option minbuf= + +Thu Nov 21 22:23:10 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.66 + minbuf= Option new + +Tue Nov 19 19:13:34 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsiopen.c 1.93 + Fix for Coredump with dev=/dev/rsr1c:@,0 + +Sun Nov 10 19:18:04 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.36 + Orange Forum Embargo Warning only if mp->msf_min == 97 for DVDs + +Mon Nov 4 18:12:16 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.40 + close(f) /dev/zero oly if /dev/zero has been opened + +Sun Nov 3 16:32:52 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.123 + * cdrecord.h 1.122 + write_xscsi()/seek_scsi()/seek_g0()/seek_g1() new + +Sat Nov 2 22:11:55 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.212 + Version -> 1.11a40, _POSIX_MEMLOCK/_POSIX_PRIORITY_SCHEDULING Test POSIX 2001 conformant + +Sun Oct 27 15:19:29 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.211 + New Wait Feature free the IDE Busses if Source&Destination are on the same cable (use -immed) + +Sun Oct 27 14:57:11 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.65 + New Wait (usleep) Feature for -immed documented + +Sun Oct 27 14:42:36 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.121 + New Flag RF_WR_WAIT to actively free the IDE Busses via usleep() + +Sun Oct 27 02:26:26 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.210 + * wm_packet.c 1.20 + * drv_jvc.c 1.70 + Change from trackp->padsize ->trackp->padsecs + +Sun Oct 27 02:02:38 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.120 + Change from trackp->padsize ->trackp->padsecs + New Sektor based Makros Sminutes(s)/Sseconds(s)/Shseconds(s)/Sframes(s) + +Sun Oct 27 01:20:58 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.64 + Better docukmentation for padsize= + +Sat Oct 26 23:13:47 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.122 + Text Generic mmc2 DVD -> Generic mmc2 DVD-R/DVD-RW + +Sat Oct 26 20:21:15 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * wm_packet.c 1.19 + Support printing the fill ratio of the drive buffer and the actual write speed + +Fri Oct 25 15:06:33 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.109 + ATIP printinf for speed better -> %2d (reserved val %2d) + +Fri Oct 25 15:05:21 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.209 + pad_track() now shows Drive buffer fill% and speed + Verbose prinrting for write_track_data() and pad_track() unified + +Fri Oct 25 00:49:04 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.208 + Warning for cdrecord blank=fast if drive does not like -> Try cdrecord blank=all + write_track_data() now computes trackp->isecsize from trackp->isecsize to trackp->secsize + +Fri Oct 25 00:18:19 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.108 + BURN-Free was not used -> BURN-Free was never needed + +Fri Oct 25 00:06:12 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.107 + Test for 0xFF:0xFF/0xFF with dsp->ds_maxblocks == 716730 -> dsp->ds_maxblocks == 1166730 because we now use forceposivive in msf_to_lba() + +Thu Oct 24 23:47:23 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.106 + di_to_dstat() now always sets dsp->ds_first_leadin to allow 2. setting for Yamaha AudioMaster + +Wed Oct 23 22:46:02 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.207 + Version -> 1.11a39, Only cdrecord dev=help calls scg_help() no automatic printing if scg_open() fails + +Wed Oct 23 22:40:41 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.63 + Many changes tp prepare for 2.0 + +Wed Oct 23 22:21:46 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-ata.c 1.4 + Workaround for Linux Kernel design bug: CDROM_SEND_PACKET stes errno to EINVAL if Sense Key is "Invalid Command" + +Mon Oct 21 19:20:33 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.75 + /dev/sg* read loop again with 1000 loops but only if 'f' is a RAW device + Typo fixed + +Sun Oct 20 15:28:58 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.74 + sg_clearnblock() new to alow to clear O_NONBLOCK directly after open(.., ...|O_NONBLOCK) + +Sat Oct 19 22:04:23 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.206 + Version -> 1.11a38, Support for libscg Help + +Sat Oct 19 21:28:22 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsiopen.c 1.92 + * scsihack.c 1.41 + scg_help() Funktion new + +Sat Oct 19 21:27:21 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.85 + Version -> 0.7 + +Sat Oct 19 21:26:25 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.29 + * scsi-vms.c 1.32 + * scsi-unixware.c 1.27 + * scsi-sun.c 1.76 + * scsi-sgi.c 1.35 + * scsi-remote.c 1.10 + * scsi-osf.c 1.24 + * scsi-os2.c 1.22 + * scsi-openserver.c 1.30 + * scsi-next.c 1.31 + * scsi-mac-iokit.c 1.4 + * scsi-linux-sg.c 1.73 + * scsi-linux-pg.c 1.42 + * scsi-linux-ata.c 1.3 + * scsi-hpux.c 1.30 + * scsi-bsd.c 1.41 + * scsi-bsd-os.c 1.27 + * scsi-beos.c 1.21 + * scsi-apollo.c 1.4 + * scsi-amigaos.c 1.3 + * scsi-aix.c 1.35 + scgo_help() Funktion new + +Sat Oct 19 19:14:05 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.53 + Parameter tcomment new in __scg_help() + +Sat Oct 19 14:02:47 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.52 + Help functions new + +Fri Oct 18 17:25:31 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.72 + Modified Cleanup read() loop in sg_initdev() by request from Linus Torvalds + +Fri Oct 18 17:20:00 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sun.c 1.75 + open Warnung von error() auf js_fprintf((FILE *)scgp->errfile umgestellt + +Fri Oct 18 17:16:48 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsiopen.c 1.91 + * scsi-linux-ata.c 1.2 + * scsi-sun.c 1.74 + Allow unified dev=ATAPI, dev=ATAPI:, dev=USCSI, dev=USCSI: + +Sun Oct 13 21:40:59 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.71 + open(name, 2) -> O_RDWR.... + sg_initdev() with better loop to read possible rests from driver (requested by Linus Torvalds) + +Sun Oct 13 21:23:54 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sun.c 1.73 + * scsi-linux-pg.c 1.41 + open(name, 2) -> O_RDWR.... + +Sat Oct 12 13:53:52 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * sector.c 1.11 + Initialize Testsector in encspeed() to make resulting speed independent from junk on the stack + +Thu Oct 10 23:43:33 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.205 + Change wording from DAO -> SAO + +Wed Oct 9 19:36:09 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsireg.h 1.28 + New device types for Inquiry + +Wed Oct 9 19:35:44 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.84 + scg_fprintdev() New device types for Inquiry + +Tue Oct 8 00:57:50 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-unixware.c 1.26 + Handle EBUSY for multiple opens + +Mon Oct 7 22:19:15 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * sector.c 1.10 + * cdrecord.h 1.119 + * cdrecord.c 1.204 + Verbose printing of the LEC encoding speed -> encspeed() + +Sat Oct 5 22:07:27 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.203 + call cdr_buffer_cap() in Silent mode to make sure buggy drives (CW-7585) will not print constantly error messages + +Sat Oct 5 18:07:46 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-ata.c 1.1 + date and time created 02/10/05 17:07:46 by joerg + +Sat Oct 5 17:48:27 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.70 + Support for CDROM_SEND_PACKET in scsi-linux-ata.c new + SCSI Timeout now may be distinguished from SCSI selection Timeout by implementing a workarounf for a Linux kernel bug + +Sat Oct 5 00:02:52 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sun.c 1.72 + Do not open all /dev/scg* devices if not in SCAN mode + ENXIO for USCSI means selection Timeout + +Fri Oct 4 23:59:05 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-vms.c 1.31 + Warn for missing Scanbus, up to 26 IDE Controller from Chip.Dancy@hp.com + +Wed Oct 2 21:44:22 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.202 + Version -> 1.11a36, #ifdef HAVE_LIB_EDC_ECC to allow compilation without libedc + +Wed Oct 2 02:22:32 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.39 + Allow again compilation with #undef FIFO + +Wed Oct 2 00:54:52 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsiopen.c 1.90 + replace comma by semikolon + +Wed Oct 2 00:48:49 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-vms.c 1.30 + gk_chan is Unsigned but there was a comparison <= 0 + scsi status scsi_sts now correct for ATAPI + +Sat Sep 28 20:36:58 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.105 + deflt_writemodes_mmc() now with fallback to SAO if TAO is not supported + +Sat Sep 28 14:53:33 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.201 + -force Wirkung auf RAW Speed nur noch bis maximal das was eine CPU kann + Neue environment Variable "CDR_FORCERAWSPEED" + +Sat Sep 28 14:46:54 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * sector.c 1.9 + EDC_SCRAMBLE_NOSWAP #define in old libedc new + +Fri Sep 27 17:39:00 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.200 + Limit gracetime to 999, Do not use \b with wait time because seconds may use more than one column + +Fri Sep 27 16:40:46 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_simul.c 1.37 + DVD max speed -> 1000 + +Fri Sep 27 14:33:00 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.199 + Drive current speed/Drive default speed/Drive max speed printing now with lverbose > 1 + Hint to Heiko with Encoding speed printing + +Fri Sep 27 14:30:18 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.104 + Max Speed in struct from 370 -> 372, + mmc_opthelp()/hasdrvopt()/get_justlink_ricoh() now with EXPORT + Bug with dp->cdr_dstat->ds_dr_cur_wspeed fixed, + set dp->cdr_speeddef/dp->cdr_speedmax from drive values + +Fri Sep 27 14:28:27 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.89 + Change to use new driveropts= method from drv_mmc.c + +Fri Sep 27 14:25:18 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_simul.c 1.36 + Max Speed for CD from 370 -> 372 + +Thu Sep 26 03:06:39 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.121 + scsi_load()scsi_unload() now may be called with cdr_t * 0 + +Wed Sep 25 18:05:41 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.103 + scsi_blank()/scsi_close_tr_session()/scsi_flush_cache() with immed Flag + +Wed Sep 25 16:12:10 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.117 + * cdrecord.c 1.198 + * drv_simul.c 1.35 + * drv_philips.c 1.58 + * scsi_cdr.c 1.120 + * drv_dvd.c 1.88 + start/stop, load/unload, flush_cache with immed Parameter + +Wed Sep 25 14:22:26 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.69 + * drv_dvd.c 1.87 + * drv_mmc.c 1.102 + * cdr_drv.c 1.28 + * cdrecord.c 1.197 + * cdrecord.h 1.116 + blank() driver function now weith cdr_t * parameter for F_IMMED + +Wed Sep 25 13:52:12 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.196 + -immed new + +Wed Sep 25 13:51:28 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.195 + F_DVD -> TI_DVD (was wrong) + +Wed Sep 25 13:13:11 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.115 + F_DVD -> TI_DVD (was wrong), F_IMMED new + +Wed Sep 25 00:38:52 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.194 + * cdrecord.h 1.114 + * drv_sony.c 1.59 + * drv_simul.c 1.34 + * drv_philips.c 1.57 + * drv_mmc.c 1.101 + * drv_jvc.c 1.68 + * drv_dvd.c 1.86 + close_track()/fixate() enhanced by cdr_t * Parameter + +Tue Sep 24 21:28:33 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.100 + mmc_set_speed() new to allow drives that don't like speed=1 + +Tue Sep 24 18:40:42 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.193 + Version -> 1.11a35, Do not print Zeit/speed Statistics if writing did not yet start + +Tue Sep 24 18:36:56 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.119 + Modify speed printing to include CD/DVD Speed + +Mon Sep 23 15:42:22 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_simul.c 1.33 + Simulate Next Writable Address (for TAO) + +Mon Sep 23 15:39:22 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.192 + Move Comment out of #ifdef DRV_DVD + +Mon Sep 23 15:17:56 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.191 + Fix Pregap handling for DVD (no 150 Sektors per Track) + +Sun Sep 22 01:35:18 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.113 + F_DVD new + +Sun Sep 22 00:11:57 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.85 + Set DVD Flag in driverstructure because it is now used + +Sat Sep 21 23:59:25 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_simul.c 1.32 + Set DVD Flags, calculate DVD speed correctly, + correct real time spend in usleep() + +Sat Sep 21 01:33:16 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.190 + Version -> 1.11a34, Late check for tracks == 0 only if -fix was not used + +Fri Sep 20 01:58:54 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * auinfo.c 1.17 + -auinfo should be superceede -scms / -copy + +Thu Sep 12 17:16:35 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.189 + Statistics order new and better, + Print new statistics even on abort + +Thu Sep 12 17:03:42 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.112 + New Flags RF_DID_STAT/RF_DID_CDRSTAT + +Thu Sep 12 16:42:57 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.56 + Modified -> reload_media() + +Thu Sep 12 15:52:20 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.99 + cdr_dstat->ds_dr_max_rspeed/cdr_dstat->ds_dr_cur_rspeed neu + cdr_dstat->ds_dr_max_speed/cdr_dstat->ds_dr_cur_speed -> cdr_dstat->ds_dr_max_wspeed/cdr_dstat->ds_dr_cur_wspeed + scsi_set_speed() with MMC-3 rotctl Parameter + +Thu Sep 12 15:47:01 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.188 + Version -> 1.11a33, ds_dr_max_speed -> ds_dr_max_wspeed + +Thu Sep 12 15:43:36 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.84 + * scsi_cdr.c 1.118 + * cdrecord.h 1.111 + scsi_set_speed() mit MMC-3 rotctl Parameter + +Thu Sep 12 14:37:26 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.98 + dsp->ds_flags with DSF_HIGHSP_ERA / DSF_ULTRASP_ERA + New Speed Tabels for HS and UHS RW media + atip_printspeed() new + Print A1 ATIP Werte also in hex + Modify ATIP printout for UHS CD-RW + +Thu Sep 12 13:34:49 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.187 + Driveropts print MMC,MMC-2,MMC-3 + -force now allows to write faster data in -raw Data + Checks for Ultra High speed CD-RW for old writers + Do not print average write speed if data size is unknown + +Thu Sep 12 13:27:10 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.117 + Enhancements for MMC-2 & MMC-3 in -prcap (mode Page 2A) + +Wed Sep 11 21:23:48 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsireg.h 1.27 + MMC-2 & MMC-3 enhancements for Mode Page 2A + +Wed Sep 11 20:47:35 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.110 + CDR_MMC/CDR_MMC2/CDR_MMC3 new + +Wed Sep 11 15:13:20 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * subchan.c 1.14 + end = 0 for useless GCC Warning 'end' might be uninitialized + +Wed Sep 11 15:01:55 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.109 + trackp->dataoff/tracks/track/trackno -> Uchar + DSF_HIGHSP_ERA & DSF_ULTRASP_ERA new + CDR_ALLOC without top Bit for GCC Warning + +Wed Sep 11 14:59:46 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.83 + * auinfo.c 1.16 + Cast for trackp->track* -> Uchar + +Wed Sep 11 14:59:07 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.58 + Constant 0xFFFFFFFF with #ifdef for K&R/ANSI + +Sun Sep 1 23:43:15 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.186 + Print minimal Drive Buffer fill ratio + +Sun Sep 1 23:42:39 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.97 + DiskT@2 Support new + +Sun Sep 1 23:33:34 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.108 + Several new ds_* Vars for better Statistics + +Sun Sep 1 21:27:35 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.185 + cdrstats() now guesses Buffer underruns and prints average write speed + +Sun Sep 1 17:42:59 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.96 + cdr_stats() Function new + speed_select_mmc() with 2nd Parameter dp for FORCESPEED + driveropts=foesecpeed new + driveropts=tattooinfo new + driveropts=tattoofile=name new + hasdrvopt() fixed: missing break nach past recognised Option + +Sun Sep 1 16:50:22 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.184 + Buffer Cap print every 1 MB + +Fri Aug 30 13:57:26 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.183 + Version -> 1.11a32, CDR_DISKTATTOO new, (*dp->cdr_stats)(scgp, dp); for Burn-Free Statistics + +Fri Aug 30 13:42:33 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.107 + New driverinterfacefunction cdr_stats() + CDR_DISKTATTOO new + +Fri Aug 30 13:41:21 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.57 + * drv_simul.c 1.31 + * drv_philips.c 1.55 + * drv_jvc.c 1.67 + * drv_dvd.c 1.82 + New driverinterfacefunction cdr_stats() + +Thu Aug 29 21:40:34 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.56 + * drv_simul.c 1.30 + * drv_philips.c 1.54 + * drv_jvc.c 1.66 + * drv_dvd.c 1.81 + * cdrecord.h 1.106 + * cdrecord.c 1.182 + New Parameter cdr_t *dp for cdr_set_speed_dummy() for "forcespeed" + +Thu Aug 29 17:12:40 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * mmcvendor.h 1.2 + link_counter is [2]. + +Mon Aug 26 17:47:17 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.95 + Turning... messages -> stdout + +Mon Aug 26 01:56:39 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.94 + JustLink Support new + +Mon Aug 26 01:22:08 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * mmcvendor.h 1.1 + date and time created 02/08/26 00:22:08 by joerg + +Tue Aug 20 01:11:19 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.93 + mmc_opt1() new + Yamaha Audio Master Support new + Be more careful with test_write (-dummy) in deflt_writemodes_mmc() + Check driveropts= already in attach_mmc() and turn into flags + +Tue Aug 20 00:06:22 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.181 + Call dp->cdr_opt1() _before_ set speed/dummy and before the first Size Check + +Mon Aug 19 02:30:52 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.180 + Do not clear ds_cdrflags after attach() + +Mon Aug 19 01:12:18 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.179 + driveropts=help new in short usage() + +Mon Aug 19 00:45:49 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.105 + * drv_dvd.c 1.80 + * drv_simul.c 1.29 + * drv_jvc.c 1.65 + * drv_sony.c 1.55 + * drv_philips.c 1.53 + cdr_t->cdr_opt1() new + +Mon Aug 19 00:40:47 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.178 + dataoff = 16 as Default in autoaudio to allow cdrecord -raw to work without -data + +Mon Aug 19 00:34:46 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.177 + Call (*dp->cdr_opt1)(scgp, dp) for Yamaha Audio Master, then 2. Check for size + +Sat Aug 17 01:13:39 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.92 + Yamaha Audio Master recognition, Varirec in driveropts=help, Varirec recognition + +Sat Aug 17 00:52:44 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.104 + Calling sequence comment new + +Sat Aug 17 00:04:28 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * sector.c 1.8 + Max RAW speed in metering raised from 100x -> 1000x + +Fri Aug 16 02:39:01 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.176 + * cdrecord.h 1.103 + CDR_VARIREC / CDR_AUDIOMASTER / CDR_FORCESPEED new + +Wed Aug 14 23:43:34 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.175 + Version -> 1.11a30, Speed test for RAW data sectors + +Wed Aug 14 20:50:55 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * defaults.c 1.9 + Allow Space as separator in /etc/default/cdrecord + +Wed Aug 14 01:04:46 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.102 + * sector.c 1.7 + encspeed() new + +Tue Aug 13 23:45:22 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * sector.c 1.6 + HAVE_LIB_EDC_ECC/HAVE_NEW_LIB_EDC/CLONE_WRITE new + +Tue Jul 30 00:22:27 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.174 + Version ->1.11a28, tracksize/secsize ->itracksize/isecsize for debug printf + +Mon Jul 29 22:22:12 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.101 + track_base() Macro new, typedef struct ofile ofile_t new + +Mon Jul 29 21:58:12 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * subchan.c 1.13 + Shift ISRC & MCN by one to the end if the are on an index change + +Sun Jul 28 23:19:55 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_simul.c 1.28 + Flags with allen possible write modi and with CDR_TRAYLOAD to avoid + +Sun Jul 28 13:54:08 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * subchan.c 1.12 + better comment + +Thu Jul 25 03:25:39 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * subchan.c 1.11 + Support for ISRC/MCN in RAW Mode new (but witout index shift) + +Tue Jul 23 23:47:58 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * subchan.c 1.10 + First loop in fillsubch() removed because it is identical to second loop + +Tue Jul 23 23:32:31 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * subchan.c 1.9 + fillsubch() now coeerect for audio Pregap between Tracks korrekt with relative time counting downwards + +Sun Jul 21 18:21:24 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.91 + set dsp->{ds_disktype!ds_trfirst!ds_trlast!ds_trfirst_ls} from dip->* + Do not cast malloc() anymore + Check write_cdtext() Returncode + Prepare for just Link + +Sun Jul 21 18:13:25 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.79 + set CDR_BURNFREE Flag, + set dsp->{ds_disktype!ds_trfirst!ds_trlast!ds_trfirst_ls} from dip->* + +Sun Jul 21 18:07:21 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.173 + Version -> 1.11a27, + Define Warning that needs to be printed if Source has been changed, + Better messages for wrong DVD-RW write speed, reload_media() at end Ende of RAW Write + +Sun Jul 21 17:52:54 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.116 + * auinfo.c 1.15 + malloc() Cast removed + +Sun Jul 21 17:51:44 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.54 + dsp->ds_diskid now is UInt32_t + +Sun Jul 21 17:44:11 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.100 + struct disk_status with Typen from utypes.h + +Mon Jul 8 00:31:04 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * wm_session.c 1.4 + * wm_packet.c 1.18 + * subchan.c 1.8 + * fifo.c 1.38 + * drv_mmc.c 1.90 + * drv_jvc.c 1.64 + * clone.c 1.5 + * cdrecord.h 1.99 + * cdrecord.c 1.172 + 'tracks' outside driver interface removed and replaced by trackp->tracks + +Sun Jul 7 22:30:24 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.63 + Better rebuild old driver interface in next_wr_address_jvc() + +Sun Jul 7 22:28:35 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * wm_packet.c 1.17 + * drv_mmc.c 1.89 + * cdr_drv.c 1.27 + * cdrecord.h 1.98 + * cdrecord.c 1.171 + * drv_sony.c 1.53 + * drv_simul.c 1.27 + * drv_philips.c 1.52 + * drv_jvc.c 1.62 + * drv_dvd.c 1.77 + trackno/tracks Parameter in driverinterface removed for new Struct Member + +Sat Jul 6 21:19:22 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.170 + * cdrecord.h 1.97 + track_t now with tracks and track for simplified driverinterface + +Sat Jul 6 18:20:27 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.96 + * cdrecord.c 1.169 + * drv_sony.c 1.52 + * drv_simul.c 1.26 + * drv_philips.c 1.51 + * drv_mmc.c 1.88 + * drv_jvc.c 1.61 + * drv_dvd.c 1.76 + cdr_speeddef/cdr_speedmax new and do not default to speed= 1 but to cdr_speeddef + +Fri Jul 5 23:11:39 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.168 + Version -> 1.11a26 + wm2name[] with better systematics + Bugfix for High Speed CD-RW that could not be written anymore at 10x speed + New test for too slow writing of a CD-RW + Modename for blank only now is "BLANK" + Text: write XXX mode -> real XXX mode + SAO & RAW start (leadin) Code -> drv_mmc.c + Correctly print the current DVD writespeed + +Fri Jul 5 21:36:25 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.95 + New driverfunction write_leadin, WM_ * Macros with better system, + new Macro wm_base(), + RF_LEADIN new + +Fri Jul 5 21:31:48 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.87 + New driverfunction write_leadin_mmc() with Code from cdrecord main function + +Fri Jul 5 21:26:04 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.51 + * drv_simul.c 1.25 + * drv_philips.c 1.50 + * drv_jvc.c 1.60 + * drv_dvd.c 1.75 + New driverfunction write_leadin as dummy + +Thu Jul 4 13:01:36 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.167 + Version -> 1.11a25 + Print Writemodes (new) + set_wrmode() new + restructuring: cdr_t->cdr_dstat is now used + dp->cdr_dstat->ds_cdrflags |= RF_PRATIP new + Check for ultra low speed media in High Speed writer + Check for high speed media in Low Speed writer + Avoid that cdrecord -- speed=8 causes speed=8 to be ignored as file type arg + +Thu Jul 4 12:55:52 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.94 + restructuring: cdr_t->cdr_dstat is now used + New Write Mode WM_* definitions + +Thu Jul 4 12:53:14 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.74 + * drv_mmc.c 1.86 + * drv_philips.c 1.49 + * drv_sony.c 1.50 + Check for dp->cdr_dstat->ds_cdrflags & RF_PRATIP + Fill dsp->ds_flags |= DSF_ERA and dsp->ds_at_*_speed + +Tue Jul 2 19:55:47 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.49 + * drv_simul.c 1.24 + * drv_philips.c 1.48 + * drv_jvc.c 1.59 + * cdr_drv.c 1.26 + * drv_mmc.c 1.85 + * drv_dvd.c 1.73 + dstat_t * now is a Member of cdr_t -> better handling of special funcs + +Tue Jul 2 15:18:31 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.84 + get_atip() now is always usable (not only if PRINT_ATIP has been defined) + +Sun Jun 16 15:58:37 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.115 + Comment -> mmc-2 + +Fri May 31 22:09:39 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.114 + wait_unit_ready() fast Abort even if k == SC_MEDIUM_ERROR + +Wed May 29 01:43:13 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.28 + Better printf() format strings for DWORD + +Wed May 29 01:02:28 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdtext.h 1.3 + List of language codes enhanced + +Wed May 29 00:55:22 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.37 + palign() Macro with (UIntptr_t) Cast + +Wed May 29 00:54:26 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.166 + Version -> 1.11a24, gracetime= in usage(), printf() Format correkt for bmtime() + +Wed May 29 00:51:56 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.62 + gracetime= new + +Wed May 29 00:50:03 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdtext.c 1.8 + Avoid Coredump if a single .inf File is missing and trackp[i].text is NULL -> ->textcodes does not work + +Mon May 20 17:08:41 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-aix.c 1.34 + palign() -> with UIntptr_t cast + +Mon May 20 16:38:23 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-remote.c 1.9 + avoid Integeroverflow with %.*s and 64 bit + +Mon May 20 14:28:12 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sun.c 1.71 + Cast (int)req.uscsi_buflen/(int)req.uscsi_resid forr 64 bit + +Mon May 13 02:02:09 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.165 + Version -> 1.11a23, + Flush Cache with exit() in Silent Mode to avoid problem with cdrecord -toc and CD-ROMs + +Mon May 13 02:00:49 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.36 + * drv_mmc.c 1.83 + * drv_jvc.c 1.58 + * drv_dvd.c 1.71 + * cdrecord.h 1.93 + New Typ tsize_t instead of off_t for Track size Vars > sizeof(long) on non-largefile OS + +Sat May 4 21:55:38 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.164 + Avoid that abort via ^C kills a running SCSI Command + +Sat May 4 21:42:56 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.83 + * scsitransp.h 1.51 + Callback Function at Ende of SCSI Command + +Sat May 4 18:10:05 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.163 + Version -> 1.11a22 + gracetime= Option new + Now use geterrno()/seterrno() + reload_media() reads from stdder if input is from stdin + +Sat May 4 16:00:13 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.162 + printf() Formats enhanced to get non jumping output with DVDs + +Sat May 4 15:36:45 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.70 + always set CDR_TAO|CDR_SAO in cdr_flags to allow speudo-DAO Mode + +Sat May 4 15:34:41 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.92 + MIN_GRACE_TIME new + +Sat Apr 20 22:29:26 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.35 + Now use geterrno()/seterrno() + +Tue Apr 16 19:20:40 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsierrs.c 2.28 + New Errorstrings from 29.5.2001 + +Tue Apr 9 22:48:58 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.35 + Embargo Message now better + +Tue Apr 9 22:41:41 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.91 + F_STDIN Flag new + +Sat Mar 30 12:26:12 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.69 + Make drecord -atip print useful things + +Wed Mar 27 23:36:26 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.68 + maxblocks computing corrected (now even works with Panasonic) + +Tue Mar 26 19:18:31 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * subchan.c 1.7 + create SCMS Bit + set COPY Bit in TOC and sub channels + +Tue Mar 26 19:10:32 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.161 + Version -> 1.11a19 + +Tue Mar 26 19:07:15 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * auinfo.c 1.14 + Albumperformer= new + +Tue Mar 26 19:02:58 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdtext.c 1.7 + textfile= not-existent caused a Coredump + +Sun Mar 24 23:39:28 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.160 + SCMS and Copy permitted printing new, Version -> 1.11a18 + +Sun Mar 24 23:38:11 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * auinfo.c 1.13 + SCMS as new value for Copy_permitted= + +Sun Mar 10 00:24:19 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.159 + Print real write speed + +Sat Mar 9 23:21:05 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.82 + remiove typo in hasdrvopt() + +Sat Mar 9 23:03:00 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.81 + first VariRec Support + +Sat Mar 9 21:15:48 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.65 + Burn-PROOF Support new, try tp make Panasonic DVD-R working + +Sat Mar 9 20:20:16 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.158 + IS_SCHILY_XCONFIG new, Short Usage with susage() new + +Fri Mar 8 16:48:58 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.157 + Version print Lizens better, -cdi sets toctype + +Fri Mar 8 16:46:54 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.82 + Version -> 0.6 + +Tue Mar 5 23:34:46 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * defaults.c 1.8 + NULL Pointer for args is now OK to allow to be used with readcd + +Tue Mar 5 23:32:00 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.90 + getnum()/getllnum() from cdrecord.c -> getnum.c + +Tue Mar 5 23:26:31 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.156 + Version -> 1.11a17 + getnum()/getllnum() -> getnum.c + cdr_defaults() changed to allow to be used with readcd.c + +Tue Mar 5 23:20:48 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * getnum.c 1.1 + date and time created 02/03/05 23:20:48 by joerg + +Mon Mar 4 23:42:43 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.34 + * drv_mmc.c 1.80 + * drv_dvd.c 1.64 + * scsi_cdr.c 1.113 + * drv_simul.c 1.23 + * fifo.c 1.34 + * crc16.c 1.5 + * crc16.h 1.3 + * cdrecord.h 1.89 + Copyright -> 2002 + +Mon Mar 4 23:32:08 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdtext.h 1.2 + Comment for Text Language code now better + +Mon Mar 4 23:21:31 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.155 + better comment for Version printing for not working Branches + +Mon Mar 4 22:43:47 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.154 + Comments for Sector size + +Mon Mar 4 22:42:12 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * defaults.c 1.7 + Copyright -> 2002 + new Function open_cdrdefaults(), + Comment that states that "/etc/default/cdrecord" may not be changed + +Fri Mar 1 22:37:21 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.33 + Better Text for unknown ID Codes + +Thu Feb 28 23:04:45 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * auinfo.c 1.12 + readtstr() now looks for rightmost ' from right to left, + readtag("CDINDEX_DISCID=") -> readtstr("CDINDEX_DISCID=") + +Sun Feb 24 15:44:34 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.153 + Copyright -> 2002 + +Sat Feb 23 22:00:51 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdtext.c 1.6 + First Support for CD-Text Synthesis with new functions text_txt()/packtext()/anytext()/fillup_pack()/fillpack() + +Sat Feb 23 21:44:33 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdtext.h 1.1 + date and time created 02/02/23 21:44:33 by joerg + +Sat Feb 23 21:21:10 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.61 + -text/textfile= Options documented + +Sat Feb 23 21:17:42 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.152 + Version -> 1.11a15, Option -text new, char * textfile not global anymore + +Sat Feb 23 21:10:53 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * auinfo.c 1.11 + First CD-Text Support + +Sat Feb 23 17:24:48 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.88 + void *text new in struct track, packtext() Prototype new + +Sat Feb 23 16:01:50 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.79 + CD-Text Cue sheet for Lead-in does not depend anymore from char *textfile but from trackp[0].flags & TI_TEXT + +Wed Feb 20 19:39:39 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.112 + * drv_dvd.c 1.63 + * drv_simul.c 1.22 + * fifo.c 1.33 + #ifndef DEBUG around #define DEBUG + +Tue Feb 19 22:10:23 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdtext.c 1.5 + setuptextdata() new + +Fri Feb 15 00:46:56 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * crc16.h 1.2 + * crc16.c 1.4 + flip_crc_error_cor() with bsize Parameter and EXPORT instead of LOCAL + cdtext_crc_ok() removed -> cdtext.c + +Fri Feb 15 00:42:47 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdtext.c 1.4 + Flip error correction for Text CRC correction + Automatic Text Size Header recognition + +Sun Feb 10 12:43:07 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-openserver.c 1.29 + MAX-DMA -> 63kB, -scanbus contolled by env Vars + +Sat Feb 9 17:29:02 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.32 + Warning for guessed IDs + +Tue Jan 29 20:46:42 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.31 + Removed wrong (now superfluous) IDs + +Thu Jan 24 00:03:25 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.30 + "Advanced Digital Media", "Moser Baer India Limited", "NAN-YA Plastics Corporation", "SHENZEN SG&GAST DIGITAL OPTICAL DISCS" new from Plextools binary + m_grandadvance[] was superfluous (m_grandadv[]) + "WEALTH FAIR INVESTMENT LIMITE" typo fixed (D missing). + +Fri Jan 18 12:43:58 2002 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.69 + do not try to use the PG driver if open(device) fails + +Fri Dec 7 22:40:31 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.111 + scsi_in_progress() with additional sense qualifier 0x04 for CyberDrive + +Sun Dec 2 15:42:53 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-beos.c 1.20 + Typo removed, Support for BeOS 5 + +Sun Dec 2 15:37:36 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-amigaos.c 1.2 + Reworked the error handling code + +Sun Dec 2 13:44:43 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-amigaos.c 1.1 + date and time created 01/12/02 13:44:43 by joerg + +Tue Nov 27 20:25:39 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.40 + Copyright + 2001 + +Tue Nov 27 20:24:18 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.39 + scsi-amigaos.c new + +Tue Nov 27 02:10:34 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.151 + NEED_SYS_SOCKET_H for BeOS new + Version -> 1.11a13 + cdr_buffer_cap() environment for Plasmon RF41xx better + +Tue Nov 27 02:08:47 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.47 + Comment for buffer_cap dummy function for the Plasmon RF41xx better + +Tue Nov 13 16:17:05 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.87 + * drv_dvd.c 1.62 + * cdrecord.c 1.150 + New Flag DSF_DVD, better overcapacity output for DVD + +Sun Nov 11 18:30:47 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.61 + Comment for ACARD TECH AEC-7720 ATAPI<->SCSI adaptor better + +Sun Nov 11 17:53:42 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-remote.c 1.8 + Test HAVE_RCMD new + +Thu Nov 1 19:15:46 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_simul.c 1.21 + Now using timedefs.h + +Wed Oct 31 19:29:35 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.110 + For ACARD TECH AEC-7720 ATAPI<->SCSI adaptor read Mode Page list only in debug mode + +Wed Oct 31 00:24:58 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.109 + sense_secsize() now calles mode_sense() first with 12 Bytes and again with 0xFE Bytes for Moge Page List + +Wed Oct 31 00:17:27 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.78 + check_writemodes_mmc() -> EXPORT, read_dvd_structure() now with mit 32 byte instead of 15 bytes len Parameter + +Wed Oct 31 00:06:47 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.86 + Prototyp for check_writemodes_mmc() + +Tue Oct 30 23:12:03 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsireg.h 1.26 + cd_mode_page_05 intel byteorder link_size was wrong + +Tue Oct 30 21:36:53 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.147 + DVD Check code did code exit() for non MMC CD writers + version -> 1.11a10 + +Mon Oct 29 19:12:29 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-mac-iokit.c 1.3 + Include Liste reworked + +Mon Oct 29 18:57:46 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cd_misc.c 1.10 + * misc.c 1.2 + * modes.c 1.24 + * diskid.c 1.29 + * drv_simul.c 1.20 + * fifo.c 1.32 + * wm_track.c 1.3 + * wm_session.c 1.3 + * wm_packet.c 1.16 + avoid sys/types.h + +Sat Oct 27 02:56:16 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-remote.c 1.7 + Test for HAVE_NETDB_H for rcmd() + +Sat Oct 27 02:55:30 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsierrs.c 2.27 + #include <unixstd.h> for size_t for snprintf() + +Sat Oct 27 02:53:49 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.31 + Test for HAVE_FORK new + +Sat Oct 27 02:53:18 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdtext.c 1.3 + casts because sizeof() on MacOS X is long + +Thu Oct 25 16:19:08 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-mac-iokit.c 1.2 + Unitnitialised Var dict, plugInResult format string ... GCC error removed + +Thu Oct 25 02:03:56 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.38 + Support for MaxOS X (Darwin-1.4) + +Thu Oct 25 02:03:11 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-mac-iokit.c 1.1 + date and time created 01/10/25 01:03:11 by joerg + +Wed Oct 17 19:40:22 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.146 + initialize scgp with NUL + brackets around if (p = senv_field(6)) + +Tue Oct 16 17:03:53 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.57 + * cdrecord.c 1.144 + * cdrecord.h 1.85 + * drv_simul.c 1.19 + * drv_sony.c 1.48 + * drv_philips.c 1.46 + * drv_mmc.c 1.77 + * drv_jvc.c 1.57 + New Structuremember cdr_cmdflags in cdr_t + +Tue Oct 16 15:57:05 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.143 + Better error messages for DVD Demo Mode > 1 GB + +Wed Oct 10 23:04:03 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.139 + number() corrected - had wrong if/then/else Structure for T/P/G Multiplyer + +Tue Oct 9 02:19:36 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.138 + sys/types.h & sys/stat.h -> statdefs.h, -> 1.11a09 + +Tue Oct 9 01:42:05 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * audiosize.c 1.18 + * isosize.c 1.8 + sys/types.h & sys/stat.h -> statdefs.h + +Sun Oct 7 21:27:14 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-pg.c 1.40 + * scsi-linux-sg.c 1.68 + Better error messages for Scanbus if /dev/sg* or /dev/pg* cannot be opened + +Sun Oct 7 21:03:23 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.76 + Modifications to allow recognition of CD/DVD writer + +Sun Oct 7 20:41:51 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdr_drv.c 1.25 + xdebug for DVD/CD writer recognition + +Sun Oct 7 19:01:25 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.55 + read_dvd_structure() from drv_dvd.c -> scsi_cdr.c for Pioneer A03 DVD-R/CD-R + reload_media() only if writing later + +Sun Oct 7 13:35:21 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.108 + * cdrecord.h 1.84 + read_dvd_structure() from drv_dvd.c -> scsi_cdr.c for Pioneer A03 DVD-R/CD-R + +Thu Sep 27 19:01:30 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsidefs.h 1.27 + #undef DEV_UNKNOWN for True64 + +Thu Sep 13 19:10:03 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.107 + * cdr_drv.c 1.24 + * drv_dvd.c 1.54 + * cdrecord.h 1.83 + Modifications to allow recognition of CD/DVD writer + +Thu Sep 13 19:01:46 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.137 + cdrecord -version now may print cdrecord-Clone, + Modifications to allow recognition of CD/DVD writer + +Thu Sep 13 15:36:21 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsidefs.h 1.26 + DEV_MMC_DVD_WR new + +Thu Sep 13 14:31:05 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sun.c 1.70 + maxdma for USCSI to default if == -1 (e.g. for TAPE), Debug print the RQ Buffer. + +Tue Sep 11 14:04:03 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.106 + Open CD-Text File in Binary + +Tue Sep 11 03:06:31 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.67 + Timeout Workaround for ioctl() + +Tue Sep 4 14:04:25 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.136 + DEMO_SPEED new + +Thu Aug 9 16:38:21 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.82 + * cdrecord.c 1.135 + #define GRACE_TIME 9 new + +Fri Jul 20 13:17:21 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.75 + * cdrecord.c 1.134 + * cdrecord.h 1.81 + RF_BLANK new to avoid opening the tray before blanking + Version -> 1.11a07 + +Thu Jul 19 00:28:36 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-remote.c 1.6 + Now using _niread()/_nixwrite() + +Thu Jul 12 23:40:28 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsidefs.h 1.25 + Taiyo Yuden EW-50 new + +Thu Jul 12 23:35:08 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.105 + * cdr_drv.c 1.23 + * drv_philips.c 1.45 + New driver for Taiyo Yuden EW-50 because it swabs audio bytes compared to Philips CDD-521 + +Thu Jul 12 23:33:28 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.30 + Better Debug messages for FIFO adresse/size + +Thu Jul 5 00:08:38 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * sector.c 1.5 + Match new libedc + +Thu Jun 28 13:19:02 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.74 + Use -DSAO_RAW -DSAO_RAW_TEST for SAO RAW tests only + +Wed Jun 27 10:04:03 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * clone.c 1.4 + clone_cue() for Test + +Wed Jun 27 09:51:19 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.133 + CDR_SRAW16 removed + +Wed Jun 27 09:47:10 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsimmc.h 1.6 + * scsi_cdr.c 1.104 + struct ftrackdesc -> scsimmc.h + +Wed Jun 27 09:35:13 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.103 + struct tocheader definition removed because it is in scsimmc.h + +Sun Jun 24 22:35:23 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.73 + check_writemodes_mmc() now resety silent correctly, deflt_writemodes_mmc() new + +Sun Jun 24 19:55:02 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.80 + CDR_SRAW16 disabled, because SAO supports only RAW96x + +Fri Jun 22 08:42:55 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsimmc.h 1.5 + struct tocheader now with Uchar + +Wed Jun 20 21:53:55 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * subchan.c 1.6 + min Struktur member -> pmin + +Wed Jun 20 21:53:34 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdr_drv.c 1.22 + #include <stdio.h> for printf() + +Wed Jun 20 21:53:03 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.132 + Changes for GCC-3.0 & Linux include file bugs for printf() (is a #define), 1.11a04 -> 1.11a05 + +Tue Jun 19 12:26:49 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.131 + Usage() with textfile=, 1.11a03 -> 1.11a04 + +Tue Jun 19 12:22:30 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdtext.c 1.2 + Modifications for RAW CD-Text + +Tue Jun 19 11:39:08 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.79 + * subchan.c 1.5 + addrw() new for CD-Text Support in RAW mode + +Tue Jun 19 02:10:37 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.78 + * cdrecord.c 1.130 + BUF_SIZE -> CDR_BUF_SIZE & from cdrecord.c -> cdrecord.h + +Tue Jun 19 01:04:54 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.129 + Do not call exit() if interrupting during wait time via ^C + +Mon Jun 18 09:29:52 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdtext.c 1.1 + date and time created 01/06/18 08:29:52 by joerg + +Mon Jun 18 08:55:07 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.72 + * cdrecord.c 1.128 + * cdrecord.h 1.77 + First CD-Text Support + +Sat Jun 16 19:20:36 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.127 + trackp->dataoff new, call on_comerr() earlier + +Sat Jun 16 18:16:51 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.76 + Dataoffset in struct track new, is_text() new + +Sat Jun 16 18:15:05 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.71 + Forgotten if (xdebug) + +Tue Jun 12 22:57:03 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.126 + -clone new, write mode for -xa1 -xa2, RAW data bug removed + +Tue Jun 12 22:42:25 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * sector.c 1.4 + recodesectors() -> subrecodesecs()/sunchan.c, scrsectors() without return for AUDIO + +Tue Jun 12 22:41:37 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * subchan.c 1.4 + subrecodesecs() from sector.c & scrsectors() dummy + +Tue Jun 12 22:40:59 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.75 + recodesectors() -> subrecodesecs() + +Tue Jun 12 01:51:49 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.74 + Modifications for clone.c + +Tue Jun 12 01:50:53 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * clone.c 1.1 + date and time created 01/06/12 00:50:53 by joerg + +Tue Jun 12 01:07:06 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * subchan.c 1.3 + subq/nsubh -> _subq/_nsubh + +Tue Jun 12 01:05:54 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * subchan.c 1.2 + Changes for clone writing, qwto16() new for clone 16/96 Writing + +Tue Jun 12 00:12:42 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * sector.c 1.3 + removed unused Vars + +Mon Jun 11 23:31:00 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.73 + Enhancements for clone writing + +Mon Jun 11 23:29:50 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * sector.c 1.2 + scrsectors()/recodesectors() fuer clone writing neu + +Mon Jun 11 23:12:41 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.70 + Checking write modes Message only with xdebug + +Mon Jun 11 23:11:55 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * movesect.c 1.2 + Make it more general to allow compress and expand + +Mon Jun 11 23:09:58 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * auinfo.c 1.10 + Comment for ISRC + +Sat Jun 9 20:13:35 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.125 + -copy/-nocopy new, Prevent data sectors only in RAW Mode (without libedc_ecc) + +Sat Jun 9 20:05:59 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.60 + New Options -raw, -raw96r, -raw96p, -raw16, -copy, -nocopy + +Wed Jun 6 00:09:58 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.124 + Any positive startsector for RAW is wriong -> Philips Firmware bug fixed + +Mon Jun 4 19:28:17 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.123 + Modifications for RAW Mode + cdr_t *dp now allocated + BURNFREE printput with Driver Flags + OPC also for -blank + write_secs() new for all writes on ATAPI + print_wrmodes()/check_wrmode() new + reload_media() new + +Mon Jun 4 17:45:49 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.72 + * drv_dvd.c 1.53 + * drv_mmc.c 1.69 + New Function reload_media() + +Mon Jun 4 17:08:05 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.71 + * wm_packet.c 1.15 + Modifications for RAW Mode + +Mon Jun 4 17:06:21 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * subchan.c 1.1 + date and time created 01/06/04 16:06:21 by joerg + +Mon Jun 4 16:52:34 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * crc16.c 1.3 + Now correct Code with Inverted CRC Bits + +Mon Jun 4 16:49:47 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * auinfo.c 1.9 + SECT_AUDIO_NPRE -> SECT_AUDIO_NOPRE + +Mon Jun 4 16:06:15 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * crc16.c 1.2 + Now using Uint*_t + +Mon Jun 4 16:02:17 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * crc16.h 1.1 + date and time created 01/06/04 15:02:17 by joerg + +Mon Jun 4 13:33:19 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.68 + Now using CDR_SRAW*, botchexit Abort removed + +Mon Jun 4 12:53:18 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * sector.c 1.1 + date and time created 01/06/04 11:53:18 by joerg + +Sun Jun 3 20:51:22 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * auinfo.c 1.8 + Modifications for RAW Mode + +Sun Jun 3 14:48:57 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.122 + Use comexit()/comerr() instead of exscsi() + New Function do_opc() now also called before blank, -force avoids this + +Sat Jun 2 21:24:52 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * movesect.h 1.1 + * movesect.c 1.1 + date and time created 01/06/02 20:24:52 by joerg + +Fri Jun 1 07:54:04 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.59 + burnproof -> burnfree + +Fri Jun 1 07:46:01 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.102 + BURN-Proof (Sanyo) -> Buffer-Underrun-Free recording + +Fri Jun 1 07:44:39 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.29 + call fill_buf() instead of read_buf() and trackp/secno Parameter for Subcode Generator + +Fri Jun 1 02:08:55 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.67 + BURN-Proof -> BURN-Free + +Thu May 31 23:31:44 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsireg.h 1.25 + BURN Free & link size new + +Thu May 31 03:21:47 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.66 + check_writemodes_mmc() new, is_raw() set write modes + +Mon May 28 00:51:36 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cd_misc.c 1.9 + sec_to_msf() new + +Sun May 27 14:01:28 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * audiosize.c 1.17 + Better comment + +Thu May 24 19:10:28 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * auinfo.c 1.7 + No exit() if -debug & nindex > 1 + +Thu May 24 19:09:39 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * modes.c 1.23 + Warning using default data only if not in Silent mode + +Thu May 24 19:07:13 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.52 + * drv_jvc.c 1.56 + * drv_simul.c 1.18 + * drv_philips.c 1.44 + * drv_sony.c 1.47 + CDR_DAO -> CDR_SAO, SAO no more predefined - it either does not work or is tested automatically (MMC) + +Sun May 20 21:23:53 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.46 + * drv_philips.c 1.43 + mask sectype with ST_MASK because of new mode bits + +Sun May 20 18:51:41 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_simul.c 1.17 + CDR_SIMUL Flag new + +Fri May 18 21:07:58 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.70 + F_OVERBURN new, F_RAW / is_raw() new, CDR_SIMUL new + +Fri May 18 19:30:02 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.121 + trackp[0].dbtype is set with Data type from Track 1 + +Fri May 18 19:22:50 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.65 + In open_session() wird nun schon der Datenblocktyp fuer den ersten track eingestellt + +Mon May 14 23:36:07 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.120 + -overburn new + Bracket bug with > 90 min Warning removed + > 90 Min Warning only if offizial capacity is exceeded (for DVD-R) + -pad implied for next Track with -isosize + Win32 Priorities are non contiguous (fix in rt_raisepri()) + +Mon May 14 22:54:17 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.69 + F_OVERBURN (-overburn) new + +Mon May 14 22:53:33 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.58 + -overburn new, -isosize better documented + +Sat Apr 28 23:34:12 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-remote.c 1.5 + Read char with buffer for cygwin + +Fri Apr 20 11:38:03 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.81 + scg_svhead() is silent if non verbose + +Fri Apr 20 11:34:41 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.66 + Hack for ide-scsi bug, although there is sense data, SCSI Status is 0 + +Thu Apr 19 21:52:41 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.64 + removed superfluous scgp->silent--; in fixate_mmx(). silent did become negative + +Thu Apr 19 21:51:26 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.119 + Enhance wait time in wait_unit_ready() after blank to 240 s for Mitsumi + +Tue Apr 17 00:58:57 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.57 + Hint for mailman interface + +*************** Release 1.10 ******************* + +Fri Apr 13 20:41:36 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.118 + Version -> 1.10 final + +Fri Apr 13 20:40:58 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.117 + Backwardcounter corrected + +Fri Apr 13 20:39:09 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.56 + New Support mail Adresses + +Wed Apr 11 01:22:18 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.101 + * cdrecord.h 1.68 + print_capacity() new with FILE * Parameter + +Sun Apr 8 02:03:49 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * modes.c 1.22 + scgp->silent--; was oat wrong place + +Sun Apr 1 14:39:01 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.55 + Typo + +Sat Mar 31 23:02:28 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * modes.c 1.21 + unit_ready() before each mode_sense()/mode_select() + +Sat Mar 31 22:46:28 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.63 + Comment for IOMEGA DMA overrun modified (Philips removed) + +Sun Mar 18 19:39:48 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.54 + REMOTE SCSI description and new unified SCSI Options + +Sun Mar 18 19:31:31 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.116 + Unified SCSI Options + +Sun Mar 18 19:27:02 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.80 + Fixed bug that printed SCSI timing without verbose + +Sun Mar 18 18:37:45 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.79 + New Functions: scg_svhead()/scg_svtail()/scg__sprinterr() + Comments for Functions + Print SCSI timing for earch failed SCSI Command + +Sun Mar 18 18:28:17 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.50 + New Funstions: scg_svhead()/scg_svtail()/scg__sprinterr() + +Sun Mar 18 15:37:09 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.78 + Print Timing without Verbose + +Sun Mar 18 15:10:18 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.27 + * scsi-vms.c 1.29 + * scsi-unixware.c 1.25 + * scsi-sgi.c 1.34 + * scsi-osf.c 1.23 + * scsi-next.c 1.30 + * scsi-linux-sg.c 1.65 + * scsi-hpux.c 1.29 + * scsi-linux-pg.c 1.39 + * scsi-bsd.c 1.40 + * scsi-bsd-os.c 1.26 + * scsi-beos.c 1.19 + * scsi-aix.c 1.33 + if (scgp->debug) -> if (scgp->debug > 0) + +Wed Mar 14 00:42:40 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.49 + * scsitransp.c 1.77 + scg_verbose() -> scg_vsetup() + +Mon Mar 12 23:09:38 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.115 + Version -> 1.10a17, select_target() uses FILE * + +Mon Mar 12 23:08:46 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_scan.h 1.3 + * scsi_scan.c 1.14 + comerrno() removed + select_target() with FILE * + select_target() returns number of Targets + +Mon Mar 12 23:06:50 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.67 + * scsi_cdr.c 1.100 + printinq() new + +Mon Mar 12 22:06:05 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.64 + Better differentiation SCG_RETRYABLE/SCG_NO_ERROR + Set ux_errno if Sense Data present + +Sun Mar 11 17:10:12 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-pg.c 1.38 + SCG_RETRYABLE for DMA overrun + CHECK CONDITION == SCG_NO_ERROR + +Sun Mar 11 17:07:48 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.76 + Remove unused Variables + +Sun Mar 11 16:56:24 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.48 + scg_vhead()/scg_vtail()/scg_verbose() & scg_errfflush() new + +Sun Mar 11 16:55:55 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.75 + scg_vhead()/scg_vtail()/scg_verbose() & scg_errfflush() new + Version -> 0.5 + +Sat Mar 10 17:53:45 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.47 + scgp->bufptr new + SCG_KVERSION new + +Sat Mar 10 17:52:53 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.74 + scgp->bufptr new + scgp->scmd->resid < 0 == DMA overrun + +Sat Mar 10 16:24:00 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.63 + SCG_KVERSION new + +Mon Feb 26 22:20:32 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-unixware.c 1.24 + New formatting + +Mon Feb 26 22:18:39 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-unixware.c 1.23 + Environment "LIBSCG_SCAN_ALL" controls scanning of Harddisks because of system crash + +Mon Feb 26 16:05:41 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.114 + Warning if DVD-R code is missing and we found a DVD-R drive + +Sun Feb 25 13:02:42 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.27 + Now using mmapdefs.h + +Fri Feb 23 17:32:38 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsidefs.h 1.24 + ccs() Makro -> is_ccs() + +Fri Feb 23 00:24:02 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.26 + Support for mmap() on Apollo Domain/OS with mmap(0, &size, ...) + +Thu Feb 22 16:13:27 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * audiosize.c 1.16 + Fixed bug in Prototyp (result from long -> off_t) + +Thu Feb 22 16:11:07 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.66 + * wm_packet.c 1.14 + * cdrecord.c 1.113 + * drv_mmc.c 1.62 + * drv_jvc.c 1.54 + * drv_dvd.c 1.51 + Large File support + +Thu Feb 22 16:10:53 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.55 + padsize Parameter for pad_track() casted to Llong + +Thu Feb 22 00:57:53 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdr_drv.c 1.21 + mconfig.h/unixstd.h for Large Files + +Thu Feb 22 00:55:35 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_scan.c 1.13 + #include <mconfig.h> for Large Files + +Thu Feb 22 00:54:26 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.25 + Large File support + Casts for sizeof() [long] on MaxOS X + +Wed Feb 21 23:32:51 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * defaults.c 1.6 + #include unixstd.h for Large Files + +Wed Feb 21 23:27:48 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * auinfo.c 1.6 + * isosize.c 1.7 + * audiosize.c 1.15 + Large File support + +Tue Feb 20 23:56:44 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.45 + * drv_philips.c 1.42 + unixstd.h for sys/types.h for off_t in cdrecord.h + +Thu Feb 15 23:09:12 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.37 + Test for HAVE_BSD_DEV_SCSIREG_H for new MacOSX + +Fri Feb 9 00:35:50 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.41 + Fixes for Plasmon RF 4100 + +Tue Jan 23 12:20:32 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * modes.c 1.20 + Cast for singed/unsigned cmparison + +Mon Jan 15 01:09:05 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.24 + %x -> %p Format + +Sun Jan 7 19:46:42 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.36 + scsi-apollo.c new + +Sun Jan 7 19:39:40 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.73 + * scsi-vms.c 1.28 + * scsi-unixware.c 1.22 + * scsi-linux-pg.c 1.37 + * scsi-aix.c 1.32 + sense_len check -> scsitransp.c + +Tue Jan 2 00:09:45 2001 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.72 + sccsid[] is always used -> without #ifdef lint + +Fri Dec 29 00:06:35 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.112 + Lint, 1.10a10, rlimit cast to Llong for SGI + +Thu Dec 28 23:19:23 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.99 + Modified for Lint + +Wed Dec 20 18:26:01 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sgi.c 1.33 + Cast to caddr_t for SENSEBUF(dsp) + +Wed Dec 13 20:22:52 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-pg.c 1.36 + Cast s_cmd.addr = (caddr_t)sp->u_sense.cmd_sense; + +Tue Dec 12 15:20:46 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.46 + struct scsi -> struct scg_scsi for AIX + +Sat Dec 9 22:52:01 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.62 + Recognise ENOTTY as errno for failed ioctl() + +Sat Dec 9 18:20:25 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * modes.c 1.19 + * scsilog.c 1.13 + * drv_sony.c 1.44 + * drv_philips.c 1.40 + * drv_mmc.c 1.61 + * drv_jvc.c 1.53 + * drv_dvd.c 1.50 + u_char -> Uchar + +Wed Dec 6 12:43:51 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.111 + atoll() -> libschily + +Wed Nov 29 17:22:15 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-vms.c 1.27 + Indented + +Wed Nov 29 17:18:51 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-vms.c 1.26 + ATAPI Support and changed for new libscg Interface + +Fri Nov 24 11:00:58 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.110 + Workaround for ACER drive that does not return from -dummy + Typo in online Help + +Wed Nov 8 00:06:05 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.45 + * scsireg.h 1.24 + * scsidefs.h 1.23 + * scgio.h 2.16 + #ifdef __cplusplus extern "C" { + +Sat Nov 4 15:00:50 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.23 + * cdrecord.c 1.109 + Printf-like Formats cleaned up + +Sat Nov 4 14:56:09 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.98 + PIONEER CD-WO DR-R504X -> DEV_PIONEER_DW_S114X + +Sat Nov 4 14:52:43 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.65 + DEFAULT_FIFOSIZE -> Long Constant + +Tue Oct 31 15:58:54 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.108 + Cygwin-1.x Compatibility + +Sun Oct 22 13:37:15 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-aix.c 1.31 + Type in sizeof(devname removed + +Tue Oct 17 10:35:34 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.53 + SEE ALSO enhanced + +Fri Oct 13 11:28:51 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.61 + use pg_version() only for PP + +Wed Sep 20 00:59:38 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * modes.c 1.18 + Code reordered so DMA overrun messages only appears once + +Sun Sep 17 17:15:06 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.64 + #define sample -> #define msample for Win32 + +Fri Sep 8 03:04:50 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * modes.c 1.17 + Warning for Philips DMA overrun + +Wed Sep 6 23:41:34 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.97 + unit_ready() made better + +Wed Sep 6 09:59:05 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.71 + * scsitransp.h 1.44 + scg_cmderr() -> scg_cmd_err(), scg_cmd_status() new + +Tue Sep 5 03:32:34 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.70 + Default printing to stderr + +Tue Sep 5 03:06:01 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.69 + scg__open() returns -1 when SCGO_OPEN fails, to avoid calling scg_fileno() + +Tue Sep 5 02:30:41 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.96 + allow_atapi() calls unit_ready() before mode_sense() to make it work past a reset + +Tue Sep 5 02:28:03 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * modes.c 1.16 + Minimal transfer sizeof(struct scsi_mode_header) after DMA overrun + +Tue Sep 5 02:22:48 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.60 + read_toc()/read_disk_info() reads minimal 4 bytes for Philips ATAPI drives + +Mon Sep 4 20:24:52 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.52 + Typo removed + +Sat Sep 2 21:16:00 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.43 + Drive flags new in SCSI * + +Sat Sep 2 21:03:48 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.26 + * scsi-vms.c 1.25 + * scsi-unixware.c 1.21 + * scsi-sgi.c 1.32 + * scsi-osf.c 1.22 + * scsi-os2.c 1.21 + * scsi-next.c 1.29 + * scsi-linux-sg.c 1.60 + * scsi-linux-pg.c 1.35 + * scsi-hpux.c 1.28 + * scsi-bsd.c 1.39 + * scsi-bsd-os.c 1.25 + * scsi-aix.c 1.30 + * scsi-beos.c 1.18 + All debug printing to stderr (scgp->errfile) + +Tue Aug 29 23:44:31 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-next.c 1.28 + * scsi-bsd-os.c 1.24 + error codes & return harmonised + +Tue Aug 29 02:36:09 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.59 + set curspeed only if > 0 (SCSI-3 floating point exception in waitfix) + +Tue Aug 29 02:35:04 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_scan.c 1.12 + call scg_settarget() in scanbus, to make sure SCSI address for scg_initator_id() is OK + +Sat Aug 26 10:20:43 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.58 + OPC Hack for strange drive that returns from OPC with "UNIT ATTENTION/operator selected write permit" + +Sat Aug 26 10:15:03 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.107 + Enhancements for remote SCSI, scg_reset() with what Parameter + +Sat Aug 26 00:53:10 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.35 + * scsitransp.c 1.68 + scsibus/target/lun acess now only with scg_scsibus()/scsi_target()/scg_lun() and scg_settarget() + do not initialize target in struct scg_cmd because this is now done in SCG lowlevel code + scg__open() from scsihack.c -> scsitransp.c, scg_settarget() -> scgsettarget.c + dummy code it now always present + +Sat Aug 26 00:22:51 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.42 + scg_settarget() -> scgsettarget.c + +Fri Aug 25 23:17:25 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.25 + * scsi-vms.c 1.24 + * scsi-unixware.c 1.20 + * scsi-sgi.c 1.31 + * scsi-osf.c 1.21 + * scsi-os2.c 1.20 + * scsi-next.c 1.27 + * scsi-linux-sg.c 1.59 + * scsi-linux-pg.c 1.34 + * scsi-hpux.c 1.27 + * scsi-bsd.c 1.38 + * scsi-bsd-os.c 1.23 + * scsi-beos.c 1.17 + * scsi-aix.c 1.29 + scsibus/target/lun acess now only with scg_scsibus()/scsi_target()/scg_lun() and scg_settarget() + do not initialize target in struct scg_cmd because this is now done in SCG lowlevel code + +Thu Aug 24 00:52:32 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.41 + scg Address Stucture new + scg__open() without bus/target/lun Parameter + scg_remote() new + +Wed Aug 23 22:44:26 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_scan.c 1.11 + * scsilog.c 1.12 + * drv_dvd.c 1.49 + * drv_jvc.c 1.52 + * drv_philips.c 1.39 + * drv_sony.c 1.43 + * scsi_cdr.c 1.95 + scsibus/target/lun acess now only with scg_scsibus()/scsi_target()/scg_lun() and scg_settarget() + do not initialize target in struct scg_cmd because this is now done in SCG lowlevel code + +Sun Aug 20 20:57:32 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.40 + * scsitransp.c 1.67 + * scsihack.c 1.34 + * scsi-linux-sg.c 1.58 + * scsi-linux-pg.c 1.33 + * scsi-sgi.c 1.30 + * scsi-next.c 1.26 + * scsi-hpux.c 1.26 + * scsi-bsd.c 1.37 + * scsi-aix.c 1.28 + * scsi_scan.c 1.10 + Now using scg_settarget() + +Sat Aug 19 23:24:03 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.66 + * scsihack.c 1.33 + * scsi-wnt.c 1.24 + * scsi-vms.c 1.23 + * scsi-unixware.c 1.19 + * scsi-sgi.c 1.29 + * scsi-osf.c 1.20 + * scsi-os2.c 1.19 + * scsi-next.c 1.25 + * scsi-linux-sg.c 1.57 + * scsi-linux-pg.c 1.32 + * scsi-hpux.c 1.25 + * scsi-bsd.c 1.36 + * scsi-beos.c 1.16 + * scsi-bsd-os.c 1.22 + * scsi-aix.c 1.27 + * scsitransp.h 1.38 + scg_reset() with Function code Parameter + +Sat Aug 19 22:37:30 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.63 + * scsitransp.h 1.39 + #ifdef's modified for new #define _SCG_*_H + +Sat Aug 19 21:57:31 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsireg.h 1.23 + * scsidefs.h 1.22 + * scgio.h 2.15 + Correctly made multi include safe with #ifdef _SCG_* + +Sat Aug 19 21:05:25 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.65 + sys/param.h removed + +Sat Aug 19 20:52:31 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.37 + Now using scg_ops + Remote Version #defines, scg__version() removed + +Sat Aug 19 20:23:20 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sgi.c 1.28 + * scsi-osf.c 1.19 + * scsierrs.c 2.26 + * scsitransp.c 1.64 + * scsireg.h 1.22 + u_char -> Uchar + +Sat Aug 19 19:13:16 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.63 + * scsihack.c 1.32 + scsitransp.c and scsihack.c separated + +Sat Aug 19 17:30:28 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsireg.h 1.21 + Status & Sense Definitions from scsireg.h + +Fri Aug 18 10:40:48 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-vms.c 1.22 + * scsi-wnt.c 1.23 + * scsi-unixware.c 1.18 + * scsi-sgi.c 1.27 + * scsi-osf.c 1.18 + * scsi-os2.c 1.18 + * scsi-next.c 1.24 + * scsi-linux-sg.c 1.56 + * scsi-linux-pg.c 1.31 + * scsi-hpux.c 1.24 + * scsi-bsd.c 1.35 + * scsi-bsd-os.c 1.21 + * scsi-beos.c 1.15 + * scsihack.c 1.31 + * scsi-aix.c 1.26 + * scsitransp.c 1.62 + Now uses scg_ops Structure and calling via pointers + +Thu Aug 17 22:50:53 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.61 + Bracketing typo in scg_sprintresult() removed (printed junk) + +Wed Aug 16 10:11:08 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.22 + * scsi-vms.c 1.21 + * scsi-unixware.c 1.17 + * scsi-sgi.c 1.26 + * scsi-os2.c 1.17 + * scsi-osf.c 1.17 + * scsi-next.c 1.23 + * scsi-linux-sg.c 1.55 + * scsi-hpux.c 1.23 + * scsi-linux-pg.c 1.30 + * scsi-bsd.c 1.34 + * scsi-beos.c 1.14 + * scsi-bsd-os.c 1.20 + * scsi-aix.c 1.25 + * scsihack.c 1.30 + * scsitransp.c 1.60 + scg_send() now only with scgp* Parameter + +Sun Aug 13 23:31:37 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.59 + Buggy braketing corrected (printed 4-5 null Bytes to error output even in silent mode) + +Fri Aug 4 01:26:24 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.36 + * scsitransp.c 1.58 + Komplett umgebaut damit die Fehlerausgabe in einen String erfolgt + +Tue Aug 1 00:03:45 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.35 + * scsitransp.c 1.57 + * scsierrs.c 2.25 + * scsi-wnt.c 1.21 + * scsi-vms.c 1.20 + * scsi-unixware.c 1.16 + * scsi-sgi.c 1.25 + * scsi-osf.c 1.16 + * scsi-os2.c 1.16 + * scsi-next.c 1.22 + * scsi-linux-sg.c 1.54 + * scsi-linux-pg.c 1.29 + * scsi-hpux.c 1.22 + * scsi-bsd.c 1.33 + * scsi-bsd-os.c 1.19 + * scsi-beos.c 1.13 + * scsi-aix.c 1.24 + All printf()'s -> js_printf(), sprintf() -> snprintf() + +Sun Jul 30 15:15:34 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.56 + * scsitransp.h 1.34 + scg_prbytes()/scg_prsense() & scg_printdev() INterface restructured + +Sun Jul 30 13:52:05 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * wm_packet.c 1.13 + * scsi_scan.c 1.9 + * scsilog.c 1.11 + * cdrecord.c 1.106 + * scsi_cdr.c 1.94 + * modes.c 1.15 + * drv_sony.c 1.42 + * drv_simul.c 1.16 + * drv_philips.c 1.38 + * drv_mmc.c 1.57 + * drv_jvc.c 1.51 + * drv_dvd.c 1.48 + Restructured for new libscg with scg_*() + +Thu Jul 27 01:17:47 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.55 + scg_prbytes()/scg_printdev() now using FILE * Parameter + scg__errmsg() restructured to be similar to snprintf() + +Thu Jul 27 01:15:54 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsierrs.c 2.24 + Made similar to snprintf() + +Thu Jul 27 01:15:02 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.33 + scg_prbytes()/scg_printdev() now using FILE * Parameter + scg__errmsg() restructured to be similar to snprintf() + +Sun Jul 23 18:01:12 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsierrs.c 2.23 + * scsihack.c 1.29 + * scsitransp.c 1.54 + * scsi-wnt.c 1.20 + * scsi-vms.c 1.19 + * scsi-unixware.c 1.15 + * scsi-osf.c 1.15 + * scsi-sgi.c 1.24 + * scsi-os2.c 1.15 + * scsi-next.c 1.21 + * scsi-linux-sg.c 1.53 + * scsi-linux-pg.c 1.28 + * scsi-hpux.c 1.21 + * scsi-bsd.c 1.32 + * scsi-beos.c 1.12 + * scsi-bsd-os.c 1.18 + * scsi-aix.c 1.23 + * scsitransp.h 1.32 + restructured to use scg_ basieed Function names + +Sun Jul 23 00:28:09 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.31 + open_scsi()/close_scsi()/... -> scg_open()/scg_close/... + +Thu Jul 20 20:12:42 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.51 + Note for Volmgt & Solaris/USCSI + +*************** Release 1.9 ******************* + +Thu Jul 20 19:49:20 2000 joerg + * diskid.c 1.28 + New Manufacturer: "Grand Advance Technology LTD." + +Thu Jul 20 19:12:01 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.105 + Version -> 1.9 + 99 Minute check better + +Mon Jul 3 01:19:21 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.52 + Type fixed in !scglocal(scgp)->drvers < 0 + +Mon Jul 3 00:11:20 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.93 + * drv_sony.c 1.41 + * drv_dvd.c 1.47 + * drv_mmc.c 1.56 + * cdrecord.h 1.62 + * cd_misc.c 1.8 + msf_to_lba() with force_positive Flag for 99 Minute CD's + +Sun Jul 2 23:22:00 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.51 + scsi_raisedma() only for Kernel-2.2.10 and newer + +Sat Jul 1 13:40:49 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.50 + New allocated copy buffer in SCSI * -> local for raisedma + +Sat Jul 1 13:22:49 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.53 + * scsi-wnt.c 1.19 + * scsi-vms.c 1.18 + * scsi-unixware.c 1.14 + * scsi-sgi.c 1.23 + * scsi-osf.c 1.14 + * scsi-os2.c 1.14 + * scsi-next.c 1.20 + * scsi-linux-sg.c 1.49 + * scsi-linux-pg.c 1.27 + * scsi-hpux.c 1.20 + * scsi-bsd.c 1.31 + * scsi-bsd-os.c 1.17 + * scsi-beos.c 1.11 + * scsi-aix.c 1.22 + maxdma/maxbuf new in SCSI * + scsi_getbuf() now calls scsi_bufsize() to init new members + +Sat Jul 1 13:09:43 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.30 + maxdma/maxbuf new in SCSI * + +Fri Jun 30 18:43:43 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.48 + scsi_raisedma() now called with correct DMA Buffersize + +Fri Jun 30 18:38:48 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.52 + * scsihack.c 1.28 + * scsi-wnt.c 1.18 + * scsi-vms.c 1.17 + * scsi-unixware.c 1.13 + * scsi-sgi.c 1.22 + * scsi-sco.c 1.14 + * scsi-osf.c 1.13 + * scsi-os2.c 1.13 + * scsi-next.c 1.19 + * scsi-linux-sg.c 1.47 + * scsi-hpux.c 1.19 + * scsi-linux-pg.c 1.26 + * scsi-bsd.c 1.30 + * scsi-beos.c 1.10 + * scsi-bsd-os.c 1.16 + * scsi-aix.c 1.21 + scsi_maxdma() now with 2nd Parameter "amt" for Linux sg driver + +Tue Jun 27 19:29:05 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.55 + Disk Subtype decoder for High Speed RW + +Tue Jun 27 19:19:51 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.104 + Support for 99 Minute CD's + +Tue Jun 27 19:17:16 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.27 + 99 Minute media in table + +Mon Jun 26 22:40:39 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.26 + Bestdisc Technology Corporation new + +Mon Jun 26 22:29:17 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-bsd.c 1.29 + * scsi-bsd-os.c 1.15 + * scsi-sgi.c 1.21 + * scsi-linux-sg.c 1.46 + * scsi-linux-pg.c 1.25 + * scsi-next.c 1.18 + better error messages into scgp->errstr + +Fri Jun 23 23:52:39 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.45 + pvers && isold -> scglocal + +Fri Jun 23 23:23:33 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.44 + Variable pvers only conditional for unused... warning + +Fri Jun 23 23:19:00 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.43 + Support for SG_IO ioctl() + +Fri Jun 23 21:40:38 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.29 + overbose new + +Thu Jun 22 15:20:18 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.42 + SG_SCSI_RESET & SG_SET_RESERVED_SIZE new + +Wed Jun 21 10:34:52 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-pg.c 1.24 + Test with ATAPI SCSI status code + +Wed Jun 21 10:33:31 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.51 + scsitransp.c split into scsitransp.c & scsi-sun.c + +Wed Jun 21 10:27:11 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.27 + scsi-sun.c new + +Tue Jun 20 07:20:40 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.28 + secured _SCGIO_H -> _SCG_SCSISENSE_H + +Tue Jun 20 06:09:57 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-bsd.c 1.28 + ATAPI Support for OpenBSD + +Sun Jun 4 00:55:02 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.103 + #include <sys/select.h> for select() (autoconf Test for AIX), version -> 1.9a02 + +Sat Jun 3 17:31:06 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.102 + New Option -shorttrack/-noshorttrack + +Fri Jun 2 22:37:51 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.61 + New Flag TI_SHORT_TRACK & is_shorttrk() macro + +Fri Jun 2 22:32:59 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.50 + New Optionen -shorttrack & -noshorttrack + +Fri Jun 2 21:44:43 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * defaults.c 1.5 + Prevent a buffer overrrun with dev= option + +Fri Jun 2 21:43:16 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * auinfo.c 1.5 + Check for buffer ovverun + +Fri Jun 2 00:03:13 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.54 + Set Pregapsize to 1 if the drive does not support 0 + free(cue) if cuep == NULL + +Tue May 30 02:46:22 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.25 + Restructured + +Tue May 30 01:06:32 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.24 + New manufacturers: "WEALTH FAIR INVESTMENT LIMITE", "General Magnetics Ld", "MPO" + +Tue May 30 00:59:12 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.27 + debug Parameter -> odebug + +Mon May 29 19:07:56 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-next.c 1.17 + Typo corrected max_scsibus -> scglocal(scgp)->max_scsibus + +Mon May 29 00:31:18 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsireg.h 1.20 + Mode page 2A pw_in_lead_in & side_change new + +Mon May 29 00:13:25 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.92 + More Page 2A bits for cdrecord -prcap + +Sun May 28 18:52:11 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-vms.c 1.16 + scsi_close() now works + +Sun May 28 18:40:55 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.49 + -fix hint for CDR-50 & CDR-55 specified + +Sun May 7 16:52:20 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.91 + * scsilog.c 1.10 + * scsi_scan.c 1.8 + * auinfo.c 1.4 + * cd_misc.c 1.7 + * audiosize.c 1.14 + * cdr_drv.c 1.20 + * fifo.c 1.22 + * defaults.c 1.4 + * wm_packet.c 1.12 + * modes.c 1.14 + * cdrecord.c 1.101 + * drv_sony.c 1.40 + * drv_simul.c 1.15 + * drv_philips.c 1.37 + * drv_mmc.c 1.53 + * drv_jvc.c 1.50 + * drv_dvd.c 1.46 + * scsierrs.c 2.22 + * scsitransp.c 1.50 + #include <schily.h> + +Sun May 7 16:46:39 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.90 + New DVD recognition, to allow Ricoh 9060 + +Sun May 7 16:11:09 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.26 + Support for new Mac OS X + +Mon May 1 20:06:37 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.49 + scsi_maxmdma() cleaned up + +Thu Apr 27 15:06:42 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.48 + Examples for cdda2wav + +Thu Apr 27 14:22:19 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.52 + No more error message forSony & long write in progress when Fixating + +Thu Apr 27 14:17:01 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.23 + Better message for illegal ID (CD-RW) + all old CD-R's now print ILLEGAL OLD CODE + +Wed Apr 26 11:50:19 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.100 + * cdrecord.h 1.60 + * scsi_cdr.c 1.89 + * drv_jvc.c 1.49 + * drv_dvd.c 1.45 + scsi_close_tr_session()/scsi_blank() with immed Parameter + +*************** Release 1.8.1 ******************* + +Thu Apr 27 14:22:19 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.52 + No error message for Sony & long write in progress while fixating + +Thu Apr 27 14:17:01 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.23 + Better printout with illegal ID for CD-RW, all old CD-R's now give ILLEGAL OLD CODE + +Wed Apr 26 11:50:19 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.100 + * cdrecord.h 1.60 + * scsi_cdr.c 1.89 + * drv_jvc.c 1.49 + * drv_dvd.c 1.45 + scsi_close_tr_session()/scsi_blank() with immed Parameter + +Mon Apr 24 12:32:14 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.99 + Version -> 1.8.1 final, exitcode == 0 only if fixating in Dummy Mode fails + +Sat Apr 22 15:37:05 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.22 + New manufacturer "VICTOR COMPANY OF JAPAN, LIMITED", "VIVASTAR AG" + +Sun Apr 16 17:07:55 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.47 + BURN-Proof Option for Sanyo + +Sun Apr 16 17:07:11 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.51 + BURN-Proof Support for Sanyo + +Sun Apr 16 17:06:30 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.98 + New Option driveropts= + better -dao usage + +Sun Apr 16 03:11:26 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.88 + display BURN-Proof for cdrecord -prcap + +Sun Apr 16 03:08:58 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * defaults.c 1.3 + * cdrecord.dfl 1.2 + driveropts new + +Sun Apr 16 02:16:29 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.39 + * cdrecord.h 1.59 + * drv_simul.c 1.14 + * drv_philips.c 1.36 + * drv_jvc.c 1.48 + * drv_dvd.c 1.44 + open_session() now with cdr_t * Parameter for BURN-Proof + +Mon Apr 3 21:05:37 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-pg.c 1.23 + #include <string.h> for strlen() + +Sat Apr 1 21:59:19 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.21 + New manufaturer: "TAROKO INTERNATIONAL CO.,LTD.", "UNIDISC TECHNOLOGY CO.,LTD", "Hong Kong Digital Technology Co., Ltd.", "VIVA MAGNETICS LIMITED" + +Sat Mar 11 12:31:09 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.87 + Sanyo CRD-R24S -> Philips CDD 521 + +Sat Mar 11 12:30:06 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.50 + send_opc_mmc() now calls send_opc() and suppresses ILLEGAL_REQUEST + +Sat Mar 11 12:26:37 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.46 + WeB address changed + +Sun Feb 20 21:54:33 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.58 + * cdrecord.c 1.97 + * cdrecord.1 1.45 + New Option -waiti for multi session from Pipe from mkisofs + +Sun Feb 20 20:56:09 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.96 + scsi_in_progress() Test and usleep(100000) if Long Write in Progress + +Sun Feb 20 20:54:06 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.49 + scsi_in_progress() test for scsi_flush_cache() in fixate, send_cue() -> LOCAL + +Sun Feb 20 20:52:49 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.57 + scsi_in_progress() new, send_cue() removed + +Sun Feb 20 20:52:15 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.86 + scsi_in_progress() new + +Sat Feb 19 00:38:35 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.95 + read Sectorsize from read_capacity too, for drivs without Blockdescriptor, dp->cdr_opc() new + +Sat Feb 19 00:33:54 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.85 + send_opc() new + +Sat Feb 19 00:24:37 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.56 + * drv_sony.c 1.38 + * drv_simul.c 1.13 + * drv_philips.c 1.35 + * drv_mmc.c 1.48 + * drv_jvc.c 1.47 + * drv_dvd.c 1.43 + Separate OPC code in driver interface + +Sun Feb 6 08:27:21 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sgi.c 1.20 + * scsi-openserver.c 1.17 + * scsi-linux-sg.c 1.41 + * scsi-aix.c 1.20 + * scsi-bsd-os.c 1.14 + * scsi-hpux.c 1.18 + * scsi-linux-pg.c 1.22 + * scsi-bsd.c 1.27 + added missing brackets in scsi_close() to make sure that scsi_close() really closes files + +Sun Feb 6 08:25:14 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.40 + Maxdma now is correcteven if only a prallel port is present + +*************** Release 1.8 ******************* + +Fri Jan 28 10:01:48 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.47 + * drv_dvd.c 1.42 + load_media() with new doexit Parameter + Reload now does not make problems with notebook type drives + +Fri Jan 28 09:51:26 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.34 + * cdrecord.h 1.55 + * cdrecord.c 1.94 + load_media() with new doexit Parameter + +Fri Jan 28 09:50:51 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.84 + wait_unit_ready() does not print error message if scgp->silent >= 1 + +Wed Jan 26 11:48:08 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_scan.c 1.7 + Initiator-ID test past havebus() + +Sun Jan 23 16:39:01 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.93 + Better error message for open_scsi() + +Sun Jan 23 16:07:46 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-unixware.c 1.9 + New code from SCO, -scanbus now works + +Sun Jan 23 00:44:28 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.25 + scsi-sco.c -> scsi-openserver.c + +Tue Jan 18 00:02:33 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.92 + Version -> 1.8, mlockall()/setpri() problems do not cause abort + Note to -pad option for audio Files with wrong length + #include <sys/procset.h> for SCO Openserver + +Thu Jan 13 01:32:35 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.20 + Problems with m_digitalstor (97:27/01) in table docuented + +Thu Jan 13 01:11:45 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * defaults.c 1.2 + CDR_DEVICE now superseedes /etc/default/cdrecord + +Tue Jan 11 01:46:47 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-hpux.c 1.17 + sprintf(.../dev/rscsi...) now uses hex digits for tgt 0..15 + +Sat Jan 8 23:42:25 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.83 + scsi_read() now looks for is_atapi to allow mkisofs & ATAPI to do multi-session + +Fri Jan 7 02:24:28 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.24 + Dummyfunctions fuor new Interface + +Fri Jan 7 02:22:36 2000 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdr_drv.c 1.19 + set_cdrcmds() now calls return() past exit() for lint's sake + +Wed Dec 29 14:01:03 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.91 + exargs Strukt new + Setting to 2048 bytes/sector earlier for -msinfo + new function exscsi() + exfifo() -> excdr() + +Wed Dec 29 02:14:11 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.54 + * fifo.c 1.21 + wait_faio() new + +Wed Dec 29 00:38:52 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.19 + New manufacturer: "Hile Optical Disc Technology Corp." + "Friendly CD-Tek Co." + "Sound Sound Multi-Media Development Limited" + "kdg mediatech AG" + +Wed Dec 29 00:34:39 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.44 + better dociumentation for SUID Installation + +Fri Dec 24 01:59:35 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.20 + sp null pointer Problem in fifo_stats() fixed + input-buffer -> input buffer + +Tue Dec 7 01:07:24 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.43 + added missing .TP + +Sun Dec 5 13:37:16 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.19 + kill_fifo() now kil only if faio_pid > 0 + +Sat Dec 4 21:36:38 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.18 + New manufacturer: EXIMPO & Seantram Technology Inc. + Seantram has been guessed before + +Sat Dec 4 14:15:16 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.90 + intfifo()/exfifo() new + kill FIFO on comerr() and signals + +Sat Dec 4 14:12:41 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.41 + isgui as with drv_mmc.c added + +Tue Nov 30 14:48:12 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.23 + * scsi-linux-pg.c 1.21 + pg.h now locally available + +Sat Nov 27 21:38:54 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-os2.c 1.12 + SRB in scsi_send() and scsi_reset() -> static to prevent core dump + +Sat Nov 20 17:49:38 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-os2.c 1.11 + scgfiles array removed + set_error() new + added some ux_errno = EIO + wait_post() now calls DosResetEventSem() in any case + +Sat Nov 20 14:21:09 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-os2.c 1.10 + DEBUG2/SCANDEBUG code removed + +Sat Nov 20 07:23:59 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.17 + New manufacturer: Customer Pressing Oosterhout + Harmonic Hall Optical Disc Ltd. + DELPHI TECHNOLOGY INC. + +Sat Nov 20 06:45:18 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.89 + Version -> 1.8a32 + 5 missing set_secsize(.. oldsize) added + +Sat Nov 20 06:44:02 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdr_drv.c 1.18 + Kodak PDC-600 in driver recognition + +Sat Nov 20 06:43:12 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.46 + next_wr_addr() in driver struct for CD-ROM -> cmd_ill() + +Sat Nov 20 06:41:39 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.18 + fixed typo for HAVE_DOSALLOCSHAREDMEM + +Fri Nov 12 10:00:19 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.48 + scsi_yes() now global + +Fri Nov 12 09:59:49 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.26 + scsi_yes() new + +Mon Oct 18 02:38:11 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.88 + always set TAO mode on startup to make checkdsize() working + +Mon Oct 18 01:34:34 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsilog.c 1.9 + * scsi_cdr.c 1.82 + i_to_short() -> i_to_2_byte() + +Mon Oct 18 01:15:21 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsilog.c 1.8 + * scsi_cdr.c 1.81 + * drv_dvd.c 1.40 + * drv_mmc.c 1.45 + * drv_philips.c 1.33 + * iso9660.h 1.4 + a_to_u_short() -> a_to_u_2_byte() + +Mon Oct 18 01:04:17 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * isosize.c 1.6 + utypes.h wegen intcvt.h + +Mon Oct 18 00:38:01 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.80 + * drv_sony.c 1.37 + * drv_jvc.c 1.46 + * drv_dvd.c 1.39 + a_to_3_byte() -> a_to_u_3_byte() + +Mon Oct 18 00:10:18 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.38 + * drv_sony.c 1.36 + * drv_jvc.c 1.45 + * drv_philips.c 1.32 + i_to_long() -> i_to_4_byte() + +Mon Oct 18 00:04:43 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.79 + * isosize.c 1.5 + * drv_dvd.c 1.37 + * drv_mmc.c 1.44 + * drv_jvc.c 1.44 + * drv_sony.c 1.35 + * drv_philips.c 1.31 + * audiosize.c 1.13 + * cdrecord.c 1.87 + modified to use intcvt.h and a_to_4_byte() + +Sun Oct 17 23:21:40 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * iso9660.h 1.3 + removed i_to_* and a_to_* macros -> intcvt.h + +Sun Oct 17 22:51:51 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsireg.h 1.19 + struct scsi_capacity modified to use Int32_t + +Sat Oct 16 13:52:29 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.78 + * drv_mmc.c 1.43 + * auinfo.c 1.3 + * drv_sony.c 1.34 + malloc() casts for K&R C + +Fri Oct 15 20:28:25 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.53 + * cdr_drv.c 1.17 + * cdrecord.c 1.86 + set_cdrmds() if 2. Parameter is NULL returns BOOL + for cdrecord to check for dvd driver or not + +Fri Oct 15 20:19:36 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.77 + Optima Dis Covery 650 CD-R Inquiry recognition new + +Fri Oct 15 20:17:17 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-beos.c 1.9 + * scsi-osf.c 1.12 + typos removed + +Thu Oct 7 15:33:17 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-bsd-os.c 1.13 + * scsi-aix.c 1.19 + mising bracket in scsi_open() fixed + +Fri Sep 17 17:59:18 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.85 + Version -> 1.8a29 + libscg version check + #incude <vadefs.h> for win32 realtime pri Code + +Fri Sep 17 17:56:57 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.76 + endless lookp in mmc_cap() removed: no medium (wait_unit_ready()) + +Fri Sep 17 15:48:09 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.47 + HAVE_SCG #define earlier + +Fri Sep 17 15:42:39 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-pg.c 1.20 + duplicates with scsi-linux-sg.c fuer scg__version() removed + +Fri Sep 17 15:36:55 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.46 + #ifdef HAVE_SCG for _scg_trans_version[] + +Fri Sep 17 15:09:54 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.17 + * scsi-vms.c 1.15 + * scsi-unixware.c 1.8 + * scsi-sgi.c 1.19 + * scsi-osf.c 1.11 + * scsi-sco.c 1.13 + * scsi-os2.c 1.9 + * scsi-next.c 1.16 + * scsi-linux-sg.c 1.39 + * scsi-linux-pg.c 1.19 + * scsi-hpux.c 1.16 + * scsi-bsd.c 1.26 + * scsi-bsd-os.c 1.12 + * scsi-beos.c 1.8 + * scsi-aix.c 1.18 + * scsitransp.c 1.45 + * scsitransp.h 1.25 + scg_version() new + +Fri Sep 17 14:55:17 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.22 + Comment changed + +Tue Sep 14 10:57:29 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.38 + scgfile variable in max_dma corrected from scgfile -> scglocal(scgp)->scgfile + +Fri Sep 10 14:06:19 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.16 + Better text for Disk Typ (e.g. Long strategy type) + +Thu Sep 9 12:30:38 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * auinfo.c 1.2 + isrc_illchar() Prorotype new + +Wed Sep 8 17:57:45 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.15 + New manufacturer: Guann Yinn Co. Ltd. + Opti.Me.S. S.p.A. + Nacar Media srl + +Wed Sep 8 12:45:37 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.16 + missing bracket at malloc(amt) + +Tue Sep 7 17:13:09 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.15 + * scsi-unixware.c 1.7 + * scsi-vms.c 1.14 + * scsi-sgi.c 1.18 + * scsi-sco.c 1.12 + * scsi-osf.c 1.10 + * scsi-next.c 1.15 + * scsi-os2.c 1.8 + * scsi-linux-sg.c 1.37 + * scsi-linux-pg.c 1.18 + * scsi-hpux.c 1.15 + * scsi-bsd.c 1.25 + * scsi-beos.c 1.7 + * scsi-bsd-os.c 1.11 + * scsi-aix.c 1.17 + * scsitransp.c 1.44 + First error messages past scgp->errstr + less calls to comerr() + +Tue Sep 7 17:07:55 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.24 + errstr & errptr new in SCSI * + open_scsi() with errs Parameter + +Tue Sep 7 16:47:21 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.84 + Now using new open_scsi() + added some calls to flush() + +Tue Sep 7 16:46:04 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.42 + 1.6 -> 1.8 + +Tue Sep 7 00:21:08 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.42 + * drv_jvc.c 1.43 + * drv_dvd.c 1.36 + flush() for Blanking new + +Fri Sep 3 11:57:35 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.36 + * scsi-linux-pg.c 1.17 + scsi_initiator_id() in scsi-linux-pg.c -> pg_initiator_id() + +Thu Sep 2 18:57:59 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.83 + 1.8a24 -> 1.8a26 + Ricoh DAO Bug (fwa != -150) workaround + Realtimepri for Win32 + +Thu Sep 2 14:42:14 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_scan.c 1.6 + scsi_initiator_id() new + Now prints bus,tgt,lun before selektor + +Thu Sep 2 13:32:57 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.23 + * scsi-wnt.c 1.14 + * scsi-vms.c 1.13 + * scsi-unixware.c 1.6 + * scsi-sco.c 1.11 + * scsi-sgi.c 1.17 + * scsi-osf.c 1.9 + * scsi-os2.c 1.7 + * scsi-next.c 1.14 + * scsi-linux-sg.c 1.35 + * scsi-hpux.c 1.14 + * scsi-linux-pg.c 1.16 + * scsi-bsd.c 1.24 + * scsi-bsd-os.c 1.10 + * scsi-aix.c 1.16 + * scsi-beos.c 1.6 + * scsitransp.c 1.43 + scsi_initiator_id() new + +Mon Aug 30 13:36:17 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.42 + * drv_simul.c 1.12 + * fifo.c 1.17 + #include libport.h new + +Sun Aug 29 01:42:10 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.16 + shared memory for OS/2 + +Sun Aug 29 00:52:56 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.15 + Typo fixed (\f instead of \n) + +Tue Aug 10 21:34:03 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.41 + * scsi-wnt.c 1.13 + * scsi-vms.c 1.12 + * scsi-unixware.c 1.5 + * scsi-sco.c 1.10 + * scsi-sgi.c 1.16 + * scsi-osf.c 1.8 + * scsi-os2.c 1.6 + * scsi-next.c 1.13 + * scsi-linux-sg.c 1.34 + * scsi-linux-pg.c 1.15 + * scsi-hpux.c 1.13 + * scsi-bsd.c 1.23 + * scsi-bsd-os.c 1.9 + * scsi-beos.c 1.5 + * scsi-aix.c 1.15 + Static locale variable removed + Test for openbydev + scsi_freebuf() new + +Mon Aug 9 00:39:37 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.22 + SCSI *->bufbase & scsi_freebuf() new + +Sat Aug 7 22:24:46 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.21 + running/curcmdname/local new in SCSI * + +Sat Aug 7 22:22:36 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.40 + * scsi-wnt.c 1.12 + * scsi-vms.c 1.11 + * scsi-unixware.c 1.4 + * scsi-sgi.c 1.15 + * scsi-sco.c 1.9 + * scsi-osf.c 1.7 + * scsi-os2.c 1.5 + * scsi-next.c 1.12 + * scsi-linux-sg.c 1.33 + * scsi-linux-pg.c 1.14 + * scsi-hpux.c 1.12 + * scsi-bsd.c 1.22 + * scsi-bsd-os.c 1.8 + * scsi-beos.c 1.4 + * scsi-aix.c 1.14 + scg_maxdma removed + scsi_running/scsi_command -> SCSI * struct + +Sat Aug 7 21:05:51 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-vms.c 1.10 + scsi_close() new + +Sun Aug 1 22:08:46 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.14 + WRITER_MAXWAIT & READER_MAXWAIT -> 240s for SAO SCSI Timeout + usleep() debug code + +Sun Aug 1 17:14:54 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.41 + Better documentation for -multi Option (DAO mode) + +Sun Aug 1 17:05:30 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.82 + -msinfo now works even if drive is in DAO mode + Now corrects trackstart values for second session in DAO Mode + +Sun Aug 1 16:51:35 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.33 + * drv_simul.c 1.11 + * drv_philips.c 1.30 + * drv_mmc.c 1.41 + * drv_jvc.c 1.42 + * drv_dvd.c 1.35 + speedp == 0 allowed if speed should remain as is + +Sun Aug 1 16:10:40 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.32 + * drv_simul.c 1.10 + * drv_mmc.c 1.40 + * drv_jvc.c 1.41 + * drv_dvd.c 1.34 + recovery_needed()/recover()/reserve_track() References to Philips driver removed + +Sun Aug 1 16:02:03 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.29 + * scsi_cdr.c 1.75 + * cdr_drv.c 1.16 + * cdrecord.h 1.52 + Several functions scsi_cdr.c -> drv_philips.c + new function cmd_ill() + +Sun Aug 1 13:25:42 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.33 + phys_end in dvd_structure_00 may be 0 for empty session + +Sun Jul 25 13:52:02 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.39 + scsi_close() new + __scgp removed + +Sun Jul 25 13:36:47 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.11 + * scsi-unixware.c 1.3 + * scsi-sgi.c 1.14 + * scsi-osf.c 1.6 + * scsi-sco.c 1.8 + * scsi-os2.c 1.4 + * scsi-next.c 1.11 + * scsi-linux-sg.c 1.32 + * scsi-linux-pg.c 1.13 + * scsi-hpux.c 1.11 + * scsi-bsd.c 1.21 + * scsi-bsd-os.c 1.7 + * scsi-beos.c 1.3 + * scsi-aix.c 1.13 + scsi_close() new + +Sun Jul 25 00:50:18 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.20 + close_scsi() and scsi_smalloc()/scsi_sfree() new + +Sat Jul 24 22:26:22 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.19 + scsi_close() new + +Sat Jul 24 22:25:39 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-vms.c 1.9 + last changes fro Mr. Heuser + Max Timeout corrected + +Sat Jul 24 22:22:44 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-next.c 1.10 + Kernel Driver is in undefined state if SCSI Bus is not valid -> bugfix & debug prints + +Sat Jul 24 20:43:47 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.39 + from BCD converson (debug) for Ricoh test + Trying to suppress error messages for newer MITSUMI ATAPI drives + +Sat Jul 24 19:27:06 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.40 + Better documentation for -pad/padsize= + +Sat Jul 24 19:25:34 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.14 + New manufacturer: OPTROM + AUDIO DISTRIBUTORS + Acer Media Technology + +Sat Jul 24 19:23:49 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.81 + -> 1.8a24 & write_buf() Test Code + +Sat Jul 24 19:19:22 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.80 + Check HAVE_SETPRIORITY and HAVE_NICE + +Sat Jul 24 19:17:30 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.79 + Version -> 1.8a23 + Signalhandler for wait time before burning + O_BINARY define for win32 + setmode(TDIN, O_BINARY) for win32 + track[] Array now MAX_TRACKS+2 + Print Drive Buffer size and FIFO size + -force Flag to blank problematic CD-RW's + set sector size to 2k before burning for Plextor + set_speed...() now with speedp Parameter to allow MMC to send back actual values + DAO for MMC + new Options -atip/-useinfo/-force/-dao/mcn=text/isrc=text/index=list + first Test for continuous Drive buffer cap printouts + set_secsize() new (for Plextor & DAO) + EMX Wildcard expansion for OS/2 + Timeout for DAO -> minimal 200s + print_toc() \ removed for K&R C + print_toc() with CD-Text + DosSetPriority() now korrectly doing delta + setpregaps() sets values for lead-in/out + checktsize() checks for DAO + +Sun Jul 18 14:39:31 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.51 + * scsi_cdr.c 1.74 + open_scsi() -> libscg + +Sat Jul 17 15:54:11 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.38 + MAX DMA for Solaris x86 from 32k -> 56k + scsierr() checks for sense[0] != 0 + scsi_sense_{key!code!qual} return 0 if scsierr() == FALSE + +Sat Jul 17 15:37:00 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.18 + open_scsi() for scsiopen.c new + +Mon Jun 28 01:11:18 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-pg.c 1.12 + set CDB to 0 past cdb_len + +Sun Jun 6 19:41:11 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.28 + CDR_SWABAUDIO for pioneer_dws114x + +Sun Jun 6 19:40:29 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * modes.c 1.13 + get_mode_params() now return FALSE if has_mode_page() returns FALSE + +Sun Jun 6 19:39:02 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.73 + Hack for NT-4.0 ASPI ISE inquiry fake (bug in add_len) + workaround for Ricoh NOT_READY key in get Mode page 2A + +Thu May 13 16:55:13 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.10 + #define for format to avoid hiding messages + Now uses dlopen() + ha_inquiry() new + better paraeters in scsi_open() + SRB_HaID/SRB_HaId unified + +Thu May 13 15:07:36 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.72 + check scsi_open() return code for < 0 + +Thu May 13 15:00:48 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * modes.c 1.12 + Cast for ANSI C comparison + +Thu May 13 15:00:07 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.31 + Cast for ANSI C + fixed typo in error texts + +Thu May 13 14:31:50 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.40 + mods for ANSI C comparison + +Thu May 13 14:31:12 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.39 + New Options -atip and index= + +Thu May 13 12:00:58 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsierrs.c 2.21 + field_ptr now correctly used for progress printing on NOT_READY + +Wed May 12 01:42:18 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-os2.c 1.3 + -scanbus support + +Wed May 12 01:01:54 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.27 + * scsi_cdr.c 1.71 + * cdr_drv.c 1.15 + * scsidefs.h 1.21 + DEV_RICOH_RO_1060C new (preliminary) + +Mon May 3 01:30:22 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.9 + changed names and indented + WBOOL definition to distinguish BOOL from Windows.h and BOOL from standard.h + busses new + compare busno with busses + Debug File removed + EventStatus as result of WaitForSingleObject() + set_error() new for correct error codes + scsiabort() new + +Tue Apr 27 23:11:59 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.8 + Debug File removed + +Tue Apr 27 21:06:48 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.7 + -scanbus now works + file matrix removed + check for nuber of SCSI Busses + +Mon Apr 26 22:37:40 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.6 + Try to implement -scanbus + +Mon Apr 26 22:36:00 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.5 + sp->u_scb.cmd_scb[0] = s.SRB_Status -> sp->u_scb.cmd_scb[0] = s.SRB_TargStat + error code SCG_FATAL -> SCG_RETRYABLE + +Mon Apr 26 22:35:00 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.4 + Indented II + +Mon Apr 26 22:34:15 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.3 + Indented + +Mon Apr 26 22:33:41 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.2 + Better comment + +Mon Apr 26 22:32:32 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-wnt.c 1.1 + date and time created 99/04/26 21:32:32 by joerg + +Sun Apr 25 09:48:05 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.50 + is_copy()/is_scms() new + TI_COPY/TI_SCMS new + read_subchannel() new + pr_manufacturer()/disk_rcap() with rw/audio Parameters + +Sun Apr 25 09:46:03 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.38 + clear -dummy status by clearin -dummy state + COPY & SCMS handling + +Sat Apr 24 14:10:19 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.13 + * drv_mmc.c 1.37 + pr_manufacturer()/disk_rcap() now using rw and audio Parameter + +Sat Apr 24 14:05:48 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.26 + pr_manufacturer()/disk_rcap() now using rw and audio Parameter + Printing of ATIP "restricted" + +Sat Apr 24 14:04:38 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.30 + pr_manufacturer()/disk_rcap() now using rw and audio Parameter + printf() Format (%l..) + +Sat Apr 24 14:02:11 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.70 + read_subchannel() new + +Sat Apr 24 13:03:56 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.21 + scsi-wnt.c new + +Sun Apr 18 21:04:15 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * defaults.c 1.1 + date and time created 99/04/18 20:04:15 by joerg + +Sun Apr 18 19:56:45 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.29 + * drv_simul.c 1.9 + * drv_philips.c 1.25 + * drv_mmc.c 1.36 + * drv_jvc.c 1.39 + * cdr_drv.c 1.14 + * drv_dvd.c 1.32 + * cdrecord.h 1.49 + New driver function cdr_send_cue + +Sun Apr 18 19:28:03 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.38 + g6 & g7 test functions + +Sun Apr 18 18:40:56 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.48 + index= Option new + +Sun Apr 18 18:40:54 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.35 + index= Option new + +Sun Apr 18 00:42:59 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.47 + New Flags F_SAO/F_WRITE/F_PREGAP/F_FORCE + isrc in struct track + is_tao()/is_pregap() new + ds_cdrflags in struct disk_status + cdr_buffer_cap in struct cdr_cmd + cdr_set_speed_dummy with *speedp - to allow mmc to return value + Functions for auinfo.c + +Sun Apr 18 00:18:30 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.31 + MAX_SCG & MAX_TGT -> 16 + Debug function for printing buscookies[] and scgfiles[][][] + sg_mapbus() now with Bus Parameter and spcial handling for holes in buscookies[] + sg_setup() doing range check + better handling of Status byte in extended Code for mk2 Interface + +Sun Apr 18 00:09:52 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-pg.c 1.11 + Search slot for PP Bus backwards, as buscookies[] may have holes + +Sat Apr 17 22:12:22 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.37 + New Function in Driver table to read Buffer capacity + buf_cap_teac(), read_peak_buffer_cap_teac (), buffer_inquiry_teac(), check_buffer_teac() new + +Sat Apr 17 19:32:41 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_scan.c 1.5 + Enhancements for 16 SCSI busses and 17 Targets/Bus + +Sat Apr 17 19:29:25 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdr_drv.c 1.13 + buf_dummy() new + New Function in Driver table to read Buffer capacity + +Sat Apr 17 19:28:27 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.28 + * drv_mmc.c 1.34 + * drv_philips.c 1.24 + * drv_simul.c 1.8 + * drv_dvd.c 1.31 + New Function in Driver table to read Buffer capacity + +Sat Apr 17 19:25:47 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.27 + Workaround for CDU 620 (can not read lead-in Start time) + +Sat Apr 17 18:57:36 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.37 + MAX_SCG & MAX_TGT -> 16 + Workaround for /dev/scg if Target > 7 + +Sat Apr 17 18:55:26 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-bsd-os.c 1.6 + * scsi-vms.c 1.8 + * scsi-unixware.c 1.2 + * scsi-sgi.c 1.13 + * scsi-sco.c 1.7 + * scsi-osf.c 1.5 + * scsi-os2.c 1.2 + * scsi-next.c 1.9 + * scsi-hpux.c 1.10 + * scsi-bsd.c 1.20 + * scsi-aix.c 1.12 + MAX_SCG & MAX_TGT -> 16 + +Sat Apr 17 18:47:39 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-next.c 1.8 + scsi_setup() & scsi_havebus() with scgp Pointer (bug) + +Sat Apr 17 17:09:00 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.36 + limit SunOS 4.x maxdma to 64k-1 + +Sat Apr 17 13:14:24 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.38 + -force flag and -useinfo new + +Tue Apr 13 01:29:14 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.12 + m_seantram Index 28 (typo) -> 83 + +Tue Apr 13 01:06:45 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * modes.c 1.11 + Test in has_mode_page() if desired page is really available for JVC 2080 FW Bug + +Fri Apr 9 20:49:08 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.36 + speed -> *speedp Parameter in speed_select() + +Fri Apr 9 01:03:54 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.69 + * drv_dvd.c 1.30 + * audiosize.c 1.12 + Signed/unsiged comparisons with cast + +Fri Apr 9 00:46:07 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsilog.c 1.7 + cast for comparing unsigned > int + +Fri Apr 9 00:33:17 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.68 + read_buff_cap() Ulong -> int + +Fri Apr 9 00:32:35 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.11 + New manufacturer: "Woongjin Media corp" + "INFODISC Technology Co., Ltd." + "UNITECH JAPAN INC." + "AMS Technology Inc." + +Tue Apr 6 22:08:31 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.33 + speed -> *speedp Parameter in speed_select() + Read write speed Auslesen and set *speedp + Test for dsp->ds_cdrflags & RF_WRITE + first DAO enhancements + +Tue Apr 6 22:05:25 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.67 + speed -> *speedp Parameter IN speed_select() + read_buffer() WITH mode Parameter + scsi_get_speed() new + read_buff_cap() prints Data if sp && fp == NULL and avoids division by 0 + read_cdtext() new + Workaround for Philips CDD-522 cannot do read TOC MSN + +Tue Apr 6 01:15:52 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.23 + speed -> *speedp Parameter in speed_select() + Test for dsp->ds_cdrflags & RF_WRITE + +Tue Apr 6 01:13:14 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.26 + ATIP Support + +Fri Apr 2 16:06:31 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.10 + "Seantram Technology Inc." new (guess) + +Fri Apr 2 15:50:28 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.25 + * drv_simul.c 1.7 + * drv_dvd.c 1.29 + speed -> *speedp Parameter in speed_select() + +Sun Mar 28 15:31:56 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsimmc.h 1.4 + struct mmc_cue new + +Sun Mar 28 15:29:43 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.37 + -dao and -audio default for .au & .wav + +Fri Mar 12 02:05:58 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * auinfo.c 1.1 + date and time created 99/03/12 02:05:58 by joerg + +Sun Mar 7 22:30:42 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.13 + roundup(bufsize, pagesize) to make each Segment page aligned + +Wed Mar 3 23:45:20 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.9 + New manufacturers: vanguard, grandadv, taeil, kingpro, digitalstor + +Wed Mar 3 22:58:38 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.8 + New RCAP Liste + +Sat Feb 20 00:00:44 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.66 + read_buffer() new + timeout for read_toc_philips() -> 240s for TEAC + read_master_cue() new + send_cue_sheet() new + read_buff_cap() new + +Sun Jan 31 22:37:38 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * wm_packet.c 1.11 + * cdrecord.c 1.78 + carriage Return to beginning of Track... Strings to make error message not overwrite position + +Sun Jan 31 19:50:01 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.77 + ignore dev= values from /etc/default/cdrecord for -scanbus + +Sun Jan 31 19:23:53 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.65 + Suport for ACER CR-4020C + +Sun Jan 31 19:23:05 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.22 + scgp->inq->ansi_version = 1; -> scgp->inq->data_format = 1; to make Plasmon RF-4100 work again + +Sun Jan 31 18:55:45 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.36 + Hint for SVr4 and POSIX Realtime scheduler + +Sun Jan 31 18:49:06 1999 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-bsd.c 1.19 + scsi_maxdma() from MAXPHYS -> DFLTPHYS + +Sat Dec 12 12:36:09 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-beos.c 1.2 + sccsid[] -> __sccsid[] + +Sun Dec 6 13:16:25 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-beos.c 1.1 + date and time created 98/12/06 13:16:25 by joerg + +Sun Dec 6 12:41:50 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.20 + BeOS new + +Sun Dec 6 12:41:30 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-vms.c 1.7 + New Version past phone call with vaxinf@CHCLU.CHEMIE.UNI-KONSTANZ.DE + +Sun Dec 6 12:10:54 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.35 + FreeBSD device name bug + New address for Mailing List + Documentation of /etc/default/cdrecord + +Sat Dec 5 13:46:27 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.76 + HAVE_SYS_RESOURCE_H new (BeOS) + 1.8a13 -> 1.8a14 + cdr_defaults() new + +Sat Dec 5 13:38:16 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.46 + default.c/cdr_defaults() new + +Sun Nov 29 19:40:50 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sco.c 1.6 + cleaned up and permission to use /dev/xxx:target,lun + +Sun Nov 29 19:27:55 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsidefs.h 1.20 + fused + +Sun Nov 29 19:25:54 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scgio.h 2.14 + Splitted into scgcmd.h and scgio.h + +Sun Nov 29 19:23:33 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-unixware.c 1.1 + date and time created 98/11/29 19:23:33 by joerg + +Sun Nov 29 19:22:45 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.19 + UNIXWARE new + +Sun Nov 29 19:15:04 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.75 + scgio.h -> scgcmd.h/scgio.h, scgio.h scgcmd.h scsidefs.h scsireg.h scsitransp.h -> include/scg, 1.8a11 -> 1.8a13 + +Sun Nov 29 19:14:20 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsierrs.c 2.20 + * scsitransp.c 1.35 + * cdr_drv.c 1.12 + * modes.c 1.10 + * scsilog.c 1.6 + * wm_packet.c 1.10 + * scsi_scan.c 1.4 + * scsi_cdr.c 1.64 + * audiosize.c 1.11 + * drv_sony.c 1.24 + * drv_simul.c 1.6 + * drv_philips.c 1.21 + * drv_mmc.c 1.32 + * drv_jvc.c 1.35 + * drv_dvd.c 1.28 + scgio.h -> scgcmd.h/scgio.h, scgio.h scgcmd.h scsidefs.h scsireg.h scsitransp.h -> include/scg + +Sun Nov 29 00:39:42 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sco.c 1.5 + Correctly return Sense Data, EIO if errno == 0 + +Sat Nov 28 12:32:00 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsierrs.c 2.19 + asc <= 80 -> asc < 80 for invalid sense code + +Sat Nov 28 00:49:19 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsierrs.c 2.18 + Missing NULL as terminator for sd_ccs_error_str[] added + +Wed Nov 25 22:23:07 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-pg.c 1.10 + pg_send() Prototyp new + +Wed Nov 25 22:22:46 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.34 + HAVE_PARAM_H -> HAVE_SYS_PARAM_H (Typo) + +Sun Nov 22 15:50:37 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.74 + 1.8a9 -> 1.8a11, DosSetPriority() new + +Sun Nov 22 15:26:16 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * isosize.c 1.4 + * audiosize.c 1.10 + Now using statdefs.h + +Sat Nov 21 23:41:31 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.33 + #ifdef HAVE_PARAM_H for VMS + +Sat Nov 21 21:38:31 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.63 + unsigned int cast for char Parameter in i_to_short() + +Sat Nov 7 22:21:28 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.73 + 1.8a8 -> 1.8a9 + +Fri Nov 6 23:49:59 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.30 + Typo in scsi_send() header + +Mon Nov 2 22:22:23 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-bsd.c 1.18 + Typ bus -> busno for CAM removed + +Mon Nov 2 14:55:22 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-os2.c 1.1 + date and time created 98/11/02 14:55:22 by joerg + +Mon Nov 2 13:24:30 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.18 + Now completely using SCSI *scgp as Function parameter + scsi-os2.c new + +Mon Nov 2 14:27:10 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-vms.c 1.6 + * scsi-sgi.c 1.12 + * scsi-sco.c 1.4 + * scsi-osf.c 1.4 + * scsi-next.c 1.7 + * scsi-linux-sg.c 1.29 + * scsi-linux-pg.c 1.9 + * scsi-hpux.c 1.9 + * scsi-bsd.c 1.17 + * scsi-bsd-os.c 1.5 + * scsi-aix.c 1.11 + * scsierrs.c 2.17 + * scsitransp.c 1.32 + * scsitransp.h 1.17 + * cdrecord.c 1.72 + * cdrecord.h 1.45 + * cdr_drv.c 1.11 + * drv_mmc.c 1.31 + * drv_philips.c 1.20 + * drv_jvc.c 1.34 + * drv_dvd.c 1.27 + * drv_simul.c 1.5 + * drv_sony.c 1.23 + * scsi_cdr.c 1.62 + * modes.c 1.9 + * scsi_scan.h 1.2 + * scsi_scan.c 1.3 + * scsilog.c 1.5 + * wm_packet.c 1.9 + Now completely using SCSI *scgp as Function parameter + +Thu Oct 29 15:59:52 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.17 + * scsitransp.h 1.16 + * scsitransp.c 1.31 + * scsi-sgi.c 1.11 + * scsi-vms.c 1.5 + * scsi-sco.c 1.3 + * scsi-osf.c 1.3 + * scsi-next.c 1.6 + * scsi-linux-pg.c 1.8 + * scsi-linux-sg.c 1.28 + * scsi-hpux.c 1.8 + * scsi-bsd.c 1.16 + * scsi-bsd-os.c 1.4 + * scsi-aix.c 1.10 + Globale Variables removed and replaced by SCSI *scgp + +Thu Oct 29 15:45:38 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sco.c 1.2 + Indented and scsi_isatapi() new + +Thu Oct 29 15:30:53 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sco.c 1.1 + date and time created 98/10/29 15:30:53 by joerg + +Thu Oct 29 15:21:52 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.70 + Lowlevel SCSI transport Routines now have scgp Parameter, 1.8a6 -> 1.8a7 + +Thu Oct 29 15:21:09 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.61 + * drv_sony.c 1.22 + * modes.c 1.8 + * scsilog.c 1.4 + * drv_philips.c 1.19 + * drv_mmc.c 1.30 + * drv_jvc.c 1.33 + * drv_dvd.c 1.26 + Lowlevel SCSI transport Routines now have scgp Parameter + +Wed Oct 28 22:20:25 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-aix.c 1.9 + dev=device:b,t,l Syntax new + +Mon Oct 26 03:18:37 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.7 + manufacturer_id() new + mi_num new in struct disk_man + +Mon Oct 26 03:17:34 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.44 + manufacturer_id() new + +Mon Oct 26 00:27:22 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.6 + New manufacturer: Xcitec Inc. + Doremi Media Co., Ltd. + Matsushita Electric Industrial Co.,Ltd. + CDA Datentr�ger Albrechts GmbH. + +Sun Oct 25 13:00:22 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.71 + #ifdef HAVE_SYS_MMAN_H new + +Sat Oct 24 01:41:22 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-vms.c 1.4 + * scsi-osf.c 1.2 + * scsi-sgi.c 1.10 + * scsi-next.c 1.5 + * scsi-hpux.c 1.7 + * scsi-bsd.c 1.15 + * scsi-bsd-os.c 1.3 + * scsi-aix.c 1.8 + Blind changes for 1st stage of SCSI lib: Globale Variables removed and replaced by SCSI *scgp + +Sat Oct 24 00:22:01 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.69 + * scsi_cdr.c 1.60 + open_scsi(dev, timeout, verboseopen) -> open_scsi(dev, debug, verboseopen) + +Fri Oct 23 23:46:23 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * wm_packet.c 1.8 + * scsi_cdr.c 1.59 + scsi_settimeout() -> do not divide by 100 + +Fri Oct 23 15:53:37 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.68 + XXX scgp->cap->c_bsize = 2048; XXX Hack init !!! + +Fri Oct 23 03:14:46 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.16 + scsi-sco.c new + +Fri Oct 23 16:01:44 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.27 + * scsi-linux-pg.c 1.7 + * scsitransp.c 1.30 + * scsitransp.h 1.15 + * scsierrs.c 2.16 + * scsi_cdr.c 1.58 + * scsidefs.h 1.19 + * cdrecord.c 1.67 + * drv_dvd.c 1.25 + * drv_philips.c 1.18 + * drv_sony.c 1.21 + * drv_jvc.c 1.32 + * cdr_drv.c 1.10 + * drv_mmc.c 1.29 + * modes.c 1.7 + * scsi_scan.c 1.2 + * scsilog.c 1.3 + Globale Variables removed and replaced by SCSI *scgp + +Thu Oct 22 18:49:06 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-next.c 1.4 + Now using scsi_open(device, busno, tgt, tlun) Interface + +Tue Oct 20 18:31:25 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.57 + CDD521/02 (Kodak PCD-200) + +Sun Oct 18 14:54:35 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.66 + 1.6.1 -> 1.7.1 + +*************** Release 1.6.1 ******************* + +Sun Oct 18 14:47:55 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.65 + O_BINARY for Tracks + Restore old sector size on exit() + Better handling for lba (512/2048) in read_toc() + +Sun Oct 18 14:40:35 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.56 + * cdrecord.h 1.43 + sense_secsize() new + +Sat Oct 17 16:39:41 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.12 + #ifdef SHM_LOCK to allow compilation of SysV shm on AIX + +Fri Oct 9 14:21:38 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-bsd.c 1.14 + sp->ux_errno = EIO; for old Transport Interface + +Fri Oct 9 22:19:30 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * modes.c 1.24 + * cd_misc.c 1.6 + * fifo.c 1.11 + * diskid.c 1.5 + * port.c 1.8 + #include <utypes.h> new + +Fri Oct 9 14:21:38 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cd_misc.c 1.5 + * wm_packet.c 1.7 + * wm_session.c 1.2 + * wm_track.c 1.2 + #include <sys/types.h> & #include <utypes.h> new + +Thu Oct 8 15:43:50 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.42 + u_char -> Uchar + +Wed Oct 7 18:08:46 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.64 + 1.7a2 -> 1.7, -fix -eject corrected + wait_unit_ready(120); after a load + +Wed Oct 7 18:07:41 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.55 + IMMED hack in close track/session added + +Wed Oct 7 18:06:02 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.28 + new function waitfix_mmc() + -dummy error hiding better + +Wed Oct 7 17:54:02 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-pg.c 1.6 + EIO on SCG_RETRYABLE + +Tue Oct 6 12:53:11 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-vms.c 1.3 + next version from vaxinf@CHCLU.CHEMIE.UNI-KONSTANZ.DE and my remarks + +Tue Oct 6 12:21:50 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-vms.c 1.2 + next version from vaxinf@CHCLU.CHEMIE.UNI-KONSTANZ.DE + +Tue Oct 6 02:09:14 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-pg.c 1.5 + * scsi-linux-sg.c 1.26 + * scsi-bsd-os.c 1.2 + New device:@ Syntax + +Tue Oct 6 02:04:46 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.54 + New device:@ Syntax + sscanf() -> scsi_scandev() + +Tue Oct 6 01:50:13 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.34 + new dev= Syntax (dev=device:@ / dev=device:@,lun) inserted + +Tue Oct 6 01:05:29 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-bsd.c 1.13 + modified to use -lcam & cam_open_btl(busno, tgt, tlun, O_RDWR, NULL); + +Thu Oct 1 01:15:57 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-bsd.c 1.12 + Mods for dev=devname:@,l + +Mon Sep 21 01:24:45 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.25 + scsi_settimeout() -> sg_settimeout() + +Sat Sep 19 21:49:11 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-osf.c 1.1 + date and time created 98/09/19 20:49:11 by joerg + +Tue Sep 15 02:55:28 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.17 + capacity_philips() with Philips CDD-2600 Support new + *_attach() now uses cdr_t * Parameter + cdr_kodak_pcd600 new + Pioneer DW-S114X from open_track_yamaha -> open_track_oldphilips + +Tue Sep 15 02:39:44 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-bsd.c 1.11 + #ifndef BSD_CAM -> #ifndef HAVE_CAMLIB_H + +Tue Sep 15 02:37:58 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.63 + Now uses: fctldefs.h, strdefs.h + SECURITY new + 1.7a1 -> 1.7a2 + open_scsi() check return value and print error message + Blanking time print + #ifdef _SC_PRIORITY_SCHEDULING around sysconf() + #ifdef PRIO_PROCESS around setpriority() for WNT + +Tue Sep 15 02:31:16 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.31 + Now uses: fctldefs.h, strdefs.h + blank_jvc() new + +Tue Sep 15 02:30:11 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.20 + Now uses: fctldefs.h, strdefs.h + +Tue Sep 15 02:22:12 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.41 + struct index -> struct tindex to allow #define index strchr + +Tue Sep 15 02:21:24 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.27 + Now uses: fctldefs.h, strdefs.h, timdefs.h + Sony 928 Support new + For drives that don't support read ATIP use data from read_diskinfo + Try to handle "early Return" fixating syndrom from Mitsumi drives + no error messages when fixating using -dummy + +Tue Sep 15 02:13:49 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.53 + Now uses: fctldefs.h, strdefs.h + +Tue Sep 8 01:32:08 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.15 + Conditional compilation for Linux pg driver to support old Linux releases + +Mon Sep 7 02:30:15 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-bsd.c 1.10 + Typo in scsi_fileno() fixed + +Sun Sep 6 18:47:16 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-bsd.c 1.9 + first FreeBSD CAM Support + +Sun Sep 6 18:22:13 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-bsd.c 1.8 + Enhancements for NetBSD & ATAPI + +Sun Sep 6 01:39:22 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdr_drv.c 1.9 + cdr_mmc_sony new + +Sun Sep 6 00:43:43 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_simul.c 1.4 + * drv_dvd.c 1.24 + Now uses: strdefs.h + +Sat Sep 5 23:23:31 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.29 + Now uses: timedefs.h fctldefs.h + +Mon Aug 31 01:50:12 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-pg.c 1.4 + pgbus init from -1 -> -2 + +Mon Aug 31 01:39:52 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.24 + /dev/sga... to /dev/sgz instead of /dev/sgy now checked + return nopen to allow recognition of bad dev= parameters + +Mon Aug 31 01:38:08 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-pg.c 1.3 + Debug print for pgbus + if scsibus >= 0 ist do nothing if busno is wrong + +Mon Aug 31 01:03:17 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.52 + write_xg5() new + +Mon Aug 31 01:02:00 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.51 + open_scsi() now checks dev=devicename:b,t,l + read_trackinfo() now don't prints Cannot read TOC Meldung in silent mode + +Mon Aug 31 00:43:31 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.28 + scsiprintresult() new + +Mon Aug 31 00:40:32 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.14 + scsiprintcdb()/scsiprintwdata()/scsiprintrdata()/scsiprintresult() new + +Sun Aug 30 12:55:35 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.23 + g5_cdbaddr()/g5_cdblen() -> scgio.h + +Sun Aug 30 12:54:37 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.14 + USE_PG -> USE_PG_ONLY + +Sun Aug 30 12:54:02 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scgio.h 2.13 + g0_cdblen()/g5_cdblen() & g5_cdbaddr() new + +Sun Aug 30 12:53:06 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.40 + write_xg5() new + +Sat Aug 29 22:15:37 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cd_misc.c 1.4 + pr_manufacturer() reference removed from print_min_atip() + +Sat Aug 29 21:57:01 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.33 + PP tranport documented, -scanbus doc corrected + +Sat Aug 29 21:01:59 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-pg.c 1.2 + #include <linux/pg.h> statt "pg.h" + support for integrated parallel Port Adapter & SCSI + timeout code corrected + DMA overrun now recognized + +Sat Aug 29 20:48:28 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.23 + Support for integrated parallel Port Adapter & SCSI + +Sat Aug 29 20:22:10 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cd_misc.c 1.3 + * cdrecord.h 1.39 + print_min_atip() new in cd_misc.c + +Tue Aug 25 20:23:20 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.13 + scsi_isatapi() defined, for default SCSI code + +Sun Aug 23 13:42:44 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.22 + Fix for misaligned integer access in sg_header for Linux/sparc if valloc() DMA Buffer is used + +Thu Aug 20 10:05:14 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-aix.c 1.7 + errno == Reference removed + +Thu Aug 20 01:24:33 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.32 + dev=devicename:target,lun documented + +Tue Aug 18 04:41:56 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.12 + scsi-next.c & scsi-vms.c new + +Mon Aug 17 23:08:36 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-vms.c 1.1 + date and time created 98/08/17 22:08:36 by joerg + +Mon Aug 17 22:35:19 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.11 + scsi-linux-pg.c new use with USE_PG + +Mon Aug 17 22:34:55 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-pg.c 1.1 + * scsi-bsd-os.c 1.1 + date and time created 98/08/17 21:24:24 by joerg + +Mon Aug 17 22:22:04 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.21 + MAX_SCG -> 8 + search /dev/sg0... before /dev/sfg... + +Mon Aug 17 21:47:35 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.20 + Support new sg driverinterface + scgfile new to use with global ioctl's + MAX_DMA_LINUX -> 4k if SG_BIG_BUFF undefined + SG_MAX_SENSE -> 16 if not declared + SG_GET_BUFSIZE ioctl new + scsi_isatapi() new + +Sun Aug 16 23:47:48 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * misc.c 1.1 + date and time created 98/08/16 22:47:48 by joerg + +Sun Aug 16 23:47:06 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.38 + misc.c: timevaldiff() new + +Sun Aug 16 23:34:35 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-bsd.c 1.7 + scsi_isatapi() new + /dev/scgx may be replaced by dev=/dev/xxx:0,0 + +Sun Aug 16 23:32:42 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.13 + * scsitransp.c 1.27 + * scsi-sgi.c 1.9 + * scsi-aix.c 1.6 + * scsi-hpux.c 1.6 + scsi_isatapi() new + +Fri Jul 17 03:44:13 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.10 + BSDI new -> scsi-bsd-os.c + +Fri Jun 19 19:59:07 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.12 + * scsitransp.c 1.26 + * scsihack.c 1.9 + * scsi-sgi.c 1.8 + * scsi-hpux.c 1.5 + * scsi-bsd.c 1.6 + * scsi-aix.c 1.5 + * scsi-linux-sg.c 1.19 + Use scsi_open(device, busno, tgt, tlun) with parameters + +Tue Jun 9 01:44:46 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.22 + korrekte Indizierung bei tracksize virtual tracklist + +Sat Jun 6 00:16:40 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * port.c 1.7 + #include <time.h> -> #include <timedefs.h> wegen sys/time.h + +Wed Jun 3 02:20:27 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.31 + bytes= Option removed + Introduced Mailing List + +Wed Jun 3 02:18:47 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.21 + Treshold for printing the Virtual Trackliste corrected + Abort if first virt Track is not a multiple of the sectorsize + +Wed Jun 3 01:35:24 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.4 + disk_rcap List new + +Wed Jun 3 01:04:49 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.62 + CD -> CD/DVD + +Wed Jun 3 01:01:53 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.61 + #if defined(_POSIX_PRIORITY_SCHEDULING) -> #if defined(_POSIX_PRIORITY_SCHEDULING) && !defined(HAVE_SYS_PRIOCNTL_H) bei LOCAL declaration + +Tue Jun 2 00:41:37 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.20 + attach_???() new now implementing the side effects from identify_???() + +Tue Jun 2 00:41:36 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.26 + attach_???() neu mit den Nebeneffekten aus identify_???() + +Mon Jun 1 23:34:26 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.50 + Cast for malloc(): not every malloc() is void * + +Mon Jun 1 23:33:21 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.19 + * drv_jvc.c 1.30 + * cdr_drv.c 1.8 + * cdrecord.h 1.37 + * cdrecord.c 1.60 + attach Routine now uses cdr_t * Parameter + +Mon Jun 1 22:24:42 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.19 + * scsilog.c 1.2 + Superfluous & in a_to_u_short() removed + +Sun May 31 21:38:00 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.8 + OSF1 new + +Sun May 31 01:45:04 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.25 + void * cast for valloc() return + +Sun May 31 00:39:54 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.59 + Casts for tracksize & padsize + +Sat May 30 23:12:56 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_simul.c 1.3 + Verbose Message for islast + +Sat May 30 00:35:26 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.58 + tracksize & padsize -> LLong + +Fri May 29 00:32:30 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.57 + astoll() & getllnum() new + number() -> LLong + +Fri May 29 00:05:29 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.30 + waw in .wav Typo + +Fri May 29 00:03:32 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.18 + Better comment and housekeeping + +Thu May 28 01:08:06 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.17 + next_wr_addr_dvd() now correct with read_rzone_info() + +Thu May 28 00:02:01 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.16 + Verbose level documented + set ds_maxblocks from rzone_info + rzone_size() new + phys size computation corrected + +Tue May 26 04:16:55 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.15 + Speed code removed + +Tue May 26 04:03:55 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.14 + Removed lines that have been commented out + +Tue May 26 04:01:03 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.13 + dvd check in identify_dvd() later + +Tue May 26 03:58:57 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.12 + fcntl.h + errno.h + sys/file.h removed + +Tue May 26 03:56:48 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.11 + scsiprbytes() with lverbose > 1 + multi Track Hack indented + +Tue May 26 03:49:19 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.10 + Superfluous Debugs in SCSI routines removed + +Tue May 26 00:02:51 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.56 + checktsize() with Llong for total Tracksize in Bytes + checkdsize() now computed the remaining rest capacity + +Mon May 25 04:40:51 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.9 + Computations of the track split code -> long long + MAX tracks -> 99 + +Mon May 25 04:35:54 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.8 + close_Xtrack_dvd() code -> fixate_dvd() + +Mon May 25 04:30:05 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.7 + send_dvd_structure() & send_dvd0F() new + +Mon May 25 03:46:30 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.6 + print_laserlog() new + print_logpages() new + +Mon May 25 03:42:16 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.5 + przone() new + print_dvd00()/print_dvd01()print_dvd04()/print_dvd05()/print_dvd0D()/print_dvd0E()print_dvd0F() new + now reads 4096 Bytes DVD structure + +Mon May 25 03:17:14 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.4 + print_dvd_info() new + +Mon May 25 02:31:56 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsilog.c 1.1 + date and time created 98/05/25 01:31:56 by joerg + +Mon May 25 02:05:22 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsimmc.h 1.3 + rzone_info new + dvd_structure_XX new + +Sat May 23 22:41:54 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_simul.c 1.2 + #include unixstd.h new + +Sat May 23 21:32:13 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.49 + New Mode Page 2A Heuristic (min length 0x14 -> 0x10): ATAPI LITEON only gives 0x12: No Write Speed. + +Wed May 20 23:49:35 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.55 + islast bug (|| instead of &&) fixed + bytes= Option removed + +Tue May 19 04:11:02 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.3 + struct disk_info & struct track_info -> scsimmc.h + scsilog.h new + +Sat May 16 13:15:21 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsimmc.h 1.2 + u_char -> Uchar + +Sun May 10 00:12:04 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsimmc.h 1.1 + date and time created 98/05/09 23:12:04 by joerg + +Sun May 10 00:04:17 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * auheader.h 1.2 + generic Copyright comment + +Sun May 10 00:02:27 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.25 + Strukturdefinitionen -> scsimmc.h + +Thu May 7 22:43:07 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.48 + strindex() -> strbeg() + vendor_info / prod_ident / prod_revision new because of array index problems + Kodak PCD-600 new + +Thu May 7 21:38:58 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.36 + getnum() now extern + is_mmc() with DVD recognition + disk_rcap() new + +Thu May 7 21:38:13 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdr_drv.c 1.7 + DRV_DVD new + cdr_kodak_pcd600 / cdr_cdr_simul / cdr_dvd_simul new + DEV_PIONEER_DVDR_S101 new + DVD recognition in is_mmc() nee + +Thu May 7 21:15:19 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.54 + 1.6 -> 1.7a1 + getnum() LOCAL -> EXPORT + test_unit_ready() before load Medium + Allow Medium removal if not ready on load_media() + +Thu May 7 10:43:00 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.3 + Vendor list actualalized + +Wed May 6 02:52:16 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.29 + simulation driver documented + +Wed May 6 02:41:33 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * audiosize.c 1.9 + .wav files that are smaller than expected are handled correctly + +Mon May 4 02:09:55 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.2 + Function names *_mmc -> *_dvd + ds_maxblock -> ds_maxblocks + getdisktype_dvd() now includes more tests + write_type -> WT_SAO + Hack for virtual track list + +Sun May 3 19:37:17 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.47 + mode_select_sg0()/mode_sense_sg0() cnt usage corrected + mode_sense_sg0() movebytes() count corrected + +Sat May 2 00:46:07 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_simul.c 1.1 + date and time created 98/05/01 23:46:07 by joerg + +Fri May 1 19:26:22 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.46 + DEV_PCD_600 new + is_mmc() now uses dvdp Arg + +Fri May 1 19:08:34 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsidefs.h 1.18 + PCD_600 new + +*************** Release 1.6 ******************* + +Fri Apr 17 12:53:59 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.45 + & before ibuf removed because it is an array + +Fri Apr 17 12:45:38 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.44 + min/sec/frame -> amin/asec/aframe because of min() Macro + +Thu Apr 16 01:43:26 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.26 + -ignsize new + web page for cdrecord added + +Thu Apr 16 00:55:39 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.2 + Print if Manufacturer is in none of the tables + +Thu Apr 16 00:52:13 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.24 + ds_maxblock -> ds_maxblocks + do get_atip() always, but print if lverbose is set + +Thu Apr 16 00:32:50 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.35 + * cdrecord.c 1.53 + ds_maxblock -> ds_maxblocks + new Option -ignsize + +Thu Apr 16 00:31:32 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.29 + * drv_philips.c 1.16 + ds_maxblock -> ds_maxblocks + +Sun Apr 12 16:14:07 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.43 + Smart & Friendly CD-R4012 (TEAC CDR-55S) new + +Sun Apr 12 02:15:15 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.24 + scsiprintcdb()/scsiprintwdata()/scsiprintrdata() new + print scsiprintcdb() on errors + +Sun Apr 12 01:58:26 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.34 + * cdrecord.c 1.52 + Real Blocks new + 1.6a14 -> 1.6 + +Wed Apr 1 03:28:36 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.51 + checkgui() now has verbose print + +Wed Apr 1 01:36:59 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.28 + lberbose > 1 for all subcode Messages + teac_wr_pma()/teac_rd_pma() new + JVC Errorcodes new + check for cdrecord -fix without Parameter + hide Illegal Command errorcode for next_wr_addr_teac() + +Wed Apr 1 01:29:49 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.23 + * scsi_cdr.c 1.42 + * drv_mmc.c 1.23 + GCC Warnings removed: printf format errors + +Tue Mar 31 20:58:07 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.50 + ->1.6a14, LOAD & EJECT works for CD-ROM too + GUI test on STDERR + first Trackno -> track[0] as Hack + +Tue Mar 31 20:56:43 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.25 + CREDITS + better Documentation for tsize= & TEAC + +Sun Mar 29 15:31:08 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.24 + -vv/-VV mods + -fix: not for TEAC + -load new + timeout= Option + tsize= description because of tracksize and TEAC + nice/SunOS -> nice/others + +Sun Mar 29 15:26:19 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.15 + open_session() with tracks & trackp Parameters + Philips CDD-521 old/dumb new + Pioneer DW-S114X new + +Sun Mar 29 15:22:29 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.22 + open_session() with tracks & trackp Parameters + Check for zeroed ATIP Info + wait_unit_ready() for ATAPI - sorry not working + +Sat Mar 28 23:43:07 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.49 + check_recovery() now uses flags for unload_media() + call unload_media() on input buffer, wait error, and for blank media error + open_session() now usees tracks & trackp Parameters for Sizecheck + Printing of is_swab() with audio fixed + +Sat Mar 28 23:22:30 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.27 + teac_open_session() checks tracksize ( <= 0 is not possible) + +Sat Mar 28 23:21:08 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.41 + wait_unit_ready() now handles BUSY + mode_sense_sg0() movebytes() count handling corrected (amt-4) + better (komplete) Inquiry printing with -V + JVC XR-W2001 / Plilips CDD521/00 / Traxdata CDR4120 / Pioneer CD-WO DW-S114X / Pinnacle RCD-1000 new + +Sat Mar 28 23:06:05 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsireg.h 1.18 + SCSI Status codes + +Fri Mar 27 01:04:50 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.18 + * cdrecord.h 1.33 + open_session() with tracks & trackp parameters + +Thu Mar 26 22:42:29 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdr_drv.c 1.6 + Pioneer DW-S 114, old Philips, dumb Philips new + +Tue Mar 24 21:30:08 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.32 + is_*() Macros now clearer: != 0 + +Tue Mar 24 21:29:18 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsidefs.h 1.17 + DEV_CDD_521_OLD new + +Mon Mar 16 00:48:34 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_dvd.c 1.1 + date and time created 98/04/20 00:48:34 by joerg + +Sat Mar 14 17:49:09 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-bsd.c 1.5 + MAX_DMA_BSD 64k -> 60k + +Thu Mar 12 23:48:19 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.26 + set ds_maxblock + next_wr_addr_jvc() uses read_B0() if track == 0 + use trackp[i].trackno for TOC + Lead-out Start time now uses frames + teac_calibrate() inits lba_addr from read_B0() + next_wr_addr_teac() with Parameters + +Thu Mar 12 23:42:09 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.48 + use real Track nubmers + -v/-V now Inc type Flag + print remaining capacity + Pregapsize || bug fixed + Trackno in struct track + wait_unit_ready() new + +Thu Mar 12 23:35:26 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.14 + Print computed ATIP only for empty Disk + ATIP printout now prints Lead-out start time too + compute Disk capacity + +Thu Mar 12 22:33:50 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.17 + close_track_sony() -> track = 0 ! + mode_sense() -> get_mode_params() + +Thu Mar 12 22:24:10 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.31 + Strukt track now includes trackno + CDR_DVD new + from_bcd()/to_bcd() new + wait_unit_ready() new + read_B0() new + +Thu Mar 12 22:20:40 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.40 + unit_ready() now checks for UNIT_ATTENTION + wait_unit_ready() new + toc struktures char -> Uchar + read_tochdr()/read_trackinfo() may have NULL Pointer Args + read_B0() new + +Thu Mar 12 22:12:16 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.22 + Print data if verbose > 1 + +Thu Mar 12 01:21:58 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cd_misc.c 1.2 + from_bcd()/to_bcd() new + +Tue Mar 10 00:07:50 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.47 + * drv_mmc.c 1.21 + checkgui() & isgui new + +Mon Mar 9 23:29:02 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.20 + Read ATIP non-fatal + warnung in fixation with correct lverbose flag + +Sun Mar 8 15:02:13 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.39 + SAF CD-R2006PRO CD-R2006, JVC R2626 new + +Sun Mar 8 14:59:31 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.46 + Default Timeout -> 40s + flags int -> long + new Option -load + Print Lead-out start + 90 Min value corrected + +Sun Mar 8 14:56:53 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.30 + fsamples()/frames() new + +Fri Mar 6 01:11:56 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.21 + print SCSI command names before ABORT + +Thu Mar 5 01:15:26 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsierrs.c 2.15 + referres -> refers + +Thu Mar 5 01:15:02 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.11 + * scsitransp.c 1.20 + scsi_sense_qual() new + +Mon Mar 2 22:50:12 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.19 + msf_to_lba()/lba_to_msf() -> cd_misc.c + len += 2 to correct length for TOC & disk Info + failed read ATIP is no fatal error + better print_atip() + +Mon Mar 2 22:45:53 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cd_misc.c 1.1 + date and time created 98/03/02 22:45:53 by joerg + +Mon Mar 2 22:39:02 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.29 + F_LOAD new + All Flags sorted + msf_to_lba()/lba_to_msf() new + +Mon Mar 2 22:36:10 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.13 + philips_getlilo() new + print disk manufacturer new + +Mon Mar 2 21:56:53 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.38 + Pinnacle RCD 4X4, SAF CD-RW226 new + +Mon Feb 23 22:32:27 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.37 + read_toc_philips() same parameters as read_toc() (ses -> fmt) + +Mon Feb 23 22:30:57 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.18 + msf_to_lba() corrected (+-150 bug) + lba_to_msf() new + Check for Complete Disk: 0xFF:0xFF/0xFF + pr_manufacturer() new with lverbose + different Formatting + +Mon Feb 23 21:54:28 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.45 + 80 Minute limit -> 90 Minutes + +Mon Feb 23 21:51:56 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * diskid.c 1.1 + date and time created 98/02/23 21:51:56 by joerg + +Sun Feb 22 23:23:22 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.10 + fifo_percent() with Parameter + FIFO Bug (duoubling of a segment at end of writing) fixed + +Sun Feb 22 22:54:46 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.44 + fifo_percent() with Parameter + unit_ready() for UNLOAD removed + print Disk capacity + +Sun Feb 22 22:52:53 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * wm_packet.c 1.6 + fifo_percent() with Parameter + +Sun Feb 22 22:47:51 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.28 + fifo_percent() with Parameter + msf_t typedef + pr_manufacturer() new + +Sun Feb 15 21:01:03 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * audiosize.c 1.8 + getWavShort() & getWavLong() Definitions removed + +Tue Feb 10 01:00:48 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.43 + New option timeout=# + +Mon Feb 9 12:44:40 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.18 + timeout from 1/100 sec -> 1/HZ sec + +Sun Feb 8 21:56:01 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.17 + Missing bracket at read() inserted + +Sun Feb 8 18:45:19 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.36 + Tayo Yuden CD-WO EW-50 better Inquiry + +Sun Feb 8 15:52:15 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.9 + fifo_percent() returns -1 if buflen == 0 + dummy fifo_percent() always -1 + +Sun Feb 8 15:50:43 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * wm_packet.c 1.5 + * cdrecord.c 1.42 + Copyright -> 1998 + fs Reference in fifo_percent() removed + fifo_percent() in wm_packet new + +Sun Feb 8 13:54:25 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.23 + fs= - administrative part + .au & .wav description + better -swab description + +Sun Feb 8 13:30:33 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.16 + Fix for sendcommand() befor scsi_getbuf() call + read() < 0 now handled + +Sun Feb 8 13:28:38 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * audiosize.c 1.7 + Definitions for WAVE better + better WAV recognition from Dave + +Sat Feb 7 23:20:14 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.25 + close_track_teac() fixed only audio uses no run-out blocks + +Sat Feb 7 23:18:43 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.41 + rezero_unit() now silent not supported by all drives + +Sat Feb 7 23:14:03 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.35 + Kodak CDR-240 new + +Sun Feb 1 23:17:33 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.8 + HAVE_SHM -> HAVE_USGSHM was a typo + +Sun Feb 1 21:20:48 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.34 + DVD enhancements in mmv_getval() & print_capabilities() + +Sun Feb 1 20:35:06 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsireg.h 1.17 + DVD Definitions in Mode Page 2A + +Sun Feb 1 19:56:10 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.15 + scsi_getbuf() hat nun char *ret wegen pointer Aritmetik + sizeof() cast comparison to int + scsi_send(): superfluous ; before scsi_settimeout() removed + +Sun Feb 1 19:45:21 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.40 + filename new in struct track + Errorcode and exit() in audio*size() + +Sun Feb 1 19:44:08 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * auheader.h 1.1 + date and time created 98/02/01 19:44:08 by joerg + +Sun Feb 1 19:44:00 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * audiosize.c 1.6 + auheader.h new + Errorcodes + +Sun Feb 1 19:43:26 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.27 + filename new in struct track + cd_mode_page_2A *cdr_cdcap new in struct cdr_cmd + +Sun Feb 1 19:42:28 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.12 + * drv_sony.c 1.16 + * drv_mmc.c 1.17 + * drv_jvc.c 1.24 + cd_mode_page_2A *cdr_cdcap new in struct cdr_cmd + +Sun Feb 1 16:03:29 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.16 + ATIP Enhanced + +Sun Feb 1 15:56:31 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.15 + mmv_check() -> mmc_cap()/mmc_getval() + Handle non-trayload drives + warning for dummy/verbose while fixating + +Sun Feb 1 15:49:17 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsidefs.h 1.16 + DEV_MMC_DVD, DEV_PIONEER_DVDR_S101 new + +Sun Feb 1 15:46:50 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.33 + mmc_getval() & mmv_check() with dvdp + DEV_MMC_DVD new + Pioneer DVD-R S101, TEAC CD-R55S new + allow_atapi() in print_capabilities() + heuristic with speed >= 176 according to mmc2 + +Sun Feb 1 15:46:17 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.39 + better CD-Recorder warning + +Sun Feb 1 14:53:02 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.38 + Honour file sizes + better usage() Output + .au & .wav Filesize recognition + early recognition of "incompatible medium" + sched_setscheduler() error code (< 0) is correct + +Sun Feb 1 14:39:27 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.26 + mmc_getval() & mmv_check() with dvdp + TI_WAV & is_wav() removed + +Sun Feb 1 14:33:39 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * audiosize.c 1.5 + Complete recognition of a Wavheader (with Hilfe from Heiko) + +Mon Jan 26 01:56:21 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-aix.c 1.4 + valloc() re-implemented (not available in AIX libc) + scsi sense handling ready + +Mon Jan 26 01:51:58 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.32 + mmc_cap(), mmc_getval() new + Strings for printcap() static for K&R + +Mon Jan 26 01:07:27 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * audiosize.c 1.4 + Filesize - header for Sun .au Files, data_size is not always correct + +Sun Jan 25 23:08:00 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * audiosize.c 1.3 + Sun .au Header new + +Sun Jan 25 22:58:58 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.25 + TI_NOWAV -> TI_NOAUHDR, is_auname() & ausize() new + +Sun Jan 25 18:10:47 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.24 + TI_NOWAV, mmc_cap() & mmg_getval(), is_wavname() new + +Sun Jan 25 16:16:23 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * audiosize.c 1.2 + is_wavname() new + +Sun Jan 25 16:02:26 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * audiosize.c 1.1 + date and time created 98/01/25 16:02:26 by joerg + +Sun Jan 25 13:38:40 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.23 + Errortexts for CD-R55S + +Sat Jan 24 17:52:52 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * wm_packet.c 1.4 + * fifo.c 1.7 + Honour file sizes + +Fri Jan 23 02:08:22 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.14 + scsi_initdev() new to allow concurrent cdrecord's + +Fri Jan 23 02:04:01 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.22 + * drv_mmc.c 1.14 + * drv_sony.c 1.15 + * scsireg.h 1.16 + * scgio.h 2.12 + Uint for Bitfields -> Ucbit + +Sun Jan 18 14:25:01 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.19 + flush() calls to correctly mix stderr/stdout + +Sun Jan 18 14:23:33 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.23 + TI_WAV, is_wav(), wavsize() nee + +Sat Jan 17 22:07:03 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.22 + * cdrecord.c 1.37 + -reset Option new + +Sat Jan 17 21:53:58 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.22 + F_RESET, F_PRATIP, F_PRDINFO, SES_UNDEF new + Definitios for disk status and session status + dstat_t enhanced + CDR_NOLOLIMIT & CDR_ALLOC new + fifo_percent(), allow_atapi(), mode_sense_??()/mode_select_??() new + +Sat Jan 17 21:35:54 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.6 + undef FIFO if no shared mamory + SHM_LOCK for Linux + Stat buffer for fifosize + removed sp->cont because it is not secure (use diff) + fifo_percent() new + +Sat Jan 17 21:20:57 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.36 + -reset new + fifo_percent() printing for -v + +Sat Jan 17 21:09:24 1998 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.21 + Better description of dev= and -scanbus + +Tue Dec 23 01:26:35 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.31 + Plextor PX-R24CS + S&F CD-R2006PLUS + Wearns CDR-632P new + +Tue Dec 23 01:23:34 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.30 + Uint in Bitfields -> Ucbit + +Thu Dec 11 19:30:31 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.18 + Print command execution time for each failed (non-silent) command + +Sun Nov 9 18:33:48 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.13 + Remove get Page 0x2A for Matsushita CW-7502 + has_mode_page() checks "current" instead of "default" + +Sat Nov 8 16:11:51 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.35 + Disk size check -> checkdsize() : new + +Fri Nov 7 00:02:20 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-aix.c 1.3 + timeout counts in seconds + +Fri Nov 7 00:04:11 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsireg.h 1.15 + * scgio.h 2.11 + * scsi_cdr.c 1.29 + * drv_sony.c 1.14 + * drv_mmc.c 1.12 + * drv_jvc.c 1.21 + u_char in Bitfields -> Uint + +Thu Nov 6 20:27:08 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.7 + Typo __AIX -> defined(_IBMR2) || defined(_AIX) + +Thu Nov 6 20:26:23 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-aix.c 1.2 + sccsid[] -> __sccsid[], fd -> f Typo, #include <malloc.h> + +Thu Nov 6 20:22:14 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.20 + Typo corrected + +Thu Nov 6 20:19:26 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.17 + * scsierrs.c 2.14 + * scsi_cdr.c 1.28 + * scsi.c 1.4 + * drv_sony.c 1.13 + * drv_philips.c 1.11 + * drv_mmc.c 1.11 + * drv_jvc.c 1.20 + #include <mconfig.h> for AIX + +Thu Nov 6 20:18:25 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.34 + #ifdef RLIMIT_NOFILE fuer AIX + +Wed Nov 5 18:01:32 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.19 + Better doc for fs= + +Wed Nov 5 17:57:50 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.10 + msf_to_lba() new, get_diskinfo() new, di_to_dstat() new, getdisktype_mmc() new, additions for Matsushita CW-7502 + +Wed Nov 5 17:43:41 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.5 + switch -> if then else + +Wed Nov 5 17:15:45 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.33 + init struct disk_status, better aritmetic for disk size + +Wed Nov 5 17:14:29 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.4 + print FIFO min fill in percent + +Tue Nov 4 11:20:22 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.26 + return (mode_select_g0(dp, cnt, smp, pf)) was missing in mode_select() + +Tue Nov 4 10:35:02 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.13 + Check for NULL at return of valloc() + +Tue Nov 4 00:13:35 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.19 + New flag CDR_NO_LOLIMIT + +Sun Nov 2 16:17:10 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.25 + SCSI mode(6/10) conversion for ATAPI, distinguish between S&F 2006PLUS / S&F 2006PLUS + +Sun Nov 2 14:57:57 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.16 + Print finish time + +Sun Nov 2 14:54:50 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scgio.h 2.10 + i_to_4_byte new + +Thu Oct 23 19:21:19 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.6 + AIX Support + +Thu Oct 23 19:20:25 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-aix.c 1.1 + date and time created 97/10/23 18:20:25 by joerg + +Thu Oct 23 19:12:02 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.9 + Enhancements for packet writing + +Thu Oct 23 01:35:02 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.18 + New options -prcap, -packet, pktsize =#, -noclose + +Wed Oct 22 23:50:44 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.18 + * wm_packet.c 1.3 + * cdrecord.c 1.32 + fflush(stdout) -> flush(), flush() after Fixating... + +Wed Oct 22 23:49:12 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.24 + scsi_close-session() -> scsi_close_tr_session() + +Wed Oct 22 23:49:11 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.21 + scsi_close-session() -> scsi_close_tr_session() + +Sun Oct 19 15:41:35 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.23 + * cdrecord.c 1.31 + Prevent medium removal problems fixed (read TOC) & Matsushita CD-750? + +Sun Oct 19 15:40:32 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsidefs.h 1.15 + Matsushita CW-7501 & CW-7502 + +Sun Oct 19 02:08:53 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.12 + * drv_philips.c 1.10 + * drv_jvc.c 1.17 + * wm_packet.c 1.2 + * cdrecord.h 1.20 + * cdrecord.c 1.30 + next_wr_address() has track_t * added + +Sun Oct 19 01:37:02 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.16 + read_disk_info() -> read_disk_info_teac(), zero pre-gap audio support, opt_power_judge() timeout -> 60 sec + +Sun Oct 19 01:33:21 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.22 + read_disk_info() new, print_capabilities() new + +Sun Oct 19 00:40:36 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.29 + * cdrecord.h 1.19 + get_buf() new, -prcap & print_capabilities() new, -packet new, pktsize=# new + +Sun Oct 19 00:36:32 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * wm_track.c 1.1 + * wm_session.c 1.1 + * wm_packet.c 1.1 + date and time created 97/10/18 23:36:31 by joerg + +Sat Oct 18 19:14:05 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi.c 1.3 + stdlib.h -> stdxlib.h, unistd.h -> unixstd.h + +Sat Oct 18 01:34:19 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * modes.c 1.3 + Ausgabe der Mode Parameter wenn mode_select() nicht klappt & return FALSE + +**** 1.6a3 *** + +Sun Oct 12 20:00:21 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.17 + * cdrecord.c 1.28 + New options pregap= defpregap= + +Sun Oct 12 19:30:45 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.18 + is_first() & is_last() new + +Sat Oct 11 18:01:28 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.27 + islast debug printf deleted + +Sat Oct 11 17:57:43 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.21 + * drv_sony.c 1.11 + * drv_philips.c 1.9 + * drv_mmc.c 1.8 + * drv_jvc.c 1.15 + * cdrecord.h 1.17 + * cdrecord.c 1.26 + islast for TEAC & no run-out blocks for disksize computing + +Sat Oct 11 14:54:03 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.14 + OLD_CLOSE_TRACK re-aktiviert, clear_subcode() in open_track(), set_limits() in open_track() for audio without run-out, dummy sector -> static to be zeroed + +Thu Oct 9 14:14:24 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.13 + Audio Tracks have no link&run-in + +Thu Oct 9 02:01:23 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.12 + SWABAUDIO Flag new + +Wed Oct 8 17:24:40 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.20 + * drv_sony.c 1.10 + * drv_philips.c 1.8 + * drv_mmc.c 1.7 + * cdrecord.h 1.16 + * cdrecord.c 1.25 + Modification of data structures for JVC/TEAC + +Wed Oct 8 17:23:41 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.3 + WRITER_MAXWAIT 20 -> 120 s + +Wed Oct 8 17:14:04 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.11 + Enhancements for audio and multi track disks + +Wed Oct 8 14:48:06 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.16 + Better doc for padsize & fs= + +Mon Oct 6 20:37:39 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.10 + Modified to use pad_track() + +Mon Oct 6 20:32:11 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.24 + In pad_track(): if (bytesp != 0) check was missing ->coredump + +Mon Oct 6 20:29:22 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.19 + SMART&FRIENDLY CD-R2006 + +Sun Oct 5 16:53:45 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.6 + verbose printing modified + +Sun Oct 5 16:53:09 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.23 + Check for bytesp != 0 in pad_track() + +Sat Oct 4 01:09:56 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.22 + realtime raisepri Problem for HP-UX fixed (function present bot not working) + +Fri Oct 3 21:33:13 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.18 + * drv_sony.c 1.9 + * drv_philips.c 1.7 + * drv_mmc.c 1.5 + * drv_jvc.c 1.9 + * cdrecord.h 1.15 + * cdrecord.c 1.21 + * cdrecord.1 1.15 + * cdr_drv.c 1.5 + new option blank=type for CD-RW + +Fri Oct 3 16:23:00 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.20 + pad_track() new, await_faio() new & init_faio() befor wait loop, always pad to 300 sectors , padsize= option new, DEFAULT_FIFOSIZE new + +Thu Oct 2 02:02:10 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.2 + MIN_BUFFERS -> 3, await_faio() new, kill_faio() new, stdin EOF check, Messages only for debug + +Thu Oct 2 01:38:39 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.14 + padsize Option new, nice --18 bug, 's' & 'f' mult for getnum() + +Thu Oct 2 01:31:28 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.8 + sleep()'s added to cure fixating problems ??? + +Thu Oct 2 01:19:46 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.14 + DEFAULT_FIFOSIZE, roundup(), tracksize & padsize -> long, pad_track() new, await_fifo() & kill_fifo() new, minutes() cast to int + +Wed Sep 24 00:02:39 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.19 + Fifo & tracksize Option + +Tue Sep 23 23:46:27 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sgi.c 1.7 + Bug with resid != 0 fixed + +Sun Sep 21 23:20:15 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.13 + fs= Option, tsize= Option, mkisofs | cdrecord with fs= EXAMPLE + +Sun Sep 21 22:58:34 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * fifo.c 1.1 + date and time created 97/09/21 21:58:34 by joerg + +Sun Sep 21 22:45:08 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.13 + faio_get_buf() & fifo_stats() + +Sun Sep 21 01:12:43 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.12 + fifo code + +Wed Sep 17 13:55:57 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.7 + Typo in cdr_write_teac() EXPORT -> LOCAL + +Wed Sep 17 13:55:06 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.18 + raisepri() has Parameter (n below Max), _POSIX_PRIORITY_SCHEDULING, _POSIX_MEMLOCK + +*************** Release 1.5 ******************* + +Mon Sep 15 16:46:16 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * README 1.9 + Anpassungen fuer release 1.5 + +Wed Sep 10 18:40:49 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.17 + Print always Copyright except for -msinfo + +Wed Sep 10 18:12:59 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.17 + Inquiry debug data indented + Mode Parameters only for verbose + +Wed Sep 10 17:57:32 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.16 + Flags defs von cdrecord.c -> cdrecord.h + load_media() new + load/unload_madia() global + Track verbose output after inquiry + Test errorcodes while burning + Dummy blocks added for close_track() is not an error + -nofix Flag activated + Exit code for burning errors: -2 + Swabaudio automatic + +Wed Sep 10 17:43:12 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.11 + Flag defs from cdrecord.c + getdisktype() with cdr_t * + load_media() new + load/unload_madia() global + +Wed Sep 10 17:42:13 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdr_drv.c 1.4 + * drv_jvc.c 1.6 + getdisktype() with cdr_t * + +Wed Sep 10 17:41:02 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.6 + philips_getdisktype() new for automatic eject on "Command Sequence Error" + +Wed Sep 10 16:50:56 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.12 + Scsibus , typo removed + +Wed Sep 10 15:10:03 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.11 + 1.4 -> 1.5 + +Wed Sep 10 15:04:26 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.8 + new_track_sony() return valoe corrected + +Wed Sep 10 15:03:36 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.10 + Changes for cdrecord-1.5 + +Thu Sep 4 19:26:00 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.12 + Use channel on multi channel controlers + +Thu Sep 4 19:09:10 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.5 + * drv_sony.c 1.7 + * scsi_cdr.c 1.16 + inq.ansi_version -> inq.data_format for all mode_select() calls + for Philips CDD-522 (version == 1 , format == 2) + +Wed Sep 3 02:00:33 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.11 + scsi_mapbus() new + better timeout handling + copy Struct now automatic Variable + Sense Data error = SCG_RETRYABLE + +Mon Sep 1 01:25:16 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sgi.c 1.6 + * scsi-linux-sg.c 1.10 + * scsi-hpux.c 1.4 + * scsi-bsd.c 1.4 + Last tuning make all implementations equal + Open only one file if possible. + Better bound checking + +Sun Aug 31 23:21:06 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-hpux.c 1.3 + Array again has 8 Luns + havebus tests bounds + +Sun Aug 31 23:18:35 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sgi.c 1.5 + MAX_* introduced, open max 1 lun (for now) + +Sun Aug 31 20:14:02 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-hpux.c 1.2 + MAX_LUN now 1 + +Sun Aug 31 20:10:25 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-hpux.c 1.1 + date and time created 97/08/31 19:10:25 by joerg + +Sun Aug 31 18:00:16 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.5 + HP-UX added + +Tue Aug 26 19:37:15 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.15 + init dp in main now correctly + +Tue Aug 26 17:50:20 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sgi.c 1.4 + Support complete without using -lds + +Tue Aug 26 17:47:35 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.15 + scsibus/target/lun now now -1 if bus is scanned + to make sure that not ony one target can be opened. + +Tue Aug 26 17:46:22 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.14 + test_unit_ready() after select_target() (SCANBUS) + +Tue Aug 26 01:47:41 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sgi.c 1.3 + unused includes removed + +Mon Aug 25 22:02:35 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scgio.h 2.9 + * scsitransp.c 1.15 + * scsi-sgi.c 1.2 + * scsi-linux-sg.c 1.9 + * scsi-bsd.c 1.3 + errno -> ux_errno in scg_cmd for POSIX multithread + +Mon Aug 25 21:27:55 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-sgi.c 1.1 + date and time created 97/08/25 20:27:55 by joerg + +Mon Aug 25 18:10:12 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.13 + raisepri() not always done + +Sun Aug 24 22:58:37 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.4 + First pre-aplha makes one data track only + +Sun Aug 24 17:03:05 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.12 + New options: driver=name -checkdrive -inq -scanbus -nofix + set_trsizes() later + get_cdr_cmds() new + first simple sizecheck + "swap" output from print_data_track() removed + +Sun Aug 24 16:54:31 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.10 + struct disk_status new + is_unknown_dev() new + is_mmc() new + mmc_check() new + set_cdrcmds() new + +Sun Aug 24 16:53:09 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.14 + is_unknown_dev() new + is_mmc() new + mmc_check() new + open_scsi() modified for scsi_scan() + Device recognition new for CD-R + scsi_load() now correct + +Sun Aug 24 16:22:22 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.9 + -nofix new + driver=name new + -checkdrive new + -inq new + -scanbus new + Sense Output uses new form + +Sun Aug 24 16:19:42 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.4 + CDR_SWABAUDIO new + cd_mode* pages -> scsireg.h + identify_mmc() uses mmc_check() + +Sun Aug 24 16:18:00 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdr_drv.c 1.3 + set_cdrcmds() new + get_cdrcmds() enhanced + +Sun Aug 24 15:47:30 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.6 + * drv_philips.c 1.5 + CDR_SWABAUDIO Flag new + +Sun Aug 24 14:51:43 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsidefs.h 1.14 + CDD-2000 & CDD-2600 new + MMC Definitionen new + +Sun Aug 24 14:18:47 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsireg.h 1.14 + CD mode pages 05 & 2A + +Sun Aug 10 19:29:38 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.4 + * drv_sony.c 1.5 + * drv_mmc.c 1.3 + * cdrecord.h 1.9 + * cdrecord.c 1.11 + cdr_driver -> cdr_drname + cdr_drtext + open_track() with track_info * instead of many arguments + +Sun Aug 10 18:10:14 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.13 + LOAD (A6) command now uses correct SCSI definition + +Sun Aug 10 17:43:35 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.8 + Buffer overflow in sg_rq corrected + timeout corrected (semicolon past if) + 12 Byte Hack now OK + +Sun Aug 10 17:42:06 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scgio.h 2.8 + SCSI g5 command struct now ansi compliant + +Sun Aug 10 17:40:30 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.4 + SGI include + +Fri Jul 18 13:41:46 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.12 + read_capacity() new + scsi_load_unload() new + scsi_set_sped() new + write_xg1() new + read_toc() for SCSI-3 new + read_toc_philips() from old name + read_track_info() -> read_track_info_philips() + read_track_info() new + scsi_close_session() new + first_writable_address() with address Pointer + read_tochdr() with cdr_t * ???? + read_session_offset() with offset Pointer + Version for SCSI-3 + is_cdrecorder() removed, Taiyo Yuden new + +Fri Jul 18 12:35:02 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.7 + with new ioctl() SCSI_IOCTL_GET_BUS_NUMBER more SCSI busses + +Fri Jul 18 02:49:46 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.8 + -version + better -isosize Doku + -multi warning removed + +Fri Jul 18 02:44:11 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.10 + fix_it now past open_session() + next_writable_address() and read_session_offset() now with adress Pointer + -version usage() + superfluous argument removed with lout + +Fri Jul 18 02:31:23 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.8 + * drv_mmc.c 1.2 + SCSI-3/mmc first implementation + +Fri Jul 18 02:25:10 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.3 + * drv_philips.c 1.3 + * drv_sony.c 1.4 + next_writable_address now has adress pointer + read_session_offset_philips() extracted + +Thu Jul 17 18:12:43 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-bsd.c 1.2 + ifdef for BSD SENSE bug + +Thu Jul 17 17:43:10 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * isosize.c 1.3 + filedescriptor sense (seek) test. + +Tue Jul 15 21:27:29 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * isosize.c 1.2 + & before vd.vd_type deleted + +Tue Jul 15 21:26:57 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.3 + & before mode deleted + +Tue Jul 15 21:16:46 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.9 + version string + write_track_data() with startsec parameter + cd_recorder/drive recognition now uses cdr_t + print_toc() with cdr_t parameter + open_session() with multi parameter + Progress printing in write_track_data() now uses correct rounding + dbtype with -multi corrected + read_session_offset() with cdr_t parameter + print_toc() prints sector numbers correctly and 'lout' for 0xAA + +Tue Jul 15 13:34:04 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdr_drv.c 1.2 + drive_identify may modify cdr_t struct pointer + Yamaha CDR-400 correct with cdr_mmc + +Tue Jul 15 13:24:49 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.2 + * drv_jvc.c 1.2 + * drv_sony.c 1.2 + open_track() with dbtyp arg + open_session() with multi arg + struct cdr_t driver flags filled in + driver type string + +Tue Jul 8 19:42:42 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.6 + /dev/sg0 ... tested too + +Tue Jul 8 18:00:39 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-bsd.c 1.1 + date and time created 97/07/08 17:00:39 by joerg + +Tue Jul 8 17:59:20 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.3 + New Implementation for *BSD + +Sun Jun 22 19:58:40 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.11 + Smart & Friendly Support + +*************** Release 1.4 ******************* + +Sat Mai 21 19:58:42 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.7 + Updates for release 1.4 + +Sat Mai 21 18:11:25 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi.c 1.2 + scsireg.h Include + +Sat Mai 21 00:52:33 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_sony.c 1.1 + date and time created 97/05/20 23:52:33 by joerg + +Sat Mai 21 00:27:56 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_philips.c 1.1 + date and time created 97/05/20 23:27:56 by joerg + +Sat Mai 21 00:27:50 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_mmc.c 1.1 + date and time created 97/05/20 23:27:50 by joerg + +Sat Mai 21 00:27:43 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * drv_jvc.c 1.1 + date and time created 97/05/20 23:27:43 by joerg + +Sat Mai 21 00:27:14 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.10 + mode_select() uses inq.ansi_version >= 2 + +Sat Mai 21 00:26:42 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.7 + attach_unknown() new + +Sat Mai 21 00:26:05 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdr_drv.c 1.1 + date and time created 97/05/20 23:26:05 by joerg + +Thu Mai 19 23:46:54 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.8 + Struct track -> cdrecord.h + DB_XXX Data block types + cdr_cmd Struct as Drive Abstraction Layer + -eject Flag + checktsize() new + CDR_SPEED & CDR_DEVICE + +Thu Mai 19 16:59:44 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.6 + struct track from cdrecord.c + DB_XXX Data block types + cdr_cmd Struct as Drive Abstraction Layer + +Thu Mai 19 15:42:53 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.9 + Prototypes lokal too + scsi_load_unload() -> load_unload_philips() + start_stop_unit() now with eject + close_track_philips() new + recover with track parameter + mode_sense() new + speed_select splitted + inquiry news new drives + scsi_cdr_write() + +Mon Mai 16 15:46:48 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * config.h 1.1 + date and time created 97/05/16 14:46:48 by joerg + +Mon Mai 16 15:46:48 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi.c 1.1 + date and time created 97/05/16 14:46:48 by joerg + +Fri May 23 22:09:21 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.14 + bad 2. Parameter in gettimeofday -> struct timezone * + +Fri Apr 23 22:08:16 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsierrs.c 2.13 + missing %s in Formatstring added + +Wed Apr 14 00:54:03 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsireg.h 1.13 + new scsi device types + +Wed Apr 14 00:53:28 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.13 + scsireset() into hack part + scsi_setnonstderrs() new, scsierrmsg() chganges + new scsi devicetype codes, Solaris x86 dmasize without gethostid() + +Wed Apr 14 00:46:27 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.10 + Changes for scsierrs.c enhancements + +Wed Apr 14 00:45:26 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsierrs.c 2.12 + Enhancements for SCSI-2 & SCSI-3 + +Tue Apr 6 17:15:43 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsidefs.h 1.13 + Different order & Yamaha CDR-400, Sony CDU-924, Ricoh RO-1420, Teac CD-R50 new + +Tue Apr 6 16:36:38 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scgio.h 2.7 + Enhancements for SCSI-2 & SCSI-3 + +Tue Apr 6 14:10:35 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.5 + CCD-> CCS Typo + +Tue Apr 6 13:59:16 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.2 + scsireset() -> transport specific part + +Tue Apr 6 13:59:16 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.4 + scsireset() -> transport specific part + +*************** Release 1.3 ******************* + +Fri Mar 4 19:48:35 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * README 1.6 + Changes for Release 1.3 + +Fri Mar 4 18:57:02 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.6 + release 1.3 + +Fri Mar 4 18:46:37 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.5 + Changes for Release 1.3 + +Fri Mar 4 11:55:28 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.3 + scsihack.c & scsi-linux-sg.c splitted + +Fri Mar 4 11:53:59 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsihack.c 1.1 + date and time created 97/03/04 10:53:59 by joerg + +Fri Mar 4 11:52:42 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * iso9660.h 1.2 + Quick hack for ANSI C + +Wed Mar 2 17:16:35 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.8 + open_scsi() with verbose arg + write_track() & write_track_info() isaudio/preemp -> sectype + read_toc() new, read_header() new, read_track_info() new + first_writable_addr() now working + read_tochdr() new, read_trackinfo() new, read_session_offset() new + is_cddrive() new read_scsi() now korrekt with G0_MAXADDR & cnt < 256 + HACK XXX scsi_capacity to 2048 bytes Sectorsize initialized for mkisofs-1.10 + +Wed Mar 2 16:51:24 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.12 + BAD -> EX_BAD, BOOL scsi_havebus() new + scsi_fileno(bus, tgt, lun) new with 3 Parameters, MAX_DMA_SUN386 new + +Wed Mar 2 16:46:44 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.2 + better Kommentar + +Wed Mar 2 16:35:04 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.9 + BOOL scsi_havebus() new, scsi_fileno(bus, tgt, lun) new with 3 Parameters + +Wed Mar 2 16:33:18 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scgio.h 2.6 + intriduced _SCGIO_H & bei __STDC__ 0xFF000000UL + +Wed Mar 2 16:14:35 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsidefs.h 1.12 + BAD -> EX_BAD + +Wed Mar 2 16:14:04 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * port.c 1.6 + include fmt.h only if #ifdef FMT + +Wed Mar 2 16:07:53 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi-linux-sg.c 1.1 + date and time created 97/03/02 15:07:53 by joerg + +Wed Mar 2 15:49:56 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * iso9660.h 1.1 + date and time created 97/03/02 14:49:56 by joerg + +Wed Mar 2 15:48:55 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * isosize.c 1.1 + date and time created 97/03/02 14:48:55 by joerg + +Wed Mar 2 15:40:32 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.7 + toctname[] * sectname[] new + ldebug -> debug, HAVE_MLOCKALL, -msinfo new, -toc new + -audio/-mode2/-xa1/-xa2/-cdi new, -isosize new + better Check for options, print_msinfo() new, print_toc() new + HAVE_SYS_PRIOCNTL_H new + +Wed Mar 2 15:30:26 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.h 1.5 + BAD -> EX_BAD in standard.h, TOC_* defines, ST_* defines, struct msf + several Interface changes for Prototypes + +Wed Jan 19 00:23:11 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.6 + Changed to use scsi_buf_size() & scsi_getbuf(), better gcc Kompat. + +Wed Jan 12 23:11:18 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.11 + Sbufsize -> long, scsi_maxdma() new + +Wed Jan 12 22:10:33 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.8 + Sbufsize -> long + +Fri Jan 7 21:10:26 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * port.c 1.5 + ANSI C & printf %ld + +Thu Jan 6 22:45:03 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.7 + scsi_sense_key() & scsi_sense_code() from fmt.c + +Thu Jan 6 22:45:02 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.10 + scsi_sense_key() & scsi_sense_code() from fmt.c + +Mon Jan 3 14:47:53 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.h 1.6 + scsi_bufsize() & scsi_getbuf() new + +Mon Jan 3 14:47:52 1997 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.9 + scsi_bufsize() & scsi_getbuf() new + +Fri Dec 31 17:16:13 1996 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsireg.h 1.12 + Defekt List: length & list_block -> char[] for Byteorder + +Tue Dec 28 20:51:42 1996 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scgio.h 2.5 + #error beseitigt for SunOS cc + +Tue Dec 28 14:28:01 1996 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsitransp.c 1.8 + debug -> kdebug + +Tue Dec 28 14:19:16 1996 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scgio.h 2.4 + debug -> kdebug + +Sun Dec 19 16:18:18 1996 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.7 + Mitsumi + +Sun Dec 19 16:14:12 1996 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * README 1.5 + Performance X86 & Mitsumi + +Sat Dec 18 12:37:38 1996 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsierrs.c 2.11 + param.h, sys/buf.h, sun/dklabel.h, sun/dkio.h eliminated + +Sat Dec 18 03:26:04 1996 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * README 1.4 + Changes for Release 1.2 + +Sat Dec 18 03:24:14 1996 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.1 1.4 + Changes for Release 1.2 + +Sat Dec 18 03:13:41 1996 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * cdrecord.c 1.5 + -swab new + LOCAL functions + timings, new timeout for fixating + countdown timer before Start + write_track_info() disabled + -pad for audio, pad to 2352 bytes. + +Sun Dec 12 21:09:24 1996 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsi_cdr.c 1.6 + Flush cache & Fixation with big Timeout. + +Thu Nov 26 10:54:18 1996 Joerg Schilling <joerg@schily.isdn.cs.tu-berlin.de> + * scsierrs.c 2.10 + New Codes for CDD-2000 & Support for Yamaha CDR-100 + +Mon Dec 16 16:19:54 1996 J. Schilling <joerg@schily.isdn.cs.tu-berlin.de> + + * Added -swab option to support Yamaha audio + Thanks to (Fred) vecoven@montefiore.ulg.ac.be + for the hint. + * Added counter for quit time (9 seconds) + +Wed Dec 12 21:09:24 1996 J. Schilling <joerg@schily.isdn.cs.tu-berlin.de> + + * Flush cache & Fixation with separate bigger timeout, + other timeout reduced to 20sec. + +Mo Dec 3 13:03:30 1996 J. Schilling <joerg@schily.isdn.cs.tu-berlin.de> + + * Set sector size on all drive types before writing, + * Omwith the write_track_info Mode Select before write_track + even for Philips drives (this is currently not needed because + we don't support ISRC codes at this time). + +Tue Nov 26 10:54:18 1996 J. Schilling <joerg@schily.isdn.cs.tu-berlin.de> + + * New error codes for CDD-2000 & error code support for Yamaha CDR-100 + +Sun Nov 3 22:58:21 1996 J. Schilling <joerg@schily.isdn.cs.tu-berlin.de> + + * scsireset() aded to scsitransport.[hc] + * Timings for Track and Fixation + +Fri Oct 4 11:45:13 1996 J. Schilling <joerg@schily.isdn.cs.tu-berlin.de> + + * Version 1.1 released. + +Mon Aug 19 22:25:18 1996 J. Schilling <joerg@schily.isdn.cs.tu-berlin.de> + + * Read access test to allow cdrecord to run savely suid root + +Sun Aug 18 12:11:20 1996 J. Schilling <joerg@schily.isdn.cs.tu-berlin.de> + + * bit ordering problems solved + Thanks to Gert Poletiek <gert@fwi.uva.nl> for testing + +Tue Jun 18 21:38:51 1996 J. Schilling <joerg@schily.isdn.cs.tu-berlin.de> + + * several changes in scgio.h + +Sun Jun 16 15:56:35 1996 J. Schilling <joerg@schily.isdn.cs.tu-berlin.de> + + * Ansi C Protytypes + * priocntl added for Solaris + Thanks to Anders Lundgren <al@irfu.se> + +Sun Feb 4 19:14:46 1996 J. Schilling <joerg@schily.isdn.cs.tu-berlin.de> + + * Initial release 1.0 diff --git a/scsilib/DEFAULTS/Defaults b/scsilib/DEFAULTS/Defaults new file mode 100644 index 0000000..f36f1e9 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults @@ -0,0 +1,8 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions: include system specific file +# +########################################################################### + +include $(DEFLTSROOT)/$(DEFLTSDIR)/Defaults.$(O_ARCH) diff --git a/scsilib/DEFAULTS/Defaults.aix b/scsilib/DEFAULTS/Defaults.aix new file mode 100644 index 0000000..9499fce --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.aix @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for IBM AIX Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R$(INS_BASE)/lib -R/opt/schily/lib -R$(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.amigaos b/scsilib/DEFAULTS/Defaults.amigaos new file mode 100644 index 0000000..4690815 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.amigaos @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for AmigaOS Systems using CC=gcc +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.beos b/scsilib/DEFAULTS/Defaults.beos new file mode 100644 index 0000000..01deab9 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.beos @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for BeOS Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.bsd-os b/scsilib/DEFAULTS/Defaults.bsd-os new file mode 100644 index 0000000..dae9975 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.bsd-os @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for BSD/OS Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +#LDPATH= -L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.bsd-os3 b/scsilib/DEFAULTS/Defaults.bsd-os3 new file mode 100644 index 0000000..dae9975 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.bsd-os3 @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for BSD/OS Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +#LDPATH= -L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.cygwin32_nt b/scsilib/DEFAULTS/Defaults.cygwin32_nt new file mode 100644 index 0000000..fa11311 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.cygwin32_nt @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Cygnus GCC for WINNT Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +#LDPATH= -L/opt/schily/lib +LDPATH= +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) +RUNPATH= + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.darwin b/scsilib/DEFAULTS/Defaults.darwin new file mode 100644 index 0000000..a72a694 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.darwin @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Mac OS X Darwin Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= #-L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.dgux b/scsilib/DEFAULTS/Defaults.dgux new file mode 100644 index 0000000..e5fe871 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.dgux @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Data General DGUX Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R$(INS_BASE)/lib -R/opt/schily/lib -R$(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.dgux3 b/scsilib/DEFAULTS/Defaults.dgux3 new file mode 100644 index 0000000..e5fe871 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.dgux3 @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Data General DGUX Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R$(INS_BASE)/lib -R/opt/schily/lib -R$(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.dgux4 b/scsilib/DEFAULTS/Defaults.dgux4 new file mode 100644 index 0000000..e5fe871 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.dgux4 @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Data General DGUX Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R$(INS_BASE)/lib -R/opt/schily/lib -R$(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.domainos b/scsilib/DEFAULTS/Defaults.domainos new file mode 100644 index 0000000..1b57936 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.domainos @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Apollo Domain/OS Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= -W0,-info,0 + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.freebsd b/scsilib/DEFAULTS/Defaults.freebsd new file mode 100644 index 0000000..87e306c --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.freebsd @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for FreeBSD Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.gnu b/scsilib/DEFAULTS/Defaults.gnu new file mode 100644 index 0000000..c708931 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.gnu @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for GNU (hurd) Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include /usr/src/linux/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.hp-ux b/scsilib/DEFAULTS/Defaults.hp-ux new file mode 100644 index 0000000..f793370 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.hp-ux @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for HP/UX Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.irix b/scsilib/DEFAULTS/Defaults.irix new file mode 100644 index 0000000..6d78317 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.irix @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Silicon Graphics Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.linux b/scsilib/DEFAULTS/Defaults.linux new file mode 100644 index 0000000..f695442 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.linux @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Linux Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.mac-os10 b/scsilib/DEFAULTS/Defaults.mac-os10 new file mode 100644 index 0000000..b81284c --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.mac-os10 @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Mac OS X Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= #-L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.mingw32_nt b/scsilib/DEFAULTS/Defaults.mingw32_nt new file mode 100644 index 0000000..bc4a2e6 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.mingw32_nt @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Win32/Mingw32 systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +#LDPATH= -L/opt/schily/lib +LDPATH= +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) +RUNPATH= + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.ms-dos b/scsilib/DEFAULTS/Defaults.ms-dos new file mode 100644 index 0000000..5a6901f --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.ms-dos @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for MSDOS/DJGPP v2 Systems using CC=gcc +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.netbsd b/scsilib/DEFAULTS/Defaults.netbsd new file mode 100644 index 0000000..777d0fe --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.netbsd @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for NetBSD Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.newsos6 b/scsilib/DEFAULTS/Defaults.newsos6 new file mode 100644 index 0000000..7399dc0 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.newsos6 @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Sony NEWS-OS 6.x +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.nextstep b/scsilib/DEFAULTS/Defaults.nextstep new file mode 100644 index 0000000..a2cabf2 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.nextstep @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for NeXT Step Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.openbsd b/scsilib/DEFAULTS/Defaults.openbsd new file mode 100644 index 0000000..67a2527 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.openbsd @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for OpenBSD Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.openserver b/scsilib/DEFAULTS/Defaults.openserver new file mode 100644 index 0000000..a45010c --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.openserver @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for SCO OpenServer 5 Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= +RUNPATH= + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /usr/local +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.os2 b/scsilib/DEFAULTS/Defaults.os2 new file mode 100644 index 0000000..adf7900 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.os2 @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for OS/2 Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.osf1 b/scsilib/DEFAULTS/Defaults.osf1 new file mode 100644 index 0000000..8d02994 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.osf1 @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Digital UNIX (OSF1) Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.qnx b/scsilib/DEFAULTS/Defaults.qnx new file mode 100644 index 0000000..de9fe3b --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.qnx @@ -0,0 +1,41 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for QNX Systems +# +########################################################################### +# +# Compiler stuff +# +# When QNX support started in december 1999, there was only the watcom +# C-compler (cc). Now, in novemver 2001 we switch to gcc. +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.rhapsody b/scsilib/DEFAULTS/Defaults.rhapsody new file mode 100644 index 0000000..fb2d7ed --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.rhapsody @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for NeXT Step (Apple Rhapsody) Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= #-L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.sunos4 b/scsilib/DEFAULTS/Defaults.sunos4 new file mode 100644 index 0000000..1f0471c --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.sunos4 @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for SunOS Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will not work on SunOS + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.sunos5 b/scsilib/DEFAULTS/Defaults.sunos5 new file mode 100644 index 0000000..0137d2a --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.sunos5 @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Solaris Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/Defaults.unixware b/scsilib/DEFAULTS/Defaults.unixware new file mode 100644 index 0000000..7515703 --- /dev/null +++ b/scsilib/DEFAULTS/Defaults.unixware @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for SCO UnixWare Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= +RUNPATH= + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /usr/local +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS/MKLINKS b/scsilib/DEFAULTS/MKLINKS new file mode 100644 index 0000000..4f023a5 --- /dev/null +++ b/scsilib/DEFAULTS/MKLINKS @@ -0,0 +1,4 @@ +#!/bin/sh +# +ln -s Defaults.dgux Defaults.dgux3 +ln -s Defaults.dgux Defaults.dgux4 diff --git a/scsilib/DEFAULTS_ENG/Defaults b/scsilib/DEFAULTS_ENG/Defaults new file mode 100644 index 0000000..f36f1e9 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults @@ -0,0 +1,8 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions: include system specific file +# +########################################################################### + +include $(DEFLTSROOT)/$(DEFLTSDIR)/Defaults.$(O_ARCH) diff --git a/scsilib/DEFAULTS_ENG/Defaults.aix b/scsilib/DEFAULTS_ENG/Defaults.aix new file mode 100644 index 0000000..d903561 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.aix @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for IBM AIX Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R$(INS_BASE)/lib -R/opt/schily/lib -R$(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.amigaos b/scsilib/DEFAULTS_ENG/Defaults.amigaos new file mode 100644 index 0000000..766c09e --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.amigaos @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for AmigaOS Systems using CC=gcc +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.beos b/scsilib/DEFAULTS_ENG/Defaults.beos new file mode 100644 index 0000000..753823c --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.beos @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for BeOS Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.bsd-os b/scsilib/DEFAULTS_ENG/Defaults.bsd-os new file mode 100644 index 0000000..15d07d1 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.bsd-os @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for BSD/OS Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +#LDPATH= -L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.bsd-os3 b/scsilib/DEFAULTS_ENG/Defaults.bsd-os3 new file mode 100644 index 0000000..15d07d1 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.bsd-os3 @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for BSD/OS Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +#LDPATH= -L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.cygwin32_nt b/scsilib/DEFAULTS_ENG/Defaults.cygwin32_nt new file mode 100644 index 0000000..74ab2f7 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.cygwin32_nt @@ -0,0 +1,42 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Cygnus GCC for WINNT Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +#LDPATH= -L/opt/schily/lib +LDPATH= +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) +RUNPATH= + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.darwin b/scsilib/DEFAULTS_ENG/Defaults.darwin new file mode 100644 index 0000000..56a796f --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.darwin @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Mac OS X Darwin Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= #-L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.dgux b/scsilib/DEFAULTS_ENG/Defaults.dgux new file mode 100644 index 0000000..46a5585 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.dgux @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Data General DGUX Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R$(INS_BASE)/lib -R/opt/schily/lib -R$(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.dgux3 b/scsilib/DEFAULTS_ENG/Defaults.dgux3 new file mode 100644 index 0000000..46a5585 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.dgux3 @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Data General DGUX Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R$(INS_BASE)/lib -R/opt/schily/lib -R$(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.dgux4 b/scsilib/DEFAULTS_ENG/Defaults.dgux4 new file mode 100644 index 0000000..46a5585 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.dgux4 @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Data General DGUX Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R$(INS_BASE)/lib -R/opt/schily/lib -R$(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.domainos b/scsilib/DEFAULTS_ENG/Defaults.domainos new file mode 100644 index 0000000..d64f5c7 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.domainos @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Apollo Domain/OS Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.freebsd b/scsilib/DEFAULTS_ENG/Defaults.freebsd new file mode 100644 index 0000000..f78a8d7 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.freebsd @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for FreeBSD Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.gnu b/scsilib/DEFAULTS_ENG/Defaults.gnu new file mode 100644 index 0000000..abc7e5e --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.gnu @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for GNU (hurd) Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include /usr/src/linux/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.hp-ux b/scsilib/DEFAULTS_ENG/Defaults.hp-ux new file mode 100644 index 0000000..9830ce3 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.hp-ux @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for HP/UX Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.irix b/scsilib/DEFAULTS_ENG/Defaults.irix new file mode 100644 index 0000000..f9bde13 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.irix @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Silicon Graphics Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.linux b/scsilib/DEFAULTS_ENG/Defaults.linux new file mode 100644 index 0000000..34da6a3 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.linux @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Linux Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include /usr/src/linux/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.mac-os10 b/scsilib/DEFAULTS_ENG/Defaults.mac-os10 new file mode 100644 index 0000000..f69bec0 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.mac-os10 @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Mac OS X Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= #-L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.mingw32_nt b/scsilib/DEFAULTS_ENG/Defaults.mingw32_nt new file mode 100644 index 0000000..5811f85 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.mingw32_nt @@ -0,0 +1,42 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Win32/Mingw32 systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +#LDPATH= -L/opt/schily/lib +LDPATH= +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) +RUNPATH= + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.ms-dos b/scsilib/DEFAULTS_ENG/Defaults.ms-dos new file mode 100644 index 0000000..76d833f --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.ms-dos @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for MSDOS/DJGPP v2 Systems using CC=gcc +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.netbsd b/scsilib/DEFAULTS_ENG/Defaults.netbsd new file mode 100644 index 0000000..498b6ae --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.netbsd @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for NetBSD Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.newsos6 b/scsilib/DEFAULTS_ENG/Defaults.newsos6 new file mode 100644 index 0000000..6588ce0 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.newsos6 @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Sony NEWS-OS 6.x +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.nextstep b/scsilib/DEFAULTS_ENG/Defaults.nextstep new file mode 100644 index 0000000..0953af3 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.nextstep @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for NeXT Step Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.openbsd b/scsilib/DEFAULTS_ENG/Defaults.openbsd new file mode 100644 index 0000000..36fa58a --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.openbsd @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for OpenBSD Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.openserver b/scsilib/DEFAULTS_ENG/Defaults.openserver new file mode 100644 index 0000000..4a746e3 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.openserver @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for SCO OpenServer 5 Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= +RUNPATH= + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /usr/local +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.os2 b/scsilib/DEFAULTS_ENG/Defaults.os2 new file mode 100644 index 0000000..1e8646d --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.os2 @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for OS/2 Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.osf1 b/scsilib/DEFAULTS_ENG/Defaults.osf1 new file mode 100644 index 0000000..4f595ce --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.osf1 @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Digital UNIX (OSF1) Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.qnx b/scsilib/DEFAULTS_ENG/Defaults.qnx new file mode 100644 index 0000000..337c25e --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.qnx @@ -0,0 +1,43 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for QNX Systems +# +########################################################################### +# +# Compiler stuff +# +# When QNX support started in december 1999, there was only the watcom +# C-compler (cc). Now, in novemver 2001 we switch to gcc. +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.rhapsody b/scsilib/DEFAULTS_ENG/Defaults.rhapsody new file mode 100644 index 0000000..7271f71 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.rhapsody @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for NeXT Step (Apple Rhapsody) Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= #-L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.sunos4 b/scsilib/DEFAULTS_ENG/Defaults.sunos4 new file mode 100644 index 0000000..8366f13 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.sunos4 @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for SunOS Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will not work on SunOS + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.sunos5 b/scsilib/DEFAULTS_ENG/Defaults.sunos5 new file mode 100644 index 0000000..cc11e76 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.sunos5 @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for Solaris Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /opt/schily +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/Defaults.unixware b/scsilib/DEFAULTS_ENG/Defaults.unixware new file mode 100644 index 0000000..cc13691 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/Defaults.unixware @@ -0,0 +1,40 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for SCO UnixWare Systems +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= +RUNPATH= + +########################################################################### +# +# Installation config stuff +# +########################################################################### +#INS_BASE= /usr/local +#INS_KBASE= / +INS_BASE= /tmp/schily +INS_KBASE= /tmp/schily/root +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/DEFAULTS_ENG/MKLINKS b/scsilib/DEFAULTS_ENG/MKLINKS new file mode 100644 index 0000000..4f023a5 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/MKLINKS @@ -0,0 +1,4 @@ +#!/bin/sh +# +ln -s Defaults.dgux Defaults.dgux3 +ln -s Defaults.dgux Defaults.dgux4 diff --git a/scsilib/DEFAULTS_ENG/README b/scsilib/DEFAULTS_ENG/README new file mode 100644 index 0000000..f5c8e94 --- /dev/null +++ b/scsilib/DEFAULTS_ENG/README @@ -0,0 +1 @@ +This directory contains engineering defaults diff --git a/scsilib/Gmake b/scsilib/Gmake new file mode 100755 index 0000000..a1e5b8d --- /dev/null +++ b/scsilib/Gmake @@ -0,0 +1,4 @@ +#!/bin/sh +MAKEPROG=gmake +export MAKEPROG +exec gmake "$@" diff --git a/scsilib/Gmake.linux b/scsilib/Gmake.linux new file mode 100755 index 0000000..17fb6dc --- /dev/null +++ b/scsilib/Gmake.linux @@ -0,0 +1,8 @@ +#!/bin/sh + +MAKEPROG=gmake +export MAKEPROG + +# gmake is called 'make' on Linux + +exec make "$@" diff --git a/scsilib/INSTALL b/scsilib/INSTALL new file mode 100644 index 0000000..59ba1b8 --- /dev/null +++ b/scsilib/INSTALL @@ -0,0 +1,335 @@ +Short overview for those who don't read manuals: + + Calling configure manually is outdated because this is a task of the + makefile system. + + There is no 'configure', simply call 'make' on the top level + directory. + + ***** If this does not work for you, read the rest if this file ***** + ***** If you have any problem, also first read the topic specific ***** + ***** README.* files (e.g. README.linux for Linux problems). ***** + + All results in general will be placed into a directory named + OBJ/<arch-name>/ in the current projects leaf directory. + + You **need** either my "smake" program, the SunPRO make + from /usr/bin/make (SunOS 4.x) or /usr/ccs/bin/make (SunOS 5.x) + or GNU make to compile this program. Read README.gmake for + more information on gmake and a list of the most annoying bugs in gmake. + + All other make programs are either not smart enough or have bugs. + + My "smake" source is at: + + ftp://ftp.berlios.de/pub/smake/alpha/ + + It is easy to compile and doesn't need a working make program + on your machine. If you don't have a working "make" program on the + machine where you like to compile "smake" read the file "BOOTSTRAP". + + If you have the choice between all three make programs, the + preference would be + + 1) smake (preferred) + 2) SunPRO make + 3) GNU make (this is the last resort) + + Important notice: "smake" that comes with SGI/IRIX will not work!!! + This is not the Schily "smake" but a dumb make program from SGI. + + ***** If you are on a platform that is not yet known by the ***** + ***** Schily makefilesystem you cannot use GNU make. ***** + ***** In this case, the automake features of smake are required. ***** + + Please read the README's for your operating system too. + + WARNING + Do not use 'mc' to extract the tar file! + All mc versions before 4.0.14 cannot extract symbolic links correctly. + + The versions of WinZip that support tar archives cannot be used too. + The reason is that they don't support symbolic links. + Star and Gnutar do support symbolic links even on win32 systems. + To support symbolic links on win32, you need to link with the + Cygwin32 POSIX library. + + To unpack an archive use: + + gzip -d < some-arch.tar.gz | tar -xpf - + + Replace 'star' by the actual archive name. + + If your Platform does not support hard links or symbolic links, you + first need to compile "star" and then call: + + star -xpz -copy-links < some-arch.tar.gz + + If your platform does not support hard links but supports + symbolic links, you only need to call the command above once. + If your platform does not support symbolic links, you need to call + the command twice because a symbolic link may occur in the archive + before the file it points to. + + + +Here comes the long form: + + +PREFACE: + + Calling configure manually is outdated because this is a task of the + makefile system. + + You don't have to call configure with this make file system. + + Calling 'make' or 'make all' on the top level directory will create + all needed targets. Calling 'make install' will install all needed + files. + + This program uses a new makefilesystem. This makefilesystem uses + techniques and ideas from the 1980s and 1990s, is designed in a + modular way and allows sources to be combined in a modular way. + For mor information on the modular features read README.SSPM. + + The makefilesystem is optimized for a program called 'smake' + Copyright 1985 by J�rg Schilling, but SunPro make (the make program + that comes with SunOS >= 4.0 and Solaris) as well as newer versions + of GNU make will work also. BSDmake could be made working, if it + supports pattern matching rules correctly. + + The makefile system allows simultaneous compilation on a wide + variety of target systems if the source tree is accessible via NFS. + + +Finding Compilation Results: + + To allow this, all binaries and results of a 'compilation' in any form + are placed in sub-directories. This includes automatically generated + include files. Results in general will be placed into + a directory named OBJ/<arch-name>/ in the current projects + leaf directory, libraries will be placed into a directory called + libs/<arch-name>/ that is located in the source tree root directory. + + <arch-name> will be something like 'sparc-sunos5-cc' + + This is the main reason why simultaneous compilation is possible on + all supported platforms if the source is mounted via NFS. + + +How to compile: + + To compile a system or sub-system, simply enter 'smake', 'make' or + 'Gmake'. Compilation may be initialized at any point of the source + tree of a system. If compilation is started in a sub tree, all objects + in that sub tree will be made. + + +How to install results: + + To install the product of a compilation in your system, call: + + smake install + + at top level. The binaries will usually be installed in + /opt/schily/bin. The directory /opt/<vendor-name>/ has been agreed + on by all major UNIX vendors in 1989. Unfortunately, still not all + vendors follow this agreement. + + If you want to change the default installation directory, edit the + appropriate (system dependent) files in the DEFAULTS directory + (e.g. DEFAULTS/Defaults.sunos5). + + ***** If "smake install" doesn't do anything, you are on a broken ***** + ***** File System. Remove the file INSTALL in this case (the FS ***** + ***** does not handle upper/lower case characters correctly). ***** + ***** This is true for all DOS based filesystems and for Apple's ***** + ***** HFS+ filesystem. ***** + + +Using a different installation directory: + + If your system does not yet use the standard installation path /opt + or if you don't like this installation directory, you can easily + change the installation directory. You may edit the DEFAULTS file + for your system and modify the macro INS_BASE. + + You may use a different installation directory without editing the + DEFAULTS files. If you like to install everything in /usr/local, call: + + + If your make program supports to propagate make macros to sub make programs + which is the case for recent smake releases as well as for a recent gnumake: + + smake INS_BASE=/usr/local install + or + gmake INS_BASE=/usr/local install + + If you make program doesn't propagate make macros (e.g. SunPRO make) call: + + env INS_BASE=/usr/local make -e install + + +Using a different C-compiler: + + If the configured default compiler is not present on the current machine, + the makefilesystem will try an automatic fallback to GCC. For this reason + in most cases you will not need to manually select a compiler. + + The default C-compiler can be modified in the files in the + DEFAULT directory. If you want to have a different compiler + for one compilation, call: + + make CCOM=gcc + or + make CCOM=cc + + This works even when your make program doesn't propagate make macros. + + +Creating 64 bit executables on Solaris: + + If you like to create 64 bit executables you always need first to + remove any old make results. This includes all autoconf results. In + order to make sure that the source tree is in a "clean" state, call: + + ./.clean + + at the top level directory. Then configure and compile everything by + calling: + + smake COPTX=-xarch=v9 LDOPTX=-xarch=v9 + + To do this with GCC, you need at least GCC-3.1. It is the first 64 bit + aware GCC. With GCC, call on Solaris: + + smake CCOM=gcc COPTX=-m64 LDOPTX=-m64 + + It is not clear if GCC already supports other platforms in 64 bit mode. + As all GCC versions before 3.1 did emit hundreds of compilation + warnings related to 64 bit bugs when compiling itself, there is little + hope that other platforms are already supported in 64 bit mode. + + +Getting help from make: + + For a list of targets call: + + make .help + + +Getting more information on the make file system: + + The man page makefiles.4 located in man/man4/makefiles.4 contains + the documentation on general use and for leaf makefiles. + + The man page makerules.4 located in man/man4/makerules.4 contains + the documentation for system programmers who want to modify + the make rules of the makefile system. + + For further information read + + ftp://ftp.berlios.de/pub/makefiles/PortableSoftware.ps.gz + + +Hints for compilation: + + The makefile system is optimized for 'smake'. Smake will give the + fastest processing and best debugging output. + + SunPro make will work as is. GNU make need some special preparation. + + Read README.gmake for more information on gmake. + + To use GNU make create a file called 'Gmake' in your search path + that contains: + + #!/bin/sh + MAKEPROG=gmake + export MAKEPROG + exec gmake "$@" + + and call 'Gmake' instead of gmake. On Linux there is no gmake, 'make' + on Linux is really a gmake. + + 'Gmake' and 'Gmake.linux' are part of this distribution. + + Some versions of gmake are very buggy. There are e.g. versions of gmake + on some architectures that will not correctly recognize the default + target. In this case call 'make all' or ../Gmake all'. + + Note that pseudo error messages from gmake similar to: + + gmake[1]: Entering directory `cdrtools-1.10/conf' + ../RULES/rules.cnf:58: ../incs/sparc-sunos5-cc/Inull: No such file or directory + ../RULES/rules.cnf:59: ../incs/sparc-sunos5-cc/rules.cnf: No such file or directory + + Are a result of a bug un GNU make. The make file system itself is + correct (as you could prove by using smake). + If your gmake version still has this bug, send a bug report to: + + "Paul D. Smith" <psmith@gnu.org> + + He is the current GNU make maintainer. + + If you like to use 'smake', please always compile it from source. + The packages are located on: + + ftp://ftp.berlios.de/pub/smake/alpha/ + + Smake has a -D flag to see the actual makefile source used + and a -d flag that gives easy to read debugging info. Use smake -xM + to get a makefile dependency list. Try smake -help + + +Compiling the project using engineering defaults: + + The defaults found in the directory DEFAULTS are configured to + give minimum warnings. This is made because many people will + be irritated by warning messages and because the GNU c-compiler + will give warnings for perfectly correct and portable c-code. + + If you want to port code to new platforms or do engineering + on the code, you should use the alternate set of defaults found + in the directory DEFAULTS_ENG. + You may do this permanently by renaming the directories or + for one compilation by calling: + + make DEFAULTSDIR=DEFAULTS_ENG + + +Compiling the project to allow debugging with dbx/gdb: + + If you like to compile with debugging information for dbx or gdb, + call: + + make clean + make COPTX=-g LDOPTX=-g + + + If you want to see an example, please have a look at the "star" + source. It may be found on: + + ftp://ftp.berlios.de/pub/star + + Have a look at the manual page, it is included in the distribution. + Install the manual page with + + make install first and include /opt/schily/man in your MANPATH + + Note that some systems (e.g. Solaris 2.x) require you either to call + /usr/lib/makewhatis /opt/schily/man or to call + + man -F <man-page-name> + +Author: + +Joerg Schilling +Seestr. 110 +D-13353 Berlin +Germany + +Email: joerg@schily.isdn.cs.tu-berlin.de, js@cs.tu-berlin.de + schilling@fokus.fhg.de + +Please mail bugs and suggestions to me. diff --git a/scsilib/Makefile b/scsilib/Makefile new file mode 100644 index 0000000..dea8e2e --- /dev/null +++ b/scsilib/Makefile @@ -0,0 +1,25 @@ +#ident %W% %E% %Q% +########################################################################### +SRCROOT= . +DIRNAME= SRCROOT +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +include $(SRCROOT)/TARGETS/Targetdirs + +########################################################################### +# Due to a bug in SunPRO make we need special rules for the root makefile +# +include $(SRCROOT)/$(RULESDIR)/rules.rdi +########################################################################### + +install: + @ + +check: + +uninstall: + @ + +distclean: clean diff --git a/scsilib/PORTING b/scsilib/PORTING new file mode 100644 index 0000000..4702c41 --- /dev/null +++ b/scsilib/PORTING @@ -0,0 +1,142 @@ +Porting FAQ for SING (Schily Is Not Gnu) utilities. + +- The base for porting is the makefile system. + Always look into: + ftp://ftp.berlios.de/pub/makefiles + for a version that might be newer than the one used + inside the program that should be ported. + + If you want to know more about the makefile system, + read the man pages makefiles4 and makerules.4, + they are located in man/man4/* + + to convert a manpage troff->postscript use: + gtroff -man file.tr | grops > file.ps + + to convert a manpage troff->Terminal use: + nroff -man file.tr | more -s + + +- To be able to use the makefile system, you need a + make program that meets the minimum requirements + for a make program (see makerules(4) man page) + Currently, the following make programs meet this + minimum requirements: Smake (my program), SunPro Make and Gmake + + A good idea is to first compile 'smake' if you don't + have it already. + + The smake source can be found on: + + ftp://ftp.berlios.de/pub/smake/ + or + ftp://ftp.berlios.de/pub/smake/alpha + + for the most recent version. + +- To be able to use the makefile system with gmake, + the operating system must have a command named 'uname'. + If not, you have to provide it as a shell script. + + +1) If you are using smake release 1.1 or newer and + a recent makefile system, the next step should be done + automagically (smake-1.1 or newer implement a -version + option to retrieve the version number). + + If you are using gmake, you need to do this by hand. + + First step for adding a new architecture is creating + the appropriate rule files in the RULES directory: + + RULES/os-{newos}.id For OS identification + RULES/os-{newos}.def For OS definition (man style) + RULES/{newarch}-{newos}-cc.rul + RULES/{newarch}-{newos}-gcc.rul + + And create a file: + + DEFAULTS/Defaults.{newos} + + Have a look in similar files for a template. + + If the files hae been generated automagically by smake, + please check the content and mail me a working set for your OS. + +2) All C-porting control is located in include/mconfig.h + and in the file incs/{newarch}-{newos}-{cc!gcc}/xconfig.h + The later file is created automatically using GNU + configure. The File conf/xconfig.h.in contains all + templates and comments for the various things that are tested. + + In any case, it is recommended to carefully watch the + outout from the 'configure' run (which is automatically + started from within 'make'). You may also wish to check all + files that are created in the directory + incs/{newarch}-{newos}-{cc!gcc}/ + +3) Everything should compile now. + If not, try to hack the files and mail me your problems. + + You should have a closer look at the sources as it may be that + the first attempt to port a utility will not support + all possible features of the new OS. + If your OS supportes these features in a non standard way, + you need to hack conf/configure.in and the source and add + support for the non standard behaviour of your OS. + + This is definitely recommended if you want to port programs + like 'cdrecord' 'star' and similar which need fork(2) and + mmap(2) or setprioriry(2) or if you check programs on + non POSIX operating systems like W95/W98/WNT OS/2 and + similar. + + +Notice for porting tools, that use the SCSI library libscg: + +I) Cdrecord should compile at this moment if you are using + a new architecture. The SCSI transport however will not work. + Check this! + + All files that contain low level code for SCSI transport are + located in the directory libscg/ + +II) Implementing a SCSI Transport Layer for your architecture: + + You need to add a new block into scsihack.c that will add + support for your OS. Copy the block: + + #ifdef __NEW_ARCHITECTURE + #define SCSI_IMPL /* We have a SCSI implementation for XXX */ + /* + * Add new hacks here + */ + #include "scsi-new-arch.c" + #endif + + and rename __NEW_ARCHITECTURE to reflect your new architecture. + + Add a new file that will be called scsi-{newarch}.c + Have a look into scsi-linux-sg.c for a template how to do this. + + More hints for writing the needed SCSI low level transport functions + is in: + + ftp://ftp.berlios.de/pub/cdrecord/README.scsi-IF + +4) Test your ported program. + +5) You may check other programs from me to see if everything compiles + and works. + +6) Send me your changes + +Joerg Schilling + +schilling@fokus.fhg.de +joerg@schily.isdn.cs.tu-berlin.de +js@cs.tu-berlin.de + + + + diff --git a/scsilib/README b/scsilib/README new file mode 100644 index 0000000..b419ade --- /dev/null +++ b/scsilib/README @@ -0,0 +1,460 @@ +# @(#)README 1.25 02/12/25 Copyright 1996-2002 J. Schilling + +This is Version 2.0 of cdrecord + +Cdrecord allows you to create CD's on a CD-Recorder. +Cdrecord runs on: + +SunOS 4.1.3 or later: m68k sparc +Solaris 2.3 or later: sparc x86 ppc. + +Linux: alpha x86 IA-64 m68k mips mipsel parisc parisc64 ppc s390 sparc sparc64 strongarm + +FreeBSD: alpha arm IA-64 powerpc sparc sparc64 x86 x86-64 +NetBSD: alpha amiga x86 m68k sparc +OpenBSD: x86 + +AIX: rs6000 +AmigaOS m68k +Apollo Domain/OS m68k ??? +Apple Rhapsody: ppc, x86 +Apple MacOS X: ppc +Apple Darwin: ppc +BeOS: m68k x86 +BSD/OS (BSDi): sparc x86 +Caldera OpenUnix: x86 +HP-UX: hppa +GNU HURD: x86 +NeXt Step: mc68xxx x86 and hppa +OS/2: x86 +OSF1: alpha +SCO Openserver 5.x: x86 +SCO Unixware 2.x: x86 +SCO Unixware 7.x: x86 +SGI IRIX: mips +Win95: x86 +Win98: x86 +WinME: x86 +WinNT: x86 +WinNT-5 (aka Win2000): x86 +WinNT-5.1 (aka WinXP): x86 +VMS: *VAX alpha +QNX: x86 (coming soon) + + +To learn how to compile and install cdrecord, read README.compile + +To compile on currently unknown platforms you definitely need 'smake' +from ftp.berlios.de/pub/smake or ftp.berlios.de/pub/smake +GNUmake is too dump to do this job as it does not include automake features +like 'smake' does. + +For multi session please read README.multi + +In general, it is a good idea to read all README's and check whether +they may apply for your needs/problems. + +Cdrecord runs without problems on a loaded Solaris system. +On Solaris, cdrecord uses the SVr4 priocntl() call to establish +SVr4 real-time scheduling which grants to run cdrecord in a even higher +priority than all kernel processes. On system that provide POSIX real-time +scheduling the result may be slightly worse as not all POSIX RT implementations +grant decent real time behaviour. + +The cdrtools distribution contains a SCSI user level transport library +called libscg. The SCSI library is suitable to talk to any SCSI device without +having a special device specific driver for it. +Cdrecord may be easily ported to any system that has a generic SCSI device +driver similar to the scg driver. + +On SunOS/Solaris: +You *need* the SCSI general driver 'scg' in order to run cdrecord. + +SunOS 4.1.3 only: + The 'scg' driver is Copyright 1986-1995 J�rg Schilling, + it is supplied binary in a loadable format. + There is no future support, there is no non loadable support. + +Solaris only: + The 'scg' driver is Copyright 1986-1995 J�rg Schilling, + it is supplied binary in pkgadd(1m) format and is tested + on Solaris 2.3, Solaris 2.4 & Solaris 2.5 (sparc). + +Solaris only: + It is _nice to have_ the 'fbk' driver to mount files that contain + images of file systems. Fbk means File simulates Block Device. + + The 'fbk' driver is Copyright 1988-1995 J�rg Schilling, + it is supplied binary in pkgadd(1m) format and is tested + on Solaris 2.3, Solaris 2.4 & Solaris 2.5 (sparc). + +On other OS, libscg uses the SCSI drivers that are present on the system. + +Cdrecord-1.3 or later adopts the right BUF_SIZE for each architecture. +This is to reduce some performance problems on Solaris x86. +It may be that the reason for this performance problems is that +the PC-architecture has no IO-MMU and therefore is not able to do DVMA. +If this points out to be the reason, I have to +change the scg driver & cdrecord, but this would +be needed on Linux anyway. + +Cdrecord is currently maintained with the following drives: + + Plextor PX-W4824A + Plextor PX-W4012A + Plextor PX-W2410A + Plextor PX-W1210S + Plextor PX-W1210A + Plextor PX-W124 + Plextor PX-W8220 + Plextor PX-W4220 + Plextor PX-R820 + Plextor PX-R412C + Yamaha F-1 + Yamaha CRW-2200S + Yamaha CRW-2200A + Yamaha CRW-2100S + Yamaha CRW-4416 + Yamaha CDR-400 + Ricoh MP-7040A + Ricoh MP-7040S + Ricoh MP-7060S (available only to Thomas Niederreiter and Heiko Ei�feld) + Ricoh MP-7063A + Ricoh MP-7080A + Ricoh MP-7083A + Ricoh MP-9060A + Ricoh MP-7163A + Ricoh DVD+RW MP5125 (DVD+ writing not yet supported) + HP DVD-200i (DVD+ writing not yet supported) + Philips DVD-RW 1208 (DVD+ writing not yet supported) + TEAC CD-R55S + TEAC CD-R58S + TEAC CD-W54E + TEAC CD-W28E + Sanyo CDR-Bp2 + Sanyo CDR-Bp3A + Sony CDU948S + Sony CRX-145E + Sony CRX-200E (DDCD writing not supported) + COMPRO/Matsushita/Panasonic CW-7502 + COMPRO/Matsushita/Panasonic CW-7586 + Philips CDD-2000 + Philips PCRW-804 + Goldstar LG 8080 + AOPEN CRW-4048 + Cyberdrive CW-038D + Cyberdrive CW-078D + Pioneer DVD-R A03 + +It should run also on: + + All SCSI-3/mmc compliant drives + All ATAPI/mmc compliant drives + + NOTE: + + It seems that all drives that have been initially released in 1999 + or later are MMC compliant. If a recent drive does not work with + cdrecord, you most likely found a firmware bug in this drive. + Contact your drive vendor in this case. + +Drives that have been reported to work or should work because +Andy MCFadden (see also http://www.fadden.com/cdrfaq/faq05.html) listed +them to be identical to working drives. Note that this list may be outdated + + ACER CR-1420C + ACER CDRW 6206A + AOPEN CRW9420 (Re-writable) + BTC BCE 621E + COMPRO CW-7502 + COMPRO/Matsushita/Panasonic CW-7586 + Dysan CR-622 ???? See Wearnes 622 + Dysan CR-1622 + DynaTec CDM-240J (see Pinnacle RCD-4x4) + DynaTec CDM-240 (use cdrecord driver=yamaha_cdr100 and report inquiry) + DynaTec CDM-400 (use cdrecord driver=yamaha_cdr100 and report inquiry) + Grundig CDR-100 + Hewlett Packard 4020i + Hewlett Packard 6020i + HP C4324/C4325 (HP SureStore 4020i/6020i) + HP 7100 + HP 7110 + HP 7200 + HP 8100 + HP 8210 + HP CD-Writer+ M820 + Hi-Val CD-R (see Pinnacle RCD-4x4) + IMATION CD-RW IMW040420 + JVC XR-W2001 (uses TEAC code - see below - audio not working) + JVC XR-W2010 (uses TEAC code - see below - audio not working) + JVC XR-W2020 (uses TEAC code - see below - audio not working) + JVC XR-W2080 (first MMC drive from JVC) + Kodak PCD-200 or Kodak PCD-200 Plus + Kodak PCD-225 + Kodak PCD-240 + Kodak PCD-600 + Matsushita CW-7502 + Matsushita CW-7503 + Matsushita CW-7582 + Matsushita CW-7586 + Memorex CR-622 ???? See Wearnes 622 + Memorex CR-1622 + Memorex CRW-1622 + Microboards PlayWrite 2000 (use cdrecord driver=sony_cdu924 and report inquiry) + Microboards PlayWrite 4000 (use cdrecord driver=yamaha_cdr100 and report inquiry) + Microboards PlayWrite 4001RW + MicroNet MasterCD Plus 4x4 (use cdrecord driver=yamaha_cdr100 and report inquiry) + MicroNet MasterCD Plus 4x6 + Mitsubishi MCA-CDRW 226 + Mitsumi CR-2401-TS + Mitsumi CR-2600-TE + Mitsumi CR-2801-TE + Mitsumi CR-4801-TE + Mitsumi CR-4802-TE ??? + Nomai 680.rw + Olympus CDS615E + Olympus CDS620E (use cdrecord driver=sony_cdu924 and report inquiry) + Olympus CD-R2x6 (use cdrecord driver=sony_cdu924 and report inquiry) + Optima Dis Kovery 650 CD-R + OTI CDRW 965 + OTI-975 Socrates 1.0 (CDRW) + Panasonic CW-7502 + Panasonic CW-7503 + Panasonic CW-7582 + Panasonic CW-7586 + Philips CDD 521 (CDD521/02 Revision: 2.06 has bad firmware - seems not to work) + Philips CDD 521 (upgraded units only: ID: CDD521/10 Revision: 2.07) + Philips CDD 522 + Philips CDD 2000 + Philips CDD 2600 + Philips CDD 3600 + Philips CDD 3610 + Philips CDRW400 + Philips Omniwriter 26 + Philips Omniwriter 26A + Philips CDD4201 CD-RW + Philips PCRW-804 + Pinnacle Micro RCD-1000 (see TEAC/JVC): Need to upgrade firmware to 2.35 + Pinnacle Micro RCD-5020 (see TEAC/JVC - audio not working) + Pinnacle Micro RCD-5040 (see TEAC/JVC - audio not working) + Pinnacle Micro RCD-4x4 + Pioneer DW-S114X + Plasmon CDR 4220 + Plasmon RF-4100 + Plasmon RF-4102 + Plasmon CDR 4400 (use cdrecord driver=yamaha_cdr100 and report inquiry) + Plasmon CDR 480 + Plextor PX-R24CS (use cdrecord driver=ricoh_ro1420c and report inquiry) + Plextor PX-R412C + Plextor PX-R820 + Plextor PX-W4220 + Plextor PX-W8220 + Plextor PX-W124 + Plextor PX-W1210S + Plextor PX-W1210A + Procom PCDR 4 (use cdrecord driver=yamaha_cdr100 and report inquiry) + Ricoh RO-1420C + Ricoh MP-6200 + Ricoh MP-6200I + Ricoh MP-6201 + Ricoh MP-7040A + Ricoh MP-7040S + Ricoh MP-7060S + Ricoh MP-7063A + Ricoh MP-7080A + Ricoh MP-7083A + Ricoh MP-9060A + Sanyo CDR-Bp2 + Sanyo CDR-Bp3 + Smart & Friendly CD-R1002 (use cdrecord driver=sony_cdu924 and report inquiry) + Smart & Friendly CD-R1004 (use cdrecord driver=yamaha_cdr100 and report inquiry) + Smart & Friendly CD-R2004 (use cdrecord driver=sony_cdu924 and report inquiry) + Smart & Friendly CD-R2006 PLUS + Smart & Friendly CD-R2006 PRO + Smart & Friendly CD-R4000 (use cdrecord driver=yamaha_cdr100 and report inquiry) + Smart & Friendly CD-R4006 + Smart & Friendly CD-R4012 + Smart & Friendly CD-RW226 + Smart & Friendly CD-R8020 + Sony CDU920S + Sony CDU924S + Sony CDU926S + Sony CDU928S + Sony CDU940S + Sony CDU948S + Sony CRX-100 + Sony CRX-140 + Sony CRX-145 + Taiyo Yuden CD-WO EW-50 + TEAC CD-R50S + TEAC CD-R55S + TEAC CD-R56S + TEAC CD-R58S + TEAC CD-W54E + That's Write CDR-N820S + Traxdata CDRW-2260EL-PRO + Traxdata CDR-4120 + Traxdata CDRW-4260 + Turtle Beach 2040R (use cdrecord driver=ricoh_ro1420c and report inquiry) + WAITEK WT2036 + Wearnes CD-R622 + Wearnes CD-R632P + Yamaha CDR-100 + Yamaha CDR-102 + Yamaha CDR-200 + Yamaha CDR-400(Firmware revision 1.0d and up otherwise upgrade) + Yamaha CDR-401 + Yamaha CRW-4001 + Yamaha CRW-2260 + Yamaha CRW-2261 + Yamaha CRW-4260 + Yamaha CRW-4261 + Yamaha CRW-4416 + Yamaha CRW-6416 + Yamaha CRW-8424 + Yamaha CRW-2100 + +Multi-session has not been tested with the Plasmon RF-4100 + +All companies that support me with SCSI command reference manuals and drives +will get (continued) support in the following releases. + +The following drives will never be supported by cdrecord because they are too old: + + JVC XR-W1001 + Pinnacle Micro RCD-202 + Ricoh RS-9200CD + +The following drives are currently not supported because I don't get specs: +(some of them may partially work: see above) + + Creative Labs CDR 4210 + JVC XR-W2001 + JVC XR-W2010 + JVC XR-W2020 + Pinnacle Micro RCD-1000 + Pinnacle Micro RCD-5020 + Pinnacle Micro RCD-5040 + Plasmon CDR-4240 + Sony CDW-900E + +The following drives may get support soon (If I get time to do so): + + Panasonic CW-7501 + Ricoh RS-1060C + +If you understang German, it makes sense to have a look at http://www.dchlb.de/ +and http://www.brennmeister.com/ for additional information. + +To install get: + +Solaris only: + SCHILYscg.sparc.tar.Z The scg driver in pkgadd format (sparc). + SCHILYfbk.sparc.tar.Z The fbk driver in pkgadd format (sparc). + SCHILYscg.i386.tar.Z The scg driver in pkgadd format (x86). + SCHILYfbk.i386.tar.Z The fbk driver in pkgadd format (x86). + +Note that the fbk driver packet is for Solaris 2.4 and not system independent. + +All Systems: + cdrtools-2.0.tar.gz The cdrtools for source distribution. + +NOTE: All these tar archives are 100% ansi compatible. Solaris 2.x tar and GNU + tar may get some minor trouble. + +WARNING: Do not use 'mc' to extract the tar file! + All mc versions before 4.0.14 cannot extract symbolic links correctly. + +To unpack the archive use: + + gzip -d < cdrtools-2.0.tar.gz | tar -xpf - + + Replace 'cdrtools-2.0' by the actual archive name. + + If your Platform does not support hard links or symbolic links, you + first need to compile "star" and then call: + + star -xpz -copy-links < cdrtools-2.0.tar.gz + + If your platform does not support hard links but supports + symbolic links, you only need to call the command above once. + If your platform does not support symbolic links, you need to call + the command twice because a symbolic link may occur in the archive + before the file it points to. + + + + + +The files are located on: + +ftp://ftp.berlios.de/pub/cdrecord/ ... +ftp://ftp.berlios.de/pub/schily/kernel/scg/ ... +ftp://ftp.berlios.de/pub/schily/kernel/fbk/ ... + +Only use the mkisofs that is contained in this release. +All other mkisofs versions are too buggy. + + +Installation Process: + +Solaris only: + 1) scg driver + untar SCHILYscg.tar: + su + Password: xxxxx + cd /tmp + zcat SCHILYscg.tar | tar -xvf - + pkgadd -d . + reboot -- -r + + 2) fbk driver + similar to scg driver (see above) + + 3) Switch the CD-Writer to an unused target id (2 should do it) + + +NOTE: + Be very careful. pkgadd does not check for the right target + architecture. Do not install drivers for intel on sparc + and vice versa. You will get a corrupt system. + + You need to be root because you need access to /dev/scg? and to be + able to put cdrecord into the real-time scheduling class. + +All Systems: + +The SCSI transport library has been taken from the sformat program. +Sformat is the first SCSI disk formatting/analyzing/repairing that runs on +SunOS/Solaris. The first release of sformat has been made for SunOS 3.0 +(two years before Sun introduced their format utility). Sformat source +including 10 years of competence in SCSI disk handling is available +on: + ftp://ftp.berlios.de/pub/sformat + +I am interested to hear if someone is interested in a kernel based +filesystem for Solaris that uses packet writing on the CD-Recorder. +The filesystem will create a single session CD that may be finally converted +to a hybrid filesystem that allows to be read as +ISO-9660 with Rock Ridge extensions too. +Please mail suggestions to: wofs@schily.isdn.cs.tu-berlin.de + +If you want to use the CD-recorder as CD-ROM device, have a look at + +Solaris only: +ftp://ftp.berlios.de/pub/schily/kernel/sd + +Current information on cdrecord may be found on: + + http://www.fokus.fhg.de/research/cc/glone/employees/joerg.schilling/private/cdrecord.html + + + Joerg Schilling + + (really J�rg Schilling if you have ISO-8859-1) + +If you have questions mail to: + + HOME: joerg@schily.isdn.cs.tu-berlin.de + UNIVERSITY: js@cs.tu-berlin.de + WORK: schilling@fokus.fhg.de diff --git a/scsilib/README.cdrdao b/scsilib/README.cdrdao new file mode 100644 index 0000000..f6113d4 --- /dev/null +++ b/scsilib/README.cdrdao @@ -0,0 +1,7 @@ +This is a snapshot of Joerg Schilling's SCSI library from cdrtools-2.01a31. + +The additional directory 'export' is used to hold some links to include +files and built libraries for easy access by the remaining cdrdao package. + +It is also possible to use an installed SCSI library. See "INSTALL" in the +main directory for more information. diff --git a/scsilib/RULES/9000-710-hp-ux-cc.rul b/scsilib/RULES/9000-710-hp-ux-cc.rul new file mode 100644 index 0000000..ebd50be --- /dev/null +++ b/scsilib/RULES/9000-710-hp-ux-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)9000-725-hp-ux-cc.rul 1.9 03/01/30 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +# +# -Ae -> ANSI C (non-bundled C only - bundled C ignores -Ae) +# +DAportable -> Create Parisc-1.1 code +# +COPTS= -Ae +DAportable +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(SRCROOT)/conf/mkdep-hpux.sh +MKDEP_OUT= diff --git a/scsilib/RULES/9000-710-hp-ux-gcc.rul b/scsilib/RULES/9000-710-hp-ux-gcc.rul new file mode 100644 index 0000000..c6a7b46 --- /dev/null +++ b/scsilib/RULES/9000-710-hp-ux-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)9000-725-hp-ux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/9000-712-hp-ux-cc.rul b/scsilib/RULES/9000-712-hp-ux-cc.rul new file mode 100644 index 0000000..ebd50be --- /dev/null +++ b/scsilib/RULES/9000-712-hp-ux-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)9000-725-hp-ux-cc.rul 1.9 03/01/30 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +# +# -Ae -> ANSI C (non-bundled C only - bundled C ignores -Ae) +# +DAportable -> Create Parisc-1.1 code +# +COPTS= -Ae +DAportable +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(SRCROOT)/conf/mkdep-hpux.sh +MKDEP_OUT= diff --git a/scsilib/RULES/9000-712-hp-ux-gcc.rul b/scsilib/RULES/9000-712-hp-ux-gcc.rul new file mode 100644 index 0000000..c6a7b46 --- /dev/null +++ b/scsilib/RULES/9000-712-hp-ux-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)9000-725-hp-ux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/9000-715-hp-ux-cc.rul b/scsilib/RULES/9000-715-hp-ux-cc.rul new file mode 100644 index 0000000..ebd50be --- /dev/null +++ b/scsilib/RULES/9000-715-hp-ux-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)9000-725-hp-ux-cc.rul 1.9 03/01/30 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +# +# -Ae -> ANSI C (non-bundled C only - bundled C ignores -Ae) +# +DAportable -> Create Parisc-1.1 code +# +COPTS= -Ae +DAportable +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(SRCROOT)/conf/mkdep-hpux.sh +MKDEP_OUT= diff --git a/scsilib/RULES/9000-715-hp-ux-gcc.rul b/scsilib/RULES/9000-715-hp-ux-gcc.rul new file mode 100644 index 0000000..c6a7b46 --- /dev/null +++ b/scsilib/RULES/9000-715-hp-ux-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)9000-725-hp-ux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/9000-725-hp-ux-cc.rul b/scsilib/RULES/9000-725-hp-ux-cc.rul new file mode 100644 index 0000000..ebd50be --- /dev/null +++ b/scsilib/RULES/9000-725-hp-ux-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)9000-725-hp-ux-cc.rul 1.9 03/01/30 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +# +# -Ae -> ANSI C (non-bundled C only - bundled C ignores -Ae) +# +DAportable -> Create Parisc-1.1 code +# +COPTS= -Ae +DAportable +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(SRCROOT)/conf/mkdep-hpux.sh +MKDEP_OUT= diff --git a/scsilib/RULES/9000-725-hp-ux-gcc.rul b/scsilib/RULES/9000-725-hp-ux-gcc.rul new file mode 100644 index 0000000..c6a7b46 --- /dev/null +++ b/scsilib/RULES/9000-725-hp-ux-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)9000-725-hp-ux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/9000-735-hp-ux-cc.rul b/scsilib/RULES/9000-735-hp-ux-cc.rul new file mode 100644 index 0000000..ebd50be --- /dev/null +++ b/scsilib/RULES/9000-735-hp-ux-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)9000-725-hp-ux-cc.rul 1.9 03/01/30 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +# +# -Ae -> ANSI C (non-bundled C only - bundled C ignores -Ae) +# +DAportable -> Create Parisc-1.1 code +# +COPTS= -Ae +DAportable +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(SRCROOT)/conf/mkdep-hpux.sh +MKDEP_OUT= diff --git a/scsilib/RULES/9000-735-hp-ux-gcc.rul b/scsilib/RULES/9000-735-hp-ux-gcc.rul new file mode 100644 index 0000000..c6a7b46 --- /dev/null +++ b/scsilib/RULES/9000-735-hp-ux-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)9000-725-hp-ux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/9000-743-hp-ux-cc.rul b/scsilib/RULES/9000-743-hp-ux-cc.rul new file mode 100644 index 0000000..ebd50be --- /dev/null +++ b/scsilib/RULES/9000-743-hp-ux-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)9000-725-hp-ux-cc.rul 1.9 03/01/30 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +# +# -Ae -> ANSI C (non-bundled C only - bundled C ignores -Ae) +# +DAportable -> Create Parisc-1.1 code +# +COPTS= -Ae +DAportable +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(SRCROOT)/conf/mkdep-hpux.sh +MKDEP_OUT= diff --git a/scsilib/RULES/9000-743-hp-ux-gcc.rul b/scsilib/RULES/9000-743-hp-ux-gcc.rul new file mode 100644 index 0000000..c6a7b46 --- /dev/null +++ b/scsilib/RULES/9000-743-hp-ux-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)9000-725-hp-ux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/9000-755-hp-ux-cc.rul b/scsilib/RULES/9000-755-hp-ux-cc.rul new file mode 100644 index 0000000..ebd50be --- /dev/null +++ b/scsilib/RULES/9000-755-hp-ux-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)9000-725-hp-ux-cc.rul 1.9 03/01/30 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +# +# -Ae -> ANSI C (non-bundled C only - bundled C ignores -Ae) +# +DAportable -> Create Parisc-1.1 code +# +COPTS= -Ae +DAportable +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(SRCROOT)/conf/mkdep-hpux.sh +MKDEP_OUT= diff --git a/scsilib/RULES/9000-755-hp-ux-gcc.rul b/scsilib/RULES/9000-755-hp-ux-gcc.rul new file mode 100644 index 0000000..c6a7b46 --- /dev/null +++ b/scsilib/RULES/9000-755-hp-ux-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)9000-725-hp-ux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/9000-777-hp-ux-cc.rul b/scsilib/RULES/9000-777-hp-ux-cc.rul new file mode 100644 index 0000000..ebd50be --- /dev/null +++ b/scsilib/RULES/9000-777-hp-ux-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)9000-725-hp-ux-cc.rul 1.9 03/01/30 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +# +# -Ae -> ANSI C (non-bundled C only - bundled C ignores -Ae) +# +DAportable -> Create Parisc-1.1 code +# +COPTS= -Ae +DAportable +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(SRCROOT)/conf/mkdep-hpux.sh +MKDEP_OUT= diff --git a/scsilib/RULES/9000-777-hp-ux-gcc.rul b/scsilib/RULES/9000-777-hp-ux-gcc.rul new file mode 100644 index 0000000..c6a7b46 --- /dev/null +++ b/scsilib/RULES/9000-777-hp-ux-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)9000-725-hp-ux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/9000-778-hp-ux-cc.rul b/scsilib/RULES/9000-778-hp-ux-cc.rul new file mode 100644 index 0000000..ebd50be --- /dev/null +++ b/scsilib/RULES/9000-778-hp-ux-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)9000-725-hp-ux-cc.rul 1.9 03/01/30 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +# +# -Ae -> ANSI C (non-bundled C only - bundled C ignores -Ae) +# +DAportable -> Create Parisc-1.1 code +# +COPTS= -Ae +DAportable +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(SRCROOT)/conf/mkdep-hpux.sh +MKDEP_OUT= diff --git a/scsilib/RULES/9000-778-hp-ux-gcc.rul b/scsilib/RULES/9000-778-hp-ux-gcc.rul new file mode 100644 index 0000000..c6a7b46 --- /dev/null +++ b/scsilib/RULES/9000-778-hp-ux-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)9000-725-hp-ux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/9000-780-hp-ux-cc.rul b/scsilib/RULES/9000-780-hp-ux-cc.rul new file mode 100644 index 0000000..ebd50be --- /dev/null +++ b/scsilib/RULES/9000-780-hp-ux-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)9000-725-hp-ux-cc.rul 1.9 03/01/30 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +# +# -Ae -> ANSI C (non-bundled C only - bundled C ignores -Ae) +# +DAportable -> Create Parisc-1.1 code +# +COPTS= -Ae +DAportable +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(SRCROOT)/conf/mkdep-hpux.sh +MKDEP_OUT= diff --git a/scsilib/RULES/9000-780-hp-ux-gcc.rul b/scsilib/RULES/9000-780-hp-ux-gcc.rul new file mode 100644 index 0000000..c6a7b46 --- /dev/null +++ b/scsilib/RULES/9000-780-hp-ux-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)9000-725-hp-ux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/9000-782-hp-ux-cc.rul b/scsilib/RULES/9000-782-hp-ux-cc.rul new file mode 100644 index 0000000..ebd50be --- /dev/null +++ b/scsilib/RULES/9000-782-hp-ux-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)9000-725-hp-ux-cc.rul 1.9 03/01/30 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +# +# -Ae -> ANSI C (non-bundled C only - bundled C ignores -Ae) +# +DAportable -> Create Parisc-1.1 code +# +COPTS= -Ae +DAportable +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(SRCROOT)/conf/mkdep-hpux.sh +MKDEP_OUT= diff --git a/scsilib/RULES/9000-782-hp-ux-gcc.rul b/scsilib/RULES/9000-782-hp-ux-gcc.rul new file mode 100644 index 0000000..c6a7b46 --- /dev/null +++ b/scsilib/RULES/9000-782-hp-ux-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)9000-725-hp-ux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/9000-785-hp-ux-cc.rul b/scsilib/RULES/9000-785-hp-ux-cc.rul new file mode 100644 index 0000000..ebd50be --- /dev/null +++ b/scsilib/RULES/9000-785-hp-ux-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)9000-725-hp-ux-cc.rul 1.9 03/01/30 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +# +# -Ae -> ANSI C (non-bundled C only - bundled C ignores -Ae) +# +DAportable -> Create Parisc-1.1 code +# +COPTS= -Ae +DAportable +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(SRCROOT)/conf/mkdep-hpux.sh +MKDEP_OUT= diff --git a/scsilib/RULES/9000-785-hp-ux-gcc.rul b/scsilib/RULES/9000-785-hp-ux-gcc.rul new file mode 100644 index 0000000..c6a7b46 --- /dev/null +++ b/scsilib/RULES/9000-785-hp-ux-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)9000-725-hp-ux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/9000-800-hp-ux-cc.rul b/scsilib/RULES/9000-800-hp-ux-cc.rul new file mode 100644 index 0000000..ebd50be --- /dev/null +++ b/scsilib/RULES/9000-800-hp-ux-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)9000-725-hp-ux-cc.rul 1.9 03/01/30 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +# +# -Ae -> ANSI C (non-bundled C only - bundled C ignores -Ae) +# +DAportable -> Create Parisc-1.1 code +# +COPTS= -Ae +DAportable +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(SRCROOT)/conf/mkdep-hpux.sh +MKDEP_OUT= diff --git a/scsilib/RULES/9000-800-hp-ux-gcc.rul b/scsilib/RULES/9000-800-hp-ux-gcc.rul new file mode 100644 index 0000000..c6a7b46 --- /dev/null +++ b/scsilib/RULES/9000-800-hp-ux-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)9000-725-hp-ux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/9000-820-hp-ux-cc.rul b/scsilib/RULES/9000-820-hp-ux-cc.rul new file mode 100644 index 0000000..ebd50be --- /dev/null +++ b/scsilib/RULES/9000-820-hp-ux-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)9000-725-hp-ux-cc.rul 1.9 03/01/30 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +# +# -Ae -> ANSI C (non-bundled C only - bundled C ignores -Ae) +# +DAportable -> Create Parisc-1.1 code +# +COPTS= -Ae +DAportable +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(SRCROOT)/conf/mkdep-hpux.sh +MKDEP_OUT= diff --git a/scsilib/RULES/9000-820-hp-ux-gcc.rul b/scsilib/RULES/9000-820-hp-ux-gcc.rul new file mode 100644 index 0000000..c6a7b46 --- /dev/null +++ b/scsilib/RULES/9000-820-hp-ux-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)9000-725-hp-ux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/9000-831-hp-ux-cc.rul b/scsilib/RULES/9000-831-hp-ux-cc.rul new file mode 100644 index 0000000..ebd50be --- /dev/null +++ b/scsilib/RULES/9000-831-hp-ux-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)9000-725-hp-ux-cc.rul 1.9 03/01/30 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +# +# -Ae -> ANSI C (non-bundled C only - bundled C ignores -Ae) +# +DAportable -> Create Parisc-1.1 code +# +COPTS= -Ae +DAportable +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(SRCROOT)/conf/mkdep-hpux.sh +MKDEP_OUT= diff --git a/scsilib/RULES/9000-831-hp-ux-gcc.rul b/scsilib/RULES/9000-831-hp-ux-gcc.rul new file mode 100644 index 0000000..c6a7b46 --- /dev/null +++ b/scsilib/RULES/9000-831-hp-ux-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)9000-725-hp-ux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/9000-899-hp-ux-cc.rul b/scsilib/RULES/9000-899-hp-ux-cc.rul new file mode 100644 index 0000000..ebd50be --- /dev/null +++ b/scsilib/RULES/9000-899-hp-ux-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)9000-725-hp-ux-cc.rul 1.9 03/01/30 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +# +# -Ae -> ANSI C (non-bundled C only - bundled C ignores -Ae) +# +DAportable -> Create Parisc-1.1 code +# +COPTS= -Ae +DAportable +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(SRCROOT)/conf/mkdep-hpux.sh +MKDEP_OUT= diff --git a/scsilib/RULES/9000-899-hp-ux-gcc.rul b/scsilib/RULES/9000-899-hp-ux-gcc.rul new file mode 100644 index 0000000..c6a7b46 --- /dev/null +++ b/scsilib/RULES/9000-899-hp-ux-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)9000-725-hp-ux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .sl + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/MKLINKS b/scsilib/RULES/MKLINKS new file mode 100644 index 0000000..870f993 --- /dev/null +++ b/scsilib/RULES/MKLINKS @@ -0,0 +1,188 @@ +#!/bin/sh +########################################################################### +#ident "@(#)MKLINKS 1.53 04/09/08 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +ln -s mk-.id mk-make.id +ln -s r-make.c4x r-gmake.c4x +ln -s r-make.c4x-dep r-gmake.c4x-dep +ln -s r-make.obj r-gmake.obj +ln -s 9000-725-hp-ux-cc.rul 9000-710-hp-ux-cc.rul +ln -s 9000-725-hp-ux-cc.rul 9000-712-hp-ux-cc.rul +ln -s 9000-725-hp-ux-cc.rul 9000-715-hp-ux-cc.rul +ln -s 9000-725-hp-ux-cc.rul 9000-735-hp-ux-cc.rul +ln -s 9000-725-hp-ux-cc.rul 9000-743-hp-ux-cc.rul +ln -s 9000-725-hp-ux-cc.rul 9000-755-hp-ux-cc.rul +ln -s 9000-725-hp-ux-cc.rul 9000-777-hp-ux-cc.rul +ln -s 9000-725-hp-ux-cc.rul 9000-778-hp-ux-cc.rul +ln -s 9000-725-hp-ux-cc.rul 9000-780-hp-ux-cc.rul +ln -s 9000-725-hp-ux-cc.rul 9000-782-hp-ux-cc.rul +ln -s 9000-725-hp-ux-cc.rul 9000-785-hp-ux-cc.rul +ln -s 9000-725-hp-ux-cc.rul 9000-800-hp-ux-cc.rul +ln -s 9000-725-hp-ux-cc.rul 9000-820-hp-ux-cc.rul +ln -s 9000-725-hp-ux-cc.rul 9000-831-hp-ux-cc.rul +ln -s 9000-725-hp-ux-cc.rul 9000-899-hp-ux-cc.rul +ln -s 9000-725-hp-ux-gcc.rul 9000-710-hp-ux-gcc.rul +ln -s 9000-725-hp-ux-gcc.rul 9000-712-hp-ux-gcc.rul +ln -s 9000-725-hp-ux-gcc.rul 9000-715-hp-ux-gcc.rul +ln -s 9000-725-hp-ux-gcc.rul 9000-735-hp-ux-gcc.rul +ln -s 9000-725-hp-ux-gcc.rul 9000-743-hp-ux-gcc.rul +ln -s 9000-725-hp-ux-gcc.rul 9000-755-hp-ux-gcc.rul +ln -s 9000-725-hp-ux-gcc.rul 9000-777-hp-ux-gcc.rul +ln -s 9000-725-hp-ux-gcc.rul 9000-778-hp-ux-gcc.rul +ln -s 9000-725-hp-ux-gcc.rul 9000-780-hp-ux-gcc.rul +ln -s 9000-725-hp-ux-gcc.rul 9000-782-hp-ux-gcc.rul +ln -s 9000-725-hp-ux-gcc.rul 9000-785-hp-ux-gcc.rul +ln -s 9000-725-hp-ux-gcc.rul 9000-800-hp-ux-gcc.rul +ln -s 9000-725-hp-ux-gcc.rul 9000-820-hp-ux-gcc.rul +ln -s 9000-725-hp-ux-gcc.rul 9000-831-hp-ux-gcc.rul +ln -s 9000-725-hp-ux-gcc.rul 9000-899-hp-ux-gcc.rul +ln -s hppa-nextstep-cc.rul i386-nextstep-cc.rul +ln -s hppa-nextstep-cc.rul m68k-nextstep-cc.rul +ln -s hppa-nextstep-cc.rul sparc-nextstep-cc.rul +ln -s hppa-nextstep-cc.rul i386-nextstep-gcc.rul +ln -s hppa-nextstep-cc.rul m68k-nextstep-gcc.rul +ln -s hppa-nextstep-cc.rul sparc-nextstep-gcc.rul +ln -s os-irix.id os-irix64.id +ln -s ip22-irix-cc.rul ip17-irix-cc.rul +ln -s ip22-irix-cc.rul ip20-irix-cc.rul +ln -s ip22-irix-cc.rul ip27-irix-cc.rul +ln -s ip22-irix-cc.rul ip28-irix-cc.rul +ln -s ip22-irix-cc.rul ip30-irix-cc.rul +ln -s ip22-irix-cc.rul ip32-irix-cc.rul +ln -s ip22-irix-gcc.rul ip17-irix-gcc.rul +ln -s ip22-irix-gcc.rul ip20-irix-gcc.rul +ln -s ip22-irix-gcc.rul ip27-irix-gcc.rul +ln -s ip22-irix-gcc.rul ip28-irix-gcc.rul +ln -s ip22-irix-gcc.rul ip30-irix-gcc.rul +ln -s ip22-irix-gcc.rul ip32-irix-gcc.rul +ln -s i386-freebsd-cc.rul sparc64-freebsd-cc.rul +ln -s i386-freebsd-gcc.rul sparc64-freebsd-gcc.rul +ln -s i386-netbsd-cc.rul alpha-netbsd-cc.rul +ln -s i386-netbsd-gcc.rul alpha-netbsd-gcc.rul +ln -s i386-netbsd-cc.rul sparc-netbsd-cc.rul +ln -s i386-netbsd-gcc.rul sparc-netbsd-gcc.rul +ln -s i386-netbsd-cc.rul mac68k-netbsd-cc.rul +ln -s i386-netbsd-gcc.rul mac68k-netbsd-gcc.rul +ln -s i386-netbsd-cc.rul amiga-netbsd-cc.rul +ln -s i386-netbsd-gcc.rul amiga-netbsd-gcc.rul +ln -s i386-netbsd-cc.rul macppc-netbsd-cc.rul +ln -s i386-netbsd-gcc.rul macppc-netbsd-gcc.rul +ln -s i386-bsd-os-cc.rul sparc-bsd-os-cc.rul +ln -s i386-bsd-os-gcc.rul sparc-bsd-os-gcc.rul +ln -s i386-bsd-os3-cc.rul sparc-bsd-os3-cc.rul +ln -s i386-bsd-os3-gcc.rul sparc-bsd-os3-gcc.rul +ln -s i586-linux-cc.rul i386-linux-cc.rul +ln -s i586-linux-cc.rul i486-linux-cc.rul +ln -s i586-linux-cc.rul i686-linux-cc.rul +ln -s i586-linux-gcc.rul i386-linux-gcc.rul +ln -s i586-linux-gcc.rul i486-linux-gcc.rul +ln -s i586-linux-gcc.rul i686-linux-gcc.rul +ln -s i586-linux-cc.rul sparc-linux-cc.rul +ln -s i586-linux-gcc.rul sparc-linux-gcc.rul +ln -s i586-linux-cc.rul sparc64-linux-cc.rul +ln -s i586-linux-gcc.rul sparc64-linux-gcc.rul +ln -s i586-linux-cc.rul alpha-linux-cc.rul +ln -s i586-linux-gcc.rul alpha-linux-gcc.rul +ln -s i586-linux-cc.rul ppc-linux-cc.rul +ln -s i586-linux-gcc.rul ppc-linux-gcc.rul +ln -s i586-linux-cc.rul m68k-linux-cc.rul +ln -s i586-linux-gcc.rul m68k-linux-gcc.rul +ln -s i586-linux-cc.rul armv4l-linux-cc.rul +ln -s i586-linux-gcc.rul armv4l-linux-gcc.rul +ln -s i586-linux-cc.rul armv4l-linux-cc.rul +ln -s i586-linux-gcc.rul armv4l-linux-gcc.rul +ln -s i586-linux-cc.rul armv4tl-linux-cc.rul +ln -s i586-linux-gcc.rul armv4tl-linux-gcc.rul +ln -s i586-linux-cc.rul armv5tel-linux-cc.rul +ln -s i586-linux-gcc.rul armv5tel-linux-gcc.rul +ln -s i586-linux-cc.rul armv5tejl-linux-cc.rul +ln -s i586-linux-gcc.rul armv5tejl-linux-gcc.rul +ln -s i586-linux-cc.rul armv6l-linux-cc.rul +ln -s i586-linux-gcc.rul armv6l-linux-gcc.rul +ln -s i586-linux-cc.rul mips-linux-cc.rul +ln -s i586-linux-gcc.rul mips-linux-gcc.rul +ln -s i586-linux-cc.rul mips64-linux-cc.rul +ln -s i586-linux-gcc.rul mips64-linux-gcc.rul +ln -s i586-linux-cc.rul mipsel-linux-cc.rul +ln -s i586-linux-gcc.rul mipsel-linux-gcc.rul +ln -s i586-linux-cc.rul s390-linux-cc.rul +ln -s i586-linux-gcc.rul s390-linux-gcc.rul +ln -s i586-linux-cc.rul s390x-linux-cc.rul +ln -s i586-linux-gcc.rul s390x-linux-gcc.rul +ln -s i586-linux-cc.rul parisc-linux-cc.rul +ln -s i586-linux-gcc.rul parisc-linux-gcc.rul +ln -s i586-linux-cc.rul parisc64-linux-cc.rul +ln -s i586-linux-gcc.rul parisc64-linux-gcc.rul +ln -s i586-linux-cc.rul ia64-linux-cc.rul +ln -s i586-linux-gcc.rul ia64-linux-gcc.rul +ln -s i586-linux-cc.rul x86_64-linux-cc.rul +ln -s i586-linux-gcc.rul x86_64-linux-gcc.rul +ln -s os-cygwin32_nt.id os-cygwin_95-4.0.id +ln -s os-cygwin32_nt.id os-cygwin_98-4.0.id +ln -s os-cygwin32_nt.id os-cygwin_98-4.10.id +ln -s os-cygwin32_nt.id os-cygwin_me-4.90.id +ln -s os-cygwin32_nt.id os-cygwin_nt-4.0.id +ln -s os-cygwin32_nt.id os-cygwin_nt-5.0.id +ln -s os-cygwin32_nt.id os-cygwin_nt-5.1.id +ln -s os-unixware.id os-openunix.id +ln -s i486-cygwin32_nt-cc.rul i386-cygwin32_nt-cc.rul +ln -s i486-cygwin32_nt-cc.rul i586-cygwin32_nt-cc.rul +ln -s i486-cygwin32_nt-cc.rul i686-cygwin32_nt-cc.rul +ln -s i486-cygwin32_nt-cc.rul i786-cygwin32_nt-cc.rul +ln -s i486-cygwin32_nt-gcc.rul i386-cygwin32_nt-gcc.rul +ln -s i486-cygwin32_nt-gcc.rul i586-cygwin32_nt-gcc.rul +ln -s i486-cygwin32_nt-gcc.rul i686-cygwin32_nt-gcc.rul +ln -s i486-cygwin32_nt-gcc.rul i786-cygwin32_nt-gcc.rul +ln -s power-macintosh-rhapsody-cc.rul power-macintosh-mac-os10-cc.rul +ln -s power-macintosh-rhapsody-gcc.rul power-macintosh-mac-os10-gcc.rul +ln -s sun4-sunos4-cc.rul sun4c-sunos4-cc.rul +ln -s sun4-sunos4-gcc.rul sun4c-sunos4-gcc.rul +ln -s sun4-sunos5-cc.rul sun4c-sunos5-cc.rul +ln -s sun4-sunos5-gcc.rul sun4c-sunos5-gcc.rul +ln -s sun4-sunos4-cc.rul sun4m-sunos4-cc.rul +ln -s sun4-sunos4-gcc.rul sun4m-sunos4-gcc.rul +ln -s sun4-sunos5-cc.rul sun4m-sunos5-cc.rul +ln -s sun4-sunos5-gcc.rul sun4m-sunos5-gcc.rul +ln -s sun4-sunos5-cc.rul sun4u-sunos5-cc.rul +ln -s sun4-sunos5-gcc.rul sun4u-sunos5-gcc.rul +ln -s sun4-sunos5-cc.rul sun4d-sunos5-cc.rul +ln -s sun4-sunos5-gcc.rul sun4d-sunos5-gcc.rul +ln -s sun4-sunos5-cc.rul sun4e-sunos5-cc.rul +ln -s sun4-sunos5-gcc.rul sun4e-sunos5-gcc.rul +ln -s sun4-sunos5-cc.rul sun4L-sunos5-cc.rul +ln -s sun4-sunos5-gcc.rul sun4L-sunos5-gcc.rul +ln -s i386-unixware-cc.rul i486-unixware-cc.rul +ln -s i386-unixware-gcc.rul i486-unixware-gcc.rul +ln -s i386-unixware-cc.rul i586-unixware-cc.rul +ln -s i386-unixware-gcc.rul i586-unixware-gcc.rul +ln -s i386-unixware-cc.rul pentium-iii-unixware-cc.rul +ln -s i386-unixware-gcc.rul pentium-iii-unixware-gcc.rul +ln -s i386-unixware-cc.rul pentium-pro-unixware-cc.rul +ln -s i386-unixware-gcc.rul pentium-pro-unixware-gcc.rul +ln -s i386-ms-dos-gcc.rul i486-ms-dos-gcc.rul +ln -s i386-ms-dos-gcc.rul i586-ms-dos-gcc.rul +ln -s i386-ms-dos-gcc.rul i686-ms-dos-gcc.rul +ln -s i386-ms-dos-gcc.rul i786-ms-dos-gcc.rul +# +ln -s mk-smake.id mk-build.id +ln -s r-smake.c4x r-build.c4x +ln -s r-smake.c4x-dep r-build.c4x-dep +ln -s r-smake.dep r-build.dep +ln -s r-smake.obj r-build.obj +ln -s r-smake.tag r-build.tag diff --git a/scsilib/RULES/README b/scsilib/RULES/README new file mode 100644 index 0000000..e3bad23 --- /dev/null +++ b/scsilib/RULES/README @@ -0,0 +1,27 @@ +PATH setzen +LD_RUN_PATH loeschen +LD_LIBRARY_PATH Loeschen +umask setzen + +symlink libxxx.so -> libxxx.so.x.y +bei install setzen + +highlevel rules: + +rules.aux +rules.cmd +rules.dir +rules.drv +rules.lib +rules.loc +rules.mks +rules.mod +rules.rdi +rules.shl + +sollten umbenannt werden z.B. in xrules.* + +SunPRo -mt GCC -D_REENTRANT -lthread + +DESTDIR fuer GNU autoconf Kompatibilitaet? + diff --git a/scsilib/RULES/alpha-linux-cc.rul b/scsilib/RULES/alpha-linux-cc.rul new file mode 100644 index 0000000..e1dbbe6 --- /dev/null +++ b/scsilib/RULES/alpha-linux-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-cc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/alpha-linux-gcc.rul b/scsilib/RULES/alpha-linux-gcc.rul new file mode 100644 index 0000000..b0c8042 --- /dev/null +++ b/scsilib/RULES/alpha-linux-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/alpha-netbsd-cc.rul b/scsilib/RULES/alpha-netbsd-cc.rul new file mode 100644 index 0000000..62d64c4 --- /dev/null +++ b/scsilib/RULES/alpha-netbsd-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-netbsd-cc.rul 1.6 02/10/15 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NetBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +#OSDEFS= -DIS_UNIX +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/alpha-netbsd-gcc.rul b/scsilib/RULES/alpha-netbsd-gcc.rul new file mode 100644 index 0000000..f1674b7 --- /dev/null +++ b/scsilib/RULES/alpha-netbsd-gcc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-netbsd-gcc.rul 1.6 02/10/15 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NetBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +#OSDEFS= -DIS_UNIX +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/alpha-osf1-cc.rul b/scsilib/RULES/alpha-osf1-cc.rul new file mode 100644 index 0000000..bdb17f9 --- /dev/null +++ b/scsilib/RULES/alpha-osf1-cc.rul @@ -0,0 +1,69 @@ +#ident "@(#)alpha-osf1-cc.rul 1.3 01/09/27 " +########################################################################### +# Written 1998 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Digital UNIX (OSF1) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) -L/usr/ccs/lib + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) -lrt + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= diff --git a/scsilib/RULES/alpha-osf1-gcc.rul b/scsilib/RULES/alpha-osf1-gcc.rul new file mode 100644 index 0000000..916ccfb --- /dev/null +++ b/scsilib/RULES/alpha-osf1-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)alpha-osf1-gcc.rul 1.3 02/10/15 " +########################################################################### +# Written 1998 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Digital UNIX (OSF1) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) -L/usr/ccs/lib + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) -lrt + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/amiga-netbsd-cc.rul b/scsilib/RULES/amiga-netbsd-cc.rul new file mode 100644 index 0000000..62d64c4 --- /dev/null +++ b/scsilib/RULES/amiga-netbsd-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-netbsd-cc.rul 1.6 02/10/15 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NetBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +#OSDEFS= -DIS_UNIX +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/amiga-netbsd-gcc.rul b/scsilib/RULES/amiga-netbsd-gcc.rul new file mode 100644 index 0000000..f1674b7 --- /dev/null +++ b/scsilib/RULES/amiga-netbsd-gcc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-netbsd-gcc.rul 1.6 02/10/15 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NetBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +#OSDEFS= -DIS_UNIX +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/armv4l-linux-cc.rul b/scsilib/RULES/armv4l-linux-cc.rul new file mode 100644 index 0000000..e1dbbe6 --- /dev/null +++ b/scsilib/RULES/armv4l-linux-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-cc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/armv4l-linux-gcc.rul b/scsilib/RULES/armv4l-linux-gcc.rul new file mode 100644 index 0000000..b0c8042 --- /dev/null +++ b/scsilib/RULES/armv4l-linux-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/aviion-dgux3-cc.rul b/scsilib/RULES/aviion-dgux3-cc.rul new file mode 100644 index 0000000..1fd14cb --- /dev/null +++ b/scsilib/RULES/aviion-dgux3-cc.rul @@ -0,0 +1,66 @@ +#ident "@(#)aviion-dgux3-cc.rul 1.4 99/08/29 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for DGUX 3.x on mc88100 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= -Xa +CWOPTS= -v +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -Kpic +COPTGPROF= -xpg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= -lkvm -lelf + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -xM +MKDEP_OUT= diff --git a/scsilib/RULES/aviion-dgux3-gcc.rul b/scsilib/RULES/aviion-dgux3-gcc.rul new file mode 100644 index 0000000..8885c00 --- /dev/null +++ b/scsilib/RULES/aviion-dgux3-gcc.rul @@ -0,0 +1,69 @@ +#ident "@(#)aviion-dgux3-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for DGUX 3.x on mc88100 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= -lkvm -lelf + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +#LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LDOPTDYN= -shared -ztext -h $(TARGET) -ldl +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +#DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/aviion-dgux4-cc.rul b/scsilib/RULES/aviion-dgux4-cc.rul new file mode 100644 index 0000000..32fc526 --- /dev/null +++ b/scsilib/RULES/aviion-dgux4-cc.rul @@ -0,0 +1,65 @@ +#ident "@(#)aviion-dgux4-cc.rul 1.4 99/08/29 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for DGUX 4.x on mc88100/pentium +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= -Xa +CWOPTS= -v +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -Kpic +COPTGPROF= -xpg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +LIB_KVM= -lkvm -lelf + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -xM +MKDEP_OUT= diff --git a/scsilib/RULES/aviion-dgux4-gcc.rul b/scsilib/RULES/aviion-dgux4-gcc.rul new file mode 100644 index 0000000..14cfe16 --- /dev/null +++ b/scsilib/RULES/aviion-dgux4-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)aviion-dgux4-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for DGUX 4.x on mc88100/pentium +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +LIB_KVM= -lkvm -lelf + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +#LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LDOPTDYN= -shared -ztext -h $(TARGET) -ldl +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +#DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/bemac-beos-cc.rul b/scsilib/RULES/bemac-beos-cc.rul new file mode 100644 index 0000000..6779805 --- /dev/null +++ b/scsilib/RULES/bemac-beos-cc.rul @@ -0,0 +1,81 @@ +#ident @(#)bemac-beos-cc.rul 1.3 01/11/26 +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for BeOS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +# +# XXX Old BeOS needs libroot.so to get [efg]cvt() +# XXX New BeOS seems to have this in libc and in addition we include +# XXX strtod.c for floating point conversion on OS without such code. +# XXX For this reason, -DNO_FLOATINGPOINT -DUSE_FLOATINGARGS has been +# XXX removed and printing floating numbers will work with old/new BeOS +# +#OSDEFS += -DNO_FLOATINGPOINT -DUSE_FLOATINGARGS + +CPPOPTS= -O4 -g -i- -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -w8 +COPTOPT= -opt off +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= #-fpic +COPTGPROF= #-pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +#LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= -multidefs -msg nodup -sym on -g $(LIBS_PATH) $(LDPATH) +LDOPTDYN=# -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CCCOM= mwccppc +CC= @echo " ==> COMPILING \"$@\""; $(CCCOM) +LDCC= @echo " ==> LINKING \"$@\""; $(CCCOM) +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; $(CCCOM) +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(CCCOM) -make +MKDEP_OUT= + +LN= /bin/ln -s diff --git a/scsilib/RULES/bemac-beos-mwcc.rul b/scsilib/RULES/bemac-beos-mwcc.rul new file mode 100644 index 0000000..05950aa --- /dev/null +++ b/scsilib/RULES/bemac-beos-mwcc.rul @@ -0,0 +1,81 @@ +#ident @(#)bemac-beos-mwcc.rul 1.3 01/11/26 +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for BeOS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +# +# XXX Old BeOS needs libroot.so to get [efg]cvt() +# XXX New BeOS seems to have this in libc and in addition we include +# XXX strtod.c for floating point conversion on OS without such code. +# XXX For this reason, -DNO_FLOATINGPOINT -DUSE_FLOATINGARGS has been +# XXX removed and printing floating numbers will work with old/new BeOS +# +#OSDEFS += -DNO_FLOATINGPOINT -DUSE_FLOATINGARGS + +CPPOPTS= -relax_pointers -opt all -sym on -g -i- -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -w8 +COPTOPT= -opt off +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= #-fpic +COPTGPROF= #-pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +#LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= -multidefs -msg nodup -sym on -g $(LIBS_PATH) $(LDPATH) +LDOPTDYN=# -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CCCOM= mwccppc +CC= @echo " ==> COMPILING \"$@\""; $(CCCOM) +LDCC= @echo " ==> LINKING \"$@\""; $(CCCOM) +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; $(CCCOM) +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(CCCOM) -make +MKDEP_OUT= + +LN= /bin/ln -s diff --git a/scsilib/RULES/bepc-beos-cc.rul b/scsilib/RULES/bepc-beos-cc.rul new file mode 100644 index 0000000..e9ab506 --- /dev/null +++ b/scsilib/RULES/bepc-beos-cc.rul @@ -0,0 +1,83 @@ +#ident @(#)bepc-beos-cc.rul 1.3 02/10/15 +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for BeOS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +# +# XXX Old BeOS needs libroot.so to get [efg]cvt() +# XXX New BeOS seems to have this in libc and in addition we include +# XXX strtod.c for floating point conversion on OS without such code. +# XXX For this reason, -DNO_FLOATINGPOINT -DUSE_FLOATINGARGS has been +# XXX removed and printing floating numbers will work with old/new BeOS +# +#OSDEFS += -DNO_FLOATINGPOINT -DUSE_FLOATINGARGS + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +CONFFLAGS= i586 + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +#LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= + +LN= /bin/ln -s diff --git a/scsilib/RULES/bepc-beos-gcc.rul b/scsilib/RULES/bepc-beos-gcc.rul new file mode 100644 index 0000000..220b177 --- /dev/null +++ b/scsilib/RULES/bepc-beos-gcc.rul @@ -0,0 +1,81 @@ +#ident @(#)bepc-beos-gcc.rul 1.4 02/10/15 +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for BeOS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +# +# XXX Old BeOS needs libroot.so to get [efg]cvt() +# XXX New BeOS seems to have this in libc and in addition we include +# XXX strtod.c for floating point conversion on OS without such code. +# XXX For this reason, -DNO_FLOATINGPOINT -DUSE_FLOATINGARGS has been +# XXX removed and printing floating numbers will work with old/new BeOS +# +#OSDEFS += -DNO_FLOATINGPOINT -DUSE_FLOATINGARGS + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +CONFFLAGS= i586 + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +#LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/dn5500-domainos-cc.rul b/scsilib/RULES/dn5500-domainos-cc.rul new file mode 100644 index 0000000..fc05dac --- /dev/null +++ b/scsilib/RULES/dn5500-domainos-cc.rul @@ -0,0 +1,73 @@ +#ident "@(#)dn5500-domainos-cc.rul 1.2 01/02/26 " +########################################################################### +# Written 2001 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for DomainOS (sys5.3, 10.4.1) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -W0,-info,4 +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +#CCCOM= cc -A systype,bsd4.3 +CCCOM= /bsd4.3/bin/cc +CC= @echo " ==> COMPILING \"$@\""; $(CCCOM) +LDCC= @echo " ==> LINKING \"$@\""; $(CCCOM) +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; $(CCCOM) +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +#MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); /user/local/com/makedepend +MKDEP_OUT= +MKDIR= $(MKDIR_SH) diff --git a/scsilib/RULES/dummy.dep b/scsilib/RULES/dummy.dep new file mode 100644 index 0000000..4c286f6 --- /dev/null +++ b/scsilib/RULES/dummy.dep @@ -0,0 +1,24 @@ +#ident @(#)dummy.dep 1.1 98/09/27 +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Dependency building dummy rules +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +depend rmdep: + @echo "$@: nothing to make" diff --git a/scsilib/RULES/gmake.wrn b/scsilib/RULES/gmake.wrn new file mode 100644 index 0000000..6c7b5a6 --- /dev/null +++ b/scsilib/RULES/gmake.wrn @@ -0,0 +1,21 @@ + W A R N I N G Messages like: + +gmake[2]: Entering directory `/tmp/cdrtools-2.01/libschily' +../RULES/r-gmake.dep:76: OBJ/<arch-dir>/cvmod.d: No such file or directory +../RULES/r-gmake.dep:76: OBJ/<arch-dir>/dat.d: No such file or directory +../RULES/r-gmake.dep:76: OBJ/<arch-dir>/fcons.d: No such file or directory +../RULES/r-gmake.dep:76: OBJ/<arch-dir>/fdown.d: No such file or directory +../RULES/r-gmake.dep:76: OBJ/<arch-dir>/fdup.d: No such file or directory +../RULES/r-gmake.dep:76: OBJ/<arch-dir>/ffileread.d: No such file or directory +../RULES/r-gmake.dep:76: OBJ/<arch-dir>/ffilewrite.d: No such file or directory +../RULES/r-gmake.dep:76: OBJ/<arch-dir>/fgetline.d: No such file or directory +../RULES/r-gmake.dep:76: OBJ/<arch-dir>/fgetstr.d: No such file or directory +../RULES/r-gmake.dep:76: OBJ/<arch-dir>/file_raise.d: No such file or directory +../RULES/r-gmake.dep:76: OBJ/<arch-dir>/fileclose.d: No such file or directory +.... + +are caused by a GNU make bug and not by the Schily makefile system. + +The related bug has been reported to the GNU make maintainers in 1988 but +as the bug has not yet been fixed, it seems that GNU make is unmaintained :-( +A working highly portable make program is at ftp://ftp.berlios.de/pub/smake diff --git a/scsilib/RULES/hppa-nextstep-cc.rul b/scsilib/RULES/hppa-nextstep-cc.rul new file mode 100644 index 0000000..281d851 --- /dev/null +++ b/scsilib/RULES/hppa-nextstep-cc.rul @@ -0,0 +1,67 @@ +#ident "@(#)hppa-nextstep-cc.rul 1.5 03/02/27 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NeXT Step on hppa (GCC) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= +MKDIR= $(MKDIR_SH) diff --git a/scsilib/RULES/hppa-nextstep-gcc.rul b/scsilib/RULES/hppa-nextstep-gcc.rul new file mode 100644 index 0000000..8e879c9 --- /dev/null +++ b/scsilib/RULES/hppa-nextstep-gcc.rul @@ -0,0 +1,67 @@ +#ident "@(#)hppa-nextstep-gcc.rul 1.5 03/02/27 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NeXT Step on hppa (GCC) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= +MKDIR= $(MKDIR_SH) diff --git a/scsilib/RULES/i386-at386-gnu-cc.rul b/scsilib/RULES/i386-at386-gnu-cc.rul new file mode 100644 index 0000000..64c686a --- /dev/null +++ b/scsilib/RULES/i386-at386-gnu-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i386-at386-gnu-cc.rul 1.2 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for GNU (hurd) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i386-at386-gnu-gcc.rul b/scsilib/RULES/i386-at386-gnu-gcc.rul new file mode 100644 index 0000000..cee402d --- /dev/null +++ b/scsilib/RULES/i386-at386-gnu-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i386-at386-gnu-gcc.rul 1.2 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for GNU (hurd) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i386-bsd-os-cc.rul b/scsilib/RULES/i386-bsd-os-cc.rul new file mode 100644 index 0000000..549b5b3 --- /dev/null +++ b/scsilib/RULES/i386-bsd-os-cc.rul @@ -0,0 +1,69 @@ +#ident "@(#)i386-bsd-os-cc.rul 1.5 03/01/15 " +########################################################################### +# Written 1998 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for BSD/OS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) -I/sys $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +#COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +#SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -shared -Wl,-soname,$(TARGET) +#LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i386-bsd-os-gcc.rul b/scsilib/RULES/i386-bsd-os-gcc.rul new file mode 100644 index 0000000..774de7e --- /dev/null +++ b/scsilib/RULES/i386-bsd-os-gcc.rul @@ -0,0 +1,69 @@ +#ident "@(#)i386-bsd-os-gcc.rul 1.5 03/01/15 " +########################################################################### +# Written 1998 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for BSD/OS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) -I/sys $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +#COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +#SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -shared -Wl,-soname,$(TARGET) +#LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i386-bsd-os3-cc.rul b/scsilib/RULES/i386-bsd-os3-cc.rul new file mode 100644 index 0000000..825c769 --- /dev/null +++ b/scsilib/RULES/i386-bsd-os3-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-bsd-os-cc.rul 1.4 02/10/15 " +########################################################################### +# Written 1998 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for BSD/OS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) -I/sys $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +#COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +#SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -shared -Wl,-soname,$(TARGET) +#LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +# shlicc2 is not present oln older or newer systems +#LDCC= @echo " ==> LINKING \"$@\""; shlicc2 +LDCC= @echo " ==> LINKING \"$@\""; shlicc +#DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i386-bsd-os3-gcc.rul b/scsilib/RULES/i386-bsd-os3-gcc.rul new file mode 100644 index 0000000..825c769 --- /dev/null +++ b/scsilib/RULES/i386-bsd-os3-gcc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-bsd-os-cc.rul 1.4 02/10/15 " +########################################################################### +# Written 1998 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for BSD/OS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) -I/sys $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +#COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +#SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -shared -Wl,-soname,$(TARGET) +#LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +# shlicc2 is not present oln older or newer systems +#LDCC= @echo " ==> LINKING \"$@\""; shlicc2 +LDCC= @echo " ==> LINKING \"$@\""; shlicc +#DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i386-cygwin32_nt-cc.rul b/scsilib/RULES/i386-cygwin32_nt-cc.rul new file mode 100644 index 0000000..b65d8a5 --- /dev/null +++ b/scsilib/RULES/i386-cygwin32_nt-cc.rul @@ -0,0 +1,78 @@ +#ident "@(#)i486-cygwin32_nt-cc.rul 1.4 02/10/15 " +########################################################################### +# Written 1998 by B. Bochow +########################################################################### +# +# Platform dependent MACROS for CYGWIN32_NT +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -mwin32 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +#KDEFINES= -DKERNEL -D_KERNEL +KDEFINES= +#COPTDYN= -fpic +COPTDYN= +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +#SHL_SUFFIX= .so.1.0 +SHL_SUFFIX= .dll + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LDOPTDYN= +#LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so +LNDYNLIB= + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +#DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= + diff --git a/scsilib/RULES/i386-cygwin32_nt-gcc.rul b/scsilib/RULES/i386-cygwin32_nt-gcc.rul new file mode 100644 index 0000000..fe6af34 --- /dev/null +++ b/scsilib/RULES/i386-cygwin32_nt-gcc.rul @@ -0,0 +1,78 @@ +#ident "@(#)i486-cygwin32_nt-gcc.rul 1.4 02/10/15 " +########################################################################### +# Written 1998 by B. Bochow +########################################################################### +# +# Platform dependent MACROS for CYGWIN32_NT +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -mwin32 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +#KDEFINES= -DKERNEL -D_KERNEL +KDEFINES= +#COPTDYN= -fpic +COPTDYN= +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +#SHL_SUFFIX= .so.1.0 +SHL_SUFFIX= .dll + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LDOPTDYN= +#LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so +LNDYNLIB= + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +#DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= + diff --git a/scsilib/RULES/i386-freebsd-cc.rul b/scsilib/RULES/i386-freebsd-cc.rul new file mode 100644 index 0000000..ae3976f --- /dev/null +++ b/scsilib/RULES/i386-freebsd-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i386-freebsd-cc.rul 1.4 02/10/15 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for FreeBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i386-freebsd-gcc.rul b/scsilib/RULES/i386-freebsd-gcc.rul new file mode 100644 index 0000000..d73f226 --- /dev/null +++ b/scsilib/RULES/i386-freebsd-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i386-freebsd-gcc.rul 1.4 02/10/15 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for FreeBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i386-linux-cc.rul b/scsilib/RULES/i386-linux-cc.rul new file mode 100644 index 0000000..e1dbbe6 --- /dev/null +++ b/scsilib/RULES/i386-linux-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-cc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i386-linux-gcc.rul b/scsilib/RULES/i386-linux-gcc.rul new file mode 100644 index 0000000..b0c8042 --- /dev/null +++ b/scsilib/RULES/i386-linux-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i386-mingw32_nt-gcc.rul b/scsilib/RULES/i386-mingw32_nt-gcc.rul new file mode 100644 index 0000000..f2ebf86 --- /dev/null +++ b/scsilib/RULES/i386-mingw32_nt-gcc.rul @@ -0,0 +1,67 @@ +#ident "@(#)i386-mingw32_nt-gcc.rul 1.1 04/07/11 " +########################################################################### +# +# Platform dependent MACROS for Win32/Mingw32 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I/MinGW/Include -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) -lmgw32 + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= + +MKDIR= $(MKDIR_SH) diff --git a/scsilib/RULES/i386-ms-dos-gcc.rul b/scsilib/RULES/i386-ms-dos-gcc.rul new file mode 100644 index 0000000..8127a91 --- /dev/null +++ b/scsilib/RULES/i386-ms-dos-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)i386-ms-dos-gcc.rul 1.1 03/11/23 " +########################################################################### +# +# Platform dependent MACROS for MSDOS/DJGPP v2 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +#OSDEFS= +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +#CWOPTS= +COPTOPT= -O +KDEFINES= +COPTDYN= +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +#LDCC= @echo " ==> LINKING \"$@\""; gcc -Wl,--strip-all +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i386-netbsd-cc.rul b/scsilib/RULES/i386-netbsd-cc.rul new file mode 100644 index 0000000..62d64c4 --- /dev/null +++ b/scsilib/RULES/i386-netbsd-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-netbsd-cc.rul 1.6 02/10/15 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NetBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +#OSDEFS= -DIS_UNIX +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i386-netbsd-gcc.rul b/scsilib/RULES/i386-netbsd-gcc.rul new file mode 100644 index 0000000..f1674b7 --- /dev/null +++ b/scsilib/RULES/i386-netbsd-gcc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-netbsd-gcc.rul 1.6 02/10/15 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NetBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +#OSDEFS= -DIS_UNIX +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i386-nextstep-cc.rul b/scsilib/RULES/i386-nextstep-cc.rul new file mode 100644 index 0000000..281d851 --- /dev/null +++ b/scsilib/RULES/i386-nextstep-cc.rul @@ -0,0 +1,67 @@ +#ident "@(#)hppa-nextstep-cc.rul 1.5 03/02/27 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NeXT Step on hppa (GCC) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= +MKDIR= $(MKDIR_SH) diff --git a/scsilib/RULES/i386-nextstep-gcc.rul b/scsilib/RULES/i386-nextstep-gcc.rul new file mode 100644 index 0000000..281d851 --- /dev/null +++ b/scsilib/RULES/i386-nextstep-gcc.rul @@ -0,0 +1,67 @@ +#ident "@(#)hppa-nextstep-cc.rul 1.5 03/02/27 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NeXT Step on hppa (GCC) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= +MKDIR= $(MKDIR_SH) diff --git a/scsilib/RULES/i386-openbsd-cc.rul b/scsilib/RULES/i386-openbsd-cc.rul new file mode 100644 index 0000000..c946a4c --- /dev/null +++ b/scsilib/RULES/i386-openbsd-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i386-openbsd-cc.rul 1.5 02/10/15 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for OpenBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i386-openbsd-gcc.rul b/scsilib/RULES/i386-openbsd-gcc.rul new file mode 100644 index 0000000..eb3dd44 --- /dev/null +++ b/scsilib/RULES/i386-openbsd-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i386-openbsd-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for OpenBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i386-openserver-cc.rul b/scsilib/RULES/i386-openserver-cc.rul new file mode 100644 index 0000000..0f45dac --- /dev/null +++ b/scsilib/RULES/i386-openserver-cc.rul @@ -0,0 +1,69 @@ +#ident "@(#)i386-openserver-cc.rul 1.1 00/01/23 " +########################################################################### +# Written 1999 by J. Schilling/Santa Cruz Operation +########################################################################### +# +# Platform dependent MACROS for SCO OpenServer 5 using cc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +OSDEFS= -DSCO -DOPENSERVER +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= -belf +CWOPTS= -w3 +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -KPIC +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -dy -G $(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true + +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(SRCROOT)/conf/mkdep-sco.sh +MKDEP_OUT= +MKDIR= $(MKDIR_SH) diff --git a/scsilib/RULES/i386-openserver-gcc.rul b/scsilib/RULES/i386-openserver-gcc.rul new file mode 100644 index 0000000..1319e72 --- /dev/null +++ b/scsilib/RULES/i386-openserver-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i386-openserver-gcc.rul 1.3 02/10/15 " +########################################################################### +# Written 1999 by J. Schilling/Santa Cruz Operation +########################################################################### +# +# Platform dependent MACROS for SCO OpenServer 5 using gcc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -DSCO -DOPENSERVER +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= -melf +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -dy -G $(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true + +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= +MKDIR= $(MKDIR_SH) diff --git a/scsilib/RULES/i386-os2-gcc.rul b/scsilib/RULES/i386-os2-gcc.rul new file mode 100644 index 0000000..284f30b --- /dev/null +++ b/scsilib/RULES/i386-os2-gcc.rul @@ -0,0 +1,87 @@ +#ident "@(#)i386-os2-gcc.rul 1.7 03/01/29 " +########################################################################### +# First version written 1999 by C. Wohlgemuth +########################################################################### +# +# Platform dependent MACROS for OS/2 using gcc (EMX) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +# XXX strtod.c now does floating point conversion on OS without ?cvt(). +# XXX For this reason, -DNO_FLOATINGPOINT -DUSE_FLOATINGARGS has been +# XXX removed and printing floating numbers will work on any OS. +# +OSDEFS= -D__OS2 + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) + +# +# Using -Zcrtdll is a hack to allow this flag to be seen +# from configure too. +COPTS= -Zcrtdll +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O + +KDEFINES= + +COPTDYN= +COPTGPROF= +LIB_PREFIX= +LIB_SUFFIX= .a +SHL_SUFFIX= + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= -lsocket + +#LIB_MATH= -lm +LIB_MATH= +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) + +LDOPTDYN= + +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc -Zexe -Zcrtdll +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true + + +ARFLAGS= cr + +LORDER= echo +TSORT= cat +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i386-unixware-cc.rul b/scsilib/RULES/i386-unixware-cc.rul new file mode 100644 index 0000000..116d798 --- /dev/null +++ b/scsilib/RULES/i386-unixware-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-unixware-cc.rul 1.4 03/05/31 " +########################################################################### +# Written 1999 by J. Schilling/Santa Cruz Operation +########################################################################### +# +# Platform dependent MACROS for SCO UnixWare 2.x / 7.x using cc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +OSDEFS= -DUNIXWARE -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -v +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -KPIC +#COPTGPROF= -pg +COPTGPROF= -p + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -dy -G $(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true + +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); sh $(SRCROOT)/conf/mkdep-sco.sh +MKDEP_OUT= diff --git a/scsilib/RULES/i386-unixware-gcc.rul b/scsilib/RULES/i386-unixware-gcc.rul new file mode 100644 index 0000000..c59ea75 --- /dev/null +++ b/scsilib/RULES/i386-unixware-gcc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-unixware-gcc.rul 1.2 02/10/15 " +########################################################################### +# Written 1999 by J. Schilling/Santa Cruz Operation +########################################################################### +# +# Platform dependent MACROS for SCO UnixWare 2.x / 7.x using gcc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -DUNIXWARE -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -dy -G $(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true + +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i486-cygwin32_nt-cc.rul b/scsilib/RULES/i486-cygwin32_nt-cc.rul new file mode 100644 index 0000000..b65d8a5 --- /dev/null +++ b/scsilib/RULES/i486-cygwin32_nt-cc.rul @@ -0,0 +1,78 @@ +#ident "@(#)i486-cygwin32_nt-cc.rul 1.4 02/10/15 " +########################################################################### +# Written 1998 by B. Bochow +########################################################################### +# +# Platform dependent MACROS for CYGWIN32_NT +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -mwin32 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +#KDEFINES= -DKERNEL -D_KERNEL +KDEFINES= +#COPTDYN= -fpic +COPTDYN= +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +#SHL_SUFFIX= .so.1.0 +SHL_SUFFIX= .dll + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LDOPTDYN= +#LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so +LNDYNLIB= + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +#DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= + diff --git a/scsilib/RULES/i486-cygwin32_nt-gcc.rul b/scsilib/RULES/i486-cygwin32_nt-gcc.rul new file mode 100644 index 0000000..fe6af34 --- /dev/null +++ b/scsilib/RULES/i486-cygwin32_nt-gcc.rul @@ -0,0 +1,78 @@ +#ident "@(#)i486-cygwin32_nt-gcc.rul 1.4 02/10/15 " +########################################################################### +# Written 1998 by B. Bochow +########################################################################### +# +# Platform dependent MACROS for CYGWIN32_NT +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -mwin32 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +#KDEFINES= -DKERNEL -D_KERNEL +KDEFINES= +#COPTDYN= -fpic +COPTDYN= +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +#SHL_SUFFIX= .so.1.0 +SHL_SUFFIX= .dll + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LDOPTDYN= +#LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so +LNDYNLIB= + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +#DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= + diff --git a/scsilib/RULES/i486-linux-cc.rul b/scsilib/RULES/i486-linux-cc.rul new file mode 100644 index 0000000..e1dbbe6 --- /dev/null +++ b/scsilib/RULES/i486-linux-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-cc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i486-linux-gcc.rul b/scsilib/RULES/i486-linux-gcc.rul new file mode 100644 index 0000000..b0c8042 --- /dev/null +++ b/scsilib/RULES/i486-linux-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i486-mingw32_nt-gcc.rul b/scsilib/RULES/i486-mingw32_nt-gcc.rul new file mode 100644 index 0000000..20c3334 --- /dev/null +++ b/scsilib/RULES/i486-mingw32_nt-gcc.rul @@ -0,0 +1,67 @@ +#ident "@(#)i486-mingw32_nt-gcc.rul 1.1 04/07/11 " +########################################################################### +# +# Platform dependent MACROS for Win32/Mingw32 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I/MinGW/Include -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) -lmgw32 + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= + +MKDIR= $(MKDIR_SH) diff --git a/scsilib/RULES/i486-ms-dos-gcc.rul b/scsilib/RULES/i486-ms-dos-gcc.rul new file mode 100644 index 0000000..8127a91 --- /dev/null +++ b/scsilib/RULES/i486-ms-dos-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)i386-ms-dos-gcc.rul 1.1 03/11/23 " +########################################################################### +# +# Platform dependent MACROS for MSDOS/DJGPP v2 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +#OSDEFS= +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +#CWOPTS= +COPTOPT= -O +KDEFINES= +COPTDYN= +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +#LDCC= @echo " ==> LINKING \"$@\""; gcc -Wl,--strip-all +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i486-unixware-cc.rul b/scsilib/RULES/i486-unixware-cc.rul new file mode 100644 index 0000000..116d798 --- /dev/null +++ b/scsilib/RULES/i486-unixware-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-unixware-cc.rul 1.4 03/05/31 " +########################################################################### +# Written 1999 by J. Schilling/Santa Cruz Operation +########################################################################### +# +# Platform dependent MACROS for SCO UnixWare 2.x / 7.x using cc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +OSDEFS= -DUNIXWARE -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -v +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -KPIC +#COPTGPROF= -pg +COPTGPROF= -p + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -dy -G $(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true + +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); sh $(SRCROOT)/conf/mkdep-sco.sh +MKDEP_OUT= diff --git a/scsilib/RULES/i486-unixware-gcc.rul b/scsilib/RULES/i486-unixware-gcc.rul new file mode 100644 index 0000000..c59ea75 --- /dev/null +++ b/scsilib/RULES/i486-unixware-gcc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-unixware-gcc.rul 1.2 02/10/15 " +########################################################################### +# Written 1999 by J. Schilling/Santa Cruz Operation +########################################################################### +# +# Platform dependent MACROS for SCO UnixWare 2.x / 7.x using gcc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -DUNIXWARE -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -dy -G $(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true + +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i586-cygwin32_nt-cc.rul b/scsilib/RULES/i586-cygwin32_nt-cc.rul new file mode 100644 index 0000000..b65d8a5 --- /dev/null +++ b/scsilib/RULES/i586-cygwin32_nt-cc.rul @@ -0,0 +1,78 @@ +#ident "@(#)i486-cygwin32_nt-cc.rul 1.4 02/10/15 " +########################################################################### +# Written 1998 by B. Bochow +########################################################################### +# +# Platform dependent MACROS for CYGWIN32_NT +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -mwin32 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +#KDEFINES= -DKERNEL -D_KERNEL +KDEFINES= +#COPTDYN= -fpic +COPTDYN= +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +#SHL_SUFFIX= .so.1.0 +SHL_SUFFIX= .dll + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LDOPTDYN= +#LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so +LNDYNLIB= + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +#DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= + diff --git a/scsilib/RULES/i586-cygwin32_nt-gcc.rul b/scsilib/RULES/i586-cygwin32_nt-gcc.rul new file mode 100644 index 0000000..fe6af34 --- /dev/null +++ b/scsilib/RULES/i586-cygwin32_nt-gcc.rul @@ -0,0 +1,78 @@ +#ident "@(#)i486-cygwin32_nt-gcc.rul 1.4 02/10/15 " +########################################################################### +# Written 1998 by B. Bochow +########################################################################### +# +# Platform dependent MACROS for CYGWIN32_NT +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -mwin32 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +#KDEFINES= -DKERNEL -D_KERNEL +KDEFINES= +#COPTDYN= -fpic +COPTDYN= +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +#SHL_SUFFIX= .so.1.0 +SHL_SUFFIX= .dll + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LDOPTDYN= +#LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so +LNDYNLIB= + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +#DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= + diff --git a/scsilib/RULES/i586-linux-cc.rul b/scsilib/RULES/i586-linux-cc.rul new file mode 100644 index 0000000..e1dbbe6 --- /dev/null +++ b/scsilib/RULES/i586-linux-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-cc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i586-linux-gcc.rul b/scsilib/RULES/i586-linux-gcc.rul new file mode 100644 index 0000000..b0c8042 --- /dev/null +++ b/scsilib/RULES/i586-linux-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i586-mingw32_nt-gcc.rul b/scsilib/RULES/i586-mingw32_nt-gcc.rul new file mode 100644 index 0000000..11df96c --- /dev/null +++ b/scsilib/RULES/i586-mingw32_nt-gcc.rul @@ -0,0 +1,67 @@ +#ident "@(#)i586-mingw32_nt-gcc.rul 1.1 04/07/11 " +########################################################################### +# +# Platform dependent MACROS for Win32/Mingw32 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I/MinGW/Include -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) -lmgw32 + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= + +MKDIR= $(MKDIR_SH) diff --git a/scsilib/RULES/i586-ms-dos-gcc.rul b/scsilib/RULES/i586-ms-dos-gcc.rul new file mode 100644 index 0000000..8127a91 --- /dev/null +++ b/scsilib/RULES/i586-ms-dos-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)i386-ms-dos-gcc.rul 1.1 03/11/23 " +########################################################################### +# +# Platform dependent MACROS for MSDOS/DJGPP v2 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +#OSDEFS= +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +#CWOPTS= +COPTOPT= -O +KDEFINES= +COPTDYN= +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +#LDCC= @echo " ==> LINKING \"$@\""; gcc -Wl,--strip-all +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i586-unixware-cc.rul b/scsilib/RULES/i586-unixware-cc.rul new file mode 100644 index 0000000..116d798 --- /dev/null +++ b/scsilib/RULES/i586-unixware-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-unixware-cc.rul 1.4 03/05/31 " +########################################################################### +# Written 1999 by J. Schilling/Santa Cruz Operation +########################################################################### +# +# Platform dependent MACROS for SCO UnixWare 2.x / 7.x using cc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +OSDEFS= -DUNIXWARE -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -v +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -KPIC +#COPTGPROF= -pg +COPTGPROF= -p + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -dy -G $(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true + +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); sh $(SRCROOT)/conf/mkdep-sco.sh +MKDEP_OUT= diff --git a/scsilib/RULES/i586-unixware-gcc.rul b/scsilib/RULES/i586-unixware-gcc.rul new file mode 100644 index 0000000..c59ea75 --- /dev/null +++ b/scsilib/RULES/i586-unixware-gcc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-unixware-gcc.rul 1.2 02/10/15 " +########################################################################### +# Written 1999 by J. Schilling/Santa Cruz Operation +########################################################################### +# +# Platform dependent MACROS for SCO UnixWare 2.x / 7.x using gcc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -DUNIXWARE -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -dy -G $(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true + +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i686-cygwin32_nt-cc.rul b/scsilib/RULES/i686-cygwin32_nt-cc.rul new file mode 100644 index 0000000..b65d8a5 --- /dev/null +++ b/scsilib/RULES/i686-cygwin32_nt-cc.rul @@ -0,0 +1,78 @@ +#ident "@(#)i486-cygwin32_nt-cc.rul 1.4 02/10/15 " +########################################################################### +# Written 1998 by B. Bochow +########################################################################### +# +# Platform dependent MACROS for CYGWIN32_NT +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -mwin32 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +#KDEFINES= -DKERNEL -D_KERNEL +KDEFINES= +#COPTDYN= -fpic +COPTDYN= +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +#SHL_SUFFIX= .so.1.0 +SHL_SUFFIX= .dll + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LDOPTDYN= +#LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so +LNDYNLIB= + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +#DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= + diff --git a/scsilib/RULES/i686-cygwin32_nt-gcc.rul b/scsilib/RULES/i686-cygwin32_nt-gcc.rul new file mode 100644 index 0000000..fe6af34 --- /dev/null +++ b/scsilib/RULES/i686-cygwin32_nt-gcc.rul @@ -0,0 +1,78 @@ +#ident "@(#)i486-cygwin32_nt-gcc.rul 1.4 02/10/15 " +########################################################################### +# Written 1998 by B. Bochow +########################################################################### +# +# Platform dependent MACROS for CYGWIN32_NT +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -mwin32 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +#KDEFINES= -DKERNEL -D_KERNEL +KDEFINES= +#COPTDYN= -fpic +COPTDYN= +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +#SHL_SUFFIX= .so.1.0 +SHL_SUFFIX= .dll + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LDOPTDYN= +#LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so +LNDYNLIB= + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +#DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= + diff --git a/scsilib/RULES/i686-linux-cc.rul b/scsilib/RULES/i686-linux-cc.rul new file mode 100644 index 0000000..e1dbbe6 --- /dev/null +++ b/scsilib/RULES/i686-linux-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-cc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i686-linux-gcc.rul b/scsilib/RULES/i686-linux-gcc.rul new file mode 100644 index 0000000..b0c8042 --- /dev/null +++ b/scsilib/RULES/i686-linux-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i686-mingw32_nt-gcc.rul b/scsilib/RULES/i686-mingw32_nt-gcc.rul new file mode 100644 index 0000000..b751952 --- /dev/null +++ b/scsilib/RULES/i686-mingw32_nt-gcc.rul @@ -0,0 +1,67 @@ +#ident "@(#)i686-mingw32_nt-gcc.rul 1.1 04/07/11 " +########################################################################### +# +# Platform dependent MACROS for Win32/Mingw32 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I/MinGW/Include -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) -lmgw32 + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= + +MKDIR= $(MKDIR_SH) diff --git a/scsilib/RULES/i686-ms-dos-gcc.rul b/scsilib/RULES/i686-ms-dos-gcc.rul new file mode 100644 index 0000000..8127a91 --- /dev/null +++ b/scsilib/RULES/i686-ms-dos-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)i386-ms-dos-gcc.rul 1.1 03/11/23 " +########################################################################### +# +# Platform dependent MACROS for MSDOS/DJGPP v2 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +#OSDEFS= +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +#CWOPTS= +COPTOPT= -O +KDEFINES= +COPTDYN= +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +#LDCC= @echo " ==> LINKING \"$@\""; gcc -Wl,--strip-all +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i786-cygwin32_nt-cc.rul b/scsilib/RULES/i786-cygwin32_nt-cc.rul new file mode 100644 index 0000000..b65d8a5 --- /dev/null +++ b/scsilib/RULES/i786-cygwin32_nt-cc.rul @@ -0,0 +1,78 @@ +#ident "@(#)i486-cygwin32_nt-cc.rul 1.4 02/10/15 " +########################################################################### +# Written 1998 by B. Bochow +########################################################################### +# +# Platform dependent MACROS for CYGWIN32_NT +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -mwin32 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +#KDEFINES= -DKERNEL -D_KERNEL +KDEFINES= +#COPTDYN= -fpic +COPTDYN= +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +#SHL_SUFFIX= .so.1.0 +SHL_SUFFIX= .dll + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LDOPTDYN= +#LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so +LNDYNLIB= + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +#DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= + diff --git a/scsilib/RULES/i786-cygwin32_nt-gcc.rul b/scsilib/RULES/i786-cygwin32_nt-gcc.rul new file mode 100644 index 0000000..fe6af34 --- /dev/null +++ b/scsilib/RULES/i786-cygwin32_nt-gcc.rul @@ -0,0 +1,78 @@ +#ident "@(#)i486-cygwin32_nt-gcc.rul 1.4 02/10/15 " +########################################################################### +# Written 1998 by B. Bochow +########################################################################### +# +# Platform dependent MACROS for CYGWIN32_NT +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -mwin32 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +#KDEFINES= -DKERNEL -D_KERNEL +KDEFINES= +#COPTDYN= -fpic +COPTDYN= +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +#SHL_SUFFIX= .so.1.0 +SHL_SUFFIX= .dll + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LDOPTDYN= +#LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so +LNDYNLIB= + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +#DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= + diff --git a/scsilib/RULES/i786-mingw32_nt-gcc.rul b/scsilib/RULES/i786-mingw32_nt-gcc.rul new file mode 100644 index 0000000..1b56691 --- /dev/null +++ b/scsilib/RULES/i786-mingw32_nt-gcc.rul @@ -0,0 +1,67 @@ +#ident "@(#)i786-mingw32_nt-gcc.rul 1.1 04/07/11 " +########################################################################### +# +# Platform dependent MACROS for Win32/Mingw32 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I/MinGW/Include -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) -lmgw32 + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= + +MKDIR= $(MKDIR_SH) diff --git a/scsilib/RULES/i786-ms-dos-gcc.rul b/scsilib/RULES/i786-ms-dos-gcc.rul new file mode 100644 index 0000000..8127a91 --- /dev/null +++ b/scsilib/RULES/i786-ms-dos-gcc.rul @@ -0,0 +1,68 @@ +#ident "@(#)i386-ms-dos-gcc.rul 1.1 03/11/23 " +########################################################################### +# +# Platform dependent MACROS for MSDOS/DJGPP v2 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +#OSDEFS= +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +#CWOPTS= +COPTOPT= -O +KDEFINES= +COPTDYN= +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +#LDCC= @echo " ==> LINKING \"$@\""; gcc -Wl,--strip-all +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/i86pc-sunos5-cc.rul b/scsilib/RULES/i86pc-sunos5-cc.rul new file mode 100644 index 0000000..b44b0c2 --- /dev/null +++ b/scsilib/RULES/i86pc-sunos5-cc.rul @@ -0,0 +1,68 @@ +#ident "@(#)i86pc-sunos5-cc.rul 1.6 04/01/02 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 5.x on PC +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(SUNPROCOPTOPT) $(COPTX) + +LINTFLAGS= -Nlevel=4 + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= -Xa +CWOPTS= -v +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -Kpic +COPTGPROF= -xpg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +LIB_KVM= -lkvm -lelf +LIB_VOLMGT= -lvolmgt + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -xM +MKDEP_OUT= diff --git a/scsilib/RULES/i86pc-sunos5-gcc.rul b/scsilib/RULES/i86pc-sunos5-gcc.rul new file mode 100644 index 0000000..515ed48 --- /dev/null +++ b/scsilib/RULES/i86pc-sunos5-gcc.rul @@ -0,0 +1,67 @@ +#ident "@(#)i86pc-sunos5-gcc.rul 1.6 04/01/02 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 5.x for PC +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +LIB_KVM= -lkvm -lelf +LIB_VOLMGT= -lvolmgt + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/ia64-linux-cc.rul b/scsilib/RULES/ia64-linux-cc.rul new file mode 100644 index 0000000..e1dbbe6 --- /dev/null +++ b/scsilib/RULES/ia64-linux-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-cc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/ia64-linux-gcc.rul b/scsilib/RULES/ia64-linux-gcc.rul new file mode 100644 index 0000000..b0c8042 --- /dev/null +++ b/scsilib/RULES/ia64-linux-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/ip17-irix-cc.rul b/scsilib/RULES/ip17-irix-cc.rul new file mode 100644 index 0000000..01d5a83 --- /dev/null +++ b/scsilib/RULES/ip17-irix-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)ip22-irix-cc.rul 1.5 01/12/09 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Silicon Graphics IRIX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 $(LARGEFILE_OPT) +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -fullwarn +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -Kpic +COPTGPROF= -p1 + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) $(LARGEFILE_OPT) +#LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs +# +# lorder seems not to work on some machines, disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= diff --git a/scsilib/RULES/ip17-irix-gcc.rul b/scsilib/RULES/ip17-irix-gcc.rul new file mode 100644 index 0000000..e9a8bf8 --- /dev/null +++ b/scsilib/RULES/ip17-irix-gcc.rul @@ -0,0 +1,72 @@ +#ident "@(#)ip22-irix-gcc.rul 1.6 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Silicon Graphics IRIX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs +# +# lorder seems not to work on some machines, disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/ip20-irix-cc.rul b/scsilib/RULES/ip20-irix-cc.rul new file mode 100644 index 0000000..01d5a83 --- /dev/null +++ b/scsilib/RULES/ip20-irix-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)ip22-irix-cc.rul 1.5 01/12/09 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Silicon Graphics IRIX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 $(LARGEFILE_OPT) +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -fullwarn +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -Kpic +COPTGPROF= -p1 + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) $(LARGEFILE_OPT) +#LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs +# +# lorder seems not to work on some machines, disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= diff --git a/scsilib/RULES/ip20-irix-gcc.rul b/scsilib/RULES/ip20-irix-gcc.rul new file mode 100644 index 0000000..e9a8bf8 --- /dev/null +++ b/scsilib/RULES/ip20-irix-gcc.rul @@ -0,0 +1,72 @@ +#ident "@(#)ip22-irix-gcc.rul 1.6 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Silicon Graphics IRIX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs +# +# lorder seems not to work on some machines, disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/ip22-irix-cc.rul b/scsilib/RULES/ip22-irix-cc.rul new file mode 100644 index 0000000..01d5a83 --- /dev/null +++ b/scsilib/RULES/ip22-irix-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)ip22-irix-cc.rul 1.5 01/12/09 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Silicon Graphics IRIX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 $(LARGEFILE_OPT) +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -fullwarn +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -Kpic +COPTGPROF= -p1 + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) $(LARGEFILE_OPT) +#LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs +# +# lorder seems not to work on some machines, disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= diff --git a/scsilib/RULES/ip22-irix-gcc.rul b/scsilib/RULES/ip22-irix-gcc.rul new file mode 100644 index 0000000..e9a8bf8 --- /dev/null +++ b/scsilib/RULES/ip22-irix-gcc.rul @@ -0,0 +1,72 @@ +#ident "@(#)ip22-irix-gcc.rul 1.6 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Silicon Graphics IRIX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs +# +# lorder seems not to work on some machines, disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/ip27-irix-cc.rul b/scsilib/RULES/ip27-irix-cc.rul new file mode 100644 index 0000000..01d5a83 --- /dev/null +++ b/scsilib/RULES/ip27-irix-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)ip22-irix-cc.rul 1.5 01/12/09 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Silicon Graphics IRIX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 $(LARGEFILE_OPT) +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -fullwarn +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -Kpic +COPTGPROF= -p1 + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) $(LARGEFILE_OPT) +#LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs +# +# lorder seems not to work on some machines, disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= diff --git a/scsilib/RULES/ip27-irix-gcc.rul b/scsilib/RULES/ip27-irix-gcc.rul new file mode 100644 index 0000000..e9a8bf8 --- /dev/null +++ b/scsilib/RULES/ip27-irix-gcc.rul @@ -0,0 +1,72 @@ +#ident "@(#)ip22-irix-gcc.rul 1.6 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Silicon Graphics IRIX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs +# +# lorder seems not to work on some machines, disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/ip28-irix-cc.rul b/scsilib/RULES/ip28-irix-cc.rul new file mode 100644 index 0000000..01d5a83 --- /dev/null +++ b/scsilib/RULES/ip28-irix-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)ip22-irix-cc.rul 1.5 01/12/09 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Silicon Graphics IRIX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 $(LARGEFILE_OPT) +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -fullwarn +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -Kpic +COPTGPROF= -p1 + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) $(LARGEFILE_OPT) +#LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs +# +# lorder seems not to work on some machines, disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= diff --git a/scsilib/RULES/ip28-irix-gcc.rul b/scsilib/RULES/ip28-irix-gcc.rul new file mode 100644 index 0000000..e9a8bf8 --- /dev/null +++ b/scsilib/RULES/ip28-irix-gcc.rul @@ -0,0 +1,72 @@ +#ident "@(#)ip22-irix-gcc.rul 1.6 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Silicon Graphics IRIX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs +# +# lorder seems not to work on some machines, disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/ip30-irix-cc.rul b/scsilib/RULES/ip30-irix-cc.rul new file mode 100644 index 0000000..01d5a83 --- /dev/null +++ b/scsilib/RULES/ip30-irix-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)ip22-irix-cc.rul 1.5 01/12/09 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Silicon Graphics IRIX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 $(LARGEFILE_OPT) +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -fullwarn +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -Kpic +COPTGPROF= -p1 + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) $(LARGEFILE_OPT) +#LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs +# +# lorder seems not to work on some machines, disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= diff --git a/scsilib/RULES/ip30-irix-gcc.rul b/scsilib/RULES/ip30-irix-gcc.rul new file mode 100644 index 0000000..e9a8bf8 --- /dev/null +++ b/scsilib/RULES/ip30-irix-gcc.rul @@ -0,0 +1,72 @@ +#ident "@(#)ip22-irix-gcc.rul 1.6 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Silicon Graphics IRIX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs +# +# lorder seems not to work on some machines, disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/ip32-irix-cc.rul b/scsilib/RULES/ip32-irix-cc.rul new file mode 100644 index 0000000..01d5a83 --- /dev/null +++ b/scsilib/RULES/ip32-irix-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)ip22-irix-cc.rul 1.5 01/12/09 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Silicon Graphics IRIX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 $(LARGEFILE_OPT) +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -fullwarn +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -Kpic +COPTGPROF= -p1 + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) $(LARGEFILE_OPT) +#LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs +# +# lorder seems not to work on some machines, disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= diff --git a/scsilib/RULES/ip32-irix-gcc.rul b/scsilib/RULES/ip32-irix-gcc.rul new file mode 100644 index 0000000..e9a8bf8 --- /dev/null +++ b/scsilib/RULES/ip32-irix-gcc.rul @@ -0,0 +1,72 @@ +#ident "@(#)ip22-irix-gcc.rul 1.6 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Silicon Graphics IRIX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs +# +# lorder seems not to work on some machines, disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/ldummy.cnf b/scsilib/RULES/ldummy.cnf new file mode 100644 index 0000000..723673d --- /dev/null +++ b/scsilib/RULES/ldummy.cnf @@ -0,0 +1,22 @@ +#ident @(#)ldummy.cnf 1.1 98/10/23 +########################################################################### +# Written 1998 by J. Schilling +########################################################################### +# +# Dummy Make Rules for local dynamic configuration +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### diff --git a/scsilib/RULES/local.cnf b/scsilib/RULES/local.cnf new file mode 100644 index 0000000..3b5e987 --- /dev/null +++ b/scsilib/RULES/local.cnf @@ -0,0 +1,41 @@ +#ident @(#)local.cnf 1.3 01/02/25 +########################################################################### +# Written 1998 by J. Schilling +########################################################################### +# +# Make Rules for local dynamic configuration +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### + +#config: $(ARCHDIR)/local.cnf + +$(ARCHDIR)/Inull: + $(MKDIR) -p $(ARCHDIR) + @echo > $@ + +$(ARCHDIR)/local.cnf $(ARCHDIR)/lconfig.h: $(ARCHDIR)/Inull \ + configure local.cnf.in lconfig.h.in + $(RUL_LCONF) + +########################################################################### +RUL_LCONF= @echo " ==> CONFIGURING LOCAL RULES \"$@\""; $(RM_F) $@; \ + cd $(ARCHDIR); \ + CONFIG_NOFAIL=TRUE CC="$(XCCCOM)" CFLAGS="$(CFLAGS)" sh ../../configure $(CONFFLAGS) +########################################################################### +include $(ARCHDIR)/Inull +include $(ARCHDIR)/local.cnf +########################################################################### diff --git a/scsilib/RULES/m68k-amigaos-gcc.rul b/scsilib/RULES/m68k-amigaos-gcc.rul new file mode 100644 index 0000000..5a1144c --- /dev/null +++ b/scsilib/RULES/m68k-amigaos-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)m68k-amigaos-gcc.rul 1.2 02/10/15 " +########################################################################### +# Written 1997,2001 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for AmigaOS GCC systems +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/m68k-linux-cc.rul b/scsilib/RULES/m68k-linux-cc.rul new file mode 100644 index 0000000..e1dbbe6 --- /dev/null +++ b/scsilib/RULES/m68k-linux-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-cc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/m68k-linux-gcc.rul b/scsilib/RULES/m68k-linux-gcc.rul new file mode 100644 index 0000000..b0c8042 --- /dev/null +++ b/scsilib/RULES/m68k-linux-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/m68k-nextstep-cc.rul b/scsilib/RULES/m68k-nextstep-cc.rul new file mode 100644 index 0000000..281d851 --- /dev/null +++ b/scsilib/RULES/m68k-nextstep-cc.rul @@ -0,0 +1,67 @@ +#ident "@(#)hppa-nextstep-cc.rul 1.5 03/02/27 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NeXT Step on hppa (GCC) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= +MKDIR= $(MKDIR_SH) diff --git a/scsilib/RULES/m68k-nextstep-gcc.rul b/scsilib/RULES/m68k-nextstep-gcc.rul new file mode 100644 index 0000000..281d851 --- /dev/null +++ b/scsilib/RULES/m68k-nextstep-gcc.rul @@ -0,0 +1,67 @@ +#ident "@(#)hppa-nextstep-cc.rul 1.5 03/02/27 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NeXT Step on hppa (GCC) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= +MKDIR= $(MKDIR_SH) diff --git a/scsilib/RULES/mac68k-netbsd-cc.rul b/scsilib/RULES/mac68k-netbsd-cc.rul new file mode 100644 index 0000000..62d64c4 --- /dev/null +++ b/scsilib/RULES/mac68k-netbsd-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-netbsd-cc.rul 1.6 02/10/15 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NetBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +#OSDEFS= -DIS_UNIX +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/mac68k-netbsd-gcc.rul b/scsilib/RULES/mac68k-netbsd-gcc.rul new file mode 100644 index 0000000..f1674b7 --- /dev/null +++ b/scsilib/RULES/mac68k-netbsd-gcc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-netbsd-gcc.rul 1.6 02/10/15 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NetBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +#OSDEFS= -DIS_UNIX +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/macppc-netbsd-cc.rul b/scsilib/RULES/macppc-netbsd-cc.rul new file mode 100644 index 0000000..62d64c4 --- /dev/null +++ b/scsilib/RULES/macppc-netbsd-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-netbsd-cc.rul 1.6 02/10/15 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NetBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +#OSDEFS= -DIS_UNIX +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/macppc-netbsd-gcc.rul b/scsilib/RULES/macppc-netbsd-gcc.rul new file mode 100644 index 0000000..f1674b7 --- /dev/null +++ b/scsilib/RULES/macppc-netbsd-gcc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-netbsd-gcc.rul 1.6 02/10/15 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NetBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +#OSDEFS= -DIS_UNIX +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/man-bsd.def b/scsilib/RULES/man-bsd.def new file mode 100644 index 0000000..33ad76c --- /dev/null +++ b/scsilib/RULES/man-bsd.def @@ -0,0 +1,50 @@ +#ident @(#)man-bsd.def 1.1 97/02/11 +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Definition for manual sections on BSD based systems +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### + +MANSECT_CMD= man1 +MANSECT_SYSCALL= man2 +MANSECT_LIB= man3 +MANSECT_FILEFORM= man5 +MANSECT_HDR= man7 +MANSECT_TABLES= man7 +MANSECT_MACROS= man7 +MANSECT_GAMES= man6 +MANSECT_DEMOS= man6 +MANSECT_DEVICE= man4 +MANSECT_NETWORK= man4 +MANSECT_ADMIN= man8 +MANSECT_DRIVER= man4 + +MANSUFF_CMD= 1 +MANSUFF_SYSCALL= 2 +MANSUFF_LIB= 3 +MANSUFF_FILEFORM= 5 +MANSUFF_HDR= 7 +MANSUFF_TABLES= 7 +MANSUFF_MACROS= 7 +MANSUFF_GAMES= 6 +MANSUFF_DEMOS= 6 +MANSUFF_DEVICE= 4 +MANSUFF_NETWORK= 4 +MANSUFF_ADMIN= 8 +MANSUFF_DRIVER= 4 diff --git a/scsilib/RULES/man-sysv.def b/scsilib/RULES/man-sysv.def new file mode 100644 index 0000000..70c0ae9 --- /dev/null +++ b/scsilib/RULES/man-sysv.def @@ -0,0 +1,50 @@ +#ident @(#)man-sysv.def 1.1 97/02/11 +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Definition for manual sections on SYSV based systems +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### + +MANSECT_CMD= man1 +MANSECT_SYSCALL= man2 +MANSECT_LIB= man3 +MANSECT_FILEFORM= man4 +MANSECT_HDR= man5 +MANSECT_TABLES= man5 +MANSECT_MACROS= man5 +MANSECT_GAMES= man6 +MANSECT_DEMOS= man6 +MANSECT_DEVICE= man7 +MANSECT_NETWORK= man7 +MANSECT_ADMIN= man8 +MANSECT_DRIVER= man9 + +MANSUFF_CMD= 1 +MANSUFF_SYSCALL= 2 +MANSUFF_LIB= 3 +MANSUFF_FILEFORM= 4 +MANSUFF_HDR= 5 +MANSUFF_TABLES= 5 +MANSUFF_MACROS= 5 +MANSUFF_GAMES= 6 +MANSUFF_DEMOS= 6 +MANSUFF_DEVICE= 7 +MANSUFF_NETWORK= 7 +MANSUFF_ADMIN= 8 +MANSUFF_DRIVER= 9 diff --git a/scsilib/RULES/mips-linux-cc.rul b/scsilib/RULES/mips-linux-cc.rul new file mode 100644 index 0000000..e1dbbe6 --- /dev/null +++ b/scsilib/RULES/mips-linux-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-cc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/mips-linux-gcc.rul b/scsilib/RULES/mips-linux-gcc.rul new file mode 100644 index 0000000..b0c8042 --- /dev/null +++ b/scsilib/RULES/mips-linux-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/mipsel-linux-cc.rul b/scsilib/RULES/mipsel-linux-cc.rul new file mode 100644 index 0000000..e1dbbe6 --- /dev/null +++ b/scsilib/RULES/mipsel-linux-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-cc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/mipsel-linux-gcc.rul b/scsilib/RULES/mipsel-linux-gcc.rul new file mode 100644 index 0000000..b0c8042 --- /dev/null +++ b/scsilib/RULES/mipsel-linux-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/mk-.id b/scsilib/RULES/mk-.id new file mode 100644 index 0000000..6309bd5 --- /dev/null +++ b/scsilib/RULES/mk-.id @@ -0,0 +1,57 @@ +#ident "@(#)mk-.id 1.10 98/10/13 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Name of make program (make/gmake/smake) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### + +MAKEPROG= make # Sun make + +########################################################################### +# +# standard (automatic) machine identification +# +########################################################################### +# +# XP_ARCH = uname -p = mach # Processor (sparc/mc68020) +# XK_ARCH = uname -m = arch -k # Kernel (sun3/sun4c/sun4m) +# XM_ARCH = arch ~ arch -k # Machine (sun3/sun4) +# +########################################################################### + +XP_ARCH:sh= (mach || uname -p || true)2>/dev/null | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',------' +XK_ARCH:sh= uname -m | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',------' +XM_ARCH:sh= (arch || /usr/ucb/arch || true)2>/dev/null | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',------' + +P_ARCH= $(XP_ARCH) +K_ARCH= $(XK_ARCH) +M_ARCH= $(XM_ARCH) + +_XP_ARCH= $(XP_ARCH:unknown=$(K_ARCH)) + +_P_ARCH= $(_UNIQ)$(_XP_ARCH) +__P_ARCH= $(_P_ARCH:$(_UNIQ)=$(K_ARCH)) +P_ARCH= $(__P_ARCH:$(_UNIQ)%=%) + +_M_ARCH= $(_UNIQ)$(XM_ARCH) +__M_ARCH= $(_M_ARCH:$(_UNIQ)=$(K_ARCH)) +M_ARCH= $(__M_ARCH:$(_UNIQ)%=%) + +OSNAME:sh= uname -s | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',------' +OSREL:sh= uname -r | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',------' diff --git a/scsilib/RULES/mk-build.id b/scsilib/RULES/mk-build.id new file mode 100644 index 0000000..355f346 --- /dev/null +++ b/scsilib/RULES/mk-build.id @@ -0,0 +1,57 @@ +#ident "@(#)mk-smake.id 1.4 97/02/18 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Name of make program (make/gmake/smake) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### + +MAKEPROG= $(MAKE_NAME) + +########################################################################### +# +# standard (automatic) machine identification +# +########################################################################### +# +# XP_ARCH = MAKE_ARCH = uname -p = mach # Processor (sparc/mc68020) +# XK_ARCH = MAKE_MACH = uname -m = arch -k # Kernel (sun3/sun4c/sun4m) +# XM_ARCH = MAKE_M_ARCH = arch ~ arch -k # Machine (sun3/sun4) +# +########################################################################### + +XP_ARCH= $(MAKE_ARCH) +XK_ARCH= $(MAKE_MACH) +XM_ARCH= $(MAKE_M_ARCH) + +P_ARCH= $(XP_ARCH) +K_ARCH= $(XK_ARCH) +M_ARCH= $(XM_ARCH) + +_P_ARCH= $(_UNIQ)$(XP_ARCH) +__P_ARCH= $(_P_ARCH:$(_UNIQ)=$(MAKE_MACH)) +P_ARCH= $(__P_ARCH:$(_UNIQ)%=%) + +_M_ARCH= $(_UNIQ)$(MAKE_M_ARCH) +__M_ARCH= $(_M_ARCH:$(_UNIQ)=$(MAKE_MACH)) +M_ARCH= $(__M_ARCH:$(_UNIQ)%=%) + +HOSTNAME= $(MAKE_HOST) +OSNAME= $(MAKE_OS) +OSDEFS= $(MAKE_OSDEFS) +OSREL= $(MAKE_OSREL) diff --git a/scsilib/RULES/mk-gmake.id b/scsilib/RULES/mk-gmake.id new file mode 100644 index 0000000..95fa149 --- /dev/null +++ b/scsilib/RULES/mk-gmake.id @@ -0,0 +1,75 @@ +#ident "@(#)mk-gmake.id 1.12 04/09/08 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Name of make program (make/gmake/smake) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### + +MAKEPROG= gmake + +########################################################################### +# +# standard (automatic) machine identification +# +########################################################################### +# +# XP_ARCH = uname -p = mach # Processor (sparc/mc68020) +# XK_ARCH = uname -m = arch -k # Kernel (sun3/sun4c/sun4m) +# XM_ARCH = arch ~ arch -k # Machine (sun3/sun4) +# +########################################################################### + +ifndef ARCH_DONE + +_MACHCMD= (uname -p || true) 2> /dev/null +_ARCHCMD= (arch || /usr/ucb/arch || true) 2> /dev/null + +XP_ARCH:= $(shell $(_MACHCMD) | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',//////' | tr ',/' ',-') +XK_ARCH:= $(shell uname -m | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',//////' | tr ',/' ',-') +XM_ARCH:= $(shell $(_ARCHCMD) | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',//////' | tr ',/' ',-') + +P_ARCH= $(XP_ARCH) +K_ARCH= $(XK_ARCH) +M_ARCH= $(XM_ARCH) + +_XP_ARCH= $(XP_ARCH:unknown=$(K_ARCH)) + +_P_ARCH= $(_UNIQ)$(_XP_ARCH) +__P_ARCH= $(_P_ARCH:$(_UNIQ)=$(K_ARCH)) +P_ARCH= $(__P_ARCH:$(_UNIQ)%=%) + +_M_ARCH= $(_UNIQ)$(XM_ARCH) +__M_ARCH= $(_M_ARCH:$(_UNIQ)=$(K_ARCH)) +M_ARCH= $(__M_ARCH:$(_UNIQ)%=%) + +OSNAME:= $(shell uname -s | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',//////' | tr ',/' ',-') +OSREL:= $(shell uname -r | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',//////' | tr ',/' ',-') + +ARCH_DONE= TRUE + +export XP_ARCH +export K_ARCH +export XM_ARCH +export P_ARCH +export M_ARCH +export OSNAME +export OSREL +export ARCH_DONE + +endif diff --git a/scsilib/RULES/mk-make.id b/scsilib/RULES/mk-make.id new file mode 100644 index 0000000..6309bd5 --- /dev/null +++ b/scsilib/RULES/mk-make.id @@ -0,0 +1,57 @@ +#ident "@(#)mk-.id 1.10 98/10/13 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Name of make program (make/gmake/smake) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### + +MAKEPROG= make # Sun make + +########################################################################### +# +# standard (automatic) machine identification +# +########################################################################### +# +# XP_ARCH = uname -p = mach # Processor (sparc/mc68020) +# XK_ARCH = uname -m = arch -k # Kernel (sun3/sun4c/sun4m) +# XM_ARCH = arch ~ arch -k # Machine (sun3/sun4) +# +########################################################################### + +XP_ARCH:sh= (mach || uname -p || true)2>/dev/null | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',------' +XK_ARCH:sh= uname -m | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',------' +XM_ARCH:sh= (arch || /usr/ucb/arch || true)2>/dev/null | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',------' + +P_ARCH= $(XP_ARCH) +K_ARCH= $(XK_ARCH) +M_ARCH= $(XM_ARCH) + +_XP_ARCH= $(XP_ARCH:unknown=$(K_ARCH)) + +_P_ARCH= $(_UNIQ)$(_XP_ARCH) +__P_ARCH= $(_P_ARCH:$(_UNIQ)=$(K_ARCH)) +P_ARCH= $(__P_ARCH:$(_UNIQ)%=%) + +_M_ARCH= $(_UNIQ)$(XM_ARCH) +__M_ARCH= $(_M_ARCH:$(_UNIQ)=$(K_ARCH)) +M_ARCH= $(__M_ARCH:$(_UNIQ)%=%) + +OSNAME:sh= uname -s | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',------' +OSREL:sh= uname -r | tr '[A-Z]' '[a-z]' | tr ', /\\()"' ',------' diff --git a/scsilib/RULES/mk-smake.id b/scsilib/RULES/mk-smake.id new file mode 100644 index 0000000..355f346 --- /dev/null +++ b/scsilib/RULES/mk-smake.id @@ -0,0 +1,57 @@ +#ident "@(#)mk-smake.id 1.4 97/02/18 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Name of make program (make/gmake/smake) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### + +MAKEPROG= $(MAKE_NAME) + +########################################################################### +# +# standard (automatic) machine identification +# +########################################################################### +# +# XP_ARCH = MAKE_ARCH = uname -p = mach # Processor (sparc/mc68020) +# XK_ARCH = MAKE_MACH = uname -m = arch -k # Kernel (sun3/sun4c/sun4m) +# XM_ARCH = MAKE_M_ARCH = arch ~ arch -k # Machine (sun3/sun4) +# +########################################################################### + +XP_ARCH= $(MAKE_ARCH) +XK_ARCH= $(MAKE_MACH) +XM_ARCH= $(MAKE_M_ARCH) + +P_ARCH= $(XP_ARCH) +K_ARCH= $(XK_ARCH) +M_ARCH= $(XM_ARCH) + +_P_ARCH= $(_UNIQ)$(XP_ARCH) +__P_ARCH= $(_P_ARCH:$(_UNIQ)=$(MAKE_MACH)) +P_ARCH= $(__P_ARCH:$(_UNIQ)%=%) + +_M_ARCH= $(_UNIQ)$(MAKE_M_ARCH) +__M_ARCH= $(_M_ARCH:$(_UNIQ)=$(MAKE_MACH)) +M_ARCH= $(__M_ARCH:$(_UNIQ)%=%) + +HOSTNAME= $(MAKE_HOST) +OSNAME= $(MAKE_OS) +OSDEFS= $(MAKE_OSDEFS) +OSREL= $(MAKE_OSREL) diff --git a/scsilib/RULES/news4000-newsos6-cc.rul b/scsilib/RULES/news4000-newsos6-cc.rul new file mode 100644 index 0000000..a197651 --- /dev/null +++ b/scsilib/RULES/news4000-newsos6-cc.rul @@ -0,0 +1,72 @@ +#ident @(#)news4000-newsos6-cc.rul 1.2 99/08/29 +########################################################################### +# +# Platform dependent MACROS for Sony NEWS-OS 6.x +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +# +# From objectx@polyphony.scei.co.jp XXX is -D__STDC__=0 correct ??? +# +OSDEFS= -D__SVR4 -DSVR4 -D__STDC__=0 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -fullwarn +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -Kpic +COPTGPROF= -p1 + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= -lsocket +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs +# +# lorder seems not to work on some machines, disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= diff --git a/scsilib/RULES/os-aix.def b/scsilib/RULES/os-aix.def new file mode 100644 index 0000000..b99542d --- /dev/null +++ b/scsilib/RULES/os-aix.def @@ -0,0 +1,23 @@ +#ident "@(#)os-aix.def 1.2 97/02/11 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Global os definitions for AIX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= sysv diff --git a/scsilib/RULES/os-aix.id b/scsilib/RULES/os-aix.id new file mode 100644 index 0000000..b33661f --- /dev/null +++ b/scsilib/RULES/os-aix.id @@ -0,0 +1,26 @@ +#ident "@(#)os-aix.id 1.1 97/01/18 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for AIX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= aix +-O_ARCH= -$(O_ARCH) +K_ARCH= rs6000 +P_ARCH= rs6000 diff --git a/scsilib/RULES/os-amigaos.def b/scsilib/RULES/os-amigaos.def new file mode 100644 index 0000000..e20948a --- /dev/null +++ b/scsilib/RULES/os-amigaos.def @@ -0,0 +1,23 @@ +#ident "@(#)os-amigaos.def 1.1 01/11/28 " +########################################################################### +# Written 2001 by J. Schilling +########################################################################### +# +# Global os definitions for AmigaOS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= bsd diff --git a/scsilib/RULES/os-amigaos.id b/scsilib/RULES/os-amigaos.id new file mode 100644 index 0000000..a5b50de --- /dev/null +++ b/scsilib/RULES/os-amigaos.id @@ -0,0 +1,24 @@ +#ident "@(#)os-amigaos.id 1.1 01/11/28 " +########################################################################### +# Written 2001 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for AmigaOS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= amigaos +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-beos.def b/scsilib/RULES/os-beos.def new file mode 100644 index 0000000..f4382de --- /dev/null +++ b/scsilib/RULES/os-beos.def @@ -0,0 +1,23 @@ +#ident @(#)os-beos.def 1.1 98/12/02 +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Global os definitions for BeOS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= bsd diff --git a/scsilib/RULES/os-beos.id b/scsilib/RULES/os-beos.id new file mode 100644 index 0000000..ac9c527 --- /dev/null +++ b/scsilib/RULES/os-beos.id @@ -0,0 +1,24 @@ +#ident @(#)os-beos.id 1.1 98/12/02 +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for BeOS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= beos +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-bsd-os.def b/scsilib/RULES/os-bsd-os.def new file mode 100644 index 0000000..f107264 --- /dev/null +++ b/scsilib/RULES/os-bsd-os.def @@ -0,0 +1,23 @@ +#ident "@(#)os-bsd-os.def 1.1 98/09/27 " +########################################################################### +# Written 1998 by J. Schilling +########################################################################### +# +# Global os definitions for BSD/OS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= bsd diff --git a/scsilib/RULES/os-bsd-os.id b/scsilib/RULES/os-bsd-os.id new file mode 100644 index 0000000..7654ceb --- /dev/null +++ b/scsilib/RULES/os-bsd-os.id @@ -0,0 +1,25 @@ +#ident "@(#)os-bsd-os.id 1.2 03/01/15 " +########################################################################### +# Written 1998 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for BSD/OS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +_O_ARCH= $(OSREL:3.%=bsd-os3) +O_ARCH= $(_O_ARCH:4.%=bsd-os) +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-bsd-os3.def b/scsilib/RULES/os-bsd-os3.def new file mode 100644 index 0000000..f107264 --- /dev/null +++ b/scsilib/RULES/os-bsd-os3.def @@ -0,0 +1,23 @@ +#ident "@(#)os-bsd-os.def 1.1 98/09/27 " +########################################################################### +# Written 1998 by J. Schilling +########################################################################### +# +# Global os definitions for BSD/OS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= bsd diff --git a/scsilib/RULES/os-cygwin32_nt.def b/scsilib/RULES/os-cygwin32_nt.def new file mode 100644 index 0000000..19fa64c --- /dev/null +++ b/scsilib/RULES/os-cygwin32_nt.def @@ -0,0 +1,24 @@ +#ident "@(#)os-cygwin32_nt.def 1.1 98/08/18 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Global os definitions for CYGWIN32_NT +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= bsd + diff --git a/scsilib/RULES/os-cygwin32_nt.id b/scsilib/RULES/os-cygwin32_nt.id new file mode 100644 index 0000000..af39cec --- /dev/null +++ b/scsilib/RULES/os-cygwin32_nt.id @@ -0,0 +1,24 @@ +#ident "@(#)os-cygwin32_nt.id 1.1 98/08/18 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for Cygnus GCC for MS Windows NT +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= cygwin32_nt +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-cygwin_95-4.0.id b/scsilib/RULES/os-cygwin_95-4.0.id new file mode 100644 index 0000000..af39cec --- /dev/null +++ b/scsilib/RULES/os-cygwin_95-4.0.id @@ -0,0 +1,24 @@ +#ident "@(#)os-cygwin32_nt.id 1.1 98/08/18 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for Cygnus GCC for MS Windows NT +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= cygwin32_nt +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-cygwin_98-4.0.id b/scsilib/RULES/os-cygwin_98-4.0.id new file mode 100644 index 0000000..af39cec --- /dev/null +++ b/scsilib/RULES/os-cygwin_98-4.0.id @@ -0,0 +1,24 @@ +#ident "@(#)os-cygwin32_nt.id 1.1 98/08/18 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for Cygnus GCC for MS Windows NT +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= cygwin32_nt +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-cygwin_98-4.10.id b/scsilib/RULES/os-cygwin_98-4.10.id new file mode 100644 index 0000000..af39cec --- /dev/null +++ b/scsilib/RULES/os-cygwin_98-4.10.id @@ -0,0 +1,24 @@ +#ident "@(#)os-cygwin32_nt.id 1.1 98/08/18 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for Cygnus GCC for MS Windows NT +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= cygwin32_nt +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-cygwin_me-4.90.id b/scsilib/RULES/os-cygwin_me-4.90.id new file mode 100644 index 0000000..af39cec --- /dev/null +++ b/scsilib/RULES/os-cygwin_me-4.90.id @@ -0,0 +1,24 @@ +#ident "@(#)os-cygwin32_nt.id 1.1 98/08/18 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for Cygnus GCC for MS Windows NT +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= cygwin32_nt +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-cygwin_nt-4.0.id b/scsilib/RULES/os-cygwin_nt-4.0.id new file mode 100644 index 0000000..af39cec --- /dev/null +++ b/scsilib/RULES/os-cygwin_nt-4.0.id @@ -0,0 +1,24 @@ +#ident "@(#)os-cygwin32_nt.id 1.1 98/08/18 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for Cygnus GCC for MS Windows NT +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= cygwin32_nt +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-cygwin_nt-5.0.id b/scsilib/RULES/os-cygwin_nt-5.0.id new file mode 100644 index 0000000..af39cec --- /dev/null +++ b/scsilib/RULES/os-cygwin_nt-5.0.id @@ -0,0 +1,24 @@ +#ident "@(#)os-cygwin32_nt.id 1.1 98/08/18 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for Cygnus GCC for MS Windows NT +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= cygwin32_nt +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-cygwin_nt-5.1.id b/scsilib/RULES/os-cygwin_nt-5.1.id new file mode 100644 index 0000000..af39cec --- /dev/null +++ b/scsilib/RULES/os-cygwin_nt-5.1.id @@ -0,0 +1,24 @@ +#ident "@(#)os-cygwin32_nt.id 1.1 98/08/18 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for Cygnus GCC for MS Windows NT +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= cygwin32_nt +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-darwin.def b/scsilib/RULES/os-darwin.def new file mode 100644 index 0000000..9e70b5e --- /dev/null +++ b/scsilib/RULES/os-darwin.def @@ -0,0 +1,23 @@ +#ident "@(#)os-darwin.def 1.1 01/02/15 " +########################################################################### +# Written 2001 by J. Schilling +########################################################################### +# +# Global definitions for Mac OS X (Darwin) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= bsd diff --git a/scsilib/RULES/os-darwin.id b/scsilib/RULES/os-darwin.id new file mode 100644 index 0000000..34bd2d8 --- /dev/null +++ b/scsilib/RULES/os-darwin.id @@ -0,0 +1,24 @@ +#ident "@(#)os-darwin.id 1.1 01/02/15 " +########################################################################### +# Written 2001 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for Mac OS X (Darwin) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= darwin +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-dgux.id b/scsilib/RULES/os-dgux.id new file mode 100644 index 0000000..214f096 --- /dev/null +++ b/scsilib/RULES/os-dgux.id @@ -0,0 +1,25 @@ +#ident "@(#)os-dgux.id 1.1 97/01/18 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for DGUX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +_O_ARCH= $(OSREL:r4.%=dgux4) +O_ARCH= $(_O_ARCH:5.4r3%=dgux3) +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-dgux3.def b/scsilib/RULES/os-dgux3.def new file mode 100644 index 0000000..30273cc --- /dev/null +++ b/scsilib/RULES/os-dgux3.def @@ -0,0 +1,23 @@ +#ident "@(#)os-dgux3.def 1.2 97/02/11 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Global os definitions for DGUX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= sysv diff --git a/scsilib/RULES/os-dgux4.def b/scsilib/RULES/os-dgux4.def new file mode 100644 index 0000000..723f3b2 --- /dev/null +++ b/scsilib/RULES/os-dgux4.def @@ -0,0 +1,23 @@ +#ident "@(#)os-dgux4.def 1.2 97/02/11 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Global os definitions for DGUX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= sysv diff --git a/scsilib/RULES/os-domainos.def b/scsilib/RULES/os-domainos.def new file mode 100644 index 0000000..23f678f --- /dev/null +++ b/scsilib/RULES/os-domainos.def @@ -0,0 +1,25 @@ +#ident "@(#)os-domainos.def 1.1 01/02/18 " +########################################################################### +# Written 2001 by J. Schilling +########################################################################### +# +# Global os definitions for Apollo Domain/OS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +# Domain/OS uses it's own style, so let's use SVSv. +########################################################################### +MANSTYLE= sysv diff --git a/scsilib/RULES/os-domainos.id b/scsilib/RULES/os-domainos.id new file mode 100644 index 0000000..5bc0c36 --- /dev/null +++ b/scsilib/RULES/os-domainos.id @@ -0,0 +1,24 @@ +#ident "@(#)os-domainos.id 1.1 01/02/18 " +########################################################################### +# Written 2001 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for Apollo Domain/OS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= domainos +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-freebsd.def b/scsilib/RULES/os-freebsd.def new file mode 100644 index 0000000..ea93a7f --- /dev/null +++ b/scsilib/RULES/os-freebsd.def @@ -0,0 +1,23 @@ +#ident "@(#)os-freebsd.def 1.1 97/02/11 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Global os definitions for FreeBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= bsd diff --git a/scsilib/RULES/os-freebsd.id b/scsilib/RULES/os-freebsd.id new file mode 100644 index 0000000..d146efa --- /dev/null +++ b/scsilib/RULES/os-freebsd.id @@ -0,0 +1,24 @@ +#ident "@(#)os-freebsd.id 1.1 97/02/11 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for FreeBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= freebsd +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-gnu.def b/scsilib/RULES/os-gnu.def new file mode 100644 index 0000000..d899e60 --- /dev/null +++ b/scsilib/RULES/os-gnu.def @@ -0,0 +1,23 @@ +#ident "@(#)os-gnu.def 1.1 02/05/21 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Global os definitions for GNU (hurd) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= bsd diff --git a/scsilib/RULES/os-gnu.id b/scsilib/RULES/os-gnu.id new file mode 100644 index 0000000..8bf6216 --- /dev/null +++ b/scsilib/RULES/os-gnu.id @@ -0,0 +1,24 @@ +#ident "@(#)os-gnu.id 1.1 02/05/21 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for GNU (hurd) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= gnu +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-hp-ux.def b/scsilib/RULES/os-hp-ux.def new file mode 100644 index 0000000..c95b882 --- /dev/null +++ b/scsilib/RULES/os-hp-ux.def @@ -0,0 +1,23 @@ +#ident "@(#)os-hp-ux.def 1.2 97/02/11 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Global os definitions for HP-UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= sysv diff --git a/scsilib/RULES/os-hp-ux.id b/scsilib/RULES/os-hp-ux.id new file mode 100644 index 0000000..872c19f --- /dev/null +++ b/scsilib/RULES/os-hp-ux.id @@ -0,0 +1,24 @@ +#ident "@(#)os-hp-ux.id 1.1 97/01/18 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for HP/UX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= hp-ux +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-irix.def b/scsilib/RULES/os-irix.def new file mode 100644 index 0000000..46653d1 --- /dev/null +++ b/scsilib/RULES/os-irix.def @@ -0,0 +1,23 @@ +#ident "@(#)os-irix.def 1.2 97/02/11 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Global os definitions for IRIX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= bsd diff --git a/scsilib/RULES/os-irix.id b/scsilib/RULES/os-irix.id new file mode 100644 index 0000000..05cd817 --- /dev/null +++ b/scsilib/RULES/os-irix.id @@ -0,0 +1,24 @@ +#ident "@(#)os-irix.id 1.1 97/01/18 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for Silicon Graphics IRIX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= irix +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-irix64.id b/scsilib/RULES/os-irix64.id new file mode 100644 index 0000000..05cd817 --- /dev/null +++ b/scsilib/RULES/os-irix64.id @@ -0,0 +1,24 @@ +#ident "@(#)os-irix.id 1.1 97/01/18 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for Silicon Graphics IRIX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= irix +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-linux.def b/scsilib/RULES/os-linux.def new file mode 100644 index 0000000..194d300 --- /dev/null +++ b/scsilib/RULES/os-linux.def @@ -0,0 +1,23 @@ +#ident "@(#)os-linux.def 1.2 97/02/11 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Global os definitions for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= bsd diff --git a/scsilib/RULES/os-linux.id b/scsilib/RULES/os-linux.id new file mode 100644 index 0000000..4ad54f3 --- /dev/null +++ b/scsilib/RULES/os-linux.id @@ -0,0 +1,24 @@ +#ident "@(#)os-linux.id 1.1 97/01/18 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= linux +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-mac-os.id b/scsilib/RULES/os-mac-os.id new file mode 100644 index 0000000..f164c47 --- /dev/null +++ b/scsilib/RULES/os-mac-os.id @@ -0,0 +1,25 @@ +#ident "@(#)os-mac-os.id 1.1 00/03/29 " +########################################################################### +# Written 2000 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for Mac OS X +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +_O_ARCH= $(OSREL:9.%=mac-os9) +O_ARCH= $(_O_ARCH:10.%=mac-os10) +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-mac-os10.def b/scsilib/RULES/os-mac-os10.def new file mode 100644 index 0000000..52ec66a --- /dev/null +++ b/scsilib/RULES/os-mac-os10.def @@ -0,0 +1,23 @@ +#ident "@(#)os-mac-os10.def 1.1 00/03/29 " +########################################################################### +# Written 2000 by J. Schilling +########################################################################### +# +# Global os definitions for Mac OS X +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= bsd diff --git a/scsilib/RULES/os-mingw32_95-4.0.id b/scsilib/RULES/os-mingw32_95-4.0.id new file mode 100644 index 0000000..611eca1 --- /dev/null +++ b/scsilib/RULES/os-mingw32_95-4.0.id @@ -0,0 +1,22 @@ +#ident "@(#)os-mingw_95-4.0.id 1.1 04/07/10 " +########################################################################### +# +# OS specific MACRO definitions for Win32/Mingw32 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +O_ARCH= mingw32_nt +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-mingw32_98-4.0.id b/scsilib/RULES/os-mingw32_98-4.0.id new file mode 100644 index 0000000..1d1f71a --- /dev/null +++ b/scsilib/RULES/os-mingw32_98-4.0.id @@ -0,0 +1,22 @@ +#ident "@(#)os-mingw_98-4.0.id 1.1 04/07/10 " +########################################################################### +# +# OS specific MACRO definitions for Win32/Mingw32 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +O_ARCH= mingw32_nt +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-mingw32_98-4.10.id b/scsilib/RULES/os-mingw32_98-4.10.id new file mode 100644 index 0000000..73dead8 --- /dev/null +++ b/scsilib/RULES/os-mingw32_98-4.10.id @@ -0,0 +1,22 @@ +#ident "@(#)os-mingw_98-4.10.id 1.1 04/07/10 " +########################################################################### +# +# OS specific MACRO definitions for Win32/Mingw32 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +O_ARCH= mingw32_nt +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-mingw32_me-4.90.id b/scsilib/RULES/os-mingw32_me-4.90.id new file mode 100644 index 0000000..17e33a6 --- /dev/null +++ b/scsilib/RULES/os-mingw32_me-4.90.id @@ -0,0 +1,22 @@ +#ident "@(#)os-mingw_me-4.90.id 1.1 04/07/10 " +########################################################################### +# +# OS specific MACRO definitions for Win32/Mingw32 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +O_ARCH= mingw32_nt +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-mingw32_nt-4.0.id b/scsilib/RULES/os-mingw32_nt-4.0.id new file mode 100644 index 0000000..9ae53cb --- /dev/null +++ b/scsilib/RULES/os-mingw32_nt-4.0.id @@ -0,0 +1,22 @@ +#ident "@(#)os-mingw32_nt-4.0.id 1.1 04/07/10 " +########################################################################### +# +# OS specific MACRO definitions for Win32/Mingw32 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +O_ARCH= mingw32_nt +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-mingw32_nt-5.0.id b/scsilib/RULES/os-mingw32_nt-5.0.id new file mode 100644 index 0000000..16a9a8d --- /dev/null +++ b/scsilib/RULES/os-mingw32_nt-5.0.id @@ -0,0 +1,22 @@ +#ident "@(#)os-mingw32_nt-5.0.id 1.1 04/07/10 " +########################################################################### +# +# OS specific MACRO definitions for Win32/Mingw32 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +O_ARCH= mingw32_nt +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-mingw32_nt-5.1.id b/scsilib/RULES/os-mingw32_nt-5.1.id new file mode 100644 index 0000000..47690a6 --- /dev/null +++ b/scsilib/RULES/os-mingw32_nt-5.1.id @@ -0,0 +1,22 @@ +#ident "@(#)os-mingw32_nt-5.1.id 1.1 04/07/10 " +########################################################################### +# +# OS specific MACRO definitions for Win32/Mingw32 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +O_ARCH= mingw32_nt +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-mingw32_nt-5.2.id b/scsilib/RULES/os-mingw32_nt-5.2.id new file mode 100644 index 0000000..76fe52a --- /dev/null +++ b/scsilib/RULES/os-mingw32_nt-5.2.id @@ -0,0 +1,22 @@ +#ident "@(#)os-mingw32_nt-5.2.id 1.1 04/07/10 " +########################################################################### +# +# OS specific MACRO definitions for Win32/Mingw32 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +O_ARCH= mingw32_nt +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-mingw32_nt.def b/scsilib/RULES/os-mingw32_nt.def new file mode 100644 index 0000000..bac65e6 --- /dev/null +++ b/scsilib/RULES/os-mingw32_nt.def @@ -0,0 +1,21 @@ +#ident "@(#)os-mingw32_nt.def 1.1 04/07/10 " +########################################################################### +# +# Global os definitions for Win32/Mingw32 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +MANSTYLE= bsd diff --git a/scsilib/RULES/os-mingw32_nt.id b/scsilib/RULES/os-mingw32_nt.id new file mode 100644 index 0000000..8fa76a1 --- /dev/null +++ b/scsilib/RULES/os-mingw32_nt.id @@ -0,0 +1,22 @@ +#ident "@(#)os-mingw32_nt.id 1.1 04/07/10 " +########################################################################### +# +# OS specific MACRO definitions for Win32/Mingw32 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +O_ARCH= mingw32_nt +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-ms-dos.def b/scsilib/RULES/os-ms-dos.def new file mode 100644 index 0000000..de852a2 --- /dev/null +++ b/scsilib/RULES/os-ms-dos.def @@ -0,0 +1,21 @@ +#ident "@(#)os-ms-dos.def 1.1 03/11/23 " +########################################################################### +# +# Global os definitions for MS-DOS/DJGPP v2 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +MANSTYLE= sysv diff --git a/scsilib/RULES/os-ms-dos.id b/scsilib/RULES/os-ms-dos.id new file mode 100644 index 0000000..138ccee --- /dev/null +++ b/scsilib/RULES/os-ms-dos.id @@ -0,0 +1,22 @@ +#ident "@(#)os-ms-dos.id 1.1 03/11/23 " +########################################################################### +# +# OS specific MACRO definitions for MS-DOS/DJGPP v2 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +O_ARCH= ms-dos +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-netbsd.def b/scsilib/RULES/os-netbsd.def new file mode 100644 index 0000000..413dfe0 --- /dev/null +++ b/scsilib/RULES/os-netbsd.def @@ -0,0 +1,23 @@ +#ident "@(#)os-netbsd.def 1.1 97/02/11 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Global os definitions for NetBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= bsd diff --git a/scsilib/RULES/os-netbsd.id b/scsilib/RULES/os-netbsd.id new file mode 100644 index 0000000..6fb650d --- /dev/null +++ b/scsilib/RULES/os-netbsd.id @@ -0,0 +1,24 @@ +#ident "@(#)os-netbsd.id 1.1 97/02/11 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for NetBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= netbsd +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-news-os.id b/scsilib/RULES/os-news-os.id new file mode 100644 index 0000000..6c59047 --- /dev/null +++ b/scsilib/RULES/os-news-os.id @@ -0,0 +1,23 @@ +#ident @(#)os-news-os.id 1.1 98/12/06 +########################################################################### +# +# OS specific MACRO definitions for Sony NEWS-OS 6.x +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +_O_ARCH= $(OSREL:5.%=newsos5) +O_ARCH= $(_O_ARCH:6.%=newsos6) +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-newsos6.def b/scsilib/RULES/os-newsos6.def new file mode 100644 index 0000000..c9480c7 --- /dev/null +++ b/scsilib/RULES/os-newsos6.def @@ -0,0 +1,21 @@ +#ident @(#)os-newsos6.def 1.1 98/12/06 +########################################################################### +# +# Global os definitions for Sony NEWS-OS 6.x +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= sysv diff --git a/scsilib/RULES/os-nextstep.def b/scsilib/RULES/os-nextstep.def new file mode 100644 index 0000000..014300c --- /dev/null +++ b/scsilib/RULES/os-nextstep.def @@ -0,0 +1,23 @@ +#ident "@(#)os-nextstep.def 1.1 98/11/01 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Global os definitions for NeXT Step +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= bsd diff --git a/scsilib/RULES/os-nextstep.id b/scsilib/RULES/os-nextstep.id new file mode 100644 index 0000000..6ccfb3d --- /dev/null +++ b/scsilib/RULES/os-nextstep.id @@ -0,0 +1,24 @@ +#ident "@(#)os-nextstep.id 1.1 98/11/01 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for NeXT Step +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= nextstep +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-openbsd.def b/scsilib/RULES/os-openbsd.def new file mode 100644 index 0000000..6ce9a48 --- /dev/null +++ b/scsilib/RULES/os-openbsd.def @@ -0,0 +1,23 @@ +#ident "@(#)os-openbsd.def 1.2 97/07/08 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Global os definitions for OpenBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= bsd diff --git a/scsilib/RULES/os-openbsd.id b/scsilib/RULES/os-openbsd.id new file mode 100644 index 0000000..132c1cb --- /dev/null +++ b/scsilib/RULES/os-openbsd.id @@ -0,0 +1,24 @@ +#ident "@(#)os-openbsd.id 1.2 97/07/08 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for OpenBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= openbsd +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-openserver.def b/scsilib/RULES/os-openserver.def new file mode 100644 index 0000000..e94c047 --- /dev/null +++ b/scsilib/RULES/os-openserver.def @@ -0,0 +1,23 @@ +#ident "@(#)os-openserver.def 1.1 00/01/23 " +########################################################################### +# Written 1999 by J. Schilling/Santa Cruz Operation +########################################################################### +# +# Global os definitions for SCO OpenServer 5 Systems +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= sysv diff --git a/scsilib/RULES/os-openunix.id b/scsilib/RULES/os-openunix.id new file mode 100644 index 0000000..011dbba --- /dev/null +++ b/scsilib/RULES/os-openunix.id @@ -0,0 +1,24 @@ +#ident "@(#)os-unixware.id 1.1 00/01/23 " +########################################################################### +# Written 2000 by J. Schilling/Santa Cruz Operation +########################################################################### +# +# OS specific MACRO definitions for UnixWare 7 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= unixware +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-os-2.id b/scsilib/RULES/os-os-2.id new file mode 100644 index 0000000..3ec68f1 --- /dev/null +++ b/scsilib/RULES/os-os-2.id @@ -0,0 +1,24 @@ +#ident "@(#)os-os-2.id 1.1 99/08/28 " +########################################################################### +# Written 1999 by C. Wohlgemuth +########################################################################### +# +# OS specific MACRO definitions for OS/2 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= os2 +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-os2.def b/scsilib/RULES/os-os2.def new file mode 100644 index 0000000..0e88b26 --- /dev/null +++ b/scsilib/RULES/os-os2.def @@ -0,0 +1,23 @@ +#ident "@(#)os-os2.def 1.1 99/08/28 " +########################################################################### +# Written 1998 by C. Wohlgemuth +########################################################################### +# +# Global os definitions for OS/2 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= bsd diff --git a/scsilib/RULES/os-osf1.def b/scsilib/RULES/os-osf1.def new file mode 100644 index 0000000..f635795 --- /dev/null +++ b/scsilib/RULES/os-osf1.def @@ -0,0 +1,23 @@ +#ident "@(#)os-osf1.def 1.1 98/08/22 " +########################################################################### +# Written 1998 by J. Schilling +########################################################################### +# +# Global os definitions for Digital UNIX (OSF1) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= bsd diff --git a/scsilib/RULES/os-osf1.id b/scsilib/RULES/os-osf1.id new file mode 100644 index 0000000..8562769 --- /dev/null +++ b/scsilib/RULES/os-osf1.id @@ -0,0 +1,24 @@ +#ident "@(#)os-osf1.id 1.1 98/08/22 " +########################################################################### +# Written 1998 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for Digital UNIX (OSF1) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= osf1 +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-qnx.def b/scsilib/RULES/os-qnx.def new file mode 100644 index 0000000..6929bdc --- /dev/null +++ b/scsilib/RULES/os-qnx.def @@ -0,0 +1,23 @@ +#ident "@(#)os-qnx.def 1.1 99/12/20 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Global os definitions for QNX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= sysv diff --git a/scsilib/RULES/os-qnx.id b/scsilib/RULES/os-qnx.id new file mode 100644 index 0000000..a7cfe4c --- /dev/null +++ b/scsilib/RULES/os-qnx.id @@ -0,0 +1,24 @@ +#ident "@(#)os-qnx.id 1.1 99/12/20 " +########################################################################### +# Written 1998 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for QNX +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= qnx +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-rhapsody.def b/scsilib/RULES/os-rhapsody.def new file mode 100644 index 0000000..bb7a32e --- /dev/null +++ b/scsilib/RULES/os-rhapsody.def @@ -0,0 +1,23 @@ +#ident "@(#)os-rhapsody.def 1.1 98/11/01 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Global definitions for NeXT Step (Apple Rhapsody) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= bsd diff --git a/scsilib/RULES/os-rhapsody.id b/scsilib/RULES/os-rhapsody.id new file mode 100644 index 0000000..e23ecc8 --- /dev/null +++ b/scsilib/RULES/os-rhapsody.id @@ -0,0 +1,24 @@ +#ident "@(#)os-rhapsody.id 1.1 98/11/01 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for NeXT Step (Apple Rhapsody) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= rhapsody +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-sco_sv.id b/scsilib/RULES/os-sco_sv.id new file mode 100644 index 0000000..b574128 --- /dev/null +++ b/scsilib/RULES/os-sco_sv.id @@ -0,0 +1,24 @@ +#ident "@(#)os-sco_sv.id 1.1 00/01/23 " +########################################################################### +# Written 1999 by J. Schilling/Santa Cruz Operation +########################################################################### +# +# OS specific MACRO definitions for SCO OpenServer 5 Systems +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= openserver +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-sunos.id b/scsilib/RULES/os-sunos.id new file mode 100644 index 0000000..5bf9d9d --- /dev/null +++ b/scsilib/RULES/os-sunos.id @@ -0,0 +1,25 @@ +#ident "@(#)os-sunos.id 1.1 97/01/18 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# OS specific MACRO definitions for SunOS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +_O_ARCH= $(OSREL:4.%=sunos4) +O_ARCH= $(_O_ARCH:5.%=sunos5) +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-sunos4.def b/scsilib/RULES/os-sunos4.def new file mode 100644 index 0000000..f536046 --- /dev/null +++ b/scsilib/RULES/os-sunos4.def @@ -0,0 +1,23 @@ +#ident "@(#)os-sunos4.def 1.2 97/02/11 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Global os definitions for SunOS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= bsd diff --git a/scsilib/RULES/os-sunos5.def b/scsilib/RULES/os-sunos5.def new file mode 100644 index 0000000..14004e5 --- /dev/null +++ b/scsilib/RULES/os-sunos5.def @@ -0,0 +1,23 @@ +#ident "@(#)os-sunos5.def 1.2 97/02/11 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Global os definitions for Solaris +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= sysv diff --git a/scsilib/RULES/os-unix_sv.id b/scsilib/RULES/os-unix_sv.id new file mode 100644 index 0000000..0b479e0 --- /dev/null +++ b/scsilib/RULES/os-unix_sv.id @@ -0,0 +1,24 @@ +#ident "@(#)os-unix_sv.id 1.1 00/01/23 " +########################################################################### +# Written 1999 by J. Schilling/Santa Cruz Operation +########################################################################### +# +# OS specific MACRO definitions for UnixWare 2 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= unixware +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/os-unixware.def b/scsilib/RULES/os-unixware.def new file mode 100644 index 0000000..7104919 --- /dev/null +++ b/scsilib/RULES/os-unixware.def @@ -0,0 +1,23 @@ +#ident "@(#)os-unixware.def 1.1 00/01/23 " +########################################################################### +# Written 2000 by J. Schilling/Santa Cruz Operation +########################################################################### +# +# Global os definitions for UnixWare 7 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MANSTYLE= sysv diff --git a/scsilib/RULES/os-unixware.id b/scsilib/RULES/os-unixware.id new file mode 100644 index 0000000..011dbba --- /dev/null +++ b/scsilib/RULES/os-unixware.id @@ -0,0 +1,24 @@ +#ident "@(#)os-unixware.id 1.1 00/01/23 " +########################################################################### +# Written 2000 by J. Schilling/Santa Cruz Operation +########################################################################### +# +# OS specific MACRO definitions for UnixWare 7 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +O_ARCH= unixware +-O_ARCH= -$(O_ARCH) diff --git a/scsilib/RULES/parisc-linux-cc.rul b/scsilib/RULES/parisc-linux-cc.rul new file mode 100644 index 0000000..e1dbbe6 --- /dev/null +++ b/scsilib/RULES/parisc-linux-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-cc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/parisc-linux-gcc.rul b/scsilib/RULES/parisc-linux-gcc.rul new file mode 100644 index 0000000..b0c8042 --- /dev/null +++ b/scsilib/RULES/parisc-linux-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/parisc64-linux-cc.rul b/scsilib/RULES/parisc64-linux-cc.rul new file mode 100644 index 0000000..e1dbbe6 --- /dev/null +++ b/scsilib/RULES/parisc64-linux-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-cc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/parisc64-linux-gcc.rul b/scsilib/RULES/parisc64-linux-gcc.rul new file mode 100644 index 0000000..b0c8042 --- /dev/null +++ b/scsilib/RULES/parisc64-linux-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/pci-qnx-cc.rul b/scsilib/RULES/pci-qnx-cc.rul new file mode 100644 index 0000000..b7a67c2 --- /dev/null +++ b/scsilib/RULES/pci-qnx-cc.rul @@ -0,0 +1,75 @@ +#ident "@(#)pci-qnx-cc.rul 1.3 00/01/06 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for unknown systems systems with dumb cc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= +# +# Switch optimizing on if your compiler supports it +#COPTOPT= -O +COPTOPT= +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) + +# Set Stack size to 256k +LDOPTS= $(LIBS_PATH) $(LDPATH) -N 256k +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +#MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); echo "Cannot do -M with unknown cc"; : +MKDEP_OUT= diff --git a/scsilib/RULES/pentium-iii-unixware-cc.rul b/scsilib/RULES/pentium-iii-unixware-cc.rul new file mode 100644 index 0000000..116d798 --- /dev/null +++ b/scsilib/RULES/pentium-iii-unixware-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-unixware-cc.rul 1.4 03/05/31 " +########################################################################### +# Written 1999 by J. Schilling/Santa Cruz Operation +########################################################################### +# +# Platform dependent MACROS for SCO UnixWare 2.x / 7.x using cc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +OSDEFS= -DUNIXWARE -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -v +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -KPIC +#COPTGPROF= -pg +COPTGPROF= -p + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -dy -G $(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true + +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); sh $(SRCROOT)/conf/mkdep-sco.sh +MKDEP_OUT= diff --git a/scsilib/RULES/pentium-iii-unixware-gcc.rul b/scsilib/RULES/pentium-iii-unixware-gcc.rul new file mode 100644 index 0000000..c59ea75 --- /dev/null +++ b/scsilib/RULES/pentium-iii-unixware-gcc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-unixware-gcc.rul 1.2 02/10/15 " +########################################################################### +# Written 1999 by J. Schilling/Santa Cruz Operation +########################################################################### +# +# Platform dependent MACROS for SCO UnixWare 2.x / 7.x using gcc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -DUNIXWARE -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -dy -G $(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true + +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/pentium-pro-unixware-cc.rul b/scsilib/RULES/pentium-pro-unixware-cc.rul new file mode 100644 index 0000000..116d798 --- /dev/null +++ b/scsilib/RULES/pentium-pro-unixware-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-unixware-cc.rul 1.4 03/05/31 " +########################################################################### +# Written 1999 by J. Schilling/Santa Cruz Operation +########################################################################### +# +# Platform dependent MACROS for SCO UnixWare 2.x / 7.x using cc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +OSDEFS= -DUNIXWARE -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -v +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -KPIC +#COPTGPROF= -pg +COPTGPROF= -p + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -dy -G $(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true + +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); sh $(SRCROOT)/conf/mkdep-sco.sh +MKDEP_OUT= diff --git a/scsilib/RULES/pentium-pro-unixware-gcc.rul b/scsilib/RULES/pentium-pro-unixware-gcc.rul new file mode 100644 index 0000000..c59ea75 --- /dev/null +++ b/scsilib/RULES/pentium-pro-unixware-gcc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-unixware-gcc.rul 1.2 02/10/15 " +########################################################################### +# Written 1999 by J. Schilling/Santa Cruz Operation +########################################################################### +# +# Platform dependent MACROS for SCO UnixWare 2.x / 7.x using gcc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -DUNIXWARE -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -dy -G $(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true + +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/power-macintosh-darwin-cc.rul b/scsilib/RULES/power-macintosh-darwin-cc.rul new file mode 100644 index 0000000..57242ab --- /dev/null +++ b/scsilib/RULES/power-macintosh-darwin-cc.rul @@ -0,0 +1,78 @@ +#ident "@(#)power-macintosh-darwin-cc.rul 1.7 02/10/17 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Darwin-1.2 ff. (Apple MacOS X) PPC (GCC) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) -framework IOKit -framework CoreFoundation +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +# +# lorder seems not to work on some versions because Apple installed +# a broken /bin/sh that is not POSIX cimpliant an will not +# be able to run the /usr/bin/lorder script. The error messages are: +# type: not found +# type: not found +# lorder: nm: not found +# ... disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= diff --git a/scsilib/RULES/power-macintosh-darwin-gcc.rul b/scsilib/RULES/power-macintosh-darwin-gcc.rul new file mode 100644 index 0000000..ad9c380 --- /dev/null +++ b/scsilib/RULES/power-macintosh-darwin-gcc.rul @@ -0,0 +1,78 @@ +#ident "@(#)power-macintosh-darwin-gcc.rul 1.7 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Darwin-1.2 ff. (Apple MacOS X) PPC (GCC) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) -framework IOKit -framework CoreFoundation +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +# +# lorder seems not to work on some versions because Apple installed +# a broken /bin/sh that is not POSIX cimpliant an will not +# be able to run the /usr/bin/lorder script. The error messages are: +# type: not found +# type: not found +# lorder: nm: not found +# ... disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/power-macintosh-mac-os10-cc.rul b/scsilib/RULES/power-macintosh-mac-os10-cc.rul new file mode 100644 index 0000000..efa608e --- /dev/null +++ b/scsilib/RULES/power-macintosh-mac-os10-cc.rul @@ -0,0 +1,78 @@ +#ident "@(#)power-macintosh-rhapsody-cc.rul 1.6 02/10/17 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NeXT Step 4.x (Apple Rhapsody) PPC (GCC) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +# +# lorder seems not to work on some versions because Apple installed +# a broken /bin/sh that is not POSIX cimpliant an will not +# be able to run the /usr/bin/lorder script. The error messages are: +# type: not found +# type: not found +# lorder: nm: not found +# ... disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= diff --git a/scsilib/RULES/power-macintosh-mac-os10-gcc.rul b/scsilib/RULES/power-macintosh-mac-os10-gcc.rul new file mode 100644 index 0000000..aeddfee --- /dev/null +++ b/scsilib/RULES/power-macintosh-mac-os10-gcc.rul @@ -0,0 +1,78 @@ +#ident "@(#)power-macintosh-rhapsody-gcc.rul 1.6 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NeXT Step 4.x (Apple Rhapsody) PPC (GCC) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +# +# lorder seems not to work on some versions because Apple installed +# a broken /bin/sh that is not POSIX cimpliant an will not +# be able to run the /usr/bin/lorder script. The error messages are: +# type: not found +# type: not found +# lorder: nm: not found +# ... disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/power-macintosh-rhapsody-cc.rul b/scsilib/RULES/power-macintosh-rhapsody-cc.rul new file mode 100644 index 0000000..efa608e --- /dev/null +++ b/scsilib/RULES/power-macintosh-rhapsody-cc.rul @@ -0,0 +1,78 @@ +#ident "@(#)power-macintosh-rhapsody-cc.rul 1.6 02/10/17 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NeXT Step 4.x (Apple Rhapsody) PPC (GCC) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +# +# lorder seems not to work on some versions because Apple installed +# a broken /bin/sh that is not POSIX cimpliant an will not +# be able to run the /usr/bin/lorder script. The error messages are: +# type: not found +# type: not found +# lorder: nm: not found +# ... disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= diff --git a/scsilib/RULES/power-macintosh-rhapsody-gcc.rul b/scsilib/RULES/power-macintosh-rhapsody-gcc.rul new file mode 100644 index 0000000..aeddfee --- /dev/null +++ b/scsilib/RULES/power-macintosh-rhapsody-gcc.rul @@ -0,0 +1,78 @@ +#ident "@(#)power-macintosh-rhapsody-gcc.rul 1.6 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NeXT Step 4.x (Apple Rhapsody) PPC (GCC) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +# +# lorder seems not to work on some versions because Apple installed +# a broken /bin/sh that is not POSIX cimpliant an will not +# be able to run the /usr/bin/lorder script. The error messages are: +# type: not found +# type: not found +# lorder: nm: not found +# ... disable it +# +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/powerpc-beos-gcc.rul b/scsilib/RULES/powerpc-beos-gcc.rul new file mode 100644 index 0000000..84d96f9 --- /dev/null +++ b/scsilib/RULES/powerpc-beos-gcc.rul @@ -0,0 +1,81 @@ +#ident "@(#)powerpc-beos-gcc.rul 1.3 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for BeOS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +# +# XXX Old BeOS needs libroot.so to get [efg]cvt() +# XXX New BeOS seems to have this in libc and in addition we include +# XXX strtod.c for floating point conversion on OS without such code. +# XXX For this reason, -DNO_FLOATINGPOINT -DUSE_FLOATINGARGS has been +# XXX removed and printing floating numbers will work with old/new BeOS +# +#OSDEFS += -DNO_FLOATINGPOINT -DUSE_FLOATINGARGS + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +#CONFFLAGS= + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +#LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/powerpc-beos-mwcc.rul b/scsilib/RULES/powerpc-beos-mwcc.rul new file mode 100644 index 0000000..4012674 --- /dev/null +++ b/scsilib/RULES/powerpc-beos-mwcc.rul @@ -0,0 +1,79 @@ +#ident "@(#)powerpc-beos-mwcc.rul 1.4 02/10/17 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for BeOS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +# +# XXX Old BeOS needs libroot.so to get [efg]cvt() +# XXX New BeOS seems to have this in libc and in addition we include +# XXX strtod.c for floating point conversion on OS without such code. +# XXX For this reason, -DNO_FLOATINGPOINT -DUSE_FLOATINGARGS has been +# XXX removed and printing floating numbers will work with old/new BeOS +# +#OSDEFS += -DNO_FLOATINGPOINT -DUSE_FLOATINGARGS + +CPPOPTS= -relax_pointers -opt global -sym on -g -i- -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= +COPTOPT= -opt off +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= #-fpic +COPTGPROF= #-pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +#LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= -multidefs -sym on -g $(LIBS_PATH) $(LDPATH) +LDOPTDYN=# -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CCCOM= mwccppc +CC= @echo " ==> COMPILING \"$@\""; $(CCCOM) +LDCC= @echo " ==> LINKING \"$@\""; $(CCCOM) +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; $(CCCOM) +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(CCCOM) -make +MKDEP_OUT= diff --git a/scsilib/RULES/ppc-linux-cc.rul b/scsilib/RULES/ppc-linux-cc.rul new file mode 100644 index 0000000..e1dbbe6 --- /dev/null +++ b/scsilib/RULES/ppc-linux-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-cc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/ppc-linux-gcc.rul b/scsilib/RULES/ppc-linux-gcc.rul new file mode 100644 index 0000000..b0c8042 --- /dev/null +++ b/scsilib/RULES/ppc-linux-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/ppc64-linux-cc.rul b/scsilib/RULES/ppc64-linux-cc.rul new file mode 100644 index 0000000..e1dbbe6 --- /dev/null +++ b/scsilib/RULES/ppc64-linux-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-cc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/ppc64-linux-gcc.rul b/scsilib/RULES/ppc64-linux-gcc.rul new file mode 100644 index 0000000..b0c8042 --- /dev/null +++ b/scsilib/RULES/ppc64-linux-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/r-build.dep b/scsilib/RULES/r-build.dep new file mode 100644 index 0000000..623f94a --- /dev/null +++ b/scsilib/RULES/r-build.dep @@ -0,0 +1,73 @@ +#ident "@(#)r-smake.dep 1.8 02/10/11 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Dependency building rules for smake +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +DEP_SUFFIX= .d +RMDEP= $(RM) $(RM_FORCE) $(ARCHDIR)/$@ +DEP_FILE= $(CFILES:%.c=%.d) +PDEP_FILE= $(CFILES:%.c=$(ARCHDIR)/%.d) +PALLDEP_FILE= $(CFILES:%.c=$(ARCHDIR)/%.d) $(ARCHDIR)/$(TARGET).dep +########################################################################### +depend: rmdep $(DEP_FILE) + +rmdep: + $(RM) $(RM_FORCE) $(PALLDEP_FILE) + +########################################################################### +# +# Make the complete path to the architecture subdirectory. +# +########################################################################### +$(ARCHDIR): + $(MKDIR) -p $@ + +########################################################################### +# +# Generate dependency file(s). +# This rules is checked when the dependency file(s) are included. +# +# Modify the the path for .o files to reflect that they are placed in +# $(ARCHDIR). Add the dependency file itself to each line so that +# the dependencies will be rebuilt if a source is newer that the +# appropriate dependency file. +# +########################################################################### +.d: .c + $(MKDEP) $(CPPFLAGS) $(MKDEP_OUT) $< \ + | sed -e 's;^\(.*\)\.o[ ]*:;\1.o \1.d:;' > $(ARCHDIR)/$@ + +%.d: %.c + $(MKDEP) $(CPPFLAGS) $(MKDEP_OUT) $< \ + | sed -e 's;^\(.*\)\.o[ ]*:;\1.o \1.d:;' > $(ARCHDIR)/$@ + +Dnull: $(ARCHDIR) + @echo > $O/$@ + +#$(DEP_FILE): +# $(MKDEP) $(CPPFLAGS) -f - $(CFILES) \ +# | sed -e 's;^\(.*\.o[ ]*:\);$(ARCHDIR)/\1;' > $@ + +########################################################################### +# +# Include the dependency file(s) generated from the rules above. +# +########################################################################### +include Dnull $(DEP_FILE) diff --git a/scsilib/RULES/r-build.obj b/scsilib/RULES/r-build.obj new file mode 100644 index 0000000..bc47522 --- /dev/null +++ b/scsilib/RULES/r-build.obj @@ -0,0 +1,43 @@ +#ident @(#)r-smake.obj 1.4 99/11/01 +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Object building rules for smake +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +# This defines a rule that compiles source files from current directory and +# puts the resultant objects directly into $(ARCHDIR), +# to allow concurrent compilation on different platforms. +# Object file names are constructed from $(CFILES). +########################################################################### +ARCHDIRX= +OFILES= $(CFILES:%.c=%.o) +POFILES= $(CFILES:%.c=$(ARCHDIR)/%.o) +.OBJDIR: $(ARCHDIR) +########################################################################### + +.o: .c +# $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $O/$@ $< +%.o: %.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $O/$@ $< + +#$(ARCHDIR)/%.o: %.c +# $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(*F).c + +########################################################################### diff --git a/scsilib/RULES/r-build.tag b/scsilib/RULES/r-build.tag new file mode 100644 index 0000000..89ecd1d --- /dev/null +++ b/scsilib/RULES/r-build.tag @@ -0,0 +1,27 @@ +#ident "@(#)r-smake.tag 1.2 97/02/05 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Tag building rules for smake +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +TAGS: $(CFILES) $(HFILES) + $(ETAGS) $r1 + +tags: $(CFILES) $(HFILES) + $(CTAGS) -t $r1 diff --git a/scsilib/RULES/r-gmake.dep b/scsilib/RULES/r-gmake.dep new file mode 100644 index 0000000..1a155e8 --- /dev/null +++ b/scsilib/RULES/r-gmake.dep @@ -0,0 +1,76 @@ +#ident "@(#)r-gmake.dep 1.10 02/10/11 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Dependency building rules for gmake +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +DEP_SUFFIX= .d +RMDEP= $(RM) $(RM_FORCE) $@ +DEP_FILE= $(CFILES:%.c=%.d) +PDEP_FILE= $(CFILES:%.c=$(ARCHDIR)/%.d) +PALLDEP_FILE= $(CFILES:%.c=$(ARCHDIR)/%.d) $(ARCHDIR)/$(TARGET).dep +DEP_DEP= $(ARCHDIR)/Dnull +########################################################################### +depend: rmdep $(DEP_FILE) + +rmdep: + $(RM) $(RM_FORCE) $(PALLDEP_FILE) + +########################################################################### +# +# Make the complete path to the architecture subdirectory. +# +########################################################################### +$(ARCHDIR): + $(MKDIR) -p $@ + +########################################################################### +# +# Generate dependency file(s). +# This rules is checked when the dependency file(s) are included. +# +# Modify the the path for .o files to reflect that they are placed in +# $(ARCHDIR). Add the dependency file itself to each line so that +# the dependencies will be rebuilt if a source is newer that the +# appropriate dependency file. +# +########################################################################### +$(ARCHDIR)/%.d: %.c + $(MKDEP) $(CPPFLAGS) $(MKDEP_OUT) $< \ + | sed -e 's;^\(.*\)\.o[ ]*:;$(ARCHDIR)/\1.o \1.d:;' > $@ + +#$(DEP_FILE): $(DEP_DEP) $(CFILES) +# $(MKDEP) $(CPPFLAGS) $(MKDEP_OUT) $(^:%$(DEP_DEP)=%) \ +# | sed -e 's;^\(.*\)\.o[ ]*:;$(ARCHDIR)/\1.o $(DEP_FILE):;' > $@ + +$(PDEP_FILE): $(DEP_DEP) + +$(PDEP_FILE): $(DEP_DEP) + +$(DEP_DEP): $(ARCHDIR) + @if [ ! -f $@ ]; then \ + echo > $@; \ + fi + +########################################################################### +# +# Include the dependency file(s) generated from the rules above. +# +########################################################################### +include $(PDEP_FILE) diff --git a/scsilib/RULES/r-gmake.obj b/scsilib/RULES/r-gmake.obj new file mode 100644 index 0000000..a83f580 --- /dev/null +++ b/scsilib/RULES/r-gmake.obj @@ -0,0 +1,34 @@ +#ident @(#)r-make.obj 1.2 97/01/30 +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Object building rules for gmake +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +# This defines a rule that compiles source files from current directory and +# puts the resultant objects directly into $(ARCHDIR), +# to allow concurrent compilation on different platforms. +# Object file names are constructed from $(CFILES). +########################################################################### +ARCHDIRX= $(ARCHDIR)/ +OFILES= $(CFILES:%.c=$(ARCHDIR)/%.o) +POFILES= $(CFILES:%.c=$(ARCHDIR)/%.o) +########################################################################### +$(ARCHDIR)/%.o: %.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< +########################################################################### diff --git a/scsilib/RULES/r-gmake.tag b/scsilib/RULES/r-gmake.tag new file mode 100644 index 0000000..be3ed79 --- /dev/null +++ b/scsilib/RULES/r-gmake.tag @@ -0,0 +1,27 @@ +#ident "@(#)r-gmake.tag 1.1 97/01/18 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Tag building rules for gmake +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +TAGS: $(CFILES) $(HFILES) + $(ETAGS) $+ + +tags: $(CFILES) $(HFILES) + $(CTAGS) -t $+ diff --git a/scsilib/RULES/r-make.dep b/scsilib/RULES/r-make.dep new file mode 100644 index 0000000..8d21c0c --- /dev/null +++ b/scsilib/RULES/r-make.dep @@ -0,0 +1,72 @@ +#ident "@(#)r-make.dep 1.5 02/10/11 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Dependency building rules for make +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +DEP_SUFFIX= .dep +RMDEP= $(RM) $(RM_FORCE) $@ +DEP_FILE= $(ARCHDIR)/$(TARGET).dep +PDEP_FILE= $(ARCHDIR)/$(TARGET).dep +PALLDEP_FILE= $(CFILES:%.c=$(ARCHDIR)/%.d) $(ARCHDIR)/$(TARGET).dep +DEP_DEP= $(ARCHDIR)/Dnull +########################################################################### +depend: rmdep $(DEP_FILE) + +rmdep: + $(RM) $(RM_FORCE) $(PALLDEP_FILE) + +########################################################################### +# +# Make the complete path to the architecture subdirectory. +# +########################################################################### +$(ARCHDIR): + $(MKDIR) -p $@ + +########################################################################### +# +# Generate dependency file(s). +# This rules is checked when the dependency file(s) are included. +# +# Modify the the path for .o files to reflect that they are placed in +# $(ARCHDIR). Add the dependency file itself to each line so that +# the dependencies will be rebuilt if a source is newer that the +# appropriate dependency file. +# +########################################################################### +$(ARCHDIR)/%.dep: %.c + $(MKDEP) $(CPPFLAGS) $(MKDEP_OUT) $< \ + | sed -e 's;^\(.*\)\.o[ ]*:;$(ARCHDIR)/\1.o $(DEP_FILE):;' > $@ + +$(DEP_FILE): $(DEP_DEP) $(CFILES) + $(MKDEP) $(CPPFLAGS) $(MKDEP_OUT) $(CFILES) \ + | sed -e 's;^\(.*\)\.o[ ]*:;$(ARCHDIR)/\1.o $(DEP_FILE):;' > $@ + +$(DEP_DEP): $(ARCHDIR) + @if [ ! -f $@ ]; then \ + echo > $@; \ + fi + +########################################################################### +# +# Include the dependency file(s) generated from the rules above. +# +########################################################################### +include $(DEP_FILE) diff --git a/scsilib/RULES/r-make.obj b/scsilib/RULES/r-make.obj new file mode 100644 index 0000000..a83f580 --- /dev/null +++ b/scsilib/RULES/r-make.obj @@ -0,0 +1,34 @@ +#ident @(#)r-make.obj 1.2 97/01/30 +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Object building rules for gmake +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +# This defines a rule that compiles source files from current directory and +# puts the resultant objects directly into $(ARCHDIR), +# to allow concurrent compilation on different platforms. +# Object file names are constructed from $(CFILES). +########################################################################### +ARCHDIRX= $(ARCHDIR)/ +OFILES= $(CFILES:%.c=$(ARCHDIR)/%.o) +POFILES= $(CFILES:%.c=$(ARCHDIR)/%.o) +########################################################################### +$(ARCHDIR)/%.o: %.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< +########################################################################### diff --git a/scsilib/RULES/r-make.tag b/scsilib/RULES/r-make.tag new file mode 100644 index 0000000..a9c4db7 --- /dev/null +++ b/scsilib/RULES/r-make.tag @@ -0,0 +1,29 @@ +#ident "@(#)r-make.tag 1.1 97/01/18 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Tag building rules for make +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +TAGS: $(CFILES) $(HFILES) + $(ETAGS) $(CFILES) $(HFILES) + + +tags: $(CFILES) $(HFILES) + $(CTAGS) -t $(CFILES) $(HFILES) + diff --git a/scsilib/RULES/r-smake.dep b/scsilib/RULES/r-smake.dep new file mode 100644 index 0000000..623f94a --- /dev/null +++ b/scsilib/RULES/r-smake.dep @@ -0,0 +1,73 @@ +#ident "@(#)r-smake.dep 1.8 02/10/11 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Dependency building rules for smake +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +DEP_SUFFIX= .d +RMDEP= $(RM) $(RM_FORCE) $(ARCHDIR)/$@ +DEP_FILE= $(CFILES:%.c=%.d) +PDEP_FILE= $(CFILES:%.c=$(ARCHDIR)/%.d) +PALLDEP_FILE= $(CFILES:%.c=$(ARCHDIR)/%.d) $(ARCHDIR)/$(TARGET).dep +########################################################################### +depend: rmdep $(DEP_FILE) + +rmdep: + $(RM) $(RM_FORCE) $(PALLDEP_FILE) + +########################################################################### +# +# Make the complete path to the architecture subdirectory. +# +########################################################################### +$(ARCHDIR): + $(MKDIR) -p $@ + +########################################################################### +# +# Generate dependency file(s). +# This rules is checked when the dependency file(s) are included. +# +# Modify the the path for .o files to reflect that they are placed in +# $(ARCHDIR). Add the dependency file itself to each line so that +# the dependencies will be rebuilt if a source is newer that the +# appropriate dependency file. +# +########################################################################### +.d: .c + $(MKDEP) $(CPPFLAGS) $(MKDEP_OUT) $< \ + | sed -e 's;^\(.*\)\.o[ ]*:;\1.o \1.d:;' > $(ARCHDIR)/$@ + +%.d: %.c + $(MKDEP) $(CPPFLAGS) $(MKDEP_OUT) $< \ + | sed -e 's;^\(.*\)\.o[ ]*:;\1.o \1.d:;' > $(ARCHDIR)/$@ + +Dnull: $(ARCHDIR) + @echo > $O/$@ + +#$(DEP_FILE): +# $(MKDEP) $(CPPFLAGS) -f - $(CFILES) \ +# | sed -e 's;^\(.*\.o[ ]*:\);$(ARCHDIR)/\1;' > $@ + +########################################################################### +# +# Include the dependency file(s) generated from the rules above. +# +########################################################################### +include Dnull $(DEP_FILE) diff --git a/scsilib/RULES/r-smake.obj b/scsilib/RULES/r-smake.obj new file mode 100644 index 0000000..bc47522 --- /dev/null +++ b/scsilib/RULES/r-smake.obj @@ -0,0 +1,43 @@ +#ident @(#)r-smake.obj 1.4 99/11/01 +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Object building rules for smake +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +# This defines a rule that compiles source files from current directory and +# puts the resultant objects directly into $(ARCHDIR), +# to allow concurrent compilation on different platforms. +# Object file names are constructed from $(CFILES). +########################################################################### +ARCHDIRX= +OFILES= $(CFILES:%.c=%.o) +POFILES= $(CFILES:%.c=$(ARCHDIR)/%.o) +.OBJDIR: $(ARCHDIR) +########################################################################### + +.o: .c +# $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $O/$@ $< +%.o: %.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $O/$@ $< + +#$(ARCHDIR)/%.o: %.c +# $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $(*F).c + +########################################################################### diff --git a/scsilib/RULES/r-smake.tag b/scsilib/RULES/r-smake.tag new file mode 100644 index 0000000..89ecd1d --- /dev/null +++ b/scsilib/RULES/r-smake.tag @@ -0,0 +1,27 @@ +#ident "@(#)r-smake.tag 1.2 97/02/05 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Tag building rules for smake +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +TAGS: $(CFILES) $(HFILES) + $(ETAGS) $r1 + +tags: $(CFILES) $(HFILES) + $(CTAGS) -t $r1 diff --git a/scsilib/RULES/rs6000-aix-cc.rul b/scsilib/RULES/rs6000-aix-cc.rul new file mode 100644 index 0000000..382d96e --- /dev/null +++ b/scsilib/RULES/rs6000-aix-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)rs6000-aix-cc.rul 1.6 02/10/11 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for AIX on RS6000 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +OSDEFS= -DPROTOTYTPES +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -pic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); $(SRCROOT)/conf/mkdep-aix.sh +MKDEP_OUT= + +#$RMDEP= : +#$#MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +#$MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); echo "Cannot do -M with IBM'cc"; : +#$MKDEP_OUT= diff --git a/scsilib/RULES/rs6000-aix-gcc.rul b/scsilib/RULES/rs6000-aix-gcc.rul new file mode 100644 index 0000000..fb20fa1 --- /dev/null +++ b/scsilib/RULES/rs6000-aix-gcc.rul @@ -0,0 +1,66 @@ +#ident "@(#)rs6000-aix-gcc.rul 1.4 02/10/15 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for AIX on RS6000 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -DPROTOTYTPES +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -pic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/rules.aux b/scsilib/RULES/rules.aux new file mode 100644 index 0000000..483d33b --- /dev/null +++ b/scsilib/RULES/rules.aux @@ -0,0 +1,39 @@ +#ident "@(#)rules.aux 1.6 04/01/23 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Rules for installing auxiliary files +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +PTARGET= $(TARGET) +SRCFILE= $(TARGET) +########################################################################### + +_INSMODEI= $(_UNIQ)$(INSMODE) +__INSMODEI= $(_INSMODEI:$(_UNIQ)=$(INSMODEF)) +INSMODEI= $(__INSMODEI:$(_UNIQ)%=%) + +all: $(SRCFILE) + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.clr +include $(SRCROOT)/$(RULESDIR)/rules.ins +include $(SRCROOT)/$(RULESDIR)/rules.tag +include $(SRCROOT)/$(RULESDIR)/rules.hlp +include $(SRCROOT)/$(RULESDIR)/dummy.dep +########################################################################### diff --git a/scsilib/RULES/rules.clr b/scsilib/RULES/rules.clr new file mode 100644 index 0000000..0509a7e --- /dev/null +++ b/scsilib/RULES/rules.clr @@ -0,0 +1,47 @@ +#ident @(#)rules.clr 1.5 99/08/28 +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Rules to make source tree clean +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +# Do not remove target if it is in the current directory +########################################################################### +RMTARGET= $(PTARGET:$(TARGET)%=%) +########################################################################### +clean: + $(RM) $(RM_FORCE) $(CLEAN_FILES) $(POFILES) \ + $(PTARGETC) \ + $(CLEAN_FILEX) \ + $(PYOFILES) $(PLOFILES) + +clobber: clean + $(RM) $(RM_FORCE) $(RMTARGET) $(PALLDEP_FILE) \ + $(PTARGETC) \ + $(CLOBBER_FILEX) + $(RM) $(RM_FORCE) $(ARCHDIR)/Dnull + +distclean: + $(RM) $(RM_RF) $(CLEAN_FILES) \ + .EDTMP *.bak OBJ/* \ + $(SRCROOT)/libs/* $(SRCROOT)/incs/* + +rmtarget: + $(RM) $(RM_FORCE) $(RMTARGET) + +relink: rmtarget all diff --git a/scsilib/RULES/rules.cmd b/scsilib/RULES/rules.cmd new file mode 100644 index 0000000..b74f81a --- /dev/null +++ b/scsilib/RULES/rules.cmd @@ -0,0 +1,45 @@ +#ident @(#)rules.cmd 1.6 04/01/23 +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Rules for user level commands (usually found in .../bin) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +_EXEEXT= $(EXEEXT) +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.obj +########################################################################### + +_INSMODEI= $(_UNIQ)$(INSMODE) +__INSMODEI= $(_INSMODEI:$(_UNIQ)=$(INSMODEX)) +INSMODEI= $(__INSMODEI:$(_UNIQ)%=%) + +all: $(PTARGET) + +$(PTARGET): $(OFILES) $(SRCLIBS) + $(LDCC) -o $@ $(POFILES) $(LDFLAGS) $(LDLIBS) +# $(CC) -o $@ $(OFILES) $(LDPATH) $(RUNPATH) $(SRCLIBS) $(LIBS) + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.lnt +include $(SRCROOT)/$(RULESDIR)/rules.clr +include $(SRCROOT)/$(RULESDIR)/rules.ins +include $(SRCROOT)/$(RULESDIR)/rules.tag +include $(SRCROOT)/$(RULESDIR)/rules.hlp +include $(SRCROOT)/$(RULESDIR)/rules.dep +########################################################################### diff --git a/scsilib/RULES/rules.cnf b/scsilib/RULES/rules.cnf new file mode 100644 index 0000000..f016e69 --- /dev/null +++ b/scsilib/RULES/rules.cnf @@ -0,0 +1,59 @@ +#ident @(#)rules.cnf 1.8 04/01/23 +########################################################################### +# Written 1998 by J. Schilling +########################################################################### +# +# Make Rules for global dynamic configuration +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### + +config: $(OINCSDIR)/rules.cnf + +$(OINCSDIR)/Inull: + $(MKDIR) -p $(OINCSDIR) + @echo > $@ + +$(OINCSDIR): + $(MKDIR) -p $@ + +# +# Hack until the <mach>-<os>-*cc.rul files are updated +# +_HCCCOM= $(OARCH:%-gcc=gcc) +HCCCOM= $(_HCCCOM:%-cc=cc) + +_CCCOM= $(_UNIQ)$(CCCOM) +__CCCOM= $(_CCCOM:$(_UNIQ)=$(HCCCOM)) +XCCCOM= $(__CCCOM:$(_UNIQ)%=%) + +#CONFFLAGS += -cc=$(XCCCOM) + +$(OINCSDIR)/rules.cnf $(OINCSDIR)/xconfig.h: $(OINCSDIR)/Inull \ + $(SRCROOT)/conf/configure \ + $(SRCROOT)/conf/rules.cnf.in \ + $(SRCROOT)/conf/xconfig.h.in + $(RUL_CONF) + +########################################################################### +RUL_CONF= @echo " ==> CONFIGURING RULES \"$@\""; $(RM_F) $@; \ + cd $(OINCSDIR); \ + CONFIG_NOFAIL=TRUE CC="$(XCCCOM)" CFLAGS="$(CFLAGS)" sh ../../conf/configure $(CONFFLAGS) +########################################################################### +include $(OINCSDIR)/Inull +include $(OINCSDIR)/rules.cnf +########################################################################### +include $(SRCROOT)/$(RULESDIR)/$(LOCAL_CNF) diff --git a/scsilib/RULES/rules.dep b/scsilib/RULES/rules.dep new file mode 100644 index 0000000..f7a9a20 --- /dev/null +++ b/scsilib/RULES/rules.dep @@ -0,0 +1,23 @@ +#ident "@(#)rules.dep 1.1 97/01/18 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Dependency building rules ... use MAKEPROG specific version +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/r-$(MAKEPROG).dep diff --git a/scsilib/RULES/rules.dir b/scsilib/RULES/rules.dir new file mode 100644 index 0000000..c45b387 --- /dev/null +++ b/scsilib/RULES/rules.dir @@ -0,0 +1,28 @@ +#ident @(#)rules.dir 1.7 04/01/23 +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# DIRS contains the names of all directories where sub make should take place +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### + +include $(SRCROOT)/$(RULESDIR)/rules1.dir + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.hlp +########################################################################### diff --git a/scsilib/RULES/rules.drv b/scsilib/RULES/rules.drv new file mode 100644 index 0000000..941b3ac --- /dev/null +++ b/scsilib/RULES/rules.drv @@ -0,0 +1,43 @@ +#ident @(#)rules.drv 1.5 04/01/23 +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Rules for loadable drivers +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.obj +########################################################################### + +_INSMODEI= $(_UNIQ)$(INSMODE) +__INSMODEI= $(_INSMODEI:$(_UNIQ)=$(INSMODEX)) +INSMODEI= $(__INSMODEI:$(_UNIQ)%=%) + +all: $(PTARGET) + +$(PTARGET): $(OFILES) $(SRCLIBS) + $(LD) -r -o $@ $(POFILES) $(SRCLIBS) $(LIBS) + +INS_BASE= $(INS_KBASE) +CPPOPTS += $(KDEFINES) +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.clr +include $(SRCROOT)/$(RULESDIR)/rules.ins +include $(SRCROOT)/$(RULESDIR)/rules.tag +include $(SRCROOT)/$(RULESDIR)/rules.hlp +include $(SRCROOT)/$(RULESDIR)/rules.dep +########################################################################### diff --git a/scsilib/RULES/rules.hlp b/scsilib/RULES/rules.hlp new file mode 100644 index 0000000..5dc1d7c --- /dev/null +++ b/scsilib/RULES/rules.hlp @@ -0,0 +1,54 @@ +#ident "@(#)rules.hlp 1.7 01/02/04 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Help rules +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +# Location for targets: +# +# - all : see appropriate rules +# - lint : rules.lnt +# - clean, clobber, distclean, relink, rmtarget : rules.clr +# - install, ibins : rules.ins +# - depend, rmdep : rules.dep +# - config : rules.cnf +# - tags, TAGS : rules.tag +# - .help : rules.hlp +# - tinfo : rules.dir/rules.rdi +# +########################################################################### +.help: + @echo "Usage: make [target]" + @echo "Available targets are:" $(ALLTARGETS) + @echo " all make the default target" + @echo " lint lint all sources for the default target" + @echo " clean remove all made objects and the default target" + @echo " clobber remove all from 'clean' and all dependency files" + @echo " distclean remove all from 'clobber' and all made files" + @echo " for all architectures" + @echo " relink remove and relink the default target" + @echo " rmtarget remove the default target" + @echo " install install the default target to final destination" + @echo " ibins install the default target to local dir 'bins'" + @echo " depend remake the dependency files" + @echo " config remake the dynamic configuration files" + @echo " tags make vi/ved compatible tag file" + @echo " TAGS make emacs compatible tag file" + @echo " .help display this help" + @echo " tinfo display target info for slottable target components" diff --git a/scsilib/RULES/rules.inc b/scsilib/RULES/rules.inc new file mode 100644 index 0000000..feb5c81 --- /dev/null +++ b/scsilib/RULES/rules.inc @@ -0,0 +1,47 @@ +#ident @(#)rules.inc 1.3 04/01/23 +########################################################################### +# Written 1999 by J. Schilling +########################################################################### +# +# Rules for creating include files (usually found in .../incs/machdir) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.obj +########################################################################### + +PTARGET= $(OINCSDIR)/$(TARGET) +PTARGETC= $(ARCHDIR)/$(TARGETC) + +_INSMODEI= $(_UNIQ)$(INSMODE) +__INSMODEI= $(_INSMODEI:$(_UNIQ)=$(INSMODEF)) +INSMODEI= $(__INSMODEI:$(_UNIQ)%=%) + +all: $(PTARGETC) $(PTARGET) + +$(PTARGETC): $(OFILES) $(SRCLIBS) + $(LDCC) -o $@ $(POFILES) $(LDFLAGS) $(LDLIBS) + +$(PTARGET): $(OINCSDIR) $(PTARGETC) + @echo " ==> GENERATING include file \"$@\""; $(PTARGETC) > $@ + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.clr +include $(SRCROOT)/$(RULESDIR)/rules.ins +include $(SRCROOT)/$(RULESDIR)/rules.tag +include $(SRCROOT)/$(RULESDIR)/rules.hlp +include $(SRCROOT)/$(RULESDIR)/rules.dep +########################################################################### diff --git a/scsilib/RULES/rules.ins b/scsilib/RULES/rules.ins new file mode 100644 index 0000000..e875577 --- /dev/null +++ b/scsilib/RULES/rules.ins @@ -0,0 +1,72 @@ +#ident @(#)rules.ins 1.13 04/01/23 +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Rules for target installation +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +$(INS_BASE)/$(INSDIR): + $(MKDIR) -p $@ +$(SRCROOT)/bins/$(OARCH): + $(MKDIR) -p $@ + +$(INS_BASE)/$(INSDIR)/$(TARGET)$(_EXEEXT): $(PTARGET) + $(INSTALL) $(PTARGET) $@ + +$(SRCROOT)/bins/$(OARCH)/$(TARGET)$(_EXEEXT): $(PTARGET) + $(INSTALL) $(PTARGET) $@ + +PHARDLINKS= $(HARDLINKS:%=$(INS_BASE)/$(INSDIR)/%$(_EXEEXT)) +hardlinks: $(PHARDLINKS) + +PSYMLINKS= $(SYMLINKS:%=$(INS_BASE)/$(INSDIR)/%$(_EXEEXT)) +symlinks: $(PSYMLINKS) + +_INSMODEINS= $(_UNIQ)$(INSMODEI) +__INSMODEINS= $(_INSMODEINS:$(_UNIQ)=$(INSMODEX)) +INSMODEINS= $(__INSMODEINS:$(_UNIQ)%=%) + +dummy $(PHARDLINKS): $(INS_BASE)/$(INSDIR)/$(TARGET)$(_EXEEXT) + @echo " ==> INSTALLING link \"$@\""; $(RM) $(RM_FORCE) $@; $(LN) $(INS_BASE)/$(INSDIR)/$(TARGET)$(_EXEEXT) $@ + +symdummy $(PSYMLINKS): $(INS_BASE)/$(INSDIR)/$(TARGET)$(_EXEEXT) + @echo " ==> INSTALLING symlink \"$@\""; $(RM) $(RM_FORCE) $@; $(SYMLINK) $(TARGET)$(_EXEEXT) $@ + +xinstall: + @if [ ".$(XMK_FILE)" != . ] ; then \ + for XMK_F in $(XMK_FILE) XxZzY-- ; do \ + ( \ + if [ -r ./$$XMK_F ] ; then \ + echo " ==> MAKING \"install\" ON SUBCOMPONENT \"$(CURDIR)/$$XMK_F\""; \ + "$(MAKE)" -f $$XMK_F $(MAKEMACS) XARCH=$(XARCH) install; \ + else \ + if [ $$XMK_F != XxZzY-- ]; then \ + echo "NOTICE: Partial source ($(DIRNAME)/$$XMK_F) missing";\ + fi \ + fi \ + ); \ + done \ + fi + +install: all $(INS_BASE)/$(INSDIR) \ + $(INS_BASE)/$(INSDIR)/$(TARGET)$(_EXEEXT) \ + hardlinks symlinks \ + xinstall + +ibins: all $(SRCROOT)/bins/$(OARCH) \ + $(SRCROOT)/bins/$(OARCH)/$(TARGET)$(_EXEEXT) diff --git a/scsilib/RULES/rules.lib b/scsilib/RULES/rules.lib new file mode 100644 index 0000000..52cdd45 --- /dev/null +++ b/scsilib/RULES/rules.lib @@ -0,0 +1,48 @@ +#ident "@(#)rules.lib 1.6 04/01/23 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Rules for traditional libraries (libxxx.a) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.obj +########################################################################### +TARGET= $(LIB_PREFIX)$(TARGETLIB)$(LIB_SUFFIX) +TARGET_PATH= $(OLIBSDIR) +PTARGET= $(OLIBSDIR)/$(TARGET) + +_INSMODEI= $(_UNIQ)$(INSMODE) +__INSMODEI= $(_INSMODEI:$(_UNIQ)=$(INSMODEF)) +INSMODEI= $(__INSMODEI:$(_UNIQ)%=%) + +all: $(TARGET_PATH) $(PTARGET) + +$(TARGET_PATH): + $(MKDIR) -p $@ + +$(PTARGET): $(OFILES) + $(AR) $(ARFLAGS) $@ `$(LORDER) $(POFILES) | $(TSORT)` + $(RANLIB) $@ + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.clr +include $(SRCROOT)/$(RULESDIR)/rules.ins +include $(SRCROOT)/$(RULESDIR)/rules.tag +include $(SRCROOT)/$(RULESDIR)/rules.hlp +include $(SRCROOT)/$(RULESDIR)/rules.dep +########################################################################### diff --git a/scsilib/RULES/rules.lnt b/scsilib/RULES/rules.lnt new file mode 100644 index 0000000..8ccb0ef --- /dev/null +++ b/scsilib/RULES/rules.lnt @@ -0,0 +1,27 @@ +#ident @(#)rules.lnt 1.1 01/02/04 +########################################################################### +# Written 2001 by J. Schilling +########################################################################### +# +# Rules for lint +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### + +lint: $(CFILES) + lint $(LINTFLAGS) $(CPPFLAGS) $(CFILES) + +########################################################################### diff --git a/scsilib/RULES/rules.loc b/scsilib/RULES/rules.loc new file mode 100644 index 0000000..94096ac --- /dev/null +++ b/scsilib/RULES/rules.loc @@ -0,0 +1,48 @@ +#ident "@(#)rules.loc 1.5 04/01/23 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Rules to localize files +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +PTARGET= $(ARCHDIR)/$(TARGET) +########################################################################### +# +# We are doing a copy to $(ARCHDIR) to be able to have platform dependent +# shell files in future. +# +########################################################################### +_INSMODEI= $(_UNIQ)$(INSMODE) +__INSMODEI= $(_INSMODEI:$(_UNIQ)=$(INSMODEF)) +INSMODEI= $(__INSMODEI:$(_UNIQ)%=%) + +all: $(ARCHDIR) $(PTARGET) + +$(PTARGET): $(SRCFILE) + $(LOCALIZE) $(SRCFILE) $@ + +$(ARCHDIR): + $(MKDIR) -p $@ + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.clr +include $(SRCROOT)/$(RULESDIR)/rules.ins +include $(SRCROOT)/$(RULESDIR)/rules.tag +include $(SRCROOT)/$(RULESDIR)/rules.hlp +include $(SRCROOT)/$(RULESDIR)/dummy.dep +########################################################################### diff --git a/scsilib/RULES/rules.man b/scsilib/RULES/rules.man new file mode 100644 index 0000000..525eea2 --- /dev/null +++ b/scsilib/RULES/rules.man @@ -0,0 +1,33 @@ +#ident "@(#)rules.man 1.1 97/02/11 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Manual page building rules +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/man-$(MANSTYLE).def +########################################################################### + +INSDIR= $(MANDIR)/$(MANSECT) +SUBARCHDIR= /$(MANDIR) +TARGET= $(TARGETMAN).$(MANSUFFIX) +SRCFILE= $(MANFILE) + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.loc +########################################################################### diff --git a/scsilib/RULES/rules.mkd b/scsilib/RULES/rules.mkd new file mode 100644 index 0000000..97e6db4 --- /dev/null +++ b/scsilib/RULES/rules.mkd @@ -0,0 +1,25 @@ +#ident "%W% %E% %Q%" +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# make complete path to the architecture subdirectory. +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +$(ARCHDIR): + $(MKDIR) -p $@ + diff --git a/scsilib/RULES/rules.mks b/scsilib/RULES/rules.mks new file mode 100644 index 0000000..9ba91de --- /dev/null +++ b/scsilib/RULES/rules.mks @@ -0,0 +1,38 @@ +#ident "@(#)rules.mks 1.9 04/01/23 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Rules for multiple Makefiles (*.mk) in one subdirectory +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### + +$(ALLTARGETS): + @ for MK in $(MK_FILES) ; \ + do \ + ( \ + if [ -r ./$$MK ] ; then \ + echo " ==> MAKING \"$@\" ON SUBCOMPONENT \"$(CURDIR)/$$MK\""; "$(MAKE)" -f $$MK $(MAKEMACS) XARCH=$(XARCH) $@;\ + else \ + echo "NOTICE: Partial source ($(CURDIR)/$$MK) missing";\ + fi \ + ); \ + done + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.hlp +########################################################################### diff --git a/scsilib/RULES/rules.mod b/scsilib/RULES/rules.mod new file mode 100644 index 0000000..8d8f0d5 --- /dev/null +++ b/scsilib/RULES/rules.mod @@ -0,0 +1,41 @@ +#ident @(#)rules.mod 1.5 04/01/23 +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Rules for loadable streams modules +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.obj +########################################################################### + +_INSMODEI= $(_UNIQ)$(INSMODE) +__INSMODEI= $(_INSMODEI:$(_UNIQ)=$(INSMODEX)) +INSMODEI= $(__INSMODEI:$(_UNIQ)%=%) + +all: $(PTARGET) + +$(PTARGET): $(OFILES) $(SRCLIBS) + $(LD) -r -o $@ $(OFILES) $(SRCLIBS) $(LIBS) + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.clr +include $(SRCROOT)/$(RULESDIR)/rules.ins +include $(SRCROOT)/$(RULESDIR)/rules.tag +include $(SRCROOT)/$(RULESDIR)/rules.hlp +include $(SRCROOT)/$(RULESDIR)/rules.dep +########################################################################### diff --git a/scsilib/RULES/rules.obj b/scsilib/RULES/rules.obj new file mode 100644 index 0000000..4414ee2 --- /dev/null +++ b/scsilib/RULES/rules.obj @@ -0,0 +1,25 @@ +#ident @(#)rules.obj 1.3 04/01/23 +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Object building rules ... use MAKEPROG specific version +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +PTARGET= $(ARCHDIR)/$(TARGET)$(_EXEEXT) +########################################################################### +include $(SRCROOT)/$(RULESDIR)/r-$(MAKEPROG).obj diff --git a/scsilib/RULES/rules.prg b/scsilib/RULES/rules.prg new file mode 100644 index 0000000..cd1d4a4 --- /dev/null +++ b/scsilib/RULES/rules.prg @@ -0,0 +1,89 @@ +#ident "@(#)rules.prg 1.12 00/03/19 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Generic rules for program names +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +# +# This file holds definitions that are common to all architectures. +# It should be included first and then partially overwritten, +# if the current architecture requires some changes. +# +########################################################################### + +CLEAN_FILES= core err + +SHELL= /bin/sh +LN= /bin/ln +SYMLINK= /bin/ln -s +RM= /bin/rm +MV= /bin/mv +LORDER= lorder +TSORT= tsort +CTAGS= vctags +ETAGS= etags +UMASK= umask $(UMASK_VAL) +UMASK_DEF= 002 + +RM_FORCE= -f +RM_RECURS= -r +RM_RF= $(RM_RECURS) $(RM_FORCE) + +RM_F= $(RM) $(RM_FORCE) + +INSMODEF_DEF= 444 +INSMODEX_DEF= 755 +INSUSR_DEF= bin +INSGRP_DEF= bin + +_DEFUMASK= $(_UNIQ)$(DEFUMASK) +__DEFUMASK= $(_DEFUMASK:$(_UNIQ)=$(UMASK_DEF)) +UMASK_VAL= $(__DEFUMASK:$(_UNIQ)%=%) + +_DEFINSMODEF= $(_UNIQ)$(DEFINSMODEF) +__DEFINSMODEF= $(_DEFINSMODEF:$(_UNIQ)=$(INSMODEF_DEF)) +INSMODEF= $(__DEFINSMODEF:$(_UNIQ)%=%) + +_DEFINSMODEX= $(_UNIQ)$(DEFINSMODEX) +__DEFINSMODEX= $(_DEFINSMODEX:$(_UNIQ)=$(INSMODEX_DEF)) +INSMODEX= $(__DEFINSMODEX:$(_UNIQ)%=%) + +_DEFINSUSR= $(_UNIQ)$(DEFINSUSR) +__DEFINSUSR= $(_DEFINSUSR:$(_UNIQ)=$(INSUSR_DEF)) +INSUSR= $(__DEFINSUSR:$(_UNIQ)%=%) + +_DEFINSGRP= $(_UNIQ)$(DEFINSGRP) +__DEFINSGRP= $(_DEFINSGRP:$(_UNIQ)=$(INSGRP_DEF)) +INSGRP= $(__DEFINSGRP:$(_UNIQ)%=%) + + +LD= @echo " ==> LINKING \"$@\""; ld +LOCALIZE= @echo " ==> LOCALIZING \"$@\""; $(RM_F) $@; cp +INSTALL= @echo " ==> INSTALLING \"$@\""; sh $(SRCROOT)/conf/install-sh -c -m $(INSMODEINS) -o $(INSUSR) -g $(INSGRP) +CHMOD= @echo " ==> SEETING PERMISSIONS ON \"$@\""; chmod +CHOWN= @echo " ==> SETTING OWNER ON \"$@\""; chown +CHGRP= @echo " ==> SETTING GROUP ON \"$@\""; chgrp +AR= @echo " ==> ARCHIVING \"$@\""; ar +#YACC= @echo " ==> YACCING \"$@\""; yacc +#LEX= @echo " ==> LEXING \"$@\""; lex +#AWK= @echo " ==> AWKING \"$@\""; awk +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; makedepend +MKDEP_OUT= -f - +MKDIR= @echo " ==> MAKING DIRECTORY \"$@\""; $(UMASK); mkdir +MKDIR_SH= @echo " ==> MAKING DIRECTORY \"$@\""; $(UMASK); sh $(SRCROOT)/conf/mkdir-sh diff --git a/scsilib/RULES/rules.rdi b/scsilib/RULES/rules.rdi new file mode 100644 index 0000000..3ecc0b9 --- /dev/null +++ b/scsilib/RULES/rules.rdi @@ -0,0 +1,42 @@ +#ident @(#)rules.rdi 1.8 04/01/23 +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# DIRS contains the names of all directories where sub make should take place +# This is a modified version for the prokect's root directory +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### + +include $(SRCROOT)/$(RULESDIR)/rules1.dir + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.hlp +########################################################################### +# Due to a serious bug in SunPRO make we cannot include the configuration +# rules. SunPRO make inconsistsently shortens rules that start with "./" +# and thus wil not find existing rules for a file to be included. +# Due to a bug in GNU make dynamic configuration must have been run before +# C-compiler generated dependency rules are loaded. This is done by running +# make in the 'conf' directory before any other target is made. +# +# include $(SRCROOT)/$(RULESDIR)/rules.cnf +########################################################################### +#config: conf_warn + +#conf_warn: +# @echo "$@: cannot make due to a SunPRO make bug" diff --git a/scsilib/RULES/rules.rel b/scsilib/RULES/rules.rel new file mode 100644 index 0000000..087ae5a --- /dev/null +++ b/scsilib/RULES/rules.rel @@ -0,0 +1,73 @@ +#ident @(#)rules.rel 1.3 04/06/23 +########################################################################### +# Written 2001 by J. Schilling +########################################################################### +# +# Release building rules +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### + +MAKE_LICENSE=MKGNU +REL_SRC_MATCH=cat + +rel: $(CFILES:%=release/%) $(HFILES:%=release/%) $(XRELFILES:%=release/%) + +release/%.c: %.c + rm -f $@ + unifdef $(IFDEF) $< | $(REL_SRC_MATCH) >$@ + chmod 444 $@ + -cpmodes $< $@ + cptime $< $@ + $(MAKE_LICENSE) $@ + rm -f $@.bak + +release/%.h: %.h + rm -f $@ + unifdef $(IFDEF) $< | $(REL_SRC_MATCH) >$@ + chmod 444 $@ + -cpmodes $< $@ + cptime $< $@ + $(MAKE_LICENSE) $@ + rm -f $@.bak + +release/Makefile%: Makefile% + rm -f $@ + sed -e '/IFDEF=/,$$d' $< >$@ + chmod 444 $@ + -cpmodes $< $@ + cptime $< $@ + $(MAKE_LICENSE) $@ + rm -f $@.bak + +release/%.mk: %.mk + rm -f $@ + sed -e '/IFDEF=/,$$d' $< >$@ + chmod 444 $@ + -cpmodes $< $@ + cptime $< $@ + $(MAKE_LICENSE) $@ + rm -f $@.bak + +release/%: % + rm -f $@ +# unifdef $(IFDEF) $< >$@ + cat $< >$@ + chmod 444 $@ + -cpmodes $< $@ + cptime $< $@ + $(MAKE_LICENSE) $@ + rm -f $@.bak diff --git a/scsilib/RULES/rules.scr b/scsilib/RULES/rules.scr new file mode 100644 index 0000000..1ea07e3 --- /dev/null +++ b/scsilib/RULES/rules.scr @@ -0,0 +1,26 @@ +#ident "@(#)rules.scr 1.1 97/02/11 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Shell script building rules +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +SRCFILE= $(SCRFILE) +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.loc +########################################################################### diff --git a/scsilib/RULES/rules.shl b/scsilib/RULES/rules.shl new file mode 100644 index 0000000..041ac0e --- /dev/null +++ b/scsilib/RULES/rules.shl @@ -0,0 +1,60 @@ +#ident "@(#)rules.shl 1.6 04/01/23 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Rules for shared (dynamic) libraries +# +# SUBARCHDIR must be before any other definitions +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### + +SUBARCHDIR= /pic +COPTS += $(COPTDYN) +LDOPTS += $(LDOPTDYN) + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.obj +########################################################################### +TARGET= $(LIB_PREFIX)$(TARGETLIB)$(SHL_SUFFIX) +TARGET_BASE= $(LIB_PREFIX)$(TARGETLIB) +TARGET_PATH= $(OLIBSDIR) +PTARGET= $(OLIBSDIR)/$(TARGET) +PTARGET_BASE= $(OLIBSDIR)/$(TARGET_BASE) + +_INSMODEI= $(_UNIQ)$(INSMODE) +__INSMODEI= $(_INSMODEI:$(_UNIQ)=$(INSMODEF)) +INSMODEI= $(__INSMODEI:$(_UNIQ)%=%) + +all: $(TARGET_PATH) $(PTARGET) + +$(TARGET_PATH): + $(MKDIR) -p $@ + +$(PTARGET): $(OFILES) + $(DYNLD) -o $@ $(LDFLAGS) $(LDLIBS) `$(LORDER) $(POFILES) | $(TSORT)` + -$(LNDYNLIB) + +# @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.clr +include $(SRCROOT)/$(RULESDIR)/rules.ins +include $(SRCROOT)/$(RULESDIR)/rules.tag +include $(SRCROOT)/$(RULESDIR)/rules.hlp +include $(SRCROOT)/$(RULESDIR)/rules.dep +########################################################################### diff --git a/scsilib/RULES/rules.tag b/scsilib/RULES/rules.tag new file mode 100644 index 0000000..02d6a79 --- /dev/null +++ b/scsilib/RULES/rules.tag @@ -0,0 +1,23 @@ +#ident "@(#)rules.tag 1.1 97/01/18 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Tag building rules ... use MAKEPROG specific version +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/r-$(MAKEPROG).tag diff --git a/scsilib/RULES/rules.top b/scsilib/RULES/rules.top new file mode 100644 index 0000000..d88424e --- /dev/null +++ b/scsilib/RULES/rules.top @@ -0,0 +1,46 @@ +#ident "@(#)rules.top 1.15 04/01/23 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Rules that should be included at top of every Makefile +# This is the general purpose C-language version +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +# +# Include global language independent macros +# +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules1.top + +########################################################################### +# +# Include platform dependent macros for C-language here. +# +# If a project needs other languages too, additional rules may be defined. +# These additional rules should be placed in a file that uses a hierarchy +# similar to rules.top and mey be called e.g. yacc.top. +# +########################################################################### +include $(SRCROOT)/$(RULESDIR)/$(XARCH).rul + +########################################################################### +# +# Include global autofonfiguration rules +# +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.cnf diff --git a/scsilib/RULES/rules1.dir b/scsilib/RULES/rules1.dir new file mode 100644 index 0000000..06972a0 --- /dev/null +++ b/scsilib/RULES/rules1.dir @@ -0,0 +1,50 @@ +#ident @(#)rules1.dir 1.10 02/10/23 +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# DIRS contains the names of all directories where sub make should take place +# +# The code that is shared bwtween rules.dir and rules.rdi +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### + +$(ALLTARGETS): + @list="$(DIRS)"; \ + [ -d TARGETS -a -f TARGETS/__slot ] && \ + list=`echo TARGETS/[0-9][0-9]* | sed -e 's;TARGETS/[0-9][0-9];;g' | sed -e 's;!@!;/;g'`;\ + for DIR in $${list} ; \ + do \ + echo " ==> MAKING \"$@\" ON SUBDIRECTORY \"$(CURDIR)/$$DIR\""; \ + if [ -d ./$$DIR -a -r ./$$DIR/Makefile ] ; then \ + "$(MAKE)" -C ./$$DIR $(MAKEMACS) XARCH=$(XARCH) DIRNAME=$(CURDIR)/$$DIR $@ || exit -1 ; \ + else \ + echo "NOTICE: Partial source ($(CURDIR)/$$DIR) missing";\ + fi ; \ + done + +tinfo: + @[ -d TARGETS -a -f TARGETS/__slot ] && list=`echo TARGETS/[0-9][0-9]*`;\ + for i in $${list}; \ + do \ + (read line < $$i; \ + name=`echo $$i | sed -e 's;TARGETS/[0-9][0-9];;' | sed -e 's;!@!;/;g'`; \ + echo "$$name - $${line}"; \ + ); \ + done + +########################################################################### diff --git a/scsilib/RULES/rules1.top b/scsilib/RULES/rules1.top new file mode 100644 index 0000000..2b62d83 --- /dev/null +++ b/scsilib/RULES/rules1.top @@ -0,0 +1,299 @@ +#ident "@(#)rules1.top 1.27 04/07/11 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Rules that should be included at top of every Makefile +# Do not include this file directly; this is the language independent +# version that may be included in special purpose versions. +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +# +# Global definitions: +# +# Define magic unique cookie +# +########################################################################### +_UNIQ= .XxZzy- + +########################################################################### +# +# Make sure this becomes the default target +# +########################################################################### +all: + +########################################################################### +# +# Build a macro $(SRCROOTSL) that allows to use file name +# $(SRCROOTSL)incs/Dcc.$(PARCH)$(-O_ARCH) instead of using +# the file name $(SRCROOT)/incs/Dcc.$(PARCH)$(-O_ARCH) +# +# This is needed because of a serious bug in SunPRO make. We need to do some +# tricks in order to make code working that depends on including files where +# the file name is a macro and the file may be built as a result of a make +# rule. +# +# SunPRO make inconsistsently shortens rules that start with "./" +# and thus will not find existing rules for a file to be included. +# We use pattern matching macro expansions to consistently shorten the +# name if it starts with "./". This allows to use the same textual +# string for both the rule and the include statement. +# +# Note that Thus bug has been reported to Sun in 1998 but Sun seems not +# interested to fix the bug. +# +########################################################################### +_SRCROOTSL= $(SRCROOT)/ +SRCROOTSL= $(_SRCROOTSL:./%=%) + +########################################################################### +# +# Global handler for failed inludes +# +########################################################################### +.INCLUDE_FAILED: + @echo " ==> AUTOMAKING \"$^\""; sh $(SRCROOTSL)conf/makeinc $^ + +########################################################################### +# +# Legacy support for old smake programs ... +# +########################################################################### +.INCLUDEFAILED: + @echo " ==> AUTOMAKING \"$^\""; sh $(SRCROOTSL)conf/makeinc $^ + +########################################################################### +# +# Some global constants or pre-definitions +# +########################################################################### +_LCONFIG= $(_UNIQ)$(LCONFIG) +__LCONFIG= $(_LCONFIG:$(_UNIQ)=ldummy.cnf) +LOCAL_CNF= $(__LCONFIG:$(_UNIQ)%=%) +########################################################################### + +########################################################################### +# +# Standard (automatic) makeprog identification +# +# Each make program should define a macro: MAKE_NAME for identification. +# MAKE_NAME in this case is a built in macro like MAKE or MAKEFLAGS. +# Currently only 'smake' implements this feature. +# +########################################################################### +_MAKEPROG= $(_UNIQ)$(MAKE_NAME) +__MAKEPROG= $(_MAKEPROG:$(_UNIQ)=$(MAKEPROG)) +_XMAKEPROG= $(__MAKEPROG:$(_UNIQ)%=%) + +# gmake defines a macro MAKE_COMMAND. If neither MAKE_NAME is defined by +# the make program, not MAKEPROG is set, try this to recognize gmake. +# +_MAKE_COMMAND= $(MAKE_COMMAND:%make=gmake) + +__XMAKEPROG= $(_UNIQ)$(_XMAKEPROG) +___XMAKEPROG= $(__XMAKEPROG:$(_UNIQ)=$(_MAKE_COMMAND)) +XMAKEPROG= $(___XMAKEPROG:$(_UNIQ)%=%) + +include $(SRCROOT)/$(RULESDIR)/mk-$(XMAKEPROG).id + +########################################################################### +# +# Standard (automatic) os identification +# +########################################################################### +include $(SRCROOT)/$(RULESDIR)/os-$(OSNAME).id + +########################################################################### +# +# Global os definitions +# +########################################################################### +include $(SRCROOT)/$(RULESDIR)/os-$(O_ARCH).def + +########################################################################### +# +# Some global project definitions that may be overwritten in 'Defaults' +# +########################################################################### +CWARNOPTS= $(CWOPTS) + +########################################################################### +# +# Global project definitions +# +########################################################################### +DEF_ROOT= $(SRCROOT) +DEF_DIR= DEFAULTS + +_DEFAULTSROOT= $(_UNIQ)$(DEFAULTSROOT) +__DEFAULTSROOT= $(_DEFAULTSROOT:$(_UNIQ)=$(DEF_ROOT)) +DEFLTSROOT= $(__DEFAULTSROOT:$(_UNIQ)%=%) + +_DEFAULTSDIR= $(_UNIQ)$(DEFAULTSDIR) +__DEFAULTSDIR= $(_DEFAULTSDIR:$(_UNIQ)=$(DEF_DIR)) +DEFLTSDIR= $(__DEFAULTSDIR:$(_UNIQ)%=%) + +include $(DEFLTSROOT)/$(DEFLTSDIR)/Defaults + +########################################################################### +# +# Get curent directory name +# +########################################################################### +_DIRNAME= $(_UNIQ)$(DIRNAME) +__DIRNAME= $(_DIRNAME:$(_UNIQ)=...) +CURDIR= $(__DIRNAME:$(_UNIQ)%=%) + +########################################################################### +# +# Standard UNIX compiler name for use as architecture name. +# +# (this is not necessarily the name the compiler is called by) +# This is now defined in $(DEFAULTSROOT)/Defaults +# If not ... use 'cc' +# +########################################################################### +DEFCCOM_DEF= cc + +_DEFCCOM= $(_UNIQ)$(DEFCCOM) +__DEFCCOM= $(_DEFCCOM:$(_UNIQ)=$(DEFCCOM_DEF)) +CCOM_DEF= $(__DEFCCOM:$(_UNIQ)%=%) + +_CCOM= $(_UNIQ)$(CCOM) +__CCOM= $(_CCOM:$(_UNIQ)=$(CCOM_DEF)) +C_ARCH= $(__CCOM:$(_UNIQ)%=%) + +########################################################################### +# +# Standard default include directories +# +########################################################################### +DEFINCDIRS_DEF= $(SRCROOT)/include + +_INCDIRS= $(_UNIQ)$(DEFINCDIRS) +__INCDIRS= $(_INCDIRS:$(_UNIQ)=$(DEFINCDIRS_DEF)) +INCDIRS= $(__INCDIRS:$(_UNIQ)%=%) + +########################################################################### +# +# Prepare come macros needed to build $(ARCHDIR) +# +# Build macros for: +# - processor type +# - operating system +# - compiler identification +# +########################################################################### +KARCH_DEF= $(K_ARCH) +MARCH_DEF= $(M_ARCH) +PARCH_DEF= $(P_ARCH) + +KARCH= K_ARCH + +_MARCH= $(_UNIQ)$(ARCH) +__MARCH= $(_MARCH:$(_UNIQ)=$(MARCH_DEF)) +MARCH= $(__MARCH:$(_UNIQ)%=%) + +_PARCH= $(_UNIQ)$(ARCH) +__PARCH= $(_PARCH:$(_UNIQ)=$(PARCH_DEF)) +PARCH= $(__PARCH:$(_UNIQ)%=%) + +########################################################################### +# +# Now include the file $(SRCROOT)/incs/Dcc.$(PARCH)$(-O_ARCH) +# which is needed if the C-complier from the manual default configutration +# is not present on the current system. We try to use GCC as fallback +# in this case. +# +# Due to a serious bug in SunPRO make we need to do some tricks to make +# the following code working. +# +# See notes about $(SRCROOT)/ vs. $(SRCROOTSL) above. +# +########################################################################### +_DCC= $(SRCROOTSL)incs/Dcc.$(PARCH)$(-O_ARCH) + +$(_DCC): + sh $(SRCROOTSL)conf/cc-config.sh $(C_ARCH) $@ + +include $(_DCC) + +########################################################################### +# +# Build $(ARCHDIR) which occupies a central role in the whole +# make file system. ARCHDIR is used as a sub directory name to keep +# platform dependent files on different places. +# +# It is built from: +# - processor type +# - operating system +# - compiler identification +# +# A possible name could be: +# mc68020-sunos4-cc +# +########################################################################### +#OARCH= $(MARCH)$(-O_ARCH)-$(C_ARCH) +OARCH= $(PARCH)$(-O_ARCH)-$(C_ARCH) +XARCH= $(K_ARCH)$(-O_ARCH)-$(C_ARCH) +.print: + echo $(XP_ARCH) $(P_ARCH) $(OARCH) $(XARCH) + +########################################################################### +# +# All generated files are placed directly into this subdirectory. +# This includes e.g. yacc output (.c & .h files). +# SUBARCH is used if a object is conditional compiled in multiple ways. +# +########################################################################### +OARCHDIR= OBJ/$(OARCH) +ARCHDIR= OBJ/$(OARCH)$(SUBARCHDIR)$(SUBARCH) + +########################################################################### +# +# See notes about $(SRCROOT)/ vs. $(SRCROOTSL) above. +# +########################################################################### +OLIBSDIR= $(SRCROOTSL)libs/$(OARCH) +OINCSDIR= $(SRCROOTSL)incs/$(OARCH) + +########################################################################### +# Location for targets: +# +# - all : see appropriate rules +# - lint : rules.lnt +# - clean, clobber, distclean, relink, rmtarget : rules.clr +# - install, ibins : rules.ins +# - depend, rmdep : rules.dep +# - config : rules.cnf +# - tags, TAGS : rules.tag +# - .help : rules.hlp +# - tinfo : rules.dir/rules.rdi +# +# We do not put '.help' and 'tinfo' into 'ALLTARGETS' because: +# +# .help is not recursive +# tinfo is handeled separately in rules1.dir +# +# If we would add .help and tinfo, we would get multiple defined target +# messages. +########################################################################### +ALLTARGETS= all lint clean clobber distclean install ibins depend rmdep \ + config TAGS tags rmtarget relink rel + +.PHONY: $(ALLTARGETS) .help tinfo diff --git a/scsilib/RULES/s390-linux-cc.rul b/scsilib/RULES/s390-linux-cc.rul new file mode 100644 index 0000000..e1dbbe6 --- /dev/null +++ b/scsilib/RULES/s390-linux-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-cc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/s390-linux-gcc.rul b/scsilib/RULES/s390-linux-gcc.rul new file mode 100644 index 0000000..b0c8042 --- /dev/null +++ b/scsilib/RULES/s390-linux-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sparc-bsd-os-cc.rul b/scsilib/RULES/sparc-bsd-os-cc.rul new file mode 100644 index 0000000..549b5b3 --- /dev/null +++ b/scsilib/RULES/sparc-bsd-os-cc.rul @@ -0,0 +1,69 @@ +#ident "@(#)i386-bsd-os-cc.rul 1.5 03/01/15 " +########################################################################### +# Written 1998 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for BSD/OS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) -I/sys $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +#COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +#SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -shared -Wl,-soname,$(TARGET) +#LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sparc-bsd-os-gcc.rul b/scsilib/RULES/sparc-bsd-os-gcc.rul new file mode 100644 index 0000000..774de7e --- /dev/null +++ b/scsilib/RULES/sparc-bsd-os-gcc.rul @@ -0,0 +1,69 @@ +#ident "@(#)i386-bsd-os-gcc.rul 1.5 03/01/15 " +########################################################################### +# Written 1998 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for BSD/OS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) -I/sys $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +#COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +#SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -shared -Wl,-soname,$(TARGET) +#LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sparc-bsd-os3-cc.rul b/scsilib/RULES/sparc-bsd-os3-cc.rul new file mode 100644 index 0000000..825c769 --- /dev/null +++ b/scsilib/RULES/sparc-bsd-os3-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-bsd-os-cc.rul 1.4 02/10/15 " +########################################################################### +# Written 1998 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for BSD/OS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) -I/sys $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +#COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +#SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -shared -Wl,-soname,$(TARGET) +#LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +# shlicc2 is not present oln older or newer systems +#LDCC= @echo " ==> LINKING \"$@\""; shlicc2 +LDCC= @echo " ==> LINKING \"$@\""; shlicc +#DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sparc-bsd-os3-gcc.rul b/scsilib/RULES/sparc-bsd-os3-gcc.rul new file mode 100644 index 0000000..825c769 --- /dev/null +++ b/scsilib/RULES/sparc-bsd-os3-gcc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-bsd-os-cc.rul 1.4 02/10/15 " +########################################################################### +# Written 1998 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for BSD/OS +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) -I/sys $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +#COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +#SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +#LDOPTDYN= -shared -Wl,-soname,$(TARGET) +#LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +# shlicc2 is not present oln older or newer systems +#LDCC= @echo " ==> LINKING \"$@\""; shlicc2 +LDCC= @echo " ==> LINKING \"$@\""; shlicc +#DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sparc-linux-cc.rul b/scsilib/RULES/sparc-linux-cc.rul new file mode 100644 index 0000000..e1dbbe6 --- /dev/null +++ b/scsilib/RULES/sparc-linux-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-cc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sparc-linux-gcc.rul b/scsilib/RULES/sparc-linux-gcc.rul new file mode 100644 index 0000000..b0c8042 --- /dev/null +++ b/scsilib/RULES/sparc-linux-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sparc-netbsd-cc.rul b/scsilib/RULES/sparc-netbsd-cc.rul new file mode 100644 index 0000000..62d64c4 --- /dev/null +++ b/scsilib/RULES/sparc-netbsd-cc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-netbsd-cc.rul 1.6 02/10/15 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NetBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +#OSDEFS= -DIS_UNIX +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sparc-netbsd-gcc.rul b/scsilib/RULES/sparc-netbsd-gcc.rul new file mode 100644 index 0000000..f1674b7 --- /dev/null +++ b/scsilib/RULES/sparc-netbsd-gcc.rul @@ -0,0 +1,71 @@ +#ident "@(#)i386-netbsd-gcc.rul 1.6 02/10/15 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NetBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +#OSDEFS= -DIS_UNIX +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sparc-nextstep-cc.rul b/scsilib/RULES/sparc-nextstep-cc.rul new file mode 100644 index 0000000..281d851 --- /dev/null +++ b/scsilib/RULES/sparc-nextstep-cc.rul @@ -0,0 +1,67 @@ +#ident "@(#)hppa-nextstep-cc.rul 1.5 03/02/27 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NeXT Step on hppa (GCC) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= +MKDIR= $(MKDIR_SH) diff --git a/scsilib/RULES/sparc-nextstep-gcc.rul b/scsilib/RULES/sparc-nextstep-gcc.rul new file mode 100644 index 0000000..281d851 --- /dev/null +++ b/scsilib/RULES/sparc-nextstep-gcc.rul @@ -0,0 +1,67 @@ +#ident "@(#)hppa-nextstep-cc.rul 1.5 03/02/27 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for NeXT Step on hppa (GCC) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= +MKDIR= $(MKDIR_SH) diff --git a/scsilib/RULES/sparc64-freebsd-cc.rul b/scsilib/RULES/sparc64-freebsd-cc.rul new file mode 100644 index 0000000..ae3976f --- /dev/null +++ b/scsilib/RULES/sparc64-freebsd-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i386-freebsd-cc.rul 1.4 02/10/15 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for FreeBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sparc64-freebsd-gcc.rul b/scsilib/RULES/sparc64-freebsd-gcc.rul new file mode 100644 index 0000000..d73f226 --- /dev/null +++ b/scsilib/RULES/sparc64-freebsd-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i386-freebsd-gcc.rul 1.4 02/10/15 " +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for FreeBSD +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr +LORDER= lorder +TSORT= tsort + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sparc64-linux-cc.rul b/scsilib/RULES/sparc64-linux-cc.rul new file mode 100644 index 0000000..e1dbbe6 --- /dev/null +++ b/scsilib/RULES/sparc64-linux-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-cc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sparc64-linux-gcc.rul b/scsilib/RULES/sparc64-linux-gcc.rul new file mode 100644 index 0000000..b0c8042 --- /dev/null +++ b/scsilib/RULES/sparc64-linux-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sun3-sunos4-cc.rul b/scsilib/RULES/sun3-sunos4-cc.rul new file mode 100644 index 0000000..50cb49e --- /dev/null +++ b/scsilib/RULES/sun3-sunos4-cc.rul @@ -0,0 +1,65 @@ +#ident "@(#)sun3-sunos4-cc.rul 1.3 99/08/29 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 4.x on Motorola mc 680x0 +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -pic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= -lkvm + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sun3-sunos4-gcc.rul b/scsilib/RULES/sun3-sunos4-gcc.rul new file mode 100644 index 0000000..3d29107 --- /dev/null +++ b/scsilib/RULES/sun3-sunos4-gcc.rul @@ -0,0 +1,66 @@ +#ident "@(#)sun3-sunos4-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 4.x on Motorola mc 680x0 (GCC) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O2 +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= -lkvm + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sun4-sunos4-cc.rul b/scsilib/RULES/sun4-sunos4-cc.rul new file mode 100644 index 0000000..271ab3e --- /dev/null +++ b/scsilib/RULES/sun4-sunos4-cc.rul @@ -0,0 +1,65 @@ +#ident "@(#)sun4-sunos4-cc.rul 1.3 99/08/29 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 4.x on sparc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -pic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= -lkvm + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sun4-sunos4-gcc.rul b/scsilib/RULES/sun4-sunos4-gcc.rul new file mode 100644 index 0000000..535c6c2 --- /dev/null +++ b/scsilib/RULES/sun4-sunos4-gcc.rul @@ -0,0 +1,65 @@ +#ident "@(#)sun4-sunos4-gcc.rul 1.4 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 4.x on sparc (GCC) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= -lkvm + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sun4-sunos5-cc.rul b/scsilib/RULES/sun4-sunos5-cc.rul new file mode 100644 index 0000000..af77405 --- /dev/null +++ b/scsilib/RULES/sun4-sunos5-cc.rul @@ -0,0 +1,68 @@ +#ident "@(#)sun4-sunos5-cc.rul 1.6 04/01/02 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 5.x on sparc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(SUNPROCOPTOPT) $(COPTX) + +LINTFLAGS= -Nlevel=4 + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= -Xa +CWOPTS= -v +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -Kpic +COPTGPROF= -xpg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +LIB_KVM= -lkvm -lelf +LIB_VOLMGT= -lvolmgt + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -xM +MKDEP_OUT= diff --git a/scsilib/RULES/sun4-sunos5-gcc.rul b/scsilib/RULES/sun4-sunos5-gcc.rul new file mode 100644 index 0000000..821a77e --- /dev/null +++ b/scsilib/RULES/sun4-sunos5-gcc.rul @@ -0,0 +1,67 @@ +#ident "@(#)sun4-sunos5-gcc.rul 1.6 04/01/02 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 5.x on sparc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +LIB_KVM= -lkvm -lelf +LIB_VOLMGT= -lvolmgt + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sun4L-sunos5-cc.rul b/scsilib/RULES/sun4L-sunos5-cc.rul new file mode 100644 index 0000000..af77405 --- /dev/null +++ b/scsilib/RULES/sun4L-sunos5-cc.rul @@ -0,0 +1,68 @@ +#ident "@(#)sun4-sunos5-cc.rul 1.6 04/01/02 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 5.x on sparc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(SUNPROCOPTOPT) $(COPTX) + +LINTFLAGS= -Nlevel=4 + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= -Xa +CWOPTS= -v +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -Kpic +COPTGPROF= -xpg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +LIB_KVM= -lkvm -lelf +LIB_VOLMGT= -lvolmgt + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -xM +MKDEP_OUT= diff --git a/scsilib/RULES/sun4L-sunos5-gcc.rul b/scsilib/RULES/sun4L-sunos5-gcc.rul new file mode 100644 index 0000000..821a77e --- /dev/null +++ b/scsilib/RULES/sun4L-sunos5-gcc.rul @@ -0,0 +1,67 @@ +#ident "@(#)sun4-sunos5-gcc.rul 1.6 04/01/02 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 5.x on sparc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +LIB_KVM= -lkvm -lelf +LIB_VOLMGT= -lvolmgt + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sun4c-sunos4-cc.rul b/scsilib/RULES/sun4c-sunos4-cc.rul new file mode 100644 index 0000000..271ab3e --- /dev/null +++ b/scsilib/RULES/sun4c-sunos4-cc.rul @@ -0,0 +1,65 @@ +#ident "@(#)sun4-sunos4-cc.rul 1.3 99/08/29 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 4.x on sparc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -pic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= -lkvm + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sun4c-sunos4-gcc.rul b/scsilib/RULES/sun4c-sunos4-gcc.rul new file mode 100644 index 0000000..535c6c2 --- /dev/null +++ b/scsilib/RULES/sun4c-sunos4-gcc.rul @@ -0,0 +1,65 @@ +#ident "@(#)sun4-sunos4-gcc.rul 1.4 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 4.x on sparc (GCC) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= -lkvm + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sun4c-sunos5-cc.rul b/scsilib/RULES/sun4c-sunos5-cc.rul new file mode 100644 index 0000000..af77405 --- /dev/null +++ b/scsilib/RULES/sun4c-sunos5-cc.rul @@ -0,0 +1,68 @@ +#ident "@(#)sun4-sunos5-cc.rul 1.6 04/01/02 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 5.x on sparc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(SUNPROCOPTOPT) $(COPTX) + +LINTFLAGS= -Nlevel=4 + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= -Xa +CWOPTS= -v +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -Kpic +COPTGPROF= -xpg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +LIB_KVM= -lkvm -lelf +LIB_VOLMGT= -lvolmgt + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -xM +MKDEP_OUT= diff --git a/scsilib/RULES/sun4c-sunos5-gcc.rul b/scsilib/RULES/sun4c-sunos5-gcc.rul new file mode 100644 index 0000000..821a77e --- /dev/null +++ b/scsilib/RULES/sun4c-sunos5-gcc.rul @@ -0,0 +1,67 @@ +#ident "@(#)sun4-sunos5-gcc.rul 1.6 04/01/02 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 5.x on sparc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +LIB_KVM= -lkvm -lelf +LIB_VOLMGT= -lvolmgt + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sun4d-sunos5-cc.rul b/scsilib/RULES/sun4d-sunos5-cc.rul new file mode 100644 index 0000000..af77405 --- /dev/null +++ b/scsilib/RULES/sun4d-sunos5-cc.rul @@ -0,0 +1,68 @@ +#ident "@(#)sun4-sunos5-cc.rul 1.6 04/01/02 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 5.x on sparc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(SUNPROCOPTOPT) $(COPTX) + +LINTFLAGS= -Nlevel=4 + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= -Xa +CWOPTS= -v +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -Kpic +COPTGPROF= -xpg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +LIB_KVM= -lkvm -lelf +LIB_VOLMGT= -lvolmgt + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -xM +MKDEP_OUT= diff --git a/scsilib/RULES/sun4d-sunos5-gcc.rul b/scsilib/RULES/sun4d-sunos5-gcc.rul new file mode 100644 index 0000000..821a77e --- /dev/null +++ b/scsilib/RULES/sun4d-sunos5-gcc.rul @@ -0,0 +1,67 @@ +#ident "@(#)sun4-sunos5-gcc.rul 1.6 04/01/02 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 5.x on sparc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +LIB_KVM= -lkvm -lelf +LIB_VOLMGT= -lvolmgt + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sun4e-sunos5-cc.rul b/scsilib/RULES/sun4e-sunos5-cc.rul new file mode 100644 index 0000000..af77405 --- /dev/null +++ b/scsilib/RULES/sun4e-sunos5-cc.rul @@ -0,0 +1,68 @@ +#ident "@(#)sun4-sunos5-cc.rul 1.6 04/01/02 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 5.x on sparc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(SUNPROCOPTOPT) $(COPTX) + +LINTFLAGS= -Nlevel=4 + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= -Xa +CWOPTS= -v +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -Kpic +COPTGPROF= -xpg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +LIB_KVM= -lkvm -lelf +LIB_VOLMGT= -lvolmgt + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -xM +MKDEP_OUT= diff --git a/scsilib/RULES/sun4e-sunos5-gcc.rul b/scsilib/RULES/sun4e-sunos5-gcc.rul new file mode 100644 index 0000000..821a77e --- /dev/null +++ b/scsilib/RULES/sun4e-sunos5-gcc.rul @@ -0,0 +1,67 @@ +#ident "@(#)sun4-sunos5-gcc.rul 1.6 04/01/02 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 5.x on sparc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +LIB_KVM= -lkvm -lelf +LIB_VOLMGT= -lvolmgt + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sun4m-sunos4-cc.rul b/scsilib/RULES/sun4m-sunos4-cc.rul new file mode 100644 index 0000000..271ab3e --- /dev/null +++ b/scsilib/RULES/sun4m-sunos4-cc.rul @@ -0,0 +1,65 @@ +#ident "@(#)sun4-sunos4-cc.rul 1.3 99/08/29 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 4.x on sparc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -pic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= -lkvm + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sun4m-sunos4-gcc.rul b/scsilib/RULES/sun4m-sunos4-gcc.rul new file mode 100644 index 0000000..535c6c2 --- /dev/null +++ b/scsilib/RULES/sun4m-sunos4-gcc.rul @@ -0,0 +1,65 @@ +#ident "@(#)sun4-sunos4-gcc.rul 1.4 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 4.x on sparc (GCC) +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +LIB_SOCKET= +LIB_MATH= -lm +LIB_KVM= -lkvm + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= +LNDYNLIB= @ + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; ld +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +ARFLAGS= cr + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sun4m-sunos5-cc.rul b/scsilib/RULES/sun4m-sunos5-cc.rul new file mode 100644 index 0000000..af77405 --- /dev/null +++ b/scsilib/RULES/sun4m-sunos5-cc.rul @@ -0,0 +1,68 @@ +#ident "@(#)sun4-sunos5-cc.rul 1.6 04/01/02 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 5.x on sparc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(SUNPROCOPTOPT) $(COPTX) + +LINTFLAGS= -Nlevel=4 + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= -Xa +CWOPTS= -v +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -Kpic +COPTGPROF= -xpg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +LIB_KVM= -lkvm -lelf +LIB_VOLMGT= -lvolmgt + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -xM +MKDEP_OUT= diff --git a/scsilib/RULES/sun4m-sunos5-gcc.rul b/scsilib/RULES/sun4m-sunos5-gcc.rul new file mode 100644 index 0000000..821a77e --- /dev/null +++ b/scsilib/RULES/sun4m-sunos5-gcc.rul @@ -0,0 +1,67 @@ +#ident "@(#)sun4-sunos5-gcc.rul 1.6 04/01/02 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 5.x on sparc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +LIB_KVM= -lkvm -lelf +LIB_VOLMGT= -lvolmgt + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/sun4u-sunos5-cc.rul b/scsilib/RULES/sun4u-sunos5-cc.rul new file mode 100644 index 0000000..af77405 --- /dev/null +++ b/scsilib/RULES/sun4u-sunos5-cc.rul @@ -0,0 +1,68 @@ +#ident "@(#)sun4-sunos5-cc.rul 1.6 04/01/02 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 5.x on sparc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(SUNPROCOPTOPT) $(COPTX) + +LINTFLAGS= -Nlevel=4 + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= -Xa +CWOPTS= -v +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -Kpic +COPTGPROF= -xpg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +LIB_KVM= -lkvm -lelf +LIB_VOLMGT= -lvolmgt + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -xM +MKDEP_OUT= diff --git a/scsilib/RULES/sun4u-sunos5-gcc.rul b/scsilib/RULES/sun4u-sunos5-gcc.rul new file mode 100644 index 0000000..821a77e --- /dev/null +++ b/scsilib/RULES/sun4u-sunos5-gcc.rul @@ -0,0 +1,67 @@ +#ident "@(#)sun4-sunos5-gcc.rul 1.6 04/01/02 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for SunOS 5.x on sparc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +OSDEFS= -D__SVR4 -DSVR4 +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1 + +LIB_SOCKET= -lsocket -lnsl -ldl +LIB_MATH= -lm +LIB_KVM= -lkvm -lelf +LIB_VOLMGT= -lvolmgt + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTDYN= -dy -G -ztext -h $(TARGET) -ldl +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= crs + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/x86_64-linux-cc.rul b/scsilib/RULES/x86_64-linux-cc.rul new file mode 100644 index 0000000..e1dbbe6 --- /dev/null +++ b/scsilib/RULES/x86_64-linux-cc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-cc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/x86_64-linux-gcc.rul b/scsilib/RULES/x86_64-linux-gcc.rul new file mode 100644 index 0000000..b0c8042 --- /dev/null +++ b/scsilib/RULES/x86_64-linux-gcc.rul @@ -0,0 +1,70 @@ +#ident "@(#)i586-linux-gcc.rul 1.5 02/10/15 " +########################################################################### +# Written 1996 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for Linux +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/RULES/x86pc-qnx-gcc.rul b/scsilib/RULES/x86pc-qnx-gcc.rul new file mode 100644 index 0000000..e35de4f --- /dev/null +++ b/scsilib/RULES/x86pc-qnx-gcc.rul @@ -0,0 +1,74 @@ +########################################################################### +#ident "@(#)x86pc-qnx-gcc.rul 1.2 02/10/15 " +########################################################################### +# Written 2001 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for QNX Neutrino +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= -lsocks -lrpc +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +#RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +#LORDER= lorder +#TSORT= tsort +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= diff --git a/scsilib/START b/scsilib/START new file mode 100644 index 0000000..b76c9a8 --- /dev/null +++ b/scsilib/START @@ -0,0 +1 @@ +./cdrecord -dummy -v speed=2 dev=2,0 /usr/home/joerg/cd.raw diff --git a/scsilib/TARGETS/15conf b/scsilib/TARGETS/15conf new file mode 100644 index 0000000..c30f946 --- /dev/null +++ b/scsilib/TARGETS/15conf @@ -0,0 +1 @@ +Makefiles Autoconfiguration part 1. Automated run of configure. diff --git a/scsilib/TARGETS/25inc b/scsilib/TARGETS/25inc new file mode 100644 index 0000000..18c6bb4 --- /dev/null +++ b/scsilib/TARGETS/25inc @@ -0,0 +1 @@ +Makefiles Autoconfiguration part 2. Create autogenerated include files. diff --git a/scsilib/TARGETS/45lib b/scsilib/TARGETS/45lib new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/scsilib/TARGETS/45lib diff --git a/scsilib/TARGETS/45libdeflt b/scsilib/TARGETS/45libdeflt new file mode 100644 index 0000000..65ea747 --- /dev/null +++ b/scsilib/TARGETS/45libdeflt @@ -0,0 +1 @@ +Library to read local defaults from /etc/default/* diff --git a/scsilib/TARGETS/45libedc b/scsilib/TARGETS/45libedc new file mode 100644 index 0000000..5688a34 --- /dev/null +++ b/scsilib/TARGETS/45libedc @@ -0,0 +1 @@ +Heiko's CD sector formatting Library (not licensed under GPL) diff --git a/scsilib/TARGETS/45libfile b/scsilib/TARGETS/45libfile new file mode 100644 index 0000000..b740017 --- /dev/null +++ b/scsilib/TARGETS/45libfile @@ -0,0 +1 @@ +Library version of the file(1) command diff --git a/scsilib/TARGETS/45libhfs_iso b/scsilib/TARGETS/45libhfs_iso new file mode 100644 index 0000000..d65ed2c --- /dev/null +++ b/scsilib/TARGETS/45libhfs_iso @@ -0,0 +1 @@ +Library to handle Apple HFS extensions diff --git a/scsilib/TARGETS/45libparanoia b/scsilib/TARGETS/45libparanoia new file mode 100644 index 0000000..85512f2 --- /dev/null +++ b/scsilib/TARGETS/45libparanoia @@ -0,0 +1 @@ +Portable CD Audio paranoia extraction library diff --git a/scsilib/TARGETS/45librscg b/scsilib/TARGETS/45librscg new file mode 100644 index 0000000..e1256e2 --- /dev/null +++ b/scsilib/TARGETS/45librscg @@ -0,0 +1 @@ +Remote SCSI transport library diff --git a/scsilib/TARGETS/45libscg b/scsilib/TARGETS/45libscg new file mode 100644 index 0000000..ce5f113 --- /dev/null +++ b/scsilib/TARGETS/45libscg @@ -0,0 +1 @@ +Portable SCSI transport library diff --git a/scsilib/TARGETS/45libschily b/scsilib/TARGETS/45libschily new file mode 100644 index 0000000..abb7fd8 --- /dev/null +++ b/scsilib/TARGETS/45libschily @@ -0,0 +1 @@ +Library containing Schily SING (Schily Is Not GNU) extensions diff --git a/scsilib/TARGETS/45libunls b/scsilib/TARGETS/45libunls new file mode 100644 index 0000000..c92a7b4 --- /dev/null +++ b/scsilib/TARGETS/45libunls @@ -0,0 +1 @@ +National language support library for UNICODE diff --git a/scsilib/TARGETS/55cdda2wav b/scsilib/TARGETS/55cdda2wav new file mode 100644 index 0000000..fb50cb7 --- /dev/null +++ b/scsilib/TARGETS/55cdda2wav @@ -0,0 +1 @@ +CD digital audio extraction program diff --git a/scsilib/TARGETS/55cdrecord b/scsilib/TARGETS/55cdrecord new file mode 100644 index 0000000..9c8d0e2 --- /dev/null +++ b/scsilib/TARGETS/55cdrecord @@ -0,0 +1 @@ +CD audio/data recording program diff --git a/scsilib/TARGETS/55cmd b/scsilib/TARGETS/55cmd new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/scsilib/TARGETS/55cmd diff --git a/scsilib/TARGETS/55mkisofs b/scsilib/TARGETS/55mkisofs new file mode 100644 index 0000000..f29eece --- /dev/null +++ b/scsilib/TARGETS/55mkisofs @@ -0,0 +1 @@ +Creates populated ISO-9660 filesystem images diff --git a/scsilib/TARGETS/55mkisofs!@!diag b/scsilib/TARGETS/55mkisofs!@!diag new file mode 100644 index 0000000..90c157a --- /dev/null +++ b/scsilib/TARGETS/55mkisofs!@!diag @@ -0,0 +1 @@ +Diagnose tools for Mkisofs diff --git a/scsilib/TARGETS/55readcd b/scsilib/TARGETS/55readcd new file mode 100644 index 0000000..d68f712 --- /dev/null +++ b/scsilib/TARGETS/55readcd @@ -0,0 +1 @@ +CD data extraction program diff --git a/scsilib/TARGETS/55rscsi b/scsilib/TARGETS/55rscsi new file mode 100644 index 0000000..bc6cf8e --- /dev/null +++ b/scsilib/TARGETS/55rscsi @@ -0,0 +1 @@ +Remote SCSI transport server program (daemon) diff --git a/scsilib/TARGETS/55scgcheck b/scsilib/TARGETS/55scgcheck new file mode 100644 index 0000000..15c10f5 --- /dev/null +++ b/scsilib/TARGETS/55scgcheck @@ -0,0 +1 @@ +Libscg ABI compliance checker diff --git a/scsilib/TARGETS/55scgskeleton b/scsilib/TARGETS/55scgskeleton new file mode 100644 index 0000000..92fd3e7 --- /dev/null +++ b/scsilib/TARGETS/55scgskeleton @@ -0,0 +1 @@ +Skeleton program for SCSI transport using libscg diff --git a/scsilib/TARGETS/85man b/scsilib/TARGETS/85man new file mode 100644 index 0000000..b6d14cb --- /dev/null +++ b/scsilib/TARGETS/85man @@ -0,0 +1 @@ +Various man man pages diff --git a/scsilib/TARGETS/99export b/scsilib/TARGETS/99export new file mode 100644 index 0000000..ceef4a5 --- /dev/null +++ b/scsilib/TARGETS/99export @@ -0,0 +1 @@ +Export diff --git a/scsilib/TARGETS/README b/scsilib/TARGETS/README new file mode 100644 index 0000000..8ea0eb1 --- /dev/null +++ b/scsilib/TARGETS/README @@ -0,0 +1,12 @@ +05patches +15conf - Autofonfiguration part 1. Automated run of configure. +25inc - Autofonfiguration part 2. Create autogenerated include files. + +35 reserved + +45lib +55cmd +65kern +75 reserved +85man +95 reserved \ No newline at end of file diff --git a/scsilib/TARGETS/Targetdirs b/scsilib/TARGETS/Targetdirs new file mode 100644 index 0000000..80513bc --- /dev/null +++ b/scsilib/TARGETS/Targetdirs @@ -0,0 +1,6 @@ +########################################################################### +# +# This file is intentionally left empty. The targets are now defined by the +# "Slottable Source" feature of the makefile system +# +########################################################################### diff --git a/scsilib/TARGETS/__slot b/scsilib/TARGETS/__slot new file mode 100644 index 0000000..ed83197 --- /dev/null +++ b/scsilib/TARGETS/__slot @@ -0,0 +1 @@ +This file enables the "slot" feature of the Schily SING makefile system diff --git a/scsilib/TEMPLATES/Defaults.gcc b/scsilib/TEMPLATES/Defaults.gcc new file mode 100644 index 0000000..f9ebde3 --- /dev/null +++ b/scsilib/TEMPLATES/Defaults.gcc @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for unknown Systems using CC=gcc +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +#DEFCCOM= cc +DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/TEMPLATES/Defaults.xcc b/scsilib/TEMPLATES/Defaults.xcc new file mode 100644 index 0000000..4aa3014 --- /dev/null +++ b/scsilib/TEMPLATES/Defaults.xcc @@ -0,0 +1,38 @@ +#ident "%W% %E% %Q%" +########################################################################### +# +# global definitions for unknown Systems using CC=cc +# +########################################################################### +# +# Compiler stuff +# +########################################################################### +DEFCCOM= cc +#DEFCCOM= gcc +########################################################################### +# +# If the next line is commented out, compilation is done with max warn level +# If the next line is uncommented, compilation is done with minimal warnings +# +########################################################################### +#CWARNOPTS= + +DEFINCDIRS= $(SRCROOT)/include +LDPATH= -L/opt/schily/lib +#RUNPATH= -R $(INS_BASE)/lib -R /opt/schily/lib -R $(OLIBSDIR) Will probably not work + +########################################################################### +# +# Installation config stuff +# +########################################################################### +INS_BASE= /opt/schily +INS_KBASE= / +# +DEFUMASK= 002 +# +DEFINSMODEF= 444 +DEFINSMODEX= 755 +DEFINSUSR= bin +DEFINSGRP= bin diff --git a/scsilib/TEMPLATES/Makefile.aux b/scsilib/TEMPLATES/Makefile.aux new file mode 100644 index 0000000..4999af1 --- /dev/null +++ b/scsilib/TEMPLATES/Makefile.aux @@ -0,0 +1,16 @@ +#ident %W% %E% %Q% +########################################################################### +# Sample makefile for installing non-localized auxiliary files +########################################################################### +SRCROOT= ../.. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +INSDIR= etc +TARGET= help.dat +XMK_FILE= Makefile.man + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.aux +########################################################################### diff --git a/scsilib/TEMPLATES/Makefile.cmd b/scsilib/TEMPLATES/Makefile.cmd new file mode 100644 index 0000000..14392a1 --- /dev/null +++ b/scsilib/TEMPLATES/Makefile.cmd @@ -0,0 +1,19 @@ +#ident %W% %E% %Q% +########################################################################### +# Sample makefile for general application programs +########################################################################### +SRCROOT= ../.. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +INSDIR= bin +TARGET= cfform +#CPPOPTS += -Ispecincl +CFILES= cfform.c +LIBS= -lat +XMK_FILE= Makefile.man + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.cmd +########################################################################### diff --git a/scsilib/TEMPLATES/Makefile.dir b/scsilib/TEMPLATES/Makefile.dir new file mode 100644 index 0000000..3002390 --- /dev/null +++ b/scsilib/TEMPLATES/Makefile.dir @@ -0,0 +1,14 @@ +#ident %W% %E% %Q% +########################################################################### +# Sample makefile for sub directory makes +########################################################################### +SRCROOT= .. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +include Targetdirs.$(M_ARCH) + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.dir +########################################################################### diff --git a/scsilib/TEMPLATES/Makefile.drv b/scsilib/TEMPLATES/Makefile.drv new file mode 100644 index 0000000..8e6e33e --- /dev/null +++ b/scsilib/TEMPLATES/Makefile.drv @@ -0,0 +1,21 @@ +#ident %W% %E% %Q% +########################################################################### +# Sample makefile for general device drivers +########################################################################### +SRCROOT= ../../.. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +INSDIR= usr/kernel/drv +TARGET= ga +CPPOPTS += -DFOKUS -DATMNA -DBROKEN_PROM -DTPI_COMPAT \ + -DGADEBUG -DGADEBUG_MASK=0x0 +CFILES= ga.c +SRCLIBS= +LIBS= +XMK_FILE= Makefile.man + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.drv +########################################################################### diff --git a/scsilib/TEMPLATES/Makefile.inc b/scsilib/TEMPLATES/Makefile.inc new file mode 100644 index 0000000..dbfbd09 --- /dev/null +++ b/scsilib/TEMPLATES/Makefile.inc @@ -0,0 +1,15 @@ +#ident %W% %E% %Q% +########################################################################### +SRCROOT= .. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +INSDIR= include +TARGET= align.h +TARGETC= align_test +CFILES= align_test.c + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.inc +########################################################################### diff --git a/scsilib/TEMPLATES/Makefile.lib b/scsilib/TEMPLATES/Makefile.lib new file mode 100644 index 0000000..95968f3 --- /dev/null +++ b/scsilib/TEMPLATES/Makefile.lib @@ -0,0 +1,19 @@ +#ident %W% %E% %Q% +########################################################################### +# Sample makefile for non-shared libraries +########################################################################### +SRCROOT= ../.. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +INSDIR= lib +TARGETLIB= aal +CPPOPTS += -DFOKUS +CFILES= aallib.c +LIBS= +XMK_FILE= Makefile.man + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.lib +########################################################################### diff --git a/scsilib/TEMPLATES/Makefile.loc b/scsilib/TEMPLATES/Makefile.loc new file mode 100644 index 0000000..fcef2bc --- /dev/null +++ b/scsilib/TEMPLATES/Makefile.loc @@ -0,0 +1,17 @@ +#ident %W% %E% %Q% +########################################################################### +# Sample makefile for installing localized auxiliary files +########################################################################### +SRCROOT= ../.. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +INSDIR= etc +TARGET= test +SRCFILE= test +XMK_FILE= Makefile.man + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.loc +########################################################################### diff --git a/scsilib/TEMPLATES/Makefile.man b/scsilib/TEMPLATES/Makefile.man new file mode 100644 index 0000000..c4c56ed --- /dev/null +++ b/scsilib/TEMPLATES/Makefile.man @@ -0,0 +1,18 @@ +#ident %W% %E% %Q% +########################################################################### +# Sample makefile for installing manual pages +########################################################################### +SRCROOT= ../.. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +MANDIR= man +TARGETMAN= test +MANSECT= $(MANSECT_LIB) +MANSUFFIX= $(MANSUFF_LIB) +MANFILE= test.tr + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.man +########################################################################### diff --git a/scsilib/TEMPLATES/Makefile.mks b/scsilib/TEMPLATES/Makefile.mks new file mode 100644 index 0000000..87a1453 --- /dev/null +++ b/scsilib/TEMPLATES/Makefile.mks @@ -0,0 +1,16 @@ +#ident "%W% %E% %Q%" +########################################################################### +# Sample makefile for sub-makes in one directory +########################################################################### +SRCROOT= ../.. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +#MK_FILES= cfform.mk cfget20.mk cfhec11.mk cfinfo20.mk cfpld.mk cfput20.mk +MK_FILES= cfform.mk +XMK_FILE= Makefile.man + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.mks +########################################################################### diff --git a/scsilib/TEMPLATES/Makefile.mod b/scsilib/TEMPLATES/Makefile.mod new file mode 100644 index 0000000..6671ff4 --- /dev/null +++ b/scsilib/TEMPLATES/Makefile.mod @@ -0,0 +1,21 @@ +#ident %W% %E% %Q% +########################################################################### +# Sample makefile for loadable streams modules +########################################################################### +SRCROOT= ../../.. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +INSDIR= usr/kernel/strmod +TARGET= ga +CPPOPTS += -DFOKUS -DATMNA -DBROKEN_PROM -DTPI_COMPAT \ + -DGADEBUG -DGADEBUG_MASK=0x0 +CFILES= ga.c +SRCLIBS= +LIBS= +XMK_FILE= Makefile.man + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.mod +########################################################################### diff --git a/scsilib/TEMPLATES/Makefile.root b/scsilib/TEMPLATES/Makefile.root new file mode 100644 index 0000000..fbb3d30 --- /dev/null +++ b/scsilib/TEMPLATES/Makefile.root @@ -0,0 +1,17 @@ +#ident %W% %E% %Q% +########################################################################### +# Sample makefile for the source root +########################################################################### +SRCROOT= . +DIRNAME= SRCROOT +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +include Targetdirs.$(M_ARCH) + +########################################################################### +# Due to a bug in SunPRO make we need special rules for the root makefile +# +include $(SRCROOT)/$(RULESDIR)/rules.rdi +########################################################################### diff --git a/scsilib/TEMPLATES/Makefile.scr b/scsilib/TEMPLATES/Makefile.scr new file mode 100644 index 0000000..1a7ad30 --- /dev/null +++ b/scsilib/TEMPLATES/Makefile.scr @@ -0,0 +1,17 @@ +#ident %W% %E% %Q% +########################################################################### +# Sample makefile for installing localized shell scripts +########################################################################### +SRCROOT= ../.. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +INSDIR= bin +TARGET= test +SCRFILE= test.sh +XMK_FILE= Makefile.man + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.scr +########################################################################### diff --git a/scsilib/TEMPLATES/Makefile.shl b/scsilib/TEMPLATES/Makefile.shl new file mode 100644 index 0000000..27f12a6 --- /dev/null +++ b/scsilib/TEMPLATES/Makefile.shl @@ -0,0 +1,19 @@ +#ident %W% %E% %Q% +########################################################################### +# Sample makefile for shared libraries +########################################################################### +SRCROOT= ../.. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +INSDIR= lib +TARGETLIB= aal +CPPOPTS += -DFOKUS +CFILES= aallib.c +LIBS= +XMK_FILE= Makefile.man + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.shl +########################################################################### diff --git a/scsilib/TEMPLATES/Makefile_de.man b/scsilib/TEMPLATES/Makefile_de.man new file mode 100644 index 0000000..5cb767f --- /dev/null +++ b/scsilib/TEMPLATES/Makefile_de.man @@ -0,0 +1,20 @@ +#ident %W% %E% %Q% +########################################################################### +# Sample makefile for installing non english manual pages +########################################################################### +SRCROOT= ../.. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### +# Rules for German manual pages (replace de with your locale) +########################################################################### + +MANDIR= man/de +TARGETMAN= test +MANSECT= $(MANSECT_LIB) +MANSUFFIX= $(MANSUFF_LIB) +MANFILE= test-de.tr + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.man +########################################################################### diff --git a/scsilib/TEMPLATES/cmd.mk b/scsilib/TEMPLATES/cmd.mk new file mode 100644 index 0000000..14392a1 --- /dev/null +++ b/scsilib/TEMPLATES/cmd.mk @@ -0,0 +1,19 @@ +#ident %W% %E% %Q% +########################################################################### +# Sample makefile for general application programs +########################################################################### +SRCROOT= ../.. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +INSDIR= bin +TARGET= cfform +#CPPOPTS += -Ispecincl +CFILES= cfform.c +LIBS= -lat +XMK_FILE= Makefile.man + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.cmd +########################################################################### diff --git a/scsilib/TEMPLATES/inc.mk b/scsilib/TEMPLATES/inc.mk new file mode 100644 index 0000000..dbfbd09 --- /dev/null +++ b/scsilib/TEMPLATES/inc.mk @@ -0,0 +1,15 @@ +#ident %W% %E% %Q% +########################################################################### +SRCROOT= .. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +INSDIR= include +TARGET= align.h +TARGETC= align_test +CFILES= align_test.c + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.inc +########################################################################### diff --git a/scsilib/TEMPLATES/lib.mk b/scsilib/TEMPLATES/lib.mk new file mode 100644 index 0000000..95968f3 --- /dev/null +++ b/scsilib/TEMPLATES/lib.mk @@ -0,0 +1,19 @@ +#ident %W% %E% %Q% +########################################################################### +# Sample makefile for non-shared libraries +########################################################################### +SRCROOT= ../.. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +INSDIR= lib +TARGETLIB= aal +CPPOPTS += -DFOKUS +CFILES= aallib.c +LIBS= +XMK_FILE= Makefile.man + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.lib +########################################################################### diff --git a/scsilib/TEMPLATES/shl.mk b/scsilib/TEMPLATES/shl.mk new file mode 100644 index 0000000..27f12a6 --- /dev/null +++ b/scsilib/TEMPLATES/shl.mk @@ -0,0 +1,19 @@ +#ident %W% %E% %Q% +########################################################################### +# Sample makefile for shared libraries +########################################################################### +SRCROOT= ../.. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +INSDIR= lib +TARGETLIB= aal +CPPOPTS += -DFOKUS +CFILES= aallib.c +LIBS= +XMK_FILE= Makefile.man + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.shl +########################################################################### diff --git a/scsilib/TEMPLATES/temp-gcc.rul b/scsilib/TEMPLATES/temp-gcc.rul new file mode 100644 index 0000000..64d913f --- /dev/null +++ b/scsilib/TEMPLATES/temp-gcc.rul @@ -0,0 +1,75 @@ +#ident "%W% %E% %Q%" +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for unknown GCC systems +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(GCCOPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= -Wall -Wtraditional \ + -Wshadow -Wmissing-prototypes -Wstrict-prototypes +COPTOPT= -O +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; gcc +LDCC= @echo " ==> LINKING \"$@\""; gcc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; gcc +#RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +#LORDER= lorder +#TSORT= tsort +LORDER= echo +TSORT= cat + +RMDEP= : +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); gcc -M +MKDEP_OUT= + +MKDIR= $(MKDIR_SH) diff --git a/scsilib/TEMPLATES/temp-xcc.rul b/scsilib/TEMPLATES/temp-xcc.rul new file mode 100644 index 0000000..10f7390 --- /dev/null +++ b/scsilib/TEMPLATES/temp-xcc.rul @@ -0,0 +1,76 @@ +#ident "%W% %E% %Q%" +########################################################################### +# Written 1997 by J. Schilling +########################################################################### +# +# Platform dependent MACROS for unknown systems systems with dumb cc +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.prg +########################################################################### + +CPPFLAGS= $(CPPOPTS) $(CPPOPTX) +CFLAGS= $(COPTS) $(CWARNOPTS) $(COPTOPT) $(COPTX) + +CPPOPTS= -I. -I$(ARCHDIR) -I$(OINCSDIR) $(INCDIRS:%=-I%) $(OSDEFS) +COPTS= +CWOPTS= +# +# Switch optimizing on if your compiler supports it +#COPTOPT= -O +COPTOPT= +KDEFINES= -DKERNEL -D_KERNEL +COPTDYN= -fpic +COPTGPROF= -pg + +LIB_PREFIX= lib +LIB_SUFFIX= .a +SHL_SUFFIX= .so.1.0 + +#LIB_SOCKET= -lsocket -lnsl -ldl +LIB_SOCKET= +LIB_MATH= -lm +#LIB_KVM= -lkvm +LIB_KVM= + +LIBS_PATH= -L$(OLIBSDIR) + +LDFLAGS= $(LDOPTS) $(LDOPTX) +LDLIBS= $(LIBS) $(LIBX) + +#LDOPTS= $(LIBS_PATH) $(LDPATH) $(RUNPATH) +LDOPTS= $(LIBS_PATH) $(LDPATH) +LDOPTDYN= -shared -Wl,-soname,$(TARGET) +LNDYNLIB= @$(SYMLINK) $(TARGET) $(PTARGET_BASE).so + +FLOAT_OPTIONS= + +CC= @echo " ==> COMPILING \"$@\""; cc +LDCC= @echo " ==> LINKING \"$@\""; cc +DYNLD= @echo " ==> LINKING dynamic library \"$@\""; cc +#RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; ranlib +RANLIB= @echo " ==> RANDOMIZING ARCHIVE \"$@\""; true +ARFLAGS= cr +#LORDER= lorder +#TSORT= tsort +LORDER= echo +TSORT= cat + +RMDEP= : +#MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); cc -M +MKDEP= @echo " ==> MAKING DEPENDENCIES \"$@\""; $(RMDEP); echo "Cannot do -M with unknown cc"; : +MKDEP_OUT= diff --git a/scsilib/build_all.com b/scsilib/build_all.com new file mode 100644 index 0000000..be59c6f --- /dev/null +++ b/scsilib/build_all.com @@ -0,0 +1,29 @@ +$ set default [.LIBFILE] +$ write sys$output "Creating LIBFILE.OLB" +$ @LIBFILE.COM +$ set default [-.LIBHFS_ISO] +$ write sys$output "Creating LIBHFS_ISO.OLB" +$ @LIBHFS_ISO.COM +$ set default [-.LIBUNLS] +$ write sys$output "Creating LIBUNLS.OLB" +$ @LIBUNLS.COM +$ set default [-.LIBSCG] +$ write sys$output "Creating LIBSCG.OLB" +$ @libscg.com +$ set default [-.libschily] +$ write sys$output "Creating LIBSCHILY.OLB" +$ @libschily.com +$ set default [-.MKISOFS] +$ write sys$output "BUILDING MKISOFS.EXE" +$ @BUILD_MKISOFS.COM +$ set default [-.cdrecord] +$ write sys$output "BUILDING CDRECORD.EXE" +$ @build_cdrecord.com +$ set default [-.readcd] +$ write sys$output "BUILDING READCD.EXE" +$ @build_readcd.com +$ set default [-.CDDA2WAV] +$ write sys$output "BUILDING CDDA2WAV.EXE" +$ @BUILD_CDDA2WAV.com +$ set default [-] +$ dir [.bins]*.exe diff --git a/scsilib/conf/Makefile b/scsilib/conf/Makefile new file mode 100644 index 0000000..a96fb16 --- /dev/null +++ b/scsilib/conf/Makefile @@ -0,0 +1,50 @@ +#ident @(#)Makefile 1.2 04/01/23 +########################################################################### +# Written 1998 by J. Schilling +########################################################################### +# Makefile for local dynamic configuration +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +SRCROOT= .. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +CONFFILES= Inull rules.cnf xconfig.h + +PCONFFILES= $(CONFFILES:%=$(OINCSDIR)/%) + +all: config + +clobber: + $(RM_F) $(PCONFFILES) + +distclean: + $(RM) $(RM_RF) $(PCONFFILES) \ + .vedtmp* *.bak OBJ/* \ + $(SRCROOT)/libs/* $(SRCROOT)/incs/* + +########################################################################### +# Now done in rules.top +#include $(SRCROOT)/$(RULESDIR)/rules.cnf +########################################################################### + +OTHERTARGETS= clean install ibins depend rmdep \ + TAGS tags rmtarget relink + +$(OTHERTARGETS): + @echo "$@: nothing to make" + diff --git a/scsilib/conf/acgeneral.m4 b/scsilib/conf/acgeneral.m4 new file mode 100644 index 0000000..b967fb5 --- /dev/null +++ b/scsilib/conf/acgeneral.m4 @@ -0,0 +1,2610 @@ +dnl Parameterized macros. +dnl Requires GNU m4. +dnl This file is part of Autoconf. +dnl Copyright (C) 1992, 93, 94, 95, 96, 1998 Free Software Foundation, Inc. +dnl +dnl This program 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, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception, the Free Software Foundation gives unlimited +dnl permission to copy, distribute and modify the configure scripts that +dnl are the output of Autoconf. You need not follow the terms of the GNU +dnl General Public License when using or distributing such scripts, even +dnl though portions of the text of Autoconf appear in them. The GNU +dnl General Public License (GPL) does govern all other use of the material +dnl that constitutes the Autoconf program. +dnl +dnl Certain portions of the Autoconf source text are designed to be copied +dnl (in certain cases, depending on the input) into the output of +dnl Autoconf. We call these the "data" portions. The rest of the Autoconf +dnl source text consists of comments plus executable code that decides which +dnl of the data portions to output in any given case. We call these +dnl comments and executable code the "non-data" portions. Autoconf never +dnl copies any of the non-data portions into its output. +dnl +dnl This special exception to the GPL applies to versions of Autoconf +dnl released by the Free Software Foundation. When you make and +dnl distribute a modified version of Autoconf, you may extend this special +dnl exception to the GPL to apply to your modified version as well, *unless* +dnl your modified version has the potential to copy into its output some +dnl of the text that was the non-data portion of the version that you started +dnl with. (In other words, unless your change moves or copies text from +dnl the non-data portions to the data portions.) If your modification has +dnl such potential, you must delete any notice of this special exception +dnl to the GPL from your modified version. +dnl +dnl Written by David MacKenzie, with help from +dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, +dnl Roland McGrath, Noah Friedman, david d zuhn, and many others. +dnl +divert(-1)dnl Throw away output until AC_INIT is called. +changequote([, ]) + +define(AC_ACVERSION, 2.13) + +dnl Some old m4's don't support m4exit. But they provide +dnl equivalent functionality by core dumping because of the +dnl long macros we define. +ifdef([__gnu__], , [errprint(Autoconf requires GNU m4. +Install it before installing Autoconf or set the +M4 environment variable to its path name. +)m4exit(2)]) + +undefine([eval]) +undefine([include]) +undefine([shift]) +undefine([format]) + + +dnl ### Defining macros + + +dnl m4 output diversions. We let m4 output them all in order at the end, +dnl except that we explicitly undivert AC_DIVERSION_SED, AC_DIVERSION_CMDS, +dnl and AC_DIVERSION_ICMDS. + +dnl AC_DIVERSION_NOTICE - 1 (= 0) AC_REQUIRE'd #! /bin/sh line +define(AC_DIVERSION_NOTICE, 1)dnl copyright notice & option help strings +define(AC_DIVERSION_INIT, 2)dnl initialization code +define(AC_DIVERSION_NORMAL_4, 3)dnl AC_REQUIRE'd code, 4 level deep +define(AC_DIVERSION_NORMAL_3, 4)dnl AC_REQUIRE'd code, 3 level deep +define(AC_DIVERSION_NORMAL_2, 5)dnl AC_REQUIRE'd code, 2 level deep +define(AC_DIVERSION_NORMAL_1, 6)dnl AC_REQUIRE'd code, 1 level deep +define(AC_DIVERSION_NORMAL, 7)dnl the tests and output code +define(AC_DIVERSION_SED, 8)dnl variable substitutions in config.status +define(AC_DIVERSION_CMDS, 9)dnl extra shell commands in config.status +define(AC_DIVERSION_ICMDS, 10)dnl extra initialization in config.status + +dnl Change the diversion stream to STREAM, while stacking old values. +dnl AC_DIVERT_PUSH(STREAM) +define(AC_DIVERT_PUSH, +[pushdef([AC_DIVERSION_CURRENT], $1)dnl +divert(AC_DIVERSION_CURRENT)dnl +]) + +dnl Change the diversion stream to its previous value, unstacking it. +dnl AC_DIVERT_POP() +define(AC_DIVERT_POP, +[popdef([AC_DIVERSION_CURRENT])dnl +divert(AC_DIVERSION_CURRENT)dnl +]) + +dnl Initialize the diversion setup. +define([AC_DIVERSION_CURRENT], AC_DIVERSION_NORMAL) +dnl This will be popped by AC_REQUIRE in AC_INIT. +pushdef([AC_DIVERSION_CURRENT], AC_DIVERSION_NOTICE) + +dnl The prologue for Autoconf macros. +dnl AC_PRO(MACRO-NAME) +define(AC_PRO, +[define([AC_PROVIDE_$1], )dnl +ifelse(AC_DIVERSION_CURRENT, AC_DIVERSION_NORMAL, +[AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))], +[pushdef([AC_DIVERSION_CURRENT], AC_DIVERSION_CURRENT)])dnl +]) + +dnl The Epilogue for Autoconf macros. +dnl AC_EPI() +define(AC_EPI, +[AC_DIVERT_POP()dnl +ifelse(AC_DIVERSION_CURRENT, AC_DIVERSION_NORMAL, +[undivert(AC_DIVERSION_NORMAL_4)dnl +undivert(AC_DIVERSION_NORMAL_3)dnl +undivert(AC_DIVERSION_NORMAL_2)dnl +undivert(AC_DIVERSION_NORMAL_1)dnl +])dnl +]) + +dnl Define a macro which automatically provides itself. Add machinery +dnl so the macro automatically switches expansion to the diversion +dnl stack if it is not already using it. In this case, once finished, +dnl it will bring back all the code accumulated in the diversion stack. +dnl This, combined with AC_REQUIRE, achieves the topological ordering of +dnl macros. We don't use this macro to define some frequently called +dnl macros that are not involved in ordering constraints, to save m4 +dnl processing. +dnl AC_DEFUN(NAME, EXPANSION) +define([AC_DEFUN], +[define($1, [AC_PRO([$1])$2[]AC_EPI()])]) + + +dnl ### Initialization + + +dnl AC_INIT_NOTICE() +AC_DEFUN(AC_INIT_NOTICE, +[# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version] AC_ACVERSION [ +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +[#] Any additions from configure.in:]) + +dnl AC_PREFIX_DEFAULT(PREFIX) +AC_DEFUN(AC_PREFIX_DEFAULT, +[AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl +ac_default_prefix=$1 +AC_DIVERT_POP()]) + +dnl AC_INIT_PARSE_ARGS() +AC_DEFUN(AC_INIT_PARSE_ARGS, +[ +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +dnl Installation directory options. +dnl These are left unexpanded so users can "make install exec_prefix=/foo" +dnl and all the variables that are supposed to be based on exec_prefix +dnl by default will actually change. +dnl Use braces instead of parens because sh, perl, etc. also accept them. +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +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 +changequote(, )dnl + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; +changequote([, ])dnl + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -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 ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$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" ;; + + -cc=* | --cc=* ) + CC="$ac_optarg" ; echo using $CC as compiler ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. +changequote(, )dnl + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then +changequote([, ])dnl + AC_MSG_ERROR($ac_feature: invalid feature name) + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. +changequote(, )dnl + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then +changequote([, ])dnl + AC_MSG_ERROR($ac_feature: invalid feature name) + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + 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) + # 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 << EOF +changequote(, )dnl +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +changequote([, ])dnl +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$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" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + 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) + 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" ;; + + -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 ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version AC_ACVERSION" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. +changequote(, )dnl + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then +changequote([, ])dnl + AC_MSG_ERROR($ac_package: invalid package name) + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. +changequote(, )dnl + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then +changequote([, ])dnl + AC_MSG_ERROR($ac_package: invalid package name) + fi + 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" ;; + + -*) AC_MSG_ERROR([$ac_option: invalid option; use --help to show usage]) + ;; + + *) +changequote(, )dnl + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then +changequote([, ])dnl + AC_MSG_WARN($ac_option: invalid host type) + fi + if test "x$nonopt" != xNONE; then + AC_MSG_ERROR(can only configure for one host and one target at a time) + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + AC_MSG_ERROR(missing argument to --`echo $ac_prev | sed 's/_/-/g'`) +fi +]) + +dnl Try to have only one #! line, so the script doesn't look funny +dnl for users of AC_REVISION. +dnl AC_INIT_BINSH() +AC_DEFUN(AC_INIT_BINSH, +[#! /bin/sh +]) + +dnl AC_INIT(UNIQUE-FILE-IN-SOURCE-DIR) +AC_DEFUN(AC_INIT, +[sinclude(acsite.m4)dnl +sinclude(./aclocal.m4)dnl +AC_REQUIRE([AC_INIT_BINSH])dnl +AC_INIT_NOTICE +AC_DIVERT_POP()dnl to NORMAL +AC_DIVERT_PUSH(AC_DIVERSION_INIT)dnl +AC_INIT_PARSE_ARGS +AC_INIT_PREPARE($1)dnl +AC_DIVERT_POP()dnl to NORMAL +]) + +dnl AC_INIT_PREPARE(UNIQUE-FILE-IN-SOURCE-DIR) +AC_DEFUN(AC_INIT_PREPARE, +[trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +define(AC_FD_MSG, 6)dnl +[#] AC_FD_MSG checking for... messages and results +define(AC_FD_CC, 5)dnl +[#] AC_FD_CC compiler messages saved in config.log +if test "$silent" = yes; then + exec AC_FD_MSG>/dev/null +else + exec AC_FD_MSG>&1 +fi +exec AC_FD_CC>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&AC_FD_CC + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; +changequote(<<, >>)dnl +dnl If you change this globbing pattern, test it on an old shell -- +dnl it's sensitive. Putting any kind of quote in it causes syntax errors. + *" "*|*" "*|*[\[\]\~\<<#>>\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; +changequote([, ])dnl + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=$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 its parent. + ac_prog=[$]0 +changequote(, )dnl + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` +changequote([, ])dnl + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + 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 + if test "$ac_srcdir_defaulted" = yes; then + AC_MSG_ERROR(can not find sources in $ac_confdir or ..) + else + AC_MSG_ERROR(can not find sources in $srcdir) + fi +fi +dnl Double slashes in pathnames in object file debugging info +dnl mess up M-x gdb in Emacs. +changequote(, )dnl +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` +changequote([, ])dnl + +dnl Let the site file select an alternate cache file if it wants to. +AC_SITE_LOAD +AC_CACHE_LOAD +AC_LANG_C +dnl By default always use an empty string as the executable +dnl extension. Only change it if the script calls AC_EXEEXT. +ac_exeext= +dnl By default assume that objects files use an extension of .o. Only +dnl change it if the script calls AC_OBJEXT. +ac_objext=o +AC_PROG_ECHO_N +dnl Substitute for predefined variables. +AC_SUBST(SHELL)dnl +AC_SUBST(CFLAGS)dnl +AC_SUBST(CPPFLAGS)dnl +AC_SUBST(CXXFLAGS)dnl +AC_SUBST(FFLAGS)dnl +AC_SUBST(DEFS)dnl +AC_SUBST(LDFLAGS)dnl +AC_SUBST(LIBS)dnl +AC_SUBST(exec_prefix)dnl +AC_SUBST(prefix)dnl +AC_SUBST(program_transform_name)dnl +dnl Installation directory options. +AC_SUBST(bindir)dnl +AC_SUBST(sbindir)dnl +AC_SUBST(libexecdir)dnl +AC_SUBST(datadir)dnl +AC_SUBST(sysconfdir)dnl +AC_SUBST(sharedstatedir)dnl +AC_SUBST(localstatedir)dnl +AC_SUBST(libdir)dnl +AC_SUBST(includedir)dnl +AC_SUBST(oldincludedir)dnl +AC_SUBST(infodir)dnl +AC_SUBST(mandir)dnl +]) + + +dnl ### Selecting optional features + + +dnl AC_ARG_ENABLE(FEATURE, HELP-STRING, ACTION-IF-TRUE [, ACTION-IF-FALSE]) +AC_DEFUN(AC_ARG_ENABLE, +[AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl +ac_help="$ac_help +[$2]" +AC_DIVERT_POP()dnl +[#] Check whether --enable-[$1] or --disable-[$1] was given. +if test "[${enable_]patsubst([$1], -, _)+set}" = set; then + enableval="[$enable_]patsubst([$1], -, _)" + ifelse([$3], , :, [$3]) +ifelse([$4], , , [else + $4 +])dnl +fi +]) + +AC_DEFUN(AC_ENABLE, +[AC_OBSOLETE([$0], [; instead use AC_ARG_ENABLE])dnl +AC_ARG_ENABLE([$1], [ --enable-$1], [$2], [$3])dnl +]) + + +dnl ### Working with optional software + + +dnl AC_ARG_WITH(PACKAGE, HELP-STRING, ACTION-IF-TRUE [, ACTION-IF-FALSE]) +AC_DEFUN(AC_ARG_WITH, +[AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)dnl +ac_help="$ac_help +[$2]" +AC_DIVERT_POP()dnl +[#] Check whether --with-[$1] or --without-[$1] was given. +if test "[${with_]patsubst([$1], -, _)+set}" = set; then + withval="[$with_]patsubst([$1], -, _)" + ifelse([$3], , :, [$3]) +ifelse([$4], , , [else + $4 +])dnl +fi +]) + +AC_DEFUN(AC_WITH, +[AC_OBSOLETE([$0], [; instead use AC_ARG_WITH])dnl +AC_ARG_WITH([$1], [ --with-$1], [$2], [$3])dnl +]) + + +dnl ### Transforming program names. + + +dnl AC_ARG_PROGRAM() +AC_DEFUN(AC_ARG_PROGRAM, +[if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," +]) + + +dnl ### Version numbers + + +dnl AC_REVISION(REVISION-INFO) +AC_DEFUN(AC_REVISION, +[AC_REQUIRE([AC_INIT_BINSH])dnl +[# From configure.in] translit([$1], $")]) + +dnl Subroutines of AC_PREREQ. + +dnl Change the dots in NUMBER into commas. +dnl AC_PREREQ_SPLIT(NUMBER) +define(AC_PREREQ_SPLIT, +[translit($1, ., [, ])]) + +dnl Default the ternary version number to 0 (e.g., 1, 7 -> 1, 7, 0). +dnl AC_PREREQ_CANON(MAJOR, MINOR [,TERNARY]) +define(AC_PREREQ_CANON, +[$1, $2, ifelse([$3], , 0, [$3])]) + +dnl Complain and exit if version number 1 is less than version number 2. +dnl PRINTABLE2 is the printable version of version number 2. +dnl AC_PREREQ_COMPARE(MAJOR1, MINOR1, TERNARY1, MAJOR2, MINOR2, TERNARY2, +dnl PRINTABLE2) +define(AC_PREREQ_COMPARE, +[ifelse(builtin([eval], +[$3 + $2 * 1000 + $1 * 1000000 < $6 + $5 * 1000 + $4 * 1000000]), 1, +[errprint(dnl +FATAL ERROR: Autoconf version $7 or higher is required for this script +)m4exit(3)])]) + +dnl Complain and exit if the Autoconf version is less than VERSION. +dnl AC_PREREQ(VERSION) +define(AC_PREREQ, +[AC_PREREQ_COMPARE(AC_PREREQ_CANON(AC_PREREQ_SPLIT(AC_ACVERSION)), +AC_PREREQ_CANON(AC_PREREQ_SPLIT([$1])), [$1])]) + + +dnl ### Getting the canonical system type + + +dnl Find install-sh, config.sub, config.guess, and Cygnus configure +dnl in directory DIR. These are auxiliary files used in configuration. +dnl DIR can be either absolute or relative to $srcdir. +dnl AC_CONFIG_AUX_DIR(DIR) +AC_DEFUN(AC_CONFIG_AUX_DIR, +[AC_CONFIG_AUX_DIRS($1 $srcdir/$1)]) + +dnl The default is `$srcdir' or `$srcdir/..' or `$srcdir/../..'. +dnl There's no need to call this macro explicitly; just AC_REQUIRE it. +AC_DEFUN(AC_CONFIG_AUX_DIR_DEFAULT, +[AC_CONFIG_AUX_DIRS($srcdir $srcdir/.. $srcdir/../..)]) + +dnl Internal subroutine. +dnl Search for the configuration auxiliary files in directory list $1. +dnl We look only for install-sh, so users of AC_PROG_INSTALL +dnl do not automatically need to distribute the other auxiliary files. +dnl AC_CONFIG_AUX_DIRS(DIR ...) +AC_DEFUN(AC_CONFIG_AUX_DIRS, +[ac_aux_dir= +for ac_dir in $1; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + AC_MSG_ERROR([can not find install-sh or install.sh in $1]) +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. +AC_PROVIDE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +]) + +dnl Canonicalize the host, target, and build system types. +AC_DEFUN(AC_CANONICAL_SYSTEM, +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_BEFORE([$0], [AC_ARG_PROGRAM]) +# Do some error checking and defaulting for the host and target type. +# The inputs are: +# configure --host=HOST --target=TARGET --build=BUILD NONOPT +# +# The rules are: +# 1. You are not allowed to specify --host, --target, and nonopt at the +# same time. +# 2. Host defaults to nonopt. +# 3. If nonopt is not specified, then host defaults to the current host, +# as determined by config.guess. +# 4. Target and build default to nonopt. +# 5. If nonopt is not specified, then target and build default to host. + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +case $host---$target---$nonopt in +NONE---*---* | *---NONE---* | *---*---NONE) ;; +*) AC_MSG_ERROR(can only configure for one host and one target at a time) ;; +esac + +AC_CANONICAL_HOST +AC_CANONICAL_TARGET +AC_CANONICAL_BUILD +test "$host_alias" != "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- +]) + +dnl Subroutines of AC_CANONICAL_SYSTEM. + +AC_DEFUN(AC_CANONICAL_HOST, +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else AC_MSG_ERROR(can not run $ac_config_sub) +fi + +AC_MSG_CHECKING(host system type) + +dnl Set host_alias. +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else AC_MSG_ERROR(can not guess host type; you must specify one) + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +dnl Set the other host vars. +changequote(<<, >>)dnl +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +changequote([, ])dnl +AC_MSG_RESULT($host) +AC_SUBST(host)dnl +AC_SUBST(host_alias)dnl +AC_SUBST(host_cpu)dnl +AC_SUBST(host_vendor)dnl +AC_SUBST(host_os)dnl +]) + +dnl Internal use only. +AC_DEFUN(AC_CANONICAL_TARGET, +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_MSG_CHECKING(target system type) + +dnl Set target_alias. +target_alias=$target +case "$target_alias" in +NONE) + case $nonopt in + NONE) target_alias=$host_alias ;; + *) target_alias=$nonopt ;; + esac ;; +esac + +dnl Set the other target vars. +changequote(<<, >>)dnl +target=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $target_alias` +target_cpu=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +target_vendor=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +target_os=`echo $target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +changequote([, ])dnl +AC_MSG_RESULT($target) +AC_SUBST(target)dnl +AC_SUBST(target_alias)dnl +AC_SUBST(target_cpu)dnl +AC_SUBST(target_vendor)dnl +AC_SUBST(target_os)dnl +]) + +dnl Internal use only. +AC_DEFUN(AC_CANONICAL_BUILD, +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_MSG_CHECKING(build system type) + +dnl Set build_alias. +build_alias=$build +case "$build_alias" in +NONE) + case $nonopt in + NONE) build_alias=$host_alias ;; + *) build_alias=$nonopt ;; + esac ;; +esac + +dnl Set the other build vars. +changequote(<<, >>)dnl +build=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $build_alias` +build_cpu=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +build_vendor=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +build_os=`echo $build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +changequote([, ])dnl +AC_MSG_RESULT($build) +AC_SUBST(build)dnl +AC_SUBST(build_alias)dnl +AC_SUBST(build_cpu)dnl +AC_SUBST(build_vendor)dnl +AC_SUBST(build_os)dnl +]) + + +dnl AC_VALIDATE_CACHED_SYSTEM_TUPLE[(cmd)] +dnl if the cache file is inconsistent with the current host, +dnl target and build system types, execute CMD or print a default +dnl error message. +AC_DEFUN(AC_VALIDATE_CACHED_SYSTEM_TUPLE, [ + AC_REQUIRE([AC_CANONICAL_SYSTEM]) + AC_MSG_CHECKING([cached system tuple]) + if { test x"${ac_cv_host_system_type+set}" = x"set" && + test x"$ac_cv_host_system_type" != x"$host"; } || + { test x"${ac_cv_build_system_type+set}" = x"set" && + test x"$ac_cv_build_system_type" != x"$build"; } || + { test x"${ac_cv_target_system_type+set}" = x"set" && + test x"$ac_cv_target_system_type" != x"$target"; }; then + AC_MSG_RESULT([different]) + ifelse($#, 1, [$1], + [AC_MSG_ERROR([remove config.cache and re-run configure])]) + else + AC_MSG_RESULT(ok) + fi + ac_cv_host_system_type="$host" + ac_cv_build_system_type="$build" + ac_cv_target_system_type="$target" +]) + + +dnl ### Caching test results + + +dnl Look for site or system specific initialization scripts. +dnl AC_SITE_LOAD() +define(AC_SITE_LOAD, +[# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done +]) + +dnl AC_CACHE_LOAD() +define(AC_CACHE_LOAD, +[if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi +]) + +dnl AC_CACHE_SAVE() +define(AC_CACHE_SAVE, +[cat > confcache <<\EOF +# 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. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +dnl Allow a site initialization script to override cache values. +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# 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. +changequote(, )dnl +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +changequote([, ])dnl +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache +]) + +dnl The name of shell var CACHE-ID must contain `_cv_' in order to get saved. +dnl AC_CACHE_VAL(CACHE-ID, COMMANDS-TO-SET-IT) +define(AC_CACHE_VAL, +[dnl We used to use the below line, but it fails if the 1st arg is a +dnl shell variable, so we need the eval. +dnl if test "${$1+set}" = set; then +dnl the '' avoids an AIX 4.1 sh bug ("invalid expansion"). +if eval "test \"`echo '$''{'$1'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&AC_FD_MSG +else + $2 +fi +]) + +dnl AC_CACHE_CHECK(MESSAGE, CACHE-ID, COMMANDS) +define(AC_CACHE_CHECK, +[AC_MSG_CHECKING([$1]) +AC_CACHE_VAL([$2], [$3]) +AC_MSG_RESULT([$]$2)]) + + +dnl ### Defining symbols + + +dnl Set VARIABLE to VALUE, verbatim, or 1. +dnl AC_DEFINE(VARIABLE [, VALUE]) +define(AC_DEFINE, +[cat >> confdefs.h <<\EOF +[#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1) +EOF +]) + +dnl Similar, but perform shell substitutions $ ` \ once on VALUE. +define(AC_DEFINE_UNQUOTED, +[cat >> confdefs.h <<EOF +[#define] $1 ifelse($#, 2, [$2], $#, 3, [$2], 1) +EOF +]) + + +dnl ### Setting output variables + + +dnl This macro protects VARIABLE from being diverted twice +dnl if this macro is called twice for it. +dnl AC_SUBST(VARIABLE) +define(AC_SUBST, +[ifdef([AC_SUBST_$1], , +[define([AC_SUBST_$1], )dnl +AC_DIVERT_PUSH(AC_DIVERSION_SED)dnl +s%@$1@%[$]$1%g +AC_DIVERT_POP()dnl +])]) + +dnl AC_SUBST_FILE(VARIABLE) +define(AC_SUBST_FILE, +[ifdef([AC_SUBST_$1], , +[define([AC_SUBST_$1], )dnl +AC_DIVERT_PUSH(AC_DIVERSION_SED)dnl +/@$1@/r [$]$1 +s%@$1@%%g +AC_DIVERT_POP()dnl +])]) + + +dnl ### Printing messages + + +dnl AC_MSG_CHECKING(FEATURE-DESCRIPTION) +define(AC_MSG_CHECKING, +[echo $ac_n "checking $1""... $ac_c" 1>&AC_FD_MSG +echo "configure:__oline__: checking $1" >&AC_FD_CC]) + +dnl AC_CHECKING(FEATURE-DESCRIPTION) +define(AC_CHECKING, +[echo "checking $1" 1>&AC_FD_MSG +echo "configure:__oline__: checking $1" >&AC_FD_CC]) + +dnl AC_MSG_RESULT(RESULT-DESCRIPTION) +define(AC_MSG_RESULT, +[echo "$ac_t""$1" 1>&AC_FD_MSG]) + +dnl AC_VERBOSE(RESULT-DESCRIPTION) +define(AC_VERBOSE, +[AC_OBSOLETE([$0], [; instead use AC_MSG_RESULT])dnl +echo " $1" 1>&AC_FD_MSG]) + +dnl AC_MSG_WARN(PROBLEM-DESCRIPTION) +define(AC_MSG_WARN, +[echo "configure: warning: $1" 1>&2]) + +dnl AC_MSG_ERROR(ERROR-DESCRIPTION) +define(AC_MSG_ERROR, +[{ echo "configure: error: $1" 1>&2; exit 1; }]) + + +dnl ### Selecting which language to use for testing + + +dnl AC_LANG_C() +AC_DEFUN(AC_LANG_C, +[define([AC_LANG], [C])dnl +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&AC_FD_CC' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' +cross_compiling=$ac_cv_prog_cc_cross +]) + +dnl AC_LANG_CPLUSPLUS() +AC_DEFUN(AC_LANG_CPLUSPLUS, +[define([AC_LANG], [CPLUSPLUS])dnl +ac_ext=C +# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&AC_FD_CC' +ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' +cross_compiling=$ac_cv_prog_cxx_cross +]) + +dnl AC_LANG_FORTRAN77() +AC_DEFUN(AC_LANG_FORTRAN77, +[define([AC_LANG], [FORTRAN77])dnl +ac_ext=f +ac_compile='${F77-f77} -c $FFLAGS conftest.$ac_ext 1>&AC_FD_CC' +ac_link='${F77-f77} -o conftest${ac_exeext} $FFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&AC_FD_CC' +cross_compiling=$ac_cv_prog_f77_cross +]) + +dnl Push the current language on a stack. +dnl AC_LANG_SAVE() +define(AC_LANG_SAVE, +[pushdef([AC_LANG_STACK], AC_LANG)]) + +dnl Restore the current language from the stack. +dnl AC_LANG_RESTORE() +pushdef([AC_LANG_RESTORE], +[ifelse(AC_LANG_STACK, [C], [AC_LANG_C],dnl +AC_LANG_STACK, [CPLUSPLUS], [AC_LANG_CPLUSPLUS],dnl +AC_LANG_STACK, [FORTRAN77], [AC_LANG_FORTRAN77])[]popdef([AC_LANG_STACK])]) + + +dnl ### Compiler-running mechanics + + +dnl The purpose of this macro is to "configure:123: command line" +dnl written into config.log for every test run. +dnl AC_TRY_EVAL(VARIABLE) +AC_DEFUN(AC_TRY_EVAL, +[{ (eval echo configure:__oline__: \"[$]$1\") 1>&AC_FD_CC; dnl +(eval [$]$1) 2>&AC_FD_CC; }]) + +dnl AC_TRY_COMMAND(COMMAND) +AC_DEFUN(AC_TRY_COMMAND, +[{ ac_try='$1'; AC_TRY_EVAL(ac_try); }]) + + +dnl ### Dependencies between macros + + +dnl AC_BEFORE(THIS-MACRO-NAME, CALLED-MACRO-NAME) +define(AC_BEFORE, +[ifdef([AC_PROVIDE_$2], [errprint(__file__:__line__: [$2 was called before $1 +])])]) + +dnl AC_REQUIRE(MACRO-NAME) +define(AC_REQUIRE, +[ifdef([AC_PROVIDE_$1], , +[AC_DIVERT_PUSH(builtin(eval, AC_DIVERSION_CURRENT - 1))dnl +indir([$1]) +AC_DIVERT_POP()dnl +])]) + +dnl AC_PROVIDE(MACRO-NAME) +define(AC_PROVIDE, +[define([AC_PROVIDE_$1], )]) + +dnl AC_OBSOLETE(THIS-MACRO-NAME [, SUGGESTION]) +define(AC_OBSOLETE, +[errprint(__file__:__line__: warning: [$1] is obsolete[$2] +)]) + + +dnl ### Checking for programs + + +dnl AC_CHECK_PROG(VARIABLE, PROG-TO-CHECK-FOR, VALUE-IF-FOUND +dnl [, [VALUE-IF-NOT-FOUND] [, [PATH] [, [REJECT]]]]) +AC_DEFUN(AC_CHECK_PROG, +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_prog_$1, +[if test -n "[$]$1"; then + ac_cv_prog_$1="[$]$1" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +ifelse([$6], , , [ ac_prog_rejected=no +])dnl +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$5], , $PATH, [$5])" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then +ifelse([$6], , , dnl +[ if test "[$ac_dir/$ac_word]" = "$6"; then + ac_prog_rejected=yes + continue + fi +])dnl + ac_cv_prog_$1="$3" + break + fi + done + IFS="$ac_save_ifs" +ifelse([$6], , , [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_$1 + shift + if test [$]# -gt 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 $1 to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "[$]@" + shift + ac_cv_prog_$1="[$]@" +ifelse([$2], [$4], dnl +[ else + # Default is a loser. + AC_MSG_ERROR([$1=$6 unacceptable, but no other $4 found in dnl +ifelse([$5], , [\$]PATH, [$5])]) +])dnl + fi +fi +])dnl +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_CHECK_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_prog_$1" && ac_cv_prog_$1="$4" +])dnl +fi])dnl +$1="$ac_cv_prog_$1" +if test -n "[$]$1"; then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) + +dnl AC_PATH_PROG(VARIABLE, PROG-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN(AC_PATH_PROG, +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="ifelse([$4], , $PATH, [$4])" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" +dnl If no 3rd arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$3], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$3" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test -n "[$]$1"; then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) + +dnl AC_CHECK_PROGS(VARIABLE, PROGS-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND +dnl [, PATH]]) +AC_DEFUN(AC_CHECK_PROGS, +[for ac_prog in $2 +do +AC_CHECK_PROG($1, [$]ac_prog, [$]ac_prog, , $4) +test -n "[$]$1" && break +done +ifelse([$3], , , [test -n "[$]$1" || $1="$3" +])]) + +dnl AC_PATH_PROGS(VARIABLE, PROGS-TO-CHECK-FOR [, VALUE-IF-NOT-FOUND +dnl [, PATH]]) +AC_DEFUN(AC_PATH_PROGS, +[for ac_prog in $2 +do +AC_PATH_PROG($1, [$]ac_prog, , $4) +test -n "[$]$1" && break +done +ifelse([$3], , , [test -n "[$]$1" || $1="$3" +])]) + +dnl Internal subroutine. +AC_DEFUN(AC_CHECK_TOOL_PREFIX, +[AC_REQUIRE([AC_CANONICAL_HOST])AC_REQUIRE([AC_CANONICAL_BUILD])dnl +if test $host != $build; then + ac_tool_prefix=${host_alias}- +else + ac_tool_prefix= +fi +]) + +dnl AC_CHECK_TOOL(VARIABLE, PROG-TO-CHECK-FOR[, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN(AC_CHECK_TOOL, +[AC_REQUIRE([AC_CHECK_TOOL_PREFIX])dnl +AC_CHECK_PROG($1, ${ac_tool_prefix}$2, ${ac_tool_prefix}$2, + ifelse([$3], , [$2], ), $4) +ifelse([$3], , , [ +if test -z "$ac_cv_prog_$1"; then +if test -n "$ac_tool_prefix"; then + AC_CHECK_PROG($1, $2, $2, $3) +else + $1="$3" +fi +fi]) +]) + +dnl Guess the value for the `prefix' variable by looking for +dnl the argument program along PATH and taking its parent. +dnl Example: if the argument is `gcc' and we find /usr/local/gnu/bin/gcc, +dnl set `prefix' to /usr/local/gnu. +dnl This comes too late to find a site file based on the prefix, +dnl and it might use a cached value for the path. +dnl No big loss, I think, since most configures don't use this macro anyway. +dnl AC_PREFIX_PROGRAM(PROGRAM) +AC_DEFUN(AC_PREFIX_PROGRAM, +[if test "x$prefix" = xNONE; then +changequote(<<, >>)dnl +define(<<AC_VAR_NAME>>, translit($1, [a-z], [A-Z]))dnl +changequote([, ])dnl +dnl We reimplement AC_MSG_CHECKING (mostly) to avoid the ... in the middle. +echo $ac_n "checking for prefix by $ac_c" 1>&AC_FD_MSG +AC_PATH_PROG(AC_VAR_NAME, $1) +changequote(<<, >>)dnl + if test -n "$ac_cv_path_<<>>AC_VAR_NAME"; then + prefix=`echo $ac_cv_path_<<>>AC_VAR_NAME|sed 's%/[^/][^/]*//*[^/][^/]*$%%'` +changequote([, ])dnl + fi +fi +undefine([AC_VAR_NAME])dnl +]) + +dnl Try to compile, link and execute TEST-PROGRAM. Set WORKING-VAR to +dnl `yes' if the current compiler works, otherwise set it ti `no'. Set +dnl CROSS-VAR to `yes' if the compiler and linker produce non-native +dnl executables, otherwise set it to `no'. Before calling +dnl `AC_TRY_COMPILER()', call `AC_LANG_*' to set-up for the right +dnl language. +dnl +dnl AC_TRY_COMPILER(TEST-PROGRAM, WORKING-VAR, CROSS-VAR) +AC_DEFUN(AC_TRY_COMPILER, +[cat > conftest.$ac_ext << EOF +ifelse(AC_LANG, [FORTRAN77], , +[ +[#]line __oline__ "configure" +#include "confdefs.h" +]) +[$1] +EOF +if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + [$2]=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + [$3]=no + else + [$3]=yes + fi +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC + [$2]=no +fi +rm -fr conftest*]) + + +dnl ### Checking for libraries + + +dnl AC_TRY_LINK_FUNC(func, action-if-found, action-if-not-found) +dnl Try to link a program that calls FUNC, handling GCC builtins. If +dnl the link succeeds, execute ACTION-IF-FOUND; otherwise, execute +dnl ACTION-IF-NOT-FOUND. + +AC_DEFUN(AC_TRY_LINK_FUNC, +AC_TRY_LINK(dnl +ifelse([$1], [main], , dnl Avoid conflicting decl of main. +[/* Override any gcc2 internal prototype to avoid an error. */ +]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus +extern "C" +#endif +])dnl +[/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $1(); +]), +[$1()], +[$2], +[$3])) + + +dnl AC_SEARCH_LIBS(FUNCTION, SEARCH-LIBS [, ACTION-IF-FOUND +dnl [, ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]]) +dnl Search for a library defining FUNC, if it's not already available. + +AC_DEFUN(AC_SEARCH_LIBS, +[AC_PREREQ([2.13]) +AC_CACHE_CHECK([for library containing $1], [ac_cv_search_$1], +[ac_func_search_save_LIBS="$LIBS" +ac_cv_search_$1="no" +AC_TRY_LINK_FUNC([$1], [ac_cv_search_$1="none required"]) +test "$ac_cv_search_$1" = "no" && for i in $2; do +LIBS="-l$i $5 $ac_func_search_save_LIBS" +AC_TRY_LINK_FUNC([$1], +[ac_cv_search_$1="-l$i" +break]) +done +LIBS="$ac_func_search_save_LIBS"]) +if test "$ac_cv_search_$1" != "no"; then + test "$ac_cv_search_$1" = "none required" || LIBS="$ac_cv_search_$1 $LIBS" + $3 +else : + $4 +fi]) + + + +dnl AC_CHECK_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND +dnl [, OTHER-LIBRARIES]]]) +AC_DEFUN(AC_CHECK_LIB, +[AC_MSG_CHECKING([for $2 in -l$1]) +dnl Use a cache variable name containing both the library and function name, +dnl because the test really is for library $1 defining function $2, not +dnl just for library $1. Separate tests with the same $1 and different $2s +dnl may have different results. +ac_lib_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'` +AC_CACHE_VAL(ac_cv_lib_$ac_lib_var, +[ac_save_LIBS="$LIBS" +LIBS="-l$1 $5 $LIBS" +AC_TRY_LINK(dnl +ifelse(AC_LANG, [FORTRAN77], , +ifelse([$2], [main], , dnl Avoid conflicting decl of main. +[/* Override any gcc2 internal prototype to avoid an error. */ +]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus +extern "C" +#endif +])dnl +[/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $2(); +])), + [$2()], + eval "ac_cv_lib_$ac_lib_var=yes", + eval "ac_cv_lib_$ac_lib_var=no") +LIBS="$ac_save_LIBS" +])dnl +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + AC_MSG_RESULT(yes) + ifelse([$3], , +[changequote(, )dnl + ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` +changequote([, ])dnl + AC_DEFINE_UNQUOTED($ac_tr_lib) + LIBS="-l$1 $LIBS" +], [$3]) +else + AC_MSG_RESULT(no) +ifelse([$4], , , [$4 +])dnl +fi +]) + +dnl AC_HAVE_LIBRARY(LIBRARY, [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND +dnl [, OTHER-LIBRARIES]]]) +AC_DEFUN(AC_HAVE_LIBRARY, +[AC_OBSOLETE([$0], [; instead use AC_CHECK_LIB])dnl +changequote(<<, >>)dnl +define(<<AC_LIB_NAME>>, dnl +patsubst(patsubst($1, <<lib\([^\.]*\)\.a>>, <<\1>>), <<-l>>, <<>>))dnl +define(<<AC_CV_NAME>>, ac_cv_lib_<<>>AC_LIB_NAME)dnl +changequote([, ])dnl +AC_MSG_CHECKING([for -l[]AC_LIB_NAME]) +AC_CACHE_VAL(AC_CV_NAME, +[ac_save_LIBS="$LIBS" +LIBS="-l[]AC_LIB_NAME[] $4 $LIBS" +AC_TRY_LINK( , [main()], AC_CV_NAME=yes, AC_CV_NAME=no) +LIBS="$ac_save_LIBS" +])dnl +AC_MSG_RESULT($AC_CV_NAME) +if test "$AC_CV_NAME" = yes; then + ifelse([$2], , +[AC_DEFINE([HAVE_LIB]translit(AC_LIB_NAME, [a-z], [A-Z])) + LIBS="-l[]AC_LIB_NAME[] $LIBS" +], [$2]) +ifelse([$3], , , [else + $3 +])dnl +fi +undefine([AC_LIB_NAME])dnl +undefine([AC_CV_NAME])dnl +]) + + +dnl ### Examining declarations + + +dnl AC_TRY_CPP(INCLUDES, [ACTION-IF-TRUE [, ACTION-IF-FALSE]]) +AC_DEFUN(AC_TRY_CPP, +[AC_REQUIRE_CPP()dnl +cat > conftest.$ac_ext <<EOF +[#]line __oline__ "configure" +#include "confdefs.h" +[$1] +EOF +dnl Capture the stderr of cpp. eval is necessary to expand ac_cpp. +dnl We used to copy stderr to stdout and capture it in a variable, but +dnl that breaks under sh -x, which writes compile commands starting +dnl with ` +' to stderr in eval and subshells. +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +AC_TRY_EVAL(ac_try) +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + ifelse([$2], , :, [rm -rf conftest* + $2]) +else + echo "$ac_err" >&AC_FD_CC + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +ifelse([$3], , , [ rm -rf conftest* + $3 +])dnl +fi +rm -f conftest*]) + +dnl AC_EGREP_HEADER(PATTERN, HEADER-FILE, ACTION-IF-FOUND [, +dnl ACTION-IF-NOT-FOUND]) +AC_DEFUN(AC_EGREP_HEADER, +[AC_EGREP_CPP([$1], [#include <$2>], [$3], [$4])]) + +dnl Because this macro is used by AC_PROG_GCC_TRADITIONAL, which must +dnl come early, it is not included in AC_BEFORE checks. +dnl AC_EGREP_CPP(PATTERN, PROGRAM, [ACTION-IF-FOUND [, +dnl ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_EGREP_CPP, +[AC_REQUIRE_CPP()dnl +cat > conftest.$ac_ext <<EOF +[#]line __oline__ "configure" +#include "confdefs.h" +[$2] +EOF +dnl eval is necessary to expand ac_cpp. +dnl Ultrix and Pyramid sh refuse to redirect output of eval, so use subshell. +if (eval "$ac_cpp conftest.$ac_ext") 2>&AC_FD_CC | +dnl Prevent m4 from eating character classes: +changequote(, )dnl + egrep "$1" >/dev/null 2>&1; then +changequote([, ])dnl + ifelse([$3], , :, [rm -rf conftest* + $3]) +ifelse([$4], , , [else + rm -rf conftest* + $4 +])dnl +fi +rm -f conftest* +]) + + +dnl ### Examining syntax + + +dnl AC_TRY_COMPILE(INCLUDES, FUNCTION-BODY, +dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_TRY_COMPILE, +[cat > conftest.$ac_ext <<EOF +ifelse(AC_LANG, [FORTRAN77], +[ program main +[$2] + end], +[dnl This sometimes fails to find confdefs.h, for some reason. +dnl [#]line __oline__ "[$]0" +[#]line __oline__ "configure" +#include "confdefs.h" +[$1] +int main() { +[$2] +; return 0; } +])EOF +if AC_TRY_EVAL(ac_compile); then + ifelse([$3], , :, [rm -rf conftest* + $3]) +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +ifelse([$4], , , [ rm -rf conftest* + $4 +])dnl +fi +rm -f conftest*]) + + +dnl ### Examining libraries + + +dnl AC_COMPILE_CHECK(ECHO-TEXT, INCLUDES, FUNCTION-BODY, +dnl ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]) +AC_DEFUN(AC_COMPILE_CHECK, +[AC_OBSOLETE([$0], [; instead use AC_TRY_COMPILE or AC_TRY_LINK, and AC_MSG_CHECKING and AC_MSG_RESULT])dnl +ifelse([$1], , , [AC_CHECKING([for $1]) +])dnl +AC_TRY_LINK([$2], [$3], [$4], [$5]) +]) + +dnl AC_TRY_LINK(INCLUDES, FUNCTION-BODY, +dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_TRY_LINK, +[cat > conftest.$ac_ext <<EOF +ifelse(AC_LANG, [FORTRAN77], +[ + program main + call [$2] + end +], +[dnl This sometimes fails to find confdefs.h, for some reason. +dnl [#]line __oline__ "[$]0" +[#]line __oline__ "configure" +#include "confdefs.h" +[$1] +int main() { +[$2] +; return 0; } +])EOF +if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + ifelse([$3], , :, [rm -rf conftest* + $3]) +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +ifelse([$4], , , [ rm -rf conftest* + $4 +])dnl +fi +rm -f conftest*]) + + +dnl ### Checking for run-time features + + +dnl AC_TRY_RUN(PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE +dnl [, ACTION-IF-CROSS-COMPILING]]]) +AC_DEFUN(AC_TRY_RUN, +[if test "$cross_compiling" = yes; then + ifelse([$4], , + [errprint(__file__:__line__: warning: [AC_TRY_RUN] called without default to allow cross compiling +)dnl + AC_MSG_ERROR(can not run test program while cross compiling)], + [$4]) +else + AC_TRY_RUN_NATIVE([$1], [$2], [$3]) +fi +]) + +dnl Like AC_TRY_RUN but assumes a native-environment (non-cross) compiler. +dnl AC_TRY_RUN_NATIVE(PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE]]) +AC_DEFUN(AC_TRY_RUN_NATIVE, +[cat > conftest.$ac_ext <<EOF +[#]line __oline__ "configure" +#include "confdefs.h" +ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus +extern "C" void exit(int); +#endif +])dnl +[$1] +EOF +if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then +dnl Don't remove the temporary files here, so they can be examined. + ifelse([$2], , :, [$2]) +else + echo "configure: failed program was:" >&AC_FD_CC + cat conftest.$ac_ext >&AC_FD_CC +ifelse([$3], , , [ rm -fr conftest* + $3 +])dnl +fi +rm -fr conftest*]) + + +dnl ### Checking for header files + + +dnl AC_CHECK_HEADER(HEADER-FILE, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_CHECK_HEADER, +[dnl Do the transliteration at runtime so arg 1 can be a shell variable. +ac_safe=`echo "$1" | sed 'y%./+-%__p_%'` +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(ac_cv_header_$ac_safe, +[AC_TRY_CPP([#include <$1>], eval "ac_cv_header_$ac_safe=yes", + eval "ac_cv_header_$ac_safe=no")])dnl +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) +else + AC_MSG_RESULT(no) +ifelse([$3], , , [$3 +])dnl +fi +]) + +dnl AC_CHECK_HEADERS(HEADER-FILE... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_CHECK_HEADERS, +[for ac_hdr in $1 +do +AC_CHECK_HEADER($ac_hdr, +[changequote(, )dnl + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` +changequote([, ])dnl + AC_DEFINE_UNQUOTED($ac_tr_hdr) $2], $3)dnl +done +]) + + +dnl ### Checking for the existence of files + +dnl AC_CHECK_FILE(FILE, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_CHECK_FILE, +[AC_REQUIRE([AC_PROG_CC]) +dnl Do the transliteration at runtime so arg 1 can be a shell variable. +ac_safe=`echo "$1" | sed 'y%./+-%__p_%'` +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(ac_cv_file_$ac_safe, +[if test "$cross_compiling" = yes; then + errprint(__file__:__line__: warning: Cannot check for file existence when cross compiling +)dnl + AC_MSG_ERROR(Cannot check for file existence when cross compiling) +else + if test -r $1; then + eval "ac_cv_file_$ac_safe=yes" + else + eval "ac_cv_file_$ac_safe=no" + fi +fi])dnl +if eval "test \"`echo '$ac_cv_file_'$ac_safe`\" = yes"; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) +else + AC_MSG_RESULT(no) +ifelse([$3], , , [$3]) +fi +]) + +dnl AC_CHECK_FILES(FILE... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_CHECK_FILES, +[for ac_file in $1 +do +AC_CHECK_FILE($ac_file, +[changequote(, )dnl + ac_tr_file=HAVE_`echo $ac_file | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` +changequote([, ])dnl + AC_DEFINE_UNQUOTED($ac_tr_file) $2], $3)dnl +done +]) + + +dnl ### Checking for library functions + + +dnl AC_CHECK_FUNC(FUNCTION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_CHECK_FUNC, +[AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(ac_cv_func_$1, +[AC_TRY_LINK( +dnl Don't include <ctype.h> because on OSF/1 3.0 it includes <sys/types.h> +dnl which includes <sys/select.h> which contains a prototype for +dnl select. Similarly for bzero. +[/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $1(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus +extern "C" +#endif +])dnl +[/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $1(); +], [ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$1) || defined (__stub___$1) +choke me +#else +$1(); +#endif +], eval "ac_cv_func_$1=yes", eval "ac_cv_func_$1=no")]) +if eval "test \"`echo '$ac_cv_func_'$1`\" = yes"; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) +else + AC_MSG_RESULT(no) +ifelse([$3], , , [$3 +])dnl +fi +]) + +dnl AC_CHECK_FUNCS(FUNCTION... [, ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]) +AC_DEFUN(AC_CHECK_FUNCS, +[for ac_func in $1 +do +AC_CHECK_FUNC($ac_func, +[changequote(, )dnl + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` +changequote([, ])dnl + AC_DEFINE_UNQUOTED($ac_tr_func) $2], $3)dnl +done +]) + +dnl AC_REPLACE_FUNCS(FUNCTION...) +AC_DEFUN(AC_REPLACE_FUNCS, +[AC_CHECK_FUNCS([$1], , [LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"]) +AC_SUBST(LIBOBJS)dnl +]) + + +dnl ### Checking compiler characteristics + + +dnl AC_CHECK_SIZEOF(TYPE [, CROSS-SIZE]) +AC_DEFUN(AC_CHECK_SIZEOF, +[changequote(<<, >>)dnl +dnl The name to #define. +define(<<AC_TYPE_NAME>>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl +dnl The cache variable name. +define(<<AC_CV_NAME>>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl +changequote([, ])dnl +AC_MSG_CHECKING(size of $1) +AC_CACHE_VAL(AC_CV_NAME, +[AC_TRY_RUN([#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof($1)); + exit(0); +}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl +AC_MSG_RESULT($AC_CV_NAME) +AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME) +undefine([AC_TYPE_NAME])dnl +undefine([AC_CV_NAME])dnl +]) + + +dnl ### Checking for typedefs + + +dnl AC_CHECK_TYPE(TYPE, DEFAULT) +AC_DEFUN(AC_CHECK_TYPE, +[AC_REQUIRE([AC_HEADER_STDC])dnl +AC_MSG_CHECKING(for $1) +AC_CACHE_VAL(ac_cv_type_$1, +[AC_EGREP_CPP(dnl +changequote(<<,>>)dnl +<<(^|[^a-zA-Z_0-9])$1[^a-zA-Z_0-9]>>dnl +changequote([,]), [#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif], ac_cv_type_$1=yes, ac_cv_type_$1=no)])dnl +AC_MSG_RESULT($ac_cv_type_$1) +if test $ac_cv_type_$1 = no; then + AC_DEFINE($1, $2) +fi +]) + + +dnl ### Creating output files + + +dnl AC_CONFIG_HEADER(HEADER-TO-CREATE ...) +AC_DEFUN(AC_CONFIG_HEADER, +[define(AC_LIST_HEADER, $1)]) + +dnl Link each of the existing files SOURCE... to the corresponding +dnl link name in DEST... +dnl AC_LINK_FILES(SOURCE..., DEST...) +AC_DEFUN(AC_LINK_FILES, +[dnl +define([AC_LIST_FILES], ifdef([AC_LIST_FILES], [AC_LIST_FILES ],)[$1])dnl +define([AC_LIST_LINKS], ifdef([AC_LIST_LINKS], [AC_LIST_LINKS ],)[$2])]) + +dnl Add additional commands for AC_OUTPUT to put into config.status. +dnl Use diversions instead of macros so we can be robust in the +dnl presence of commas in $1 and/or $2. +dnl AC_OUTPUT_COMMANDS(EXTRA-CMDS, INIT-CMDS) +AC_DEFUN(AC_OUTPUT_COMMANDS, +[AC_DIVERT_PUSH(AC_DIVERSION_CMDS)dnl +[$1] +AC_DIVERT_POP()dnl +AC_DIVERT_PUSH(AC_DIVERSION_ICMDS)dnl +[$2] +AC_DIVERT_POP()]) + +dnl AC_CONFIG_SUBDIRS(DIR ...) +AC_DEFUN(AC_CONFIG_SUBDIRS, +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +define([AC_LIST_SUBDIRS], ifdef([AC_LIST_SUBDIRS], [AC_LIST_SUBDIRS ],)[$1])dnl +subdirs="AC_LIST_SUBDIRS" +AC_SUBST(subdirs)dnl +]) + +dnl The big finish. +dnl Produce config.status, config.h, and links; and configure subdirs. +dnl AC_OUTPUT([FILE...] [, EXTRA-CMDS] [, INIT-CMDS]) +define(AC_OUTPUT, +[trap '' 1 2 15 +AC_CACHE_SAVE +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then +changequote(, )dnl + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +changequote([, ])dnl +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +ifdef([AC_LIST_HEADER], [DEFS=-DHAVE_CONFIG_H], [AC_OUTPUT_MAKE_DEFS()]) + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +dnl hostname on some systems (SVR3.2, Linux) returns a bogus exit status, +dnl so uname gets run too. +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +[#] [$]0 [$]ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +changequote(, )dnl +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +changequote([, ])dnl +for ac_option +do + case "[\$]ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]ac_configure_args --no-create --no-recursion" + exec [\$]{CONFIG_SHELL-/bin/sh} [$]0 [$]ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version AC_ACVERSION" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "[\$]ac_cs_usage"; exit 0 ;; + *) echo "[\$]ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ifdef([AC_PROVIDE_AC_PROG_INSTALL], [ac_given_INSTALL="$INSTALL" +])dnl + +changequote(<<, >>)dnl +ifdef(<<AC_LIST_HEADER>>, +<<trap 'rm -fr `echo "$1 AC_LIST_HEADER" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15>>, +<<trap 'rm -fr `echo "$1" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15>>) +changequote([, ])dnl +EOF +cat >> $CONFIG_STATUS <<EOF + +AC_OUTPUT_FILES($1) +ifdef([AC_LIST_HEADER], [AC_OUTPUT_HEADER(AC_LIST_HEADER)])dnl +ifdef([AC_LIST_LINKS], [AC_OUTPUT_LINKS(AC_LIST_FILES, AC_LIST_LINKS)])dnl +EOF +cat >> $CONFIG_STATUS <<EOF +undivert(AC_DIVERSION_ICMDS)dnl +$3 +EOF +cat >> $CONFIG_STATUS <<\EOF +undivert(AC_DIVERSION_CMDS)dnl +$2 +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 +dnl config.status should not do recursion. +ifdef([AC_LIST_SUBDIRS], [AC_OUTPUT_SUBDIRS(AC_LIST_SUBDIRS)])dnl +])dnl + +dnl Set the DEFS variable to the -D options determined earlier. +dnl This is a subroutine of AC_OUTPUT. +dnl It is called inside configure, outside of config.status. +dnl AC_OUTPUT_MAKE_DEFS() +define(AC_OUTPUT_MAKE_DEFS, +[# Transform confdefs.h into DEFS. +dnl Using a here document instead of a string reduces the quoting nightmare. +# Protect against shell expansion while executing Makefile rules. +# Protect against Makefile macro expansion. +cat > conftest.defs <<\EOF +changequote(<<, >>)dnl +s%<<#define>> \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g +s%[ `~<<#>>$^&*(){}\\|;'"<>?]%\\&%g +s%\[%\\&%g +s%\]%\\&%g +s%\$%$$%g +changequote([, ])dnl +EOF +DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` +rm -f conftest.defs +]) + +dnl Do the variable substitutions to create the Makefiles or whatever. +dnl This is a subroutine of AC_OUTPUT. It is called inside an unquoted +dnl here document whose contents are going into config.status, but +dnl upon returning, the here document is being quoted. +dnl AC_OUTPUT_FILES(FILE...) +define(AC_OUTPUT_FILES, +[# Protect against being on the right side of a sed subst in config.status. +changequote(, )dnl +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +changequote([, ])dnl +dnl These here document variables are unquoted when configure runs +dnl but quoted when config.status runs, so variables are expanded once. +$ac_vpsub +dnl Shell code in configure.in might set extrasub. +$extrasub +dnl Insert the sed substitutions of variables. +undivert(AC_DIVERSION_SED) +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"$1"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then +changequote(, )dnl + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` +changequote([, ])dnl + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. +changequote(, )dnl + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` +changequote([, ])dnl + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + +ifdef([AC_PROVIDE_AC_PROG_INSTALL], +[ case "$ac_given_INSTALL" in +changequote(, )dnl + [/$]*) INSTALL="$ac_given_INSTALL" ;; +changequote([, ])dnl + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac +])dnl + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +ifdef([AC_PROVIDE_AC_PROG_INSTALL], [s%@INSTALL@%$INSTALL%g +])dnl +dnl The parens around the eval prevent an "illegal io" in Ultrix sh. +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +dnl This would break Makefile dependencies. +dnl if cmp -s $ac_file conftest.out 2>/dev/null; then +dnl echo "$ac_file is unchanged" +dnl rm -f conftest.out +dnl else +dnl rm -f $ac_file +dnl mv conftest.out $ac_file +dnl fi +fi; done +rm -f conftest.s* +]) + +dnl Create the config.h files from the config.h.in files. +dnl This is a subroutine of AC_OUTPUT. It is called inside a quoted +dnl here document whose contents are going into config.status. +dnl AC_OUTPUT_HEADER(HEADER-FILE...) +define(AC_OUTPUT_HEADER, +[changequote(<<, >>)dnl +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='<<$>>%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' +changequote([, ])dnl + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +dnl Support passing AC_CONFIG_HEADER a value containing shell variables. +cat >> $CONFIG_STATUS <<EOF + CONFIG_HEADERS="$1" +EOF +cat >> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then +changequote(, )dnl + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac +changequote([, ])dnl + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +dnl Using a here document instead of a string reduces the quoting nightmare. +dnl Putting comments in sed scripts is not portable. +cat > conftest.hdr <<\EOF +changequote(<<, >>)dnl +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%<<#define>> \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +changequote([, ])dnl +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +changequote(, )dnl +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +changequote([, ])dnl +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +dnl Now back to your regularly scheduled config.status. +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + changequote(, )dnl + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + changequote([, ])dnl + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +]) + +dnl This is a subroutine of AC_OUTPUT. It is called inside a quoted +dnl here document whose contents are going into config.status. +dnl AC_OUTPUT_LINKS(SOURCE..., DEST...) +define(AC_OUTPUT_LINKS, +[EOF + +cat >> $CONFIG_STATUS <<EOF +ac_sources="$1" +ac_dests="$2" +EOF + +cat >> $CONFIG_STATUS <<\EOF +srcdir=$ac_given_srcdir +while test -n "$ac_sources"; do + set $ac_dests; ac_dest=[$]1; shift; ac_dests=[$]* + set $ac_sources; ac_source=[$]1; shift; ac_sources=[$]* + + echo "linking $srcdir/$ac_source to $ac_dest" + + if test ! -r $srcdir/$ac_source; then + AC_MSG_ERROR($srcdir/$ac_source: File not found) + fi + rm -f $ac_dest + + # Make relative symlinks. + # Remove last slash and all that follows it. Not all systems have dirname. +changequote(, )dnl + ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'` +changequote([, ])dnl + if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then + # The dest file is in a subdirectory. + test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir" + ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dest_dir_suffix. +changequote(, )dnl + ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'` +changequote([, ])dnl + else + ac_dest_dir_suffix= ac_dots= + fi + + case "$srcdir" in +changequote(, )dnl + [/$]*) ac_rel_source="$srcdir/$ac_source" ;; +changequote([, ])dnl + *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;; + esac + + # Make a symlink if possible; otherwise try a hard link. + if ln -s $ac_rel_source $ac_dest 2>/dev/null || + ln $srcdir/$ac_source $ac_dest; then : + else + AC_MSG_ERROR(can not link $ac_dest to $srcdir/$ac_source) + fi +done +]) + +dnl This is a subroutine of AC_OUTPUT. +dnl It is called after running config.status. +dnl AC_OUTPUT_SUBDIRS(DIRECTORY...) +define(AC_OUTPUT_SUBDIRS, +[ +if test "$no_recursion" != yes; then + + # Remove --cache-file and --srcdir arguments so they do not pile up. + ac_sub_configure_args= + ac_prev= + for ac_arg in $ac_configure_args; do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case "$ac_arg" in + -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=*) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; + esac + done + + for ac_config_dir in $1; do + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + if test ! -d $srcdir/$ac_config_dir; then + continue + fi + + echo configuring in $ac_config_dir + + case "$srcdir" in + .) ;; + *) + if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :; + else + AC_MSG_ERROR(can not create `pwd`/$ac_config_dir) + fi + ;; + esac + + ac_popdir=`pwd` + cd $ac_config_dir + +changequote(, )dnl + # A "../" for each directory in /$ac_config_dir. + ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'` +changequote([, ])dnl + + case "$srcdir" in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + /*) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_config_dir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f $ac_sub_srcdir/configure; then + ac_sub_configure=$ac_sub_srcdir/configure + elif test -f $ac_sub_srcdir/configure.in; then + ac_sub_configure=$ac_configure + else + AC_MSG_WARN(no configuration information is in $ac_config_dir) + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + + # Make the cache file name correct relative to the subdirectory. + case "$cache_file" in + /*) ac_sub_cache_file=$cache_file ;; + *) # Relative path. + ac_sub_cache_file="$ac_dots$cache_file" ;; + esac +ifdef([AC_PROVIDE_AC_PROG_INSTALL], + [ case "$ac_given_INSTALL" in +changequote(, )dnl + [/$]*) INSTALL="$ac_given_INSTALL" ;; +changequote([, ])dnl + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac +])dnl + + echo "[running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file] --srcdir=$ac_sub_srcdir" + # The eval makes quoting arguments work. + if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir + then : + else + AC_MSG_ERROR($ac_sub_configure failed for $ac_config_dir) + fi + fi + + cd $ac_popdir + done +fi +]) diff --git a/scsilib/conf/aclocal.m4 b/scsilib/conf/aclocal.m4 new file mode 100644 index 0000000..4eaa9a1 --- /dev/null +++ b/scsilib/conf/aclocal.m4 @@ -0,0 +1,1875 @@ +dnl @(#)aclocal.m4 1.39 04/07/25 Copyright 1998 J. Schilling + +dnl Set VARIABLE to VALUE in C-string form, verbatim, or 1. +dnl AC_DEFINE_STRING(VARIABLE [, VALUE]) +define(AC_DEFINE_STRING, +[cat >> confdefs.h <<\EOF +[#define] $1 ifelse($#, 2, "[$2]", $#, 3, "[$2]", 1) +EOF +]) + +dnl Similar, but perform shell substitutions $ ` \ once on VALUE. +define(AC_DEFINE_UNQUOTED_STRING, +[cat >> confdefs.h <<EOF +[#define] $1 ifelse($#, 2, "[$2]", $#, 3, "[$2]", 1) +EOF +]) + +dnl Checks if structure 'stat' have field 'st_spare1'. +dnl Defines HAVE_ST_SPARE1 on success. +AC_DEFUN([AC_STRUCT_ST_SPARE1], +[AC_CACHE_CHECK([if struct stat contains st_spare1], ac_cv_struct_st_spare1, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/stat.h>], + [struct stat s; s.st_spare1 = 0;], + [ac_cv_struct_st_spare1=yes], + [ac_cv_struct_st_spare1=no])]) +if test $ac_cv_struct_st_spare1 = yes; then + AC_DEFINE(HAVE_ST_SPARE1) +fi]) + +dnl Checks if structure 'stat' have field 'st_atimensec'. +dnl Defines HAVE_ST_ATIMENSEC on success. +AC_DEFUN([AC_STRUCT_ST_ATIMENSEC], +[AC_CACHE_CHECK([if struct stat contains st_atimensec], ac_cv_struct_st_atimensec, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/stat.h>], + [struct stat s; s.st_atimensec = 0;], + [ac_cv_struct_st_atimensec=yes], + [ac_cv_struct_st_atimensec=no])]) +if test $ac_cv_struct_st_atimensec = yes; then + AC_DEFINE(HAVE_ST_ATIMENSEC) +fi]) + +dnl Checks if structure 'stat' have field 'st_atim.tv_nsec'. +dnl Defines HAVE_ST_NSEC on success. +AC_DEFUN([AC_STRUCT_ST_NSEC], +[AC_CACHE_CHECK([if struct stat contains st_atim.tv_nsec], ac_cv_struct_st_nsec, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/stat.h>], + [struct stat s; s.st_atim.tv_nsec = 0;], + [ac_cv_struct_st_nsec=yes], + [ac_cv_struct_st_nsec=no])]) +if test $ac_cv_struct_st_nsec = yes; then + AC_DEFINE(HAVE_ST_NSEC) +fi]) + +dnl Checks if structure 'stat' have field 'st_atim.st__tim.tv_nsec'. +dnl Defines HAVE_ST__TIM on success. +AC_DEFUN([AC_STRUCT_ST__TIM], +[AC_CACHE_CHECK([if struct stat contains st_atim.st__tim.tv_nsec], ac_cv_struct_st__tim, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/stat.h>], + [struct stat s; s.st_atim.st__tim.tv_nsec = 0;], + [ac_cv_struct_st__tim=yes], + [ac_cv_struct_st__tim=no])]) +if test $ac_cv_struct_st__tim = yes; then + AC_DEFINE(HAVE_ST__TIM) +fi]) + +dnl Checks if structure 'stat' have field 'st_atimspec.tv_nsec'. +dnl Defines HAVE_ST_ATIMESPEC on success. +AC_DEFUN([AC_STRUCT_ST_ATIMESPEC], +[AC_CACHE_CHECK([if struct stat contains st_atimespec.tv_nsec], ac_cv_struct_st_atimespec, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/stat.h>], + [struct stat s; s.st_atimespec.tv_nsec = 0;], + [ac_cv_struct_st_atimespec=yes], + [ac_cv_struct_st_atimespec=no])]) +if test $ac_cv_struct_st_atimespec = yes; then + AC_DEFINE(HAVE_ST_ATIMESPEC) +fi]) + +dnl Checks if structure 'stat' have field 'st_flags'. +dnl Defines HAVE_ST_FLAGS on success. +AC_DEFUN([AC_STRUCT_ST_FLAGS], +[AC_CACHE_CHECK([if struct stat contains st_flags], ac_cv_struct_st_flags, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/stat.h>], + [struct stat s; s.st_flags = 0;], + [ac_cv_struct_st_flags=yes], + [ac_cv_struct_st_flags=no])]) +if test $ac_cv_struct_st_flags = yes; then + AC_DEFINE(HAVE_ST_FLAGS) +fi]) + +dnl Checks if structure 'stat' have field 'st_fstype'. +dnl Defines HAVE_ST_FSTYPE on success. +AC_DEFUN([AC_STRUCT_ST_FSTYPE], +[AC_CACHE_CHECK([if struct stat contains st_fstype], ac_cv_struct_st_fstype, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/stat.h>], + [struct stat s; s.st_fstype[0] = 0;], + [ac_cv_struct_st_fstype=yes], + [ac_cv_struct_st_fstype=no])]) +if test $ac_cv_struct_st_fstype = yes; then + AC_DEFINE(HAVE_ST_FSTYPE) +fi]) + +dnl Checks if structure 'mtget' have field 'mt_type'. +dnl Defines HAVE_MTGET_TYPE on success. +AC_DEFUN([AC_STRUCT_MTGET_TYPE], +[AC_CACHE_CHECK([if struct mtget contains mt_type], ac_cv_struct_mtget_type, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/mtio.h>], + [struct mtget t; t.mt_type = 0;], + [ac_cv_struct_mtget_type=yes], + [ac_cv_struct_mtget_type=no])]) +if test $ac_cv_struct_mtget_type = yes; then + AC_DEFINE(HAVE_MTGET_TYPE) +fi]) + +dnl Checks if structure 'mtget' have field 'mt_model'. +dnl Defines HAVE_MTGET_MODEL on success. +AC_DEFUN([AC_STRUCT_MTGET_MODEL], +[AC_CACHE_CHECK([if struct mtget contains mt_model], ac_cv_struct_mtget_model, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/mtio.h>], + [struct mtget t; t.mt_model = 0;], + [ac_cv_struct_mtget_model=yes], + [ac_cv_struct_mtget_model=no])]) +if test $ac_cv_struct_mtget_model = yes; then + AC_DEFINE(HAVE_MTGET_MODEL) +fi]) + +dnl Checks if structure 'mtget' have field 'mt_dsreg'. +dnl Defines HAVE_MTGET_DSREG on success. +AC_DEFUN([AC_STRUCT_MTGET_DSREG], +[AC_CACHE_CHECK([if struct mtget contains mt_dsreg], ac_cv_struct_mtget_dsreg, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/mtio.h>], + [struct mtget t; t.mt_dsreg = 0;], + [ac_cv_struct_mtget_dsreg=yes], + [ac_cv_struct_mtget_dsreg=no])]) +if test $ac_cv_struct_mtget_dsreg = yes; then + AC_DEFINE(HAVE_MTGET_DSREG) +fi]) + +dnl Checks if structure 'mtget' have field 'mt_dsreg1'. +dnl Defines HAVE_MTGET_DSREG on success. +AC_DEFUN([AC_STRUCT_MTGET_DSREG1], +[AC_CACHE_CHECK([if struct mtget contains mt_dsreg1], ac_cv_struct_mtget_dsreg1, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/mtio.h>], + [struct mtget t; t.mt_dsreg1 = 0;], + [ac_cv_struct_mtget_dsreg1=yes], + [ac_cv_struct_mtget_dsreg1=no])]) +if test $ac_cv_struct_mtget_dsreg1 = yes; then + AC_DEFINE(HAVE_MTGET_DSREG1) +fi]) + +dnl Checks if structure 'mtget' have field 'mt_dsreg2'. +dnl Defines HAVE_MTGET_DSREG2 on success. +AC_DEFUN([AC_STRUCT_MTGET_DSREG2], +[AC_CACHE_CHECK([if struct mtget contains mt_dsreg2], ac_cv_struct_mtget_dsreg2, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/mtio.h>], + [struct mtget t; t.mt_dsreg2 = 0;], + [ac_cv_struct_mtget_dsreg2=yes], + [ac_cv_struct_mtget_dsreg2=no])]) +if test $ac_cv_struct_mtget_dsreg2 = yes; then + AC_DEFINE(HAVE_MTGET_DSREG2) +fi]) + +dnl Checks if structure 'mtget' have field 'mt_gstat'. +dnl Defines HAVE_MTGET_GSTAT on success. +AC_DEFUN([AC_STRUCT_MTGET_GSTAT], +[AC_CACHE_CHECK([if struct mtget contains mt_gstat], ac_cv_struct_mtget_gstat, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/mtio.h>], + [struct mtget t; t.mt_gstat = 0;], + [ac_cv_struct_mtget_gstat=yes], + [ac_cv_struct_mtget_gstat=no])]) +if test $ac_cv_struct_mtget_gstat = yes; then + AC_DEFINE(HAVE_MTGET_GSTAT) +fi]) + +dnl Checks if structure 'mtget' have field 'mt_erreg'. +dnl Defines HAVE_MTGET_ERREG on success. +AC_DEFUN([AC_STRUCT_MTGET_ERREG], +[AC_CACHE_CHECK([if struct mtget contains mt_erreg], ac_cv_struct_mtget_erreg, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/mtio.h>], + [struct mtget t; t.mt_erreg = 0;], + [ac_cv_struct_mtget_erreg=yes], + [ac_cv_struct_mtget_erreg=no])]) +if test $ac_cv_struct_mtget_erreg = yes; then + AC_DEFINE(HAVE_MTGET_ERREG) +fi]) + +dnl Checks if structure 'mtget' have field 'mt_resid'. +dnl Defines HAVE_MTGET_RESID on success. +AC_DEFUN([AC_STRUCT_MTGET_RESID], +[AC_CACHE_CHECK([if struct mtget contains mt_resid], ac_cv_struct_mtget_resid, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/mtio.h>], + [struct mtget t; t.mt_resid = 0;], + [ac_cv_struct_mtget_resid=yes], + [ac_cv_struct_mtget_resid=no])]) +if test $ac_cv_struct_mtget_resid = yes; then + AC_DEFINE(HAVE_MTGET_RESID) +fi]) + +dnl Checks if structure 'mtget' have field 'mt_fileno'. +dnl Defines HAVE_MTGET_FILENO on success. +AC_DEFUN([AC_STRUCT_MTGET_FILENO], +[AC_CACHE_CHECK([if struct mtget contains mt_fileno], + ac_cv_struct_mtget_fileno, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/mtio.h>], + [struct mtget t; t.mt_fileno = 0;], + [ac_cv_struct_mtget_fileno=yes], + [ac_cv_struct_mtget_fileno=no])]) +if test $ac_cv_struct_mtget_fileno = yes; then + AC_DEFINE(HAVE_MTGET_FILENO) +fi]) + +dnl Checks if structure 'mtget' have field 'mt_blkno'. +dnl Defines HAVE_MTGET_BLKNO on success. +AC_DEFUN([AC_STRUCT_MTGET_BLKNO], +[AC_CACHE_CHECK([if struct mtget contains mt_blkno], ac_cv_struct_mtget_blkno, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/mtio.h>], + [struct mtget t; t.mt_blkno = 0;], + [ac_cv_struct_mtget_blkno=yes], + [ac_cv_struct_mtget_blkno=no])]) +if test $ac_cv_struct_mtget_blkno = yes; then + AC_DEFINE(HAVE_MTGET_BLKNO) +fi]) + +dnl Checks if structure 'mtget' have field 'mt_flags'. +dnl Defines HAVE_MTGET_FLAGS on success. +AC_DEFUN([AC_STRUCT_MTGET_FLAGS], +[AC_CACHE_CHECK([if struct mtget contains mt_flags], ac_cv_struct_mtget_flags, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/mtio.h>], + [struct mtget t; t.mt_flags = 0;], + [ac_cv_struct_mtget_flags=yes], + [ac_cv_struct_mtget_flags=no])]) +if test $ac_cv_struct_mtget_flags = yes; then + AC_DEFINE(HAVE_MTGET_FLAGS) +fi]) + +dnl Checks if structure 'mtget' have field 'mt_bf'. +dnl Defines HAVE_MTGET_BF on success. +AC_DEFUN([AC_STRUCT_MTGET_BF], +[AC_CACHE_CHECK([if struct mtget contains mt_bf], ac_cv_struct_mtget_bf, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/mtio.h>], + [struct mtget t; t.mt_bf = 0;], + [ac_cv_struct_mtget_bf=yes], + [ac_cv_struct_mtget_bf=no])]) +if test $ac_cv_struct_mtget_bf = yes; then + AC_DEFINE(HAVE_MTGET_BF) +fi]) + +dnl Checks for illegal declaration of 'union semun' in sys/sem.h. +dnl Defines HAVE_UNION_SEMUN on success. +AC_DEFUN([AC_STRUCT_UNION_SEMUN], +[AC_CACHE_CHECK([if an illegal declaration for union semun in sys/sem.h exists], ac_cv_struct_union_semun, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/ipc.h> +#include <sys/sem.h>], [union semun s;], + [ac_cv_struct_union_semun=yes], + [ac_cv_struct_union_semun=no])]) +if test $ac_cv_struct_union_semun = yes; then + AC_DEFINE(HAVE_UNION_SEMUN) +fi]) + +dnl Checks if 'union wait' is declared in 'wait.h' or 'sys/wait.h'. +dnl Defines HAVE_UNION_WAIT on success. +AC_DEFUN([AC_STRUCT_UNION_WAIT], +[AC_CACHE_CHECK([if union wait is declared in wait.h or sys/wait.h], ac_cv_struct_union_wait, + [AC_TRY_COMPILE([#include <sys/types.h> +#if defined(HAVE_WAIT_H) +# include <wait.h> +#else +#include <sys/wait.h> +#endif], [union wait w;], + [ac_cv_struct_union_wait=yes], + [ac_cv_struct_union_wait=no])]) +if test $ac_cv_struct_union_wait = yes; then + AC_DEFINE(HAVE_UNION_WAIT) +fi]) + +dnl Checks if 'struct rusage' is declared in sys/resource.h. +dnl Defines HAVE_STRUCT_RUSAGE on success. +AC_DEFUN([AC_STRUCT_RUSAGE], +[AC_CACHE_CHECK([if struct rusage is declared in sys/resource.h], ac_cv_struct_rusage, + [AC_TRY_COMPILE([#include <sys/time.h> +#include <sys/resource.h>], [struct rusage r;], + [ac_cv_struct_rusage=yes], + [ac_cv_struct_rusage=no])]) +if test $ac_cv_struct_rusage = yes; then + AC_DEFINE(HAVE_STRUCT_RUSAGE) +fi]) + +dnl Checks if structure 'siginfo' have field 'si_utime'. +dnl Defines HAVE_SI_UTIME on success. +AC_DEFUN([AC_STRUCT_SI_UTIME], +[AC_CACHE_CHECK([if struct siginfo contains si_utime], ac_cv_struct_si_utime, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/siginfo.h>], + [struct siginfo si; si.si_utime = 0;], + [ac_cv_struct_si_utime=yes], + [ac_cv_struct_si_utime=no])]) +if test $ac_cv_struct_si_utime = yes; then + AC_DEFINE(HAVE_SI_UTIME) +fi]) + + +dnl Checks wether major(), minor() and makedev() are defined in +dnl 'sys/mkdev.h' or in 'sys/sysmacros.h. Defines MAJOR_IN_MKDEV or +dnl MAJOR_IN_SYSMACROS or nothing. +AC_DEFUN([AC_HEADER_MAKEDEV], +[AC_CACHE_CHECK([for header file containing major(), minor() and makedev()], + ac_cv_header_makedev, +[ac_cv_header_makedev=none +AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/mkdev.h>], + [int i = major(0); i = minor(0); i = makedev(0,0);], + [ac_cv_header_makedev=sys/mkdev.h]) +if test $ac_cv_header_makedev = none; then + AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/sysmacros.h>], + [int i = major(0); i = minor(0); i = makedev(0,0);], + [ac_cv_header_makedev=sys/sysmacros.h]) +fi]) +if test $ac_cv_header_makedev = sys/mkdev.h; then + AC_DEFINE(MAJOR_IN_MKDEV) +fi +if test $ac_cv_header_makedev = sys/sysmacros.h; then + AC_DEFINE(MAJOR_IN_SYSMACROS) +fi]) + +dnl Checks for USG derived STDIO that uses _filbuf() +dnl Defines HAVE__FILBUF on success. +AC_DEFUN([AC_HEADER__FILBUF], +[AC_CACHE_CHECK([for _filbuf()], ac_cv_func__filbuf, + [AC_TRY_LINK([#include <stdio.h>], +[FILE *f; +int flag; +int count; +char *ptr; +char c = 0; +f = fopen("confdefs.h", "r"); +_filbuf(f); +_flsbuf(c, f); +flag = f->_flag & _IONBF; +flag |= f->_flag & _IOERR; +flag |= f->_flag & _IOEOF; +count = f->_cnt; +ptr = (char *)f->_ptr; +fclose(f);], + [ac_cv_func__filbuf=yes], + [ac_cv_func__filbuf=no])]) +if test $ac_cv_func__filbuf = yes; then + AC_DEFINE(HAVE__FILBUF) +fi]) + +dnl Checks for USG derived STDIO that uses __filbuf() +dnl Defines HAVE___FILBUF on success. +AC_DEFUN([AC_HEADER___FILBUF], +[AC_CACHE_CHECK([for __filbuf()], ac_cv_func___filbuf, + [AC_TRY_LINK([#include <stdio.h>], +[FILE *f; +int flag; +int count; +char *ptr; +char c = 0; +f = fopen("confdefs.h", "r"); +__filbuf(f); +__flsbuf(c, f); +flag = f->_flag & _IONBF; +flag |= f->_flag & _IOERR; +flag |= f->_flag & _IOEOF; +count = f->_cnt; +ptr = (char *)f->_ptr; +fclose(f);], + [ac_cv_func___filbuf=yes], + [ac_cv_func___filbuf=no])]) +if test $ac_cv_func___filbuf = yes; then + AC_DEFINE(HAVE___FILBUF) +fi]) + +dnl Checks for USG derived STDIO +dnl Defines HAVE_USG_STDIO on success. +AC_DEFUN([AC_HEADER_USG_STDIO], +[AC_REQUIRE([AC_HEADER__FILBUF])AC_REQUIRE([AC_HEADER___FILBUF])dnl +AC_CACHE_CHECK([for USG derived STDIO], ac_cv_header_usg_stdio, + [AC_TRY_LINK([#include <stdio.h>], +[FILE *f; +int flag; +int count; +char *ptr; +char c = 0; +f = fopen("confdefs.h", "r"); +#ifdef HAVE___FILBUF +__filbuf(f); +__flsbuf(c, f); +#else +# ifdef HAVE__FILBUF +_filbuf(f); +_flsbuf(c, f); +# else +no filbuf() +# endif +#endif +flag = f->_flag & _IONBF; +flag |= f->_flag & _IOERR; +flag |= f->_flag & _IOEOF; +count = f->_cnt; +ptr = (char *)f->_ptr; +fclose(f);], + [ac_cv_header_usg_stdio=yes], + [ac_cv_header_usg_stdio=no])]) +if test $ac_cv_header_usg_stdio = yes; then + AC_DEFINE(HAVE_USG_STDIO) +fi]) + +dnl Checks for errno definition in <errno.h> +dnl Defines HAVE_ERRNO_DEF on success. +AC_DEFUN([AC_HEADER_ERRNO_DEF], +[AC_CACHE_CHECK([for errno definition in errno.h], ac_cv_header_errno_def, + [AC_TRY_COMPILE([#include <errno.h>], +[errno = 0;], + [ac_cv_header_errno_def=yes], + [ac_cv_header_errno_def=no])]) +if test $ac_cv_header_errno_def = yes; then + AC_DEFINE(HAVE_ERRNO_DEF) +fi]) + +dnl Checks for UNIX-98 compliant <inttypes.h> +dnl Defines HAVE_INTTYPES_H on success. +AC_DEFUN([AC_HEADER_INTTYPES], +[AC_CACHE_CHECK([for UNIX-98 compliant inttypes.h], ac_cv_header_inttypes, + [AC_TRY_COMPILE([#include <inttypes.h>], +[int8_t c; uint8_t uc; int16_t s; uint16_t us; int32_t i; uint32_t ui; +int64_t ll; uint64_t ull; +intptr_t ip; uintptr_t uip;], + [ac_cv_header_inttypes=yes], + [ac_cv_header_inttypes=no])]) +if test $ac_cv_header_inttypes = yes; then + AC_DEFINE(HAVE_INTTYPES_H) +fi]) + +dnl Checks for type time_t +dnl Defines time_t to long on failure. +AC_DEFUN([AC_TYPE_TIME_T], +[AC_REQUIRE([AC_HEADER_TIME])dnl +AC_CACHE_CHECK([for time_t], ac_cv_type_time_t, + [AC_TRY_COMPILE([ +#include <sys/types.h> +#ifdef TIME_WITH_SYS_TIME_H +# include <sys/time.h> +# include <time.h> +#else +#ifdef HAVE_SYS_TIME_H +# include <sys/time.h> +#else +# include <time.h> +#endif +#endif], [time_t t;], + [ac_cv_type_time_t=yes], + [ac_cv_type_time_t=no])]) +if test $ac_cv_type_time_t = no; then + AC_DEFINE(time_t, long) +fi]) + +dnl Checks for type clock_t +dnl Defines clock_t to long on failure. +AC_DEFUN([AC_TYPE_CLOCK_T], +[AC_REQUIRE([AC_HEADER_TIME])dnl +AC_CACHE_CHECK([for clock_t], ac_cv_type_clock_t, + [AC_TRY_COMPILE([ +#include <sys/types.h> +/* + * time.h is needed because of a bug in Next Step. + * Next Step needs time.h for clock_t + */ +#ifdef TIME_WITH_SYS_TIME +# ifndef _INCL_SYS_TIME_H +# include <sys/time.h> +# define _INCL_SYS_TIME_H +# endif +# ifndef _INCL_TIME_H +# include <time.h> +# define _INCL_TIME_H +# endif +#else +#ifdef HAVE_SYS_TIME_H +# ifndef _INCL_SYS_TIME_H +# include <sys/time.h> +# define _INCL_SYS_TIME_H +# endif +#else +# ifndef _INCL_TIME_H +# include <time.h> +# define _INCL_TIME_H +# endif +#endif +#endif +#include <sys/times.h>], [clock_t t;], + [ac_cv_type_clock_t=yes], + [ac_cv_type_clock_t=no])]) +if test $ac_cv_type_clock_t = no; then + AC_DEFINE(clock_t, long) +fi]) + +dnl Checks for type socklen_t +dnl Defines socklen_t to int on failure. +AC_DEFUN([AC_TYPE_SOCKLEN_T], +[AC_REQUIRE([AC_HEADER_STDC])dnl +AC_MSG_CHECKING(for socklen_t) +AC_CACHE_VAL(ac_cv_type_socklen_t, +[AC_EGREP_CPP(dnl +changequote(<<,>>)dnl +<<(^|[^a-zA-Z_0-9])socklen_t[^a-zA-Z_0-9]>>dnl +changequote([,]), [#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +#include <sys/socket.h>], ac_cv_type_socklen_t=yes, ac_cv_type_socklen_t=no)])dnl +AC_MSG_RESULT($ac_cv_type_socklen_t) +if test $ac_cv_type_socklen_t = no; then + AC_DEFINE(socklen_t, int) +fi]) + +dnl Checks for type struct sockaddr_storage +dnl Defines HAVE_SOCKADDR_STORAGE on success. +AC_DEFUN([AC_STRUCT_SOCKADDR_STORAGE], +[AC_CACHE_CHECK([if struct sockaddr_storage is declared in socket.h], ac_cv_struct_sockaddr_storage, + [AC_TRY_COMPILE([#include <sys/socket.h>], + [struct sockaddr_storage ss; ss.ss_family = 0;], + [ac_cv_struct_sockaddr_storage=yes], + [ac_cv_struct_sockaddr_storage=no])]) +if test $ac_cv_struct_sockaddr_storage = yes; then + AC_DEFINE(HAVE_SOCKADDR_STORAGE) +fi]) + +dnl Checks for type long long +dnl Defines HAVE_LONGLONG on success. +AC_DEFUN([AC_TYPE_LONGLONG], +[AC_CACHE_CHECK([for type long long], ac_cv_type_longlong, + [AC_TRY_COMPILE([], [long long i;], + [ac_cv_type_longlong=yes], + [ac_cv_type_longlong=no])]) +if test $ac_cv_type_longlong = yes; then + AC_DEFINE(HAVE_LONGLONG) +fi]) + +dnl Checks if C-compiler orders bitfields htol +dnl Defines BITFIELDS_HTOL on success. +AC_DEFUN([AC_C_BITFIELDS], +[AC_CACHE_CHECK([whether bitorder in bitfields is htol], ac_cv_c_bitfields_htol, + [AC_TRY_RUN([ +struct { + unsigned char x1:4; + unsigned char x2:4; +} a; +int +main() +{ +char *cp; + +cp = (char *)&a; +*cp = 0x12; +exit(a.x1 == 2);}], + [ac_cv_c_bitfields_htol=yes], + [ac_cv_c_bitfields_htol=no])]) +if test $ac_cv_c_bitfields_htol = yes; then + AC_DEFINE(BITFIELDS_HTOL) +fi]) + +dnl Checks if C-compiler understands prototypes +dnl Defines PROTOTYPES on success. +AC_DEFUN([AC_TYPE_PROTOTYPES], +[AC_CACHE_CHECK([for prototypes], ac_cv_type_prototypes, + [AC_TRY_RUN([ +doit(int i, ...) +{return 0;} +int +main(int ac, char *av[]) +{ doit(1, 2, 3); +exit(0);}], + [ac_cv_type_prototypes=yes], + [ac_cv_type_prototypes=no])]) +if test $ac_cv_type_prototypes = yes; then + AC_DEFINE(PROTOTYPES) +fi]) + +dnl Checks for type size_t +dnl Defines HAVE_SIZE_T_ on success. +AC_DEFUN([AC_TYPE_SIZE_T_], +[AC_CACHE_CHECK([for type size_t], ac_cv_type_size_t_, + [AC_TRY_COMPILE([#include <sys/types.h>], [size_t s;], + [ac_cv_type_size_t_=yes], + [ac_cv_type_size_t_=no])]) +if test $ac_cv_type_size_t_ = yes; then + AC_DEFINE(HAVE_SIZE_T) +else + AC_DEFINE(NO_SIZE_T) +fi]) + +dnl Checks if type char is unsigned +dnl Defines CHAR_IS_UNSIGNED on success. +AC_DEFUN([AC_TYPE_CHAR], +[AC_CACHE_CHECK([if char is unsigned], ac_cv_type_char_unsigned, + [AC_TRY_RUN([ +int +main() +{ + char c; + + c = -1; + exit(c < 0);}], + [ac_cv_type_char_unsigned=yes], + [ac_cv_type_char_unsigned=no], + [ac_cv_type_char_unsigned=no])]) +if test $ac_cv_type_char_unsigned = yes; then + AC_DEFINE(CHAR_IS_UNSIGNED) +fi]) + +dnl Checks if function/macro va_copy() is available +dnl Defines HAVE_VA_COPY on success. +AC_DEFUN([AC_FUNC_VA_COPY], +[AC_CACHE_CHECK([for va_copy], ac_cv_func_va_copy, + [AC_TRY_LINK([ +#ifdef HAVE_STDARG_H +# include <stdarg.h> +#else +# include <varargs.h> +#endif], + [ +va_list a, b; + +va_copy(a, b);], + [ac_cv_func_va_copy=yes], + [ac_cv_func_va_copy=no])]) +if test $ac_cv_func_va_copy = yes; then + AC_DEFINE(HAVE_VA_COPY) +fi]) + +dnl Checks if function/macro __va_copy() is available +dnl Defines HAVE__VA_COPY on success. +AC_DEFUN([AC_FUNC__VA_COPY], +[AC_CACHE_CHECK([for __va_copy], ac_cv_func__va_copy, + [AC_TRY_LINK([ +#ifdef HAVE_STDARG_H +# include <stdarg.h> +#else +# include <varargs.h> +#endif], + [ +va_list a, b; + +__va_copy(a, b);], + + [ac_cv_func__va_copy=yes], + [ac_cv_func__va_copy=no])]) +if test $ac_cv_func__va_copy = yes; then + AC_DEFINE(HAVE__VA_COPY) +fi]) + +dnl Checks if va_list is an array +dnl Defines VA_LIST_IS_ARRAY on success. +AC_DEFUN([AC_TYPE_VA_LIST], +[AC_CACHE_CHECK([if va_list is an array], ac_cv_type_va_list_array, + [AC_TRY_LINK([ +#ifdef HAVE_STDARG_H +# include <stdarg.h> +#else +# include <varargs.h> +#endif +], + [ +va_list a, b; + +a = b;], + [ac_cv_type_va_list_array=no], + [ac_cv_type_va_list_array=yes])]) +if test $ac_cv_type_va_list_array = yes; then + AC_DEFINE(VA_LIST_IS_ARRAY) +fi]) + +dnl Checks if quotactl is present as ioctl +dnl Defines HAVE_QUOTAIOCTL on success. +AC_DEFUN([AC_FUNC_QUOTAIOCTL], +[AC_CACHE_CHECK([if quotactl is an ioctl], ac_cv_func_quotaioctl, + [AC_TRY_LINK([#include <sys/types.h> +#include <sys/fs/ufs_quota.h>], + [struct quotctl q; ioctl(0, Q_QUOTACTL, &q)], + [ac_cv_func_quotaioctl=yes], + [ac_cv_func_quotaioctl=no])]) +if test $ac_cv_func_quotaioctl = yes; then + AC_DEFINE(HAVE_QUOTAIOCTL) +fi]) + +dnl Checks if function __dtoa() is available +dnl Defines HAVE_DTOA on success. +AC_DEFUN([AC_FUNC_DTOA], +[AC_CACHE_CHECK([for __dtoa], ac_cv_func_dtoa, + [AC_TRY_LINK([extern char *__dtoa();], +[int decpt; int sign; char *ep; char *bp; +bp = __dtoa(0.0, 2, 6, &decpt, &sign, &ep);], + [ac_cv_func_dtoa=yes], + [ac_cv_func_dtoa=no])]) +if test $ac_cv_func_dtoa = yes; then + AC_DEFINE(HAVE_DTOA) +fi]) + +dnl Checks if reentrant __dtoa() exists (needs a result prt) +dnl Defines HAVE_DTOA_R on success. +AC_DEFUN([AC_FUNC_DTOA_R], +[AC_REQUIRE([AC_FUNC_DTOA])dnl +AC_CACHE_CHECK([for __dtoa that needs result ptr], ac_cv_func_dtoa_r, + [AC_TRY_RUN([ +extern char *__dtoa(); +int +main() +{ +#ifdef HAVE_DTOA + int decpt, sign; + char *bp; + char *ep; + char *result; + + result = 0; + bp = __dtoa(1.9, 2, 5, &decpt, &sign, &ep, &result); + exit(result == 0); +#else + exit(1); +#endif +}], + [ac_cv_func_dtoa_r=yes], + [ac_cv_func_dtoa_r=no])]) +if test $ac_cv_func_dtoa_r = yes; then + AC_DEFINE(HAVE_DTOA_R) +fi]) + +dnl Checks if working ecvt() exists +dnl Defines HAVE_ECVT on success. +AC_DEFUN([AC_FUNC_ECVT], +[AC_CACHE_CHECK([for working ecvt() ], ac_cv_func_ecvt, + [AC_TRY_RUN([ +extern char *ecvt(); + +sprintf(s) + char *s; +{ + strcpy(s, "DEAD"); +} + +int +main() +{ + int a, b; + +/* exit (strcmp("DEAD", ecvt(1.9, 2, &a, &b)) == 0);*/ + exit (strcmp("19", ecvt(1.9, 2, &a, &b)) != 0); +}], + [ac_cv_func_ecvt=yes], + [ac_cv_func_ecvt=no])]) +if test $ac_cv_func_ecvt = yes; then + AC_DEFINE(HAVE_ECVT) +fi]) + +dnl Checks if working fcvt() exists +dnl Defines HAVE_FCVT on success. +AC_DEFUN([AC_FUNC_FCVT], +[AC_CACHE_CHECK([for working fcvt() ], ac_cv_func_fcvt, + [AC_TRY_RUN([ +extern char *fcvt(); + +sprintf(s) + char *s; +{ + strcpy(s, "DEAD"); +} + +int +main() +{ + int a, b; + +/* exit (strcmp("DEAD", fcvt(1.9, 2, &a, &b)) == 0);*/ + exit (strcmp("190", fcvt(1.9, 2, &a, &b)) != 0); +}], + [ac_cv_func_fcvt=yes], + [ac_cv_func_fcvt=no])]) +if test $ac_cv_func_fcvt = yes; then + AC_DEFINE(HAVE_FCVT) +fi]) + +dnl Checks if working gcvt() exists +dnl Defines HAVE_GCVT on success. +AC_DEFUN([AC_FUNC_GCVT], +[AC_CACHE_CHECK([for working gcvt() ], ac_cv_func_gcvt, + [AC_TRY_RUN([ +extern char *gcvt(); + +sprintf(s) + char *s; +{ + strcpy(s, "DEAD"); +} + +int +main() +{ + char buf[32]; + +/* exit (strcmp("DEAD", gcvt(1.9, 10, buf)) == 0);*/ + exit (strcmp("1.9", gcvt(1.9, 10, buf)) != 0); +}], + [ac_cv_func_gcvt=yes], + [ac_cv_func_gcvt=no])]) +if test $ac_cv_func_gcvt = yes; then + AC_DEFINE(HAVE_GCVT) +fi]) + +dnl Checks if function uname() is available +dnl Defines HAVE_UNAME on success. +AC_DEFUN([AC_FUNC_UNAME], +[AC_CACHE_CHECK([for uname], ac_cv_func_uname, + [AC_TRY_LINK([#include <sys/utsname.h>], +[struct utsname un; +uname(&un);], + [ac_cv_func_uname=yes], + [ac_cv_func_uname=no])]) +if test $ac_cv_func_uname = yes; then + AC_DEFINE(HAVE_UNAME) +fi]) + +dnl Checks if function mlockall() is available +dnl beware HP-UX 10.x it contains a bad mlockall() in libc +dnl Defines HAVE_MLOCK on success. +AC_DEFUN([AC_FUNC_MLOCK], +[AC_REQUIRE([AC_HEADER_ERRNO_DEF])dnl +AC_CACHE_CHECK([for mlock], ac_cv_func_mlock, + [AC_TRY_RUN([ +#include <sys/types.h> +#include <errno.h> +#ifndef HAVE_ERRNO_DEF +extern int errno; +#endif + +main() +{ + if (mlock(0, 0) < 0) { + if (errno == EINVAL || errno == ENOMEM || + errno == EPERM || errno == EACCES) + exit(0); + exit(-1); + } + exit(0); +}], + [ac_cv_func_mlock=yes], + [ac_cv_func_mlock=no])]) +if test $ac_cv_func_mlock = yes; then + AC_DEFINE(HAVE_MLOCK) +fi]) + +dnl Checks if function mlockall() is available +dnl beware HP-UX 10.x it contains a bad mlockall() in libc +dnl Defines HAVE_MLOCKALL on success. +AC_DEFUN([AC_FUNC_MLOCKALL], +[AC_REQUIRE([AC_HEADER_ERRNO_DEF])dnl +AC_CACHE_CHECK([for mlockall], ac_cv_func_mlockall, + [AC_TRY_RUN([ +#include <sys/types.h> +#include <sys/mman.h> +#include <errno.h> +#ifndef HAVE_ERRNO_DEF +extern int errno; +#endif + +int +main() +{ + if (mlockall(MCL_CURRENT|MCL_FUTURE) < 0) { + if (errno == EINVAL || errno == ENOMEM || + errno == EPERM || errno == EACCES) + exit(0); + exit(-1); + } + exit(0); +} +], + [ac_cv_func_mlockall=yes], + [ac_cv_func_mlockall=no])]) +if test $ac_cv_func_mlockall = yes; then + AC_DEFINE(HAVE_MLOCKALL) +fi]) + +AC_DEFUN([jsAC_FUNC_MMAP], +[AC_REQUIRE([AC_MMAP_SIZEP])dnl +AC_CHECK_HEADERS(unistd.h) +AC_CHECK_FUNCS(getpagesize) +AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped, +[AC_TRY_RUN([ +/* Thanks to Mike Haertel and Jim Avera for this test. + Here is a matrix of mmap possibilities: + mmap private not fixed + mmap private fixed at somewhere currently unmapped + mmap private fixed at somewhere already mapped + mmap shared not fixed + mmap shared fixed at somewhere currently unmapped + mmap shared fixed at somewhere already mapped + For private mappings, we should verify that changes cannot be read() + back from the file, nor mmap's back from the file at a different + address. (There have been systems where private was not correctly + implemented like the infamous i386 svr4.0, and systems where the + VM page cache was not coherent with the filesystem buffer cache + like early versions of FreeBSD and possibly contemporary NetBSD.) + For shared mappings, we should conversely verify that changes get + propogated back to all the places they're supposed to be. + + Grep wants private fixed already mapped. + The main things grep needs to know about mmap are: + * does it exist and is it safe to write into the mmap'd area + * how to use it (BSD variants) */ +#include <sys/types.h> +#include <fcntl.h> +#include <sys/mman.h> + +/* + * Needed for Apollo Domain/OS and may be for others? + */ +#ifdef _MMAP_WITH_SIZEP +# define mmap_sizeparm(s) (&(s)) +#else +# define mmap_sizeparm(s) (s) +#endif + +/* This mess was copied from the GNU getpagesize.h. */ +#ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include <unistd.h> +# endif + +/* Assume that all systems that can run configure have sys/param.h. */ +# ifndef HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# ifdef HAVE_SYS_PARAM_H +# include <sys/param.h> +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +#ifdef __cplusplus +extern "C" { void *malloc(unsigned); } +#else +char *malloc(); +#endif + +int +main() +{ + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize(); + + /* + * First, make a file with some known garbage in it. + */ + data = malloc(pagesize); + if (!data) + exit(1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand(); + umask(0); + fd = creat("conftestmmap", 0600); + if (fd < 0) + exit(1); + if (write(fd, data, pagesize) != pagesize) + exit(1); + close(fd); + + /* + * Next, try to mmap the file at a fixed address which + * already has something else allocated at it. If we can, + * also make sure that we see the same garbage. + */ + fd = open("conftestmmap", O_RDWR); + if (fd < 0) + exit(1); + data2 = malloc(2 * pagesize); + if (!data2) + exit(1); + data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap(data2, mmap_sizeparm(pagesize), PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit(1); + + /* + * Finally, make sure that changes to the mapped area + * do not percolate back to the file as seen by read(). + * (This is a bug on some variants of i386 svr4.0.) + */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = malloc(pagesize); + if (!data3) + exit(1); + if (read(fd, data3, pagesize) != pagesize) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit(1); + close(fd); + unlink("conftestmmap"); + exit(0); +} +], ac_cv_func_mmap_fixed_mapped=yes, ac_cv_func_mmap_fixed_mapped=no, +ac_cv_func_mmap_fixed_mapped=no)]) +if test $ac_cv_func_mmap_fixed_mapped = yes; then + AC_DEFINE(HAVE_MMAP) +fi +]) + +AC_DEFUN([AC_MMAP_SIZEP], +[AC_CHECK_HEADERS(unistd.h) +AC_CHECK_FUNCS(getpagesize) +AC_CACHE_CHECK(for mmap that needs ptr to size, ac_cv_func_mmap_sizep, +[AC_TRY_RUN([ +#include <sys/types.h> +#include <fcntl.h> +#include <signal.h> +#include <setjmp.h> +#include <sys/mman.h> + +#ifndef MAP_FILE +#define MAP_FILE 0 /* Needed on Apollo Domain/OS */ +#endif + +/* This mess was copied from the GNU getpagesize.h. */ +#ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include <unistd.h> +# endif + +/* Assume that all systems that can run configure have sys/param.h. */ +# ifndef HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# ifdef HAVE_SYS_PARAM_H +# include <sys/param.h> +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +#ifdef __cplusplus +extern "C" { void *malloc(unsigned); } +#else +char *malloc(); +#endif + +jmp_buf jenv; + +int +intr() +{ + signal(SIGSEGV, intr); + longjmp(jenv, 1); +} + +int +main() +{ + char *data, *data2; + int i, pagesize, ps; + int fd; + + pagesize = getpagesize(); + + /* + * First, make a file with some known garbage in it. + */ + data = malloc(pagesize); + if (!data) + exit(1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand(); + umask(0); + fd = creat("conftestmmap", 0600); + if (fd < 0) + exit(1); + if (write(fd, data, pagesize) != pagesize) + exit(1); + close(fd); + + /* + * Next, try to mmap the file at a fixed address which + * already has something else allocated at it. If we can, + * also make sure that we see the same garbage. + */ + fd = open("conftestmmap", O_RDWR); + if (fd < 0) + exit(1); + + /* + * Keep a copy, Apollo modifies the value... + */ + ps = pagesize; + + /* + * Apollo mmap() is not a syscall but a library function and fails + * if it tries to dereference 'ps'. We must use setjmp in order to + * catch the failure. + */ + signal(SIGSEGV, intr); + if (setjmp(jenv) == 0) { + data2 = mmap(0, ps, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0L); + } else { + data2 = (char *)-1; + } + if (data2 != (char *)-1) + exit(1); + + signal(SIGSEGV, intr); + if (setjmp(jenv) == 0) { + data2 = mmap(0, &ps, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0L); + } else { + data2 = (char *)-1; + } + if (data2 == (char *)-1) + exit(1); + + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit(1); + + close(fd); + unlink("conftestmmap"); + exit(0); +} +], ac_cv_func_mmap_sizep=yes, ac_cv_func_mmap_sizep=no, +ac_cv_func_mmap_sizep=no)]) +if test $ac_cv_func_mmap_sizep = yes; then + AC_DEFINE(_MMAP_WITH_SIZEP) +fi +]) + +dnl Checks if mmap() works to get shared memory +dnl Defines HAVE_SMMAP on success. +AC_DEFUN([AC_FUNC_SMMAP], +[AC_CACHE_CHECK([if mmap works to get shared memory], ac_cv_func_smmap, + [AC_TRY_RUN([ +#include <sys/types.h> +#include <sys/mman.h> + +#ifndef MAP_ANONYMOUS +# ifdef MAP_ANON +# define MAP_ANONYMOUS MAP_ANON +# endif +#endif + +/* + * Needed for Apollo Domain/OS and may be for others? + */ +#ifdef _MMAP_WITH_SIZEP +# define mmap_sizeparm(s) (&(s)) +#else +# define mmap_sizeparm(s) (s) +#endif + +char * +mkshare() +{ + int size = 8192; + int f; + char *addr; + +#ifdef MAP_ANONYMOUS /* HP/UX */ + f = -1; + addr = mmap(0, mmap_sizeparm(size), PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, f, 0); +#else + if ((f = open("/dev/zero", 2)) < 0) + exit(1); + addr = mmap(0, mmap_sizeparm(size), PROT_READ|PROT_WRITE, MAP_SHARED, f, 0); +#endif + if (addr == (char *)-1) + exit(1); + close(f); + + return (addr); +} + +int +main() +{ + char *addr; + + addr = mkshare(); + *addr = 'I'; + + switch (fork()) { + + case -1: + printf("help\n"); exit(1); + + case 0: /* child */ + *addr = 'N'; + _exit(0); + break; + default: /* parent */ + wait(0); + sleep(1); + break; + } + + if (*addr != 'N') + exit(1); + exit(0); +} +], + [ac_cv_func_smmap=yes], + [ac_cv_func_smmap=no], + [ac_cv_func_smmap=no])]) +if test $ac_cv_func_smmap = yes; then + AC_DEFINE(HAVE_SMMAP) +fi]) + +dnl Checks if sys_siglist[] exists +dnl Defines HAVE_SYS_SIGLIST on success. +AC_DEFUN([AC_FUNC_SYS_SIGLIST], +[AC_CACHE_CHECK([for sys_siglist], ac_cv_func_sys_siglist, + [AC_TRY_RUN([ +int +main() +{ extern char *sys_siglist[]; +if (sys_siglist[1] == 0) + exit(1); +exit(0);}], + [ac_cv_func_sys_siglist=yes], + [ac_cv_func_sys_siglist=no])]) +if test $ac_cv_func_sys_siglist = yes; then + AC_DEFINE(HAVE_SYS_SIGLIST) +fi]) + +dnl Checks for maximum number of bits in minor device number +AC_DEFUN([AC_CHECK_MINOR_BITS], +[AC_REQUIRE([AC_HEADER_MAKEDEV])dnl +changequote(<<, >>)dnl +define(<<AC_MACRO_NAME>>, DEV_MINOR_BITS)dnl +dnl The cache variable name. +define(<<AC_CV_NAME>>, ac_cv_dev_minor_bits)dnl +changequote([, ])dnl +AC_MSG_CHECKING(bits in minor device number) +AC_CACHE_VAL(AC_CV_NAME, +[AC_TRY_RUN([#include <stdio.h> +#include <sys/types.h> +#ifdef major +# define _FOUND_MAJOR_ +#endif + +#ifdef MAJOR_IN_MKDEV +# include <sys/mkdev.h> +# define _FOUND_MAJOR_ +#endif + +#ifndef _FOUND_MAJOR_ +# ifdef MAJOR_IN_SYSMACROS +# include <sys/sysmacros.h> +# define _FOUND_MAJOR_ +# endif +#endif + +#ifndef _FOUND_MAJOR_ +# if defined(hpux) || defined(__hpux__) || defined(__hpux) +# include <sys/mknod.h> +# define _FOUND_MAJOR_ +# endif +#endif + +#ifndef _FOUND_MAJOR_ +# define major(dev) (((dev) >> 8) & 0xFF) +# define minor(dev) ((dev) & 0xFF) +# define makedev(majo, mino) (((majo) << 8) | (mino)) +#endif +int +main() +{ + long l = 1; + int i; + int m; + int c = 0; + FILE *f=fopen("conftestval", "w"); + + if (!f) exit(1); + + for (i=1, m=0; i <= 32; i++, l<<=1) { + if (minor(l) == 0 && c == 0) + c = m; + if (minor(l) != 0) + m = i; + } + fprintf(f, "%d\n", m); + exit(0); +}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl +AC_MSG_RESULT($AC_CV_NAME) +AC_DEFINE_UNQUOTED(AC_MACRO_NAME, $AC_CV_NAME) +undefine([AC_MACRO_NAME])dnl +undefine([AC_CV_NAME])dnl +]) + +dnl Checks for maximum number of bits in minor device numbers are non contiguous +dnl Defines DEV_MINOR_NONCONTIG on success. +AC_DEFUN([AC_CHECK_MINOR_NONCONTIG], +[AC_REQUIRE([AC_HEADER_MAKEDEV])dnl +AC_CACHE_CHECK([whether bits in minor device numbers are non contiguous], ac_cv_dev_minor_noncontig, + [AC_TRY_RUN([ +#include <sys/types.h> +#ifdef major +# define _FOUND_MAJOR_ +#endif + +#ifdef MAJOR_IN_MKDEV +# include <sys/mkdev.h> +# define _FOUND_MAJOR_ +#endif + +#ifndef _FOUND_MAJOR_ +# ifdef MAJOR_IN_SYSMACROS +# include <sys/sysmacros.h> +# define _FOUND_MAJOR_ +# endif +#endif + +#ifndef _FOUND_MAJOR_ +# if defined(hpux) || defined(__hpux__) || defined(__hpux) +# include <sys/mknod.h> +# define _FOUND_MAJOR_ +# endif +#endif + +#ifndef _FOUND_MAJOR_ +# define major(dev) (((dev) >> 8) & 0xFF) +# define minor(dev) ((dev) & 0xFF) +# define makedev(majo, mino) (((majo) << 8) | (mino)) +#endif +int +main() +{ + long l = 1; + int i; + int m; + int c = 0; + + for (i=1, m=0; i <= 32; i++, l<<=1) { + if (minor(l) == 0 && c == 0) + c = m; + if (minor(l) != 0) + m = i; + } +exit (m == c);}], + [ac_cv_dev_minor_noncontig=yes], + [ac_cv_dev_minor_noncontig=no])]) +if test $ac_cv_dev_minor_noncontig = yes; then + AC_DEFINE(DEV_MINOR_NONCONTIG) +fi]) + +dnl Checks if we may not define our own malloc() +dnl Defines NO_USER_MALLOC if we cannot. +AC_DEFUN([AC_USER_MALLOC], +[AC_CACHE_CHECK([if we may not define our own malloc()], ac_cv_no_user_malloc, + [AC_TRY_RUN([ +static int mcalled; +char * +malloc(s) + int s; +{ + extern char *sbrk(); + + mcalled++; + _exit(0); + return (sbrk(s)); +} + +free(p) char *p;{} + +main() +{ +#ifdef HAVE_STRDUP + strdup("aaa"); +#else + exit(0); +#endif + exit(1);}], + [ac_cv_no_user_malloc=no], + [ac_cv_no_user_malloc=yes])]) +if test $ac_cv_no_user_malloc = yes; then + AC_DEFINE(NO_USER_MALLOC) +fi]) + +dnl Checks if BSD-4.2 compliant getpgrp() exists +dnl Defines HAVE_BSD_GETPGRP on success. +AC_DEFUN([AC_FUNC_BSD_GETPGRP], +[AC_CACHE_CHECK([for BSD compliant getpgrp], ac_cv_func_bsd_getpgrp, + [AC_TRY_RUN([ +int +main() +{ long p; +/* + * POSIX getpgrp() has void parameter... + */ + p = getpgrp(-1); + if (p == getpgrp(1) && p == getpgrp(getpid())) + exit(1); +exit(0);}], + [ac_cv_func_bsd_getpgrp=yes], + [ac_cv_func_bsd_getpgrp=no])]) +if test $ac_cv_func_bsd_getpgrp = yes; then + AC_DEFINE(HAVE_BSD_GETPGRP) +fi]) + +dnl Checks if BSD-4.2 compliant setpgrp() exists +dnl Defines HAVE_BSD_SETPGRP on success. +AC_DEFUN([AC_FUNC_BSD_SETPGRP], +[AC_REQUIRE([AC_HEADER_ERRNO_DEF])dnl +AC_CACHE_CHECK([for BSD compliant setpgrp], ac_cv_func_bsd_setpgrp, + [AC_TRY_RUN([ +#include <errno.h> +#ifndef HAVE_ERRNO_DEF +extern int errno; +#endif +int +main() +{ errno = 0; +/* + * Force illegal pid on BSD + */ +if (setpgrp(-1, 100) < 0 && errno == ESRCH) + exit(0); +exit(1);}], + [ac_cv_func_bsd_setpgrp=yes], + [ac_cv_func_bsd_setpgrp=no])]) +if test $ac_cv_func_bsd_setpgrp = yes; then + AC_DEFINE(HAVE_BSD_SETPGRP) +fi]) + +dnl Checks if select() needs more than sys/time.h & sys/types.h +dnl Defines SELECT_NONSTD_HDR on success. +AC_DEFUN([AC_HEADER_SELECT_NONSTD], +[AC_CACHE_CHECK([if select needs nonstd include files], ac_cv_header_slect_nonstd_hdr, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/time.h>], + [fd_set rfd; FD_ZERO(&rfd); select(1, &rfd, 0, 0, 0);], + [ac_cv_header_slect_nonstd_hdr=no], + [ac_cv_header_slect_nonstd_hdr=yes])]) +if test $ac_cv_header_slect_nonstd_hdr = yes; then + AC_DEFINE(SELECT_NONSTD_HDR) +fi]) + +dnl Checks if select() needs sys/select.h +dnl Defines NEED_SYS_SELECT_H on success. +AC_DEFUN([AC_HEADER_SYS_SELECT], +[AC_REQUIRE([AC_HEADER_SELECT_NONSTD])dnl +AC_CACHE_CHECK([if sys/select.h is needed for select], ac_cv_header_need_sys_select_h, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/time.h> +#include <sys/select.h> +#ifndef SELECT_NONSTD_HDR +do not compile if we do not need nonstandard headers +#endif], + [fd_set rfd; FD_ZERO(&rfd); select(1, &rfd, 0, 0, 0);], + [ac_cv_header_need_sys_select_h=yes], + [ac_cv_header_need_sys_select_h=no])]) +if test $ac_cv_header_need_sys_select_h = yes; then + AC_DEFINE(NEED_SYS_SELECT_H) +fi]) + +dnl Checks if select() needs sys/socket.h +dnl Defines NEED_SYS_SOCKET_H on success. +AC_DEFUN([AC_HEADER_SELECT2], +[AC_REQUIRE([AC_HEADER_SELECT_NONSTD])dnl +AC_CACHE_CHECK([if sys/socket.h is needed for select], ac_cv_header_need_sys_socket_h, + [AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/time.h> +#include <sys/socket.h> +#ifndef SELECT_NONSTD_HDR +do not compile if we do not need nonstandard headers +#endif], + [fd_set rfd; FD_ZERO(&rfd); select(1, &rfd, 0, 0, 0);], + [ac_cv_header_need_sys_socket_h=yes], + [ac_cv_header_need_sys_socket_h=no])]) +if test $ac_cv_header_need_sys_socket_h = yes; then + AC_DEFINE(NEED_SYS_SOCKET_H) +fi]) + +dnl Checks if file locking via fcntl() is available +dnl Defines HAVE_FCNTL_LOCKF on success. +AC_DEFUN([AC_FUNC_FCNTL_LOCKF], +[AC_CACHE_CHECK([for file locking via fcntl], ac_cv_func_fcntl_lock, + [AC_TRY_LINK([ +#include <sys/types.h> +#include <fcntl.h>], + [ +struct flock fl; +fcntl(0, F_SETLK, &fl);], + [ac_cv_func_fcntl_lock=yes], + [ac_cv_func_fcntl_lock=no])]) +if test $ac_cv_func_fcntl_lock = yes; then + AC_DEFINE(HAVE_FCNTL_LOCKF) +fi]) + + +dnl Checks if link() allows hard links on symlinks +dnl Defines HAVE_HARD_SYMLINKS on success. +AC_DEFUN([AC_HARD_SYMLINKS], +[AC_CACHE_CHECK([if link() allows hard links on symlinks], ac_cv_hard_symlinks, + [AC_TRY_RUN([ +main() +{ + int ret = 0; + + unlink("confdefs.f1"); + unlink("confdefs.l1"); + unlink("confdefs.h1"); + + if (symlink("confdefs.f1", "confdefs.l1") < 0) + ret = 1; + if (link("confdefs.l1", "confdefs.h1") < 0) + ret = 1; + + unlink("confdefs.l1"); + unlink("confdefs.h1"); + + exit(ret); +}], + [ac_cv_hard_symlinks=yes], + [ac_cv_hard_symlinks=no])]) +if test $ac_cv_hard_symlinks = yes; then + AC_DEFINE(HAVE_HARD_SYMLINKS) +fi]) + + +dnl Checks if link() does not follow symlinks +dnl Defines HAVE_LINK_NOFOLLOW on success. +AC_DEFUN([AC_LINK_NOFOLLOW], +[AC_CACHE_CHECK([if link() does not folow symlinks], ac_cv_link_nofollow, + [AC_TRY_RUN([ +#include <sys/types.h> +#include <sys/stat.h> + +main() +{ + int ret = 0; + int f; + struct stat sb; + + unlink("confdefs.f1"); + unlink("confdefs.l1"); + unlink("confdefs.h1"); + + f = creat("confdefs.f1", 0666); + close(f); + if (symlink("confdefs.f1", "confdefs.l1") < 0) + ret = 1; + if (link("confdefs.l1", "confdefs.h1") < 0) + ret = 1; + + stat("confdefs.f1", &sb); + if (sb.st_nlink == 2) + ret = 1; + + unlink("confdefs.f1"); + unlink("confdefs.l1"); + unlink("confdefs.h1"); + + exit(ret); +}], + [ac_cv_link_nofollow=yes], + [ac_cv_link_nofollow=no])]) +if test $ac_cv_link_nofollow = yes; then + AC_DEFINE(HAVE_LINK_NOFOLLOW) +fi]) + +dnl Checks if access() does implement E_OK (010) for effective UIDs +dnl Defines HAVE_ACCESS_E_OK on success. +AC_DEFUN([AC_ACCESS_E_OK], +[AC_REQUIRE([AC_HEADER_ERRNO_DEF])dnl +AC_CHECK_HEADERS(unistd.h) +AC_CACHE_CHECK([if access() does implement E_OK], ac_cv_access_e_ok, + [AC_TRY_RUN([ +# ifdef HAVE_UNISTD_H +# include <unistd.h> +# endif +#ifndef R_OK +#define R_OK 4 /* Test for Read permission */ +#define W_OK 2 /* Test for Write permission */ +#define X_OK 1 /* Test for eXecute permission */ +#define F_OK 0 /* Test for existence of File */ +#endif + +#ifndef E_OK +#ifdef EFF_ONLY_OK +#define E_OK EFF_ONLY_OK /* Irix */ +#else +#ifdef EUID_OK +#define E_OK EUID_OK /* UNICOS (0400) */ +#else +#define E_OK 010 /* Test effective uids */ +#endif +#endif +#endif + +#include <errno.h> +#ifndef HAVE_ERRNO_DEF +extern int errno; +#endif + +main() +{ + int ret = 0; + + if (access(".", F_OK) != 0) + ret = 1; + else if (access(".", E_OK|F_OK) != 0) + ret = 1; + else if (access(".", (R_OK<<4)|F_OK) == 0) + ret = 1; + + + exit(ret); +}], + [ac_cv_access_e_ok=yes], + [ac_cv_access_e_ok=no])]) +if test $ac_cv_access_e_ok = yes; then + AC_DEFINE(HAVE_ACCESS_E_OK) +fi]) + + +dnl XXXXXXXXXXXXXXXXXX Begin Stolen (but modified) from GNU tar XXXXXXXXXXXXXXXXXXXXXXXXXXX +dnl Changes: + +dnl One line has been changed to: [ac_save_CC="${CC-cc}" to default to "'cc" + +dnl AC_SYS_LARGEFILE_MACRO_VALUE test moved from AC_FUNC_FSEEKO into AC_SYS_LARGEFILE +dnl Do not call AC_FUNC_FSEEKO because it does not check whether fseeko() is +dnl available on non Large File mode. There are additionoal tests for fseeko()/ftello() +dnl inside the AC_HAVE_LARGEFILES test. + +dnl largefile_cc_opt definition added + +#serial 18 + +dnl By default, many hosts won't let programs access large files; +dnl one must use special compiler options to get large-file access to work. +dnl For more details about this brain damage please see: +dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html + +dnl Written by Paul Eggert <eggert@twinsun.com>. + +dnl Internal subroutine of AC_SYS_LARGEFILE. +dnl AC_SYS_LARGEFILE_TEST_INCLUDES +AC_DEFUN([AC_SYS_LARGEFILE_TEST_INCLUDES], + [[#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply "#define LARGE_OFF_T 9223372036854775807", + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +# define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; + ]]) + +dnl Internal subroutine of AC_SYS_LARGEFILE. +dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, VALUE, CACHE-VAR, COMMENT, INCLUDES, FUNCTION-BODY) +AC_DEFUN([AC_SYS_LARGEFILE_MACRO_VALUE], + [AC_CACHE_CHECK([for $1 value needed for large files], $3, + [$3=no + AC_TRY_COMPILE([$5], + [$6], + , + [AC_TRY_COMPILE([#define $1 $2] +[$5] + , + [$6], + [$3=$2])])]) + if test "[$]$3" != no; then + AC_DEFINE_UNQUOTED([$1], [$]$3, [$4]) + fi]) + +AC_DEFUN([AC_SYS_LARGEFILE], + [AC_ARG_ENABLE(largefile, + [ --disable-largefile omit support for large files]) + if test "$enable_largefile" != no; then + + AC_CACHE_CHECK([for special C compiler options needed for large files], + ac_cv_sys_largefile_CC, + [ac_cv_sys_largefile_CC=no + largefile_cc_opt="" + if test "$GCC" != yes; then + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , , + [ac_save_CC="${CC-cc}" + CC="$CC -n32" + AC_TRY_COMPILE(AC_SYS_LARGEFILE_TEST_INCLUDES, , + ac_cv_sys_largefile_CC=' -n32') + CC="$ac_save_CC"]) + fi]) + if test "$ac_cv_sys_largefile_CC" != no; then + CC="$CC$ac_cv_sys_largefile_CC" + largefile_cc_opt="$ac_cv_sys_largefile_CC" + fi + + AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS, 64, + ac_cv_sys_file_offset_bits, + [Number of bits in a file offset, on hosts where this is settable.], + AC_SYS_LARGEFILE_TEST_INCLUDES) + AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES, 1, + ac_cv_sys_large_files, + [Define for large files, on AIX-style hosts.], + AC_SYS_LARGEFILE_TEST_INCLUDES) + AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1, + ac_cv_sys_largefile_source, + [Define to make fseeko visible on some hosts (e.g. glibc 2.2).], + [#include <stdio.h>], [return !fseeko;]) + fi + ]) + + +AC_DEFUN([AC_FUNC_FSEEKO], + [AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE, 1, + ac_cv_sys_largefile_source, + [Define to make fseeko visible on some hosts (e.g. glibc 2.2).], + [#include <stdio.h>], [return !fseeko;]) + # We used to try defining _XOPEN_SOURCE=500 too, to work around a bug + # in glibc 2.1.3, but that breaks too many other things. + # If you want fseeko and ftello with glibc, upgrade to a fixed glibc. + + AC_CACHE_CHECK([for fseeko], ac_cv_func_fseeko, + [ac_cv_func_fseeko=no + AC_TRY_LINK([#include <stdio.h>], + [return fseeko && fseeko (stdin, 0, 0);], + [ac_cv_func_fseeko=yes])]) + if test $ac_cv_func_fseeko != no; then + AC_DEFINE(HAVE_FSEEKO, 1, + [Define if fseeko (and presumably ftello) exists and is declared.]) + fi]) + + +dnl XXXXXXXXXXXXXXXXXX End Stolen (but modified) from GNU tar XXXXXXXXXXXXXXXXXXXXXXXXXXXXX + +AC_DEFUN([AC_HAVE_LARGEFILES], +[AC_CACHE_CHECK([if system supports Large Files at all], ac_cv_largefiles, + [AC_TRY_COMPILE([#include <stdio.h> +#include <sys/types.h>], + [ +/* + * Check that off_t can represent 2**63 - 1 correctly. + * We can't simply "#define LARGE_OFF_T 9223372036854775807", + * since some C++ compilers masquerading as C compilers + * incorrectly reject 9223372036854775807. + */ +# define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +return !fseeko; +return !ftello;], + [ac_cv_largefiles=yes], + [ac_cv_largefiles=no])]) + if test $ac_cv_largefiles = yes; then + AC_DEFINE(HAVE_LARGEFILES) + fi]) + +dnl Checks for whether fseeko() is available in non large file mode +dnl and whether there is a prototype for fseeko() +dnl Defines HAVE_FSEEKO on success. +AC_DEFUN([AC_SMALL_FSEEKO], +[AC_CACHE_CHECK([for fseeko()], ac_cv_func_fseeko, + [AC_TRY_LINK([#include <stdio.h>], +[return !fseeko;], + [ac_cv_func_fseeko=yes], + [ac_cv_func_fseeko=no])]) +if test $ac_cv_func_fseeko = yes; then + AC_DEFINE(HAVE_FSEEKO) +fi]) + +dnl Checks for whether ftello() is available in non large file mode +dnl and whether there is a prototype for ftello() +dnl Defines HAVE_FTELLO on success. +AC_DEFUN([AC_SMALL_FTELLO], +[AC_CACHE_CHECK([for ftello()], ac_cv_func_ftello, + [AC_TRY_LINK([#include <stdio.h>], +[return !ftello;], + [ac_cv_func_ftello=yes], + [ac_cv_func_ftello=no])]) +if test $ac_cv_func_ftello = yes; then + AC_DEFINE(HAVE_FTELLO) +fi]) + +dnl Checks if compiler allows dynamic arrays. +dnl Defines HAVE_DYN_ARRAYS on success. +AC_DEFUN([AC_DYN_ARRAYS], +[AC_CACHE_CHECK([if compiler allows dynamic arrays], ac_cv_dyn_arrays, + [AC_TRY_COMPILE([], + [extern int __aa(); int len = __aa(); char some_array[len];], + [ac_cv_dyn_arrays=yes], + [ac_cv_dyn_arrays=no])]) +if test $ac_cv_dyn_arrays = yes; then + AC_DEFINE(HAVE_DYN_ARRAYS) +fi]) + diff --git a/scsilib/conf/acoldnames.m4 b/scsilib/conf/acoldnames.m4 new file mode 100644 index 0000000..d31cdd7 --- /dev/null +++ b/scsilib/conf/acoldnames.m4 @@ -0,0 +1,80 @@ +dnl Map old names of Autoconf macros to new regularized names. +dnl This file is part of Autoconf. +dnl Copyright (C) 1994 Free Software Foundation, Inc. +dnl +dnl This program 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, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl General macros. +dnl +define(AC_WARN, [indir([AC_MSG_WARN], $@)])dnl +define(AC_ERROR, [indir([AC_MSG_ERROR], $@)])dnl +AC_DEFUN(AC_PROGRAM_CHECK, [indir([AC_CHECK_PROG], $@)])dnl +AC_DEFUN(AC_PROGRAM_PATH, [indir([AC_PATH_PROG], $@)])dnl +AC_DEFUN(AC_PROGRAMS_CHECK, [indir([AC_CHECK_PROGS], $@)])dnl +AC_DEFUN(AC_PROGRAMS_PATH, [indir([AC_PATH_PROGS], $@)])dnl +AC_DEFUN(AC_PREFIX, [indir([AC_PREFIX_PROGRAM], $@)])dnl +AC_DEFUN(AC_HEADER_EGREP, [indir([AC_EGREP_HEADER], $@)])dnl +AC_DEFUN(AC_PROGRAM_EGREP, [indir([AC_EGREP_CPP], $@)])dnl +AC_DEFUN(AC_TEST_PROGRAM, [indir([AC_TRY_RUN], $@)])dnl +AC_DEFUN(AC_TEST_CPP, [indir([AC_TRY_CPP], $@)])dnl +AC_DEFUN(AC_HEADER_CHECK, [indir([AC_CHECK_HEADER], $@)])dnl +AC_DEFUN(AC_FUNC_CHECK, [indir([AC_CHECK_FUNC], $@)])dnl +AC_DEFUN(AC_HAVE_FUNCS, [indir([AC_CHECK_FUNCS], $@)])dnl +AC_DEFUN(AC_HAVE_HEADERS, [indir([AC_CHECK_HEADERS], $@)])dnl +AC_DEFUN(AC_SIZEOF_TYPE, [indir([AC_CHECK_SIZEOF], $@)])dnl +dnl +dnl Specific macros. +dnl +AC_DEFUN(AC_GCC_TRADITIONAL, [indir([AC_PROG_GCC_TRADITIONAL])])dnl +AC_DEFUN(AC_MINUS_C_MINUS_O, [indir([AC_PROG_CC_C_O])])dnl +AC_DEFUN(AC_SET_MAKE, [indir([AC_PROG_MAKE_SET])])dnl +AC_DEFUN(AC_YYTEXT_POINTER, [indir([AC_DECL_YYTEXT])])dnl +AC_DEFUN(AC_LN_S, [indir([AC_PROG_LN_S])])dnl +AC_DEFUN(AC_STDC_HEADERS, [indir([AC_HEADER_STDC])])dnl +AC_DEFUN(AC_MAJOR_HEADER, [indir([AC_HEADER_MAJOR])])dnl +AC_DEFUN(AC_STAT_MACROS_BROKEN, [indir([AC_HEADER_STAT])])dnl +AC_DEFUN(AC_SYS_SIGLIST_DECLARED, [indir([AC_DECL_SYS_SIGLIST])])dnl +AC_DEFUN(AC_GETGROUPS_T, [indir([AC_TYPE_GETGROUPS])])dnl +AC_DEFUN(AC_UID_T, [indir([AC_TYPE_UID_T])])dnl +AC_DEFUN(AC_SIZE_T, [indir([AC_TYPE_SIZE_T])])dnl +AC_DEFUN(AC_PID_T, [indir([AC_TYPE_PID_T])])dnl +AC_DEFUN(AC_OFF_T, [indir([AC_TYPE_OFF_T])])dnl +AC_DEFUN(AC_MODE_T, [indir([AC_TYPE_MODE_T])])dnl +AC_DEFUN(AC_RETSIGTYPE, [indir([AC_TYPE_SIGNAL])])dnl +AC_DEFUN(AC_MMAP, [indir([AC_FUNC_MMAP])])dnl +AC_DEFUN(AC_VPRINTF, [indir([AC_FUNC_VPRINTF])])dnl +AC_DEFUN(AC_VFORK, [indir([AC_FUNC_VFORK])])dnl +AC_DEFUN(AC_WAIT3, [indir([AC_FUNC_WAIT3])])dnl +AC_DEFUN(AC_ALLOCA, [indir([AC_FUNC_ALLOCA])])dnl +AC_DEFUN(AC_GETLOADAVG, [indir([AC_FUNC_GETLOADAVG])])dnl +AC_DEFUN(AC_UTIME_NULL, [indir([AC_FUNC_UTIME_NULL])])dnl +AC_DEFUN(AC_STRCOLL, [indir([AC_FUNC_STRCOLL])])dnl +AC_DEFUN(AC_SETVBUF_REVERSED, [indir([AC_FUNC_SETVBUF_REVERSED])])dnl +AC_DEFUN(AC_TIME_WITH_SYS_TIME, [indir([AC_HEADER_TIME])])dnl +AC_DEFUN(AC_TIMEZONE, [indir([AC_STRUCT_TIMEZONE])])dnl +AC_DEFUN(AC_ST_BLOCKS, [indir([AC_STRUCT_ST_BLOCKS])])dnl +AC_DEFUN(AC_ST_BLKSIZE, [indir([AC_STRUCT_ST_BLKSIZE])])dnl +AC_DEFUN(AC_ST_RDEV, [indir([AC_STRUCT_ST_RDEV])])dnl +AC_DEFUN(AC_CROSS_CHECK, [indir([AC_C_CROSS])])dnl +AC_DEFUN(AC_CHAR_UNSIGNED, [indir([AC_C_CHAR_UNSIGNED])])dnl +AC_DEFUN(AC_LONG_DOUBLE, [indir([AC_C_LONG_DOUBLE])])dnl +AC_DEFUN(AC_WORDS_BIGENDIAN, [indir([AC_C_BIGENDIAN])])dnl +AC_DEFUN(AC_INLINE, [indir([AC_C_INLINE])])dnl +AC_DEFUN(AC_CONST, [indir([AC_C_CONST])])dnl +AC_DEFUN(AC_LONG_FILE_NAMES, [indir([AC_SYS_LONG_FILE_NAMES])])dnl +AC_DEFUN(AC_RESTARTABLE_SYSCALLS, [indir([AC_SYS_RESTARTABLE_SYSCALLS])])dnl +AC_DEFUN(AC_FIND_X, [indir([AC_PATH_X])])dnl +AC_DEFUN(AC_FIND_XTRA, [indir([AC_PATH_XTRA])])dnl diff --git a/scsilib/conf/acspecific.m4 b/scsilib/conf/acspecific.m4 new file mode 100644 index 0000000..32aa4cb --- /dev/null +++ b/scsilib/conf/acspecific.m4 @@ -0,0 +1,2780 @@ +dnl Macros that test for specific features. +dnl This file is part of Autoconf. +dnl Copyright (C) 1992, 93, 94, 95, 96, 1998 Free Software Foundation, Inc. +dnl +dnl This program 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, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl As a special exception, the Free Software Foundation gives unlimited +dnl permission to copy, distribute and modify the configure scripts that +dnl are the output of Autoconf. You need not follow the terms of the GNU +dnl General Public License when using or distributing such scripts, even +dnl though portions of the text of Autoconf appear in them. The GNU +dnl General Public License (GPL) does govern all other use of the material +dnl that constitutes the Autoconf program. +dnl +dnl Certain portions of the Autoconf source text are designed to be copied +dnl (in certain cases, depending on the input) into the output of +dnl Autoconf. We call these the "data" portions. The rest of the Autoconf +dnl source text consists of comments plus executable code that decides which +dnl of the data portions to output in any given case. We call these +dnl comments and executable code the "non-data" portions. Autoconf never +dnl copies any of the non-data portions into its output. +dnl +dnl This special exception to the GPL applies to versions of Autoconf +dnl released by the Free Software Foundation. When you make and +dnl distribute a modified version of Autoconf, you may extend this special +dnl exception to the GPL to apply to your modified version as well, *unless* +dnl your modified version has the potential to copy into its output some +dnl of the text that was the non-data portion of the version that you started +dnl with. (In other words, unless your change moves or copies text from +dnl the non-data portions to the data portions.) If your modification has +dnl such potential, you must delete any notice of this special exception +dnl to the GPL from your modified version. +dnl +dnl Written by David MacKenzie, with help from +dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor, +dnl Roland McGrath, Noah Friedman, david d zuhn, and many others. + + +dnl ### Checks for programs + + +dnl Check whether to use -n, \c, or newline-tab to separate +dnl checking messages from result messages. +dnl Idea borrowed from dist 3.0. +dnl Internal use only. +AC_DEFUN(AC_PROG_ECHO_N, +[if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi +]) + +AC_DEFUN(AC_PROG_CC, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +AC_CHECK_PROG(CC, gcc, gcc) +if test -z "$CC"; then + AC_CHECK_PROG(CC, cc, cc, , , /usr/ucb/cc) + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + AC_CHECK_PROG(CC, cl, cl) ;; + esac + fi + test -z "$CC" && AC_MSG_ERROR([no acceptable cc found in \$PATH]) +fi + +AC_PROG_CC_WORKS +AC_PROG_CC_GNU + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +dnl Check whether -g works, even if CFLAGS is set, in case the package +dnl plays around with CFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +AC_PROG_CC_G +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 +]) + +AC_DEFUN(AC_PROG_CXX, +[AC_BEFORE([$0], [AC_PROG_CXXCPP])dnl +AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, gcc) + +AC_PROG_CXX_WORKS +AC_PROG_CXX_GNU + +if test $ac_cv_prog_gxx = yes; then + GXX=yes +else + GXX= +fi + +dnl Check whether -g works, even if CXXFLAGS is set, in case the package +dnl plays around with CXXFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. +ac_test_CXXFLAGS="${CXXFLAGS+set}" +ac_save_CXXFLAGS="$CXXFLAGS" +CXXFLAGS= +AC_PROG_CXX_G +if test "$ac_test_CXXFLAGS" = set; then + CXXFLAGS="$ac_save_CXXFLAGS" +elif test $ac_cv_prog_cxx_g = yes; then + if test "$GXX" = yes; then + CXXFLAGS="-g -O2" + else + CXXFLAGS="-g" + fi +else + if test "$GXX" = yes; then + CXXFLAGS="-O2" + else + CXXFLAGS= + fi +fi +]) + +dnl Determine a Fortran 77 compiler to use. If `F77' is not already set +dnl in the environment, check for `g77', `f77' and `f2c', in that order. +dnl Set the output variable `F77' to the name of the compiler found. +dnl +dnl If using `g77' (the GNU Fortran 77 compiler), then `AC_PROG_F77' +dnl will set the shell variable `G77' to `yes', and empty otherwise. If +dnl the output variable `FFLAGS' was not already set in the environment, +dnl then set it to `-g -02' for `g77' (or `-O2' where `g77' does not +dnl accept `-g'). Otherwise, set `FFLAGS' to `-g' for all other Fortran +dnl 77 compilers. +dnl +dnl AC_PROG_F77() +AC_DEFUN(AC_PROG_F77, +[AC_BEFORE([$0], [AC_PROG_CPP])dnl +if test -z "$F77"; then + AC_CHECK_PROGS(F77, g77 f77 f2c) + test -z "$F77" && AC_MSG_ERROR([no acceptable Fortran 77 compiler found in \$PATH]) +fi + +AC_PROG_F77_WORKS +AC_PROG_F77_GNU + +if test $ac_cv_prog_g77 = yes; then + G77=yes +dnl Check whether -g works, even if FFLAGS is set, in case the package +dnl plays around with FFLAGS (such as to build both debugging and +dnl normal versions of a library), tasteless as that idea is. + ac_test_FFLAGS="${FFLAGS+set}" + ac_save_FFLAGS="$FFLAGS" + FFLAGS= + AC_PROG_F77_G + if test "$ac_test_FFLAGS" = set; then + FFLAGS="$ac_save_FFLAGS" + elif test $ac_cv_prog_f77_g = yes; then + FFLAGS="-g -O2" + else + FFLAGS="-O2" + fi +else + G77= + test "${FFLAGS+set}" = set || FFLAGS="-g" +fi +]) + +AC_DEFUN(AC_PROG_CC_WORKS, +[AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) works]) +AC_LANG_SAVE +AC_LANG_C +AC_TRY_COMPILER([main(){return(0);}], ac_cv_prog_cc_works, ac_cv_prog_cc_cross) +AC_LANG_RESTORE +AC_MSG_RESULT($ac_cv_prog_cc_works) +if test $ac_cv_prog_cc_works = no; then + AC_MSG_ERROR([installation or configuration problem: C compiler cannot create executables.]) +fi +AC_MSG_CHECKING([whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler]) +AC_MSG_RESULT($ac_cv_prog_cc_cross) +cross_compiling=$ac_cv_prog_cc_cross +]) + +AC_DEFUN(AC_PROG_CXX_WORKS, +[AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works]) +AC_LANG_SAVE +AC_LANG_CPLUSPLUS +AC_TRY_COMPILER([int main(){return(0);}], ac_cv_prog_cxx_works, ac_cv_prog_cxx_cross) +AC_LANG_RESTORE +AC_MSG_RESULT($ac_cv_prog_cxx_works) +if test $ac_cv_prog_cxx_works = no; then + AC_MSG_ERROR([installation or configuration problem: C++ compiler cannot create executables.]) +fi +AC_MSG_CHECKING([whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler]) +AC_MSG_RESULT($ac_cv_prog_cxx_cross) +cross_compiling=$ac_cv_prog_cxx_cross +]) + +dnl Test whether the Fortran 77 compiler can compile and link a trivial +dnl Fortran program. Also, test whether the Fortran 77 compiler is a +dnl cross-compiler (which may realistically be the case if the Fortran +dnl compiler is `g77'). +dnl +dnl AC_PROG_F77_WORKS() +AC_DEFUN(AC_PROG_F77_WORKS, +[AC_MSG_CHECKING([whether the Fortran 77 compiler ($F77 $FFLAGS $LDFLAGS) works]) +AC_LANG_SAVE +AC_LANG_FORTRAN77 +AC_TRY_COMPILER(dnl +[ program conftest + end +], ac_cv_prog_f77_works, ac_cv_prog_f77_cross) +AC_LANG_RESTORE +AC_MSG_RESULT($ac_cv_prog_f77_works) +if test $ac_cv_prog_f77_works = no; then + AC_MSG_ERROR([installation or configuration problem: Fortran 77 compiler cannot create executables.]) +fi +AC_MSG_CHECKING([whether the Fortran 77 compiler ($F77 $FFLAGS $LDFLAGS) is a cross-compiler]) +AC_MSG_RESULT($ac_cv_prog_f77_cross) +cross_compiling=$ac_cv_prog_f77_cross +]) + +AC_DEFUN(AC_PROG_CC_GNU, +[AC_CACHE_CHECK(whether we are using GNU C, ac_cv_prog_gcc, +[dnl The semicolon is to pacify NeXT's syntax-checking cpp. +cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if AC_TRY_COMMAND(${CC-cc} -E conftest.c) | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi])]) + +AC_DEFUN(AC_PROG_CXX_GNU, +[AC_CACHE_CHECK(whether we are using GNU C++, ac_cv_prog_gxx, +[dnl The semicolon is to pacify NeXT's syntax-checking cpp. +cat > conftest.C <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if AC_TRY_COMMAND(${CXX-g++} -E conftest.C) | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gxx=yes +else + ac_cv_prog_gxx=no +fi])]) + +dnl Test whether for Fortran 77 compiler is `g77' (the GNU Fortran 77 +dnl Compiler). This test depends on whether the Fortran 77 compiler can +dnl do CPP pre-processing. +dnl +dnl AC_PROG_F77_GNU() +AC_DEFUN(AC_PROG_F77_GNU, +[AC_CACHE_CHECK(whether we are using GNU Fortran 77, ac_cv_prog_g77, +[cat > conftest.fpp <<EOF +#ifdef __GNUC__ + yes +#endif +EOF +if AC_TRY_COMMAND($F77 -E conftest.fpp) | egrep yes >/dev/null 2>&1; then + ac_cv_prog_g77=yes +else + ac_cv_prog_g77=no +fi])]) + +AC_DEFUN(AC_PROG_CC_G, +[AC_CACHE_CHECK(whether ${CC-cc} accepts -g, ac_cv_prog_cc_g, +[echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* +])]) + +AC_DEFUN(AC_PROG_CXX_G, +[AC_CACHE_CHECK(whether ${CXX-g++} accepts -g, ac_cv_prog_cxx_g, +[echo 'void f(){}' > conftest.cc +if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then + ac_cv_prog_cxx_g=yes +else + ac_cv_prog_cxx_g=no +fi +rm -f conftest* +])]) + +dnl Test whether the Fortran 77 compiler can accept the `-g' option to +dnl enable debugging. +dnl +dnl AC_PROG_F77_G() +AC_DEFUN(AC_PROG_F77_G, +[AC_CACHE_CHECK(whether $F77 accepts -g, ac_cv_prog_f77_g, +[cat > conftest.f << EOF + program conftest + end +EOF +if test -z "`$F77 -g -c conftest.f 2>&1`"; then + ac_cv_prog_f77_g=yes +else + ac_cv_prog_f77_g=no +fi +rm -f conftest* +])]) + +AC_DEFUN(AC_PROG_GCC_TRADITIONAL, +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_CPP])dnl +if test $ac_cv_prog_gcc = yes; then + AC_CACHE_CHECK(whether ${CC-cc} needs -traditional, + ac_cv_prog_gcc_traditional, +[ ac_pattern="Autoconf.*'x'" + AC_EGREP_CPP($ac_pattern, [#include <sgtty.h> +Autoconf TIOCGETP], + ac_cv_prog_gcc_traditional=yes, ac_cv_prog_gcc_traditional=no) + + if test $ac_cv_prog_gcc_traditional = no; then + AC_EGREP_CPP($ac_pattern, [#include <termio.h> +Autoconf TCGETA], + ac_cv_prog_gcc_traditional=yes) + fi]) + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi +]) + +AC_DEFUN(AC_PROG_CC_C_O, +[if test "x$CC" != xcc; then + AC_MSG_CHECKING(whether $CC and cc understand -c and -o together) +else + AC_MSG_CHECKING(whether cc understands -c and -o together) +fi +set dummy $CC; ac_cc="`echo [$]2 | +changequote(, )dnl + sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`" +changequote([, ])dnl +AC_CACHE_VAL(ac_cv_prog_cc_${ac_cc}_c_o, +[echo 'foo(){}' > conftest.c +# Make sure it works both with $CC and with simple cc. +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +ac_try='${CC-cc} -c conftest.c -o conftest.o 1>&AC_FD_CC' +if AC_TRY_EVAL(ac_try) && + test -f conftest.o && AC_TRY_EVAL(ac_try); +then + eval ac_cv_prog_cc_${ac_cc}_c_o=yes + if test "x$CC" != xcc; then + # Test first that cc exists at all. + if AC_TRY_COMMAND(cc -c conftest.c 1>&AC_FD_CC); then + ac_try='cc -c conftest.c -o conftest.o 1>&AC_FD_CC' + if AC_TRY_EVAL(ac_try) && + test -f conftest.o && AC_TRY_EVAL(ac_try); + then + # cc works too. + : + else + # cc exists but doesn't like -o. + eval ac_cv_prog_cc_${ac_cc}_c_o=no + fi + fi + fi +else + eval ac_cv_prog_cc_${ac_cc}_c_o=no +fi +rm -f conftest* +])dnl +if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" = yes"; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) + AC_DEFINE(NO_MINUS_C_MINUS_O) +fi +]) + +dnl Test if the Fortran 77 compiler accepts the options `-c' and `-o' +dnl simultaneously, and define `F77_NO_MINUS_C_MINUS_O' if it does not. +dnl +dnl The usefulness of this macro is questionable, as I can't really see +dnl why anyone would use it. The only reason I include it is for +dnl completeness, since a similar test exists for the C compiler. +dnl +dnl AC_PROG_F77_C_O +AC_DEFUN(AC_PROG_F77_C_O, +[AC_BEFORE([$0], [AC_PROG_F77])dnl +AC_MSG_CHECKING(whether $F77 understand -c and -o together) +set dummy $F77; ac_f77="`echo [$]2 | +changequote(, )dnl +sed -e 's/[^a-zA-Z0-9_]/_/g' -e 's/^[0-9]/_/'`" +changequote([, ])dnl +AC_CACHE_VAL(ac_cv_prog_f77_${ac_f77}_c_o, +[cat > conftest.f << EOF + program conftest + end +EOF +# We do the `AC_TRY_EVAL' test twice because some compilers refuse to +# overwrite an existing `.o' file with `-o', although they will create +# one. +ac_try='$F77 $FFLAGS -c conftest.f -o conftest.o 1>&AC_FD_CC' +if AC_TRY_EVAL(ac_try) && test -f conftest.o && AC_TRY_EVAL(ac_try); then + eval ac_cv_prog_f77_${ac_f77}_c_o=yes +else + eval ac_cv_prog_f77_${ac_f77}_c_o=no +fi +rm -f conftest* +])dnl +if eval "test \"`echo '$ac_cv_prog_f77_'${ac_f77}_c_o`\" = yes"; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) + AC_DEFINE(F77_NO_MINUS_C_MINUS_O) +fi +]) + +dnl Define SET_MAKE to set ${MAKE} if make doesn't. +AC_DEFUN(AC_PROG_MAKE_SET, +[AC_MSG_CHECKING(whether ${MAKE-make} sets \${MAKE}) +set dummy ${MAKE-make}; ac_make=`echo "[$]2" | sed 'y%./+-%__p_%'` +AC_CACHE_VAL(ac_cv_prog_make_${ac_make}_set, +[cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +changequote(, )dnl +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +changequote([, ])dnl +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake])dnl +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + AC_MSG_RESULT(yes) + SET_MAKE= +else + AC_MSG_RESULT(no) + SET_MAKE="MAKE=${MAKE-make}" +fi +AC_SUBST([SET_MAKE])dnl +]) + +AC_DEFUN(AC_PROG_RANLIB, +[AC_CHECK_PROG(RANLIB, ranlib, ranlib, :)]) + +dnl Check for mawk first since it's generally faster. +AC_DEFUN(AC_PROG_AWK, +[AC_CHECK_PROGS(AWK, mawk gawk nawk awk, )]) + +AC_DEFUN(AC_PROG_YACC, +[AC_CHECK_PROGS(YACC, 'bison -y' byacc, yacc)]) + +AC_DEFUN(AC_PROG_CPP, +[AC_MSG_CHECKING(how to run the C preprocessor) +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +AC_CACHE_VAL(ac_cv_prog_CPP, +[ # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. +dnl Use a header file that comes with gcc, so configuring glibc +dnl with a fresh cross-compiler works. + AC_TRY_CPP([#include <assert.h> +Syntax Error], , + CPP="${CC-cc} -E -traditional-cpp" + AC_TRY_CPP([#include <assert.h> +Syntax Error], , + CPP="${CC-cc} -nologo -E" + AC_TRY_CPP([#include <assert.h> +Syntax Error], , CPP=/lib/cpp))) + ac_cv_prog_CPP="$CPP"])dnl + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +AC_MSG_RESULT($CPP) +AC_SUBST(CPP)dnl +]) + +AC_DEFUN(AC_PROG_CXXCPP, +[AC_MSG_CHECKING(how to run the C++ preprocessor) +if test -z "$CXXCPP"; then +AC_CACHE_VAL(ac_cv_prog_CXXCPP, +[AC_LANG_SAVE[]dnl +AC_LANG_CPLUSPLUS[]dnl + CXXCPP="${CXX-g++} -E" + AC_TRY_CPP([#include <stdlib.h>], , CXXCPP=/lib/cpp) + ac_cv_prog_CXXCPP="$CXXCPP" +AC_LANG_RESTORE[]dnl +fi])dnl +CXXCPP="$ac_cv_prog_CXXCPP" +AC_MSG_RESULT($CXXCPP) +AC_SUBST(CXXCPP)dnl +]) + +dnl Require finding the C or C++ preprocessor, whichever is the +dnl current language. +AC_DEFUN(AC_REQUIRE_CPP, +[ifelse(AC_LANG, C, [AC_REQUIRE([AC_PROG_CPP])], [AC_REQUIRE([AC_PROG_CXXCPP])])]) + +AC_DEFUN(AC_PROG_LEX, +[AC_CHECK_PROG(LEX, flex, flex, lex) +if test -z "$LEXLIB" +then + case "$LEX" in + flex*) ac_lib=fl ;; + *) ac_lib=l ;; + esac + AC_CHECK_LIB($ac_lib, yywrap, LEXLIB="-l$ac_lib") +fi +AC_SUBST(LEXLIB)]) + +dnl Check if lex declares yytext as a char * by default, not a char[]. +undefine([AC_DECL_YYTEXT]) +AC_DEFUN(AC_DECL_YYTEXT, +[AC_REQUIRE_CPP()dnl +AC_REQUIRE([AC_PROG_LEX])dnl +AC_CACHE_CHECK(lex output file root, ac_cv_prog_lex_root, +[# The minimal lex program is just a single line: %%. But some broken lexes +# (Solaris, I think it was) want two %% lines, so accommodate them. +echo '%% +%%' | $LEX +if test -f lex.yy.c; then + ac_cv_prog_lex_root=lex.yy +elif test -f lexyy.c; then + ac_cv_prog_lex_root=lexyy +else + AC_MSG_ERROR(cannot find output from $LEX; giving up) +fi]) +LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root +AC_SUBST(LEX_OUTPUT_ROOT)dnl + +AC_CACHE_CHECK(whether yytext is a pointer, ac_cv_prog_lex_yytext_pointer, +[# POSIX says lex can declare yytext either as a pointer or an array; the +# default is implementation-dependent. Figure out which it is, since +# not all implementations provide the %pointer and %array declarations. +ac_cv_prog_lex_yytext_pointer=no +echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c +ac_save_LIBS="$LIBS" +LIBS="$LIBS $LEXLIB" +AC_TRY_LINK(`cat $LEX_OUTPUT_ROOT.c`, , ac_cv_prog_lex_yytext_pointer=yes) +LIBS="$ac_save_LIBS" +rm -f "${LEX_OUTPUT_ROOT}.c" +]) +dnl +if test $ac_cv_prog_lex_yytext_pointer = yes; then + AC_DEFINE(YYTEXT_POINTER) +fi +]) + +AC_DEFUN(AC_PROG_INSTALL, +[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +AC_MSG_CHECKING(for a BSD compatible install) +if test -z "$INSTALL"; then +AC_CACHE_VAL(ac_cv_path_install, +[ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" +])dnl + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +dnl We do special magic for INSTALL instead of AC_SUBST, to get +dnl relative paths right. +AC_MSG_RESULT($INSTALL) + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' +AC_SUBST(INSTALL_PROGRAM)dnl + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +AC_SUBST(INSTALL_SCRIPT)dnl + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +AC_SUBST(INSTALL_DATA)dnl +]) + +AC_DEFUN(AC_PROG_LN_S, +[AC_MSG_CHECKING(whether ln -s works) +AC_CACHE_VAL(ac_cv_prog_LN_S, +[rm -f conftestdata +if ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" +else + ac_cv_prog_LN_S=ln +fi])dnl +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + AC_MSG_RESULT(yes) +else + AC_MSG_RESULT(no) +fi +AC_SUBST(LN_S)dnl +]) + +define(AC_RSH, +[errprint(__file__:__line__: [$0] has been removed; replace it with equivalent code +)m4exit(4)]) + + +dnl ### Checks for header files + + +AC_DEFUN(AC_HEADER_STDC, +[AC_REQUIRE_CPP()dnl +AC_CACHE_CHECK(for ANSI C header files, ac_cv_header_stdc, +[AC_TRY_CPP([#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h>], ac_cv_header_stdc=yes, ac_cv_header_stdc=no) + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +AC_EGREP_HEADER(memchr, string.h, , ac_cv_header_stdc=no) +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +AC_EGREP_HEADER(free, stdlib.h, , ac_cv_header_stdc=no) +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +AC_TRY_RUN([#include <ctype.h> +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } +], , ac_cv_header_stdc=no, :) +fi]) +if test $ac_cv_header_stdc = yes; then + AC_DEFINE(STDC_HEADERS) +fi +]) + +AC_DEFUN(AC_UNISTD_H, +[AC_OBSOLETE([$0], [; instead use AC_CHECK_HEADERS(unistd.h)])dnl +AC_CHECK_HEADER(unistd.h, AC_DEFINE(HAVE_UNISTD_H))]) + +AC_DEFUN(AC_USG, +[AC_OBSOLETE([$0], + [; instead use AC_CHECK_HEADERS(string.h) and HAVE_STRING_H])dnl +AC_MSG_CHECKING([for BSD string and memory functions]) +AC_TRY_LINK([#include <strings.h>], [rindex(0, 0); bzero(0, 0);], + [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); AC_DEFINE(USG)])]) + + +dnl If memchr and the like aren't declared in <string.h>, include <memory.h>. +dnl To avoid problems, don't check for gcc2 built-ins. +AC_DEFUN(AC_MEMORY_H, +[AC_OBSOLETE([$0], [; instead use AC_CHECK_HEADERS(memory.h) and HAVE_MEMORY_H])dnl +AC_MSG_CHECKING(whether string.h declares mem functions) +AC_EGREP_HEADER(memchr, string.h, ac_found=yes, ac_found=no) +AC_MSG_RESULT($ac_found) +if test $ac_found = no; then + AC_CHECK_HEADER(memory.h, [AC_DEFINE(NEED_MEMORY_H)]) +fi +]) + +AC_DEFUN(AC_HEADER_MAJOR, +[AC_CACHE_CHECK(whether sys/types.h defines makedev, + ac_cv_header_sys_types_h_makedev, +[AC_TRY_LINK([#include <sys/types.h>], [return makedev(0, 0);], + ac_cv_header_sys_types_h_makedev=yes, ac_cv_header_sys_types_h_makedev=no) +]) + +if test $ac_cv_header_sys_types_h_makedev = no; then +AC_CHECK_HEADER(sys/mkdev.h, [AC_DEFINE(MAJOR_IN_MKDEV)]) + + if test $ac_cv_header_sys_mkdev_h = no; then +AC_CHECK_HEADER(sys/sysmacros.h, [AC_DEFINE(MAJOR_IN_SYSMACROS)]) + fi +fi +]) + +AC_DEFUN(AC_HEADER_DIRENT, +[ac_header_dirent=no +AC_CHECK_HEADERS_DIRENT(dirent.h sys/ndir.h sys/dir.h ndir.h, + [ac_header_dirent=$ac_hdr; break]) +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then +AC_CHECK_LIB(dir, opendir, LIBS="$LIBS -ldir") +else +AC_CHECK_LIB(x, opendir, LIBS="$LIBS -lx") +fi +]) + +dnl Like AC_CHECK_HEADER, except also make sure that HEADER-FILE +dnl defines the type `DIR'. dirent.h on NextStep 3.2 doesn't. +dnl AC_CHECK_HEADER_DIRENT(HEADER-FILE, ACTION-IF-FOUND) +AC_DEFUN(AC_CHECK_HEADER_DIRENT, +[ac_safe=`echo "$1" | sed 'y%./+-%__p_%'` +AC_MSG_CHECKING([for $1 that defines DIR]) +AC_CACHE_VAL(ac_cv_header_dirent_$ac_safe, +[AC_TRY_COMPILE([#include <sys/types.h> +#include <$1>], [DIR *dirp = 0;], + eval "ac_cv_header_dirent_$ac_safe=yes", + eval "ac_cv_header_dirent_$ac_safe=no")])dnl +if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then + AC_MSG_RESULT(yes) + $2 +else + AC_MSG_RESULT(no) +fi +]) + +dnl Like AC_CHECK_HEADERS, except succeed only for a HEADER-FILE that +dnl defines `DIR'. +dnl AC_CHECK_HEADERS_DIRENT(HEADER-FILE... [, ACTION]) +define(AC_CHECK_HEADERS_DIRENT, +[for ac_hdr in $1 +do +AC_CHECK_HEADER_DIRENT($ac_hdr, +[changequote(, )dnl + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` +changequote([, ])dnl + AC_DEFINE_UNQUOTED($ac_tr_hdr) $2])dnl +done]) + +AC_DEFUN(AC_DIR_HEADER, +[AC_OBSOLETE([$0], [; instead use AC_HEADER_DIRENT])dnl +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do + AC_CHECK_HEADER_DIRENT($ac_hdr, [ac_header_dirent=$ac_hdr; break]) +done + +case "$ac_header_dirent" in +dirent.h) AC_DEFINE(DIRENT) ;; +sys/ndir.h) AC_DEFINE(SYSNDIR) ;; +sys/dir.h) AC_DEFINE(SYSDIR) ;; +ndir.h) AC_DEFINE(NDIR) ;; +esac + +AC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void, +[AC_TRY_RUN([#include <sys/types.h> +#include <$ac_header_dirent> +int closedir(); main() { exit(closedir(opendir(".")) != 0); }], + ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes, ac_cv_func_closedir_void=yes)]) +if test $ac_cv_func_closedir_void = yes; then + AC_DEFINE(VOID_CLOSEDIR) +fi +]) + +AC_DEFUN(AC_HEADER_STAT, +[AC_CACHE_CHECK(whether stat file-mode macros are broken, + ac_cv_header_stat_broken, +[AC_EGREP_CPP([You lose], [#include <sys/types.h> +#include <sys/stat.h> + +#if defined(S_ISBLK) && defined(S_IFDIR) +# if S_ISBLK (S_IFDIR) +You lose. +# endif +#endif + +#if defined(S_ISBLK) && defined(S_IFCHR) +# if S_ISBLK (S_IFCHR) +You lose. +# endif +#endif + +#if defined(S_ISLNK) && defined(S_IFREG) +# if S_ISLNK (S_IFREG) +You lose. +# endif +#endif + +#if defined(S_ISSOCK) && defined(S_IFREG) +# if S_ISSOCK (S_IFREG) +You lose. +# endif +#endif +], ac_cv_header_stat_broken=yes, ac_cv_header_stat_broken=no)]) +if test $ac_cv_header_stat_broken = yes; then + AC_DEFINE(STAT_MACROS_BROKEN) +fi +]) + +AC_DEFUN(AC_DECL_SYS_SIGLIST, +[AC_CACHE_CHECK([for sys_siglist declaration in signal.h or unistd.h], + ac_cv_decl_sys_siglist, +[AC_TRY_COMPILE([#include <sys/types.h> +#include <signal.h> +/* NetBSD declares sys_siglist in unistd.h. */ +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif], [char *msg = *(sys_siglist + 1);], + ac_cv_decl_sys_siglist=yes, ac_cv_decl_sys_siglist=no)]) +if test $ac_cv_decl_sys_siglist = yes; then + AC_DEFINE(SYS_SIGLIST_DECLARED) +fi +]) + +AC_DEFUN(AC_HEADER_SYS_WAIT, +[AC_CACHE_CHECK([for sys/wait.h that is POSIX.1 compatible], + ac_cv_header_sys_wait_h, +[AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/wait.h> +#ifndef WEXITSTATUS +#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +#endif +#ifndef WIFEXITED +#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif], [int s; +wait (&s); +s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;], +ac_cv_header_sys_wait_h=yes, ac_cv_header_sys_wait_h=no)]) +if test $ac_cv_header_sys_wait_h = yes; then + AC_DEFINE(HAVE_SYS_WAIT_H) +fi +]) + + +dnl ### Checks for typedefs + + +AC_DEFUN(AC_TYPE_GETGROUPS, +[AC_REQUIRE([AC_TYPE_UID_T])dnl +AC_CACHE_CHECK(type of array argument to getgroups, ac_cv_type_getgroups, +[AC_TRY_RUN( +changequote(<<, >>)dnl +<< +/* Thanks to Mike Rendell for this test. */ +#include <sys/types.h> +#define NGID 256 +#undef MAX +#define MAX(x, y) ((x) > (y) ? (x) : (y)) +main() +{ + gid_t gidset[NGID]; + int i, n; + union { gid_t gval; long lval; } val; + + val.lval = -1; + for (i = 0; i < NGID; i++) + gidset[i] = val.gval; + n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1, + gidset); + /* Exit non-zero if getgroups seems to require an array of ints. This + happens when gid_t is short but getgroups modifies an array of ints. */ + exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0); +} +>>, +changequote([, ])dnl + ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int, + ac_cv_type_getgroups=cross) +if test $ac_cv_type_getgroups = cross; then + dnl When we can't run the test program (we are cross compiling), presume + dnl that <unistd.h> has either an accurate prototype for getgroups or none. + dnl Old systems without prototypes probably use int. + AC_EGREP_HEADER([getgroups.*int.*gid_t], unistd.h, + ac_cv_type_getgroups=gid_t, ac_cv_type_getgroups=int) +fi]) +AC_DEFINE_UNQUOTED(GETGROUPS_T, $ac_cv_type_getgroups) +]) + +AC_DEFUN(AC_TYPE_UID_T, +[AC_CACHE_CHECK(for uid_t in sys/types.h, ac_cv_type_uid_t, +[AC_EGREP_HEADER(uid_t, sys/types.h, + ac_cv_type_uid_t=yes, ac_cv_type_uid_t=no)]) +if test $ac_cv_type_uid_t = no; then + AC_DEFINE(uid_t, int) + AC_DEFINE(gid_t, int) +fi +]) + +AC_DEFUN(AC_TYPE_SIZE_T, +[AC_CHECK_TYPE(size_t, unsigned)]) + +AC_DEFUN(AC_TYPE_PID_T, +[AC_CHECK_TYPE(pid_t, int)]) + +AC_DEFUN(AC_TYPE_OFF_T, +[AC_CHECK_TYPE(off_t, long)]) + +AC_DEFUN(AC_TYPE_MODE_T, +[AC_CHECK_TYPE(mode_t, int)]) + +dnl Note that identifiers starting with SIG are reserved by ANSI C. +AC_DEFUN(AC_TYPE_SIGNAL, +[AC_CACHE_CHECK([return type of signal handlers], ac_cv_type_signal, +[AC_TRY_COMPILE([#include <sys/types.h> +#include <signal.h> +#ifdef signal +#undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif +], +[int i;], ac_cv_type_signal=void, ac_cv_type_signal=int)]) +AC_DEFINE_UNQUOTED(RETSIGTYPE, $ac_cv_type_signal) +]) + + +dnl ### Checks for functions + + +AC_DEFUN(AC_FUNC_CLOSEDIR_VOID, +[AC_REQUIRE([AC_HEADER_DIRENT])dnl +AC_CACHE_CHECK(whether closedir returns void, ac_cv_func_closedir_void, +[AC_TRY_RUN([#include <sys/types.h> +#include <$ac_header_dirent> +int closedir(); main() { exit(closedir(opendir(".")) != 0); }], + ac_cv_func_closedir_void=no, ac_cv_func_closedir_void=yes, ac_cv_func_closedir_void=yes)]) +if test $ac_cv_func_closedir_void = yes; then + AC_DEFINE(CLOSEDIR_VOID) +fi +]) + +AC_DEFUN(AC_FUNC_FNMATCH, +[AC_CACHE_CHECK(for working fnmatch, ac_cv_func_fnmatch_works, +# Some versions of Solaris or SCO have a broken fnmatch function. +# So we run a test program. If we are cross-compiling, take no chance. +# Thanks to John Oleynick and Franc,ois Pinard for this test. +[AC_TRY_RUN([main() { exit (fnmatch ("a*", "abc", 0) != 0); }], +ac_cv_func_fnmatch_works=yes, ac_cv_func_fnmatch_works=no, +ac_cv_func_fnmatch_works=no)]) +if test $ac_cv_func_fnmatch_works = yes; then + AC_DEFINE(HAVE_FNMATCH) +fi +]) + +AC_DEFUN(AC_FUNC_MMAP, +[AC_CHECK_HEADERS(unistd.h) +AC_CHECK_FUNCS(getpagesize) +AC_CACHE_CHECK(for working mmap, ac_cv_func_mmap_fixed_mapped, +[AC_TRY_RUN([ +/* Thanks to Mike Haertel and Jim Avera for this test. + Here is a matrix of mmap possibilities: + mmap private not fixed + mmap private fixed at somewhere currently unmapped + mmap private fixed at somewhere already mapped + mmap shared not fixed + mmap shared fixed at somewhere currently unmapped + mmap shared fixed at somewhere already mapped + For private mappings, we should verify that changes cannot be read() + back from the file, nor mmap's back from the file at a different + address. (There have been systems where private was not correctly + implemented like the infamous i386 svr4.0, and systems where the + VM page cache was not coherent with the filesystem buffer cache + like early versions of FreeBSD and possibly contemporary NetBSD.) + For shared mappings, we should conversely verify that changes get + propogated back to all the places they're supposed to be. + + Grep wants private fixed already mapped. + The main things grep needs to know about mmap are: + * does it exist and is it safe to write into the mmap'd area + * how to use it (BSD variants) */ +#include <sys/types.h> +#include <fcntl.h> +#include <sys/mman.h> + +/* This mess was copied from the GNU getpagesize.h. */ +#ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include <unistd.h> +# endif + +/* Assume that all systems that can run configure have sys/param.h. */ +# ifndef HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# ifdef HAVE_SYS_PARAM_H +# include <sys/param.h> +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +#ifdef __cplusplus +extern "C" { void *malloc(unsigned); } +#else +char *malloc(); +#endif + +int +main() +{ + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize(); + + /* + * First, make a file with some known garbage in it. + */ + data = malloc(pagesize); + if (!data) + exit(1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand(); + umask(0); + fd = creat("conftestmmap", 0600); + if (fd < 0) + exit(1); + if (write(fd, data, pagesize) != pagesize) + exit(1); + close(fd); + + /* + * Next, try to mmap the file at a fixed address which + * already has something else allocated at it. If we can, + * also make sure that we see the same garbage. + */ + fd = open("conftestmmap", O_RDWR); + if (fd < 0) + exit(1); + data2 = malloc(2 * pagesize); + if (!data2) + exit(1); + data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit(1); + + /* + * Finally, make sure that changes to the mapped area + * do not percolate back to the file as seen by read(). + * (This is a bug on some variants of i386 svr4.0.) + */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = malloc(pagesize); + if (!data3) + exit(1); + if (read(fd, data3, pagesize) != pagesize) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit(1); + close(fd); + unlink("conftestmmap"); + exit(0); +} +], ac_cv_func_mmap_fixed_mapped=yes, ac_cv_func_mmap_fixed_mapped=no, +ac_cv_func_mmap_fixed_mapped=no)]) +if test $ac_cv_func_mmap_fixed_mapped = yes; then + AC_DEFINE(HAVE_MMAP) +fi +]) + +AC_DEFUN(AC_FUNC_GETPGRP, +[AC_CACHE_CHECK(whether getpgrp takes no argument, ac_cv_func_getpgrp_void, +[AC_TRY_RUN([ +/* + * If this system has a BSD-style getpgrp(), + * which takes a pid argument, exit unsuccessfully. + * + * Snarfed from Chet Ramey's bash pgrp.c test program + */ +#include <stdio.h> +#include <sys/types.h> + +int pid; +int pg1, pg2, pg3, pg4; +int ng, np, s, child; + +main() +{ + pid = getpid(); + pg1 = getpgrp(0); + pg2 = getpgrp(); + pg3 = getpgrp(pid); + pg4 = getpgrp(1); + + /* + * If all of these values are the same, it's pretty sure that + * we're on a system that ignores getpgrp's first argument. + */ + if (pg2 == pg4 && pg1 == pg3 && pg2 == pg3) + exit(0); + + child = fork(); + if (child < 0) + exit(1); + else if (child == 0) { + np = getpid(); + /* + * If this is Sys V, this will not work; pgrp will be + * set to np because setpgrp just changes a pgrp to be + * the same as the pid. + */ + setpgrp(np, pg1); + ng = getpgrp(0); /* Same result for Sys V and BSD */ + if (ng == pg1) { + exit(1); + } else { + exit(0); + } + } else { + wait(&s); + exit(s>>8); + } +} +], ac_cv_func_getpgrp_void=yes, ac_cv_func_getpgrp_void=no, + AC_MSG_ERROR(cannot check getpgrp if cross compiling)) +]) +if test $ac_cv_func_getpgrp_void = yes; then + AC_DEFINE(GETPGRP_VOID) +fi +]) + +AC_DEFUN(AC_FUNC_SETPGRP, +[AC_CACHE_CHECK(whether setpgrp takes no argument, ac_cv_func_setpgrp_void, +AC_TRY_RUN([ +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +/* + * If this system has a BSD-style setpgrp, which takes arguments, exit + * successfully. + */ +main() +{ + if (setpgrp(1,1) == -1) + exit(0); + else + exit(1); +} +], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes, + AC_MSG_ERROR(cannot check setpgrp if cross compiling)) +) +if test $ac_cv_func_setpgrp_void = yes; then + AC_DEFINE(SETPGRP_VOID) +fi +]) + +AC_DEFUN(AC_FUNC_VPRINTF, +[AC_CHECK_FUNC(vprintf, AC_DEFINE(HAVE_VPRINTF)) +if test "$ac_cv_func_vprintf" != yes; then +AC_CHECK_FUNC(_doprnt, AC_DEFINE(HAVE_DOPRNT)) +fi +]) + +AC_DEFUN(AC_FUNC_VFORK, +[AC_REQUIRE([AC_TYPE_PID_T])dnl +AC_CHECK_HEADER(vfork.h, AC_DEFINE(HAVE_VFORK_H)) +AC_CACHE_CHECK(for working vfork, ac_cv_func_vfork_works, +[AC_TRY_RUN([/* Thanks to Paul Eggert for this test. */ +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#ifdef HAVE_VFORK_H +#include <vfork.h> +#endif +/* On some sparc systems, changes by the child to local and incoming + argument registers are propagated back to the parent. + The compiler is told about this with #include <vfork.h>, + but some compilers (e.g. gcc -O) don't grok <vfork.h>. + Test for this by using a static variable whose address + is put into a register that is clobbered by the vfork. */ +static +#ifdef __cplusplus +sparc_address_test (int arg) +#else +sparc_address_test (arg) int arg; +#endif +{ + static pid_t child; + if (!child) { + child = vfork (); + if (child < 0) { + perror ("vfork"); + _exit(2); + } + if (!child) { + arg = getpid(); + write(-1, "", 0); + _exit (arg); + } + } +} +main() { + pid_t parent = getpid (); + pid_t child; + + sparc_address_test (); + + child = vfork (); + + if (child == 0) { + /* Here is another test for sparc vfork register problems. + This test uses lots of local variables, at least + as many local variables as main has allocated so far + including compiler temporaries. 4 locals are enough for + gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. + A buggy compiler should reuse the register of parent + for one of the local variables, since it will think that + parent can't possibly be used any more in this routine. + Assigning to the local variable will thus munge parent + in the parent process. */ + pid_t + p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), + p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); + /* Convince the compiler that p..p7 are live; otherwise, it might + use the same hardware register for all 8 local variables. */ + if (p != p1 || p != p2 || p != p3 || p != p4 + || p != p5 || p != p6 || p != p7) + _exit(1); + + /* On some systems (e.g. IRIX 3.3), + vfork doesn't separate parent from child file descriptors. + If the child closes a descriptor before it execs or exits, + this munges the parent's descriptor as well. + Test for this by closing stdout in the child. */ + _exit(close(fileno(stdout)) != 0); + } else { + int status; + struct stat st; + + while (wait(&status) != child) + ; + exit( + /* Was there some problem with vforking? */ + child < 0 + + /* Did the child fail? (This shouldn't happen.) */ + || status + + /* Did the vfork/compiler bug occur? */ + || parent != getpid() + + /* Did the file descriptor bug occur? */ + || fstat(fileno(stdout), &st) != 0 + ); + } +}], +ac_cv_func_vfork_works=yes, ac_cv_func_vfork_works=no, AC_CHECK_FUNC(vfork) +ac_cv_func_vfork_works=$ac_cv_func_vfork)]) +if test $ac_cv_func_vfork_works = no; then + AC_DEFINE(vfork, fork) +fi +]) + +AC_DEFUN(AC_FUNC_WAIT3, +[AC_CACHE_CHECK(for wait3 that fills in rusage, ac_cv_func_wait3_rusage, +[AC_TRY_RUN([#include <sys/types.h> +#include <sys/time.h> +#include <sys/resource.h> +#include <stdio.h> +/* HP-UX has wait3 but does not fill in rusage at all. */ +main() { + struct rusage r; + int i; + /* Use a field that we can force nonzero -- + voluntary context switches. + For systems like NeXT and OSF/1 that don't set it, + also use the system CPU time. And page faults (I/O) for Linux. */ + r.ru_nvcsw = 0; + r.ru_utime.tv_sec = 0; + r.ru_utime.tv_usec = 0; + r.ru_stime.tv_sec = 0; + r.ru_stime.tv_usec = 0; + r.ru_majflt = r.ru_minflt = 0; + switch (fork()) { + case 0: /* Child. */ + sleep(1); /* Give up the CPU. */ + for (i=200000; --i > 0;) getpid(); /* Use up some CPU time */ + _exit(0); + case -1: _exit(0); /* What can we do? */ + default: /* Parent. */ + wait3(&i, 0, &r); + sleep(2); /* Avoid "text file busy" from rm on fast HP-UX machines. */ + exit(r.ru_nvcsw == 0 && r.ru_majflt == 0 && r.ru_minflt == 0 + && r.ru_utime.tv_sec == 0 && r.ru_utime.tv_usec == 0 + && r.ru_stime.tv_sec == 0 && r.ru_stime.tv_usec == 0); + } +}], ac_cv_func_wait3_rusage=yes, ac_cv_func_wait3_rusage=no, +ac_cv_func_wait3_rusage=no)]) +if test $ac_cv_func_wait3_rusage = yes; then + AC_DEFINE(HAVE_WAIT3) +fi +]) + +AC_DEFUN(AC_FUNC_ALLOCA, +[AC_REQUIRE_CPP()dnl Set CPP; we run AC_EGREP_CPP conditionally. +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +AC_CACHE_CHECK([for working alloca.h], ac_cv_header_alloca_h, +[AC_TRY_LINK([#include <alloca.h>], [char *p = alloca(2 * sizeof(int));], + ac_cv_header_alloca_h=yes, ac_cv_header_alloca_h=no)]) +if test $ac_cv_header_alloca_h = yes; then + AC_DEFINE(HAVE_ALLOCA_H) +fi + +AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works, +[AC_TRY_LINK([ +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER +# include <malloc.h> +# define alloca _alloca +# else +# if HAVE_ALLOCA_H +# include <alloca.h> +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +# endif +#endif +], [char *p = (char *) alloca(1);], + ac_cv_func_alloca_works=yes, ac_cv_func_alloca_works=no)]) +if test $ac_cv_func_alloca_works = yes; then + AC_DEFINE(HAVE_ALLOCA) +fi + +if test $ac_cv_func_alloca_works = no; then + # The SVR3 libPW and SVR4 libucb both contain incompatible functions + # that cause trouble. Some versions do not even contain alloca or + # contain a buggy version. If you still want to use their alloca, + # use ar to extract alloca.o from them instead of compiling alloca.c. + ALLOCA=alloca.${ac_objext} + AC_DEFINE(C_ALLOCA) + +AC_CACHE_CHECK(whether alloca needs Cray hooks, ac_cv_os_cray, +[AC_EGREP_CPP(webecray, +[#if defined(CRAY) && ! defined(CRAY2) +webecray +#else +wenotbecray +#endif +], ac_cv_os_cray=yes, ac_cv_os_cray=no)]) +if test $ac_cv_os_cray = yes; then +for ac_func in _getb67 GETB67 getb67; do + AC_CHECK_FUNC($ac_func, [AC_DEFINE_UNQUOTED(CRAY_STACKSEG_END, $ac_func) + break]) +done +fi + +AC_CACHE_CHECK(stack direction for C alloca, ac_cv_c_stack_direction, +[AC_TRY_RUN([find_stack_direction () +{ + static char *addr = 0; + auto char dummy; + if (addr == 0) + { + addr = &dummy; + return find_stack_direction (); + } + else + return (&dummy > addr) ? 1 : -1; +} +main () +{ + exit (find_stack_direction() < 0); +}], ac_cv_c_stack_direction=1, ac_cv_c_stack_direction=-1, + ac_cv_c_stack_direction=0)]) +AC_DEFINE_UNQUOTED(STACK_DIRECTION, $ac_cv_c_stack_direction) +fi +AC_SUBST(ALLOCA)dnl +]) + +AC_DEFUN(AC_FUNC_GETLOADAVG, +[ac_have_func=no # yes means we've found a way to get the load average. + +# Some systems with -lutil have (and need) -lkvm as well, some do not. +# On Solaris, -lkvm requires nlist from -lelf, so check that first +# to get the right answer into the cache. +AC_CHECK_LIB(elf, elf_begin, LIBS="-lelf $LIBS") +AC_CHECK_LIB(kvm, kvm_open, LIBS="-lkvm $LIBS") +# Check for the 4.4BSD definition of getloadavg. +AC_CHECK_LIB(util, getloadavg, + [LIBS="-lutil $LIBS" ac_have_func=yes ac_cv_func_getloadavg_setgid=yes]) + +if test $ac_have_func = no; then + # There is a commonly available library for RS/6000 AIX. + # Since it is not a standard part of AIX, it might be installed locally. + ac_getloadavg_LIBS="$LIBS"; LIBS="-L/usr/local/lib $LIBS" + AC_CHECK_LIB(getloadavg, getloadavg, + LIBS="-lgetloadavg $LIBS", LIBS="$ac_getloadavg_LIBS") +fi + +# Make sure it is really in the library, if we think we found it. +AC_REPLACE_FUNCS(getloadavg) + +if test $ac_cv_func_getloadavg = yes; then + AC_DEFINE(HAVE_GETLOADAVG) + ac_have_func=yes +else + # Figure out what our getloadavg.c needs. + ac_have_func=no + AC_CHECK_HEADER(sys/dg_sys_info.h, + [ac_have_func=yes; AC_DEFINE(DGUX) + AC_CHECK_LIB(dgc, dg_sys_info)]) + + # We cannot check for <dwarf.h>, because Solaris 2 does not use dwarf (it + # uses stabs), but it is still SVR4. We cannot check for <elf.h> because + # Irix 4.0.5F has the header but not the library. + if test $ac_have_func = no && test $ac_cv_lib_elf_elf_begin = yes; then + ac_have_func=yes; AC_DEFINE(SVR4) + fi + + if test $ac_have_func = no; then + AC_CHECK_HEADER(inq_stats/cpustats.h, + [ac_have_func=yes; AC_DEFINE(UMAX) + AC_DEFINE(UMAX4_3)]) + fi + + if test $ac_have_func = no; then + AC_CHECK_HEADER(sys/cpustats.h, + [ac_have_func=yes; AC_DEFINE(UMAX)]) + fi + + if test $ac_have_func = no; then + AC_CHECK_HEADERS(mach/mach.h) + fi + + AC_CHECK_HEADER(nlist.h, + [AC_DEFINE(NLIST_STRUCT) + AC_CACHE_CHECK([for n_un in struct nlist], ac_cv_struct_nlist_n_un, + [AC_TRY_COMPILE([#include <nlist.h>], + [struct nlist n; n.n_un.n_name = 0;], + ac_cv_struct_nlist_n_un=yes, ac_cv_struct_nlist_n_un=no)]) + if test $ac_cv_struct_nlist_n_un = yes; then + AC_DEFINE(NLIST_NAME_UNION) + fi + ])dnl +fi # Do not have getloadavg in system libraries. + +# Some definitions of getloadavg require that the program be installed setgid. +dnl FIXME Don't hardwire the path of getloadavg.c in the top-level directory. +AC_CACHE_CHECK(whether getloadavg requires setgid, + ac_cv_func_getloadavg_setgid, +[AC_EGREP_CPP([Yowza Am I SETGID yet], +[#include "$srcdir/getloadavg.c" +#ifdef LDAV_PRIVILEGED +Yowza Am I SETGID yet +#endif], + ac_cv_func_getloadavg_setgid=yes, ac_cv_func_getloadavg_setgid=no)]) +if test $ac_cv_func_getloadavg_setgid = yes; then + NEED_SETGID=true; AC_DEFINE(GETLOADAVG_PRIVILEGED) +else + NEED_SETGID=false +fi +AC_SUBST(NEED_SETGID)dnl + +if test $ac_cv_func_getloadavg_setgid = yes; then + AC_CACHE_CHECK(group of /dev/kmem, ac_cv_group_kmem, +[changequote(, )dnl + # On Solaris, /dev/kmem is a symlink. Get info on the real file. + ac_ls_output=`ls -lgL /dev/kmem 2>/dev/null` + # If we got an error (system does not support symlinks), try without -L. + test -z "$ac_ls_output" && ac_ls_output=`ls -lg /dev/kmem` + ac_cv_group_kmem=`echo $ac_ls_output \ + | sed -ne 's/[ ][ ]*/ /g; + s/^.[sSrwx-]* *[0-9]* *\([^0-9]*\) *.*/\1/; + / /s/.* //;p;'` +changequote([, ])dnl +]) + KMEM_GROUP=$ac_cv_group_kmem +fi +AC_SUBST(KMEM_GROUP)dnl +]) + +AC_DEFUN(AC_FUNC_UTIME_NULL, +[AC_CACHE_CHECK(whether utime accepts a null argument, ac_cv_func_utime_null, +[rm -f conftestdata; > conftestdata +# Sequent interprets utime(file, 0) to mean use start of epoch. Wrong. +AC_TRY_RUN([#include <sys/types.h> +#include <sys/stat.h> +main() { +struct stat s, t; +exit(!(stat ("conftestdata", &s) == 0 && utime("conftestdata", (long *)0) == 0 +&& stat("conftestdata", &t) == 0 && t.st_mtime >= s.st_mtime +&& t.st_mtime - s.st_mtime < 120)); +}], ac_cv_func_utime_null=yes, ac_cv_func_utime_null=no, + ac_cv_func_utime_null=no) +rm -f core core.* *.core]) +if test $ac_cv_func_utime_null = yes; then + AC_DEFINE(HAVE_UTIME_NULL) +fi +]) + +AC_DEFUN(AC_FUNC_STRCOLL, +[AC_CACHE_CHECK(for working strcoll, ac_cv_func_strcoll_works, +[AC_TRY_RUN([#include <string.h> +main () +{ + exit (strcoll ("abc", "def") >= 0 || + strcoll ("ABC", "DEF") >= 0 || + strcoll ("123", "456") >= 0); +}], ac_cv_func_strcoll_works=yes, ac_cv_func_strcoll_works=no, +ac_cv_func_strcoll_works=no)]) +if test $ac_cv_func_strcoll_works = yes; then + AC_DEFINE(HAVE_STRCOLL) +fi +]) + +AC_DEFUN(AC_FUNC_SETVBUF_REVERSED, +[AC_CACHE_CHECK(whether setvbuf arguments are reversed, + ac_cv_func_setvbuf_reversed, +[AC_TRY_RUN([#include <stdio.h> +/* If setvbuf has the reversed format, exit 0. */ +main () { + /* This call has the arguments reversed. + A reversed system may check and see that the address of main + is not _IOLBF, _IONBF, or _IOFBF, and return nonzero. */ + if (setvbuf(stdout, _IOLBF, (char *) main, BUFSIZ) != 0) + exit(1); + putc('\r', stdout); + exit(0); /* Non-reversed systems segv here. */ +}], ac_cv_func_setvbuf_reversed=yes, ac_cv_func_setvbuf_reversed=no) +rm -f core core.* *.core]) +if test $ac_cv_func_setvbuf_reversed = yes; then + AC_DEFINE(SETVBUF_REVERSED) +fi +]) + +AC_DEFUN(AC_FUNC_GETMNTENT, +[# getmntent is in -lsun on Irix 4, -lseq on Dynix/PTX, -lgen on Unixware. +AC_CHECK_LIB(sun, getmntent, LIBS="-lsun $LIBS", + [AC_CHECK_LIB(seq, getmntent, LIBS="-lseq $LIBS", + [AC_CHECK_LIB(gen, getmntent, LIBS="-lgen $LIBS")])]) +AC_CHECK_FUNC(getmntent, [AC_DEFINE(HAVE_GETMNTENT)])]) + +AC_DEFUN(AC_FUNC_STRFTIME, +[AC_CHECK_FUNC(strftime, [AC_DEFINE(HAVE_STRFTIME)], +[# strftime is in -lintl on SCO UNIX. +AC_CHECK_LIB(intl, strftime, +[AC_DEFINE(HAVE_STRFTIME) +LIBS="-lintl $LIBS"])])]) + +AC_DEFUN(AC_FUNC_MEMCMP, +[AC_CACHE_CHECK(for 8-bit clean memcmp, ac_cv_func_memcmp_clean, +[AC_TRY_RUN([ +main() +{ + char c0 = 0x40, c1 = 0x80, c2 = 0x81; + exit(memcmp(&c0, &c2, 1) < 0 && memcmp(&c1, &c2, 1) < 0 ? 0 : 1); +} +], ac_cv_func_memcmp_clean=yes, ac_cv_func_memcmp_clean=no, +ac_cv_func_memcmp_clean=no)]) +test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}" +AC_SUBST(LIBOBJS)dnl +]) + +AC_DEFUN(AC_FUNC_SELECT_ARGTYPES, +[AC_MSG_CHECKING([types of arguments for select()]) + AC_CACHE_VAL(ac_cv_func_select_arg234,dnl + [AC_CACHE_VAL(ac_cv_func_select_arg1,dnl + [AC_CACHE_VAL(ac_cv_func_select_arg5,dnl + [for ac_cv_func_select_arg234 in 'fd_set *' 'int *' 'void *'; do + for ac_cv_func_select_arg1 in 'int' 'size_t' 'unsigned long' 'unsigned'; do + for ac_cv_func_select_arg5 in 'struct timeval *' 'const struct timeval *'; do + AC_TRY_COMPILE(dnl +[#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_SYS_TIME_H +#include <sys/time.h> +#endif +#ifdef HAVE_SYS_SELECT_H +#include <sys/select.h> +#endif +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +extern select ($ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5);],,dnl + [ac_not_found=no ; break 3],ac_not_found=yes) + done + done + done + ])dnl AC_CACHE_VAL + ])dnl AC_CACHE_VAL + ])dnl AC_CACHE_VAL + if test "$ac_not_found" = yes; then + ac_cv_func_select_arg1=int + ac_cv_func_select_arg234='int *' + ac_cv_func_select_arg5='struct timeval *' + fi + AC_MSG_RESULT([$ac_cv_func_select_arg1,$ac_cv_func_select_arg234,$ac_cv_func_select_arg5]) + AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG1,$ac_cv_func_select_arg1) + AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG234,($ac_cv_func_select_arg234)) + AC_DEFINE_UNQUOTED(SELECT_TYPE_ARG5,($ac_cv_func_select_arg5)) +]) + + +dnl ### Checks for structure members + + +AC_DEFUN(AC_HEADER_TIME, +[AC_CACHE_CHECK([whether time.h and sys/time.h may both be included], + ac_cv_header_time, +[AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/time.h> +#include <time.h>], +[struct tm *tp;], ac_cv_header_time=yes, ac_cv_header_time=no)]) +if test $ac_cv_header_time = yes; then + AC_DEFINE(TIME_WITH_SYS_TIME) +fi +]) + +AC_DEFUN(AC_STRUCT_TM, +[AC_CACHE_CHECK([whether struct tm is in sys/time.h or time.h], + ac_cv_struct_tm, +[AC_TRY_COMPILE([#include <sys/types.h> +#include <time.h>], +[struct tm *tp; tp->tm_sec;], + ac_cv_struct_tm=time.h, ac_cv_struct_tm=sys/time.h)]) +if test $ac_cv_struct_tm = sys/time.h; then + AC_DEFINE(TM_IN_SYS_TIME) +fi +]) + +AC_DEFUN(AC_STRUCT_TIMEZONE, +[AC_REQUIRE([AC_STRUCT_TM])dnl +AC_CACHE_CHECK([for tm_zone in struct tm], ac_cv_struct_tm_zone, +[AC_TRY_COMPILE([#include <sys/types.h> +#include <$ac_cv_struct_tm>], [struct tm tm; tm.tm_zone;], + ac_cv_struct_tm_zone=yes, ac_cv_struct_tm_zone=no)]) +if test "$ac_cv_struct_tm_zone" = yes; then + AC_DEFINE(HAVE_TM_ZONE) +else + AC_CACHE_CHECK(for tzname, ac_cv_var_tzname, +[AC_TRY_LINK( +changequote(<<, >>)dnl +<<#include <time.h> +#ifndef tzname /* For SGI. */ +extern char *tzname[]; /* RS6000 and others reject char **tzname. */ +#endif>>, +changequote([, ])dnl +[atoi(*tzname);], ac_cv_var_tzname=yes, ac_cv_var_tzname=no)]) + if test $ac_cv_var_tzname = yes; then + AC_DEFINE(HAVE_TZNAME) + fi +fi +]) + +AC_DEFUN(AC_STRUCT_ST_BLOCKS, +[AC_CACHE_CHECK([for st_blocks in struct stat], ac_cv_struct_st_blocks, +[AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/stat.h>], [struct stat s; s.st_blocks;], +ac_cv_struct_st_blocks=yes, ac_cv_struct_st_blocks=no)]) +if test $ac_cv_struct_st_blocks = yes; then + AC_DEFINE(HAVE_ST_BLOCKS) +else + LIBOBJS="$LIBOBJS fileblocks.${ac_objext}" +fi +AC_SUBST(LIBOBJS)dnl +]) + +AC_DEFUN(AC_STRUCT_ST_BLKSIZE, +[AC_CACHE_CHECK([for st_blksize in struct stat], ac_cv_struct_st_blksize, +[AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/stat.h>], [struct stat s; s.st_blksize;], +ac_cv_struct_st_blksize=yes, ac_cv_struct_st_blksize=no)]) +if test $ac_cv_struct_st_blksize = yes; then + AC_DEFINE(HAVE_ST_BLKSIZE) +fi +]) + +AC_DEFUN(AC_STRUCT_ST_RDEV, +[AC_CACHE_CHECK([for st_rdev in struct stat], ac_cv_struct_st_rdev, +[AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/stat.h>], [struct stat s; s.st_rdev;], +ac_cv_struct_st_rdev=yes, ac_cv_struct_st_rdev=no)]) +if test $ac_cv_struct_st_rdev = yes; then + AC_DEFINE(HAVE_ST_RDEV) +fi +]) + + +dnl ### Checks for compiler characteristics + + +AC_DEFUN(AC_C_CROSS, +[AC_OBSOLETE([$0], [; it has been merged into AC_PROG_CC])]) + +AC_DEFUN(AC_C_CHAR_UNSIGNED, +[AC_CACHE_CHECK(whether char is unsigned, ac_cv_c_char_unsigned, +[if test "$GCC" = yes; then + # GCC predefines this symbol on systems where it applies. +AC_EGREP_CPP(yes, +[#ifdef __CHAR_UNSIGNED__ + yes +#endif +], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no) +else +AC_TRY_RUN( +[/* volatile prevents gcc2 from optimizing the test away on sparcs. */ +#if !defined(__STDC__) || __STDC__ != 1 +#define volatile +#endif +main() { + volatile char c = 255; exit(c < 0); +}], ac_cv_c_char_unsigned=yes, ac_cv_c_char_unsigned=no) +fi]) +if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then + AC_DEFINE(__CHAR_UNSIGNED__) +fi +]) + +AC_DEFUN(AC_C_LONG_DOUBLE, +[AC_CACHE_CHECK(for long double, ac_cv_c_long_double, +[if test "$GCC" = yes; then + ac_cv_c_long_double=yes +else +AC_TRY_RUN([int main() { +/* The Stardent Vistra knows sizeof(long double), but does not support it. */ +long double foo = 0.0; +/* On Ultrix 4.3 cc, long double is 4 and double is 8. */ +exit(sizeof(long double) < sizeof(double)); }], +ac_cv_c_long_double=yes, ac_cv_c_long_double=no) +fi]) +if test $ac_cv_c_long_double = yes; then + AC_DEFINE(HAVE_LONG_DOUBLE) +fi +]) + +AC_DEFUN(AC_INT_16_BITS, +[AC_OBSOLETE([$0], [; instead use AC_CHECK_SIZEOF(int)])dnl +AC_MSG_CHECKING(whether int is 16 bits) +AC_TRY_RUN([main() { exit(sizeof(int) != 2); }], + [AC_MSG_RESULT(yes) + AC_DEFINE(INT_16_BITS)], AC_MSG_RESULT(no)) +]) + +AC_DEFUN(AC_LONG_64_BITS, +[AC_OBSOLETE([$0], [; instead use AC_CHECK_SIZEOF(long)])dnl +AC_MSG_CHECKING(whether long int is 64 bits) +AC_TRY_RUN([main() { exit(sizeof(long int) != 8); }], + [AC_MSG_RESULT(yes) + AC_DEFINE(LONG_64_BITS)], AC_MSG_RESULT(no)) +]) + +AC_DEFUN(AC_C_BIGENDIAN, +[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian, +[ac_cv_c_bigendian=unknown +# See if sys/param.h defines the BYTE_ORDER macro. +AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/param.h>], [ +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif], [# It does; now see whether it defined to BIG_ENDIAN or not. +AC_TRY_COMPILE([#include <sys/types.h> +#include <sys/param.h>], [ +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)]) +if test $ac_cv_c_bigendian = unknown; then +AC_TRY_RUN([main () { + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes) +fi]) +if test $ac_cv_c_bigendian = yes; then + AC_DEFINE(WORDS_BIGENDIAN) +fi +]) + +dnl Do nothing if the compiler accepts the inline keyword. +dnl Otherwise define inline to __inline__ or __inline if one of those work, +dnl otherwise define inline to be empty. +AC_DEFUN(AC_C_INLINE, +[AC_CACHE_CHECK([for inline], ac_cv_c_inline, +[ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + AC_TRY_COMPILE(, [} $ac_kw foo() {], [ac_cv_c_inline=$ac_kw; break]) +done +]) +case "$ac_cv_c_inline" in + inline | yes) ;; + no) AC_DEFINE(inline, ) ;; + *) AC_DEFINE_UNQUOTED(inline, $ac_cv_c_inline) ;; +esac +]) + +AC_DEFUN(AC_C_CONST, +[dnl This message is consistent in form with the other checking messages, +dnl and with the result message. +AC_CACHE_CHECK([for working const], ac_cv_c_const, +[AC_TRY_COMPILE(, +changequote(<<, >>)dnl +<< +/* Ultrix mips cc rejects this. */ +typedef int charset[2]; const charset x; +/* SunOS 4.1.1 cc rejects this. */ +char const *const *ccp; +char **p; +/* NEC SVR4.0.2 mips cc rejects this. */ +struct point {int x, y;}; +static struct point const zero = {0,0}; +/* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in an arm + of an if-expression whose if-part is not a constant expression */ +const char *g = "string"; +ccp = &g + (g ? g-g : 0); +/* HPUX 7.0 cc rejects these. */ +++ccp; +p = (char**) ccp; +ccp = (char const *const *) p; +{ /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; +} +{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; +} +{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; +} +{ /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} +>>, +changequote([, ])dnl +ac_cv_c_const=yes, ac_cv_c_const=no)]) +if test $ac_cv_c_const = no; then + AC_DEFINE(const, ) +fi +]) + +AC_DEFUN(AC_C_STRINGIZE, [ +AC_REQUIRE([AC_PROG_CPP]) +AC_MSG_CHECKING([for preprocessor stringizing operator]) +AC_CACHE_VAL(ac_cv_c_stringize, +AC_EGREP_CPP([#teststring],[ +#define x(y) #y + +char *s = x(teststring); +], ac_cv_c_stringize=no, ac_cv_c_stringize=yes)) +if test "${ac_cv_c_stringize}" = yes +then + AC_DEFINE(HAVE_STRINGIZE) +fi +AC_MSG_RESULT([${ac_cv_c_stringize}]) +])dnl + +define(AC_ARG_ARRAY, +[errprint(__file__:__line__: [$0] has been removed; don't do unportable things with arguments +)m4exit(4)]) + +dnl Check the object extension used by the compiler: typically .o or +dnl .obj. If this is called, some other behaviour will change, +dnl determined by ac_objext. +AC_DEFUN(AC_OBJEXT, +[AC_MSG_CHECKING([for object suffix]) +AC_CACHE_VAL(ac_cv_objext, +[rm -f conftest* +echo 'int i = 1;' > conftest.$ac_ext +if AC_TRY_EVAL(ac_compile); then + for ac_file in conftest.*; do + case $ac_file in + *.c) ;; + *) ac_cv_objext=`echo $ac_file | sed -e s/conftest.//` ;; + esac + done +else + AC_MSG_ERROR([installation or configuration problem; compiler does not work]) +fi +rm -f conftest*]) +AC_MSG_RESULT($ac_cv_objext) +OBJEXT=$ac_cv_objext +ac_objext=$ac_cv_objext +AC_SUBST(OBJEXT)]) + +dnl Determine the linker flags (e.g. `-L' and `-l') for the Fortran 77 +dnl intrinsic and run-time libraries that are required to successfully +dnl link a Fortran 77 program or shared library. The output variable +dnl FLIBS is set to these flags. +dnl +dnl This macro is intended to be used in those situations when it is +dnl necessary to mix, e.g. C++ and Fortran 77, source code into a single +dnl program or shared library. +dnl +dnl For example, if object files from a C++ and Fortran 77 compiler must +dnl be linked together, then the C++ compiler/linker must be used for +dnl linking (since special C++-ish things need to happen at link time +dnl like calling global constructors, instantiating templates, enabling +dnl exception support, etc.). +dnl +dnl However, the Fortran 77 intrinsic and run-time libraries must be +dnl linked in as well, but the C++ compiler/linker doesn't know how to +dnl add these Fortran 77 libraries. Hence, the macro +dnl `AC_F77_LIBRARY_LDFLAGS' was created to determine these Fortran 77 +dnl libraries. +dnl +dnl This macro was packaged in its current form by Matthew D. Langston +dnl <langston@SLAC.Stanford.EDU>. However, nearly all of this macro +dnl came from the `OCTAVE_FLIBS' macro in `octave-2.0.13/aclocal.m4', +dnl and full credit should go to John W. Eaton for writing this +dnl extremely useful macro. Thank you John. +dnl +dnl AC_F77_LIBRARY_LDFLAGS() +AC_DEFUN(AC_F77_LIBRARY_LDFLAGS, +[AC_MSG_CHECKING([for Fortran 77 libraries]) +AC_REQUIRE([AC_PROG_F77]) +AC_REQUIRE([AC_CANONICAL_HOST]) +AC_CACHE_VAL(ac_cv_flibs, +[changequote(, )dnl +dnl Write a minimal program and compile it with -v. I don't know what +dnl to do if your compiler doesn't have -v... +echo " END" > conftest.f +foutput=`${F77} -v -o conftest conftest.f 2>&1` +dnl +dnl The easiest thing to do for xlf output is to replace all the commas +dnl with spaces. Try to only do that if the output is really from xlf, +dnl since doing that causes problems on other systems. +dnl +xlf_p=`echo $foutput | grep xlfentry` +if test -n "$xlf_p"; then + foutput=`echo $foutput | sed 's/,/ /g'` +fi +dnl +ld_run_path=`echo $foutput | \ + sed -n -e 's/^.*LD_RUN_PATH *= *\([^ ]*\).*/\1/p'` +dnl +dnl We are only supposed to find this on Solaris systems... +dnl Uh, the run path should be absolute, shouldn't it? +dnl +case "$ld_run_path" in + /*) + if test "$ac_cv_prog_gcc" = yes; then + ld_run_path="-Xlinker -R -Xlinker $ld_run_path" + else + ld_run_path="-R $ld_run_path" + fi + ;; + *) + ld_run_path= + ;; +esac +dnl +flibs= +lflags= +dnl +dnl If want_arg is set, we know we want the arg to be added to the list, +dnl so we don't have to examine it. +dnl +want_arg= +dnl +for arg in $foutput; do + old_want_arg=$want_arg + want_arg= +dnl +dnl None of the options that take arguments expect the argument to +dnl start with a -, so pretend we didn't see anything special. +dnl + if test -n "$old_want_arg"; then + case "$arg" in + -*) + old_want_arg= + ;; + esac + fi + case "$old_want_arg" in + '') + case $arg in + /*.a) + exists=false + for f in $lflags; do + if test x$arg = x$f; then + exists=true + fi + done + if $exists; then + arg= + else + lflags="$lflags $arg" + fi + ;; + -bI:*) + exists=false + for f in $lflags; do + if test x$arg = x$f; then + exists=true + fi + done + if $exists; then + arg= + else + if test "$ac_cv_prog_gcc" = yes; then + lflags="$lflags -Xlinker $arg" + else + lflags="$lflags $arg" + fi + fi + ;; + -lang* | -lcrt0.o | -lc | -lgcc) + arg= + ;; + -[lLR]) + want_arg=$arg + arg= + ;; + -[lLR]*) + exists=false + for f in $lflags; do + if test x$arg = x$f; then + exists=true + fi + done + if $exists; then + arg= + else + case "$arg" in + -lkernel32) + case "$canonical_host_type" in + *-*-cygwin*) + arg= + ;; + *) + lflags="$lflags $arg" + ;; + esac + ;; + -lm) + ;; + *) + lflags="$lflags $arg" + ;; + esac + fi + ;; + -u) + want_arg=$arg + arg= + ;; + -Y) + want_arg=$arg + arg= + ;; + *) + arg= + ;; + esac + ;; + -[lLR]) + arg="$old_want_arg $arg" + ;; + -u) + arg="-u $arg" + ;; + -Y) +dnl +dnl Should probably try to ensure unique directory options here too. +dnl This probably only applies to Solaris systems, and then will only +dnl work with gcc... +dnl + arg=`echo $arg | sed -e 's%^P,%%'` + SAVE_IFS=$IFS + IFS=: + list= + for elt in $arg; do + list="$list -L$elt" + done + IFS=$SAVE_IFS + arg="$list" + ;; + esac +dnl + if test -n "$arg"; then + flibs="$flibs $arg" + fi +done +if test -n "$ld_run_path"; then + flibs_result="$ld_run_path $flibs" +else + flibs_result="$flibs" +fi +changequote([, ])dnl +ac_cv_flibs="$flibs_result"]) +FLIBS="$ac_cv_flibs" +AC_SUBST(FLIBS)dnl +AC_MSG_RESULT($FLIBS) +]) + + +dnl ### Checks for operating system services + + +AC_DEFUN(AC_SYS_INTERPRETER, +[# Pull the hash mark out of the macro call to avoid m4 problems. +ac_msg="whether #! works in shell scripts" +AC_CACHE_CHECK($ac_msg, ac_cv_sys_interpreter, +[echo '#! /bin/cat +exit 69 +' > conftest +chmod u+x conftest +(SHELL=/bin/sh; export SHELL; ./conftest >/dev/null) +if test $? -ne 69; then + ac_cv_sys_interpreter=yes +else + ac_cv_sys_interpreter=no +fi +rm -f conftest]) +interpval="$ac_cv_sys_interpreter" +]) + +define(AC_HAVE_POUNDBANG, +[errprint(__file__:__line__: [$0 has been replaced by AC_SYS_INTERPRETER, taking no arguments +])m4exit(4)]) + +AC_DEFUN(AC_SYS_LONG_FILE_NAMES, +[AC_CACHE_CHECK(for long file names, ac_cv_sys_long_file_names, +[ac_cv_sys_long_file_names=yes +# Test for long file names in all the places we know might matter: +# . the current directory, where building will happen +# $prefix/lib where we will be installing things +# $exec_prefix/lib likewise +# eval it to expand exec_prefix. +# $TMPDIR if set, where it might want to write temporary files +# if $TMPDIR is not set: +# /tmp where it might want to write temporary files +# /var/tmp likewise +# /usr/tmp likewise +if test -n "$TMPDIR" && test -d "$TMPDIR" && test -w "$TMPDIR"; then + ac_tmpdirs="$TMPDIR" +else + ac_tmpdirs='/tmp /var/tmp /usr/tmp' +fi +for ac_dir in . $ac_tmpdirs `eval echo $prefix/lib $exec_prefix/lib` ; do + test -d $ac_dir || continue + test -w $ac_dir || continue # It is less confusing to not echo anything here. + (echo 1 > $ac_dir/conftest9012345) 2>/dev/null + (echo 2 > $ac_dir/conftest9012346) 2>/dev/null + val=`cat $ac_dir/conftest9012345 2>/dev/null` + if test ! -f $ac_dir/conftest9012345 || test "$val" != 1; then + ac_cv_sys_long_file_names=no + rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2>/dev/null + break + fi + rm -f $ac_dir/conftest9012345 $ac_dir/conftest9012346 2>/dev/null +done]) +if test $ac_cv_sys_long_file_names = yes; then + AC_DEFINE(HAVE_LONG_FILE_NAMES) +fi +]) + +AC_DEFUN(AC_SYS_RESTARTABLE_SYSCALLS, +[AC_CACHE_CHECK(for restartable system calls, ac_cv_sys_restartable_syscalls, +[AC_TRY_RUN( +[/* Exit 0 (true) if wait returns something other than -1, + i.e. the pid of the child, which means that wait was restarted + after getting the signal. */ +#include <sys/types.h> +#include <signal.h> +ucatch (isig) { } +main () { + int i = fork (), status; + if (i == 0) { sleep (3); kill (getppid (), SIGINT); sleep (3); exit (0); } + signal (SIGINT, ucatch); + status = wait(&i); + if (status == -1) wait(&i); + exit (status == -1); +} +], ac_cv_sys_restartable_syscalls=yes, ac_cv_sys_restartable_syscalls=no)]) +if test $ac_cv_sys_restartable_syscalls = yes; then + AC_DEFINE(HAVE_RESTARTABLE_SYSCALLS) +fi +]) + +AC_DEFUN(AC_PATH_X, +[AC_REQUIRE_CPP()dnl Set CPP; we run AC_PATH_X_DIRECT conditionally. +# If we find X, set shell vars x_includes and x_libraries to the +# paths, otherwise set no_x=yes. +# Uses ac_ vars as temps to allow command line to override cache and checks. +# --without-x overrides everything else, but does not touch the cache. +AC_MSG_CHECKING(for X) + +AC_ARG_WITH(x, [ --with-x use the X Window System]) +# $have_x is `yes', `no', `disabled', or empty when we do not yet know. +if test "x$with_x" = xno; then + # The user explicitly disabled X. + have_x=disabled +else + if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then + # Both variables are already set. + have_x=yes + else +AC_CACHE_VAL(ac_cv_have_x, +[# One or both of the vars are not set, and there is no cached value. +ac_x_includes=NO ac_x_libraries=NO +AC_PATH_X_XMKMF +AC_PATH_X_DIRECT +if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then + # Didn't find X anywhere. Cache the known absence of X. + ac_cv_have_x="have_x=no" +else + # Record where we found X for the cache. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries" +fi])dnl + fi + eval "$ac_cv_have_x" +fi # $with_x != no + +if test "$have_x" != yes; then + AC_MSG_RESULT($have_x) + no_x=yes +else + # If each of the values was on the command line, it overrides each guess. + test "x$x_includes" = xNONE && x_includes=$ac_x_includes + test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries + # Update the cache value to reflect the command line values. + ac_cv_have_x="have_x=yes \ + ac_x_includes=$x_includes ac_x_libraries=$x_libraries" + AC_MSG_RESULT([libraries $x_libraries, headers $x_includes]) +fi +]) + +dnl Internal subroutine of AC_PATH_X. +dnl Set ac_x_includes and/or ac_x_libraries. +AC_DEFUN(AC_PATH_X_XMKMF, +[rm -fr conftestdir +if mkdir conftestdir; then + cd conftestdir + # Make sure to not put "make" in the Imakefile rules, since we grep it out. + cat > Imakefile <<'EOF' +acfindx: + @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"' +EOF + if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then + # GNU make sometimes prints "make[1]: Entering...", which would confuse us. + eval `${MAKE-make} acfindx 2>/dev/null | grep -v make` + # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR. + for ac_extension in a so sl; do + if test ! -f $ac_im_usrlibdir/libX11.$ac_extension && + test -f $ac_im_libdir/libX11.$ac_extension; then + ac_im_usrlibdir=$ac_im_libdir; break + fi + done + # Screen out bogus values from the imake configuration. They are + # bogus both because they are the default anyway, and because + # using them would break gcc on systems where it needs fixed includes. + case "$ac_im_incroot" in + /usr/include) ;; + *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;; + esac + case "$ac_im_usrlibdir" in + /usr/lib | /lib) ;; + *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;; + esac + fi + cd .. + rm -fr conftestdir +fi +]) + +dnl Internal subroutine of AC_PATH_X. +dnl Set ac_x_includes and/or ac_x_libraries. +AC_DEFUN(AC_PATH_X_DIRECT, +[if test "$ac_x_includes" = NO; then + # Guess where to find include files, by looking for this one X11 .h file. + test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h + + # First, try using that file with no special directory specified. +AC_TRY_CPP([#include <$x_direct_test_include>], +[# We can compile using X headers with no special include directory. +ac_x_includes=], +[# Look for the header file in a standard set of common directories. +# Check X11 before X11Rn because it is often a symlink to the current release. + for ac_dir in \ + /usr/X11/include \ + /usr/X11R6/include \ + /usr/X11R5/include \ + /usr/X11R4/include \ + \ + /usr/include/X11 \ + /usr/include/X11R6 \ + /usr/include/X11R5 \ + /usr/include/X11R4 \ + \ + /usr/local/X11/include \ + /usr/local/X11R6/include \ + /usr/local/X11R5/include \ + /usr/local/X11R4/include \ + \ + /usr/local/include/X11 \ + /usr/local/include/X11R6 \ + /usr/local/include/X11R5 \ + /usr/local/include/X11R4 \ + \ + /usr/X386/include \ + /usr/x386/include \ + /usr/XFree86/include/X11 \ + \ + /usr/include \ + /usr/local/include \ + /usr/unsupported/include \ + /usr/athena/include \ + /usr/local/x11r5/include \ + /usr/lpp/Xamples/include \ + \ + /usr/openwin/include \ + /usr/openwin/share/include \ + ; \ + do + if test -r "$ac_dir/$x_direct_test_include"; then + ac_x_includes=$ac_dir + break + fi + done]) +fi # $ac_x_includes = NO + +if test "$ac_x_libraries" = NO; then + # Check for the libraries. + + test -z "$x_direct_test_library" && x_direct_test_library=Xt + test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc + + # See if we find them without any special options. + # Don't add to $LIBS permanently. + ac_save_LIBS="$LIBS" + LIBS="-l$x_direct_test_library $LIBS" +AC_TRY_LINK(, [${x_direct_test_function}()], +[LIBS="$ac_save_LIBS" +# We can link X programs with no special library path. +ac_x_libraries=], +[LIBS="$ac_save_LIBS" +# First see if replacing the include by lib works. +# Check X11 before X11Rn because it is often a symlink to the current release. +for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \ + /usr/X11/lib \ + /usr/X11R6/lib \ + /usr/X11R5/lib \ + /usr/X11R4/lib \ + \ + /usr/lib/X11 \ + /usr/lib/X11R6 \ + /usr/lib/X11R5 \ + /usr/lib/X11R4 \ + \ + /usr/local/X11/lib \ + /usr/local/X11R6/lib \ + /usr/local/X11R5/lib \ + /usr/local/X11R4/lib \ + \ + /usr/local/lib/X11 \ + /usr/local/lib/X11R6 \ + /usr/local/lib/X11R5 \ + /usr/local/lib/X11R4 \ + \ + /usr/X386/lib \ + /usr/x386/lib \ + /usr/XFree86/lib/X11 \ + \ + /usr/lib \ + /usr/local/lib \ + /usr/unsupported/lib \ + /usr/athena/lib \ + /usr/local/x11r5/lib \ + /usr/lpp/Xamples/lib \ + /lib/usr/lib/X11 \ + \ + /usr/openwin/lib \ + /usr/openwin/share/lib \ + ; \ +do +dnl Don't even attempt the hair of trying to link an X program! + for ac_extension in a so sl; do + if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then + ac_x_libraries=$ac_dir + break 2 + fi + done +done]) +fi # $ac_x_libraries = NO +]) + +dnl Find additional X libraries, magic flags, etc. +AC_DEFUN(AC_PATH_XTRA, +[AC_REQUIRE([AC_PATH_X])dnl +if test "$no_x" = yes; then + # Not all programs may use this symbol, but it does not hurt to define it. + AC_DEFINE(X_DISPLAY_MISSING) + X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS= +else + if test -n "$x_includes"; then + X_CFLAGS="$X_CFLAGS -I$x_includes" + fi + + # It would also be nice to do this for all -L options, not just this one. + if test -n "$x_libraries"; then + X_LIBS="$X_LIBS -L$x_libraries" +dnl FIXME banish uname from this macro! + # For Solaris; some versions of Sun CC require a space after -R and + # others require no space. Words are not sufficient . . . . + case "`(uname -sr) 2>/dev/null`" in + "SunOS 5"*) + AC_MSG_CHECKING(whether -R must be followed by a space) + ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" + AC_TRY_LINK(, , ac_R_nospace=yes, ac_R_nospace=no) + if test $ac_R_nospace = yes; then + AC_MSG_RESULT(no) + X_LIBS="$X_LIBS -R$x_libraries" + else + LIBS="$ac_xsave_LIBS -R $x_libraries" + AC_TRY_LINK(, , ac_R_space=yes, ac_R_space=no) + if test $ac_R_space = yes; then + AC_MSG_RESULT(yes) + X_LIBS="$X_LIBS -R $x_libraries" + else + AC_MSG_RESULT(neither works) + fi + fi + LIBS="$ac_xsave_LIBS" + esac + fi + + # Check for system-dependent libraries X programs must link with. + # Do this before checking for the system-independent R6 libraries + # (-lICE), since we may need -lsocket or whatever for X linking. + + if test "$ISC" = yes; then + X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet" + else + # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X + # libraries were built with DECnet support. And karl@cs.umb.edu says + # the Alpha needs dnet_stub (dnet does not exist). + AC_CHECK_LIB(dnet, dnet_ntoa, [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"]) + if test $ac_cv_lib_dnet_dnet_ntoa = no; then + AC_CHECK_LIB(dnet_stub, dnet_ntoa, + [X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"]) + fi + + # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT, + # to get the SysV transport functions. + # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4) + # needs -lnsl. + # The nsl library prevents programs from opening the X display + # on Irix 5.2, according to dickey@clark.net. + AC_CHECK_FUNC(gethostbyname) + if test $ac_cv_func_gethostbyname = no; then + AC_CHECK_LIB(nsl, gethostbyname, X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl") + fi + + # lieder@skyler.mavd.honeywell.com says without -lsocket, + # socket/setsockopt and other routines are undefined under SCO ODT + # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary + # on later versions), says simon@lia.di.epfl.ch: it contains + # gethostby* variants that don't use the nameserver (or something). + # -lsocket must be given before -lnsl if both are needed. + # We assume that if connect needs -lnsl, so does gethostbyname. + AC_CHECK_FUNC(connect) + if test $ac_cv_func_connect = no; then + AC_CHECK_LIB(socket, connect, X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS", , + $X_EXTRA_LIBS) + fi + + # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. + AC_CHECK_FUNC(remove) + if test $ac_cv_func_remove = no; then + AC_CHECK_LIB(posix, remove, X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix") + fi + + # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. + AC_CHECK_FUNC(shmat) + if test $ac_cv_func_shmat = no; then + AC_CHECK_LIB(ipc, shmat, X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc") + fi + fi + + # Check for libraries that X11R6 Xt/Xaw programs need. + ac_save_LDFLAGS="$LDFLAGS" + test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries" + # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to + # check for ICE first), but we must link in the order -lSM -lICE or + # we get undefined symbols. So assume we have SM if we have ICE. + # These have to be linked with before -lX11, unlike the other + # libraries we check for below, so use a different variable. + # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. + AC_CHECK_LIB(ICE, IceConnectionNumber, + [X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"], , $X_EXTRA_LIBS) + LDFLAGS="$ac_save_LDFLAGS" + +fi +AC_SUBST(X_CFLAGS)dnl +AC_SUBST(X_PRE_LIBS)dnl +AC_SUBST(X_LIBS)dnl +AC_SUBST(X_EXTRA_LIBS)dnl +]) + +dnl The old Cygwin32 macro is deprecated. +AC_DEFUN(AC_CYGWIN32, +[AC_OBSOLETE([$0], [; instead use AC_CYGWIN])dnl +AC_CYGWIN]) + +dnl Check for Cygwin. This is a way to set the right value for +dnl EXEEXT. +AC_DEFUN(AC_CYGWIN, +[AC_CACHE_CHECK(for Cygwin environment, ac_cv_cygwin, +[AC_TRY_COMPILE(,[ +#ifndef __CYGWIN__ +#define __CYGWIN__ __CYGWIN32__ +#endif +return __CYGWIN__;], +ac_cv_cygwin=yes, ac_cv_cygwin=no) +rm -f conftest*]) +CYGWIN= +test "$ac_cv_cygwin" = yes && CYGWIN=yes]) + +dnl Check for mingw32. This is another way to set the right value for +dnl EXEEXT. +AC_DEFUN(AC_MINGW32, +[AC_CACHE_CHECK(for mingw32 environment, ac_cv_mingw32, +[AC_TRY_COMPILE(,[return __MINGW32__;], +ac_cv_mingw32=yes, ac_cv_mingw32=no) +rm -f conftest*]) +MINGW32= +test "$ac_cv_mingw32" = yes && MINGW32=yes]) + +dnl Check for EMX/OS2. This is another way to set the right value for +dnl EXEEXT. +AC_DEFUN(AC_EMXOS2, +[AC_CACHE_CHECK(for EMX/OS2 environment, ac_cv_emxos2, +[AC_TRY_COMPILE(,[return __EMX__;], +ac_cv_emxos2=yes, ac_cv_emxos2=no) +rm -f conftest*]) +AC_CACHE_VAL(ac_cv_libpre, +if test "$ac_cv_emxos2" = yes ; then + ac_cv_libpre= +else + ac_cv_libpre=lib +fi +) +EMXOS2= +test "$ac_cv_emxos2" = yes && EMXOS2=yes]) + +dnl Check for the extension used for executables. This knows that we +dnl add .exe for Cygwin or mingw32. Otherwise, it compiles a test +dnl executable. If this is called, the executable extensions will be +dnl automatically used by link commands run by the configure script. +AC_DEFUN(AC_EXEEXT, +[AC_REQUIRE([AC_CYGWIN]) +AC_REQUIRE([AC_MINGW32]) +AC_REQUIRE([AC_EMXOS2]) +AC_MSG_CHECKING([for executable suffix]) +AC_CACHE_VAL(ac_cv_exeext, +[if test "$CYGWIN" = yes || test "$MINGW32" = yes || test "$EMXOS2" = yes; then + ac_cv_exeext=.exe +else + rm -f conftest* + echo 'int main () { return 0; }' > conftest.$ac_ext + ac_cv_exeext= + if AC_TRY_EVAL(ac_link); then + for file in conftest.*; do + case $file in + *.c | *.o | *.obj) ;; + *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + else + AC_MSG_ERROR([installation or configuration problem: compiler cannot create executables.]) + fi + rm -f conftest* + test x"${ac_cv_exeext}" = x && ac_cv_exeext=no +fi]) +EXEEXT="" +test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} +AC_MSG_RESULT(${ac_cv_exeext}) +dnl Setting ac_exeext will implicitly change the ac_link command. +ac_exeext=$EXEEXT +AC_SUBST(EXEEXT)]) + + +dnl ### Checks for UNIX variants +dnl These are kludges which should be replaced by a single POSIX check. +dnl They aren't cached, to discourage their use. + + +AC_DEFUN(AC_AIX, +[AC_BEFORE([$0], [AC_TRY_COMPILE])dnl +AC_BEFORE([$0], [AC_TRY_RUN])dnl +AC_MSG_CHECKING(for AIX) +AC_EGREP_CPP(yes, +[#ifdef _AIX + yes +#endif +], [AC_MSG_RESULT(yes); AC_DEFINE(_ALL_SOURCE)], AC_MSG_RESULT(no)) +]) + +AC_DEFUN(AC_MINIX, +[AC_BEFORE([$0], [AC_TRY_COMPILE])dnl +AC_BEFORE([$0], [AC_TRY_RUN])dnl +AC_CHECK_HEADER(minix/config.h, MINIX=yes, MINIX=) +if test "$MINIX" = yes; then + AC_DEFINE(_POSIX_SOURCE) + AC_DEFINE(_POSIX_1_SOURCE, 2) + AC_DEFINE(_MINIX) +fi +]) + +AC_DEFUN(AC_ISC_POSIX, +[AC_REQUIRE([AC_PROG_CC])dnl +AC_BEFORE([$0], [AC_TRY_COMPILE])dnl +AC_BEFORE([$0], [AC_TRY_RUN])dnl +AC_MSG_CHECKING(for POSIXized ISC) +if test -d /etc/conf/kconfig.d && + grep _POSIX_VERSION [/usr/include/sys/unistd.h] >/dev/null 2>&1 +then + AC_MSG_RESULT(yes) + ISC=yes # If later tests want to check for ISC. + AC_DEFINE(_POSIX_SOURCE) + if test "$GCC" = yes; then + CC="$CC -posix" + else + CC="$CC -Xp" + fi +else + AC_MSG_RESULT(no) + ISC= +fi +]) + +AC_DEFUN(AC_XENIX_DIR, +[AC_OBSOLETE([$0], [; instead use AC_HEADER_DIRENT])dnl +AC_REQUIRE([AC_DIR_HEADER])dnl +AC_MSG_CHECKING(for Xenix) +AC_EGREP_CPP(yes, +[#if defined(M_XENIX) && !defined(M_UNIX) + yes +#endif +], [AC_MSG_RESULT(yes); XENIX=yes], [AC_MSG_RESULT(no); XENIX=]) +if test "$XENIX" = yes; then + # Make sure -ldir precedes -lx. + test $ac_header_dirent = dirent.h && LIBS="-ldir $LIBS" + LIBS="$LIBS -lx" +fi +]) + +AC_DEFUN(AC_DYNIX_SEQ, +[AC_OBSOLETE([$0], [; instead use AC_FUNC_GETMNTENT])dnl +AC_CHECK_LIB(seq, getmntent, LIBS="-lseq $LIBS") +]) + +AC_DEFUN(AC_IRIX_SUN, +[AC_OBSOLETE([$0], [; instead use AC_FUNC_GETMNTENT or AC_CHECK_LIB(sun, getpwnam)])dnl +AC_CHECK_LIB(sun, getmntent, LIBS="-lsun $LIBS") +]) + +AC_DEFUN(AC_SCO_INTL, +[AC_OBSOLETE([$0], [; instead use AC_FUNC_STRFTIME])dnl +AC_CHECK_LIB(intl, strftime, LIBS="-lintl $LIBS") +]) diff --git a/scsilib/conf/autoconf.m4 b/scsilib/conf/autoconf.m4 new file mode 100644 index 0000000..dde59ab --- /dev/null +++ b/scsilib/conf/autoconf.m4 @@ -0,0 +1,28 @@ +dnl Driver that loads the Autoconf macro files. +dnl Requires GNU m4. +dnl This file is part of Autoconf. +dnl Copyright (C) 1994 Free Software Foundation, Inc. +dnl +dnl This program 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, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl Written by David MacKenzie. +dnl +include(acgeneral.m4)dnl +builtin(include, acspecific.m4)dnl +builtin(include, acoldnames.m4)dnl +dnl Do not sinclude acsite.m4 here, because it may not be installed +dnl yet when Autoconf is frozen. +dnl Do not sinclude ./aclocal.m4 here, to prevent it from being frozen. diff --git a/scsilib/conf/autoheader.m4 b/scsilib/conf/autoheader.m4 new file mode 100644 index 0000000..cb411b0 --- /dev/null +++ b/scsilib/conf/autoheader.m4 @@ -0,0 +1,110 @@ +dnl Driver and redefinitions of some Autoconf macros for autoheader. +dnl This file is part of Autoconf. +dnl Copyright (C) 1994, 1995 Free Software Foundation, Inc. +dnl +dnl This program 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, or (at your option) +dnl any later version. +dnl +dnl This program is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +dnl GNU General Public License for more details. +dnl +dnl You should have received a copy of the GNU General Public License +dnl along with this program; if not, write to the Free Software +dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +dnl 02111-1307, USA. +dnl +dnl Written by Roland McGrath. +dnl +include(acgeneral.m4)dnl +builtin(include, acspecific.m4)dnl +builtin(include, acoldnames.m4)dnl + +dnl These are alternate definitions of some macros, which produce +dnl strings in the output marked with "@@@" so we can easily extract +dnl the information we want. The `#' at the end of the first line of +dnl each definition seems to be necessary to prevent m4 from eating +dnl the newline, which makes the @@@ not always be at the beginning of +dnl a line. + +define([AC_CHECK_FUNCS], [# +@@@funcs="$funcs $1"@@@ +ifelse([$2], , , [ +# If it was found, we do: +$2 +# If it was not found, we do: +$3 +]) +]) + +define([AC_CHECK_HEADERS], [# +@@@headers="$headers $1"@@@ +ifelse([$2], , , [ +# If it was found, we do: +$2 +# If it was not found, we do: +$3 +]) +]) + +define([AC_CHECK_HEADERS_DIRENT], [# +@@@headers="$headers $1"@@@ +]) + +define([AC_CHECK_LIB], [# + ifelse([$3], , [ +@@@libs="$libs $1"@@@ +], [ +# If it was found, we do: +$3 +# If it was not found, we do: +$4 +]) +]) + +define([AC_HAVE_LIBRARY], [# +changequote(<<, >>)dnl +define(<<AC_LIB_NAME>>, dnl +patsubst(patsubst($1, <<lib\([^\.]*\)\.a>>, <<\1>>), <<-l>>, <<>>))dnl +changequote([, ])dnl + ifelse([$2], , [ +@@@libs="$libs AC_LIB_NAME"@@@ +], [ +# If it was found, we do: +$2 +# If it was not found, we do: +$3 +]) +]) + +define([AC_CHECK_SIZEOF], [# +@@@types="$types,$1"@@@ +]) + +define([AC_CONFIG_HEADER], [# +define([AC_CONFIG_H], patsubst($1, [ .*$], []))dnl +@@@config_h=AC_CONFIG_H@@@ +]) + +define([AC_DEFINE], [# +ifelse([$3],,[# +@@@syms="$syms $1"@@@ +], [# +@@@verbatim="$verbatim +/* $3 */ +#undef $1 +"@@@ +])]) + +define([AC_DEFINE_UNQUOTED], [# +ifelse([$3],,[# +@@@syms="$syms $1"@@@ +], [# +@@@verbatim="$verbatim +/* $3 */ +#undef $1 +"@@@ +])]) diff --git a/scsilib/conf/cc-config.sh b/scsilib/conf/cc-config.sh new file mode 100755 index 0000000..852de95 --- /dev/null +++ b/scsilib/conf/cc-config.sh @@ -0,0 +1,140 @@ +#!/bin/sh +# @(#)cc-config.sh 1.4 03/05/31 Copyright 2002 J. Schilling +########################################################################### +# Written 2002 by J. Schilling +########################################################################### +# Configuration script called to verify system default C-compiler. +# It tries to fall back to GCC if the system default could not be found. +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### + +# +# Usage: +# sh ./conf/cc-config.sh cc incs/Dcc.<platform> +# + +CC=$1 +echo "Trying to find $CC" + +# +# Check if we are on SunOS-5.x and /usr/ucb is in PATH before /opt/SUNWspro/bin +# /usr/ucb/cc will not work correctly to compile things on Solaris. +# +# This check will also catch the case where no Sun C-compiler is installed and +# calling cc results in the message: +# /usr/ucb/cc: language optional software package not installed +# +xos=`echo "$2" | grep sunos5 ` +if [ -n "$xos" ]; then + # + # On Solaris, the type builtin is working. + # + xcc=`type "$CC" | grep /usr/ucb/cc` + if [ -n "$xcc" ]; then + # + # We did find /usr/ucb/cc + # + echo + echo 'Warning:' "$xcc" + echo ' You should not have "/usr/ucb" in your PATH if you like to compile.' + echo ' If you did install a C-compiler in /opt/SUNWspro/bin, abort' + echo ' fix your PATH and start again.' + echo ' Otherwise GCC will be used.' + echo + sleep 60 + CC=do-no-use-ucb-cc + fi +fi + +# +# There are old shells that don't support the 'type' builtin. +# For this reason it is not a simple task to find out whether +# this compiler exists and works. +# +# First try to run the default C-compiler without args +# +$CC > /dev/null 2>&1 +if [ $? = 0 ]; then + echo "Found $CC" + echo "Creating empty '$2'" + :> $2 + exit +fi + +# +# Now try to run the default C-compiler and check whether it creates +# any output (usually an error message). +# +# This test will fail if the shell does redirect the error message +# "cc: not found". All shells I tested (except ksh) send this message to +# the stderr stream the shell itself is attached to and only redirects the +# output from the command. As there may no output if there is no binary, +# this prooves the existence of the default compiler. +# +ccout=`$CC 2>&1` +ret=$? + +nf=`echo "$ccout" | grep 'not found' ` +if [ $ret = 127 -a -n "$nf" ]; then + # + # ksh redirects even the error message from the shell, but we + # see that there is no executable because the exit code is 127 + # + ccout="" +fi + +if [ -n "$ccout" ]; then + echo "Found $CC" + echo "Creating empty '$2'" + :> $2 + exit +fi + +# +# If the current default is gcc, try cc. +# If the current default is cc, try gcc. +# +if [ ".$CC" = ".gcc" ]; then + XCC=cc + echo 'Trying to find cc' + ccout=`cc -c tt.$$.c 2>&1` + ret=$? + nf=`echo "$ccout" | grep 'not found' ` + if [ $ret = 127 -a -n "$nf" ]; then + # + # ksh redirects even the error message from the shell, but we + # see that there is no executable because the exit code is 127 + # + ccout="" + fi + if [ -n "$ccout" ]; then + CC=cc + fi +else + XCC=gcc + echo 'Trying to find GCC' + gcc -v 2> /dev/null && CC=gcc +fi + +if [ ".$CC" = ".$1" ]; then + echo "$XCC not found, keeping current global default" + echo "Creating empty '$2'" + :> $2 +else + echo "Found $CC" + echo "Making $CC the default compiler in '$2'" + echo DEFCCOM=$CC > $2 +fi diff --git a/scsilib/conf/config.guess b/scsilib/conf/config.guess new file mode 100755 index 0000000..6d26523 --- /dev/null +++ b/scsilib/conf/config.guess @@ -0,0 +1,975 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc. +# +# This file 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. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Written by Per Bothner <bothner@cygnus.com>. +# The master version of this file is at the FSF in /home/gd/gnu/lib. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# The plan is that this can be called by configure scripts if you +# don't specify an explicit system type (host/target name). +# +# Only a few systems have been added to this list; please add others +# (but try to keep the structure clean). +# + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 8/24/94.) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + alpha:OSF1:*:*) + if test $UNAME_RELEASE = "V4.0"; then + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + fi + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + cat <<EOF >dummy.s + .globl main + .ent main +main: + .frame \$30,0,\$26,0 + .prologue 0 + .long 0x47e03d80 # implver $0 + lda \$2,259 + .long 0x47e20c21 # amask $2,$1 + srl \$1,8,\$2 + sll \$2,2,\$2 + sll \$0,3,\$0 + addl \$1,\$0,\$0 + addl \$2,\$0,\$0 + ret \$31,(\$26),1 + .end main +EOF + ${CC-cc} dummy.s -o dummy 2>/dev/null + if test "$?" = 0 ; then + ./dummy + case "$?" in + 7) + UNAME_MACHINE="alpha" + ;; + 15) + UNAME_MACHINE="alphaev5" + ;; + 14) + UNAME_MACHINE="alphaev56" + ;; + 10) + UNAME_MACHINE="alphapca56" + ;; + 16) + UNAME_MACHINE="alphaev6" + ;; + esac + fi + rm -f dummy.s dummy + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr [[A-Z]] [[a-z]]` + exit 0 ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit 0 ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-cbm-sysv4 + exit 0;; + amiga:NetBSD:*:*) + echo m68k-cbm-netbsd${UNAME_RELEASE} + exit 0 ;; + amiga:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit 0 ;; + arc64:OpenBSD:*:*) + echo mips64el-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + hkmips:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + pmax:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sgi:OpenBSD:*:*) + echo mips-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + wgrisc:OpenBSD:*:*) + echo mipsel-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit 0;; + arm32:NetBSD:*:*) + echo arm-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + SR2?01:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit 0;; + Pyramid*:OSx*:*:*|MIS*:OSx*:*:*|MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit 0 ;; + NILE:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit 0 ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + i86pc:SunOS:5.*:*) + echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit 0 ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit 0 ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit 0 ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit 0 ;; + atari*:NetBSD:*:*) + echo m68k-atari-netbsd${UNAME_RELEASE} + exit 0 ;; + atari*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sun3*:NetBSD:*:*) + echo m68k-sun-netbsd${UNAME_RELEASE} + exit 0 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:NetBSD:*:*) + echo m68k-apple-netbsd${UNAME_RELEASE} + exit 0 ;; + mac68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme68k:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + mvme88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit 0 ;; + macppc:NetBSD:*:*) + echo powerpc-apple-netbsd${UNAME_RELEASE} + exit 0 ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit 0 ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit 0 ;; + 2020:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit 0 ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + sed 's/^ //' << EOF >dummy.c + int main (argc, argv) int argc; char **argv; { + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + ${CC-cc} dummy.c -o dummy \ + && ./dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ + && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo mips-mips-riscos${UNAME_RELEASE} + exit 0 ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit 0 ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit 0 ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit 0 ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit 0 ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 -o $UNAME_PROCESSOR = mc88110 ] ; then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ + -o ${TARGET_BINARY_INTERFACE}x = x ] ; then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else echo i586-dg-dgux${UNAME_RELEASE} + fi + exit 0 ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit 0 ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit 0 ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit 0 ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit 0 ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit 0 ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i?86:AIX:*:*) + echo i386-ibm-aix + exit 0 ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + sed 's/^ //' << EOF >dummy.c + #include <sys/systemcfg.h> + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo rs6000-ibm-aix3.2.5 + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit 0 ;; + *:AIX:*:4) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` + if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=4.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit 0 ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit 0 ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit 0 ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit 0 ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit 0 ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit 0 ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit 0 ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit 0 ;; + 9000/[34678]??:HP-UX:*:*) + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/6?? | 9000/7?? | 9000/80[24] | 9000/8?[13679] | 9000/892 | 9000/820 | 9000/800 ) + sed 's/^ //' << EOF >dummy.c + #include <stdlib.h> + #include <unistd.h> + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (${CC-cc} dummy.c -o dummy 2>/dev/null ) && HP_ARCH=`./dummy` + rm -f dummy.c dummy + esac + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit 0 ;; + 3050*:HI-UX:*:*) + sed 's/^ //' << EOF >dummy.c + #include <unistd.h> + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + echo unknown-hitachi-hiuxwe2 + exit 0 ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit 0 ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit 0 ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit 0 ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit 0 ;; + i?86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit 0 ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit 0 ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit 0 ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit 0 ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit 0 ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit 0 ;; + CRAY*X-MP:*:*:*) + echo xmp-cray-unicos + exit 0 ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ + exit 0 ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} + exit 0 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + exit 0 ;; + F300:UNIX_System_V:*:*) + FUJITSU_SYS=`uname -p | tr [A-Z] [a-z] | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; + F301:UNIX_System_V:*:*) + echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` + exit 0 ;; + hp3[0-9][05]:NetBSD:*:*) + echo m68k-hp-netbsd${UNAME_RELEASE} + exit 0 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit 0 ;; + i?86:BSD/386:*:* | *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit 0 ;; + *:FreeBSD:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:NetBSD:*:*) + echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + *:OpenBSD:*:*) + echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + exit 0 ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit 0 ;; + i*:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit 0 ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit 0 ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit 0 ;; + *:GNU:*:*) + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit 0 ;; + *:Linux:*:*) + # uname on the ARM produces all sorts of strangeness, and we need to + # filter it out. + case "$UNAME_MACHINE" in + arm* | sa110*) UNAME_MACHINE="arm" ;; + esac + + # The BFD linker knows what the default object file format is, so + # first see if it will tell us. + ld_help_string=`ld --help 2>&1` + ld_supported_emulations=`echo $ld_help_string \ + | sed -ne '/supported emulations:/!d + s/[ ][ ]*/ /g + s/.*supported emulations: *// + s/ .*// + p'` + case "$ld_supported_emulations" in + i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" ; exit 0 ;; + i?86coff) echo "${UNAME_MACHINE}-pc-linux-gnucoff" ; exit 0 ;; + sparclinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; + armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; + m68klinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" ; exit 0 ;; + elf32ppc) echo "powerpc-unknown-linux-gnu" ; exit 0 ;; + esac + + if test "${UNAME_MACHINE}" = "alpha" ; then + sed 's/^ //' <<EOF >dummy.s + .globl main + .ent main + main: + .frame \$30,0,\$26,0 + .prologue 0 + .long 0x47e03d80 # implver $0 + lda \$2,259 + .long 0x47e20c21 # amask $2,$1 + srl \$1,8,\$2 + sll \$2,2,\$2 + sll \$0,3,\$0 + addl \$1,\$0,\$0 + addl \$2,\$0,\$0 + ret \$31,(\$26),1 + .end main +EOF + LIBC="" + ${CC-cc} dummy.s -o dummy 2>/dev/null + if test "$?" = 0 ; then + ./dummy + case "$?" in + 7) + UNAME_MACHINE="alpha" + ;; + 15) + UNAME_MACHINE="alphaev5" + ;; + 14) + UNAME_MACHINE="alphaev56" + ;; + 10) + UNAME_MACHINE="alphapca56" + ;; + 16) + UNAME_MACHINE="alphaev6" + ;; + esac + + objdump --private-headers dummy | \ + grep ld.so.1 > /dev/null + if test "$?" = 0 ; then + LIBC="libc1" + fi + fi + rm -f dummy.s dummy + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 + elif test "${UNAME_MACHINE}" = "mips" ; then + cat >dummy.c <<EOF +main(argc, argv) + int argc; + char *argv[]; +{ +#ifdef __MIPSEB__ + printf ("%s-unknown-linux-gnu\n", argv[1]); +#endif +#ifdef __MIPSEL__ + printf ("%sel-unknown-linux-gnu\n", argv[1]); +#endif + return 0; +} +EOF + ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + else + # Either a pre-BFD a.out linker (linux-gnuoldld) + # or one that does not give us useful --help. + # GCC wants to distinguish between linux-gnuoldld and linux-gnuaout. + # If ld does not provide *any* "supported emulations:" + # that means it is gnuoldld. + echo "$ld_help_string" | grep >/dev/null 2>&1 "supported emulations:" + test $? != 0 && echo "${UNAME_MACHINE}-pc-linux-gnuoldld" && exit 0 + + case "${UNAME_MACHINE}" in + i?86) + VENDOR=pc; + ;; + *) + VENDOR=unknown; + ;; + esac + # Determine whether the default compiler is a.out or elf + cat >dummy.c <<EOF +#include <features.h> +main(argc, argv) + int argc; + char *argv[]; +{ +#ifdef __ELF__ +# ifdef __GLIBC__ +# if __GLIBC__ >= 2 + printf ("%s-${VENDOR}-linux-gnu\n", argv[1]); +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +# else + printf ("%s-${VENDOR}-linux-gnulibc1\n", argv[1]); +# endif +#else + printf ("%s-${VENDOR}-linux-gnuaout\n", argv[1]); +#endif + return 0; +} +EOF + ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 + rm -f dummy.c dummy + fi ;; +# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions +# are messed up and put the nodename in both sysname and nodename. + i?86:DYNIX/ptx:4*:*) + echo i386-sequent-sysv4 + exit 0 ;; + i?86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit 0 ;; + i?86:*:4.*:* | i?86:SYSTEM_V:4.*:*) + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i?86:MS-DOS:5:50) + # DJGPP v2 + echo ${UNAME_MACHINE}-pc-msdos + exit 0 ;; + i?86:*:5:*) + # Fixed at (any) Pentium or better + UNAME_MACHINE=i586 + if [ ${UNAME_SYSTEM} = "UnixWare" ] || + [ ${UNAME_SYSTEM} = "OpenUNIX" ]; then + echo ${UNAME_MACHINE}-sco-sysv${UNAME_RELEASE}uw${UNAME_VERSION} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_RELEASE} + fi + exit 0 ;; + i?86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` + echo ${UNAME_MACHINE}-pc-isc$UNAME_REL + elif /bin/uname -X 2>/dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` + (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit 0 ;; + pc:*:*:*) + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i386. + echo i386-pc-msdosdjgpp + exit 0 ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit 0 ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit 0 ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit 0 ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit 0 ;; + M68*:*:R3V[567]*:*) + test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; + 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && echo i486-ncr-sysv4 && exit 0 ;; + m68*:LynxOS:2.*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit 0 ;; + i?86:LynxOS:2.*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit 0 ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit 0 ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit 0 ;; + PENTIUM:CPunix:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says <Richard.M.Bartel@ccMail.Census.GOV> + echo i586-unisys-sysv4 + exit 0 ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes <hewes@openmarket.com>. + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit 0 ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit 0 ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit 0 ;; + news*:NEWS-OS:*:6*) + echo mips-sony-newsos6 + exit 0 ;; + R3000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R4000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit 0 ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit 0 ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit 0 ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit 0 ;; + "Power Macintosh":Rhapsody:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit 0 ;; + "Power Macintosh":"Mac OS":*) + echo powerpc-apple-macosx${UNAME_RELEASE} + exit 0 ;; + "Power Macintosh":"Darwin":*) + echo powerpc-apple-macosx${UNAME_RELEASE} + exit 0 ;; + *:OS/2:*:*) + echo "i386-pc-os2_emx" + exit 0;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +cat >dummy.c <<EOF +#ifdef _SEQUENT_ +# include <sys/types.h> +# include <sys/utsname.h> +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include <sys/param.h> + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +#if !defined (ultrix) + printf ("vax-dec-bsd\n"); exit (0); +#else + printf ("vax-dec-ultrix\n"); exit (0); +#endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 +rm -f dummy.c dummy + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit 0 ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit 0 ;; + c34*) + echo c34-convex-bsd + exit 0 ;; + c38*) + echo c38-convex-bsd + exit 0 ;; + c4*) + echo c4-convex-bsd + exit 0 ;; + esac +fi + +if [ x$CONFIG_NOFAIL = xTRUE ]; then + echo unknownCPU-unknownMFR-unknownOS + exit 0 +fi + +#echo '(Unable to guess system type)' 1>&2 + +exit 1 diff --git a/scsilib/conf/config.sub b/scsilib/conf/config.sub new file mode 100755 index 0000000..9beb74a --- /dev/null +++ b/scsilib/conf/config.sub @@ -0,0 +1,963 @@ +#! /bin/sh +# Configuration validation subroutine script, version 1.1. +# Copyright (C) 1991, 92-97, 1998 Free Software Foundation, Inc. +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file 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. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, +# Boston, MA 02111-1307, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +if [ x$1 = x ] +then + echo Configuration name missing. 1>&2 + echo "Usage: $0 CPU-MFR-OPSYS" 1>&2 + echo "or $0 ALIAS" 1>&2 + echo where ALIAS is a recognized configuration type. 1>&2 + exit 1 +fi + +# First pass through any local machine types. +case $1 in + *local*) + echo $1 + exit 0 + ;; + *) + ;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + linux-gnu*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple) + os= + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco5) + os=sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + tahoe | i860 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ + | arme[lb] | pyramid | mn10200 | mn10300 | tron | a29k \ + | 580 | i960 | h8300 | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0? \ + | alpha | alphaev5 | alphaev56 | we32k | ns16k | clipper \ + | i370 | sh | powerpc | powerpcle | 1750a | dsp16xx | pdp11 \ + | mips64 | mipsel | mips64el | mips64orion | mips64orionel \ + | mipstx39 | mipstx39el \ + | sparc | sparclet | sparclite | sparc64 | v850) + basic_machine=$basic_machine-unknown + ;; + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i[34567]86) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + vax-* | tahoe-* | i[34567]86-* | i860-* | m32r-* | m68k-* | m68000-* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ + | power-* | none-* | 580-* | cray2-* | h8300-* | i960-* \ + | xmp-* | ymp-* | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0?-* \ + | ia64-* \ + | alpha-* | alphaev5-* | alphaev56-* | alphaev6-* | we32k-* | cydra-* \ + | ns16k-* | pn-* | np1-* | xps100-* | clipper-* | orion-* \ + | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ + | sparc64-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* \ + | mipstx39-* | mipstx39el-* \ + | f301-*) + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-cbm + ;; + amigaos | amigados) + basic_machine=m68k-cbm + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-cbm + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | ymp) + basic_machine=ymp-cray + os=-unicos + ;; + cray2) + basic_machine=cray2-cray + os=-unicos + ;; + [ctj]90-cray) + basic_machine=c90-cray + os=-unicos + ;; + crds | unos) + basic_machine=m68k-crds + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k7[0-9][0-9] | hp7[0-9][0-9] | hp9k8[0-9]7 | hp8[0-9]7) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + os=-mvs + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i[34567]86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i[34567]86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i[34567]86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i[34567]86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + miniframe) + basic_machine=m68000-convergent + ;; + mipsel*-linux*) + basic_machine=mipsel-unknown + os=-linux-gnu + ;; + mips*-linux*) + basic_machine=mips-unknown + os=-linux-gnu + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + np1) + basic_machine=np1-gould + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc-unknown) + basic_machine=parisc-unknown + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pentium | p5 | k5 | nexen) + basic_machine=i586-pc + ;; + pentiumpro | p6 | k6 | 6x86) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | nexen-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | k6-* | 6x86-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=rs6000-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + mips) + if [ x$os = x-linux-gnu ]; then + basic_machine=mips-unknown + else + basic_machine=mips-mips + fi + ;; + romp) + basic_machine=romp-ibm + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sparc) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ + | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -os2* | -rhapsody* | -macos* ) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -ctix* | -uts*) + os=-sysv + ;; + -ns2 ) + os=-nextstep2 + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + # For sys5.3 apollo + -sys5.3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -xenix) + os=-xenix + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + *-acorn) + os=-riscix1.2 + ;; + arm*-semi) + os=-aout + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-ibm) + os=-aix + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f301-fujitsu) + os=-uxpv + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -aix*) + vendor=ibm + ;; + -hpux*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -vxsim* | -vxworks*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os diff --git a/scsilib/conf/configure b/scsilib/conf/configure new file mode 100755 index 0000000..46bcb7b --- /dev/null +++ b/scsilib/conf/configure @@ -0,0 +1,11210 @@ +#! /bin/sh + +# From configure.in Revision + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +#serial 18 + + + + + + + + + + + + + + + + + + + + + + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --disable-largefile omit support for large files" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +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=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -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 ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$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" ;; + + -cc=* | --cc=* ) + CC="$ac_optarg" ; echo using $CC as compiler ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + 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) + # 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 << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$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" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + 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) + 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" ;; + + -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 ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + 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 "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=xconfig.h.in + +# 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 its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + 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 + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + + +# Make sure we can run config.sub. +if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : +else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; } +fi + +echo $ac_n "checking host system type""... $ac_c" 1>&6 +echo "configure:726: checking host system type" >&5 + +host_alias=$host +case "$host_alias" in +NONE) + case $nonopt in + NONE) + if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then : + else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; } + fi ;; + *) host_alias=$nonopt ;; + esac ;; +esac + +host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias` +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` +echo "$ac_t""$host" 1>&6 + + +echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 +echo "configure:748: checking for Cygwin environment" >&5 +if eval "test \"`echo '$''{'ac_cv_cygwin'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 753 "configure" +#include "confdefs.h" + +int main() { + +#ifndef __CYGWIN__ +#define __CYGWIN__ __CYGWIN32__ +#endif +return __CYGWIN__; +; return 0; } +EOF +if { (eval echo configure:764: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_cygwin=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_cygwin=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_cygwin" 1>&6 +CYGWIN= +test "$ac_cv_cygwin" = yes && CYGWIN=yes +echo $ac_n "checking for mingw32 environment""... $ac_c" 1>&6 +echo "configure:781: checking for mingw32 environment" >&5 +if eval "test \"`echo '$''{'ac_cv_mingw32'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 786 "configure" +#include "confdefs.h" + +int main() { +return __MINGW32__; +; return 0; } +EOF +if { (eval echo configure:793: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_mingw32=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_mingw32=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_mingw32" 1>&6 +MINGW32= +test "$ac_cv_mingw32" = yes && MINGW32=yes +echo $ac_n "checking for EMX/OS2 environment""... $ac_c" 1>&6 +echo "configure:810: checking for EMX/OS2 environment" >&5 +if eval "test \"`echo '$''{'ac_cv_emxos2'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 815 "configure" +#include "confdefs.h" + +int main() { +return __EMX__; +; return 0; } +EOF +if { (eval echo configure:822: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_emxos2=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_emxos2=no +fi +rm -f conftest* +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_emxos2" 1>&6 +if eval "test \"`echo '$''{'ac_cv_libpre'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$ac_cv_emxos2" = yes ; then + ac_cv_libpre= +else + ac_cv_libpre=lib +fi + +fi + +EMXOS2= +test "$ac_cv_emxos2" = yes && EMXOS2=yes + + + +echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 +echo "configure:853: checking for executable suffix" >&5 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$CYGWIN" = yes || test "$MINGW32" = yes || test "$EMXOS2" = yes; then + ac_cv_exeext=.exe +else + rm -f conftest* + echo 'int main () { return 0; }' > conftest.$ac_ext + ac_cv_exeext= + if { (eval echo configure:863: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; }; then + for file in conftest.*; do + case $file in + *.c | *.o | *.obj) ;; + *) ac_cv_exeext=`echo $file | sed -e s/conftest//` ;; + esac + done + else + { echo "configure: error: installation or configuration problem: compiler cannot create executables." 1>&2; exit 1; } + fi + rm -f conftest* + test x"${ac_cv_exeext}" = x && ac_cv_exeext=no +fi +fi + +EXEEXT="" +test x"${ac_cv_exeext}" != xno && EXEEXT=${ac_cv_exeext} +echo "$ac_t""${ac_cv_exeext}" 1>&6 +ac_exeext=$EXEEXT + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +echo "configure:884: checking how to run the C preprocessor" >&5 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext <<EOF +#line 899 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:905: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext <<EOF +#line 916 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:922: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext <<EOF +#line 933 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:939: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi + CPP="$ac_cv_prog_CPP" +else + ac_cv_prog_CPP="$CPP" +fi +echo "$ac_t""$CPP" 1>&6 + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:966: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:994: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + + +echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 +echo "configure:1022: checking for ANSI C header files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1027 "configure" +#include "confdefs.h" +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1035: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + ac_cv_header_stdc=yes +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. +cat > conftest.$ac_ext <<EOF +#line 1052 "configure" +#include "confdefs.h" +#include <string.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "memchr" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. +cat > conftest.$ac_ext <<EOF +#line 1070 "configure" +#include "confdefs.h" +#include <stdlib.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "free" >/dev/null 2>&1; then + : +else + rm -rf conftest* + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. +if test "$cross_compiling" = yes; then + : +else + cat > conftest.$ac_ext <<EOF +#line 1091 "configure" +#include "confdefs.h" +#include <ctype.h> +#define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int main () { int i; for (i = 0; i < 256; i++) +if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); +exit (0); } + +EOF +if { (eval echo configure:1102: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_header_stdc=no +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_header_stdc" 1>&6 +if test $ac_cv_header_stdc = yes; then + cat >> confdefs.h <<\EOF +#define STDC_HEADERS 1 +EOF + +fi + +echo $ac_n "checking for UNIX-98 compliant inttypes.h""... $ac_c" 1>&6 +echo "configure:1126: checking for UNIX-98 compliant inttypes.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_inttypes'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1131 "configure" +#include "confdefs.h" +#include <inttypes.h> +int main() { +int8_t c; uint8_t uc; int16_t s; uint16_t us; int32_t i; uint32_t ui; +int64_t ll; uint64_t ull; +intptr_t ip; uintptr_t uip; +; return 0; } +EOF +if { (eval echo configure:1140: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_inttypes=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_inttypes=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_inttypes" 1>&6 +if test $ac_cv_header_inttypes = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_INTTYPES_H 1 +EOF + +fi +ac_header_dirent=no +for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6 +echo "configure:1164: checking for $ac_hdr that defines DIR" >&5 +if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1169 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <$ac_hdr> +int main() { +DIR *dirp = 0; +; return 0; } +EOF +if { (eval echo configure:1177: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_dirent_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_dirent_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + ac_header_dirent=$ac_hdr; break +else + echo "$ac_t""no" 1>&6 +fi +done +# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. +if test $ac_header_dirent = dirent.h; then +echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6 +echo "configure:1202: checking for opendir in -ldir" >&5 +ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-ldir $LIBS" +cat > conftest.$ac_ext <<EOF +#line 1210 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir(); + +int main() { +opendir() +; return 0; } +EOF +if { (eval echo configure:1221: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -ldir" +else + echo "$ac_t""no" 1>&6 +fi + +else +echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6 +echo "configure:1243: checking for opendir in -lx" >&5 +ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lx $LIBS" +cat > conftest.$ac_ext <<EOF +#line 1251 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char opendir(); + +int main() { +opendir() +; return 0; } +EOF +if { (eval echo configure:1262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + LIBS="$LIBS -lx" +else + echo "$ac_t""no" 1>&6 +fi + +fi + +echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6 +echo "configure:1285: checking whether stat file-mode macros are broken" >&5 +if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1290 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/stat.h> + +#if defined(S_ISBLK) && defined(S_IFDIR) +# if S_ISBLK (S_IFDIR) +You lose. +# endif +#endif + +#if defined(S_ISBLK) && defined(S_IFCHR) +# if S_ISBLK (S_IFCHR) +You lose. +# endif +#endif + +#if defined(S_ISLNK) && defined(S_IFREG) +# if S_ISLNK (S_IFREG) +You lose. +# endif +#endif + +#if defined(S_ISSOCK) && defined(S_IFREG) +# if S_ISSOCK (S_IFREG) +You lose. +# endif +#endif + +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "You lose" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_header_stat_broken=yes +else + rm -rf conftest* + ac_cv_header_stat_broken=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_header_stat_broken" 1>&6 +if test $ac_cv_header_stat_broken = yes; then + cat >> confdefs.h <<\EOF +#define STAT_MACROS_BROKEN 1 +EOF + +fi + +echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 +echo "configure:1341: checking whether time.h and sys/time.h may both be included" >&5 +if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1346 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/time.h> +#include <time.h> +int main() { +struct tm *tp; +; return 0; } +EOF +if { (eval echo configure:1355: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_time=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_time=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_time" 1>&6 +if test $ac_cv_header_time = yes; then + cat >> confdefs.h <<\EOF +#define TIME_WITH_SYS_TIME 1 +EOF + +fi + +echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 +echo "configure:1376: checking for sys/wait.h that is POSIX.1 compatible" >&5 +if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1381 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/wait.h> +#ifndef WEXITSTATUS +#define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8) +#endif +#ifndef WIFEXITED +#define WIFEXITED(stat_val) (((stat_val) & 255) == 0) +#endif +int main() { +int s; +wait (&s); +s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; +; return 0; } +EOF +if { (eval echo configure:1397: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_sys_wait_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_sys_wait_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_sys_wait_h" 1>&6 +if test $ac_cv_header_sys_wait_h = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_SYS_WAIT_H 1 +EOF + +fi + +echo $ac_n "checking if select needs nonstd include files""... $ac_c" 1>&6 +echo "configure:1418: checking if select needs nonstd include files" >&5 +if eval "test \"`echo '$''{'ac_cv_header_slect_nonstd_hdr'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1423 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/time.h> +int main() { +fd_set rfd; FD_ZERO(&rfd); select(1, &rfd, 0, 0, 0); +; return 0; } +EOF +if { (eval echo configure:1431: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_slect_nonstd_hdr=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_slect_nonstd_hdr=yes +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_slect_nonstd_hdr" 1>&6 +if test $ac_cv_header_slect_nonstd_hdr = yes; then + cat >> confdefs.h <<\EOF +#define SELECT_NONSTD_HDR 1 +EOF + +fi +echo $ac_n "checking if sys/select.h is needed for select""... $ac_c" 1>&6 +echo "configure:1451: checking if sys/select.h is needed for select" >&5 +if eval "test \"`echo '$''{'ac_cv_header_need_sys_select_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1456 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/time.h> +#include <sys/select.h> +#ifndef SELECT_NONSTD_HDR +do not compile if we do not need nonstandard headers +#endif +int main() { +fd_set rfd; FD_ZERO(&rfd); select(1, &rfd, 0, 0, 0); +; return 0; } +EOF +if { (eval echo configure:1468: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_need_sys_select_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_need_sys_select_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_need_sys_select_h" 1>&6 +if test $ac_cv_header_need_sys_select_h = yes; then + cat >> confdefs.h <<\EOF +#define NEED_SYS_SELECT_H 1 +EOF + +fi +echo $ac_n "checking if sys/socket.h is needed for select""... $ac_c" 1>&6 +echo "configure:1488: checking if sys/socket.h is needed for select" >&5 +if eval "test \"`echo '$''{'ac_cv_header_need_sys_socket_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1493 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/time.h> +#include <sys/socket.h> +#ifndef SELECT_NONSTD_HDR +do not compile if we do not need nonstandard headers +#endif +int main() { +fd_set rfd; FD_ZERO(&rfd); select(1, &rfd, 0, 0, 0); +; return 0; } +EOF +if { (eval echo configure:1505: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_need_sys_socket_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_need_sys_socket_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_need_sys_socket_h" 1>&6 +if test $ac_cv_header_need_sys_socket_h = yes; then + cat >> confdefs.h <<\EOF +#define NEED_SYS_SOCKET_H 1 +EOF + +fi +for ac_hdr in varargs.h stdarg.h stdlib.h stddef.h string.h strings.h unistd.h fcntl.h sys/file.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1528: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1533 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1538: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in getopt.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1568: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1573 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1578: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in limits.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1608: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1613 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1618: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in a.out.h aouthdr.h elf.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1648: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1653 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1658: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in malloc.h termios.h termio.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1688: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1693 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1698: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in pwd.h grp.h sys/acl.h acllib.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1728: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1733 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1738: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in shadow.h syslog.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1768: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1773 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1778: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in sys/time.h sys/times.h utime.h sys/utime.h sys/ioctl.h sys/filio.h sys/param.h sys/systeminfo.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1808: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1813 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1818: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in sys/syscall.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1848: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1853 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1858: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in mntent.h sys/mntent.h sys/mnttab.h sys/mount.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1888: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1893 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1898: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in wait.h sys/resource.h sys/procfs.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1928: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1933 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1938: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in sys/utsname.h sys/priocntl.h sys/rtpriocntl.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:1968: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1973 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1978: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in sys/mtio.h sys/tape.h sys/mman.h linux/pg.h camlib.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2008: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2013 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2018: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in sys/shm.h sys/ipc.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2048: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2053 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2058: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in sys/dkio.h sys/dklabel.h sun/dkio.h sun/dklabel.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2088: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2093 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2098: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in sys/types.h sys/stat.h types.h stat.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2128: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2133 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2138: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in poll.h sys/poll.h sys/select.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2168: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2173 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2178: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in netdb.h sys/socket.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2208: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2213 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2218: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in ieeefp.h fp.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2248: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2253 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2258: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in values.h float.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2288: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2293 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2298: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in arpa/inet.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2328: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2333 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2338: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in bsd/dev/scsireg.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2368: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2373 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2378: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in sys/bsdtty.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2408: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2413 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2418: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in OS.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2448: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2453 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2458: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in attr/xattr.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2488: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2493 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2498: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_hdr in fnmatch.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2528: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2533 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2538: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +echo $ac_n "checking for header file containing major(), minor() and makedev()""... $ac_c" 1>&6 +echo "configure:2566: checking for header file containing major(), minor() and makedev()" >&5 +if eval "test \"`echo '$''{'ac_cv_header_makedev'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_header_makedev=none +cat > conftest.$ac_ext <<EOF +#line 2572 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/mkdev.h> +int main() { +int i = major(0); i = minor(0); i = makedev(0,0); +; return 0; } +EOF +if { (eval echo configure:2580: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_makedev=sys/mkdev.h +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +if test $ac_cv_header_makedev = none; then + cat > conftest.$ac_ext <<EOF +#line 2590 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/sysmacros.h> +int main() { +int i = major(0); i = minor(0); i = makedev(0,0); +; return 0; } +EOF +if { (eval echo configure:2598: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_makedev=sys/sysmacros.h +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +fi +fi + +echo "$ac_t""$ac_cv_header_makedev" 1>&6 +if test $ac_cv_header_makedev = sys/mkdev.h; then + cat >> confdefs.h <<\EOF +#define MAJOR_IN_MKDEV 1 +EOF + +fi +if test $ac_cv_header_makedev = sys/sysmacros.h; then + cat >> confdefs.h <<\EOF +#define MAJOR_IN_SYSMACROS 1 +EOF + +fi + + +echo $ac_n "checking bits in minor device number""... $ac_c" 1>&6 +echo "configure:2625: checking bits in minor device number" >&5 +if eval "test \"`echo '$''{'ac_cv_dev_minor_bits'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 2633 "configure" +#include "confdefs.h" +#include <stdio.h> +#include <sys/types.h> +#ifdef major +# define _FOUND_MAJOR_ +#endif + +#ifdef MAJOR_IN_MKDEV +# include <sys/mkdev.h> +# define _FOUND_MAJOR_ +#endif + +#ifndef _FOUND_MAJOR_ +# ifdef MAJOR_IN_SYSMACROS +# include <sys/sysmacros.h> +# define _FOUND_MAJOR_ +# endif +#endif + +#ifndef _FOUND_MAJOR_ +# if defined(hpux) || defined(__hpux__) || defined(__hpux) +# include <sys/mknod.h> +# define _FOUND_MAJOR_ +# endif +#endif + +#ifndef _FOUND_MAJOR_ +# define major(dev) (((dev) >> 8) & 0xFF) +# define minor(dev) ((dev) & 0xFF) +# define makedev(majo, mino) (((majo) << 8) | (mino)) +#endif +int +main() +{ + long l = 1; + int i; + int m; + int c = 0; + FILE *f=fopen("conftestval", "w"); + + if (!f) exit(1); + + for (i=1, m=0; i <= 32; i++, l<<=1) { + if (minor(l) == 0 && c == 0) + c = m; + if (minor(l) != 0) + m = i; + } + fprintf(f, "%d\n", m); + exit(0); +} +EOF +if { (eval echo configure:2686: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_dev_minor_bits=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_dev_minor_bits=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_dev_minor_bits" 1>&6 +cat >> confdefs.h <<EOF +#define DEV_MINOR_BITS $ac_cv_dev_minor_bits +EOF + + +echo $ac_n "checking whether bits in minor device numbers are non contiguous""... $ac_c" 1>&6 +echo "configure:2706: checking whether bits in minor device numbers are non contiguous" >&5 +if eval "test \"`echo '$''{'ac_cv_dev_minor_noncontig'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 2714 "configure" +#include "confdefs.h" + +#include <sys/types.h> +#ifdef major +# define _FOUND_MAJOR_ +#endif + +#ifdef MAJOR_IN_MKDEV +# include <sys/mkdev.h> +# define _FOUND_MAJOR_ +#endif + +#ifndef _FOUND_MAJOR_ +# ifdef MAJOR_IN_SYSMACROS +# include <sys/sysmacros.h> +# define _FOUND_MAJOR_ +# endif +#endif + +#ifndef _FOUND_MAJOR_ +# if defined(hpux) || defined(__hpux__) || defined(__hpux) +# include <sys/mknod.h> +# define _FOUND_MAJOR_ +# endif +#endif + +#ifndef _FOUND_MAJOR_ +# define major(dev) (((dev) >> 8) & 0xFF) +# define minor(dev) ((dev) & 0xFF) +# define makedev(majo, mino) (((majo) << 8) | (mino)) +#endif +int +main() +{ + long l = 1; + int i; + int m; + int c = 0; + + for (i=1, m=0; i <= 32; i++, l<<=1) { + if (minor(l) == 0 && c == 0) + c = m; + if (minor(l) != 0) + m = i; + } +exit (m == c);} +EOF +if { (eval echo configure:2762: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_dev_minor_noncontig=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_dev_minor_noncontig=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_dev_minor_noncontig" 1>&6 +if test $ac_cv_dev_minor_noncontig = yes; then + cat >> confdefs.h <<\EOF +#define DEV_MINOR_NONCONTIG 1 +EOF + +fi + +echo $ac_n "checking for _filbuf()""... $ac_c" 1>&6 +echo "configure:2785: checking for _filbuf()" >&5 +if eval "test \"`echo '$''{'ac_cv_func__filbuf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2790 "configure" +#include "confdefs.h" +#include <stdio.h> +int main() { +FILE *f; +int flag; +int count; +char *ptr; +char c = 0; +f = fopen("confdefs.h", "r"); +_filbuf(f); +_flsbuf(c, f); +flag = f->_flag & _IONBF; +flag |= f->_flag & _IOERR; +flag |= f->_flag & _IOEOF; +count = f->_cnt; +ptr = (char *)f->_ptr; +fclose(f); +; return 0; } +EOF +if { (eval echo configure:2810: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_func__filbuf=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_func__filbuf=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_func__filbuf" 1>&6 +if test $ac_cv_func__filbuf = yes; then + cat >> confdefs.h <<\EOF +#define HAVE__FILBUF 1 +EOF + +fi +echo $ac_n "checking for __filbuf()""... $ac_c" 1>&6 +echo "configure:2830: checking for __filbuf()" >&5 +if eval "test \"`echo '$''{'ac_cv_func___filbuf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2835 "configure" +#include "confdefs.h" +#include <stdio.h> +int main() { +FILE *f; +int flag; +int count; +char *ptr; +char c = 0; +f = fopen("confdefs.h", "r"); +__filbuf(f); +__flsbuf(c, f); +flag = f->_flag & _IONBF; +flag |= f->_flag & _IOERR; +flag |= f->_flag & _IOEOF; +count = f->_cnt; +ptr = (char *)f->_ptr; +fclose(f); +; return 0; } +EOF +if { (eval echo configure:2855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_func___filbuf=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_func___filbuf=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_func___filbuf" 1>&6 +if test $ac_cv_func___filbuf = yes; then + cat >> confdefs.h <<\EOF +#define HAVE___FILBUF 1 +EOF + +fi +echo $ac_n "checking for USG derived STDIO""... $ac_c" 1>&6 +echo "configure:2875: checking for USG derived STDIO" >&5 +if eval "test \"`echo '$''{'ac_cv_header_usg_stdio'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2880 "configure" +#include "confdefs.h" +#include <stdio.h> +int main() { +FILE *f; +int flag; +int count; +char *ptr; +char c = 0; +f = fopen("confdefs.h", "r"); +#ifdef HAVE___FILBUF +__filbuf(f); +__flsbuf(c, f); +#else +# ifdef HAVE__FILBUF +_filbuf(f); +_flsbuf(c, f); +# else +no filbuf() +# endif +#endif +flag = f->_flag & _IONBF; +flag |= f->_flag & _IOERR; +flag |= f->_flag & _IOEOF; +count = f->_cnt; +ptr = (char *)f->_ptr; +fclose(f); +; return 0; } +EOF +if { (eval echo configure:2909: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_header_usg_stdio=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_usg_stdio=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_usg_stdio" 1>&6 +if test $ac_cv_header_usg_stdio = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_USG_STDIO 1 +EOF + +fi +echo $ac_n "checking for errno definition in errno.h""... $ac_c" 1>&6 +echo "configure:2929: checking for errno definition in errno.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_errno_def'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2934 "configure" +#include "confdefs.h" +#include <errno.h> +int main() { +errno = 0; +; return 0; } +EOF +if { (eval echo configure:2941: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_errno_def=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_errno_def=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_errno_def" 1>&6 +if test $ac_cv_header_errno_def = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ERRNO_DEF 1 +EOF + +fi + +echo $ac_n "checking for working const""... $ac_c" 1>&6 +echo "configure:2962: checking for working const" >&5 +if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2967 "configure" +#include "confdefs.h" + +int main() { + +/* Ultrix mips cc rejects this. */ +typedef int charset[2]; const charset x; +/* SunOS 4.1.1 cc rejects this. */ +char const *const *ccp; +char **p; +/* NEC SVR4.0.2 mips cc rejects this. */ +struct point {int x, y;}; +static struct point const zero = {0,0}; +/* AIX XL C 1.02.0.0 rejects this. + It does not let you subtract one const X* pointer from another in an arm + of an if-expression whose if-part is not a constant expression */ +const char *g = "string"; +ccp = &g + (g ? g-g : 0); +/* HPUX 7.0 cc rejects these. */ +++ccp; +p = (char**) ccp; +ccp = (char const *const *) p; +{ /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; +} +{ /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ + int x[] = {25, 17}; + const int *foo = &x[0]; + ++foo; +} +{ /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ + typedef const int *iptr; + iptr p = 0; + ++p; +} +{ /* AIX XL C 1.02.0.0 rejects this saying + "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ + struct s { int j; const int *ap[3]; }; + struct s *b; b->j = 5; +} +{ /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ + const int foo = 10; +} + +; return 0; } +EOF +if { (eval echo configure:3016: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_const=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_const=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_c_const" 1>&6 +if test $ac_cv_c_const = no; then + cat >> confdefs.h <<\EOF +#define const +EOF + +fi + +echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6 +echo "configure:3037: checking whether byte ordering is bigendian" >&5 +if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_c_bigendian=unknown +# See if sys/param.h defines the BYTE_ORDER macro. +cat > conftest.$ac_ext <<EOF +#line 3044 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/param.h> +int main() { + +#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN + bogus endian macros +#endif +; return 0; } +EOF +if { (eval echo configure:3055: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + # It does; now see whether it defined to BIG_ENDIAN or not. +cat > conftest.$ac_ext <<EOF +#line 3059 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/param.h> +int main() { + +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif +; return 0; } +EOF +if { (eval echo configure:3070: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_bigendian=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_c_bigendian=no +fi +rm -f conftest* +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +if test $ac_cv_c_bigendian = unknown; then +if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 3090 "configure" +#include "confdefs.h" +main () { + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long l; + char c[sizeof (long)]; + } u; + u.l = 1; + exit (u.c[sizeof (long) - 1] == 1); +} +EOF +if { (eval echo configure:3103: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_c_bigendian=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_bigendian=yes +fi +rm -fr conftest* +fi + +fi +fi + +echo "$ac_t""$ac_cv_c_bigendian" 1>&6 +if test $ac_cv_c_bigendian = yes; then + cat >> confdefs.h <<\EOF +#define WORDS_BIGENDIAN 1 +EOF + +fi + +echo $ac_n "checking whether bitorder in bitfields is htol""... $ac_c" 1>&6 +echo "configure:3127: checking whether bitorder in bitfields is htol" >&5 +if eval "test \"`echo '$''{'ac_cv_c_bitfields_htol'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 3135 "configure" +#include "confdefs.h" + +struct { + unsigned char x1:4; + unsigned char x2:4; +} a; +int +main() +{ +char *cp; + +cp = (char *)&a; +*cp = 0x12; +exit(a.x1 == 2);} +EOF +if { (eval echo configure:3151: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_c_bitfields_htol=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_bitfields_htol=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_c_bitfields_htol" 1>&6 +if test $ac_cv_c_bitfields_htol = yes; then + cat >> confdefs.h <<\EOF +#define BITFIELDS_HTOL 1 +EOF + +fi +echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 +echo "configure:3173: checking return type of signal handlers" >&5 +if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3178 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <signal.h> +#ifdef signal +#undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int main() { +int i; +; return 0; } +EOF +if { (eval echo configure:3195: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_type_signal=void +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_type_signal=int +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_type_signal" 1>&6 +cat >> confdefs.h <<EOF +#define RETSIGTYPE $ac_cv_type_signal +EOF + + +echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 +echo "configure:3214: checking for uid_t in sys/types.h" >&5 +if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3219 "configure" +#include "confdefs.h" +#include <sys/types.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "uid_t" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_uid_t=yes +else + rm -rf conftest* + ac_cv_type_uid_t=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_type_uid_t" 1>&6 +if test $ac_cv_type_uid_t = no; then + cat >> confdefs.h <<\EOF +#define uid_t int +EOF + + cat >> confdefs.h <<\EOF +#define gid_t int +EOF + +fi + +echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6 +echo "configure:3248: checking type of array argument to getgroups" >&5 +if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_type_getgroups=cross +else + cat > conftest.$ac_ext <<EOF +#line 3256 "configure" +#include "confdefs.h" + +/* Thanks to Mike Rendell for this test. */ +#include <sys/types.h> +#define NGID 256 +#undef MAX +#define MAX(x, y) ((x) > (y) ? (x) : (y)) +main() +{ + gid_t gidset[NGID]; + int i, n; + union { gid_t gval; long lval; } val; + + val.lval = -1; + for (i = 0; i < NGID; i++) + gidset[i] = val.gval; + n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1, + gidset); + /* Exit non-zero if getgroups seems to require an array of ints. This + happens when gid_t is short but getgroups modifies an array of ints. */ + exit ((n > 0 && gidset[n] != val.gval) ? 1 : 0); +} + +EOF +if { (eval echo configure:3281: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_type_getgroups=gid_t +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_type_getgroups=int +fi +rm -fr conftest* +fi + +if test $ac_cv_type_getgroups = cross; then + cat > conftest.$ac_ext <<EOF +#line 3295 "configure" +#include "confdefs.h" +#include <unistd.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "getgroups.*int.*gid_t" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_getgroups=gid_t +else + rm -rf conftest* + ac_cv_type_getgroups=int +fi +rm -f conftest* + +fi +fi + +echo "$ac_t""$ac_cv_type_getgroups" 1>&6 +cat >> confdefs.h <<EOF +#define GETGROUPS_T $ac_cv_type_getgroups +EOF + + +echo $ac_n "checking for type long long""... $ac_c" 1>&6 +echo "configure:3319: checking for type long long" >&5 +if eval "test \"`echo '$''{'ac_cv_type_longlong'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3324 "configure" +#include "confdefs.h" + +int main() { +long long i; +; return 0; } +EOF +if { (eval echo configure:3331: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_type_longlong=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_type_longlong=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_type_longlong" 1>&6 +if test $ac_cv_type_longlong = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_LONGLONG 1 +EOF + +fi +echo $ac_n "checking for prototypes""... $ac_c" 1>&6 +echo "configure:3351: checking for prototypes" >&5 +if eval "test \"`echo '$''{'ac_cv_type_prototypes'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 3359 "configure" +#include "confdefs.h" + +doit(int i, ...) +{return 0;} +int +main(int ac, char *av[]) +{ doit(1, 2, 3); +exit(0);} +EOF +if { (eval echo configure:3369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_type_prototypes=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_type_prototypes=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_type_prototypes" 1>&6 +if test $ac_cv_type_prototypes = yes; then + cat >> confdefs.h <<\EOF +#define PROTOTYPES 1 +EOF + +fi +echo $ac_n "checking if compiler allows dynamic arrays""... $ac_c" 1>&6 +echo "configure:3391: checking if compiler allows dynamic arrays" >&5 +if eval "test \"`echo '$''{'ac_cv_dyn_arrays'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3396 "configure" +#include "confdefs.h" + +int main() { +extern int __aa(); int len = __aa(); char some_array[len]; +; return 0; } +EOF +if { (eval echo configure:3403: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_dyn_arrays=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_dyn_arrays=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_dyn_arrays" 1>&6 +if test $ac_cv_dyn_arrays = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_DYN_ARRAYS 1 +EOF + +fi + +echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 +echo "configure:3424: checking for uid_t in sys/types.h" >&5 +if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3429 "configure" +#include "confdefs.h" +#include <sys/types.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "uid_t" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_uid_t=yes +else + rm -rf conftest* + ac_cv_type_uid_t=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_type_uid_t" 1>&6 +if test $ac_cv_type_uid_t = no; then + cat >> confdefs.h <<\EOF +#define uid_t int +EOF + + cat >> confdefs.h <<\EOF +#define gid_t int +EOF + +fi + +echo $ac_n "checking for size_t""... $ac_c" 1>&6 +echo "configure:3458: checking for size_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3463 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_size_t=yes +else + rm -rf conftest* + ac_cv_type_size_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_size_t" 1>&6 +if test $ac_cv_type_size_t = no; then + cat >> confdefs.h <<\EOF +#define size_t unsigned +EOF + +fi + +echo $ac_n "checking for ssize_t""... $ac_c" 1>&6 +echo "configure:3491: checking for ssize_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_ssize_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3496 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])ssize_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_ssize_t=yes +else + rm -rf conftest* + ac_cv_type_ssize_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_ssize_t" 1>&6 +if test $ac_cv_type_ssize_t = no; then + cat >> confdefs.h <<\EOF +#define ssize_t int +EOF + +fi + +echo $ac_n "checking for pid_t""... $ac_c" 1>&6 +echo "configure:3524: checking for pid_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3529 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_pid_t=yes +else + rm -rf conftest* + ac_cv_type_pid_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_pid_t" 1>&6 +if test $ac_cv_type_pid_t = no; then + cat >> confdefs.h <<\EOF +#define pid_t int +EOF + +fi + +echo $ac_n "checking for off_t""... $ac_c" 1>&6 +echo "configure:3557: checking for off_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3562 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_off_t=yes +else + rm -rf conftest* + ac_cv_type_off_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_off_t" 1>&6 +if test $ac_cv_type_off_t = no; then + cat >> confdefs.h <<\EOF +#define off_t long +EOF + +fi + +echo $ac_n "checking for mode_t""... $ac_c" 1>&6 +echo "configure:3590: checking for mode_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3595 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])mode_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_mode_t=yes +else + rm -rf conftest* + ac_cv_type_mode_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_mode_t" 1>&6 +if test $ac_cv_type_mode_t = no; then + cat >> confdefs.h <<\EOF +#define mode_t int +EOF + +fi + +echo $ac_n "checking for time_t""... $ac_c" 1>&6 +echo "configure:3623: checking for time_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_time_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3628 "configure" +#include "confdefs.h" + +#include <sys/types.h> +#ifdef TIME_WITH_SYS_TIME_H +# include <sys/time.h> +# include <time.h> +#else +#ifdef HAVE_SYS_TIME_H +# include <sys/time.h> +#else +# include <time.h> +#endif +#endif +int main() { +time_t t; +; return 0; } +EOF +if { (eval echo configure:3646: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_type_time_t=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_type_time_t=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_type_time_t" 1>&6 +if test $ac_cv_type_time_t = no; then + cat >> confdefs.h <<\EOF +#define time_t long +EOF + +fi +echo $ac_n "checking for caddr_t""... $ac_c" 1>&6 +echo "configure:3666: checking for caddr_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_caddr_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3671 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])caddr_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_caddr_t=yes +else + rm -rf conftest* + ac_cv_type_caddr_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_caddr_t" 1>&6 +if test $ac_cv_type_caddr_t = no; then + cat >> confdefs.h <<\EOF +#define caddr_t char * +EOF + +fi + +echo $ac_n "checking for daddr_t""... $ac_c" 1>&6 +echo "configure:3699: checking for daddr_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_daddr_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3704 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])daddr_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_daddr_t=yes +else + rm -rf conftest* + ac_cv_type_daddr_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_daddr_t" 1>&6 +if test $ac_cv_type_daddr_t = no; then + cat >> confdefs.h <<\EOF +#define daddr_t long +EOF + +fi + +echo $ac_n "checking for dev_t""... $ac_c" 1>&6 +echo "configure:3732: checking for dev_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_dev_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3737 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])dev_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_dev_t=yes +else + rm -rf conftest* + ac_cv_type_dev_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_dev_t" 1>&6 +if test $ac_cv_type_dev_t = no; then + cat >> confdefs.h <<\EOF +#define dev_t unsigned short +EOF + +fi + +echo $ac_n "checking for ino_t""... $ac_c" 1>&6 +echo "configure:3765: checking for ino_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_ino_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3770 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])ino_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_ino_t=yes +else + rm -rf conftest* + ac_cv_type_ino_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_ino_t" 1>&6 +if test $ac_cv_type_ino_t = no; then + cat >> confdefs.h <<\EOF +#define ino_t unsigned long +EOF + +fi + +echo $ac_n "checking for nlink_t""... $ac_c" 1>&6 +echo "configure:3798: checking for nlink_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_nlink_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3803 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])nlink_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_nlink_t=yes +else + rm -rf conftest* + ac_cv_type_nlink_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_nlink_t" 1>&6 +if test $ac_cv_type_nlink_t = no; then + cat >> confdefs.h <<\EOF +#define nlink_t unsigned long +EOF + +fi + +echo $ac_n "checking for blksize_t""... $ac_c" 1>&6 +echo "configure:3831: checking for blksize_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_blksize_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3836 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])blksize_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_blksize_t=yes +else + rm -rf conftest* + ac_cv_type_blksize_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_blksize_t" 1>&6 +if test $ac_cv_type_blksize_t = no; then + cat >> confdefs.h <<\EOF +#define blksize_t long +EOF + +fi + +echo $ac_n "checking for blkcnt_t""... $ac_c" 1>&6 +echo "configure:3864: checking for blkcnt_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_blkcnt_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3869 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])blkcnt_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_blkcnt_t=yes +else + rm -rf conftest* + ac_cv_type_blkcnt_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_blkcnt_t" 1>&6 +if test $ac_cv_type_blkcnt_t = no; then + cat >> confdefs.h <<\EOF +#define blkcnt_t Intmax_t +EOF + +fi + +echo $ac_n "checking for clock_t""... $ac_c" 1>&6 +echo "configure:3897: checking for clock_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_clock_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3902 "configure" +#include "confdefs.h" + +#include <sys/types.h> +/* + * time.h is needed because of a bug in Next Step. + * Next Step needs time.h for clock_t + */ +#ifdef TIME_WITH_SYS_TIME +# ifndef _INCL_SYS_TIME_H +# include <sys/time.h> +# define _INCL_SYS_TIME_H +# endif +# ifndef _INCL_TIME_H +# include <time.h> +# define _INCL_TIME_H +# endif +#else +#ifdef HAVE_SYS_TIME_H +# ifndef _INCL_SYS_TIME_H +# include <sys/time.h> +# define _INCL_SYS_TIME_H +# endif +#else +# ifndef _INCL_TIME_H +# include <time.h> +# define _INCL_TIME_H +# endif +#endif +#endif +#include <sys/times.h> +int main() { +clock_t t; +; return 0; } +EOF +if { (eval echo configure:3937: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_type_clock_t=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_type_clock_t=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_type_clock_t" 1>&6 +if test $ac_cv_type_clock_t = no; then + cat >> confdefs.h <<\EOF +#define clock_t long +EOF + +fi +echo $ac_n "checking for socklen_t""... $ac_c" 1>&6 +echo "configure:3957: checking for socklen_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_socklen_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3962 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +#include <sys/socket.h> +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])socklen_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_socklen_t=yes +else + rm -rf conftest* + ac_cv_type_socklen_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_socklen_t" 1>&6 +if test $ac_cv_type_socklen_t = no; then + cat >> confdefs.h <<\EOF +#define socklen_t int +EOF + +fi + +echo $ac_n "checking for u_char""... $ac_c" 1>&6 +echo "configure:3991: checking for u_char" >&5 +if eval "test \"`echo '$''{'ac_cv_type_u_char'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3996 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])u_char[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_u_char=yes +else + rm -rf conftest* + ac_cv_type_u_char=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_u_char" 1>&6 +if test $ac_cv_type_u_char = no; then + cat >> confdefs.h <<\EOF +#define u_char unsigned char +EOF + +fi + +echo $ac_n "checking for u_short""... $ac_c" 1>&6 +echo "configure:4024: checking for u_short" >&5 +if eval "test \"`echo '$''{'ac_cv_type_u_short'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 4029 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])u_short[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_u_short=yes +else + rm -rf conftest* + ac_cv_type_u_short=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_u_short" 1>&6 +if test $ac_cv_type_u_short = no; then + cat >> confdefs.h <<\EOF +#define u_short unsigned short +EOF + +fi + +echo $ac_n "checking for u_int""... $ac_c" 1>&6 +echo "configure:4057: checking for u_int" >&5 +if eval "test \"`echo '$''{'ac_cv_type_u_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 4062 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])u_int[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_u_int=yes +else + rm -rf conftest* + ac_cv_type_u_int=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_u_int" 1>&6 +if test $ac_cv_type_u_int = no; then + cat >> confdefs.h <<\EOF +#define u_int unsigned int +EOF + +fi + +echo $ac_n "checking for u_long""... $ac_c" 1>&6 +echo "configure:4090: checking for u_long" >&5 +if eval "test \"`echo '$''{'ac_cv_type_u_long'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 4095 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])u_long[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_u_long=yes +else + rm -rf conftest* + ac_cv_type_u_long=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_u_long" 1>&6 +if test $ac_cv_type_u_long = no; then + cat >> confdefs.h <<\EOF +#define u_long unsigned long +EOF + +fi + + +echo $ac_n "checking size of char""... $ac_c" 1>&6 +echo "configure:4124: checking size of char" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_char'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 4132 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(char)); + exit(0); +} +EOF +if { (eval echo configure:4143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_char=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_char=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_char" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_CHAR $ac_cv_sizeof_char +EOF + + +echo $ac_n "checking size of short int""... $ac_c" 1>&6 +echo "configure:4163: checking size of short int" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_short_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 4171 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(short int)); + exit(0); +} +EOF +if { (eval echo configure:4182: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_short_int=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_short_int=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_short_int" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_SHORT_INT $ac_cv_sizeof_short_int +EOF + + +echo $ac_n "checking size of int""... $ac_c" 1>&6 +echo "configure:4202: checking size of int" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 4210 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(int)); + exit(0); +} +EOF +if { (eval echo configure:4221: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_int=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_int=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_int" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_INT $ac_cv_sizeof_int +EOF + + +echo $ac_n "checking size of long int""... $ac_c" 1>&6 +echo "configure:4241: checking size of long int" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_long_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 4249 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(long int)); + exit(0); +} +EOF +if { (eval echo configure:4260: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_long_int=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_long_int=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_long_int" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_LONG_INT $ac_cv_sizeof_long_int +EOF + + +echo $ac_n "checking size of long long""... $ac_c" 1>&6 +echo "configure:4280: checking size of long long" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 4288 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(long long)); + exit(0); +} +EOF +if { (eval echo configure:4299: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_long_long=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_long_long=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_long_long" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long +EOF + + +echo $ac_n "checking size of char *""... $ac_c" 1>&6 +echo "configure:4319: checking size of char *" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_char_p'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 4327 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(char *)); + exit(0); +} +EOF +if { (eval echo configure:4338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_char_p=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_char_p=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_char_p" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_CHAR_P $ac_cv_sizeof_char_p +EOF + + + +echo $ac_n "checking size of unsigned char""... $ac_c" 1>&6 +echo "configure:4359: checking size of unsigned char" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_char'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 4367 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(unsigned char)); + exit(0); +} +EOF +if { (eval echo configure:4378: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_unsigned_char=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_unsigned_char=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_unsigned_char" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_UNSIGNED_CHAR $ac_cv_sizeof_unsigned_char +EOF + + +echo $ac_n "checking size of unsigned short int""... $ac_c" 1>&6 +echo "configure:4398: checking size of unsigned short int" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_short_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 4406 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(unsigned short int)); + exit(0); +} +EOF +if { (eval echo configure:4417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_unsigned_short_int=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_unsigned_short_int=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_unsigned_short_int" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_UNSIGNED_SHORT_INT $ac_cv_sizeof_unsigned_short_int +EOF + + +echo $ac_n "checking size of unsigned int""... $ac_c" 1>&6 +echo "configure:4437: checking size of unsigned int" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 4445 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(unsigned int)); + exit(0); +} +EOF +if { (eval echo configure:4456: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_unsigned_int=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_unsigned_int=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_unsigned_int" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_UNSIGNED_INT $ac_cv_sizeof_unsigned_int +EOF + + +echo $ac_n "checking size of unsigned long int""... $ac_c" 1>&6 +echo "configure:4476: checking size of unsigned long int" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_long_int'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 4484 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(unsigned long int)); + exit(0); +} +EOF +if { (eval echo configure:4495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_unsigned_long_int=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_unsigned_long_int=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_unsigned_long_int" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_UNSIGNED_LONG_INT $ac_cv_sizeof_unsigned_long_int +EOF + + +echo $ac_n "checking size of unsigned long long""... $ac_c" 1>&6 +echo "configure:4515: checking size of unsigned long long" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_long_long'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 4523 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(unsigned long long)); + exit(0); +} +EOF +if { (eval echo configure:4534: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_unsigned_long_long=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_unsigned_long_long=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_unsigned_long_long" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_UNSIGNED_LONG_LONG $ac_cv_sizeof_unsigned_long_long +EOF + + +echo $ac_n "checking size of unsigned char *""... $ac_c" 1>&6 +echo "configure:4554: checking size of unsigned char *" >&5 +if eval "test \"`echo '$''{'ac_cv_sizeof_unsigned_char_p'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 4562 "configure" +#include "confdefs.h" +#include <stdio.h> +main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) exit(1); + fprintf(f, "%d\n", sizeof(unsigned char *)); + exit(0); +} +EOF +if { (eval echo configure:4573: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_sizeof_unsigned_char_p=`cat conftestval` +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_sizeof_unsigned_char_p=0 +fi +rm -fr conftest* +fi + +fi +echo "$ac_t""$ac_cv_sizeof_unsigned_char_p" 1>&6 +cat >> confdefs.h <<EOF +#define SIZEOF_UNSIGNED_CHAR_P $ac_cv_sizeof_unsigned_char_p +EOF + + + +echo $ac_n "checking if char is unsigned""... $ac_c" 1>&6 +echo "configure:4594: checking if char is unsigned" >&5 +if eval "test \"`echo '$''{'ac_cv_type_char_unsigned'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_type_char_unsigned=no +else + cat > conftest.$ac_ext <<EOF +#line 4602 "configure" +#include "confdefs.h" + +int +main() +{ + char c; + + c = -1; + exit(c < 0);} +EOF +if { (eval echo configure:4613: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_type_char_unsigned=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_type_char_unsigned=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_type_char_unsigned" 1>&6 +if test $ac_cv_type_char_unsigned = yes; then + cat >> confdefs.h <<\EOF +#define CHAR_IS_UNSIGNED 1 +EOF + +fi +echo $ac_n "checking if va_list is an array""... $ac_c" 1>&6 +echo "configure:4635: checking if va_list is an array" >&5 +if eval "test \"`echo '$''{'ac_cv_type_va_list_array'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 4640 "configure" +#include "confdefs.h" + +#ifdef HAVE_STDARG_H +# include <stdarg.h> +#else +# include <varargs.h> +#endif + +int main() { + +va_list a, b; + +a = b; +; return 0; } +EOF +if { (eval echo configure:4656: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_type_va_list_array=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_type_va_list_array=yes +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_type_va_list_array" 1>&6 +if test $ac_cv_type_va_list_array = yes; then + cat >> confdefs.h <<\EOF +#define VA_LIST_IS_ARRAY 1 +EOF + +fi +echo $ac_n "checking if struct mtget contains mt_type""... $ac_c" 1>&6 +echo "configure:4676: checking if struct mtget contains mt_type" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_mtget_type'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 4681 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/mtio.h> +int main() { +struct mtget t; t.mt_type = 0; +; return 0; } +EOF +if { (eval echo configure:4689: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_mtget_type=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_mtget_type=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_mtget_type" 1>&6 +if test $ac_cv_struct_mtget_type = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MTGET_TYPE 1 +EOF + +fi +echo $ac_n "checking if struct mtget contains mt_model""... $ac_c" 1>&6 +echo "configure:4709: checking if struct mtget contains mt_model" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_mtget_model'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 4714 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/mtio.h> +int main() { +struct mtget t; t.mt_model = 0; +; return 0; } +EOF +if { (eval echo configure:4722: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_mtget_model=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_mtget_model=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_mtget_model" 1>&6 +if test $ac_cv_struct_mtget_model = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MTGET_MODEL 1 +EOF + +fi +echo $ac_n "checking if struct mtget contains mt_dsreg""... $ac_c" 1>&6 +echo "configure:4742: checking if struct mtget contains mt_dsreg" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_mtget_dsreg'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 4747 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/mtio.h> +int main() { +struct mtget t; t.mt_dsreg = 0; +; return 0; } +EOF +if { (eval echo configure:4755: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_mtget_dsreg=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_mtget_dsreg=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_mtget_dsreg" 1>&6 +if test $ac_cv_struct_mtget_dsreg = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MTGET_DSREG 1 +EOF + +fi +echo $ac_n "checking if struct mtget contains mt_dsreg1""... $ac_c" 1>&6 +echo "configure:4775: checking if struct mtget contains mt_dsreg1" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_mtget_dsreg1'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 4780 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/mtio.h> +int main() { +struct mtget t; t.mt_dsreg1 = 0; +; return 0; } +EOF +if { (eval echo configure:4788: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_mtget_dsreg1=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_mtget_dsreg1=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_mtget_dsreg1" 1>&6 +if test $ac_cv_struct_mtget_dsreg1 = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MTGET_DSREG1 1 +EOF + +fi +echo $ac_n "checking if struct mtget contains mt_dsreg2""... $ac_c" 1>&6 +echo "configure:4808: checking if struct mtget contains mt_dsreg2" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_mtget_dsreg2'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 4813 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/mtio.h> +int main() { +struct mtget t; t.mt_dsreg2 = 0; +; return 0; } +EOF +if { (eval echo configure:4821: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_mtget_dsreg2=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_mtget_dsreg2=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_mtget_dsreg2" 1>&6 +if test $ac_cv_struct_mtget_dsreg2 = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MTGET_DSREG2 1 +EOF + +fi +echo $ac_n "checking if struct mtget contains mt_gstat""... $ac_c" 1>&6 +echo "configure:4841: checking if struct mtget contains mt_gstat" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_mtget_gstat'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 4846 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/mtio.h> +int main() { +struct mtget t; t.mt_gstat = 0; +; return 0; } +EOF +if { (eval echo configure:4854: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_mtget_gstat=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_mtget_gstat=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_mtget_gstat" 1>&6 +if test $ac_cv_struct_mtget_gstat = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MTGET_GSTAT 1 +EOF + +fi +echo $ac_n "checking if struct mtget contains mt_erreg""... $ac_c" 1>&6 +echo "configure:4874: checking if struct mtget contains mt_erreg" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_mtget_erreg'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 4879 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/mtio.h> +int main() { +struct mtget t; t.mt_erreg = 0; +; return 0; } +EOF +if { (eval echo configure:4887: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_mtget_erreg=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_mtget_erreg=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_mtget_erreg" 1>&6 +if test $ac_cv_struct_mtget_erreg = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MTGET_ERREG 1 +EOF + +fi +echo $ac_n "checking if struct mtget contains mt_resid""... $ac_c" 1>&6 +echo "configure:4907: checking if struct mtget contains mt_resid" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_mtget_resid'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 4912 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/mtio.h> +int main() { +struct mtget t; t.mt_resid = 0; +; return 0; } +EOF +if { (eval echo configure:4920: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_mtget_resid=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_mtget_resid=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_mtget_resid" 1>&6 +if test $ac_cv_struct_mtget_resid = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MTGET_RESID 1 +EOF + +fi +echo $ac_n "checking if struct mtget contains mt_fileno""... $ac_c" 1>&6 +echo "configure:4940: checking if struct mtget contains mt_fileno" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_mtget_fileno'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 4945 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/mtio.h> +int main() { +struct mtget t; t.mt_fileno = 0; +; return 0; } +EOF +if { (eval echo configure:4953: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_mtget_fileno=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_mtget_fileno=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_mtget_fileno" 1>&6 +if test $ac_cv_struct_mtget_fileno = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MTGET_FILENO 1 +EOF + +fi +echo $ac_n "checking if struct mtget contains mt_blkno""... $ac_c" 1>&6 +echo "configure:4973: checking if struct mtget contains mt_blkno" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_mtget_blkno'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 4978 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/mtio.h> +int main() { +struct mtget t; t.mt_blkno = 0; +; return 0; } +EOF +if { (eval echo configure:4986: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_mtget_blkno=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_mtget_blkno=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_mtget_blkno" 1>&6 +if test $ac_cv_struct_mtget_blkno = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MTGET_BLKNO 1 +EOF + +fi +echo $ac_n "checking if struct mtget contains mt_flags""... $ac_c" 1>&6 +echo "configure:5006: checking if struct mtget contains mt_flags" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_mtget_flags'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 5011 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/mtio.h> +int main() { +struct mtget t; t.mt_flags = 0; +; return 0; } +EOF +if { (eval echo configure:5019: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_mtget_flags=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_mtget_flags=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_mtget_flags" 1>&6 +if test $ac_cv_struct_mtget_flags = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MTGET_FLAGS 1 +EOF + +fi +echo $ac_n "checking if struct mtget contains mt_bf""... $ac_c" 1>&6 +echo "configure:5039: checking if struct mtget contains mt_bf" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_mtget_bf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 5044 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/mtio.h> +int main() { +struct mtget t; t.mt_bf = 0; +; return 0; } +EOF +if { (eval echo configure:5052: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_mtget_bf=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_mtget_bf=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_mtget_bf" 1>&6 +if test $ac_cv_struct_mtget_bf = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MTGET_BF 1 +EOF + +fi +echo $ac_n "checking if struct rusage is declared in sys/resource.h""... $ac_c" 1>&6 +echo "configure:5072: checking if struct rusage is declared in sys/resource.h" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_rusage'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 5077 "configure" +#include "confdefs.h" +#include <sys/time.h> +#include <sys/resource.h> +int main() { +struct rusage r; +; return 0; } +EOF +if { (eval echo configure:5085: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_rusage=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_rusage=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_rusage" 1>&6 +if test $ac_cv_struct_rusage = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_STRUCT_RUSAGE 1 +EOF + +fi +echo $ac_n "checking if struct siginfo contains si_utime""... $ac_c" 1>&6 +echo "configure:5105: checking if struct siginfo contains si_utime" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_si_utime'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 5110 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/siginfo.h> +int main() { +struct siginfo si; si.si_utime = 0; +; return 0; } +EOF +if { (eval echo configure:5118: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_si_utime=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_si_utime=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_si_utime" 1>&6 +if test $ac_cv_struct_si_utime = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_SI_UTIME 1 +EOF + +fi +echo $ac_n "checking if struct sockaddr_storage is declared in socket.h""... $ac_c" 1>&6 +echo "configure:5138: checking if struct sockaddr_storage is declared in socket.h" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_sockaddr_storage'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 5143 "configure" +#include "confdefs.h" +#include <sys/socket.h> +int main() { +struct sockaddr_storage ss; ss.ss_family = 0; +; return 0; } +EOF +if { (eval echo configure:5150: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_sockaddr_storage=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_sockaddr_storage=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_sockaddr_storage" 1>&6 +if test $ac_cv_struct_sockaddr_storage = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_SOCKADDR_STORAGE 1 +EOF + +fi +echo $ac_n "checking if an illegal declaration for union semun in sys/sem.h exists""... $ac_c" 1>&6 +echo "configure:5170: checking if an illegal declaration for union semun in sys/sem.h exists" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_union_semun'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 5175 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/ipc.h> +#include <sys/sem.h> +int main() { +union semun s; +; return 0; } +EOF +if { (eval echo configure:5184: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_union_semun=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_union_semun=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_union_semun" 1>&6 +if test $ac_cv_struct_union_semun = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_UNION_SEMUN 1 +EOF + +fi +echo $ac_n "checking if union wait is declared in wait.h or sys/wait.h""... $ac_c" 1>&6 +echo "configure:5204: checking if union wait is declared in wait.h or sys/wait.h" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_union_wait'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 5209 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if defined(HAVE_WAIT_H) +# include <wait.h> +#else +#include <sys/wait.h> +#endif +int main() { +union wait w; +; return 0; } +EOF +if { (eval echo configure:5221: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_union_wait=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_union_wait=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_union_wait" 1>&6 +if test $ac_cv_struct_union_wait = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_UNION_WAIT 1 +EOF + +fi +echo $ac_n "checking if struct stat contains st_spare1""... $ac_c" 1>&6 +echo "configure:5241: checking if struct stat contains st_spare1" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_st_spare1'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 5246 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/stat.h> +int main() { +struct stat s; s.st_spare1 = 0; +; return 0; } +EOF +if { (eval echo configure:5254: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st_spare1=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_st_spare1=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_st_spare1" 1>&6 +if test $ac_cv_struct_st_spare1 = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ST_SPARE1 1 +EOF + +fi +echo $ac_n "checking if struct stat contains st_atimensec""... $ac_c" 1>&6 +echo "configure:5274: checking if struct stat contains st_atimensec" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_st_atimensec'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 5279 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/stat.h> +int main() { +struct stat s; s.st_atimensec = 0; +; return 0; } +EOF +if { (eval echo configure:5287: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st_atimensec=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_st_atimensec=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_st_atimensec" 1>&6 +if test $ac_cv_struct_st_atimensec = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ST_ATIMENSEC 1 +EOF + +fi +echo $ac_n "checking if struct stat contains st_atim.tv_nsec""... $ac_c" 1>&6 +echo "configure:5307: checking if struct stat contains st_atim.tv_nsec" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_st_nsec'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 5312 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/stat.h> +int main() { +struct stat s; s.st_atim.tv_nsec = 0; +; return 0; } +EOF +if { (eval echo configure:5320: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st_nsec=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_st_nsec=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_st_nsec" 1>&6 +if test $ac_cv_struct_st_nsec = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ST_NSEC 1 +EOF + +fi +echo $ac_n "checking if struct stat contains st_atim.st__tim.tv_nsec""... $ac_c" 1>&6 +echo "configure:5340: checking if struct stat contains st_atim.st__tim.tv_nsec" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_st__tim'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 5345 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/stat.h> +int main() { +struct stat s; s.st_atim.st__tim.tv_nsec = 0; +; return 0; } +EOF +if { (eval echo configure:5353: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st__tim=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_st__tim=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_st__tim" 1>&6 +if test $ac_cv_struct_st__tim = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ST__TIM 1 +EOF + +fi +echo $ac_n "checking if struct stat contains st_atimespec.tv_nsec""... $ac_c" 1>&6 +echo "configure:5373: checking if struct stat contains st_atimespec.tv_nsec" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_st_atimespec'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 5378 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/stat.h> +int main() { +struct stat s; s.st_atimespec.tv_nsec = 0; +; return 0; } +EOF +if { (eval echo configure:5386: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st_atimespec=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_st_atimespec=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_st_atimespec" 1>&6 +if test $ac_cv_struct_st_atimespec = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ST_ATIMESPEC 1 +EOF + +fi +echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6 +echo "configure:5406: checking for st_blksize in struct stat" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 5411 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/stat.h> +int main() { +struct stat s; s.st_blksize; +; return 0; } +EOF +if { (eval echo configure:5419: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st_blksize=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_st_blksize=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_st_blksize" 1>&6 +if test $ac_cv_struct_st_blksize = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ST_BLKSIZE 1 +EOF + +fi + +echo $ac_n "checking for st_blocks in struct stat""... $ac_c" 1>&6 +echo "configure:5440: checking for st_blocks in struct stat" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_st_blocks'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 5445 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/stat.h> +int main() { +struct stat s; s.st_blocks; +; return 0; } +EOF +if { (eval echo configure:5453: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st_blocks=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_st_blocks=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_st_blocks" 1>&6 +if test $ac_cv_struct_st_blocks = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ST_BLOCKS 1 +EOF + +else + LIBOBJS="$LIBOBJS fileblocks.${ac_objext}" +fi + +echo $ac_n "checking if struct stat contains st_fstype""... $ac_c" 1>&6 +echo "configure:5476: checking if struct stat contains st_fstype" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_st_fstype'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 5481 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/stat.h> +int main() { +struct stat s; s.st_fstype[0] = 0; +; return 0; } +EOF +if { (eval echo configure:5489: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st_fstype=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_st_fstype=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_st_fstype" 1>&6 +if test $ac_cv_struct_st_fstype = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ST_FSTYPE 1 +EOF + +fi +echo $ac_n "checking for st_rdev in struct stat""... $ac_c" 1>&6 +echo "configure:5509: checking for st_rdev in struct stat" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_st_rdev'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 5514 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/stat.h> +int main() { +struct stat s; s.st_rdev; +; return 0; } +EOF +if { (eval echo configure:5522: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st_rdev=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_st_rdev=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_st_rdev" 1>&6 +if test $ac_cv_struct_st_rdev = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ST_RDEV 1 +EOF + +fi + +echo $ac_n "checking if struct stat contains st_flags""... $ac_c" 1>&6 +echo "configure:5543: checking if struct stat contains st_flags" >&5 +if eval "test \"`echo '$''{'ac_cv_struct_st_flags'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 5548 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/stat.h> +int main() { +struct stat s; s.st_flags = 0; +; return 0; } +EOF +if { (eval echo configure:5556: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_struct_st_flags=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_struct_st_flags=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_struct_st_flags" 1>&6 +if test $ac_cv_struct_st_flags = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ST_FLAGS 1 +EOF + +fi + +echo $ac_n "checking for wait3 that fills in rusage""... $ac_c" 1>&6 +echo "configure:5577: checking for wait3 that fills in rusage" >&5 +if eval "test \"`echo '$''{'ac_cv_func_wait3_rusage'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_wait3_rusage=no +else + cat > conftest.$ac_ext <<EOF +#line 5585 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/time.h> +#include <sys/resource.h> +#include <stdio.h> +/* HP-UX has wait3 but does not fill in rusage at all. */ +main() { + struct rusage r; + int i; + /* Use a field that we can force nonzero -- + voluntary context switches. + For systems like NeXT and OSF/1 that don't set it, + also use the system CPU time. And page faults (I/O) for Linux. */ + r.ru_nvcsw = 0; + r.ru_utime.tv_sec = 0; + r.ru_utime.tv_usec = 0; + r.ru_stime.tv_sec = 0; + r.ru_stime.tv_usec = 0; + r.ru_majflt = r.ru_minflt = 0; + switch (fork()) { + case 0: /* Child. */ + sleep(1); /* Give up the CPU. */ + for (i=200000; --i > 0;) getpid(); /* Use up some CPU time */ + _exit(0); + case -1: _exit(0); /* What can we do? */ + default: /* Parent. */ + wait3(&i, 0, &r); + sleep(2); /* Avoid "text file busy" from rm on fast HP-UX machines. */ + exit(r.ru_nvcsw == 0 && r.ru_majflt == 0 && r.ru_minflt == 0 + && r.ru_utime.tv_sec == 0 && r.ru_utime.tv_usec == 0 + && r.ru_stime.tv_sec == 0 && r.ru_stime.tv_usec == 0); + } +} +EOF +if { (eval echo configure:5620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_wait3_rusage=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_wait3_rusage=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_wait3_rusage" 1>&6 +if test $ac_cv_func_wait3_rusage = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_WAIT3 1 +EOF + +fi + +echo $ac_n "checking for mlock""... $ac_c" 1>&6 +echo "configure:5643: checking for mlock" >&5 +if eval "test \"`echo '$''{'ac_cv_func_mlock'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 5651 "configure" +#include "confdefs.h" + +#include <sys/types.h> +#include <errno.h> +#ifndef HAVE_ERRNO_DEF +extern int errno; +#endif + +main() +{ + if (mlock(0, 0) < 0) { + if (errno == EINVAL || errno == ENOMEM || + errno == EPERM || errno == EACCES) + exit(0); + exit(-1); + } + exit(0); +} +EOF +if { (eval echo configure:5671: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_mlock=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_mlock=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_mlock" 1>&6 +if test $ac_cv_func_mlock = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MLOCK 1 +EOF + +fi +echo $ac_n "checking for mlockall""... $ac_c" 1>&6 +echo "configure:5693: checking for mlockall" >&5 +if eval "test \"`echo '$''{'ac_cv_func_mlockall'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 5701 "configure" +#include "confdefs.h" + +#include <sys/types.h> +#include <sys/mman.h> +#include <errno.h> +#ifndef HAVE_ERRNO_DEF +extern int errno; +#endif + +int +main() +{ + if (mlockall(MCL_CURRENT|MCL_FUTURE) < 0) { + if (errno == EINVAL || errno == ENOMEM || + errno == EPERM || errno == EACCES) + exit(0); + exit(-1); + } + exit(0); +} + +EOF +if { (eval echo configure:5724: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_mlockall=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_mlockall=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_mlockall" 1>&6 +if test $ac_cv_func_mlockall = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MLOCKALL 1 +EOF + +fi +echo $ac_n "checking for va_copy""... $ac_c" 1>&6 +echo "configure:5746: checking for va_copy" >&5 +if eval "test \"`echo '$''{'ac_cv_func_va_copy'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 5751 "configure" +#include "confdefs.h" + +#ifdef HAVE_STDARG_H +# include <stdarg.h> +#else +# include <varargs.h> +#endif +int main() { + +va_list a, b; + +va_copy(a, b); +; return 0; } +EOF +if { (eval echo configure:5766: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_func_va_copy=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_func_va_copy=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_func_va_copy" 1>&6 +if test $ac_cv_func_va_copy = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_VA_COPY 1 +EOF + +fi +echo $ac_n "checking for __va_copy""... $ac_c" 1>&6 +echo "configure:5786: checking for __va_copy" >&5 +if eval "test \"`echo '$''{'ac_cv_func__va_copy'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 5791 "configure" +#include "confdefs.h" + +#ifdef HAVE_STDARG_H +# include <stdarg.h> +#else +# include <varargs.h> +#endif +int main() { + +va_list a, b; + +__va_copy(a, b); +; return 0; } +EOF +if { (eval echo configure:5806: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_func__va_copy=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_func__va_copy=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_func__va_copy" 1>&6 +if test $ac_cv_func__va_copy = yes; then + cat >> confdefs.h <<\EOF +#define HAVE__VA_COPY 1 +EOF + +fi +echo $ac_n "checking for working ecvt() ""... $ac_c" 1>&6 +echo "configure:5826: checking for working ecvt() " >&5 +if eval "test \"`echo '$''{'ac_cv_func_ecvt'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 5834 "configure" +#include "confdefs.h" + +extern char *ecvt(); + +sprintf(s) + char *s; +{ + strcpy(s, "DEAD"); +} + +int +main() +{ + int a, b; + +/* exit (strcmp("DEAD", ecvt(1.9, 2, &a, &b)) == 0);*/ + exit (strcmp("19", ecvt(1.9, 2, &a, &b)) != 0); +} +EOF +if { (eval echo configure:5854: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_ecvt=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_ecvt=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_ecvt" 1>&6 +if test $ac_cv_func_ecvt = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ECVT 1 +EOF + +fi +echo $ac_n "checking for working fcvt() ""... $ac_c" 1>&6 +echo "configure:5876: checking for working fcvt() " >&5 +if eval "test \"`echo '$''{'ac_cv_func_fcvt'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 5884 "configure" +#include "confdefs.h" + +extern char *fcvt(); + +sprintf(s) + char *s; +{ + strcpy(s, "DEAD"); +} + +int +main() +{ + int a, b; + +/* exit (strcmp("DEAD", fcvt(1.9, 2, &a, &b)) == 0);*/ + exit (strcmp("190", fcvt(1.9, 2, &a, &b)) != 0); +} +EOF +if { (eval echo configure:5904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_fcvt=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_fcvt=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_fcvt" 1>&6 +if test $ac_cv_func_fcvt = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_FCVT 1 +EOF + +fi +echo $ac_n "checking for working gcvt() ""... $ac_c" 1>&6 +echo "configure:5926: checking for working gcvt() " >&5 +if eval "test \"`echo '$''{'ac_cv_func_gcvt'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 5934 "configure" +#include "confdefs.h" + +extern char *gcvt(); + +sprintf(s) + char *s; +{ + strcpy(s, "DEAD"); +} + +int +main() +{ + char buf[32]; + +/* exit (strcmp("DEAD", gcvt(1.9, 10, buf)) == 0);*/ + exit (strcmp("1.9", gcvt(1.9, 10, buf)) != 0); +} +EOF +if { (eval echo configure:5954: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_gcvt=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_gcvt=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_gcvt" 1>&6 +if test $ac_cv_func_gcvt = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_GCVT 1 +EOF + +fi +echo $ac_n "checking for __dtoa""... $ac_c" 1>&6 +echo "configure:5976: checking for __dtoa" >&5 +if eval "test \"`echo '$''{'ac_cv_func_dtoa'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 5981 "configure" +#include "confdefs.h" +extern char *__dtoa(); +int main() { +int decpt; int sign; char *ep; char *bp; +bp = __dtoa(0.0, 2, 6, &decpt, &sign, &ep); +; return 0; } +EOF +if { (eval echo configure:5989: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_func_dtoa=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_func_dtoa=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_func_dtoa" 1>&6 +if test $ac_cv_func_dtoa = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_DTOA 1 +EOF + +fi +echo $ac_n "checking for __dtoa that needs result ptr""... $ac_c" 1>&6 +echo "configure:6009: checking for __dtoa that needs result ptr" >&5 +if eval "test \"`echo '$''{'ac_cv_func_dtoa_r'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 6017 "configure" +#include "confdefs.h" + +extern char *__dtoa(); +int +main() +{ +#ifdef HAVE_DTOA + int decpt, sign; + char *bp; + char *ep; + char *result; + + result = 0; + bp = __dtoa(1.9, 2, 5, &decpt, &sign, &ep, &result); + exit(result == 0); +#else + exit(1); +#endif +} +EOF +if { (eval echo configure:6038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_dtoa_r=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_dtoa_r=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_dtoa_r" 1>&6 +if test $ac_cv_func_dtoa_r = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_DTOA_R 1 +EOF + +fi +for ac_hdr in unistd.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:6063: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 6068 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:6073: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in getpagesize +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:6102: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 6107 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:6130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +echo $ac_n "checking for mmap that needs ptr to size""... $ac_c" 1>&6 +echo "configure:6155: checking for mmap that needs ptr to size" >&5 +if eval "test \"`echo '$''{'ac_cv_func_mmap_sizep'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_mmap_sizep=no +else + cat > conftest.$ac_ext <<EOF +#line 6163 "configure" +#include "confdefs.h" + +#include <sys/types.h> +#include <fcntl.h> +#include <signal.h> +#include <setjmp.h> +#include <sys/mman.h> + +#ifndef MAP_FILE +#define MAP_FILE 0 /* Needed on Apollo Domain/OS */ +#endif + +/* This mess was copied from the GNU getpagesize.h. */ +#ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include <unistd.h> +# endif + +/* Assume that all systems that can run configure have sys/param.h. */ +# ifndef HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# ifdef HAVE_SYS_PARAM_H +# include <sys/param.h> +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +#ifdef __cplusplus +extern "C" { void *malloc(unsigned); } +#else +char *malloc(); +#endif + +jmp_buf jenv; + +int +intr() +{ + signal(SIGSEGV, intr); + longjmp(jenv, 1); +} + +int +main() +{ + char *data, *data2; + int i, pagesize, ps; + int fd; + + pagesize = getpagesize(); + + /* + * First, make a file with some known garbage in it. + */ + data = malloc(pagesize); + if (!data) + exit(1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand(); + umask(0); + fd = creat("conftestmmap", 0600); + if (fd < 0) + exit(1); + if (write(fd, data, pagesize) != pagesize) + exit(1); + close(fd); + + /* + * Next, try to mmap the file at a fixed address which + * already has something else allocated at it. If we can, + * also make sure that we see the same garbage. + */ + fd = open("conftestmmap", O_RDWR); + if (fd < 0) + exit(1); + + /* + * Keep a copy, Apollo modifies the value... + */ + ps = pagesize; + + /* + * Apollo mmap() is not a syscall but a library function and fails + * if it tries to dereference 'ps'. We must use setjmp in order to + * catch the failure. + */ + signal(SIGSEGV, intr); + if (setjmp(jenv) == 0) { + data2 = mmap(0, ps, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0L); + } else { + data2 = (char *)-1; + } + if (data2 != (char *)-1) + exit(1); + + signal(SIGSEGV, intr); + if (setjmp(jenv) == 0) { + data2 = mmap(0, &ps, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0L); + } else { + data2 = (char *)-1; + } + if (data2 == (char *)-1) + exit(1); + + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit(1); + + close(fd); + unlink("conftestmmap"); + exit(0); +} + +EOF +if { (eval echo configure:6304: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_mmap_sizep=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_mmap_sizep=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_mmap_sizep" 1>&6 +if test $ac_cv_func_mmap_sizep = yes; then + cat >> confdefs.h <<\EOF +#define _MMAP_WITH_SIZEP 1 +EOF + +fi + +for ac_hdr in unistd.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:6330: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 6335 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:6340: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in getpagesize +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:6369: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 6374 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:6397: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +echo $ac_n "checking for working mmap""... $ac_c" 1>&6 +echo "configure:6422: checking for working mmap" >&5 +if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_mmap_fixed_mapped=no +else + cat > conftest.$ac_ext <<EOF +#line 6430 "configure" +#include "confdefs.h" + +/* Thanks to Mike Haertel and Jim Avera for this test. + Here is a matrix of mmap possibilities: + mmap private not fixed + mmap private fixed at somewhere currently unmapped + mmap private fixed at somewhere already mapped + mmap shared not fixed + mmap shared fixed at somewhere currently unmapped + mmap shared fixed at somewhere already mapped + For private mappings, we should verify that changes cannot be read() + back from the file, nor mmap's back from the file at a different + address. (There have been systems where private was not correctly + implemented like the infamous i386 svr4.0, and systems where the + VM page cache was not coherent with the filesystem buffer cache + like early versions of FreeBSD and possibly contemporary NetBSD.) + For shared mappings, we should conversely verify that changes get + propogated back to all the places they're supposed to be. + + Grep wants private fixed already mapped. + The main things grep needs to know about mmap are: + * does it exist and is it safe to write into the mmap'd area + * how to use it (BSD variants) */ +#include <sys/types.h> +#include <fcntl.h> +#include <sys/mman.h> + +/* + * Needed for Apollo Domain/OS and may be for others? + */ +#ifdef _MMAP_WITH_SIZEP +# define mmap_sizeparm(s) (&(s)) +#else +# define mmap_sizeparm(s) (s) +#endif + +/* This mess was copied from the GNU getpagesize.h. */ +#ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include <unistd.h> +# endif + +/* Assume that all systems that can run configure have sys/param.h. */ +# ifndef HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# ifdef HAVE_SYS_PARAM_H +# include <sys/param.h> +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +#ifdef __cplusplus +extern "C" { void *malloc(unsigned); } +#else +char *malloc(); +#endif + +int +main() +{ + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize(); + + /* + * First, make a file with some known garbage in it. + */ + data = malloc(pagesize); + if (!data) + exit(1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand(); + umask(0); + fd = creat("conftestmmap", 0600); + if (fd < 0) + exit(1); + if (write(fd, data, pagesize) != pagesize) + exit(1); + close(fd); + + /* + * Next, try to mmap the file at a fixed address which + * already has something else allocated at it. If we can, + * also make sure that we see the same garbage. + */ + fd = open("conftestmmap", O_RDWR); + if (fd < 0) + exit(1); + data2 = malloc(2 * pagesize); + if (!data2) + exit(1); + data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap(data2, mmap_sizeparm(pagesize), PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit(1); + + /* + * Finally, make sure that changes to the mapped area + * do not percolate back to the file as seen by read(). + * (This is a bug on some variants of i386 svr4.0.) + */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = malloc(pagesize); + if (!data3) + exit(1); + if (read(fd, data3, pagesize) != pagesize) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit(1); + close(fd); + unlink("conftestmmap"); + exit(0); +} + +EOF +if { (eval echo configure:6579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_mmap_fixed_mapped=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_mmap_fixed_mapped=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6 +if test $ac_cv_func_mmap_fixed_mapped = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MMAP 1 +EOF + +fi + +for ac_hdr in unistd.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:6605: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 6610 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:6615: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in getpagesize +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:6644: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 6649 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:6672: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +echo $ac_n "checking for mmap that needs ptr to size""... $ac_c" 1>&6 +echo "configure:6697: checking for mmap that needs ptr to size" >&5 +if eval "test \"`echo '$''{'ac_cv_func_mmap_sizep'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_mmap_sizep=no +else + cat > conftest.$ac_ext <<EOF +#line 6705 "configure" +#include "confdefs.h" + +#include <sys/types.h> +#include <fcntl.h> +#include <signal.h> +#include <setjmp.h> +#include <sys/mman.h> + +#ifndef MAP_FILE +#define MAP_FILE 0 /* Needed on Apollo Domain/OS */ +#endif + +/* This mess was copied from the GNU getpagesize.h. */ +#ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include <unistd.h> +# endif + +/* Assume that all systems that can run configure have sys/param.h. */ +# ifndef HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# ifdef HAVE_SYS_PARAM_H +# include <sys/param.h> +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +#ifdef __cplusplus +extern "C" { void *malloc(unsigned); } +#else +char *malloc(); +#endif + +jmp_buf jenv; + +int +intr() +{ + signal(SIGSEGV, intr); + longjmp(jenv, 1); +} + +int +main() +{ + char *data, *data2; + int i, pagesize, ps; + int fd; + + pagesize = getpagesize(); + + /* + * First, make a file with some known garbage in it. + */ + data = malloc(pagesize); + if (!data) + exit(1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand(); + umask(0); + fd = creat("conftestmmap", 0600); + if (fd < 0) + exit(1); + if (write(fd, data, pagesize) != pagesize) + exit(1); + close(fd); + + /* + * Next, try to mmap the file at a fixed address which + * already has something else allocated at it. If we can, + * also make sure that we see the same garbage. + */ + fd = open("conftestmmap", O_RDWR); + if (fd < 0) + exit(1); + + /* + * Keep a copy, Apollo modifies the value... + */ + ps = pagesize; + + /* + * Apollo mmap() is not a syscall but a library function and fails + * if it tries to dereference 'ps'. We must use setjmp in order to + * catch the failure. + */ + signal(SIGSEGV, intr); + if (setjmp(jenv) == 0) { + data2 = mmap(0, ps, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0L); + } else { + data2 = (char *)-1; + } + if (data2 != (char *)-1) + exit(1); + + signal(SIGSEGV, intr); + if (setjmp(jenv) == 0) { + data2 = mmap(0, &ps, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0L); + } else { + data2 = (char *)-1; + } + if (data2 == (char *)-1) + exit(1); + + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit(1); + + close(fd); + unlink("conftestmmap"); + exit(0); +} + +EOF +if { (eval echo configure:6846: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_mmap_sizep=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_mmap_sizep=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_mmap_sizep" 1>&6 +if test $ac_cv_func_mmap_sizep = yes; then + cat >> confdefs.h <<\EOF +#define _MMAP_WITH_SIZEP 1 +EOF + +fi + +echo $ac_n "checking if mmap works to get shared memory""... $ac_c" 1>&6 +echo "configure:6869: checking if mmap works to get shared memory" >&5 +if eval "test \"`echo '$''{'ac_cv_func_smmap'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_smmap=no +else + cat > conftest.$ac_ext <<EOF +#line 6877 "configure" +#include "confdefs.h" + +#include <sys/types.h> +#include <sys/mman.h> + +#ifndef MAP_ANONYMOUS +# ifdef MAP_ANON +# define MAP_ANONYMOUS MAP_ANON +# endif +#endif + +/* + * Needed for Apollo Domain/OS and may be for others? + */ +#ifdef _MMAP_WITH_SIZEP +# define mmap_sizeparm(s) (&(s)) +#else +# define mmap_sizeparm(s) (s) +#endif + +char * +mkshare() +{ + int size = 8192; + int f; + char *addr; + +#ifdef MAP_ANONYMOUS /* HP/UX */ + f = -1; + addr = mmap(0, mmap_sizeparm(size), PROT_READ|PROT_WRITE, MAP_SHARED|MAP_ANONYMOUS, f, 0); +#else + if ((f = open("/dev/zero", 2)) < 0) + exit(1); + addr = mmap(0, mmap_sizeparm(size), PROT_READ|PROT_WRITE, MAP_SHARED, f, 0); +#endif + if (addr == (char *)-1) + exit(1); + close(f); + + return (addr); +} + +int +main() +{ + char *addr; + + addr = mkshare(); + *addr = 'I'; + + switch (fork()) { + + case -1: + printf("help\n"); exit(1); + + case 0: /* child */ + *addr = 'N'; + _exit(0); + break; + default: /* parent */ + wait(0); + sleep(1); + break; + } + + if (*addr != 'N') + exit(1); + exit(0); +} + +EOF +if { (eval echo configure:6949: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_smmap=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_smmap=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_smmap" 1>&6 +if test $ac_cv_func_smmap = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_SMMAP 1 +EOF + +fi +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 +echo "configure:6973: checking for working alloca.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 6978 "configure" +#include "confdefs.h" +#include <alloca.h> +int main() { +char *p = alloca(2 * sizeof(int)); +; return 0; } +EOF +if { (eval echo configure:6985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_header_alloca_h=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_alloca_h=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_alloca_h" 1>&6 +if test $ac_cv_header_alloca_h = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ALLOCA_H 1 +EOF + +fi + +echo $ac_n "checking for alloca""... $ac_c" 1>&6 +echo "configure:7006: checking for alloca" >&5 +if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 7011 "configure" +#include "confdefs.h" + +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER +# include <malloc.h> +# define alloca _alloca +# else +# if HAVE_ALLOCA_H +# include <alloca.h> +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +char *alloca (); +# endif +# endif +# endif +# endif +#endif + +int main() { +char *p = (char *) alloca(1); +; return 0; } +EOF +if { (eval echo configure:7039: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_func_alloca_works=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_func_alloca_works=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_func_alloca_works" 1>&6 +if test $ac_cv_func_alloca_works = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ALLOCA 1 +EOF + +fi + +if test $ac_cv_func_alloca_works = no; then + # The SVR3 libPW and SVR4 libucb both contain incompatible functions + # that cause trouble. Some versions do not even contain alloca or + # contain a buggy version. If you still want to use their alloca, + # use ar to extract alloca.o from them instead of compiling alloca.c. + ALLOCA=alloca.${ac_objext} + cat >> confdefs.h <<\EOF +#define C_ALLOCA 1 +EOF + + +echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 +echo "configure:7071: checking whether alloca needs Cray hooks" >&5 +if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 7076 "configure" +#include "confdefs.h" +#if defined(CRAY) && ! defined(CRAY2) +webecray +#else +wenotbecray +#endif + +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "webecray" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_os_cray=yes +else + rm -rf conftest* + ac_cv_os_cray=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_os_cray" 1>&6 +if test $ac_cv_os_cray = yes; then +for ac_func in _getb67 GETB67 getb67; do + echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:7101: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 7106 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:7129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<EOF +#define CRAY_STACKSEG_END $ac_func +EOF + + break +else + echo "$ac_t""no" 1>&6 +fi + +done +fi + +echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 +echo "configure:7156: checking stack direction for C alloca" >&5 +if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_c_stack_direction=0 +else + cat > conftest.$ac_ext <<EOF +#line 7164 "configure" +#include "confdefs.h" +find_stack_direction () +{ + static char *addr = 0; + auto char dummy; + if (addr == 0) + { + addr = &dummy; + return find_stack_direction (); + } + else + return (&dummy > addr) ? 1 : -1; +} +main () +{ + exit (find_stack_direction() < 0); +} +EOF +if { (eval echo configure:7183: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_c_stack_direction=1 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_c_stack_direction=-1 +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_c_stack_direction" 1>&6 +cat >> confdefs.h <<EOF +#define STACK_DIRECTION $ac_cv_c_stack_direction +EOF + +fi + +echo $ac_n "checking if quotactl is an ioctl""... $ac_c" 1>&6 +echo "configure:7205: checking if quotactl is an ioctl" >&5 +if eval "test \"`echo '$''{'ac_cv_func_quotaioctl'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 7210 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <sys/fs/ufs_quota.h> +int main() { +struct quotctl q; ioctl(0, Q_QUOTACTL, &q) +; return 0; } +EOF +if { (eval echo configure:7218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_func_quotaioctl=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_func_quotaioctl=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_func_quotaioctl" 1>&6 +if test $ac_cv_func_quotaioctl = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_QUOTAIOCTL 1 +EOF + +fi +echo $ac_n "checking for file locking via fcntl""... $ac_c" 1>&6 +echo "configure:7238: checking for file locking via fcntl" >&5 +if eval "test \"`echo '$''{'ac_cv_func_fcntl_lock'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 7243 "configure" +#include "confdefs.h" + +#include <sys/types.h> +#include <fcntl.h> +int main() { + +struct flock fl; +fcntl(0, F_SETLK, &fl); +; return 0; } +EOF +if { (eval echo configure:7254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_func_fcntl_lock=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_func_fcntl_lock=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_func_fcntl_lock" 1>&6 +if test $ac_cv_func_fcntl_lock = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_FCNTL_LOCKF 1 +EOF + +fi +echo $ac_n "checking for uname""... $ac_c" 1>&6 +echo "configure:7274: checking for uname" >&5 +if eval "test \"`echo '$''{'ac_cv_func_uname'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 7279 "configure" +#include "confdefs.h" +#include <sys/utsname.h> +int main() { +struct utsname un; +uname(&un); +; return 0; } +EOF +if { (eval echo configure:7287: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_func_uname=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_func_uname=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_func_uname" 1>&6 +if test $ac_cv_func_uname = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_UNAME 1 +EOF + +fi +ac_safe=`echo "vfork.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for vfork.h""... $ac_c" 1>&6 +echo "configure:7308: checking for vfork.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 7313 "configure" +#include "confdefs.h" +#include <vfork.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:7318: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_VFORK_H 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +echo $ac_n "checking for working vfork""... $ac_c" 1>&6 +echo "configure:7343: checking for working vfork" >&5 +if eval "test \"`echo '$''{'ac_cv_func_vfork_works'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + echo $ac_n "checking for vfork""... $ac_c" 1>&6 +echo "configure:7349: checking for vfork" >&5 +if eval "test \"`echo '$''{'ac_cv_func_vfork'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 7354 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char vfork(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char vfork(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_vfork) || defined (__stub___vfork) +choke me +#else +vfork(); +#endif + +; return 0; } +EOF +if { (eval echo configure:7377: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_vfork=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_vfork=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'vfork`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +fi + +ac_cv_func_vfork_works=$ac_cv_func_vfork +else + cat > conftest.$ac_ext <<EOF +#line 7399 "configure" +#include "confdefs.h" +/* Thanks to Paul Eggert for this test. */ +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif +#ifdef HAVE_VFORK_H +#include <vfork.h> +#endif +/* On some sparc systems, changes by the child to local and incoming + argument registers are propagated back to the parent. + The compiler is told about this with #include <vfork.h>, + but some compilers (e.g. gcc -O) don't grok <vfork.h>. + Test for this by using a static variable whose address + is put into a register that is clobbered by the vfork. */ +static +#ifdef __cplusplus +sparc_address_test (int arg) +#else +sparc_address_test (arg) int arg; +#endif +{ + static pid_t child; + if (!child) { + child = vfork (); + if (child < 0) { + perror ("vfork"); + _exit(2); + } + if (!child) { + arg = getpid(); + write(-1, "", 0); + _exit (arg); + } + } +} +main() { + pid_t parent = getpid (); + pid_t child; + + sparc_address_test (); + + child = vfork (); + + if (child == 0) { + /* Here is another test for sparc vfork register problems. + This test uses lots of local variables, at least + as many local variables as main has allocated so far + including compiler temporaries. 4 locals are enough for + gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. + A buggy compiler should reuse the register of parent + for one of the local variables, since it will think that + parent can't possibly be used any more in this routine. + Assigning to the local variable will thus munge parent + in the parent process. */ + pid_t + p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), + p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); + /* Convince the compiler that p..p7 are live; otherwise, it might + use the same hardware register for all 8 local variables. */ + if (p != p1 || p != p2 || p != p3 || p != p4 + || p != p5 || p != p6 || p != p7) + _exit(1); + + /* On some systems (e.g. IRIX 3.3), + vfork doesn't separate parent from child file descriptors. + If the child closes a descriptor before it execs or exits, + this munges the parent's descriptor as well. + Test for this by closing stdout in the child. */ + _exit(close(fileno(stdout)) != 0); + } else { + int status; + struct stat st; + + while (wait(&status) != child) + ; + exit( + /* Was there some problem with vforking? */ + child < 0 + + /* Did the child fail? (This shouldn't happen.) */ + || status + + /* Did the vfork/compiler bug occur? */ + || parent != getpid() + + /* Did the file descriptor bug occur? */ + || fstat(fileno(stdout), &st) != 0 + ); + } +} +EOF +if { (eval echo configure:7494: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_vfork_works=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_vfork_works=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_vfork_works" 1>&6 +if test $ac_cv_func_vfork_works = no; then + cat >> confdefs.h <<\EOF +#define vfork fork +EOF + +fi + +echo $ac_n "checking for sys_siglist""... $ac_c" 1>&6 +echo "configure:7517: checking for sys_siglist" >&5 +if eval "test \"`echo '$''{'ac_cv_func_sys_siglist'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 7525 "configure" +#include "confdefs.h" + +int +main() +{ extern char *sys_siglist[]; +if (sys_siglist[1] == 0) + exit(1); +exit(0);} +EOF +if { (eval echo configure:7535: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_sys_siglist=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_sys_siglist=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_sys_siglist" 1>&6 +if test $ac_cv_func_sys_siglist = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_SYS_SIGLIST 1 +EOF + +fi +echo $ac_n "checking for BSD compliant getpgrp""... $ac_c" 1>&6 +echo "configure:7557: checking for BSD compliant getpgrp" >&5 +if eval "test \"`echo '$''{'ac_cv_func_bsd_getpgrp'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 7565 "configure" +#include "confdefs.h" + +int +main() +{ long p; +/* + * POSIX getpgrp() has void parameter... + */ + p = getpgrp(-1); + if (p == getpgrp(1) && p == getpgrp(getpid())) + exit(1); +exit(0);} +EOF +if { (eval echo configure:7579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_bsd_getpgrp=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_bsd_getpgrp=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_bsd_getpgrp" 1>&6 +if test $ac_cv_func_bsd_getpgrp = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_BSD_GETPGRP 1 +EOF + +fi +echo $ac_n "checking for BSD compliant setpgrp""... $ac_c" 1>&6 +echo "configure:7601: checking for BSD compliant setpgrp" >&5 +if eval "test \"`echo '$''{'ac_cv_func_bsd_setpgrp'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 7609 "configure" +#include "confdefs.h" + +#include <errno.h> +#ifndef HAVE_ERRNO_DEF +extern int errno; +#endif +int +main() +{ errno = 0; +/* + * Force illegal pid on BSD + */ +if (setpgrp(-1, 100) < 0 && errno == ESRCH) + exit(0); +exit(1);} +EOF +if { (eval echo configure:7626: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_func_bsd_setpgrp=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_bsd_setpgrp=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_bsd_setpgrp" 1>&6 +if test $ac_cv_func_bsd_setpgrp = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_BSD_SETPGRP 1 +EOF + +fi +for ac_func in access eaccess euidaccess +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:7650: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 7655 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:7678: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in brk sbrk strerror nice memmove flock lockf fchdir statvfs quotactl +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:7705: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 7710 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:7733: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in dup2 +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:7760: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 7765 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:7788: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in getcwd shmat semget +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:7815: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 7820 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:7843: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in lstat readlink symlink link rename mkfifo mknod +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:7870: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 7875 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:7898: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in setreuid setresuid seteuid setuid +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:7925: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 7930 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:7953: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in setregid setresgid setegid setgid +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:7980: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 7985 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8008: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in getpgid setpgid +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:8035: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 8040 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8063: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in getpgrp setpgrp +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:8090: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 8095 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8118: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in getspnam getspwnam +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:8145: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 8150 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8173: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in sync fsync fork wait4 waitid waitpid getrusage getrlimit setrlimit ulimit +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:8200: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 8205 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in execl execle execlp execv execve execvp +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:8255: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 8260 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in gethostid gethostname getdomainname getpagesize getdtablesize +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:8310: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 8315 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8338: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in gettimeofday settimeofday time stime +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:8365: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 8370 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in poll select chown lchown times utime utimes +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:8420: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 8425 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in ecvt_r fcvt_r gcvt_r +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:8475: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 8480 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8503: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in econvert fconvert gconvert +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:8530: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 8535 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in isinf isnan +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:8585: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 8590 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8613: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in rand drand48 +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:8640: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 8645 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8668: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in setpriority DosSetPriority +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:8695: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 8700 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8723: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in DosAllocSharedMem +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:8750: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 8755 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8778: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in seekdir +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:8805: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 8810 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8833: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in strsignal str2sig sig2str +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:8860: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 8865 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in killpg sigrelse sigprocmask sigsetmask sigset +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:8915: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 8920 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in nanosleep usleep +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:8970: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 8975 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:8998: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in tcgetattr tcsetattr +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:9025: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 9030 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:9053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in putenv setenv snprintf strcasecmp strdup +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:9080: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 9085 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:9108: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in valloc +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:9135: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 9140 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:9163: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in madvise +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:9190: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 9195 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:9218: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in chflags fchflags fflagstostr strtofflags +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:9245: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 9250 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:9273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in fnmatch +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:9300: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 9305 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:9328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +echo $ac_n "checking if we may not define our own malloc()""... $ac_c" 1>&6 +echo "configure:9354: checking if we may not define our own malloc()" >&5 +if eval "test \"`echo '$''{'ac_cv_no_user_malloc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 9362 "configure" +#include "confdefs.h" + +static int mcalled; +char * +malloc(s) + int s; +{ + extern char *sbrk(); + + mcalled++; + _exit(0); + return (sbrk(s)); +} + +free(p) char *p;{} + +main() +{ +#ifdef HAVE_STRDUP + strdup("aaa"); +#else + exit(0); +#endif + exit(1);} +EOF +if { (eval echo configure:9388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_no_user_malloc=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_no_user_malloc=yes +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_no_user_malloc" 1>&6 +if test $ac_cv_no_user_malloc = yes; then + cat >> confdefs.h <<\EOF +#define NO_USER_MALLOC 1 +EOF + +fi + +echo $ac_n "checking if link() allows hard links on symlinks""... $ac_c" 1>&6 +echo "configure:9411: checking if link() allows hard links on symlinks" >&5 +if eval "test \"`echo '$''{'ac_cv_hard_symlinks'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 9419 "configure" +#include "confdefs.h" + +main() +{ + int ret = 0; + + unlink("confdefs.f1"); + unlink("confdefs.l1"); + unlink("confdefs.h1"); + + if (symlink("confdefs.f1", "confdefs.l1") < 0) + ret = 1; + if (link("confdefs.l1", "confdefs.h1") < 0) + ret = 1; + + unlink("confdefs.l1"); + unlink("confdefs.h1"); + + exit(ret); +} +EOF +if { (eval echo configure:9441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_hard_symlinks=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_hard_symlinks=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_hard_symlinks" 1>&6 +if test $ac_cv_hard_symlinks = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_HARD_SYMLINKS 1 +EOF + +fi +echo $ac_n "checking if link() does not folow symlinks""... $ac_c" 1>&6 +echo "configure:9463: checking if link() does not folow symlinks" >&5 +if eval "test \"`echo '$''{'ac_cv_link_nofollow'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 9471 "configure" +#include "confdefs.h" + +#include <sys/types.h> +#include <sys/stat.h> + +main() +{ + int ret = 0; + int f; + struct stat sb; + + unlink("confdefs.f1"); + unlink("confdefs.l1"); + unlink("confdefs.h1"); + + f = creat("confdefs.f1", 0666); + close(f); + if (symlink("confdefs.f1", "confdefs.l1") < 0) + ret = 1; + if (link("confdefs.l1", "confdefs.h1") < 0) + ret = 1; + + stat("confdefs.f1", &sb); + if (sb.st_nlink == 2) + ret = 1; + + unlink("confdefs.f1"); + unlink("confdefs.l1"); + unlink("confdefs.h1"); + + exit(ret); +} +EOF +if { (eval echo configure:9505: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_link_nofollow=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_link_nofollow=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_link_nofollow" 1>&6 +if test $ac_cv_link_nofollow = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_LINK_NOFOLLOW 1 +EOF + +fi +for ac_hdr in unistd.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:9530: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 9535 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:9540: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +echo $ac_n "checking if access() does implement E_OK""... $ac_c" 1>&6 +echo "configure:9567: checking if access() does implement E_OK" >&5 +if eval "test \"`echo '$''{'ac_cv_access_e_ok'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } +else + cat > conftest.$ac_ext <<EOF +#line 9575 "configure" +#include "confdefs.h" + +# ifdef HAVE_UNISTD_H +# include <unistd.h> +# endif +#ifndef R_OK +#define R_OK 4 /* Test for Read permission */ +#define W_OK 2 /* Test for Write permission */ +#define X_OK 1 /* Test for eXecute permission */ +#define F_OK 0 /* Test for existence of File */ +#endif + +#ifndef E_OK +#ifdef EFF_ONLY_OK +#define E_OK EFF_ONLY_OK /* Irix */ +#else +#ifdef EUID_OK +#define E_OK EUID_OK /* UNICOS (0400) */ +#else +#define E_OK 010 /* Test effective uids */ +#endif +#endif +#endif + +#include <errno.h> +#ifndef HAVE_ERRNO_DEF +extern int errno; +#endif + +main() +{ + int ret = 0; + + if (access(".", F_OK) != 0) + ret = 1; + else if (access(".", E_OK|F_OK) != 0) + ret = 1; + else if (access(".", (R_OK<<4)|F_OK) == 0) + ret = 1; + + + exit(ret); +} +EOF +if { (eval echo configure:9620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +then + ac_cv_access_e_ok=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_access_e_ok=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_access_e_ok" 1>&6 +if test $ac_cv_access_e_ok = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_ACCESS_E_OK 1 +EOF + +fi + + +echo $ac_n "checking for fseeko()""... $ac_c" 1>&6 +echo "configure:9644: checking for fseeko()" >&5 +if eval "test \"`echo '$''{'ac_cv_func_fseeko'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 9649 "configure" +#include "confdefs.h" +#include <stdio.h> +int main() { +return !fseeko; +; return 0; } +EOF +if { (eval echo configure:9656: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_func_fseeko=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_func_fseeko=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_func_fseeko" 1>&6 +if test $ac_cv_func_fseeko = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_FSEEKO 1 +EOF + +fi +echo $ac_n "checking for ftello()""... $ac_c" 1>&6 +echo "configure:9676: checking for ftello()" >&5 +if eval "test \"`echo '$''{'ac_cv_func_ftello'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 9681 "configure" +#include "confdefs.h" +#include <stdio.h> +int main() { +return !ftello; +; return 0; } +EOF +if { (eval echo configure:9688: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + ac_cv_func_ftello=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_func_ftello=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_func_ftello" 1>&6 +if test $ac_cv_func_ftello = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_FTELLO 1 +EOF + +fi + +echo $ac_n "checking for rcmd in -lsocket""... $ac_c" 1>&6 +echo "configure:9709: checking for rcmd in -lsocket" >&5 +ac_lib_var=`echo socket'_'rcmd | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lsocket $LIBS" +cat > conftest.$ac_ext <<EOF +#line 9717 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char rcmd(); + +int main() { +rcmd() +; return 0; } +EOF +if { (eval echo configure:9728: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lib_socket="-lsocket" +else + echo "$ac_t""no" 1>&6 +fi + +ac_save_LIBS="$LIBS" +LIBS="$LIBS $lib_socket" +echo $ac_n "checking for inet_ntoa in -lnsl""... $ac_c" 1>&6 +echo "configure:9751: checking for inet_ntoa in -lnsl" >&5 +ac_lib_var=`echo nsl'_'inet_ntoa | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lnsl $LIBS" +cat > conftest.$ac_ext <<EOF +#line 9759 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char inet_ntoa(); + +int main() { +inet_ntoa() +; return 0; } +EOF +if { (eval echo configure:9770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lib_nsl="-lnsl" +else + echo "$ac_t""no" 1>&6 +fi + +LIBS="$LIBS $lib_nsl" +for ac_func in rcmd socket socketpair +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:9794: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 9799 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:9822: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in getservbyname inet_ntoa +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:9849: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 9854 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:9877: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in getaddrinfo getnameinfo +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:9904: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 9909 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:9932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +LIBS="$ac_save_LIBS" + +# Check whether --enable-largefile or --disable-largefile was given. +if test "${enable_largefile+set}" = set; then + enableval="$enable_largefile" + : +fi + + if test "$enable_largefile" != no; then + + echo $ac_n "checking for special C compiler options needed for large files""... $ac_c" 1>&6 +echo "configure:9967: checking for special C compiler options needed for large files" >&5 +if eval "test \"`echo '$''{'ac_cv_sys_largefile_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_sys_largefile_CC=no + largefile_cc_opt="" + if test "$GCC" != yes; then + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat > conftest.$ac_ext <<EOF +#line 9977 "configure" +#include "confdefs.h" +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply "#define LARGE_OFF_T 9223372036854775807", + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +# define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; + +int main() { + +; return 0; } +EOF +if { (eval echo configure:9993: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_save_CC="${CC-cc}" + CC="$CC -n32" + cat > conftest.$ac_ext <<EOF +#line 10002 "configure" +#include "confdefs.h" +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply "#define LARGE_OFF_T 9223372036854775807", + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +# define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; + +int main() { + +; return 0; } +EOF +if { (eval echo configure:10018: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sys_largefile_CC=' -n32' +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + CC="$ac_save_CC" +fi +rm -f conftest* + fi +fi + +echo "$ac_t""$ac_cv_sys_largefile_CC" 1>&6 + if test "$ac_cv_sys_largefile_CC" != no; then + CC="$CC$ac_cv_sys_largefile_CC" + largefile_cc_opt="$ac_cv_sys_largefile_CC" + fi + + echo $ac_n "checking for _FILE_OFFSET_BITS value needed for large files""... $ac_c" 1>&6 +echo "configure:10039: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +if eval "test \"`echo '$''{'ac_cv_sys_file_offset_bits'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_sys_file_offset_bits=no + cat > conftest.$ac_ext <<EOF +#line 10045 "configure" +#include "confdefs.h" +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply "#define LARGE_OFF_T 9223372036854775807", + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +# define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; + +int main() { + +; return 0; } +EOF +if { (eval echo configure:10061: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat > conftest.$ac_ext <<EOF +#line 10068 "configure" +#include "confdefs.h" +#define _FILE_OFFSET_BITS 64 +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply "#define LARGE_OFF_T 9223372036854775807", + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +# define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; + + +int main() { + +; return 0; } +EOF +if { (eval echo configure:10086: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sys_file_offset_bits=64 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_sys_file_offset_bits" 1>&6 + if test "$ac_cv_sys_file_offset_bits" != no; then + cat >> confdefs.h <<EOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits +EOF + + fi + echo $ac_n "checking for _LARGE_FILES value needed for large files""... $ac_c" 1>&6 +echo "configure:10106: checking for _LARGE_FILES value needed for large files" >&5 +if eval "test \"`echo '$''{'ac_cv_sys_large_files'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_sys_large_files=no + cat > conftest.$ac_ext <<EOF +#line 10112 "configure" +#include "confdefs.h" +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply "#define LARGE_OFF_T 9223372036854775807", + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +# define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; + +int main() { + +; return 0; } +EOF +if { (eval echo configure:10128: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat > conftest.$ac_ext <<EOF +#line 10135 "configure" +#include "confdefs.h" +#define _LARGE_FILES 1 +#include <sys/types.h> + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply "#define LARGE_OFF_T 9223372036854775807", + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +# define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; + + +int main() { + +; return 0; } +EOF +if { (eval echo configure:10153: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sys_large_files=1 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_sys_large_files" 1>&6 + if test "$ac_cv_sys_large_files" != no; then + cat >> confdefs.h <<EOF +#define _LARGE_FILES $ac_cv_sys_large_files +EOF + + fi + echo $ac_n "checking for _LARGEFILE_SOURCE value needed for large files""... $ac_c" 1>&6 +echo "configure:10173: checking for _LARGEFILE_SOURCE value needed for large files" >&5 +if eval "test \"`echo '$''{'ac_cv_sys_largefile_source'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_sys_largefile_source=no + cat > conftest.$ac_ext <<EOF +#line 10179 "configure" +#include "confdefs.h" +#include <stdio.h> +int main() { +return !fseeko; +; return 0; } +EOF +if { (eval echo configure:10186: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cat > conftest.$ac_ext <<EOF +#line 10193 "configure" +#include "confdefs.h" +#define _LARGEFILE_SOURCE 1 +#include <stdio.h> + +int main() { +return !fseeko; +; return 0; } +EOF +if { (eval echo configure:10202: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_sys_largefile_source=1 +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_sys_largefile_source" 1>&6 + if test "$ac_cv_sys_largefile_source" != no; then + cat >> confdefs.h <<EOF +#define _LARGEFILE_SOURCE $ac_cv_sys_largefile_source +EOF + + fi + fi + +echo $ac_n "checking if system supports Large Files at all""... $ac_c" 1>&6 +echo "configure:10224: checking if system supports Large Files at all" >&5 +if eval "test \"`echo '$''{'ac_cv_largefiles'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 10229 "configure" +#include "confdefs.h" +#include <stdio.h> +#include <sys/types.h> +int main() { + +/* + * Check that off_t can represent 2**63 - 1 correctly. + * We can't simply "#define LARGE_OFF_T 9223372036854775807", + * since some C++ compilers masquerading as C compilers + * incorrectly reject 9223372036854775807. + */ +# define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +return !fseeko; +return !ftello; +; return 0; } +EOF +if { (eval echo configure:10249: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_largefiles=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_largefiles=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_largefiles" 1>&6 + if test $ac_cv_largefiles = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_LARGEFILES 1 +EOF + + fi + +cat >> confdefs.h <<EOF +#define HOST_ALIAS "$host_alias" +EOF + +cat >> confdefs.h <<EOF +#define HOST_SUB "$host" +EOF + +cat >> confdefs.h <<EOF +#define HOST_CPU "$host_cpu" +EOF + +cat >> confdefs.h <<EOF +#define HOST_VENDOR "$host_vendor" +EOF + +cat >> confdefs.h <<EOF +#define HOST_OS "$host_os" +EOF + + + +echo $ac_n "checking for crypt in -lc""... $ac_c" 1>&6 +echo "configure:10292: checking for crypt in -lc" >&5 +ac_lib_var=`echo c'_'crypt | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lc $LIBS" +cat > conftest.$ac_ext <<EOF +#line 10300 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char crypt(); + +int main() { +crypt() +; return 0; } +EOF +if { (eval echo configure:10311: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lib_crypt="" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6 +echo "configure:10330: checking for crypt in -lcrypt" >&5 +ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lcrypt $LIBS" +cat > conftest.$ac_ext <<EOF +#line 10338 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char crypt(); + +int main() { +crypt() +; return 0; } +EOF +if { (eval echo configure:10349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lib_crypt="-lcrypt" +else + echo "$ac_t""no" 1>&6 +fi + +fi + + +ac_save_LIBS="$LIBS" +LIBS="$LIBS $lib_crypt" +for ac_func in crypt +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:10377: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 10382 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:10405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +LIBS="$ac_save_LIBS" + +if test $ac_cv_header_camlib_h = yes; then + scsi_lib=-lcam +fi + +if test "$ac_cv_header_sys_acl_h" = yes; then + + echo "checking for Posix Access Control List support" 1>&6 +echo "configure:10438: checking for Posix Access Control List support" >&5 + echo $ac_n "checking for acl_get_file in -lacl""... $ac_c" 1>&6 +echo "configure:10440: checking for acl_get_file in -lacl" >&5 +ac_lib_var=`echo acl'_'acl_get_file | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lacl $LIBS" +cat > conftest.$ac_ext <<EOF +#line 10448 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char acl_get_file(); + +int main() { +acl_get_file() +; return 0; } +EOF +if { (eval echo configure:10459: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lib_acl="-lacl" +else + echo "$ac_t""no" 1>&6 +fi + + echo $ac_n "checking for acl_get_file in -lpacl""... $ac_c" 1>&6 +echo "configure:10480: checking for acl_get_file in -lpacl" >&5 +ac_lib_var=`echo pacl'_'acl_get_file | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lpacl $LIBS" +cat > conftest.$ac_ext <<EOF +#line 10488 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char acl_get_file(); + +int main() { +acl_get_file() +; return 0; } +EOF +if { (eval echo configure:10499: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lib_acl="-lpacl" +else + echo "$ac_t""no" 1>&6 +fi + + + ac_save_LIBS="$LIBS" + LIBS="$LIBS $lib_acl" + for ac_func in acl_get_file acl_set_file acl_from_text acl_to_text acl_free acl_delete_def_file +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:10525: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 10530 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:10553: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + LIBS="$ac_save_LIBS" + + echo "checking for Solaris Access Control List support" 1>&6 +echo "configure:10580: checking for Solaris Access Control List support" >&5 + echo $ac_n "checking for acltotext in -lsec""... $ac_c" 1>&6 +echo "configure:10582: checking for acltotext in -lsec" >&5 +ac_lib_var=`echo sec'_'acltotext | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lsec $LIBS" +cat > conftest.$ac_ext <<EOF +#line 10590 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char acltotext(); + +int main() { +acltotext() +; return 0; } +EOF +if { (eval echo configure:10601: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lib_acl="-lsec" +else + echo "$ac_t""no" 1>&6 +fi + + ac_save_LIBS="$LIBS" + LIBS="$LIBS $lib_acl" + for ac_func in acl facl aclfromtext acltotext +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:10626: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 10631 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:10654: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + LIBS="$ac_save_LIBS" + + echo "checking for HP-UX Access Control List support" 1>&6 +echo "configure:10681: checking for HP-UX Access Control List support" >&5 + for ac_func in getacl fgetacl setacl fsetacl strtoacl acltostr cpacl fcpacl chownacl setaclentry fsetaclentry +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:10685: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 10690 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:10713: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + +fi + +if test "$ac_cv_header_attr_xattr_h" = yes; then + echo "checking for Extended Attribute support" 1>&6 +echo "configure:10742: checking for Extended Attribute support" >&5 + echo $ac_n "checking for getxattr in -lattr""... $ac_c" 1>&6 +echo "configure:10744: checking for getxattr in -lattr" >&5 +ac_lib_var=`echo attr'_'getxattr | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lattr $LIBS" +cat > conftest.$ac_ext <<EOF +#line 10752 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char getxattr(); + +int main() { +getxattr() +; return 0; } +EOF +if { (eval echo configure:10763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lib_attr="-lattr" +else + echo "$ac_t""no" 1>&6 +fi + + ac_save_LIBS="$LIBS" + LIBS="$LIBS $lib_attr" + for ac_func in getxattr setxattr listxattr +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:10788: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 10793 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:10816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + LIBS="$ac_save_LIBS" +fi + + + + + + + + +trap '' 1 2 15 +cat > confcache <<\EOF +# 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. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# 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. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir + +trap 'rm -fr `echo "rules.cnf xconfig.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@host@%$host%g +s%@host_alias@%$host_alias%g +s%@host_cpu@%$host_cpu%g +s%@host_vendor@%$host_vendor%g +s%@host_os@%$host_os%g +s%@EXEEXT@%$EXEEXT%g +s%@CPP@%$CPP%g +s%@RANLIB@%$RANLIB%g +s%@SET_MAKE@%$SET_MAKE%g +s%@LIBOBJS@%$LIBOBJS%g +s%@ALLOCA@%$ALLOCA%g +s%@largefile_cc_opt@%$largefile_cc_opt%g +s%@lib_crypt@%$lib_crypt%g +s%@scsi_lib@%$scsi_lib%g +s%@lib_acl@%$lib_acl%g +s%@lib_attr@%$lib_attr%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"rules.cnf"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <<EOF + CONFIG_HEADERS="xconfig.h" +EOF +cat >> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <<EOF + +EOF +cat >> $CONFIG_STATUS <<\EOF + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/scsilib/conf/configure.in b/scsilib/conf/configure.in new file mode 100644 index 0000000..b96fc69 --- /dev/null +++ b/scsilib/conf/configure.in @@ -0,0 +1,310 @@ +dnl @(#)configure.in 1.74 04/07/26 Copyright 1998-2003 J. Schilling +dnl Process this file with autoconf to produce a configure script. +AC_REVISION($Revision$)dnl + +AC_INIT(xconfig.h.in) +AC_CONFIG_HEADER(xconfig.h) +AC_CANONICAL_HOST + +dnl Checks for programs. +dnl CC=${CC-cc} +dnl AC_PROG_CC +AC_EXEEXT +AC_PROG_CPP +dnl AC_PROG_INSTALL +AC_PROG_RANLIB +AC_PROG_MAKE_SET + +dnl Checks for header files. +AC_HEADER_STDC +AC_HEADER_INTTYPES +AC_HEADER_DIRENT +AC_HEADER_STAT +AC_HEADER_TIME +AC_HEADER_SYS_WAIT +dnl check whether select() needs sys/select.h +AC_HEADER_SYS_SELECT +dnl check whether select() needs sys/socket.h (BeOS) +AC_HEADER_SELECT2 +AC_CHECK_HEADERS(varargs.h stdarg.h stdlib.h stddef.h string.h strings.h unistd.h fcntl.h sys/file.h) +AC_CHECK_HEADERS(getopt.h) +AC_CHECK_HEADERS(limits.h) +AC_CHECK_HEADERS(a.out.h aouthdr.h elf.h) +AC_CHECK_HEADERS(malloc.h termios.h termio.h) +AC_CHECK_HEADERS(pwd.h grp.h sys/acl.h acllib.h) +AC_CHECK_HEADERS(shadow.h syslog.h) +AC_CHECK_HEADERS(sys/time.h sys/times.h utime.h sys/utime.h sys/ioctl.h sys/filio.h sys/param.h sys/systeminfo.h) +AC_CHECK_HEADERS(sys/syscall.h) +AC_CHECK_HEADERS(mntent.h sys/mntent.h sys/mnttab.h sys/mount.h) +AC_CHECK_HEADERS(wait.h sys/resource.h sys/procfs.h) +AC_CHECK_HEADERS(sys/utsname.h sys/priocntl.h sys/rtpriocntl.h) +AC_CHECK_HEADERS(sys/mtio.h sys/tape.h sys/mman.h linux/pg.h camlib.h) +AC_CHECK_HEADERS(sys/shm.h sys/ipc.h) +AC_CHECK_HEADERS(sys/dkio.h sys/dklabel.h sun/dkio.h sun/dklabel.h) +AC_CHECK_HEADERS(sys/types.h sys/stat.h types.h stat.h) +AC_CHECK_HEADERS(poll.h sys/poll.h sys/select.h) +AC_CHECK_HEADERS(netdb.h sys/socket.h) +AC_CHECK_HEADERS(ieeefp.h fp.h) +AC_CHECK_HEADERS(values.h float.h) +AC_CHECK_HEADERS(arpa/inet.h) +AC_CHECK_HEADERS(bsd/dev/scsireg.h) +dnl Check for HP-UX sys/bsdtty.h (needed for TIOCGPGRP) +AC_CHECK_HEADERS(sys/bsdtty.h) +dnl Check for BeOS kernel definitions (e.g. B_PAGE_SIZE) +AC_CHECK_HEADERS(OS.h) +dnl Check for Linux Extended File Attributes definitions +AC_CHECK_HEADERS(attr/xattr.h) +AC_CHECK_HEADERS(fnmatch.h) + +dnl from aclocal.m4 (uses AC_TRY_COMPILE) +AC_HEADER_MAKEDEV + +dnl don't use GNU original +dnl from GNU acspecific.m4 (uses AC_CHECK_HEADER) +dnl AC_HEADER_MAJOR + +AC_CHECK_MINOR_BITS +AC_CHECK_MINOR_NONCONTIG + +AC_HEADER_USG_STDIO +AC_HEADER_ERRNO_DEF + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_C_BIGENDIAN +AC_C_BITFIELDS +AC_TYPE_SIGNAL +AC_TYPE_GETGROUPS +AC_TYPE_LONGLONG +AC_TYPE_PROTOTYPES +dnl AC_USER_MALLOC must be past AC_CHECK_FUNCS(strdup) +AC_DYN_ARRAYS + +AC_TYPE_UID_T +AC_TYPE_SIZE_T +AC_CHECK_TYPE(ssize_t, int) +AC_TYPE_PID_T +AC_TYPE_OFF_T +AC_TYPE_MODE_T +AC_TYPE_TIME_T +AC_CHECK_TYPE(caddr_t, char *) +AC_CHECK_TYPE(daddr_t, long) +AC_CHECK_TYPE(dev_t, unsigned short) +AC_CHECK_TYPE(ino_t, unsigned long) +AC_CHECK_TYPE(nlink_t, unsigned long) +AC_CHECK_TYPE(blksize_t, long) +AC_CHECK_TYPE(blkcnt_t, Intmax_t) +AC_TYPE_CLOCK_T +AC_TYPE_SOCKLEN_T + +dnl These types are present on all UNIX systems but should be avoided +dnl for portability. +dnl On Apollo/Domain OS we don't have them.... +dnl Better include <utypes.h> and use Uchar, Uint & Ulong +AC_CHECK_TYPE(u_char, unsigned char) +AC_CHECK_TYPE(u_short, unsigned short) +AC_CHECK_TYPE(u_int, unsigned int) +AC_CHECK_TYPE(u_long, unsigned long) + +AC_CHECK_SIZEOF(char) +AC_CHECK_SIZEOF(short int) +AC_CHECK_SIZEOF(int) +AC_CHECK_SIZEOF(long int) +AC_CHECK_SIZEOF(long long) +AC_CHECK_SIZEOF(char *) + +AC_CHECK_SIZEOF(unsigned char) +AC_CHECK_SIZEOF(unsigned short int) +AC_CHECK_SIZEOF(unsigned int) +AC_CHECK_SIZEOF(unsigned long int) +AC_CHECK_SIZEOF(unsigned long long) +AC_CHECK_SIZEOF(unsigned char *) + +dnl # AC_TYPE_SIZE_T_ # Defines HAVE_SIZE_T / NO_SIZE_T +AC_TYPE_CHAR +AC_TYPE_VA_LIST +AC_STRUCT_MTGET_TYPE +AC_STRUCT_MTGET_MODEL +AC_STRUCT_MTGET_DSREG +AC_STRUCT_MTGET_DSREG1 +AC_STRUCT_MTGET_DSREG2 +AC_STRUCT_MTGET_GSTAT +AC_STRUCT_MTGET_ERREG +AC_STRUCT_MTGET_RESID +AC_STRUCT_MTGET_FILENO +AC_STRUCT_MTGET_BLKNO +AC_STRUCT_MTGET_FLAGS +AC_STRUCT_MTGET_BF +AC_STRUCT_RUSAGE +AC_STRUCT_SI_UTIME +AC_STRUCT_SOCKADDR_STORAGE +AC_STRUCT_UNION_SEMUN +AC_STRUCT_UNION_WAIT +AC_STRUCT_ST_SPARE1 +AC_STRUCT_ST_ATIMENSEC +AC_STRUCT_ST_NSEC +AC_STRUCT_ST__TIM +AC_STRUCT_ST_ATIMESPEC +AC_STRUCT_ST_BLKSIZE +AC_STRUCT_ST_BLOCKS +AC_STRUCT_ST_FSTYPE +AC_STRUCT_ST_RDEV +AC_STRUCT_ST_FLAGS + +dnl Checks for library functions. +AC_FUNC_WAIT3 +AC_FUNC_MLOCK +AC_FUNC_MLOCKALL +AC_FUNC_VA_COPY +AC_FUNC__VA_COPY +AC_FUNC_ECVT +AC_FUNC_FCVT +AC_FUNC_GCVT +AC_FUNC_DTOA +AC_FUNC_DTOA_R +jsAC_FUNC_MMAP +AC_MMAP_SIZEP +AC_FUNC_SMMAP +AC_FUNC_ALLOCA +AC_FUNC_QUOTAIOCTL +AC_FUNC_FCNTL_LOCKF +AC_FUNC_UNAME +AC_FUNC_VFORK +AC_FUNC_SYS_SIGLIST +AC_FUNC_BSD_GETPGRP +AC_FUNC_BSD_SETPGRP +AC_CHECK_FUNCS(access eaccess euidaccess) +AC_CHECK_FUNCS(brk sbrk strerror nice memmove flock lockf fchdir statvfs quotactl) +AC_CHECK_FUNCS(dup2) +AC_CHECK_FUNCS(getcwd shmat semget) +AC_CHECK_FUNCS(lstat readlink symlink link rename mkfifo mknod) +AC_CHECK_FUNCS(setreuid setresuid seteuid setuid) +AC_CHECK_FUNCS(setregid setresgid setegid setgid) +AC_CHECK_FUNCS(getpgid setpgid) +AC_CHECK_FUNCS(getpgrp setpgrp) +dnl getspwnam() on HP-UX is in libsec.a +AC_CHECK_FUNCS(getspnam getspwnam) +AC_CHECK_FUNCS(sync fsync fork wait4 waitid waitpid getrusage getrlimit setrlimit ulimit) +AC_CHECK_FUNCS(execl execle execlp execv execve execvp) +AC_CHECK_FUNCS(gethostid gethostname getdomainname getpagesize getdtablesize) +AC_CHECK_FUNCS(gettimeofday settimeofday time stime) +AC_CHECK_FUNCS(poll select chown lchown times utime utimes) +dnl AC_CHECK_FUNCS(ecvt fcvt gcvt) +AC_CHECK_FUNCS(ecvt_r fcvt_r gcvt_r) +AC_CHECK_FUNCS(econvert fconvert gconvert) +AC_CHECK_FUNCS(isinf isnan) +AC_CHECK_FUNCS(rand drand48) +AC_CHECK_FUNCS(setpriority DosSetPriority) +AC_CHECK_FUNCS(DosAllocSharedMem) +AC_CHECK_FUNCS(seekdir) +AC_CHECK_FUNCS(strsignal str2sig sig2str) +AC_CHECK_FUNCS(killpg sigrelse sigprocmask sigsetmask sigset) +AC_CHECK_FUNCS(nanosleep usleep) +AC_CHECK_FUNCS(tcgetattr tcsetattr) +AC_CHECK_FUNCS(putenv setenv snprintf strcasecmp strdup) +AC_CHECK_FUNCS(valloc) +AC_CHECK_FUNCS(madvise) +AC_CHECK_FUNCS(chflags fchflags fflagstostr strtofflags) +AC_CHECK_FUNCS(fnmatch) + +dnl Checks for typedefs, structures, and compiler characteristics. +dnl that need results from the AC_CHECK_FUNCS() calls. +AC_USER_MALLOC + +dnl Checks for OS characteristics. +AC_HARD_SYMLINKS +AC_LINK_NOFOLLOW +AC_ACCESS_E_OK + + +dnl Need to check this in default compilation mode to find out +dnl whether this platform supports both functions by default too. +dnl We cannot use the standard tests because they would find +dnl that fseeko()/ftello() are present in small file mode on +dnl Limnux while there is no prototype for these functions. +AC_SMALL_FSEEKO +AC_SMALL_FTELLO + +dnl ??? AC_CHECK_LIB(socket, socket, lib_socket="-lsocket") +dnl +AC_CHECK_LIB(socket, rcmd, lib_socket="-lsocket") +ac_save_LIBS="$LIBS" +LIBS="$LIBS $lib_socket" +AC_CHECK_LIB(nsl, inet_ntoa, lib_nsl="-lnsl") +LIBS="$LIBS $lib_nsl" +AC_CHECK_FUNCS(rcmd socket socketpair) +AC_CHECK_FUNCS(getservbyname inet_ntoa) +AC_CHECK_FUNCS(getaddrinfo getnameinfo) +LIBS="$ac_save_LIBS" + +dnl Check for largefile support +dnl Do this last to make sure that no large file definition +dnl in confdefs.h will modify our results +AC_SYS_LARGEFILE +dnl Warning do not run this test. it interferes with the test +dnl AC_CHECK_FUNCS(fseeko ftello) from above. +dnl The test AC_HAVE_LARGEFILES will check whether ftello/fseeko +dnl are available in Large File mode +dnl AC_FUNC_FSEEKO +AC_HAVE_LARGEFILES + +AC_DEFINE_UNQUOTED_STRING(HOST_ALIAS,$host_alias) +AC_DEFINE_UNQUOTED_STRING(HOST_SUB,$host) +AC_DEFINE_UNQUOTED_STRING(HOST_CPU,$host_cpu) +AC_DEFINE_UNQUOTED_STRING(HOST_VENDOR,$host_vendor) +AC_DEFINE_UNQUOTED_STRING(HOST_OS,$host_os) + +dnl AC_CHECK_LIB(crypt, crypt, lib_crypt="-lcrypt") + +AC_CHECK_LIB(c, crypt, lib_crypt="", + [AC_CHECK_LIB(crypt, crypt, lib_crypt="-lcrypt")]) + +ac_save_LIBS="$LIBS" +LIBS="$LIBS $lib_crypt" +AC_CHECK_FUNCS(crypt) +LIBS="$ac_save_LIBS" + +if test $ac_cv_header_camlib_h = yes; then + scsi_lib=-lcam +fi + +if test "$ac_cv_header_sys_acl_h" = yes; then + + AC_CHECKING(for Posix Access Control List support) + AC_CHECK_LIB(acl, acl_get_file, lib_acl="-lacl") + AC_CHECK_LIB(pacl, acl_get_file, lib_acl="-lpacl") + + ac_save_LIBS="$LIBS" + LIBS="$LIBS $lib_acl" + AC_CHECK_FUNCS(acl_get_file acl_set_file acl_from_text acl_to_text acl_free acl_delete_def_file) + LIBS="$ac_save_LIBS" + + AC_CHECKING(for Solaris Access Control List support) + AC_CHECK_LIB(sec, acltotext, lib_acl="-lsec") + ac_save_LIBS="$LIBS" + LIBS="$LIBS $lib_acl" + AC_CHECK_FUNCS(acl facl aclfromtext acltotext) + LIBS="$ac_save_LIBS" + + AC_CHECKING(for HP-UX Access Control List support) + AC_CHECK_FUNCS(getacl fgetacl setacl fsetacl strtoacl acltostr cpacl fcpacl chownacl setaclentry fsetaclentry) + +fi + +if test "$ac_cv_header_attr_xattr_h" = yes; then + AC_CHECKING(for Extended Attribute support) + AC_CHECK_LIB(attr, getxattr, lib_attr="-lattr") + ac_save_LIBS="$LIBS" + LIBS="$LIBS $lib_attr" + AC_CHECK_FUNCS(getxattr setxattr listxattr) + LIBS="$ac_save_LIBS" +fi + +AC_SUBST(largefile_cc_opt) + +AC_SUBST(lib_crypt) +AC_SUBST(scsi_lib) +AC_SUBST(lib_acl) +AC_SUBST(lib_attr) + +AC_OUTPUT(rules.cnf) diff --git a/scsilib/conf/install-sh b/scsilib/conf/install-sh new file mode 100755 index 0000000..fc58de0 --- /dev/null +++ b/scsilib/conf/install-sh @@ -0,0 +1,288 @@ +#! /bin/sh +# +# @(#)install-sh 1.6 04/01/20 1999 J. Schilling +# +# install - install a program, script, or datafile +# This comes from X11R5 (mit/util/scripts/install.sh). +# Mods to make install-sh behave reasonable when called by +# non root user by J. Schilling +# +# Copyright 1991 by the Massachusetts Institute of Technology +# Copyright 1999 by J. Schilling +# +# Permission to use, copy, modify, distribute, and sell this software and its +# documentation for any purpose is hereby granted without fee, provided that +# the above copyright notice appear in all copies and that both that +# copyright notice and this permission notice appear in supporting +# documentation, and that the name of M.I.T. not be used in advertising or +# publicity pertaining to distribution of the software without specific, +# written prior permission. M.I.T. makes no representations about the +# suitability of this software for any purpose. It is provided "as is" +# without express or implied warranty. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. It can only install one file at a time, a restriction +# shared with many OS's install programs. + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" +mkdirprog="${MKDIRPROG-mkdir}" + +transformbasename="" +transform_arg="" +instcmd="$mvprog" +chmodcmd="$chmodprog 0755" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" +dir_arg="" + +# +# Check if we are 'root' to avoid chown as non root user +# +rootflag=FALSE +dstdir=/tmp/xd.$$ +dsttmp=${dstdir}/xx.$$ +trap "rm -f ${dsttmp}; rm -rf ${dstdir}" 0 +mkdir ${dstdir} +${chmodcmd} ${dstdir} +echo > ${dsttmp} +${chownprog} root ${dsttmp} 2> /dev/null && ${chmodcmd} ${dsttmp} 2> /dev/null && rootflag=TRUE +# +# Win95 has no user 'root' and chown succeeds always. +# Unfortunately, there is also no user 'bin' and chown complains about +# user 'bin' being non-existant. +# Check if the fie is now really owned by 'root' to avoid the Win95 probems +# +if [ $rootflag = TRUE ]; then + ls -l ${dsttmp} 2> /dev/null | grep root > /dev/null || rootflag=FALSE +fi +rm -f ${dsttmp} +rm -rf ${dstdir} + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -d) dir_arg=true + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) if [ $rootflag = TRUE ] + then + chowncmd="$chownprog $2" + else + echo "install: -o option available only to root -- ignored" + fi + shift + shift + continue;; + + -g) if [ $rootflag = TRUE ] + then + chgrpcmd="$chgrpprog $2" + else + echo "install: -g option available only to root -- ignored" + fi + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + -t=*) transformarg=`echo $1 | sed 's/-t=//'` + shift + continue;; + + -b=*) transformbasename=`echo $1 | sed 's/-b=//'` + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + # this colon is to work around a 386BSD /bin/sh bug + : + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +else + true +fi + +if [ x"$dir_arg" != x ]; then + dst=$src + src="" + + if [ -d $dst ]; then + instcmd=: + else + instcmd=mkdir + fi +else + +# Waiting for this to be detected by the "$instcmd $src $dsttmp" command +# might cause directories to be created, which would be especially bad +# if $src (and thus $dsttmp) contains '*'. + + if [ -f $src -o -d $src ] + then + true + else + echo "install: $src does not exist" + exit 1 + fi + + if [ x"$dst" = x ] + then + echo "install: no destination specified" + exit 1 + else + true + fi + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + + if [ -d $dst ] + then + dst="$dst"/`basename $src` + else + true + fi +fi + +## this sed command emulates the dirname command +dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` + +# Make sure that the destination directory exists. +# this part is taken from Noah Friedman's mkinstalldirs script + +# Skip lots of stat calls in the usual case. +if [ ! -d "$dstdir" ]; then +defaultIFS=' +' +IFS="${IFS-${defaultIFS}}" + +oIFS="${IFS}" +# Some sh's can't handle IFS=/ for some reason. +IFS='%' +set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` +IFS="${oIFS}" + +pathcomp='' + +while [ $# -ne 0 ] ; do + pathcomp="${pathcomp}${1}" + shift + + if [ ! -d "${pathcomp}" ] ; + then + $mkdirprog "${pathcomp}" + else + true + fi + + pathcomp="${pathcomp}/" +done +fi + +if [ x"$dir_arg" != x ] +then + $doit $instcmd $dst && + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi +else + +# If we're going to rename the final executable, determine the name now. + + if [ x"$transformarg" = x ] + then + dstfile=`basename $dst` + else + dstfile=`basename $dst $transformbasename | + sed $transformarg`$transformbasename + fi + +# don't allow the sed command to completely eliminate the filename + + if [ x"$dstfile" = x ] + then + dstfile=`basename $dst` + else + true + fi + +# Make a temp file name in the proper directory. + + dsttmp=$dstdir/#inst.$$# + +# Move or copy the file name to the temp name + + $doit $instcmd $src $dsttmp && + + trap "rm -f ${dsttmp}" 0 && + +# and set any options; do chmod last to preserve setuid bits + +# If any of these fail, we abort the whole thing. If we want to +# ignore errors from any of these, just make sure not to ignore +# errors from the above "$doit $instcmd $src $dsttmp" command. + + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + +# Now rename the file to the real destination. + + $doit $rmcmd -f $dstdir/$dstfile && + $doit $mvcmd $dsttmp $dstdir/$dstfile + +fi && + + +exit 0 diff --git a/scsilib/conf/makeinc b/scsilib/conf/makeinc new file mode 100755 index 0000000..46b2e59 --- /dev/null +++ b/scsilib/conf/makeinc @@ -0,0 +1,196 @@ +#!/bin/sh +# +# @(#)makeinc 1.3 02/12/16 Copyright 1998 J. Schilling +########################################################################### +# Copyright 1998 by J. Schilling +########################################################################### +# +# Automake script for the Schily (SING) makefile system +# +########################################################################### +# +# Creates the following files: +# +# ./RULES/os-sunos.id +# ./RULES/os-sunos.def +# ./DEFAULTS/Defaults.sunos +# ./RULES/sun4c-sunos-gcc.rul +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +MAILADDR=schilling@fokus.fhg.de + +########################################################################### +# Option processing +########################################################################### +case $1 in + +-r) + shift + SRCROOT=$1 + shift + ;; +esac + +if [ $# -lt 1 ]; then + echo 'Usage: makeinc [-r srcroot] filename' +fi + +########################################################################### +# Find SRCROOT if not specified via option +########################################################################### +if [ .$SRCROOT = . -a -r RULES ]; then + SRCROOT=. +fi +if [ .$SRCROOT = . -a -r ../RULES ]; then + SRCROOT=.. +fi +if [ .$SRCROOT = . -a -r ../../RULES ]; then + SRCROOT=../.. +fi +if [ .$SRCROOT = . -a -r ../../../RULES ]; then + SRCROOT=../../.. +fi +if [ .$SRCROOT = . -a -r ../../../../RULES ]; then + SRCROOT=../../../.. +fi +if [ .$SRCROOT = . -a -r ../../../../../RULES ]; then + SRCROOT=../../../../.. +fi +if [ .$SRCROOT = . -a -r ../../../../../../RULES ]; then + SRCROOT=../../../../../.. +fi + +########################################################################### +# Real start of automake script +########################################################################### +echo 'NOTICE: Automake script called' +if [ -r $1 ]; then + echo "WARNING: requested file '$1' already exists" + exit +fi +echo "IMPORTANT: Please report your architecture to $MAILADDR" +echo +echo "Trying to create missing rule file '$1'" +sleep 1 +echo + +CC=cc +gcc -v 2> /dev/null && CC=gcc +echo "CC: $CC" + +MANSTYLE=sysv +if [ -r /usr/man/*man7*/man* -o -r /usr/share/man/*man7*/man* \ + -o -r /usr/man/*man7*/ascii* -o -r /usr/share/man/*man7*/ascii* ]; then + MANSTYLE=bsd +fi +echo "MANSTYLE: $MANSTYLE" + + case $1 in + + *os-*.id) + echo $1 + OSNAME=`echo $1 | sed -e 's;\(.*\)os-\(.*\)\.id;\2;'` + echo '###########################################################################' > $1 + echo "# OS specific MACRO definitions for $OSNAME" >> $1 + echo "# This file is auto generated and may be wrong" >> $1 + echo '###########################################################################' >> $1 + echo "O_ARCH= $OSNAME" >> $1 + echo '-O_ARCH= -$(O_ARCH)' >> $1 + ;; + + *os-*.def) + echo $1 + OSNAME=`echo $1 | sed -e 's;\(.*\)os-\(.*\)\.def;\2;'` + echo '###########################################################################' > $1 + echo "# Global os definitions for $OSNAME" >> $1 + echo "# This file is auto generated and may be wrong" >> $1 + echo '###########################################################################' >> $1 + echo "MANSTYLE= $MANSTYLE" >> $1 + ;; + + *Defaults.*) + echo $1 + OSNAME=`echo $1 | sed -e 's;\(.*\)\.\(.*\);\2;'` + echo '###########################################################################' > $1 + echo "# global definitions for $OSNAME Systems" >> $1 + echo "# This file is auto generated and may be wrong" >> $1 + echo '###########################################################################' >> $1 + if [ $CC = gcc ]; then + cat $SRCROOT/TEMPLATES/Defaults.gcc >> $1 + else + cat $SRCROOT/TEMPLATES/Defaults.xcc >> $1 + fi + echo >> $1 + echo '###########################################################################' >> $1 + echo "# Do compilattion with minimal warnings" >> $1 + echo '###########################################################################' >> $1 + echo "CWARNOPTS=" >> $1 + ;; + + *-*-*cc.rul) + ARCH=`echo $1 | sed -e 's;\(.*\)/\(.*\)-\(.*\)-\(.*\).rul;\2;'` + OSNAME=`echo $1 | sed -e 's;\(.*\)/\(.*\)-\(.*\)-\(.*\).rul;\3;'` + CCOM=`echo $1 | sed -e 's;\(.*\)/\(.*\)-\(.*\)-\(.*\).rul;\4;'` + DIR=`echo $1 | sed -e "s;\(.*\)/$ARCH-$OSNAME-$CCOM.rul;\1;"` + echo "ARCH: $ARCH" + echo "OSNAME: $OSNAME" + echo "CCOM: $CCOM" + echo "DIR: $DIR" + echo $1 + echo "Trying to find similar architecture for '$1'" + similar=`ls $DIR/*-$OSNAME-$CCOM.rul 2>/dev/null| head -1` + SARCH=`echo $similar | sed -e "s;\(.*\)/\(.*\)-$OSNAME-$CCOM.rul;\2;"` + + if [ .$similar != . ]; then + echo 'Found similar architecture ' "'$similar'" + echo 'creating symlink:' ln -s $SARCH-$OSNAME-$CCOM.rul $1 + echo "Please send a mail to $MAILADDR to report whether this works or not" + sleep 10 + ln -s $SARCH-$OSNAME-$CCOM.rul $1 || cp $SARCH-$OSNAME-$CCOM.rul $1 + exit + else + echo '###########################################################################' > $1 + echo "# global definitions for $OSNAME Systems" >> $1 + echo "# This file is auto generated and may be wrong" >> $1 + echo '###########################################################################' >> $1 + + if [ $CCOM = gcc ]; then + echo 'Using generic GCC machine configuration file' + cat $SRCROOT/TEMPLATES/temp-gcc.rul >> $1 + else + echo 'Using generic dumb cc machine configuration file' + cat $SRCROOT/TEMPLATES/temp-xcc.rul >> $1 + fi + fi + ;; + + ####################################################################### + # This entry is not really needed... + ####################################################################### + *TARGETS/Targetdirs*) + echo "Linking $1 to $SRCROOT/TARGETS/Targetdirs" + ln -s Targetdirs $1 + ;; + *) + echo "Unknown rule to build: '$1'." + exit 1 + ;; + + esac + +echo "Please send a mail to $MAILADDR to report whether this works or not" +sleep 10 diff --git a/scsilib/conf/mkdep-aix.sh b/scsilib/conf/mkdep-aix.sh new file mode 100755 index 0000000..e5476c5 --- /dev/null +++ b/scsilib/conf/mkdep-aix.sh @@ -0,0 +1,58 @@ +#!/bin/sh +#ident "@(#)mkdep-aix.sh 1.1 02/10/11 " +########################################################################### +# Copyright 2002 by J. Schilling +########################################################################### +# +# Create dependency list with AIX cc +# +########################################################################### +# +# This script will probably not work correctly with a list of C-files +# but as we don't need it with 'smake' or 'gmake' it seems to be sufficient. +# +# Note that AIX cc will create a file foo.u for every foo.c file. The file +# foo.u is located in the directory where cc is run. +# For this reason, there may be problems of other software likes to create +# foo.u during compilation. Please report problems. +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +FILES= +UFILES= +trap 'rm -f $UFILES ; exit 1' 1 2 15 + +for i in "$@"; do + + case "$i" in + + -*) # ignore options + ;; + *.c) if [ ! -z "$FILES" ]; then + FILES="$FILES " + fi + b=`basename $i ''` + FILES="$FILES$b" + ;; + esac +done + +UFILES=`echo "$FILES" | sed -e 's;\([^.]*\)\.c;\1.u;g'` + +rm -f $UFILES +cc -M -E > /dev/null "$@" +cat $UFILES +rm -f $UFILES diff --git a/scsilib/conf/mkdep-hpux.sh b/scsilib/conf/mkdep-hpux.sh new file mode 100755 index 0000000..d1cf5df --- /dev/null +++ b/scsilib/conf/mkdep-hpux.sh @@ -0,0 +1,42 @@ +#!/bin/sh +#ident "@(#)mkdep-hpux.sh 1.1 02/10/10 " +########################################################################### +# Copyright 2002 by J. Schilling +########################################################################### +# +# Create dependency list with the HP-UX bundled cc +# +########################################################################### +# +# This script will probably not work correctly with a list of C-files +# but as we don't need it with 'smake' or 'gmake' it seems to be sufficient. +# +# Due to a design bug in the compiler interface we cannot tell the compiler +# to output the list on stdout, -Wp,-M- does not work. As the default +# output is on stderr and the output is even completely confused with +# error messages and warnings, we cannot just grep away the warnings +# like we do on SCO unix. +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### + +trap 'rm -fr /tmp/cpp-m.$$ ; exit 1' 1 2 15 + +cc -Wp,-M/tmp/cpp-m.$$ -E > /dev/null "$@" + +cat /tmp/cpp-m.$$ + +rm -f /tmp/cpp-m.$$ diff --git a/scsilib/conf/mkdep-sco.sh b/scsilib/conf/mkdep-sco.sh new file mode 100755 index 0000000..ee7dd4d --- /dev/null +++ b/scsilib/conf/mkdep-sco.sh @@ -0,0 +1,49 @@ +#!/bin/sh +#ident "@(#)mkdep-sco.sh 1.5 03/03/05 " +########################################################################### +# Copyright 1999 by J. Schilling +########################################################################### +# +# Create dependency list with SCO's cc +# +########################################################################### +# +# This script will probably not work correctly with a list of C-files +# but as we don't need it with 'smake' or 'gmake' it seems to be sufficient. +# +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along with +# this program; see the file COPYING. If not, write to the Free Software +# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +########################################################################### +FILES= + +for i in "$@"; do + + case "$i" in + + -*) # ignore options + ;; + *.c) if [ ! -z "$FILES" ]; then + FILES="$FILES " + fi + # base name from $i + base=`echo $i | sed -e 's;[^/]*/;;'` + FILES="$FILES$base" + ;; + esac +done + +OFILES=`echo "$FILES" | sed -e 's;\([^.]*\)\.c;\1.o;g'` + +cc -H -E 2>&1 > /dev/null "$@" | grep -hv '^"' | grep -hv '^UX:' | sed -e "s;^;$OFILES: ;" diff --git a/scsilib/conf/mkdir-sh b/scsilib/conf/mkdir-sh new file mode 100755 index 0000000..dda30a3 --- /dev/null +++ b/scsilib/conf/mkdir-sh @@ -0,0 +1,58 @@ +#!/bin/sh +# +# Replacement for mkdir -p ... functionality. +# +# BSD-4.3, NeXT Step <= 3.x and similar don't accept the -p flag +# +# @(#)mkdir-sh 1.2 98/12/14 Copyright 1998 J. Schilling +# +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + +if [ $# -lt 1 ]; then + echo "Usage: mkdir-sh [-p] dir ...." + exit 1 +fi + +dop=false +case $1 in +-p) + dop=true + shift + ;; +esac + +if [ $dop = false ]; then + for i in "$@"; do + mkdir "$i" + done +else + for i in "$@"; do + if [ -d "$i" ]; then + continue + fi + # Don't use ${i:-.}, BSD4.3 doen't like it + # + fullname="$i" + if [ ."$i" = . ]; then + fullname=. + fi + dirname=`expr \ + "$fullname/" : '\(/\)/*[^/]*//*$' \| \ + "$fullname/" : '\(.*[^/]\)//*[^/][^/]*//*$' \| \ + .` + sh $0 -p "$dirname" + mkdir "$i" + done +fi diff --git a/scsilib/conf/rules.cnf.in b/scsilib/conf/rules.cnf.in new file mode 100644 index 0000000..5f4df62 --- /dev/null +++ b/scsilib/conf/rules.cnf.in @@ -0,0 +1,10 @@ +# @(#)rules.cnf.in 1.5 03/09/13 Copyright 1998-2003 J. Schilling + +EXEEXT= @EXEEXT@ + +LARGEFILE_CC_OPT= @largefile_cc_opt@ + +SCSILIB= @scsi_lib@ +LIB_CRYPT= @lib_crypt@ +LIB_ACL= @lib_acl@ +LIB_ATTR = @lib_attr@ diff --git a/scsilib/conf/xconfig.h.in b/scsilib/conf/xconfig.h.in new file mode 100644 index 0000000..cd5547a --- /dev/null +++ b/scsilib/conf/xconfig.h.in @@ -0,0 +1,510 @@ +/* @(#)xconfig.h.in 1.76 04/07/26 Copyright 1998-2003 J. Schilling */ +/* + * Dynamic autoconf C-include code. + * + * Copyright (c) 1998-2003 J. Schilling + */ + +/* + * Header Files + */ +#undef PROTOTYPES /* if Compiler supports ANSI C prototypes */ +#undef HAVE_STDARG_H /* to use stdarg.h, else use varargs.h NOTE: SaberC on a Sun has prototypes but no stdarg.h */ +#undef HAVE_VARARGS_H /* to use use varargs.h NOTE: The free HP-UX C-compiler has stdarg.h but no PROTOTYPES */ +#undef HAVE_STDLIB_H /* to use general utility defines (malloc(), size_t ...) and general C library prototypes */ +#undef HAVE_STDDEF_H /* to use offsetof(), ptrdiff_t, wchar>t, size_t */ +#undef HAVE_STRING_H /* to get NULL and ANSI C string function prototypes */ +#undef HAVE_STRINGS_H /* to get BSD string function prototypes */ +#undef STDC_HEADERS /* if ANSI compliant stdlib.h, stdarg.h, string.h, float.h are present */ +#undef HAVE_UNISTD_H /* to get POSIX syscall prototypes XXX sys/file.h fcntl.h (unixstd/fctl)XXX*/ +#undef HAVE_GETOPT_H /* to get getopt() prototype from getopt.h instead of unistd.h */ +#undef HAVE_LIMITS_H /* to get POSIX numeric limits constants */ +#undef HAVE_A_OUT_H /* if a.out.h is present (may be a system using a.out format) */ +#undef HAVE_AOUTHDR_H /* if aouthdr.h is present. This is a COFF system */ +#undef HAVE_ELF_H /* if elf.h is present. This is an ELF system */ +#undef HAVE_FCNTL_H /* to access, O_XXX constants for open(), otherwise use sys/file.h */ +#undef HAVE_SYS_FILE_H /* to use O_XXX constants for open() and flock() defs */ +#undef HAVE_INTTYPES_H /* to use UNIX-98 inttypes.h */ +#undef HAVE_DIRENT_H /* to use POSIX dirent.h */ +#undef HAVE_SYS_DIR_H /* to use BSD sys/dir.h */ +#undef HAVE_NDIR_H /* to use ndir.h */ +#undef HAVE_SYS_NDIR_H /* to use sys/ndir.h */ +#undef HAVE_ALLOCA_H /* if alloca.h exists */ +#undef HAVE_MALLOC_H /* if malloc.h exists */ +#undef HAVE_TERMIOS_H /* to use POSIX termios.h */ +#undef HAVE_TERMIO_H /* to use SVR4 termio.h */ +#undef HAVE_PWD_H /* if pwd.h exists */ +#undef HAVE_GRP_H /* if grp.h exists */ +#undef HAVE_SYS_ACL_H /* to use <sys/acl.h> for ACL definitions */ +#undef HAVE_ACLLIB_H /* if HP-UX <acllib.h> is present */ +#undef HAVE_SHADOW_H /* if shadow.h exists */ +#undef HAVE_SYSLOG_H /* if syslog.h exists */ +#undef HAVE_SYS_TIME_H /* may include sys/time.h for struct timeval */ +#undef TIME_WITH_SYS_TIME /* may include both time.h and sys/time.h */ +#undef HAVE_TIMES /* to use times() and sys/times.h */ +#undef HAVE_SYS_TIMES_H /* may include sys/times.h for struct tms */ +#undef HAVE_UTIME /* to use AT&T utime() and utimbuf */ +#undef HAVE_UTIMES /* to use BSD utimes() and sys/time.h */ +#undef HAVE_UTIME_H /* to use utime.h for the utimbuf structure declaration, else declare struct utimbuf yourself */ +#undef HAVE_SYS_UTIME_H /* to use sys/utime.h if utime.h does not exist */ +#undef HAVE_SYS_IOCTL_H /* if sys/ioctl.h is present */ +#undef HAVE_SYS_FILIO_H /* if sys/ioctl.h is present */ +#undef HAVE_SYS_PARAM_H /* if sys/param.h is present */ +#undef HAVE_MNTENT_H /* if mntent.h is present */ +#undef HAVE_SYS_MNTENT_H /* if sys/mntent.h is present */ +#undef HAVE_SYS_MNTTAB_H /* if sys/mnttab.h is present */ +#undef HAVE_SYS_MOUNT_H /* if sys/mount.h is present */ +#undef HAVE_WAIT_H /* to use wait.h for prototypes and union wait */ +#undef HAVE_SYS_WAIT_H /* else use sys/wait.h */ +#undef HAVE_SYS_RESOURCE_H /* to use sys/resource.h for rlimit() and wait3() */ +#undef HAVE_SYS_PROCFS_H /* to use sys/procfs.h for wait3() emulation */ +#undef HAVE_SYS_SYSTEMINFO_H /* to use SVr4 sysinfo() */ +#undef HAVE_SYS_UTSNAME_H /* to use uname() */ +#undef HAVE_SYS_PRIOCNTL_H /* to use SVr4 priocntl() instead of nice()/setpriority() */ +#undef HAVE_SYS_RTPRIOCNTL_H /* if the system supports SVr4 real time classes */ +#undef HAVE_SYS_SYSCALL_H /* to use syscall() */ +#undef HAVE_SYS_MTIO_H /* to use mtio definitions from sys/mtio.h */ +#undef HAVE_SYS_TAPE_H /* to use mtio definitions from AIX sys/tape.h */ +#undef HAVE_SYS_MMAN_H /* to use definitions for mmap()/madvise()... from sys/mman.h */ +#undef HAVE_SYS_SHM_H /* to use definitions for shmget() ... from sys/shm.h */ +#undef HAVE_SYS_IPC_H /* to use definitions for shmget() ... from sys/ipc.h */ +#undef MAJOR_IN_MKDEV /* if we should include sys/mkdev.h to get major()/minor()/makedev() */ +#undef MAJOR_IN_SYSMACROS /* if we should include sys/sysmacros.h to get major()/minor()/makedev() */ +#undef HAVE_SYS_DKIO_H /* if we may include sys/dkio.h for disk ioctls */ +#undef HAVE_SYS_DKLABEL_H /* if we may include sys/dklabel.h for disk label */ +#undef HAVE_SUN_DKIO_H /* if we may include sun/dkio.h for disk ioctls */ +#undef HAVE_SUN_DKLABEL_H /* if we may include sun/dklabel.h for disk label */ +#undef HAVE_SYS_TYPES_H /* if we may include sys/types.h (the standard) */ +#undef HAVE_SYS_STAT_H /* if we may include sys/stat.h (the standard) */ +#undef HAVE_TYPES_H /* if we may include types.h (rare cases e.g. ATARI TOS) */ +#undef HAVE_STAT_H /* if we may include stat.h (rare cases e.g. ATARI TOS) */ +#undef HAVE_POLL_H /* if we may include poll.h to use poll() */ +#undef HAVE_SYS_POLL_H /* if we may include sys/poll.h to use poll() */ +#undef HAVE_SYS_SELECT_H /* if we may have sys/select.h nonstandard use for select() on some systems*/ +#undef NEED_SYS_SELECT_H /* if we need sys/select.h to use select() (this is nonstandard) */ +#undef HAVE_NETDB_H /* if we have netdb.h for get*by*() and rcmd() */ +#undef HAVE_SYS_SOCKET_H /* if we have sys/socket.h for socket() */ +#undef NEED_SYS_SOCKET_H /* if we need sys/socket.h to use select() (this is nonstandard) */ +#undef HAVE_LINUX_PG_H /* if we may include linux/pg.h for PP ATAPI sypport */ +#undef HAVE_CAMLIB_H /* if we may include camlib.h for CAM SCSI transport definitions */ +#undef HAVE_IEEEFP_H /* if we may include ieeefp.h for finite()/isnand() */ +#undef HAVE_FP_H /* if we may include fp.h for FINITE()/IS_INF()/IS_NAN() */ +#undef HAVE_VALUES_H /* if we may include values.h for MAXFLOAT */ +#undef HAVE_FLOAT_H /* if we may include float.h for FLT_MAX */ +#undef HAVE__FILBUF /* if we have _filbuf() for USG derived STDIO */ +#undef HAVE___FILBUF /* if we have __filbuf() for USG derived STDIO */ +#undef HAVE_USG_STDIO /* if we have USG derived STDIO */ +#undef HAVE_ERRNO_DEF /* if we have errno definition in <errno.h> */ +#undef HAVE_VFORK_H /* if we should include vfork.h for vfork() definitions */ +#undef HAVE_ARPA_INET_H /* if we have arpa/inet.h (missing on BeOS) */ + /* BeOS has inet_ntoa() in <netdb.h> */ +#undef HAVE_BSD_DEV_SCSIREG_H /* if we have a NeXT Step compatible sg driver */ +#undef HAVE_SYS_BSDTTY_H /* if we have sys/bsdtty.h on HP-UX for TIOCGPGRP */ +#undef HAVE_OS_H /* if we have the BeOS kernel definitions in OS.h */ +#undef HAVE_ATTR_XATTR_H /* if we have the Linux Extended File Attr definitions in attr/xattr.h */ +#undef HAVE_FNMATCH_H /* if we may include fnmatch.h */ + +/* + * Convert to SCHILY name + */ +#ifdef STDC_HEADERS +# ifndef HAVE_STDC_HEADERS +# define HAVE_STDC_HEADERS +# endif +#endif + +#ifdef HAVE_ELF_H +#define HAVE_ELF /* This system uses ELF */ +#else +# ifdef HAVE_AOUTHDR_H +# define HAVE_COFF /* This system uses COFF */ +# else +# ifdef HAVE_A_OUT_H +# define HAVE_AOUT /* This system uses AOUT */ +# endif +# endif +#endif + +/* + * Library Functions + */ +#undef HAVE_ACCESS /* access() is present in libc */ +#undef HAVE_EACCESS /* eaccess() is present in libc */ +#undef HAVE_EUIDACCESS /* euidaccess() is present in libc */ +#undef HAVE_ACCESS_E_OK /* access() implements E_OK (010) for effective UIDs */ +#undef HAVE_CRYPT /* crypt() is present in libc or libcrypt */ +#undef HAVE_STRERROR /* strerror() is present in libc */ +#undef HAVE_MEMMOVE /* memmove() is present in libc */ +#undef HAVE_MADVISE /* madvise() is present in libc */ +#undef HAVE_MLOCK /* mlock() is present in libc */ +#undef HAVE_MLOCKALL /* working mlockall() is present in libc */ +#undef HAVE_MMAP /* working mmap() is present in libc */ +#undef _MMAP_WITH_SIZEP /* mmap() needs address of size parameter */ +#undef HAVE_FLOCK /* *BSD flock() is present in libc */ +#undef HAVE_LOCKF /* lockf() is present in libc (XOPEN) */ +#undef HAVE_FCNTL_LOCKF /* file locking via fcntl() is present in libc */ +#undef HAVE_FCHDIR /* fchdir() is present in libc */ +#undef HAVE_STATVFS /* statvfs() is present in libc */ +#undef HAVE_QUOTACTL /* quotactl() is present in libc */ +#undef HAVE_QUOTAIOCTL /* use ioctl(f, Q_QUOTACTL, &q) instead of quotactl() */ +#undef HAVE_SETREUID /* setreuid() is present in libc */ +#undef HAVE_SETRESUID /* setresuid() is present in libc */ +#undef HAVE_SETEUID /* seteuid() is present in libc */ +#undef HAVE_SETUID /* setuid() is present in libc */ +#undef HAVE_SETREGID /* setregid() is present in libc */ +#undef HAVE_SETRESGID /* setresgid() is present in libc */ +#undef HAVE_SETEGID /* setegid() is present in libc */ +#undef HAVE_SETGID /* setgid() is present in libc */ +#undef HAVE_GETPGID /* getpgid() is present in libc (POSIX) */ +#undef HAVE_SETPGID /* setpgid() is present in libc (POSIX) */ +#undef HAVE_GETPGRP /* getpgrp() is present in libc (ANY) */ +#undef HAVE_SETPGRP /* setpgrp() is present in libc (ANY) */ +#undef HAVE_BSD_GETPGRP /* getpgrp() in libc is BSD-4.2 compliant */ +#undef HAVE_BSD_SETPGRP /* setpgrp() in libc is BSD-4.2 compliant */ +#undef HAVE_GETSPNAM /* getspnam() in libc (SVR4 compliant) */ +#undef HAVE_GETSPWNAM /* getspwnam() in libsec.a (HP-UX) */ +#undef HAVE_SYNC /* sync() is present in libc */ +#undef HAVE_FSYNC /* fsync() is present in libc */ +#undef HAVE_TCGETATTR /* tcgetattr() is present in libc */ +#undef HAVE_TCSETATTR /* tcsetattr() is present in libc */ +#undef HAVE_WAIT3 /* working wait3() is present in libc */ +#undef HAVE_WAIT4 /* wait4() is present in libc */ +#undef HAVE_WAITID /* waitid() is present in libc */ +#undef HAVE_WAITPID /* waitpid() is present in libc */ +#undef HAVE_GETHOSTID /* gethostid() is present in libc */ +#undef HAVE_GETHOSTNAME /* gethostname() is present in libc */ +#undef HAVE_GETDOMAINNAME /* getdomainname() is present in libc */ +#undef HAVE_GETPAGESIZE /* getpagesize() is present in libc */ +#undef HAVE_GETDTABLESIZE /* getdtablesize() is present in libc */ +#undef HAVE_GETRUSAGE /* getrusage() is present in libc */ +#undef HAVE_GETRLIMIT /* getrlimit() is present in libc */ +#undef HAVE_SETRLIMIT /* setrlimit() is present in libc */ +#undef HAVE_ULIMIT /* ulimit() is present in libc */ +#undef HAVE_GETTIMEOFDAY /* gettimeofday() is present in libc */ +#undef HAVE_SETTIMEOFDAY /* settimeofday() is present in libc */ +#undef HAVE_TIME /* time() is present in libc */ +#undef HAVE_STIME /* stime() is present in libc */ +#undef HAVE_POLL /* poll() is present in libc */ +#undef HAVE_SELECT /* select() is present in libc */ +#undef HAVE_CHOWN /* chown() is present in libc */ +#undef HAVE_LCHOWN /* lchown() is present in libc */ +#undef HAVE_BRK /* brk() is present in libc */ +#undef HAVE_SBRK /* sbrk() is present in libc */ +#undef HAVE_VA_COPY /* va_copy() is present in varargs.h/stdarg.h */ +#undef HAVE__VA_COPY /* __va_copy() is present in varargs.h/stdarg.h */ +#undef HAVE_DTOA /* BSD-4.4 __dtoa() is present in libc */ +#undef HAVE_DTOA_R /* BSD-4.4 __dtoa() with result ptr (reentrant) */ +#undef HAVE_DUP2 /* dup2() is present in libc */ +#undef HAVE_GETCWD /* POSIX getcwd() is present in libc */ +#undef HAVE_SMMAP /* may map anonymous memory to get shared mem */ +#undef HAVE_SHMAT /* shmat() is present in libc */ +#undef HAVE_SEMGET /* semget() is present in libc */ +#undef HAVE_LSTAT /* lstat() is present in libc */ +#undef HAVE_READLINK /* readlink() is present in libc */ +#undef HAVE_SYMLINK /* symlink() is present in libc */ +#undef HAVE_LINK /* link() is present in libc */ +#undef HAVE_HARD_SYMLINKS /* link() allows hard links on symlinks */ +#undef HAVE_LINK_NOFOLLOW /* link() does not follow symlinks when hard linking symlinks */ +#undef HAVE_RENAME /* rename() is present in libc */ +#undef HAVE_MKFIFO /* mkfifo() is present in libc */ +#undef HAVE_MKNOD /* mknod() is present in libc */ +#undef HAVE_ECVT /* ecvt() is present in libc */ +#undef HAVE_FCVT /* fcvt() is present in libc */ +#undef HAVE_GCVT /* gcvt() is present in libc */ +#undef HAVE_ECVT_R /* ecvt_r() is present in libc */ +#undef HAVE_FCVT_R /* fcvt_r() is present in libc */ +#undef HAVE_GCVT_R /* gcvt_r() is present in libc */ +#undef HAVE_ECONVERT /* econvert() is present in libc */ +#undef HAVE_FCONVERT /* fconvert() is present in libc */ +#undef HAVE_GCONVERT /* gconvert() is present in libc */ +#undef HAVE_ISINF /* isinf() is present in libc */ +#undef HAVE_ISNAN /* isnan() is present in libc */ +#undef HAVE_RAND /* rand() is present in libc */ +#undef HAVE_DRAND48 /* drand48() is present in libc */ +#undef HAVE_SETPRIORITY /* setpriority() is present in libc */ +#undef HAVE_NICE /* nice() is present in libc */ +#undef HAVE_DOSSETPRIORITY /* DosSetPriority() is present in libc */ +#undef HAVE_DOSALLOCSHAREDMEM /* DosAllocSharedMem() is present in libc */ +#undef HAVE_SEEKDIR /* seekdir() is present in libc */ +#undef HAVE_PUTENV /* putenv() is present in libc (preferred function) */ +#undef HAVE_SETENV /* setenv() is present in libc (use instead of putenv()) */ +#undef HAVE_UNAME /* uname() is present in libc */ +#undef HAVE_SNPRINTF /* snprintf() is present in libc */ +#undef HAVE_STRCASECMP /* strcasecmp() is present in libc */ +#undef HAVE_STRDUP /* strdup() is present in libc */ +#undef HAVE_STRSIGNAL /* strsignal() is present in libc */ +#undef HAVE_STR2SIG /* str2sig() is present in libc */ +#undef HAVE_SIG2STR /* sig2str() is present in libc */ +#undef HAVE_KILLPG /* killpg() is present in libc */ +#undef HAVE_SIGRELSE /* sigrelse() is present in libc */ +#undef HAVE_SIGPROCMASK /* sigprocmask() is present in libc (POSIX) */ +#undef HAVE_SIGSETMASK /* sigsetmask() is present in libc (BSD) */ +#undef HAVE_SIGSET /* sigset() is present in libc (POSIX) */ +#undef HAVE_SYS_SIGLIST /* char *sys_siglist[] is present in libc */ +#undef HAVE_NANOSLEEP /* nanosleep() is present in libc */ +#undef HAVE_USLEEP /* usleep() is present in libc */ +#undef HAVE_FORK /* fork() is present in libc */ +#undef HAVE_EXECL /* execl() is present in libc */ +#undef HAVE_EXECLE /* execle() is present in libc */ +#undef HAVE_EXECLP /* execlp() is present in libc */ +#undef HAVE_EXECV /* execv() is present in libc */ +#undef HAVE_EXECVE /* execve() is present in libc */ +#undef HAVE_EXECVP /* execvp() is present in libc */ +#undef HAVE_ALLOCA /* alloca() is present (else use malloc())*/ +#undef HAVE_VALLOC /* valloc() is present in libc (else use malloc())*/ +#undef vfork + +#undef HAVE_CHFLAGS /* chflags() is present in libc */ +#undef HAVE_FCHFLAGS /* fchflags() is present in libc */ +#undef HAVE_FFLAGSTOSTR /* fflagstostr() is present in libc */ +#undef HAVE_STRTOFFLAGS /* strtofflags() is present in libc */ + +#undef HAVE_FNMATCH /* fnmatch() is present in libc */ + +/* + * Linux Extended File Attributes + */ +#undef HAVE_GETXATTR /* getxattr() */ +#undef HAVE_SETXATTR /* setxattr() */ +#undef HAVE_LISTXATTR /* listxattr() */ + +/* + * Important: This must be a result from a check _before_ the Large File test + * has been run. It then tells us whether these functions are + * available even when not in Large File mode. + * + * Do not run the AC_FUNC_FSEEKO test from the GNU tar Large File test + * siute. It will use the same cache names and interfere with our test. + * Instead use the tests AC_SMALL_FSEEKO/AC_SMALL/STELLO and make sure + * they are placed before the large file tests. + */ +#undef HAVE_FSEEKO /* fseeko() is present in default compile mode */ +#undef HAVE_FTELLO /* ftello() is present in default compile mode */ + +#undef HAVE_RCMD /* rcmd() is present in libc/libsocket */ +#undef HAVE_SOCKET /* socket() is present in libc/libsocket */ +#undef HAVE_SOCKETPAIR /* socketpair() is present in libc/libsocket */ +#undef HAVE_GETSERVBYNAME /* getservbyname() is present in libc/libsocket */ +#undef HAVE_INET_NTOA /* inet_ntoa() is present in libc/libsocket */ +#undef HAVE_GETADDRINFO /* getaddrinfo() is present in libc/libsocket */ +#undef HAVE_GETNAMEINFO /* getnameinfo() is present in libc/libsocket */ + +#if defined(HAVE_QUOTACTL) || defined(HAVE_QUOTAIOCTL) +# define HAVE_QUOTA /* The system inludes quota */ +#endif + +/* + * We need to test for the include files too because Apollo Domain/OS has a + * libc that includes the functions but the includes files are not visible + * from the BSD compile environment. + */ +#if defined(HAVE_SHMAT) && defined(HAVE_SYS_SHM_H) && defined(HAVE_SYS_IPC_H) +# define HAVE_USGSHM /* USG shared memory is present */ +#endif +#if defined(HAVE_SEMGET) && defined(HAVE_SYS_SHM_H) && defined(HAVE_SYS_IPC_H) +# define HAVE_USGSEM /* USG semaphores are present */ +#endif + +#if defined(HAVE_GETPGRP) && !defined(HAVE_BSD_GETPGRP) +#define HAVE_POSIX_GETPGRP 1 /* getpgrp() in libc is POSIX compliant */ +#endif +#if defined(HAVE_SETPGRP) && !defined(HAVE_BSD_SETPGRP) +#define HAVE_POSIX_SETPGRP 1 /* setpgrp() in libc is POSIX compliant */ +#endif + +/* + * Structures + */ +#undef HAVE_MTGET_TYPE /* if struct mtget contains mt_type (drive type) */ +#undef HAVE_MTGET_MODEL /* if struct mtget contains mt_model (drive type) */ +#undef HAVE_MTGET_DSREG /* if struct mtget contains mt_dsreg (drive status) */ +#undef HAVE_MTGET_DSREG1 /* if struct mtget contains mt_dsreg1 (drive status msb) */ +#undef HAVE_MTGET_DSREG2 /* if struct mtget contains mt_dsreg2 (drive status lsb) */ +#undef HAVE_MTGET_GSTAT /* if struct mtget contains mt_gstat (generic status) */ +#undef HAVE_MTGET_ERREG /* if struct mtget contains mt_erreg (error register) */ +#undef HAVE_MTGET_RESID /* if struct mtget contains mt_resid (residual count) */ +#undef HAVE_MTGET_FILENO /* if struct mtget contains mt_fileno (file #) */ +#undef HAVE_MTGET_BLKNO /* if struct mtget contains mt_blkno (block #) */ +#undef HAVE_MTGET_FLAGS /* if struct mtget contains mt_flags (flags) */ +#undef HAVE_MTGET_BF /* if struct mtget contains mt_bf (optimum blocking factor) */ +#undef HAVE_STRUCT_RUSAGE /* have struct rusage in sys/resource.h */ +#undef HAVE_SI_UTIME /* if struct siginfo contains si_utime */ +#undef HAVE_UNION_SEMUN /* have an illegal definition for union semun in sys/sem.h */ +#undef HAVE_UNION_WAIT /* have union wait in wait.h */ +/* + * SCO UnixWare has st_atim.st__tim.tv_nsec but the st_atim.tv_nsec tests also + * succeeds. If you use st_atim.tv_nsec on UnixWare, you get a warning about + * illegal structure usage. For this reason, your code needs to have + * #ifdef HAVE_ST__TIM before #ifdef HAVE_ST_NSEC. + */ +#undef HAVE_ST_SPARE1 /* if struct stat contains st_spare1 (usecs) */ +#undef HAVE_ST_ATIMENSEC /* if struct stat contains st_atimensec (nanosecs) */ +#undef HAVE_ST_NSEC /* if struct stat contains st_atim.tv_nsec (nanosecs) */ +#undef HAVE_ST__TIM /* if struct stat contains st_atim.st__tim.tv_nsec (nanosecs) */ +#undef HAVE_ST_ATIMESPEC /* if struct stat contains st_atimespec.tv_nsec (nanosecs) */ +#undef HAVE_ST_BLKSIZE /* if struct stat contains st_blksize */ +#undef HAVE_ST_BLOCKS /* if struct stat contains st_blocks */ +#undef HAVE_ST_FSTYPE /* if struct stat contains st_fstype */ +#undef HAVE_ST_RDEV /* if struct stat contains st_rdev */ +#undef HAVE_ST_FLAGS /* if struct stat contains st_flags */ +#undef STAT_MACROS_BROKEN /* if the macros S_ISDIR, S_ISREG .. don't work */ + +#undef DEV_MINOR_NONCONTIG /* if bits in minor device number are noncontiguous */ + +#undef HAVE_SOCKADDR_STORAGE /* if socket.h defines struct sockaddr_storage */ + + + +#undef const /* Define to empty if const doesn't work */ +#undef uid_t /* To be used if uid_t is not present */ +#undef gid_t /* To be used if gid_t is not present */ +#undef size_t /* To be used if size_t is not present */ +#undef ssize_t /* To be used if ssize_t is not present */ +#undef pid_t /* To be used if pid_t is not present */ +#undef off_t /* To be used if off_t is not present */ +#undef mode_t /* To be used if mode_t is not present */ +#undef time_t /* To be used if time_t is not present */ +#undef caddr_t /* To be used if caddr_t is not present */ +#undef daddr_t /* To be used if daddr_t is not present */ +#undef dev_t /* To be used if dev_t is not present */ +#undef ino_t /* To be used if ino_t is not present */ +#undef nlink_t /* To be used if nlink_t is not present */ +#undef blksize_t /* To be used if blksize_t is not present */ +#undef blkcnt_t /* To be used if blkcnt_t is not present */ +/* + * Important: Next Step needs time.h for clock_t (because of a bug) + */ +#undef clock_t /* To be used if clock_t is not present */ +#undef socklen_t /* To be used if socklen_t is not present */ + +/* + * These types are present on all UNIX systems but should be avoided + * for portability. + * On Apollo/Domain OS we don't have them.... + * + * Better include <utypes.h> and use Uchar, Uint & Ulong + */ +#undef u_char /* To be used if u_char is not present */ +#undef u_short /* To be used if u_short is not present */ +#undef u_int /* To be used if u_int is not present */ +#undef u_long /* To be used if u_long is not present */ + +/*#undef HAVE_SIZE_T*/ +/*#undef NO_SIZE_T*/ +#undef GETGROUPS_T +#define GID_T GETGROUPS_T + +/* + * Define as the return type of signal handlers (int or void). + */ +#undef RETSIGTYPE + +/* + * Defines needed to get large file support. + */ +#ifdef USE_LARGEFILES + +#undef HAVE_LARGEFILES + +#ifdef HAVE_LARGEFILES /* If we have working largefiles at all */ + /* This is not defined with glibc-2.1.3 */ + +#undef _LARGE_FILES /* Large file defined on AIX-style hosts. */ +#undef _XOPEN_SOURCE /* To make ftello() visible (glibc 2.1.3). */ + /* XXX We don't use this because glibc2.1.3*/ + /* XXX is bad anyway. If we define */ + /* XXX _XOPEN_SOURCE we will loose caddr_t */ + +#undef HAVE_FSEEKO /* Do we need this? If HAVE_LARGEFILES is */ + /* defined, we have fseeko() */ + +#endif /* HAVE_LARGEFILES */ +#endif /* USE_LARGEFILES */ + +#ifdef USE_ACL /* Enable/disable ACL support */ +/* + * POSIX ACL support + */ +#undef HAVE_ACL_GET_FILE /* acl_get_file() function */ +#undef HAVE_ACL_SET_FILE /* acl_set_file() function */ +#undef HAVE_ACL_FROM_TEXT /* acl_from_text() function */ +#undef HAVE_ACL_TO_TEXT /* acl_to_text() function */ +#undef HAVE_ACL_FREE /* acl_free() function */ +#undef HAVE_ACL_DELETE_DEF_FILE /* acl_delete_def_file() function */ + +#if defined(HAVE_ACL_GET_FILE) && defined(HAVE_ACL_SET_FILE) && \ + defined(HAVE_ACL_FROM_TEXT) && defined(HAVE_ACL_TO_TEXT) && \ + defined(HAVE_ACL_FREE) +# define HAVE_POSIX_ACL 1 /* POSIX ACL's present */ +#endif + +/* + * Sun ACL support. + * Note: unfortunately, HP-UX has an (undocumented) acl() function in libc. + */ +#undef HAVE_ACL /* acl() function */ +#undef HAVE_FACL /* facl() function */ +#undef HAVE_ACLFROMTEXT /* aclfromtext() function */ +#undef HAVE_ACLTOTEXT /* acltotext() function */ + +#if defined(HAVE_ACL) && defined(HAVE_FACL) && \ + defined(HAVE_ACLFROMTEXT) && defined(HAVE_ACLTOTEXT) +# define HAVE_SUN_ACL 1 /* Sun ACL's present */ +#endif + +/* + * HP-UX ACL support. + * Note: unfortunately, HP-UX has an (undocumented) acl() function in libc. + */ +#undef HAVE_GETACL /* getacl() function */ +#undef HAVE_FGETACL /* fgetacl() function */ +#undef HAVE_SETACL /* setacl() function */ +#undef HAVE_FSETACL /* fsetacl() function */ +#undef HAVE_STRTOACL /* strtoacl() function */ +#undef HAVE_ACLTOSTR /* acltostr() function */ +#undef HAVE_CPACL /* cpacl() function */ +#undef HAVE_FCPACL /* fcpacl() function */ +#undef HAVE_CHOWNACL /* chownacl() function */ +#undef HAVE_SETACLENTRY /* setaclentry() function */ +#undef HAVE_FSETACLENTRY /* fsetaclentry() function */ + +#if defined(HAVE_GETACL) && defined(HAVE_FGETACL) && \ + defined(HAVE_SETACL) && defined(HAVE_FSETACL) && \ + defined(HAVE_STRTOACL) && defined(HAVE_ACLTOTEXT) +# define HAVE_HP_ACL 1 /* HP-UX ACL's present */ +#endif + +/* + * Global definition whether ACL support is present. + * As HP-UX differs too much from other implementations, HAVE_HP_ACL is not + * included in HAVE_ANY_ACL. + */ +#if defined(HAVE_POSIX_ACL) || defined(HAVE_SUN_ACL) +# define HAVE_ANY_ACL 1 /* Any ACL implementation present */ +#endif + +#endif /* USE_ACL */ + +/* + * Misc CC / LD related stuff + */ +#undef NO_USER_MALLOC /* If we cannot define our own malloc() */ +#undef HAVE_DYN_ARRAYS /* If the compiler allows dynamic sized arrays */ + + +/* + * Begin restricted code for quality assurance. + * + * Warning: you are not allowed to include the #define below if you are not + * using the Schily makefile system or if you modified the autoconfiguration + * tests. + * + * If you only added other tests you are allowed to keep this #define. + * + * This restiction is introduced because this way, I hope that people + * contribute to the project instead of creating branches. + */ +#define IS_SCHILY_XCONFIG +/* + * End restricted code for quality assurance. + */ diff --git a/scsilib/conf/xconfig.h.in.orig b/scsilib/conf/xconfig.h.in.orig new file mode 100644 index 0000000..7122683 --- /dev/null +++ b/scsilib/conf/xconfig.h.in.orig @@ -0,0 +1,549 @@ +/* @(#)xconfig.h.in 1.76 04/07/26 Copyright 1998-2003 J. Schilling */ +/* + * Dynamic autoconf C-include code. + * + * Copyright (c) 1998-2003 J. Schilling + */ + +/* + * Header Files + */ +#undef PROTOTYPES /* if Compiler supports ANSI C prototypes */ +#undef HAVE_STDARG_H /* to use stdarg.h, else use varargs.h NOTE: SaberC on a Sun has prototypes but no stdarg.h */ +#undef HAVE_VARARGS_H /* to use use varargs.h NOTE: The free HP-UX C-compiler has stdarg.h but no PROTOTYPES */ +#undef HAVE_STDLIB_H /* to use general utility defines (malloc(), size_t ...) and general C library prototypes */ +#undef HAVE_STDDEF_H /* to use offsetof(), ptrdiff_t, wchar>t, size_t */ +#undef HAVE_STRING_H /* to get NULL and ANSI C string function prototypes */ +#undef HAVE_STRINGS_H /* to get BSD string function prototypes */ +#undef STDC_HEADERS /* if ANSI compliant stdlib.h, stdarg.h, string.h, float.h are present */ +#undef HAVE_UNISTD_H /* to get POSIX syscall prototypes XXX sys/file.h fcntl.h (unixstd/fctl)XXX*/ +#undef HAVE_GETOPT_H /* to get getopt() prototype from getopt.h instead of unistd.h */ +#undef HAVE_LIMITS_H /* to get POSIX numeric limits constants */ +#undef HAVE_A_OUT_H /* if a.out.h is present (may be a system using a.out format) */ +#undef HAVE_AOUTHDR_H /* if aouthdr.h is present. This is a COFF system */ +#undef HAVE_ELF_H /* if elf.h is present. This is an ELF system */ +#undef HAVE_FCNTL_H /* to access, O_XXX constants for open(), otherwise use sys/file.h */ +#undef HAVE_SYS_FILE_H /* to use O_XXX constants for open() and flock() defs */ +#undef HAVE_INTTYPES_H /* to use UNIX-98 inttypes.h */ +#undef HAVE_DIRENT_H /* to use POSIX dirent.h */ +#undef HAVE_SYS_DIR_H /* to use BSD sys/dir.h */ +#undef HAVE_NDIR_H /* to use ndir.h */ +#undef HAVE_SYS_NDIR_H /* to use sys/ndir.h */ +#undef HAVE_ALLOCA_H /* if alloca.h exists */ +#undef HAVE_MALLOC_H /* if malloc.h exists */ +#undef HAVE_TERMIOS_H /* to use POSIX termios.h */ +#undef HAVE_TERMIO_H /* to use SVR4 termio.h */ +#undef HAVE_PWD_H /* if pwd.h exists */ +#undef HAVE_GRP_H /* if grp.h exists */ +#undef HAVE_SYS_ACL_H /* to use <sys/acl.h> for ACL definitions */ +#undef HAVE_ACLLIB_H /* if HP-UX <acllib.h> is present */ +#undef HAVE_SHADOW_H /* if shadow.h exists */ +#undef HAVE_SYSLOG_H /* if syslog.h exists */ +#undef HAVE_SYS_TIME_H /* may include sys/time.h for struct timeval */ +#undef TIME_WITH_SYS_TIME /* may include both time.h and sys/time.h */ +#undef HAVE_TIMES /* to use times() and sys/times.h */ +#undef HAVE_SYS_TIMES_H /* may include sys/times.h for struct tms */ +#undef HAVE_UTIME /* to use AT&T utime() and utimbuf */ +#undef HAVE_UTIMES /* to use BSD utimes() and sys/time.h */ +#undef HAVE_UTIME_H /* to use utime.h for the utimbuf structure declaration, else declare struct utimbuf yourself */ +#undef HAVE_SYS_UTIME_H /* to use sys/utime.h if utime.h does not exist */ +#undef HAVE_SYS_IOCTL_H /* if sys/ioctl.h is present */ +#undef HAVE_SYS_FILIO_H /* if sys/ioctl.h is present */ +#undef HAVE_SYS_PARAM_H /* if sys/param.h is present */ +#undef HAVE_MNTENT_H /* if mntent.h is present */ +#undef HAVE_SYS_MNTENT_H /* if sys/mntent.h is present */ +#undef HAVE_SYS_MNTTAB_H /* if sys/mnttab.h is present */ +#undef HAVE_SYS_MOUNT_H /* if sys/mount.h is present */ +#undef HAVE_WAIT_H /* to use wait.h for prototypes and union wait */ +#undef HAVE_SYS_WAIT_H /* else use sys/wait.h */ +#undef HAVE_SYS_RESOURCE_H /* to use sys/resource.h for rlimit() and wait3() */ +#undef HAVE_SYS_PROCFS_H /* to use sys/procfs.h for wait3() emulation */ +#undef HAVE_SYS_SYSTEMINFO_H /* to use SVr4 sysinfo() */ +#undef HAVE_SYS_UTSNAME_H /* to use uname() */ +#undef HAVE_SYS_PRIOCNTL_H /* to use SVr4 priocntl() instead of nice()/setpriority() */ +#undef HAVE_SYS_RTPRIOCNTL_H /* if the system supports SVr4 real time classes */ +#undef HAVE_SYS_SYSCALL_H /* to use syscall() */ +#undef HAVE_SYS_MTIO_H /* to use mtio definitions from sys/mtio.h */ +#undef HAVE_SYS_TAPE_H /* to use mtio definitions from AIX sys/tape.h */ +#undef HAVE_SYS_MMAN_H /* to use definitions for mmap()/madvise()... from sys/mman.h */ +#undef HAVE_SYS_SHM_H /* to use definitions for shmget() ... from sys/shm.h */ +#undef HAVE_SYS_IPC_H /* to use definitions for shmget() ... from sys/ipc.h */ +#undef MAJOR_IN_MKDEV /* if we should include sys/mkdev.h to get major()/minor()/makedev() */ +#undef MAJOR_IN_SYSMACROS /* if we should include sys/sysmacros.h to get major()/minor()/makedev() */ +#undef HAVE_SYS_DKIO_H /* if we may include sys/dkio.h for disk ioctls */ +#undef HAVE_SYS_DKLABEL_H /* if we may include sys/dklabel.h for disk label */ +#undef HAVE_SUN_DKIO_H /* if we may include sun/dkio.h for disk ioctls */ +#undef HAVE_SUN_DKLABEL_H /* if we may include sun/dklabel.h for disk label */ +#undef HAVE_SYS_TYPES_H /* if we may include sys/types.h (the standard) */ +#undef HAVE_SYS_STAT_H /* if we may include sys/stat.h (the standard) */ +#undef HAVE_TYPES_H /* if we may include types.h (rare cases e.g. ATARI TOS) */ +#undef HAVE_STAT_H /* if we may include stat.h (rare cases e.g. ATARI TOS) */ +#undef HAVE_POLL_H /* if we may include poll.h to use poll() */ +#undef HAVE_SYS_POLL_H /* if we may include sys/poll.h to use poll() */ +#undef HAVE_SYS_SELECT_H /* if we may have sys/select.h nonstandard use for select() on some systems*/ +#undef NEED_SYS_SELECT_H /* if we need sys/select.h to use select() (this is nonstandard) */ +#undef HAVE_NETDB_H /* if we have netdb.h for get*by*() and rcmd() */ +#undef HAVE_SYS_SOCKET_H /* if we have sys/socket.h for socket() */ +#undef NEED_SYS_SOCKET_H /* if we need sys/socket.h to use select() (this is nonstandard) */ +#undef HAVE_LINUX_PG_H /* if we may include linux/pg.h for PP ATAPI sypport */ +#undef HAVE_CAMLIB_H /* if we may include camlib.h for CAM SCSI transport definitions */ +#undef HAVE_IEEEFP_H /* if we may include ieeefp.h for finite()/isnand() */ +#undef HAVE_FP_H /* if we may include fp.h for FINITE()/IS_INF()/IS_NAN() */ +#undef HAVE_VALUES_H /* if we may include values.h for MAXFLOAT */ +#undef HAVE_FLOAT_H /* if we may include float.h for FLT_MAX */ +#undef HAVE__FILBUF /* if we have _filbuf() for USG derived STDIO */ +#undef HAVE___FILBUF /* if we have __filbuf() for USG derived STDIO */ +#undef HAVE_USG_STDIO /* if we have USG derived STDIO */ +#undef HAVE_ERRNO_DEF /* if we have errno definition in <errno.h> */ +#undef HAVE_VFORK_H /* if we should include vfork.h for vfork() definitions */ +#undef HAVE_ARPA_INET_H /* if we have arpa/inet.h (missing on BeOS) */ + /* BeOS has inet_ntoa() in <netdb.h> */ +#undef HAVE_BSD_DEV_SCSIREG_H /* if we have a NeXT Step compatible sg driver */ +#undef HAVE_SYS_BSDTTY_H /* if we have sys/bsdtty.h on HP-UX for TIOCGPGRP */ +#undef HAVE_OS_H /* if we have the BeOS kernel definitions in OS.h */ +#undef HAVE_ATTR_XATTR_H /* if we have the Linux Extended File Attr definitions in attr/xattr.h */ +#undef HAVE_FNMATCH_H /* if we may include fnmatch.h */ + +/* + * Convert to SCHILY name + */ +#ifdef STDC_HEADERS +# ifndef HAVE_STDC_HEADERS +# define HAVE_STDC_HEADERS +# endif +#endif + +#ifdef HAVE_ELF_H +#define HAVE_ELF /* This system uses ELF */ +#else +# ifdef HAVE_AOUTHDR_H +# define HAVE_COFF /* This system uses COFF */ +# else +# ifdef HAVE_A_OUT_H +# define HAVE_AOUT /* This system uses AOUT */ +# endif +# endif +#endif + +/* + * Library Functions + */ +#undef HAVE_ACCESS /* access() is present in libc */ +#undef HAVE_EACCESS /* eaccess() is present in libc */ +#undef HAVE_EUIDACCESS /* euidaccess() is present in libc */ +#undef HAVE_ACCESS_E_OK /* access() implements E_OK (010) for effective UIDs */ +#undef HAVE_CRYPT /* crypt() is present in libc or libcrypt */ +#undef HAVE_STRERROR /* strerror() is present in libc */ +#undef HAVE_MEMMOVE /* memmove() is present in libc */ +#undef HAVE_MADVISE /* madvise() is present in libc */ +#undef HAVE_MLOCK /* mlock() is present in libc */ +#undef HAVE_MLOCKALL /* working mlockall() is present in libc */ +#undef HAVE_MMAP /* working mmap() is present in libc */ +#undef _MMAP_WITH_SIZEP /* mmap() needs address of size parameter */ +#undef HAVE_FLOCK /* *BSD flock() is present in libc */ +#undef HAVE_LOCKF /* lockf() is present in libc (XOPEN) */ +#undef HAVE_FCNTL_LOCKF /* file locking via fcntl() is present in libc */ +#undef HAVE_FCHDIR /* fchdir() is present in libc */ +#undef HAVE_STATVFS /* statvfs() is present in libc */ +#undef HAVE_QUOTACTL /* quotactl() is present in libc */ +#undef HAVE_QUOTAIOCTL /* use ioctl(f, Q_QUOTACTL, &q) instead of quotactl() */ +#undef HAVE_SETREUID /* setreuid() is present in libc */ +#undef HAVE_SETRESUID /* setresuid() is present in libc */ +#undef HAVE_SETEUID /* seteuid() is present in libc */ +#undef HAVE_SETUID /* setuid() is present in libc */ +#undef HAVE_SETREGID /* setregid() is present in libc */ +#undef HAVE_SETRESGID /* setresgid() is present in libc */ +#undef HAVE_SETEGID /* setegid() is present in libc */ +#undef HAVE_SETGID /* setgid() is present in libc */ +#undef HAVE_GETPGID /* getpgid() is present in libc (POSIX) */ +#undef HAVE_SETPGID /* setpgid() is present in libc (POSIX) */ +#undef HAVE_GETPGRP /* getpgrp() is present in libc (ANY) */ +#undef HAVE_SETPGRP /* setpgrp() is present in libc (ANY) */ +#undef HAVE_BSD_GETPGRP /* getpgrp() in libc is BSD-4.2 compliant */ +#undef HAVE_BSD_SETPGRP /* setpgrp() in libc is BSD-4.2 compliant */ +#undef HAVE_GETSPNAM /* getspnam() in libc (SVR4 compliant) */ +#undef HAVE_GETSPWNAM /* getspwnam() in libsec.a (HP-UX) */ +#undef HAVE_SYNC /* sync() is present in libc */ +#undef HAVE_FSYNC /* fsync() is present in libc */ +#undef HAVE_TCGETATTR /* tcgetattr() is present in libc */ +#undef HAVE_TCSETATTR /* tcsetattr() is present in libc */ +#undef HAVE_WAIT3 /* working wait3() is present in libc */ +#undef HAVE_WAIT4 /* wait4() is present in libc */ +#undef HAVE_WAITID /* waitid() is present in libc */ +#undef HAVE_WAITPID /* waitpid() is present in libc */ +#undef HAVE_GETHOSTID /* gethostid() is present in libc */ +#undef HAVE_GETHOSTNAME /* gethostname() is present in libc */ +#undef HAVE_GETDOMAINNAME /* getdomainname() is present in libc */ +#undef HAVE_GETPAGESIZE /* getpagesize() is present in libc */ +#undef HAVE_GETDTABLESIZE /* getdtablesize() is present in libc */ +#undef HAVE_GETRUSAGE /* getrusage() is present in libc */ +#undef HAVE_GETRLIMIT /* getrlimit() is present in libc */ +#undef HAVE_SETRLIMIT /* setrlimit() is present in libc */ +#undef HAVE_ULIMIT /* ulimit() is present in libc */ +#undef HAVE_GETTIMEOFDAY /* gettimeofday() is present in libc */ +#undef HAVE_SETTIMEOFDAY /* settimeofday() is present in libc */ +#undef HAVE_TIME /* time() is present in libc */ +#undef HAVE_STIME /* stime() is present in libc */ +#undef HAVE_POLL /* poll() is present in libc */ +#undef HAVE_SELECT /* select() is present in libc */ +#undef HAVE_CHOWN /* chown() is present in libc */ +#undef HAVE_LCHOWN /* lchown() is present in libc */ +#undef HAVE_BRK /* brk() is present in libc */ +#undef HAVE_SBRK /* sbrk() is present in libc */ +#undef HAVE_VA_COPY /* va_copy() is present in varargs.h/stdarg.h */ +#undef HAVE__VA_COPY /* __va_copy() is present in varargs.h/stdarg.h */ +#undef HAVE_DTOA /* BSD-4.4 __dtoa() is present in libc */ +#undef HAVE_DTOA_R /* BSD-4.4 __dtoa() with result ptr (reentrant) */ +#undef HAVE_DUP2 /* dup2() is present in libc */ +#undef HAVE_GETCWD /* POSIX getcwd() is present in libc */ +#undef HAVE_SMMAP /* may map anonymous memory to get shared mem */ +#undef HAVE_SHMAT /* shmat() is present in libc */ +#undef HAVE_SEMGET /* semget() is present in libc */ +#undef HAVE_LSTAT /* lstat() is present in libc */ +#undef HAVE_READLINK /* readlink() is present in libc */ +#undef HAVE_SYMLINK /* symlink() is present in libc */ +#undef HAVE_LINK /* link() is present in libc */ +#undef HAVE_HARD_SYMLINKS /* link() allows hard links on symlinks */ +#undef HAVE_LINK_NOFOLLOW /* link() does not follow symlinks when hard linking symlinks */ +#undef HAVE_RENAME /* rename() is present in libc */ +#undef HAVE_MKFIFO /* mkfifo() is present in libc */ +#undef HAVE_MKNOD /* mknod() is present in libc */ +#undef HAVE_ECVT /* ecvt() is present in libc */ +#undef HAVE_FCVT /* fcvt() is present in libc */ +#undef HAVE_GCVT /* gcvt() is present in libc */ +#undef HAVE_ECVT_R /* ecvt_r() is present in libc */ +#undef HAVE_FCVT_R /* fcvt_r() is present in libc */ +#undef HAVE_GCVT_R /* gcvt_r() is present in libc */ +#undef HAVE_ECONVERT /* econvert() is present in libc */ +#undef HAVE_FCONVERT /* fconvert() is present in libc */ +#undef HAVE_GCONVERT /* gconvert() is present in libc */ +#undef HAVE_ISINF /* isinf() is present in libc */ +#undef HAVE_ISNAN /* isnan() is present in libc */ +#undef HAVE_RAND /* rand() is present in libc */ +#undef HAVE_DRAND48 /* drand48() is present in libc */ +#undef HAVE_SETPRIORITY /* setpriority() is present in libc */ +#undef HAVE_NICE /* nice() is present in libc */ +#undef HAVE_DOSSETPRIORITY /* DosSetPriority() is present in libc */ +#undef HAVE_DOSALLOCSHAREDMEM /* DosAllocSharedMem() is present in libc */ +#undef HAVE_SEEKDIR /* seekdir() is present in libc */ +#undef HAVE_PUTENV /* putenv() is present in libc (preferred function) */ +#undef HAVE_SETENV /* setenv() is present in libc (use instead of putenv()) */ +#undef HAVE_UNAME /* uname() is present in libc */ +#undef HAVE_SNPRINTF /* snprintf() is present in libc */ +#undef HAVE_STRCASECMP /* strcasecmp() is present in libc */ +#undef HAVE_STRDUP /* strdup() is present in libc */ +#undef HAVE_STRSIGNAL /* strsignal() is present in libc */ +#undef HAVE_STR2SIG /* str2sig() is present in libc */ +#undef HAVE_SIG2STR /* sig2str() is present in libc */ +#undef HAVE_KILLPG /* killpg() is present in libc */ +#undef HAVE_SIGRELSE /* sigrelse() is present in libc */ +#undef HAVE_SIGPROCMASK /* sigprocmask() is present in libc (POSIX) */ +#undef HAVE_SIGSETMASK /* sigsetmask() is present in libc (BSD) */ +#undef HAVE_SIGSET /* sigset() is present in libc (POSIX) */ +#undef HAVE_SYS_SIGLIST /* char *sys_siglist[] is present in libc */ +#undef HAVE_NANOSLEEP /* nanosleep() is present in libc */ +#undef HAVE_USLEEP /* usleep() is present in libc */ +#undef HAVE_FORK /* fork() is present in libc */ +#undef HAVE_EXECL /* execl() is present in libc */ +#undef HAVE_EXECLE /* execle() is present in libc */ +#undef HAVE_EXECLP /* execlp() is present in libc */ +#undef HAVE_EXECV /* execv() is present in libc */ +#undef HAVE_EXECVE /* execve() is present in libc */ +#undef HAVE_EXECVP /* execvp() is present in libc */ +#undef HAVE_ALLOCA /* alloca() is present (else use malloc())*/ +#undef HAVE_VALLOC /* valloc() is present in libc (else use malloc())*/ +#undef vfork + +#undef HAVE_CHFLAGS /* chflags() is present in libc */ +#undef HAVE_FCHFLAGS /* fchflags() is present in libc */ +#undef HAVE_FFLAGSTOSTR /* fflagstostr() is present in libc */ +#undef HAVE_STRTOFFLAGS /* strtofflags() is present in libc */ + +#undef HAVE_FNMATCH /* fnmatch() is present in libc */ + +/* + * Linux Extended File Attributes + */ +#undef HAVE_GETXATTR /* getxattr() */ +#undef HAVE_SETXATTR /* setxattr() */ +#undef HAVE_LISTXATTR /* listxattr() */ + +/* + * Important: This must be a result from a check _before_ the Large File test + * has been run. It then tells us whether these functions are + * available even when not in Large File mode. + * + * Do not run the AC_FUNC_FSEEKO test from the GNU tar Large File test + * siute. It will use the same cache names and interfere with our test. + * Instead use the tests AC_SMALL_FSEEKO/AC_SMALL/STELLO and make sure + * they are placed before the large file tests. + */ +#undef HAVE_FSEEKO /* fseeko() is present in default compile mode */ +#undef HAVE_FTELLO /* ftello() is present in default compile mode */ + +#undef HAVE_RCMD /* rcmd() is present in libc/libsocket */ +#undef HAVE_SOCKET /* socket() is present in libc/libsocket */ +#undef HAVE_SOCKETPAIR /* socketpair() is present in libc/libsocket */ +#undef HAVE_GETSERVBYNAME /* getservbyname() is present in libc/libsocket */ +#undef HAVE_INET_NTOA /* inet_ntoa() is present in libc/libsocket */ +#undef HAVE_GETADDRINFO /* getaddrinfo() is present in libc/libsocket */ +#undef HAVE_GETNAMEINFO /* getnameinfo() is present in libc/libsocket */ + +#if defined(HAVE_QUOTACTL) || defined(HAVE_QUOTAIOCTL) +# define HAVE_QUOTA /* The system inludes quota */ +#endif + +/* + * We need to test for the include files too because Apollo Domain/OS has a + * libc that includes the functions but the includes files are not visible + * from the BSD compile environment. + */ +#if defined(HAVE_SHMAT) && defined(HAVE_SYS_SHM_H) && defined(HAVE_SYS_IPC_H) +# define HAVE_USGSHM /* USG shared memory is present */ +#endif +#if defined(HAVE_SEMGET) && defined(HAVE_SYS_SHM_H) && defined(HAVE_SYS_IPC_H) +# define HAVE_USGSEM /* USG semaphores are present */ +#endif + +#if defined(HAVE_GETPGRP) && !defined(HAVE_BSD_GETPGRP) +#define HAVE_POSIX_GETPGRP 1 /* getpgrp() in libc is POSIX compliant */ +#endif +#if defined(HAVE_SETPGRP) && !defined(HAVE_BSD_SETPGRP) +#define HAVE_POSIX_SETPGRP 1 /* setpgrp() in libc is POSIX compliant */ +#endif + +/* + * Structures + */ +#undef HAVE_MTGET_TYPE /* if struct mtget contains mt_type (drive type) */ +#undef HAVE_MTGET_MODEL /* if struct mtget contains mt_model (drive type) */ +#undef HAVE_MTGET_DSREG /* if struct mtget contains mt_dsreg (drive status) */ +#undef HAVE_MTGET_DSREG1 /* if struct mtget contains mt_dsreg1 (drive status msb) */ +#undef HAVE_MTGET_DSREG2 /* if struct mtget contains mt_dsreg2 (drive status lsb) */ +#undef HAVE_MTGET_GSTAT /* if struct mtget contains mt_gstat (generic status) */ +#undef HAVE_MTGET_ERREG /* if struct mtget contains mt_erreg (error register) */ +#undef HAVE_MTGET_RESID /* if struct mtget contains mt_resid (residual count) */ +#undef HAVE_MTGET_FILENO /* if struct mtget contains mt_fileno (file #) */ +#undef HAVE_MTGET_BLKNO /* if struct mtget contains mt_blkno (block #) */ +#undef HAVE_MTGET_FLAGS /* if struct mtget contains mt_flags (flags) */ +#undef HAVE_MTGET_BF /* if struct mtget contains mt_bf (optimum blocking factor) */ +#undef HAVE_STRUCT_RUSAGE /* have struct rusage in sys/resource.h */ +#undef HAVE_SI_UTIME /* if struct siginfo contains si_utime */ +#undef HAVE_UNION_SEMUN /* have an illegal definition for union semun in sys/sem.h */ +#undef HAVE_UNION_WAIT /* have union wait in wait.h */ +/* + * SCO UnixWare has st_atim.st__tim.tv_nsec but the st_atim.tv_nsec tests also + * succeeds. If you use st_atim.tv_nsec on UnixWare, you get a warning about + * illegal structure usage. For this reason, your code needs to have + * #ifdef HAVE_ST__TIM before #ifdef HAVE_ST_NSEC. + */ +#undef HAVE_ST_SPARE1 /* if struct stat contains st_spare1 (usecs) */ +#undef HAVE_ST_ATIMENSEC /* if struct stat contains st_atimensec (nanosecs) */ +#undef HAVE_ST_NSEC /* if struct stat contains st_atim.tv_nsec (nanosecs) */ +#undef HAVE_ST__TIM /* if struct stat contains st_atim.st__tim.tv_nsec (nanosecs) */ +#undef HAVE_ST_ATIMESPEC /* if struct stat contains st_atimespec.tv_nsec (nanosecs) */ +#undef HAVE_ST_BLKSIZE /* if struct stat contains st_blksize */ +#undef HAVE_ST_BLOCKS /* if struct stat contains st_blocks */ +#undef HAVE_ST_FSTYPE /* if struct stat contains st_fstype */ +#undef HAVE_ST_RDEV /* if struct stat contains st_rdev */ +#undef HAVE_ST_FLAGS /* if struct stat contains st_flags */ +#undef STAT_MACROS_BROKEN /* if the macros S_ISDIR, S_ISREG .. don't work */ + +#undef DEV_MINOR_BITS /* # if bits needed to hold minor device number */ +#undef DEV_MINOR_NONCONTIG /* if bits in minor device number are noncontiguous */ + +#undef HAVE_SOCKADDR_STORAGE /* if socket.h defines struct sockaddr_storage */ + + +/* + * Byteorder/Bitorder + */ +#define HAVE_C_BIGENDIAN /* Flag that WORDS_BIGENDIAN test was done */ +#undef WORDS_BIGENDIAN /* If using network byte order */ +#define HAVE_C_BITFIELDS /* Flag that BITFIELDS_HTOL test was done */ +#undef BITFIELDS_HTOL /* If high bits come first in structures */ + +/* + * Types/Keywords + */ +#undef SIZEOF_CHAR +#undef SIZEOF_SHORT_INT +#undef SIZEOF_INT +#undef SIZEOF_LONG_INT +#undef SIZEOF_LONG_LONG +#undef SIZEOF_CHAR_P +#undef SIZEOF_UNSIGNED_CHAR +#undef SIZEOF_UNSIGNED_SHORT_INT +#undef SIZEOF_UNSIGNED_INT +#undef SIZEOF_UNSIGNED_LONG_INT +#undef SIZEOF_UNSIGNED_LONG_LONG +#undef SIZEOF_UNSIGNED_CHAR_P + +#undef HAVE_LONGLONG /* Compiler defines long long type */ +#undef CHAR_IS_UNSIGNED /* Compiler defines char to be unsigned */ + +#undef const /* Define to empty if const doesn't work */ +#undef uid_t /* To be used if uid_t is not present */ +#undef gid_t /* To be used if gid_t is not present */ +#undef size_t /* To be used if size_t is not present */ +#undef ssize_t /* To be used if ssize_t is not present */ +#undef pid_t /* To be used if pid_t is not present */ +#undef off_t /* To be used if off_t is not present */ +#undef mode_t /* To be used if mode_t is not present */ +#undef time_t /* To be used if time_t is not present */ +#undef caddr_t /* To be used if caddr_t is not present */ +#undef daddr_t /* To be used if daddr_t is not present */ +#undef dev_t /* To be used if dev_t is not present */ +#undef ino_t /* To be used if ino_t is not present */ +#undef nlink_t /* To be used if nlink_t is not present */ +#undef blksize_t /* To be used if blksize_t is not present */ +#undef blkcnt_t /* To be used if blkcnt_t is not present */ +/* + * Important: Next Step needs time.h for clock_t (because of a bug) + */ +#undef clock_t /* To be used if clock_t is not present */ +#undef socklen_t /* To be used if socklen_t is not present */ + +/* + * These types are present on all UNIX systems but should be avoided + * for portability. + * On Apollo/Domain OS we don't have them.... + * + * Better include <utypes.h> and use Uchar, Uint & Ulong + */ +#undef u_char /* To be used if u_char is not present */ +#undef u_short /* To be used if u_short is not present */ +#undef u_int /* To be used if u_int is not present */ +#undef u_long /* To be used if u_long is not present */ + +/*#undef HAVE_SIZE_T*/ +/*#undef NO_SIZE_T*/ +#undef VA_LIST_IS_ARRAY /* va_list is an array */ +#undef GETGROUPS_T +#define GID_T GETGROUPS_T + +/* + * Define as the return type of signal handlers (int or void). + */ +#undef RETSIGTYPE + +/* + * Defines needed to get large file support. + */ +#ifdef USE_LARGEFILES + +#undef HAVE_LARGEFILES + +#ifdef HAVE_LARGEFILES /* If we have working largefiles at all */ + /* This is not defined with glibc-2.1.3 */ + +#undef _FILE_OFFSET_BITS /* # of bits in off_t if settable */ +#undef _LARGEFILE_SOURCE /* To make ftello() visible (HP-UX 10.20). */ +#undef _LARGE_FILES /* Large file defined on AIX-style hosts. */ +#undef _XOPEN_SOURCE /* To make ftello() visible (glibc 2.1.3). */ + /* XXX We don't use this because glibc2.1.3*/ + /* XXX is bad anyway. If we define */ + /* XXX _XOPEN_SOURCE we will loose caddr_t */ + +#undef HAVE_FSEEKO /* Do we need this? If HAVE_LARGEFILES is */ + /* defined, we have fseeko() */ + +#endif /* HAVE_LARGEFILES */ +#endif /* USE_LARGEFILES */ + +#ifdef USE_ACL /* Enable/disable ACL support */ +/* + * POSIX ACL support + */ +#undef HAVE_ACL_GET_FILE /* acl_get_file() function */ +#undef HAVE_ACL_SET_FILE /* acl_set_file() function */ +#undef HAVE_ACL_FROM_TEXT /* acl_from_text() function */ +#undef HAVE_ACL_TO_TEXT /* acl_to_text() function */ +#undef HAVE_ACL_FREE /* acl_free() function */ +#undef HAVE_ACL_DELETE_DEF_FILE /* acl_delete_def_file() function */ + +#if defined(HAVE_ACL_GET_FILE) && defined(HAVE_ACL_SET_FILE) && \ + defined(HAVE_ACL_FROM_TEXT) && defined(HAVE_ACL_TO_TEXT) && \ + defined(HAVE_ACL_FREE) +# define HAVE_POSIX_ACL 1 /* POSIX ACL's present */ +#endif + +/* + * Sun ACL support. + * Note: unfortunately, HP-UX has an (undocumented) acl() function in libc. + */ +#undef HAVE_ACL /* acl() function */ +#undef HAVE_FACL /* facl() function */ +#undef HAVE_ACLFROMTEXT /* aclfromtext() function */ +#undef HAVE_ACLTOTEXT /* acltotext() function */ + +#if defined(HAVE_ACL) && defined(HAVE_FACL) && \ + defined(HAVE_ACLFROMTEXT) && defined(HAVE_ACLTOTEXT) +# define HAVE_SUN_ACL 1 /* Sun ACL's present */ +#endif + +/* + * HP-UX ACL support. + * Note: unfortunately, HP-UX has an (undocumented) acl() function in libc. + */ +#undef HAVE_GETACL /* getacl() function */ +#undef HAVE_FGETACL /* fgetacl() function */ +#undef HAVE_SETACL /* setacl() function */ +#undef HAVE_FSETACL /* fsetacl() function */ +#undef HAVE_STRTOACL /* strtoacl() function */ +#undef HAVE_ACLTOSTR /* acltostr() function */ +#undef HAVE_CPACL /* cpacl() function */ +#undef HAVE_FCPACL /* fcpacl() function */ +#undef HAVE_CHOWNACL /* chownacl() function */ +#undef HAVE_SETACLENTRY /* setaclentry() function */ +#undef HAVE_FSETACLENTRY /* fsetaclentry() function */ + +#if defined(HAVE_GETACL) && defined(HAVE_FGETACL) && \ + defined(HAVE_SETACL) && defined(HAVE_FSETACL) && \ + defined(HAVE_STRTOACL) && defined(HAVE_ACLTOTEXT) +# define HAVE_HP_ACL 1 /* HP-UX ACL's present */ +#endif + +/* + * Global definition whether ACL support is present. + * As HP-UX differs too much from other implementations, HAVE_HP_ACL is not + * included in HAVE_ANY_ACL. + */ +#if defined(HAVE_POSIX_ACL) || defined(HAVE_SUN_ACL) +# define HAVE_ANY_ACL 1 /* Any ACL implementation present */ +#endif + +#endif /* USE_ACL */ + +/* + * Misc CC / LD related stuff + */ +#undef NO_USER_MALLOC /* If we cannot define our own malloc() */ +#undef HAVE_DYN_ARRAYS /* If the compiler allows dynamic sized arrays */ + +/* + * Strings that help to maintain OS/platform id's in C-programs + */ +#undef HOST_ALIAS /* Output from config.guess (orig) */ +#undef HOST_SUB /* Output from config.sub (modified) */ +#undef HOST_CPU /* CPU part from HOST_SUB */ +#undef HOST_VENDOR /* VENDOR part from HOST_SUB */ +#undef HOST_OS /* CPU part from HOST_SUB */ + + +/* + * Begin restricted code for quality assurance. + * + * Warning: you are not allowed to include the #define below if you are not + * using the Schily makefile system or if you modified the autoconfiguration + * tests. + * + * If you only added other tests you are allowed to keep this #define. + * + * This restiction is introduced because this way, I hope that people + * contribute to the project instead of creating branches. + */ +#define IS_SCHILY_XCONFIG +/* + * End restricted code for quality assurance. + */ diff --git a/scsilib/configure b/scsilib/configure new file mode 100755 index 0000000..5015118 --- /dev/null +++ b/scsilib/configure @@ -0,0 +1,31 @@ +#!/bin/sh - +echo 'configure is no longer used - just type "make", supported make programs are:' +echo '' +echo 'smake - The Schily smake program' +echo ' This is the preferred make program, the source can be' +echo ' found on ftp://ftp.berlios.de/pub/smake/alpha/' +echo '' +echo ' Smake is the only make program with automake features, it is' +echo ' the only program that works on unknown platforms.' +echo '' +echo 'make - SunPRO make (on SunOS/Solaris only)' +echo ' in /usr/bin/ (SunOS 4.x) or /usr/ccs/bin/ (Solaris)' +echo '' +echo 'gmake - GNU make' +echo ' GNU make will not work correctly on all platforms' +echo ' and due to some conceptional bugs output several' +echo ' error messages that are not related to the makefile' +echo ' system but to GNU make (see README.gmake)' +echo '' +echo 'Other make programs will not work, for more information read README.compile' +echo '' +echo 'If you have problems and if you are in doubt, try to use smake' +echo ' Always compile the latest version that can be found on:' +echo ' ftp://ftp.berlios.de/pub/smake/alpha/' +echo '' +# +# Make automated procedures that believe all programs still use the outdated GNU +# "./configure; make" procedure think configure failed and get the attention of +# a human ... +# +exit 1 diff --git a/scsilib/doc/cdda2wav.man b/scsilib/doc/cdda2wav.man new file mode 100644 index 0000000..916a05f --- /dev/null +++ b/scsilib/doc/cdda2wav.man @@ -0,0 +1,802 @@ +CDDA2WAV(1) CDDA2WAV(1) + + + +NNAAMMEE + cdda2wav - a sampling utility that dumps CD audio data + into wav sound files + +SSYYNNOOPPSSIISS + ccddddaa22wwaavv [--cc _c_h_a_n_s] [--ss] [--mm] [--bb _b_i_t_s] [--rr _r_a_t_e] [--aa + _d_i_v_i_d_e_r] [--tt _t_r_a_c_k[_+_e_n_d_t_r_a_c_k]] [--ii _i_n_d_e_x] [--oo _o_f_f_s_e_t] [--dd + _d_u_r_a_t_i_o_n] [--xx] [--qq] [--ww] [--vv _o_p_t_l_i_s_t] [--VV] [--QQ] [--JJ] [--LL + _c_d_d_b_m_o_d_e] [--RR] [--PP _s_e_c_t_o_r_s] [--FF] [--GG] [--TT] [--ee] [--pp _p_e_r_- + _c_e_n_t_a_g_e] [--nn _s_e_c_t_o_r_s] [--ll _b_u_f_f_e_r_s] [--NN] [--JJ] [--HH] [--gg] + [--BB] [--DD _d_e_v_i_c_e] [--AA _a_u_x_d_e_v_i_c_e] [--II _i_n_t_e_r_f_a_c_e] [--OO _a_u_d_i_o_- + _t_y_p_e] [--CC _i_n_p_u_t_-_e_n_d_i_a_n_e_s_s] [--EE _o_u_t_p_u_t_-_e_n_d_i_a_n_e_s_s] [--MM + _c_o_u_n_t] [--SS _s_p_e_e_d] [--ppaarraannooiiaa] [ccddddbbpp--sseerrvveerr==sseerrvveerrnnaammee] + [ccddddbbpp--ppoorrtt==ppoorrttnnuummbbeerr] [_f_i_l_e_n_a_m_e_(_s_) or _d_i_r_e_c_t_o_r_i_e_s] + +DDEESSCCRRIIPPTTIIOONN + ccddddaa22wwaavv can retrieve audio tracks from CDROM drives (see + README for a list of drives) that are capable of reading + audio data digitally to the host (CCDDDDAA). + +OOPPTTIIOONNSS + --DD _d_e_v_i_c_e _-_-_d_e_v _-_-_d_e_v_i_c_e + uses ddeevviiccee as the source for CDDA reading. For + example /dev/cdrom for the ccooookkeedd__iiooccttll interface + and Bus,ID,Lun for the ggeenneerriicc__ssccssii interface. The + ddeevviiccee has to correspond with the interface setting + (see below). The setting of the environment vari- + able CCDDDDAA__DDEEVVIICCEE is overridden by this option. + + --AA _a_u_x_d_e_v_i_c_e _-_-_a_u_x_d_e_v_i_c_e + uses aauuxxddeevviiccee as CDROM drive for ioctl usage. + + --II _i_n_t_e_r_f_a_c_e _-_-_i_n_t_e_r_f_a_c_e + specifies the interface for CDROM access: + ggeenneerriicc__ssccssii or (on Linux, and FreeBSD systems) + ccooookkeedd__iiooccttll. + + --cc _c_h_a_n_n_e_l_s _-_-_c_h_a_n_n_e_l_s + uses 11 for mono, or 22 for stereo recording, or ss + for stereo recording with both channels swapped. + + --ss ----sstteerreeoo + sets to stereo recording. + + --mm ----mmoonnoo + sets to mono recording. + + --xx ----mmaaxx + sets maximum (CD) quality. + + --bb _b_i_t_s _-_-_b_i_t_s_-_p_e_r_-_s_a_m_p_l_e + sets bits per sample per channel: 88, 1122 or 1166. + + --rr _r_a_t_e _-_-_r_a_t_e + sets rate in samples per second. Possible values + are listed with the --RR option. + + --aa _d_i_v_i_d_e_r _-_-_d_i_v_i_d_e_r + sets rate to 44100Hz / divider. Possible values + are listed with the --RR option. + + --RR ----dduummpp--rraatteess + shows a list of all sample rates and their + dividers. + + --PP sseeccttoorrss ----sseett--oovveerrllaapp + sets the initial number of overlap _s_e_c_t_o_r_s for jit- + ter correction. + + --nn _s_e_c_t_o_r_s _-_-_s_e_c_t_o_r_s_-_p_e_r_-_r_e_q_u_e_s_t + reads _s_e_c_t_o_r_s per request. + + --ll _b_u_f_f_e_r_s _-_-_b_u_f_f_e_r_s_-_i_n_-_r_i_n_g + uses a ring buffer with _b_u_f_f_e_r_s total. + + --tt _t_r_a_c_k_+_e_n_d_t_r_a_c_k _-_-_t_r_a_c_k + selects the start track and optionally the end + track. + + --ii _i_n_d_e_x _-_-_i_n_d_e_x + selects the start index. + + --oo _o_f_f_s_e_t _-_-_o_f_f_s_e_t + starts _o_f_f_s_e_t sectors behind start track (one sec- + tor equivalents 1/75 seconds). + + --OO aauuddiioottyyppee ----oouuttppuutt--ffoorrmmaatt + can be _w_a_v (for wav files) or _a_i_f_f (for apple/sgi + aiff files) or _a_i_f_c (for apple/sgi aifc files) or + _a_u or _s_u_n (for sun .au PCM files) or _c_d_r or _r_a_w + (for headerless files to be used for cd writers). + + --CC _e_n_d_i_a_n_e_s_s _-_-_c_d_r_o_m_-_e_n_d_i_a_n_e_s_s + sets endianess of the input samples to 'little', + 'big' or 'guess' to override defaults. + + --EE _e_n_d_i_a_n_e_s_s _-_-_o_u_t_p_u_t_-_e_n_d_i_a_n_e_s_s + sets endianess of the output samples to 'little' or + 'big' to override defaults. + + --dd _d_u_r_a_t_i_o_n _-_-_d_u_r_a_t_i_o_n + sets recording time in seconds or frames. Frames + (sectors) are indicated by a 'f' suffix (like 75f + for 75 sectors). 00 sets the time for whole track. + + --BB ----bbuullkk ----aallllttrraacckkss + copies each track into a seperate file. + + --ww ----wwaaiitt + waits for signal, then start recording. + + --FF ----ffiinndd--eexxttrreemmeess + finds extrem amplitudes in samples. + + --GG ----ffiinndd--mmoonnoo + finds if input samples are in mono. + + --TT ----ddeeeemmpphhaassiizzee + undo the effect of pre-emphasis in the input sam- + ples. + + --ee ----eecchhoo + copies audio data to sound device e.g. //ddeevv//ddsspp. + + --pp ppeerrcceennttaaggee ----sseett--ppiittcchh + changes pitch of audio data copied to sound device. + + --vv iitteemmlliisstt ----vveerrbboossee--lleevveell + prints verbose information about the CD. LLeevveell is + a list of comma seperated suboptions. Each subop- + tion controls the type of information to be + reported. + +----------+----------------------------------------------------------------+ + |Suboption | Description | + +----------+----------------------------------------------------------------+ + | disable | no information is given, warnings appear however | + | all | all information is given | + | toc | show table of contents | + | summary | show a summary of the recording parameters | + | indices | determine and display index offsets | + | catalog | retrieve and display the media catalog number MCN | + | trackid | retrieve and display all Intern. Standard Recording Codes ISRC | + | sectors | show the table of contents in start sector notation | + | titles | show the table of contents with track titles (when available) | + +----------+----------------------------------------------------------------+ + --NN ----nnoo--wwrriittee + does not write to a file, it just reads (for debug- + ging purposes). + + --JJ ----iinnffoo--oonnllyy + does not write to a file, it just gives information + about the disc. + + --LL ccddddbb mmooddee ----ccddddbb + does a cddbp album- and track title lookup based on + the cddb id. The parameter cddb mode defines how + multiple entries shall be handled. + + ccddddbbpp--sseerrvveerr==sseerrvveerrnnaammee + sets the server to be contacted for title lookups. + + ccddddbbpp--ppoorrtt==ppoorrttnnuummbbeerr + sets the port number to be used for title lookups. + + --HH ----nnoo--iinnffooffiillee + does not write an info file and a cddb file. + + --gg ----gguuii + formats the output to be better parsable by gui + frontends. + + --MM ccoouunntt ----mmdd55 + enables calculation of MD-5 checksum for 'count' + bytes from a beginning of a track. + + --SS ssppeeeedd ----ssppeeeedd + sets the cdrom device to one of the selectable + speeds for reading. + + --qq ----qquuiieett + quiet operation, no screen output. + + --VV ----vveerrbboossee--SSCCSSII + enable SCSI command logging to the console. This is + mainly used for debugging. + + --QQ ----ssiilleenntt--SSCCSSII + suppress SCSI command error reports to the console. + This is mainly used for guis. + + --ppaarraannooiiaa + use the paranoia library instead of cdda2wav's rou- + tines for reading. + + --hh ----hheellpp + display version of cdda2wav on standard output. + + Defaults depend on the + MMaakkeeffiillee and eennvviirroonnmmeenntt vvaarriiaabbllee settings (cur- + rently CCDDDDAA__DDEEVVIICCEE ). + +EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS + CCDDDDAA__DDEEVVIICCEE is used to set the device name. The device + naming is compatible with J�rg Schilling's cdrecord pack- + age. + + CCDDDDBBPP__SSEERRVVEERR + is used for cddbp title lookups when supplied. + + CCDDDDBBPP__PPOORRTT + is used for cddbp title lookups when supplied. + + RRSSHH If the RRSSHH environment variable is present, the + remote connection will not be created via rrccmmdd(3) + but by calling the program pointed to by RRSSHH. Use + e.g. RRSSHH==/usr/bin/ssh to create a secure shell + connection. + + Note that this forces ccddddaa22wwaavv to create a pipe to + the rrsshh((11)) program and disallows ccddddaa22wwaavv to + directly access the network socket to the remote + server. This makes it impossible to set up perfor- + mance parameters and slows down the connection com- + pared to a rroooott initiated rrccmmdd((33)) connection. + + RRSSCCSSII If the RRSSCCSSII environment variable is present, the + remote SCSI server will not be the program + //oopptt//sscchhiillyy//ssbbiinn//rrssccssii but the program pointed to + by RRSSCCSSII. Note that the remote SCSI server program + name will be ignored if you log in using an account + that has been created with a remote SCSI server + program as login shell. + +RREETTUURRNN VVAALLUUEESS + ccddddaa22wwaavv uses the following exit codes to indicate various + degress of success: ++---------+--------------------------------------------------------------------+ +|Exitcode | Description | ++---------+--------------------------------------------------------------------+ +| 0 | no errors encountered, successful operation. | +| 1 | usage or syntax error. cdda2wav got inconsistent arguments. | +| 2 | permission (un)set errors. permission changes failed. | +| 3 | read errors on the cdrom/burner device encountered. | +| 4 | write errors while writing one of the output files encountered. | +| 5 | errors with soundcard handling (initialization/write). | +| 6 | errors with stat() system call on the read device (cooked ioctl). | +| 7 | pipe communication errors encountered (in forked mode). | +| 8 | signal handler installation errors encountered. | +| 9 | allocation of shared memory failed (in forked mode). | +| 10 | dynamic heap memory allocation failed. | +| 11 | errors on the audio cd medium encountered. | +| 12 | device open error in ioctl handling detected. | +| 13 | race condition in ioctl interface handling detected. | +| 14 | error in ioctl() operation encountered. | +| 15 | internal error encountered. Please report back!!! | +| 16 | error in semaphore operation encountered (install / request). | +| 17 | could not get the scsi transfer buffer. | +| 18 | could not create pipes for process communication (in forked mode). | ++---------+--------------------------------------------------------------------+ +DDIISSCCUUSSSSIIOONN + ccddddaa22wwaavv is able to read parts of an aauuddiioo CD or mmuullttiimmee-- + ddiiaa CDROM (containing audio parts) directly digitally. + These parts can be written to a file, a pipe, or to a + sound device. + + ccddddaa22wwaavv stands for CCDDDDAA to WWAAVV (where CCDDDDAA stands for + compact disc digital audio and WWAAVV is a sound sample for- + mat introduced by MS Windows). It allows copying CCDDDDAA + audio data from the CDROM drive into a file in WWAAVV or + other formats. + + The latest versions try to get higher real-time scheduling + priorities to ensure smooth (uninterrupted) operation. + These priorities are available for super users and are + higher than those of 'normal' processes. Thus delays are + minimized. + + If your CDROM is on device DDEEVV and it is loaded with an + audio CD, you may simply invoke ccddddaa22wwaavv ddeevv==DDEEVV and it + will create the sound file aauuddiioo..wwaavv recording the whole + track beginning with track 1 in stereo at 16 bit at 44100 + Hz sample rate, if your file system has enough space free. + Otherwise recording time will be limited. For details see + files RREEAADDMMEE and RREEAADDMMEE..IINNSSTTAALLLL + +HHIINNTTSS OONN OOPPTTIIOONNSS + Options + Most of the options are used to control the format + of the WAV file. In the following text all of them + are described. + + Select Device + --DD _d_e_v_i_c_e selects the CDROM drive device to be + used. The specifier given should correspond to the + selected interface (see below). CCHHAANNGGEE!! For the + cooked_ioctl interface this is the cdrom device + descriptor as before. TThhee SSCCSSII ddeevviicceess uusseedd wwiitthh + tthhee ggeenneerriicc SSCCSSII iinntteerrffaaccee hhoowweevveerr aarree nnooww + aaddddrreesssseedd wwiitthh tthheeiirr SSCCSSII--BBuuss,, SSCCSSII--IIdd,, aanndd SSCCSSII-- + LLuunn iinnsstteeaadd ooff tthhee ggeenneerriicc SSCCSSII ddeevviiccee ddeessccrriipp-- + ttoorr!!!!!! One example for a SCSI CDROM drive on bus 0 + with SCSI ID 3 and lun 0 is -D0,3,0. + + Select Auxiliary device + --AA _a_u_x_d_e_v_i_c_e is necessary for CD-Extra handling. + For Non-SCSI-CDROM drives this is the same device + as given by -D (see above). For SCSI-CDROM drives + it is the CDROM drive (SCSI) device (i.e. //ddeevv//ssrr00 + ) corresponding to the SCSI device (i.e. 00,,33,,00 ). + It has to match the device used for sampling. + + Select Interface + --II _i_n_t_e_r_f_a_c_e selects the CDROM drive interface. For + SCSI drives use generic_scsi (cooked_ioctl may not + yet be available for all devices): ggeenneerriicc__ssccssii and + ccooookkeedd__iiooccttll. The first uses the generic SCSI + interface, the latter uses the ioctl of the CDROM + driver. The latter variant works only when the ker- + nel driver supports CCDDDDAA reading. This entry has to + match the selected CDROM device (see above). + + Enable echo to soundcard + --ee copies audio data to the sound card while + recording, so you hear it nearly simultaneously. + The soundcard gets the same data that is recorded. + This is time critical, so it works best with the --qq + option. To use ccddddaa22wwaavv as a pseudo CD player + without recording in a file you could use ccddddaa22wwaavv + --qq --ee --tt22 --dd00 --NN to play the whole second track. + This feature reduces the recording speed to at most + onefold speed. You cannot make better recordings + than your sound card can play (since the same data + is used). + + Change pitch of echoed audio + --pp ppeerrcceennttaaggee changes the pitch of all audio echoed + to a sound card. Only the copy to the soundcard is + affected, the recorded audio samples in a file + remain the same. Normal pitch, which is the + default, is given by 100%. Lower percentages cor- + respond to lower pitches, i.e. -p 50 transposes + the audio output one octave lower. See also the + script ppiittcchhppllaayy as an example. This option was + contributed by Raul Sobon. + + Select mono or stereo recording + --mm or --cc 11 selects mono recording (both stereo + channels are mixed), --ss or --cc 22 or --cc ss selects + stereo recording. Parameter s will swap both sound + channels. + + Select maximum quality + --xx will set stereo, 16 bits per sample at 44.1 KHz + (full CD quality). Note that other format options + given later can change this setting. + + Select sample quality + --bb 88 specifies 8 bit (1 Byte) for each sample in + each channel; --bb 1122 specifies 12 bit (2 Byte) for + each sample in each channel; --bb 1166 specifies 16 bit + (2 Byte) for each sample in each channel (Ensure + that your sample player or sound card is capable of + playing 12-bit or 16-bit samples). Selecting 12 or + 16 bits doubles file size. 12-bit samples are + aligned to 16-bit samples, so they waste some disk + space. + + Select sample rate + --rr _s_a_m_p_l_e_r_a_t_e selects a sample rate. _s_a_m_p_l_e_r_a_t_e + can be in a range between 44100 and 900. Option --RR + lists all available rates. + + Select sample rate divider + --aa _d_i_v_i_d_e_r selects a sample rate divider. _d_i_v_i_d_e_r + can be minimally 1 and maximally 50.5 and every- + thing between in steps of 0.5. Option --RR lists all + available rates. + + To make the sound smoother at lower sampling rates, + ccddddaa22wwaavv sums over _n samples (where _n is the spe- + cific dividend). So for 22050 Hertz output we have + to sum over 2 samples, for 900 Hertz we have to sum + over 49 samples. This cancels higher frequencies. + Standard sector size of an audio CD (ignoring addi- + tional information) is 2352 Bytes. In order to fin- + ish summing for an output sample at sector bound- + aries the rates above have to be choosen. Arbi- + trary sampling rates in high quality would require + some interpolation scheme, which needs much more + sophisticated programming. + + List a table of all sampling rates + --RR shows a list of all sample rates and their + dividers. Dividers can range from 1 to 50.5 in + steps of 0.5. + + Select start track and optionally end track + --tt _n_+_m selects nn as the start track and optionally + mm as the last track of a range to be recorded. + These tracks must be from the table of contents. + This sets the track where recording begins. Record- + ing can advance through the following tracks as + well (limited by the optional end track or other- + wise depending on recording time). Whether one file + or different files are then created depends on the + --BB option (see below). + + Select start index + --ii _n selects the index to start recording with. + Indices other than 1 will invoke the index scanner, + which will take some time to find the correct start + position. An offset may be given additionally (see + below). + + Set recording time + --dd nn sets recording time to _n seconds or set + recording time for whole track if _n is zero. In + order to specify the duration in frames (sectors) + also, the argument can have an appended 'f'. Then + the numerical argument is to be taken as frames + (sectors) rather than seconds. Please note that if + track ranges are being used they define the record- + ing time as well thus overriding any --dd option + specified times. + + Recording time is defined as the time the generated + sample will play (at the defined sample rate). + Since it's related to the amount of generated sam- + ples, it's not the time of the sampling process + itself (which can be less or more). It's neither + strictly coupled with the time information on the + audio CD (shown by your hifi CD player). Differ- + ences can occur by the usage of the --oo option (see + below). Notice that recording time will be short- + ened, unless enough disk space exists. Recording + can be aborted at anytime by pressing the break + character (signal SIGQUIT). + + Record all tracks of a complete audio CD in seperate files + --BB copies each track into a seperate file. A base + name can be given. File names have an appended + track number and an extension corresponding to the + audio format. To record all audio tracks of a CD, + use a sufficient high duration (i.e. -d99999). + + Set start sector offset + --oo _s_e_c_t_o_r_s increments start sector of the track by + _s_e_c_t_o_r_s. By this option you are able to skip a + certain amount at the beginning of a track so you + can pick exactly the part you want. Each sector + runs for 1/75 seconds, so you have very fine con- + trol. If your offset is so high that it would not + fit into the current track, a warning message is + issued and the offset is ignored. Recording time + is not reduced. (To skip introductory quiet pas- + sages automagically, use the --ww option see below.) + + Wait for signal option + --ww Turning on this option will suppress all silent + output at startup, reducing possibly file size. + ccddddaa22wwaavv will watch for any signal in the output + signal and switches on writing to file. + + Find extrem samples + --FF Turning on this option will display the most + negative and the most positive sample value found + during recording for both channels. This can be + useful for readjusting the volume. The values shown + are not reset at track boundaries, they cover the + complete sampling process. They are taken from the + original samples and have the same format (i.e. + they are independent of the selected output for- + mat). + + Find if input samples are in mono + --GG If this option is given, input samples for both + channels will be compared. At the end of the pro- + gram the result is printed. Differences in the + channels indicate stereo, otherwise when both chan- + nels are equal it will indicate mono. + + Undo the pre-emphasis in the input samples + --TT Some older audio CDs are recorded with a modi- + fied frequency response called pre-emphasis. This + is found mostly in classical recordings. The cor- + rection can be seen in the flags of the Table Of + Contents often. But there are recordings, that show + this setting only in the subchannels. If this + option is given, the index scanner will be started, + which reads the q-subchannel of each track. If pre- + emphasis is indicated in the q-subchannel of a + track, but not in the TOC, pre-emphasis will be + assumed to be present, and subsequently a reverse + filtering is done for this track before the samples + are written into the audio file. + + Set audio format + --OO aauuddiioottyyppee can be _w_a_v (for wav files) or _a_u or + _s_u_n (for sun PCM files) or _c_d_r or _r_a_w (for header- + less files to be used for cd writers). All file + samples are coded in linear pulse code modulation + (as done in the audio compact disc format). This + holds for all audio formats. Wav files are compat- + ible to Wind*ws sound files, they have lsb,msb byte + order as being used on the audio cd. The default + filename extension is '.wav'. Sun type files are + not like the older common logarithmically coded .au + files, but instead as mentioned above linear PCM is + used. The byte order is msb,lsb to be compatible. + The default filename extension is '.au'. The AIFF + and the newer variant AIFC from the Apple/SGI world + store their samples in bigendian format (msb,lsb). + In AIFC no compression is used. Finally the easi- + est 'format', the cdr aka raw format. It is done + per default in msb,lsb byte order to satisfy the + order wanted by most cd writers. Since there is no + header information in this format, the sample + parameters can only be identified by playing the + samples on a soundcard or similiar. The default + filename extension is '.cdr' or '.raw'. + + Select cdrom drive reading speed + --SS ssppeeeedd allows to switch the cdrom drive to a + certain level of speed in order to reduce read + errors. The argument is transfered verbatim to the + drive. Details depend very much on the cdrom + drives. An argument of 0 for example is often the + default speed of the drive, a value of 1 often + selects single speed. + + Enable MD5 checksums + --MM ccoouunntt enables calculation of MD-5 checksum for + 'count' bytes from the beginning of a track. This + was introduced for quick comparisons of tracks. + + Use Monty's libparanoia for reading of sectors + --ppaarraannooiiaa selects an alternate way of extracting + audio sectors. Monty's library is used with the + following default options: + + PARANOIA_MODE_FULL, but without PARANOIA_MODE_NEV- + ERSKIP + + for details see Monty's libparanoia documentation. + In this case the option --PP has no effect. + + Do linear or overlapping reading of sectors + (This applies unless option --ppaarraannooiiaa is used.) --PP + sseeccttoorrss sets the given number of sectors for ini- + tial overlap sampling for jitter correction. Two + cases are to be distinguished. For nonzero values, + some sectors are read twice to enable cdda2wav's + jitter correction. If an argument of zero is + given, no overlap sampling will be used. For + nonzero overlap sectors cdda2wav dynamically + adjusts the setting during sampling (like cdpara- + noia does). If no match can be found, cdda2wav + retries the read with an increased overlap. If the + amount of jitter is lower than the current over- + lapped samples, cdda2wav reduces the overlap set- + ting, resulting in a higher reading speed. The + argument given has to be lower than the total num- + ber of sectors per request (see option _-_n below). + Cdda2wav will check this setting and issues a error + message otherwise. The case of zero sectors is + nice on low load situations or errorfree (perfect) + cdrom drives and perfect (not scratched) audio cds. + + Set the transfer size + --nn sseeccttoorrss will set the transfer size to the spec- + ified sectors per request. + + Set number of ring buffer elements + --ll bbuuffffeerrss will allocate the specified number of + ring buffer elements. + + Set endianess of input samples + --CC eennddiiaanneessss will override the default settings of + the input format. Endianess can be set explicitly + to "little" or "big" or to the automatic endianess + detection based on voting with "guess". + + Set endianess of output samples + --EE eennddiiaanneessss (endianess can be "little" or "big") + will override the default settings of the output + format. + + Verbose option + --vv iitteemmlliisstt prints more information. A list allows + selection of different information items. + + ddiissaabbllee keeps quiet + + ttoocc displays the table of contents + + ssuummmmaarryy displays a summary of recording parameters + + iinnddiicceess invokes the index scanner and displays + start positions of indices + + ccaattaalloogg retrieves and displays a media catalog num- + ber + + ttrraacckkiidd retrieves and displays international stan- + dard recording codes + + sseeccttoorrss displays track start positions in absolute + sector notation + + To combine several requests just list the subop- + tions seperated with commas. + + The table of contents + The display will show the table of contents with + number of tracks and total time (displayed in + _m_m:_s_s._h_h format, _m_m=minutes, _s_s=seconds, _h_h=rounded + 1/100 seconds). The following list displays track + number and track time for each entry. The summary + gives a line per track describing the type of the + track. + + ttrraacckk pprreeeemmpphhaassiiss ccooppyyppeerrmmiitttteedd ttrraacckkttyyppee cchhaannss + + The ttrraacckk column holds the track number. pprreeeemmpphhaa-- + ssiiss shows if that track has been given a non linear + frequency response. NOTE: You can undo this effect + with the --TT option. ccooppyy--ppeerrmmiitttteedd indicates if + this track is allowed to copy. ttrraacckkttyyppee can be + data or audio. On multimedia CDs (except hidden + track CDs) both of them should be present. cchhaann-- + nneellss is defined for audio tracks only. There can be + two or four channels. + + No file output + --NN this debugging option switches off writing to a + file. + + No infofile generation + --HH this option switches off creation of an info + file and a cddb file. + + Generation of simple output for gui frontends + --gg this option switches on simple line formatting, + which is needed to support gui frontends (like xcd- + roast). + + Verbose SCSI logging + --VV this option switches on logging of SCSI com- + mands. This will produce a lot of output (when SCSI + devices are being used). This is needed for debug- + ging purposes. The format is the same as being used + with the cdrecord program from J�rg Schilling. I + will not describe it here. + + Quiet option + --qq suppresses all screen output except error + messages. That reduces cpu time resources. + + Just show information option + --JJ does not write a file, it only prints informa- + tion about the disc (depending on the --vv option). + This is just for information purposes. + +CCDDDDBBPP ssuuppppoorrtt + Lookup album and track titles option + --LL ccddddbbpp mmooddee Cdda2wav tries to retrieve per- + former, album-, and track titles from a cddbp + server. The default server right now is + 'freedb.freedb.org'. It is planned to have more + control over the server handling later. The param- + eter defines how multiple entries are handled: + + 0 interactive mode, the user chooses one of the + entries. + + 1 take the first entry without asking. + + Set server for title lookups + ccddddbbpp--sseerrvveerr sseerrvveerrnnaammee When using -L or --cddb, + the server being contacted can be set with this + option. + + Set portnumber for title lookups + ccddddbbpp--ppoorrtt ppoorrttnnuummbbeerr When using -L or --cddb, the + server port being contacted can be set with this + option. + +HHIINNTTSS OONN UUSSAAGGEE + Don't create samples you cannot read. First check your + sample player software and sound card hardware. I experi- + enced problems with very low sample rates (stereo <= 1575 + Hz, mono <= 3675 Hz) when trying to play them with stan- + dard WAV players for sound blaster (maybe they are not + legal in WWAAVV format). Most CD-Writers insist on audio sam- + ples in a bigendian format. Now cdda2wav supports the --EE + eennddiiaanneessss option to control the endianess of the written + samples. + + If your hardware is fast enough to run cdda2wav uninter- + rupted and your CD drive is one of the 'perfect' ones, you + will gain speed when switching all overlap sampling off + with the --PP 00 option. Further fine tuning can be done + with the --nn sseeccttoorrss option. You can specify how much sec- + tors should be requested in one go. + + Cdda2wav supports ppiippeess now. Use a filename of -- to let + cdda2wav output its samples to standard output. + + Conversion to other sound formats can be done using the + ssooxx program package (although the use of ssooxx --xx to change + the byte order of samples should be no more necessary; see + option --EE to change the output byteorder). + + If you want to sample more than one track into different + files in one run, this is currently possible with the --BB + option. When recording time exceeds the track limit a new + file will be opened for the next track. + +FFIILLEESS + Cdda2wav can generate a lot of files for various purposes. + + Audio files: + + There are audio files containing samples with default + extensions These files are not generated when option (-N) + is given. Multiple files may be written when the bulk copy + option (-B) is used. Individual file names can be given as + arguments. If the number of file names given is sufficient + to cover all included audio tracks, the file names will be + used verbatim. Otherwise, if there are less file names + than files needed to write the included tracks, the part + of the file name before the extension is extended with + '_dd' where dd represents the current track number. + + Cddb and Cdindex files: + + If cdda2wav detects cd-extra or cd-text (album/track) + title information, then .cddb and .cdindex files are gen- + erated unless suppressed by the option -H. They contain + suitable formatted entries for submission to audio cd + track title databases in the internet. The CDINDEX and + CDDB(tm) systems are currently supported. For more infor- + mation please visit www.musicbrainz.org and + www.freedb.com. + + Inf files: + + The inf files are describing the sample files and the part + from the audio cd, it was taken from. They are a means to + transfer information to a cd burning program like + cdrecord. For example, if the original audio cd had pre- + emphasis enabled, and cdda2wav -T did remove the pre- + emphasis, then the inf file has pre-emphasis not set + (since the audio file does not have it anymore), while the + .cddb and the .cdindex have pre-emphasis set as the origi- + nal does. + +WWAARRNNIINNGG + IIMMPPOORRTTAANNTT:: it is prohibited to sell copies of copyrighted + material by noncopyright holders. This program may not be + used to circumvent copyrights. The user acknowledges this + constraint when using the software. + +BBUUGGSS + Generation of md5 checksums is currently broken. + + Performance may not be optimal on slower systems. + + The index scanner may give timeouts. + + The resampling (rate conversion code) uses polynomial + interpolation, which is not optimal. + + Cdda2wav should use threads. + + Cdda2wav currently cannot sample hidden audio tracks + (track 1 index 0). + +AACCKKNNOOWWLLEEDDGGEEMMEENNTTSS + Thanks goto Project MODE (http://www.mode.net/) and Fraun- + hofer Institut f�r integrierte Schaltungen (FhG-IIS) + (http://www.iis.fhg.de/) for financial support. Plextor + Europe and Ricoh Japan provided cdrom disk drives and cd + burners which helped a lot to develop this software. + Rammi has helped a lot with the debugging and showed a lot + of stamina when hearing 100 times the first 16 seconds of + the first track of the Krupps CD. Libparanoia contributed + by Monty (Christopher Montgomery) xiphmont@mit.edu. + +AAUUTTHHOORR + Heiko Eissfeldt heiko@colossus.escape.de + +DDAATTEE + 11 Sep 2002 + + + + CDDA2WAV(1) diff --git a/scsilib/doc/cdda2wav.ps b/scsilib/doc/cdda2wav.ps new file mode 100644 index 0000000..eb0d31a --- /dev/null +++ b/scsilib/doc/cdda2wav.ps @@ -0,0 +1,1082 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.17.2 +%%CreationDate: Sun Dec 1 14:59:42 2002 +%%DocumentNeededResources: font Times-Roman +%%+ font Times-Bold +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.17 2 +%%Pages: 10 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.17 2 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 841.89 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron +/Zcaron/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE +/Times-Roman@0 ENC0/Times-Roman RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(CDD)72 48 Q(A2W)-.4 E -1.35(AV)-1.2 G 333.66 +(\(1\) CDD)1.35 F(A2W)-.4 E -1.35(AV)-1.2 G(\(1\))1.35 E/F1 10.95 +/Times-Bold@0 SF -.219(NA)72 84 S(ME).219 E F0(cdda2w)108 96 Q .4 -.2 +(av \255 a s)-.1 H(ampling utility that dumps CD audio data into w).2 E +.4 -.2(av s)-.1 H(ound \214les).2 E F1(SYNOPSIS)72 112.8 Q/F2 10 +/Times-Bold@0 SF(cdda2wa)108 124.8 Q(v)-.25 E F0([)2.813 E F2(-c)A/F3 10 +/Times-Italic@0 SF -.15(ch)2.813 G(ans).15 E F0 2.813(][).27 G F2(-s) +-2.813 E F0 2.813(][)C F2(-m)-2.813 E F0 2.813(][)C F2(-b)-2.813 E F3 +(bits)2.813 E F0 2.812(][).27 G F2(-r)-2.812 E F3 -.15(ra)2.812 G(te).15 +E F0 2.812(][).18 G F2(-a)-2.812 E F3(divider)2.812 E F0 2.812(][).73 G +F2(-t)-2.812 E F3(tr)2.812 E(ac)-.15 E(k)-.2 E F0([).67 E F3(+endtr)-.36 +E(ac)-.15 E(k)-.2 E F0 .312(]] [).67 F F2(-i)A F3(inde)2.812 E(x)-.2 E +F0 2.812(][).53 G F2(-o)-2.812 E F3(of)2.812 E(fset)-.18 E F0 2.812(][) +.68 G F2(-d)-2.812 E F3(dur)108 136.8 Q(ation)-.15 E F0 3.266(][).24 G +F2(-x)-3.266 E F0 3.266(][)C F2(-q)-3.266 E F0 3.266(][)C F2(-w)-3.266 E +F0 3.266(][)C F2(-v)-3.266 E F3(optlist)3.266 E F0 3.266(][).68 G F2(-V) +-3.266 E F0 3.267(][)C F2(-Q)-3.267 E F0 3.267(][)C F2(-J)-3.267 E F0 +3.267(][)C F2(-L)-3.267 E F3(cddbmode)3.267 E F0 3.267(][).18 G F2(-R) +-3.267 E F0 3.267(][)C F2(-P)-3.267 E F3(sector)3.267 E(s)-.1 E F0 3.267 +(][).27 G F2(-F)-3.267 E F0 3.267(][)C F2(-G)-3.267 E F0 3.267(][)C F2 +(-T)-3.267 E F0 3.267(][)C F2(-e)-3.267 E F0 3.267(][)C F2(-p)-3.267 E +F3(per)108 148.8 Q(centa)-.37 E -.1(ge)-.1 G F0 3.411(][).28 G F2(-n) +-3.411 E F3(sector)3.411 E(s)-.1 E F0 3.411(][).27 G F2(-l)-3.411 E F3 +-.2(bu)3.411 G -.18(ff).2 G(er).18 E(s)-.1 E F0 3.411(][).27 G F2(-N) +-3.411 E F0 3.411(][)C F2(-J)-3.411 E F0 3.411(][)C F2(-H)-3.411 E F0 +3.411(][)C F2(-g)-3.411 E F0 3.411(][)C F2(-B)-3.411 E F0 3.411(][)C F2 +(-D)-3.411 E F3(de)3.41 E(vice)-.15 E F0 3.41(][).18 G F2(-A)-3.41 E F3 +(auxde)3.41 E(vice)-.15 E F0 3.41(][).18 G F2(-I)-3.41 E F3(interface) +3.41 E F0 3.41(][).18 G F2(-O)-3.41 E F3(audiotype)108 160.8 Q F0 5.989 +(][).18 G F2(-C)-5.989 E F3(input-endianess)5.989 E F0 5.989(][).27 G F2 +(-E)-5.989 E F3(output-endianess)5.989 E F0 5.989(][).27 G F2(-M)-5.989 +E F3(count)5.989 E F0 5.989(][).68 G F2(-S)-5.989 E F3(speed)5.989 E F0 +5.989(][).77 G F2(-paranoia)-5.989 E F0 5.989(][)C F2(cddbp-)-5.989 E +(ser)108 172.8 Q -.1(ve)-.1 G(r=ser).1 E -.1(ve)-.1 G -.15(rn).1 G(ame) +.15 E F0 2.5(][)C F2(cddbp-port=portnumber)-2.5 E F0 2.5(][)C F3 +(\214lename\(s\))-.59 E F0(or)2.5 E F3(dir)2.5 E(ectories)-.37 E F0(]) +.27 E F1(DESCRIPTION)72 189.6 Q F2(cdda2wa)108 201.6 Q(v)-.25 E F0 .347 +(can retrie)2.847 F .647 -.15(ve a)-.25 H .347(udio tracks from CDR).15 +F .347(OM dri)-.4 F -.15(ve)-.25 G 2.847(s\().15 G .346 +(see README for a list of dri)-2.847 F -.15(ve)-.25 G .346 +(s\) that are capa-).15 F +(ble of reading audio data digitally to the host \()108 213.6 Q F2(CDD)A +(A)-.35 E F0(\).)A F1(OPTIONS)72 230.4 Q F2<ad44>108 242.4 Q F3(de)2.5 E +2.5(vice --de)-.15 F 2.5(v-)-.15 G(-de)-2.5 E(vice)-.15 E F0(uses)144 +254.4 Q F2(de)2.835 E(vice)-.15 E F0 .335(as the source for CDD)2.835 F +2.836(Ar)-.4 G 2.836(eading. F)-2.836 F .336(or e)-.15 F .336 +(xample /de)-.15 F .336(v/cdrom for the)-.25 F F2(cook)2.836 E(ed_ioctl) +-.1 E F0(inter)2.836 E(-)-.2 E -.1(fa)144 266.4 S .813 +(ce and Bus,ID,Lun for the).1 F F2(generic_scsi)3.312 E F0(interf)3.312 +E .812(ace. The)-.1 F F2(de)3.312 E(vice)-.15 E F0 .812 +(has to correspond with the inter)3.312 F(-)-.2 E -.1(fa)144 278.4 S +.597(ce setting \(see belo).1 F 3.097(w\). The)-.25 F .598 +(setting of the en)3.097 F .598(vironment v)-.4 F(ariable)-.25 E F2(CDD) +3.098 E(A_DEVICE)-.35 E F0 .598(is o)3.098 F -.15(ve)-.15 G(rridden).15 +E(by this option.)144 290.4 Q F2<ad41>108 307.2 Q F3(auxde)2.5 E 2.5 +(vice --auxde)-.15 F(vice)-.15 E F0(uses)144 319.2 Q F2(auxde)2.5 E +(vice)-.15 E F0(as CDR)2.5 E(OM dri)-.4 E .3 -.15(ve f)-.25 H +(or ioctl usage.).15 E F2<ad49>108 336 Q F3 2.5(interface --interface) +2.5 F F0 1.867(speci\214es the interf)144 348 R 1.867(ace for CDR)-.1 F +1.867(OM access:)-.4 F F2(generic_scsi)4.367 E F0 1.866 +(or \(on Linux, and FreeBSD systems\))4.367 F F2(cook)144 360 Q +(ed_ioctl)-.1 E F0(.)A F2<ad63>108 376.8 Q F3 -.15(ch)2.5 G 2.5 +(annels --c).15 F(hannels)-.15 E F0(uses)144 388.8 Q F2(1)2.5 E F0 +(for mono, or)2.5 E F2(2)2.5 E F0(for stereo recording, or)2.5 E F2(s) +2.5 E F0(for stereo recording with both channels sw)2.5 E(apped.)-.1 E +F2 2.5(\255s --ster)108 405.6 R(eo)-.18 E F0(sets to stereo recording.) +144 417.6 Q F2 2.5(\255m --mono)108 434.4 R F0(sets to mono recording.) +144 446.4 Q F2 2.5(\255x --max)108 463.2 R F0 +(sets maximum \(CD\) quality)144 475.2 Q(.)-.65 E F2<ad62>108 492 Q F3 +2.5(bits --bits-per)2.5 F(-sample)-.2 E F0 +(sets bits per sample per channel:)144 504 Q F2(8)2.5 E F0(,)A F2(12)2.5 +E F0(or)2.5 E F2(16)2.5 E F0(.)A F2<ad72>108 520.8 Q F3 -.15(ra)2.5 G +2.5(te --r).15 F(ate)-.15 E F0(sets rate in samples per second.)144 +532.8 Q(Possible v)5 E(alues are listed with the)-.25 E F2<ad52>2.5 E F0 +(option.)2.5 E F2<ad61>108 549.6 Q F3 2.5(divider --divider)2.5 F F0 +(sets rate to 44100Hz / di)144 561.6 Q(vider)-.25 E 5(.P)-.55 G +(ossible v)-5 E(alues are listed with the)-.25 E F2<ad52>2.5 E F0 +(option.)2.5 E F2 2.5(\255R --dump-rates)108 578.4 R F0(sho)144 590.4 Q +(ws a list of all sample rates and their di)-.25 E(viders.)-.25 E F2 2.5 +(\255P sectors --set-o)108 607.2 R -.1(ve)-.1 G(rlap).1 E F0 +(sets the initial number of o)144 619.2 Q -.15(ve)-.15 G(rlap).15 E F3 +(sector)2.5 E(s)-.1 E F0(for jitter correction.)2.5 E F2<ad6e>108 636 Q +F3(sector)2.5 E 5(s-)-.1 G(-sector)-5 E(s-per)-.1 E(-r)-.2 E(equest)-.37 +E F0(reads)144 648 Q F3(sector)2.5 E(s)-.1 E F0(per request.)2.5 E F2 +<ad6c>108 664.8 Q F3 -.2(bu)2.5 G -.18(ff).2 G(er).18 E 5(s-)-.1 G(-b)-5 +E(uf)-.2 E(fer)-.18 E(s-in-ring)-.1 E F0(uses a ring b)144 676.8 Q(uf) +-.2 E(fer with)-.25 E F3 -.2(bu)2.5 G -.18(ff).2 G(er).18 E(s)-.1 E F0 +(total.)2.5 E F2<ad74>108 693.6 Q F3(tr)2.5 E(ac)-.15 E(k+endtr)-.2 E +(ac)-.15 E 5(k-)-.2 G(-tr)-5 E(ac)-.15 E(k)-.2 E F0 +(selects the start track and optionally the end track.)144 705.6 Q(1)535 +768 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(CDD)72 48 Q(A2W)-.4 E -1.35(AV)-1.2 G 333.66 +(\(1\) CDD)1.35 F(A2W)-.4 E -1.35(AV)-1.2 G(\(1\))1.35 E/F1 10 +/Times-Bold@0 SF<ad69>108 84 Q/F2 10/Times-Italic@0 SF(inde)2.5 E 5(x-) +-.2 G(-inde)-5 E(x)-.2 E F0(selects the start inde)144 96 Q(x.)-.15 E F1 +<ad6f>108 112.8 Q F2(of)2.5 E 2.5(fset --of)-.18 F(fset)-.18 E F0 +(starts)144 124.8 Q F2(of)2.5 E(fset)-.18 E F0 +(sectors behind start track \(one sector equi)2.5 E -.25(va)-.25 G +(lents 1/75 seconds\).).25 E F1 2.5(\255O audiotype --output-f)108 141.6 +R(ormat)-.25 E F0 .646(can be)144 153.6 R F2(wav)3.146 E F0 .646 +(\(for w)3.146 F 1.046 -.2(av \214)-.1 H .646(les\) or).2 F F2(aif)3.146 +E(f)-.18 E F0 .646(\(for apple/sgi aif)3.146 F 3.146<668c>-.25 G .646 +(les\) or)-3.146 F F2(aifc)3.146 E F0 .646 +(\(for apple/sgi aifc \214les\) or)3.146 F F2(au)3.146 E F0(or)3.146 E +F2(sun)144 165.6 Q F0(\(for sun .au PCM \214les\) or)2.5 E F2(cdr)2.5 E +F0(or)2.5 E F2 -.15(ra)2.5 G(w).15 E F0 +(\(for headerless \214les to be used for cd writers\).)2.5 E F1<ad43>108 +182.4 Q F2 2.5(endianess --cdr)2.5 F(om-endianess)-.45 E F0 +(sets endianess of the input samples to ')144 194.4 Q +(little', 'big' or 'guess' to o)-.1 E -.15(ve)-.15 G(rride def).15 E +(aults.)-.1 E F1<ad45>108 211.2 Q F2 2.5(endianess --output-endianess) +2.5 F F0(sets endianess of the output samples to ')144 223.2 Q +(little' or 'big' to o)-.1 E -.15(ve)-.15 G(rride def).15 E(aults.)-.1 E +F1<ad64>108 240 Q F2(dur)2.5 E 2.5(ation --dur)-.15 F(ation)-.15 E F0 +.82(sets recording time in seconds or frames.)144 252 R .819 +(Frames \(sectors\) are indicated by a 'f)5.819 F 3.319('s).55 G(uf) +-3.319 E .819(\214x \(lik)-.25 F 3.319(e7)-.1 G(5f)-3.319 E +(for 75 sectors\).)144 264 Q F1(0)5 E F0(sets the time for whole track.) +2.5 E F1 2.5(\255B --b)108 280.8 R(ulk --alltracks)-.2 E F0 +(copies each track into a seperate \214le.)144 292.8 Q F1 2.5 +(\255w --wait)108 309.6 R F0 -.1(wa)144 321.6 S +(its for signal, then start recording.).1 E F1 2.5(\255F --\214nd-extr) +108 338.4 R(emes)-.18 E F0(\214nds e)144 350.4 Q +(xtrem amplitudes in samples.)-.15 E F1 2.5(\255G --\214nd-mono)108 +367.2 R F0(\214nds if input samples are in mono.)144 379.2 Q F1 2.5 +(\255T --deemphasize)108 396 R F0(undo the ef)144 408 Q +(fect of pre-emphasis in the input samples.)-.25 E F1 2.5(\255e --echo) +108 424.8 R F0(copies audio data to sound de)144 436.8 Q(vice e.g.)-.25 +E F1(/de)5 E(v/dsp)-.15 E F0(.)A F1 2.5(\255p per)108 453.6 R +(centage --set-pitch)-.18 E F0 +(changes pitch of audio data copied to sound de)144 465.6 Q(vice.)-.25 E +F1 2.5(\255v itemlist --v)108 482.4 R(erbose-le)-.1 E -.1(ve)-.15 G(l).1 +E F0 1.352(prints v)144 494.4 R 1.353(erbose information about the CD.) +-.15 F F1(Le)6.353 E -.1(ve)-.15 G(l).1 E F0 1.353 +(is a list of comma seperated suboptions. Each)3.853 F +(suboption controls the type of information to be reported.)144 506.4 Q +.4 LW 502.205 510.9 181.795 510.9 DL 12.5(Suboption Description)186.795 +520.4 R 502.205 524.9 181.795 524.9 DL 12.5(disable no)199.585 534.4 R +(information is gi)2.5 E -.15(ve)-.25 G(n, w).15 E(arnings appear ho)-.1 +E(we)-.25 E -.15(ve)-.25 G(r).15 E 12.5(all all)217.915 546.4 R +(information is gi)2.5 E -.15(ve)-.25 G(n).15 E 12.5(toc sho)215.695 +558.4 R 2.5(wt)-.25 G(able of contents)-2.5 E 12.5(summary sho)190.695 +570.4 R 2.5(was)-.25 G(ummary of the recording parameters)-2.5 E 12.5 +(indices determine)199.585 582.4 R(and display inde)2.5 E 2.5(xo)-.15 G +-.25(ff)-2.5 G(sets).25 E 12.5(catalog retrie)199.035 594.4 R .3 -.15 +(ve a)-.25 H(nd display the media catalog number MCN).15 E 12.5 +(trackid retrie)200.145 606.4 R .3 -.15(ve a)-.25 H +(nd display all Intern. Standard Recording Codes ISRC).15 E 12.5 +(sectors sho)200.145 618.4 R 2.5(wt)-.25 G +(he table of contents in start sector notation)-2.5 E 12.5(titles sho) +208.465 630.4 R 2.5(wt)-.25 G +(he table of contents with track titles \(when a)-2.5 E -.25(va)-.2 G +(ilable\)).25 E 502.205 634.9 181.795 634.9 DL 235.415 510.9 235.415 +634.9 DL 502.205 510.9 502.205 634.9 DL 181.795 510.9 181.795 634.9 DL +F1 2.5(\255N --no-write)108 647.2 R F0 +(does not write to a \214le, it just reads \(for deb)144 659.2 Q +(ugging purposes\).)-.2 E F1 2.5(\255J --inf)108 676 R(o-only)-.25 E F0 +(does not write to a \214le, it just gi)144 688 Q -.15(ve)-.25 G 2.5(si) +.15 G(nformation about the disc.)-2.5 E F1 2.5(\255L cddb)108 704.8 R +(mode --cddb)2.5 E F0 1.781(does a cddbp alb)144 716.8 R 1.781 +(um- and track title lookup based on the cddb id.)-.2 F 1.78 +(The parameter cddb mode)6.78 F(de\214nes ho)144 728.8 Q 2.5(wm)-.25 G +(ultiple entries shall be handled.)-2.5 E(2)535 768 Q EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(CDD)72 48 Q(A2W)-.4 E -1.35(AV)-1.2 G 333.66 +(\(1\) CDD)1.35 F(A2W)-.4 E -1.35(AV)-1.2 G(\(1\))1.35 E/F1 10 +/Times-Bold@0 SF(cddbp-ser)110.5 84 Q -.1(ve)-.1 G(r=ser).1 E -.1(ve)-.1 +G -.15(rn).1 G(ame).15 E F0(sets the serv)144 96 Q +(er to be contacted for title lookups.)-.15 E F1(cddbp-port=portnumber) +110.5 112.8 Q F0(sets the port number to be used for title lookups.)144 +124.8 Q F1 2.5(\255H --no-inf)108 141.6 R(o\214le)-.25 E F0 +(does not write an info \214le and a cddb \214le.)144 153.6 Q F1 2.5 +(\255g --gui)108 170.4 R F0 +(formats the output to be better parsable by gui frontends.)144 182.4 Q +F1 2.5(\255M count)108 199.2 R(--md5)2.5 E F0 +(enables calculation of MD-5 checksum for 'count' bytes from a be)144 +211.2 Q(ginning of a track.)-.15 E F1 2.5(\255S speed)108 228 R(--speed) +2.5 E F0(sets the cdrom de)144 240 Q +(vice to one of the selectable speeds for reading.)-.25 E F1 2.5 +(\255q --quiet)108 256.8 R F0(quiet operation, no screen output.)144 +268.8 Q F1 2.5(\255V --v)108 285.6 R(erbose-SCSI)-.1 E F0(enable SCSI c\ +ommand logging to the console. This is mainly used for deb)144 297.6 Q +(ugging.)-.2 E F1 2.5(\255Q --silent-SCSI)108 314.4 R F0(suppress SCSI \ +command error reports to the console. This is mainly used for guis.)144 +326.4 Q F1(\255paranoia)108 343.2 Q F0 +(use the paranoia library instead of cdda2w)144 355.2 Q -.2(av)-.1 G 1.1 +-.55('s r).2 H(outines for reading.).55 E F1 2.5(\255h --help)108 372 R +F0(display v)144 384 Q(ersion of cdda2w)-.15 E .4 -.2(av o)-.1 H 2.5(ns) +.2 G(tandard output.)-2.5 E(Def)108 400.8 Q(aults depend on the)-.1 E F1 +(Mak)144 412.8 Q(e\214le)-.1 E F0(and)2.5 E F1(en)2.5 E(vir)-.4 E +(onment v)-.18 E(ariable)-.1 E F0(settings \(currently)2.5 E F1(CDD)2.5 +E(A_DEVICE)-.35 E F0(\).)2.5 E/F2 10.95/Times-Bold@0 SF(ENVIR)72 429.6 Q +(ONMENT V)-.329 E(ARIABLES)-1.478 E F1(CDD)108 441.6 Q(A_DEVICE)-.35 E +F0 1.056(is used to set the de)3.556 F 1.056(vice name. The de)-.25 F +1.056(vice naming is compatible with J\366r)-.25 F 3.556(gS)-.18 G +(chilling')-3.556 E(s)-.55 E(cdrecord package.)108 453.6 Q F1(CDDBP_SER) +108 470.4 Q(VER)-.55 E F0 +(is used for cddbp title lookups when supplied.)144 482.4 Q F1 +(CDDBP_POR)108 499.2 Q(T)-.4 E F0 +(is used for cddbp title lookups when supplied.)144 511.2 Q F1(RSH)108 +528 Q F0 .128(If the)15.44 F F1(RSH)2.628 E F0(en)2.628 E .128 +(vironment v)-.4 F .127 +(ariable is present, the remote connection will not be created via)-.25 +F F1 -.18(rc)2.627 G(md).18 E F0(\(3\))A -.2(bu)144 540 S 2.585(tb).2 G +2.585(yc)-2.585 G .085(alling the program pointed to by)-2.585 F F1(RSH) +2.586 E F0 5.086(.U)C .086(se e.g.)-5.086 F F1(RSH=)5.086 E F0 .086 +(/usr/bin/ssh to create a secure shell)B(connection.)144 552 Q .321 +(Note that this forces)144 576 R F1(cdda2wa)2.821 E(v)-.25 E F0 .321 +(to create a pipe to the)2.821 F F1(rsh\(1\))2.82 E F0 .32 +(program and disallo)2.82 F(ws)-.25 E F1(cdda2wa)2.82 E(v)-.25 E F0(to) +2.82 E .28(directly access the netw)144 588 R .28(ork sock)-.1 F .28 +(et to the remote serv)-.1 F(er)-.15 E 5.281(.T)-.55 G .281(his mak) +-5.281 F .281(es it impossible to set up perfor)-.1 F(-)-.2 E .813 +(mance parameters and slo)144 600 R .813(ws do)-.25 F .813 +(wn the connection compared to a)-.25 F F1 -.18(ro)3.313 G(ot).18 E F0 +(initiated)3.313 E F1 -.18(rc)3.313 G(md\(3\)).18 E F0(connec-)3.313 E +(tion.)144 612 Q F1(RSCSI)108 628.8 Q F0 1.382(If the)6.55 F F1(RSCSI) +3.882 E F0(en)3.882 E 1.382(vironment v)-.4 F 1.383 +(ariable is present, the remote SCSI serv)-.25 F 1.383 +(er will not be the program)-.15 F F1(/opt/schily/sbin/rscsi)144 640.8 Q +F0 -.2(bu)3.737 G 3.737(tt).2 G 1.236(he program pointed to by)-3.737 F +F1(RSCSI)3.736 E F0 6.236(.N)C 1.236(ote that the remote SCSI serv) +-6.236 F(er)-.15 E .553(program name will be ignored if you log in usin\ +g an account that has been created with a remote)144 652.8 R(SCSI serv) +144 664.8 Q(er program as login shell.)-.15 E F2(RETURN V)72 681.6 Q +(ALUES)-1.478 E F1(cdda2wa)108 693.6 Q(v)-.25 E F0(uses the follo)2.5 E +(wing e)-.25 E(xit codes to indicate v)-.15 E(arious de)-.25 E +(gress of success:)-.15 E(3)535 768 Q EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(CDD)72 48 Q(A2W)-.4 E -1.35(AV)-1.2 G 333.66 +(\(1\) CDD)1.35 F(A2W)-.4 E -1.35(AV)-1.2 G(\(1\))1.35 E .4 LW 490.03 +76.5 157.97 76.5 DL 12.5(Exitcode Description)162.97 86 R 490.03 90.5 +157.97 90.5 DL 15(0n)193.52 100 S 2.5(oe)-15 G +(rrors encountered, successful operation.)-2.5 E 15(1u)193.52 112 S +(sage or syntax error)-15 E 2.5(.c)-.55 G(dda2w)-2.5 E .4 -.2(av g)-.1 H +(ot inconsistent ar).2 E(guments.)-.18 E 15(2p)193.52 124 S +(ermission \(un\)set errors. permission changes f)-15 E(ailed.)-.1 E 15 +(3r)193.52 136 S(ead errors on the cdrom/b)-15 E(urner de)-.2 E +(vice encountered.)-.25 E 15(4w)193.52 148 S +(rite errors while writing one of the output \214les encountered.)-15 E +15(5e)193.52 160 S +(rrors with soundcard handling \(initialization/write\).)-15 E 15(6e) +193.52 172 S(rrors with stat\(\) system call on the read de)-15 E +(vice \(cook)-.25 E(ed ioctl\).)-.1 E 15(7p)193.52 184 S +(ipe communication errors encountered \(in fork)-15 E(ed mode\).)-.1 E +15(8s)193.52 196 S(ignal handler installation errors encountered.)-15 E +15(9a)193.52 208 S(llocation of shared memory f)-15 E(ailed \(in fork) +-.1 E(ed mode\).)-.1 E 12.5(10 dynamic)188.52 220 R +(heap memory allocation f)2.5 E(ailed.)-.1 E 12.5(11 errors)188.52 232 R +(on the audio cd medium encountered.)2.5 E 12.5(12 de)188.52 244 R +(vice open error in ioctl handling detected.)-.25 E 12.5(13 race)188.52 +256 R(condition in ioctl interf)2.5 E(ace handling detected.)-.1 E 12.5 +(14 error)188.52 268 R(in ioctl\(\) operation encountered.)2.5 E 12.5 +(15 internal)188.52 280 R(error encountered. Please report back!!!)2.5 E +12.5(16 error)188.52 292 R +(in semaphore operation encountered \(install / request\).)2.5 E 12.5 +(17 could)188.52 304 R(not get the scsi transfer b)2.5 E(uf)-.2 E(fer) +-.25 E(.)-.55 E 12.5(18 could)188.52 316 R +(not create pipes for process communication \(in fork)2.5 E(ed mode\).) +-.1 E 490.03 320.5 157.97 320.5 DL 206.02 76.5 206.02 320.5 DL 490.03 +76.5 490.03 320.5 DL 157.97 76.5 157.97 320.5 DL/F1 10.95/Times-Bold@0 +SF(DISCUSSION)72 332.8 Q/F2 10/Times-Bold@0 SF(cdda2wa)108 344.8 Q(v) +-.25 E F0 .723(is able to read parts of an)3.224 F F2(audio)3.223 E F0 +.723(CD or)3.223 F F2(multimedia)3.223 E F0(CDR)3.223 E .723 +(OM \(containing audio parts\) directly)-.4 F(digitally)108 356.8 Q 2.5 +(.T)-.65 G +(hese parts can be written to a \214le, a pipe, or to a sound de)-2.5 E +(vice.)-.25 E F2(cdda2wa)108 373.6 Q(v)-.25 E F0 .832(stands for)3.332 F +F2(CDD)3.332 E(A)-.35 E F0(to)3.332 E F2 -1.2(WA)3.332 G(V)-.25 E F0 +(\(where)3.332 E F2(CDD)3.332 E(A)-.35 E F0 .832 +(stands for compact disc digital audio and)3.332 F F2 -1.2(WA)3.333 G(V) +-.25 E F0 .833(is a)3.333 F .198(sound sample format introduced by MS W) +108 385.6 R(indo)-.4 E 2.697(ws\). It)-.25 F(allo)2.697 E .197(ws cop) +-.25 F(ying)-.1 E F2(CDD)2.697 E(A)-.35 E F0 .197 +(audio data from the CDR)2.697 F(OM)-.4 E(dri)108 397.6 Q .3 -.15(ve i) +-.25 H(nto a \214le in).15 E F2 -1.2(WA)2.5 G(V)-.25 E F0 +(or other formats.)2.5 E .396(The latest v)108 414.4 R .396(ersions try\ + to get higher real-time scheduling priorities to ensure smooth \(unint\ +errupted\) opera-)-.15 F 1.097(tion. These priorities are a)108 426.4 R +-.25(va)-.2 G 1.097(ilable for super users and are higher than those of\ + 'normal' processes. Thus).25 F(delays are minimized.)108 438.4 Q .628 +(If your CDR)108 455.2 R .629(OM is on de)-.4 F(vice)-.25 E F2(DEV)3.129 +E F0 .629(and it is loaded with an audio CD, you may simply in)3.129 F +-.2(vo)-.4 G -.1(ke).2 G F2(cdda2wa)3.229 E(v)-.25 E(de)108 467.2 Q +(v=DEV)-.15 E F0 .634(and it will create the sound \214le)3.135 F F2 +(audio.wa)3.134 E(v)-.25 E F0 .634(recording the whole track be)3.134 F +.634(ginning with track 1 in)-.15 F .872(stereo at 16 bit at 44100 Hz s\ +ample rate, if your \214le system has enough space free.)108 479.2 R +.873(Otherwise recording)5.873 F(time will be limited. F)108 491.2 Q +(or details see \214les)-.15 E F2(README)2.5 E F0(and)2.5 E F2 +(README.INST)2.5 E(ALL)-.9 E F1(HINTS ON OPTIONS)72 508 Q F0(Options)108 +520 Q .019(Most of the options are used to control the format of the W) +144 532 R 2.719 -1.35(AV \214)-1.2 H .019(le. In the follo)1.35 F .019 +(wing te)-.25 F .019(xt all of them)-.15 F(are described.)144 544 Q +(Select De)108 560.8 Q(vice)-.25 E F2<ad44>144 572.8 Q/F3 10 +/Times-Italic@0 SF(de)3.057 E(vice)-.15 E F0 .557(selects the CDR)3.057 +F .557(OM dri)-.4 F .857 -.15(ve d)-.25 H -.25(ev).15 G .557 +(ice to be used.).25 F .558(The speci\214er gi)5.557 F -.15(ve)-.25 G +3.058(ns).15 G .558(hould correspond to)-3.058 F 1.12 +(the selected interf)144 584.8 R 1.12(ace \(see belo)-.1 F(w\).)-.25 E +F2(CHANGE!)6.12 E F0 -.15(Fo)6.12 G 3.62(rt).15 G 1.12(he cook)-3.62 F +1.12(ed_ioctl interf)-.1 F 1.12(ace this is the cdrom)-.1 F(de)144 596.8 +Q .844(vice descriptor as before.)-.25 F F2 .844(The SCSI de)5.844 F +.845(vices used with the generic SCSI interface ho)-.15 F(we)-.1 E -.1 +(ve)-.15 G(r).1 E(ar)144 608.8 Q 2.76(en)-.18 G .46 -.1(ow a)-2.76 H +(ddr).1 E .259(essed with their SCSI-Bus, SCSI-Id, and SCSI-Lun instead\ + of the generic SCSI)-.18 F(de)144 620.8 Q .485(vice descriptor!!!)-.15 +F F0 .485(One e)5.485 F .485(xample for a SCSI CDR)-.15 F .485(OM dri) +-.4 F .785 -.15(ve o)-.25 H 2.985(nb).15 G .485 +(us 0 with SCSI ID 3 and lun 0)-3.185 F(is -D0,3,0.)144 632.8 Q +(Select Auxiliary de)108 649.6 Q(vice)-.25 E F2<ad41>144 661.6 Q F3 +(auxde)2.826 E(vice)-.15 E F0 .326 +(is necessary for CD-Extra handling. F)2.826 F .325(or Non-SCSI-CDR)-.15 +F .325(OM dri)-.4 F -.15(ve)-.25 G 2.825(st).15 G .325(his is the same) +-2.825 F(de)144 673.6 Q .058(vice as gi)-.25 F -.15(ve)-.25 G 2.558(nb) +.15 G 2.558(y-)-2.558 G 2.559(D\()-2.558 G .059(see abo)-2.559 F -.15 +(ve)-.15 G .059(\). F).15 F .059(or SCSI-CDR)-.15 F .059(OM dri)-.4 F +-.15(ve)-.25 G 2.559(si).15 G 2.559(ti)-2.559 G 2.559(st)-2.559 G .059 +(he CDR)-2.559 F .059(OM dri)-.4 F .359 -.15(ve \()-.25 H .059 +(SCSI\) de).15 F(vice)-.25 E(\(i.e.)144 685.6 Q F2(/de)5.45 E(v/sr0)-.15 +E F0 2.95(\)c)2.95 G .45(orresponding to the SCSI de)-2.95 F .45 +(vice \(i.e.)-.25 F F2(0,3,0)5.45 E F0 .45(\). It has to match the de) +2.95 F .45(vice used for)-.25 F(sampling.)144 697.6 Q(4)535 768 Q EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(CDD)72 48 Q(A2W)-.4 E -1.35(AV)-1.2 G 333.66 +(\(1\) CDD)1.35 F(A2W)-.4 E -1.35(AV)-1.2 G(\(1\))1.35 E(Select Interf) +108 84 Q(ace)-.1 E/F1 10/Times-Bold@0 SF<ad49>144 96 Q/F2 10 +/Times-Italic@0 SF(interface)3.469 E F0 .969(selects the CDR)3.469 F +.969(OM dri)-.4 F 1.269 -.15(ve i)-.25 H(nterf).15 E .969(ace. F)-.1 F +.969(or SCSI dri)-.15 F -.15(ve)-.25 G 3.469(su).15 G .97 +(se generic_scsi \(cook)-3.469 F(ed_ioctl)-.1 E 2.276(may not yet be a) +144 108 R -.25(va)-.2 G 2.276(ilable for all de).25 F(vices\):)-.25 E F1 +(generic_scsi)4.776 E F0(and)4.776 E F1(cook)4.776 E(ed_ioctl)-.1 E F0 +7.275(.T)C 2.275(he \214rst uses the)-7.275 F .005(generic SCSI interf) +144 120 R .005(ace, the latter uses the ioctl of the CDR)-.1 F .006 +(OM dri)-.4 F -.15(ve)-.25 G 1.106 -.55(r. T).15 H .006(he latter v).55 +F .006(ariant w)-.25 F .006(orks only)-.1 F 1.376(when the k)144 132 R +1.376(ernel dri)-.1 F -.15(ve)-.25 G 3.876(rs).15 G(upports)-3.876 E F1 +(CDD)3.876 E(A)-.35 E F0 1.376 +(reading. This entry has to match the selected CDR)3.876 F(OM)-.4 E(de) +144 144 Q(vice \(see abo)-.25 E -.15(ve)-.15 G(\).).15 E +(Enable echo to soundcard)108 160.8 Q F1<ad65>144 172.8 Q F0 .48(copies\ + audio data to the sound card while recording, so you hear it nearly si\ +multaneously)2.98 F 2.98(.T)-.65 G(he)-2.98 E .92(soundcard gets the sa\ +me data that is recorded. This is time critical, so it w)144 184.8 R +.919(orks best with the)-.1 F F1<ad71>3.419 E F0 4.678(option. T)144 +196.8 R 4.678(ou)-.8 G(se)-4.678 E F1(cdda2wa)4.678 E(v)-.25 E F0 2.179 +(as a pseudo CD player without recording in a \214le you could use)4.678 +F F1(cdda2wa)144 208.8 Q 3.145<76ad>-.25 G 3.145<71ad>-3.145 G 3.145 +<65ad>-3.145 G .645(t2 \255d0 \255N)-3.145 F F0 .645 +(to play the whole second track. This feature reduces the recording) +3.145 F .368(speed to at most onefold speed. Y)144 220.8 R .368 +(ou cannot mak)-1.1 F 2.868(eb)-.1 G .368 +(etter recordings than your sound card can play)-2.868 F +(\(since the same data is used\).)144 232.8 Q +(Change pitch of echoed audio)108 249.6 Q F1 .299(\255p per)144 261.6 R +(centage)-.18 E F0 .298 +(changes the pitch of all audio echoed to a sound card. Only the cop) +2.799 F 2.798(yt)-.1 G 2.798(ot)-2.798 G .298(he sound-)-2.798 F .388 +(card is af)144 273.6 R .389 +(fected, the recorded audio samples in a \214le remain the same.)-.25 F +.389(Normal pitch, which is the)5.389 F(def)144 285.6 Q .764 +(ault, is gi)-.1 F -.15(ve)-.25 G 3.264(nb).15 G 3.264(y1)-3.264 G 3.264 +(00%. Lo)-3.264 F .764(wer percentages correspond to lo)-.25 F .763 +(wer pitches, i.e.)-.25 F .763(-p 50 transposes)5.763 F .69 +(the audio output one octa)144 297.6 R .99 -.15(ve l)-.2 H -.25(ow).15 G +(er).25 E 5.69(.S)-.55 G .691(ee also the script)-5.69 F F1(pitchplay) +3.191 E F0 .691(as an e)3.191 F .691(xample. This option w)-.15 F(as)-.1 +E(contrib)144 309.6 Q(uted by Raul Sobon.)-.2 E +(Select mono or stereo recording)108 326.4 Q F1<ad6d>144 338.4 Q F0(or) +3.463 E F1 .963(\255c 1)3.463 F F0 .963 +(selects mono recording \(both stereo channels are mix)3.463 F(ed\),) +-.15 E F1<ad73>3.463 E F0(or)3.462 E F1 .962(\255c 2)3.462 F F0(or)3.462 +E F1 .962(\255c s)3.462 F F0(selects)3.462 E(stereo recording. P)144 +350.4 Q(arameter s will sw)-.15 E(ap both sound channels.)-.1 E +(Select maximum quality)108 367.2 Q F1<ad78>144 379.2 Q F0 1.866 +(will set stereo, 16 bits per sample at 44.1 KHz \(full CD quality\).) +4.366 F 1.867(Note that other format)6.867 F(options gi)144 391.2 Q -.15 +(ve)-.25 G 2.5(nl).15 G(ater can change this setting.)-2.5 E +(Select sample quality)108 408 Q F1 .622(\255b 8)144 420 R F0 .622 +(speci\214es 8 bit \(1 Byte\) for each sample in each channel;)3.122 F +F1 .621(\255b 12)3.121 F F0 .621(speci\214es 12 bit \(2 Byte\) for)3.121 +F 1.444(each sample in each channel;)144 432 R F1 1.444(\255b 16)3.944 F +F0 1.444(speci\214es 16 bit \(2 Byte\) for each sample in each channel) +3.944 F 1.441(\(Ensure that your sample player or sound card is capable\ + of playing 12-bit or 16-bit samples\).)144 444 R 1.34 +(Selecting 12 or 16 bits doubles \214le size.)144 456 R 1.341 +(12-bit samples are aligned to 16-bit samples, so the)6.341 F(y)-.15 E +-.1(wa)144 468 S(ste some disk space.).1 E(Select sample rate)108 484.8 +Q F1<ad72>144 496.8 Q F2(sampler)2.63 E(ate)-.15 E F0 .13 +(selects a sample rate.)2.63 F F2(sampler)5.13 E(ate)-.15 E F0 .129 +(can be in a range between 44100 and 900. Option)2.629 F F1<ad52>144 +508.8 Q F0(lists all a)2.5 E -.25(va)-.2 G(ilable rates.).25 E +(Select sample rate di)108 525.6 Q(vider)-.25 E F1<ad61>144 537.6 Q F2 +(divider)4.206 E F0 1.706(selects a sample rate di)4.206 F(vider)-.25 E +(.)-.55 E F2(divider)6.706 E F0 1.706 +(can be minimally 1 and maximally 50.5 and)4.206 F -2.15 -.25(ev e)144 +549.6 T(rything between in steps of 0.5.).25 E(Option)5 E F1<ad52>2.5 E +F0(lists all a)2.5 E -.25(va)-.2 G(ilable rates.).25 E 1.963 -.8(To m) +144 566.4 T(ak).8 E 2.863(et)-.1 G .363(he sound smoother at lo)-2.863 F +.363(wer sampling rates,)-.25 F F1(cdda2wa)2.862 E(v)-.25 E F0 .362 +(sums o)2.862 F -.15(ve)-.15 G(r).15 E F2(n)2.862 E F0 .362 +(samples \(where)2.862 F F2(n)2.862 E F0(is)2.862 E .016 +(the speci\214c di)144 578.4 R .016 +(vidend\). So for 22050 Hertz output we ha)-.25 F .317 -.15(ve t)-.2 H +2.517(os).15 G .017(um o)-2.517 F -.15(ve)-.15 G 2.517(r2s).15 G .017 +(amples, for 900 Hertz we)-2.517 F(ha)144 590.4 Q 1.268 -.15(ve t)-.2 H +3.468(os).15 G .968(um o)-3.468 F -.15(ve)-.15 G 3.468(r4).15 G 3.468 +(9s)-3.468 G 3.467(amples. This)-3.468 F .967 +(cancels higher frequencies. Standard sector size of an audio)3.467 F +.141(CD \(ignoring additional information\) is 2352 Bytes. In order to \ +\214nish summing for an output sam-)144 602.4 R .108 +(ple at sector boundaries the rates abo)144 614.4 R .408 -.15(ve h)-.15 +H -2.25 -.2(av e).15 H .108(to be choosen.)2.808 F .108 +(Arbitrary sampling rates in high qual-)5.108 F .079(ity w)144 626.4 R +.079(ould require some interpolation scheme, which needs much more soph\ +isticated programming.)-.1 F(List a table of all sampling rates)108 +643.2 Q F1<ad52>144 655.2 Q F0(sho)2.639 E .139 +(ws a list of all sample rates and their di)-.25 F .138(viders. Di)-.25 +F .138(viders can range from 1 to 50.5 in steps of)-.25 F(0.5.)144 667.2 +Q(Select start track and optionally end track)108 684 Q F1<ad74>144 696 +Q F2(n+m)3.529 E F0(selects)3.529 E F1(n)3.529 E F0 1.029 +(as the start track and optionally)3.529 F F1(m)3.529 E F0 1.029 +(as the last track of a range to be recorded.)3.529 F 1.86 +(These tracks must be from the table of contents.)144 708 R 1.859 +(This sets the track where recording be)6.859 F(gins.)-.15 E .641 +(Recording can adv)144 720 R .641(ance through the follo)-.25 F .641 +(wing tracks as well \(limited by the optional end track or)-.25 F(5)535 +768 Q EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(CDD)72 48 Q(A2W)-.4 E -1.35(AV)-1.2 G 333.66 +(\(1\) CDD)1.35 F(A2W)-.4 E -1.35(AV)-1.2 G(\(1\))1.35 E 2.454 +(otherwise depending on recording time\). Whether one \214le or dif)144 +84 R 2.454(ferent \214les are then created)-.25 F(depends on the)144 96 +Q/F1 10/Times-Bold@0 SF<ad42>2.5 E F0(option \(see belo)2.5 E(w\).)-.25 +E(Select start inde)108 112.8 Q(x)-.15 E F1<ad69>144 124.8 Q/F2 10 +/Times-Italic@0 SF(n)3.224 E F0 .724(selects the inde)3.224 F 3.224(xt) +-.15 G 3.224(os)-3.224 G .724(tart recording with.)-3.224 F .724 +(Indices other than 1 will in)5.724 F -.2(vo)-.4 G .924 -.1(ke t).2 H +.725(he inde).1 F 3.225(xs)-.15 G(canner)-3.225 E(,)-.4 E .893 +(which will tak)144 136.8 R 3.393(es)-.1 G .893 +(ome time to \214nd the correct start position. An of)-3.393 F .892 +(fset may be gi)-.25 F -.15(ve)-.25 G 3.392(na).15 G(dditionally)-3.392 +E(\(see belo)144 148.8 Q(w\).)-.25 E(Set recording time)108 165.6 Q F1 +2.61(\255d n)144 177.6 R F0 .11(sets recording time to)2.61 F F2(n)2.61 +E F0 .11(seconds or set recording time for whole track if)2.61 F F2(n) +2.61 E F0 .11(is zero. In order to)2.61 F 1.35 +(specify the duration in frames \(sectors\) also, the ar)144 189.6 R +1.35(gument can ha)-.18 F 1.65 -.15(ve a)-.2 H 3.85(na).15 G 1.35 +(ppended 'f)-3.85 F 1.35('. Then the).55 F .12(numerical ar)144 201.6 R +.12(gument is to be tak)-.18 F .121 +(en as frames \(sectors\) rather than seconds.)-.1 F .121 +(Please note that if track)5.121 F .547(ranges are being used the)144 +213.6 R 3.046(yd)-.15 G .546(e\214ne the recording time as well thus o) +-3.046 F -.15(ve)-.15 G .546(rriding an).15 F(y)-.15 E F1<ad64>3.046 E +F0 .546(option speci-)3.046 F(\214ed times.)144 225.6 Q .535(Recording \ +time is de\214ned as the time the generated sample will play \(at the d\ +e\214ned sample rate\).)144 242.4 R 1.263(Since it')144 254.4 R 3.763 +(sr)-.55 G 1.263(elated to the amount of generated samples, it')-3.763 F +3.762(sn)-.55 G 1.262(ot the time of the sampling process)-3.762 F .968 +(itself \(which can be less or more\).)144 266.4 R(It')5.968 E 3.468(sn) +-.55 G .968(either strictly coupled with the time information on the) +-3.468 F .885(audio CD \(sho)144 278.4 R .885 +(wn by your hi\214 CD player\).)-.25 F(Dif)5.885 E .885 +(ferences can occur by the usage of the)-.25 F F1<ad6f>3.384 E F0 +(option)3.384 E .005(\(see belo)144 290.4 R .006(w\). Notice that recor\ +ding time will be shortened, unless enough disk space e)-.25 F .006 +(xists. Record-)-.15 F(ing can be aborted at an)144 302.4 Q +(ytime by pressing the break character \(signal SIGQ)-.15 E(UIT\).)-.1 E +(Record all tracks of a complete audio CD in seperate \214les)108 319.2 +Q F1<ad42>144 331.2 Q F0 .28 +(copies each track into a seperate \214le. A base name can be gi)2.78 F +-.15(ve)-.25 G .28(n. File names ha).15 F .58 -.15(ve a)-.2 H 2.78(na) +.15 G(ppended)-2.78 E .63(track number and an e)144 343.2 R .631 +(xtension corresponding to the audio format. T)-.15 F 3.131(or)-.8 G +.631(ecord all audio tracks of a)-3.131 F(CD, use a suf)144 355.2 Q +(\214cient high duration \(i.e. -d99999\).)-.25 E(Set start sector of) +108 372 Q(fset)-.25 E F1<ad6f>144 384 Q F2(sector)2.541 E(s)-.1 E F0 +.041(increments start sector of the track by)2.541 F F2(sector)2.541 E +(s)-.1 E F0 5.041(.B).27 G 2.54(yt)-5.041 G .04 +(his option you are able to skip a cer)-2.54 F(-)-.2 E .106 +(tain amount at the be)144 396 R .107 +(ginning of a track so you can pick e)-.15 F .107(xactly the part you w) +-.15 F .107(ant. Each sector runs)-.1 F .677 +(for 1/75 seconds, so you ha)144 408 R .977 -.15(ve ve)-.2 H .677 +(ry \214ne control. If your of).15 F .677(fset is so high that it w)-.25 +F .677(ould not \214t into)-.1 F 1.251(the current track, a w)144 420 R +1.251(arning message is issued and the of)-.1 F 1.251(fset is ignored.) +-.25 F 1.252(Recording time is not)6.252 F 2.5(reduced. \(T)144 432 R +2.5(os)-.8 G(kip introductory quiet passages automagically)-2.5 E 2.5 +(,u)-.65 G(se the)-2.5 E F1<ad77>2.5 E F0(option see belo)2.5 E -.65(w.) +-.25 G(\)).65 E -.8(Wa)108 448.8 S(it for signal option).8 E F1<ad77>144 +460.8 Q F0 -.45(Tu)3.865 G 1.365(rning on this option will suppress all\ + silent output at startup, reducing possibly \214le size.).45 F F1 +(cdda2wa)144 472.8 Q(v)-.25 E F0(will w)2.5 E(atch for an)-.1 E 2.5(ys) +-.15 G(ignal in the output signal and switches on writing to \214le.) +-2.5 E(Find e)108 489.6 Q(xtrem samples)-.15 E F1<ad46>144 501.6 Q F0 +-.45(Tu)2.66 G .16(rning on this option will display the most ne).45 F +-.05(ga)-.15 G(ti).05 E .46 -.15(ve a)-.25 H .16(nd the most positi).15 +F .46 -.15(ve s)-.25 H .16(ample v).15 F .16(alue found)-.25 F 1.617(du\ +ring recording for both channels. This can be useful for readjusting th\ +e v)144 513.6 R 1.616(olume. The v)-.2 F(alues)-.25 E(sho)144 525.6 Q +.266(wn are not reset at track boundaries, the)-.25 F 2.766(yc)-.15 G +-.15(ove)-2.766 G 2.766(rt).15 G .266(he complete sampling process. The) +-2.766 F 2.766(ya)-.15 G .266(re tak)-2.766 F(en)-.1 E .377 +(from the original samples and ha)144 537.6 R .677 -.15(ve t)-.2 H .377 +(he same format \(i.e. the).15 F 2.877(ya)-.15 G .377 +(re independent of the selected out-)-2.877 F(put format\).)144 549.6 Q +(Find if input samples are in mono)108 566.4 Q F1<ad47>144 578.4 Q F0 +1.028(If this option is gi)3.528 F -.15(ve)-.25 G 1.028 +(n, input samples for both channels will be compared. At the end of the) +.15 F 1.534(program the result is printed. Dif)144 590.4 R 1.534 +(ferences in the channels indicate stereo, otherwise when both)-.25 F +(channels are equal it will indicate mono.)144 602.4 Q +(Undo the pre-emphasis in the input samples)108 619.2 Q F1<ad54>144 +631.2 Q F0 .639 +(Some older audio CDs are recorded with a modi\214ed frequenc)3.139 F +3.14(yr)-.15 G .64(esponse called pre-emphasis.)-3.14 F .027(This is fo\ +und mostly in classical recordings. The correction can be seen in the \ +\215ags of the T)144 643.2 R .026(able Of)-.8 F 1.418 +(Contents often. But there are recordings, that sho)144 655.2 R 3.919 +(wt)-.25 G 1.419(his setting only in the subchannels. If this)-3.919 F +.849(option is gi)144 667.2 R -.15(ve)-.25 G .849(n, the inde).15 F +3.349(xs)-.15 G .849 +(canner will be started, which reads the q-subchannel of each track. If) +-3.349 F .298 +(pre-emphasis is indicated in the q-subchannel of a track, b)144 679.2 R +.298(ut not in the T)-.2 F .299(OC, pre-emphasis will be)-.18 F .77 +(assumed to be present, and subsequently a re)144 691.2 R -.15(ve)-.25 G +.769(rse \214ltering is done for this track before the sam-).15 F +(ples are written into the audio \214le.)144 703.2 Q(6)535 768 Q EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(CDD)72 48 Q(A2W)-.4 E -1.35(AV)-1.2 G 333.66 +(\(1\) CDD)1.35 F(A2W)-.4 E -1.35(AV)-1.2 G(\(1\))1.35 E +(Set audio format)108 84 Q/F1 10/Times-Bold@0 SF 2.564(\255O audiotype) +144 96 R F0 .064(can be)2.564 F/F2 10/Times-Italic@0 SF(wav)2.564 E F0 +.065(\(for w)2.564 F .465 -.2(av \214)-.1 H .065(les\) or).2 F F2(au) +2.565 E F0(or)2.565 E F2(sun)2.565 E F0 .065(\(for sun PCM \214les\) or) +2.565 F F2(cdr)2.565 E F0(or)2.565 E F2 -.15(ra)2.565 G(w).15 E F0 .065 +(\(for head-)2.565 F .667(erless \214les to be used for cd writers\).) +144 108 R .667 +(All \214le samples are coded in linear pulse code modulation)5.667 F +.677(\(as done in the audio compact disc format\). This holds for all a\ +udio formats.)144 120 R -1.1 -.8(Wa v)5.677 H .677(\214les are com-) +3.977 F .703(patible to W)144 132 R .703(ind*ws sound \214les, the)-.4 F +3.203(yh)-.15 G -2.25 -.2(av e)-3.203 H .702 +(lsb,msb byte order as being used on the audio cd. The)3.402 F(def)144 +144 Q .382(ault \214lename e)-.1 F .382(xtension is '.w)-.15 F -.2(av) +-.1 G 2.882('. Sun).2 F .382(type \214les are not lik)2.882 F 2.882(et) +-.1 G .383(he older common log)-2.882 F(arithmically)-.05 E .055 +(coded .au \214les, b)144 156 R .055(ut instead as mentioned abo)-.2 F +.355 -.15(ve l)-.15 H .054 +(inear PCM is used. The byte order is msb,lsb to be).15 F .725 +(compatible. The def)144 168 R .725(ault \214lename e)-.1 F .725 +(xtension is '.au'.)-.15 F .725(The AIFF and the ne)5.725 F .725(wer v) +-.25 F .725(ariant AIFC from)-.25 F .002(the Apple/SGI w)144 180 R .001 +(orld store their samples in bigendian format \(msb,lsb\). In AIFC no c\ +ompression is)-.1 F 3.427(used. Finally)144 192 R .927 +(the easiest 'format', the cdr aka ra)3.427 F 3.427(wf)-.15 G .927 +(ormat. It is done per def)-3.427 F .927(ault in msb,lsb byte)-.1 F .722 +(order to satisfy the order w)144 204 R .722 +(anted by most cd writers. Since there is no header information in this) +-.1 F 1.182(format, the sample parameters can only be identi\214ed by p\ +laying the samples on a soundcard or)144 216 R(similiar)144 228 Q 2.5 +(.T)-.55 G(he def)-2.5 E(ault \214lename e)-.1 E +(xtension is '.cdr' or '.ra)-.15 E(w'.)-.15 E(Select cdrom dri)108 244.8 +Q .3 -.15(ve r)-.25 H(eading speed).15 E F1 3.922(\255S speed)144 256.8 +R F0(allo)3.922 E 1.422(ws to switch the cdrom dri)-.25 F 1.722 -.15 +(ve t)-.25 H 3.922(oac).15 G 1.422(ertain le)-3.922 F -.15(ve)-.25 G +3.922(lo).15 G 3.921(fs)-3.922 G 1.421(peed in order to reduce read) +-3.921 F .501(errors. The ar)144 268.8 R .501(gument is transfered v) +-.18 F .501(erbatim to the dri)-.15 F -.15(ve)-.25 G 5.501(.D).15 G .501 +(etails depend v)-5.501 F .502(ery much on the cdrom)-.15 F(dri)144 +280.8 Q -.15(ve)-.25 G 3.454(s. An).15 F(ar)3.454 E .954 +(gument of 0 for e)-.18 F .954(xample is often the def)-.15 F .954 +(ault speed of the dri)-.1 F -.15(ve)-.25 G 3.453(,av).15 G .953 +(alue of 1 often)-3.703 F(selects single speed.)144 292.8 Q +(Enable MD5 checksums)108 309.6 Q F1 2.628(\255M count)144 321.6 R F0 +.128(enables calculation of MD-5 checksum for 'count' bytes from the be) +2.628 F .128(ginning of a track.)-.15 F(This w)144 333.6 Q +(as introduced for quick comparisons of tracks.)-.1 E(Use Monty')108 +350.4 Q 2.5(sl)-.55 G(ibparanoia for reading of sectors)-2.5 E F1 +(\255paranoia)144 362.4 Q F0 1.015(selects an alternate w)3.515 F 1.015 +(ay of e)-.1 F 1.015(xtracting audio sectors. Monty')-.15 F 3.515(sl) +-.55 G 1.015(ibrary is used with the)-3.515 F(follo)144 374.4 Q +(wing def)-.25 E(ault options:)-.1 E -.92(PA)144 398.4 S +(RANOIA_MODE_FULL, b).92 E(ut without P)-.2 E(ARANOIA_MODE_NEVERSKIP) +-.92 E(for details see Monty')144 422.4 Q 2.5(sl)-.55 G +(ibparanoia documentation.)-2.5 E(In this case the option)5 E F1<ad50> +2.5 E F0(has no ef)2.5 E(fect.)-.25 E(Do linear or o)108 439.2 Q -.15 +(ve)-.15 G(rlapping reading of sectors).15 E .669 +(\(This applies unless option)144 451.2 R F1(\255paranoia)3.169 E F0 +.669(is used.\))3.169 F F1 3.169(\255P sectors)5.669 F F0 .669 +(sets the gi)3.169 F -.15(ve)-.25 G 3.17(nn).15 G .67 +(umber of sectors for)-3.17 F .012(initial o)144 463.2 R -.15(ve)-.15 G +.012(rlap sampling for jitter correction. T).15 F .211 -.1(wo c)-.8 H +.011(ases are to be distinguished. F).1 F .011(or nonzero v)-.15 F +(alues,)-.25 E .037(some sectors are read twice to enable cdda2w)144 +475.2 R -.2(av)-.1 G 1.137 -.55('s j).2 H .038(itter correction.).55 F +.038(If an ar)5.038 F .038(gument of zero is gi)-.18 F -.15(ve)-.25 G +(n,).15 E .44(no o)144 487.2 R -.15(ve)-.15 G .44 +(rlap sampling will be used.).15 F -.15(Fo)5.44 G 2.94(rn).15 G .44 +(onzero o)-2.94 F -.15(ve)-.15 G .44(rlap sectors cdda2w).15 F .84 -.2 +(av d)-.1 H .44(ynamically adjusts the).2 F 1.077 +(setting during sampling \(lik)144 499.2 R 3.578(ec)-.1 G 1.078 +(dparanoia does\).)-3.578 F 1.078(If no match can be found, cdda2w)6.078 +F 1.478 -.2(av r)-.1 H 1.078(etries the).2 F .782 +(read with an increased o)144 511.2 R -.15(ve)-.15 G 3.281(rlap. If).15 +F .781(the amount of jitter is lo)3.281 F .781(wer than the current o) +-.25 F -.15(ve)-.15 G .781(rlapped sam-).15 F 1.489(ples, cdda2w)144 +523.2 R 1.889 -.2(av r)-.1 H 1.489(educes the o).2 F -.15(ve)-.15 G +1.489(rlap setting, resulting in a higher reading speed.).15 F 1.49 +(The ar)6.49 F(gument)-.18 E(gi)144 535.2 Q -.15(ve)-.25 G 5.349(nh).15 +G 2.849(as to be lo)-5.349 F 2.849 +(wer than the total number of sectors per request \(see option)-.25 F F2 +(-n)5.348 E F0(belo)5.348 E(w\).)-.25 E(Cdda2w)144 547.2 Q .451 -.2 +(av w)-.1 H .052 +(ill check this setting and issues a error message otherwise.).2 F .052 +(The case of zero sectors is)5.052 F 1.079(nice on lo)144 559.2 R 3.579 +(wl)-.25 G 1.079(oad situations or errorfree \(perfect\) cdrom dri) +-3.579 F -.15(ve)-.25 G 3.578(sa).15 G 1.078 +(nd perfect \(not scratched\) audio)-3.578 F(cds.)144 571.2 Q +(Set the transfer size)108 588 Q F1 2.5(\255n sectors)144 600 R F0 +(will set the transfer size to the speci\214ed sectors per request.)2.5 +E(Set number of ring b)108 616.8 Q(uf)-.2 E(fer elements)-.25 E F1 2.5 +(\255l b)144 628.8 R(uffers)-.2 E F0 +(will allocate the speci\214ed number of ring b)2.5 E(uf)-.2 E +(fer elements.)-.25 E(Set endianess of input samples)108 645.6 Q F1 +3.004(\255C endianess)144 657.6 R F0 .504(will o)3.004 F -.15(ve)-.15 G +.504(rride the def).15 F .504(ault settings of the input format.)-.1 F +.504(Endianess can be set e)5.504 F(xplic-)-.15 E(itly to "little" or "\ +big" or to the automatic endianess detection based on v)144 669.6 Q +(oting with "guess".)-.2 E(Set endianess of output samples)108 686.4 Q +F1 3.35(\255E endianess)144 698.4 R F0 .849 +(\(endianess can be "little" or "big"\) will o)3.35 F -.15(ve)-.15 G +.849(rride the def).15 F .849(ault settings of the output)-.1 F(format.) +144 710.4 Q(7)535 768 Q EP +%%Page: 8 8 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(CDD)72 48 Q(A2W)-.4 E -1.35(AV)-1.2 G 333.66 +(\(1\) CDD)1.35 F(A2W)-.4 E -1.35(AV)-1.2 G(\(1\))1.35 E -1.11(Ve)108 84 +S(rbose option)1.11 E/F1 10/Times-Bold@0 SF 2.5(\255v itemlist)144 96 R +F0(prints more information. A list allo)2.5 E(ws selection of dif)-.25 E +(ferent information items.)-.25 E F1(disable)144 120 Q F0 -.1(ke)2.5 G +(eps quiet).1 E F1(toc)144 144 Q F0(displays the table of contents)2.5 E +F1(summary)144 168 Q F0(displays a summary of recording parameters)2.5 E +F1(indices)144 192 Q F0(in)2.5 E -.2(vo)-.4 G -.1(ke).2 G 2.5(st).1 G +(he inde)-2.5 E 2.5(xs)-.15 G +(canner and displays start positions of indices)-2.5 E F1(catalog)144 +216 Q F0(retrie)2.5 E -.15(ve)-.25 G 2.5(sa).15 G +(nd displays a media catalog number)-2.5 E F1(trackid)144 240 Q F0 +(retrie)2.5 E -.15(ve)-.25 G 2.5(sa).15 G +(nd displays international standard recording codes)-2.5 E F1(sectors) +144 264 Q F0(displays track start positions in absolute sector notation) +2.5 E 1.6 -.8(To c)144 288 T(ombine se).8 E -.15(ve)-.25 G +(ral requests just list the suboptions seperated with commas.).15 E +(The table of contents)108 304.8 Q 1.365(The display will sho)144 316.8 +R 3.865(wt)-.25 G 1.365(he table of contents with number of tracks and \ +total time \(displayed in)-3.865 F/F2 10/Times-Italic@0 SF(mm)144 328.8 +Q F0(:).32 E F2(ss).34 E F0(.).27 E F2(hh)A F0(format,)3.311 E F2(mm) +3.311 E F0(=minutes,).32 E F2(ss)3.311 E F0(=seconds,).27 E F2(hh)3.311 +E F0 .811(=rounded 1/100 seconds\).).28 F .811(The follo)5.811 F .811 +(wing list dis-)-.25 F .62 +(plays track number and track time for each entry)144 340.8 R 5.62(.T) +-.65 G .62(he summary gi)-5.62 F -.15(ve)-.25 G 3.12(sal).15 G .62 +(ine per track describing)-3.12 F(the type of the track.)144 352.8 Q F1 +(track pr)234.88 376.8 Q(eemphasis copypermitted tracktype chans)-.18 E +F0(The)144 400.8 Q F1(track)2.861 E F0 .361 +(column holds the track number)2.861 F(.)-.55 E F1(pr)5.361 E(eemphasis) +-.18 E F0(sho)2.861 E .36(ws if that track has been gi)-.25 F -.15(ve) +-.25 G 2.86(nan).15 G(on)-2.86 E .495(linear frequenc)144 412.8 R 2.995 +(yr)-.15 G 2.995(esponse. NO)-2.995 F .495(TE: Y)-.4 F .495 +(ou can undo this ef)-1.1 F .496(fect with the)-.25 F F1<ad54>2.996 E F0 +(option.)2.996 E F1(copy-permitted)5.496 E F0 1.292 +(indicates if this track is allo)144 424.8 R 1.291(wed to cop)-.25 F +-.65(y.)-.1 G F1(tracktype)6.941 E F0 1.291 +(can be data or audio. On multimedia CDs)3.791 F(\(e)144 436.8 Q .913 +(xcept hidden track CDs\) both of them should be present.)-.15 F F1 +(channels)5.913 E F0 .914(is de\214ned for audio tracks)3.414 F(only)144 +448.8 Q 2.5(.T)-.65 G(here can be tw)-2.5 E 2.5(oo)-.1 G 2.5(rf)-2.5 G +(our channels.)-2.5 E(No \214le output)108 465.6 Q F1<ad4e>144 477.6 Q +F0(this deb)2.5 E(ugging option switches of)-.2 E 2.5(fw)-.25 G +(riting to a \214le.)-2.5 E(No info\214le generation)108 494.4 Q F1 +<ad48>144 506.4 Q F0(this option switches of)2.5 E 2.5(fc)-.25 G +(reation of an info \214le and a cddb \214le.)-2.5 E +(Generation of simple output for gui frontends)108 523.2 Q F1<ad67>144 +535.2 Q F0 .731(this option switches on simple line formatting, which i\ +s needed to support gui frontends \(lik)3.232 F(e)-.1 E(xcd-roast\).)144 +547.2 Q -1.11(Ve)108 564 S(rbose SCSI logging)1.11 E F1<ad56>144 576 Q +F0 .835(this option switches on logging of SCSI commands. This will pro\ +duce a lot of output \(when)3.335 F .599(SCSI de)144 588 R .598 +(vices are being used\).)-.25 F .598(This is needed for deb)5.598 F .598 +(ugging purposes. The format is the same as)-.2 F +(being used with the cdrecord program from J\366r)144 600 Q 2.5(gS)-.18 +G 2.5(chilling. I)-2.5 F(will not describe it here.)2.5 E(Quiet option) +108 616.8 Q F1<ad71>144 628.8 Q F0(suppresses all screen output e)2.5 E +(xcept error messages.)-.15 E(That reduces cpu time resources.)5 E +(Just sho)108 645.6 Q 2.5(wi)-.25 G(nformation option)-2.5 E F1<ad4a>144 +657.6 Q F0 1.072(does not write a \214le, it only prints information ab\ +out the disc \(depending on the)3.572 F F1<ad76>3.573 E F0(option\).) +3.573 E(This is just for information purposes.)144 669.6 Q/F3 10.95 +/Times-Bold@0 SF(CDDBP support)72 686.4 Q F0(Lookup alb)108 698.4 Q +(um and track titles option)-.2 E F1 4.186(\255L cddbp)144 710.4 R(mode) +4.186 E F0(Cdda2w)4.186 E 2.086 -.2(av t)-.1 H 1.686(ries to retrie).2 F +1.986 -.15(ve p)-.25 H(erformer).15 E 4.186(,a)-.4 G(lb)-4.186 E 1.685 +(um-, and track titles from a cddbp)-.2 F(serv)144 722.4 Q(er)-.15 E +2.836(.T)-.55 G .336(he def)-2.836 F .336(ault serv)-.1 F .336 +(er right no)-.15 F 2.837(wi)-.25 G 2.837(s')-2.837 G(freedb)-2.837 E +(.freedb)-.4 E(.or)-.4 E 2.837(g'. It)-.18 F .337(is planned to ha)2.837 +F .637 -.15(ve m)-.2 H .337(ore control o).15 F -.15(ve)-.15 G(r).15 E +(8)535 768 Q EP +%%Page: 9 9 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(CDD)72 48 Q(A2W)-.4 E -1.35(AV)-1.2 G 333.66 +(\(1\) CDD)1.35 F(A2W)-.4 E -1.35(AV)-1.2 G(\(1\))1.35 E(the serv)144 84 +Q(er handling later)-.15 E 5(.T)-.55 G(he parameter de\214nes ho)-5 E +2.5(wm)-.25 G(ultiple entries are handled:)-2.5 E 35.55(0i)108 100.8 S +(nteracti)-35.55 E .3 -.15(ve m)-.25 H +(ode, the user chooses one of the entries.).15 E 35.55(1t)108 117.6 S +(ak)-35.55 E 2.5(et)-.1 G(he \214rst entry without asking.)-2.5 E +(Set serv)108 134.4 Q(er for title lookups)-.15 E/F1 10/Times-Bold@0 SF +(cddbp-ser)144 146.4 Q -.1(ve)-.1 G 5.638(rs).1 G(er)-5.638 E -.1(ve)-.1 +G -.15(rn).1 G(ame).15 E F0 .638(When using \255L or --cddb, the serv) +3.138 F .638(er being contacted can be set with)-.15 F(this option.)144 +158.4 Q(Set portnumber for title lookups)108 175.2 Q F1 3.652 +(cddbp-port portnumber)144 187.2 R F0 1.152 +(When using \255L or --cddb, the serv)3.652 F 1.152 +(er port being contacted can be set)-.15 F(with this option.)144 199.2 Q +/F2 10.95/Times-Bold@0 SF(HINTS ON USA)72 216 Q(GE)-.602 E F0(Don')108 +228 Q 2.83(tc)-.18 G .33 +(reate samples you cannot read. First check your sample player softw) +-2.83 F .33(are and sound card hardw)-.1 F .33(are. I)-.1 F -.15(ex)108 +240 S .69(perienced problems with v).15 F .69(ery lo)-.15 F 3.19(ws)-.25 +G .69(ample rates \(stereo <= 1575 Hz, mono <= 3675 Hz\) when trying to) +-3.19 F .841(play them with standard W)108 252 R 3.541 -1.35(AV p)-1.2 H +.841(layers for sound blaster \(maybe the)1.35 F 3.34(ya)-.15 G .84 +(re not le)-3.34 F -.05(ga)-.15 G 3.34(li).05 G(n)-3.34 E F1 -1.2(WA) +3.34 G(V)-.25 E F0 .84(format\). Most)3.34 F 1.384 +(CD-Writers insist on audio samples in a bigendian format.)108 264 R(No) +6.384 E 3.884(wc)-.25 G(dda2w)-3.884 E 1.785 -.2(av s)-.1 H 1.385 +(upports the).2 F F1 3.885(\255E endianess)3.885 F F0 +(option to control the endianess of the written samples.)108 276 Q .908 +(If your hardw)108 292.8 R .908(are is f)-.1 F .908 +(ast enough to run cdda2w)-.1 F 1.308 -.2(av u)-.1 H .908 +(ninterrupted and your CD dri).2 F 1.208 -.15(ve i)-.25 H 3.407(so).15 G +.907(ne of the 'perfect')-3.407 F .523(ones, you will g)108 304.8 R .524 +(ain speed when switching all o)-.05 F -.15(ve)-.15 G .524 +(rlap sampling of).15 F 3.024(fw)-.25 G .524(ith the)-3.024 F F1 3.024 +(\255P 0)3.024 F F0 .524(option. Further \214ne tun-)3.024 F .275 +(ing can be done with the)108 316.8 R F1 2.775(\255n sectors)2.775 F F0 +.275(option. Y)2.775 F .275(ou can specify ho)-1.1 F 2.775(wm)-.25 G +.274(uch sectors should be requested in one)-2.775 F(go.)108 328.8 Q +(Cdda2w)108 345.6 Q .4 -.2(av s)-.1 H(upports).2 E F1(pipes)2.5 E F0(no) +2.5 E 1.3 -.65(w. U)-.25 H(se a \214lename of).65 E F1<ad>2.5 E F0 +(to let cdda2w)2.5 E .4 -.2(av o)-.1 H +(utput its samples to standard output.).2 E(Con)108 362.4 Q -.15(ve)-.4 +G .392(rsion to other sound formats can be done using the).15 F F1(sox) +2.892 E F0 .392(program package \(although the use of)2.892 F F1 .393 +(sox -x)2.893 F F0 .204(to change the byte order of samples should be n\ +o more necessary; see option)108 374.4 R F1<ad45>2.703 E F0 .203 +(to change the output byte-)2.703 F(order\).)108 386.4 Q .411(If you w) +108 403.2 R .411(ant to sample more than one track into dif)-.1 F .412 +(ferent \214les in one run, this is currently possible with the)-.25 F +F1<ad42>108 415.2 Q F0(option. When recording time e)2.5 E +(xceeds the track limit a ne)-.15 E 2.5<778c>-.25 G +(le will be opened for the ne)-2.5 E(xt track.)-.15 E F2(FILES)72 432 Q +F0(Cdda2w)108 444 Q .4 -.2(av c)-.1 H +(an generate a lot of \214les for v).2 E(arious purposes.)-.25 E +(Audio \214les:)108 468 Q .433 +(There are audio \214les containing samples with def)108 492 R .433 +(ault e)-.1 F .432 +(xtensions These \214les are not generated when option)-.15 F .721 +(\(-N\) is gi)108 504 R -.15(ve)-.25 G .721 +(n. Multiple \214les may be written when the b).15 F .721(ulk cop)-.2 F +3.221(yo)-.1 G .721(ption \(-B\) is used. Indi)-3.221 F .722 +(vidual \214le names)-.25 F .146(can be gi)108 516 R -.15(ve)-.25 G +2.646(na).15 G 2.646(sa)-2.646 G -.18(rg)-2.646 G .146 +(uments. If the number of \214le names gi).18 F -.15(ve)-.25 G 2.646(ni) +.15 G 2.646(ss)-2.646 G(uf)-2.646 E .146(\214cient to co)-.25 F -.15(ve) +-.15 G 2.645(ra).15 G .145(ll included audio tracks,)-2.645 F .643 +(the \214le names will be used v)108 528 R 3.143(erbatim. Otherwise,) +-.15 F .643 +(if there are less \214le names than \214les needed to write the)3.143 F +.762(included tracks, the part of the \214le name before the e)108 540 R +.762(xtension is e)-.15 F .761(xtended with '_dd' where dd represents) +-.15 F(the current track number)108 552 Q(.)-.55 E(Cddb and Cdinde)108 +576 Q 2.5<788c>-.15 G(les:)-2.5 E 1.269(If cdda2w)108 600 R 1.669 -.2 +(av d)-.1 H 1.269(etects cd-e).2 F 1.269(xtra or cd-te)-.15 F 1.269 +(xt \(alb)-.15 F 1.269 +(um/track\) title information, then .cddb and .cdinde)-.2 F 3.77<788c> +-.15 G 1.27(les are)-3.77 F 1.249 +(generated unless suppressed by the option -H. The)108 612 R 3.749(yc) +-.15 G 1.248(ontain suitable formatted entries for submission to)-3.749 +F 1.249(audio cd track title databases in the internet. The CDINDEX and\ + CDDB\(tm\) systems are currently sup-)108 624 R(ported. F)108 636 Q +(or more information please visit www)-.15 E(.musicbrainz.or)-.65 E 2.5 +(ga)-.18 G(nd www)-2.5 E(.freedb)-.65 E(.com.)-.4 E(Inf \214les:)108 660 +Q .738(The inf \214les are describing the sample \214les and the part f\ +rom the audio cd, it w)108 684 R .737(as tak)-.1 F .737(en from. The)-.1 +F 3.237(ya)-.15 G .737(re a)-3.237 F .5 +(means to transfer information to a cd b)108 696 R .501 +(urning program lik)-.2 F 3.001(ec)-.1 G .501(drecord. F)-3.001 F .501 +(or e)-.15 F .501(xample, if the original audio cd)-.15 F .384 +(had pre-emphasis enabled, and cdda2w)108 708 R .784 -.2(av -)-.1 H +2.884(Td).2 G .384(id remo)-2.884 F .684 -.15(ve t)-.15 H .384 +(he pre-emphasis, then the inf \214le has pre-empha-).15 F 1.652 +(sis not set \(since the audio \214le does not ha)108 720 R 1.953 -.15 +(ve i)-.2 H 4.153(ta).15 G -.15(ny)-4.153 G 1.653 +(more\), while the .cddb and the .cdinde).15 F 4.153(xh)-.15 G -2.25 -.2 +(av e)-4.153 H(pre-)4.353 E(9)535 768 Q EP +%%Page: 10 10 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(CDD)72 48 Q(A2W)-.4 E -1.35(AV)-1.2 G 333.66 +(\(1\) CDD)1.35 F(A2W)-.4 E -1.35(AV)-1.2 G(\(1\))1.35 E +(emphasis set as the original does.)108 84 Q/F1 10.95/Times-Bold@0 SF +-1.314(WA)72 100.8 S(RNING)1.314 E/F2 10/Times-Bold@0 SF(IMPOR)108 112.8 +Q -.9(TA)-.4 G(NT).9 E(:)-.74 E F0 1.039 +(it is prohibited to sell copies of cop)3.54 F 1.039 +(yrighted material by noncop)-.1 F 1.039(yright holders. This pro-)-.1 F +1.226(gram may not be used to circumv)108 124.8 R 1.226(ent cop)-.15 F +3.726(yrights. The)-.1 F 1.226(user ackno)3.726 F 1.226 +(wledges this constraint when using the)-.25 F(softw)108 136.8 Q(are.) +-.1 E F1 -.11(BU)72 153.6 S(GS).11 E F0 +(Generation of md5 checksums is currently brok)108 165.6 Q(en.)-.1 E +(Performance may not be optimal on slo)108 189.6 Q(wer systems.)-.25 E +(The inde)108 213.6 Q 2.5(xs)-.15 G(canner may gi)-2.5 E .3 -.15(ve t) +-.25 H(imeouts.).15 E(The resampling \(rate con)108 237.6 Q -.15(ve)-.4 +G(rsion code\) uses polynomial interpolation, which is not optimal.).15 +E(Cdda2w)108 261.6 Q .4 -.2(av s)-.1 H(hould use threads.).2 E(Cdda2w) +108 285.6 Q .4 -.2(av c)-.1 H +(urrently cannot sample hidden audio tracks \(track 1 inde).2 E 2.5(x0) +-.15 G(\).)-2.5 E F1 -.602(AC)72 302.4 S(KNO).602 E(WLEDGEMENTS)-.548 E +F0 1.896(Thanks goto Project MODE \(http://www)108 314.4 R 1.896 +(.mode.net/\) and Fraunhofer Institut f\374r inte)-.65 F 1.896 +(grierte Schaltungen)-.15 F .879(\(FhG-IIS\) \(http://www)108 326.4 R +.879(.iis.fhg.de/\) for \214nancial support.)-.65 F(Ple)5.879 E .879 +(xtor Europe and Ricoh Japan pro)-.15 F .88(vided cdrom)-.15 F .883 +(disk dri)108 338.4 R -.15(ve)-.25 G 3.383(sa).15 G .882(nd cd b)-3.383 +F .882(urners which helped a lot to de)-.2 F -.15(ve)-.25 G .882 +(lop this softw).15 F 3.382(are. Rammi)-.1 F .882 +(has helped a lot with the)3.382 F(deb)108 350.4 Q .319(ugging and sho) +-.2 F .32(wed a lot of stamina when hearing 100 times the \214rst 16 se\ +conds of the \214rst track of the)-.25 F(Krupps CD.)108 362.4 Q +(Libparanoia contrib)5 E +(uted by Monty \(Christopher Montgomery\) xiphmont@mit.edu.)-.2 E F1 +-.548(AU)72 379.2 S(THOR).548 E F0(Heik)108 391.2 Q 2.5(oE)-.1 G +(issfeldt heik)-2.5 E(o@colossus.escape.de)-.1 E F1 -.383(DA)72 408 S +(TE)-.657 E F0(11 Sep 2002)108 420 Q(10)530 768 Q EP +%%Trailer +end +%%EOF diff --git a/scsilib/doc/cdrecord.man b/scsilib/doc/cdrecord.man new file mode 100644 index 0000000..6a507ec --- /dev/null +++ b/scsilib/doc/cdrecord.man @@ -0,0 +1,1458 @@ +CDRECORD(1) Schily's USER COMMANDS CDRECORD(1) + + + +NNAAMMEE + cdrecord - record audio or data Compact Discs from a mas- + ter + +SSYYNNOOPPSSIISS + ccddrreeccoorrdd [ _g_e_n_e_r_a_l _o_p_t_i_o_n_s ] ddeevv==_d_e_v_i_c_e [ _t_r_a_c_k _o_p_t_i_o_n_s ] + _t_r_a_c_k_1..._t_r_a_c_k_n + + +DDEESSCCRRIIPPTTIIOONN + CCddrreeccoorrdd is used to record data or audio Compact Discs on + an Orange Book CD-Recorder. + + The _d_e_v_i_c_e refers to _s_c_s_i_b_u_s/_t_a_r_g_e_t/_l_u_n of the CD- + Recorder. Communication on _S_u_n_O_S is done with the SCSI + general driver ssccgg.. Other operating systems are using a + library simulation of this driver. Possible syntax is: + ddeevv== _s_c_s_i_b_u_s,_t_a_r_g_e_t,_l_u_n or ddeevv== _t_a_r_g_e_t,_l_u_n. In the latter + case, the CD-Recorder has to be connected to the default + SCSI bus of the machine. _S_c_s_i_b_u_s, _t_a_r_g_e_t and _l_u_n are + integer numbers. Some operating systems or SCSI transport + implementations may require to specify a filename in addi- + tion. In this case the correct syntax for the device is: + ddeevv== _d_e_v_i_c_e_n_a_m_e:_s_c_s_i_b_u_s,_t_a_r_g_e_t,_l_u_n or ddeevv== _d_e_v_i_c_e_n_a_m_e:_t_a_r_- + _g_e_t,_l_u_n. If the name of the device node that has been + specified on such a system refers to exactly one SCSI + device, a shorthand in the form ddeevv== _d_e_v_i_c_e_n_a_m_e:_@ or ddeevv== + _d_e_v_i_c_e_n_a_m_e:_@,_l_u_n may be used instead of ddeevv== _d_e_v_i_c_e_- + _n_a_m_e:_s_c_s_i_b_u_s,_t_a_r_g_e_t,_l_u_n. + + + To access remote SCSI devices, you need to prepend the + SCSI device name by a remote device indicator. The remote + device indicator is either RREEMMOOTTEE::_u_s_e_r_@_h_o_s_t_: or + RREEMMOOTTEE::_h_o_s_t_: + A valid remote SCSI device name may be: RREEMMOOTTEE::_u_s_e_r_@_h_o_s_t_: + to allow remote SCSI bus scanning or + RREEMMOOTTEE::_u_s_e_r_@_h_o_s_t_:_1_,_0_,_0 to access the SCSI device at _h_o_s_t + connected to SCSI bus # 1,target 0 lun 0. + + + To access SCSI devices via alternate transport layers, you + need to prepend the SCSI device name by a transport layer + indicator. The transport layer indicator may be something + like UUSSCCSSII:: or AATTAAPPII::. To get a list of supported trans- + port layers for your platform, use ddeevv== _H_E_L_P: + + + + To make ccddrreeccoorrdd portable to all UNIX platforms, the syn- + tax ddeevv== _d_e_v_i_c_e_n_a_m_e:_s_c_s_i_b_u_s,_t_a_r_g_e_t,_l_u_n is preferred as is + hides OS specific knowledge about device names from the + user. A specific OS must not necessarily support a way to + specify a real device file name nor a way to specify _s_c_s_i_- + _b_u_s,_t_a_r_g_e_t,_l_u_n. + + + _S_c_s_i_b_u_s 0 is the default SCSI bus on the machine. Watch + the boot messages for more information or look into + //vvaarr//aaddmm//mmeessssaaggeess for more information about the SCSI con- + figuration of your machine. If you have problems to fig- + ure out what values for _s_c_s_i_b_u_s,_t_a_r_g_e_t,_l_u_n should be used, + try the --ssccaannbbuuss option of ccddrreeccoorrdd described below. + + + If a file /etc/default/cdrecord exists, the parameter to + the ddeevv== option may also be a drive name label in said + file (see FILES section). + + + On SSVVrr44 compliant systems, ccddrreeccoorrdd uses the the real time + class to get the highest scheduling priority that is pos- + sible (higher than all kernel processes). On systems with + PPOOSSIIXX rreeaall ttiimmee sscchheedduulliinngg cdrecord uses real time + scheduling too, but may not be able to gain a priority + that is higher than all kernel processes. + + In _T_r_a_c_k _A_t _O_n_c_e mode, each _t_r_a_c_k corresponds to a single + file that contains the prepared data for that track. If + the argument is `--', standard input is used for that + track. Only one track may be taken from _s_t_d_i_n. + + +GGEENNEERRAALL OOPPTTIIOONNSS + General options must be before any track file name or + track option. + + --vveerrssiioonn + Print version information and exit. + + --vv Increment the level of general verbosity by one. + This is used e.g. to display the progress of the + writing process. + + --VV Increment the verbose level in respect of SCSI com- + mand transport by one. This helps to debug prob- + lems during the writing process, that occur in the + CD-Recorder. If you get incomprehensible error + messages you should use this flag to get more + detailed output. --VVVV will show data buffer content + in addition. Using --VV or --VVVV slows down the pro- + cess and may be the reason for a buffer underrun. + + ddeebbuugg==_#_, --dd + Set the misc debug value to # (with debug=#) or + increment the misc debug level by one (with -d). If + you specify _-_d_d_, this equals to ddeebbuugg==_2_. This may + help to find problems while opening a driver for + libscg as well as with sector sizes and sector + types. Using --ddeebbuugg slows down the process and may + be the reason for a buffer underrun. + + kkddeebbuugg==#, kkdd==# + Tell the ssccgg-driver to modify the kernel debug + value while SCSI commands are running. + + --ssiilleenntt, --ss + Do not print out a status report for failed SCSI + commands. + + --ffoorrccee Force to continue on some errors. Be careful when + using this option. CCddrreeccoorrdd implements several + checks that prevent you from doing unwanted things + like damaging CD-RW media by improper drives. Many + of the sanity checks are disabled when the --ffoorrccee + option is used. + + This option also implements some tricks that will + allow you to blank bad CD-RW disks. + + --iimmmmeedd Tell cdrecord to set the SSCCSSII IIMMMMEEDD flag in certain + commands (load/eject/blank/close_track/close_ses- + sion). This can be useful on broken systems with + ATAPI harddisk and CD/DVD writer on the same bus or + with SCSI systems that don't use disconnect/recon- + nect. These systems will freeze while blanking or + fixating a CD/DVD or while a DVD writer is filling + up a session to the minimum amount (approx. 800 + MB). Setting the --iimmmmeedd flag will request the com- + mand to return immediately while the operation pro- + ceeds in background, making the bus usable for the + other devices and avoiding the system freeze. This + is an experimental feature which may work or not, + depending on the model of the CD/DVD writer. A + correct solution would be to set up a correct + cabling but there seem to be notebooks around that + have been set up the wrong way by the manufacturer. + As it is impossible to fix this problem in note- + books, the --iimmmmeedd option has been added. + + A second experimental feature of the --iimmmmeedd flag is + to tell cdrecord to try to wait short times wile + writing to the media. This is expected to free the + IDE bus if the CD/DVD writer and the data source + are connected to the same IDE cable. In this case, + the CD/DVD writer would otherwise usually block the + IDE bus for nearly all the time making it impossi- + ble to fetch data from the source drive. See also + mmiinnbbuuff== and --vv option. + + Use both features at your own risk. It it turns + out that it would make sense to have a separate + option for the the wait feature, write to the + author and convince him. + + mmiinnbbuuff==_v_a_l_u_e + The # mmiinnbbuuff== options allows to define the minimum + drive buffer fill ratio for the experimental ATAPI + wait mode that is intended to free the IDE bus to + allow hard disk and CD/DVD writer to be on the same + IDE cable. As the wait mode currently only works + when the verbose option --vv has been specified, + ccddrreeccoorrdd implies the verbose option in case the + --iimmmmeedd or mmiinnbbuuff== option have been specified. + Valid values for mmiinnbbuuff== are between 25 and 95 for + 25%...95% minimum drive buffer fill ratio. + + --dduummmmyy The CD-Recorder will go through all steps of the + recording process, but the laser is turned off dur- + ing this procedure. It is recommended to run sev- + eral tests before actually writing to a Compact + Disk or Digital Versatile Disk, if the timing and + load response of the system is not known. + + --ddaaoo Set SSAAOO ((SSeessssiioonn AAtt OOnnccee)) mode which is usually + called DDiisskk AAtt OOnnccee mode. This currently only + works with MMC drives that support SSeessssiioonn AAtt OOnnccee + mode. + + --rraaww Set RRAAWW wwrriittiinngg mmooddee.. Using this option defaults + to --rraaww9966rr. + + --rraaww9966rr + Select Set RRAAWW wwrriittiinngg mmooddee with 2352 byte sectors + plus 96 bytes of raw P-W subchannel data resulting + in a sector size of 2448 bytes. This is the pre- + ferred raw writing mode as it gives best control + over the CD writing process. If you find any prob- + lems with the layout of a disk or with sub channel + content (e.g. wrong times on the display when play- + ing the CD) and your drive supports to write in + --rraaww9966rr or --rraaww1166 mode, you should give it a try. + There are several CD writers with bad firmware that + result in broken disks when writing in TAO or SAO + mode. Writing data disks in raw mode needs signif- + icantly more CPU time than other write modes. If + your CPU is too slow, this may result in buffer + underruns. + + --rraaww9966pp + Select Set RRAAWW wwrriittiinngg mmooddee with 2352 byte sectors + plus 96 bytes of packed P-W subchannel data result- + ing in a sector size of 2448 bytes. This is the + less preferred raw writing mode as only a few + recorders support it and some of these recorders + have bugs in the firmware implementation. Don't + use this mode if your recorder supports --rraaww9966rr or + --rraaww1166. Writing data disks in raw mode needs sig- + nificantly more CPU time than other write modes. If + your CPU is too slow, this may result in buffer + underruns. + + --rraaww1166 Select Set RRAAWW wwrriittiinngg mmooddee with 2352 byte sectors + plus 6 bytes of P-Q subchannel data resulting in a + sector size of 2368 bytes. If a recorder does not + support --rraaww9966rr, this is the preferred raw writing + mode. It does not allow to write _C_D_-_T_e_x_t or + _C_D_+_G_r_a_p_h_i_c_s but it is the only raw writing mode in + cheap CD writers. As these cheap writers in most + cases do not support --ddaaoo mode. Don't use this + mode if your recorder supports --rraaww9966rr. Writing + data disks in raw mode needs significantly more CPU + time than other write modes. If your CPU is too + slow, this may result in buffer underruns. + + --mmuullttii Allow multi session CD's to be made. This flag + needs to be present on all sessions of a multi ses- + sion disk, except you want to create a session that + will be the last session on the media. The fixa- + tion will be done in a way that allows the CD- + Recorder to append additional sessions later. This + is done by generation a TOC with a link to the next + program area. The so generated media is not 100% + compatible to manufactured CD's (except for + CDplus). Use only for recording of multi session + CD's. If this option is present, the default track + type is CCDD--RROOMM XXAA mmooddee 22. The _S_o_n_y drives have no + hardware support for CCDD--RROOMM XXAA mmooddee 22. You have to + specify the --ddaattaa option in order to create multi + session disks on these drives. As long as cdrecord + does not have a coder for converting data sectors + to audio sectors, you need to force CCDD--RROOMM sectors + by including the --ddaattaa option if you like to record + a multisession disk in SAO mode. Not all drives + allow multisession CD's in SAO mode. + + --mmssiinnffoo + Retrieve multi session info in a form suitable for + mmkkiissooffss--11..1100 or later. + + This option makes only sense with a CD that con- + tains at least one closed session and is appendable + (not finally closed yet). Some drives create error + messages if you try to get the multi session info + for a disk that is not suitable for this operation. + + --ttoocc Retrieve and print out the table of content or PMA + of a CD. With this option, ccddrreeccoorrdd will work with + CD-R drives and with CD-ROM drives. + + --aattiipp Retrieve and print out the ATIP (absolute Time in + Pregroove) info of a CD/DVD recordable or CD/DVD + rewritable media. With this option, ccddrreeccoorrdd will + try to retrieve the ATIP info. If the actual drive + does not support to read the ATIP info, it may be + that only a reduced set of information records or + even nothing is displayed. Only a limited number of + MMC compliant drives support to read the ATIP info. + + If ccddrreeccoorrdd is able to retrieve the lead-in start + time for the first session, it will try to decode + and print the manufacturer info from the media. + DVD media dos not have atip information but there + is equivalent prerecorded information that is read + out and printed. + + --ffiixx The disk will only be fixated (i.e. a TOC for a CD- + Reader will be written). This may be used, if for + some reason the disk has been written but not fix- + ated. This option currently does not work with old + TEAC drives (CD-R50S and CD-R55S). + + --nnooffiixx Do not fixate the disk after writing the tracks. + This may be used to create an audio disk in steps. + An un-fixated disk can usually not be used on a non + CD-writer type drive but there are audio CD players + that will be able to play such a disk. + + --wwaaiittii Wait for input to become available on standard + input before trying to open the SCSI driver. This + allows ccddrreeccoorrdd to read it's input from a pipe even + when writing additional sessions to a multi session + disk. When writing another session to a multi ses- + sion disk, mmkkiissooffss needs to read the old session + from the device before writing output. This cannot + be done if ccddrreeccoorrdd opens the SCSI driver at the + same time. + + --llooaadd Load the media and exit. This only works with a + tray loading mechanism but seems to be useful when + using the Kodak disk transporter. + + --eejjeecctt Eject disk after doing the work. Some Devices + (e.g. Philips) need to eject the medium before cre- + ating a new disk. Doing a -dummy test and immedi- + ately creating a real disk would not work on these + devices. + + ssppeeeedd==# + Set the speed factor of the writing process to #. + # is an integer, representing a multiple of the + audio speed. This is about 150 KB/s for CD-ROM and + about 172 KB/s for CD-Audio. If no _s_p_e_e_d option is + present, ccddrreeccoorrdd will try to get the speed value + from the CCDDRR__SSPPEEEEDD environment. If your drive has + problems with _s_p_e_e_d_=_2 or _s_p_e_e_d_=_4, you should try + _s_p_e_e_d_=_0. + + bbllaannkk==_t_y_p_e + Blank a CD-RW and exit or blank a CD-RW before + writing. The blanking type may be one of: + + help Display a list of possible blanking + types. + + all Blank the entire disk. This may take a + long time. + + fast Minimally blank the disk. This results + in erasing the PMA, the TOC and the + pregap. + + track Blank a track. + + unreserve Unreserve a reserved track. + + trtail Blank the tail of a track. + + unclose Unclose last session. + + session Blank the last session. + Not all drives support all blanking types. It may be nec- + essary to use bbllaannkk==aallll if a drive reports a specified + command as being invalid. If used together with the + --ffoorrccee flag, this option may be used to blank CD-RW disks + that otherwise cannot be blanked. Note that you may need + to specify bbllaannkk==_a_l_l because some drives will not continue + with certain types of bad CD-RW disks. Note also that + ccddeeccoorrdd does it's best if the --ffoorrccee flag is used but it + finally depends on the drive's firmware whether the blank- + ing operation will succeed or not. + + ffss==# Set the fifo (ring buffer) size to #. You may use + the same method as in dddd(1), ssdddd(1) or ssttaarr(1). + The number representing the size is taken in bytes + unless otherwise specified. If a number is fol- + lowed directly by the letter `b', `k', `m', `s' of + `f', the size is multiplied by 512, 1024, + 1024*1024, 2048 or 2352. If the size consists of + numbers separated by `x' or `*', multiplication of + the two numbers is performed. Thus _f_s_=_1_0_x_6_3_k will + specify a fifo size of 630 kBytes. + + The size specified by the _f_s_= argument includes the + shared memory that is needed for administration. + This is at least one page of memory. If no _f_s= + option is present, ccddrreeccoorrdd will try to get the + fifo size value from the CCDDRR__FFIIFFOOSSIIZZEE environment. + The default fifo size is currently 4 MB. + + The fifo is used to increase buffering for the real + time writing process. It allows to run a pipe from + mmkkiissooffss directly into ccddrreeccoorrdd. If the fifo is + active and a pipe from mmkkiissooffss into ccddrreeccoorrdd is + used to create a CD, ccddrreeccoorrdd will abort prior to + do any modifications on the disk if mmkkiissooffss dies + before it starts writing. The recommended fifo + size is between 4 and 32 MBytes. As a rule of + thumb, the fifo size should be at least equal to + the size of the internal buffer of the CD-Recorder + and no more than half of the physical amount of RAM + available in the machine. If the fifo size is big + enough, the fifo statistics will print a fifo empty + count of zero and the fifo min fill is not below + 20%. It is not wise to use too much space for the + fifo. If you need more than 8 MB to write a CD on + an idle machine, your machine is either underpow- + ered, has hardware problems or is mis-configured. + The sun4c architecture (e.g. a Sparcstation-2) has + only MMU page table entries for 16 MBytes per pro- + cess. Using more than 14 MBytes for the fifo may + cause the operating system in this case to spend + much time to constantly reload the MMU tables. + Newer machines from Sun do not have this MMU hard- + ware problem. I have no information on PC-hardware + reflecting this problem. + + If you have buffer underruns or similar problems + and observe a zero _f_i_f_o _e_m_p_t_y _c_o_u_n_t, you have hard- + ware problems. The fifo size in this case is suffi- + cient. + + ddeevv==_t_a_r_g_e_t + Sets the SCSI target for the CD-Recorder, see notes + above. A typical device specification is ddeevv==_6_,_0 . + If a filename must be provided together with the + numerical target specification, the filename is + implementation specific. The correct filename in + this case can be found in the system specific manu- + als of the target operating system. On a _F_r_e_e_B_S_D + system without _C_A_M support, you need to use the + control device (e.g. _/_d_e_v_/_r_c_d_0_._c_t_l). A correct + device specification in this case may be + ddeevv==_/_d_e_v_/_r_c_d_0_._c_t_l_:_@ . + + On Linux, drives connected to a parallel port + adapter are mapped to a virtual SCSI bus. Different + adapters are mapped to different targets on this + virtual SCSI bus. + + If no _d_e_v option is present, ccddrreeccoorrdd will try to + get the device from the CCDDRR__DDEEVVIICCEE environment. + + If the argument to the ddeevv== option does not contain + the characters ',', '/', '@' or ':', it is inter- + preted as an label name that may be found in the + file /etc/default/cdrecord (see FILES section). + + ggrraacceettiimmee==_# + Set the grace time before starting to write to _# + seconds. Values below 2 seconds are not allowed. + + ttiimmeeoouutt==_# + Set the default SCSI command timeout value to _# + seconds. The default SCSI command timeout is the + minimum timeout used for sending SCSI commands. If + a SCSI command fails due to a timeout, you may try + to raise the default SCSI command timeout above the + timeout value of the failed command. If the com- + mand runs correctly with a raised command timeout, + please report the better timeout value and the cor- + responding command to the author of the program. + If no _t_i_m_e_o_u_t option is present, a default timeout + of 40 seconds is used. + + ddrriivveerr==_n_a_m_e + Allows to use a user supplied driver name for the + device. To get a list of possible drivers use + ddrriivveerr==hheellpp. The reason for the existence of this + option is to allow users to use ccddrreeccoorrdd with + drives that are similar to supported drives but not + known directly by ccddrreeccoorrdd. Use this option with + extreme care. If a wrong driver is used for a + device, the possibility of creating corrupted disks + is high. The minimum problem related to a wrong + driver is that the --ssppeeeedd or --dduummmmyy will not work. + + There are two special driver entries in the list: + ccddrr__ssiimmuull and ddvvdd__ssiimmuull. These driver entries are + designed to make timing tests at any speed or tim- + ing tests for drives that do not support the --dduummmmyy + option. The simulation drivers implement a drive + with a buffer size of 1MB that can be changed via + the CCDDRR__SSIIMMUULL__BBUUFFSSIIZZEE environment variable. The + simulation driver correctly simulates even a buffer + underrun condition. If the --dduummmmyy option is pre- + sent, the simulation is not aborted in case of a + buffer underrun. + + ddrriivveerrooppttss==_o_p_t_i_o_n _l_i_s_t + Set driver specific options. The options are speci- + fied a comma separated list. To get a list of + valid options use ddrriivveerrooppttss==_h_e_l_p together with the + _-_c_h_e_c_k_d_r_i_v_e option. Currently implemented driver + options are: + + bbuurrnnffrreeee + Turn the support for Buffer Underrun Free + writing on. This only works for drives that + support Buffer Underrun Free technology. + This may be called: SSaannyyoo BBUURRNN--PPrrooooff, RRiiccoohh + JJuusstt--LLiinnkk, YYaammaahhaa LLoosssslleessss--LLiinnkk or similar. + + The default is to turn BBUURRNN--FFrreeee off, + regardless of the defaults of the drive. + + nnoobbuurrnnffrreeee + Turn the support for Buffer Underrun Free + writing off. + + vvaarriirreecc==_v_a_l_u_e + Turn on the PPlleexxttoorr VVaarriiRReecc writing mode. + The mandatory parameter _v_a_l_u_e is the laser + power offset and currently may be selected + from -2, -1, 0, 1, 2. In addition, you need + to set the write speed to 4 in order to + allow VVaarriiRReecc to work. + + aauuddiioommaasstteerr + Turn on the YYaahhaammaa AAuuddiioo MMaasstteerr QQ.. RR.. fea- + ture which usually should result in high + quality CDs that have less reading problems + in HiFi players. As this is implemented as + a variant of the Session at Once write mode, + it will only work if you select SAO write + mode and there is no need to turn it off. + The AAuuddiioo MMaasstteerr mode will work with a lim- + ited speed but may also be used with data + CDs. in AAuuddiioo MMaasstteerr mode, the pits on the + CD will be written larger then usual so the + capacity of the medium is reduced when turn- + ing this feature on. A 74 minute CD will + only have a capacity of 63 minutes if AAuuddiioo + MMaasstteerr is active and the capacity of a 80 + minute CD will be reduced to 68 minutes. + + ffoorrcceessppeeeedd + Normally, modern drives know the highest + possible speed for different media and may + reduce the speed in order to grant best + write quality. Some drives (e.g. Ricoh and + Yamaha) allow to force the drive to use the + selected speed even if the medium is so bad + that the write quality would be poor. This + option tells such a drive to force to use + the selected speed regardless of the medium + quality. + + Use this option with extreme care and note + that the drive should know better which + medium will work at full speed. The default + is to turn ffoorrcceessppeeeedd off, regardless of the + defaults of the drive. + + nnooffoorrcceessppeeeedd + Turn off the ffoorrccee ssppeeeedd feature. + + ttaattttooooiinnffoo + Use this option together with --cchheecckkddrriivvee to + retrieve the image size information for the + YYaammaahhaa DDiisskkTT@@22 feature. The images always + have a line length of 3744 pixel. Line num- + ber 0 (radius 0) is mapped to the center of + the disk. If you know the inner and outer + radius you will be able to create a pre dis- + torted image that later may appear undis- + torted on the disk. + + ttaattttooooffiillee==_n_a_m_e + Use this option together with --cchheecckkddrriivvee to + write an image prepared for the YYaammaahhaa + DDiisskkTT@@22 feature to the medium. The file + must be a file with raw image B&W data (one + byte per pixel) in a size as retrieved by a + previous call to ttaattttooooffiillee==_n_a_m_e . If the + size of the image equals the maximum possi- + ble size (3744 x 320 pixel), ccddrreeccoorrdd will + use the first part of the file. This first + part then will be written to the leftover + space on the CD. + + Note that the image must be mirrored to be + readable from the pick up side of the CD. + + --cchheecckkddrriivvee + Checks if a driver for the current drive is present + and exit. If the drive is a known drive, ccddrreeccoorrdd + uses exit code 0. + + --pprrccaapp Print the drive capabilities for SCSI-3/mmc compli- + ant drives as obtained from mode page 0x2A. Values + marked with _k_B use 1000 bytes as kilo-byte, values + marked with _K_B use 1024 bytes as Kilo-byte. + + --iinnqq Do an inquiry for the drive, print the inquiry info + and exit. + + --ssccaannbbuuss + Scan all SCSI devices on all SCSI busses and print + the inquiry strings. This option may be used to + find SCSI address of the CD-Recorder on a system. + The numbers printed out as labels are computed by: + bbuuss ** 110000 ++ ttaarrggeett + + --rreesseett Try to reset the SCSI bus where the CD recorder is + located. This works not on all operating systems. + + --oovveerrbbuurrnn + Allow ccddrreeccoorrdd to write more than the official size + of a medium. This feature is usually called _o_v_e_r_- + _b_u_r_n_i_n_g and depends on the fact that most blank + media may hold more space than the official size. + As the official size of the lead-out area on the + disk is 90 seconds (6750 sectors) and a disk usu- + ally works if there are at least 150 sectors of + lead out, all media may be overburned by at least + 88 seconds (6600 sectors). Most CD recorders only + do overburning in SSAAOO or RRAAWW mode. Known exceptions + are TEAC CD-R50S, TEAC CD-R55S and the Panasonic + CW-7502. Some drives do now allow to overburn as + much as you might like and limit the size of a CD + to e.g. 76 minutes. This problem may be circum- + vented by writing the CD in RAW mode because this + way the drive has no chance to find the size before + starting to burn. There is no guarantee that your + drive supports overburning at all. Make a test to + check if your drive implements the feature. + + --iiggnnssiizzee + Ignore the known size of the medium. This options + should be used with extreme care, it exists only + for debugging purposes don't use it for other rea- + sons. It is not needed to write disks with more + than the nominal capacity. This option implies + --oovveerrbbuurrnn. + + --uusseeiinnffoo + Use *.inf files to overwrite audio options. If + this option is used, the pregap size information is + read from the *.inf file that is associated with + the file that contains the audio data for a track. + + ddeeffpprreeggaapp==# + Set the default pre-gap size for all tracks except + track number 1. This option currently only makes + sense with the TEAC drive when creating track-at- + once disks without the 2 second silence before each + track. + This option may go away in future. + + --ppaacckkeett + Set PPaacckkeett wwrriittiinngg mmooddee.. This is an experimental + interface. + + ppkkttssiizzee==# + Set the packet size to #, forces fixed packet mode. + This is an experimental interface. + + --nnoocclloossee + Do not close the current track, useful only when in + packet writing mode. This is an experimental + interface. + + mmccnn==_m_e_d___c_a_t___n_r + Set the MMeeddiiaa CCaattaalloogg NNuummbbeerr of the CD to + _m_e_d___c_a_t___n_r. + + --tteexxtt Write CD-Text created by ccddrreeccoorrdd and based on + information taken from a file that contains ascii + information for the text strings. Currently only + the format in the **..iinnff files created by ccddddaa22wwaavv + is supported. You need to use the --uusseeiinnffoo option + in addition in order to tell ccddrreeccoorrdd to read these + files. If you like to write your own CD-Text infor- + mation, edit the **..iinnff files with a text editor and + change the field that are relevant for CD-Text. + + tteexxttffiillee==filename + Write CD-Text based on information found in the + binary file _f_i_l_e_n_a_m_e. This file must contain + information in a data format defined in the SCSI-3 + MMC-2 standard and in the Red Book. The four byte + size header that is defined in the SCSI standard is + optional and allows to make the recognition of cor- + rect data less ambiguous. This is the best option + to be used to copy CD-Text data from existing CDs + that already carry CD-Text information. To get data + in a format suitable for this option use ccddrreeccoorrdd + --vvvv --ttoocc to extract the information from disk. + + +TTRRAACCKK OOPPTTIIOONNSS + Track options may be mixed with track file names. + + iissrrcc==_I_S_R_C___n_u_m_b_e_r + Set the IInntteerrnnaattiioonnaall SSttaannddaarrdd RReeccoorrddiinngg NNuummbbeerr for + the next track to _I_S_R_C___n_u_m_b_e_r. + + iinnddeexx==_l_i_s_t + Sets an index list for the next track. In index + list is a comma separated list of numbers that are + counting from index 1. The first entry in this list + must contain a 0, the following numbers must be an + ascending list of numbers (counting in 1/75 sec- + onds) that represent the start of the indices. An + index list in the form: 0,7500,15000 sets index 1 + to the start of the track, index 2 100 seconds from + the start of the track and index 3 200 seconds from + the start of the track. + + --aauuddiioo If this flag is present, all subsequent tracks are + written in CCDD--DDAA (similar to Red Book) audio for- + mat. The file with data for this tracks should + contain stereo, 16-bit digital audio with 44100 + samples/s. The byte order should be the following: + MSB left, LSB left, MSB right, LSB right, MSB left + and so on. The track should be a multiple of 2352 + bytes. It is not possible to put the master image + of an audio track on a raw disk because data will + be read in multiple of 2352 bytes during the + recording process. + + If a filename ends in _._a_u or _._w_a_v the file is con- + sidered to be a structured audio data file. + CCddrreeccoorrdd assumes that the file in this case is a + Sun audio file or a Microsoft .WAV file and + extracts the audio data from the files by skipping + over the non-audio header information. In all + other cases, cdrecord will only work correctly if + the audio data stream does not have any header. + Because many structured audio files do not have an + integral number of blocks (1/75th second) in + length, it is often necessary to specify the --ppaadd + option as well. ccddrreeccoorrdd recognizes that audio + data in a .WAV file is stored in Intel (little- + endian) byte order, and will automatically byte- + swap the data if the CD recorder requires big- + endian data. CCddrreeccoorrdd will reject any audio file + that does not match the Red Book requirements of + 16-bit stereo samples in PCM coding at 44100 sam- + ples/second. + + Using other structured audio data formats as input + to ccddrreeccoorrdd will usually work if the structure of + the data is the structure described above (raw pcm + data in big-endian byte order). However, if the + data format includes a header, you will hear a + click at the start of a track. + + If neither _-_d_a_t_a nor _-_a_u_d_i_o have been specified, + ccddrreeccoorrdd defaults to _-_a_u_d_i_o for all filenames that + end in _._a_u or _._w_a_v and to _-_d_a_t_a for all other + files. + + --sswwaabb If this flag is present, audio data is assumed to + be in byte-swapped (little-endian) order. Some + types of CD-Writers e.g. Yamaha, Sony and the new + SCSI-3/mmc drives require audio data to be pre- + sented in little-endian order, while other writers + require audio data to be presented in the big- + endian (network) byte order normally used by the + SCSI protocol. CCddrreeccoorrdd knows if a CD-Recorder + needs audio data in big- or little-endian order, + and corrects the byte order of the data stream to + match the needs of the recorder. You only need the + _-_s_w_a_b flag if your data stream is in Intel (little- + endian) byte order. + + Note that the verbose output of ccddrreeccoorrdd will show + you if swapping is necessary to make the byte order + of the input data fit the required byte order of + the recorder. CCddrreeccoorrdd will not show you if the + _-_s_w_a_b flag was actually present for a track. + + --ddaattaa If this flag is present, all subsequent tracks are + written in CCDD--RROOMM mmooddee 11 (Yellow Book) format. The + data is a multiple of 2048 bytes. The file with + track data should contain an IISSOO--99666600 or RRoocckk RRiiddggee + filesystem image (see mmkkiissooffss for more details). If + the track data is an uuffss filesystem image, fragment + size should be set to 2 KB or more to allow CR- + drives with 2 KB sector size to to be used for + reading. + + -data is the default, if no other flag is present. + + If neither _-_d_a_t_a nor _-_a_u_d_i_o have been specified, + ccddrreeccoorrdd defaults to _-_a_u_d_i_o for all filenames that + end in _._a_u or _._w_a_v and to _-_d_a_t_a for all other + files. + + --mmooddee22 If this flag is present, all subsequent tracks are + written in CCDD--RROOMM mmooddee 22 format. The data is a mul- + tiple of 2048 bytes. + + --xxaa11 If this flag is present, all subsequent tracks are + written in CCDD--RROOMM XXAA mmooddee 11 format. The data is a + multiple of 2048 bytes. + + --xxaa22 If this flag is present, all subsequent tracks are + written in CCDD--RROOMM XXAA mmooddee 22 format. The data is a + multiple of 2048 bytes. + + --ccddii If this flag is present, all subsequent tracks are + written in CCDDII format. The data is a multiple of + 2048 bytes. + + --iissoossiizzee + Use the IISSOO--99666600 file system size as the size of + the next track. This option is needed if you want + ccddrreeccoorrdd to directly read the image of a track from + a raw disk partition or from a _T_A_O master CD. In + the first case the option --iissoossiizzee is needed to + limit the size of the CD to the size of the ISO + filesystem. In the second case the option --iissoossiizzee + is needed to prevent ccddrreeccoorrdd from reading the two + run out blocks that are appended by each CD- + recorder in track at once mode. These two run out + blocks cannot be read and would cause a buffer + under run that would cause a defective copy. Do + not use this option on files created by mmkkiissooffss and + in case ccddrreeccoorrdd reads the track data from _s_t_d_i_n. + In the first case, you would prevent ccddrreeccoorrdd from + writing the amount of padding that has been + appended by mmkkiissooffss and in the latter case, it will + not work because _s_t_d_i_n is not seekable. + + If --iissoossiizzee is used for a track, ccddrreeccoorrdd will + automatically add padding for this track as if the + --ppaadd option has been used but the amount of padding + may be less than the padding written by mmkkiissooffss. + Note that if you use --iissoossiizzee on a track that con- + tains Sparc boot information, the boot information + will be lost. + + Note also that this option cannot be used to deter- + mine the size of a file system if the multi session + option is present. + + --ppaadd If the track is a data track, 15 sectors of zeroed + data will be added to the end of this and each sub- + sequent data track. In this case, the --ppaadd option + is superseded by the ppaaddssiizzee== option. It will + remain however as a shorthand for ppaaddssiizzee==_1_5_s_. If + the _-_p_a_d option refers to an audio track, ccddrreeccoorrdd + will pad the audio data to be a multiple of 2352 + bytes. The audio data padding is done with binary + zeroes which is equal to absolute silence. + + --ppaadd remains valid until disabled by --nnooppaadd. + + ppaaddssiizzee==# + Set the amount of data to be appended as padding to + the next track to #. Opposed to the behavior of + the --ppaadd option, the value for _p_a_d_s_i_z_e_= is reset to + zero for each new track. Cdrecord assumes a sector + size of 2048 bytes for the _p_a_d_s_i_z_e_= option, inde- + pendent from the real sector size and independent + from the write mode. The megabytes mentioned in + the verbose mode output however are counting the + output sector size which is e.g. 2448 bytes when + writing in RAW/RAW96 mode. See ffss= option for pos- + sible arguments. To pad the equivalent of 20 min- + utes on a CD, you may write ppaaddssiizzee==20x60x75s. Use + this option if your CD-drive is not able to read + the last sectors of a track or if you want to be + able to read the CD on a LLiinnuuxx system with the + ISO-9660 filesystem read ahead bug. If an empty + file is used for track data, this option may be + used to create a disk that is entirely made of + padding. This may e.g. be used to find out how + much overburning is possible with a specific media. + + --nnooppaadd Do not pad the following tracks - the default. + + --sshhoorrttttrraacckk + Allow all subsequent tracks to violate the Read + Book track length standard which requires a minimum + track length of 4 seconds. This option is only + useful when used in SAO or RAW mode. Not all + drives support this feature. The drive must be + accept the resulting CUE sheet or support RAW writ- + ing. + + --nnoosshhoorrttttrraacckk + Re-enforce the Red Book track length standard. + Tracks must be at least 4 seconds. + + pprreeggaapp==# + Set the pre-gap size for the next track. This + option currently only makes sense with the TEAC + drive when creating track-at-once disks without the + 2 second silence before each track. + This option may go away in future. + + --pprreeeemmpp + If this flag is present, all TOC entries for subse- + quent audio tracks will indicate that the audio + data has been sampled with 50/15 �sec preemphasis. + The data, however is not modified during the pro- + cess of transferring from file to disk. This + option has no effect on data tracks. + + --nnoopprreeeemmpp + If this flag is present, all TOC entries for subse- + quent audio tracks will indicate that the audio + data has been mastered with linear data - this is + the default. + + --ccooppyy If this flag is present, all TOC entries for subse- + quent audio tracks of the resulting CD will indi- + cate that the audio data has permission to be + copied without limit. This option has no effect on + data tracks. + + --nnooccooppyy + If this flag is present, all TOC entries for subse- + quent audio tracks of the resulting CD will indi- + cate that the audio data has permission to be + copied only once for personal use - this is the + default. + + --ssccmmss If this flag is present, all TOC entries for subse- + quent audio tracks of the resulting CD will indi- + cate that the audio data has no permission to be + copied anymore. + + ttssiizzee==# + If the master image for the next track has been + stored on a raw disk, use this option to specify + the valid amount of data on this disk. If the image + of the next track is stored in a regular file, the + size of that file is taken to determine the length + of this track. If the track contains an ISO 9660 + filesystem image use the _-_i_s_o_s_i_z_e option to deter- + mine the length of that filesystem image. + In Disk at Once mode and with some drives that use + the TEAC programming interface, even in Track at + Once mode, ccddrreeccoorrdd needs to know the size of each + track before starting to write the disk. Cdrecord + now checks this and aborts before starting to + write. If this happens you will need to run + mmkkiissooffss --pprriinntt--ssiizzee before and use the output (with + `s' appended) as an argument to the ttssiizzee= option + of ccddrreeccoorrdd (e.g. tsize=250000s). + See ffss= option for possible arguments. + + +EEXXAAMMPPLLEESS + For all examples below, it will be assumed that the CD- + Recorder is connected to the primary SCSI bus of the + machine. The SCSI target id is set to 2. + + To record a pure CD-ROM at double speed, using data from + the file _c_d_i_m_a_g_e_._r_a_w: + + cdrecord -v speed=2 dev=2,0 cdimage.raw + + To create an image for a ISO 9660 filesystem with Rock + Ridge extensions: + + mkisofs -R -o cdimage.raw /home/joerg/master/tree + + To check the resulting file before writing to CD on + Solaris: + + mount -r -F fbk -o type=hsfs /dev/fbk0:cdimage.raw + /mnt + + On Linux: + + mount cdimage.raw -r -t iso9660 -o loop /mnt + + Go on with: + ls -lR /mnt + umount /mnt + + If the overall speed of the system is sufficient and the + structure of the filesystem is not too complex, cdrecord + will run without creating an image of the ISO 9660 + filesystem. Simply run the pipeline: + + mkisofs -R /master/tree | cdrecord -v fs=6m speed=2 + dev=2,0 - + + The recommended minimum fifo size for running this + pipeline is 4 MBytes. As the default fifo size is 4 MB, + the ffss== option needs only be present if you want to use a + different fifo size. If your system is loaded, you should + run mkisofs in the real time class too. To raise the pri- + ority of mmkkiissooffss replace the command + + mkisofs -R /master/tree + by + priocntl -e -c RT -p 59 mkisofs -R /master/tree + + on Solaris and by + + nice --18 mkisofs -R /master/tree + + on systems that don't have UUNNIIXX IInntteerrnnaattiioonnaall compliant + realtime scheduling. + + Cdrecord runs at priority 59 on Solaris, you should run + mkisofs at no more than priority 58. On other systems, you + should run mkisofs at no less than nice --18. + + Creating a CD-ROM without file system image on disk has + been tested on a Sparcstation-2 with a Yamaha CDR-400. It + did work up to quad speed when the machine was not loaded. + A faster machine may be able to handle quad speed also in + the loaded case. + + To record a pure CD-DA (audio) at single speed, with each + track contained in a file named _t_r_a_c_k_0_1_._c_d_a_u_d_i_o, + _t_r_a_c_k_0_2_._c_d_a_u_d_i_o, etc: + + cdrecord -v speed=1 dev=2,0 -audio track*.cdaudio + + To check if it will be ok to use double speed for the + example above. Use the dummy write option: + + cdrecord -v -dummy speed=2 dev=2,0 -audio track*.cdau- + dio + + To record a mixed-mode CD with an ISO 9660 filesystem from + _c_d_i_m_a_g_e_._r_a_w on the first track, the other tracks being + audio tracks from the files _t_r_a_c_k_0_1_._c_d_a_u_d_i_o, _t_r_a_c_k_0_2_._c_d_a_u_- + _d_i_o, etc: + + cdrecord -v -dummy dev=2,0 cdimage.raw -audio + track*.cdaudio + + To handle drives that need to know the size of a track + before starting to write, first run + + mkisofs -R -q -print-size /master/tree + + and then run + + mkisofs -R /master/tree | cdrecord speed=2 dev=2,0 + tsize=XXXs - + + where _X_X_X is replaced by the output of the previous run of + mkisofs. + + To copy an audio CD in the most accurate way, first run + + cdda2wav -vall cddb=0 -D2,0 -B -Owav + + and then run + + cdrecord -v dev=2,0 -dao -useinfo -text *.wav + + This will try copy track indices and to read CD-Text + information from disk. If there is no CD-Text informa- + tion, ccddddaa22wwaavv will try to get the information from + freedb.org instead. + + +EENNVVIIRROONNMMEENNTT + CCDDRR__DDEEVVIICCEE + This may either hold a device identifier that is + suitable to the open call of the SCSI transport + library or a label in the file + /etc/default/cdrecord. + + CCDDRR__SSPPEEEEDD + Sets the default speed value for writing (see also + --ssppeeeedd option). + + CCDDRR__FFIIFFOOSSIIZZEE + Sets the default size of the FIFO (see also ffss==# + option). + + CCDDRR__FFOORRCCEERRAAWWSSPPEEEEDD + If this environment variable is set, ccddrreeccoorrdd will + allow you to write at the full RAW encoding speed a + single CPU supports. This will create high poten- + tial of buffer underruns. Use with care. + + RRSSHH If the RRSSHH environment is present, the remote con- + nection will not be created via rrccmmdd(3) but by + calling the program pointed to by RRSSHH. Use e.g. + RRSSHH==/usr/bin/ssh to create a secure shell connec- + tion. + + Note that this forces ccddrreeccoorrdd to create a pipe to + the rrsshh((11)) program and disallows ccddrreeccoorrdd to + directly access the network socket to the remote + server. This makes it impossible to set up perfor- + mance parameters and slows down the connection com- + pared to a rroooott initiated rrccmmdd((33)) connection. + + RRSSCCSSII If the RRSSCCSSII environment is present, the remote + SCSI server will not be the program + //oopptt//sscchhiillyy//ssbbiinn//rrssccssii but the program pointed to + by RRSSCCSSII. Note that the remote SCSI server program + name will be ignored if you log in using an account + that has been created with a remote SCSI server + program as login shell. + + +FFIILLEESS + /etc/default/cdrecord + Default values can be set for the following options + in /etc/default/cdrecord. For example: CDR_FIFOS- + IZE=8m or CDR_SPEED=2 + + CDR_DEVICE + This may either hold a device identifier + that is suitable to the open call of the + SCSI transport library or a label in the + file /etc/default/cdrecord that allows to + identify a specific drive on the system. + + CDR_SPEED + Sets the default speed value for writing + (see also --ssppeeeedd option). + + CDR_FIFOSIZE + Sets the default size of the FIFO (see also + ffss==# option). + + Any other label + is an identifier for a specific drive on the + system. Such an identifier may not contain + the characters ',', '/', '@' or ':'. + + Each line that follows a label contains a + TAB separated list of items. Currently, + three items are recognized: the SCSI ID of + the drive, the default speed that should be + used for this drive and the default FIFO + size that should be used for this drive. The + values for _s_p_e_e_d and _f_i_f_o_s_i_z_e may be set to + -1 to tell cdrecord to use the global + defaults. A typical line may look this way: + + teac1= 0,5,0 4 8m + + yamaha= 1,6,0 -1 -1 + + This tells ccddrreeccoorrdd that a drive named _t_e_a_c_1 + is at scsibus 0, target 5, lun 0 and should + be used with speed 4 and a FIFO size of 8 + MB. A second drive may be found at scsibus + 1, target 6, lun 0 and uses the default + speed and the default FIFO size. + + +SSEEEE AALLSSOO + ccddddaa22wwaavv(1), rreeaaddccdd(1), ssccgg(7), ffbbkk(7), mmkkiissooffss(8), + rrccmmdd(3), sssshh(1). + + +NNOOTTEESS + On Solaris you need to stop the volume management if you + like to use the USCSI fallback SCSI transport code. Even + things like ccddrreeccoorrdd --ssccaannbbuuss will not work if the volume + management is running. + + Disks made in TTrraacckk AAtt OOnnccee mode are not suitable as a + master for direct mass production by CD manufacturers. + You will need the ddiisskk aatt oonnccee option to record such + disks. Nevertheless the disks made in TTrraacckk AAtt OOnnccee will + normally be read in all CD players. Some old audio CD + players however may produce a two second click between two + audio tracks. + + The minimal size of a track is 4 seconds or 300 sectors. + If you write smaller tracks, the CD-Recorder will add + dummy blocks. This is not an error, even though the SCSI- + error message looks this way. + + CCddrreeccoorrdd has been tested on an upgraded Philips CDD-521 + recorder at single and double speed on a SparcStation + 20/502 with no problems, slower computer systems should + work also. The newer Philips/HP/Plasmon/Grundig drives as + well as Yamaha CDR-100 and CDR-102 work also. The Plasmon + RF-4100 work, but has not tested in multi session. A + Philips CDD-521 that has not been upgraded will not work. + The Sony CDU-924 has been tested, but does not support XA- + mode2 in hardware. The sony therefore cannot create con- + forming multi session disks. The Ricoh RO-1420C works, + but some people seem to have problems to use them with + speed=2, try speed=0 in this case. + + The Yamaha CDR-400 and all new SCSI-3/mmc conforming + drives are supported in single and multi-session. + + You should run several tests in all supported speeds of + your drive with the --dduummmmyy option turned on if you are + using ccddrreeccoorrdd on an unknown system. Writing a CD is a + realtime process. NNFFSS will not always deliver constantly + the needed data rates. If you want to use ccddrreeccoorrdd with + CD-images that are located on a NNFFSS mounted filesystem, be + sure that the fifo size is big enough. I used ccddrreeccoorrdd + with with medium load on a SS20/502 and even at quad speed + on a Sparcstation-2 which was heavily loaded, but it is + recommended to leave the system as lightly loaded as pos- + sible while writing a CD. If you want to make sure that + buffer underruns are not caused by your source disk, you + may use the command + + ccddrreeccoorrdd --dduummmmyy ddeevv==22,,00 ppaaddssiizzee==660000mm //ddeevv//nnuullll + + to create a disk that is entirely made of dummy data. + CCddrreeccoorrdd needs to run as root to get access to the + //ddeevv//ssccgg?? device nodes and to be able to lock itself into + memory. + + If you don't want to allow users to become root on your + system, ccddrreeccoorrdd may safely be installed suid root. This + allows all users or a group of users with no root privi- + leges to use ccddrreeccoorrdd.. CCddrreeccoorrdd in this case checks, if + the real user would have been able to read the specified + files. To give all user access to use ccddrreeccoorrdd,, enter: + + chown root /usr/local/bin/cdrecord + chmod 4711 /usr/local/bin/cdrecord + + To give a restricted group of users access to cdrecord + enter: + + chown root /usr/local/bin/cdrecord + chgrp cdburners /usr/local/bin/cdrecord + chmod 4710 /usr/local/bin/cdrecord + + and add a group _c_d_b_u_r_n_e_r_s on your system. + + Never give write permissions for non root users to the + _/_d_e_v_/_s_c_g_? devices unless you would allow anybody to + read/write/format all your disks. + + You should not connect old drives that do not support dis- + connect/reconnect to either the SCSI bus that is connected + to the CD-Recorder or the source disk. + + A Compact Disc can have no more than 99 tracks. + + When creating a disc with both audio and data tracks, the + data should be on track 1 otherwise you should create a + CDplus disk which is a multi session disk with the first + session containing the audio tracks and the following ses- + sion containing the data track. + + Many operating systems are not able to read more than a + single data track, or need special software to do so. + + More information on the SCSI command set of a HP CD- + Recorder can be found at: + + http://www.hp.com/isgsupport/cdr/index.html + + If you have more information or SCSI command manuals for + currently unsupported CD-Recorders please contact the + author. + + The Philips CDD 521 CD-Recorder (even in the upgraded + version) has several firmware bugs. Some of them will + force you to power cycle the device or to reboot the + machine. + + When using ccddrreeccoorrdd with the broken LLiinnuuxx SSCCSSII ggeenneerriicc + ddrriivveerr.. You should note that ccddrreeccoorrdd uses a hack, that + tries to emulate the functionality of the scg driver. + Unfortunately, the sg driver on LLiinnuuxx has several severe + bugs: + + +o It cannot see if a SCSI command could not be sent + at all. + + +o It cannot get the SCSI status byte. CCddrreeccoorrdd for + that reason cannot report failing SCSI commands in + some situations. + + +o It cannot get real DMA count of transfer. CCddrreeccoorrdd + cannot tell you if there is an DMA residual count. + + +o It cannot get number of bytes valid in auto sense + data. CCddrreeccoorrdd cannot tell you if device transfers + no sense data at all. + + +o It fetches to few data in auto request sense + (CCS/SCSI-2/SCSI-3 needs >= 18). + + The fifo percent output is computed just after a block of + data has been written to the CD-Recorder. For this reason, + there will never be 100% fifo fill, while the fifo is in + streaming mode. + + +DDIIAAGGNNOOSSTTIICCSS + You have 9 seconds to type ^C to abort ccddrreeccoorrdd after you + see the message: + + Starting to write CD at speed %d in %s mode for %s ses- + sion. + + A typical error message for a SCSI command looks like: + + cdrecord: I/O error. test unit ready: scsi sendcmd: no error + CDB: 00 20 00 00 00 00 + status: 0x2 (CHECK CONDITION) + Sense Bytes: 70 00 05 00 00 00 00 0A 00 00 00 00 25 00 00 00 00 00 + Sense Key: 0x5 Illegal Request, Segment 0 + Sense Code: 0x25 Qual 0x00 (logical unit not supported) Fru 0x0 + Sense flags: Blk 0 (not valid) + cmd finished after 0.002s timeout 40s + + The first line gives information about the transport of + the command. The text after the first colon gives the + error text for the system call from the view of the ker- + nel. It usually is: II//OO eerrrroorr unless other problems hap- + pen. The next words contain a short description for the + SCSI command that fails. The rest of the line tells you if + there were any problems for the transport of the command + over the SCSI bus. ffaattaall eerrrroorr means that it was not pos- + sible to transport the command (i.e. no device present at + the requested SCSI address). + + The second line prints the SCSI command descriptor block + for the failed command. + + The third line gives information on the SCSI status code + returned by the command, if the transport of the command + succeeds. This is error information from the SCSI device. + + The fourth line is a hex dump of the auto request sense + information for the command. + + The fifth line is the error text for the sense key if + available, followed by the segment number that is only + valid if the command was a _c_o_p_y command. If the error mes- + sage is not directly related to the current command, the + text _d_e_f_e_r_r_e_d _e_r_r_o_r is appended. + + The sixth line is the error text for the sense code and + the sense qualifier if available. If the type of the + device is known, the sense data is decoded from tables in + _s_c_s_i_e_r_r_s_._c . The text is followed by the error value for + a field replaceable unit. + + The seventh line prints the block number that is related + to the failed command and text for several error flags. + The block number may not be valid. + + The eight line reports the timeout set up for this command + and the time that the command really needed to complete. + + The following message is not an error: + Track 01: Total bytes read/written: 2048/2048 (1 sectors). + cdrecord: I/O error. flush cache: scsi sendcmd: no error + CDB: 35 00 00 00 00 00 00 00 00 00 + status: 0x2 (CHECK CONDITION) + Sense Bytes: F0 00 05 80 00 00 27 0A 00 00 00 00 B5 00 00 00 00 00 + Sense Key: 0x5 Illegal Request, Segment 0 + Sense Code: 0xB5 Qual 0x00 (dummy data blocks added) Fru 0x0 + Sense flags: Blk -2147483609 (valid) + cmd finished after 0.002s timeout 40s + + It simply notifies, that a track that is smaller than the + minimum size has been expanded to 300 sectors. + +BBUUGGSS + CCddrreeccoorrdd has even more options than llss. + + There should be a recover option to make disks usable, + that have been written during a power failure. + + +CCRREEDDIITTSS + Bill Swartz (Bill_Swartz@twolf.com) + For helping me with the TEAC driver support + + Aaron Newsome (aaron.d.newsome@wdc.com) + For letting me develop Sony support on his + drive + + Eric Youngdale (eric@andante.jic.com) + For supplying mkisofs + + Gadi Oxman (gadio@netvision.net.il) + For tips on the ATAPI standard + + Finn Arne Gangstad (finnag@guardian.no) + For the first FIFO implementation. + + Dave Platt (dplatt@feghoot.ml.org) + For creating the experimental packet writ- + ing support, the first implementation of + CD-RW blanking support, the first .wav file + decoder and many nice discussions on + cdrecord. + + Chris P. Ross (cross@eng.us.uu.net) + For the first implementation os a BSDI SCSI + transport. + + Grant R. Guenther (grant@torque.net) + For creating the first parallel port trans- + port implementation for Linux. + + Kenneth D. Merry (ken@kdm.org) + for providing the CAM port for FreeBSD + together with Michael Smith + (msmith@freebsd.org) + + Heiko Ei�feldt (heiko@hexco.de) + for making libedc_ecc available (needed to + write RAW data sectors). + + +MMAAIILLIINNGG LLIISSTTSS + If you want to actively take part on the development of + cdrecord, you may join the developer mailing list via this + URL: + + hhttttpp::////lliissttss..bbeerrlliiooss..ddee//mmaaiillmmaann//lliissttiinnffoo//ccddrreeccoorrdd--ddeevveelloopp-- + eerrss + + The mail address of the list is: ccddwwrriittee@@ootthheerr..ddeebbiiaann..oorrgg + + +AAUUTTHHOORR + Joerg Schilling + Seestr. 110 + D-13353 Berlin + Germany + + Additional information can be found on: + http://www.fokus.fhg.de/usr/schilling/cdrecord.html + + If you have support questions, send them to: + + ccddrreeccoorrdd--ssuuppppoorrtt@@bbeerrlliiooss..ddee + or ccddwwrriittee@@ootthheerr..ddeebbiiaann..oorrgg + + Of you have definitely found a bug, send a mail to: + + ccddrreeccoorrdd--ddeevveellooppeerrss@@bbeerrlliiooss..ddee + or sscchhiilllliinngg@@ffookkuuss..ffhhgg..ddee + + To subscribe, use: + + hhttttpp::////lliissttss..bbeerrlliiooss..ddee//mmaaiillmmaann//lliissttiinnffoo//ccddrreeccoorrdd--ddeevveelloopp-- + eerrss + or hhttttpp::////lliissttss..bbeerrlliiooss..ddee//mmaaiillmmaann//lliissttiinnffoo//ccddrreeccoorrdd--ssuupp-- + ppoorrtt + + The old cdwrite mailing list may be joined by sending mail + to: + + cdwrite-request@other.debian.org + + and including the word _s_u_b_s_c_r_i_b_e in the body. The mail + address of the list is: + + cdwrite@other.debian.org + + + +Joerg Schilling Version 2.0 CDRECORD(1) diff --git a/scsilib/doc/cdrecord.ps b/scsilib/doc/cdrecord.ps new file mode 100644 index 0000000..93eec8f --- /dev/null +++ b/scsilib/doc/cdrecord.ps @@ -0,0 +1,1838 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.17.2 +%%CreationDate: Tue Dec 24 17:01:55 2002 +%%DocumentNeededResources: font Times-Roman +%%+ font Times-Bold +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.17 2 +%%Pages: 17 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.17 2 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 841.89 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron +/Zcaron/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE +/Times-Roman@0 ENC0/Times-Roman RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 104.275(CDRECORD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(CDRECORD\(1\))106.775 E/F1 10.95/Times-Bold@0 SF +-.219(NA)72 84 S(ME).219 E F0 +(cdrecord \255 record audio or data Compact Discs from a master)108 96 Q +F1(SYNOPSIS)72 112.8 Q/F2 10/Times-Bold@0 SF(cdr)108 124.8 Q(ecord)-.18 +E F0([)2.5 E/F3 10/Times-Italic@0 SF -.1(ge)2.5 G(ner).1 E(al options) +-.15 E F0(])2.5 E F2(de)2.5 E(v=)-.15 E F3(de).35 E(vice)-.15 E F0([)2.5 +E F3(tr)2.5 E(ac)-.15 E 2.5(ko)-.2 G(ptions)-2.5 E F0(])2.5 E F3(tr)2.5 +E(ac)-.15 E(k1)-.2 E F0 1.666(...)C F3(tr)-1.536 E(ac)-.15 E(kn)-.2 E F1 +(DESCRIPTION)72 153.6 Q F2(Cdr)108 165.6 Q(ecord)-.18 E F0(is used to r\ +ecord data or audio Compact Discs on an Orange Book CD-Recorder)2.5 E(.) +-.55 E(The)108 182.4 Q F3(de)3.911 E(vice)-.15 E F0 1.411(refers to) +3.911 F F3(scsib)3.911 E(us)-.2 E F0(/).27 E F3(tar).13 E -.1(ge)-.37 G +(t).1 E F0(/).68 E F3(lun).09 E F0 1.411(of the CD-Recorder)3.911 F +3.911(.C)-.55 G 1.411(ommunication on)-3.911 F F3(SunOS)3.911 E F0 1.41 +(is done with the)3.91 F 1.254(SCSI general dri)108 194.4 R -.15(ve)-.25 +G(r).15 E F2(scg)3.754 E(.)-.15 E F0 1.255 +(Other operating systems are using a library simulation of this dri) +6.254 F -.15(ve)-.25 G 4.855 -.55(r. P).15 H(ossible).55 E 1.002 +(syntax is:)108 206.4 R F2(de)3.502 E(v=)-.15 E F3(scsib)3.502 E(us)-.2 +E F0(,).27 E F3(tar).13 E -.1(ge)-.37 G(t).1 E F0(,).68 E F3(lun).09 E +F0(or)3.502 E F2(de)3.501 E(v=)-.15 E F3(tar)3.501 E -.1(ge)-.37 G(t).1 +E F0(,).68 E F3(lun).09 E F0 6.001(.I).24 G 3.501(nt)-6.001 G 1.001 +(he latter case, the CD-Recorder has to be con-)-3.501 F .465 +(nected to the def)108 218.4 R .465(ault SCSI b)-.1 F .465 +(us of the machine.)-.2 F F3(Scsib)5.465 E(us)-.2 E F0(,).27 E F3(tar) +2.965 E -.1(ge)-.37 G(t).1 E F0(and)2.965 E F3(lun)2.965 E F0 .466 +(are inte)2.966 F .466(ger numbers.)-.15 F .466(Some operat-)5.466 F +.578(ing systems or SCSI transport implementations may require to speci\ +fy a \214lename in addition.)108 230.4 R .578(In this case)5.578 F .365 +(the correct syntax for the de)108 242.4 R .365(vice is:)-.25 F F2(de) +2.865 E(v=)-.15 E F3(de)2.865 E(vicename)-.15 E F0(:).18 E F3(scsib).34 +E(us)-.2 E F0(,).27 E F3(tar).13 E -.1(ge)-.37 G(t).1 E F0(,).68 E F3 +(lun).09 E F0(or)2.865 E F2(de)2.865 E(v=)-.15 E F3(de)2.865 E(vicename) +-.15 E F0(:).18 E F3(tar).13 E -.1(ge)-.37 G(t).1 E F0(,).68 E F3(lun) +.09 E F0 5.365(.I).24 G(f)-5.365 E .568(the name of the de)108 254.4 R +.568(vice node that has been speci\214ed on such a system refers to e) +-.25 F .567(xactly one SCSI de)-.15 F .567(vice, a)-.25 F .189 +(shorthand in the form)108 266.4 R F2(de)2.689 E(v=)-.15 E F3(de)2.689 E +(vicename)-.15 E F0(:).18 E F3(@)-.68 E F0(or)2.689 E F2(de)2.689 E(v=) +-.15 E F3(de)2.689 E(vicename)-.15 E F0(:).18 E F3(@)-.68 E F0(,)A F3 +(lun).09 E F0 .19(may be used instead of)2.689 F F2(de)2.69 E(v=)-.15 E +F3(de)2.69 E(vice-)-.15 E(name)108 278.4 Q F0(:).18 E F3(scsib)A(us)-.2 +E F0(,).27 E F3(tar).13 E -.1(ge)-.37 G(t).1 E F0(,).68 E F3(lun).09 E +F0(.).24 E 2.32 -.8(To a)108 307.2 T .72(ccess remote SCSI de).8 F .72 +(vices, you need to prepend the SCSI de)-.25 F .72 +(vice name by a remote de)-.25 F .72(vice indicator)-.25 F(.)-.55 E +(The remote de)108 319.2 Q(vice indicator is either)-.25 E F2(REMO)2.5 E +(TE:)-.4 E F3(user@host:).08 E F0(or)2.5 E F2(REMO)5 E(TE:)-.4 E F3 +(host:).31 E F0 3.273(Av)108 331.2 S .773(alid remote SCSI de)-3.523 F +.773(vice name may be:)-.25 F F2(REMO)3.273 E(TE:)-.4 E F3(user@host:) +.08 E F0 .773(to allo)3.273 F 3.274(wr)-.25 G .774(emote SCSI b)-3.274 F +.774(us scanning or)-.2 F F2(REMO)108 343.2 Q(TE:)-.4 E F3 +(user@host:1,0,0)A F0(to access the SCSI de)2.5 E(vice at)-.25 E F3 +(host)2.5 E F0(connected to SCSI b)2.5 E(us # 1,tar)-.2 E(get 0 lun 0.) +-.18 E 3.074 -.8(To a)108 372 T 1.474(ccess SCSI de).8 F 1.474 +(vices via alternate transport layers, you need to prepend the SCSI de) +-.25 F 1.473(vice name by a)-.25 F .057(transport layer indicator)108 +384 R 5.057(.T)-.55 G .057 +(he transport layer indicator may be something lik)-5.057 F(e)-.1 E F2 +(USCSI:)2.558 E F0(or)2.558 E F2 -1.5 -.95(AT A)2.558 H(PI:).95 E F0 +5.058(.T)C 2.558(og)-5.858 G .058(et a)-2.558 F +(list of supported transport layers for your platform, use)108 396 Q F2 +(de)2.5 E(v=)-.15 E F3(HELP)2.5 E F0(:).44 E 2.759 -.8(To m)108 436.8 T +(ak).8 E(e)-.1 E F2(cdr)3.659 E(ecord)-.18 E F0 1.159(portable to all) +3.659 F/F4 8/Times-Roman@0 SF(UNIX)3.658 E F0 1.158 +(platforms, the syntax)3.658 F F2(de)3.658 E(v=)-.15 E F3(de)3.658 E +(vicename)-.15 E F0(:).18 E F3(scsib).34 E(us)-.2 E F0(,).27 E F3(tar) +.13 E -.1(ge)-.37 G(t).1 E F0(,).68 E F3(lun).09 E F0 1.158(is pre-) +3.658 F .297(ferred as is hides OS speci\214c kno)108 448.8 R .297 +(wledge about de)-.25 F .297(vice names from the user)-.25 F 5.297(.A) +-.55 G .298(speci\214c OS must not neces-)-2.5 F(sarily support a w)108 +460.8 Q(ay to specify a real de)-.1 E(vice \214le name nor a w)-.25 E +(ay to specify)-.1 E F3(scsib)2.5 E(us)-.2 E F0(,).27 E F3(tar).13 E -.1 +(ge)-.37 G(t).1 E F0(,).68 E F3(lun).09 E F0(.).24 E F3(Scsib)108 489.6 +Q(us)-.2 E F0 3.257(0i)3.257 G 3.257(st)-3.257 G .757(he def)-3.257 F +.757(ault SCSI b)-.1 F .757(us on the machine. W)-.2 F .756 +(atch the boot messages for more information or look)-.8 F(into)108 +501.6 Q F2(/v)2.995 E(ar/adm/messages)-.1 E F0 .496 +(for more information about the SCSI con\214guration of your machine.) +2.995 F .496(If you ha)5.496 F -.15(ve)-.2 G 2.158 +(problems to \214gure out what v)108 513.6 R 2.158(alues for)-.25 F F3 +(scsib)4.658 E(us)-.2 E F0(,).27 E F3(tar).13 E -.1(ge)-.37 G(t).1 E F0 +(,).68 E F3(lun).09 E F0 2.158(should be used, try the)4.658 F F2 +(\255scanb)4.658 E(us)-.2 E F0 2.158(option of)4.658 F F2(cdr)108 525.6 +Q(ecord)-.18 E F0(described belo)2.5 E -.65(w.)-.25 G .114 +(If a \214le /etc/def)108 554.4 R .114(ault/cdrecord e)-.1 F .115 +(xists, the parameter to the)-.15 F F2(de)2.615 E(v=)-.15 E F0 .115 +(option may also be a dri)2.615 F .415 -.15(ve n)-.25 H .115 +(ame label in said).15 F(\214le \(see FILES section\).)108 566.4 Q(On) +108 595.2 Q F2(SVr4)3.559 E F0 1.059(compliant systems,)3.559 F F2(cdr) +3.559 E(ecord)-.18 E F0 1.059 +(uses the the real time class to get the highest scheduling priority) +3.559 F .284(that is possible \(higher than all k)108 607.2 R .285 +(ernel processes\).)-.1 F .285(On systems with)5.285 F F2 .285(POSIX r) +2.785 F .285(eal time scheduling)-.18 F F0(cdrecord)2.785 E +(uses real time scheduling too, b)108 619.2 Q(ut may not be able to g) +-.2 E(ain a priority that is higher than all k)-.05 E(ernel processes.) +-.1 E(In)108 636 Q F3 -1.55 -.55(Tr a)2.604 H .504 -.2(ck A).55 H 2.604 +(tO).2 G(nce)-2.604 E F0 .103(mode, each)2.603 F F3(tr)2.603 E(ac)-.15 E +(k)-.2 E F0 .103(corresponds to a single \214le that contains the prepa\ +red data for that track.)2.603 F(If the ar)108 648 Q(gument is `)-.18 E +F2<ad>A F0(', standard input is used for that track.)A +(Only one track may be tak)5 E(en from)-.1 E F3(stdin)2.5 E F0(.).24 E +F1(GENERAL OPTIONS)72 676.8 Q F0(General options must be before an)108 +688.8 Q 2.5(yt)-.15 G(rack \214le name or track option.)-2.5 E F2<ad76> +108 705.6 Q(ersion)-.1 E F0(Print v)144 717.6 Q +(ersion information and e)-.15 E(xit.)-.15 E(J)72 768 Q -.25(..)-5.5 K +(or)-4.5 5.5 M 2.5(gS)-.18 G 153.065(chilling V)-2.5 F(ersion 2.0)-1.11 +E(1)206.225 E EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 104.275(CDRECORD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(CDRECORD\(1\))106.775 E/F1 10/Times-Bold@0 SF<ad76> +108 84 Q F0 .993(Increment the le)25.3 F -.15(ve)-.25 G 3.493(lo).15 G +3.493(fg)-3.493 G .993(eneral v)-3.493 F .993(erbosity by one.)-.15 F +.994(This is used e.g. to display the progress of the)5.993 F +(writing process.)144 96 Q F1<ad56>108 112.8 Q F0 .991(Increment the v) +23.08 F .991(erbose le)-.15 F -.15(ve)-.25 G 3.491(li).15 G 3.491(nr) +-3.491 G .991(espect of SCSI command transport by one.)-3.491 F .99 +(This helps to deb)5.99 F(ug)-.2 E .466 +(problems during the writing process, that occur in the CD-Recorder)144 +124.8 R 5.466(.I)-.55 G 2.966(fy)-5.466 G .467(ou get incomprehensible) +-2.966 F .899 +(error messages you should use this \215ag to get more detailed output.) +144 136.8 R F1(\255VV)5.899 E F0 .898(will sho)3.398 F 3.398(wd)-.25 G +.898(ata b)-3.398 F(uf)-.2 E(fer)-.25 E .25(content in addition.)144 +148.8 R(Using)5.25 E F1<ad56>2.75 E F0(or)2.75 E F1(\255VV)2.75 E F0 +(slo)2.75 E .25(ws do)-.25 F .251 +(wn the process and may be the reason for a b)-.25 F(uf)-.2 E(fer)-.25 E +(underrun.)144 160.8 Q F1(deb)108 177.6 Q(ug=)-.2 E/F2 10/Times-Italic@0 +SF(#,).48 E F1(-d)2.5 E F0 .386(Set the misc deb)144 189.6 R .386(ug v) +-.2 F .386(alue to # \(with deb)-.25 F .385 +(ug=#\) or increment the misc deb)-.2 F .385(ug le)-.2 F -.15(ve)-.25 G +2.885(lb).15 G 2.885(yo)-2.885 G .385(ne \(with -d\).)-2.885 F .13 +(If you specify)144 201.6 R F2(-dd,)2.63 E F0 .13(this equals to)2.63 F +F1(deb)2.63 E(ug=)-.2 E F2(2.).38 E F0 .13 +(This may help to \214nd problems while opening a dri)5.13 F -.15(ve) +-.25 G(r).15 E .111 +(for libscg as well as with sector sizes and sector types.)144 213.6 R +(Using)5.11 E F1(\255deb)2.61 E(ug)-.2 E F0(slo)2.61 E .11(ws do)-.25 F +.11(wn the process and)-.25 F(may be the reason for a b)144 225.6 Q(uf) +-.2 E(fer underrun.)-.25 E F1(kdeb)108 242.4 Q(ug=)-.2 E F0(#,)A F1(kd=) +2.5 E F0(#)A -.7(Te)144 254.4 S(ll the).7 E F1(scg)2.5 E F0(-dri)A -.15 +(ve)-.25 G 2.5(rt).15 G 2.5(om)-2.5 G(odify the k)-2.5 E(ernel deb)-.1 E +(ug v)-.2 E(alue while SCSI commands are running.)-.25 E F1(\255silent) +108 271.2 Q F0(,)A F1<ad73>2.5 E F0 +(Do not print out a status report for f)144 283.2 Q +(ailed SCSI commands.)-.1 E F1<ad66>108 300 Q(or)-.25 E(ce)-.18 E F0 +-.15(Fo)9.08 G .573 +(rce to continue on some errors. Be careful when using this option.).15 +F F1(Cdr)5.573 E(ecord)-.18 E F0 .573(implements se)3.073 F(v-)-.25 E +2.67(eral checks that pre)144 312 R -.15(ve)-.25 G 2.669 +(nt you from doing unw).15 F 2.669(anted things lik)-.1 F 5.169(ed)-.1 G +2.669(amaging CD-R)-5.169 F 5.169(Wm)-.55 G 2.669(edia by)-5.169 F +(improper dri)144 324 Q -.15(ve)-.25 G(s. Man).15 E 2.5(yo)-.15 G 2.5 +(ft)-2.5 G(he sanity checks are disabled when the)-2.5 E F1<ad66>2.5 E +(or)-.25 E(ce)-.18 E F0(option is used.)2.5 E +(This option also implements some tricks that will allo)144 348 Q 2.5 +(wy)-.25 G(ou to blank bad CD-R)-2.5 E 2.5(Wd)-.55 G(isks.)-2.5 E F1 +(\255immed)108 364.8 Q F0 -.7(Te)144 376.8 S 13.729 +(ll cdrecord to set the).7 F F1 13.729(SCSI IMMED)16.229 F F0 13.729 +(\215ag in certain commands)16.229 F 3.874 +(\(load/eject/blank/close_track/close_session\). This)144 388.8 R 1.373 +(can be useful on brok)3.874 F 1.373(en systems with A)-.1 F -.93(TA) +-1.11 G(PI).93 E 2.25(harddisk and CD/D)144 400.8 R 2.25 +(VD writer on the same b)-.4 F 2.25(us or with SCSI systems that don') +-.2 F 4.75(tu)-.18 G 2.25(se discon-)-4.75 F 3.031 +(nect/reconnect. These)144 412.8 R .531 +(systems will freeze while blanking or \214xating a CD/D)3.031 F .53 +(VD or while a D)-.4 F(VD)-.4 E .383(writer is \214lling up a session t\ +o the minimum amount \(approx. 800 MB\).)144 424.8 R .383(Setting the) +5.383 F F1(\255immed)2.884 E F0(\215ag)2.884 E 1.917(will request the c\ +ommand to return immediately while the operation proceeds in background\ +,)144 436.8 R .164(making the b)144 448.8 R .164 +(us usable for the other de)-.2 F .164(vices and a)-.25 F -.2(vo)-.2 G +.165(iding the system freeze.).2 F .165(This is an e)5.165 F(xperimen-) +-.15 E 1.366(tal feature which may w)144 460.8 R 1.366 +(ork or not, depending on the model of the CD/D)-.1 F 1.365(VD writer) +-.4 F 6.365(.A)-.55 G(correct)-2.5 E .126(solution w)144 472.8 R .126 +(ould be to set up a correct cabling b)-.1 F .126 +(ut there seem to be notebooks around that ha)-.2 F .427 -.15(ve b)-.2 H +(een).15 E .823(set up the wrong w)144 484.8 R .823(ay by the manuf)-.1 +F(acturer)-.1 E 5.823(.A)-.55 G 3.323(si)-5.823 G 3.323(ti)-3.323 G +3.323(si)-3.323 G .823(mpossible to \214x this problem in notebooks,) +-3.323 F(the)144 496.8 Q F1(\255immed)2.5 E F0(option has been added.) +2.5 E 2.533(As)144 520.8 S .033(econd e)-2.533 F .034 +(xperimental feature of the)-.15 F F1(\255immed)2.534 E F0 .034 +(\215ag is to tell cdrecord to try to w)2.534 F .034 +(ait short times wile)-.1 F 1.444(writing to the media. This is e)144 +532.8 R 1.443(xpected to free the IDE b)-.15 F 1.443(us if the CD/D)-.2 +F 1.443(VD writer and the data)-.4 F 1.236 +(source are connected to the same IDE cable. In this case, the CD/D)144 +544.8 R 1.236(VD writer w)-.4 F 1.236(ould otherwise)-.1 F 1.658 +(usually block the IDE b)144 556.8 R 1.658 +(us for nearly all the time making it impossible to fetch data from the) +-.2 F(source dri)144 568.8 Q -.15(ve)-.25 G 2.5(.S).15 G(ee also)-2.5 E +F1(minb)2.5 E(uf=)-.2 E F0(and)2.5 E F1<ad76>2.5 E F0(option.)2.5 E +1.282(Use both features at your o)144 592.8 R 1.282(wn risk.)-.25 F +1.282(It it turns out that it w)6.282 F 1.282(ould mak)-.1 F 3.782(es) +-.1 G 1.282(ense to ha)-3.782 F 1.583 -.15(ve a s)-.2 H(eparate).15 E +(option for the the w)144 604.8 Q +(ait feature, write to the author and con)-.1 E(vince him.)-.4 E F1 +(minb)108 621.6 Q(uf=)-.2 E F2(value).29 E F0 .878(The #)144 633.6 R F1 +(minb)3.378 E(uf=)-.2 E F0 .878(options allo)3.378 F .877 +(ws to de\214ne the minimum dri)-.25 F 1.177 -.15(ve b)-.25 H(uf)-.05 E +.877(fer \214ll ratio for the e)-.25 F(xperimental)-.15 E -1.21 -1.11 +(AT A)144 645.6 T .11(PI w)1.11 F .11 +(ait mode that is intended to free the IDE b)-.1 F .111(us to allo)-.2 F +2.611(wh)-.25 G .111(ard disk and CD/D)-2.611 F .111(VD writer to be)-.4 +F .745(on the same IDE cable.)144 657.6 R .745(As the w)5.745 F .745 +(ait mode currently only w)-.1 F .744(orks when the v)-.1 F .744 +(erbose option)-.15 F F1<ad76>3.244 E F0(has)3.244 E .454 +(been speci\214ed,)144 669.6 R F1(cdr)2.954 E(ecord)-.18 E F0 .454 +(implies the v)2.954 F .454(erbose option in case the)-.15 F F1 +(\255immed)2.954 E F0(or)2.955 E F1(minb)2.955 E(uf=)-.2 E F0 .455 +(option ha)2.955 F -.15(ve)-.2 G .622(been speci\214ed.)144 681.6 R +-1.11(Va)5.622 G .622(lid v)1.11 F .622(alues for)-.25 F F1(minb)3.122 E +(uf=)-.2 E F0 .622(are between 25 and 95 for 25%.)3.122 F 1.666(..)1.666 +G .622(95% minimum dri)-1.666 F -.15(ve)-.25 G -.2(bu)144 693.6 S -.25 +(ff).2 G(er \214ll ratio.).25 E(J)72 768 Q -.25(..)-5.5 K(or)-4.5 5.5 M +2.5(gS)-.18 G 153.065(chilling V)-2.5 F(ersion 2.0)-1.11 E(2)206.225 E +EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 104.275(CDRECORD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(CDRECORD\(1\))106.775 E/F1 10/Times-Bold@0 SF +(\255dummy)108 84 Q F0 .134 +(The CD-Recorder will go through all steps of the recording process, b) +144 96 R .134(ut the laser is turned of)-.2 F 2.635(fd)-.25 G(ur)-2.635 +E(-)-.2 E 1.042(ing this procedure.)144 108 R 1.042 +(It is recommended to run se)6.042 F -.15(ve)-.25 G 1.042 +(ral tests before actually writing to a Compact).15 F(Disk or Digital V) +144 120 Q(ersatile Disk, if the timing and load response of the system \ +is not kno)-1.11 E(wn.)-.25 E F1(\255dao)108 136.8 Q F0(Set)14.74 E F1 +(SA)3.542 E 3.542(O\()-.45 G 1.042(Session At Once\))-3.542 F F0 1.043 +(mode which is usually called)3.542 F F1 1.043(Disk At Once)3.543 F F0 +3.543(mode. This)3.543 F(currently)3.543 E(only w)144 148.8 Q +(orks with MMC dri)-.1 E -.15(ve)-.25 G 2.5(st).15 G(hat support)-2.5 E +F1(Session At Once)2.5 E F0(mode.)2.5 E F1(\255raw)108 165.6 Q F0(Set) +13.64 E F1(RA)2.5 E 2.5(Ww)-1.3 G(riting mode.)-2.5 E F0 +(Using this option def)5 E(aults to)-.1 E F1(\255raw96r)2.5 E F0(.)A F1 +(\255raw96r)108 182.4 Q F0 .469(Select Set)144 194.4 R F1(RA)2.969 E +2.969(Ww)-1.3 G .469(riting mode)-2.969 F F0 .469 +(with 2352 byte sectors plus 96 bytes of ra)2.969 F 2.968(wP)-.15 G .468 +(-W subchannel data)-2.968 F 1.107 +(resulting in a sector size of 2448 bytes.)144 206.4 R 1.108 +(This is the preferred ra)6.108 F 3.608(ww)-.15 G 1.108 +(riting mode as it gi)-3.608 F -.15(ve)-.25 G 3.608(sb).15 G(est)-3.608 +E .885(control o)144 218.4 R -.15(ve)-.15 G 3.385(rt).15 G .885 +(he CD writing process.)-3.385 F .885(If you \214nd an)5.885 F 3.385(yp) +-.15 G .885(roblems with the layout of a disk or with)-3.385 F .889(sub\ + channel content \(e.g. wrong times on the display when playing the CD\ +\) and your dri)144 230.4 R 1.19 -.15(ve s)-.25 H(up-).15 E .34 +(ports to write in)144 242.4 R F1(\255raw96r)2.84 E F0(or)2.84 E F1 +(\255raw16)2.84 E F0 .34(mode, you should gi)2.84 F .64 -.15(ve i)-.25 H +2.84(tat).15 G(ry)-2.84 E 2.84(.T)-.65 G .34(here are se)-2.84 F -.15 +(ve)-.25 G .34(ral CD writers).15 F .898(with bad \214rmw)144 254.4 R +.898(are that result in brok)-.1 F .899(en disks when writing in T)-.1 F +1.999 -.55(AO o)-.93 H 3.399(rS).55 G 1.999 -.55(AO m)-3.399 H 3.399 +(ode. Writing).55 F(data)3.399 E .429(disks in ra)144 266.4 R 2.929(wm) +-.15 G .428(ode needs signi\214cantly more CPU time than other write mo\ +des. If your CPU is too)-2.929 F(slo)144 278.4 Q 1.3 -.65(w, t)-.25 H +(his may result in b).65 E(uf)-.2 E(fer underruns.)-.25 E F1(\255raw96p) +108 295.2 Q F0 .885(Select Set)144 307.2 R F1(RA)3.385 E 3.385(Ww)-1.3 G +.885(riting mode)-3.385 F F0 .885 +(with 2352 byte sectors plus 96 bytes of pack)3.385 F .886 +(ed P-W subchannel)-.1 F .313 +(data resulting in a sector size of 2448 bytes.)144 319.2 R .313 +(This is the less preferred ra)5.313 F 2.812(ww)-.15 G .312 +(riting mode as only a)-2.812 F(fe)144 331.2 Q 3.455(wr)-.25 G .955 +(ecorders support it and some of these recorders ha)-3.455 F 1.255 -.15 +(ve b)-.2 H .955(ugs in the \214rmw)-.05 F .955(are implementation.)-.1 +F(Don')144 343.2 Q 3.852(tu)-.18 G 1.352 +(se this mode if your recorder supports)-3.852 F F1(\255raw96r)3.851 E +F0(or)3.851 E F1(\255raw16)3.851 E F0 6.351(.W)C 1.351 +(riting data disks in ra)-6.351 F(w)-.15 E 1.126(mode needs signi\214ca\ +ntly more CPU time than other write modes. If your CPU is too slo)144 +355.2 R 2.427 -.65(w, t)-.25 H(his).65 E(may result in b)144 367.2 Q(uf) +-.2 E(fer underruns.)-.25 E F1(\255raw16)108 384 Q F0 .251(Select Set) +144 396 R F1(RA)2.751 E 2.751(Ww)-1.3 G .251(riting mode)-2.751 F F0 .25 +(with 2352 byte sectors plus 6 bytes of P-Q subchannel data result-) +2.751 F .962(ing in a sector size of 2368 bytes.)144 408 R .963 +(If a recorder does not support)5.963 F F1(\255raw96r)3.463 E F0 3.463 +(,t)C .963(his is the preferred)-3.463 F(ra)144 420 Q 2.727(ww)-.15 G +.227(riting mode.)-2.727 F .227(It does not allo)5.227 F 2.727(wt)-.25 G +2.727(ow)-2.727 G(rite)-2.727 E/F2 10/Times-Italic@0 SF(CD-T)2.727 E -.2 +(ex)-.92 G(t).2 E F0(or)2.727 E F2(CD+Gr)2.727 E(aphics)-.15 E F0 -.2 +(bu)2.727 G 2.726(ti).2 G 2.726(ti)-2.726 G 2.726(st)-2.726 G .226 +(he only ra)-2.726 F 2.726(ww)-.15 G(rit-)-2.726 E .641 +(ing mode in cheap CD writers.)144 432 R .641 +(As these cheap writers in most cases do not support)5.641 F F1(\255dao) +3.142 E F0(mode.)3.142 E(Don')144 444 Q 3.565(tu)-.18 G 1.065 +(se this mode if your recorder supports)-3.565 F F1(\255raw96r)3.565 E +F0 6.065(.W)C 1.064(riting data disks in ra)-6.065 F 3.564(wm)-.15 G +1.064(ode needs)-3.564 F .782(signi\214cantly more CPU time than other \ +write modes. If your CPU is too slo)144 456 R 2.082 -.65(w, t)-.25 H +.782(his may result in).65 F -.2(bu)144 468 S -.25(ff).2 G +(er underruns.).25 E F1(\255multi)108 484.8 Q F0(Allo)7.52 E 2.918(wm) +-.25 G .418(ulti session CD')-2.918 F 2.918(st)-.55 G 2.918(ob)-2.918 G +2.918(em)-2.918 G .417 +(ade. This \215ag needs to be present on all sessions of a multi ses-) +-2.918 F .36(sion disk, e)144 496.8 R .36(xcept you w)-.15 F .361 +(ant to create a session that will be the last session on the media.)-.1 +F .361(The \214xa-)5.361 F .245(tion will be done in a w)144 508.8 R +.245(ay that allo)-.1 F .245 +(ws the CD-Recorder to append additional sessions later)-.25 F 2.744(.T) +-.55 G .244(his is)-2.744 F 1.111(done by generation a T)144 520.8 R +1.112(OC with a link to the ne)-.18 F 1.112 +(xt program area. The so generated media is not)-.15 F .134 +(100% compatible to manuf)144 532.8 R .134(actured CD')-.1 F 2.634(s\() +-.55 G -.15(ex)-2.634 G .134(cept for CDplus\).).15 F .133 +(Use only for recording of multi ses-)5.134 F 1.065(sion CD')144 544.8 R +3.565(s. If)-.55 F 1.065(this option is present, the def)3.565 F 1.065 +(ault track type is)-.1 F F1(CD-R)3.565 E 1.066(OM XA mode 2)-.3 F F0 +6.066(.T)C(he)-6.066 E F2(Sony)3.566 E F0(dri)144 556.8 Q -.15(ve)-.25 G +2.582(sh).15 G -2.25 -.2(av e)-2.582 H .082(no hardw)2.782 F .082 +(are support for)-.1 F F1(CD-R)2.582 E .082(OM XA mode 2)-.3 F F0 5.082 +(.Y)C .082(ou ha)-6.182 F .382 -.15(ve t)-.2 H 2.582(os).15 G .082 +(pecify the)-2.582 F F1(\255data)2.581 E F0(option)2.581 E .656 +(in order to create multi session disks on these dri)144 568.8 R -.15 +(ve)-.25 G 3.157(s. As).15 F .657(long as cdrecord does not ha)3.157 F +.957 -.15(ve a c)-.2 H(oder).15 E .536(for con)144 580.8 R -.15(ve)-.4 G +.536(rting data sectors to audio sectors, you need to force).15 F F1 +(CD-R)3.036 E(OM)-.3 E F0 .536(sectors by including the)3.036 F F1 +(\255data)144 592.8 Q F0 .045(option if you lik)2.545 F 2.545(et)-.1 G +2.545(or)-2.545 G .045(ecord a multisession disk in SA)-2.545 F 2.545 +(Om)-.55 G 2.546(ode. Not)-2.545 F .046(all dri)2.546 F -.15(ve)-.25 G +2.546(sa).15 G(llo)-2.546 E 2.546(wm)-.25 G(ultises-)-2.546 E(sion CD') +144 604.8 Q 2.5(si)-.55 G 2.5(nS)-2.5 G 1.1 -.55(AO m)-2.5 H(ode.).55 E +F1(\255msinf)108 621.6 Q(o)-.25 E F0(Retrie)144 633.6 Q .3 -.15(ve m) +-.25 H(ulti session info in a form suitable for).15 E F1(mkisofs-1.10) +2.5 E F0(or later)2.5 E(.)-.55 E .77(This option mak)144 657.6 R .769(e\ +s only sense with a CD that contains at least one closed session and is\ + append-)-.1 F .395(able \(not \214nally closed yet\).)144 669.6 R .396 +(Some dri)5.396 F -.15(ve)-.25 G 2.896(sc).15 G .396 +(reate error messages if you try to get the multi session)-2.896 F +(info for a disk that is not suitable for this operation.)144 681.6 Q F1 +(\255toc)108 698.4 Q F0(Retrie)17.53 E .526 -.15(ve a)-.25 H .226 +(nd print out the table of content or PMA of a CD.).15 F -.4(Wi)5.225 G +.225(th this option,).4 F F1(cdr)2.725 E(ecord)-.18 E F0 .225(will w) +2.725 F(ork)-.1 E(with CD-R dri)144 710.4 Q -.15(ve)-.25 G 2.5(sa).15 G +(nd with CD-R)-2.5 E(OM dri)-.4 E -.15(ve)-.25 G(s.).15 E(J)72 768 Q +-.25(..)-5.5 K(or)-4.5 5.5 M 2.5(gS)-.18 G 153.065(chilling V)-2.5 F +(ersion 2.0)-1.11 E(3)206.225 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 104.275(CDRECORD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(CDRECORD\(1\))106.775 E/F1 10/Times-Bold@0 SF +(\255atip)108 84 Q F0(Retrie)13.63 E 1.57 -.15(ve a)-.25 H 1.27 +(nd print out the A).15 F 1.271(TIP \(absolute T)-1.11 F 1.271 +(ime in Pre)-.35 F(groo)-.15 E -.15(ve)-.15 G 3.771(\)i).15 G 1.271 +(nfo of a CD/D)-3.771 F 1.271(VD recordable or)-.4 F(CD/D)144 96 Q 1.012 +(VD re)-.4 F 1.012(writable media.)-.25 F -.4(Wi)6.012 G 1.012 +(th this option,).4 F F1(cdr)3.512 E(ecord)-.18 E F0 1.012 +(will try to retrie)3.512 F 1.312 -.15(ve t)-.25 H 1.012(he A).15 F +1.012(TIP info. If the)-1.11 F .574(actual dri)144 108 R .874 -.15(ve d) +-.25 H .574(oes not support to read the A).15 F .574 +(TIP info, it may be that only a reduced set of informa-)-1.11 F .752 +(tion records or e)144 120 R -.15(ve)-.25 G 3.252(nn).15 G .751 +(othing is displayed. Only a limited number of MMC compliant dri)-3.252 +F -.15(ve)-.25 G 3.251(ss).15 G(up-)-3.251 E(port to read the A)144 132 +Q(TIP info.)-1.11 E(If)144 156 Q F1(cdr)3.229 E(ecord)-.18 E F0 .729 +(is able to retrie)3.229 F 1.029 -.15(ve t)-.25 H .73(he lead-in start \ +time for the \214rst session, it will try to decode and).15 F .132 +(print the manuf)144 168 R .132(acturer info from the media.)-.1 F -.4 +(DV)5.132 G 2.632(Dm).4 G .132(edia dos not ha)-2.632 F .432 -.15(ve a) +-.2 H .132(tip information b).15 F .131(ut there is)-.2 F(equi)144 180 Q +-.25(va)-.25 G +(lent prerecorded information that is read out and printed.).25 E F1 +<ad8c78>108 196.8 Q F0 .62(The disk will only be \214xated \(i.e. a T) +19.74 F .621(OC for a CD-Reader will be written\).)-.18 F .621 +(This may be used, if)5.621 F .079 +(for some reason the disk has been written b)144 208.8 R .079 +(ut not \214xated. This option currently does not w)-.2 F .078(ork with) +-.1 F(old TEA)144 220.8 Q 2.5(Cd)-.4 G(ri)-2.5 E -.15(ve)-.25 G 2.5(s\() +.15 G(CD-R50S and CD-R55S\).)-2.5 E F1<ad6e6f8c78>108 237.6 Q F0 .713(D\ +o not \214xate the disk after writing the tracks. This may be used to c\ +reate an audio disk in steps.)9.18 F .525(An un-\214xated disk can usua\ +lly not be used on a non CD-writer type dri)144 249.6 R .824 -.15(ve b) +-.25 H .524(ut there are audio CD)-.05 F +(players that will be able to play such a disk.)144 261.6 Q F1 +(\255waiti)108 278.4 Q F0 -.8(Wa)9.19 G .81(it for input to become a).8 +F -.25(va)-.2 G .811 +(ilable on standard input before trying to open the SCSI dri).25 F -.15 +(ve)-.25 G 1.911 -.55(r. T).15 H(his).55 E(allo)144 290.4 Q(ws)-.25 E F1 +(cdr)3.624 E(ecord)-.18 E F0 1.123(to read it')3.624 F 3.623(si)-.55 G +1.123(nput from a pipe e)-3.623 F -.15(ve)-.25 G 3.623(nw).15 G 1.123 +(hen writing additional sessions to a multi)-3.623 F .428(session disk.) +144 302.4 R .428(When writing another session to a multi session disk,) +5.428 F F1(mkisofs)2.928 E F0 .428(needs to read the old)2.928 F .858 +(session from the de)144 314.4 R .858(vice before writing output.)-.25 F +.858(This cannot be done if)5.858 F F1(cdr)3.358 E(ecord)-.18 E F0 .858 +(opens the SCSI)3.358 F(dri)144 326.4 Q -.15(ve)-.25 G 2.5(ra).15 G 2.5 +(tt)-2.5 G(he same time.)-2.5 E F1(\255load)108 343.2 Q F0 .741 +(Load the media and e)11.96 F .741(xit. This only w)-.15 F .741 +(orks with a tray loading mechanism b)-.1 F .742(ut seems to be useful) +-.2 F(when using the K)144 355.2 Q(odak disk transporter)-.35 E(.)-.55 E +F1(\255eject)108 372 Q F0 .298(Eject disk after doing the w)10.32 F +2.798(ork. Some)-.1 F(De)2.798 E .297 +(vices \(e.g. Philips\) need to eject the medium before cre-)-.25 F .768 +(ating a ne)144 384 R 3.268(wd)-.25 G .769 +(isk. Doing a \255dummy test and immediately creating a real disk w) +-3.268 F .769(ould not w)-.1 F .769(ork on)-.1 F(these de)144 396 Q +(vices.)-.25 E F1(speed=)108 412.8 Q F0(#)A 1.345(Set the speed f)144 +424.8 R 1.345(actor of the writing process to #.)-.1 F 3.845(#i)6.345 G +3.845(sa)-3.845 G 3.845(ni)-3.845 G(nte)-3.845 E(ger)-.15 E 3.845(,r)-.4 +G 1.345(epresenting a multiple of the)-3.845 F 1.547(audio speed.)144 +436.8 R 1.547(This is about 150 KB/s for CD-R)6.547 F 1.548 +(OM and about 172 KB/s for CD-Audio.)-.4 F 1.548(If no)6.548 F/F2 10 +/Times-Italic@0 SF(speed)144 448.8 Q F0 .459(option is present,)2.959 F +F1(cdr)2.959 E(ecord)-.18 E F0 .459(will try to get the speed v)2.959 F +.458(alue from the)-.25 F F1(CDR_SPEED)2.958 E F0(en)2.958 E(viron-)-.4 +E 2.5(ment. If)144 460.8 R(your dri)2.5 E .3 -.15(ve h)-.25 H +(as problems with).15 E F2(speed=2)2.5 E F0(or)2.5 E F2(speed=4)2.5 E F0 +2.5(,y).29 G(ou should try)-2.5 E F2(speed=0)2.5 E F0(.).47 E F1(blank=) +108 477.6 Q F2(type).13 E F0(Blank a CD-R)144 489.6 Q 2.5(Wa)-.55 G +(nd e)-2.5 E(xit or blank a CD-R)-.15 E 2.5(Wb)-.55 G +(efore writing. The blanking type may be one of:)-2.5 E 40.28 +(help Display)144 506.4 R 2.5(al)2.5 G(ist of possible blanking types.) +-2.5 E 47.5(all Blank)144 523.2 R(the entire disk. This may tak)2.5 E +2.5(eal)-.1 G(ong time.)-2.5 E -.1(fa)144 540 S 43.16(st Minimally).1 F +(blank the disk. This results in erasing the PMA, the T)2.5 E .001 +(OC and the pre)-.18 F -.05(ga)-.15 G(p.).05 E 37.51(track Blank)144 +556.8 R 2.5(at)2.5 G(rack.)-2.5 E(unreserv)144 573.6 Q 21.28(eU)-.15 G +(nreserv)-21.28 E 2.5(ear)-.15 G(eserv)-2.5 E(ed track.)-.15 E 38.61 +(trtail Blank)144 590.4 R(the tail of a track.)2.5 E 26.95 +(unclose Unclose)144 607.2 R(last session.)2.5 E 28.61(session Blank)144 +624 R(the last session.)2.5 E .259(Not all dri)108 636 R -.15(ve)-.25 G +2.759(ss).15 G .259 +(upport all blanking types. It may be necessary to use)-2.759 F F1 +(blank=all)2.759 E F0 .259(if a dri)2.759 F .559 -.15(ve r)-.25 H .259 +(eports a speci\214ed).15 F .273(command as being in)108 648 R -.25(va) +-.4 G 2.773(lid. If).25 F .273(used together with the)2.773 F F1<ad66> +2.773 E(or)-.25 E(ce)-.18 E F0 .274 +(\215ag, this option may be used to blank CD-R)2.773 F(W)-.55 E .46 +(disks that otherwise cannot be blank)108 660 R .459 +(ed. Note that you may need to specify)-.1 F F1(blank=)2.959 E F2(all) +.33 E F0 .459(because some dri)2.959 F -.15(ve)-.25 G(s).15 E .034 +(will not continue with certain types of bad CD-R)108 672 R 2.535(Wd) +-.55 G .035(isks. Note also that)-2.535 F F1(cdecord)2.535 E F0 .035 +(does it')2.535 F 2.535(sb)-.55 G .035(est if the)-2.535 F F1<ad66>2.535 +E(or)-.25 E(ce)-.18 E F0 .897(\215ag is used b)108 684 R .897 +(ut it \214nally depends on the dri)-.2 F -.15(ve)-.25 G 1.997 -.55 +('s \214).15 H(rmw).55 E .897 +(are whether the blanking operation will succeed or)-.1 F(not.)108 696 Q +F1(fs=)108 712.8 Q F0 18.08(#S)C .677(et the \214fo \(ring b)-18.08 F +(uf)-.2 E .678(fer\) size to #.)-.25 F -1.1(Yo)5.678 G 3.178(um)1.1 G +.678(ay use the same method as in)-3.178 F F1(dd)3.178 E F0(\(1\),)A F1 +(sdd)3.178 E F0 .678(\(1\) or)B F1(star)3.178 E F0(\(1\).)A 1.689 +(The number representing the size is tak)144 724.8 R 1.689 +(en in bytes unless otherwise speci\214ed.)-.1 F 1.688(If a number is) +6.688 F(J)72 768 Q -.25(..)-5.5 K(or)-4.5 5.5 M 2.5(gS)-.18 G 153.065 +(chilling V)-2.5 F(ersion 2.0)-1.11 E(4)206.225 E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 104.275(CDRECORD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(CDRECORD\(1\))106.775 E(follo)144 84 Q 2.479 +(wed directly by the letter `b', `k', `m', `s' of `f)-.25 F 2.479 +(', the size is multiplied by 512, 1024,).55 F .718 +(1024*1024, 2048 or 2352.)144 96 R .718(If the size consists of numbers\ + separated by `x' or `*', multiplication)5.718 F(of the tw)144 108 Q 2.5 +(on)-.1 G(umbers is performed.)-2.5 E(Thus)5 E/F1 10/Times-Italic@0 SF +(fs=10x63k)2.5 E F0(will specify a \214fo size of 630 kBytes.)2.5 E .429 +(The size speci\214ed by the)144 132 R F1(fs=)2.929 E F0(ar)2.929 E .43 +(gument includes the shared memory that is needed for administra-)-.18 F +.437(tion. This is at least one page of memory)144 144 R 5.437(.I)-.65 G +2.937(fn)-5.437 G(o)-2.937 E F1(fs)2.936 E F0 2.936(=o).27 G .436 +(ption is present,)-2.936 F/F2 10/Times-Bold@0 SF(cdr)2.936 E(ecord)-.18 +E F0 .436(will try to get the)2.936 F(\214fo size v)144 156 Q +(alue from the)-.25 E F2(CDR_FIFOSIZE)2.5 E F0(en)2.5 E 2.5 +(vironment. The)-.4 F(def)2.5 E(ault \214fo size is currently 4 MB.)-.1 +E .108(The \214fo is used to increase b)144 180 R(uf)-.2 E .108 +(fering for the real time writing process.)-.25 F .108(It allo)5.108 F +.108(ws to run a pipe from)-.25 F F2(mkisofs)144 192 Q F0 .09 +(directly into)2.59 F F2(cdr)2.59 E(ecord)-.18 E F0 5.09(.I)C 2.59(ft) +-5.09 G .09(he \214fo is acti)-2.59 F .39 -.15(ve a)-.25 H .09 +(nd a pipe from).15 F F2(mkisofs)2.59 E F0(into)2.59 E F2(cdr)2.59 E +(ecord)-.18 E F0 .09(is used)2.59 F 1.583(to create a CD,)144 204 R F2 +(cdr)4.083 E(ecord)-.18 E F0 1.583(will abort prior to do an)4.083 F +4.084(ym)-.15 G 1.584(odi\214cations on the disk if)-4.084 F F2(mkisofs) +4.084 E F0(dies)4.084 E 1.19(before it starts writing.)144 216 R 1.19 +(The recommended \214fo size is between 4 and 32 MBytes.)6.19 F 1.19 +(As a rule of)6.19 F .717(thumb, the \214fo size should be at least equ\ +al to the size of the internal b)144 228 R(uf)-.2 E .718 +(fer of the CD-Recorder)-.25 F .331(and no more than half of the ph)144 +240 R .331(ysical amount of RAM a)-.05 F -.25(va)-.2 G .33 +(ilable in the machine.).25 F .33(If the \214fo size is)5.33 F .215(big\ + enough, the \214fo statistics will print a \214fo empty count of zero \ +and the \214fo min \214ll is not belo)144 252 R(w)-.25 E 2.812(20%. It) +144 264 R .311(is not wise to use too much space for the \214fo. If you\ + need more than 8 MB to write a CD)2.812 F .023 +(on an idle machine, your machine is either underpo)144 276 R .023 +(wered, has hardw)-.25 F .023(are problems or is mis-con\214g-)-.1 F +4.364(ured. The)144 288 R 1.864(sun4c architecture \(e.g. a Sparcstatio\ +n-2\) has only MMU page table entries for 16)4.364 F .812(MBytes per pr\ +ocess. Using more than 14 MBytes for the \214fo may cause the operating\ + system in)144 300 R .446 +(this case to spend much time to constantly reload the MMU tables. Ne) +144 312 R .445(wer machines from Sun do)-.25 F .12(not ha)144 324 R .42 +-.15(ve t)-.2 H .12(his MMU hardw).15 F .121(are problem. I ha)-.1 F +.421 -.15(ve n)-.2 H 2.621(oi).15 G .121(nformation on PC-hardw)-2.621 F +.121(are re\215ecting this prob-)-.1 F(lem.)144 336 Q .993(If you ha)144 +360 R 1.293 -.15(ve b)-.2 H(uf)-.05 E .993 +(fer underruns or similar problems and observ)-.25 F 3.492(eaz)-.15 G +(ero)-3.492 E F1 .992(\214fo empty count)3.492 F F0 3.492(,y).68 G .992 +(ou ha)-3.492 F -.15(ve)-.2 G(hardw)144 372 Q +(are problems. The \214fo size in this case is suf)-.1 E(\214cient.)-.25 +E F2(de)108 388.8 Q(v=)-.15 E F1(tar).13 E -.1(ge)-.37 G(t).1 E F0 2.041 +(Sets the SCSI tar)144 400.8 R 2.041(get for the CD-Recorder)-.18 F +4.541(,s)-.4 G 2.041(ee notes abo)-4.541 F -.15(ve)-.15 G 7.042(.A).15 G +2.042(typical de)-2.5 F 2.042(vice speci\214cation is)-.25 F F2(de)144 +412.8 Q(v=)-.15 E F1(6,0).2 E F0 5.246(.I)2.746 G 2.746(fa\214)-5.246 G +.246(lename must be pro)-2.746 F .246 +(vided together with the numerical tar)-.15 F .246 +(get speci\214cation, the \214le-)-.18 F .066 +(name is implementation speci\214c.)144 424.8 R .066 +(The correct \214lename in this case can be found in the system spe-) +5.066 F 1.205(ci\214c manuals of the tar)144 436.8 R 1.204 +(get operating system.)-.18 F 1.204(On a)6.204 F F1 -1.77 -.55(Fr e) +3.704 H(eBSD).55 E F0 1.204(system without)3.704 F F1(CAM)3.704 E F0 +1.204(support, you)3.704 F .347(need to use the control de)144 448.8 R +.347(vice \(e.g.)-.25 F F1(/de)5.347 E(v/r)-.15 E(cd0.ctl)-.37 E F0 +2.847(\). A).51 F .347(correct de)2.847 F .348 +(vice speci\214cation in this case may)-.25 F(be)144 460.8 Q F2(de)2.5 E +(v=)-.15 E F1(/de)1.15 E(v/r)-.15 E(cd0.ctl:@)-.37 E F0(.)2.5 E .572 +(On Linux, dri)144 484.8 R -.15(ve)-.25 G 3.072(sc).15 G .572 +(onnected to a parallel port adapter are mapped to a virtual SCSI b) +-3.072 F .571(us. Dif)-.2 F(ferent)-.25 E(adapters are mapped to dif)144 +496.8 Q(ferent tar)-.25 E(gets on this virtual SCSI b)-.18 E(us.)-.2 E +.526(If no)144 520.8 R F1(de)3.026 E(v)-.15 E F0 .527 +(option is present,)3.027 F F2(cdr)3.027 E(ecord)-.18 E F0 .527 +(will try to get the de)3.027 F .527(vice from the)-.25 F F2(CDR_DEVICE) +3.027 E F0(en)3.027 E(viron-)-.4 E(ment.)144 532.8 Q 1.047(If the ar)144 +556.8 R 1.047(gument to the)-.18 F F2(de)3.547 E(v=)-.15 E F0 1.047 +(option does not contain the characters ',)3.547 F 1.047 +(', '/', '@' or ':', it is inter)-.7 F(-)-.2 E +(preted as an label name that may be found in the \214le /etc/def)144 +568.8 Q(ault/cdrecord \(see FILES section\).)-.1 E F2(gracetime=)108 +585.6 Q F1(#).48 E F0(Set the grace time before starting to write to)144 +597.6 Q F1(#)2.5 E F0 2.5(seconds. V)3.4 F(alues belo)-1.11 E 2.5(w2s) +-.25 G(econds are not allo)-2.5 E(wed.)-.25 E F2(timeout=)108 614.4 Q F1 +(#).48 E F0 .13(Set the def)144 626.4 R .13(ault SCSI command timeout v) +-.1 F .13(alue to)-.25 F F1(#)2.63 E F0 2.63(seconds. The)3.53 F(def) +2.63 E .13(ault SCSI command timeout is)-.1 F .452 +(the minimum timeout used for sending SCSI commands.)144 638.4 R .451 +(If a SCSI command f)5.451 F .451(ails due to a time-)-.1 F .366 +(out, you may try to raise the def)144 650.4 R .366 +(ault SCSI command timeout abo)-.1 F .667 -.15(ve t)-.15 H .367 +(he timeout v).15 F .367(alue of the f)-.25 F(ailed)-.1 E 2.716 +(command. If)144 662.4 R .216(the command runs correctly with a raised \ +command timeout, please report the better)2.716 F .401(timeout v)144 +674.4 R .401 +(alue and the corresponding command to the author of the program.)-.25 F +.402(If no)5.402 F F1(timeout)2.902 E F0(option)2.902 E +(is present, a def)144 686.4 Q(ault timeout of 40 seconds is used.)-.1 E +F2(dri)108 703.2 Q -.1(ve)-.1 G(r=).1 E F1(name).36 E F0(Allo)144 715.2 +Q 1.41(ws to use a user supplied dri)-.25 F -.15(ve)-.25 G 3.91(rn).15 G +1.41(ame for the de)-3.91 F 3.91(vice. T)-.25 F 3.91(og)-.8 G 1.41 +(et a list of possible dri)-3.91 F -.15(ve)-.25 G 1.41(rs use).15 F F2 +(dri)144 727.2 Q -.1(ve)-.1 G(r=help).1 E F0 5.973(.T)C .973 +(he reason for the e)-5.973 F .973(xistence of this option is to allo) +-.15 F 3.473(wu)-.25 G .973(sers to use)-3.473 F F2(cdr)3.474 E(ecord) +-.18 E F0(with)3.474 E(J)72 768 Q -.25(..)-5.5 K(or)-4.5 5.5 M 2.5(gS) +-.18 G 153.065(chilling V)-2.5 F(ersion 2.0)-1.11 E(5)206.225 E EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 104.275(CDRECORD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(CDRECORD\(1\))106.775 E(dri)144 84 Q -.15(ve)-.25 G +3.609(st).15 G 1.109(hat are similar to supported dri)-3.609 F -.15(ve) +-.25 G 3.609(sb).15 G 1.109(ut not kno)-3.809 F 1.109(wn directly by) +-.25 F/F1 10/Times-Bold@0 SF(cdr)3.608 E(ecord)-.18 E F0 6.108(.U)C +1.108(se this option)-6.108 F .094(with e)144 96 R .094 +(xtreme care. If a wrong dri)-.15 F -.15(ve)-.25 G 2.595(ri).15 G 2.595 +(su)-2.595 G .095(sed for a de)-2.595 F .095 +(vice, the possibility of creating corrupted disks)-.25 F .54(is high.) +144 108 R .54(The minimum problem related to a wrong dri)5.54 F -.15(ve) +-.25 G 3.04(ri).15 G 3.04(st)-3.04 G .54(hat the)-3.04 F F1(\255speed) +3.04 E F0(or)3.04 E F1(\255dummy)3.04 E F0 .54(will not)3.04 F -.1(wo) +144 120 S(rk.).1 E .149(There are tw)144 144 R 2.649(os)-.1 G .149 +(pecial dri)-2.649 F -.15(ve)-.25 G 2.649(re).15 G .149 +(ntries in the list:)-2.649 F F1(cdr_simul)2.649 E F0(and)2.649 E F1 +(dvd_simul)2.65 E F0 5.15(.T)C .15(hese dri)-5.15 F -.15(ve)-.25 G 2.65 +(re).15 G .15(ntries are)-2.65 F 1.912(designed to mak)144 156 R 4.412 +(et)-.1 G 1.912(iming tests at an)-4.412 F 4.412(ys)-.15 G 1.912 +(peed or timing tests for dri)-4.412 F -.15(ve)-.25 G 4.412(st).15 G +1.911(hat do not support the)-4.412 F F1(\255dummy)144 168 Q F0 2.842 +(option. The)2.842 F .342(simulation dri)2.842 F -.15(ve)-.25 G .342 +(rs implement a dri).15 F .642 -.15(ve w)-.25 H .343(ith a b).15 F(uf) +-.2 E .343(fer size of 1MB that can be)-.25 F .523(changed via the)144 +180 R F1(CDR_SIMUL_B)3.022 E(UFSIZE)-.1 E F0(en)3.022 E .522 +(vironment v)-.4 F 3.022(ariable. The)-.25 F .522(simulation dri)3.022 F +-.15(ve)-.25 G 3.022(rc).15 G(orrectly)-3.022 E .004(simulates e)144 192 +R -.15(ve)-.25 G 2.504(nab).15 G(uf)-2.704 E .004 +(fer underrun condition.)-.25 F .005(If the)5.005 F F1(\255dummy)2.505 E +F0 .005(option is present, the simulation is not)2.505 F +(aborted in case of a b)144 204 Q(uf)-.2 E(fer underrun.)-.25 E F1(dri) +108 220.8 Q -.1(ve)-.1 G -.18(ro).1 G(pts=).18 E/F2 10/Times-Italic@0 SF +(option list).23 E F0 .343(Set dri)144 232.8 R -.15(ve)-.25 G 2.843(rs) +.15 G .343 +(peci\214c options. The options are speci\214ed a comma separated list.) +-2.843 F 1.943 -.8(To g)5.343 H .343(et a list of v).8 F(alid)-.25 E +.386(options use)144 244.8 R F1(dri)2.886 E -.1(ve)-.1 G -.18(ro).1 G +(pts=).18 E F2(help).31 E F0 .386(together with the)2.886 F F2<ad63> +2.886 E(hec)-.15 E(kdrive)-.2 E F0 2.886(option. Currently)2.886 F .386 +(implemented dri)2.886 F -.15(ve)-.25 G(r).15 E(options are:)144 256.8 Q +F1 -.2(bu)144 273.6 S -.15(rn).2 G(fr).15 E(ee)-.18 E F0 -.45(Tu)180 +285.6 S 1.122(rn the support for Buf).45 F 1.122 +(fer Underrun Free writing on.)-.25 F 1.121(This only w)6.121 F 1.121 +(orks for dri)-.1 F -.15(ve)-.25 G 3.621(st).15 G(hat)-3.621 E 1.954 +(support Buf)180 297.6 R 1.954(fer Underrun Free technology)-.25 F 6.954 +(.T)-.65 G 1.954(his may be called:)-6.954 F F1(Sany)4.454 E 4.454(oB) +-.25 G(URN-Pr)-4.554 E(oof)-.18 E F0(,)A F1(Ricoh J)180 309.6 Q +(ust-Link)-.15 E F0(,)A F1 -.85(Ya)2.5 G(maha Lossless-Link).85 E F0 +(or similar)2.5 E(.)-.55 E(The def)180 333.6 Q(ault is to turn)-.1 E F1 +-.1(BU)2.5 G(RN-Fr).1 E(ee)-.18 E F0(of)2.5 E(f, re)-.25 E -.05(ga)-.15 +G(rdless of the def).05 E(aults of the dri)-.1 E -.15(ve)-.25 G(.).15 E +F1(nob)144 350.4 Q(ur)-.2 E(nfr)-.15 E(ee)-.18 E F0 -.45(Tu)180 362.4 S +(rn the support for Buf).45 E(fer Underrun Free writing of)-.25 E(f.) +-.25 E F1 -.1(va)144 379.2 S(rir).1 E(ec=)-.18 E F2(value).29 E F0 -.45 +(Tu)180 391.2 S .71(rn on the).45 F F1 .71(Plextor V)3.21 F(ariRec)-.92 +E F0 .71(writing mode. The mandatory parameter)3.21 F F2(value)3.21 E F0 +.71(is the laser)3.21 F(po)180 403.2 Q .556(wer of)-.25 F .556 +(fset and currently may be selected from -2, -1, 0, 1, 2.)-.25 F .557 +(In addition, you need to)5.557 F +(set the write speed to 4 in order to allo)180 415.2 Q(w)-.25 E F1 -.92 +(Va)2.5 G(riRec).92 E F0(to w)2.5 E(ork.)-.1 E F1(audiomaster)144 432 Q +F0 -.45(Tu)180 444 S 1.038(rn on the).45 F F1 -.85(Ya)3.538 G 1.038 +(hama A).85 F 1.038(udio Master Q)-.5 F 3.538(.R)-.2 G(.)-3.538 E F0 +1.038(feature which usually should result in high)6.038 F .265 +(quality CDs that ha)180 456 R .565 -.15(ve l)-.2 H .265 +(ess reading problems in HiFi players.).15 F .266 +(As this is implemented as a)5.265 F -.25(va)180 468 S 1.535 +(riant of the Session at Once write mode, it will only w).25 F 1.534 +(ork if you select SA)-.1 F 4.034(Ow)-.55 G(rite)-4.034 E .45 +(mode and there is no need to turn it of)180 480 R 2.951(f. The)-.25 F +F1 -.5(Au)2.951 G .451(dio Master).5 F F0 .451(mode will w)2.951 F .451 +(ork with a lim-)-.1 F .811(ited speed b)180 492 R .811 +(ut may also be used with data CDs. in)-.2 F F1 -.5(Au)3.31 G .81 +(dio Master).5 F F0 .81(mode, the pits on the)3.31 F .258 +(CD will be written lar)180 504 R .258 +(ger then usual so the capacity of the medium is reduced when turn-)-.18 +F 1.016(ing this feature on.)180 516 R 3.516(A7)6.016 G 3.515(4m)-3.516 +G 1.015(inute CD will only ha)-3.515 F 1.315 -.15(ve a c)-.2 H 1.015 +(apacity of 63 minutes if).15 F F1 -.5(Au)3.515 G(dio).5 E(Master)180 +528 Q F0(is acti)2.5 E .3 -.15(ve a)-.25 H +(nd the capacity of a 80 minute CD will be reduced to 68 minutes.).15 E +F1 -.25(fo)144 544.8 S -.18(rc).25 G(espeed).18 E F0(Normally)180 556.8 +Q 3.721(,m)-.65 G 1.221(odern dri)-3.721 F -.15(ve)-.25 G 3.721(sk).15 G +(no)-3.721 E 3.721(wt)-.25 G 1.222(he highest possible speed for dif) +-3.721 F 1.222(ferent media and may)-.25 F 2.46 +(reduce the speed in order to grant best write quality)180 568.8 R 7.46 +(.S)-.65 G 2.46(ome dri)-7.46 F -.15(ve)-.25 G 4.96(s\().15 G 2.46 +(e.g. Ricoh and)-4.96 F -1(Ya)180 580.8 S .664(maha\) allo)1 F 3.164(wt) +-.25 G 3.164(of)-3.164 G .664(orce the dri)-3.164 F .964 -.15(ve t)-.25 +H 3.164(ou).15 G .664(se the selected speed e)-3.164 F -.15(ve)-.25 G +3.164(ni).15 G 3.164(ft)-3.164 G .664(he medium is so bad)-3.164 F 1.339 +(that the write quality w)180 592.8 R 1.338(ould be poor)-.1 F 3.838(.T) +-.55 G 1.338(his option tells such a dri)-3.838 F 1.638 -.15(ve t)-.25 H +3.838(of).15 G 1.338(orce to use the)-3.838 F(selected speed re)180 +604.8 Q -.05(ga)-.15 G(rdless of the medium quality).05 E(.)-.65 E 2.005 +(Use this option with e)180 628.8 R 2.005 +(xtreme care and note that the dri)-.15 F 2.305 -.15(ve s)-.25 H 2.005 +(hould kno).15 F 4.505(wb)-.25 G 2.005(etter which)-4.505 F .743 +(medium will w)180 640.8 R .743(ork at full speed.)-.1 F .743(The def) +5.743 F .743(ault is to turn)-.1 F F1 -.25(fo)3.242 G -.18(rc).25 G +(espeed).18 E F0(of)3.242 E .742(f, re)-.25 F -.05(ga)-.15 G .742 +(rdless of the).05 F(def)180 652.8 Q(aults of the dri)-.1 E -.15(ve)-.25 +G(.).15 E F1(nof)144 669.6 Q(or)-.25 E(cespeed)-.18 E F0 -.45(Tu)180 +681.6 S(rn of).45 E 2.5(ft)-.25 G(he)-2.5 E F1 -.25(fo)2.5 G -.18(rc).25 +G 2.5(es).18 G(peed)-2.5 E F0(feature.)2.5 E F1(tattooinf)144 698.4 Q(o) +-.25 E F0 .615(Use this option together with)180 710.4 R F1 +(\255checkdri)3.115 E -.1(ve)-.1 G F0 .615(to retrie)3.215 F .915 -.15 +(ve t)-.25 H .616(he image size information for the).15 F F1 -.85(Ya)180 +722.4 S 1.203(maha DiskT@2).85 F F0 1.203(feature. The images al)3.703 F +-.1(wa)-.1 G 1.202(ys ha).1 F 1.502 -.15(ve a l)-.2 H 1.202 +(ine length of 3744 pix).15 F 3.702(el. Line)-.15 F(J)72 768 Q -.25(..) +-5.5 K(or)-4.5 5.5 M 2.5(gS)-.18 G 153.065(chilling V)-2.5 F(ersion 2.0) +-1.11 E(6)206.225 E EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 104.275(CDRECORD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(CDRECORD\(1\))106.775 E .388 +(number 0 \(radius 0\) is mapped to the center of the disk.)180 84 R +.388(If you kno)5.388 F 2.888(wt)-.25 G .388(he inner and outer)-2.888 F +.764(radius you will be able to create a pre distorted image that later\ + may appear undistorted)180 96 R(on the disk.)180 108 Q/F1 10 +/Times-Bold@0 SF(tattoo\214le=)144 124.8 Q/F2 10/Times-Italic@0 SF(name) +.36 E F0 .992(Use this option together with)180 136.8 R F1(\255checkdri) +3.492 E -.1(ve)-.1 G F0 .992(to write an image prepared for the)3.592 F +F1 -.85(Ya)3.493 G(maha).85 E(DiskT@2)180 148.8 Q F0 .264 +(feature to the medium.)2.764 F .264 +(The \214le must be a \214le with ra)5.264 F 2.763(wi)-.15 G .263 +(mage B&W data \(one)-2.763 F .36(byte per pix)180 160.8 R .36 +(el\) in a size as retrie)-.15 F -.15(ve)-.25 G 2.86(db).15 G 2.861(yap) +-2.86 G(re)-2.861 E .361(vious call to)-.25 F F1(tattoo\214le=)2.861 E +F2(name).36 E F0 5.361(.I)2.861 G 2.861(ft)-5.361 G .361(he size of) +-2.861 F .959 +(the image equals the maximum possible size \(3744 x 320 pix)180 172.8 R +(el\),)-.15 E F1(cdr)3.458 E(ecord)-.18 E F0 .958(will use the)3.458 F(\ +\214rst part of the \214le. This \214rst part then will be written to t\ +he lefto)180 184.8 Q -.15(ve)-.15 G 2.5(rs).15 G(pace on the CD.)-2.5 E +(Note that the image must be mirrored to be readable from the pick up s\ +ide of the CD.)180 208.8 Q F1(\255checkdri)108 225.6 Q -.1(ve)-.1 G F0 +.26(Checks if a dri)144 237.6 R -.15(ve)-.25 G 2.76(rf).15 G .26 +(or the current dri)-2.76 F .56 -.15(ve i)-.25 H 2.76(sp).15 G .26 +(resent and e)-2.76 F 2.76(xit. If)-.15 F .26(the dri)2.76 F .56 -.15 +(ve i)-.25 H 2.76(sak).15 G(no)-2.76 E .26(wn dri)-.25 F -.15(ve)-.25 G +(,).15 E F1(cdr)2.76 E(ecord)-.18 E F0(uses e)144 249.6 Q(xit code 0.) +-.15 E F1(\255pr)108 266.4 Q(cap)-.18 E F0 .783(Print the dri)5.48 F +1.083 -.15(ve c)-.25 H .782(apabilities for SCSI-3/mmc compliant dri).15 +F -.15(ve)-.25 G 3.282(sa).15 G 3.282(so)-3.282 G .782 +(btained from mode page 0x2A.)-3.282 F -1.11(Va)144 278.4 S 1.326 +(lues mark)1.11 F 1.326(ed with)-.1 F F2(kB)3.826 E F0 1.326 +(use 1000 bytes as kilo-byte, v)3.826 F 1.326(alues mark)-.25 F 1.326 +(ed with)-.1 F F2(KB)3.826 E F0 1.327(use 1024 bytes as)3.827 F +(Kilo-byte.)144 290.4 Q F1(\255inq)108 307.2 Q F0 +(Do an inquiry for the dri)16.4 E -.15(ve)-.25 G 2.5(,p).15 G +(rint the inquiry info and e)-2.5 E(xit.)-.15 E F1(\255scanb)108 324 Q +(us)-.2 E F0 .22(Scan all SCSI de)144 336 R .22(vices on all SCSI b)-.25 +F .219(usses and print the inquiry strings. This option may be used to) +-.2 F .76(\214nd SCSI address of the CD-Recorder on a system.)144 348 R +.761(The numbers printed out as labels are com-)5.761 F(puted by:)144 +360 Q F1 -.2(bu)2.5 G 2.5(s*1).2 G(00 + tar)-2.5 E(get)-.1 E<ad72>108 +376.8 Q(eset)-.18 E F0 -.35(Tr)9.94 G 3.197(yt).35 G 3.197(or)-3.197 G +.697(eset the SCSI b)-3.197 F .697 +(us where the CD recorder is located. This w)-.2 F .696 +(orks not on all operating sys-)-.1 F(tems.)144 388.8 Q F1<ad6f>108 +405.6 Q -.1(ve)-.1 G(rb).1 E(ur)-.2 E(n)-.15 E F0(Allo)144 417.6 Q(w) +-.25 E F1(cdr)3.633 E(ecord)-.18 E F0 1.133(to write more than the of) +3.633 F 1.133(\214cial size of a medium. This feature is usually called) +-.25 F F2 -.1(ov)144 429.6 S(erb).1 E(urning)-.2 E F0 .385 +(and depends on the f)2.885 F .384 +(act that most blank media may hold more space than the of)-.1 F +(\214cial)-.25 E .859(size. As the of)144 441.6 R .859(\214cial size of\ + the lead-out area on the disk is 90 seconds \(6750 sectors\) and a dis\ +k)-.25 F .352(usually w)144 453.6 R .352 +(orks if there are at least 150 sectors of lead out, all media may be o) +-.1 F -.15(ve)-.15 G(rb).15 E .351(urned by at least)-.2 F 2.001 +(88 seconds \(6600 sectors\).)144 465.6 R 2.001 +(Most CD recorders only do o)7.001 F -.15(ve)-.15 G(rb).15 E 2.002 +(urning in)-.2 F F1(SA)4.502 E(O)-.45 E F0(or)4.502 E F1(RA)4.502 E(W) +-1.3 E F0(mode.)4.502 E(Kno)144 477.6 Q 1.64(wn e)-.25 F 1.639 +(xceptions are TEA)-.15 F 4.139(CC)-.4 G 1.639(D-R50S, TEA)-4.139 F +4.139(CC)-.4 G 1.639(D-R55S and the P)-4.139 F 1.639(anasonic CW)-.15 F +4.139(-7502. Some)-.65 F(dri)144 489.6 Q -.15(ve)-.25 G 3.215(sd).15 G +3.215(on)-3.215 G 1.215 -.25(ow a)-3.215 H(llo).25 E 3.215(wt)-.25 G +3.215(oo)-3.215 G -.15(ve)-3.365 G(rb).15 E .716 +(urn as much as you might lik)-.2 F 3.216(ea)-.1 G .716 +(nd limit the size of a CD to e.g. 76)-3.216 F .813 +(minutes. This problem may be circumv)144 501.6 R .813 +(ented by writing the CD in RA)-.15 F 3.312(Wm)-.9 G .812 +(ode because this w)-3.312 F(ay)-.1 E .988(the dri)144 513.6 R 1.288 +-.15(ve h)-.25 H .988 +(as no chance to \214nd the size before starting to b).15 F 3.489 +(urn. There)-.2 F .989(is no guarantee that your)3.489 F(dri)144 525.6 Q +.3 -.15(ve s)-.25 H(upports o).15 E -.15(ve)-.15 G(rb).15 E +(urning at all.)-.2 E(Mak)5 E 2.5(eat)-.1 G(est to check if your dri) +-2.5 E .3 -.15(ve i)-.25 H(mplements the feature.).15 E F1(\255ignsize) +108 542.4 Q F0 .012(Ignore the kno)144 554.4 R .012 +(wn size of the medium. This options should be used with e)-.25 F .011 +(xtreme care, it e)-.15 F .011(xists only)-.15 F .95(for deb)144 566.4 R +.95(ugging purposes don')-.2 F 3.45(tu)-.18 G .95 +(se it for other reasons.)-3.45 F .95 +(It is not needed to write disks with more)5.95 F +(than the nominal capacity)144 578.4 Q 5(.T)-.65 G(his option implies)-5 +E F1<ad6f>2.5 E -.1(ve)-.1 G(rb).1 E(ur)-.2 E(n)-.15 E F0(.)A F1 +(\255useinf)108 595.2 Q(o)-.25 E F0 .009(Use *.inf \214les to o)144 +607.2 R -.15(ve)-.15 G .009(rwrite audio options.).15 F .009 +(If this option is used, the pre)5.009 F -.05(ga)-.15 G 2.509(ps).05 G +.008(ize information is read)-2.509 F(from the *.inf \214le that is ass\ +ociated with the \214le that contains the audio data for a track.)144 +619.2 Q F1(defpr)108 636 Q(egap=)-.18 E F0(#)A .161(Set the def)144 648 +R .162(ault pre-g)-.1 F .162(ap size for all tracks e)-.05 F .162 +(xcept track number 1.)-.15 F .162(This option currently only mak)5.162 +F(es)-.1 E .532(sense with the TEA)144 660 R 3.032(Cd)-.4 G(ri)-3.032 E +.832 -.15(ve w)-.25 H .531 +(hen creating track-at-once disks without the 2 second silence before) +.15 F(each track.)144 672 Q(This option may go a)144 684 Q -.1(wa)-.15 G +2.5(yi).1 G 2.5(nf)-2.5 G(uture.)-2.5 E F1(\255pack)108 700.8 Q(et)-.1 E +F0(Set)144 712.8 Q F1 -.1(Pa)2.5 G(ck).1 E(et writing mode.)-.1 E F0 +(This is an e)5 E(xperimental interf)-.15 E(ace.)-.1 E(J)72 768 Q -.25 +(..)-5.5 K(or)-4.5 5.5 M 2.5(gS)-.18 G 153.065(chilling V)-2.5 F +(ersion 2.0)-1.11 E(7)206.225 E EP +%%Page: 8 8 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 104.275(CDRECORD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(CDRECORD\(1\))106.775 E/F1 10/Times-Bold@0 SF +(pktsize=)108 84 Q F0(#)A(Set the pack)144 96 Q +(et size to #, forces \214x)-.1 E(ed pack)-.15 E(et mode.)-.1 E +(This is an e)5 E(xperimental interf)-.15 E(ace.)-.1 E F1(\255noclose) +108 112.8 Q F0 .481 +(Do not close the current track, useful only when in pack)144 124.8 R +.481(et writing mode.)-.1 F .482(This is an e)5.482 F(xperimental)-.15 E +(interf)144 136.8 Q(ace.)-.1 E F1(mcn=)108 153.6 Q/F2 10/Times-Italic@0 +SF(med_cat_nr).38 E F0(Set the)144 165.6 Q F1(Media Catalog Number)2.5 E +F0(of the CD to)2.5 E F2(med_cat_nr)2.5 E F0(.).73 E F1(\255text)108 +182.4 Q F0 .314(Write CD-T)14.2 F -.15(ex)-.7 G 2.814(tc).15 G .314 +(reated by)-2.814 F F1(cdr)2.814 E(ecord)-.18 E F0 .314 +(and based on information tak)2.814 F .314 +(en from a \214le that contains ascii)-.1 F .123(information for the te) +144 194.4 R .124(xt strings. Currently only the format in the)-.15 F F1 +(*.inf)2.624 E F0 .124(\214les created by)2.624 F F1(cdda2wa)2.624 E(v) +-.25 E F0(is)2.624 E .47(supported. Y)144 206.4 R .47 +(ou need to use the)-1.1 F F1(\255useinf)2.97 E(o)-.25 E F0 .469 +(option in addition in order to tell)2.97 F F1(cdr)2.969 E(ecord)-.18 E +F0 .469(to read these)2.969 F .517(\214les. If you lik)144 218.4 R 3.017 +(et)-.1 G 3.018(ow)-3.017 G .518(rite your o)-3.018 F .518(wn CD-T)-.25 +F -.15(ex)-.7 G 3.018(ti).15 G .518(nformation, edit the)-3.018 F F1 +(*.inf)3.018 E F0 .518(\214les with a te)3.018 F .518(xt editor and)-.15 +F(change the \214eld that are rele)144 230.4 Q -.25(va)-.25 G +(nt for CD-T).25 E -.15(ex)-.7 G(t.).15 E F1(text\214le=)108 247.2 Q F0 +(\214lename)A 1.67(Write CD-T)144 259.2 R -.15(ex)-.7 G 4.17(tb).15 G +1.669(ased on information found in the binary \214le)-4.17 F F2 +(\214lename)4.169 E F0 6.669(.T).18 G 1.669(his \214le must contain) +-6.669 F 1.089(information in a data format de\214ned in the SCSI-3 MMC\ +-2 standard and in the Red Book. The)144 271.2 R .109(four byte size he\ +ader that is de\214ned in the SCSI standard is optional and allo)144 +283.2 R .109(ws to mak)-.25 F 2.608(et)-.1 G .108(he recog-)-2.608 F +1.244(nition of correct data less ambiguous.)144 295.2 R 1.244 +(This is the best option to be used to cop)6.244 F 3.745(yC)-.1 G(D-T) +-3.745 E -.15(ex)-.7 G 3.745(td).15 G(ata)-3.745 E .162(from e)144 307.2 +R .162(xisting CDs that already carry CD-T)-.15 F -.15(ex)-.7 G 2.661 +(ti).15 G .161(nformation. T)-2.661 F 2.661(og)-.8 G .161 +(et data in a format suitable for this)-2.661 F(option use)144 319.2 Q +F1(cdr)2.5 E(ecord \255vv \255toc)-.18 E F0(to e)2.5 E +(xtract the information from disk.)-.15 E/F3 10.95/Times-Bold@0 SF(TRA) +72 348 Q(CK OPTIONS)-.602 E F0 -.35(Tr)108 360 S(ack options may be mix) +.35 E(ed with track \214le names.)-.15 E F1(isr)108 376.8 Q(c=)-.18 E F2 +(ISRC_number).58 E F0(Set the)144 388.8 Q F1(Inter)2.5 E +(national Standard Recording Number)-.15 E F0(for the ne)2.5 E +(xt track to)-.15 E F2(ISRC_number)2.5 E F0(.).73 E F1(index=)108 405.6 +Q F2(list).09 E F0 1(Sets an inde)144 417.6 R 3.5(xl)-.15 G 1 +(ist for the ne)-3.5 F 1(xt track.)-.15 F 1(In inde)6 F 3.5(xl)-.15 G 1 +(ist is a comma separated list of numbers that are)-3.5 F .325 +(counting from inde)144 429.6 R 2.825(x1)-.15 G 2.825(.T)-2.825 G .325 +(he \214rst entry in this list must contain a 0, the follo)-2.825 F .325 +(wing numbers must be)-.25 F .5(an ascending list of numbers \(counting\ + in 1/75 seconds\) that represent the start of the indices. An)144 441.6 +R(inde)144 453.6 Q 2.578(xl)-.15 G .078 +(ist in the form: 0,7500,15000 sets inde)-2.578 F 2.578(x1t)-.15 G 2.578 +(ot)-2.578 G .078(he start of the track, inde)-2.578 F 2.578(x21)-.15 G +.077(00 seconds from)-2.578 F(the start of the track and inde)144 465.6 +Q 2.5(x32)-.15 G(00 seconds from the start of the track.)-2.5 E F1 +(\255audio)108 482.4 Q F0 .225 +(If this \215ag is present, all subsequent tracks are written in)6.4 F +F1(CD-D)2.725 E(A)-.35 E F0 .226(\(similar to Red Book\) audio for)2.725 +F(-)-.2 E 2.929(mat. The)144 494.4 R .429(\214le with data for this tra\ +cks should contain stereo, 16-bit digital audio with 44100 sam-)2.929 F +3.132(ples/s. The)144 506.4 R .632(byte order should be the follo)3.132 +F .633(wing: MSB left, LSB left, MSB right, LSB right, MSB)-.25 F .885(\ +left and so on. The track should be a multiple of 2352 bytes. It is not\ + possible to put the master)144 518.4 R .575 +(image of an audio track on a ra)144 530.4 R 3.076(wd)-.15 G .576 +(isk because data will be read in multiple of 2352 bytes during)-3.076 F +(the recording process.)144 542.4 Q .168(If a \214lename ends in)144 +566.4 R F2(.au)2.668 E F0(or)2.668 E F2(.wav)2.668 E F0 .168 +(the \214le is considered to be a structured audio data \214le.)2.668 F +F1(Cdr)5.167 E(ecord)-.18 E F0 .145(assumes that the \214le in this cas\ +e is a Sun audio \214le or a Microsoft .W)144 578.4 R 2.846 -1.35 +(AV \214)-1.2 H .146(le and e)1.35 F .146(xtracts the audio)-.15 F .166 +(data from the \214les by skipping o)144 590.4 R -.15(ve)-.15 G 2.666 +(rt).15 G .166(he non-audio header information.)-2.666 F .166 +(In all other cases, cdrecord)5.166 F .6(will only w)144 602.4 R .601 +(ork correctly if the audio data stream does not ha)-.1 F .901 -.15 +(ve a)-.2 H .901 -.15(ny h).15 H(eader).15 E 5.601(.B)-.55 G .601 +(ecause man)-5.601 F 3.101(ys)-.15 G(truc-)-3.101 E .009 +(tured audio \214les do not ha)144 614.4 R .309 -.15(ve a)-.2 H 2.509 +(ni).15 G(nte)-2.509 E .009 +(gral number of blocks \(1/75th second\) in length, it is often nec-) +-.15 F .671(essary to specify the)144 626.4 R F1(\255pad)3.171 E F0 .672 +(option as well.)3.172 F F1(cdr)5.672 E(ecord)-.18 E F0 .672 +(recognizes that audio data in a .W)3.172 F 3.372 -1.35(AV \214)-1.2 H +.672(le is)1.35 F 2.036(stored in Intel \(little-endian\) byte order)144 +638.4 R 4.536(,a)-.4 G 2.036(nd will automatically byte-sw)-4.536 F +2.035(ap the data if the CD)-.1 F .112 +(recorder requires big-endian data.)144 650.4 R F1(Cdr)5.112 E(ecord) +-.18 E F0 .113(will reject an)2.612 F 2.613(ya)-.15 G .113 +(udio \214le that does not match the Red)-2.613 F(Book requirements of \ +16-bit stereo samples in PCM coding at 44100 samples/second.)144 662.4 Q +.049(Using other structured audio data formats as input to)144 686.4 R +F1(cdr)2.549 E(ecord)-.18 E F0 .049(will usually w)2.549 F .048 +(ork if the structure of)-.1 F .353 +(the data is the structure described abo)144 698.4 R .654 -.15(ve \() +-.15 H(ra).15 E 2.854(wp)-.15 G .354 +(cm data in big-endian byte order\).)-2.854 F(Ho)5.354 E(we)-.25 E -.15 +(ve)-.25 G 1.154 -.4(r, i).15 H 2.854(ft).4 G(he)-2.854 E +(data format includes a header)144 710.4 Q 2.5(,y)-.4 G +(ou will hear a click at the start of a track.)-2.5 E(J)72 768 Q -.25 +(..)-5.5 K(or)-4.5 5.5 M 2.5(gS)-.18 G 153.065(chilling V)-2.5 F +(ersion 2.0)-1.11 E(8)206.225 E EP +%%Page: 9 9 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 104.275(CDRECORD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(CDRECORD\(1\))106.775 E 1.195(If neither)144 84 R +/F1 10/Times-Italic@0 SF(\255data)3.695 E F0(nor)3.695 E F1(\255audio) +3.695 E F0(ha)3.694 E 1.494 -.15(ve b)-.2 H 1.194(een speci\214ed,).15 F +/F2 10/Times-Bold@0 SF(cdr)3.694 E(ecord)-.18 E F0(def)3.694 E 1.194 +(aults to)-.1 F F1(\255audio)3.694 E F0 1.194(for all \214lenames)3.694 +F(that end in)144 96 Q F1(.au)2.5 E F0(or)2.5 E F1(.wav)2.5 E F0(and to) +2.5 E F1(\255data)2.5 E F0(for all other \214les.)2.5 E F2(\255swab)108 +112.8 Q F0 1.373 +(If this \215ag is present, audio data is assumed to be in byte-sw)8.63 +F 1.373(apped \(little-endian\) order)-.1 F 6.373(.S)-.55 G(ome)-6.373 E +.562(types of CD-Writers e.g. Y)144 124.8 R .562(amaha, Son)-1 F 3.061 +(ya)-.15 G .561(nd the ne)-3.061 F 3.061(wS)-.25 G .561(CSI-3/mmc dri) +-3.061 F -.15(ve)-.25 G 3.061(sr).15 G .561(equire audio data to be) +-3.061 F .765(presented in little-endian order)144 136.8 R 3.265(,w)-.4 +G .765 +(hile other writers require audio data to be presented in the big-) +-3.265 F 1.86(endian \(netw)144 148.8 R 1.859 +(ork\) byte order normally used by the SCSI protocol.)-.1 F F2(Cdr)6.859 +E(ecord)-.18 E F0(kno)4.359 E 1.859(ws if a CD-)-.25 F 1.257 +(Recorder needs audio data in big- or little-endian order)144 160.8 R +3.757(,a)-.4 G 1.257(nd corrects the byte order of the data)-3.757 F +.358(stream to match the needs of the recorder)144 172.8 R 5.358(.Y)-.55 +G .358(ou only need the)-6.458 F F1(\255swab)2.858 E F0 .358 +(\215ag if your data stream is in)2.858 F +(Intel \(little-endian\) byte order)144 184.8 Q(.)-.55 E .222 +(Note that the v)144 208.8 R .222(erbose output of)-.15 F F2(cdr)2.722 E +(ecord)-.18 E F0 .222(will sho)2.722 F 2.722(wy)-.25 G .222(ou if sw) +-2.722 F .223(apping is necessary to mak)-.1 F 2.723(et)-.1 G .223 +(he byte)-2.723 F .577 +(order of the input data \214t the required byte order of the recorder) +144 220.8 R(.)-.55 E F2(Cdr)5.577 E(ecord)-.18 E F0 .577(will not sho) +3.077 F 3.077(wy)-.25 G .577(ou if)-3.077 F(the)144 232.8 Q F1(\255swab) +2.5 E F0(\215ag w)2.5 E(as actually present for a track.)-.1 E F2 +(\255data)108 249.6 Q F0 .853 +(If this \215ag is present, all subsequent tracks are written in)11.41 F +F2(CD-R)3.353 E .853(OM mode 1)-.3 F F0(\(Y)3.353 E(ello)-1 E 3.354(wB) +-.25 G .854(ook\) for)-3.354 F(-)-.2 E .289 +(mat. The data is a multiple of 2048 bytes.)144 261.6 R .289 +(The \214le with track data should contain an)5.289 F F2(ISO-9660)2.788 +E F0(or)2.788 E F2 .36(Rock Ridge)144 273.6 R F0 .36 +(\214lesystem image \(see)2.86 F F2(mkisofs)2.86 E F0 .361 +(for more details\). If the track data is an)2.86 F F2(ufs)2.861 E F0 +(\214lesystem)2.861 E .126 +(image, fragment size should be set to 2 KB or more to allo)144 285.6 R +2.626(wC)-.25 G(R-dri)-2.626 E -.15(ve)-.25 G 2.626(sw).15 G .126 +(ith 2 KB sector size to to)-2.626 F(be used for reading.)144 297.6 Q +(\255data is the def)144 314.4 Q(ault, if no other \215ag is present.) +-.1 E 1.194(If neither)144 331.2 R F1(\255data)3.694 E F0(nor)3.694 E F1 +(\255audio)3.694 E F0(ha)3.694 E 1.494 -.15(ve b)-.2 H 1.194 +(een speci\214ed,).15 F F2(cdr)3.694 E(ecord)-.18 E F0(def)3.694 E 1.194 +(aults to)-.1 F F1(\255audio)3.695 E F0 1.195(for all \214lenames)3.695 +F(that end in)144 343.2 Q F1(.au)2.5 E F0(or)2.5 E F1(.wav)2.5 E F0 +(and to)2.5 E F1(\255data)2.5 E F0(for all other \214les.)2.5 E F2 +(\255mode2)108 360 Q F0 .416 +(If this \215ag is present, all subsequent tracks are written in)144 372 +R F2(CD-R)2.915 E .415(OM mode 2)-.3 F F0 .415(format. The data is a) +2.915 F(multiple of 2048 bytes.)144 384 Q F2(\255xa1)108 400.8 Q F0 .391 +(If this \215ag is present, all subsequent tracks are written in)15.3 F +F2(CD-R)2.891 E .391(OM XA mode 1)-.3 F F0 .392(format. The data)2.892 F +(is a multiple of 2048 bytes.)144 412.8 Q F2(\255xa2)108 429.6 Q F0 .391 +(If this \215ag is present, all subsequent tracks are written in)15.3 F +F2(CD-R)2.891 E .391(OM XA mode 2)-.3 F F0 .391(format. The data)2.891 F +(is a multiple of 2048 bytes.)144 441.6 Q F2(\255cdi)108 458.4 Q F0 .984 +(If this \215ag is present, all subsequent tracks are written in)17.52 F +F2(CDI)3.485 E F0 .985(format. The data is a multiple of)3.485 F +(2048 bytes.)144 470.4 Q F2(\255isosize)108 487.2 Q F0 .346(Use the)144 +499.2 R F2(ISO-9660)2.846 E F0 .346 +(\214le system size as the size of the ne)2.846 F .346(xt track.)-.15 F +.345(This option is needed if you w)5.346 F(ant)-.1 E F2(cdr)144 511.2 Q +(ecord)-.18 E F0 .151(to directly read the image of a track from a ra) +2.651 F 2.651(wd)-.15 G .151(isk partition or from a)-2.651 F F1 -1.9 +-.5(TA O)2.651 H F0 .152(master CD.)3.151 F 1.114 +(In the \214rst case the option)144 523.2 R F2(\255isosize)3.614 E F0 +1.114(is needed to limit the size of the CD to the size of the ISO)3.614 +F 2.804(\214lesystem. In)144 535.2 R .304(the second case the option) +2.804 F F2(\255isosize)2.804 E F0 .304(is needed to pre)2.804 F -.15(ve) +-.25 G(nt).15 E F2(cdr)2.804 E(ecord)-.18 E F0 .304(from reading the) +2.804 F(tw)144 547.2 Q 3.165(or)-.1 G .665(un out blocks that are appen\ +ded by each CD-recorder in track at once mode. These tw)-3.165 F 3.164 +(or)-.1 G(un)-3.164 E .661(out blocks cannot be read and w)144 559.2 R +.661(ould cause a b)-.1 F(uf)-.2 E .661(fer under run that w)-.25 F .662 +(ould cause a defecti)-.1 F .962 -.15(ve c)-.25 H(op).15 E -.65(y.)-.1 G +.409(Do not use this option on \214les created by)144 571.2 R F2 +(mkisofs)2.909 E F0 .409(and in case)2.909 F F2(cdr)2.909 E(ecord)-.18 E +F0 .409(reads the track data from)2.909 F F1(stdin)144 583.2 Q F0 5.526 +(.I).24 G 3.026(nt)-5.526 G .527(he \214rst case, you w)-3.026 F .527 +(ould pre)-.1 F -.15(ve)-.25 G(nt).15 E F2(cdr)3.027 E(ecord)-.18 E F0 +.527(from writing the amount of padding that has)3.027 F +(been appended by)144 595.2 Q F2(mkisofs)2.5 E F0 +(and in the latter case, it will not w)2.5 E(ork because)-.1 E F1(stdin) +2.5 E F0(is not seekable.)2.5 E(If)144 619.2 Q F2(\255isosize)3.84 E F0 +1.34(is used for a track,)3.84 F F2(cdr)3.84 E(ecord)-.18 E F0 1.339 +(will automatically add padding for this track as if the)3.839 F F2 +(\255pad)144 631.2 Q F0 1.093(option has been used b)3.592 F 1.093 +(ut the amount of padding may be less than the padding written by)-.2 F +F2(mkisofs)144 643.2 Q F0 5.837(.N)C .837(ote that if you use)-5.837 F +F2(\255isosize)3.337 E F0 .837 +(on a track that contains Sparc boot information, the boot)3.337 F +(information will be lost.)144 655.2 Q .332(Note also that this option \ +cannot be used to determine the size of a \214le system if the multi se\ +ssion)144 679.2 R(option is present.)144 691.2 Q F2(\255pad)108 708 Q F0 +.29(If the track is a data track, 15 sectors of zeroed data will be add\ +ed to the end of this and each sub-)14.18 F 1.33(sequent data track.)144 +720 R 1.33(In this case, the)6.33 F F2(\255pad)3.831 E F0 1.331 +(option is superseded by the)3.831 F F2(padsize=)3.831 E F0 1.331 +(option. It will)3.831 F(J)72 768 Q -.25(..)-5.5 K(or)-4.5 5.5 M 2.5(gS) +-.18 G 153.065(chilling V)-2.5 F(ersion 2.0)-1.11 E(9)206.225 E EP +%%Page: 10 10 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 104.275(CDRECORD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(CDRECORD\(1\))106.775 E 1.729(remain ho)144 84 R +(we)-.25 E -.15(ve)-.25 G 4.229(ra).15 G 4.229(sas)-4.229 G 1.729 +(horthand for)-4.229 F/F1 10/Times-Bold@0 SF(padsize=)4.229 E/F2 10 +/Times-Italic@0 SF(15s.).01 E F0 1.729(If the)6.729 F F2(\255pad)4.229 E +F0 1.728(option refers to an audio track,)4.229 F F1(cdr)144 96 Q(ecord) +-.18 E F0 .531(will pad the audio data to be a multiple of 2352 bytes.) +3.031 F .531(The audio data padding is done)5.531 F +(with binary zeroes which is equal to absolute silence.)144 108 Q F1 +(\255pad)144 132 Q F0(remains v)2.5 E(alid until disabled by)-.25 E F1 +(\255nopad)2.5 E F0(.)A F1(padsize=)108 148.8 Q F0(#)A .381 +(Set the amount of data to be appended as padding to the ne)144 160.8 R +.381(xt track to #.)-.15 F .381(Opposed to the beha)5.381 F(vior)-.2 E +.09(of the)144 172.8 R F1(\255pad)2.59 E F0 .09(option, the v)2.59 F .09 +(alue for)-.25 F F2(padsize=)2.59 E F0 .091 +(is reset to zero for each ne)2.59 F 2.591(wt)-.25 G 2.591 +(rack. Cdrecord)-2.591 F .091(assumes a)2.591 F .531 +(sector size of 2048 bytes for the)144 184.8 R F2(padsize=)3.031 E F0 +.53(option, independent from the real sector size and inde-)3.031 F .346 +(pendent from the write mode.)144 196.8 R .346(The me)5.346 F -.05(ga) +-.15 G .346(bytes mentioned in the v).05 F .347(erbose mode output ho) +-.15 F(we)-.25 E -.15(ve)-.25 G 2.847(ra).15 G(re)-2.847 E .133(countin\ +g the output sector size which is e.g. 2448 bytes when writing in RA)144 +208.8 R(W/RA)-.9 E .133(W96 mode.)-.9 F(See)5.133 E F1(fs)144 220.8 Q F0 +3.231(=o)C .731(ption for possible ar)-3.231 F 3.231(guments. T)-.18 F +3.231(op)-.8 G .731(ad the equi)-3.231 F -.25(va)-.25 G .731 +(lent of 20 minutes on a CD, you may write).25 F F1(padsize=)144 232.8 Q +F0 2.626(20x60x75s. Use)B .126(this option if your CD-dri)2.626 F .425 +-.15(ve i)-.25 H 2.625(sn).15 G .125 +(ot able to read the last sectors of a track)-2.625 F 1.039(or if you w) +144 244.8 R 1.039(ant to be able to read the CD on a)-.1 F F1(Linux) +3.539 E F0 1.039(system with the ISO-9660 \214lesystem read)3.539 F .537 +(ahead b)144 256.8 R 3.037(ug. If)-.2 F .536(an empty \214le is used fo\ +r track data, this option may be used to create a disk that is)3.037 F +1.118(entirely made of padding.)144 268.8 R 1.118 +(This may e.g. be used to \214nd out ho)6.118 F 3.618(wm)-.25 G 1.118 +(uch o)-3.618 F -.15(ve)-.15 G(rb).15 E 1.119(urning is possible)-.2 F +(with a speci\214c media.)144 280.8 Q F1(\255nopad)108 297.6 Q F0 +(Do not pad the follo)144 309.6 Q(wing tracks \255 the def)-.25 E(ault.) +-.1 E F1(\255shorttrack)108 326.4 Q F0(Allo)144 338.4 Q 2.791(wa)-.25 G +.291(ll subsequent tracks to violate the Read Book track length standar\ +d which requires a mini-)-2.791 F .168(mum track length of 4 seconds.) +144 350.4 R .168(This option is only useful when used in SA)5.168 F +2.669(Oo)-.55 G 2.669(rR)-2.669 G 1.969 -.9(AW m)-2.669 H 2.669 +(ode. Not).9 F .537(all dri)144 362.4 R -.15(ve)-.25 G 3.037(ss).15 G +.537(upport this feature. The dri)-3.037 F .837 -.15(ve m)-.25 H .537 +(ust be accept the resulting CUE sheet or support RA).15 F(W)-.9 E +(writing.)144 374.4 Q F1(\255noshorttrack)108 391.2 Q F0 +(Re-enforce the Red Book track length standard. T)144 403.2 Q +(racks must be at least 4 seconds.)-.35 E F1(pr)108 420 Q(egap=)-.18 E +F0(#)A 1.03(Set the)144 432 R(pre-g)6.03 E 1.03(ap size for the ne)-.05 +F 1.03(xt track.)-.15 F 1.03(This option currently only mak)6.03 F 1.03 +(es sense with the TEA)-.1 F(C)-.4 E(dri)144 444 Q .3 -.15(ve w)-.25 H(\ +hen creating track-at-once disks without the 2 second silence before ea\ +ch track.).15 E(This option may go a)144 456 Q -.1(wa)-.15 G 2.5(yi).1 G +2.5(nf)-2.5 G(uture.)-2.5 E F1(\255pr)108 472.8 Q(eemp)-.18 E F0 .432 +(If this \215ag is present, all T)144 484.8 R .432(OC entries for subse\ +quent audio tracks will indicate that the audio data)-.18 F .076 +(has been sampled with 50/15 \265sec preemphasis.)144 496.8 R .077 +(The data, ho)5.077 F(we)-.25 E -.15(ve)-.25 G 2.577(ri).15 G 2.577(sn) +-2.577 G .077(ot modi\214ed during the pro-)-2.577 F +(cess of transferring from \214le to disk.)144 508.8 Q +(This option has no ef)5 E(fect on data tracks.)-.25 E F1(\255nopr)108 +525.6 Q(eemp)-.18 E F0 .432(If this \215ag is present, all T)144 537.6 R +.432(OC entries for subsequent audio tracks will indicate that the audi\ +o data)-.18 F(has been mastered with linear data \255 this is the def) +144 549.6 Q(ault.)-.1 E F1(\255copy)108 566.4 Q F0 .235 +(If this \215ag is present, all T)10.3 F .235(OC entries for subsequent\ + audio tracks of the resulting CD will indicate)-.18 F .941 +(that the audio data has permission to be copied without limit.)144 +578.4 R .941(This option has no ef)5.941 F .941(fect on data)-.25 F +(tracks.)144 590.4 Q F1(\255nocopy)108 607.2 Q F0 .235 +(If this \215ag is present, all T)144 619.2 R .235(OC entries for subse\ +quent audio tracks of the resulting CD will indicate)-.18 F(that the au\ +dio data has permission to be copied only once for personal use \255 th\ +is is the def)144 631.2 Q(ault.)-.1 E F1(\255scms)108 648 Q F0 .236 +(If this \215ag is present, all T)9.75 F .235(OC entries for subsequent\ + audio tracks of the resulting CD will indicate)-.18 F +(that the audio data has no permission to be copied an)144 660 Q(ymore.) +-.15 E F1(tsize=)108 676.8 Q F0 6.42(#I)C 2.888(ft)-6.42 G .388 +(he master image for the ne)-2.888 F .388 +(xt track has been stored on a ra)-.15 F 2.888(wd)-.15 G .388 +(isk, use this option to specify the)-2.888 F -.25(va)144 688.8 S .46 +(lid amount of data on this disk. If the image of the ne).25 F .46 +(xt track is stored in a re)-.15 F .46(gular \214le, the size)-.15 F .25 +(of that \214le is tak)144 700.8 R .25 +(en to determine the length of this track.)-.1 F .251 +(If the track contains an ISO 9660 \214lesys-)5.251 F(tem image use the) +144 712.8 Q F2(\255isosize)2.5 E F0 +(option to determine the length of that \214lesystem image.)2.5 E 1.033 +(In Disk at Once mode and with some dri)144 724.8 R -.15(ve)-.25 G 3.533 +(st).15 G 1.033(hat use the TEA)-3.533 F 3.533(Cp)-.4 G 1.033 +(rogramming interf)-3.533 F 1.033(ace, e)-.1 F -.15(ve)-.25 G 3.533(ni) +.15 G(n)-3.533 E(J)72 768 Q -.25(..)-5.5 K(or)-4.5 5.5 M 2.5(gS)-.18 G +153.065(chilling V)-2.5 F(ersion 2.0)-1.11 E(10)201.225 E EP +%%Page: 11 11 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 104.275(CDRECORD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(CDRECORD\(1\))106.775 E -.35(Tr)144 84 S .96 +(ack at Once mode,).35 F/F1 10/Times-Bold@0 SF(cdr)3.46 E(ecord)-.18 E +F0 .96(needs to kno)3.46 F 3.461(wt)-.25 G .961 +(he size of each track before starting to write the)-3.461 F 2.964 +(disk. Cdrecord)144 96 R(no)2.964 E 2.964(wc)-.25 G .464 +(hecks this and aborts before starting to write.)-2.964 F .463 +(If this happens you will need)5.464 F 1.154(to run)144 108 R F1 1.154 +(mkisofs -print-size)3.654 F F0 1.154 +(before and use the output \(with `s' appended\) as an ar)3.654 F 1.155 +(gument to the)-.18 F F1(tsize)144 120 Q F0 2.5(=o)C(ption of)-2.5 E F1 +(cdr)2.5 E(ecord)-.18 E F0(\(e.g. tsize=250000s\).)2.5 E(See)144 132 Q +F1(fs)2.5 E F0 2.5(=o)C(ption for possible ar)-2.5 E(guments.)-.18 E/F2 +10.95/Times-Bold@0 SF(EXAMPLES)72 160.8 Q F0 -.15(Fo)108 172.8 S 3.139 +(ra).15 G .639(ll e)-3.139 F .639(xamples belo)-.15 F 1.939 -.65(w, i) +-.25 H 3.139(tw).65 G .639 +(ill be assumed that the CD-Recorder is connected to the primary SCSI b) +-3.139 F .638(us of)-.2 F(the machine. The SCSI tar)108 184.8 Q +(get id is set to 2.)-.18 E 1.6 -.8(To r)108 201.6 T(ecord a pure CD-R) +.8 E(OM at double speed, using data from the \214le)-.4 E/F3 10 +/Times-Italic@0 SF(cdima)2.5 E -.1(ge)-.1 G(.r)-.05 E(aw)-.15 E F0(:).31 +E(cdrecord \255v speed=2 de)118 218.4 Q(v=2,0 cdimage.ra)-.25 E(w)-.15 E +1.6 -.8(To c)108 235.2 T +(reate an image for a ISO 9660 \214lesystem with Rock Ridge e).8 E +(xtensions:)-.15 E(mkisofs \255R \255o cdimage.ra)118 252 Q 2.5(w/)-.15 +G(home/joer)-2.5 E(g/master/tree)-.18 E 1.6 -.8(To c)108 268.8 T +(heck the resulting \214le before writing to CD on Solaris:).8 E +(mount \255r \255F fbk \255o type=hsfs /de)118 285.6 Q +(v/fbk0:cdimage.ra)-.25 E 2.5(w/)-.15 G(mnt)-2.5 E(On Linux:)108 302.4 Q +(mount cdimage.ra)118 319.2 Q 2.5<77ad>-.15 G 2.5<72ad>-2.5 G 2.5(ti) +-2.5 G(so9660 \255o loop /mnt)-2.5 E(Go on with:)108 336 Q +(ls \255lR /mnt)118 348 Q(umount /mnt)118 360 Q 1.896(If the o)108 376.8 +R -.15(ve)-.15 G 1.896(rall speed of the system is suf).15 F 1.896 +(\214cient and the structure of the \214lesystem is not too comple)-.25 +F(x,)-.15 E(cdrecord will run without creating an image of the ISO 9660\ + \214lesystem. Simply run the pipeline:)108 388.8 Q +(mkisofs \255R /master/tree | cdrecord \255v fs=6m speed=2 de)118 405.6 +Q(v=2,0 -)-.25 E .921(The recommended minimum \214fo size for running t\ +his pipeline is 4 MBytes.)108 422.4 R .92(As the def)5.92 F .92 +(ault \214fo size is 4)-.1 F .411(MB, the)108 434.4 R F1(fs=)2.911 E F0 +.412(option needs only be present if you w)2.912 F .412 +(ant to use a dif)-.1 F .412(ferent \214fo size.)-.25 F .412 +(If your system is loaded,)5.412 F +(you should run mkisofs in the real time class too.)108 446.4 Q 1.6 -.8 +(To r)5 H(aise the priority of).8 E F1(mkisofs)2.5 E F0 +(replace the command)2.5 E(mkisofs \255R /master/tree)118 463.2 Q(by)108 +475.2 Q(priocntl \255e \255c R)118 487.2 Q 2.5<54ad>-.6 G 2.5(p5)-2.5 G +2.5(9m)-2.5 G(kisofs \255R /master/tree)-2.5 E(on Solaris and by)108 +511.2 Q(nice --18 mkisofs \255R /master/tree)118 535.2 Q +(on systems that don')108 559.2 Q 2.5(th)-.18 G -2.25 -.2(av e)-2.5 H F1 +(UNIX Inter)2.7 E(national)-.15 E F0(compliant realtime scheduling.)2.5 +E .502(Cdrecord runs at priority 59 on Solaris, you should run mkisofs \ +at no more than priority 58. On other sys-)108 576 R +(tems, you should run mkisofs at no less than nice --18.)108 588 Q .382 +(Creating a CD-R)108 604.8 R .382(OM without \214le system image on dis\ +k has been tested on a Sparcstation-2 with a Y)-.4 F(amaha)-1 E .506 +(CDR-400. It did w)108 616.8 R .505 +(ork up to quad speed when the machine w)-.1 F .505(as not loaded.)-.1 F +3.005(Af)5.505 G .505(aster machine may be able)-3.105 F +(to handle quad speed also in the loaded case.)108 628.8 Q 1.64 -.8 +(To r)108 645.6 T .04(ecord a pure CD-D).8 F 2.54(A\()-.4 G .041 +(audio\) at single speed, with each track contained in a \214le named) +-2.54 F F3(tr)2.541 E(ac)-.15 E(k01.cdaudio)-.2 E F0(,).18 E F3(tr)108 +657.6 Q(ac)-.15 E(k02.cdaudio)-.2 E F0 2.5(,e).18 G(tc:)-2.5 E +(cdrecord \255v speed=1 de)118 674.4 Q(v=2,0 -audio track*.cdaudio)-.25 +E 1.6 -.8(To c)108 691.2 T +(heck if it will be ok to use double speed for the e).8 E(xample abo) +-.15 E -.15(ve)-.15 G 5(.U).15 G(se the dummy write option:)-5 E +(cdrecord \255v \255dummy speed=2 de)118 708 Q +(v=2,0 \255audio track*.cdaudio)-.25 E 2.607 -.8(To r)108 724.8 T 1.007 +(ecord a mix).8 F 1.007(ed-mode CD with an ISO 9660 \214lesystem from) +-.15 F F3(cdima)3.506 E -.1(ge)-.1 G(.r)-.05 E(aw)-.15 E F0 1.006 +(on the \214rst track, the other)3.506 F(J)72 768 Q -.25(..)-5.5 K(or) +-4.5 5.5 M 2.5(gS)-.18 G 153.065(chilling V)-2.5 F(ersion 2.0)-1.11 E +(11)201.225 E EP +%%Page: 12 12 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 104.275(CDRECORD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(CDRECORD\(1\))106.775 E +(tracks being audio tracks from the \214les)108 84 Q/F1 10 +/Times-Italic@0 SF(tr)2.5 E(ac)-.15 E(k01.cdaudio)-.2 E F0(,).18 E F1 +(tr)2.5 E(ac)-.15 E(k02.cdaudio)-.2 E F0 2.5(,e).18 G(tc:)-2.5 E +(cdrecord \255v \255dummy de)118 100.8 Q(v=2,0 cdimage.ra)-.25 E 2.5 +<77ad>-.15 G(audio track*.cdaudio)-2.5 E 1.6 -.8(To h)108 117.6 T +(andle dri).8 E -.15(ve)-.25 G 2.5(st).15 G(hat need to kno)-2.5 E 2.5 +(wt)-.25 G(he size of a track before starting to write, \214rst run)-2.5 +E(mkisofs -R -q -print-size /master/tree)118 134.4 Q(and then run)108 +151.2 Q(mkisofs -R /master/tree | cdrecord speed=2 de)118 168 Q +(v=2,0 tsize=XXXs -)-.25 E(where)108 184.8 Q F1(XXX)2.5 E F0 +(is replaced by the output of the pre)2.5 E(vious run of mkisofs.)-.25 E +1.6 -.8(To c)108 201.6 T(op).8 E 2.5(ya)-.1 G 2.5(na)-2.5 G +(udio CD in the most accurate w)-2.5 E(ay)-.1 E 2.5<2c8c>-.65 G(rst run) +-2.5 E(cdda2w)118 218.4 Q .4 -.2(av -)-.1 H -.25(va).2 G +(ll cddb=0 -D2,0 -B -Ow).25 E -.2(av)-.1 G(and then run)108 235.2 Q +(cdrecord -v de)118 252 Q(v=2,0 -dao -useinfo -te)-.25 E 2.5(xt *.w)-.15 +F -.2(av)-.1 G .657(This will try cop)108 268.8 R 3.157(yt)-.1 G .658 +(rack indices and to read CD-T)-3.157 F -.15(ex)-.7 G 3.158(ti).15 G +.658(nformation from disk.)-3.158 F .658(If there is no CD-T)5.658 F +-.15(ex)-.7 G 3.158(ti).15 G(nfor)-3.158 E(-)-.2 E(mation,)108 280.8 Q +/F2 10/Times-Bold@0 SF(cdda2wa)2.5 E(v)-.25 E F0 +(will try to get the information from freedb)2.5 E(.or)-.4 E 2.5(gi)-.18 +G(nstead.)-2.5 E/F3 10.95/Times-Bold@0 SF(ENVIR)72 309.6 Q(ONMENT)-.329 +E F2(CDR_DEVICE)108 321.6 Q F0 1.628(This may either hold a de)144 333.6 +R 1.628(vice identi\214er that is suitable to the open call of the SCSI\ + transport)-.25 F(library or a label in the \214le /etc/def)144 345.6 Q +(ault/cdrecord.)-.1 E F2(CDR_SPEED)108 362.4 Q F0(Sets the def)144 374.4 +Q(ault speed v)-.1 E(alue for writing \(see also)-.25 E F2(\255speed)2.5 +E F0(option\).)2.5 E F2(CDR_FIFOSIZE)108 391.2 Q F0(Sets the def)144 +403.2 Q(ault size of the FIFO \(see also)-.1 E F2(fs=)2.5 E F0 2.5(#o)C +(ption\).)-2.5 E F2(CDR_FORCERA)108 420 Q(WSPEED)-1.3 E F0 1.317 +(If this en)144 432 R 1.317(vironment v)-.4 F 1.317(ariable is set,)-.25 +F F2(cdr)3.817 E(ecord)-.18 E F0 1.317(will allo)3.817 F 3.818(wy)-.25 G +1.318(ou to write at the full RA)-3.818 F 3.818(We)-.9 G(ncoding)-3.818 +E(speed a single CPU supports.)144 444 Q +(This will create high potential of b)5 E(uf)-.2 E +(fer underruns. Use with care.)-.25 E F2(RSH)108 460.8 Q F0 .55(If the) +15.44 F F2(RSH)3.05 E F0(en)3.05 E .549 +(vironment is present, the remote connection will not be created via)-.4 +F F2 -.18(rc)3.049 G(md).18 E F0 .549(\(3\) b)B .549(ut by)-.2 F .578 +(calling the program pointed to by)144 472.8 R F2(RSH)3.079 E F0 5.579 +(.U)C .579(se e.g.)-5.579 F F2(RSH=)5.579 E F0 .579 +(/usr/bin/ssh to create a secure shell con-)B(nection.)144 484.8 Q .87 +(Note that this forces)144 508.8 R F2(cdr)3.37 E(ecord)-.18 E F0 .869 +(to create a pipe to the)3.37 F F2(rsh\(1\))3.369 E F0 .869 +(program and disallo)3.369 F(ws)-.25 E F2(cdr)3.369 E(ecord)-.18 E F0 +(to)3.369 E .28(directly access the netw)144 520.8 R .28(ork sock)-.1 F +.28(et to the remote serv)-.1 F(er)-.15 E 5.281(.T)-.55 G .281(his mak) +-5.281 F .281(es it impossible to set up perfor)-.1 F(-)-.2 E .813 +(mance parameters and slo)144 532.8 R .813(ws do)-.25 F .813 +(wn the connection compared to a)-.25 F F2 -.18(ro)3.313 G(ot).18 E F0 +(initiated)3.313 E F2 -.18(rc)3.313 G(md\(3\)).18 E F0(connec-)3.313 E +(tion.)144 544.8 Q F2(RSCSI)108 561.6 Q F0 3.942(If the)6.55 F F2(RSCSI) +6.442 E F0(en)6.443 E 3.943(vironment is present, the remote SCSI serv) +-.4 F 3.943(er will not be the program)-.15 F F2(/opt/schily/sbin/rscsi) +144 573.6 Q F0 -.2(bu)3.737 G 3.737(tt).2 G 1.236 +(he program pointed to by)-3.737 F F2(RSCSI)3.736 E F0 6.236(.N)C 1.236 +(ote that the remote SCSI serv)-6.236 F(er)-.15 E .553(program name wil\ +l be ignored if you log in using an account that has been created with \ +a remote)144 585.6 R(SCSI serv)144 597.6 Q(er program as login shell.) +-.15 E F3(FILES)72 626.4 Q F0(/etc/def)108 638.4 Q(ault/cdrecord)-.1 E +(Def)144 650.4 Q 3.228(ault v)-.1 F 3.228 +(alues can be set for the follo)-.25 F 3.227(wing options in /etc/def) +-.25 F 5.727(ault/cdrecord. F)-.1 F 3.227(or e)-.15 F(xample:)-.15 E/F4 +9/Times-Roman@0 SF(CDR_FIFOSIZE=8m)144 662.4 Q F0(or)2.25 E F4 +(CDR_SPEED=2)2.5 E F0(CDR_DEVICE)144 679.2 Q .261 +(This may either hold a de)180 691.2 R .262 +(vice identi\214er that is suitable to the open call of the SCSI trans-) +-.25 F 1.418(port library or a label in the \214le /etc/def)180 703.2 R +1.418(ault/cdrecord that allo)-.1 F 1.418(ws to identify a speci\214c) +-.25 F(dri)180 715.2 Q .3 -.15(ve o)-.25 H 2.5(nt).15 G(he system.)-2.5 +E(J)72 768 Q -.25(..)-5.5 K(or)-4.5 5.5 M 2.5(gS)-.18 G 153.065 +(chilling V)-2.5 F(ersion 2.0)-1.11 E(12)201.225 E EP +%%Page: 13 13 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 104.275(CDRECORD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(CDRECORD\(1\))106.775 E(CDR_SPEED)144 84 Q +(Sets the def)180 96 Q(ault speed v)-.1 E(alue for writing \(see also) +-.25 E/F1 10/Times-Bold@0 SF(\255speed)2.5 E F0(option\).)2.5 E +(CDR_FIFOSIZE)144 112.8 Q(Sets the def)180 124.8 Q +(ault size of the FIFO \(see also)-.1 E F1(fs=)2.5 E F0 2.5(#o)C +(ption\).)-2.5 E(An)144 141.6 Q 2.5(yo)-.15 G(ther label)-2.5 E .548 +(is an identi\214er for a speci\214c dri)180 153.6 R .848 -.15(ve o)-.25 +H 3.048(nt).15 G .548(he system.)-3.048 F .548 +(Such an identi\214er may not contain the)5.548 F(characters ',)180 +165.6 Q(', '/', '@' or ':'.)-.7 E 1.385(Each line that follo)180 189.6 R +1.384(ws a label contains a T)-.25 F 1.384(AB separated list of items.) +-.93 F(Currently)6.384 E 3.884(,t)-.65 G(hree)-3.884 E .538 +(items are recognized: the SCSI ID of the dri)180 201.6 R -.15(ve)-.25 G +3.039(,t).15 G .539(he def)-3.039 F .539 +(ault speed that should be used for)-.1 F 1.447(this dri)180 213.6 R +1.747 -.15(ve a)-.25 H 1.447(nd the def).15 F 1.446 +(ault FIFO size that should be used for this dri)-.1 F -.15(ve)-.25 G +3.946(.T).15 G 1.446(he v)-3.946 F 1.446(alues for)-.25 F/F2 10 +/Times-Italic@0 SF(speed)180 225.6 Q F0(and)3.309 E F2(\214fosize)3.309 +E F0 .809(may be set to -1 to tell cdrecord to use the global def)3.309 +F 3.31(aults. A)-.1 F(typical)3.31 E(line may look this w)180 237.6 Q +(ay:)-.1 E(teac1= 0,5,0)180 261.6 Q 31(48)22.76 G(m)-31 E(yamaha= 1,6,0) +180 285.6 Q 25.17(-1 -1)12.76 F .334(This tells)180 309.6 R F1(cdr)2.834 +E(ecord)-.18 E F0 .334(that a dri)2.834 F .634 -.15(ve n)-.25 H(amed).15 +E F2(teac1)2.833 E F0 .333(is at scsib)2.833 F .333(us 0, tar)-.2 F .333 +(get 5, lun 0 and should be)-.18 F .531 +(used with speed 4 and a FIFO size of 8 MB.)180 321.6 R 3.031(As)5.531 G +.531(econd dri)-3.031 F .831 -.15(ve m)-.25 H .531(ay be found at scsib) +.15 F .532(us 1,)-.2 F(tar)180 333.6 Q(get 6, lun 0 and uses the def) +-.18 E(ault speed and the def)-.1 E(ault FIFO size.)-.1 E/F3 10.95 +/Times-Bold@0 SF(SEE ALSO)72 362.4 Q F1(cdda2wa)108 374.4 Q(v)-.25 E F0 +(\(1\),)A F1 -.18(re)2.5 G(adcd).18 E F0(\(1\),)A F1(scg)2.5 E F0 +(\(7\),)A F1(fbk)2.5 E F0(\(7\),)A F1(mkisofs)2.5 E F0(\(8\),)A F1 -.18 +(rc)2.5 G(md).18 E F0(\(3\),)A F1(ssh)2.5 E F0(\(1\).)A F3(NO)72 403.2 Q +(TES)-.438 E F0 .505(On Solaris you need to stop the v)108 415.2 R .505 +(olume management if you lik)-.2 F 3.005(et)-.1 G 3.005(ou)-3.005 G .505 +(se the USCSI f)-3.005 F .505(allback SCSI transport)-.1 F(code. Ev)108 +427.2 Q(en things lik)-.15 E(e)-.1 E F1(cdr)2.5 E(ecord -scanb)-.18 E +(us)-.2 E F0(will not w)2.5 E(ork if the v)-.1 E +(olume management is running.)-.2 E .483(Disks made in)108 444 R F1 -.74 +(Tr)2.983 G .483(ack At Once).74 F F0 .484(mode are not suitable as a m\ +aster for direct mass production by CD manu-)2.983 F -.1(fa)108 456 S +3.973(cturers. Y).1 F 1.473(ou will need the)-1.1 F F1 1.473 +(disk at once)3.973 F F0 1.473(option to record such disks.)3.973 F(Ne) +6.473 E -.15(ve)-.25 G 1.473(rtheless the disks made in).15 F F1 -.74 +(Tr)108 468 S .207(ack At Once).74 F F0 .207 +(will normally be read in all CD players. Some old audio CD players ho) +2.707 F(we)-.25 E -.15(ve)-.25 G 2.708(rm).15 G .208(ay produce)-2.708 F +2.5(at)108 480 S .2 -.1(wo s)-2.5 H(econd click between tw).1 E 2.5(oa) +-.1 G(udio tracks.)-2.5 E .563(The minimal size of a track is 4 seconds\ + or 300 sectors. If you write smaller tracks, the CD-Recorder will)108 +496.8 R(add dummy blocks. This is not an error)108 508.8 Q 2.5(,e)-.4 G +-.15(ve)-2.75 G 2.5(nt).15 G(hough the SCSI-error message looks this w) +-2.5 E(ay)-.1 E(.)-.65 E F1(Cdr)108 525.6 Q(ecord)-.18 E F0 1.773(has b\ +een tested on an upgraded Philips CDD-521 recorder at single and double\ + speed on a)4.273 F 4.317(SparcStation 20/502 with no problems, slo)108 +537.6 R 4.317(wer computer systems should w)-.25 F 4.316(ork also.)-.1 F +4.316(The ne)9.316 F(wer)-.25 E 1.149(Philips/HP/Plasmon/Grundig dri)108 +549.6 R -.15(ve)-.25 G 3.649(sa).15 G 3.649(sw)-3.649 G 1.149(ell as Y) +-3.649 F 1.149(amaha CDR-100 and CDR-102 w)-1 F 1.15 +(ork also. The Plasmon)-.1 F .205(RF-4100 w)108 561.6 R .205(ork, b)-.1 +F .205(ut has not tested in multi session.)-.2 F 2.705(AP)5.205 G .205 +(hilips CDD-521 that has not been upgraded will not)-2.705 F -.1(wo)108 +573.6 S 2.933(rk. The).1 F(Son)2.933 E 2.933(yC)-.15 G .434 +(DU-924 has been tested, b)-2.933 F .434 +(ut does not support XA-mode2 in hardw)-.2 F 2.934(are. The)-.1 F(son) +2.934 E 2.934(yt)-.15 G(here-)-2.934 E .48 +(fore cannot create conforming multi session disks.)108 585.6 R .479 +(The Ricoh R)5.479 F .479(O-1420C w)-.4 F .479(orks, b)-.1 F .479 +(ut some people seem to)-.2 F(ha)108 597.6 Q .3 -.15(ve p)-.2 H +(roblems to use them with speed=2, try speed=0 in this case.).15 E .621 +(The Y)108 614.4 R .621(amaha CDR-400 and all ne)-1 F 3.121(wS)-.25 G +.621(CSI-3/mmc conforming dri)-3.121 F -.15(ve)-.25 G 3.122(sa).15 G +.622(re supported in single and multi-ses-)-3.122 F(sion.)108 626.4 Q +-1.1(Yo)108 643.2 S 2.568(us)1.1 G .068(hould run se)-2.568 F -.15(ve) +-.25 G .068(ral tests in all supported speeds of your dri).15 F .368 +-.15(ve w)-.25 H .068(ith the).15 F F1(\255dummy)2.568 E F0 .068 +(option turned on if you)2.568 F 1.628(are using)108 655.2 R F1(cdr) +4.128 E(ecord)-.18 E F0 1.628(on an unkno)4.128 F 1.628 +(wn system. Writing a CD is a realtime process.)-.25 F F1(NFS)6.629 E F0 +1.629(will not al)4.129 F -.1(wa)-.1 G(ys).1 E(deli)108 667.2 Q -.15(ve) +-.25 G 2.685(rc).15 G .185(onstantly the needed data rates.)-2.685 F +.185(If you w)5.185 F .185(ant to use)-.1 F F1(cdr)2.685 E(ecord)-.18 E +F0 .185(with CD-images that are located on a)2.685 F F1(NFS)108 679.2 Q +F0 .446 +(mounted \214lesystem, be sure that the \214fo size is big enough.)2.946 +F 2.947(Iu)5.447 G(sed)-2.947 E F1(cdr)2.947 E(ecord)-.18 E F0 .447 +(with with medium load)2.947 F 1.538(on a SS20/502 and e)108 691.2 R +-.15(ve)-.25 G 4.038(na).15 G 4.038(tq)-4.038 G 1.538 +(uad speed on a Sparcstation-2 which w)-4.038 F 1.538(as hea)-.1 F 1.538 +(vily loaded, b)-.2 F 1.537(ut it is recom-)-.2 F .157(mended to lea)108 +703.2 R .457 -.15(ve t)-.2 H .157 +(he system as lightly loaded as possible while writing a CD.).15 F .158 +(If you w)5.158 F .158(ant to mak)-.1 F 2.658(es)-.1 G .158(ure that) +-2.658 F -.2(bu)108 715.2 S -.25(ff).2 G(er underruns are not caused by\ + your source disk, you may use the command).25 E(J)72 768 Q -.25(..)-5.5 +K(or)-4.5 5.5 M 2.5(gS)-.18 G 153.065(chilling V)-2.5 F(ersion 2.0)-1.11 +E(13)201.225 E EP +%%Page: 14 14 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 104.275(CDRECORD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(CDRECORD\(1\))106.775 E/F1 10/Times-Bold@0 SF(cdr) +118 84 Q(ecord -dummy de)-.18 E(v=2,0 padsize=600m /de)-.15 E(v/null) +-.15 E F0 .835(to create a disk that is entirely made of dummy data.)108 +100.8 R F1(Cdr)5.835 E(ecord)-.18 E F0 .834 +(needs to run as root to get access to the)3.335 F F1(/de)108 112.8 Q +(v/scg?)-.15 E F0(de)5 E +(vice nodes and to be able to lock itself into memory)-.25 E(.)-.65 E +.043(If you don')108 129.6 R 2.543(tw)-.18 G .043(ant to allo)-2.643 F +2.543(wu)-.25 G .043(sers to become root on your system,)-2.543 F F1 +(cdr)2.543 E(ecord)-.18 E F0 .044(may safely be installed suid root.) +2.543 F .937(This allo)108 141.6 R .936 +(ws all users or a group of users with no root pri)-.25 F(vile)-.25 E +.936(ges to use)-.15 F F1(cdr)3.436 E 3.436(ecord. Cdr)-.18 F(ecord)-.18 +E F0 .936(in this case)3.436 F 1.423(checks, if the real user w)108 +153.6 R 1.423(ould ha)-.1 F 1.723 -.15(ve b)-.2 H 1.423 +(een able to read the speci\214ed \214les.).15 F 3.024 -.8(To g)6.424 H +-2.15 -.25(iv e).8 H 1.424(all user access to use)4.174 F F1(cdr)108 +165.6 Q(ecord,)-.18 E F0(enter:)2.5 E(cho)144 182.4 Q +(wn root /usr/local/bin/cdrecord)-.25 E +(chmod 4711 /usr/local/bin/cdrecord)144 194.4 Q 1.6 -.8(To g)108 211.2 T +-2.15 -.25(iv e).8 H 2.5(ar)2.75 G +(estricted group of users access to cdrecord enter:)-2.5 E(cho)144 228 Q +(wn root /usr/local/bin/cdrecord)-.25 E(chgrp cdb)144 240 Q +(urners /usr/local/bin/cdrecord)-.2 E +(chmod 4710 /usr/local/bin/cdrecord)144 252 Q(and add a group)108 268.8 +Q/F2 10/Times-Italic@0 SF(cdb)2.5 E(urner)-.2 E(s)-.1 E F0 +(on your system.)2.5 E(Ne)108 285.6 Q -.15(ve)-.25 G 3.03(rg).15 G -2.15 +-.25(iv e)-3.03 H .53(write permissions for non root users to the)3.28 F +F2(/de)3.03 E(v/scg?)-.15 E F0(de)5.53 E .53(vices unless you w)-.25 F +.53(ould allo)-.1 F 3.03(wa)-.25 G -.15(ny)-3.03 G(body).15 E +(to read/write/format all your disks.)108 297.6 Q -1.1(Yo)108 314.4 S +3.356(us)1.1 G .856(hould not connect old dri)-3.356 F -.15(ve)-.25 G +3.356(st).15 G .857 +(hat do not support disconnect/reconnect to either the SCSI b)-3.356 F +.857(us that is)-.2 F(connected to the CD-Recorder or the source disk.) +108 326.4 Q 2.5(AC)108 343.2 S(ompact Disc can ha)-2.5 E .3 -.15(ve n) +-.2 H 2.5(om).15 G(ore than 99 tracks.)-2.5 E .635(When creating a disc\ + with both audio and data tracks, the data should be on track 1 otherwi\ +se you should)108 360 R .267(create a CDplus disk which is a multi sess\ +ion disk with the \214rst session containing the audio tracks and the) +108 372 R(follo)108 384 Q(wing session containing the data track.)-.25 E +(Man)108 400.8 Q 3.179(yo)-.15 G .679(perating systems are not able to \ +read more than a single data track, or need special softw)-3.179 F .679 +(are to do)-.1 F(so.)108 412.8 Q(More information on the SCSI command s\ +et of a HP CD-Recorder can be found at:)108 429.6 Q(http://www)144 446.4 +Q(.hp.com/isgsupport/cdr/inde)-.65 E(x.html)-.15 E .72(If you ha)108 +463.2 R 1.02 -.15(ve m)-.2 H .721(ore information or SCSI command manua\ +ls for currently unsupported CD-Recorders please).15 F +(contact the author)108 475.2 Q(.)-.55 E 1.333 +(The Philips CDD 521 CD-Recorder \(e)108 492 R -.15(ve)-.25 G 3.833(ni) +.15 G 3.833(nt)-3.833 G 1.333(he upgraded v)-3.833 F 1.333 +(ersion\) has se)-.15 F -.15(ve)-.25 G 1.332(ral \214rmw).15 F 1.332 +(are b)-.1 F 1.332(ugs. Some of)-.2 F(them will force you to po)108 504 +Q(wer c)-.25 E(ycle the de)-.15 E(vice or to reboot the machine.)-.25 E +.404(When using)108 520.8 R F1(cdr)2.904 E(ecord)-.18 E F0 .404 +(with the brok)2.904 F(en)-.1 E F1 .404(Linux SCSI generic dri)2.904 F +-.1(ve)-.1 G -1(r.).1 G F0 -1.1(Yo)6.404 G 2.905(us)1.1 G .405 +(hould note that)-2.905 F F1(cdr)2.905 E(ecord)-.18 E F0 .405(uses a) +2.905 F .054 +(hack, that tries to emulate the functionality of the scg dri)108 532.8 +R -.15(ve)-.25 G 3.654 -.55(r. U).15 H(nfortunately).55 E 2.554(,t)-.65 +G .054(he sg dri)-2.554 F -.15(ve)-.25 G 2.554(ro).15 G(n)-2.554 E F1 +(Linux)2.554 E F0 .053(has se)2.553 F(v-)-.25 E(eral se)108 544.8 Q -.15 +(ve)-.25 G(re b).15 E(ugs:)-.2 E 32.5<8349>108 561.6 S 2.5(tc)-32.5 G +(annot see if a SCSI command could not be sent at all.)-2.5 E 32.5<8349> +108 578.4 S 2.532(tc)-32.5 G .032(annot get the SCSI status byte.)-2.532 +F F1(Cdr)5.033 E(ecord)-.18 E F0 .033(for that reason cannot report f) +2.533 F .033(ailing SCSI commands)-.1 F(in some situations.)144 590.4 Q +32.5<8349>108 607.2 S 3.212(tc)-32.5 G .711 +(annot get real DMA count of transfer)-3.212 F(.)-.55 E F1(Cdr)5.711 E +(ecord)-.18 E F0 .711(cannot tell you if there is an DMA residual)3.211 +F(count.)144 619.2 Q 32.5<8349>108 636 S 3.109(tc)-32.5 G .609 +(annot get number of bytes v)-3.109 F .609(alid in auto sense data.)-.25 +F F1(Cdr)5.61 E(ecord)-.18 E F0 .61(cannot tell you if de)3.11 F .61 +(vice trans-)-.25 F(fers no sense data at all.)144 648 Q 32.5<8349>108 +664.8 S 2.5(tf)-32.5 G(etches to fe)-2.5 E 2.5(wd)-.25 G +(ata in auto request sense \(CCS/SCSI-2/SCSI-3 needs >= 18\).)-2.5 E +.263(The \214fo percent output is computed just after a block of data h\ +as been written to the CD-Recorder)108 681.6 R 2.762(.F)-.55 G .262 +(or this)-2.912 F(reason, there will ne)108 693.6 Q -.15(ve)-.25 G 2.5 +(rb).15 G 2.5(e1)-2.5 G +(00% \214fo \214ll, while the \214fo is in streaming mode.)-2.5 E(J)72 +768 Q -.25(..)-5.5 K(or)-4.5 5.5 M 2.5(gS)-.18 G 153.065(chilling V)-2.5 +F(ersion 2.0)-1.11 E(14)201.225 E EP +%%Page: 15 15 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 104.275(CDRECORD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(CDRECORD\(1\))106.775 E/F1 10.95/Times-Bold@0 SF +(DIA)72 84 Q(GNOSTICS)-.602 E F0 -1.1(Yo)108 96 S 2.5(uh)1.1 G -2.25 -.2 +(av e)-2.5 H 2.5(9s)2.7 G(econds to type ^C to abort)-2.5 E/F2 10 +/Times-Bold@0 SF(cdr)2.5 E(ecord)-.18 E F0(after you see the message:) +2.5 E(Starting to write CD at speed %d in %s mode for %s session.)108 +112.8 Q 2.5(At)108 129.6 S +(ypical error message for a SCSI command looks lik)-2.5 E(e:)-.1 E +(cdrecord: I/O error)144 153.6 Q 2.5(.t)-.55 G +(est unit ready: scsi sendcmd: no error)-2.5 E 2.5(CDB: 00)144 165.6 R +(20 00 00 00 00)2.5 E(status: 0x2 \(CHECK CONDITION\))144 177.6 Q +(Sense Bytes: 70 00 05 00 00 00 00 0A 00 00 00 00 25 00 00 00 00 00)144 +189.6 Q(Sense K)144 201.6 Q -.15(ey)-.25 G 2.5(:0).15 G(x5 Ille)-2.5 E +-.05(ga)-.15 G 2.5(lR).05 G(equest, Se)-2.5 E(gment 0)-.15 E +(Sense Code: 0x25 Qual 0x00 \(logical unit not supported\) Fru 0x0)144 +213.6 Q(Sense \215ags: Blk 0 \(not v)144 225.6 Q(alid\))-.25 E +(cmd \214nished after 0.002s timeout 40s)144 237.6 Q .351 +(The \214rst line gi)108 261.6 R -.15(ve)-.25 G 2.851(si).15 G .352 +(nformation about the transport of the command.)-2.851 F .352(The te) +5.352 F .352(xt after the \214rst colon gi)-.15 F -.15(ve)-.25 G 2.852 +(st).15 G(he)-2.852 E .041(error te)108 273.6 R .041 +(xt for the system call from the vie)-.15 F 2.541(wo)-.25 G 2.541(ft) +-2.541 G .04(he k)-2.541 F .04(ernel. It usually is:)-.1 F F2 .04 +(I/O err)2.54 F(or)-.18 E F0 .04(unless other problems hap-)2.54 F .579 +(pen. The ne)108 285.6 R .579(xt w)-.15 F .579 +(ords contain a short description for the SCSI command that f)-.1 F .58 +(ails. The rest of the line tells)-.1 F .051(you if there were an)108 +297.6 R 2.551(yp)-.15 G .051(roblems for the transport of the command o) +-2.551 F -.15(ve)-.15 G 2.551(rt).15 G .051(he SCSI b)-2.551 F(us.)-.2 E +F2 .051(fatal err)5.051 F(or)-.18 E F0 .051(means that)2.551 F(it w)108 +309.6 Q(as not possible to transport the command \(i.e. no de)-.1 E +(vice present at the requested SCSI address\).)-.25 E +(The second line prints the SCSI command descriptor block for the f)108 +326.4 Q(ailed command.)-.1 E .706(The third line gi)108 343.2 R -.15(ve) +-.25 G 3.206(si).15 G .707(nformation on the SCSI status code returned \ +by the command, if the transport of the)-3.206 F(command succeeds.)108 +355.2 Q(This is error information from the SCSI de)5 E(vice.)-.25 E +(The fourth line is a he)108 372 Q 2.5(xd)-.15 G +(ump of the auto request sense information for the command.)-2.5 E .846 +(The \214fth line is the error te)108 388.8 R .846(xt for the sense k) +-.15 F 1.146 -.15(ey i)-.1 H 3.346(fa).15 G -.25(va)-3.546 G .846 +(ilable, follo).25 F .846(wed by the se)-.25 F .846 +(gment number that is only)-.15 F -.25(va)108 400.8 S .421 +(lid if the command w).25 F .421(as a)-.1 F/F3 10/Times-Italic@0 SF +(copy)2.921 E F0 .421(command. If the error message is not directly rel\ +ated to the current com-)2.921 F(mand, the te)108 412.8 Q(xt)-.15 E F3 +(deferr)2.5 E(ed err)-.37 E(or)-.45 E F0(is appended.)2.5 E 1.279 +(The sixth line is the error te)108 429.6 R 1.279 +(xt for the sense code and the sense quali\214er if a)-.15 F -.25(va)-.2 +G 3.778(ilable. If).25 F 1.278(the type of the)3.778 F(de)108 441.6 Q +.012(vice is kno)-.25 F .012 +(wn, the sense data is decoded from tables in)-.25 F F3(scsierr)2.512 E +(s.c)-.1 E F0 5.012(.T)2.822 G .012(he te)-5.012 F .012(xt is follo)-.15 +F .012(wed by the error v)-.25 F(alue)-.25 E +(for a \214eld replaceable unit.)108 453.6 Q 1.069(The se)108 470.4 R +-.15(ve)-.25 G 1.069 +(nth line prints the block number that is related to the f).15 F 1.069 +(ailed command and te)-.1 F 1.069(xt for se)-.15 F -.15(ve)-.25 G 1.068 +(ral error).15 F(\215ags. The block number may not be v)108 482.4 Q +(alid.)-.25 E .356(The eight line reports the timeout set up for this c\ +ommand and the time that the command really needed to)108 499.2 R +(complete.)108 511.2 Q(The follo)108 528 Q +(wing message is not an error:)-.25 E -.35(Tr)144 540 S(ack 01: T).35 E +(otal bytes read/written: 2048/2048 \(1 sectors\).)-.8 E +(cdrecord: I/O error)144 552 Q 2.5<2e8d>-.55 G +(ush cache: scsi sendcmd: no error)-2.5 E 2.5(CDB: 35)144 564 R +(00 00 00 00 00 00 00 00 00)2.5 E(status: 0x2 \(CHECK CONDITION\))144 +576 Q +(Sense Bytes: F0 00 05 80 00 00 27 0A 00 00 00 00 B5 00 00 00 00 00)144 +588 Q(Sense K)144 600 Q -.15(ey)-.25 G 2.5(:0).15 G(x5 Ille)-2.5 E -.05 +(ga)-.15 G 2.5(lR).05 G(equest, Se)-2.5 E(gment 0)-.15 E +(Sense Code: 0xB5 Qual 0x00 \(dummy data blocks added\) Fru 0x0)144 612 +Q(Sense \215ags: Blk -2147483609 \(v)144 624 Q(alid\))-.25 E +(cmd \214nished after 0.002s timeout 40s)144 636 Q(It simply noti\214es\ +, that a track that is smaller than the minimum size has been e)108 660 +Q(xpanded to 300 sectors.)-.15 E F1 -.11(BU)72 676.8 S(GS).11 E F2(Cdr) +108 688.8 Q(ecord)-.18 E F0(has e)2.5 E -.15(ve)-.25 G 2.5(nm).15 G +(ore options than)-2.5 E F2(ls)2.5 E F0(.)A(There should be a reco)108 +705.6 Q -.15(ve)-.15 G 2.5(ro).15 G(ption to mak)-2.5 E 2.5(ed)-.1 G +(isks usable, that ha)-2.5 E .3 -.15(ve b)-.2 H(een written during a po) +.15 E(wer f)-.25 E(ailure.)-.1 E(J)72 768 Q -.25(..)-5.5 K(or)-4.5 5.5 M +2.5(gS)-.18 G 153.065(chilling V)-2.5 F(ersion 2.0)-1.11 E(15)201.225 E +EP +%%Page: 16 16 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 104.275(CDRECORD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(CDRECORD\(1\))106.775 E/F1 10.95/Times-Bold@0 SF +(CREDITS)72 84 Q F0(Bill Sw)108 96 Q 24.32(artz \(Bill_Sw)-.1 F(artz@tw) +-.1 E(olf.com\))-.1 E -.15(Fo)183 108 S 2.5(rh).15 G +(elping me with the TEA)-2.5 E 2.5(Cd)-.4 G(ri)-2.5 E -.15(ve)-.25 G 2.5 +(rs).15 G(upport)-2.5 E(Aaron Ne)108 124.8 Q 2.27(wsome \(aaron.d.ne) +-.25 F(wsome@wdc.com\))-.25 E -.15(Fo)183 136.8 S 2.5(rl).15 G +(etting me de)-2.5 E -.15(ve)-.25 G(lop Son).15 E 2.5(ys)-.15 G +(upport on his dri)-2.5 E -.15(ve)-.25 G(Eric Y)108 153.6 Q 7.56 +(oungdale \(eric@andante.jic.com\))-1.1 F -.15(Fo)183 165.6 S 2.5(rs).15 +G(upplying mkisofs)-2.5 E(Gadi Oxman)108 182.4 Q(\(g)20.62 E +(adio@netvision.net.il\))-.05 E -.15(Fo)183 194.4 S 2.5(rt).15 G +(ips on the A)-2.5 E -.93(TA)-1.11 G(PI standard).93 E +(Finn Arne Gangstad)108 211.2 Q(\(\214nnag@guardian.no\))26.9 E -.15(Fo) +183 223.2 S 2.5(rt).15 G(he \214rst FIFO implementation.)-2.5 E(Da)108 +240 Q .3 -.15(ve P)-.2 H 27.91(latt \(dplatt@fe).15 F(ghoot.ml.or)-.15 E +(g\))-.18 E -.15(Fo)183 252 S 2.52(rc).15 G .019(reating the e)-2.52 F +.019(xperimental pack)-.15 F .019 +(et writing support, the \214rst implementation of CD-R)-.1 F(W)-.55 E +(blanking support, the \214rst .w)183 264 Q .4 -.2(av \214)-.1 H +(le decoder and man).2 E 2.5(yn)-.15 G(ice discussions on cdrecord.)-2.5 +E(Chris P)108 280.8 Q 2.5(.R)-1.11 G(oss \(cross@eng.us.uu.net\))-2.5 E +-.15(Fo)183 292.8 S 2.5(rt).15 G +(he \214rst implementation os a BSDI SCSI transport.)-2.5 E +(Grant R. Guenther)108 309.6 Q(\(grant@torque.net\))7.5 E -.15(Fo)183 +321.6 S 2.5(rc).15 G +(reating the \214rst parallel port transport implementation for Linux.) +-2.5 E -.25(Ke)108 338.4 S(nneth D. Merry \(k).25 E(en@kdm.or)-.1 E(g\)) +-.18 E 7.439(for pro)183 350.4 R 7.439 +(viding the CAM port for FreeBSD together with Michael Smith)-.15 F +(\(msmith@freebsd.or)183 362.4 Q(g\))-.18 E(Heik)108 379.2 Q 2.5(oE)-.1 +G(i\337feldt \(heik)-2.5 E(o@he)-.1 E(xco.de\))-.15 E +(for making libedc_ecc a)183 391.2 Q -.25(va)-.2 G +(ilable \(needed to write RA).25 E 2.5(Wd)-.9 G(ata sectors\).)-2.5 E F1 +(MAILING LISTS)72 420 Q F0 .764(If you w)108 432 R .764(ant to acti)-.1 +F -.15(ve)-.25 G .764(ly tak).15 F 3.264(ep)-.1 G .763(art on the de) +-3.264 F -.15(ve)-.25 G .763(lopment of cdrecord, you may join the de) +.15 F -.15(ve)-.25 G .763(loper mailing list).15 F(via this URL:)108 444 +Q/F2 10/Times-Bold@0 SF(http://lists.berlios.de/mailman/listinf)108 468 +Q(o/cdr)-.25 E(ecord-de)-.18 E -.1(ve)-.15 G(lopers).1 E F0 +(The mail address of the list is:)108 484.8 Q F2(cd)2.5 E(write@other) +-.15 E(.debian.or)-1 E(g)-.1 E F1 -.548(AU)72 513.6 S(THOR).548 E F0(J) +108 525.6 Q -.25(..)-5.5 K(or)-4.5 5.5 M 2.5(gS)-.18 G(chilling)-2.5 E +(Seestr)108 537.6 Q 2.5(.1)-.55 G(10)-2.5 E(D-13353 Berlin)108 549.6 Q +(German)108 561.6 Q(y)-.15 E(Additional information can be found on:)108 +578.4 Q(http://www)108 590.4 Q +(.fokus.fhg.de/usr/schilling/cdrecord.html)-.65 E(If you ha)108 607.2 Q +.3 -.15(ve s)-.2 H(upport questions, send them to:).15 E F2(cdr)108 624 +Q(ecord-support@berlios.de)-.18 E F0(or)108 636 Q F2(cd)2.5 E +(write@other)-.15 E(.debian.or)-1 E(g)-.1 E F0(Of you ha)108 652.8 Q .3 +-.15(ve d)-.2 H(e\214nitely found a b).15 E(ug, send a mail to:)-.2 E F2 +(cdr)108 669.6 Q(ecord-de)-.18 E -.1(ve)-.15 G(lopers@berlios.de).1 E F0 +(or)108 681.6 Q F2(schilling@f)2.5 E(okus.fhg)-.25 E(.de)-.15 E F0 1.6 +-.8(To s)108 698.4 T(ubscribe, use:).8 E F2 +(http://lists.berlios.de/mailman/listinf)108 715.2 Q(o/cdr)-.25 E +(ecord-de)-.18 E -.1(ve)-.15 G(lopers).1 E F0(or)108 727.2 Q F2 +(http://lists.berlios.de/mailman/listinf)2.5 E(o/cdr)-.25 E +(ecord-support)-.18 E F0(J)72 768 Q -.25(..)-5.5 K(or)-4.5 5.5 M 2.5(gS) +-.18 G 153.065(chilling V)-2.5 F(ersion 2.0)-1.11 E(16)201.225 E EP +%%Page: 17 17 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 104.275(CDRECORD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(CDRECORD\(1\))106.775 E +(The old cdwrite mailing list may be joined by sending mail to:)108 84 Q +(cdwrite-request@other)144 108 Q(.debian.or)-.55 E(g)-.18 E +(and including the w)108 132 Q(ord)-.1 E/F1 10/Times-Italic@0 SF +(subscribe)2.5 E F0(in the body)2.5 E 5(.T)-.65 G +(he mail address of the list is:)-5 E(cdwrite@other)144 156 Q +(.debian.or)-.55 E(g)-.18 E(J)72 768 Q -.25(..)-5.5 K(or)-4.5 5.5 M 2.5 +(gS)-.18 G 153.065(chilling V)-2.5 F(ersion 2.0)-1.11 E(17)201.225 E EP +%%Trailer +end +%%EOF diff --git a/scsilib/doc/isoinfo.man b/scsilib/doc/isoinfo.man new file mode 100644 index 0000000..e04edbb --- /dev/null +++ b/scsilib/doc/isoinfo.man @@ -0,0 +1,135 @@ +ISOINFO(8) ISOINFO(8) + + + +NNAAMMEE + devdump, isoinfo, isovfy, isodump - Utility programs for + dumping and verifying iso9660 images. + +SSYYNNOOPPSSIISS + ddeevvdduummpp _i_s_o_i_m_a_g_e + + iissoodduummpp _i_s_o_i_m_a_g_e + + iissooiinnffoo [ --dd ] [ --hh ] [ --RR ] [ --JJ ] [ --jj _c_h_a_r_s_e_t ] [ --ff ] + [ --ll ] [ --pp ] [ --TT _s_e_c_t_o_r ] [ --NN _s_e_c_t_o_r ] [ --ii _i_s_o_i_m_a_g_e ] + [ --xx _p_a_t_h ] + + iissoovvffyy _i_s_o_i_m_a_g_e + +DDEESSCCRRIIPPTTIIOONN + ddeevvdduummpp is a crude utility to interactively display the + contents of device or filesystem images. The initial + screen is a display of the first 256 bytes of the first + 2048 byte sector. The commands are the same as with iissoo-- + dduummpp. + + iissoodduummpp is a crude utility to interactively display the + contents of iso9660 images in order to verify directory + integrity. The initial screen is a display of the first + part of the root directory, and the prompt shows you the + extent number and offset in the extent. + + You can use the 'a' and 'b' commands to move back- + wards and forwards within the image. The 'g' com- + mand allows you to goto an arbitrary extent, and + the 'f' command specifies a search string to be + used. The '+' command searches forward for the next + instance of the search string, and the 'q' command + exits ddeevvdduummpp or iissoodduummpp. + + iissooiinnffoo is a utility to perform directory like listings of + iso9660 images. + + iissoovvffyy is a utility to verify the integrity of an iso9660 + image. Most of the tests in iissoovvffyy were added after bugs + were discovered in early versions of mmkkiissooffss.. It isn't + all that clear how useful this is anymore, but it doesn't + hurt to have this around. + + +OOPPTTIIOONNSS + Only the iissooiinnffoo program has any command line options. + These are: + + --hh print a summary of all options. + + --dd Print information from the primary volume descrip- + tor (PVD) of the iso9660 image. This includes + information about Rock Ridge and Joliet extensions + if present. + + --ff generate output as if a 'find . -print' command had + been run on the iso9660 image. You should not use + the --ll image with the --ff option. + + --ii iissoo__iimmaaggee + Specifies the path of the iso9660 image that we + wish to examine. + + --ll generate output as if a 'ls -lR' command had been + run on the iso9660 image. You should not use the + --ff image with the --ll option. + + --NN sseeccttoorr + Quick hack to help examine single session disc + files that are to be written to a multi-session + disc. The sector number specified is the sector + number at which the iso9660 image should be written + when send to the cd-writer. Not used for the first + session on the disc. + + --pp Print path table information. + + --RR Extract information from Rock Ridge extensions (if + present) for permissions, file names and owner- + ships. + + --JJ Extract information from Joliet extensions (if pre- + sent) for file names. + + --jj cchhaarrsseett + Convert Joliet file names (if present) to the sup- + plied charset. See mmkkiissooffss(8) for details. + + --TT sseeccttoorr + Quick hack to help examine multi-session images + that have already been burned to a multi-session + disc. The sector number specified is the sector + number for the start of the session we wish to dis- + play. + + --xx ppaatthhnnaammee + Extract specified file to stdout. + +AAUUTTHHOORR + Eric Youngdale <ericy@gnu.ai.mit.edu> or + <eric@andante.jic.com> is to blame for these shoddy hacks. + Patches to improve general usability would be gladly + accepted. + +BBUUGGSS + The user interface really sucks. + +FFUUTTUURREE IIMMPPRROOVVEEMMEENNTTSS + These utilities are really quick hacks, which are very + useful for debugging problems in mkisofs or in an iso9660 + filesystem. In the long run, it would be nice to have a + daemon that would NFS export a iso9660 image. + + The isoinfo program is probably the program that is of the + most use to the general user. + +AAVVAAIILLAABBIILLIITTYY + These utilities come with the mkisofs package, and the + primary ftp site is tsx-11.mit.edu in + /pub/linux/BETA/cdrom/mkisofs and many other mirror sites. + Despite the name, the software is not beta. + +SSEEEE AALLSSOO + mkisofs(8) + + + + +Version 2.0 02/12/24 ISOINFO(8) diff --git a/scsilib/doc/isoinfo.ps b/scsilib/doc/isoinfo.ps new file mode 100644 index 0000000..e879a26 --- /dev/null +++ b/scsilib/doc/isoinfo.ps @@ -0,0 +1,321 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.17.2 +%%CreationDate: Tue Dec 24 17:05:27 2002 +%%DocumentNeededResources: font Times-Roman +%%+ font Times-Bold +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.17 2 +%%Pages: 2 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.17 2 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 841.89 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron +/Zcaron/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE +/Times-Roman@0 ENC0/Times-Roman RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 363.3(ISOINFO\(8\) ISOINFO\(8\))72 48 R/F1 10.95 +/Times-Bold@0 SF -.219(NA)72 84 S(ME).219 E F0(de)108 96 Q +(vdump, isoinfo, iso)-.25 E(vfy)-.15 E 2.5(,i)-.65 G +(sodump \255 Utility programs for dumping and v)-2.5 E +(erifying iso9660 images.)-.15 E F1(SYNOPSIS)72 112.8 Q/F2 10 +/Times-Bold@0 SF(de)108 124.8 Q(vdump)-.15 E/F3 10/Times-Italic@0 SF +(isoima)2.5 E -.1(ge)-.1 G F2(isodump)108 141.6 Q F3(isoima)2.5 E -.1 +(ge)-.1 G F2(isoinf)108 158.4 Q(o)-.25 E F0([)2.517 E F2<ad64>2.517 E F0 +2.517(][)2.517 G F2<ad68>A F0 2.517(][)2.517 G F2<ad52>A F0 2.517(][) +2.517 G F2<ad4a>A F0 2.517(][)2.517 G F2<ad6a>A F3 -.15(ch)2.517 G(ar) +.15 E(set)-.1 E F0 2.517(][)2.517 G F2<ad66>A F0 2.517(][)2.517 G F2 +<ad6c>A F0 2.516(][)2.517 G F2<ad70>A F0 2.516(][)2.516 G F2<ad54>A F3 +(sector)2.516 E F0 2.516(][)2.516 G F2<ad4e>A F3(sector)2.516 E F0 2.516 +(][)2.516 G F2<ad69>A F3(isoima)2.516 E -.1(ge)-.1 G F0 2.516(][)2.616 G +F2<ad78>108 170.4 Q F3(path)2.5 E F0(])2.5 E F2(iso)108 187.2 Q(vfy)-.1 +E F3(isoima)2.5 E -.1(ge)-.1 G F1(DESCRIPTION)72 204 Q F2(de)108 216 Q +(vdump)-.15 E F0 .488(is a crude utility to interacti)2.988 F -.15(ve) +-.25 G .489(ly display the contents of de).15 F .489 +(vice or \214lesystem images.)-.25 F .489(The initial)5.489 F .482(scre\ +en is a display of the \214rst 256 bytes of the \214rst 2048 byte secto\ +r)108 228 R 5.481(.T)-.55 G .481(he commands are the same as with)-5.481 +F F2(isodump)108 240 Q F0(.)A F2(isodump)108 256.8 Q F0 .691 +(is a crude utility to interacti)3.191 F -.15(ve)-.25 G .691 +(ly display the contents of iso9660 images in order to v).15 F .692 +(erify direc-)-.15 F .09(tory inte)108 268.8 R(grity)-.15 E 5.09(.T)-.65 +G .09(he initial screen is a display of the \214rst part of the root di\ +rectory)-5.09 F 2.59(,a)-.65 G .09(nd the prompt sho)-2.59 F .09(ws you) +-.25 F(the e)108 280.8 Q(xtent number and of)-.15 E(fset in the e)-.25 E +(xtent.)-.15 E -1.1(Yo)144 297.6 S 2.691(uc)1.1 G .191 +(an use the 'a' and 'b' commands to mo)-2.691 F .491 -.15(ve b)-.15 H +(ackw).15 E .191(ards and forw)-.1 F .192 +(ards within the image. The 'g')-.1 F .492(command allo)144 309.6 R .492 +(ws you to goto an arbitrary e)-.25 F .491(xtent, and the 'f)-.15 F +2.991('c).55 G .491(ommand speci\214es a search string to)-2.991 F .418 +(be used. The '+' command searches forw)144 321.6 R .418(ard for the ne) +-.1 F .418(xt instance of the search string, and the 'q')-.15 F +(command e)144 333.6 Q(xits)-.15 E F2(de)2.5 E(vdump)-.15 E F0(or)2.5 E +F2(isodump)2.5 E F0(.)A F2(isoinf)108 350.4 Q(o)-.25 E F0 +(is a utility to perform directory lik)2.5 E 2.5(el)-.1 G +(istings of iso9660 images.)-2.5 E F2(iso)108 367.2 Q(vfy)-.1 E F0 .752 +(is a utility to v)3.252 F .752(erify the inte)-.15 F .752 +(grity of an iso9660 image. Most of the tests in)-.15 F F2(iso)3.252 E +(vfy)-.1 E F0 .752(were added after)3.252 F -.2(bu)108 379.2 S .534 +(gs were disco).2 F -.15(ve)-.15 G .534(red in early v).15 F .534 +(ersions of)-.15 F F2(mkisofs.)3.034 E F0 .534(It isn')5.534 F 3.034(ta) +-.18 G .534(ll that clear ho)-3.034 F 3.034(wu)-.25 G .535 +(seful this is an)-3.034 F .535(ymore, b)-.15 F .535(ut it)-.2 F(doesn') +108 391.2 Q 2.5(th)-.18 G(urt to ha)-2.5 E .3 -.15(ve t)-.2 H +(his around.).15 E F1(OPTIONS)72 420 Q F0(Only the)108 432 Q F2(isoinf) +2.5 E(o)-.25 E F0(program has an)2.5 E 2.5(yc)-.15 G +(ommand line options. These are:)-2.5 E F2<ad68>108 448.8 Q F0 +(print a summary of all options.)24.74 E F2<ad64>108 465.6 Q F0 .523 +(Print information from the primary v)24.74 F .522 +(olume descriptor \(PVD\) of the iso9660 image. This includes)-.2 F +(information about Rock Ridge and Joliet e)144 477.6 Q +(xtensions if present.)-.15 E F2<ad66>108 494.4 Q F0 .181(generate outp\ +ut as if a '\214nd . -print' command had been run on the iso9660 image.\ + Y)26.97 F .182(ou should not)-1.1 F(use the)144 506.4 Q F2(-l)2.5 E F0 +(image with the)2.5 E F2(-f)2.5 E F0(option.)2.5 E F2(\255i iso_image) +108 523.2 Q F0 +(Speci\214es the path of the iso9660 image that we wish to e)144 535.2 Q +(xamine.)-.15 E F2<ad6c>108 552 Q F0 .465(generate output as if a ') +27.52 F .464(ls -lR' command had been run on the iso9660 image.)-.1 F +-1.1(Yo)5.464 G 2.964(us)1.1 G .464(hould not use)-2.964 F(the)144 564 Q +F2(-f)2.5 E F0(image with the)2.5 E F2(-l)2.5 E F0(option.)2.5 E F2 +(\255N sector)108 580.8 Q F0 .527(Quick hack to help e)144 592.8 R .527 +(xamine single session disc \214les that are to be written to a multi-s\ +ession disc.)-.15 F 1.015(The sector number speci\214ed is the sector n\ +umber at which the iso9660 image should be written)144 604.8 R +(when send to the cd-writer)144 616.8 Q 2.5(.N)-.55 G +(ot used for the \214rst session on the disc.)-2.5 E F2<ad70>108 633.6 Q +F0(Print path table information.)24.74 E F2<ad52>108 650.4 Q F0 .325 +(Extract information from Rock Ridge e)23.08 F .326 +(xtensions \(if present\) for permissions, \214le names and o)-.15 F +(wn-)-.25 E(erships.)144 662.4 Q F2<ad4a>108 679.2 Q F0 +(Extract information from Joliet e)25.3 E +(xtensions \(if present\) for \214le names.)-.15 E F2(\255j charset)108 +696 Q F0(Con)144 708 Q -.15(ve)-.4 G +(rt Joliet \214le names \(if present\) to the supplied charset. See).15 +E F2(mkisofs)2.5 E F0(\(8\) for details.)A -1.11(Ve)72 768 S(rsion 2.0) +1.11 E 208.72(02/12/24 1)170.67 F EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 363.3(ISOINFO\(8\) ISOINFO\(8\))72 48 R/F1 10 +/Times-Bold@0 SF(\255T sector)108 84 Q F0 .165(Quick hack to help e)144 +96 R .165(xamine multi-session images that ha)-.15 F .465 -.15(ve a)-.2 +H .165(lready been b).15 F .165(urned to a multi-session)-.2 F .537(dis\ +c. The sector number speci\214ed is the sector number for the start of \ +the session we wish to dis-)144 108 R(play)144 120 Q(.)-.65 E F1 +(\255x pathname)108 136.8 Q F0(Extract speci\214ed \214le to stdout.)144 +148.8 Q/F2 10.95/Times-Bold@0 SF -.548(AU)72 165.6 S(THOR).548 E F0 1.35 +(Eric Y)108 177.6 R 1.349(oungdale <eric)-1.1 F 1.349(y@gnu.ai.mit.edu>\ + or <eric@andante.jic.com> is to blame for these shoddy hacks.)-.15 F +-.15(Pa)108 189.6 S(tches to impro).15 E .3 -.15(ve g)-.15 H +(eneral usability w).15 E(ould be gladly accepted.)-.1 E F2 -.11(BU)72 +206.4 S(GS).11 E F0(The user interf)108 218.4 Q(ace really sucks.)-.1 E +F2(FUTURE IMPR)72 235.2 Q -.548(OV)-.329 G(EMENTS).548 E F0 1.09 +(These utilities are really quick hacks, which are v)108 247.2 R 1.09 +(ery useful for deb)-.15 F 1.09(ugging problems in mkisofs or in an)-.2 +F .889(iso9660 \214lesystem. In the long run, it w)108 259.2 R .889 +(ould be nice to ha)-.1 F 1.189 -.15(ve a d)-.2 H .889(aemon that w).15 +F .889(ould NFS e)-.1 F .889(xport a iso9660)-.15 F(image.)108 271.2 Q(\ +The isoinfo program is probably the program that is of the most use to \ +the general user)108 288 Q(.)-.55 E F2 -1.04 -1.588(AV A)72 304.8 T +(ILABILITY)1.588 E F0 4.926(These utilities come with the mkisofs packa\ +ge, and the primary ftp site is tsx-11.mit.edu in)108 316.8 R +(/pub/linux/BET)108 328.8 Q(A/cdrom/mkisofs and man)-.93 E 2.5(yo)-.15 G +(ther mirror sites. Despite the name, the softw)-2.5 E(are is not beta.) +-.1 E F2(SEE ALSO)72 345.6 Q F0(mkisofs\(8\))108 357.6 Q -1.11(Ve)72 768 +S(rsion 2.0)1.11 E 208.72(02/12/24 2)170.67 F EP +%%Trailer +end +%%EOF diff --git a/scsilib/doc/mkisofs.man b/scsilib/doc/mkisofs.man new file mode 100644 index 0000000..30231fa --- /dev/null +++ b/scsilib/doc/mkisofs.man @@ -0,0 +1,2179 @@ +MKISOFS(8) MKISOFS(8) + + + +NNAAMMEE + mkisofs - create an hybrid ISO9660/JOLIET/HFS filesystem + with optional Rock Ridge attributes. + +SSYYNNOOPPSSIISS + mmkkiissooffss [ _o_p_t_i_o_n_s ] [ --oo _f_i_l_e_n_a_m_e ] _p_a_t_h_s_p_e_c _[_p_a_t_h_s_p_e_c + _._._._] + +DDEESSCCRRIIPPTTIIOONN + mmkkiissooffss is effectively a pre-mastering program to generate + an ISO9660/JOLIET/HFS hybrid filesystem. + + mmkkiissooffss is capable of generating the SSyysstteemm UUssee SShhaarriinngg + PPrroottooccooll rreeccoorrddss ((SSUUSSPP)) specified by the RRoocckk RRiiddggee IInntteerr-- + cchhaannggee PPrroottooccooll.. This is used to further describe the + files in the iso9660 filesystem to a unix host, and pro- + vides information such as longer filenames, uid/gid, posix + permissions, symbolic links, block and character devices. + + If Joliet or HFS hybrid command line options are speci- + fied, mmkkiissooffss will create additional filesystem meta data + for Joliet or HFS. The file content in this case refers + to the same data blocks on the media. It will generate a + pure ISO9660 filesystem unless the Joliet or HFS hybrid + command line options are given. + + mmkkiissooffss can generate a _t_r_u_e (or _s_h_a_r_e_d) HFS hybrid + filesystem. The same files are seen as HFS files when + accessed from a Macintosh and as ISO9660 files when + accessed from other machines. HFS stands for _H_i_e_r_a_r_c_h_i_c_a_l + _F_i_l_e _S_y_s_t_e_m and is the native file system used on Macin- + tosh computers. + + As an alternative, mmkkiissooffss can generate the _A_p_p_l_e _E_x_t_e_n_- + _s_i_o_n_s _t_o _I_S_O_9_6_6_0 for each file. These extensions provide + each file with CREATOR, TYPE and certain Finder Flags when + accessed from a Macintosh. See the HHFFSS MMAACCIINNTTOOSSHH FFIILLEE FFOORR-- + MMAATTSS section below. + + mmkkiissooffss takes a snapshot of a given directory tree, and + generates a binary image which will correspond to an + ISO9660 or HFS filesystem when written to a block device. + + Each file written to the iso9660 filesystem must have a + filename in the 8.3 format (8 characters, period, 3 char- + acters, all upper case), even if Rock Ridge is in use. + This filename is used on systems that are not able to make + use of the Rock Ridge extensions (such as MS-DOS), and + each filename in each directory must be different from the + other filenames in the same directory. mmkkiissooffss generally + tries to form correct names by forcing the unix filename + to upper case and truncating as required, but often times + this yields unsatisfactory results when there are cases + where the truncated names are not all unique. mmkkiissooffss + assigns weightings to each filename, and if two names that + are otherwise the same are found the name with the lower + priority is renamed to have a 3 digit number as an exten- + sion (where the number is guaranteed to be unique). An + example of this would be the files foo.bar and foo.bar.~1~ + - the file foo.bar.~1~ would be written as FOO000.BAR;1 + and the file foo.bar would be written as FOO.BAR;1 + + When used with various HFS options, mmkkiissooffss will attempt + to recognise files stored in a number of Apple/Unix file + formats and will copy the data and resource forks as well + as any relevant finder information. See the HHFFSS MMAACCIINNTTOOSSHH + FFIILLEE FFOORRMMAATTSS section below for more about formats mmkkiissooffss + supports. + + Note that mmkkiissooffss is not designed to communicate with the + writer directly. Most writers have proprietary command + sets which vary from one manufacturer to another, and you + need a specialized tool to actually burn the disk. + + The ccddrreeccoorrdd utility is a utility capable of burning an + actual disc. The latest version of ccddrreeccoorrdd is available + from ftp://ftp.berlios.de/pub/cdrecord + + Also you should know that most cd writers are very partic- + ular about timing. Once you start to burn a disc, you + cannot let their buffer empty before you are done, or you + will end up with a corrupt disc. Thus it is critical that + you be able to maintain an uninterrupted data stream to + the writer for the entire time that the disc is being + written. + + ppaatthhssppeecc is the path of the directory tree to be copied + into the iso9660 filesystem. Multiple paths can be speci- + fied, and mmkkiissooffss will merge the files found in all of the + specified path components to form the cdrom image. + + If the option _-_g_r_a_f_t_-_p_o_i_n_t_s has been specified, it is pos- + sible to graft the paths at points other than the root + directory, and it is possible to graft files or directo- + ries onto the cdrom image with names different than what + they have in the source filesystem. This is easiest to + illustrate with a couple of examples. Let's start by + assuming that a local file ../old.lis exists, and you wish + to include it in the cdrom image. + + + foo/bar/=../old.lis + + will include the file old.lis in the cdrom image at + /foo/bar/old.lis, while + + foo/bar/xxx=../old.lis + + will include the file old.lis in the cdrom image at + /foo/bar/xxx. The same sort of syntax can be used with + directories as well. mmkkiissooffss will create any directories + required such that the graft points exist on the cdrom + image - the directories do not need to appear in one of + the paths. By default, any directories that are created + on the fly like this will have permissions 0555 and appear + to be owned by the person running mkisofs. If you wish + other permissions or owners of the intermediate directo- + ries, see -uid, -gid, -dir-mode, -file-mode and -new-dir- + mode. + + mmkkiissooffss will also run on Win9X/NT4 machines when compiled + with Cygnus' cygwin (available from http://source- + ware.cygnus.com/cygwin/). Therefore most references in + this man page to _U_n_i_x can be replaced with _W_i_n_3_2. + + +OOPPTTIIOONNSS + --aabbssttrraacctt _F_I_L_E + Specifies the abstract file name. This parameter + can also be set in the file ..mmkkiissooffssrrcc with + ABST=filename. If specified in both places, the + command line version is used. + + --AA _a_p_p_l_i_c_a_t_i_o_n___i_d + Specifies a text string that will be written into + the volume header. This should describe the appli- + cation that will be on the disc. There is space on + the disc for 128 characters of information. This + parameter can also be set in the file ..mmkkiissooffssrrcc + with APPI=id. If specified in both places, the + command line version is used. + + --aallllooww--lloowweerrccaassee + This options allows lower case characters to appear + in iso9660 filenames. + This violates the ISO9660 standard, but it happens + to work on some systems. Use with caution. + + --aallllooww--mmuullttiiddoott + This options allows more than one dot to appear in + iso9660 filenames. A leading dot is not affected + by this option, it may be allowed separately using + the --LL option. + This violates the ISO9660 standard, but it happens + to work on many systems. Use with caution. + + --bbiibblliioo _F_I_L_E + Specifies the bibliographic file name. This param- + eter can also be set in the file ..mmkkiissooffssrrcc with + BIBLO=filename. If specified in both places, the + command line version is used. + + --ccaacchhee--iinnooddeess + Cache inode and device numbers to find hard links + to files. If mmkkiissooffss finds a hard link (a file + with multiple names), then the file will only + appear once on the CD. This helps to save space on + the CD. The option --ccaacchhee--iinnooddeess is default on + UNIX like operating systems. Be careful when using + this option on a filesystem without unique inode + numbers as it may result in files containing the + wrong content on CD. + + --nnoo--ccaacchhee--iinnooddeess + Do not cache inode and device numbers. This option + is needed whenever a filesystem does not have + unique inode numbers. It is the default on CCyyggwwiinn. + As the Microsoft operating system that runs below + CCyyggwwiinn is not POSIX compliant, it does not have + unique inode numbers. Cygwin creates fake inode + numbers from a hash algorithm that is not 100% cor- + rect. If mmkkiissooffss would cache inodes on Cygwin, it + would believe that some files are identical + although they are not. The result in this case are + files that contain the wrong content if a signifi- + cant amount of different files (> ~5000) is in + inside the tree that is to be archived. This does + not happen when the --nnoo--ccaacchhee--iinnooddeess iiss uusseedd,, bbuutt + tthhee ddiissaaddvvaannttaaggee iiss tthhaatt mmkkiissooffss cannot detect + hardlinks anymore and the resulting CD image may be + larger than expected. + + --bb _e_l_t_o_r_i_t_o___b_o_o_t___i_m_a_g_e + Specifies the path and filename of the boot image + to be used when making an "El Torito" bootable CD. + The pathname must be relative to the source path + specified to mmkkiissooffss.. This option is required to + make an "El Torito" bootable CD. The boot image + must be exactly the size of either a 1200, 1440, or + a 2880 kB floppy, and mmkkiissooffss will use this size + when creating the output iso9660 filesystem. It is + assumed that the first 512 byte sector should be + read from the boot image (it is essentially emulat- + ing a normal floppy drive). This will work, for + example, if the boot image is a LILO based boot + floppy. + + If the boot image is not an image of a floppy, you + need to add one of the options: --hhaarrdd--ddiisskk--bboooott or + --nnoo--eemmuull--bboooott. If the system should not boot off + the emulated disk, use --nnoo--bboooott. + + --eellttoorriittoo--aalltt--bboooott + Start with a new set of "El Torito" boot parame- + ters. This allows to have more than one El Torito + boot on a CD. A maximum of 63 El Torito boot + entries may be put on a single CD. + + --BB _i_m_g___s_u_n_4_,_i_m_g___s_u_n_4_c_,_i_m_g___s_u_n_4_m_,_i_m_g___s_u_n_4_d_,_i_m_g___s_u_n_4_e + Specifies a comma separated list of boot images + that are needed to make a bootable CD for sparc + systems. There may be empty fields in the comma + separated list. This option is required to make a + bootable CD for Sun sparc systems. If the --BB or + --ssppaarrcc--bboooott option has been specified, the first + sector of the resulting image will contain a Sun + disk label. This disk label specifies slice 0 for + the iso9660 image and slice 1 ... slice 7 for the + boot images that have been specified with this + option. Byte offset 512 ... 8191 within each of the + additional boot images must contain a primary boot + that works for the appropriate sparc architecture. + The rest of each of the images usually contains an + ufs filesystem that is used primary kernel boot + stage. + + The implemented boot method is the boot method + found with SunOS 4.x and SunOS 5.x. However, it + does not depend on SunOS internals but only on + properties of the Open Boot prom. For this reason, + it should be usable for any OS that boots off a + sparc system. + + If the special filename ...... is used, the actual + and all following boot partitions are mapped to the + previous partition. If mmkkiissooffss is called with --GG + _i_m_a_g_e --BB _._._. all boot partitions are mapped to the + partition that contains the iso9660 filesystem + image and the generic boot image that is located in + the first 16 sectors of the disk is used for all + architectures. + + --GG _g_e_n_e_r_i_c___b_o_o_t___i_m_a_g_e + Specifies the path and filename of the generic boot + image to be used when making a generic bootable CD. + The ggeenneerriicc__bboooott__iimmaaggee will be placed on the first + 16 sectors of the CD. The first 16 sectors are the + sectors that are located before the iso9660 primary + volume descriptor. If this option is used together + with the --ssppaarrcc--bboooott option, the Sun disk label + will overlay the first 512 bytes of the generic + boot image. + + --hhaarrdd--ddiisskk--bboooott + Specifies that the boot image used to create "El + Torito" bootable CDs is a hard disk image. The hard + disk image must begin with a master boot record + that contains a single partition. + + --nnoo--eemmuull--bboooott + Specifies that the boot image used to create "El + Torito" bootable CDs is a 'no emulation' image. The + system will load and execute this image without + performing any disk emulation. + + --nnoo--bboooott + Specifies that the created "El Torito" CD should be + marked as not bootable. The system will provide an + emulated drive for the image, but will boot off a + standard boot device. + + --bboooott--llooaadd--sseegg _s_e_g_m_e_n_t___a_d_d_r_e_s_s + Specifies the load segment address of the boot + image for no-emulation "El Torito" CDs. + + --bboooott--llooaadd--ssiizzee _l_o_a_d___s_e_c_t_o_r_s + Specifies the number of "virtual" (512-byte) sec- + tors to load in no-emulation mode. The default is + to load the entire boot file. Some BIOSes may have + problems if this is not a multiple of 4. + + --bboooott--iinnffoo--ttaabbllee + Specifies that a 56-byte table with information of + the CD-ROM layout will be patched in at offset 8 in + the boot file. If this option is given, the boot + file is modified in the source filesystem, so make + sure to make a copy if this file cannot be easily + regenerated! See the EELL TTOORRIITTOO BBOOOOTT IINNFFOO TTAABBLLEE + section for a description of this table. + + --CC _l_a_s_t___s_e_s_s___s_t_a_r_t_,_n_e_x_t___s_e_s_s___s_t_a_r_t + This option is needed when mmkkiissooffss is used to cre- + ate a CDextra or the image of a second session or a + higher level session for a multi session disk. The + option --CC takes a pair of two numbers separated by + a comma. The first number is the sector number of + the first sector in the last session of the disk + that should be appended to. The second number is + the starting sector number of the new session. The + expected pair of numbers may be retrieved by call- + ing ccddrreeccoorrdd --mmssiinnffoo ...... If the --CC option is used + in conjunction with the --MM option, mmkkiissooffss will + create a filesystem image that is intended to be a + continuation of the previous session. If the --CC + option is used without the --MM option, mmkkiissooffss will + create a filesystem image that is intended to be + used for a second session on a CDextra. This is a + multi session CD that holds audio data in the first + session and a ISO9660 filesystem in the second ses- + sion. + + --cc _b_o_o_t___c_a_t_a_l_o_g + Specifies the path and filename of the boot catalog + to be used when making an "El Torito" bootable CD. + The pathname must be relative to the source path + specified to mmkkiissooffss.. This option is required to + make a bootable CD. This file will be inserted + into the output tree and not created in the source + filesystem, so be sure the specified filename does + not conflict with an existing file, as it will be + excluded. Usually a name like "boot.catalog" is + chosen. + + --cchheecckk--oollddnnaammeess + Check all filenames imported from old session for + compliance with actual mmkkiissooffss iso9660 file naming + rules. It his option is not present, only names + with a length > 31 are checked as these files are a + hard violation of the iso9660 standard. + + --cchheecckk--sseessssiioonn _F_I_L_E + Check all old sessions for compliance with actual + mmkkiissooffss iso9660 file naming rules. This is a high + level option that is a combination of the options: + --MM _F_I_L_E --CC 00,,00 --cchheecckk--oollddnnaammeess For the parameter + _F_I_L_E see description of --MM option. + + --ccooppyyrriigghhtt _F_I_L_E + Specifies the Copyright file name. This parameter + can also be set in the file ..mmkkiissooffssrrcc with + COPY=filename. If specified in both places, the + command line version is used. + + --dd Omit trailing period from files that do not have a + period. + This violates the ISO9660 standard, but it happens + to work on many systems. Use with caution. + + --DD Do not use deep directory relocation, and instead + just pack them in the way we see them. + This violates the ISO9660 standard, but it happens + to work on many systems. Use with caution. + + --ddiirr--mmooddee _m_o_d_e + Overrides the mode of directories used to create + the image to _m_o_d_e. Specifying this option automat- + ically enables Rock Ridge extensions. + + --ddvvdd--vviiddeeoo + Generate DVD-Video compliant UDF file system. This + is done by sorting the order of the content of the + appropriate files and by adding padding between the + files if needed. + + --ff Follow symbolic links when generating the filesys- + tem. When this option is not in use, symbolic + links will be entered using Rock Ridge if enabled, + otherwise the file will be ignored. + + --ffiillee--mmooddee _m_o_d_e + Overrides the mode of regular files used to create + the image to _m_o_d_e. Specifying this option automat- + ically enables Rock Ridge extensions. + + --ggiidd _g_i_d + Overrides the gid read from the source files to the + value of _g_i_d. Specifying this option automatically + enables Rock Ridge extensions. + + --gguuii Switch the behaviour for a GUI. This currently + makes the output more verbose but may have other + effects in future. + + --ggrraafftt--ppooiinnttss + Allow to use graft points for filenames. If this + option is used, all filenames are checked for graft + points. The filename is divided at the first + unescaped equal sign. All occurrences of '\\' and + '=' characters must be escaped with '\\' if _-_g_r_a_f_t_- + _p_o_i_n_t_s has been specified. + + --hhiiddee _g_l_o_b + Hide _g_l_o_b from being seen on the ISO9660 or Rock + Ridge directory. _g_l_o_b is a shell wild-card-style + pattern that must match any part of the filename or + path. Multiple globs may be hidden. If _g_l_o_b + matches a directory, then the contents of that + directory will be hidden. In order to match a + directory name, make sure the pathname does not + include a trailing '/' character. All the hidden + files will still be written to the output CD image + file. Should be used with the --hhiiddee--jjoolliieett option. + See README.hide for more details. + + --hhiiddee--lliisstt _f_i_l_e + A file containing a list of _g_l_o_b_s to be hidden as + above. + + --hhiiddddeenn _g_l_o_b + Add the hidden (existence) ISO9660 directory + attribute for _g_l_o_b. This attribute will prevent + _g_l_o_b from being listed on DOS based systems if the + /A flag is not used for the listing. _g_l_o_b is a + shell wild-card-style pattern that must match any + part of the filename or path. In order to match a + directory name, make sure the pathname does not + include a trailing '/' character. Multiple globs + may be hidden. + + --hhiiddddeenn--lliisstt _f_i_l_e + A file containing a list of _g_l_o_b_s to get the hidden + attribute as above. + + --hhiiddee--jjoolliieett _g_l_o_b + Hide _g_l_o_b from being seen on the Joliet directory. + _g_l_o_b is a shell wild-card-style pattern that must + match any part of the filename or path. Multiple + globs may be hidden. If _g_l_o_b matches a directory, + then the contents of that directory will be hidden. + In order to match a directory name, make sure the + pathname does not include a trailing '/' character. + All the hidden files will still be written to the + output CD image file. Should be used with the + --hhiiddee option. See README.hide for more details. + + --hhiiddee--jjoolliieett--lliisstt _f_i_l_e + A file containing a list of _g_l_o_b_s to be hidden as + above. + + --hhiiddee--jjoolliieett--ttrraannss--ttbbll + Hide the TTRRAANNSS..TTBBLL files from the Joliet tree. + These files usually don't make sense in the Joliet + World as they list the real name and the ISO9660 + name which may both be different from the Joliet + name. + + --hhiiddee--rrrr--mmoovveedd + Rename the directory RRRR__MMOOVVEEDD to ..rrrr__mmoovveedd in the + Rock Ridge tree. It seems to be impossible to com- + pletely hide the RRRR__MMOOVVEEDD directory from the Rock + Ridge tree. This option only makes the visible + tree better to understand for people who don't know + what this directory is for. If you need to have no + RRRR__MMOOVVEEDD directory at all, you should use the --DD + option. Note that in case that the --DD option has + been specified, the resulting filesystem is not + ISO9660 level-1 compliant and will not be readable + on MS-DOS. See also NNOOTTEESS section for more infor- + mation on the RRRR__MMOOVVEEDD directory. + + --ll Allow full 31 character filenames. Normally the + ISO9660 filename will be in an 8.3 format which is + compatible with MS-DOS, even though the ISO9660 + standard allows filenames of up to 31 characters. + If you use this option, the disc may be difficult + to use on a MS-DOS system, but this comes in handy + on some other systems (such as the Amiga). Use + with caution. + + --iinnppuutt--cchhaarrsseett _c_h_a_r_s_e_t + Input charset that defines the characters used in + local file names. To get a list of valid charset + names, call mmkkiissooffss --iinnppuutt--cchhaarrsseett hheellpp.. To get a + 1:1 mapping, you may use ddeeffaauulltt as charset name. + The default initial values are _c_p_4_3_7 on DOS based + systems and _i_s_o_8_8_5_9_-_1 on all other systems. See + CCHHAARRAACCTTEERR SSEETTSS section below for more details. + + --oouuttppuutt--cchhaarrsseett _c_h_a_r_s_e_t + Output charset that defines the characters that + will be used in Rock Ridge file names. Defaults to + the input charset. See CCHHAARRAACCTTEERR SSEETTSS section below + for more details. + + --iissoo--lleevveell _l_e_v_e_l + Set the iso9660 conformance level. Valid numbers + are 1..3. + + With level 1, files may only consist of one section + and filenames are restricted to 8.3 characters. + + With level 2, files may only consist of one sec- + tion. + + With level 3, no restrictions apply. + + With all iso9660 levels all filenames are + restricted to upper case letters, numbers and the + underscore (_). The maximum filename length is + restricted to 31 characters, the directory nesting + level is restricted to 8 and the maximum path + length is limited to 255 characters. + + --JJ Generate Joliet directory records in addition to + regular iso9660 file names. This is primarily use- + ful when the discs are to be used on Windows-NT or + Windows-95 machines. The Joliet filenames are + specified in Unicode and each path component can be + up to 64 Unicode characters long. Note that Joliet + is no standard - CD's that use only Joliet exten- + sions but no standard Rock Ridge extensions may + usually only be used on Microsoft Win32 systems. + Furthermore, the fact that the filenames are lim- + ited to 64 characters and the fact that Joliet uses + the UTF-16 coding for Unicode characters causes + interoperability problems. + + --jjoolliieett--lloonngg + Allow Joliet filenames to be up to 103 Unicode + characters. This breaks the Joliet specification - + but appears to work. Use with caution. The number + 103 is derived from: the maximum Directory Record + Length (254), minus the length of Directory Record + (33), minus CD-ROM XA System Use Extension Informa- + tion (14), divided by the UTF-16 character size + (2). + + --jjcchhaarrsseett _c_h_a_r_s_e_t + Same as using --iinnppuutt--cchhaarrsseett _c_h_a_r_s_e_t and --JJ + options. See CCHHAARRAACCTTEERR SSEETTSS section below for more + details. + + --LL Allow ISO9660 filenames to begin with a period. + Usually, a leading dot is replaced with an under- + score in order to maintain MS-DOS compatibility. + This violates the ISO9660 standard, but it happens + to work on many systems. Use with caution. + + --lloogg--ffiillee _l_o_g___f_i_l_e + Redirect all error, warning and informational mes- + sages to _l_o_g___f_i_l_e instead of the standard error. + + --mm _g_l_o_b + Exclude _g_l_o_b from being written to CDROM. _g_l_o_b is + a shell wild-card-style pattern that must match + part of the filename (not the path as with option + --xx). Technically _g_l_o_b is matched against the + _d_-_>_d___n_a_m_e part of the directory entry. Multiple + globs may be excluded. Example: + + mkisofs -o rom -m '*.o' -m core -m foobar + + would exclude all files ending in ".o", called + "core" or "foobar" to be copied to CDROM. Note that + if you had a directory called "foobar" it too (and + of course all its descendants) would be excluded. + + NOTE: The --mm and --xx option description should both + be updated, they are wrong. Both now work identi- + cal and use filename globbing. A file is excluded + if either the last component matches or the whole + path matches. + + --eexxcclluuddee--lliisstt _f_i_l_e + A file containing a list of _g_l_o_b_s to be exclude as + above. + + --mmaaxx--iissoo99666600--ffiilleennaammeess + Allow 37 chars in iso9660 filenames. This option + forces the --NN option as the extra name space is + taken from the space reserved for ISO-9660 version + numbers. + This violates the ISO9660 standard, but it happens + to work on many systems. Although a conforming + application needs to provide a buffer space of at + least 37 characters, disks created with this option + may cause a buffer overflow in the reading operat- + ing system. Use with extreme care. + + --MM _p_a_t_h + or + + --MM _d_e_v_i_c_e + Specifies path to existing iso9660 image to be + merged. The alternate form takes a SCSI device + specifier that uses the same syntax as the ddeevv== + parameter of ccddrreeccoorrdd.. The output of mmkkiissooffss will + be a new session which should get written to the + end of the image specified in -M. Typically this + requires multi-session capability for the recorder + and cdrom drive that you are attempting to write + this image to. This option may only be used in + conjunction with the --CC option. + + --NN Omit version numbers from ISO9660 file names. + This violates the ISO9660 standard, but no one + really uses the version numbers anyway. Use with + caution. + + --nneeww--ddiirr--mmooddee _m_o_d_e + Mode to use when creating new directories in the + iso fs image. The default mode is 0555. + + --nnoobbaakk + + --nnoo--bbaakk + Do not include backup files files on the iso9660 + filesystem. If the --nnoo--bbaakk option is specified, + files that contain the characters '~' or '#' or end + in '.bak' will not be included (these are typically + backup files for editors under unix). + + --ffoorrccee--rrrr + Do not use the automatic Rock Ridge attributes + recognition for previous sessions. This helps to + show rotten iso9660 extension records as e.g. cre- + ated by NERO burning ROM. + + --nnoo--rrrr Do not use the Rock Ridge attributes from previous + sessions. This may help to avoid getting into + trouble when mmkkiissooffss finds illegal Rock Ridge sig- + natures on an old session. + + --nnoo--sspplliitt--ssyymmlliinnkk--ccoommppoonneennttss + Don't split the SL components, but begin a new Con- + tinuation Area (CE) instead. This may waste some + space, but the SunOS 4.1.4 cdrom driver has a bug + in reading split SL components (link_size = compo- + nent_size instead of link_size += component_size). + + --nnoo--sspplliitt--ssyymmlliinnkk--ffiieellddss + Don't split the SL fields, but begin a new Continu- + ation Area (CE) instead. This may waste some space, + but the SunOS 4.1.4 and Solaris 2.5.1 cdrom driver + have a bug in reading split SL fields (a `/' can be + dropped). + + --oo _f_i_l_e_n_a_m_e + is the name of the file to which the iso9660 + filesystem image should be written. This can be a + disk file, a tape drive, or it can correspond + directly to the device name of the optical disc + writer. If not specified, stdout is used. Note + that the output can also be a block special device + for a regular disk drive, in which case the disk + partition can be mounted and examined to ensure + that the premastering was done correctly. + + --ppaadd Pad the end of the ISO9660 by 16 sectors (32kB). If + the total size then is not a multiple of 16 sec- + tors, the needed number of sectors is added. If + the option --BB is used, then there is a second + padding at the end of the boot partitions. + + The padding is needed as many operating systems + (e.g. Linux) implement read ahead bugs in their + filesystem I/O. These bugs result in read errors on + one or more files that are located at the end of a + track. They are usually present when the CD is + written in Track at Once mode or when the disk is + written as mixed mode CD where an audio track fol- + lows the data track. + + To avoid problems with I/O error on the last file + on the filesystem, the --ppaadd option has been made + the default. + + --nnoo--ppaadd + Do not Pad the end of the ISO9660 by 16 sectors + (32kB). + + --ppaatthh--lliisstt _f_i_l_e + A file containing a list of _p_a_t_h_s_p_e_c directories + and filenames to be added to the ISO9660 filesys- + tem. This list of pathspecs are processed after any + that appear on the command line. If the argument is + _-, then the list is read from the standard input. + + --PP _p_u_b_l_i_s_h_e_r___i_d + Specifies a text string that will be written into + the volume header. This should describe the pub- + lisher of the CDROM, usually with a mailing address + and phone number. There is space on the disc for + 128 characters of information. This parameter can + also be set in the file ..mmkkiissooffssrrcc with PUBL=. If + specified in both places, the command line version + is used. + + --pp _p_r_e_p_a_r_e_r___i_d + Specifies a text string that will be written into + the volume header. This should describe the pre- + parer of the CDROM, usually with a mailing address + and phone number. There is space on the disc for + 128 characters of information. This parameter can + also be set in the file ..mmkkiissooffssrrcc with PREP=. If + specified in both places, the command line version + is used. + + --pprriinntt--ssiizzee + Print estimated filesystem size in multiples of the + sector size (2048 bytes) and exit. This option is + needed for Disk At Once mode and with some CD-R + drives when piping directly into ccddrreeccoorrdd.. In this + case it is needed to know the size of the filesys- + tem before the actual CD-creation is done. The + option -print-size allows to get this size from a + "dry-run" before the CD is actually written. Old + versions of mmkkiissooffss did write this information + (among other information) to _s_t_d_e_r_r. As this turns + out to be hard to parse, the number without any + other information is now printed on ssttddoouutt too. If + you like to write a simple shell script, redirect + ssttddeerrrr and catch the number from ssttddoouutt. This may + be done with: + + ccddbblloocckkss==`` mmkkiissooffss --pprriinntt--ssiizzee --qquuiieett ...... `` + + mmkkiissooffss ...... || ccddrreeccoorrdd ...... ttssiizzee==$${{ccddbblloocckkss}}ss -- + + --qquuiieett This makes mmkkiissooffss even less verbose. No progress + output will be provided. + + --RR Generate SUSP and RR records using the Rock Ridge + protocol to further describe the files on the + iso9660 filesystem. + + --rr This is like the -R option, but file ownership and + modes are set to more useful values. The uid and + gid are set to zero, because they are usually only + useful on the author's system, and not useful to + the client. All the file read bits are set true, + so that files and directories are globally readable + on the client. If any execute bit is set for a + file, set all of the execute bits, so that executa- + bles are globally executable on the client. If any + search bit is set for a directory, set all of the + search bits, so that directories are globally + searchable on the client. All write bits are + cleared, because the CD-Rom will be mounted read- + only in any case. If any of the special mode bits + are set, clear them, because file locks are not + useful on a read-only file system, and set-id bits + are not desirable for uid 0 or gid 0. When used on + Win32, the execute bit is set on _a_l_l files. This is + a result of the lack of file permissions on Win32 + and the Cygwin POSIX emulation layer. See also + -uid -gid, -dir-mode, -file-mode and -new-dir-mode. + + --rreellaaxxeedd--ffiilleennaammeess + The option --rreellaaxxeedd--ffiilleennaammeess allows ISO9660 file- + names to include digits, uppercase characters and + all other 7 bit ASCII characters (resp. anything + except lowercase characters). + This violates the ISO9660 standard, but it happens + to work on many systems. Use with caution. + + --ssoorrtt _s_o_r_t _f_i_l_e + Sort file locations on the media. Sorting is con- + trolled by a file that contains pairs of filenames + and sorting offset weighting. If the weighting is + higher, the file will be located closer to the + beginning of the media, if the weighting is lower, + the file will be located closer to the end of the + media. There must be only one space or tabs charac- + ter between the filename and the weight and the + weight must be the last characters on a line. The + filename is taken to include all the characters up + to, but not including the last space or tab charac- + ter on a line. This is to allow for space charac- + ters to be in, or at the end of a filename. This + option does nnoott sort the order of the file names + that appear in the ISO9660 directory. It sorts the + order in which the file data is written to the CD + image - which may be useful in order to optimize + the data layout on a CD. See README.sort for more + details. + + --sspplliitt--oouuttppuutt + Split the output image into several files of + approximately 1 GB. This helps to create DVD sized + iso9660 images on operating systems without large + file support. Cdrecord will concatenate more than + one file into a single track if writing to a DVD. + To make --sspplliitt--oouuttppuutt work, the --oo _f_i_l_e_n_a_m_e option + must be specified. The resulting outout images will + be named: _f_i_l_e_n_a_m_e___0_0,_f_i_l_e_n_a_m_e___0_1_,filename_02_._._. + + --ssyyssiidd _I_D + Specifies the system ID. This parameter can also + be set in the file ..mmkkiissooffssrrcc with SYSI=system_id. + If specified in both places, the command line ver- + sion is used. + + --TT Generate a file TRANS.TBL in each directory on the + CDROM, which can be used on non-Rock Ridge capable + systems to help establish the correct file names. + There is also information present in the file that + indicates the major and minor numbers for block and + character devices, and each symlink has the name of + the link file given. + + --ttaabbllee--nnaammee _T_A_B_L_E___N_A_M_E + Alternative translation table file name (see + above). Implies the --TT option. If you are creating + a multi-session image you must use the same name as + in the previous session. + + --uuccss--lleevveell _l_e_v_e_l + Set Unicode conformance level in the Joliet SVD. + The default level is 3. It may be set to 1..3 + using this option. + + --uuddff Include UUDDFF support in the generated filesystem + image. UUDDFF support is currently in alpha status + and for this reason, it is not possible to create + UDF only images. UUDDFF data structures are currently + coupled to the Joliet structures, so there are many + pitfalls with the current implementation. There is + no UID/GID support, there is no POSIX permission + support, there is no support for symlinks. Note + that UUDDFF wastes the space from sector ~20 to sector + 256 at the beginning of the disk in addition to the + spcae needed for real UUDDFF data structures. + + --uuiidd _u_i_d + Overrides the uid read from the source files to the + value of _u_i_d. Specifying this option automatically + enables Rock Ridge extensions. + + --uussee--ffiilleevveerrssiioonn + The option --uussee--ffiilleevveerrssiioonn allows mkisofs to use + file version numbers from the filesystem. If the + option is not specified, mmkkiissooffss creates a version + if 1 for all files. File versions are strings in + the range _;_1 to _;_3_2_7_6_7 This option is the default + on VMS. + + --UU Allows "Untranslated" filenames, completely violat- + ing the iso9660 standards described above. Forces + on the -d, -l, -L, -N, -relaxed-filenames, -allow- + lowercase, -allow-multidot and -no-iso-translate + flags. It allows more than one '.' character in the + filename, as well as mixed case filenames. This is + useful on HP-UX system, where the built-in CDFS + filesystem does not recognize ANY extensions. Use + with extreme caution. + + --nnoo--iissoo--ttrraannssllaattee + Do not translate the characters '#' and '~' which + are invalid for iso9660 filenames. These charac- + ters are though invalid often used by Microsoft + systems. + This violates the ISO9660 standard, but it happens + to work on many systems. Use with caution. + + --VV _v_o_l_i_d + Specifies the volume ID (volume name or label) to + be written into the master block. This parameter + can also be set in the file ..mmkkiissooffssrrcc with + VOLI=id. If specified in both places, the command + line version is used. Note that if you assign a + volume ID, this is the name that will be used as + the mount point used by the Solaris volume manage- + ment system and the name that is assigned to the + disc on a Microsoft Win32 or Apple Mac platform. + + --vvoollsseett _I_D + Specifies the volset ID. This parameter can also + be set in the file ..mmkkiissooffssrrcc with VOLS=volset_id. + If specified in both places, the command line ver- + sion is used. + + --vvoollsseett--ssiizzee _# + Sets the volume set size to #. The volume set size + is the number of CD's that are in a CD set. The + --vvoollsseett--ssiizzee option may be used to create CD's that + are part of e.g. a Operation System installation + set of CD's. The option --vvoollsseett--ssiizzee must be spec- + ified before --vvoollsseett--sseeqqnnoo on each command line. + + --vvoollsseett--sseeqqnnoo _# + Sets the volume set sequence number to #. The vol- + ume set sequence number is the index number of the + current CD in a CD set. The option --vvoollsseett--ssiizzee + must be specified before --vvoollsseett--sseeqqnnoo on each com- + mand line. + + --vv Verbose execution. If given twice on the command + line, extra debug information will be printed. + + --xx _p_a_t_h + Exclude _p_a_t_h from being written to CDROM. _p_a_t_h + must be the complete pathname that results from + concatenating the pathname given as command line + argument and the path relative to this directory. + Multiple paths may be excluded. Example: + + mkisofs -o cd -x /local/dir1 -x /local/dir2 /local + + NOTE: The --mm and --xx option description should both + be updated, they are wrong. Both now work identi- + cal and use filename globbing. A file is excluded + if either the last component matches or the whole + path matches. + + --zz Generate special RRIP records for transparently + compressed files. This is only of use and interest + for hosts that support transparent decompression, + such as Linux 2.4.14 or later. You must specify + the --RR or --rr options to enable RockRidge, and + generate compressed files using the mmkkzzffttrreeee util- + ity before running mmkkiissooffss. Note that transparent + compression is a nonstandard Rock Ridge extension. + The resulting disks are only transparently readable + if used on Linux. On other operating systems you + will need to call mmkkzzffttrreeee by hand to decompress + the files. + + +HHFFSS OOPPTTIIOONNSS + --hhffss Create an ISO9660/HFS hybrid CD. This option should + be used in conjunction with the --mmaapp, --mmaaggiicc and/or + the various _d_o_u_b_l_e _d_a_s_h options given below. + + --aappppllee Create an ISO9660 CD with Apple's extensions. Simi- + lar to the --hhffss option, except that the Apple + Extensions to ISO9660 are added instead of creating + an HFS hybrid volume. + + --mmaapp _m_a_p_p_i_n_g___f_i_l_e + Use the _m_a_p_p_i_n_g___f_i_l_e to set the CREATOR and TYPE + information for a file based on the filename's + extension. A filename is mapped only if it is not + one of the know Apple/Unix file formats. See the + HHFFSS CCRREEAATTOORR//TTYYPPEE section below. + + --mmaaggiicc _m_a_g_i_c___f_i_l_e + The CREATOR and TYPE information is set by using a + file's _m_a_g_i_c _n_u_m_b_e_r (usually the first few bytes of + a file). The _m_a_g_i_c___f_i_l_e is only used if a file is + not one of the known Apple/Unix file formats, or + the filename extension has not been mapped using + the --mmaapp option. See the HHFFSS CCRREEAATTOORR//TTYYPPEE section + below for more details. + + --hhffss--ccrreeaattoorr _C_R_E_A_T_O_R + Set the default CREATOR for all files. Must be + exactly 4 characters. See the HHFFSS CCRREEAATTOORR//TTYYPPEE sec- + tion below for more details. + + --hhffss--ttyyppee _T_Y_P_E + Set the default TYPE for all files. Must be exactly + 4 characters. See the HHFFSS CCRREEAATTOORR//TTYYPPEE section + below for more details. + + --pprroobbee Search the contents of files for all the known + Apple/Unix file formats. See the HHFFSS MMAACCIINNTTOOSSHH + FFIILLEE FFOORRMMAATTSS section below for more about these + formats. However, the only way to check for _M_a_c_B_i_- + _n_a_r_y and _A_p_p_l_e_S_i_n_g_l_e files is to open and read + them. Therefore this option _m_a_y increase processing + time. It is better to use one or more _d_o_u_b_l_e _d_a_s_h + options given below if the Apple/Unix formats in + use are known. + + --nnoo--ddeesskkttoopp + Do not create (empty) Desktop files. New HFS Desk- + top files will be created when the CD is used on a + Macintosh (and stored in the System Folder). By + default, empty Desktop files are added to the HFS + volume. + + --mmaacc--nnaammee + Use the HFS filename as the starting point for the + ISO9660, Joliet and Rock Ridge file names. See the + HHFFSS MMAACCIINNTTOOSSHH FFIILLEE NNAAMMEESS section below for more + information. + + --bboooott--hhffss--ffiillee _d_r_i_v_e_r___f_i_l_e + Installs the _d_r_i_v_e_r___f_i_l_e that _m_a_y make the CD + bootable on a Macintosh. See the HHFFSS BBOOOOTT DDRRIIVVEERR + section below. (Alpha). + + --ppaarrtt Generate an HFS partition table. By default, no + partition table is generated, but some older Macin- + tosh CDROM drivers need an HFS partition table on + the CDROM to be able to recognize a hybrid CDROM. + + --aauuttoo _A_u_t_o_S_t_a_r_t___f_i_l_e + Make the HFS CD use the QuickTime 2.0 Autostart + feature to launch an application or document. The + given filename must be the name of a document or + application located at the top level of the CD. The + filename must be less than 12 characters. (Alpha). + + --cclluusstteerr--ssiizzee _s_i_z_e + Set the size in bytes of the cluster or allocation + units of PC Exchange files. Implies the ----eexxcchhaannggee + option. See the HHFFSS MMAACCIINNTTOOSSHH FFIILLEE FFOORRMMAATTSS section + below. + + --hhiiddee--hhffss _g_l_o_b + Hide _g_l_o_b from the HFS volume. The file or direc- + tory will still exist in the ISO9660 and/or Joliet + directory. _g_l_o_b is a shell wild-card-style pattern + that must match any part of the filename Multiple + globs may be excluded. Example: + + mkisofs -o rom -hfs -hide-hfs '*.o' -hide-hfs foo- + bar + + would exclude all files ending in ".o" or called + "foobar" from the HFS volume. Note that if you had + a directory called "foobar" it too (and of course + all its descendants) would be excluded. The _g_l_o_b + can also be a path name relative to the source + directories given on the command line. Example: + + mkisofs -o rom -hfs -hide-hfs src/html src + + would exclude just the file or directory called + "html" from the "src" directory. Any other file or + directory called "html" in the tree will not be + excluded. Should be used with the --hhiiddee and/or + --hhiiddee--jjoolliieett options. In order to match a direc- + tory name, make sure the pathname does not include + a trailing '/' character. See README.hide for more + details. + + --hhiiddee--hhffss--lliisstt _f_i_l_e + A file containing a list of _g_l_o_b_s to be hidden as + above. + + --hhffss--vvoolliidd _h_f_s___v_o_l_i_d + Volume name for the HFS partition. This is the name + that is assigned to the disc on a Macintosh and + replaces the _v_o_l_i_d used with the --VV option + + --iiccoonn--ppoossiittiioonn + Use the icon position information, if it exists, + from the Apple/Unix file. The icons will appear in + the same position as they would on a Macintosh + desktop. Folder location and size on screen, its + scroll positions, folder View (view as Icons, Small + Icons, etc.) are also preserved. This option may + become set by default in the future. (Alpha). + + --rroooott--iinnffoo _f_i_l_e + Set the location, size on screen, scroll positions, + folder View etc. for the root folder of an HFS vol- + ume. See README.rootinfo for more information. + (Alpha) + + --pprreepp--bboooott _F_I_L_E + PReP boot image file. Up to 4 are allowed. See + README.prep_boot (Alpha) + + --iinnppuutt--hhffss--cchhaarrsseett _c_h_a_r_s_e_t + Input charset that defines the characters used in + HFS file names when used with the _-_m_a_c_-_n_a_m_e option. + The default charset is cp10000 (Mac Roman) _c_p_1_0_0_0_0 + (Mac Roman) See CCHHAARRAACCTTEERR SSEETTSS and HHFFSS MMAACCIINNTTOOSSHH + FFIILLEE NNAAMMEESS sections below for more details. + + --oouuttppuutt--hhffss--cchhaarrsseett _c_h_a_r_s_e_t + Output charset that defines the characters that + will be used in the HFS file names. Defaults to the + input charset. See CCHHAARRAACCTTEERR SSEETTSS section below for + more details. + + --hhffss--uunnlloocckk + By default, mmkkiissooffss will create an HFS volume that + is _l_o_c_k_e_d. This option leaves the volume unlocked + so that other applications (e.g. hfsutils) can + modify the volume. See the HHFFSS PPRROOBBLLEEMMSS//LLIIMMIITTAATTIIOONNSS + section below for warnings about using this option. + + --hhffss--bblleessss _f_o_l_d_e_r___n_a_m_e + "Bless" the given directory (folder). This is usu- + ally the SSyysstteemm FFoollddeerr and is used in creating HFS + bootable CDs. The name of the directory must be the + whole path name as mmkkiissooffss sees it. e.g. if the + given pathspec is ./cddata and the required folder + is called System Folder, then the whole path name + is "./cddata/System Folder" (remember to use quotes + if the name contains spaces). + + --hhffss--ppaarrmmss _P_A_R_A_M_E_T_E_R_S + Override certain parameters used to create the HFS + file system. Unlikely to be used in normal circum- + stances. See the libhfs_iso/hybrid.h source file + for details. + + ----ccaapp Look for AUFS CAP Macintosh files. Search for CAP + Apple/Unix file formats only. Searching for the + other possible Apple/Unix file formats is disabled, + unless other _d_o_u_b_l_e _d_a_s_h options are given. + + ----nneettaattaallkk + Look for NETATALK Macintosh files + + ----ddoouubbllee + Look for AppleDouble Macintosh files + + ----eetthheerrsshhaarree + Look for Helios EtherShare Macintosh files + + ----uusshhaarree + Look for IPT UShare Macintosh files + + ----eexxcchhaannggee + Look for PC Exchange Macintosh files + + ----ssggii Look for SGI Macintosh files + + ----xxiinneett + Look for XINET Macintosh files + + ----mmaaccbbiinn + Look for MacBinary Macintosh files + + ----ssiinnggllee + Look for AppleSingle Macintosh files + + ----ddaavvee Look for Thursby Software Systems DAVE Macintosh + files + + ----ssffmm Look for Microsoft's Services for Macintosh files + (NT only) (Alpha) + + ----oossxx--ddoouubbllee + Look for MacOS X AppleDouble Macintosh files + + ----oossxx--hhffss + Look for MacOS X HFS Macintosh files + + +CCHHAARRAACCTTEERR SSEETTSS + mmkkiissooffss processes file names in a POSIX compliant way as + strings of 8-bit characters. To represent all codings for + all languages, 8-bit characters are not sufficient. Uni- + code or IISSOO--1100664466 define character codings that need at + least 21 bits to represent all known languages. They may + be represented with UUTTFF--3322, UUTTFF--1166 or UUTTFF--88 coding. + UUTTFF--3322 uses a plain 32-bit coding but seems to be uncom- + mon. UUTTFF--1166 is used by Microsoft with Win32 with the dis- + advantage that it only supports a subset of all codes and + that 16-bit characters are not compliant with the POSIX + filesystem interface. + + Modern UNIX operating systems may use UUTTFF--88 coding for + filenames. This coding allows to use the complete Unicode + code set. Each 32-bit character is represented by one or + more 8-bit characters. If a character is coded in + IISSOO--88885599--11 (used in Central Europe and North America) is + maps 1:1 to a UUTTFF--3322 or UUTTFF--1166 coded Unicode character. + If a character is coded in 77--BBiitt AASSCCIIII (used in USA and + other countries with limted character set) is maps 1:1 to + a UUTTFF--3322, UUTTFF--1166 or UUTTFF--88 coded Unicode character. Char- + acter codes that cannot be represented as a single byte in + UTF-8 (typically if the value is > 0x7F) use escape + sequences that map to more than one 8-bit character. + + If all operating systems would use UUTTFF--88 coding, mmkkiissooffss + would not need to recode characters in file names. Unfor- + tunately, Apple uses completely nonstandard codings and + Microsoft uses a Unicode coding that is not compatible + with the POSIX filename interface. + + For all non UUTTFF--88 coded operating systems, the actual + character that each byte represents depends on the _c_h_a_r_a_c_- + _t_e_r _s_e_t or _c_o_d_e_p_a_g_e (which is the name used by Microsoft) + used by the local operating system in use - the characters + in a character set will reflect the region or natural + language used by the user. + + Usually character codes 0x00-0x1f are control characters, + codes 0x20-0x7f are the 7 bit ASCII characters and (on + PC's and Mac's) 0x80-0xff are used for other characters. + Unfortunately even this does not follow ISO standards that + reserve the range 0x80-0x9f for control characters and + only allow 0xa0-0xff for other characters. + + As there is a lot more than 256 characters/symbols in use, + only a small subset are represented in a character set. + Therefore the same character code may represent a differ- + ent character in different character sets. So a file name + generated, say in central Europe, may not display the same + character when viewed on a machine in, say eastern Europe. + + To make matters more complicated, different operating sys- + tems use different character sets for the region or lan- + guage. For example the character code for "small e with + acute accent" may be character code 0x82 on a PC, code + 0x8e on a Macintosh and code 0xe9 on a UNIX system. Note + while the codings used on a PC or Mac are nonstandard, + Unicode codes this character as 0x00000000e9 which is + basically the same value as the value used by most UNIX + systems. + + As long as not all operating systems and applications will + use the Unicode character set as the basis for file names + in a unique way, it may be necessary to specify which + character set your file names use in and which character + set the file names should appear on the CD. + + There are four options to specify the character sets you + want to use: + + -input-charset + Defines the local character set you are using on + your host machine. Any character set conversions + that take place will use this character set as the + staring point. The default input character sets are + _c_p_4_3_7 on DOS based systems and _i_s_o_8_8_5_9_-_1 on all + other systems. + + If the _-_J option is given, then the Unicode equiva- + lents of the input character set will be used in + the Joliet directory. Using the _-_j_c_h_a_r_s_e_t option is + the same as using the _-_i_n_p_u_t_-_c_h_a_r_s_e_t and _-_J + options. + + -output-charset + Defines the character set that will be used with + for the Rock Ridge names on the CD. Defaults to the + input character set. Only likely to be useful if + used on a non-Unix platform. e.g. using mmkkiissooffss on + a Microsoft Win32 machine to create Rock Ridge CDs. + If you are using mmkkiissooffss on a Unix machine, it is + likely that the output character set will be the + same as the input character set. + + -input-hfs-charset + Defines the HFS character set used for HFS file + names decoded from any of the various Apple/Unix + file formats. Only useful when used with _-_m_a_c_-_n_a_m_e + option. See the HHFFSS MMAACCIINNTTOOSSHH FFIILLEE NNAAMMEESS for more + information. Defaults to _c_p_1_0_0_0_0 (Mac Roman). + + -output-hfs-charset + Defines the HFS character set used to create HFS + file names from the input character set in use. In + most cases this will be from the character set + given with the _-_i_n_p_u_t_-_c_h_a_r_s_e_t option. Defaults to + the input HFS character set. + + There are a number of character sets built in to _m_k_i_s_o_f_s. + To get a listing, use mmkkiissooffss --iinnppuutt--cchhaarrsseett hheellpp.. + + Additional character sets can be read from file for any of + the character set options by giving a filename as the + argument to the options. The given file will only be read + if its name does not match one of the built in character + sets. + + The format of the character set files is the same as the + mapping files available from http://www.unicode.org/Pub- + lic/MAPPINGS The format of these files is: + + Column #1 is the input byte code (in hex as 0xXX) + Column #2 is the Unicode (in hex as 0xXXXX) + Rest of the line is ignored. + + Any blank line, line without two (or more) columns in the + above format or comments lines (starting with the # char- + acter) are ignored without any warnings. Any missing input + code is mapped to Unicode character 0x0000. + + Note that there is no support for 16 bit UNICODE (UTF-16) + or 32 bit UNICODE (UTF-32) coding because this coding is + not POSIX compliant. There should be support for UTF-8 + UNICODE coding which is compatible to POSIX filenames and + supported by moder UNIX implementations such as Solaris. + + A 1:1 character set mapping can be defined by using the + keyword _d_e_f_a_u_l_t as the argument to any of the character + set options. This is the behaviour of older (v1.12) ver- + sions of mmkkiissooffss. + + The ISO9660 file names generated from the input filenames + are not converted from the input character set. The + ISO9660 character set is a very limited subset of the + ASCII characters, so any conversion would be pointless. + + Any character that mmkkiissooffss can not convert will be + replaced with a '_' character. + + +HHFFSS CCRREEAATTOORR//TTYYPPEE + A Macintosh file has two properties associated with it + which define which application created the file, the _C_R_E_- + _A_T_O_R and what data the file contains, the _T_Y_P_E. Both are + (exactly) 4 letter strings. Usually this allows a Macin- + tosh user to double-click on a file and launch the correct + application etc. The CREATOR and TYPE of a particular file + can be found by using something like ResEdit (or similar) + on a Macintosh. + + The CREATOR and TYPE information is stored in all the var- + ious Apple/Unix encoded files. For other files it is pos- + sible to base the CREATOR and TYPE on the filename's + extension using a _m_a_p_p_i_n_g file (the --mmaapp option) and/or + using the _m_a_g_i_c _n_u_m_b_e_r (usually a _s_i_g_n_a_t_u_r_e in the first + few bytes) of a file (the --mmaaggiicc option). If both these + options are given, then their order on the command line is + important. If the --mmaapp option is given first, then a file- + name extension match is attempted before a magic number + match. However, if the --mmaaggiicc option is given first, then + a magic number match is attempted before a filename exten- + sion match. + + If a mapping or magic file is not used, or no match is + found then the default CREATOR and TYPE for all regular + files can be set by using entries in the ..mmkkiissooffssrrcc file + or using the --hhffss--ccrreeaattoorr and/or --hhffss--ttyyppee options, other- + wise the default CREATOR and TYPE are 'unix' and 'TEXT'. + + The format of the _m_a_p_p_i_n_g file is the same _a_f_p_f_i_l_e format + as used by _a_u_f_s. This file has five columns for the + _e_x_t_e_n_s_i_o_n, _f_i_l_e _t_r_a_n_s_l_a_t_i_o_n, _C_R_E_A_T_O_R, _T_Y_P_E and _C_o_m_m_e_n_t. + Lines starting with the '#' character are comment lines + and are ignored. An example file would be like: + + # Example filename mapping file + # + # EXTN XLate CREATOR TYPE Comment + .tif Raw '8BIM' 'TIFF' "Photoshop TIFF image" + .hqx Ascii 'BnHq' 'TEXT' "BinHex file" + .doc Raw 'MSWD' 'WDBN' "Word file" + .mov Raw 'TVOD' 'MooV' "QuickTime Movie" + * Ascii 'ttxt' 'TEXT' "Text file" + + Where: + + The first column _E_X_T_N defines the Unix filename + extension to be mapped. The default mapping for any + filename extension that doesn't match is defined + with the "*" character. + + The _X_l_a_t_e column defines the type of text transla- + tion between the Unix and Macintosh file it is + ignored by mmkkiissooffss, but is kept to be compatible + with aauuffss(1). Although mmkkiissooffss does not alter the + contents of a file, if a binary file has it's TYPE + set as 'TEXT', it _m_a_y be read incorrectly on a Mac- + intosh. Therefore a better choice for the default + TYPE may be '????' + + The _C_R_E_A_T_O_R and _T_Y_P_E keywords must be 4 characters + long and enclosed in single quotes. + + The comment field is enclosed in double quotes - it + is ignored by mmkkiissooffss, but is kept to be compatible + with aauuffss. + + The format of the _m_a_g_i_c file is almost identical to the + mmaaggiicc(4) file used by the Linux ffiillee(1) command - the rou- + tines for reading and decoding the _m_a_g_i_c file are based on + the Linux ffiillee(1) command. + + This file has four tab separated columns for the _b_y_t_e _o_f_f_- + _s_e_t, _t_y_p_e, _t_e_s_t and _m_e_s_s_a_g_e. Lines starting with the '#' + character are comment lines and are ignored. An example + file would be like: + + # Example magic file + # + # off type test message + 0 string GIF8 8BIM GIFf GIF image + 0 beshort 0xffd8 8BIM JPEG image data + + 0 string SIT! SIT! SIT! StuffIt Archive + 0 string \037\235 LZIV ZIVU standard unix compress + 0 string \037\213 GNUz ZIVU gzip compressed data + 0 string %! ASPS TEXT Postscript + 0 string \004%! ASPS TEXT PC Postscript with a ^D to start + 4 string moov txtt MooV QuickTime movie file (moov) + 4 string mdat txtt MooV QuickTime movie file (mdat) + + The format of the file is described in the mmaaggiicc(4) man + page. The only difference here is that for each entry in + the magic file, the _m_e_s_s_a_g_e for the initial offset mmuusstt be + 4 characters for the CREATOR followed by 4 characters for + the TYPE - white space is optional between them. Any other + characters on this line are ignored. Continuation lines + (starting with a '>') are also ignored i.e. only the ini- + tial offset lines are used. + + Using the --mmaaggiicc option may significantly increase pro- + cessing time as each file has to opened and read to find + it's magic number. + + In summary, for all files, the default CREATOR is 'unix' + and the default TYPE is 'TEXT'. These can be changed by + using entries in the _._m_k_i_s_o_f_s_r_c file or by using the --hhffss-- + ccrreeaattoorr and/or --hhffss--ttyyppee options. + + If the a file is in one of the known Apple/Unix formats + (and the format has been selected), then the CREATOR and + TYPE are taken from the values stored in the Apple/Unix + file. + + Other files can have their CREATOR and TYPE set from their + file name extension (the --mmaapp option), or their magic num- + ber (the --mmaaggiicc option). If the default match is used in + the _m_a_p_p_i_n_g file, then these values override the default + CREATOR and TYPE. + + A full CREATOR/TYPE database can be found at + http://www.angelfire.com/il/szekely/index.html + + +HHFFSS MMAACCIINNTTOOSSHH FFIILLEE FFOORRMMAATTSS + Macintosh files have two parts called the _D_a_t_a and + _R_e_s_o_u_r_c_e fork. Either may be empty. Unix (and many other + OSs) can only cope with files having one part (or fork). + To add to this, Macintosh files have a number of + attributes associated with them - probably the most impor- + tant are the TYPE and CREATOR. Again Unix has no concept + of these types of attributes. + + e.g. a Macintosh file may be a JPEG image where the image + is stored in the Data fork and a desktop thumbnail stored + in the Resource fork. It is usually the information in the + data fork that is useful across platforms. + + Therefore to store a Macintosh file on a Unix filesystem, + a way has to be found to cope with the two forks and the + extra attributes (which are referred to as the _f_i_n_d_e_r + _i_n_f_o). Unfortunately, it seems that every software pack- + age that stores Macintosh files on Unix has chosen a com- + pletely different storage method. + + The Apple/Unix formats that _m_k_i_s_o_f_s (partially) supports + are: + + CAP AUFS format + Data fork stored in a file. Resource fork in subdi- + rectory .resource with same filename as data fork. + Finder info in .finderinfo subdirectory with same + filename. + + AppleDouble/Netatalk + Data fork stored in a file. Resource fork stored in + a file with same name prefixed with "%". Finder + info also stored in same "%" file. Netatalk uses + the same format, but the resource fork/finderinfo + stored in subdirectory .AppleDouble with same name + as data fork. + + AppleSingle + Data structures similar to above, except both forks + and finder info are stored in one file. + + Helios EtherShare + Data fork stored in a file. Resource fork and + finder info together in subdirectory .rsrc with + same filename as data fork. + + IPT UShare + Very similar to the EtherShare format, but the + finder info is stored slightly differently. + + MacBinary + Both forks and finder info stored in one file. + + Apple PC Exchange + Used by Macintoshes to store Apple files on DOS + (FAT) disks. Data fork stored in a file. Resource + fork in subdirectory resource.frk (or + RESOURCE.FRK). Finder info as one record in file + finder.dat (or FINDER.DAT). Separate finder.dat for + each data fork directory. + + Note: _m_k_i_s_o_f_s needs to know the native FAT cluster + size of the disk that the PC Exchange files are on + (or have been copied from). This size is given by + the --cclluusstteerr--ssiizzee option. The cluster or alloca- + tion size can be found by using the DOS utility + CCHHKKDDSSKK. + + May not work with PC Exchange v2.2 or higher files + (available with MacOS 8.1). DOS media containing + PC Exchange files should be mounted as type mmssddooss + (not vvffaatt) when using Linux. + + SGI/XINET + Used by SGI machines when they mount HFS disks. + Data fork stored in a file. Resource fork in subdi- + rectory .HSResource with same name. Finder info as + one record in file .HSancillary. Separate .HSancil- + lary for each data fork directory. + + Thursby Software Systems DAVE + Allows Macintoshes to store Apple files on SMB + servers. Data fork stored in a file. Resource fork + in subdirectory resource.frk. Uses the AppleDouble + format to store resource fork. + + Services for Macintosh + Format of files stored by NT Servers on NTFS + filesystems. Data fork is stored as "filename". + Resource fork stored as a NTFS _s_t_r_e_a_m called + "filename:AFP_Resource". The finder info is stored + as a NTFS _s_t_r_e_a_m called "filename:Afp_AfpInfo". + These streams are normally invisible to the user. + + Warning: mkisofs only partially supports the SFM + format. If an HFS file or folder stored on the NT + server contains an _i_l_l_e_g_a_l NT character in its + name, then NT converts these characters to _P_r_i_v_a_t_e + _U_s_e _U_n_i_c_o_d_e characters. The characters are: " * / < + > ? | also a space or period if it is the last + character of the file name, character codes 0x01 to + 0x1f (control characters) and Apple' apple logo. + + Unfortunately, these private Unicode characters are + not readable by the mkisofs NT executable. There- + fore any file or directory name containing these + characters will be ignored - including the contents + of any such directory. + + MacOS X AppleDouble + When HFS/HFS+ files are copied or saved by MacOS X + on to a non-HFS file system (e.g. UFS, NFS etc.), + the files are stored in AppleDouble format. Data + fork stored in a file. Resource fork stored in a + file with same name prefixed with "._". Finder info + also stored in same "._" file. + + MacOS X HFS (Alpha) + Not really an Apple/Unix encoding, but actual + HFS/HFS+ files on a MacOS X system. Data fork + stored in a file. Resource fork stored in a pseudo + file with the same name with the suffix '/rsrc'. + The finderinfo is only available via a MacOS X + library call. + + Notes: (also see README.macosx) + + Only works when used on MacOS X. + + If a file is found with a zero length resource fork + and empty finderinfo, it is assumed not to have any + Apple/Unix encoding - therefore a TYPE and CREATOR + can be set using other methods. + + _m_k_i_s_o_f_s will attempt to set the CREATOR, TYPE, date and + possibly other flags from the finder info. Additionally, + if it exists, the Macintosh filename is set from the + finder info, otherwise the Macintosh name is based on the + Unix filename - see the HHFFSS MMAACCIINNTTOOSSHH FFIILLEE NNAAMMEESS section + below. + + When using the --aappppllee option, the TYPE and CREATOR are + stored in the optional System Use or SUSP field in the + ISO9660 Directory Record - in much the same way as the + Rock Ridge attributes are. In fact to make life easy, the + Apple extensions are added at the beginning of the exist- + ing Rock Ridge attributes (i.e. to get the Apple exten- + sions you get the Rock Ridge extensions as well). + + The Apple extensions require the resource fork to be + stored as an ISO9660 _a_s_s_o_c_i_a_t_e_d file. This is just like + any normal file stored in the ISO9660 filesystem except + that the associated file flag is set in the Directory + Record (bit 2). This file has the same name as the data + fork (the file seen by non-Apple machines). Associated + files are normally ignored by other OSs + + When using the --hhffss option, the TYPE and CREATOR plus + other finder info, are stored in a separate HFS directory, + not visible on the ISO9660 volume. The HFS directory ref- + erences the same data and resource fork files described + above. + + In most cases, it is better to use the --hhffss option instead + of the --aappppllee option, as the latter imposes the limited + ISO9660 characters allowed in filenames. However, the + Apple extensions do give the advantage that the files are + packed on the disk more efficiently and it may be possible + to fit more files on a CD - important when the total size + of the source files is approaching 650MB. + + +HHFFSS MMAACCIINNTTOOSSHH FFIILLEE NNAAMMEESS + Where possible, the HFS filename that is stored with an + Apple/Unix file is used for the HFS part of the CD. How- + ever, not all the Apple/Unix encodings store the HFS file- + name with the finderinfo. In these cases, the Unix file- + name is used - with escaped special characters. Special + characters include '/' and characters with codes over 127. + + Aufs escapes these characters by using ":" followed by the + character code as two hex digits. Netatalk and EtherShare + have a similar scheme, but uses "%" instead of a ":". + + If mkisofs can't find an HFS filename, then it uses the + Unix name, with any %xx or :xx characters (xx == two hex + digits) converted to a single character code. If "xx" are + not hex digits ([0-9a-fA-F]), then they are left alone - + although any remaining ":" is converted to "%" as colon is + the HFS directory separator. Care must be taken, as an + ordinary Unix file with %xx or :xx will also be converted. + e.g. + + This:2fFile converted to This/File + + This:File converted to This%File + + This:t7File converted to This%t7File + + Although HFS filenames appear to support upper and lower + case letters, the filesystem is case insensitive. i.e. the + filenames "aBc" and "AbC" are the same. If a file is found + in a directory with the same HFS name, then _m_k_i_s_o_f_s will + attempt, where possible, to make a unique name by adding + '_' characters to one of the filenames. + + If an HFS filename exists for a file, then mkisofs can use + this name as the starting point for the ISO9660, Joliet + and Rock Ridge filenames using the --mmaacc--nnaammee option. Nor- + mal Unix files without an HFS name will still use their + Unix name. e.g. + + If a _M_a_c_B_i_n_a_r_y (or _P_C _E_x_c_h_a_n_g_e) file is stored as _s_o_m_e_i_m_- + _a_g_e_._g_i_f_._b_i_n on the Unix filesystem, but contains a HFS + file called _s_o_m_e_i_m_a_g_e_._g_i_f, then this is the name that + would appear on the HFS part of the CD. However, as + mkisofs uses the Unix name as the starting point for the + other names, then the ISO9660 name generated will probably + be _S_O_M_E_I_M_A_G_._B_I_N and the Joliet/Rock Ridge would be _s_o_m_e_i_m_- + _a_g_e_._g_i_f_._b_i_n. Although the actual data (in this case) is a + GIF image. This option will use the HFS filename as the + starting point and the ISO9660 name will probably be + _S_O_M_E_I_M_A_G_._G_I_F and the Joliet/Rock Ridge would be _s_o_m_e_i_m_- + _a_g_e_._g_i_f. + + Using the --mmaacc--nnaammee option will not currently work with + the --TT option - the Unix name will be used in the + TRANS.TBL file, not the Macintosh name. + + The character set used to convert any HFS file name to a + Joliet/Rock Ridge file name defaults to _c_p_1_0_0_0_0 (Mac + Roman). The character set used can be specified using the + _-_i_n_p_u_t_-_h_f_s_-_c_h_a_r_s_e_t option. Other built in HFS character + sets are: cp10006 (MacGreek), cp10007 (MacCyrillic), + cp10029 (MacLatin2), cp10079 (MacIcelandandic) and cp10081 + (MacTurkish). + + Note: the character codes used by HFS file names taken + from the various Apple/Unix formats will not be converted + as they are assumed to be in the correct Apple character + set. Only the Joliet/Rock Ridge names derived from the HFS + file names will be converted. + + The existing mkisofs code will filter out any illegal + characters for the ISO9660 and Joliet filenames, but as + mkisofs expects to be dealing directly with Unix names, it + leaves the Rock Ridge names as is. But as '/' is a legal + HFS filename character, the --mmaacc--nnaammee option converts '/' + to a '_' in Rock Ridge filenames. + + If the Apple extensions are used, then only the ISO9660 + filenames will appear on the Macintosh. However, as the + Macintosh ISO9660 drivers can use _L_e_v_e_l _2 filenames, then + you can use options like --aallllooww--mmuullttiiddoott without problems + on a Macintosh - still take care over the names, for exam- + ple _t_h_i_s_._f_i_l_e_._n_a_m_e will be converted to _T_H_I_S_._F_I_L_E i.e. + only have one '.', also filename _a_b_c_d_e_f_g_h will be seen as + _A_B_C_D_E_F_G_H but _a_b_c_d_e_f_g_h_i will be seen as _A_B_C_D_E_F_G_H_I_. i.e. + with a '.' at the end - don't know if this is a Macintosh + problem or mkisofs/mkhybrid problem. All filenames will be + in uppercase when viewed on a Macintosh. Of course, + DOS/Win3.X machines will not be able to see Level 2 file- + names... + + +HHFFSS CCUUSSTTOOMM VVOOLLUUMMEE//FFOOLLDDEERR IICCOONNSS + To give a HFS CD a custom icon, make sure the root (top + level) folder includes a standard Macintosh volume icon + file. To give a volume a custom icon on a Macintosh, an + icon has to be pasted over the volume's icon in the "Get + Info" box of the volume. This creates an invisible file + called 'Icon\r' ('\r' is the 'carriage return' character) + in the root folder. + + A custom folder icon is very similar - an invisible file + called 'Icon\r' exits in the folder itself. + + Probably the easiest way to create a custom icon that + mkisofs can use, is to format a blank HFS floppy disk on a + Mac, paste an icon to its "Get Info" box. If using Linux + with the HFS module installed, mount the floppy using + something like: + + mount -t hfs /dev/fd0 /mnt/floppy + + The floppy will be mounted as a CAP file system by + default. Then run mkisofs using something like: + + mkisofs --cap -o output source_dir /mnt/floppy + + If you are not using Linux, then you can use the hfsutils + to copy the icon file from the floppy. However, care has + to be taken, as the icon file contains a control charac- + ter. e.g. + + hmount /dev/fd0 + hdir -a + hcopy -m Icon^V^M icon_dir/icon + + Where '^V^M' is control-V followed by control-M. Then run + mmkkiissooffss by using something like: + + mkisofs --macbin -o output source_dir icon_dir + + The procedure for creating/using custom folder icons is + very similar - paste an icon to folder's "Get Info" box + and transfer the resulting 'Icon\r' file to the relevant + directory in the mkisofs source tree. + + You may want to hide the icon files from the ISO9660 and + Joliet trees. + + To give a custom icon to a Joliet CD, follow the instruc- + tions found at: http://www.fadden.com/cdr- + faq/faq03.html#[3-21] + + +HHFFSS BBOOOOTT DDRRIIVVEERR + It _m_a_y be possible to make the hybrid CD bootable on a + Macintosh. + + A bootable HFS CD requires an Apple CD-ROM (or compatible) + driver, a bootable HFS partition and the necessary System, + Finder, etc. files. + + A driver can be obtained from any other Macintosh bootable + CD-ROM using the _a_p_p_l_e___d_r_i_v_e_r utility. This file can then + be used with the --bboooott--hhffss--ffiillee option. + + The HFS partition (i.e. the hybrid disk in our case) must + contain a suitable System Folder, again from another CD- + ROM or disk. + + For a partition to be bootable, it must have it's _b_o_o_t + _b_l_o_c_k set. The boot block is in the first two blocks of a + partition. For a non-bootable partition the boot block is + full of zeros. Normally, when a System file is copied to + partition on a Macintosh disk, the boot block is filled + with a number of required settings - unfortunately I don't + know the full spec for the boot block, so I'm guessing + that the following will work OK. + + Therefore, the utility _a_p_p_l_e___d_r_i_v_e_r also extracts the boot + block from the first HFS partition it finds on the given + CD-ROM and this is used for the HFS partition created by + mmkkiissooffss. + + PLEASE NOTE + By using a driver from an Apple CD and copying + Apple software to your CD, you become liable to + obey Apple Computer, Inc. Software License Agree- + ments. + +EELL TTOORRIITTOO BBOOOOTT IINNFFOORRMMAATTIIOONN TTAABBLLEE + When the --bboooott--iinnffoo--ttaabbllee option is given, mmkkiissooffss will + modify the boot file specified by the --bb option by insert- + ing a 56-byte "boot information table" at offset 8 in the + file. This modification is done in the source filesystem, + so make sure you use a copy if this file is not easily + recreated! This file contains pointers which may not be + easily or reliably obtained at boot time. + + The format of this table is as follows; all integers are + in section 7.3.1 ("little endian") format. + + Offset Name Size Meaning + 8 bi_pvd 4 bytes LBA of primary volume descriptor + 12 bi_file 4 bytes LBA of boot file + 16 bi_length 4 bytes Boot file length in bytes + 20 bi_csum 4 bytes 32-bit checksum + 24 bi_reserved 40 bytes Reserved + + The 32-bit checksum is the sum of all the 32-bit words in + the boot file starting at byte offset 64. All linear + block addresses (LBAs) are given in CD sectors (normally + 2048 bytes). + +CCOONNFFIIGGUURRAATTIIOONN + mmkkiissooffss looks for the ..mmkkiissooffssrrcc file, first in the cur- + rent working directory, then in the user's home directory, + and then in the directory in which the mmkkiissooffss binary is + stored. This file is assumed to contain a series of lines + of the form TTAAGG==_v_a_l_u_e_, and in this way you can specify + certain options. The case of the tag is not significant. + Some fields in the volume header are not settable on the + command line, but can be altered through this facility. + Comments may be placed in this file, using lines which + start with a hash (#) character. + + AAPPPPII The application identifier should describe the + application that will be on the disc. There is + space on the disc for 128 characters of informa- + tion. May be overridden using the --AA command line + option. + + CCOOPPYY The copyright information, often the name of a file + on the disc containing the copyright notice. There + is space in the disc for 37 characters of informa- + tion. May be overridden using the --ccooppyyrriigghhtt com- + mand line option. + + AABBSSTT The abstract information, often the name of a file + on the disc containing an abstract. There is space + in the disc for 37 characters of information. May + be overridden using the --aabbssttrraacctt command line + option. + + BBIIBBLL The bibliographic information, often the name of a + file on the disc containing a bibliography. There + is space in the disc for 37 characters of informa- + tion. May be overridden using the --bbiilliioo command + line option. + + PPRREEPP This should describe the preparer of the CDROM, + usually with a mailing address and phone number. + There is space on the disc for 128 characters of + information. May be overridden using the --pp com- + mand line option. + + PPUUBBLL This should describe the publisher of the CDROM, + usually with a mailing address and phone number. + There is space on the disc for 128 characters of + information. May be overridden using the --PP com- + mand line option. + + SSYYSSII The System Identifier. There is space on the disc + for 32 characters of information. May be overrid- + den using the --ssyyssiidd command line option. + + VVOOLLII The Volume Identifier. There is space on the disc + for 32 characters of information. May be overrid- + den using the --VV command line option. + + VVOOLLSS The Volume Set Name. There is space on the disc + for 128 characters of information. May be overrid- + den using the --vvoollsseett command line option. + + HHFFSS__TTYYPPEE + The default TYPE for Macintosh files. Must be + exactly 4 characters. May be overridden using the + --hhffss--ttyyppee command line option. + + HHFFSS__CCRREEAATTOORR + The default CREATOR for Macintosh files. Must be + exactly 4 characters. May be overridden using the + --hhffss--ccrreeaattoorr command line option. + + mmkkiissooffss can also be configured at compile time with + defaults for many of these fields. See the file + defaults.h. + + +EEXXAAMMPPLLEESS + To create a vanilla ISO-9660 filesystem image in the file + _c_d_._i_s_o, where the directory _c_d___d_i_r will become the root + directory if the CD, call: + + % mkisofs -o cd.iso cd_dir + + To create a CD with Rock Ridge extensions of the source + directory _c_d___d_i_r: + + % mkisofs -o cd.iso -R cd_dir + + To create a CD with Rock Ridge extensions of the source + directory _c_d___d_i_r where all files have at least read per- + mission and all files are owned by _r_o_o_t, call: + + % mkisofs -o cd.iso -r cd_dir + + To create a HFS hybrid CD with the Joliet and Rock Ridge + extensions of the source directory _c_d___d_i_r: + + % mkisofs -o cd.iso -R -J -hfs cd_dir + + To create a HFS hybrid CD from the source directory _c_d___d_i_r + that contains Netatalk Apple/Unix files: + + % mkisofs -o cd.iso --netatalk cd_dir + + To create a HFS hybrid CD from the source directory + _c_d___d_i_r, giving all files CREATOR and TYPES based on just + their filename extensions listed in the file "mapping".: + + % mkisofs -o cd.iso -map mapping cd_dir + + To create a CD with the 'Apple Extensions to ISO9660', + from the source directories _c_d___d_i_r and _a_n_o_t_h_e_r___d_i_r_. Files + in all the known Apple/Unix format are decoded and any + other files are given CREATOR and TYPE based on their + magic number given in the file "magic": + + % mkisofs -o cd.iso -apple -magic magic -probe \ + cd_dir another_dir + + The following example puts different files on the CD that + all have the name README, but have different contents when + seen as a ISO9660/RockRidge, Joliet or HFS CD. + + Current directory contains: + + % ls -F + README.hfs README.joliet README.unix cd_dir/ + + The following command puts the contents of the directory + _c_d___d_i_r on the CD along with the three README files - but + only one will be seen from each of the three filesystems: + + % mkisofs -o cd.iso -hfs -J -r -graft-points \ + -hide README.hfs -hide README.joliet \ + -hide-joliet README.hfs -hide-joliet README.unix \ + -hide-hfs README.joliet -hide-hfs README.unix \ + README=README.hfs README=README.joliet \ + README=README.unix cd_dir + + i.e. the file README.hfs will be seen as README on the HFS + CD and the other two README files will be hidden. Simi- + larly for the Joliet and ISO9660/RockRidge CD. + + There are probably all sorts of strange results possible + with combinations of the hide options ... + + +AAUUTTHHOORR + mmkkiissooffss is not based on the standard mk*fs tools for unix, + because we must generate a complete copy of an existing + filesystem on a disk in the iso9660 filesystem. The name + mkisofs is probably a bit of a misnomer, since it not only + creates the filesystem, but it also populates it as well. + However, the appropriate tool name for a UNIX tool that + creates populated filesystems - mkproto - is not well + known. + + Eric Youngdale <ericy@gnu.ai.mit.edu> or + <eric@andante.org> wrote the first versions (1993 ... + 1998) of the mkisofs utility. The copyright for old ver- + sions of the mkisofs utility is held by Yggdrasil Comput- + ing, Incorporated. Joerg Schilling wrote the SCSI trans- + port library and it's adaptation layer to mmkkiissooffss and + newer parts (starting from 1999) of the utility, this + makes mmkkiissooffss Copyright (C) 1999, 2000, 2001 Joerg + Schilling. + + HFS hybrid code Copyright (C) James Pearson 1997, 1998, + 1999, 2000, 2001 + libhfs code Copyright (C) 1996, 1997 Robert Leslie + libfile code Copyright (C) Ian F. Darwin 1986, 1987, 1989, + 1990, 1991, 1992, 1994, 1995. + +NNOOTTEESS + MMkkiissooffss may safely be installed suid root. This may be + needed to allow mmkkiissooffss to read the previous session when + creating a multi session image. + + If mmkkiissooffss is creating a filesystem image with Rock Ridge + attributes and the directory nesting level of the source + directory tree is too much for ISO-9660, mmkkiissooffss will do + deep directory relocation. This results in a directory + called RRRR__MMOOVVEEDD in the root directory of the CD. You can- + not avoid this directory. + +BBUUGGSS + +o Any files that have hard links to files not in the + tree being copied to the iso9660 filesystem will + have an incorrect file reference count. + + +o Does not check for SUSP record(s) in "." entry of + the root directory to verify the existence of Rock + Ridge enhancements. + + This problem is present when reading old sessions + while adding data in multi-session mode. + + +o Does not properly read relocated directories in + multi-session mode when adding data. + + Any relocated deep directory is lost if the new + session does not include the deep directory. + + Repeat by: create first session with deep directory + relocation then add new session with a single dir + that differs from the old deep path. + + +o Does not re-use RR_MOVED when doing multi-session + from TRANS.TBL + + +o Does not create whole_name entry for RR_MOVED in + multi-session mode. + + There may be some other ones. Please, report them to the + author. + + +HHFFSS PPRROOBBLLEEMMSS//LLIIMMIITTAATTIIOONNSS + I have had to make several assumptions on how I expect the + modified libhfs routines to work, however there may be + situations that either I haven't thought of, or come + across when these assumptions fail. Therefore I can't + guarantee that mkisofs will work as expected (although I + haven't had a major problem yet). Most of the HFS features + work fine, however, some are not fully tested. These are + marked as _A_l_p_h_a above. + + Although HFS filenames appear to support upper and lower + case letters, the filesystem is case insensitive. i.e. the + filenames "aBc" and "AbC" are the same. If a file is found + in a directory with the same HFS name, then _m_k_i_s_o_f_s will + attempt, where possible, to make a unique name by adding + '_' characters to one of the filenames. + + HFS file/directory names that share the first 31 charac- + ters have _N' (N == decimal number) substituted for the + last few characters to generate unique names. + + Care must be taken when "grafting" Apple/Unix files or + directories (see above for the method and syntax + involved). It is not possible to use a new name for an + Apple/Unix encoded file/directory. e.g. If a Apple/Unix + encoded file called "oldname" is to added to the CD, then + you can not use the command line: + + mkisofs -o output.raw -hfs -graft-points new- + name=oldname cd_dir + + mkisofs will be unable to decode "oldname". However, you + can graft Apple/Unix encoded files or directories as long + as you do not attempt to give them new names as above. + + When creating an HFS volume with the multisession options, + --MM and --CC, only files in the last session will be in the + HFS volume. i.e. mkisofs can not _a_d_d existing files from + previous sessions to the HFS volume. + + However, if each session is created with the --ppaarrtt option, + then each session will appear as separate volumes when + mounted on a Mac. In this case, it is worth using the --VV + or --hhffss--vvoolliidd option to give each session a unique volume + name, otherwise each "volume" will appear on the Desktop + with the same name. + + Symbolic links (as with all other non-regular files) are + not added to the HFS directory. + + Hybrid volumes may be larger than pure ISO9660 volumes + containing the same data. In some cases (e.g. DVD sized + volumes) the hybrid volume may be significantly larger. As + an HFS volume gets bigger, so does the allocation block + size (the smallest amount of space a file can occupy). + For a 650Mb CD, the allocation block is 10Kb, for a 4.7Gb + DVD it will be about 70Kb. + + The maximum number of files in an HFS volume is about + 65500 - although the real limit will be somewhat less than + this. + + The resulting hybrid volume can be accessed on a Unix + machine by using the hfsutils routines. However, no + changes can be made to the volume as it is set as lloocckkeedd.. + The option --hhffss--uunnlloocckk will create an output image that is + unlocked - however no changes should be made to the con- + tents of the volume (unless you really know what you are + doing) as it's not a "real" HFS volume. + + Using the --mmaacc--nnaammee option will not currently work with + the --TT option - the Unix name will be used in the + TRANS.TBL file, not the Macintosh name. + + Although mmkkiissooffss does not alter the contents of a file, if + a binary file has it's TYPE set as 'TEXT', it _m_a_y be read + incorrectly on a Macintosh. Therefore a better choice for + the default TYPE may be '????' + + The --mmaacc--bboooott--ffiillee option may not work at all... + + May not work with PC Exchange v2.2 or higher files (avail- + able with MacOS 8.1). DOS media containing PC Exchange + files should be mounted as type mmssddooss (not vvffaatt) when + using Linux. + + The SFM format is only partially supported - see HHFFSS MMAACC-- + IINNTTOOSSHH FFIILLEE FFOORRMMAATTSS section above. + + It is not possible to use the the --ssppaarrcc--bboooott or --ggeenneerriicc-- + bboooott options with the --bboooott--hhffss--ffiillee or --pprreepp--bboooott + options. + + mmkkiissooffss should be able to create HFS hybrid images over + 4Gb, although this has not been fully tested. + + +SSEEEE AALLSSOO + ccddrreeccoorrdd(1), mmkkzzffttrreeee(1), mmaaggiicc(5), aappppllee__ddrriivveerr(8). + + +FFUUTTUURREE IIMMPPRROOVVEEMMEENNTTSS + Some sort of gui interface. + +AAVVAAIILLAABBIILLIITTYY + mmkkiissooffss is available as part of the cdrecord package from + ftp://ftp.berlios.de/pub/cdrecord/ + + hhffssuuttiillss from ftp://ftp.mars.org/pub/hfs + + mmkkzzffttrreeee is available as part of the zisofs-tools package + from ftp://ftp.kernel.org/pub/linux/utils/fs/zisofs/ + +MMAAIILLIINNGG LLIISSTTSS + If you want to actively take part on the development of + mkisofs, and/or mkhybrid, you may join the cdwriting mail- + ing list by sending mail to: + + other-cdwrite-request@lists.debian.org + + and include the word _s_u_b_s_c_r_i_b_e in the body. The mail + address of the list is: + + cdwrite@lists.debian.org + + +MMAAIINNTTAAIINNEERR + Joerg Schilling + Seestr. 110 + D-13353 Berlin + Germany + +HHFFSS MMKKHHYYBBRRIIDD MMAAIINNTTAAIINNEERR + James Pearson + + j.pearson@ge.ucl.ac.uk + + + If you have support questions, send them to: + + ccddrreeccoorrdd--ssuuppppoorrtt@@bbeerrlliiooss..ddee + or ootthheerr--ccddwwrriittee@@lliissttss..ddeebbiiaann..oorrgg + + Of you definitly found a bug, send a mail to: + + ccddrreeccoorrdd--ddeevveellooppeerrss@@bbeerrlliiooss..ddee + or sscchhiilllliinngg@@ffookkuuss..ffhhgg..ddee + + To subscribe, use: + + hhttttpp::////lliissttss..bbeerrlliiooss..ddee//mmaaiillmmaann//lliissttiinnffoo//ccddrreeccoorrdd--ddeevveelloopp-- + eerrss + or hhttttpp::////lliissttss..bbeerrlliiooss..ddee//mmaaiillmmaann//lliissttiinnffoo//ccddrreeccoorrdd--ssuupp-- + ppoorrtt + + + +Version 2.0 24 Dec 2002 MKISOFS(8) diff --git a/scsilib/doc/mkisofs.ps b/scsilib/doc/mkisofs.ps new file mode 100644 index 0000000..ddd7405 --- /dev/null +++ b/scsilib/doc/mkisofs.ps @@ -0,0 +1,2550 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.17.2 +%%CreationDate: Tue Dec 24 17:04:32 2002 +%%DocumentNeededResources: font Times-Roman +%%+ font Times-Bold +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.17 2 +%%Pages: 24 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.17 2 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 841.89 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron +/Zcaron/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE +/Times-Roman@0 ENC0/Times-Roman RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R/F1 10.95 +/Times-Bold@0 SF -.219(NA)72 84 S(ME).219 E F0(mkisofs \255 create an h) +108 96 Q +(ybrid ISO9660/JOLIET/HFS \214lesystem with optional Rock Ridge attrib) +-.05 E(utes.)-.2 E F1(SYNOPSIS)72 112.8 Q/F2 10/Times-Bold@0 SF(mkisofs) +108 124.8 Q F0([)2.5 E/F3 10/Times-Italic@0 SF(options)2.5 E F0 2.5(][) +2.5 G F2<ad6f>A F3(\214lename)2.5 E F0(])2.5 E F3 +(pathspec [pathspec ...])2.5 E F1(DESCRIPTION)72 141.6 Q F2(mkisofs)108 +153.6 Q F0(is ef)2.5 E(fecti)-.25 E -.15(ve)-.25 G +(ly a pre-mastering program to generate an ISO9660/JOLIET/HFS h).15 E +(ybrid \214lesystem.)-.05 E F2(mkisofs)108 170.4 Q F0 .18 +(is capable of generating the)2.68 F F2 .18(System Use Sharing Pr)2.68 F +.18(otocol r)-.18 F .18(ecords \(SUSP\))-.18 F F0 .18 +(speci\214ed by the)2.68 F F2(Rock)2.68 E .581(Ridge Inter)108 182.4 R +.581(change Pr)-.18 F(otocol.)-.18 E F0 .582(This is used to further de\ +scribe the \214les in the iso9660 \214lesystem to a unix)5.581 F .594 +(host, and pro)108 194.4 R .593(vides information such as longer \214le\ +names, uid/gid, posix permissions, symbolic links, block)-.15 F +(and character de)108 206.4 Q(vices.)-.25 E .472(If Joliet or HFS h)108 +223.2 R .472(ybrid command line options are speci\214ed,)-.05 F F2 +(mkisofs)2.972 E F0 .472(will create additional \214lesystem meta)2.972 +F .044(data for Joliet or HFS.)108 235.2 R .043(The \214le content in t\ +his case refers to the same data blocks on the media.)5.043 F .043 +(It will gen-)5.043 F +(erate a pure ISO9660 \214lesystem unless the Joliet or HFS h)108 247.2 +Q(ybrid command line options are gi)-.05 E -.15(ve)-.25 G(n.).15 E F2 +(mkisofs)108 264 Q F0 .45(can generate a)2.95 F F3(true)2.95 E F0(\(or) +2.95 E F3(shar)2.95 E(ed)-.37 E F0 2.95(\)H).77 G .45(FS h)-2.95 F .45 +(ybrid \214lesystem. The same \214les are seen as HFS \214les when)-.05 +F .126(accessed from a Macintosh and as ISO9660 \214les when accessed f\ +rom other machines. HFS stands for)108 276 R F3(Hier)2.625 E(-)-.2 E(ar) +108 288 Q -.15(ch)-.37 G(ical F).15 E(ile System)-.45 E F0 +(and is the nati)2.5 E .3 -.15(ve \214)-.25 H +(le system used on Macintosh computers.).15 E 1.046(As an alternati)108 +304.8 R -.15(ve)-.25 G(,).15 E F2(mkisofs)3.546 E F0 1.046 +(can generate the)3.546 F F3 1.046(Apple Extensions to ISO9660)3.546 F +F0 1.046(for each \214le. These e)3.546 F(xtensions)-.15 E(pro)108 316.8 +Q .882(vide each \214le with CREA)-.15 F -.18(TO)-1.11 G .882 +(R, TYPE and certain Finder Flags when accessed from a Macintosh. See) +.18 F(the)108 328.8 Q F2(HFS MA)2.5 E(CINT)-.55 E(OSH FILE FORMA)-.18 E +(TS)-.95 E F0(section belo)2.5 E -.65(w.)-.25 G F2(mkisofs)108 345.6 Q +F0(tak)3.077 E .577(es a snapshot of a gi)-.1 F -.15(ve)-.25 G 3.077(nd) +.15 G .577 +(irectory tree, and generates a binary image which will correspond to) +-3.077 F(an ISO9660 or HFS \214lesystem when written to a block de)108 +357.6 Q(vice.)-.25 E .736 +(Each \214le written to the iso9660 \214lesystem must ha)108 374.4 R +1.036 -.15(ve a \214)-.2 H .735 +(lename in the 8.3 format \(8 characters, period, 3).15 F .262 +(characters, all upper case\), e)108 386.4 R -.15(ve)-.25 G 2.762(ni).15 +G 2.762(fR)-2.762 G .262(ock Ridge is in use.)-2.762 F .263 +(This \214lename is used on systems that are not able)5.263 F .268 +(to mak)108 398.4 R 2.768(eu)-.1 G .268(se of the Rock Ridge e)-2.768 F +.268(xtensions \(such as MS-DOS\), and each \214lename in each director\ +y must be)-.15 F(dif)108 410.4 Q .533 +(ferent from the other \214lenames in the same directory)-.25 F(.)-.65 E +F2(mkisofs)5.534 E F0 .534(generally tries to form correct names by) +3.034 F .165(forcing the unix \214lename to upper case and truncating a\ +s required, b)108 422.4 R .165(ut often times this yields unsatisf)-.2 F +(actory)-.1 E .685(results when there are cases where the truncated nam\ +es are not all unique.)108 434.4 R F2(mkisofs)5.686 E F0 .686 +(assigns weightings to)3.186 F .567(each \214lename, and if tw)108 446.4 +R 3.067(on)-.1 G .567 +(ames that are otherwise the same are found the name with the lo)-3.067 +F .566(wer priority is)-.25 F 1.44(renamed to ha)108 458.4 R 1.74 -.15 +(ve a 3 d)-.2 H 1.44(igit number as an e).15 F 1.44 +(xtension \(where the number is guaranteed to be unique\).)-.15 F(An) +6.44 E -.15(ex)108 470.4 S 2.528(ample of this w).15 F 2.528 +(ould be the \214les foo.bar and foo.bar)-.1 F 2.528 +(.~1~ - the \214le foo.bar)-.55 F 2.527(.~1~ w)-.55 F 2.527 +(ould be written as)-.1 F(FOO000.B)108 482.4 Q +(AR;1 and the \214le foo.bar w)-.35 E(ould be written as FOO.B)-.1 E +(AR;1)-.35 E 2.242(When used with v)108 499.2 R 2.242 +(arious HFS options,)-.25 F F2(mkisofs)4.742 E F0 2.243 +(will attempt to recognise \214les stored in a number of)4.742 F .804 +(Apple/Unix \214le formats and will cop)108 511.2 R 3.304(yt)-.1 G .804 +(he data and resource forks as well as an)-3.304 F 3.304(yr)-.15 G(ele) +-3.304 E -.25(va)-.25 G .804(nt \214nder informa-).25 F .777 +(tion. See the)108 523.2 R F2 .778(HFS MA)3.278 F(CINT)-.55 E .778 +(OSH FILE FORMA)-.18 F(TS)-.95 E F0 .778(section belo)3.278 F 3.278(wf) +-.25 G .778(or more about formats)-3.278 F F2(mkisofs)3.278 E F0(sup-) +3.278 E(ports.)108 535.2 Q .704(Note that)108 552 R F2(mkisofs)3.204 E +F0 .703(is not designed to communicate with the writer directly)3.204 F +5.703(.M)-.65 G .703(ost writers ha)-5.703 F 1.003 -.15(ve p)-.2 H +(roprietary).15 E 1.028(command sets which v)108 564 R 1.028 +(ary from one manuf)-.25 F 1.028(acturer to another)-.1 F 3.528(,a)-.4 G +1.028(nd you need a specialized tool to actually)-3.528 F -.2(bu)108 576 +S(rn the disk.).2 E(The)108 592.8 Q F2(cdr)2.988 E(ecord)-.18 E F0 .488 +(utility is a utility capable of b)2.988 F .488(urning an actual disc.) +-.2 F .488(The latest v)5.488 F .487(ersion of)-.15 F F2(cdr)2.987 E +(ecord)-.18 E F0 .487(is a)2.987 F -.25(va)-.2 G(il-).25 E +(able from ftp://ftp.berlios.de/pub/cdrecord)108 604.8 Q .344 +(Also you should kno)108 621.6 R 2.844(wt)-.25 G .344 +(hat most cd writers are v)-2.844 F .344(ery particular about timing.) +-.15 F .344(Once you start to b)5.344 F .345(urn a disc,)-.2 F .861 +(you cannot let their b)108 633.6 R(uf)-.2 E .86 +(fer empty before you are done, or you will end up with a corrupt disc.) +-.25 F .86(Thus it is)5.86 F .825(critical that you be able to maintain\ + an uninterrupted data stream to the writer for the entire time that th\ +e)108 645.6 R(disc is being written.)108 657.6 Q F2(pathspec)108 674.4 Q +F0 .761(is the path of the directory tree to be copied into the iso9660\ + \214lesystem.)3.262 F .761(Multiple paths can be)5.761 F .262 +(speci\214ed, and)108 686.4 R F2(mkisofs)2.762 E F0 .262(will mer)2.762 +F .262(ge the \214les found in all of the speci\214ed path components t\ +o form the cdrom)-.18 F(image.)108 698.4 Q .695(If the option)108 715.2 +R F3(\255gr)3.195 E(aft-points)-.15 E F0 .695(has been speci\214ed, it \ +is possible to graft the paths at points other than the root)3.195 F +(directory)108 727.2 Q 2.587(,a)-.65 G .087(nd it is possible to graft \ +\214les or directories onto the cdrom image with names dif)-2.587 F .088 +(ferent than what)-.25 F -1.11(Ve)72 768 S(rsion 2.0)1.11 E(24 Dec 2002) +162.9 E(1)203.45 E EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R(the)108 +84 Q 3.406(yh)-.15 G -2.25 -.2(av e)-3.406 H .906 +(in the source \214lesystem.)3.606 F .905 +(This is easiest to illustrate with a couple of e)5.906 F 5.905 +(xamples. Let')-.15 F 3.405(ss)-.55 G .905(tart by)-3.405 F +(assuming that a local \214le ../old.lis e)108 96 Q +(xists, and you wish to include it in the cdrom image.)-.15 E +(foo/bar/=../old.lis)144 132 Q(will include the \214le old.lis in the c\ +drom image at /foo/bar/old.lis, while)108 156 Q(foo/bar/xxx=../old.lis) +144 180 Q .692 +(will include the \214le old.lis in the cdrom image at /foo/bar/xxx.)108 +204 R .692(The same sort of syntax can be used with)5.692 F 1.711 +(directories as well.)108 216 R/F1 10/Times-Bold@0 SF(mkisofs)6.711 E F0 +1.711(will create an)4.211 F 4.211(yd)-.15 G 1.71 +(irectories required such that the graft points e)-4.211 F 1.71 +(xist on the)-.15 F .186(cdrom image - the directories do not need to a\ +ppear in one of the paths.)108 228 R .187(By def)5.187 F .187(ault, an) +-.1 F 2.687(yd)-.15 G .187(irectories that are)-2.687 F 1.635 +(created on the \215y lik)108 240 R 4.135(et)-.1 G 1.635(his will ha) +-4.135 F 1.935 -.15(ve p)-.2 H 1.634(ermissions 0555 and appear to be o) +.15 F 1.634(wned by the person running)-.25 F 3.983(mkisofs. If)108 252 +R 1.483(you wish other permissions or o)3.983 F 1.484 +(wners of the intermediate directories, see \255uid, \255gid, \255dir) +-.25 F(-)-.2 E(mode, \255\214le-mode and \255ne)108 264 Q(w-dir)-.25 E +(-mode.)-.2 E F1(mkisofs)108 280.8 Q F0 1.965(will also run on W)4.465 F +1.965(in9X/NT4 machines when compiled with Cygnus' c)-.4 F 1.964 +(ygwin \(a)-.15 F -.25(va)-.2 G 1.964(ilable from).25 F(http://source) +108 292.8 Q -.1(wa)-.25 G(re.c).1 E(ygnus.com/c)-.15 E 3.229 +(ygwin/\). Therefore most references in this man page to)-.15 F/F2 10 +/Times-Italic@0 SF(Unix)5.729 E F0 3.23(can be)5.729 F(replaced with)108 +304.8 Q F2 -.55(Wi)2.5 G(n32).55 E F0(.).02 E/F3 10.95/Times-Bold@0 SF +(OPTIONS)72 333.6 Q F1(\255abstract)108 345.6 Q F2(FILE)2.5 E F0 2.453 +(Speci\214es the abstract \214le name.)144 357.6 R 2.453 +(This parameter can also be set in the \214le)7.453 F F1(.mkisofsr)4.952 +E(c)-.18 E F0(with)4.952 E 2.5(ABST=\214lename. If)144 369.6 R +(speci\214ed in both places, the command line v)2.5 E(ersion is used.) +-.15 E F1<ad41>108 386.4 Q F2(application_id)2.5 E F0 .468 +(Speci\214es a te)144 398.4 R .468 +(xt string that will be written into the v)-.15 F .468(olume header)-.2 +F 5.468(.T)-.55 G .468(his should describe the appli-)-5.468 F .399 +(cation that will be on the disc.)144 410.4 R .399 +(There is space on the disc for 128 characters of information.)5.399 F +(This)5.398 E .019(parameter can also be set in the \214le)144 422.4 R +F1(.mkisofsr)2.519 E(c)-.18 E F0 .019(with APPI=id.)2.519 F .019 +(If speci\214ed in both places, the com-)5.019 F(mand line v)144 434.4 Q +(ersion is used.)-.15 E F1(\255allo)108 451.2 Q(w-lo)-.1 E(wer)-.1 E +(case)-.18 E F0(This options allo)144 463.2 Q(ws lo)-.25 E +(wer case characters to appear in iso9660 \214lenames.)-.25 E +(This violates the ISO9660 standard, b)144 475.2 Q(ut it happens to w) +-.2 E(ork on some systems.)-.1 E(Use with caution.)5 E F1(\255allo)108 +492 Q(w-multidot)-.1 E F0 1.989(This options allo)144 504 R 1.989 +(ws more than one dot to appear in iso9660 \214lenames.)-.25 F 4.488(Al) +6.989 G 1.988(eading dot is not)-4.488 F(af)144 516 Q +(fected by this option, it may be allo)-.25 E(wed separately using the) +-.25 E F1<ad4c>2.5 E F0(option.)2.5 E +(This violates the ISO9660 standard, b)144 528 Q(ut it happens to w)-.2 +E(ork on man)-.1 E 2.5(ys)-.15 G 2.5(ystems. Use)-2.5 F(with caution.) +2.5 E F1(\255biblio)108 544.8 Q F2(FILE)2.5 E F0 .97 +(Speci\214es the bibliographic \214le name.)144 556.8 R .971 +(This parameter can also be set in the \214le)5.97 F F1(.mkisofsr)3.471 +E(c)-.18 E F0(with)3.471 E 2.5(BIBLO=\214lename. If)144 568.8 R +(speci\214ed in both places, the command line v)2.5 E(ersion is used.) +-.15 E F1(\255cache-inodes)108 585.6 Q F0 .083(Cache inode and de)144 +597.6 R .082(vice numbers to \214nd hard links to \214les.)-.25 F(If) +5.082 E F1(mkisofs)2.582 E F0 .082(\214nds a hard link \(a \214le with) +2.582 F 1.003(multiple names\), then the \214le will only appear once o\ +n the CD. This helps to sa)144 609.6 R 1.304 -.15(ve s)-.2 H 1.004 +(pace on the).15 F 4.359(CD. The)144 621.6 R(option)4.359 E F1 +(\255cache-inodes)4.359 E F0 1.859(is def)4.359 F 1.858 +(ault on UNIX lik)-.1 F 4.358(eo)-.1 G 1.858(perating systems.)-4.358 F +1.858(Be careful when)6.858 F .305(using this option on a \214lesystem \ +without unique inode numbers as it may result in \214les containing)144 +633.6 R(the wrong content on CD.)144 645.6 Q F1(\255no-cache-inodes)108 +662.4 Q F0 1.059(Do not cache inode and de)144 674.4 R 1.059 +(vice numbers.)-.25 F 1.059(This option is needed whene)6.059 F -.15(ve) +-.25 G 3.558(ra\214).15 G 1.058(lesystem does not)-3.558 F(ha)144 686.4 +Q .954 -.15(ve u)-.2 H .654(nique inode numbers. It is the def).15 F +.655(ault on)-.1 F F1(Cygwin)3.155 E F0 5.655(.A)C 3.155(st)-5.655 G +.655(he Microsoft operating system that)-3.155 F .146(runs belo)144 +698.4 R(w)-.25 E F1(Cygwin)2.646 E F0 .145 +(is not POSIX compliant, it does not ha)2.646 F .445 -.15(ve u)-.2 H +.145(nique inode numbers.).15 F .145(Cygwin cre-)5.145 F .502(ates f)144 +710.4 R(ak)-.1 E 3.002(ei)-.1 G .502 +(node numbers from a hash algorithm that is not 100% correct.)-3.002 F +(If)5.503 E F1(mkisofs)3.003 E F0 -.1(wo)3.003 G .503(uld cache).1 F +.627(inodes on Cygwin, it w)144 722.4 R .626(ould belie)-.1 F .926 -.15 +(ve t)-.25 H .626(hat some \214les are identical although the).15 F +3.126(ya)-.15 G .626(re not. The result)-3.126 F -1.11(Ve)72 768 S +(rsion 2.0)1.11 E(24 Dec 2002)162.9 E(2)203.45 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R 1.362(i\ +n this case are \214les that contain the wrong content if a signi\214ca\ +nt amount of dif)144 84 R 1.363(ferent \214les \(>)-.25 F 1.466 +(~5000\) is in inside the tree that is to be archi)144 96 R -.15(ve)-.25 +G 3.966(d. This).15 F 1.466(does not happen when the)3.966 F/F1 10 +/Times-Bold@0 SF(\255no-cache-)3.965 E 1.115(inodes is used, b)144 108 R +1.115(ut the disadv)-.2 F 1.116(antage is that mkisofs)-.1 F F0 1.116 +(cannot detect hardlinks an)3.616 F 1.116(ymore and the)-.15 F +(resulting CD image may be lar)144 120 Q(ger than e)-.18 E(xpected.)-.15 +E F1<ad62>108 136.8 Q/F2 10/Times-Italic@0 SF(eltorito_boot_ima)2.5 E +-.1(ge)-.1 G F0 .233(Speci\214es the path and \214lename of the boot im\ +age to be used when making an "El T)144 148.8 R .232(orito" bootable)-.8 +F 2.317(CD. The pathname must be relati)144 160.8 R 2.617 -.15(ve t)-.25 +H 4.817(ot).15 G 2.317(he source path speci\214ed to)-4.817 F F1 +(mkisofs.)4.818 E F0 2.318(This option is)7.318 F .313(required to mak) +144 172.8 R 2.813(ea)-.1 G 2.813(n")-2.813 G .312(El T)-2.813 F .312 +(orito" bootable CD.)-.8 F .312(The boot image must be e)5.312 F .312 +(xactly the size of either a)-.15 F .43 +(1200, 1440, or a 2880 kB \215opp)144 184.8 R 1.73 -.65(y, a)-.1 H(nd) +.65 E F1(mkisofs)2.931 E F0 .431 +(will use this size when creating the output iso9660)2.931 F 1.06(\214l\ +esystem. It is assumed that the \214rst 512 byte sector should be read \ +from the boot image \(it is)144 196.8 R .701 +(essentially emulating a normal \215opp)144 208.8 R 3.202(yd)-.1 G(ri) +-3.202 E -.15(ve)-.25 G 3.202(\). This).15 F .702(will w)3.202 F .702 +(ork, for e)-.1 F .702(xample, if the boot image is a)-.15 F +(LILO based boot \215opp)144 220.8 Q -.65(y.)-.1 G .181 +(If the boot image is not an image of a \215opp)144 244.8 R 1.481 -.65 +(y, y)-.1 H .181(ou need to add one of the options:).65 F F1 +(-hard-disk-boot)2.681 E F0(or)144 256.8 Q F1(-no-emul-boot)2.5 E F0 5 +(.I)C 2.5(ft)-5 G(he system should not boot of)-2.5 E 2.5(ft)-.25 G +(he emulated disk, use)-2.5 E F1(-no-boot)2.5 E F0(.)A F1 +(\255eltorito-alt-boot)108 273.6 Q F0 .605(Start with a ne)144 285.6 R +3.105(ws)-.25 G .605(et of "El T)-3.105 F .605(orito" boot parameters.) +-.8 F .605(This allo)5.605 F .605(ws to ha)-.25 F .905 -.15(ve m)-.2 H +.605(ore than one El T).15 F(orito)-.8 E(boot on a CD.)144 297.6 Q 2.5 +(Am)5 G(aximum of 63 El T)-2.5 E +(orito boot entries may be put on a single CD.)-.8 E F1<ad42>108 314.4 Q +F2(img_sun4,img_sun4c,img_sun4m,img_sun4d,img_sun4e)2.5 E F0 .511(Speci\ +\214es a comma separated list of boot images that are needed to mak)144 +326.4 R 3.01(eab)-.1 G .51(ootable CD for sparc)-3.01 F 2.848 +(systems. There)144 338.4 R .349 +(may be empty \214elds in the comma separated list.)2.848 F .349 +(This option is required to mak)5.349 F(e)-.1 E 2.588(ab)144 350.4 S +.088(ootable CD for Sun sparc systems.)-2.588 F .088(If the)5.088 F F1 +<ad42>2.588 E F0(or)2.588 E F1(\255spar)2.588 E(c-boot)-.18 E F0 .087 +(option has been speci\214ed, the \214rst)2.587 F .443(sector of the re\ +sulting image will contain a Sun disk label. This disk label speci\214e\ +s slice 0 for the)144 362.4 R .262(iso9660 image and slice 1 .)144 374.4 +R -3.07 1.666(.. s)1.666 H .262(lice 7 for the boot images that ha) +-1.666 F .562 -.15(ve b)-.2 H .262(een speci\214ed with this option.).15 +F .965(Byte of)144 386.4 R .965(fset 512 .)-.25 F -2.367 1.666(.. 8) +1.666 H .966(191 within each of the additional boot images must contain\ + a primary boot)-1.666 F .747(that w)144 398.4 R .747(orks for the appr\ +opriate sparc architecture. The rest of each of the images usually cont\ +ains)-.1 F(an ufs \214lesystem that is used primary k)144 410.4 Q +(ernel boot stage.)-.1 E .769(The implemented boot method is the boot m\ +ethod found with SunOS 4.x and SunOS 5.x.)144 434.4 R(Ho)5.769 E(w-)-.25 +E -2.15 -.25(ev e)144 446.4 T 1.795 -.4(r, i).25 H 3.495(td).4 G .994 +(oes not depend on SunOS internals b)-3.495 F .994 +(ut only on properties of the Open Boot prom. F)-.2 F(or)-.15 E +(this reason, it should be usable for an)144 458.4 Q 2.5(yO)-.15 G 2.5 +(St)-2.5 G(hat boots of)-2.5 E 2.5(fas)-.25 G(parc system.)-2.5 E .958 +(If the special \214lename)144 482.4 R F1(...)3.459 E F0 .959 +(is used, the actual and all follo)5.959 F .959 +(wing boot partitions are mapped to the)-.25 F(pre)144 494.4 Q .307 +(vious partition. If)-.25 F F1(mkisofs)2.807 E F0 .307(is called with) +2.807 F F1<ad47>2.807 E F2(ima)2.817 E -.1(ge)-.1 G F1<ad42>3.086 E F2 +(...)3.036 E F0 .306(all boot partitions are mapped to the)5.306 F .717 +(partition that contains the iso9660 \214lesystem image and the generic\ + boot image that is located in)144 506.4 R +(the \214rst 16 sectors of the disk is used for all architectures.)144 +518.4 Q F1<ad47>108 535.2 Q F2 -.1(ge)2.5 G(neric_boot_ima).1 E -.1(ge) +-.1 G F0 1.768(Speci\214es the path and \214lename of the generic boot \ +image to be used when making a generic)144 547.2 R .43(bootable CD.)144 +559.2 R(The)5.43 E F1(generic_boot_image)2.93 E F0 .43 +(will be placed on the \214rst 16 sectors of the CD. The \214rst)2.93 F +1.067(16 sectors are the sectors that are located before the iso9660 pr\ +imary v)144 571.2 R 1.066(olume descriptor)-.2 F 6.066(.I)-.55 G 3.566 +(ft)-6.066 G(his)-3.566 E .726(option is used together with the)144 +583.2 R F1(\255spar)3.226 E(c-boot)-.18 E F0 .726 +(option, the Sun disk label will o)3.226 F -.15(ve)-.15 G .727 +(rlay the \214rst 512).15 F(bytes of the generic boot image.)144 595.2 Q +F1(\255hard-disk-boot)108 612 Q F0 .968 +(Speci\214es that the boot image used to create "El T)144 624 R .968 +(orito" bootable CDs is a hard disk image. The)-.8 F +(hard disk image must be)144 636 Q +(gin with a master boot record that contains a single partition.)-.15 E +F1(\255no-emul-boot)108 652.8 Q F0 .768 +(Speci\214es that the boot image used to create "El T)144 664.8 R .768 +(orito" bootable CDs is a 'no emulation' image.)-.8 F +(The system will load and e)144 676.8 Q -.15(xe)-.15 G +(cute this image without performing an).15 E 2.5(yd)-.15 G +(isk emulation.)-2.5 E F1(\255no-boot)108 693.6 Q F0 .567 +(Speci\214es that the created "El T)144 705.6 R .566 +(orito" CD should be mark)-.8 F .566 +(ed as not bootable. The system will pro-)-.1 F(vide an emulated dri)144 +717.6 Q .3 -.15(ve f)-.25 H(or the image, b).15 E(ut will boot of)-.2 E +2.5(fas)-.25 G(tandard boot de)-2.5 E(vice.)-.25 E -1.11(Ve)72 768 S +(rsion 2.0)1.11 E(24 Dec 2002)162.9 E(3)203.45 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R/F1 10 +/Times-Bold@0 SF(\255boot-load-seg)108 84 Q/F2 10/Times-Italic@0 SF(se) +2.5 E(gment_addr)-.4 E(ess)-.37 E F0(Speci\214es the load se)144 96 Q +(gment address of the boot image for no-emulation "El T)-.15 E +(orito" CDs.)-.8 E F1(\255boot-load-size)108 112.8 Q F2(load_sector)2.5 +E(s)-.1 E F0 .451(Speci\214es the number of "virtual" \(512-byte\) sect\ +ors to load in no-emulation mode.)144 124.8 R .452(The def)5.452 F .452 +(ault is)-.1 F(to load the entire boot \214le.)144 136.8 Q +(Some BIOSes may ha)5 E .3 -.15(ve p)-.2 H +(roblems if this is not a multiple of 4.).15 E F1(\255boot-inf)108 153.6 +Q(o-table)-.25 E F0 .418 +(Speci\214es that a 56-byte table with information of the CD-R)144 165.6 +R .418(OM layout will be patched in at of)-.4 F(fset)-.25 E 2.658(8i)144 +177.6 S 2.658(nt)-2.658 G .158(he boot \214le.)-2.658 F .158 +(If this option is gi)5.158 F -.15(ve)-.25 G .158 +(n, the boot \214le is modi\214ed in the source \214lesystem, so mak).15 +F(e)-.1 E .323(sure to mak)144 189.6 R 2.823(eac)-.1 G(op)-2.823 E 2.823 +(yi)-.1 G 2.823(ft)-2.823 G .322(his \214le cannot be easily re)-2.823 F +2.822(generated! See)-.15 F(the)2.822 E F1 .322(EL T)2.822 F(ORIT)-.18 E +2.822(OB)-.18 G(OO)-2.822 E 2.822(TI)-.4 G(NFO)-2.822 E -.9(TA)144 201.6 +S(BLE).9 E F0(section for a description of this table.)2.5 E F1<ad43>108 +218.4 Q F2(last_sess_start,ne)2.5 E(xt_sess_start)-.2 E F0 .499 +(This option is needed when)144 230.4 R F1(mkisofs)2.999 E F0 .499 +(is used to create a CDe)2.999 F .5 +(xtra or the image of a second session)-.15 F .065(or a higher le)144 +242.4 R -.15(ve)-.25 G 2.565(ls).15 G .065 +(ession for a multi session disk.)-2.565 F .065(The option)5.065 F F1 +<ad43>2.565 E F0(tak)2.565 E .064(es a pair of tw)-.1 F 2.564(on)-.1 G +.064(umbers sepa-)-2.564 F .066(rated by a comma. The \214rst number is\ + the sector number of the \214rst sector in the last session of the)144 +254.4 R .29(disk that should be appended to.)144 266.4 R .289 +(The second number is the starting sector number of the ne)5.29 F 2.789 +(ws)-.25 G(es-)-2.789 E 3.235(sion. The)144 278.4 R -.15(ex)3.235 G .735 +(pected pair of numbers may be retrie).15 F -.15(ve)-.25 G 3.236(db).15 +G 3.236(yc)-3.236 G(alling)-3.236 E F1(cdr)3.236 E .736(ecord \255msinf) +-.18 F 3.236(o.)-.25 G(..)-3.236 E F0 .736(If the)5.736 F F1<ad43>3.236 +E F0 .87(option is used in conjunction with the)144 290.4 R F1<ad4d>3.37 +E F0(option,)3.37 E F1(mkisofs)3.37 E F0 .87 +(will create a \214lesystem image that is)3.37 F 1.087 +(intended to be a continuation of the pre)144 302.4 R 1.088 +(vious session.)-.25 F 1.088(If the)6.088 F F1<ad43>3.588 E F0 1.088 +(option is used without the)3.588 F F1<ad4d>3.588 E F0(option,)144 314.4 +Q F1(mkisofs)2.635 E F0 .135(will create a \214lesystem image that is i\ +ntended to be used for a second session on a)2.635 F(CDe)144 326.4 Q +1.735(xtra. This is a multi session CD that holds audio data in the \ +\214rst session and a ISO9660)-.15 F +(\214lesystem in the second session.)144 338.4 Q F1<ad63>108 355.2 Q F2 +(boot_catalo)2.5 E(g)-.1 E F0 2.279(Speci\214es the path and \214lename\ + of the boot catalog to be used when making an "El T)144 367.2 R(orito") +-.8 E .466(bootable CD. The pathname must be relati)144 379.2 R .766 +-.15(ve t)-.25 H 2.966(ot).15 G .466(he source path speci\214ed to) +-2.966 F F1(mkisofs.)2.966 E F0 .466(This option)5.466 F .105 +(is required to mak)144 391.2 R 2.605(ea)-.1 G .104(bootable CD.)-.001 F +.104 +(This \214le will be inserted into the output tree and not created in) +5.104 F .347(the source \214lesystem, so be sure the speci\214ed \214le\ +name does not con\215ict with an e)144 403.2 R .347 +(xisting \214le, as it)-.15 F(will be e)144 415.2 Q +(xcluded. Usually a name lik)-.15 E 2.5(e")-.1 G +(boot.catalog" is chosen.)-2.5 E F1(\255check-oldnames)108 432 Q F0 +1.212(Check all \214lenames imported from old session for compliance wi\ +th actual)144 444 R F1(mkisofs)3.711 E F0 1.211(iso9660 \214le)3.711 F +.172(naming rules.)144 456 R .173 +(It his option is not present, only names with a length > 31 are check) +5.172 F .173(ed as these \214les)-.1 F +(are a hard violation of the iso9660 standard.)144 468 Q F1 +(\255check-session)108 484.8 Q F2(FILE)2.5 E F0 1.161 +(Check all old sessions for compliance with actual)144 496.8 R F1 +(mkisofs)3.661 E F0 1.16(iso9660 \214le naming rules.)3.661 F 1.16 +(This is a)6.16 F .191(high le)144 508.8 R -.15(ve)-.25 G 2.691(lo).15 G +.192(ption that is a combination of the options:)-2.691 F F1<ad4d>2.692 +E F2(FILE)2.692 E F1 .192(\255C 0,0 \255check-oldnames)2.692 F F0 -.15 +(Fo)2.692 G 2.692(rt).15 G(he)-2.692 E(parameter)144 520.8 Q F2(FILE)2.5 +E F0(see description of)2.5 E F1<ad4d>2.5 E F0(option.)2.5 E F1 +(\255copyright)108 537.6 Q F2(FILE)2.5 E F0 1.829(Speci\214es the Cop) +144 549.6 R 1.829(yright \214le name.)-.1 F 1.829 +(This parameter can also be set in the \214le)6.829 F F1(.mkisofsr)4.328 +E(c)-.18 E F0(with)4.328 E 2.5(COPY=\214lename. If)144 561.6 R +(speci\214ed in both places, the command line v)2.5 E(ersion is used.) +-.15 E F1<ad64>108 578.4 Q F0 +(Omit trailing period from \214les that do not ha)24.74 E .3 -.15 +(ve a p)-.2 H(eriod.).15 E(This violates the ISO9660 standard, b)144 +590.4 Q(ut it happens to w)-.2 E(ork on man)-.1 E 2.5(ys)-.15 G 2.5 +(ystems. Use)-2.5 F(with caution.)2.5 E F1<ad44>108 607.2 Q F0(Do not u\ +se deep directory relocation, and instead just pack them in the w)23.08 +E(ay we see them.)-.1 E(This violates the ISO9660 standard, b)144 619.2 +Q(ut it happens to w)-.2 E(ork on man)-.1 E 2.5(ys)-.15 G 2.5 +(ystems. Use)-2.5 F(with caution.)2.5 E F1(\255dir)108 636 Q(-mode)-.37 +E F2(mode)2.5 E F0(Ov)144 648 Q .606 +(errides the mode of directories used to create the image to)-.15 F F2 +(mode)3.106 E F0 5.606(.S).18 G .606(pecifying this option auto-)-5.606 +F(matically enables Rock Ridge e)144 660 Q(xtensions.)-.15 E F1 +(\255dvd-video)108 676.8 Q F0 .396(Generate D)144 688.8 R(VD-V)-.4 E +.396(ideo compliant UDF \214le system. This is done by sorting the orde\ +r of the content)-.6 F(of the appropriate \214les and by adding padding\ + between the \214les if needed.)144 700.8 Q F1<ad66>108 717.6 Q F0 -.15 +(Fo)26.97 G(llo).15 E 3.333(ws)-.25 G .833 +(ymbolic links when generating the \214lesystem.)-3.333 F .834 +(When this option is not in use, symbolic)5.834 F(links will be entered\ + using Rock Ridge if enabled, otherwise the \214le will be ignored.)144 +729.6 Q -1.11(Ve)72 768 S(rsion 2.0)1.11 E(24 Dec 2002)162.9 E(4)203.45 +E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R/F1 10 +/Times-Bold@0 SF(\255\214le-mode)108 84 Q/F2 10/Times-Italic@0 SF(mode) +2.5 E F0(Ov)144 96 Q .248(errides the mode of re)-.15 F .248 +(gular \214les used to create the image to)-.15 F F2(mode)2.747 E F0 +5.247(.S).18 G .247(pecifying this option auto-)-5.247 F +(matically enables Rock Ridge e)144 108 Q(xtensions.)-.15 E F1(\255gid) +108 124.8 Q F2(gid)2.5 E F0(Ov)144 136.8 Q .632 +(errides the gid read from the source \214les to the v)-.15 F .633 +(alue of)-.25 F F2(gid)3.133 E F0 5.633(.S).77 G .633 +(pecifying this option automati-)-5.633 F(cally enables Rock Ridge e)144 +148.8 Q(xtensions.)-.15 E F1(\255gui)108 165.6 Q F0 .147 +(Switch the beha)16.96 F .147(viour for a GUI. This currently mak)-.2 F +.147(es the output more v)-.1 F .147(erbose b)-.15 F .147(ut may ha)-.2 +F .446 -.15(ve o)-.2 H(ther).15 E(ef)144 177.6 Q(fects in future.)-.25 E +F1(\255graft-points)108 194.4 Q F0(Allo)144 206.4 Q 3.318(wt)-.25 G +3.318(ou)-3.318 G .818(se graft points for \214lenames. If this option \ +is used, all \214lenames are check)-3.318 F .819(ed for graft)-.1 F +1.084(points. The \214lename is di)144 218.4 R 1.084(vided at the \214r\ +st unescaped equal sign. All occurrences of '\\\\' and '=')-.25 F +(characters must be escaped with '\\\\' if)144 230.4 Q F2(\255gr)2.5 E +(aft-points)-.15 E F0(has been speci\214ed.)2.5 E F1(\255hide)108 247.2 +Q F2(glob)2.5 E F0(Hide)144 259.2 Q F2(glob)3.613 E F0 1.113 +(from being seen on the ISO9660 or Rock Ridge directory)3.613 F(.)-.65 E +F2(glob)6.113 E F0 1.114(is a shell wild-card-)3.613 F .642 +(style pattern that must match an)144 271.2 R 3.142(yp)-.15 G .642 +(art of the \214lename or path.)-3.142 F .641 +(Multiple globs may be hidden.)5.642 F(If)5.641 E F2(glob)144 283.2 Q F0 +.885(matches a directory)3.385 F 3.385(,t)-.65 G .885 +(hen the contents of that directory will be hidden.)-3.385 F .886 +(In order to match a)5.886 F .82(directory name, mak)144 295.2 R 3.32 +(es)-.1 G .819 +(ure the pathname does not include a trailing '/' character)-3.32 F +5.819(.A)-.55 G .819(ll the hidden)-5.819 F .213 +(\214les will still be written to the output CD image \214le.)144 307.2 +R .213(Should be used with the)5.213 F F1(\255hide-joliet)2.713 E F0 +(option.)2.713 E(See README.hide for more details.)144 319.2 Q F1 +(\255hide-list)108 336 Q F2(\214le)2.5 E F0 2.5<418c>144 348 S +(le containing a list of)-2.5 E F2(globs)2.5 E F0(to be hidden as abo) +2.5 E -.15(ve)-.15 G(.).15 E F1(\255hidden)108 364.8 Q F2(glob)2.5 E F0 +.713(Add the hidden \(e)144 376.8 R .713 +(xistence\) ISO9660 directory attrib)-.15 F .713(ute for)-.2 F F2(glob) +3.213 E F0 5.713(.T).23 G .713(his attrib)-5.713 F .713(ute will pre)-.2 +F -.15(ve)-.25 G(nt).15 E F2(glob)3.213 E F0 .772(from being listed on \ +DOS based systems if the /A \215ag is not used for the listing.)144 +388.8 R F2(glob)5.773 E F0 .773(is a shell)3.273 F .089 +(wild-card-style pattern that must match an)144 400.8 R 2.589(yp)-.15 G +.089(art of the \214lename or path.)-2.589 F .088 +(In order to match a direc-)5.089 F .744(tory name, mak)144 412.8 R +3.244(es)-.1 G .744 +(ure the pathname does not include a trailing '/' character)-3.244 F +5.744(.M)-.55 G .744(ultiple globs may)-5.744 F(be hidden.)144 424.8 Q +F1(\255hidden-list)108 441.6 Q F2(\214le)2.5 E F0 2.5<418c>144 453.6 S +(le containing a list of)-2.5 E F2(globs)2.5 E F0 +(to get the hidden attrib)2.5 E(ute as abo)-.2 E -.15(ve)-.15 G(.).15 E +F1(\255hide-joliet)108 470.4 Q F2(glob)2.5 E F0(Hide)144 482.4 Q F2 +(glob)2.78 E F0 .28(from being seen on the Joliet directory)2.78 F(.) +-.65 E F2(glob)5.279 E F0 .279 +(is a shell wild-card-style pattern that must)2.779 F .806(match an)144 +494.4 R 3.306(yp)-.15 G .806(art of the \214lename or path.)-3.306 F +.807(Multiple globs may be hidden.)5.806 F(If)5.807 E F2(glob)3.307 E F0 +.807(matches a direc-)3.307 F(tory)144 506.4 Q 2.983(,t)-.65 G .483 +(hen the contents of that directory will be hidden.)-2.983 F .483 +(In order to match a directory name, mak)5.483 F(e)-.1 E .241 +(sure the pathname does not include a trailing '/' character)144 518.4 R +5.241(.A)-.55 G .241(ll the hidden \214les will still be written)-5.241 +F .471(to the output CD image \214le.)144 530.4 R .471 +(Should be used with the)5.471 F F1(\255hide)2.97 E F0 .47 +(option. See README.hide for more)2.97 F(details.)144 542.4 Q F1 +(\255hide-joliet-list)108 559.2 Q F2(\214le)2.5 E F0 2.5<418c>144 571.2 +S(le containing a list of)-2.5 E F2(globs)2.5 E F0(to be hidden as abo) +2.5 E -.15(ve)-.15 G(.).15 E F1(\255hide-joliet-trans-tbl)108 588 Q F0 +.168(Hide the)144 600 R F1(TRANS.TBL)2.668 E F0 .168 +(\214les from the Joliet tree.)2.668 F .168(These \214les usually don') +5.168 F 2.668(tm)-.18 G(ak)-2.668 E 2.668(es)-.1 G .169 +(ense in the Joliet)-2.668 F -.8(Wo)144 612 S 1.359(rld as the).8 F +3.859(yl)-.15 G 1.359 +(ist the real name and the ISO9660 name which may both be dif)-3.859 F +1.358(ferent from the)-.25 F(Joliet name.)144 624 Q F1(\255hide-rr)108 +640.8 Q(-mo)-.37 E -.1(ve)-.1 G(d).1 E F0 .042(Rename the directory)144 +652.8 R F1(RR_MO)2.542 E(VED)-.5 E F0(to)2.542 E F1(.rr_mo)2.542 E -.1 +(ve)-.1 G(d).1 E F0 .043(in the Rock Ridge tree.)2.543 F .043 +(It seems to be impossi-)5.043 F 1.142(ble to completely hide the)144 +664.8 R F1(RR_MO)3.642 E(VED)-.5 E F0 1.141 +(directory from the Rock Ridge tree.)3.642 F 1.141(This option only) +6.141 F(mak)144 676.8 Q .11 +(es the visible tree better to understand for people who don')-.1 F 2.61 +(tk)-.18 G(no)-2.61 E 2.61(ww)-.25 G .11(hat this directory is for)-2.61 +F 5.11(.I)-.55 G(f)-5.11 E .005(you need to ha)144 688.8 R .305 -.15 +(ve n)-.2 H(o).15 E F1(RR_MO)2.505 E(VED)-.5 E F0 .005 +(directory at all, you should use the)2.505 F F1<ad44>2.505 E F0 .005 +(option. Note that in case)2.505 F 1.023(that the)144 700.8 R F1<ad44> +3.523 E F0 1.024(option has been speci\214ed, the resulting \214lesyste\ +m is not ISO9660 le)3.523 F -.15(ve)-.25 G 1.024(l-1 compliant).15 F +1.707(and will not be readable on MS-DOS.)144 712.8 R 1.707(See also) +6.707 F F1(NO)4.207 E(TES)-.4 E F0 1.706 +(section for more information on the)4.207 F F1(RR_MO)144 724.8 Q(VED) +-.5 E F0(directory)2.5 E(.)-.65 E -1.11(Ve)72 768 S(rsion 2.0)1.11 E +(24 Dec 2002)162.9 E(5)203.45 E EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R/F1 10 +/Times-Bold@0 SF<ad6c>108 84 Q F0(Allo)27.52 E 2.698(wf)-.25 G .198 +(ull 31 character \214lenames.)-2.698 F .198 +(Normally the ISO9660 \214lename will be in an 8.3 format which)5.198 F +.015(is compatible with MS-DOS, e)144 96 R -.15(ve)-.25 G 2.515(nt).15 G +.015(hough the ISO9660 standard allo)-2.515 F .014 +(ws \214lenames of up to 31 char)-.25 F(-)-.2 E 2.504(acters. If)144 108 +R .004(you use this option, the disc may be dif)2.504 F .004 +(\214cult to use on a MS-DOS system, b)-.25 F .005(ut this comes)-.2 F +(in handy on some other systems \(such as the Amig)144 120 Q 2.5 +(a\). Use)-.05 F(with caution.)2.5 E F1(\255input-charset)108 136.8 Q/F2 +10/Times-Italic@0 SF -.15(ch)2.5 G(ar).15 E(set)-.1 E F0 1.383(Input ch\ +arset that de\214nes the characters used in local \214le names.)144 +148.8 R 2.983 -.8(To g)6.383 H 1.383(et a list of v).8 F 1.382 +(alid charset)-.25 F .501(names, call)144 160.8 R F1 .501 +(mkisofs \255input-charset help.)3.001 F F0 2.101 -.8(To g)5.501 H .501 +(et a 1:1 mapping, you may use).8 F F1(default)3.002 E F0 .502 +(as charset)3.002 F .487(name. The def)144 172.8 R .487(ault initial v) +-.1 F .487(alues are)-.25 F F2(cp437)2.987 E F0 .487 +(on DOS based systems and)2.987 F F2(iso8859-1)2.987 E F0 .486 +(on all other sys-)2.987 F 2.5(tems. See)144 184.8 R F1(CHARA)2.5 E +(CTER SETS)-.55 E F0(section belo)2.5 E 2.5(wf)-.25 G(or more details.) +-2.5 E F1(\255output-charset)108 201.6 Q F2 -.15(ch)2.5 G(ar).15 E(set) +-.1 E F0 .645(Output charset that de\214nes the characters that will be\ + used in Rock Ridge \214le names. Def)144 213.6 R .645(aults to)-.1 F +(the input charset. See)144 225.6 Q F1(CHARA)2.5 E(CTER SETS)-.55 E F0 +(section belo)2.5 E 2.5(wf)-.25 G(or more details.)-2.5 E F1(\255iso-le) +108 242.4 Q -.1(ve)-.15 G(l).1 E F2(le)2.5 E(vel)-.15 E F0 +(Set the iso9660 conformance le)144 254.4 Q -.15(ve)-.25 G(l. V).15 E +(alid numbers are 1..3.)-1.11 E -.4(Wi)144 278.4 S(th le).4 E -.15(ve) +-.25 G 2.5(l1).15 G 2.5<2c8c>-2.5 G(les may only consist of one section\ + and \214lenames are restricted to 8.3 characters.)-2.5 E -.4(Wi)144 +302.4 S(th le).4 E -.15(ve)-.25 G 2.5(l2).15 G 2.5<2c8c>-2.5 G +(les may only consist of one section.)-2.5 E -.4(Wi)144 326.4 S(th le).4 +E -.15(ve)-.25 G 2.5(l3).15 G 2.5(,n)-2.5 G 2.5(or)-2.5 G +(estrictions apply)-2.5 E(.)-.65 E -.4(Wi)144 350.4 S .99 +(th all iso9660 le).4 F -.15(ve)-.25 G .99(ls all \214lenames are restr\ +icted to upper case letters, numbers and the under).15 F(-)-.2 E .005(s\ +core \(_\). The maximum \214lename length is restricted to 31 character\ +s, the directory nesting le)144 362.4 R -.15(ve)-.25 G 2.506(li).15 G(s) +-2.506 E(restricted to 8 and the maximum path length is limited to 255 \ +characters.)144 374.4 Q F1<ad4a>108 391.2 Q F0 .007 +(Generate Joliet directory records in addition to re)25.3 F .006 +(gular iso9660 \214le names.)-.15 F .006(This is primarily useful)5.006 +F .176(when the discs are to be used on W)144 403.2 R(indo)-.4 E .177 +(ws-NT or W)-.25 F(indo)-.4 E .177(ws-95 machines.)-.25 F .177 +(The Joliet \214lenames are)5.177 F .103(speci\214ed in Unicode and eac\ +h path component can be up to 64 Unicode characters long.)144 415.2 R +.102(Note that)5.102 F .407(Joliet is no standard - CD')144 427.2 R +2.907(st)-.55 G .407(hat use only Joliet e)-2.907 F .407(xtensions b) +-.15 F .407(ut no standard Rock Ridge e)-.2 F(xtensions)-.15 E .983 +(may usually only be used on Microsoft W)144 439.2 R .983 +(in32 systems. Furthermore, the f)-.4 F .982(act that the \214lenames) +-.1 F .248(are limited to 64 characters and the f)144 451.2 R .248 +(act that Joliet uses the UTF-16 coding for Unicode characters)-.1 F +(causes interoperability problems.)144 463.2 Q F1(\255joliet-long)108 +480 Q F0(Allo)144 492 Q 2.507(wJ)-.25 G .007(oliet \214lenames to be up\ + to 103 Unicode characters. This breaks the Joliet speci\214cation - b) +-2.507 F(ut)-.2 E 1.698(appears to w)144 504 R 1.698 +(ork. Use with caution. The number 103 is deri)-.1 F -.15(ve)-.25 G +4.199(df).15 G 1.699(rom: the maximum Directory)-4.199 F 1.372(Record L\ +ength \(254\), minus the length of Directory Record \(33\), minus CD-R) +144 516 R 1.371(OM XA System)-.4 F(Use Extension Information \(14\), di) +144 528 Q(vided by the UTF-16 character size \(2\).)-.25 E F1 +(\255jcharset)108 544.8 Q F2 -.15(ch)2.5 G(ar).15 E(set)-.1 E F0 .772 +(Same as using)144 556.8 R F1(\255input-charset)3.272 E F2 -.15(ch)3.272 +G(ar).15 E(set)-.1 E F0(and)3.272 E F1<ad4a>3.272 E F0 .773 +(options. See)3.273 F F1(CHARA)3.273 E .773(CTER SETS)-.55 F F0 .773 +(section belo)3.273 F(w)-.25 E(for more details.)144 568.8 Q F1<ad4c>108 +585.6 Q F0(Allo)23.63 E 2.557(wI)-.25 G .057(SO9660 \214lenames to be) +-2.557 F .057(gin with a period.)-.15 F(Usually)5.057 E 2.557(,al)-.65 G +.057(eading dot is replaced with an under)-2.557 F(-)-.2 E +(score in order to maintain MS-DOS compatibility)144 597.6 Q(.)-.65 E +(This violates the ISO9660 standard, b)144 609.6 Q(ut it happens to w) +-.2 E(ork on man)-.1 E 2.5(ys)-.15 G 2.5(ystems. Use)-2.5 F +(with caution.)2.5 E F1(\255log-\214le)108 626.4 Q F2(lo)2.5 E(g_\214le) +-.1 E F0(Redirect all error)144 638.4 Q 2.5(,w)-.4 G +(arning and informational messages to)-2.6 E F2(lo)2.5 E(g_\214le)-.1 E +F0(instead of the standard error)2.5 E(.)-.55 E F1<ad6d>108 655.2 Q F2 +(glob)2.5 E F0(Exclude)144 667.2 Q F2(glob)3.99 E F0 1.49 +(from being written to CDR)3.99 F(OM.)-.4 E F2(glob)6.491 E F0 1.491 +(is a shell wild-card-style pattern that must)3.991 F .728 +(match part of the \214lename \(not the path as with option)144 679.2 R +F1<ad78>3.228 E F0 3.228(\). T)B(echnically)-.7 E F2(glob)3.228 E F0 +.728(is matched ag)3.228 F(ainst)-.05 E(the)144 691.2 Q F2(d->d_name)2.5 +E F0(part of the directory entry)2.5 E 5(.M)-.65 G +(ultiple globs may be e)-5 E 2.5(xcluded. Example:)-.15 F +(mkisofs \255o rom \255m '*.o' \255m core \255m foobar)144 715.2 Q -1.11 +(Ve)72 768 S(rsion 2.0)1.11 E(24 Dec 2002)162.9 E(6)203.45 E EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R -.1(wo) +144 84 S .065(uld e).1 F .065(xclude all \214les ending in ".o", called\ + "core" or "foobar" to be copied to CDR)-.15 F .066(OM. Note that)-.4 F +.285(if you had a directory called "foobar" it too \(and of course all \ +its descendants\) w)144 96 R .284(ould be e)-.1 F(xcluded.)-.15 E(NO)144 +120 Q 1.362(TE: The)-.4 F/F1 10/Times-Bold@0 SF<ad6d>3.862 E F0(and) +3.862 E F1<ad78>3.862 E F0 1.363 +(option description should both be updated, the)3.862 F 3.863(ya)-.15 G +1.363(re wrong.)-3.863 F 1.363(Both no)6.363 F(w)-.25 E -.1(wo)144 132 S +.568(rk identical and use \214lename globbing. A \214le is e).1 F .568 +(xcluded if either the last component matches)-.15 F +(or the whole path matches.)144 144 Q F1(\255exclude-list)108 160.8 Q/F2 +10/Times-Italic@0 SF(\214le)2.5 E F0 2.5<418c>144 172.8 S +(le containing a list of)-2.5 E F2(globs)2.5 E F0(to be e)2.5 E +(xclude as abo)-.15 E -.15(ve)-.15 G(.).15 E F1 +(\255max-iso9660-\214lenames)108 189.6 Q F0(Allo)144 201.6 Q 2.821(w3) +-.25 G 2.821(7c)-2.821 G .321(hars in iso9660 \214lenames.)-2.821 F .322 +(This option forces the)5.322 F F1<ad4e>2.822 E F0 .322(option as the e) +2.822 F .322(xtra name space is)-.15 F(tak)144 213.6 Q +(en from the space reserv)-.1 E(ed for ISO-9660 v)-.15 E +(ersion numbers.)-.15 E 1.136(This violates the ISO9660 standard, b)144 +225.6 R 1.135(ut it happens to w)-.2 F 1.135(ork on man)-.1 F 3.635(ys) +-.15 G 3.635(ystems. Although)-3.635 F 3.635(ac)3.635 G(on-)-3.635 E +1.076(forming application needs to pro)144 237.6 R 1.076(vide a b)-.15 F +(uf)-.2 E 1.076(fer space of at least 37 characters, disks created with) +-.25 F(this option may cause a b)144 249.6 Q(uf)-.2 E(fer o)-.25 E -.15 +(ve)-.15 G(r\215o).15 E 2.5(wi)-.25 G 2.5(nt)-2.5 G +(he reading operating system. Use with e)-2.5 E(xtreme care.)-.15 E F1 +<ad4d>108 266.4 Q F2(path)2.5 E F0(or)144 278.4 Q F1<ad4d>108 295.2 Q F2 +(de)2.5 E(vice)-.15 E F0 1.264(Speci\214es path to e)144 307.2 R 1.263 +(xisting iso9660 image to be mer)-.15 F 1.263 +(ged. The alternate form tak)-.18 F 1.263(es a SCSI de)-.1 F(vice)-.25 E +.043(speci\214er that uses the same syntax as the)144 319.2 R F1(de) +2.543 E(v=)-.15 E F0 .043(parameter of)2.543 F F1(cdr)2.543 E(ecord.) +-.18 E F0 .043(The output of)5.043 F F1(mkisofs)2.544 E F0(will)2.544 E +.328(be a ne)144 331.2 R 2.828(ws)-.25 G .327(ession which should get w\ +ritten to the end of the image speci\214ed in \255M.)-2.828 F -.8(Ty) +5.327 G .327(pically this).8 F .383 +(requires multi-session capability for the recorder and cdrom dri)144 +343.2 R .683 -.15(ve t)-.25 H .383(hat you are attempting to write).15 F +(this image to.)144 355.2 Q +(This option may only be used in conjunction with the)5 E F1<ad43>2.5 E +F0(option.)2.5 E F1<ad4e>108 372 Q F0(Omit v)23.08 E +(ersion numbers from ISO9660 \214le names.)-.15 E .228 +(This violates the ISO9660 standard, b)144 384 R .227 +(ut no one really uses the v)-.2 F .227(ersion numbers an)-.15 F(yw)-.15 +E(ay)-.1 E 5.227(.U)-.65 G .227(se with)-5.227 F(caution.)144 396 Q F1 +(\255new-dir)108 412.8 Q(-mode)-.37 E F2(mode)2.5 E F0 +(Mode to use when creating ne)144 424.8 Q 2.5(wd)-.25 G +(irectories in the iso fs image.)-2.5 E(The def)5 E(ault mode is 0555.) +-.1 E F1(\255nobak)108 441.6 Q(\255no-bak)108 458.4 Q F0 1.168 +(Do not include backup \214les \214les on the iso9660 \214lesystem.)144 +470.4 R 1.168(If the)6.168 F F1(\255no-bak)3.668 E F0 1.168 +(option is speci\214ed,)3.668 F .539(\214les that contain the character\ +s '~' or '#' or end in '.bak' will not be included \(these are typicall\ +y)144 482.4 R(backup \214les for editors under unix\).)144 494.4 Q F1 +<ad66>108 511.2 Q(or)-.25 E(ce-rr)-.18 E F0 .938 +(Do not use the automatic Rock Ridge attrib)144 523.2 R .939 +(utes recognition for pre)-.2 F .939(vious sessions.)-.25 F .939 +(This helps to)5.939 F(sho)144 535.2 Q 2.5(wr)-.25 G(otten iso9660 e) +-2.5 E(xtension records as e.g. created by NER)-.15 E 2.5(Ob)-.4 G +(urning R)-2.7 E(OM.)-.4 E F1(\255no-rr)108 552 Q F0 .429 +(Do not use the Rock Ridge attrib)7.53 F .429(utes from pre)-.2 F .429 +(vious sessions.)-.25 F .429(This may help to a)5.429 F -.2(vo)-.2 G +.428(id getting into).2 F(trouble when)144 564 Q F1(mkisofs)2.5 E F0 +(\214nds ille)2.5 E -.05(ga)-.15 G 2.5(lR).05 G +(ock Ridge signatures on an old session.)-2.5 E F1 +(\255no-split-symlink-components)108 580.8 Q F0(Don')144 592.8 Q 3.053 +(ts)-.18 G .553(plit the SL components, b)-3.053 F .553(ut be)-.2 F .553 +(gin a ne)-.15 F 3.053(wC)-.25 G .554 +(ontinuation Area \(CE\) instead. This may w)-3.053 F(aste)-.1 E .063 +(some space, b)144 604.8 R .063(ut the SunOS 4.1.4 cdrom dri)-.2 F -.15 +(ve)-.25 G 2.563(rh).15 G .062(as a b)-2.563 F .062 +(ug in reading split SL components \(link_size)-.2 F 2.5(=c)144 616.8 S +(omponent_size instead of link_size += component_size\).)-2.5 E F1 +(\255no-split-symlink-\214elds)108 633.6 Q F0(Don')144 645.6 Q 3.209(ts) +-.18 G .709(plit the SL \214elds, b)-3.209 F .709(ut be)-.2 F .709 +(gin a ne)-.15 F 3.209(wC)-.25 G .71 +(ontinuation Area \(CE\) instead. This may w)-3.209 F .71(aste some)-.1 +F .446(space, b)144 657.6 R .446 +(ut the SunOS 4.1.4 and Solaris 2.5.1 cdrom dri)-.2 F -.15(ve)-.25 G +2.946(rh).15 G -2.25 -.2(av e)-2.946 H 2.945(ab)3.145 G .445 +(ug in reading split SL \214elds \(a)-3.145 F(`/' can be dropped\).)144 +669.6 Q F1<ad6f>108 686.4 Q F2(\214lename)2.5 E F0 .098(is the name of \ +the \214le to which the iso9660 \214lesystem image should be written.) +144 698.4 R .098(This can be a disk)5.098 F .398(\214le, a tape dri)144 +710.4 R -.15(ve)-.25 G 2.898(,o).15 G 2.898(ri)-2.898 G 2.898(tc)-2.898 +G .398(an correspond directly to the de)-2.898 F .398 +(vice name of the optical disc writer)-.25 F 5.397(.I)-.55 G 2.897(fn) +-5.397 G(ot)-2.897 E .312(speci\214ed, stdout is used.)144 722.4 R .313 +(Note that the output can also be a block special de)5.312 F .313 +(vice for a re)-.25 F .313(gular disk)-.15 F -1.11(Ve)72 768 S +(rsion 2.0)1.11 E(24 Dec 2002)162.9 E(7)203.45 E EP +%%Page: 8 8 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R(dri)144 +84 Q -.15(ve)-.25 G 2.875(,i).15 G 2.875(nw)-2.875 G .374 +(hich case the disk partition can be mounted and e)-2.875 F .374 +(xamined to ensure that the premaster)-.15 F(-)-.2 E(ing w)144 96 Q +(as done correctly)-.1 E(.)-.65 E/F1 10/Times-Bold@0 SF(\255pad)108 +112.8 Q F0 -.15(Pa)14.18 G 2.768(dt).15 G .269(he end of the ISO9660 by\ + 16 sectors \(32kB\). If the total size then is not a multiple of 16 se\ +c-)-2.768 F 1.687(tors, the needed number of sectors is added.)144 124.8 +R 1.687(If the option)6.687 F F1<ad42>4.187 E F0 1.686 +(is used, then there is a second)4.187 F +(padding at the end of the boot partitions.)144 136.8 Q .186 +(The padding is needed as man)144 160.8 R 2.687(yo)-.15 G .187 +(perating systems \(e.g. Linux\) implement read ahead b)-2.687 F .187 +(ugs in their)-.2 F .189(\214lesystem I/O. These b)144 172.8 R .189(ugs\ + result in read errors on one or more \214les that are located at the e\ +nd of a)-.2 F .316(track. The)144 184.8 R 2.816(ya)-.15 G .317 +(re usually present when the CD is written in T)-2.816 F .317 +(rack at Once mode or when the disk is)-.35 F(written as mix)144 196.8 Q +(ed mode CD where an audio track follo)-.15 E(ws the data track.)-.25 E +1.793 -.8(To a)144 220.8 T -.2(vo).6 G .193 +(id problems with I/O error on the last \214le on the \214lesystem, the) +.2 F F1(\255pad)2.693 E F0 .192(option has been made)2.692 F(the def)144 +232.8 Q(ault.)-.1 E F1(\255no\255pad)108 249.6 Q F0(Do not P)144 261.6 Q +(ad the end of the ISO9660 by 16 sectors \(32kB\).)-.15 E F1 +(\255path-list)108 278.4 Q/F2 10/Times-Italic@0 SF(\214le)2.5 E F0 3.259 +<418c>144 290.4 S .759(le containing a list of)-3.259 F F2(pathspec) +3.259 E F0 .76 +(directories and \214lenames to be added to the ISO9660 \214lesys-)3.259 +F .819(tem. This list of pathspecs are processed after an)144 302.4 R +3.319(yt)-.15 G .819(hat appear on the command line. If the ar)-3.319 F +(gu-)-.18 E(ment is)144 314.4 Q F2<ad>2.5 E F0 2.5(,t)C +(hen the list is read from the standard input.)-2.5 E F1<ad50>108 331.2 +Q F2(publisher_id)2.5 E F0 .78(Speci\214es a te)144 343.2 R .78 +(xt string that will be written into the v)-.15 F .781(olume header)-.2 +F 5.781(.T)-.55 G .781(his should describe the pub-)-5.781 F .907 +(lisher of the CDR)144 355.2 R .906 +(OM, usually with a mailing address and phone number)-.4 F 5.906(.T)-.55 +G .906(here is space on the)-5.906 F .582 +(disc for 128 characters of information.)144 367.2 R .582 +(This parameter can also be set in the \214le)5.582 F F1(.mkisofsr)3.082 +E(c)-.18 E F0(with)3.082 E 2.5(PUBL=. If)144 379.2 R +(speci\214ed in both places, the command line v)2.5 E(ersion is used.) +-.15 E F1<ad70>108 396 Q F2(pr)2.5 E(epar)-.37 E(er_id)-.37 E F0 .92 +(Speci\214es a te)144 408 R .92 +(xt string that will be written into the v)-.15 F .92(olume header)-.2 F +5.92(.T)-.55 G .92(his should describe the pre-)-5.92 F 1.011 +(parer of the CDR)144 420 R 1.011 +(OM, usually with a mailing address and phone number)-.4 F 6.011(.T)-.55 +G 1.012(here is space on the)-6.011 F .582 +(disc for 128 characters of information.)144 432 R .582 +(This parameter can also be set in the \214le)5.582 F F1(.mkisofsr)3.081 +E(c)-.18 E F0(with)3.081 E 2.5(PREP=. If)144 444 R +(speci\214ed in both places, the command line v)2.5 E(ersion is used.) +-.15 E F1(\255print-size)108 460.8 Q F0 .472(Print estimated \214lesyst\ +em size in multiples of the sector size \(2048 bytes\) and e)144 472.8 R +.472(xit. This option is)-.15 F .739 +(needed for Disk At Once mode and with some CD-R dri)144 484.8 R -.15 +(ve)-.25 G 3.238(sw).15 G .738(hen piping directly into)-3.238 F F1(cdr) +3.238 E(ecord.)-.18 E F0 .675(In this case it is needed to kno)144 496.8 +R 3.175(wt)-.25 G .675 +(he size of the \214lesystem before the actual CD-creation is done.) +-3.175 F .799(The option \255print-size allo)144 508.8 R .799(ws to get\ + this size from a "dry-run" before the CD is actually written.)-.25 F +.864(Old v)144 520.8 R .864(ersions of)-.15 F F1(mkisofs)3.364 E F0 .864 +(did write this information \(among other information\) to)3.364 F F2 +(stderr)3.365 E F0 5.865(.A).73 G 3.365(st)-5.865 G(his)-3.365 E .607 +(turns out to be hard to parse, the number without an)144 532.8 R 3.107 +(yo)-.15 G .607(ther information is no)-3.107 F 3.107(wp)-.25 G .607 +(rinted on)-3.107 F F1(stdout)3.107 E F0 3.238(too. If)144 544.8 R .738 +(you lik)3.238 F 3.238(et)-.1 G 3.238(ow)-3.238 G .738 +(rite a simple shell script, redirect)-3.238 F F1(stderr)3.238 E F0 .739 +(and catch the number from)3.238 F F1(stdout)3.239 E F0(.)A +(This may be done with:)144 556.8 Q F1 +(cdblocks=` mkisofs -print-size -quiet .)144 580.8 Q -3.332 1.666(.. `) +1.666 H(mkisofs .)144 604.8 Q -3.332 1.666(.. | c)1.666 H(dr)-1.666 E +(ecord .)-.18 E -3.332 1.666(.. t)1.666 H(size=${cdblocks}s -)-1.666 E +(\255quiet)108 621.6 Q F0(This mak)8.63 E(es)-.1 E F1(mkisofs)2.5 E F0 +-2.15 -.25(ev e)2.5 H 2.5(nl).25 G(ess v)-2.5 E 2.5(erbose. No)-.15 F +(progress output will be pro)2.5 E(vided.)-.15 E F1<ad52>108 638.4 Q F0 +.448(Generate SUSP and RR records using the Rock Ridge protocol to furt\ +her describe the \214les on the)23.08 F(iso9660 \214lesystem.)144 650.4 +Q F1<ad72>108 667.2 Q F0 .004(This is lik)25.86 F 2.504(et)-.1 G .004 +(he \255R option, b)-2.504 F .004(ut \214le o)-.2 F .004 +(wnership and modes are set to more useful v)-.25 F 2.505(alues. The) +-.25 F .005(uid and)2.505 F .623(gid are set to zero, because the)144 +679.2 R 3.123(ya)-.15 G .623(re usually only useful on the author') +-3.123 F 3.123(ss)-.55 G .622(ystem, and not useful to)-3.123 F .815 +(the client.)144 691.2 R .816(All the \214le read bits are set true, so\ + that \214les and directories are globally readable on)5.815 F .036 +(the client.)144 703.2 R .036(If an)5.036 F 2.536(ye)-.15 G -.15(xe) +-2.686 G .035(cute bit is set for a \214le, set all of the e).15 F -.15 +(xe)-.15 G .035(cute bits, so that e).15 F -.15(xe)-.15 G .035 +(cutables are glob-).15 F .859(ally e)144 715.2 R -.15(xe)-.15 G .859 +(cutable on the client.).15 F .859(If an)5.859 F 3.359(ys)-.15 G .859 +(earch bit is set for a directory)-3.359 F 3.359(,s)-.65 G .859 +(et all of the search bits, so)-3.359 F .814 +(that directories are globally searchable on the client.)144 727.2 R +.814(All write bits are cleared, because the CD-)5.814 F -1.11(Ve)72 768 +S(rsion 2.0)1.11 E(24 Dec 2002)162.9 E(8)203.45 E EP +%%Page: 9 9 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R .847 +(Rom will be mounted read-only in an)144 84 R 3.348(yc)-.15 G 3.348 +(ase. If)-3.348 F(an)3.348 E 3.348(yo)-.15 G 3.348(ft)-3.348 G .848 +(he special mode bits are set, clear them,)-3.348 F .198(because \214le\ + locks are not useful on a read-only \214le system, and set-id bits are\ + not desirable for uid)144 96 R 3.094(0o)144 108 S 3.094(rg)-3.094 G +.594(id 0.)-3.094 F .595(When used on W)5.594 F .595(in32, the e)-.4 F +-.15(xe)-.15 G .595(cute bit is set on).15 F/F1 10/Times-Italic@0 SF +(all)3.095 E F0 .595(\214les. This is a result of the lack of)3.095 F +1.585(\214le permissions on W)144 120 R 1.585 +(in32 and the Cygwin POSIX emulation layer)-.4 F 6.585(.S)-.55 G 1.585 +(ee also \255uid \255gid, \255dir)-6.585 F(-)-.2 E +(mode, \255\214le-mode and \255ne)144 132 Q(w-dir)-.25 E(-mode.)-.2 E/F2 +10/Times-Bold@0 SF<ad72>108 148.8 Q(elaxed-\214lenames)-.18 E F0 .662 +(The option)144 160.8 R F2<ad72>3.162 E(elaxed-\214lenames)-.18 E F0 +(allo)3.162 E .662 +(ws ISO9660 \214lenames to include digits, uppercase characters)-.25 F +(and all other 7 bit ASCII characters \(resp. an)144 172.8 Q(ything e) +-.15 E(xcept lo)-.15 E(wercase characters\).)-.25 E +(This violates the ISO9660 standard, b)144 184.8 Q(ut it happens to w) +-.2 E(ork on man)-.1 E 2.5(ys)-.15 G 2.5(ystems. Use)-2.5 F +(with caution.)2.5 E F2(\255sort)108 201.6 Q F1(sort \214le)2.5 E F0 +.354(Sort \214le locations on the media. Sorting is controlled by a \ +\214le that contains pairs of \214lenames and)144 213.6 R .305 +(sorting of)144 225.6 R .305(fset weighting.)-.25 F .305 +(If the weighting is higher)5.305 F 2.806(,t)-.4 G .306 +(he \214le will be located closer to the be)-2.806 F(ginning)-.15 E .044 +(of the media, if the weighting is lo)144 237.6 R(wer)-.25 E 2.544(,t) +-.4 G .044 +(he \214le will be located closer to the end of the media. There)-2.544 +F .112(must be only one space or tabs character between the \214lename \ +and the weight and the weight must)144 249.6 R .877 +(be the last characters on a line. The \214lename is tak)144 261.6 R +.876(en to include all the characters up to, b)-.1 F .876(ut not)-.2 F +.317 +(including the last space or tab character on a line. This is to allo) +144 273.6 R 2.817(wf)-.25 G .317(or space characters to be in, or)-2.817 +F .775(at the end of a \214lename.)144 285.6 R .775(This option does) +5.775 F F2(not)3.275 E F0 .775 +(sort the order of the \214le names that appear in the)3.275 F .206 +(ISO9660 directory)144 297.6 R 2.706(.I)-.65 G 2.706(ts)-2.706 G .206(o\ +rts the order in which the \214le data is written to the CD image - whi\ +ch may)-2.706 F(be useful in order to optimize the data layout on a CD.\ + See README.sort for more details.)144 309.6 Q F2(\255split-output)108 +326.4 Q F0 .775(Split the output image into se)144 338.4 R -.15(ve)-.25 +G .774(ral \214les of approximately 1 GB.).15 F .774 +(This helps to create D)5.774 F .774(VD sized)-.4 F .657 +(iso9660 images on operating systems without lar)144 350.4 R .658 +(ge \214le support.)-.18 F .658(Cdrecord will concatenate more)5.658 F +.104(than one \214le into a single track if writing to a D)144 362.4 R +2.604(VD. T)-.4 F 2.604(om)-.8 G(ak)-2.604 E(e)-.1 E F2 +(\255split-output)2.604 E F0 -.1(wo)2.604 G .104(rk, the).1 F F2<ad6f> +2.603 E F1(\214lename)2.603 E F0 4.346 +(option must be speci\214ed. The resulting outout images will be named:) +144 374.4 R F1(\214lename_00)6.847 E F0(,).47 E F1(\214le-)1.91 E +(name_01,)144 386.4 Q F0(\214lename_02)A F1(...)A F2(\255sysid)108 403.2 +Q F1(ID)2.5 E F0 1.372(Speci\214es the system ID.)144 415.2 R 1.372 +(This parameter can also be set in the \214le)6.372 F F2(.mkisofsr)3.872 +E(c)-.18 E F0 1.372(with SYSI=sys-)3.872 F 2.5(tem_id. If)144 427.2 R +(speci\214ed in both places, the command line v)2.5 E(ersion is used.) +-.15 E F2<ad54>108 444 Q F0 .82 +(Generate a \214le TRANS.TBL in each directory on the CDR)23.63 F .82 +(OM, which can be used on non-Rock)-.4 F .671 +(Ridge capable systems to help establish the correct \214le names.)144 +456 R .67(There is also information present)5.671 F .899(in the \214le \ +that indicates the major and minor numbers for block and character de) +144 468 R .9(vices, and each)-.25 F +(symlink has the name of the link \214le gi)144 480 Q -.15(ve)-.25 G(n.) +.15 E F2(\255table-name)108 496.8 Q F1 -.5(TA)2.5 G(BLE_N).5 E(AME)-.27 +E F0(Alternati)144 508.8 Q 1.409 -.15(ve t)-.25 H 1.109 +(ranslation table \214le name \(see abo).15 F -.15(ve)-.15 G 1.109 +(\). Implies the).15 F F2<ad54>3.609 E F0 3.608(option. If)3.609 F 1.108 +(you are creating a)3.608 F +(multi-session image you must use the same name as in the pre)144 520.8 +Q(vious session.)-.25 E F2(\255ucs-le)108 537.6 Q -.1(ve)-.15 G(l).1 E +F1(le)2.5 E(vel)-.15 E F0 1.296(Set Unicode conformance le)144 549.6 R +-.15(ve)-.25 G 3.796(li).15 G 3.796(nt)-3.796 G 1.297 +(he Joliet SVD. The def)-3.796 F 1.297(ault le)-.1 F -.15(ve)-.25 G +3.797(li).15 G 3.797(s3)-3.797 G 6.297(.I)-3.797 G 3.797(tm)-6.297 G +1.297(ay be set to 1..3)-3.797 F(using this option.)144 561.6 Q F2 +(\255udf)108 578.4 Q F0(Include)15.85 E F2(UDF)2.933 E F0 .432 +(support in the generated \214lesystem image.)2.933 F F2(UDF)5.432 E F0 +.432(support is currently in alpha status)2.932 F 1.153 +(and for this reason, it is not possible to create UDF only images.)144 +590.4 R F2(UDF)6.153 E F0 1.153(data structures are cur)3.653 F(-)-.2 E +.609(rently coupled to the Joliet structures, so there are man)144 602.4 +R 3.108(yp)-.15 G(itf)-3.108 E .608 +(alls with the current implementation.)-.1 F .308(There is no UID/GID s\ +upport, there is no POSIX permission support, there is no support for s\ +ym-)144 614.4 R 2.525(links. Note)144 626.4 R(that)2.525 E F2(UDF)2.525 +E F0 -.1(wa)2.525 G .025 +(stes the space from sector ~20 to sector 256 at the be).1 F .024 +(ginning of the disk in)-.15 F(addition to the spcae needed for real)144 +638.4 Q F2(UDF)2.5 E F0(data structures.)2.5 E F2(\255uid)108 655.2 Q F1 +(uid)2.5 E F0(Ov)144 667.2 Q .632 +(errides the uid read from the source \214les to the v)-.15 F .633 +(alue of)-.25 F F1(uid)3.133 E F0 5.633(.S).77 G .633 +(pecifying this option automati-)-5.633 F(cally enables Rock Ridge e)144 +679.2 Q(xtensions.)-.15 E F2(\255use-\214le)108 696 Q -.1(ve)-.15 G +(rsion).1 E F0 .149(The option)144 708 R F2(\255use-\214le)2.649 E -.1 +(ve)-.15 G(rsion).1 E F0(allo)2.649 E .149(ws mkisofs to use \214le v) +-.25 F .148(ersion numbers from the \214lesystem.)-.15 F .148(If the) +5.148 F .645(option is not speci\214ed,)144 720 R F2(mkisofs)3.145 E F0 +.645(creates a v)3.145 F .645(ersion if 1 for all \214les.)-.15 F .645 +(File v)5.645 F .645(ersions are strings in the)-.15 F -1.11(Ve)72 768 S +(rsion 2.0)1.11 E(24 Dec 2002)162.9 E(9)203.45 E EP +%%Page: 10 10 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R(range) +144 84 Q/F1 10/Times-Italic@0 SF(;1)2.5 E F0(to)2.5 E F1(;32767)2.5 E F0 +(This option is the def)2.5 E(ault on VMS.)-.1 E/F2 10/Times-Bold@0 SF +<ad55>108 100.8 Q F0(Allo)23.08 E 2.079(ws "Untranslated" \214lenames, \ +completely violating the iso9660 standards described abo)-.25 F -.15(ve) +-.15 G(.).15 E -.15(Fo)144 112.8 S .054 +(rces on the \255d, \255l, \255L, \255N, \255relax).15 F .055 +(ed-\214lenames, \255allo)-.15 F(w-lo)-.25 E .055(wercase, \255allo)-.25 +F .055(w-multidot and \255no-iso-)-.25 F 1.175 +(translate \215ags. It allo)144 124.8 R 1.174(ws more than one '.)-.25 F +3.674('c)-.7 G 1.174(haracter in the \214lename, as well as mix)-3.674 F +1.174(ed case \214le-)-.15 F 3.162(names. This)144 136.8 R .663 +(is useful on HP-UX system, where the b)3.162 F .663 +(uilt-in CDFS \214lesystem does not recognize)-.2 F(ANY e)144 148.8 Q +(xtensions. Use with e)-.15 E(xtreme caution.)-.15 E F2 +(\255no-iso-translate)108 165.6 Q F0 .47 +(Do not translate the characters '#' and '~' which are in)144 177.6 R +-.25(va)-.4 G .469(lid for iso9660 \214lenames.).25 F .469 +(These charac-)5.469 F(ters are though in)144 189.6 Q -.25(va)-.4 G +(lid often used by Microsoft systems.).25 E +(This violates the ISO9660 standard, b)144 201.6 Q(ut it happens to w) +-.2 E(ork on man)-.1 E 2.5(ys)-.15 G 2.5(ystems. Use)-2.5 F +(with caution.)2.5 E F2<ad56>108 218.4 Q F1(volid)2.5 E F0 .23 +(Speci\214es the v)144 230.4 R .23(olume ID \(v)-.2 F .23 +(olume name or label\) to be written into the master block.)-.2 F .23 +(This parame-)5.23 F .533(ter can also be set in the \214le)144 242.4 R +F2(.mkisofsr)3.032 E(c)-.18 E F0 .532(with V)3.032 F 3.032(OLI=id. If) +-.4 F .532(speci\214ed in both places, the command)3.032 F .356(line v) +144 254.4 R .356(ersion is used.)-.15 F .356 +(Note that if you assign a v)5.356 F .357 +(olume ID, this is the name that will be used as the)-.2 F .528 +(mount point used by the Solaris v)144 266.4 R .527 +(olume management system and the name that is assigned to the)-.2 F +(disc on a Microsoft W)144 278.4 Q(in32 or Apple Mac platform.)-.4 E F2 +<ad76>108 295.2 Q(olset)-.1 E F1(ID)2.5 E F0 5.042(Speci\214es the v)144 +307.2 R 5.042(olset ID.)-.2 F 5.042 +(This parameter can also be set in the \214le)10.042 F F2(.mkisofsr) +7.543 E(c)-.18 E F0(with)7.543 E -.4(VO)144 319.2 S(LS=v).4 E 2.5 +(olset_id. If)-.2 F(speci\214ed in both places, the command line v)2.5 E +(ersion is used.)-.15 E F2<ad76>108 336 Q(olset-size)-.1 E F1(#)2.5 E F0 +.116(Sets the v)144 348 R .116(olume set size to #.)-.2 F .116(The v) +5.116 F .116(olume set size is the number of CD')-.2 F 2.616(st)-.55 G +.116(hat are in a CD set.)-2.616 F(The)5.115 E F2<ad76>144 360 Q +(olset-size)-.1 E F0 .028(option may be used to create CD')2.528 F 2.529 +(st)-.55 G .029(hat are part of e.g. a Operation System installation) +-2.529 F .994(set of CD')144 372 R 3.493(s. The)-.55 F(option)3.493 E F2 +<ad76>3.493 E(olset-size)-.1 E F0 .993(must be speci\214ed before)3.493 +F F2<ad76>3.493 E(olset-seqno)-.1 E F0 .993(on each command)3.493 F +(line.)144 384 Q F2<ad76>108 400.8 Q(olset-seqno)-.1 E F1(#)2.5 E F0 +.378(Sets the v)144 412.8 R .378(olume set sequence number to #.)-.2 F +.378(The v)5.378 F .378(olume set sequence number is the inde)-.2 F +2.879(xn)-.15 G(umber)-2.879 E .2(of the current CD in a CD set.)144 +424.8 R .199(The option)5.199 F F2<ad76>2.699 E(olset-size)-.1 E F0 .199 +(must be speci\214ed before)2.699 F F2<ad76>2.699 E(olset-seqno)-.1 E F0 +(on)2.699 E(each command line.)144 436.8 Q F2<ad76>108 453.6 Q F0 -1.11 +(Ve)25.3 G(rbose e)1.11 E -.15(xe)-.15 G(cution. If gi).15 E -.15(ve) +-.25 G 2.5(nt).15 G(wice on the command line, e)-2.5 E(xtra deb)-.15 E +(ug information will be printed.)-.2 E F2<ad78>108 470.4 Q F1(path)2.5 E +F0(Exclude)5.02 E F1(path)3.633 E F0 1.133(from being written to CDR) +3.633 F(OM.)-.4 E F1(path)6.134 E F0 1.134 +(must be the complete pathname that results)3.634 F 1.218 +(from concatenating the pathname gi)144 482.4 R -.15(ve)-.25 G 3.717(na) +.15 G 3.717(sc)-3.717 G 1.217(ommand line ar)-3.717 F 1.217 +(gument and the path relati)-.18 F 1.517 -.15(ve t)-.25 H 3.717(ot).15 G +(his)-3.717 E(directory)144 494.4 Q 5(.M)-.65 G(ultiple paths may be e) +-5 E 2.5(xcluded. Example:)-.15 F +(mkisofs \255o cd \255x /local/dir1 \255x /local/dir2 /local)144 518.4 Q +(NO)144 542.4 Q 1.362(TE: The)-.4 F F2<ad6d>3.862 E F0(and)3.862 E F2 +<ad78>3.862 E F0 1.363(option description should both be updated, the) +3.862 F 3.863(ya)-.15 G 1.363(re wrong.)-3.863 F 1.363(Both no)6.363 F +(w)-.25 E -.1(wo)144 554.4 S .568 +(rk identical and use \214lename globbing. A \214le is e).1 F .568 +(xcluded if either the last component matches)-.15 F +(or the whole path matches.)144 566.4 Q F2<ad7a>108 583.2 Q F0 .354 +(Generate special RRIP records for transparently compressed \214les.) +25.86 F .355(This is only of use and interest)5.354 F .451(for hosts th\ +at support transparent decompression, such as Linux 2.4.14 or later)144 +595.2 R 5.45(.Y)-.55 G .45(ou must specify)-6.55 F(the)144 607.2 Q F2 +<ad52>2.712 E F0(or)2.712 E F2<ad72>2.712 E F0 .212 +(options to enable RockRidge, and generate compressed \214les using the) +2.712 F F2(mkzftr)2.712 E(ee)-.18 E F0(util-)2.712 E 2.217 +(ity before running)144 619.2 R F2(mkisofs)4.717 E F0 7.217(.N)C 2.217 +(ote that transparent compression is a nonstandard Rock Ridge)-7.217 F +-.15(ex)144 631.2 S 2.944(tension. The).15 F .444 +(resulting disks are only transparently readable if used on Linux.)2.944 +F .445(On other operat-)5.445 F(ing systems you will need to call)144 +643.2 Q F2(mkzftr)2.5 E(ee)-.18 E F0(by hand to decompress the \214les.) +2.5 E/F3 10.95/Times-Bold@0 SF(HFS OPTIONS)72 672 Q F2(\255hfs)108 684 Q +F0 1.137(Create an ISO9660/HFS h)17.52 F 1.136 +(ybrid CD. This option should be used in conjunction with the)-.05 F F2 +(\255map)3.636 E F0(,)A F2(\255magic)144 696 Q F0(and/or the v)2.5 E +(arious)-.25 E F1(double dash)2.5 E F0(options gi)2.5 E -.15(ve)-.25 G +2.5(nb).15 G(elo)-2.5 E -.65(w.)-.25 G F2(\255apple)108 712.8 Q F0 .393 +(Create an ISO9660 CD with Apple')6.96 F 2.893(se)-.55 G .393 +(xtensions. Similar to the)-3.043 F F2(\255hfs)2.893 E F0 .394 +(option, e)2.894 F .394(xcept that the Apple)-.15 F +(Extensions to ISO9660 are added instead of creating an HFS h)144 724.8 +Q(ybrid v)-.05 E(olume.)-.2 E -1.11(Ve)72 768 S(rsion 2.0)1.11 E +(24 Dec 2002)162.9 E(10)198.45 E EP +%%Page: 11 11 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R/F1 10 +/Times-Bold@0 SF(\255map)108 84 Q/F2 10/Times-Italic@0 SF +(mapping_\214le)2.5 E F0 1.43(Use the)144 96 R F2(mapping_\214le)3.93 E +F0 1.43(to set the CREA)3.93 F -.18(TO)-1.11 G 3.93(Ra).18 G 1.43 +(nd TYPE information for a \214le based on the \214le-)-3.93 F(name')144 +108 Q 2.828(se)-.55 G .329 +(xtension. A \214lename is mapped only if it is not one of the kno) +-2.978 F 2.829(wA)-.25 G .329(pple/Unix \214le formats.)-2.829 F +(See the)144 120 Q F1(HFS CREA)2.5 E -.18(TO)-.95 G(R/TYPE).18 E F0 +(section belo)2.5 E -.65(w.)-.25 G F1(\255magic)108 136.8 Q F2(ma)2.5 E +(gic_\214le)-.1 E F0 .34(The CREA)144 148.8 R -.18(TO)-1.11 G 2.84(Ra) +.18 G .34(nd TYPE information is set by using a \214le')-2.84 F(s)-.55 E +F2(ma)2.84 E .34(gic number)-.1 F F0 .34(\(usually the \214rst fe)2.84 F +(w)-.25 E .704(bytes of a \214le\). The)144 160.8 R F2(ma)3.204 E +(gic_\214le)-.1 E F0 .705 +(is only used if a \214le is not one of the kno)3.204 F .705 +(wn Apple/Unix \214le for)-.25 F(-)-.2 E .482(mats, or the \214lename e) +144 172.8 R .481(xtension has not been mapped using the)-.15 F F1 +(\255map)2.981 E F0 .481(option. See the)2.981 F F1 .481(HFS CRE-)2.981 +F -.78 -.95(AT O)144 184.8 T(R/TYPE).95 E F0(section belo)2.5 E 2.5(wf) +-.25 G(or more details.)-2.5 E F1(\255hfs-cr)108 201.6 Q(eator)-.18 E F2 +(CREA)2.5 E -.18(TO)-.37 G(R).18 E F0 2.82(Set the def)144 213.6 R 2.82 +(ault CREA)-.1 F -.18(TO)-1.11 G 5.32(Rf).18 G 2.821 +(or all \214les. Must be e)-5.32 F 2.821(xactly 4 characters. See the) +-.15 F F1 2.821(HFS CRE-)5.321 F -.78 -.95(AT O)144 225.6 T(R/TYPE).95 E +F0(section belo)2.5 E 2.5(wf)-.25 G(or more details.)-2.5 E F1 +(\255hfs-type)108 242.4 Q F2(TYPE)2.5 E F0 .588(Set the def)144 254.4 R +.587(ault TYPE for all \214les. Must be e)-.1 F .587 +(xactly 4 characters. See the)-.15 F F1 .587(HFS CREA)3.087 F -.18(TO) +-.95 G(R/TYPE).18 E F0(section belo)144 266.4 Q 2.5(wf)-.25 G +(or more details.)-2.5 E F1(\255pr)108 283.2 Q(obe)-.18 E F0 1.364 +(Search the contents of \214les for all the kno)5.48 F 1.364 +(wn Apple/Unix \214le formats.)-.25 F 1.364(See the)6.364 F F1 1.364 +(HFS MA)3.864 F(CIN-)-.55 E -.18(TO)144 295.2 S .394(SH FILE FORMA).18 F +(TS)-.95 E F0 .394(section belo)2.894 F 2.894(wf)-.25 G .394 +(or more about these formats.)-2.894 F(Ho)5.393 E(we)-.25 E -.15(ve)-.25 +G 1.193 -.4(r, t).15 H .393(he only w).4 F .393(ay to)-.1 F .997 +(check for)144 307.2 R F2(MacBinary)3.497 E F0(and)3.497 E F2 +(AppleSingle)3.497 E F0 .997 +(\214les is to open and read them. Therefore this option)3.497 F F2(may) +3.498 E F0 1.048 +(increase processing time. It is better to use one or more)144 319.2 R +F2 1.047(double dash)3.548 F F0 1.047(options gi)3.547 F -.15(ve)-.25 G +3.547(nb).15 G(elo)-3.547 E 3.547(wi)-.25 G 3.547(ft)-3.547 G(he)-3.547 +E(Apple/Unix formats in use are kno)144 331.2 Q(wn.)-.25 E F1 +(\255no-desktop)108 348 Q F0 .403 +(Do not create \(empty\) Desktop \214les. Ne)144 360 R 2.903(wH)-.25 G +.404(FS Desktop \214les will be created when the CD is used)-2.903 F +.793(on a Macintosh \(and stored in the System F)144 372 R 3.292 +(older\). By)-.15 F(def)3.292 E .792 +(ault, empty Desktop \214les are added to)-.1 F(the HFS v)144 384 Q +(olume.)-.2 E F1(\255mac-name)108 400.8 Q F0 .175(Use the HFS \214lenam\ +e as the starting point for the ISO9660, Joliet and Rock Ridge \214le n\ +ames. See)144 412.8 R(the)144 424.8 Q F1(HFS MA)2.5 E(CINT)-.55 E +(OSH FILE N)-.18 E(AMES)-.2 E F0(section belo)2.5 E 2.5(wf)-.25 G +(or more information.)-2.5 E F1(\255boot-hfs-\214le)108 441.6 Q F2 +(driver_\214le)2.5 E F0 1.88(Installs the)144 453.6 R F2(driver_\214le) +4.38 E F0(that)4.38 E F2(may)4.38 E F0(mak)4.38 E 4.379(et)-.1 G 1.879 +(he CD bootable on a Macintosh. See the)-4.379 F F1 1.879(HFS BOO)4.379 +F(T)-.4 E(DRIVER)144 465.6 Q F0(section belo)2.5 E 1.3 -.65(w. \()-.25 H +(Alpha\).).65 E F1(\255part)108 482.4 Q F0 .164 +(Generate an HFS partition table. By def)11.97 F .165 +(ault, no partition table is generated, b)-.1 F .165 +(ut some older Macin-)-.2 F .217(tosh CDR)144 494.4 R .217(OM dri)-.4 F +-.15(ve)-.25 G .217(rs need an HFS partition table on the CDR).15 F .216 +(OM to be able to recognize a h)-.4 F(ybrid)-.05 E(CDR)144 506.4 Q(OM.) +-.4 E F1(\255auto)108 523.2 Q F2 -.2(Au)2.5 G(toStart_\214le).2 E F0 +(Mak)144 535.2 Q 2.804(et)-.1 G .304(he HFS CD use the QuickT)-2.804 F +.304(ime 2.0 Autostart feature to launch an application or document.) +-.35 F .598(The gi)144 547.2 R -.15(ve)-.25 G 3.098<6e8c>.15 G .597(len\ +ame must be the name of a document or application located at the top le) +-3.098 F -.15(ve)-.25 G 3.097(lo).15 G 3.097(ft)-3.097 G(he)-3.097 E +(CD. The \214lename must be less than 12 characters. \(Alpha\).)144 +559.2 Q F1(\255cluster)108 576 Q(-size)-.37 E F2(size)2.5 E F0 3.172(Se\ +t the size in bytes of the cluster or allocation units of PC Exchange \ +\214les. Implies the)144 588 R F1(\255\255exchange)144 600 Q F0 +(option. See the)2.5 E F1(HFS MA)2.5 E(CINT)-.55 E(OSH FILE FORMA)-.18 E +(TS)-.95 E F0(section belo)2.5 E -.65(w.)-.25 G F1(\255hide-hfs)108 +616.8 Q F2(glob)2.5 E F0(Hide)144 628.8 Q F2(glob)3.005 E F0 .505 +(from the HFS v)3.005 F .505 +(olume. The \214le or directory will still e)-.2 F .504 +(xist in the ISO9660 and/or Joliet)-.15 F(directory)144 640.8 Q(.)-.65 E +F2(glob)5.252 E F0 .253 +(is a shell wild-card-style pattern that must match an)2.752 F 2.753(yp) +-.15 G .253(art of the \214lename Multiple)-2.753 F(globs may be e)144 +652.8 Q 2.5(xcluded. Example:)-.15 F +(mkisofs \255o rom \255hfs \255hide-hfs '*.o' \255hide-hfs foobar)144 +676.8 Q -.1(wo)144 700.8 S .942(uld e).1 F .941 +(xclude all \214les ending in ".o" or called "foobar" from the HFS v) +-.15 F .941(olume. Note that if you)-.2 F .65(had a directory called "f\ +oobar" it too \(and of course all its descendants\) w)144 712.8 R .65 +(ould be e)-.1 F 3.15(xcluded. The)-.15 F F2(glob)144 724.8 Q F0 2.287 +(can also be a path name relati)4.787 F 2.587 -.15(ve t)-.25 H 4.787(ot) +.15 G 2.287(he source directories gi)-4.787 F -.15(ve)-.25 G 4.787(no) +.15 G 4.787(nt)-4.787 G 2.286(he command line.)-4.787 F -1.11(Ve)72 768 +S(rsion 2.0)1.11 E(24 Dec 2002)162.9 E(11)198.45 E EP +%%Page: 12 12 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R +(Example:)144 84 Q(mkisofs \255o rom \255hfs \255hide-hfs src/html src) +144 108 Q -.1(wo)144 132 S 1.108(uld e).1 F 1.108(xclude just the \214l\ +e or directory called "html" from the "src" directory)-.15 F 3.608(.A) +-.65 G 1.408 -.15(ny o)-3.608 H 1.109(ther \214le or).15 F 1.256 +(directory called "html" in the tree will not be e)144 144 R 3.756 +(xcluded. Should)-.15 F 1.256(be used with the)3.756 F/F1 10 +/Times-Bold@0 SF(\255hide)3.756 E F0(and/or)3.756 E F1(\255hide-joliet) +144 156 Q F0 4.695(options. In)4.695 F 2.196 +(order to match a directory name, mak)4.695 F 4.696(es)-.1 G 2.196 +(ure the pathname does not)-4.696 F(include a trailing '/' character)144 +168 Q 2.5(.S)-.55 G(ee README.hide for more details.)-2.5 E F1 +(\255hide-hfs-list)108 184.8 Q/F2 10/Times-Italic@0 SF(\214le)2.5 E F0 +2.5<418c>144 196.8 S(le containing a list of)-2.5 E F2(globs)2.5 E F0 +(to be hidden as abo)2.5 E -.15(ve)-.15 G(.).15 E F1(\255hfs-v)108 213.6 +Q(olid)-.1 E F2(hfs_volid)2.5 E F0 -1.29(Vo)144 225.6 S .699(lume name \ +for the HFS partition. This is the name that is assigned to the disc on\ + a Macintosh)1.29 F(and replaces the)144 237.6 Q F2(volid)2.5 E F0 +(used with the)2.5 E F1<ad56>2.5 E F0(option)2.5 E F1(\255icon-position) +108 254.4 Q F0 .559(Use the icon position information, if it e)144 266.4 +R .559(xists, from the Apple/Unix \214le.)-.15 F .56 +(The icons will appear in)5.56 F .924(the same position as the)144 278.4 +R 3.423(yw)-.15 G .923(ould on a Macintosh desktop. F)-3.523 F .923 +(older location and size on screen, its)-.15 F .024 +(scroll positions, folder V)144 290.4 R(ie)-.6 E 2.524(w\()-.25 G(vie) +-2.524 E 2.524(wa)-.25 G 2.525(sI)-2.524 G .025 +(cons, Small Icons, etc.\) are also preserv)-2.525 F 2.525(ed. This)-.15 +F .025(option may)2.525 F(become set by def)144 302.4 Q +(ault in the future.)-.1 E(\(Alpha\).)5 E F1<ad72>108 319.2 Q(oot-inf) +-.18 E(o)-.25 E F2(\214le)2.5 E F0 .117 +(Set the location, size on screen, scroll positions, folder V)144 331.2 +R(ie)-.6 E 2.617(we)-.25 G .117(tc. for the root folder of an HFS v) +-2.617 F(ol-)-.2 E(ume. See README.rootinfo for more information.)144 +343.2 Q(\(Alpha\))5 E F1(\255pr)108 360 Q(ep-boot)-.18 E F2(FILE)2.5 E +F0(PReP boot image \214le. Up to 4 are allo)144 372 Q +(wed. See README.prep_boot \(Alpha\))-.25 E F1(\255input-hfs-charset)108 +388.8 Q F2 -.15(ch)2.5 G(ar).15 E(set)-.1 E F0 .788(Input charset that \ +de\214nes the characters used in HFS \214le names when used with the)144 +400.8 R F2(\255mac-name)3.288 E F0 2.782(option. The)144 412.8 R(def) +2.782 E .282(ault charset is cp10000 \(Mac Roman\))-.1 F F2(cp10000) +2.782 E F0 .281(\(Mac Roman\) See)2.781 F F1(CHARA)2.781 E(CTER)-.55 E +(SETS)144 424.8 Q F0(and)2.5 E F1(HFS MA)2.5 E(CINT)-.55 E(OSH FILE N) +-.18 E(AMES)-.2 E F0(sections belo)2.5 E 2.5(wf)-.25 G(or more details.) +-2.5 E F1(\255output-hfs-charset)108 441.6 Q F2 -.15(ch)2.5 G(ar).15 E +(set)-.1 E F0 .591(Output charset that de\214nes the characters that wi\ +ll be used in the HFS \214le names. Def)144 453.6 R .591(aults to the) +-.1 F(input charset. See)144 465.6 Q F1(CHARA)2.5 E(CTER SETS)-.55 E F0 +(section belo)2.5 E 2.5(wf)-.25 G(or more details.)-2.5 E F1 +(\255hfs-unlock)108 482.4 Q F0 1.576(By def)144 494.4 R(ault,)-.1 E F1 +(mkisofs)4.076 E F0 1.576(will create an HFS v)4.076 F 1.575 +(olume that is)-.2 F F2(loc)4.075 E -.1(ke)-.2 G(d).1 E F0 6.575(.T).77 +G 1.575(his option lea)-6.575 F -.15(ve)-.2 G 4.075(st).15 G 1.575(he v) +-4.075 F(olume)-.2 E(unlock)144 506.4 Q 1.029 +(ed so that other applications \(e.g.)-.1 F 1.029 +(hfsutils\) can modify the v)6.029 F 1.03(olume. See the)-.2 F F1 1.03 +(HFS PR)3.53 F(OB-)-.3 E(LEMS/LIMIT)144 518.4 Q -.95(AT)-.9 G(IONS).95 E +F0(section belo)2.5 E 2.5(wf)-.25 G(or w)-2.5 E +(arnings about using this option.)-.1 E F1(\255hfs-bless)108 535.2 Q F2 +(folder_name)2.5 E F0 .065("Bless" the gi)144 547.2 R -.15(ve)-.25 G +2.565(nd).15 G .065(irectory \(folder\). This is usually the)-2.565 F F1 +.064(System F)2.564 F(older)-.25 E F0 .064(and is used in creating HFS) +2.564 F .645 +(bootable CDs. The name of the directory must be the whole path name as) +144 559.2 R F1(mkisofs)3.145 E F0 .645(sees it. e.g. if)3.145 F .369 +(the gi)144 571.2 R -.15(ve)-.25 G 2.869(np).15 G .369 +(athspec is ./cddata and the required folder is called System F)-2.869 F +(older)-.15 E 2.868(,t)-.4 G .368(hen the whole path)-2.868 F +(name is "./cddata/System F)144 583.2 Q +(older" \(remember to use quotes if the name contains spaces\).)-.15 E +F1(\255hfs-parms)108 600 Q F2 -.9(PA)2.5 G(RAMETERS).9 E F0(Ov)144 612 Q +.355 +(erride certain parameters used to create the HFS \214le system. Unlik) +-.15 F .356(ely to be used in normal cir)-.1 F(-)-.2 E +(cumstances. See the libhfs_iso/h)144 624 Q +(ybrid.h source \214le for details.)-.05 E F1<adad636170>108 640.8 Q F0 +.16(Look for A)9.6 F .159(UFS CAP Macintosh \214les. Search for CAP App\ +le/Unix \214le formats only)-.55 F 2.659(.S)-.65 G .159(earching for) +-2.659 F .34 +(the other possible Apple/Unix \214le formats is disabled, unless other) +144 652.8 R F2 .34(double dash)2.84 F F0 .34(options are gi)2.84 F -.15 +(ve)-.25 G(n.).15 E F1(\255\255netatalk)108 669.6 Q F0(Look for NET)144 +681.6 Q -1.21 -1.11(AT A)-.93 H(LK Macintosh \214les)1.11 E F1 +(\255\255double)108 698.4 Q F0(Look for AppleDouble Macintosh \214les) +144 710.4 Q -1.11(Ve)72 768 S(rsion 2.0)1.11 E(24 Dec 2002)162.9 E(12) +198.45 E EP +%%Page: 13 13 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R/F1 10 +/Times-Bold@0 SF(\255\255ethershar)108 84 Q(e)-.18 E F0 +(Look for Helios EtherShare Macintosh \214les)144 96 Q F1(\255\255ushar) +108 112.8 Q(e)-.18 E F0(Look for IPT UShare Macintosh \214les)144 124.8 +Q F1(\255\255exchange)108 141.6 Q F0 +(Look for PC Exchange Macintosh \214les)144 153.6 Q F1<adad736769>108 +170.4 Q F0(Look for SGI Macintosh \214les)12.93 E F1(\255\255xinet)108 +187.2 Q F0(Look for XINET Macintosh \214les)144 199.2 Q F1 +(\255\255macbin)108 216 Q F0(Look for MacBinary Macintosh \214les)144 +228 Q F1(\255\255single)108 244.8 Q F0 +(Look for AppleSingle Macintosh \214les)144 256.8 Q F1<adad6461>108 +273.6 Q -.1(ve)-.25 G F0(Look for Thursby Softw)144 285.6 Q +(are Systems D)-.1 E -1.35(AV)-.4 G 2.5(EM)1.35 G(acintosh \214les)-2.5 +E F1<adad73666d>108 302.4 Q F0(Look for Microsoft')9.05 E 2.5(sS)-.55 G +(ervices for Macintosh \214les \(NT only\) \(Alpha\))-2.5 E F1 +(\255\255osx\255double)108 319.2 Q F0 +(Look for MacOS X AppleDouble Macintosh \214les)144 331.2 Q F1 +(\255\255osx\255hfs)108 348 Q F0(Look for MacOS X HFS Macintosh \214les) +144 360 Q/F2 10.95/Times-Bold@0 SF(CHARA)72 388.8 Q(CTER SETS)-.602 E F1 +(mkisofs)108 400.8 Q F0 1.262 +(processes \214le names in a POSIX compliant w)3.762 F 1.262 +(ay as strings of 8-bit characters.)-.1 F 2.861 -.8(To r)6.262 H 1.261 +(epresent all).8 F .803 +(codings for all languages, 8-bit characters are not suf)108 412.8 R +.803(\214cient. Unicode or)-.25 F F1(ISO-10646)3.303 E F0 .803 +(de\214ne character cod-)3.303 F 1.077 +(ings that need at least 21 bits to represent all kno)108 424.8 R 1.076 +(wn languages. The)-.25 F 3.576(ym)-.15 G 1.076(ay be represented with) +-3.576 F F1(UTF-32)3.576 E F0(,)A F1(UTF-16)108 436.8 Q F0(or)3.715 E F1 +(UTF-8)3.715 E F0(coding.)3.715 E F1(UTF-32)6.215 E F0 1.216 +(uses a plain 32-bit coding b)3.715 F 1.216(ut seems to be uncommon.)-.2 +F F1(UTF-16)6.216 E F0(is)3.716 E 1.137(used by Microsoft with W)108 +448.8 R 1.137(in32 with the disadv)-.4 F 1.136 +(antage that it only supports a subset of all codes and that)-.25 F +(16-bit characters are not compliant with the POSIX \214lesystem interf) +108 460.8 Q(ace.)-.1 E .161(Modern UNIX operating systems may use)108 +477.6 R F1(UTF-8)2.661 E F0 .161 +(coding for \214lenames. This coding allo)2.661 F .162 +(ws to use the com-)-.25 F .143(plete Unicode code set.)108 489.6 R .143 +(Each 32-bit character is represented by one or more 8-bit characters.) +5.143 F .143(If a character)5.143 F .484(is coded in)108 501.6 R F1 +(ISO-8859-1)2.984 E F0 .484 +(\(used in Central Europe and North America\) is maps 1:1 to a)2.984 F +F1(UTF-32)2.985 E F0(or)2.985 E F1(UTF-16)2.985 E F0 .99 +(coded Unicode character)108 513.6 R 5.99(.I)-.55 G 3.49(fac)-5.99 G .99 +(haracter is coded in)-3.49 F F1 .989(7-Bit ASCII)3.489 F F0 .989 +(\(used in USA and other countries with)3.489 F 1.436 +(limted character set\) is maps 1:1 to a)108 525.6 R F1(UTF-32)3.936 E +F0(,)A F1(UTF-16)3.936 E F0(or)3.936 E F1(UTF-8)3.936 E F0 1.436 +(coded Unicode character)3.936 F 6.436(.C)-.55 G(haracter)-6.436 E 1.127 +(codes that cannot be represented as a single byte in UTF-8 \(typically\ + if the v)108 537.6 R 1.126(alue is > 0x7F\) use escape)-.25 F +(sequences that map to more than one 8-bit character)108 549.6 Q(.)-.55 +E 1.547(If all operating systems w)108 566.4 R 1.547(ould use)-.1 F F1 +(UTF-8)4.047 E F0(coding,)4.047 E F1(mkisofs)4.047 E F0 -.1(wo)4.048 G +1.548(uld not need to recode characters in \214le).1 F 3.398 +(names. Unfortunately)108 578.4 R 3.398(,A)-.65 G .897(pple uses comple\ +tely nonstandard codings and Microsoft uses a Unicode coding)-3.398 F +(that is not compatible with the POSIX \214lename interf)108 590.4 Q +(ace.)-.1 E -.15(Fo)108 607.2 S 3.143(ra).15 G .643(ll non)-3.143 F F1 +(UTF-8)3.143 E F0 .644(coded operating systems, the actual character th\ +at each byte represents depends on the)3.143 F/F3 10/Times-Italic@0 SF +-.15(ch)108 619.2 S(ar).15 E .267(acter set)-.15 F F0(or)2.767 E F3 +(codepa)2.766 E -.1(ge)-.1 G F0 .266(\(which is the name used by Micros\ +oft\) used by the local operating system in use)2.866 F 2.5(-t)108 631.2 +S(he characters in a character set will re\215ect the re)-2.5 E +(gion or natural language used by the user)-.15 E(.)-.55 E .728(Usually\ + character codes 0x00-0x1f are control characters, codes 0x20-0x7f are \ +the 7 bit ASCII characters)108 648 R .569(and \(on PC')108 660 R 3.069 +(sa)-.55 G .569(nd Mac')-3.069 F .569(s\) 0x80-0xf)-.55 F 3.069(fa)-.25 +G .569(re used for other characters.)-3.069 F .569(Unfortunately e)5.569 +F -.15(ve)-.25 G 3.068(nt).15 G .568(his does not follo)-3.068 F(w)-.25 +E .98(ISO standards that reserv)108 672 R 3.48(et)-.15 G .981 +(he range 0x80-0x9f for control characters and only allo)-3.48 F 3.481 +(w0)-.25 G(xa0-0xf)-3.481 E 3.481(ff)-.25 G .981(or other)-3.481 F +(characters.)108 684 Q .139(As there is a lot more than 256 characters/\ +symbols in use, only a small subset are represented in a character)108 +700.8 R .653(set. Therefore the same character code may represent a dif) +108 712.8 R .653(ferent character in dif)-.25 F .653 +(ferent character sets. So a)-.25 F .417(\214le name generated, say in \ +central Europe, may not display the same character when vie)108 724.8 R +.416(wed on a machine)-.25 F -1.11(Ve)72 768 S(rsion 2.0)1.11 E +(24 Dec 2002)162.9 E(13)198.45 E EP +%%Page: 14 14 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R +(in, say eastern Europe.)108 84 Q 1.658 -.8(To m)108 100.8 T(ak).8 E +2.558(em)-.1 G .058(atters more complicated, dif)-2.558 F .059 +(ferent operating systems use dif)-.25 F .059 +(ferent character sets for the re)-.25 F .059(gion or)-.15 F .346 +(language. F)108 112.8 R .346(or e)-.15 F .346(xample the character cod\ +e for "small e with acute accent" may be character code 0x82 on a)-.15 F +.316(PC, code 0x8e on a Macintosh and code 0x)108 124.8 R .317 +(e9 on a UNIX system.)-.15 F .317 +(Note while the codings used on a PC or)5.317 F .564(Mac are nonstandar\ +d, Unicode codes this character as 0x00000000e9 which is basically the \ +same v)108 136.8 R .564(alue as)-.25 F(the v)108 148.8 Q +(alue used by most UNIX systems.)-.25 E .24(As long as not all operatin\ +g systems and applications will use the Unicode character set as the ba\ +sis for \214le)108 165.6 R .101(names in a unique w)108 177.6 R(ay)-.1 E +2.601(,i)-.65 G 2.601(tm)-2.601 G .1(ay be necessary to specify which c\ +haracter set your \214le names use in and which)-2.601 F +(character set the \214le names should appear on the CD.)108 189.6 Q +(There are four options to specify the character sets you w)108 206.4 Q +(ant to use:)-.1 E(\255input-charset)108 223.2 Q .249 +(De\214nes the local character set you are using on your host machine.) +144 235.2 R(An)5.25 E 2.75(yc)-.15 G .25(haracter set con)-2.75 F -.15 +(ve)-.4 G(rsions).15 E .665(that tak)144 247.2 R 3.165(ep)-.1 G .664 +(lace will use this character set as the staring point. The def)-3.165 F +.664(ault input character sets are)-.1 F/F1 10/Times-Italic@0 SF(cp437) +144 259.2 Q F0(on DOS based systems and)2.5 E F1(iso8859-1)2.5 E F0 +(on all other systems.)2.5 E .069(If the)144 283.2 R F1<ad4a>2.569 E F0 +.069(option is gi)2.569 F -.15(ve)-.25 G .069(n, then the Unicode equi) +.15 F -.25(va)-.25 G .07 +(lents of the input character set will be used in the).25 F 2.42 +(Joliet directory)144 295.2 R 4.92(.U)-.65 G 2.42(sing the)-4.92 F F1 +(\255jc)4.92 E(har)-.15 E(set)-.1 E F0 2.419 +(option is the same as using the)4.919 F F1(\255input-c)4.919 E(har)-.15 +E(set)-.1 E F0(and)4.919 E F1<ad4a>4.919 E F0(options.)144 307.2 Q +(\255output-charset)108 324 Q .543(De\214nes the character set that wil\ +l be used with for the Rock Ridge names on the CD. Def)144 336 R .543 +(aults to)-.1 F .182(the input character set. Only lik)144 348 R .182 +(ely to be useful if used on a non-Unix platform. e.g. using)-.1 F/F2 10 +/Times-Bold@0 SF(mkisofs)2.681 E F0 1.131(on a Microsoft W)144 360 R +1.131(in32 machine to create Rock Ridge CDs. If you are using)-.4 F F2 +(mkisofs)3.631 E F0 1.132(on a Unix)3.632 F(machine, it is lik)144 372 Q +(ely that the output character set will be the same as the input charac\ +ter set.)-.1 E(\255input-hfs-charset)108 388.8 Q 3.079(De\214nes the HF\ +S character set used for HFS \214le names decoded from an)144 400.8 R +5.579(yo)-.15 G 5.579(ft)-5.579 G 3.079(he v)-5.579 F(arious)-.25 E .607 +(Apple/Unix \214le formats. Only useful when used with)144 412.8 R F1 +(\255mac-name)3.108 E F0 .608(option. See the)3.108 F F2 .608(HFS MA) +3.108 F(CIN-)-.55 E -.18(TO)144 424.8 S(SH FILE N).18 E(AMES)-.2 E F0 +(for more information. Def)2.5 E(aults to)-.1 E F1(cp10000)2.5 E F0 +(\(Mac Roman\).)2.5 E(\255output-hfs-charset)108 441.6 Q .199(De\214nes\ + the HFS character set used to create HFS \214le names from the input c\ +haracter set in use. In)144 453.6 R .194 +(most cases this will be from the character set gi)144 465.6 R -.15(ve) +-.25 G 2.694(nw).15 G .194(ith the)-2.694 F F1(\255input-c)2.694 E(har) +-.15 E(set)-.1 E F0 .194(option. Def)2.694 F .194(aults to the)-.1 F +(input HFS character set.)144 477.6 Q .178 +(There are a number of character sets b)108 494.4 R .177(uilt in to)-.2 +F F1(mkisofs)2.677 E F0 5.177(.T).27 G 2.677(og)-5.977 G .177 +(et a listing, use)-2.677 F F2 .177(mkisofs \255input-charset help.) +2.677 F F0 .584 +(Additional character sets can be read from \214le for an)108 511.2 R +3.085(yo)-.15 G 3.085(ft)-3.085 G .585(he character set options by gi) +-3.085 F .585(ving a \214lename as)-.25 F .52(the ar)108 523.2 R .519 +(gument to the options. The gi)-.18 F -.15(ve)-.25 G 3.019<6e8c>.15 G +.519(le will only be read if its name does not match one of the b)-3.019 +F .519(uilt in)-.2 F(character sets.)108 535.2 Q 2.159(The format of th\ +e character set \214les is the same as the mapping \214les a)108 552 R +-.25(va)-.2 G 2.16(ilable from http://www).25 F(.uni-)-.65 E(code.or)108 +564 Q(g/Public/MAPPINGS The format of these \214les is:)-.18 E +(Column #1 is the input byte code \(in he)144 588 Q 2.5(xa)-.15 G 2.5 +(s0)-2.5 G(xXX\))-2.5 E(Column #2 is the Unicode \(in he)144 600 Q 2.5 +(xa)-.15 G 2.5(s0)-2.5 G(xXXXX\))-2.5 E(Rest of the line is ignored.)144 +612 Q(An)108 636 Q 3.273(yb)-.15 G .773(lank line, line without tw) +-3.273 F 3.273(o\()-.1 G .773(or more\) columns in the abo)-3.273 F +1.073 -.15(ve f)-.15 H .773(ormat or comments lines \(starting with).15 +F .242(the # character\) are ignored without an)108 648 R 2.742(yw)-.15 +G .242(arnings. An)-2.842 F 2.743(ym)-.15 G .243 +(issing input code is mapped to Unicode character)-2.743 F(0x0000.)108 +660 Q .04(Note that there is no support for 16 bit UNICODE \(UTF-16\) o\ +r 32 bit UNICODE \(UTF-32\) coding because)108 676.8 R .457(this coding\ + is not POSIX compliant. There should be support for UTF-8 UNICODE codi\ +ng which is com-)108 688.8 R(patible to POSIX \214lenames and supported\ + by moder UNIX implementations such as Solaris.)108 700.8 Q 3.654(A1)108 +717.6 S 1.154(:1 character set mapping can be de\214ned by using the k) +-3.654 F -.15(ey)-.1 G -.1(wo).15 G(rd).1 E F1(default)3.654 E F0 1.153 +(as the ar)3.654 F 1.153(gument to an)-.18 F 3.653(yo)-.15 G 3.653(ft) +-3.653 G(he)-3.653 E(character set options. This is the beha)108 729.6 Q +(viour of older \(v1.12\) v)-.2 E(ersions of)-.15 E F2(mkisofs)2.5 E F0 +(.)A -1.11(Ve)72 768 S(rsion 2.0)1.11 E(24 Dec 2002)162.9 E(14)198.45 E +EP +%%Page: 15 15 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R .39(The\ + ISO9660 \214le names generated from the input \214lenames are not con) +108 84 R -.15(ve)-.4 G .391(rted from the input character set.).15 F +1.029(The ISO9660 character set is a v)108 96 R 1.028 +(ery limited subset of the ASCII characters, so an)-.15 F 3.528(yc)-.15 +G(on)-3.528 E -.15(ve)-.4 G 1.028(rsion w).15 F 1.028(ould be)-.1 F +(pointless.)108 108 Q(An)108 124.8 Q 2.5(yc)-.15 G(haracter that)-2.5 E +/F1 10/Times-Bold@0 SF(mkisofs)2.5 E F0(can not con)2.5 E -.15(ve)-.4 G +(rt will be replaced with a '_' character).15 E(.)-.55 E/F2 10.95 +/Times-Bold@0 SF(HFS CREA)72 146.4 Q -.197(TO)-1.04 G(R/TYPE).197 E F0 +3.173(AM)108 158.4 S .673(acintosh \214le has tw)-3.173 F 3.173(op)-.1 G +.673(roperties associated with it which de\214ne which application crea\ +ted the \214le, the)-3.173 F/F3 10/Times-Italic@0 SF(CREA)108 170.4 Q +-.18(TO)-.37 G(R).18 E F0 .019(and what data the \214le contains, the) +2.519 F F3(TYPE)2.518 E F0 5.018(.B).73 G .018(oth are \(e)-5.018 F .018 +(xactly\) 4 letter strings. Usually this allo)-.15 F(ws)-.25 E 2.567(aM) +108 182.4 S .067(acintosh user to double-click on a \214le and launch t\ +he correct application etc. The CREA)-2.567 F -.18(TO)-1.11 G 2.567(Ra) +.18 G .068(nd TYPE)-2.567 F +(of a particular \214le can be found by using something lik)108 194.4 Q +2.5(eR)-.1 G(esEdit \(or similar\) on a Macintosh.)-2.5 E .059(The CREA) +108 211.2 R -.18(TO)-1.11 G 2.559(Ra).18 G .059 +(nd TYPE information is stored in all the v)-2.559 F .059 +(arious Apple/Unix encoded \214les.)-.25 F -.15(Fo)5.058 G 2.558(ro).15 +G .058(ther \214les)-2.558 F .214(it is possible to base the CREA)108 +223.2 R -.18(TO)-1.11 G 2.714(Ra).18 G .214(nd TYPE on the \214lename') +-2.714 F 2.715(se)-.55 G .215(xtension using a)-2.865 F F3(mapping)2.715 +E F0 .215(\214le \(the)2.715 F F1(\255map)2.715 E F0 1.257 +(option\) and/or using the)108 235.2 R F3(ma)3.757 E 1.257(gic number) +-.1 F F0 1.257(\(usually a)3.757 F F3(signatur)3.757 E(e)-.37 E F0 1.257 +(in the \214rst fe)3.757 F 3.756(wb)-.25 G 1.256 +(ytes\) of a \214le \(the)-3.756 F F1(\255magic)3.756 E F0 1.1 +(option\). If both these options are gi)108 247.2 R -.15(ve)-.25 G 1.1 +(n, then their order on the command line is important. If the).15 F F1 +(\255map)3.6 E F0 .316(option is gi)108 259.2 R -.15(ve)-.25 G 2.816 +<6e8c>.15 G .316(rst, then a \214lename e)-2.816 F .315 +(xtension match is attempted before a magic number match. Ho)-.15 F(we) +-.25 E -.15(ve)-.25 G -.4(r,).15 G 1.059(if the)108 271.2 R F1 +(\255magic)3.559 E F0 1.059(option is gi)3.559 F -.15(ve)-.25 G 3.559 +<6e8c>.15 G 1.06 +(rst, then a magic number match is attempted before a \214lename e) +-3.559 F(xtension)-.15 E(match.)108 283.2 Q .534(If a mapping or magic \ +\214le is not used, or no match is found then the def)108 300 R .534 +(ault CREA)-.1 F -.18(TO)-1.11 G 3.033(Ra).18 G .533(nd TYPE for all) +-3.033 F(re)108 312 Q .853 +(gular \214les can be set by using entries in the)-.15 F F1(.mkisofsr) +3.354 E(c)-.18 E F0 .854(\214le or using the)3.354 F F1(\255hfs-cr)3.354 +E(eator)-.18 E F0(and/or)3.354 E F1(\255hfs-type)3.354 E F0 +(options, otherwise the def)108 324 Q(ault CREA)-.1 E -.18(TO)-1.11 G +2.5(Ra).18 G(nd TYPE are 'unix' and 'TEXT'.)-2.5 E .131 +(The format of the)108 340.8 R F3(mapping)2.631 E F0 .131 +(\214le is the same)2.631 F F3(afp\214le)2.631 E F0 .131 +(format as used by)2.631 F F3(aufs)2.631 E F0 5.131(.T).27 G .131 +(his \214le has \214v)-5.131 F 2.631(ec)-.15 G .131(olumns for the) +-2.631 F F3 -.2(ex)108 352.8 S(tension).2 E F0(,).24 E F3 .485 +(\214le tr)2.985 F(anslation)-.15 E F0(,).24 E F3(CREA)2.985 E -.18(TO) +-.37 G(R).18 E F0(,).27 E F3(TYPE)2.985 E F0(and)2.986 E F3(Comment) +2.986 E F0 5.486(.L).68 G .486 +(ines starting with the '#' character are com-)-5.486 F +(ment lines and are ignored. An e)108 364.8 Q(xample \214le w)-.15 E +(ould be lik)-.1 E(e:)-.1 E 2.5(#E)108 381.6 S +(xample \214lename mapping \214le)-2.5 E(#)108 393.6 Q 2.5(#E)108 405.6 +S 12.5(XTN XLate CREA)-2.5 F -.18(TO)-1.11 G 15(RT).18 G 24.71 +(YPE Comment)-15 F 35.27(.tif Ra)108 417.6 R 21.81(w')-.15 G 27.33 +(8BIM' 'TIFF')-21.81 F("Photoshop TIFF image")24.99 E 29.16(.hqx Ascii) +108 429.6 R 27.33('BnHq' 'TEXT')18.88 F("BinHe)20 E 2.5<788c>-.15 G(le") +-2.5 E 29.72(.doc Ra)108 441.6 R 21.81(w')-.15 G 20.11(MSWD' 'WDBN') +-21.81 F("W)15 E(ord \214le")-.8 E(.mo)108 453.6 Q 29.03(vR)-.15 G 19.61 +-.15(aw ')-29.03 H(TV).15 E 23.85(OD' 'MooV')-.4 F("QuickT)19.44 E +(ime Mo)-.35 E(vie")-.15 E 44.16(*A)108 465.6 S 16.38(scii ')-44.16 F +38.06(ttxt' 'TEXT')-.18 F("T)20 E -.15(ex)-.7 G 2.5<748c>.15 G(le")-2.5 +E(Where:)108 482.4 Q .905(The \214rst column)144 499.2 R F3(EXTN)3.405 E +F0 .905(de\214nes the Unix \214lename e)3.405 F .905 +(xtension to be mapped. The def)-.15 F .905(ault mapping)-.1 F(for an) +144 511.2 Q 2.5<798c>-.15 G(lename e)-2.5 E(xtension that doesn')-.15 E +2.5(tm)-.18 G(atch is de\214ned with the "*" character)-2.5 E(.)-.55 E +(The)144 528 Q F3(Xlate)3.685 E F0 1.185 +(column de\214nes the type of te)3.685 F 1.185 +(xt translation between the Unix and Macintosh \214le it is)-.15 F .866 +(ignored by)144 540 R F1(mkisofs)3.366 E F0 3.366(,b)C .866(ut is k) +-3.566 F .865(ept to be compatible with)-.1 F F1(aufs)3.365 E F0 3.365 +(\(1\). Although)B F1(mkisofs)3.365 E F0 .865(does not alter)3.365 F +.461(the contents of a \214le, if a binary \214le has it')144 552 R +2.961(sT)-.55 G .461(YPE set as 'TEXT', it)-2.961 F F3(may)2.961 E F0 +.461(be read incorrectly on a)2.961 F +(Macintosh. Therefore a better choice for the def)144 564 Q +(ault TYPE may be '????')-.1 E(The)144 580.8 Q F3(CREA)2.5 E -.18(TO) +-.37 G(R).18 E F0(and)2.5 E F3(TYPE)2.5 E F0 -.1(ke)2.5 G(yw)-.05 E +(ords must be 4 characters long and enclosed in single quotes.)-.1 E +.508 +(The comment \214eld is enclosed in double quotes - it is ignored by)144 +597.6 R F1(mkisofs)3.008 E F0 3.008(,b)C .508(ut is k)-3.208 F .507 +(ept to be com-)-.1 F(patible with)144 609.6 Q F1(aufs)2.5 E F0(.)A .024 +(The format of the)108 626.4 R F3(ma)2.524 E(gic)-.1 E F0 .024 +(\214le is almost identical to the)2.524 F F1(magic)2.524 E F0 .024 +(\(4\) \214le used by the Linux)B F1(\214le)2.524 E F0 .024 +(\(1\) command - the)B(routines for reading and decoding the)108 638.4 Q +F3(ma)2.5 E(gic)-.1 E F0(\214le are based on the Linux)2.5 E F1(\214le) +2.5 E F0(\(1\) command.)A .479 +(This \214le has four tab separated columns for the)108 655.2 R F3 .479 +(byte of)2.979 F(fset)-.18 E F0(,).68 E F3(type)2.979 E F0(,).18 E F3 +(test)2.979 E F0(and)2.979 E F3(messa)2.979 E -.1(ge)-.1 G F0 5.479(.L) +.28 G .478(ines starting with the)-5.479 F +('#' character are comment lines and are ignored. An e)108 667.2 Q +(xample \214le w)-.15 E(ould be lik)-.1 E(e:)-.1 E 2.5(#E)108 684 S +(xample magic \214le)-2.5 E(#)108 696 Q 2.5(#o)108 708 S 13 -.25(ff t) +-2.5 H 24.72(ype test).25 F(message)36.67 E -1.11(Ve)72 768 S(rsion 2.0) +1.11 E(24 Dec 2002)162.9 E(15)198.45 E EP +%%Page: 16 16 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R 28.91 +(0s)108 84 S 19.16(tring GIF8)-28.91 F(8BIM GIFf)29.45 E(GIF image)5 E +28.91(0b)108 96 S 12.5(eshort 0xf)-28.91 F 21.65(fd8 8BIM)-.25 F 2.5 +(JPEG image)2.5 F(data)2.5 E 28.91(0s)108 108 S 19.16(tring SIT!)-28.91 +F(SIT! SIT!)32.23 E(Stuf)5 E(fIt Archi)-.25 E -.15(ve)-.25 G 28.91(0s) +108 120 S 19.16(tring \\037\\235)-28.91 F(LZIV ZIVU)15 E +(standard unix compress)5 E 28.91(0s)108 132 S 19.16(tring \\037\\213) +-28.91 F(GNUz ZIVU)15 E(gzip compressed data)5 E 28.91(0s)108 144 S +19.16(tring %!)-28.91 F(ASPS TEXT)38.9 E(Postscript)5 E 28.91(0s)108 156 +S 19.16(tring \\004%!)-28.91 F(ASPS TEXT)21.12 E +(PC Postscript with a ^D to start)5 E 28.91(4s)108 168 S 19.16 +(tring moo)-28.91 F 27.93(vt)-.15 G(xtt MooV)-27.93 E(QuickT)5 E(ime mo) +-.35 E(vie \214le \(moo)-.15 E(v\))-.15 E 28.91(4s)108 180 S 19.16 +(tring mdat)-28.91 F(txtt MooV)30.56 E(QuickT)5 E(ime mo)-.35 E +(vie \214le \(mdat\))-.15 E .132 +(The format of the \214le is described in the)108 196.8 R/F1 10 +/Times-Bold@0 SF(magic)2.632 E F0 .132(\(4\) man page. The only dif)B +.132(ference here is that for each entry)-.25 F .711 +(in the magic \214le, the)108 208.8 R/F2 10/Times-Italic@0 SF(messa) +3.211 E -.1(ge)-.1 G F0 .711(for the initial of)3.311 F(fset)-.25 E F1 +(must)3.211 E F0 .71(be 4 characters for the CREA)3.21 F -.18(TO)-1.11 G +3.21(Rf).18 G(ollo)-3.21 E .71(wed by 4)-.25 F 1.603 +(characters for the TYPE - white space is optional between them. An)108 +220.8 R 4.103(yo)-.15 G 1.603(ther characters on this line are)-4.103 F +2.5(ignored. Continuation)108 232.8 R(lines \(starting with a '>'\) are\ + also ignored i.e. only the initial of)2.5 E(fset lines are used.)-.25 E +.456(Using the)108 249.6 R F1(\255magic)2.956 E F0 .456(option may sign\ +i\214cantly increase processing time as each \214le has to opened and r\ +ead to)2.956 F(\214nd it')108 261.6 Q 2.5(sm)-.55 G(agic number)-2.5 E +(.)-.55 E .665(In summary)108 278.4 R 3.165(,f)-.65 G .665 +(or all \214les, the def)-3.165 F .665(ault CREA)-.1 F -.18(TO)-1.11 G +3.165(Ri).18 G 3.166(s')-3.165 G .666(unix' and the def)-3.166 F .666 +(ault TYPE is 'TEXT'.)-.1 F .666(These can be)5.666 F +(changed by using entries in the)108 290.4 Q F2(.mkisofsr)2.5 E(c)-.37 E +F0(\214le or by using the)2.5 E F1(\255hfs-cr)2.5 E(eator)-.18 E F0 +(and/or)2.5 E F1(\255hfs-type)2.5 E F0(options.)2.5 E .63 +(If the a \214le is in one of the kno)108 307.2 R .63(wn Apple/Unix for\ +mats \(and the format has been selected\), then the CRE-)-.25 F -.46 +-1.11(AT O)108 319.2 T 2.5(Ra)1.11 G(nd TYPE are tak)-2.5 E +(en from the v)-.1 E(alues stored in the Apple/Unix \214le.)-.25 E .773 +(Other \214les can ha)108 336 R 1.073 -.15(ve t)-.2 H .773(heir CREA).15 +F -.18(TO)-1.11 G 3.273(Ra).18 G .773 +(nd TYPE set from their \214le name e)-3.273 F .773(xtension \(the)-.15 +F F1(\255map)3.273 E F0 .773(option\), or)3.273 F .342 +(their magic number \(the)108 348 R F1(\255magic)2.842 E F0 .342 +(option\). If the def)2.842 F .342(ault match is used in the)-.1 F F2 +(mapping)2.841 E F0 .341(\214le, then these v)2.841 F(alues)-.25 E -.15 +(ove)108 360 S(rride the def).15 E(ault CREA)-.1 E -.18(TO)-1.11 G 2.5 +(Ra).18 G(nd TYPE.)-2.5 E 2.5(Af)108 376.8 S(ull CREA)-2.5 E -.18(TO) +-1.11 G(R/TYPE database can be found at http://www).18 E +(.angel\214re.com/il/szek)-.65 E(ely/inde)-.1 E(x.html)-.15 E/F3 10.95 +/Times-Bold@0 SF(HFS MA)72 405.6 Q(CINT)-.602 E(OSH FILE FORMA)-.197 E +(TS)-1.04 E F0 .788(Macintosh \214les ha)108 417.6 R 1.088 -.15(ve t)-.2 +H .989 -.1(wo p).15 H .789(arts called the).1 F F2(Data)3.289 E F0(and) +3.289 E F2(Resour)3.289 E(ce)-.37 E F0 .789(fork. Either may be empty) +3.289 F 3.289(.U)-.65 G .789(nix \(and man)-3.289 F(y)-.15 E .171 +(other OSs\) can only cope with \214les ha)108 429.6 R .171 +(ving one part \(or fork\). T)-.2 F 2.67(oa)-.8 G .17 +(dd to this, Macintosh \214les ha)-2.67 F .47 -.15(ve a n)-.2 H(umber) +.15 E .136(of attrib)108 441.6 R .137(utes associated with them - proba\ +bly the most important are the TYPE and CREA)-.2 F -.18(TO)-1.11 G .137 +(R. Ag).18 F .137(ain Unix)-.05 F +(has no concept of these types of attrib)108 453.6 Q(utes.)-.2 E .032(e\ +.g. a Macintosh \214le may be a JPEG image where the image is stored in\ + the Data fork and a desktop thumb-)108 470.4 R .123(nail stored in the\ + Resource fork. It is usually the information in the data fork that is \ +useful across platforms.)108 482.4 R .425 +(Therefore to store a Macintosh \214le on a Unix \214lesystem, a w)108 +499.2 R .425(ay has to be found to cope with the tw)-.1 F 2.925(of)-.1 G +(orks)-2.925 E .914(and the e)108 511.2 R .914(xtra attrib)-.15 F .914 +(utes \(which are referred to as the)-.2 F F2 .914(\214nder info)3.414 F +F0 3.414(\). Unfortunately).18 F 3.414(,i)-.65 G 3.414(ts)-3.414 G .914 +(eems that e)-3.414 F -.15(ve)-.25 G .915(ry soft-).15 F -.1(wa)108 +523.2 S(re package that stores Macintosh \214les on Unix has chosen a c\ +ompletely dif).1 E(ferent storage method.)-.25 E +(The Apple/Unix formats that)108 540 Q F2(mkisofs)2.5 E F0 +(\(partially\) supports are:)2.5 E(CAP A)108 556.8 Q(UFS format)-.55 E +.224(Data fork stored in a \214le. Resource fork in subdirectory .resou\ +rce with same \214lename as data fork.)144 568.8 R +(Finder info in .\214nderinfo subdirectory with same \214lename.)144 +580.8 Q(AppleDouble/Netatalk)108 597.6 Q .262(Data fork stored in a \ +\214le. Resource fork stored in a \214le with same name pre\214x)144 +609.6 R .263(ed with "%". Finder)-.15 F .744 +(info also stored in same "%" \214le. Netatalk uses the same format, b) +144 621.6 R .744(ut the resource fork/\214nderinfo)-.2 F +(stored in subdirectory .AppleDouble with same name as data fork.)144 +633.6 Q(AppleSingle)108 650.4 Q(Data structures similar to abo)144 662.4 +Q -.15(ve)-.15 G 2.5(,e).15 G +(xcept both forks and \214nder info are stored in one \214le.)-2.65 E +(Helios EtherShare)108 679.2 Q .901(Data fork stored in a \214le. Resou\ +rce fork and \214nder info together in subdirectory .rsrc with same)144 +691.2 R(\214lename as data fork.)144 703.2 Q -1.11(Ve)72 768 S +(rsion 2.0)1.11 E(24 Dec 2002)162.9 E(16)198.45 E EP +%%Page: 17 17 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R +(IPT UShare)108 84 Q -1.11(Ve)144 96 S +(ry similar to the EtherShare format, b)1.11 E +(ut the \214nder info is stored slightly dif)-.2 E(ferently)-.25 E(.) +-.65 E(MacBinary)108 112.8 Q +(Both forks and \214nder info stored in one \214le.)144 124.8 Q +(Apple PC Exchange)108 141.6 Q .007 +(Used by Macintoshes to store Apple \214les on DOS \(F)144 153.6 R -1.11 +(AT)-.74 G 2.507(\)d)1.11 G 2.507(isks. Data)-2.507 F .007 +(fork stored in a \214le. Resource)2.507 F .06(fork in subdirectory res\ +ource.frk \(or RESOURCE.FRK\). Finder info as one record in \214le \214\ +nder)144 165.6 R(.dat)-.55 E(\(or FINDER.D)144 177.6 Q -1.11(AT)-.4 G +(\). Separate \214nder)1.11 E(.dat for each data fork directory)-.55 E +(.)-.65 E(Note:)144 194.4 Q/F1 10/Times-Italic@0 SF(mkisofs)2.821 E F0 +.321(needs to kno)2.821 F 2.821(wt)-.25 G .321(he nati)-2.821 F .621 +-.15(ve F)-.25 H 2.541 -1.11(AT c)-.59 H .32 +(luster size of the disk that the PC Exchange \214les are)1.11 F .349 +(on \(or ha)144 206.4 R .649 -.15(ve b)-.2 H .349 +(een copied from\). This size is gi).15 F -.15(ve)-.25 G 2.849(nb).15 G +2.85(yt)-2.849 G(he)-2.85 E/F2 10/Times-Bold@0 SF(\255cluster)2.85 E +(-size)-.37 E F0 2.85(option. The)2.85 F .35(cluster or allo-)2.85 F +(cation size can be found by using the DOS utility)144 218.4 Q F2 +(CHKDSK)2.5 E F0(.)A 1.125(May not w)144 235.2 R 1.125 +(ork with PC Exchange v2.2 or higher \214les \(a)-.1 F -.25(va)-.2 G +1.124(ilable with MacOS 8.1\).).25 F 1.124(DOS media)6.124 F +(containing PC Exchange \214les should be mounted as type)144 247.2 Q F2 +(msdos)2.5 E F0(\(not)2.5 E F2(vfat)2.5 E F0 2.5(\)w)C(hen using Linux.) +-2.5 E(SGI/XINET)108 264 Q .838(Used by SGI machines when the)144 276 R +3.338(ym)-.15 G .838 +(ount HFS disks. Data fork stored in a \214le. Resource fork in)-3.338 F +.069(subdirectory .HSResource with same name. Finder info as one record\ + in \214le .HSancillary)144 288 R 2.568(.S)-.65 G(eparate)-2.568 E +(.HSancillary for each data fork directory)144 300 Q(.)-.65 E +(Thursby Softw)108 316.8 Q(are Systems D)-.1 E -1.35(AV)-.4 G(E)1.35 E +(Allo)144 328.8 Q .177 +(ws Macintoshes to store Apple \214les on SMB serv)-.25 F 2.678 +(ers. Data)-.15 F .178(fork stored in a \214le. Resource fork)2.678 F(i\ +n subdirectory resource.frk. Uses the AppleDouble format to store resou\ +rce fork.)144 340.8 Q(Services for Macintosh)108 357.6 Q -.15(Fo)144 +369.6 S 1.712(rmat of \214les stored by NT Serv).15 F 1.711 +(ers on NTFS \214lesystems. Data fork is stored as "\214lename".)-.15 F +.208(Resource fork stored as a NTFS)144 381.6 R F1(str)2.708 E(eam)-.37 +E F0 .209(called "\214lename:AFP_Resource". The \214nder info is stored) +2.708 F 1.718(as a NTFS)144 393.6 R F1(str)4.218 E(eam)-.37 E F0 1.717 +(called "\214lename:Afp_AfpInfo". These streams are normally in)4.218 F +1.717(visible to the)-.4 F(user)144 405.6 Q(.)-.55 E -.8(Wa)144 422.4 S +.93(rning: mkisofs only partially supports the SFM format. If an HFS \ +\214le or folder stored on the).8 F .641(NT serv)144 434.4 R .641 +(er contains an)-.15 F F1(ille)3.141 E(gal)-.4 E F0 .641 +(NT character in its name, then NT con)3.141 F -.15(ve)-.4 G .64 +(rts these characters to).15 F F1(Pri-)3.14 E .223(vate Use Unicode)144 +446.4 R F0 .223(characters. The characters are: " * / < > ?)2.723 F +2.724(|a)5.224 G .224(lso a space or period if it is the last)-2.724 F +1.569(character of the \214le name, character codes 0x01 to 0x1f \(cont\ +rol characters\) and Apple' apple)144 458.4 R(logo.)144 470.4 Q +(Unfortunately)144 487.2 Q 3.731(,t)-.65 G 1.231(hese pri)-3.731 F -.25 +(va)-.25 G 1.232 +(te Unicode characters are not readable by the mkisofs NT e).25 F -.15 +(xe)-.15 G(cutable.).15 E 1.16(Therefore an)144 499.2 R 3.66<798c>-.15 G +1.16(le or directory name containing these characters will be ignored -\ + including the)-3.66 F(contents of an)144 511.2 Q 2.5(ys)-.15 G +(uch directory)-2.5 E(.)-.65 E(MacOS X AppleDouble)108 528 Q .729 +(When HFS/HFS+ \214les are copied or sa)144 540 R -.15(ve)-.2 G 3.229 +(db).15 G 3.229(yM)-3.229 G .73 +(acOS X on to a non-HFS \214le system \(e.g. UFS,)-3.229 F 1.092 +(NFS etc.\), the \214les are stored in AppleDouble format.)144 552 R +1.091(Data fork stored in a \214le. Resource fork)6.091 F +(stored in a \214le with same name pre\214x)144 564 Q +(ed with "._". Finder info also stored in same "._" \214le.)-.15 E +(MacOS X HFS \(Alpha\))108 580.8 Q .576 +(Not really an Apple/Unix encoding, b)144 592.8 R .577 +(ut actual HFS/HFS+ \214les on a MacOS X system. Data fork)-.2 F .875(s\ +tored in a \214le. Resource fork stored in a pseudo \214le with the sam\ +e name with the suf)144 604.8 R .875(\214x '/rsrc'.)-.25 F +(The \214nderinfo is only a)144 616.8 Q -.25(va)-.2 G +(ilable via a MacOS X library call.).25 E +(Notes: \(also see README.macosx\))144 633.6 Q(Only w)144 650.4 Q +(orks when used on MacOS X.)-.1 E .659(If a \214le is found with a zero\ + length resource fork and empty \214nderinfo, it is assumed not to ha) +144 667.2 R -.15(ve)-.2 G(an)144 679.2 Q 2.5(yA)-.15 G +(pple/Unix encoding - therefore a TYPE and CREA)-2.5 E -.18(TO)-1.11 G +2.5(Rc).18 G(an be set using other methods.)-2.5 E F1(mkisofs)108 696 Q +F0 .391(will attempt to set the CREA)2.891 F -.18(TO)-1.11 G .39 +(R, TYPE, date and possibly other \215ags from the \214nder info. Addi-) +.18 F(tionally)108 708 Q 3.581(,i)-.65 G 3.581(fi)-3.581 G 3.581(te) +-3.581 G 1.081(xists, the Macintosh \214lename is set from the \214nder\ + info, otherwise the Macintosh name is)-3.731 F +(based on the Unix \214lename - see the)108 720 Q F2(HFS MA)2.5 E(CINT) +-.55 E(OSH FILE N)-.18 E(AMES)-.2 E F0(section belo)2.5 E -.65(w.)-.25 G +-1.11(Ve)72 768 S(rsion 2.0)1.11 E(24 Dec 2002)162.9 E(17)198.45 E EP +%%Page: 18 18 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R .643 +(When using the)108 84 R/F1 10/Times-Bold@0 SF(\255apple)3.143 E F0 .643 +(option, the TYPE and CREA)3.143 F -.18(TO)-1.11 G 3.143(Ra).18 G .643 +(re stored in the optional System Use or SUSP)-3.143 F .498 +(\214eld in the ISO9660 Directory Record - in much the same w)108 96 R +.499(ay as the Rock Ridge attrib)-.1 F .499(utes are. In f)-.2 F .499 +(act to)-.1 F(mak)108 108 Q 2.554(el)-.1 G .054(ife easy)-2.554 F 2.554 +(,t)-.65 G .054(he Apple e)-2.554 F .053(xtensions are added at the be) +-.15 F .053(ginning of the e)-.15 F .053(xisting Rock Ridge attrib)-.15 +F .053(utes \(i.e. to)-.2 F(get the Apple e)108 120 Q +(xtensions you get the Rock Ridge e)-.15 E(xtensions as well\).)-.15 E +.39(The Apple e)108 136.8 R .39 +(xtensions require the resource fork to be stored as an ISO9660)-.15 F +/F2 10/Times-Italic@0 SF(associated)2.891 E F0 .391 +(\214le. This is just lik)2.891 F(e)-.1 E(an)108 148.8 Q 3.186(yn)-.15 G +.686(ormal \214le stored in the ISO9660 \214lesystem e)-3.186 F .685 +(xcept that the associated \214le \215ag is set in the Directory)-.15 F +.299(Record \(bit 2\). This \214le has the same name as the data fork \ +\(the \214le seen by non-Apple machines\). Associ-)108 160.8 R +(ated \214les are normally ignored by other OSs)108 172.8 Q .363 +(When using the)108 189.6 R F1(\255hfs)2.863 E F0 .362 +(option, the TYPE and CREA)2.863 F -.18(TO)-1.11 G 2.862(Rp).18 G .362 +(lus other \214nder info, are stored in a separate HFS)-2.862 F +(directory)108 201.6 Q 3.677(,n)-.65 G 1.177 +(ot visible on the ISO9660 v)-3.677 F 1.178 +(olume. The HFS directory references the same data and resource)-.2 F +(fork \214les described abo)108 213.6 Q -.15(ve)-.15 G(.).15 E .334 +(In most cases, it is better to use the)108 230.4 R F1(\255hfs)2.833 E +F0 .333(option instead of the)2.833 F F1(\255apple)2.833 E F0 .333 +(option, as the latter imposes the lim-)2.833 F 1.012 +(ited ISO9660 characters allo)108 242.4 R 1.013(wed in \214lenames. Ho) +-.25 F(we)-.25 E -.15(ve)-.25 G 1.813 -.4(r, t).15 H 1.013(he Apple e).4 +F 1.013(xtensions do gi)-.15 F 1.313 -.15(ve t)-.25 H 1.013(he adv).15 F +1.013(antage that)-.25 F .21(the \214les are pack)108 254.4 R .21 +(ed on the disk more ef)-.1 F .209(\214ciently and it may be possible t\ +o \214t more \214les on a CD - important)-.25 F +(when the total size of the source \214les is approaching 650MB.)108 +266.4 Q/F3 10.95/Times-Bold@0 SF(HFS MA)72 295.2 Q(CINT)-.602 E +(OSH FILE N)-.197 E(AMES)-.219 E F0 .101(Where possible, the HFS \214le\ +name that is stored with an Apple/Unix \214le is used for the HFS part \ +of the CD.)108 307.2 R(Ho)108 319.2 Q(we)-.25 E -.15(ve)-.25 G 1.429 -.4 +(r, n).15 H .628(ot all the Apple/Unix encodings store the HFS \214lena\ +me with the \214nderinfo. In these cases, the).4 F .66(Unix \214lename \ +is used - with escaped special characters. Special characters include '\ +/' and characters with)108 331.2 R(codes o)108 343.2 Q -.15(ve)-.15 G +2.5(r1).15 G(27.)-2.5 E .719 +(Aufs escapes these characters by using ":" follo)108 360 R .719 +(wed by the character code as tw)-.25 F 3.219(oh)-.1 G 1.018 -.15(ex d) +-3.219 H .718(igits. Netatalk and).15 F(EtherShare ha)108 372 Q .3 -.15 +(ve a s)-.2 H(imilar scheme, b).15 E(ut uses "%" instead of a ":".)-.2 E +.527(If mkisofs can')108 388.8 R 3.027<748c>-.18 G .527 +(nd an HFS \214lename, then it uses the Unix name, with an)-3.027 F +3.028(y%)-.15 G .528(xx or :xx characters \(xx ==)-3.028 F(tw)108 400.8 +Q 3.059(oh)-.1 G .859 -.15(ex d)-3.059 H .559(igits\) con).15 F -.15(ve) +-.4 G .558(rted to a single character code. If "xx" are not he).15 F +3.058(xd)-.15 G .558(igits \([0-9a-fA-F]\), then the)-3.058 F 3.058(ya) +-.15 G(re)-3.058 E .928(left alone - although an)108 412.8 R 3.429(yr) +-.15 G .929(emaining ":" is con)-3.429 F -.15(ve)-.4 G .929 +(rted to "%" as colon is the HFS directory separator).15 F 3.429(.C)-.55 +G(are)-3.429 E(must be tak)108 424.8 Q +(en, as an ordinary Unix \214le with %xx or :xx will also be con)-.1 E +-.15(ve)-.4 G(rted. e.g.).15 E 12.5(This:2fFile con)108 441.6 R -.15(ve) +-.4 G(rted to This/File).15 E 20.83(This:File con)108 465.6 R -.15(ve) +-.4 G(rted to This%File).15 E 13.05(This:t7File con)108 489.6 R -.15(ve) +-.4 G(rted to This%t7File).15 E .68 +(Although HFS \214lenames appear to support upper and lo)108 506.4 R .68 +(wer case letters, the \214lesystem is case insensiti)-.25 F -.15(ve) +-.25 G(.).15 E .419(i.e. the \214lenames "aBc" and "AbC" are the same. \ +If a \214le is found in a directory with the same HFS name,)108 518.4 R +(then)108 530.4 Q F2(mkisofs)3.454 E F0 .954 +(will attempt, where possible, to mak)3.454 F 3.454(eau)-.1 G .954 +(nique name by adding '_' characters to one of the)-3.454 F +(\214lenames.)108 542.4 Q .665(If an HFS \214lename e)108 559.2 R .665(\ +xists for a \214le, then mkisofs can use this name as the starting poin\ +t for the ISO9660,)-.15 F 1.051 +(Joliet and Rock Ridge \214lenames using the)108 571.2 R F1 +(\255mac-name)3.551 E F0 1.05 +(option. Normal Unix \214les without an HFS name)3.551 F +(will still use their Unix name.)108 583.2 Q(e.g.)5 E .329(If a)108 600 +R F2(MacBinary)2.829 E F0(\(or)2.829 E F2 .329(PC Exc)2.829 F(hang)-.15 +E(e)-.1 E F0 2.829<298c>.18 G .329(le is stored as)-2.829 F F2(someima) +2.829 E -.1(ge)-.1 G(.gif)-.05 E(.bin)-.15 E F0 .33 +(on the Unix \214lesystem, b)2.83 F .33(ut contains a)-.2 F .685 +(HFS \214le called)108 612 R F2(someima)3.185 E -.1(ge)-.1 G(.gif)-.05 E +F0 3.185(,t)1.96 G .684(hen this is the name that w)-3.185 F .684 +(ould appear on the HFS part of the CD. Ho)-.1 F(w-)-.25 E -2.15 -.25 +(ev e)108 624 T 1.111 -.4(r, a).25 H 2.811(sm).4 G .312(kisofs uses the\ + Unix name as the starting point for the other names, then the ISO9660 \ +name gen-)-2.811 F .068(erated will probably be)108 636 R F2(SOMEIMA) +2.568 E(G.BIN)-.35 E F0 .067(and the Joliet/Rock Ridge w)2.568 F .067 +(ould be)-.1 F F2(someima)2.567 E -.1(ge)-.1 G(.gif)-.05 E(.bin)-.15 E +F0 5.067(.A).24 G(lthough)-5.067 E .176(the actual data \(in this case\ +\) is a GIF image. This option will use the HFS \214lename as the start\ +ing point and)108 648 R(the ISO9660 name will probably be)108 660 Q F2 +(SOMEIMA)2.5 E(G.GIF)-.35 E F0(and the Joliet/Rock Ridge w)2.5 E +(ould be)-.1 E F2(someima)2.5 E -.1(ge)-.1 G(.gif)-.05 E F0(.)1.96 E +.609(Using the)108 676.8 R F1(\255mac-name)3.109 E F0 .609 +(option will not currently w)3.109 F .609(ork with the)-.1 F F1<ad54> +3.108 E F0 .608(option - the Unix name will be used in)3.108 F +(the TRANS.TBL \214le, not the Macintosh name.)108 688.8 Q .621 +(The character set used to con)108 705.6 R -.15(ve)-.4 G .621(rt an).15 +F 3.122(yH)-.15 G .622 +(FS \214le name to a Joliet/Rock Ridge \214le name def)-3.122 F .622 +(aults to)-.1 F F2(cp10000)3.122 E F0 .909(\(Mac Roman\).)108 717.6 R +.909(The character set used can be speci\214ed using the)5.909 F F2 +(-input-hfs-c)3.408 E(har)-.15 E(set)-.1 E F0 .908(option. Other b)3.408 +F .908(uilt in)-.2 F 2.238(HFS character sets are: cp10006 \(MacGreek\)\ +, cp10007 \(MacCyrillic\), cp10029 \(MacLatin2\), cp10079)108 729.6 R +-1.11(Ve)72 768 S(rsion 2.0)1.11 E(24 Dec 2002)162.9 E(18)198.45 E EP +%%Page: 19 19 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R +(\(MacIcelandandic\) and cp10081 \(MacT)108 84 Q(urkish\).)-.45 E .747 +(Note: the character codes used by HFS \214le names tak)108 100.8 R .746 +(en from the v)-.1 F .746(arious Apple/Unix formats will not be)-.25 F +(con)108 112.8 Q -.15(ve)-.4 G .687(rted as the).15 F 3.187(ya)-.15 G +.687(re assumed to be in the correct Apple character set. Only the Joli\ +et/Rock Ridge names)-3.187 F(deri)108 124.8 Q -.15(ve)-.25 G 2.5(df).15 +G(rom the HFS \214le names will be con)-2.5 E -.15(ve)-.4 G(rted.).15 E +.423(The e)108 141.6 R .423(xisting mkisofs code will \214lter out an) +-.15 F 2.923(yi)-.15 G(lle)-2.923 E -.05(ga)-.15 G 2.923(lc).05 G .423 +(haracters for the ISO9660 and Joliet \214lenames, b)-2.923 F .422 +(ut as)-.2 F .279(mkisofs e)108 153.6 R .279 +(xpects to be dealing directly with Unix names, it lea)-.15 F -.15(ve) +-.2 G 2.78(st).15 G .28(he Rock Ridge names as is.)-2.78 F .28 +(But as '/' is)5.28 F 2.5(al)108 165.6 S -2.25 -.15(eg a)-2.5 H 2.5(lH) +.15 G(FS \214lename character)-2.5 E 2.5(,t)-.4 G(he)-2.5 E/F1 10 +/Times-Bold@0 SF(\255mac-name)2.5 E F0(option con)2.5 E -.15(ve)-.4 G +(rts '/' to a '_' in Rock Ridge \214lenames.).15 E .292(If the Apple e) +108 182.4 R .291(xtensions are used, then only the ISO9660 \214lenames \ +will appear on the Macintosh. Ho)-.15 F(we)-.25 E -.15(ve)-.25 G -.4(r,) +.15 G .6(as the Macintosh ISO9660 dri)108 194.4 R -.15(ve)-.25 G .6 +(rs can use).15 F/F2 10/Times-Italic@0 SF(Le)3.1 E .6(vel 2)-.15 F F0 .6 +(\214lenames, then you can use options lik)3.1 F(e)-.1 E F1(\255allo)3.1 +E(w-multi-)-.1 E(dot)108 206.4 Q F0 1.077 +(without problems on a Macintosh - still tak)3.578 F 3.577(ec)-.1 G +1.077(are o)-3.577 F -.15(ve)-.15 G 3.577(rt).15 G 1.077 +(he names, for e)-3.577 F(xample)-.15 E F2(this.\214le)3.577 E(.name) +-.15 E F0 1.077(will be)3.577 F(con)108 218.4 Q -.15(ve)-.4 G 1.439 +(rted to).15 F F2(THIS.FILE)3.939 E F0 1.439(i.e. only ha)3.939 F 1.739 +-.15(ve o)-.2 H 1.439(ne '.).15 F 1.439(', also \214lename)-.7 F F2 +(abcdefgh)3.939 E F0 1.44(will be seen as)3.94 F F2(ABCDEFGH)3.94 E F0 +-.2(bu)3.94 G(t).2 E F2(abcdefghi)108 230.4 Q F0 .443(will be seen as) +2.943 F F2(ABCDEFGHI.)2.943 E F0 .443(i.e. with a '.)5.443 F 2.943('a) +-.7 G 2.943(tt)-2.943 G .443(he end - don')-2.943 F 2.943(tk)-.18 G(no) +-2.943 E 2.943(wi)-.25 G 2.943(ft)-2.943 G .442 +(his is a Macintosh prob-)-2.943 F 1.212(lem or mkisofs/mkh)108 242.4 R +1.212(ybrid problem. All \214lenames will be in uppercase when vie)-.05 +F 1.212(wed on a Macintosh. Of)-.25 F(course, DOS/W)108 254.4 Q +(in3.X machines will not be able to see Le)-.4 E -.15(ve)-.25 G 2.5 +(l2\214).15 G(lenames...)-2.5 E/F3 10.95/Times-Bold@0 SF(HFS CUST)72 +283.2 Q(OM V)-.197 E(OLUME/FOLDER ICONS)-.493 E F0 2.072 -.8(To g)108 +295.2 T -2.15 -.25(iv e).8 H 2.972(aH)3.222 G .472 +(FS CD a custom icon, mak)-2.972 F 2.972(es)-.1 G .472 +(ure the root \(top le)-2.972 F -.15(ve)-.25 G .471 +(l\) folder includes a standard Macintosh v).15 F(ol-)-.2 E .465 +(ume icon \214le. T)108 307.2 R 2.965(og)-.8 G -2.15 -.25(iv e)-2.965 H +2.965(av)3.215 G .466 +(olume a custom icon on a Macintosh, an icon has to be pasted o)-3.165 F +-.15(ve)-.15 G 2.966(rt).15 G .466(he v)-2.966 F(olume')-.2 E(s)-.55 E +.707(icon in the "Get Info" box of the v)108 319.2 R .706 +(olume. This creates an in)-.2 F .706 +(visible \214le called 'Icon\\r' \('\\r' is the 'carriage)-.4 F +(return' character\) in the root folder)108 331.2 Q(.)-.55 E 2.5(Ac)108 +348 S(ustom folder icon is v)-2.5 E(ery similar - an in)-.15 E +(visible \214le called 'Icon\\r' e)-.4 E(xits in the folder itself.)-.15 +E .181(Probably the easiest w)108 364.8 R .182(ay to create a custom ic\ +on that mkisofs can use, is to format a blank HFS \215opp)-.1 F 2.682 +(yd)-.1 G(isk)-2.682 E 1.068(on a Mac, paste an icon to its "Get Info" \ +box. If using Linux with the HFS module installed, mount the)108 376.8 R +(\215opp)108 388.8 Q 2.5(yu)-.1 G(sing something lik)-2.5 E(e:)-.1 E +(mount \255t hfs /de)152.45 412.8 Q(v/fd0 /mnt/\215opp)-.25 E(y)-.1 E +(The \215opp)108 436.8 Q 2.5(yw)-.1 G +(ill be mounted as a CAP \214le system by def)-2.5 E +(ault. Then run mkisofs using something lik)-.1 E(e:)-.1 E +(mkisofs \255\255cap \255o output source_dir /mnt/\215opp)152.45 460.8 Q +(y)-.1 E .03 +(If you are not using Linux, then you can use the hfsutils to cop)108 +484.8 R 2.53(yt)-.1 G .03(he icon \214le from the \215opp)-2.53 F 1.33 +-.65(y. H)-.1 H -.25(ow).65 G -2.15 -.25(ev e).25 H .83 -.4(r, c).25 H +(are).4 E(has to be tak)108 496.8 Q +(en, as the icon \214le contains a control character)-.1 E 2.5(.e)-.55 G +(.g.)-2.5 E(hmount /de)152.45 520.8 Q(v/fd0)-.25 E(hdir \255a)152.45 +532.8 Q(hcop)152.45 544.8 Q 2.5<79ad>-.1 G 2.5(mI)-2.5 G +(con^V^M icon_dir/icon)-2.5 E(Where '^V^M' is control-V follo)108 568.8 +Q(wed by control-M. Then run)-.25 E F1(mkisofs)2.5 E F0 +(by using something lik)2.5 E(e:)-.1 E +(mkisofs \255\255macbin \255o output source_dir icon_dir)152.45 592.8 Q +.681(The procedure for creating/using custom folder icons is v)108 609.6 +R .68(ery similar - paste an icon to folder')-.15 F 3.18(s")-.55 G .68 +(Get Info")-3.18 F +(box and transfer the resulting 'Icon\\r' \214le to the rele)108 621.6 Q +-.25(va)-.25 G(nt directory in the mkisofs source tree.).25 E -1.1(Yo) +108 638.4 S 2.5(um)1.1 G(ay w)-2.5 E +(ant to hide the icon \214les from the ISO9660 and Joliet trees.)-.1 E +4.317 -.8(To g)108 655.2 T -2.15 -.25(iv e).8 H 5.217(ac)5.467 G 2.717 +(ustom icon to a Joliet CD, follo)-5.217 F 5.217(wt)-.25 G 2.717 +(he instructions found at: http://www)-5.217 F(.f)-.65 E(adden.com/cdr) +-.1 E(-)-.2 E -.1(fa)108 667.2 S(q/f).1 E(aq03.html#[3-21])-.1 E F3 +(HFS BOO)72 696 Q 2.738(TD)-.438 G(RIVER)-2.738 E F0(It)108 708 Q F2 +(may)2.5 E F0(be possible to mak)2.5 E 2.5(et)-.1 G(he h)-2.5 E +(ybrid CD bootable on a Macintosh.)-.05 E 3.103(Ab)108 724.8 S .603 +(ootable HFS CD requires an Apple CD-R)-3.103 F .602 +(OM \(or compatible\) dri)-.4 F -.15(ve)-.25 G 1.402 -.4(r, a b).15 H +.602(ootable HFS partition and the).4 F -1.11(Ve)72 768 S(rsion 2.0)1.11 +E(24 Dec 2002)162.9 E(19)198.45 E EP +%%Page: 20 20 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R +(necessary System, Finder)108 84 Q 2.5(,e)-.4 G(tc. \214les.)-2.5 E +2.928(Ad)108 100.8 S(ri)-2.928 E -.15(ve)-.25 G 2.928(rc).15 G .428 +(an be obtained from an)-2.928 F 2.928(yo)-.15 G .428 +(ther Macintosh bootable CD-R)-2.928 F .428(OM using the)-.4 F/F1 10 +/Times-Italic@0 SF(apple_driver)2.928 E F0(utility)2.928 E 2.928(.T)-.65 +G(his)-2.928 E(\214le can then be used with the)108 112.8 Q/F2 10 +/Times-Bold@0 SF(\255boot-hfs-\214le)2.5 E F0(option.)2.5 E 1.563 +(The HFS partition \(i.e. the h)108 129.6 R 1.563 +(ybrid disk in our case\) must contain a suitable System F)-.05 F(older) +-.15 E 4.063(,a)-.4 G -.05(ga)-4.063 G 1.562(in from).05 F(another CD-R) +108 141.6 Q(OM or disk.)-.4 E -.15(Fo)108 158.4 S 2.851(rap).15 G .351 +(artition to be bootable, it must ha)-2.851 F .652 -.15(ve i)-.2 H(t') +.15 E(s)-.55 E F1 .352(boot bloc)2.852 F(k)-.2 E F0 .352 +(set. The boot block is in the \214rst tw)2.852 F 2.852(ob)-.1 G .352 +(locks of a)-2.852 F 1.67(partition. F)108 170.4 R 1.67 +(or a non-bootable partition the boot block is full of zeros. Normally) +-.15 F 4.169(,w)-.65 G 1.669(hen a System \214le is)-4.169 F .41(copied\ + to partition on a Macintosh disk, the boot block is \214lled with a nu\ +mber of required settings - unfor)108 182.4 R(-)-.2 E(tunately I don') +108 194.4 Q 2.5(tk)-.18 G(no)-2.5 E 2.5(wt)-.25 G +(he full spec for the boot block, so I'm guessing that the follo)-2.5 E +(wing will w)-.25 E(ork OK.)-.1 E .815(Therefore, the utility)108 211.2 +R F1(apple_driver)3.314 E F0 .814(also e)3.314 F .814(xtracts the boot \ +block from the \214rst HFS partition it \214nds on the)-.15 F(gi)108 +223.2 Q -.15(ve)-.25 G 2.5(nC).15 G(D-R)-2.5 E +(OM and this is used for the HFS partition created by)-.4 E F2(mkisofs) +2.5 E F0(.)A(PLEASE NO)108 240 Q(TE)-.4 E .522(By using a dri)144 252 R +-.15(ve)-.25 G 3.022(rf).15 G .522(rom an Apple CD and cop)-3.022 F .522 +(ying Apple softw)-.1 F .523(are to your CD, you become liable)-.1 F +(to obe)144 264 Q 2.5(yA)-.15 G(pple Computer)-2.5 E 2.5(,I)-.4 G +(nc. Softw)-2.5 E(are License Agreements.)-.1 E/F3 10.95/Times-Bold@0 SF +(EL T)72 280.8 Q(ORIT)-.197 E 2.738(OB)-.197 G(OO)-2.738 E 2.738(TI) +-.438 G(NFORMA)-2.738 E(TION T)-1.04 E(ABLE)-.986 E F0 .205(When the)108 +292.8 R F2(\255boot-inf)2.705 E(o-table)-.25 E F0 .204(option is gi) +2.704 F -.15(ve)-.25 G(n,).15 E F2(mkisofs)2.704 E F0 .204 +(will modify the boot \214le speci\214ed by the)2.704 F F2<ad62>2.704 E +F0 .204(option by)2.704 F .63 +(inserting a 56-byte "boot information table" at of)108 304.8 R .63 +(fset 8 in the \214le.)-.25 F .63 +(This modi\214cation is done in the source)5.63 F .163 +(\214lesystem, so mak)108 316.8 R 2.662(es)-.1 G .162(ure you use a cop) +-2.662 F 2.662(yi)-.1 G 2.662(ft)-2.662 G .162 +(his \214le is not easily recreated!)-2.662 F .162 +(This \214le contains pointers which)5.162 F +(may not be easily or reliably obtained at boot time.)108 328.8 Q +(The format of this table is as follo)108 345.6 Q(ws; all inte)-.25 E +(gers are in section 7.3.1 \("little endian"\) format.)-.15 E(Of)122.4 +369.6 Q 44.76(fset Name)-.25 F 52.28(Size Meaning)84.12 F 64.5(8b)124.9 +381.6 S 77.72(i_pvd 4)-64.5 F 40.89(bytes LB)2.5 F 2.5(Ao)-.35 G 2.5(fp) +-2.5 G(rimary v)-2.5 E(olume descriptor)-.2 E 59.5(12 bi_\214le)122.4 +393.6 R 2.5(4b)82.44 G 40.89(ytes LB)-2.5 F 2.5(Ao)-.35 G 2.5(fb)-2.5 G +(oot \214le)-2.5 E 59.5(16 bi_length)122.4 405.6 R 2.5(4b)70.22 G 40.89 +(ytes Boot)-2.5 F(\214le length in bytes)2.5 E 59.5(20 bi_csum)122.4 +417.6 R 2.5(4b)74.11 G 40.89(ytes 32-bit)-2.5 F(checksum)2.5 E 59.5 +(24 bi_reserv)122.4 429.6 R 59(ed 40)-.15 F 35.89(bytes Reserv)2.5 F(ed) +-.15 E .364(The 32-bit checksum is the sum of all the 32-bit w)108 453.6 +R .365(ords in the boot \214le starting at byte of)-.1 F .365(fset 64.) +-.25 F .365(All linear)5.365 F(block addresses \(LB)108 465.6 Q +(As\) are gi)-.35 E -.15(ve)-.25 G 2.5(ni).15 G 2.5(nC)-2.5 G 2.5(Ds) +-2.5 G(ectors \(normally 2048 bytes\).)-2.5 E F3(CONFIGURA)72 482.4 Q +(TION)-1.04 E F2(mkisofs)108 494.4 Q F0 .633(looks for the)3.133 F F2 +(.mkisofsr)3.133 E(c)-.18 E F0 .633(\214le, \214rst in the current w) +3.133 F .633(orking directory)-.1 F 3.133(,t)-.65 G .633 +(hen in the user')-3.133 F 3.133(sh)-.55 G .632(ome direc-)-3.133 F +(tory)108 506.4 Q 2.565(,a)-.65 G .065 +(nd then in the directory in which the)-2.565 F F2(mkisofs)2.565 E F0 +.065(binary is stored.)2.565 F .065 +(This \214le is assumed to contain a series)5.065 F .209 +(of lines of the form)108 518.4 R F2 -1.25 -.9(TA G)2.709 H(=).9 E F1 +(value).29 E(,)-.1 E F0 .209(and in this w)2.709 F .209 +(ay you can specify certain options.)-.1 F .209 +(The case of the tag is not)5.209 F 3.918(signi\214cant. Some)108 530.4 +R 1.419(\214elds in the v)3.918 F 1.419 +(olume header are not settable on the command line, b)-.2 F 1.419 +(ut can be altered)-.2 F .124(through this f)108 542.4 R(acility)-.1 E +5.124(.C)-.65 G .124(omments may be placed in this \214le, using lines \ +which start with a hash \(#\) character)-5.124 F(.)-.55 E F2(APPI)108 +559.2 Q F0 .681(The application identi\214er should describe the applic\ +ation that will be on the disc.)12.67 F .682(There is space)5.682 F 1.36 +(on the disc for 128 characters of information.)144 571.2 R 1.359 +(May be o)6.359 F -.15(ve)-.15 G 1.359(rridden using the).15 F F2<ad41> +3.859 E F0 1.359(command line)3.859 F(option.)144 583.2 Q F2(COPY)108 +600 Q F0 1.138(The cop)7.67 F 1.139(yright information, often the name \ +of a \214le on the disc containing the cop)-.1 F 1.139(yright notice.) +-.1 F .703(There is space in the disc for 37 characters of information.) +144 612 R .702(May be o)5.702 F -.15(ve)-.15 G .702(rridden using the) +.15 F F2(\255copy-)3.202 E(right)144 624 Q F0(command line option.)2.5 E +F2(ABST)108 640.8 Q F0 1.473(The abstract information, often the name o\ +f a \214le on the disc containing an abstract.)9.88 F 1.474(There is) +6.474 F .768(space in the disc for 37 characters of information.)144 +652.8 R .768(May be o)5.768 F -.15(ve)-.15 G .768(rridden using the).15 +F F2(\255abstract)3.268 E F0(com-)3.268 E(mand line option.)144 664.8 Q +F2(BIBL)108 681.6 Q F0 1.751(The bibliographic information, often the n\ +ame of a \214le on the disc containing a bibliograph)12.1 F -.65(y.)-.05 +G .98(There is space in the disc for 37 characters of information.)144 +693.6 R .979(May be o)5.979 F -.15(ve)-.15 G .979(rridden using the).15 +F F2(\255bilio)3.479 E F0(command line option.)144 705.6 Q -1.11(Ve)72 +768 S(rsion 2.0)1.11 E(24 Dec 2002)162.9 E(20)198.45 E EP +%%Page: 21 21 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R/F1 10 +/Times-Bold@0 SF(PREP)108 84 Q F0 .282 +(This should describe the preparer of the CDR)9.89 F .282 +(OM, usually with a mailing address and phone num-)-.4 F(ber)144 96 Q +5.122(.T)-.55 G .122 +(here is space on the disc for 128 characters of information.)-5.122 F +.122(May be o)5.122 F -.15(ve)-.15 G .121(rridden using the).15 F F1 +<ad70>2.621 E F0(command line option.)144 108 Q F1(PUBL)108 124.8 Q F0 +.021(This should describe the publisher of the CDR)9.33 F .022 +(OM, usually with a mailing address and phone num-)-.4 F(ber)144 136.8 Q +5.09(.T)-.55 G .09 +(here is space on the disc for 128 characters of information.)-5.09 F +.089(May be o)5.089 F -.15(ve)-.15 G .089(rridden using the).15 F F1 +<ad50>2.589 E F0(command line option.)144 148.8 Q F1(SYSI)108 165.6 Q F0 +.515(The System Identi\214er)13.77 F 5.515(.T)-.55 G .516 +(here is space on the disc for 32 characters of information.)-5.515 F +.516(May be o)5.516 F -.15(ve)-.15 G -.2(r-).15 G(ridden using the)144 +177.6 Q F1(\255sysid)2.5 E F0(command line option.)2.5 E F1 -.45(VO)108 +194.4 S(LI).45 E F0 .424(The V)10.89 F .424(olume Identi\214er)-1.29 F +5.423(.T)-.55 G .423 +(here is space on the disc for 32 characters of information.)-5.423 F +.423(May be o)5.423 F -.15(ve)-.15 G -.2(r-).15 G(ridden using the)144 +206.4 Q F1<ad56>2.5 E F0(command line option.)2.5 E F1 -.45(VO)108 223.2 +S(LS).45 E F0 1.363(The V)9.22 F 1.363(olume Set Name.)-1.29 F 1.364 +(There is space on the disc for 128 characters of information.)6.363 F +1.364(May be)6.364 F -.15(ove)144 235.2 S(rridden using the).15 E F1 +<ad76>2.5 E(olset)-.1 E F0(command line option.)2.5 E F1(HFS_TYPE)108 +252 Q F0 .22(The def)144 264 R .22 +(ault TYPE for Macintosh \214les. Must be e)-.1 F .219 +(xactly 4 characters.)-.15 F .219(May be o)5.219 F -.15(ve)-.15 G .219 +(rridden using the).15 F F1(\255hfs-type)144 276 Q F0 +(command line option.)2.5 E F1(HFS_CREA)108 292.8 Q -.18(TO)-.95 G(R).18 +E F0 1.676(The def)144 304.8 R 1.677(ault CREA)-.1 F -.18(TO)-1.11 G +4.177(Rf).18 G 1.677(or Macintosh \214les. Must be e)-4.177 F 1.677 +(xactly 4 characters.)-.15 F 1.677(May be o)6.677 F -.15(ve)-.15 G +(rridden).15 E(using the)144 316.8 Q F1(\255hfs-cr)2.5 E(eator)-.18 E F0 +(command line option.)2.5 E F1(mkisofs)108 333.6 Q F0 2.308 +(can also be con\214gured at compile time with def)4.809 F 2.308 +(aults for man)-.1 F 4.808(yo)-.15 G 4.808(ft)-4.808 G 2.308 +(hese \214elds.)-4.808 F 2.308(See the \214le)7.308 F(def)108 345.6 Q +(aults.h.)-.1 E/F2 10.95/Times-Bold@0 SF(EXAMPLES)72 374.4 Q F0 1.756 +-.8(To c)108 386.4 T .156(reate a v).8 F .156 +(anilla ISO-9660 \214lesystem image in the \214le)-.25 F/F3 10 +/Times-Italic@0 SF(cd.iso)2.657 E F0 2.657(,w).18 G .157 +(here the directory)-2.657 F F3(cd_dir)2.657 E F0 .157(will become the) +2.657 F(root directory if the CD, call:)108 398.4 Q 2.5(%m)108 415.2 S +(kisofs \255o cd.iso cd_dir)-2.5 E 1.6 -.8(To c)108 432 T +(reate a CD with Rock Ridge e).8 E(xtensions of the source directory) +-.15 E F3(cd_dir)2.5 E F0(:).73 E 2.5(%m)108 448.8 S +(kisofs \255o cd.iso \255R cd_dir)-2.5 E 1.91 -.8(To c)108 465.6 T .31 +(reate a CD with Rock Ridge e).8 F .31 +(xtensions of the source directory)-.15 F F3(cd_dir)2.81 E F0 .31 +(where all \214les ha)2.81 F .61 -.15(ve a)-.2 H 2.81(tl).15 G .31 +(east read)-2.81 F(permission and all \214les are o)108 477.6 Q(wned by) +-.25 E F3 -.45(ro)2.5 G(ot).45 E F0 2.5(,c).68 G(all:)-2.5 E 2.5(%m)108 +494.4 S(kisofs \255o cd.iso \255r cd_dir)-2.5 E 1.6 -.8(To c)108 511.2 T +(reate a HFS h).8 E(ybrid CD with the Joliet and Rock Ridge e)-.05 E +(xtensions of the source directory)-.15 E F3(cd_dir)2.5 E F0(:).73 E 2.5 +(%m)108 528 S(kisofs \255o cd.iso \255R \255J \255hfs cd_dir)-2.5 E 1.6 +-.8(To c)108 544.8 T(reate a HFS h).8 E +(ybrid CD from the source directory)-.05 E F3(cd_dir)2.5 E F0 +(that contains Netatalk Apple/Unix \214les:)2.5 E 2.5(%m)108 561.6 S +(kisofs \255o cd.iso \255\255netatalk cd_dir)-2.5 E 1.85 -.8(To c)108 +578.4 T .25(reate a HFS h).8 F .25(ybrid CD from the source directory) +-.05 F F3(cd_dir)2.751 E F0 2.751(,g).73 G -.25(iv)-2.751 G .251 +(ing all \214les CREA).25 F -.18(TO)-1.11 G 2.751(Ra).18 G .251 +(nd TYPES based)-2.751 F(on just their \214lename e)108 590.4 Q +(xtensions listed in the \214le "mapping".:)-.15 E 2.5(%m)108 607.2 S +(kisofs \255o cd.iso \255map mapping cd_dir)-2.5 E 4.94 -.8(To c)108 624 +T 3.339(reate a CD with the 'Apple Extensions to ISO9660', from the sou\ +rce directories).8 F F3(cd_dir)5.839 E F0(and)5.839 E F3(another_dir)108 +636 Q(.)-1.11 E F0 1.358(Files in all the kno)6.358 F 1.359 +(wn Apple/Unix format are decoded and an)-.25 F 3.859(yo)-.15 G 1.359 +(ther \214les are gi)-3.859 F -.15(ve)-.25 G 3.859(nC).15 G(RE-)-3.859 E +-.46 -1.11(AT O)108 648 T 2.5(Ra)1.11 G +(nd TYPE based on their magic number gi)-2.5 E -.15(ve)-.25 G 2.5(ni).15 +G 2.5(nt)-2.5 G(he \214le "magic":)-2.5 E 2.5(%m)108 664.8 S +(kisofs \255o cd.iso \255apple \255magic magic \255probe \\)-2.5 E +(cd_dir another_dir)128 676.8 Q .62(The follo)108 693.6 R .62(wing e) +-.25 F .62(xample puts dif)-.15 F .619 +(ferent \214les on the CD that all ha)-.25 F .919 -.15(ve t)-.2 H .619 +(he name README, b).15 F .619(ut ha)-.2 F .919 -.15(ve d)-.2 H(if).15 E +(ferent)-.25 E +(contents when seen as a ISO9660/RockRidge, Joliet or HFS CD.)108 705.6 +Q(Current directory contains:)108 722.4 Q -1.11(Ve)72 768 S(rsion 2.0) +1.11 E(24 Dec 2002)162.9 E(21)198.45 E EP +%%Page: 22 22 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R 2.5(%l) +108 84 S 2.5<73ad>-2.5 G(F)-2.5 E 10(README.hfs README.joliet)108 96 R +7.5(README.unix cd_dir/)5 F .02(The follo)108 112.8 R .02 +(wing command puts the contents of the directory)-.25 F/F1 10 +/Times-Italic@0 SF(cd_dir)2.521 E F0 .021 +(on the CD along with the three README)2.521 F(\214les - b)108 124.8 Q +(ut only one will be seen from each of the three \214lesystems:)-.2 E +2.5(%m)108 141.6 S +(kisofs \255o cd.iso \255hfs \255J \255r \255graft-points \\)-2.5 E +(\255hide README.hfs \255hide README.joliet \\)128 153.6 Q +(\255hide-joliet README.hfs \255hide-joliet README.unix \\)128 165.6 Q +(\255hide-hfs README.joliet \255hide-hfs README.unix \\)128 177.6 Q +(README=README.hfs README=README.joliet \\)128 189.6 Q +(README=README.unix cd_dir)128 201.6 Q .316(i.e. the \214le README.hfs \ +will be seen as README on the HFS CD and the other tw)108 218.4 R 2.816 +(oR)-.1 G .316(EADME \214les will)-2.816 F +(be hidden. Similarly for the Joliet and ISO9660/RockRidge CD.)108 230.4 +Q(There are probably all sorts of strange results possible with combina\ +tions of the hide options ...)108 247.2 Q/F2 10.95/Times-Bold@0 SF -.548 +(AU)72 276 S(THOR).548 E/F3 10/Times-Bold@0 SF(mkisofs)108 288 Q F0 .645 +(is not based on the standard mk*fs tools for unix, because we must gen\ +erate a complete)3.145 F(cop)5.645 E 3.145(yo)-.1 G(f)-3.145 E .816 +(an e)108 300 R .816(xisting \214lesystem on a disk in the)-.15 F .815 +(iso9660 \214lesystem.)5.815 F .815 +(The name mkisofs is probably a bit of a mis-)5.815 F(nomer)108 312 Q +3.534(,s)-.4 G 1.034(ince it not only creates the \214lesystem, b)-3.534 +F 1.035(ut it also populates it as well.)-.2 F(Ho)6.035 E(we)-.25 E -.15 +(ve)-.25 G 1.835 -.4(r, t).15 H 1.035(he appropriate).4 F(tool name for\ + a UNIX tool that creates populated \214lesystems - mkproto - is not we\ +ll kno)108 324 Q(wn.)-.25 E .385(Eric Y)108 340.8 R .385(oungdale <eric) +-1.1 F .385(y@gnu.ai.mit.edu> or <eric@andante.or)-.15 F .385 +(g> wrote the \214rst v)-.18 F .385(ersions \(1993 .)-.15 F -2.948 1.666 +(.. 1)1.666 H .384(998\) of)-1.666 F .718(the mkisofs utility)108 352.8 +R 5.718(.T)-.65 G .718(he cop)-5.718 F .719(yright for old v)-.1 F .719 +(ersions of the mkisofs utility is held by Yggdrasil Computing,)-.15 F +4.365(Incorporated. J)108 364.8 R -.25(..)-5.5 K(or)-4.5 5.5 M 4.365(gS) +-.18 G 1.865(chilling wrote the SCSI transport library and it')-4.365 F +4.365(sa)-.55 G 1.865(daptation layer to)-4.365 F F3(mkisofs)4.365 E F0 +(and)4.365 E(ne)108 376.8 Q 1.092 +(wer parts \(starting from 1999\) of the utility)-.25 F 3.592(,t)-.65 G +1.092(his mak)-3.592 F(es)-.1 E F3(mkisofs)3.592 E F0(Cop)3.592 E 1.092 +(yright \(C\) 1999, 2000, 2001 J)-.1 F -.25(..)-5.5 K(or)-4.5 5.5 M(g) +-.18 E(Schilling.)108 388.8 Q(HFS h)108 405.6 Q(ybrid code Cop)-.05 E +(yright \(C\) James Pearson 1997, 1998, 1999, 2000, 2001)-.1 E +(libhfs code Cop)108 417.6 Q(yright \(C\) 1996, 1997 Robert Leslie)-.1 E +(lib\214le code Cop)108 429.6 Q(yright \(C\) Ian F)-.1 E 2.5(.D)-.8 G +(arwin 1986, 1987, 1989, 1990, 1991, 1992, 1994, 1995.)-2.5 E F2(NO)72 +446.4 Q(TES)-.438 E F3(Mkisofs)108 458.4 Q F0 .62 +(may safely be installed suid root. This may be needed to allo)3.12 F(w) +-.25 E F3(mkisofs)3.12 E F0 .62(to read the pre)3.12 F .62(vious ses-) +-.25 F(sion when creating a multi session image.)108 470.4 Q(If)108 +487.2 Q F3(mkisofs)3.129 E F0 .629 +(is creating a \214lesystem image with Rock Ridge attrib)3.129 F .63 +(utes and the directory nesting le)-.2 F -.15(ve)-.25 G 3.13(lo).15 G +3.13(ft)-3.13 G(he)-3.13 E .154 +(source directory tree is too much for ISO-9660,)108 499.2 R F3(mkisofs) +2.654 E F0 .154(will do deep directory relocation.)2.654 F .154 +(This results in a)5.154 F(directory called)108 511.2 Q F3(RR_MO)2.5 E +(VED)-.5 E F0(in the root directory of the CD. Y)2.5 E(ou cannot a)-1.1 +E -.2(vo)-.2 G(id this directory).2 E(.)-.65 E F2 -.11(BU)72 528 S(GS) +.11 E F0 32.5<8341>108 540 S 1.278 -.15(ny \214)-32.5 H .978 +(les that ha).15 F 1.279 -.15(ve h)-.2 H .979(ard links to \214les not \ +in the tree being copied to the iso9660 \214lesystem will).15 F(ha)144 +552 Q .3 -.15(ve a)-.2 H 2.5(ni).15 G(ncorrect \214le reference count.) +-2.5 E 32.5<8344>108 568.8 S .04(oes not check for SUSP record\(s\) in \ +"." entry of the root directory to v)-32.5 F .04(erify the e)-.15 F .04 +(xistence of Rock)-.15 F(Ridge enhancements.)144 580.8 Q(This problem i\ +s present when reading old sessions while adding data in multi-session \ +mode.)144 604.8 Q 32.5<8344>108 621.6 S(oes not properly read relocated\ + directories in multi-session mode when adding data.)-32.5 E(An)144 +645.6 Q 2.5(yr)-.15 G(elocated deep directory is lost if the ne)-2.5 E +2.5(ws)-.25 G(ession does not include the deep directory)-2.5 E(.)-.65 E +.012(Repeat by: create \214rst session with deep directory relocation t\ +hen add ne)144 669.6 R 2.513(ws)-.25 G .013(ession with a single dir) +-2.513 F(that dif)144 681.6 Q(fers from the old deep path.)-.25 E 32.5 +<8344>108 698.4 S(oes not re-use RR_MO)-32.5 E +(VED when doing multi-session from TRANS.TBL)-.5 E 32.5<8344>108 715.2 S +(oes not create whole_name entry for RR_MO)-32.5 E +(VED in multi-session mode.)-.5 E -1.11(Ve)72 768 S(rsion 2.0)1.11 E +(24 Dec 2002)162.9 E(22)198.45 E EP +%%Page: 23 23 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R +(There may be some other ones.)108 84 Q +(Please, report them to the author)5 E(.)-.55 E/F1 10.95/Times-Bold@0 SF +(HFS PR)72 112.8 Q(OBLEMS/LIMIT)-.329 E -1.04(AT)-.986 G(IONS)1.04 E F0 +2.526(Ih)108 124.8 S -2.25 -.2(av e)-2.526 H .026(had to mak)2.726 F +2.526(es)-.1 G -2.15 -.25(ev e)-2.526 H .026(ral assumptions on ho).25 F +2.526(wIe)-.25 G .025(xpect the modi\214ed libhfs routines to w)-2.676 F +.025(ork, ho)-.1 F(we)-.25 E -.15(ve)-.25 G 2.525(rt).15 G(here)-2.525 E +.29(may be situations that either I ha)108 136.8 R -.15(ve)-.2 G(n').15 +E 2.79(tt)-.18 G .29(hought of, or come across when these assumptions f) +-2.79 F 2.79(ail. Therefore)-.1 F(I)2.79 E(can')108 148.8 Q 3.137(tg) +-.18 G .637(uarantee that mkisofs will w)-3.137 F .637(ork as e)-.1 F +.636(xpected \(although I ha)-.15 F -.15(ve)-.2 G(n').15 E 3.136(th)-.18 +G .636(ad a major problem yet\). Most of)-3.136 F(the HFS features w)108 +160.8 Q(ork \214ne, ho)-.1 E(we)-.25 E -.15(ve)-.25 G .8 -.4(r, s).15 H +(ome are not fully tested. These are mark).4 E(ed as)-.1 E/F2 10 +/Times-Italic@0 SF(Alpha)2.5 E F0(abo)2.5 E -.15(ve)-.15 G(.).15 E .68 +(Although HFS \214lenames appear to support upper and lo)108 177.6 R .68 +(wer case letters, the \214lesystem is case insensiti)-.25 F -.15(ve) +-.25 G(.).15 E .419(i.e. the \214lenames "aBc" and "AbC" are the same. \ +If a \214le is found in a directory with the same HFS name,)108 189.6 R +(then)108 201.6 Q F2(mkisofs)3.453 E F0 .954 +(will attempt, where possible, to mak)3.453 F 3.454(eau)-.1 G .954 +(nique name by adding '_' characters to one of the)-3.454 F +(\214lenames.)108 213.6 Q .35 +(HFS \214le/directory names that share the \214rst 31 characters ha)108 +230.4 R .649 -.15(ve _)-.2 H .349 +(N' \(N == decimal number\) substituted for).15 F(the last fe)108 242.4 +Q 2.5(wc)-.25 G(haracters to generate unique names.)-2.5 E .79 +(Care must be tak)108 259.2 R .791 +(en when "grafting" Apple/Unix \214les or directories \(see abo)-.1 F +1.091 -.15(ve f)-.15 H .791(or the method and syntax).15 F(in)108 271.2 +Q -.2(vo)-.4 G(lv).2 E 2.751(ed\). It is not possible to use a ne)-.15 F +5.251(wn)-.25 G 2.751(ame for an Apple/Unix encoded \214le/directory) +-5.251 F 5.251(.e)-.65 G 2.751(.g. If a)-5.251 F(Apple/Unix encoded \ +\214le called "oldname" is to added to the CD, then you can not use the\ + command line:)108 283.2 Q(mkisofs \255o output.ra)144 300 Q 2.5<77ad> +-.15 G(hfs \255graft-points ne)-2.5 E(wname=oldname cd_dir)-.25 E .498 +(mkisofs will be unable to decode "oldname". Ho)108 316.8 R(we)-.25 E +-.15(ve)-.25 G 1.298 -.4(r, y).15 H .498 +(ou can graft Apple/Unix encoded \214les or directo-).4 F +(ries as long as you do not attempt to gi)108 328.8 Q .3 -.15(ve t)-.25 +H(hem ne).15 E 2.5(wn)-.25 G(ames as abo)-2.5 E -.15(ve)-.15 G(.).15 E +.199(When creating an HFS v)108 345.6 R .199 +(olume with the multisession options,)-.2 F/F3 10/Times-Bold@0 SF<ad4d> +2.699 E F0(and)2.699 E F3<ad43>2.699 E F0 2.699(,o)C .199 +(nly \214les in the last session will)-2.699 F(be in the HFS v)108 357.6 +Q(olume. i.e. mkisofs can not)-.2 E F2(add)2.5 E F0 -.15(ex)2.5 G +(isting \214les from pre).15 E(vious sessions to the HFS v)-.25 E +(olume.)-.2 E(Ho)108 374.4 Q(we)-.25 E -.15(ve)-.25 G 1.788 -.4(r, i).15 +H 3.488(fe).4 G .989(ach session is created with the)-3.488 F F3 +(\255part)3.489 E F0 .989 +(option, then each session will appear as separate v)3.489 F(ol-)-.2 E +.337(umes when mounted on a Mac. In this case, it is w)108 386.4 R .337 +(orth using the)-.1 F F3<ad56>2.837 E F0(or)2.836 E F3(\255hfs-v)2.836 E +(olid)-.1 E F0 .336(option to gi)2.836 F .636 -.15(ve e)-.25 H .336 +(ach ses-).15 F(sion a unique v)108 398.4 Q +(olume name, otherwise each "v)-.2 E +(olume" will appear on the Desktop with the same name.)-.2 E +(Symbolic links \(as with all other non-re)108 415.2 Q +(gular \214les\) are not added to the HFS directory)-.15 E(.)-.65 E .808 +(Hybrid v)108 432 R .808(olumes may be lar)-.2 F .808 +(ger than pure ISO9660 v)-.18 F .808 +(olumes containing the same data. In some cases \(e.g.)-.2 F -.4(DV)108 +444 S 2.602(Ds).4 G .102(ized v)-2.602 F .102(olumes\) the h)-.2 F .101 +(ybrid v)-.05 F .101(olume may be signi\214cantly lar)-.2 F(ger)-.18 E +2.601(.A)-.55 G 2.601(sa)-2.601 G 2.601(nH)-2.601 G .101(FS v)-2.601 F +.101(olume gets bigger)-.2 F 2.601(,s)-.4 G 2.601(od)-2.601 G(oes)-2.601 +E .298(the allocation block size \(the smallest amount of space a \214l\ +e can occup)108 456 R 2.799(y\). F)-.1 F .299 +(or a 650Mb CD, the allocation)-.15 F(block is 10Kb, for a 4.7Gb D)108 +468 Q(VD it will be about 70Kb)-.4 E(.)-.4 E .203 +(The maximum number of \214les in an HFS v)108 484.8 R .202 +(olume is about 65500 - although the real limit will be some)-.2 F(what) +-.25 E(less than this.)108 496.8 Q .018(The resulting h)108 513.6 R .018 +(ybrid v)-.05 F .018(olume can be accessed on a Unix machine by using t\ +he hfsutils routines. Ho)-.2 F(we)-.25 E -.15(ve)-.25 G .819 -.4(r, n) +.15 H(o).4 E .978(changes can be made to the v)108 525.6 R .978 +(olume as it is set as)-.2 F F3(lock)3.478 E(ed.)-.1 E F0 .978 +(The option)5.978 F F3(\255hfs-unlock)3.478 E F0 .977 +(will create an output)3.478 F 1.123(image that is unlock)108 537.6 R +1.124(ed - ho)-.1 F(we)-.25 E -.15(ve)-.25 G 3.624(rn).15 G 3.624(oc) +-3.624 G 1.124(hanges should be made to the contents of the v)-3.624 F +1.124(olume \(unless you)-.2 F(really kno)108 549.6 Q 2.5(ww)-.25 G +(hat you are doing\) as it')-2.5 E 2.5(sn)-.55 G(ot a "real" HFS v)-2.5 +E(olume.)-.2 E .609(Using the)108 566.4 R F3(\255mac-name)3.109 E F0 +.609(option will not currently w)3.109 F .609(ork with the)-.1 F F3 +<ad54>3.108 E F0 .608(option - the Unix name will be used in)3.108 F +(the TRANS.TBL \214le, not the Macintosh name.)108 578.4 Q(Although)108 +595.2 Q F3(mkisofs)3.007 E F0 .507 +(does not alter the contents of a \214le, if a binary \214le has it') +3.007 F 3.007(sT)-.55 G .507(YPE set as 'TEXT', it)-3.007 F F2(may)3.008 +E F0(be read incorrectly on a Macintosh. Therefore a better choice for \ +the def)108 607.2 Q(ault TYPE may be '????')-.1 E(The)108 624 Q F3 +(\255mac-boot-\214le)2.5 E F0(option may not w)2.5 E(ork at all...)-.1 E +.51(May not w)108 640.8 R .51 +(ork with PC Exchange v2.2 or higher \214les \(a)-.1 F -.25(va)-.2 G +.509(ilable with MacOS 8.1\).).25 F .509(DOS media containing)5.509 F +(PC Exchange \214les should be mounted as type)108 652.8 Q F3(msdos)2.5 +E F0(\(not)2.5 E F3(vfat)2.5 E F0 2.5(\)w)C(hen using Linux.)-2.5 E +(The SFM format is only partially supported - see)108 669.6 Q F3(HFS MA) +2.5 E(CINT)-.55 E(OSH FILE FORMA)-.18 E(TS)-.95 E F0(section abo)2.5 E +-.15(ve)-.15 G(.).15 E 1.015(It is not possible to use the the)108 686.4 +R F3(\255spar)3.516 E(c-boot)-.18 E F0(or)3.516 E F3(\255generic-boot) +3.516 E F0 1.016(options with the)3.516 F F3(\255boot-hfs-\214le)3.516 E +F0(or)3.516 E F3(\255pr)3.516 E(ep-)-.18 E(boot)108 698.4 Q F0(options.) +2.5 E F3(mkisofs)108 715.2 Q F0(should be able to create HFS h)2.5 E +(ybrid images o)-.05 E -.15(ve)-.15 G 2.5(r4).15 G +(Gb, although this has not been fully tested.)-2.5 E -1.11(Ve)72 768 S +(rsion 2.0)1.11 E(24 Dec 2002)162.9 E(23)198.45 E EP +%%Page: 24 24 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 355.5(MKISOFS\(8\) MKISOFS\(8\))72 48 R/F1 10.95 +/Times-Bold@0 SF(SEE ALSO)72 84 Q/F2 10/Times-Bold@0 SF(cdr)108 96 Q +(ecord)-.18 E F0(\(1\),)A F2(mkzftr)2.5 E(ee)-.18 E F0(\(1\),)A F2 +(magic)2.5 E F0(\(5\),)A F2(apple_dri)2.5 E -.1(ve)-.1 G(r).1 E F0 +(\(8\).)A F1(FUTURE IMPR)72 124.8 Q -.548(OV)-.329 G(EMENTS).548 E F0 +(Some sort of gui interf)108 136.8 Q(ace.)-.1 E F1 -1.04 -1.588(AV A)72 +153.6 T(ILABILITY)1.588 E F2(mkisofs)108 165.6 Q F0(is a)2.5 E -.25(va) +-.2 G(ilable as part of the cdrecord package from ftp://ftp.berlios.de/\ +pub/cdrecord/).25 E F2(hfsutils)108 189.6 Q F0(from ftp://ftp.mars.or) +2.5 E(g/pub/hfs)-.18 E F2(mkzftr)108 213.6 Q(ee)-.18 E F0(is a)2.5 E +-.25(va)-.2 G +(ilable as part of the zisofs-tools package from ftp://ftp.k).25 E +(ernel.or)-.1 E(g/pub/linux/utils/fs/zisofs/)-.18 E F1(MAILING LISTS)72 +230.4 Q F0 .173(If you w)108 242.4 R .173(ant to acti)-.1 F -.15(ve)-.25 +G .172(ly tak).15 F 2.672(ep)-.1 G .172(art on the de)-2.672 F -.15(ve) +-.25 G .172(lopment of mkisofs, and/or mkh).15 F .172 +(ybrid, you may join the cdwrit-)-.05 F +(ing mailing list by sending mail to:)108 254.4 Q(other)180 278.4 Q +(-cdwrite-request@lists.debian.or)-.2 E(g)-.18 E(and include the w)108 +302.4 Q(ord)-.1 E/F3 10/Times-Italic@0 SF(subscribe)2.5 E F0 +(in the body)2.5 E 5(.T)-.65 G(he mail address of the list is:)-5 E +(cdwrite@lists.debian.or)180 326.4 Q(g)-.18 E F1(MAINT)72 355.2 Q(AINER) +-.986 E F0(J)108 367.2 Q -.25(..)-5.5 K(or)-4.5 5.5 M 2.5(gS)-.18 G +(chilling)-2.5 E(Seestr)108 379.2 Q 2.5(.1)-.55 G(10)-2.5 E +(D-13353 Berlin)108 391.2 Q(German)108 403.2 Q(y)-.15 E F1 +(HFS MKHYBRID MAINT)72 420 Q(AINER)-.986 E F0(James Pearson)108 432 Q +(j.pearson@ge.ucl.ac.uk)108 448.8 Q(If you ha)108 477.6 Q .3 -.15(ve s) +-.2 H(upport questions, send them to:).15 E F2(cdr)108 494.4 Q +(ecord-support@berlios.de)-.18 E F0(or)108 506.4 Q F2(other)2.5 E(-cd) +-.37 E(write@lists.debian.or)-.15 E(g)-.1 E F0 +(Of you de\214nitly found a b)108 523.2 Q(ug, send a mail to:)-.2 E F2 +(cdr)108 540 Q(ecord-de)-.18 E -.1(ve)-.15 G(lopers@berlios.de).1 E F0 +(or)108 552 Q F2(schilling@f)2.5 E(okus.fhg)-.25 E(.de)-.15 E F0 1.6 -.8 +(To s)108 568.8 T(ubscribe, use:).8 E F2 +(http://lists.berlios.de/mailman/listinf)108 585.6 Q(o/cdr)-.25 E +(ecord-de)-.18 E -.1(ve)-.15 G(lopers).1 E F0(or)108 597.6 Q F2 +(http://lists.berlios.de/mailman/listinf)2.5 E(o/cdr)-.25 E +(ecord-support)-.18 E F0 -1.11(Ve)72 768 S(rsion 2.0)1.11 E(24 Dec 2002) +162.9 E(24)198.45 E EP +%%Trailer +end +%%EOF diff --git a/scsilib/doc/readcd.man b/scsilib/doc/readcd.man new file mode 100644 index 0000000..57f16b2 --- /dev/null +++ b/scsilib/doc/readcd.man @@ -0,0 +1,422 @@ +READCD(1) Schily's USER COMMANDS READCD(1) + + + +NNAAMMEE + readcd - read or write data Compact Discs + +SSYYNNOOPPSSIISS + rreeaaddccdd ddeevv==_d_e_v_i_c_e [ _o_p_t_i_o_n_s ] + + +DDEESSCCRRIIPPTTIIOONN + RReeaaddccdd is used to read or write Compact Discs. + + The _d_e_v_i_c_e refers to _s_c_s_i_b_u_s/_t_a_r_g_e_t/_l_u_n of the drive. Com- + munication on _S_u_n_O_S is done with the SCSI general driver + ssccgg.. Other operating systems are using a library simula- + tion of this driver. Possible syntax is: ddeevv== _s_c_s_i_- + _b_u_s,_t_a_r_g_e_t,_l_u_n or ddeevv== _t_a_r_g_e_t,_l_u_n. In the latter case, + the drive has to be connected to the default SCSI bus of + the machine. _S_c_s_i_b_u_s, _t_a_r_g_e_t and _l_u_n are integer numbers. + Some operating systems or SCSI transport implementations + may require to specify a filename in addition. In this + case the correct syntax for the device is: ddeevv== _d_e_v_i_c_e_- + _n_a_m_e:_s_c_s_i_b_u_s,_t_a_r_g_e_t,_l_u_n or ddeevv== _d_e_v_i_c_e_n_a_m_e:_t_a_r_g_e_t,_l_u_n. If + the name of the device node that has been specified on + such a system refers to exactly one SCSI device, a short- + hand in the form ddeevv== _d_e_v_i_c_e_n_a_m_e:_@ or ddeevv== _d_e_v_i_c_e_- + _n_a_m_e:_@,_l_u_n may be used instead of ddeevv== _d_e_v_i_c_e_n_a_m_e:_s_c_s_i_- + _b_u_s,_t_a_r_g_e_t,_l_u_n. + + + To access remote SCSI devices, you need to prepend the + SCSI device name by a remote device indicator. The remote + device indicator is either RREEMMOOTTEE::_u_s_e_r_@_h_o_s_t_: or + RREEMMOOTTEE::_h_o_s_t_: + A valid remote SCSI device name may be: RREEMMOOTTEE::_u_s_e_r_@_h_o_s_t_: + to allow remote SCSI bus scanning or + RREEMMOOTTEE::_u_s_e_r_@_h_o_s_t_:_1_,_0_,_0 to access the SCSI device at _h_o_s_t + connected to SCSI bus # 1,target 0 lun 0. + + + To access SCSI devices via alternate transport layers, you + need to prepend the SCSI device name by a transport layer + indicator. The transport layer indicator may be something + like UUSSCCSSII:: or AATTAAPPII::. To get a list of supported trans- + port layers for your platform, use ddeevv== _H_E_L_P: + + + To make rreeaaddccdd portable to all UNIX platforms, the syntax + ddeevv== _d_e_v_i_c_e_n_a_m_e:_s_c_s_i_b_u_s,_t_a_r_g_e_t,_l_u_n is preferred as is + hides OS specific knowledge about device names from the + user. A specific OS must not necessarily support a way to + specify a real device file name nor a way to specify _s_c_s_i_- + _b_u_s,_t_a_r_g_e_t,_l_u_n. + + + _S_c_s_i_b_u_s 0 is the default SCSI bus on the machine. Watch + the boot messages for more information or look into + //vvaarr//aaddmm//mmeessssaaggeess for more information about the SCSI con- + figuration of your machine. If you have problems to fig- + ure out what values for _s_c_s_i_b_u_s,_t_a_r_g_e_t,_l_u_n should be used, + try the --ssccaannbbuuss option of ccddrreeccoorrdd. + + +OOPPTTIIOONNSS + If no options except the _d_e_v_= option have been specified, + rreeaaddccdd goes into interactive mode. Select a primary func- + tion and then follow the instructions. + + + --vveerrssiioonn + Print version information and exit. + + ddeevv==_t_a_r_g_e_t + Sets the SCSI target for the drive, see notes + above. A typical device specification is ddeevv==_6_,_0 . + If a filename must be provided together with the + numerical target specification, the filename is + implementation specific. The correct filename in + this case can be found in the system specific manu- + als of the target operating system. On a _F_r_e_e_B_S_D + system without _C_A_M support, you need to use the + control device (e.g. _/_d_e_v_/_r_c_d_0_._c_t_l). A correct + device specification in this case may be + ddeevv==_/_d_e_v_/_r_c_d_0_._c_t_l_:_@ . + + On Linux, drives connected to a parallel port + adapter are mapped to a virtual SCSI bus. Different + adapters are mapped to different targets on this + virtual SCSI bus. + + If no _d_e_v option is present, ccddrreeccoorrdd will try to + get the device from the CCDDRR__DDEEVVIICCEE environment. + + If the argument to the ddeevv== option does not contain + the characters ',', '/', '@' or ':', it is inter- + preted as an label name that may be found in the + file /etc/default/cdrecord (see FILES section). + + ttiimmeeoouutt==_# + Set the default SCSI command timeout value to _# + seconds. The default SCSI command timeout is the + minimum timeout used for sending SCSI commands. If + a SCSI command fails due to a timeout, you may try + to raise the default SCSI command timeout above the + timeout value of the failed command. If the com- + mand runs correctly with a raised command timeout, + please report the better timeout value and the cor- + responding command to the author of the program. + If no _t_i_m_e_o_u_t option is present, a default timeout + of 40 seconds is used. + + ddeebbuugg==_#_, --dd + Set the misc debug value to # (with debug=#) or + increment the misc debug level by one (with -d). If + you specify _-_d_d_, this equals to ddeebbuugg==_2_. This may + help to find problems while opening a driver for + libscg. as well as with sector sizes and sector + types. Using --ddeebbuugg slows down the process and may + be the reason for a buffer underrun. + + kkddeebbuugg==#, kkdd==# + Tell the ssccgg-driver to modify the kernel debug + value while SCSI commands are running. + + --ssiilleenntt, --ss + Do not print out a status report for failed SCSI + commands. + + --vv Increment the level of general verbosity by one. + This is used e.g. to display the progress of the + process. + + --VV Increment the verbose level with respect of SCSI + command transport by one. This helps to debug + problems during the process, that occur in the CD- + Recorder. If you get incomprehensible error mes- + sages you should use this flag to get more detailed + output. --VVVV will show data buffer content in addi- + tion. Using --VV or --VVVV slows down the process. + + ff==_f_i_l_e Specify the filename where the output should be + written or the inout should be taken from. Using + '-' as filename will cause rreeaaddccdd to use ssttddoouutt + resp. ssttddiinn. + + --ww Switch to write mode. If this option is not pre- + sent, rreeaaddccdd reads from the specified device. + + --cc22ssccaann + Scans the whole CD or the range specified by the + sseeccttoorrss==_r_a_n_g_e for C2 errors. C2 errors are errors + that are uncorrectable after the second stage of + the 24/28 + 28/32 Reed Solomon correction system at + audio level (2352 bytes sector size). If an audio + CD has C2 errors, interpolation is needed to hide + the errors. If a data CD has C2 errors, these + errors are in most cases corrected by the ECC/EDC + code that makes 2352 bytes out of 2048 data bytes. + The ECC/EDC code should be able to correct about + 100 C2 error bytes per sector. + + If you find C2 errors you may want to reduce the + speed using the ssppeeeedd== option as C2 errors may be a + result of dynamic unbalance on the medium. + + sseeccttoorrss==_r_a_n_g_e + Specify a sector range that should be read. The + range is specified by the starting sector number, a + minus sign and the ending sector number. The end + sector is not included in the list, so sseeccttoorrss==0-0 + will not read anything and may be used to check for + a CD in the drive. + + ssppeeeedd==# + Set the speed factor of the read or write process + to #. # is an integer, representing a multiple of + the audio speed. This is about 150 KB/s for CD-ROM + and about 172 KB/s for CD-Audio. If no _s_p_e_e_d + option is present, rreeaaddccdd will use maximum speed. + Only MMC compliant drives will benefit from this + option. The speed of non MMC drives is not + changed. + + Using a lower speed may increase the readability of + a CD or DVD. + + --nnoottrruunncc + Do not truncate the outputfile when opening it. + + --ffuullllttoocc + Retrieve a full TOC from the current disk and print + it in hex. + + --cclloonnee Do a clone read. Read the CD with all sub-channel + data and a full TOC. The full TOC data will be but + into a file with similar name as with the ff== option + but the suffix ..ttoocc added. + + --nnooeerrrroorr + Do not abort if the high level error checking in + rreeaaddccdd found an uncorrectable error in the data + stream. + + --nnooccoorrrr + Switch the drive into a mode where it ignores read + errors in data sectors that are a result of uncor- + rectable ECC/EDC errors before reading. If rreeaaddccdd + completes, the error recovery mode of the drive is + switched back to the remembered old mode. + + rreettrriieess==_# + Set the retry count for high level retries in + rreeaaddccdd to _#. The default is to do 128 retries + which may be too much if you like to read a CD with + many unreadable sectors. + + --oovveerrhheeaadd + Meter the SCSI command overhead time. This is done + by executing several commands 1000 times and print- + ing the total time used. If you divide the dis- + played times by 1000, you get the average overhead + time for a single command. + +EEXXAAMMPPLLEESS + For all examples below, it will be assumed that the drive + is connected to the primary SCSI bus of the machine. The + SCSI target id is set to 2. + + To read the complete media from a CD-ROM writing the data + to the file _c_d_i_m_a_g_e_._r_a_w: + + readcd dev=2,0 f=cdimage.raw + + To read sectors from range 150 ... 10000 from a CD-ROM + writing the data to the file _c_d_i_m_a_g_e_._r_a_w: + + readcd dev=2,0 sectors=150-10000 f=cdimage.raw + + To write the data from the file _c_d_i_m_a_g_e_._r_a_w (e.g. a + filesystem image from mmkkiissooffss) to a DVD-RAM, call: + + readcd dev=2,0 -w f=cdimage.raw + + +EENNVVIIRROONNMMEENNTT + RRSSHH If the RRSSHH environment is present, the remote con- + nection will not be created via rrccmmdd(3) but by + calling the program pointed to by RRSSHH. Use e.g. + RRSSHH==/usr/bin/ssh to create a secure shell connec- + tion. + + Note that this forces ccddrreeccoorrdd to create a pipe to + the rrsshh((11)) program and disallows ccddrreeccoorrdd to + directly access the network socket to the remote + server. This makes it impossible to set up perfor- + mance parameters and slows down the connection com- + pared to a rroooott initiated rrccmmdd((33)) connection. + + RRSSCCSSII If the RRSSCCSSII environment is present, the remote + SCSI server will not be the program + //oopptt//sscchhiillyy//ssbbiinn//rrssccssii but the program pointed to + by RRSSCCSSII. Note that the remote SCSI server program + name will be ignored if you log in using an account + that has been created with a remote SCSI server + program as login shell. + +FFIILLEESS +SSEEEE AALLSSOO + ccddrreeccoorrdd(1), mmkkiissooffss(1), ssccgg(7), ffbbkk(7), rrccmmdd(3), sssshh(1). + + +NNOOTTEESS + If you don't want to allow users to become root on your + system, rreeaaddccdd may safely be installed suid root. This + allows all users or a group of users with no root privi- + leges to use rreeaaddccdd.. RReeaaddccdd in this case will only allow + access to CD-ROM type drives- To give all user access to + use rreeaaddccdd,, enter: + + chown root /usr/local/bin/readcd + chmod 4711 /usr/local/bin/readcd + + To give a restricted group of users access to rreeaaddccdd + enter: + + chown root /usr/local/bin/readcd + chgrp cdburners /usr/local/bin/readcd + chmod 4710 /usr/local/bin/readcd + + and add a group _c_d_b_u_r_n_e_r_s on your system. + + Never give write permissions for non root users to the + _/_d_e_v_/_s_c_g_? devices unless you would allow anybody to + read/write/format all your disks. + + You should not connect old drives that do not support dis- + connect/reconnect to either the SCSI bus that is connected + to the CD-Recorder or the source disk. + + When using rreeaaddccdd with the broken LLiinnuuxx SSCCSSII ggeenneerriicc + ddrriivveerr.. You should note that rreeaaddccdd uses a hack, that + tries to emulate the functionality of the scg driver. + Unfortunately, the sg driver on LLiinnuuxx has several severe + bugs: + + +o It cannot see if a SCSI command could not be sent + at all. + + +o It cannot get the SCSI status byte. RReeaaddccdd for + that reason cannot report failing SCSI commands in + some situations. + + +o It cannot get real DMA count of transfer. RReeaaddccdd + cannot tell you if there is an DMA residual count. + + +o It cannot get number of bytes valid in auto sense + data. RReeaaddccdd cannot tell you if device transfers + no sense data at all. + + +o It fetches to few data in auto request sense + (CCS/SCSI-2/SCSI-3 needs >= 18). + + +DDIIAAGGNNOOSSTTIICCSS + A typical error message for a SCSI command looks like: + + readcd: I/O error. test unit ready: scsi sendcmd: no error + CDB: 00 20 00 00 00 00 + status: 0x2 (CHECK CONDITION) + Sense Bytes: 70 00 05 00 00 00 00 0A 00 00 00 00 25 00 00 00 00 00 + Sense Key: 0x5 Illegal Request, Segment 0 + Sense Code: 0x25 Qual 0x00 (logical unit not supported) Fru 0x0 + Sense flags: Blk 0 (not valid) + cmd finished after 0.002s timeout 40s + + The first line gives information about the transport of + the command. The text after the first colon gives the + error text for the system call from the view of the ker- + nel. It usually is: II//OO eerrrroorr unless other problems hap- + pen. The next words contain a short description for the + SCSI command that fails. The rest of the line tells you if + there were any problems for the transport of the command + over the SCSI bus. ffaattaall eerrrroorr means that it was not pos- + sible to transport the command (i.e. no device present at + the requested SCSI address). + + The second line prints the SCSI command descriptor block + for the failed command. + + The third line gives information on the SCSI status code + returned by the command, if the transport of the command + succeeds. This is error information from the SCSI device. + + The fourth line is a hex dump of the auto request sense + information for the command. + + The fifth line is the error text for the sense key if + available, followed by the segment number that is only + valid if the command was a _c_o_p_y command. If the error mes- + sage is not directly related to the current command, the + text _d_e_f_e_r_r_e_d _e_r_r_o_r is appended. + + The sixth line is the error text for the sense code and + the sense qualifier if available. If the type of the + device is known, the sense data is decoded from tables in + _s_c_s_i_e_r_r_s_._c . The text is followed by the error value for + a field replaceable unit. + + The seventh line prints the block number that is related + to the failed command and text for several error flags. + The block number may not be valid. + + The eight line reports the timeout set up for this command + and the time that the command really needed to complete. + + +BBUUGGSS +CCRREEDDIITTSS +MMAAIILLIINNGG LLIISSTTSS + If you want to actively take part on the development of + cdrecord, you may join the cdwriting mailing list by send- + ing mail to: + + other-cdwrite-request@lists.debian.org + + and include the word _s_u_b_s_c_r_i_b_e in the body. The mail + address of the list is: + + cdwrite@lists.debian.org + + +AAUUTTHHOORR + Joerg Schilling + Seestr. 110 + D-13353 Berlin + Germany + + Additional information can be found on: + http://www.fokus.fhg.de/usr/schilling/cdrecord.html + + If you have support questions, send them to: + + ccddrreeccoorrdd--ssuuppppoorrtt@@bbeerrlliiooss..ddee + or ootthheerr--ccddwwrriittee@@lliissttss..ddeebbiiaann..oorrgg + + Of you have definitely found a bug, send a mail to: + + ccddrreeccoorrdd--ddeevveellooppeerrss@@bbeerrlliiooss..ddee + or sscchhiilllliinngg@@ffookkuuss..ffhhgg..ddee + + To subscribe, use: + + hhttttpp::////lliissttss..bbeerrlliiooss..ddee//mmaaiillmmaann//lliissttiinnffoo//ccddrreeccoorrdd--ddeevveelloopp-- + eerrss + or hhttttpp::////lliissttss..bbeerrlliiooss..ddee//mmaaiillmmaann//lliissttiinnffoo//ccddrreeccoorrdd--ssuupp-- + ppoorrtt + + + +Joerg Schilling Version 2.0 READCD(1) diff --git a/scsilib/doc/readcd.ps b/scsilib/doc/readcd.ps new file mode 100644 index 0000000..724c2bc --- /dev/null +++ b/scsilib/doc/readcd.ps @@ -0,0 +1,660 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.17.2 +%%CreationDate: Tue Dec 24 17:02:56 2002 +%%DocumentNeededResources: font Times-Roman +%%+ font Times-Bold +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.17 2 +%%Pages: 5 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.17 2 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 841.89 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron +/Zcaron/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE +/Times-Roman@0 ENC0/Times-Roman RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 117.615(READCD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(READCD\(1\))120.115 E/F1 10.95/Times-Bold@0 SF +-.219(NA)72 84 S(ME).219 E F0 +(readcd \255 read or write data Compact Discs)108 96 Q F1(SYNOPSIS)72 +112.8 Q/F2 10/Times-Bold@0 SF -.18(re)108 124.8 S(adcd de).18 E(v=)-.15 +E/F3 10/Times-Italic@0 SF(de).35 E(vice)-.15 E F0([)2.5 E F3(options)2.5 +E F0(])2.5 E F1(DESCRIPTION)72 153.6 Q F2(Readcd)108 165.6 Q F0 +(is used to read or write Compact Discs.)2.5 E(The)108 182.4 Q F3(de) +3.065 E(vice)-.15 E F0 .565(refers to)3.065 F F3(scsib)3.065 E(us)-.2 E +F0(/).27 E F3(tar).13 E -.1(ge)-.37 G(t).1 E F0(/).68 E F3(lun).09 E F0 +.565(of the dri)3.065 F -.15(ve)-.25 G 3.064(.C).15 G .564 +(ommunication on)-3.064 F F3(SunOS)3.064 E F0 .564 +(is done with the SCSI gen-)3.064 F 1.02(eral dri)108 194.4 R -.15(ve) +-.25 G(r).15 E F2(scg)3.52 E(.)-.15 E F0 1.02 +(Other operating systems are using a library simulation of this dri)6.02 +F -.15(ve)-.25 G 4.62 -.55(r. P).15 H 1.02(ossible syntax is:).55 F F2 +(de)108 206.4 Q(v=)-.15 E F3(scsib)3.228 E(us)-.2 E F0(,).27 E F3(tar) +.13 E -.1(ge)-.37 G(t).1 E F0(,).68 E F3(lun).09 E F0(or)3.227 E F2(de) +3.227 E(v=)-.15 E F3(tar)3.227 E -.1(ge)-.37 G(t).1 E F0(,).68 E F3(lun) +.09 E F0 5.727(.I).24 G 3.227(nt)-5.727 G .727(he latter case, the dri) +-3.227 F 1.027 -.15(ve h)-.25 H .727(as to be connected to the def).15 F +(ault)-.1 E .85(SCSI b)108 218.4 R .85(us of the machine.)-.2 F F3 +(Scsib)5.85 E(us)-.2 E F0(,).27 E F3(tar)3.35 E -.1(ge)-.37 G(t).1 E F0 +(and)3.351 E F3(lun)3.351 E F0 .851(are inte)3.351 F .851(ger numbers.) +-.15 F .851(Some operating systems or SCSI)5.851 F .338(transport imple\ +mentations may require to specify a \214lename in addition.)108 230.4 R +.337(In this case the correct syntax for)5.337 F 2.308(the de)108 242.4 +R 2.308(vice is:)-.25 F F2(de)4.808 E(v=)-.15 E F3(de)4.808 E(vicename) +-.15 E F0(:).18 E F3(scsib).34 E(us)-.2 E F0(,).27 E F3(tar).13 E -.1 +(ge)-.37 G(t).1 E F0(,).68 E F3(lun).09 E F0(or)4.808 E F2(de)4.808 E +(v=)-.15 E F3(de)4.808 E(vicename)-.15 E F0(:).18 E F3(tar).13 E -.1(ge) +-.37 G(t).1 E F0(,).68 E F3(lun).09 E F0 7.308(.I).24 G 4.809(ft)-7.308 +G 2.309(he name of the)-4.809 F(de)108 254.4 Q .465 +(vice node that has been speci\214ed on such a system refers to e)-.25 F +.465(xactly one SCSI de)-.15 F .465(vice, a shorthand in the)-.25 F +(form)108 266.4 Q F2(de)2.646 E(v=)-.15 E F3(de)2.646 E(vicename)-.15 E +F0(:).18 E F3(@)-.68 E F0(or)2.646 E F2(de)2.646 E(v=)-.15 E F3(de)2.647 +E(vicename)-.15 E F0(:).18 E F3(@)-.68 E F0(,)A F3(lun).09 E F0 .147 +(may be used instead of)2.647 F F2(de)2.647 E(v=)-.15 E F3(de)2.647 E +(vicename)-.15 E F0(:).18 E F3(scsib).34 E(us)-.2 E F0(,).27 E F3(tar) +.13 E(-)-.2 E -.1(ge)108 278.4 S(t).1 E F0(,).68 E F3(lun)A F0(.).24 E +2.32 -.8(To a)108 307.2 T .72(ccess remote SCSI de).8 F .72 +(vices, you need to prepend the SCSI de)-.25 F .72 +(vice name by a remote de)-.25 F .72(vice indicator)-.25 F(.)-.55 E +(The remote de)108 319.2 Q(vice indicator is either)-.25 E F2(REMO)2.5 E +(TE:)-.4 E F3(user@host:).08 E F0(or)2.5 E F2(REMO)5 E(TE:)-.4 E F3 +(host:).31 E F0 3.273(Av)108 331.2 S .773(alid remote SCSI de)-3.523 F +.773(vice name may be:)-.25 F F2(REMO)3.273 E(TE:)-.4 E F3(user@host:) +.08 E F0 .773(to allo)3.273 F 3.274(wr)-.25 G .774(emote SCSI b)-3.274 F +.774(us scanning or)-.2 F F2(REMO)108 343.2 Q(TE:)-.4 E F3 +(user@host:1,0,0)A F0(to access the SCSI de)2.5 E(vice at)-.25 E F3 +(host)2.5 E F0(connected to SCSI b)2.5 E(us # 1,tar)-.2 E(get 0 lun 0.) +-.18 E 3.074 -.8(To a)108 372 T 1.474(ccess SCSI de).8 F 1.474 +(vices via alternate transport layers, you need to prepend the SCSI de) +-.25 F 1.473(vice name by a)-.25 F .057(transport layer indicator)108 +384 R 5.057(.T)-.55 G .057 +(he transport layer indicator may be something lik)-5.057 F(e)-.1 E F2 +(USCSI:)2.558 E F0(or)2.558 E F2 -1.5 -.95(AT A)2.558 H(PI:).95 E F0 +5.058(.T)C 2.558(og)-5.858 G .058(et a)-2.558 F +(list of supported transport layers for your platform, use)108 396 Q F2 +(de)2.5 E(v=)-.15 E F3(HELP)2.5 E F0(:).44 E 1.862 -.8(To m)108 424.8 T +(ak).8 E(e)-.1 E F2 -.18(re)2.762 G(adcd).18 E F0 .262(portable to all) +2.762 F/F4 8/Times-Roman@0 SF(UNIX)2.761 E F0 .261 +(platforms, the syntax)2.761 F F2(de)2.761 E(v=)-.15 E F3(de)2.761 E +(vicename)-.15 E F0(:).18 E F3(scsib).34 E(us)-.2 E F0(,).27 E F3(tar) +.13 E -.1(ge)-.37 G(t).1 E F0(,).68 E F3(lun).09 E F0 .261(is preferred) +2.761 F .754(as is hides OS speci\214c kno)108 436.8 R .755 +(wledge about de)-.25 F .755(vice names from the user)-.25 F 5.755(.A) +-.55 G .755(speci\214c OS must not necessarily)-2.5 F(support a w)108 +448.8 Q(ay to specify a real de)-.1 E(vice \214le name nor a w)-.25 E +(ay to specify)-.1 E F3(scsib)2.5 E(us)-.2 E F0(,).27 E F3(tar).13 E -.1 +(ge)-.37 G(t).1 E F0(,).68 E F3(lun).09 E F0(.).24 E F3(Scsib)108 477.6 +Q(us)-.2 E F0 3.257(0i)3.257 G 3.257(st)-3.257 G .757(he def)-3.257 F +.757(ault SCSI b)-.1 F .757(us on the machine. W)-.2 F .756 +(atch the boot messages for more information or look)-.8 F(into)108 +489.6 Q F2(/v)2.995 E(ar/adm/messages)-.1 E F0 .496 +(for more information about the SCSI con\214guration of your machine.) +2.995 F .496(If you ha)5.496 F -.15(ve)-.2 G 2.158 +(problems to \214gure out what v)108 501.6 R 2.158(alues for)-.25 F F3 +(scsib)4.658 E(us)-.2 E F0(,).27 E F3(tar).13 E -.1(ge)-.37 G(t).1 E F0 +(,).68 E F3(lun).09 E F0 2.158(should be used, try the)4.658 F F2 +(\255scanb)4.658 E(us)-.2 E F0 2.158(option of)4.658 F F2(cdr)108 513.6 +Q(ecord)-.18 E F0(.)A F1(OPTIONS)72 542.4 Q F0 .483(If no options e)108 +554.4 R .483(xcept the)-.15 F F3(de)2.983 E(v=)-.15 E F0 .483(option ha) +2.983 F .783 -.15(ve b)-.2 H .484(een speci\214ed,).15 F F2 -.18(re) +2.984 G(adcd).18 E F0 .484(goes into interacti)2.984 F .784 -.15(ve m) +-.25 H 2.984(ode. Select).15 F 2.984(ap)2.984 G(ri-)-2.984 E +(mary function and then follo)108 566.4 Q 2.5(wt)-.25 G +(he instructions.)-2.5 E F2<ad76>108 588 Q(ersion)-.1 E F0(Print v)144 +600 Q(ersion information and e)-.15 E(xit.)-.15 E F2(de)108 616.8 Q(v=) +-.15 E F3(tar).13 E -.1(ge)-.37 G(t).1 E F0 .142(Sets the SCSI tar)144 +628.8 R .142(get for the dri)-.18 F -.15(ve)-.25 G 2.642(,s).15 G .142 +(ee notes abo)-2.642 F -.15(ve)-.15 G 5.142(.A).15 G .142(typical de) +-2.5 F .141(vice speci\214cation is)-.25 F F2(de)2.641 E(v=)-.15 E F3 +(6,0).2 E F0 5.141(.I)2.641 G 2.641(fa)-5.141 G .533 +(\214lename must be pro)144 640.8 R .533 +(vided together with the numerical tar)-.15 F .533 +(get speci\214cation, the \214lename is imple-)-.18 F .497 +(mentation speci\214c.)144 652.8 R .497(The correct \214lename in this \ +case can be found in the system speci\214c manuals)5.497 F .637 +(of the tar)144 664.8 R .637(get operating system.)-.18 F .637(On a) +5.637 F F3 -1.77 -.55(Fr e)3.137 H(eBSD).55 E F0 .638(system without) +3.137 F F3(CAM)3.138 E F0 .638(support, you need to use the)3.138 F +4.624(control de)144 676.8 R 4.624(vice \(e.g.)-.25 F F3(/de)9.624 E +(v/r)-.15 E(cd0.ctl)-.37 E F0 7.124(\). A).51 F 4.623(correct de)7.123 F +4.623(vice speci\214cation in this case may be)-.25 F F2(de)144 688.8 Q +(v=)-.15 E F3(/de)1.15 E(v/r)-.15 E(cd0.ctl:@)-.37 E F0(.)2.5 E .571 +(On Linux, dri)144 712.8 R -.15(ve)-.25 G 3.072(sc).15 G .572 +(onnected to a parallel port adapter are mapped to a virtual SCSI b) +-3.072 F .572(us. Dif)-.2 F(ferent)-.25 E(adapters are mapped to dif)144 +724.8 Q(ferent tar)-.25 E(gets on this virtual SCSI b)-.18 E(us.)-.2 E +(J)72 768 Q -.25(..)-5.5 K(or)-4.5 5.5 M 2.5(gS)-.18 G 153.065 +(chilling V)-2.5 F(ersion 2.0)-1.11 E(1)206.225 E EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 117.615(READCD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(READCD\(1\))120.115 E .527(If no)144 84 R/F1 10 +/Times-Italic@0 SF(de)3.027 E(v)-.15 E F0 .527(option is present,)3.027 +F/F2 10/Times-Bold@0 SF(cdr)3.027 E(ecord)-.18 E F0 .527 +(will try to get the de)3.027 F .527(vice from the)-.25 F F2(CDR_DEVICE) +3.026 E F0(en)3.026 E(viron-)-.4 E(ment.)144 96 Q 1.046(If the ar)144 +120 R 1.046(gument to the)-.18 F F2(de)3.547 E(v=)-.15 E F0 1.047 +(option does not contain the characters ',)3.547 F 1.047 +(', '/', '@' or ':', it is inter)-.7 F(-)-.2 E +(preted as an label name that may be found in the \214le /etc/def)144 +132 Q(ault/cdrecord \(see FILES section\).)-.1 E F2(timeout=)108 148.8 Q +F1(#).48 E F0 .13(Set the def)144 160.8 R .13 +(ault SCSI command timeout v)-.1 F .13(alue to)-.25 F F1(#)2.63 E F0 +2.63(seconds. The)3.53 F(def)2.63 E .13(ault SCSI command timeout is)-.1 +F .451(the minimum timeout used for sending SCSI commands.)144 172.8 R +.451(If a SCSI command f)5.451 F .452(ails due to a time-)-.1 F .367 +(out, you may try to raise the def)144 184.8 R .366 +(ault SCSI command timeout abo)-.1 F .666 -.15(ve t)-.15 H .366 +(he timeout v).15 F .366(alue of the f)-.25 F(ailed)-.1 E 2.715 +(command. If)144 196.8 R .216(the command runs correctly with a raised \ +command timeout, please report the better)2.715 F .402(timeout v)144 +208.8 R .401 +(alue and the corresponding command to the author of the program.)-.25 F +.401(If no)5.401 F F1(timeout)2.901 E F0(option)2.901 E +(is present, a def)144 220.8 Q(ault timeout of 40 seconds is used.)-.1 E +F2(deb)108 237.6 Q(ug=)-.2 E F1(#,).48 E F2(-d)2.5 E F0 .385 +(Set the misc deb)144 249.6 R .385(ug v)-.2 F .385(alue to # \(with deb) +-.25 F .386(ug=#\) or increment the misc deb)-.2 F .386(ug le)-.2 F -.15 +(ve)-.25 G 2.886(lb).15 G 2.886(yo)-2.886 G .386(ne \(with -d\).)-2.886 +F .13(If you specify)144 261.6 R F1(-dd,)2.63 E F0 .13(this equals to) +2.63 F F2(deb)2.63 E(ug=)-.2 E F1(2.).38 E F0 .13 +(This may help to \214nd problems while opening a dri)5.13 F -.15(ve) +-.25 G(r).15 E .863(for libscg.)144 273.6 R .864 +(as well as with sector sizes and sector types.)5.863 F(Using)5.864 E F2 +(\255deb)3.364 E(ug)-.2 E F0(slo)3.364 E .864(ws do)-.25 F .864 +(wn the process)-.25 F(and may be the reason for a b)144 285.6 Q(uf)-.2 +E(fer underrun.)-.25 E F2(kdeb)108 302.4 Q(ug=)-.2 E F0(#,)A F2(kd=)2.5 +E F0(#)A -.7(Te)144 314.4 S(ll the).7 E F2(scg)2.5 E F0(-dri)A -.15(ve) +-.25 G 2.5(rt).15 G 2.5(om)-2.5 G(odify the k)-2.5 E(ernel deb)-.1 E +(ug v)-.2 E(alue while SCSI commands are running.)-.25 E F2(\255silent) +108 331.2 Q F0(,)A F2<ad73>2.5 E F0 +(Do not print out a status report for f)144 343.2 Q +(ailed SCSI commands.)-.1 E F2<ad76>108 360 Q F0 .994(Increment the le) +25.3 F -.15(ve)-.25 G 3.494(lo).15 G 3.494(fg)-3.494 G .994(eneral v) +-3.494 F .994(erbosity by one.)-.15 F .993 +(This is used e.g. to display the progress of the)5.994 F(process.)144 +372 Q F2<ad56>108 388.8 Q F0 .324(Increment the v)23.08 F .324 +(erbose le)-.15 F -.15(ve)-.25 G 2.824(lw).15 G .324 +(ith respect of SCSI command transport by one.)-2.824 F .324 +(This helps to deb)5.324 F(ug)-.2 E 1.194 +(problems during the process, that occur in the CD-Recorder)144 400.8 R +6.194(.I)-.55 G 3.694(fy)-6.194 G 1.193(ou get incomprehensible error) +-3.694 F .273 +(messages you should use this \215ag to get more detailed output.)144 +412.8 R F2(\255VV)5.273 E F0 .273(will sho)2.773 F 2.773(wd)-.25 G .274 +(ata b)-2.773 F(uf)-.2 E .274(fer content)-.25 F(in addition.)144 424.8 +Q(Using)5 E F2<ad56>2.5 E F0(or)2.5 E F2(\255VV)2.5 E F0(slo)2.5 E +(ws do)-.25 E(wn the process.)-.25 E F2(f=)108 441.6 Q F1(\214le)1.91 E +F0 .471(Specify the \214lename where the output should be written or th\ +e inout should be tak)12.84 F .47(en from. Using)-.1 F +('-' as \214lename will cause)144 453.6 Q F2 -.18(re)2.5 G(adcd).18 E F0 +(to use)2.5 E F2(stdout)2.5 E F0(resp.)2.5 E F2(stdin)2.5 E F0(.)A F2 +<ad77>108 470.4 Q F0 +(Switch to write mode. If this option is not present,)23.08 E F2 -.18 +(re)2.5 G(adcd).18 E F0(reads from the speci\214ed de)2.5 E(vice.)-.25 E +F2(\255c2scan)108 487.2 Q F0 .071 +(Scans the whole CD or the range speci\214ed by the)144 499.2 R F2 +(sectors=)2.571 E F1 -.15(ra)C(ng).15 E(e)-.1 E F0 .071 +(for C2 errors. C2 errors are errors)2.571 F .085(that are uncorrectabl\ +e after the second stage of the 24/28 + 28/32 Reed Solomon correction s\ +ystem)144 511.2 R 1.082(at audio le)144 523.2 R -.15(ve)-.25 G 3.583 +(l\().15 G 1.083(2352 bytes sector size\). If an audio CD has C2 errors\ +, interpolation is needed to)-3.583 F 2.191(hide the errors. If a data \ +CD has C2 errors, these errors are in most cases corrected by the)144 +535.2 R .157(ECC/EDC code that mak)144 547.2 R .158 +(es 2352 bytes out of 2048 data bytes. The ECC/EDC code should be able) +-.1 F(to correct about 100 C2 error bytes per sector)144 559.2 Q(.)-.55 +E .302(If you \214nd C2 errors you may w)144 583.2 R .302 +(ant to reduce the speed using the)-.1 F F2(speed=)2.801 E F0 .301 +(option as C2 errors may)2.801 F +(be a result of dynamic unbalance on the medium.)144 595.2 Q F2 +(sectors=)108 612 Q F1 -.15(ra)C(ng).15 E(e)-.1 E F0 .349 +(Specify a sector range that should be read.)144 624 R .349 +(The range is speci\214ed by the starting sector number)5.349 F 2.849 +(,a)-.4 G 1.891(minus sign and the ending sector number)144 636 R 6.891 +(.T)-.55 G 1.89(he end sector is not included in the list, so)-6.891 F +F2(sec-)4.39 E(tors=)144 648 Q F0(0-0 will not read an)A +(ything and may be used to check for a CD in the dri)-.15 E -.15(ve)-.25 +G(.).15 E F2(speed=)108 664.8 Q F0(#)A .1(Set the speed f)144 676.8 R .1 +(actor of the read or write process to #.)-.1 F 2.601(#i)5.101 G 2.601 +(sa)-2.601 G 2.601(ni)-2.601 G(nte)-2.601 E(ger)-.15 E 2.601(,r)-.4 G +.101(epresenting a multiple of the)-2.601 F 1.548(audio speed.)144 688.8 +R 1.548(This is about 150 KB/s for CD-R)6.548 F 1.547 +(OM and about 172 KB/s for CD-Audio.)-.4 F 1.547(If no)6.547 F F1(speed) +144 700.8 Q F0 .134(option is present,)2.634 F F2 -.18(re)2.634 G(adcd) +.18 E F0 .134(will use maximum speed.)2.634 F .135 +(Only MMC compliant dri)5.134 F -.15(ve)-.25 G 2.635(sw).15 G .135 +(ill bene-)-2.635 F(\214t from this option.)144 712.8 Q +(The speed of non MMC dri)5 E -.15(ve)-.25 G 2.5(si).15 G 2.5(sn)-2.5 G +(ot changed.)-2.5 E(J)72 768 Q -.25(..)-5.5 K(or)-4.5 5.5 M 2.5(gS)-.18 +G 153.065(chilling V)-2.5 F(ersion 2.0)-1.11 E(2)206.225 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 117.615(READCD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(READCD\(1\))120.115 E(Using a lo)144 84 Q +(wer speed may increase the readability of a CD or D)-.25 E(VD.)-.4 E/F1 +10/Times-Bold@0 SF(\255notrunc)108 100.8 Q F0 +(Do not truncate the output\214le when opening it.)144 112.8 Q F1 +(\255fulltoc)108 129.6 Q F0(Retrie)144 141.6 Q .3 -.15(ve a f)-.25 H +(ull T).15 E(OC from the current disk and print it in he)-.18 E(x.)-.15 +E F1(\255clone)108 158.4 Q F0 .002 +(Do a clone read. Read the CD with all sub-channel data and a full T) +8.08 F 2.502(OC. The)-.18 F .002(full T)2.502 F .002(OC data will be) +-.18 F -.2(bu)144 170.4 S 2.5(ti).2 G +(nto a \214le with similar name as with the)-2.5 E F1(f=)2.5 E F0 +(option b)2.5 E(ut the suf)-.2 E<8c78>-.25 E F1(.toc)2.5 E F0(added.)2.5 +E F1(\255noerr)108 187.2 Q(or)-.18 E F0 .997 +(Do not abort if the high le)144 199.2 R -.15(ve)-.25 G 3.497(le).15 G +.997(rror checking in)-3.497 F F1 -.18(re)3.497 G(adcd).18 E F0 .997 +(found an uncorrectable error in the data)3.497 F(stream.)144 211.2 Q F1 +(\255nocorr)108 228 Q F0 .309(Switch the dri)144 240 R .609 -.15(ve i) +-.25 H .308(nto a mode where it ignores read errors in data sectors tha\ +t are a result of uncor).15 F(-)-.2 E 1.361 +(rectable ECC/EDC errors before reading.)144 252 R(If)6.361 E F1 -.18 +(re)3.861 G(adcd).18 E F0 1.362(completes, the error reco)3.862 F -.15 +(ve)-.15 G 1.362(ry mode of the).15 F(dri)144 264 Q .3 -.15(ve i)-.25 H +2.5(ss).15 G(witched back to the remembered old mode.)-2.5 E F1 -.18(re) +108 280.8 S(tries=).18 E/F2 10/Times-Italic@0 SF(#).48 E F0 .07 +(Set the retry count for high le)144 292.8 R -.15(ve)-.25 G 2.57(lr).15 +G .07(etries in)-2.57 F F1 -.18(re)2.57 G(adcd).18 E F0(to)2.57 E F2(#) +2.569 E F0 5.069(.T).9 G .069(he def)-5.069 F .069 +(ault is to do 128 retries which may)-.1 F(be too much if you lik)144 +304.8 Q 2.5(et)-.1 G 2.5(or)-2.5 G(ead a CD with man)-2.5 E 2.5(yu)-.15 +G(nreadable sectors.)-2.5 E F1<ad6f>108 321.6 Q -.1(ve)-.1 G(rhead).1 E +F0 1.845(Meter the SCSI command o)144 333.6 R -.15(ve)-.15 G 1.845 +(rhead time.).15 F 1.845(This is done by e)6.845 F -.15(xe)-.15 G 1.846 +(cuting se).15 F -.15(ve)-.25 G 1.846(ral commands 1000).15 F .225 +(times and printing the total time used. If you di)144 345.6 R .225 +(vide the displayed times by 1000, you get the a)-.25 F -.15(ve)-.2 G +-.2(r-).15 G(age o)144 357.6 Q -.15(ve)-.15 G +(rhead time for a single command.).15 E/F3 10.95/Times-Bold@0 SF +(EXAMPLES)72 374.4 Q F0 -.15(Fo)108 386.4 S 4.105(ra).15 G 1.605(ll e) +-4.105 F 1.605(xamples belo)-.15 F 2.905 -.65(w, i)-.25 H 4.105(tw).65 G +1.605(ill be assumed that the dri)-4.105 F 1.905 -.15(ve i)-.25 H 4.105 +(sc).15 G 1.606(onnected to the primary SCSI b)-4.105 F 1.606(us of the) +-.2 F(machine. The SCSI tar)108 398.4 Q(get id is set to 2.)-.18 E 1.6 +-.8(To r)108 415.2 T(ead the complete media from a CD-R).8 E +(OM writing the data to the \214le)-.4 E F2(cdima)2.5 E -.1(ge)-.1 G(.r) +-.05 E(aw)-.15 E F0(:).31 E(readcd de)118 432 Q(v=2,0 f=cdimage.ra)-.25 +E(w)-.15 E 1.6 -.8(To r)108 448.8 T +(ead sectors from range 150 ... 10000 from a CD-R).8 E +(OM writing the data to the \214le)-.4 E F2(cdima)2.5 E -.1(ge)-.1 G(.r) +-.05 E(aw)-.15 E F0(:).31 E(readcd de)118 465.6 Q +(v=2,0 sectors=150-10000 f=cdimage.ra)-.25 E(w)-.15 E 1.6 -.8(To w)108 +482.4 T(rite the data from the \214le).8 E F2(cdima)2.5 E -.1(ge)-.1 G +(.r)-.05 E(aw)-.15 E F0(\(e.g. a \214lesystem image from)2.5 E F1 +(mkisofs)2.5 E F0 2.5(\)t)C 2.5(oaD)-2.5 G(VD-RAM, call:)-2.9 E +(readcd de)118 499.2 Q(v=2,0 -w f=cdimage.ra)-.25 E(w)-.15 E F3(ENVIR)72 +528 Q(ONMENT)-.329 E F1(RSH)108 540 Q F0 .55(If the)15.44 F F1(RSH)3.05 +E F0(en)3.05 E .549 +(vironment is present, the remote connection will not be created via)-.4 +F F1 -.18(rc)3.049 G(md).18 E F0 .549(\(3\) b)B .549(ut by)-.2 F .578 +(calling the program pointed to by)144 552 R F1(RSH)3.079 E F0 5.579(.U) +C .579(se e.g.)-5.579 F F1(RSH=)5.579 E F0 .579 +(/usr/bin/ssh to create a secure shell con-)B(nection.)144 564 Q .87 +(Note that this forces)144 588 R F1(cdr)3.37 E(ecord)-.18 E F0 .869 +(to create a pipe to the)3.37 F F1(rsh\(1\))3.369 E F0 .869 +(program and disallo)3.369 F(ws)-.25 E F1(cdr)3.369 E(ecord)-.18 E F0 +(to)3.369 E .28(directly access the netw)144 600 R .28(ork sock)-.1 F +.28(et to the remote serv)-.1 F(er)-.15 E 5.281(.T)-.55 G .281(his mak) +-5.281 F .281(es it impossible to set up perfor)-.1 F(-)-.2 E .813 +(mance parameters and slo)144 612 R .813(ws do)-.25 F .813 +(wn the connection compared to a)-.25 F F1 -.18(ro)3.313 G(ot).18 E F0 +(initiated)3.313 E F1 -.18(rc)3.313 G(md\(3\)).18 E F0(connec-)3.313 E +(tion.)144 624 Q F1(RSCSI)108 640.8 Q F0 3.942(If the)6.55 F F1(RSCSI) +6.442 E F0(en)6.443 E 3.943(vironment is present, the remote SCSI serv) +-.4 F 3.943(er will not be the program)-.15 F F1(/opt/schily/sbin/rscsi) +144 652.8 Q F0 -.2(bu)3.737 G 3.737(tt).2 G 1.236 +(he program pointed to by)-3.737 F F1(RSCSI)3.736 E F0 6.236(.N)C 1.236 +(ote that the remote SCSI serv)-6.236 F(er)-.15 E .553(program name wil\ +l be ignored if you log in using an account that has been created with \ +a remote)144 664.8 R(SCSI serv)144 676.8 Q(er program as login shell.) +-.15 E F3(FILES)72 693.6 Q(SEE ALSO)72 705.6 Q F1(cdr)108 717.6 Q(ecord) +-.18 E F0(\(1\),)A F1(mkisofs)2.5 E F0(\(1\),)A F1(scg)2.5 E F0(\(7\),)A +F1(fbk)2.5 E F0(\(7\),)A F1 -.18(rc)2.5 G(md).18 E F0(\(3\),)A F1(ssh) +2.5 E F0(\(1\).)A(J)72 768 Q -.25(..)-5.5 K(or)-4.5 5.5 M 2.5(gS)-.18 G +153.065(chilling V)-2.5 F(ersion 2.0)-1.11 E(3)206.225 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 117.615(READCD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(READCD\(1\))120.115 E/F1 10.95/Times-Bold@0 SF(NO) +72 84 Q(TES)-.438 E F0 .511(If you don')108 96 R 3.011(tw)-.18 G .511 +(ant to allo)-3.111 F 3.011(wu)-.25 G .511 +(sers to become root on your system,)-3.011 F/F2 10/Times-Bold@0 SF -.18 +(re)3.01 G(adcd).18 E F0 .51(may safely be installed suid root.)3.01 F +.865(This allo)108 108 R .865 +(ws all users or a group of users with no root pri)-.25 F(vile)-.25 E +.866(ges to use)-.15 F F2 -.18(re)3.366 G 3.366(adcd. Readcd).18 F F0 +.866(in this case will)3.366 F(only allo)108 120 Q 2.5(wa)-.25 G +(ccess to CD-R)-2.5 E(OM type dri)-.4 E -.15(ve)-.25 G(s- T).15 E 2.5 +(og)-.8 G -2.15 -.25(iv e)-2.5 H(all user access to use)2.75 E F2 -.18 +(re)2.5 G(adcd,).18 E F0(enter:)2.5 E(cho)144 136.8 Q +(wn root /usr/local/bin/readcd)-.25 E(chmod 4711 /usr/local/bin/readcd) +144 148.8 Q 1.6 -.8(To g)108 165.6 T -2.15 -.25(iv e).8 H 2.5(ar)2.75 G +(estricted group of users access to)-2.5 E F2 -.18(re)2.5 G(adcd).18 E +F0(enter:)2.5 E(cho)144 182.4 Q(wn root /usr/local/bin/readcd)-.25 E +(chgrp cdb)144 194.4 Q(urners /usr/local/bin/readcd)-.2 E +(chmod 4710 /usr/local/bin/readcd)144 206.4 Q(and add a group)108 223.2 +Q/F3 10/Times-Italic@0 SF(cdb)2.5 E(urner)-.2 E(s)-.1 E F0 +(on your system.)2.5 E(Ne)108 240 Q -.15(ve)-.25 G 3.03(rg).15 G -2.15 +-.25(iv e)-3.03 H .53(write permissions for non root users to the)3.28 F +F3(/de)3.03 E(v/scg?)-.15 E F0(de)5.53 E .53(vices unless you w)-.25 F +.53(ould allo)-.1 F 3.03(wa)-.25 G -.15(ny)-3.03 G(body).15 E +(to read/write/format all your disks.)108 252 Q -1.1(Yo)108 268.8 S +3.356(us)1.1 G .856(hould not connect old dri)-3.356 F -.15(ve)-.25 G +3.356(st).15 G .857 +(hat do not support disconnect/reconnect to either the SCSI b)-3.356 F +.857(us that is)-.2 F(connected to the CD-Recorder or the source disk.) +108 280.8 Q .021(When using)108 297.6 R F2 -.18(re)2.521 G(adcd).18 E F0 +.021(with the brok)2.521 F(en)-.1 E F2 .021(Linux SCSI generic dri)2.521 +F -.1(ve)-.1 G -1(r.).1 G F0 -1.1(Yo)6.021 G 2.52(us)1.1 G .02 +(hould note that)-2.52 F F2 -.18(re)2.52 G(adcd).18 E F0 .02 +(uses a hack,)2.52 F .784 +(that tries to emulate the functionality of the scg dri)108 309.6 R -.15 +(ve)-.25 G 4.385 -.55(r. U).15 H(nfortunately).55 E 3.285(,t)-.65 G .785 +(he sg dri)-3.285 F -.15(ve)-.25 G 3.285(ro).15 G(n)-3.285 E F2(Linux) +3.285 E F0 .785(has se)3.285 F -.15(ve)-.25 G(ral).15 E(se)108 321.6 Q +-.15(ve)-.25 G(re b).15 E(ugs:)-.2 E 32.5<8349>108 338.4 S 2.5(tc)-32.5 +G(annot see if a SCSI command could not be sent at all.)-2.5 E 32.5 +<8349>108 355.2 S 3.113(tc)-32.5 G .613(annot get the SCSI status byte.) +-3.113 F F2(Readcd)5.613 E F0 .612(for that reason cannot report f)3.113 +F .612(ailing SCSI commands)-.1 F(in some situations.)144 367.2 Q 32.5 +<8349>108 384 S 3.722(tc)-32.5 G 1.223 +(annot get real DMA count of transfer)-3.722 F(.)-.55 E F2(Readcd)6.223 +E F0 1.223(cannot tell you if there is an DMA residual)3.723 F(count.) +144 396 Q 32.5<8349>108 412.8 S 2.936(tc)-32.5 G .436 +(annot get number of bytes v)-2.936 F .435(alid in auto sense data.)-.25 +F F2(Readcd)5.435 E F0 .435(cannot tell you if de)2.935 F .435 +(vice transfers)-.25 F(no sense data at all.)144 424.8 Q 32.5<8349>108 +441.6 S 2.5(tf)-32.5 G(etches to fe)-2.5 E 2.5(wd)-.25 G +(ata in auto request sense \(CCS/SCSI-2/SCSI-3 needs >= 18\).)-2.5 E F1 +(DIA)72 470.4 Q(GNOSTICS)-.602 E F0 2.5(At)108 482.4 S +(ypical error message for a SCSI command looks lik)-2.5 E(e:)-.1 E +(readcd: I/O error)144 506.4 Q 2.5(.t)-.55 G +(est unit ready: scsi sendcmd: no error)-2.5 E 2.5(CDB: 00)144 518.4 R +(20 00 00 00 00)2.5 E(status: 0x2 \(CHECK CONDITION\))144 530.4 Q +(Sense Bytes: 70 00 05 00 00 00 00 0A 00 00 00 00 25 00 00 00 00 00)144 +542.4 Q(Sense K)144 554.4 Q -.15(ey)-.25 G 2.5(:0).15 G(x5 Ille)-2.5 E +-.05(ga)-.15 G 2.5(lR).05 G(equest, Se)-2.5 E(gment 0)-.15 E +(Sense Code: 0x25 Qual 0x00 \(logical unit not supported\) Fru 0x0)144 +566.4 Q(Sense \215ags: Blk 0 \(not v)144 578.4 Q(alid\))-.25 E +(cmd \214nished after 0.002s timeout 40s)144 590.4 Q .351 +(The \214rst line gi)108 614.4 R -.15(ve)-.25 G 2.851(si).15 G .352 +(nformation about the transport of the command.)-2.851 F .352(The te) +5.352 F .352(xt after the \214rst colon gi)-.15 F -.15(ve)-.25 G 2.852 +(st).15 G(he)-2.852 E .041(error te)108 626.4 R .041 +(xt for the system call from the vie)-.15 F 2.541(wo)-.25 G 2.541(ft) +-2.541 G .04(he k)-2.541 F .04(ernel. It usually is:)-.1 F F2 .04 +(I/O err)2.54 F(or)-.18 E F0 .04(unless other problems hap-)2.54 F .579 +(pen. The ne)108 638.4 R .579(xt w)-.15 F .579 +(ords contain a short description for the SCSI command that f)-.1 F .58 +(ails. The rest of the line tells)-.1 F .051(you if there were an)108 +650.4 R 2.551(yp)-.15 G .051(roblems for the transport of the command o) +-2.551 F -.15(ve)-.15 G 2.551(rt).15 G .051(he SCSI b)-2.551 F(us.)-.2 E +F2 .051(fatal err)5.051 F(or)-.18 E F0 .051(means that)2.551 F(it w)108 +662.4 Q(as not possible to transport the command \(i.e. no de)-.1 E +(vice present at the requested SCSI address\).)-.25 E +(The second line prints the SCSI command descriptor block for the f)108 +679.2 Q(ailed command.)-.1 E .706(The third line gi)108 696 R -.15(ve) +-.25 G 3.206(si).15 G .707(nformation on the SCSI status code returned \ +by the command, if the transport of the)-3.206 F(command succeeds.)108 +708 Q(This is error information from the SCSI de)5 E(vice.)-.25 E +(The fourth line is a he)108 724.8 Q 2.5(xd)-.15 G +(ump of the auto request sense information for the command.)-2.5 E(J)72 +768 Q -.25(..)-5.5 K(or)-4.5 5.5 M 2.5(gS)-.18 G 153.065(chilling V)-2.5 +F(ersion 2.0)-1.11 E(4)206.225 E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 117.615(READCD\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(READCD\(1\))120.115 E .846 +(The \214fth line is the error te)108 84 R .846(xt for the sense k)-.15 +F 1.146 -.15(ey i)-.1 H 3.346(fa).15 G -.25(va)-3.546 G .846 +(ilable, follo).25 F .846(wed by the se)-.25 F .846 +(gment number that is only)-.15 F -.25(va)108 96 S .421 +(lid if the command w).25 F .421(as a)-.1 F/F1 10/Times-Italic@0 SF +(copy)2.921 E F0 .421(command. If the error message is not directly rel\ +ated to the current com-)2.921 F(mand, the te)108 108 Q(xt)-.15 E F1 +(deferr)2.5 E(ed err)-.37 E(or)-.45 E F0(is appended.)2.5 E 1.279 +(The sixth line is the error te)108 124.8 R 1.279 +(xt for the sense code and the sense quali\214er if a)-.15 F -.25(va)-.2 +G 3.778(ilable. If).25 F 1.278(the type of the)3.778 F(de)108 136.8 Q +.012(vice is kno)-.25 F .012 +(wn, the sense data is decoded from tables in)-.25 F F1(scsierr)2.512 E +(s.c)-.1 E F0 5.012(.T)2.822 G .012(he te)-5.012 F .012(xt is follo)-.15 +F .012(wed by the error v)-.25 F(alue)-.25 E +(for a \214eld replaceable unit.)108 148.8 Q 1.069(The se)108 165.6 R +-.15(ve)-.25 G 1.069 +(nth line prints the block number that is related to the f).15 F 1.069 +(ailed command and te)-.1 F 1.069(xt for se)-.15 F -.15(ve)-.25 G 1.068 +(ral error).15 F(\215ags. The block number may not be v)108 177.6 Q +(alid.)-.25 E .356(The eight line reports the timeout set up for this c\ +ommand and the time that the command really needed to)108 194.4 R +(complete.)108 206.4 Q/F2 10.95/Times-Bold@0 SF -.11(BU)72 235.2 S(GS) +.11 E(CREDITS)72 247.2 Q(MAILING LISTS)72 259.2 Q F0 .103(If you w)108 +271.2 R .102(ant to acti)-.1 F -.15(ve)-.25 G .102(ly tak).15 F 2.602 +(ep)-.1 G .102(art on the de)-2.602 F -.15(ve)-.25 G .102 +(lopment of cdrecord, you may join the cdwriting mailing list by).15 F +(sending mail to:)108 283.2 Q(other)144 307.2 Q +(-cdwrite-request@lists.debian.or)-.2 E(g)-.18 E(and include the w)108 +331.2 Q(ord)-.1 E F1(subscribe)2.5 E F0(in the body)2.5 E 5(.T)-.65 G +(he mail address of the list is:)-5 E(cdwrite@lists.debian.or)144 355.2 +Q(g)-.18 E F2 -.548(AU)72 384 S(THOR).548 E F0(J)108 396 Q -.25(..)-5.5 +K(or)-4.5 5.5 M 2.5(gS)-.18 G(chilling)-2.5 E(Seestr)108 408 Q 2.5(.1) +-.55 G(10)-2.5 E(D-13353 Berlin)108 420 Q(German)108 432 Q(y)-.15 E +(Additional information can be found on:)108 448.8 Q(http://www)108 +460.8 Q(.fokus.fhg.de/usr/schilling/cdrecord.html)-.65 E(If you ha)108 +477.6 Q .3 -.15(ve s)-.2 H(upport questions, send them to:).15 E/F3 10 +/Times-Bold@0 SF(cdr)108 494.4 Q(ecord-support@berlios.de)-.18 E F0(or) +108 506.4 Q F3(other)2.5 E(-cd)-.37 E(write@lists.debian.or)-.15 E(g)-.1 +E F0(Of you ha)108 523.2 Q .3 -.15(ve d)-.2 H(e\214nitely found a b).15 +E(ug, send a mail to:)-.2 E F3(cdr)108 540 Q(ecord-de)-.18 E -.1(ve)-.15 +G(lopers@berlios.de).1 E F0(or)108 552 Q F3(schilling@f)2.5 E(okus.fhg) +-.25 E(.de)-.15 E F0 1.6 -.8(To s)108 568.8 T(ubscribe, use:).8 E F3 +(http://lists.berlios.de/mailman/listinf)108 585.6 Q(o/cdr)-.25 E +(ecord-de)-.18 E -.1(ve)-.15 G(lopers).1 E F0(or)108 597.6 Q F3 +(http://lists.berlios.de/mailman/listinf)2.5 E(o/cdr)-.25 E +(ecord-support)-.18 E F0(J)72 768 Q -.25(..)-5.5 K(or)-4.5 5.5 M 2.5(gS) +-.18 G 153.065(chilling V)-2.5 F(ersion 2.0)-1.11 E(5)206.225 E EP +%%Trailer +end +%%EOF diff --git a/scsilib/doc/scgcheck.man b/scsilib/doc/scgcheck.man new file mode 100644 index 0000000..a192acf --- /dev/null +++ b/scsilib/doc/scgcheck.man @@ -0,0 +1,257 @@ +SCGCHECK(1) Schily's USER COMMANDS SCGCHECK(1) + + + +NNAAMMEE + scgcheck - check and validate the ABI of libscg + +SSYYNNOOPPSSIISS + ssccggcchheecckk [ _o_p_t_i_o_n_s ] + + +DDEESSCCRRIIPPTTIIOONN + SSccggcchheecckk is used to check and verify the Application + Binary Interface of libscg. + + + The _d_e_v_i_c_e refers to _s_c_s_i_b_u_s/_t_a_r_g_e_t/_l_u_n of the drive. Com- + munication on _S_u_n_O_S is done with the SCSI general driver + ssccgg.. Other operating systems are using a library simula- + tion of this driver. Possible syntax is: ddeevv== _s_c_s_i_- + _b_u_s,_t_a_r_g_e_t,_l_u_n or ddeevv== _t_a_r_g_e_t,_l_u_n. In the latter case, + the drive has to be connected to the default SCSI bus of + the machine. _S_c_s_i_b_u_s, _t_a_r_g_e_t and _l_u_n are integer numbers. + Some operating systems or SCSI transport implementations + may require to specify a filename in addition. In this + case the correct syntax for the device is: ddeevv== _d_e_v_i_c_e_- + _n_a_m_e:_s_c_s_i_b_u_s,_t_a_r_g_e_t,_l_u_n or ddeevv== _d_e_v_i_c_e_n_a_m_e:_t_a_r_g_e_t,_l_u_n. If + the name of the device node that has been specified on + such a system refers to exactly one SCSI device, a short- + hand in the form ddeevv== _d_e_v_i_c_e_n_a_m_e:_@ or ddeevv== _d_e_v_i_c_e_- + _n_a_m_e:_@,_l_u_n may be used instead of ddeevv== _d_e_v_i_c_e_n_a_m_e:_s_c_s_i_- + _b_u_s,_t_a_r_g_e_t,_l_u_n. + + + To access remote SCSI devices, you need to prepend the + SCSI device name by a remote device indicator. The remote + device indicator is either RREEMMOOTTEE::_u_s_e_r_@_h_o_s_t_: or + RREEMMOOTTEE::_h_o_s_t_: + A valid remote SCSI device name may be: RREEMMOOTTEE::_u_s_e_r_@_h_o_s_t_: + to allow remote SCSI bus scanning or + RREEMMOOTTEE::_u_s_e_r_@_h_o_s_t_:_1_,_0_,_0 to access the SCSI device at _h_o_s_t + connected to SCSI bus # 1,target 0 lun 0. + + + To make rreeaaddccdd portable to all UNIX platforms, the syntax + ddeevv== _d_e_v_i_c_e_n_a_m_e:_s_c_s_i_b_u_s,_t_a_r_g_e_t,_l_u_n is preferred as is + hides OS specific knowledge about device names from the + user. A specific OS must not necessarily support a way to + specify a real device file name nor a way to specify _s_c_s_i_- + _b_u_s,_t_a_r_g_e_t,_l_u_n. + + + _S_c_s_i_b_u_s 0 is the default SCSI bus on the machine. Watch + the boot messages for more information or look into + //vvaarr//aaddmm//mmeessssaaggeess for more information about the SCSI con- + figuration of your machine. If you have problems to fig- + ure out what values for _s_c_s_i_b_u_s,_t_a_r_g_e_t,_l_u_n should be used, + try the --ssccaannbbuuss option of ccddrreeccoorrdd. + + +OOPPTTIIOONNSS + --vveerrssiioonn + Print version information and exit. + + ddeevv==_t_a_r_g_e_t + Sets the SCSI target default for SCSI Bus scanning + test, see notes above. This allows e.g. to specify + to use Solaris USCSI or remote SCSI for the bus + scanning case. + + For the non bus scanning case, a typical device + specification is ddeevv==_6_,_0 . If a filename must be + provided together with the numerical target speci- + fication, the filename is implementation specific. + The correct filename in this case can be found in + the system specific manuals of the target operating + system. On a _F_r_e_e_B_S_D system without _C_A_M support, + you need to use the control device (e.g. + _/_d_e_v_/_r_c_d_0_._c_t_l). A correct device specification in + this case may be ddeevv==_/_d_e_v_/_r_c_d_0_._c_t_l_:_@ . + + On Linux, drives connected to a parallel port + adapter are mapped to a virtual SCSI bus. Different + adapters are mapped to different targets on this + virtual SCSI bus. + + If no _d_e_v option is present, ccddrreeccoorrdd will try to + get the device from the CCDDRR__DDEEVVIICCEE environment. + + If the argument to the ddeevv== option does not contain + the characters ',', '/', '@' or ':', it is inter- + preted as an label name that may be found in the + file /etc/default/cdrecord (see FILES section). + + ttiimmeeoouutt==_# + Set the default SCSI command timeout value to _# + seconds. The default SCSI command timeout is the + minimum timeout used for sending SCSI commands. If + a SCSI command fails due to a timeout, you may try + to raise the default SCSI command timeout above the + timeout value of the failed command. If the com- + mand runs correctly with a raised command timeout, + please report the better timeout value and the cor- + responding command to the author of the program. + If no _t_i_m_e_o_u_t option is present, a default timeout + of 40 seconds is used. + + ddeebbuugg==_#_, --dd + Set the misc debug value to # (with debug=#) or + increment the misc debug level by one (with -d). If + you specify _-_d_d_, this equals to ddeebbuugg==_2_. This may + help to find problems while opening a driver for + libscg. as well as with sector sizes and sector + types. Using --ddeebbuugg slows down the process and may + be the reason for a buffer underrun. + + kkddeebbuugg==#, kkdd==# + Tell the ssccgg-driver to modify the kernel debug + value while SCSI commands are running. + + --ssiilleenntt, --ss + Do not print out a status report for failed SCSI + commands. + + --vv Increment the level of general verbosity by one. + This is used e.g. to display the progress of the + process. + + --VV Increment the verbose level with respect of SCSI + command transport by one. This helps to debug + problems during the process, that occur in the CD- + Recorder. If you get incomprehensible error + messages you should use this flag to get more + detailed output. --VVVV will show data buffer content + in addition. Using --VV or --VVVV slows down the pro- + cess. + + ff==_f_i_l_e Specify the log file to be used instead of + _c_h_e_c_k_._l_o_g. + + +EEXXAAMMPPLLEESS +FFIILLEESS +SSEEEE AALLSSOO + ccddrreeccoorrdd(1), rreeaaddccdd(1), mmkkiissooffss(1), ssccgg(7). + + +NNOOTTEESS + When using ssccggcckkeecckk with the broken LLiinnuuxx SSCCSSII ggeenneerriicc + ddrriivveerr.. You should note that ssccggcchheecckk uses a hack, that + tries to emulate the functionality of the scg driver. + Unfortunately, the sg driver on LLiinnuuxx has several severe + bugs: + + +o It cannot see if a SCSI command could not be sent + at all. + + +o It cannot get the SCSI status byte. SSccggcchheecckk for + that reason cannot report failing SCSI commands in + some situations. + + +o It cannot get real DMA count of transfer. SSccggcchheecckk + cannot tell you if there is an DMA residual count. + + +o It cannot get number of bytes valid in auto sense + data. SSccggcchheecckk cannot tell you if device transfers + no sense data at all. + + +o It fetches to few data in auto request sense + (CCS/SCSI-2/SCSI-3 needs >= 18). + + +DDIIAAGGNNOOSSTTIICCSS + A typical error message for a SCSI command looks like: + + readcd: I/O error. test unit ready: scsi sendcmd: no error + CDB: 00 20 00 00 00 00 + status: 0x2 (CHECK CONDITION) + Sense Bytes: 70 00 05 00 00 00 00 0A 00 00 00 00 25 00 00 00 00 00 + Sense Key: 0x5 Illegal Request, Segment 0 + Sense Code: 0x25 Qual 0x00 (logical unit not supported) Fru 0x0 + Sense flags: Blk 0 (not valid) + cmd finished after 0.002s timeout 40s + + The first line gives information about the transport of + the command. The text after the first colon gives the + error text for the system call from the view of the ker- + nel. It usually is: II//OO eerrrroorr unless other problems hap- + pen. The next words contain a short description for the + SCSI command that fails. The rest of the line tells you if + there were any problems for the transport of the command + over the SCSI bus. ffaattaall eerrrroorr means that it was not pos- + sible to transport the command (i.e. no device present at + the requested SCSI address). + + The second line prints the SCSI command descriptor block + for the failed command. + + The third line gives information on the SCSI status code + returned by the command, if the transport of the command + succeeds. This is error information from the SCSI device. + + The fourth line is a hex dump of the auto request sense + information for the command. + + The fifth line is the error text for the sense key if + available, followed by the segment number that is only + valid if the command was a _c_o_p_y command. If the error mes- + sage is not directly related to the current command, the + text _d_e_f_e_r_r_e_d _e_r_r_o_r is appended. + + The sixth line is the error text for the sense code and + the sense qualifier if available. If the type of the + device is known, the sense data is decoded from tables in + _s_c_s_i_e_r_r_s_._c . The text is followed by the error value for + a field replaceable unit. + + The seventh line prints the block number that is related + to the failed command and text for several error flags. + The block number may not be valid. + + The eight line reports the timeout set up for this command + and the time that the command realy needed to complete. + + +BBUUGGSS +CCRREEDDIITTSS +MMAAIILLIINNGG LLIISSTTSS +AAUUTTHHOORR + Joerg Schilling + Seestr. 110 + D-13353 Berlin + Germany + + Additional information can be found on: + http://www.fokus.fhg.de/usr/schilling/cdrecord.html + + If you have support questions, send them to: + + ccddrreeccoorrdd--ssuuppppoorrtt@@bbeerrlliiooss..ddee + or ootthheerr--ccddwwrriittee@@lliissttss..ddeebbiiaann..oorrgg + + Of you have definitely found a bug, send a mail to: + + ccddrreeccoorrdd--ddeevveellooppeerrss@@bbeerrlliiooss..ddee + or sscchhiilllliinngg@@ffookkuuss..ffhhgg..ddee + + To subscribe, use: + + hhttttpp::////lliissttss..bbeerrlliiooss..ddee//mmaaiillmmaann//lliissttiinnffoo//ccddrreeccoorrdd--ddeevveelloopp-- + eerrss + or hhttttpp::////lliissttss..bbeerrlliiooss..ddee//mmaaiillmmaann//lliissttiinnffoo//ccddrreeccoorrdd--ssuupp-- + ppoorrtt + + + +Joerg Schilling Version 2.0 SCGCHECK(1) diff --git a/scsilib/doc/scgcheck.ps b/scsilib/doc/scgcheck.ps new file mode 100644 index 0000000..3d3bd2d --- /dev/null +++ b/scsilib/doc/scgcheck.ps @@ -0,0 +1,479 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.17.2 +%%CreationDate: Tue Dec 24 17:03:44 2002 +%%DocumentNeededResources: font Times-Roman +%%+ font Times-Bold +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.17 2 +%%Pages: 3 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.17 2 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 841.89 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron +/Zcaron/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE +/Times-Roman@0 ENC0/Times-Roman RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 105.385(SCGCHECK\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(SCGCHECK\(1\))107.885 E/F1 10.95/Times-Bold@0 SF +-.219(NA)72 84 S(ME).219 E F0(scgcheck \255 check and v)108 96 Q +(alidate the ABI of libscg)-.25 E F1(SYNOPSIS)72 112.8 Q/F2 10 +/Times-Bold@0 SF(scgcheck)108 124.8 Q F0([)2.5 E/F3 10/Times-Italic@0 SF +(options)2.5 E F0(])2.5 E F1(DESCRIPTION)72 153.6 Q F2(Scgcheck)108 +165.6 Q F0(is used to check and v)2.5 E +(erify the Application Binary Interf)-.15 E(ace of libscg.)-.1 E(The)108 +194.4 Q F3(de)3.065 E(vice)-.15 E F0 .565(refers to)3.065 F F3(scsib) +3.065 E(us)-.2 E F0(/).27 E F3(tar).13 E -.1(ge)-.37 G(t).1 E F0(/).68 E +F3(lun).09 E F0 .565(of the dri)3.065 F -.15(ve)-.25 G 3.064(.C).15 G +.564(ommunication on)-3.064 F F3(SunOS)3.064 E F0 .564 +(is done with the SCSI gen-)3.064 F 1.02(eral dri)108 206.4 R -.15(ve) +-.25 G(r).15 E F2(scg)3.52 E(.)-.15 E F0 1.02 +(Other operating systems are using a library simulation of this dri)6.02 +F -.15(ve)-.25 G 4.62 -.55(r. P).15 H 1.02(ossible syntax is:).55 F F2 +(de)108 218.4 Q(v=)-.15 E F3(scsib)3.228 E(us)-.2 E F0(,).27 E F3(tar) +.13 E -.1(ge)-.37 G(t).1 E F0(,).68 E F3(lun).09 E F0(or)3.227 E F2(de) +3.227 E(v=)-.15 E F3(tar)3.227 E -.1(ge)-.37 G(t).1 E F0(,).68 E F3(lun) +.09 E F0 5.727(.I).24 G 3.227(nt)-5.727 G .727(he latter case, the dri) +-3.227 F 1.027 -.15(ve h)-.25 H .727(as to be connected to the def).15 F +(ault)-.1 E .85(SCSI b)108 230.4 R .85(us of the machine.)-.2 F F3 +(Scsib)5.85 E(us)-.2 E F0(,).27 E F3(tar)3.35 E -.1(ge)-.37 G(t).1 E F0 +(and)3.351 E F3(lun)3.351 E F0 .851(are inte)3.351 F .851(ger numbers.) +-.15 F .851(Some operating systems or SCSI)5.851 F .338(transport imple\ +mentations may require to specify a \214lename in addition.)108 242.4 R +.337(In this case the correct syntax for)5.337 F 2.308(the de)108 254.4 +R 2.308(vice is:)-.25 F F2(de)4.808 E(v=)-.15 E F3(de)4.808 E(vicename) +-.15 E F0(:).18 E F3(scsib).34 E(us)-.2 E F0(,).27 E F3(tar).13 E -.1 +(ge)-.37 G(t).1 E F0(,).68 E F3(lun).09 E F0(or)4.808 E F2(de)4.808 E +(v=)-.15 E F3(de)4.808 E(vicename)-.15 E F0(:).18 E F3(tar).13 E -.1(ge) +-.37 G(t).1 E F0(,).68 E F3(lun).09 E F0 7.308(.I).24 G 4.809(ft)-7.308 +G 2.309(he name of the)-4.809 F(de)108 266.4 Q .465 +(vice node that has been speci\214ed on such a system refers to e)-.25 F +.465(xactly one SCSI de)-.15 F .465(vice, a shorthand in the)-.25 F +(form)108 278.4 Q F2(de)2.646 E(v=)-.15 E F3(de)2.646 E(vicename)-.15 E +F0(:).18 E F3(@)-.68 E F0(or)2.646 E F2(de)2.646 E(v=)-.15 E F3(de)2.647 +E(vicename)-.15 E F0(:).18 E F3(@)-.68 E F0(,)A F3(lun).09 E F0 .147 +(may be used instead of)2.647 F F2(de)2.647 E(v=)-.15 E F3(de)2.647 E +(vicename)-.15 E F0(:).18 E F3(scsib).34 E(us)-.2 E F0(,).27 E F3(tar) +.13 E(-)-.2 E -.1(ge)108 290.4 S(t).1 E F0(,).68 E F3(lun)A F0(.).24 E +2.32 -.8(To a)108 319.2 T .72(ccess remote SCSI de).8 F .72 +(vices, you need to prepend the SCSI de)-.25 F .72 +(vice name by a remote de)-.25 F .72(vice indicator)-.25 F(.)-.55 E +(The remote de)108 331.2 Q(vice indicator is either)-.25 E F2(REMO)2.5 E +(TE:)-.4 E F3(user@host:).08 E F0(or)2.5 E F2(REMO)5 E(TE:)-.4 E F3 +(host:).31 E F0 3.273(Av)108 343.2 S .773(alid remote SCSI de)-3.523 F +.773(vice name may be:)-.25 F F2(REMO)3.273 E(TE:)-.4 E F3(user@host:) +.08 E F0 .773(to allo)3.273 F 3.274(wr)-.25 G .774(emote SCSI b)-3.274 F +.774(us scanning or)-.2 F F2(REMO)108 355.2 Q(TE:)-.4 E F3 +(user@host:1,0,0)A F0(to access the SCSI de)2.5 E(vice at)-.25 E F3 +(host)2.5 E F0(connected to SCSI b)2.5 E(us # 1,tar)-.2 E(get 0 lun 0.) +-.18 E 1.862 -.8(To m)108 384 T(ak).8 E(e)-.1 E F2 -.18(re)2.762 G(adcd) +.18 E F0 .262(portable to all)2.762 F/F4 8/Times-Roman@0 SF(UNIX)2.761 E +F0 .261(platforms, the syntax)2.761 F F2(de)2.761 E(v=)-.15 E F3(de) +2.761 E(vicename)-.15 E F0(:).18 E F3(scsib).34 E(us)-.2 E F0(,).27 E F3 +(tar).13 E -.1(ge)-.37 G(t).1 E F0(,).68 E F3(lun).09 E F0 .261 +(is preferred)2.761 F .754(as is hides OS speci\214c kno)108 396 R .755 +(wledge about de)-.25 F .755(vice names from the user)-.25 F 5.755(.A) +-.55 G .755(speci\214c OS must not necessarily)-2.5 F(support a w)108 +408 Q(ay to specify a real de)-.1 E(vice \214le name nor a w)-.25 E +(ay to specify)-.1 E F3(scsib)2.5 E(us)-.2 E F0(,).27 E F3(tar).13 E -.1 +(ge)-.37 G(t).1 E F0(,).68 E F3(lun).09 E F0(.).24 E F3(Scsib)108 436.8 +Q(us)-.2 E F0 3.257(0i)3.257 G 3.257(st)-3.257 G .757(he def)-3.257 F +.757(ault SCSI b)-.1 F .757(us on the machine. W)-.2 F .756 +(atch the boot messages for more information or look)-.8 F(into)108 +448.8 Q F2(/v)2.995 E(ar/adm/messages)-.1 E F0 .496 +(for more information about the SCSI con\214guration of your machine.) +2.995 F .496(If you ha)5.496 F -.15(ve)-.2 G 2.158 +(problems to \214gure out what v)108 460.8 R 2.158(alues for)-.25 F F3 +(scsib)4.658 E(us)-.2 E F0(,).27 E F3(tar).13 E -.1(ge)-.37 G(t).1 E F0 +(,).68 E F3(lun).09 E F0 2.158(should be used, try the)4.658 F F2 +(\255scanb)4.658 E(us)-.2 E F0 2.158(option of)4.658 F F2(cdr)108 472.8 +Q(ecord)-.18 E F0(.)A F1(OPTIONS)72 501.6 Q F2<ad76>108 513.6 Q(ersion) +-.1 E F0(Print v)144 525.6 Q(ersion information and e)-.15 E(xit.)-.15 E +F2(de)108 542.4 Q(v=)-.15 E F3(tar).13 E -.1(ge)-.37 G(t).1 E F0 .207 +(Sets the SCSI tar)144 554.4 R .207(get def)-.18 F .208 +(ault for SCSI Bus scanning test, see notes abo)-.1 F -.15(ve)-.15 G +5.208(.T).15 G .208(his allo)-5.208 F .208(ws e.g. to spec-)-.25 F +(ify to use Solaris USCSI or remote SCSI for the b)144 566.4 Q +(us scanning case.)-.2 E -.15(Fo)144 590.4 S 3.452(rt).15 G .952 +(he non b)-3.452 F .952(us scanning case, a typical de)-.2 F .952 +(vice speci\214cation is)-.25 F F2(de)3.452 E(v=)-.15 E F3(6,0).2 E F0 +5.952(.I)3.452 G 3.451(fa\214)-5.952 G .951(lename must be)-3.451 F(pro) +144 602.4 Q .503(vided together with the numerical tar)-.15 F .504 +(get speci\214cation, the \214lename is implementation speci\214c.)-.18 +F .385(The correct \214lename in this case can be found in the system s\ +peci\214c manuals of the tar)144 614.4 R .384(get operat-)-.18 F .398 +(ing system.)144 626.4 R .398(On a)5.398 F F3 -1.77 -.55(Fr e)2.898 H +(eBSD).55 E F0 .399(system without)2.899 F F3(CAM)2.899 E F0 .399 +(support, you need to use the control de)2.899 F .399(vice \(e.g.)-.25 F +F3(/de)144 638.4 Q(v/r)-.15 E(cd0.ctl)-.37 E F0 2.5(\). A).51 F +(correct de)2.5 E(vice speci\214cation in this case may be)-.25 E F2(de) +2.5 E(v=)-.15 E F3(/de)1.15 E(v/r)-.15 E(cd0.ctl:@)-.37 E F0(.)2.5 E +.572(On Linux, dri)144 662.4 R -.15(ve)-.25 G 3.072(sc).15 G .572 +(onnected to a parallel port adapter are mapped to a virtual SCSI b) +-3.072 F .571(us. Dif)-.2 F(ferent)-.25 E(adapters are mapped to dif)144 +674.4 Q(ferent tar)-.25 E(gets on this virtual SCSI b)-.18 E(us.)-.2 E +.526(If no)144 698.4 R F3(de)3.026 E(v)-.15 E F0 .527 +(option is present,)3.027 F F2(cdr)3.027 E(ecord)-.18 E F0 .527 +(will try to get the de)3.027 F .527(vice from the)-.25 F F2(CDR_DEVICE) +3.027 E F0(en)3.027 E(viron-)-.4 E(ment.)144 710.4 Q(J)72 768 Q -.25(..) +-5.5 K(or)-4.5 5.5 M 2.5(gS)-.18 G 153.065(chilling V)-2.5 F(ersion 2.0) +-1.11 E(1)206.225 E EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 105.385(SCGCHECK\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(SCGCHECK\(1\))107.885 E 1.047(If the ar)144 84 R +1.047(gument to the)-.18 F/F1 10/Times-Bold@0 SF(de)3.547 E(v=)-.15 E F0 +1.047(option does not contain the characters ',)3.547 F 1.047 +(', '/', '@' or ':', it is inter)-.7 F(-)-.2 E +(preted as an label name that may be found in the \214le /etc/def)144 96 +Q(ault/cdrecord \(see FILES section\).)-.1 E F1(timeout=)108 112.8 Q/F2 +10/Times-Italic@0 SF(#).48 E F0 .13(Set the def)144 124.8 R .13 +(ault SCSI command timeout v)-.1 F .13(alue to)-.25 F F2(#)2.63 E F0 +2.63(seconds. The)3.53 F(def)2.63 E .13(ault SCSI command timeout is)-.1 +F .452(the minimum timeout used for sending SCSI commands.)144 136.8 R +.451(If a SCSI command f)5.451 F .451(ails due to a time-)-.1 F .366 +(out, you may try to raise the def)144 148.8 R .366 +(ault SCSI command timeout abo)-.1 F .667 -.15(ve t)-.15 H .367 +(he timeout v).15 F .367(alue of the f)-.25 F(ailed)-.1 E 2.716 +(command. If)144 160.8 R .216(the command runs correctly with a raised \ +command timeout, please report the better)2.716 F .401(timeout v)144 +172.8 R .401 +(alue and the corresponding command to the author of the program.)-.25 F +.402(If no)5.402 F F2(timeout)2.902 E F0(option)2.902 E +(is present, a def)144 184.8 Q(ault timeout of 40 seconds is used.)-.1 E +F1(deb)108 201.6 Q(ug=)-.2 E F2(#,).48 E F1(-d)2.5 E F0 .386 +(Set the misc deb)144 213.6 R .386(ug v)-.2 F .386(alue to # \(with deb) +-.25 F .385(ug=#\) or increment the misc deb)-.2 F .385(ug le)-.2 F -.15 +(ve)-.25 G 2.885(lb).15 G 2.885(yo)-2.885 G .385(ne \(with -d\).)-2.885 +F .13(If you specify)144 225.6 R F2(-dd,)2.63 E F0 .13(this equals to) +2.63 F F1(deb)2.63 E(ug=)-.2 E F2(2.).38 E F0 .13 +(This may help to \214nd problems while opening a dri)5.13 F -.15(ve) +-.25 G(r).15 E .864(for libscg.)144 237.6 R .864 +(as well as with sector sizes and sector types.)5.864 F(Using)5.864 E F1 +(\255deb)3.364 E(ug)-.2 E F0(slo)3.363 E .863(ws do)-.25 F .863 +(wn the process)-.25 F(and may be the reason for a b)144 249.6 Q(uf)-.2 +E(fer underrun.)-.25 E F1(kdeb)108 266.4 Q(ug=)-.2 E F0(#,)A F1(kd=)2.5 +E F0(#)A -.7(Te)144 278.4 S(ll the).7 E F1(scg)2.5 E F0(-dri)A -.15(ve) +-.25 G 2.5(rt).15 G 2.5(om)-2.5 G(odify the k)-2.5 E(ernel deb)-.1 E +(ug v)-.2 E(alue while SCSI commands are running.)-.25 E F1(\255silent) +108 295.2 Q F0(,)A F1<ad73>2.5 E F0 +(Do not print out a status report for f)144 307.2 Q +(ailed SCSI commands.)-.1 E F1<ad76>108 324 Q F0 .993(Increment the le) +25.3 F -.15(ve)-.25 G 3.493(lo).15 G 3.493(fg)-3.493 G .993(eneral v) +-3.493 F .993(erbosity by one.)-.15 F .994 +(This is used e.g. to display the progress of the)5.993 F(process.)144 +336 Q F1<ad56>108 352.8 Q F0 .324(Increment the v)23.08 F .324 +(erbose le)-.15 F -.15(ve)-.25 G 2.824(lw).15 G .324 +(ith respect of SCSI command transport by one.)-2.824 F .324 +(This helps to deb)5.324 F(ug)-.2 E 1.194 +(problems during the process, that occur in the CD-Recorder)144 364.8 R +6.194(.I)-.55 G 3.694(fy)-6.194 G 1.194(ou get incomprehensible error) +-3.694 F .273 +(messages you should use this \215ag to get more detailed output.)144 +376.8 R F1(\255VV)5.273 E F0 .273(will sho)2.773 F 2.773(wd)-.25 G .273 +(ata b)-2.773 F(uf)-.2 E .273(fer content)-.25 F(in addition.)144 388.8 +Q(Using)5 E F1<ad56>2.5 E F0(or)2.5 E F1(\255VV)2.5 E F0(slo)2.5 E +(ws do)-.25 E(wn the process.)-.25 E F1(f=)108 405.6 Q F2(\214le)1.91 E +F0(Specify the log \214le to be used instead of)12.84 E F2 -.15(ch)2.5 G +(ec).15 E(k.lo)-.2 E(g)-.1 E F0(.).22 E/F3 10.95/Times-Bold@0 SF +(EXAMPLES)72 434.4 Q(FILES)72 446.4 Q(SEE ALSO)72 458.4 Q F1(cdr)108 +470.4 Q(ecord)-.18 E F0(\(1\),)A F1 -.18(re)2.5 G(adcd).18 E F0(\(1\),)A +F1(mkisofs)2.5 E F0(\(1\),)A F1(scg)2.5 E F0(\(7\).)A F3(NO)72 499.2 Q +(TES)-.438 E F0 .456(When using)108 511.2 R F1(scgck)2.956 E(eck)-.1 E +F0 .457(with the brok)2.957 F(en)-.1 E F1 .457(Linux SCSI generic dri) +2.957 F -.1(ve)-.1 G -1(r.).1 G F0 -1.1(Yo)6.457 G 2.957(us)1.1 G .457 +(hould note that)-2.957 F F1(scgcheck)2.957 E F0 .457(uses a)2.957 F +.054(hack, that tries to emulate the functionality of the scg dri)108 +523.2 R -.15(ve)-.25 G 3.654 -.55(r. U).15 H(nfortunately).55 E 2.554 +(,t)-.65 G .054(he sg dri)-2.554 F -.15(ve)-.25 G 2.554(ro).15 G(n) +-2.554 E F1(Linux)2.554 E F0 .053(has se)2.553 F(v-)-.25 E(eral se)108 +535.2 Q -.15(ve)-.25 G(re b).15 E(ugs:)-.2 E 32.5<8349>108 552 S 2.5(tc) +-32.5 G(annot see if a SCSI command could not be sent at all.)-2.5 E +32.5<8349>108 568.8 S 2.631(tc)-32.5 G .131 +(annot get the SCSI status byte.)-2.631 F F1(Scgcheck)5.131 E F0 .132 +(for that reason cannot report f)2.631 F .132(ailing SCSI commands)-.1 F +(in some situations.)144 580.8 Q 32.5<8349>108 597.6 S 3.299(tc)-32.5 G +.799(annot get real DMA count of transfer)-3.299 F(.)-.55 E F1(Scgcheck) +5.798 E F0 .798(cannot tell you if there is an DMA residual)3.298 F +(count.)144 609.6 Q 32.5<8349>108 626.4 S 2.51(tc)-32.5 G .01 +(annot get number of bytes v)-2.51 F .011(alid in auto sense data.)-.25 +F F1(Scgcheck)5.011 E F0 .011(cannot tell you if de)2.511 F .011 +(vice transfers)-.25 F(no sense data at all.)144 638.4 Q 32.5<8349>108 +655.2 S 2.5(tf)-32.5 G(etches to fe)-2.5 E 2.5(wd)-.25 G +(ata in auto request sense \(CCS/SCSI-2/SCSI-3 needs >= 18\).)-2.5 E F3 +(DIA)72 684 Q(GNOSTICS)-.602 E F0 2.5(At)108 696 S +(ypical error message for a SCSI command looks lik)-2.5 E(e:)-.1 E +(readcd: I/O error)144 720 Q 2.5(.t)-.55 G +(est unit ready: scsi sendcmd: no error)-2.5 E(J)72 768 Q -.25(..)-5.5 K +(or)-4.5 5.5 M 2.5(gS)-.18 G 153.065(chilling V)-2.5 F(ersion 2.0)-1.11 +E(2)206.225 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 105.385(SCGCHECK\(1\) Schily\264s)72 48 R +(USER COMMANDS)2.5 E(SCGCHECK\(1\))107.885 E 2.5(CDB: 00)144 84 R +(20 00 00 00 00)2.5 E(status: 0x2 \(CHECK CONDITION\))144 96 Q +(Sense Bytes: 70 00 05 00 00 00 00 0A 00 00 00 00 25 00 00 00 00 00)144 +108 Q(Sense K)144 120 Q -.15(ey)-.25 G 2.5(:0).15 G(x5 Ille)-2.5 E -.05 +(ga)-.15 G 2.5(lR).05 G(equest, Se)-2.5 E(gment 0)-.15 E +(Sense Code: 0x25 Qual 0x00 \(logical unit not supported\) Fru 0x0)144 +132 Q(Sense \215ags: Blk 0 \(not v)144 144 Q(alid\))-.25 E +(cmd \214nished after 0.002s timeout 40s)144 156 Q .352 +(The \214rst line gi)108 180 R -.15(ve)-.25 G 2.852(si).15 G .352 +(nformation about the transport of the command.)-2.852 F .352(The te) +5.352 F .351(xt after the \214rst colon gi)-.15 F -.15(ve)-.25 G 2.851 +(st).15 G(he)-2.851 E .04(error te)108 192 R .04 +(xt for the system call from the vie)-.15 F 2.54(wo)-.25 G 2.54(ft)-2.54 +G .041(he k)-2.54 F .041(ernel. It usually is:)-.1 F/F1 10/Times-Bold@0 +SF .041(I/O err)2.541 F(or)-.18 E F0 .041(unless other problems hap-) +2.541 F .58(pen. The ne)108 204 R .58(xt w)-.15 F .58 +(ords contain a short description for the SCSI command that f)-.1 F .579 +(ails. The rest of the line tells)-.1 F .051(you if there were an)108 +216 R 2.551(yp)-.15 G .051(roblems for the transport of the command o) +-2.551 F -.15(ve)-.15 G 2.551(rt).15 G .051(he SCSI b)-2.551 F(us.)-.2 E +F1 .051(fatal err)5.051 F(or)-.18 E F0 .052(means that)2.551 F(it w)108 +228 Q(as not possible to transport the command \(i.e. no de)-.1 E +(vice present at the requested SCSI address\).)-.25 E +(The second line prints the SCSI command descriptor block for the f)108 +244.8 Q(ailed command.)-.1 E .707(The third line gi)108 261.6 R -.15(ve) +-.25 G 3.207(si).15 G .707(nformation on the SCSI status code returned \ +by the command, if the transport of the)-3.207 F(command succeeds.)108 +273.6 Q(This is error information from the SCSI de)5 E(vice.)-.25 E +(The fourth line is a he)108 290.4 Q 2.5(xd)-.15 G +(ump of the auto request sense information for the command.)-2.5 E .846 +(The \214fth line is the error te)108 307.2 R .846(xt for the sense k) +-.15 F 1.146 -.15(ey i)-.1 H 3.346(fa).15 G -.25(va)-3.546 G .846 +(ilable, follo).25 F .846(wed by the se)-.25 F .846 +(gment number that is only)-.15 F -.25(va)108 319.2 S .421 +(lid if the command w).25 F .421(as a)-.1 F/F2 10/Times-Italic@0 SF +(copy)2.921 E F0 .421(command. If the error message is not directly rel\ +ated to the current com-)2.921 F(mand, the te)108 331.2 Q(xt)-.15 E F2 +(deferr)2.5 E(ed err)-.37 E(or)-.45 E F0(is appended.)2.5 E 1.278 +(The sixth line is the error te)108 348 R 1.279 +(xt for the sense code and the sense quali\214er if a)-.15 F -.25(va)-.2 +G 3.779(ilable. If).25 F 1.279(the type of the)3.779 F(de)108 360 Q .012 +(vice is kno)-.25 F .012(wn, the sense data is decoded from tables in) +-.25 F F2(scsierr)2.512 E(s.c)-.1 E F0 5.012(.T)2.822 G .012(he te) +-5.012 F .012(xt is follo)-.15 F .012(wed by the error v)-.25 F(alue) +-.25 E(for a \214eld replaceable unit.)108 372 Q 1.068(The se)108 388.8 +R -.15(ve)-.25 G 1.069 +(nth line prints the block number that is related to the f).15 F 1.069 +(ailed command and te)-.1 F 1.069(xt for se)-.15 F -.15(ve)-.25 G 1.069 +(ral error).15 F(\215ags. The block number may not be v)108 400.8 Q +(alid.)-.25 E .503(The eight line reports the timeout set up for this c\ +ommand and the time that the command realy needed to)108 417.6 R +(complete.)108 429.6 Q/F3 10.95/Times-Bold@0 SF -.11(BU)72 458.4 S(GS) +.11 E(CREDITS)72 470.4 Q(MAILING LISTS)72 482.4 Q -.548(AU)72 494.4 S +(THOR).548 E F0(J)108 506.4 Q -.25(..)-5.5 K(or)-4.5 5.5 M 2.5(gS)-.18 G +(chilling)-2.5 E(Seestr)108 518.4 Q 2.5(.1)-.55 G(10)-2.5 E +(D-13353 Berlin)108 530.4 Q(German)108 542.4 Q(y)-.15 E +(Additional information can be found on:)108 559.2 Q(http://www)108 +571.2 Q(.fokus.fhg.de/usr/schilling/cdrecord.html)-.65 E(If you ha)108 +588 Q .3 -.15(ve s)-.2 H(upport questions, send them to:).15 E F1(cdr) +108 604.8 Q(ecord-support@berlios.de)-.18 E F0(or)108 616.8 Q F1(other) +2.5 E(-cd)-.37 E(write@lists.debian.or)-.15 E(g)-.1 E F0(Of you ha)108 +633.6 Q .3 -.15(ve d)-.2 H(e\214nitely found a b).15 E +(ug, send a mail to:)-.2 E F1(cdr)108 650.4 Q(ecord-de)-.18 E -.1(ve) +-.15 G(lopers@berlios.de).1 E F0(or)108 662.4 Q F1(schilling@f)2.5 E +(okus.fhg)-.25 E(.de)-.15 E F0 1.6 -.8(To s)108 679.2 T(ubscribe, use:) +.8 E F1(http://lists.berlios.de/mailman/listinf)108 696 Q(o/cdr)-.25 E +(ecord-de)-.18 E -.1(ve)-.15 G(lopers).1 E F0(or)108 708 Q F1 +(http://lists.berlios.de/mailman/listinf)2.5 E(o/cdr)-.25 E +(ecord-support)-.18 E F0(J)72 768 Q -.25(..)-5.5 K(or)-4.5 5.5 M 2.5(gS) +-.18 G 153.065(chilling V)-2.5 F(ersion 2.0)-1.11 E(3)206.225 E EP +%%Trailer +end +%%EOF diff --git a/scsilib/export/Makefile b/scsilib/export/Makefile new file mode 100644 index 0000000..3b8ab36 --- /dev/null +++ b/scsilib/export/Makefile @@ -0,0 +1,46 @@ +#ident %W% %E% %Q% +########################################################################### +# Written 1999 by Andreas Mueller +########################################################################### +# Makefile for local dynamic configuration +########################################################################### +# This program 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, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING. If not, write to +# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. +########################################################################### +SRCROOT= .. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +all: clobber + $(LN) -s $(SRCROOT)/include libschily + $(LN) -s $(SRCROOT)/libscg/scg scg + $(LN) -s $(SRCROOT)/incs/$(OARCH)/xconfig.h xconfig.h + $(LN) -s $(SRCROOT)/libs/$(OARCH)/libschily.a libschily.a + $(LN) -s $(SRCROOT)/libs/$(OARCH)/libscg.a libscg.a + $(LN) -s $(SRCROOT)/libs/$(OARCH)/librscg.a librscg.a + +clobber: + $(RM_F) -r libschily scg xconfig.h libschily.a libscg.a librscg.a + +distclean: clobber + +clean: clobber + +OTHERTARGETS= install ibins depend rmdep \ + TAGS tags rmtarget relink + +$(OTHERTARGETS): + @echo "$@: nothing to make" + diff --git a/scsilib/inc/Makefile b/scsilib/inc/Makefile new file mode 100644 index 0000000..ebd661f --- /dev/null +++ b/scsilib/inc/Makefile @@ -0,0 +1,12 @@ +#ident "%W% %E% %Q%" +########################################################################### +SRCROOT= .. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +MK_FILES= align_test.mk avoffset.mk + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.mks +########################################################################### diff --git a/scsilib/inc/align_test.c b/scsilib/inc/align_test.c new file mode 100644 index 0000000..7b4bfff --- /dev/null +++ b/scsilib/inc/align_test.c @@ -0,0 +1,685 @@ +/* @(#)align_test.c 1.19 03/11/25 Copyright 1995 J. Schilling */ +#ifndef lint +static char sccsid[] = + "@(#)align_test.c 1.19 03/11/25 Copyright 1995 J. Schilling"; +#endif +/* + * Generate machine dependant align.h + * + * Copyright (c) 1995 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <stdio.h> +#include <standard.h> + +/* + * CHECK_ALIGN needs SIGBUS, but DJGPP has no SIGBUS + */ +/*#define FORCE_ALIGN*/ +/*#define OFF_ALIGN*/ +/*#define CHECK_ALIGN*/ + +EXPORT int main __PR((int ac, char **av)); + +#if !defined(FORCE_ALIGN) && !defined(OFF_ALIGN) && !defined(CHECK_ALIGN) +#define OFF_ALIGN +#endif + +char buf[8192+1024]; +char *buf_aligned; + +#ifdef FORCE_ALIGN +# undef CHECK_ALIGN +# undef OFF_ALIGN +#endif + +#ifdef CHECK_ALIGN +# undef FORCE_ALIGN +# undef OFF_ALIGN +#endif + +#ifdef OFF_ALIGN +# undef FORCE_ALIGN +# undef CHECK_ALIGN +#endif + + +#ifdef FORCE_ALIGN + +#define ALIGN_short sizeof (short) +#define ALIGN_int sizeof (int) +#define ALIGN_long sizeof (long) +#define ALIGN_longlong sizeof (long long) +#define ALIGN_float sizeof (float) +#define ALIGN_double sizeof (double) +#define ALIGN_ptr sizeof (char *) + +#endif + +#ifdef CHECK_ALIGN + +#include <signal.h> +#include <setjmp.h> +LOCAL jmp_buf jb; + +LOCAL int check_align __PR((int (*)(char *, int), + void (*)(char *, int), int)); +LOCAL int check_short __PR((char *, int)); +LOCAL int check_int __PR((char *, int)); +LOCAL int check_long __PR((char *, int)); +LOCAL int check_longlong __PR((char *, int)); +LOCAL int check_float __PR((char *, int)); +LOCAL int check_double __PR((char *, int)); +LOCAL int check_ptr __PR((char *, int)); + +LOCAL int speed_check __PR((char *, + void (*)(char *, int), int)); +LOCAL void speed_short __PR((char *, int)); +LOCAL void speed_int __PR((char *, int)); +LOCAL void speed_long __PR((char *, int)); +LOCAL void speed_longlong __PR((char *, int)); +LOCAL void speed_float __PR((char *, int)); +LOCAL void speed_double __PR((char *, int)); +LOCAL void speed_ptr __PR((char *, int)); + +#define ALIGN_short check_align(check_short, speed_short, sizeof (short)) +#define ALIGN_int check_align(check_int, speed_int, sizeof (int)) +#define ALIGN_long check_align(check_long, speed_long, sizeof (long)) +#define ALIGN_longlong check_align(check_longlong, speed_longlong, sizeof (long long)) +#define ALIGN_float check_align(check_float, speed_float, sizeof (float)) +#define ALIGN_double check_align(check_double, speed_double, sizeof (double)) +#define ALIGN_ptr check_align(check_ptr, speed_ptr, sizeof (char *)) + +#endif + +#ifdef OFF_ALIGN + +#define sm_off(s, m) ((int)&((s)0)->m) + +LOCAL int off_short __PR((void)); +LOCAL int off_int __PR((void)); +LOCAL int off_long __PR((void)); +LOCAL int off_longlong __PR((void)); +LOCAL int off_float __PR((void)); +LOCAL int off_double __PR((void)); +LOCAL int off_ptr __PR((void)); + +#define ALIGN_short off_short() +#define ALIGN_int off_int() +#define ALIGN_long off_long() +#define ALIGN_longlong off_longlong() +#define ALIGN_float off_float() +#define ALIGN_double off_double() +#define ALIGN_ptr off_ptr() + +#endif + +LOCAL void printmacs __PR((void)); + +#ifdef CHECK_ALIGN +LOCAL void sig __PR((int)); + +LOCAL void +sig(signo) + int signo; +{ + signal(signo, sig); + longjmp(jb, 1); +} +#endif + +#if defined(mc68000) || defined(mc68020) +#define MIN_ALIGN 2 +#else +#define MIN_ALIGN 2 +#endif + + +#define min_align(i) (((i) < MIN_ALIGN) ? MIN_ALIGN : (i)) + +/* + * Make it LOCAL MacOS-X by default links against libcurses and + * so we totherwise have a double defined "al". + */ +LOCAL char al[] = "alignment value for "; +LOCAL char ms[] = "alignment mask for "; +LOCAL char so[] = "sizeof "; +LOCAL char sh[] = "short"; +LOCAL char in[] = "int"; +LOCAL char lo[] = "long"; +LOCAL char ll[] = "long long"; +LOCAL char fl[] = "float"; +LOCAL char db[] = "double"; +LOCAL char pt[] = "pointer"; + +#define xalign(x, a, m) (((char *)(x)) + ((a) - (((UIntptr_t)(x))&(m)))) + +EXPORT int +main(ac, av) + int ac; + char **av; +{ + char *p; + int i; + int s; + +#ifdef CHECK_ALIGN +#ifdef SIGBUS + signal(SIGBUS, sig); +#endif +#endif + + i = ((int)buf) % 1024; + i = 1024 - i; + p = &buf[i]; + buf_aligned = p; + +#ifdef DEBUG + fprintf(stderr, "buf: 0x%lX 0x%lX\n", + (unsigned long)buf, (unsigned long)xalign(buf, 1024, 1023)); +#endif + + printf("/*\n"); + printf(" * This file has been generated automatically\n"); + printf(" * by %s\n", sccsid); + printf(" * do not edit by hand.\n"); + printf(" */\n"); + printf("#ifndef _UTYPES_H\n"); + printf("#include <utypes.h>\n"); + printf("#endif\n"); + + s = sizeof (short); + i = ALIGN_short; + i = min_align(i); + printf("\n"); + printf("#define ALIGN_SHORT %d\t/* %s(%s *)\t*/\n", i, al, sh); + printf("#define ALIGN_SMASK %d\t/* %s(%s *)\t*/\n", i-1, ms, sh); + printf("#define SIZE_SHORT %d\t/* %s(%s)\t\t\t*/\n", s, so, sh); + + s = sizeof (int); + i = ALIGN_int; + i = min_align(i); + printf("\n"); + printf("#define ALIGN_INT %d\t/* %s(%s *)\t\t*/\n", i, al, in); + printf("#define ALIGN_IMASK %d\t/* %s(%s *)\t\t*/\n", i-1, ms, in); + printf("#define SIZE_INT %d\t/* %s(%s)\t\t\t\t*/\n", s, so, in); + + s = sizeof (long); + i = ALIGN_long; + i = min_align(i); + printf("\n"); + printf("#define ALIGN_LONG %d\t/* %s(%s *)\t\t*/\n", i, al, lo); + printf("#define ALIGN_LMASK %d\t/* %s(%s *)\t\t*/\n", i-1, ms, lo); + printf("#define SIZE_LONG %d\t/* %s(%s)\t\t\t*/\n", s, so, lo); + +#ifdef HAVE_LONGLONG + s = sizeof (long long); + i = ALIGN_longlong; + i = min_align(i); +#endif + printf("\n"); + printf("#define ALIGN_LLONG %d\t/* %s(%s *)\t*/\n", i, al, ll); + printf("#define ALIGN_LLMASK %d\t/* %s(%s *)\t*/\n", i-1, ms, ll); + printf("#define SIZE_LLONG %d\t/* %s(%s)\t\t\t*/\n", s, so, ll); + + s = sizeof (float); + i = ALIGN_float; + i = min_align(i); + printf("\n"); + printf("#define ALIGN_FLOAT %d\t/* %s(%s *)\t*/\n", i, al, fl); + printf("#define ALIGN_FMASK %d\t/* %s(%s *)\t*/\n", i-1, ms, fl); + printf("#define SIZE_FLOAT %d\t/* %s(%s)\t\t\t*/\n", s, so, fl); + + s = sizeof (double); + i = ALIGN_double; + i = min_align(i); + printf("\n"); + printf("#define ALIGN_DOUBLE %d\t/* %s(%s *)\t*/\n", i, al, db); + printf("#define ALIGN_DMASK %d\t/* %s(%s *)\t*/\n", i-1, ms, db); + printf("#define SIZE_DOUBLE %d\t/* %s(%s)\t\t\t*/\n", s, so, db); + + s = sizeof (char *); + i = ALIGN_ptr; + i = min_align(i); + printf("\n"); + printf("#define ALIGN_PTR %d\t/* %s(%s *)\t*/\n", i, al, pt); + printf("#define ALIGN_PMASK %d\t/* %s(%s *)\t*/\n", i-1, ms, pt); + printf("#define SIZE_PTR %d\t/* %s(%s)\t\t\t*/\n", s, so, pt); + + printmacs(); + return (0); +} + +LOCAL void +printmacs() +{ +printf("\n\n"); +printf("/*\n * There used to be a cast to an int but we get a warning from GCC.\n"); +printf(" * This warning message from GCC is wrong.\n"); +printf(" * Believe me that this macro would even be usable if I would cast to short.\n"); +printf(" * In order to avoid this warning, we are now using UIntptr_t\n */\n"); +/*printf("\n");*/ +/*printf("\n");*/ +printf("#define xaligned(a, s) ((((UIntptr_t)(a)) & (s)) == 0 )\n"); +printf("#define x2aligned(a, b, s) (((((UIntptr_t)(a)) | ((UIntptr_t)(b))) & (s)) == 0 )\n"); +printf("\n"); +printf("#define saligned(a) xaligned(a, ALIGN_SMASK)\n"); +printf("#define s2aligned(a, b) x2aligned(a, b, ALIGN_SMASK)\n"); +printf("\n"); +printf("#define ialigned(a) xaligned(a, ALIGN_IMASK)\n"); +printf("#define i2aligned(a, b) x2aligned(a, b, ALIGN_IMASK)\n"); +printf("\n"); +printf("#define laligned(a) xaligned(a, ALIGN_LMASK)\n"); +printf("#define l2aligned(a, b) x2aligned(a, b, ALIGN_LMASK)\n"); +printf("\n"); +printf("#define llaligned(a) xaligned(a, ALIGN_LLMASK)\n"); +printf("#define ll2aligned(a, b) x2aligned(a, b, ALIGN_LLMASK)\n"); +printf("\n"); +printf("#define faligned(a) xaligned(a, ALIGN_FMASK)\n"); +printf("#define f2aligned(a, b) x2aligned(a, b, ALIGN_FMASK)\n"); +printf("\n"); +printf("#define daligned(a) xaligned(a, ALIGN_DMASK)\n"); +printf("#define d2aligned(a, b) x2aligned(a, b, ALIGN_DMASK)\n"); +printf("\n"); +printf("#define paligned(a) xaligned(a, ALIGN_PMASK)\n"); +printf("#define p2aligned(a, b) x2aligned(a, b, ALIGN_PMASK)\n"); + +printf("\n\n"); +printf("/*\n * There used to be a cast to an int but we get a warning from GCC.\n"); +printf(" * This warning message from GCC is wrong.\n"); +printf(" * Believe me that this macro would even be usable if I would cast to short.\n"); +printf(" * In order to avoid this warning, we are now using UIntptr_t\n */\n"); +printf("#define xalign(x, a, m) ( ((char *)(x)) + ( (a) - 1 - ((((UIntptr_t)(x))-1)&(m))) )\n"); +printf("\n"); +printf("#define salign(x) xalign((x), ALIGN_SHORT, ALIGN_SMASK)\n"); +printf("#define ialign(x) xalign((x), ALIGN_INT, ALIGN_IMASK)\n"); +printf("#define lalign(x) xalign((x), ALIGN_LONG, ALIGN_LMASK)\n"); +printf("#define llalign(x) xalign((x), ALIGN_LLONG, ALIGN_LLMASK)\n"); +printf("#define falign(x) xalign((x), ALIGN_FLOAT, ALIGN_FMASK)\n"); +printf("#define dalign(x) xalign((x), ALIGN_DOUBLE, ALIGN_DMASK)\n"); +printf("#define palign(x) xalign((x), ALIGN_PTR, ALIGN_PMASK)\n"); +} + +#ifdef CHECK_ALIGN +/* + * Routines to compute the alignement by checking if the assignement + * causes a bus error. + * Some systems (e.g. Linux on DEC Aplha) will allow to fetch any + * type from any address. On these systems we must check the speed + * because unaligned fetches will take more time. + */ +LOCAL int +check_align(cfunc, sfunc, tsize) + int (*cfunc)(); + void (*sfunc)(); + int tsize; +{ + int calign; + int align; + int tcheck; + int t; + register int i; + register char *p = buf_aligned; + + for (i = 1; i < 128; i++) { + if (!setjmp(jb)) { + (cfunc)(p, i); + break; + } + } +#ifdef DEBUG + fprintf(stderr, "i: %d tsize: %d\n", i, tsize); +#endif + if (i == tsize) + return (i); + + align = calign = i; + tcheck = speed_check(p, sfunc, i); +#ifdef DEBUG + fprintf(stderr, "tcheck: %d\n", tcheck); +#endif + + for (i = calign*2; i <= tsize; i *= 2) { + t = speed_check(p, sfunc, i); +#ifdef DEBUG + fprintf(stderr, "tcheck: %d t: %d i: %d\n", tcheck, t, i); + fprintf(stderr, "tcheck - t: %d ... * 3: %d\n", (tcheck - t), (tcheck - t) * 3); +#endif + if (((tcheck - t) > 0) && ((tcheck - t) * 3) > tcheck) { +#ifdef DEBUG + fprintf(stderr, "kleiner\n"); +#endif + align = i; + tcheck = t; + } + } + return (align); +} + +LOCAL int +check_short(p, i) + char *p; + int i; +{ + short *sp; + + sp = (short *)&p[i]; + *sp = 1; + return (0); +} + +LOCAL int +check_int(p, i) + char *p; + int i; +{ + int *ip; + + ip = (int *)&p[i]; + *ip = 1; + return (0); +} + +LOCAL int +check_long(p, i) + char *p; + int i; +{ + long *lp; + + lp = (long *)&p[i]; + *lp = 1; + return (0); +} + +#ifdef HAVE_LONGLONG +LOCAL int +check_longlong(p, i) + char *p; + int i; +{ + long long *llp; + + llp = (long long *)&p[i]; + *llp = 1; + return (0); +} +#endif + +LOCAL int +check_float(p, i) + char *p; + int i; +{ + float *fp; + + fp = (float *)&p[i]; + *fp = 1.0; + return (0); +} + +LOCAL int +check_double(p, i) + char *p; + int i; +{ + double *dp; + + dp = (double *)&p[i]; + *dp = 1.0; + return (0); +} + +LOCAL int +check_ptr(p, i) + char *p; + int i; +{ + char **pp; + + pp = (char **)&p[i]; + *pp = (char *)1; + return (0); +} + +/* + * Routines to compute the alignement by checking the speed of the + * assignement. + * Some systems (e.g. Linux on DEC Aplha) will allow to fetch any + * type from any address. On these systems we must check the speed + * because unaligned fetches will take more time. + */ +LOCAL void +speed_short(p, n) + char *p; + int n; +{ + short *sp; + int i; + + sp = (short *)&p[n]; + + for (i = 1000000; --i >= 0; ) + *sp = i; +} + +LOCAL void +speed_int(p, n) + char *p; + int n; +{ + int *ip; + int i; + + ip = (int *)&p[n]; + + for (i = 1000000; --i >= 0; ) + *ip = i; +} + +LOCAL void +speed_long(p, n) + char *p; + int n; +{ + long *lp; + int i; + + lp = (long *)&p[n]; + + for (i = 1000000; --i >= 0; ) + *lp = i; +} + +#ifdef HAVE_LONGLONG +LOCAL void +speed_longlong(p, n) + char *p; + int n; +{ + long long *llp; + int i; + + llp = (long long *)&p[n]; + + for (i = 1000000; --i >= 0; ) + *llp = i; +} +#endif + +LOCAL void +speed_float(p, n) + char *p; + int n; +{ + float *fp; + int i; + + fp = (float *)&p[n]; + + for (i = 1000000; --i >= 0; ) + *fp = i; +} + +LOCAL void +speed_double(p, n) + char *p; + int n; +{ + double *dp; + int i; + + dp = (double *)&p[n]; + + for (i = 1000000; --i >= 0; ) + *dp = i; +} + +LOCAL void +speed_ptr(p, n) + char *p; + int n; +{ + char **pp; + int i; + + pp = (char **)&p[n]; + + for (i = 1000000; --i >= 0; ) + *pp = (char *)i; +} + +#include <timedefs.h> +LOCAL int +speed_check(p, sfunc, n) + char *p; + void (*sfunc)(); + int n; +{ + struct tms tm1; + struct tms tm2; + + times(&tm1); + (*sfunc)(p, n); + times(&tm2); + +#ifdef DEBUG + fprintf(stderr, "t1: %ld\n", (long) tm2.tms_utime-tm1.tms_utime); +#endif + + return ((int) tm2.tms_utime-tm1.tms_utime); +} + +#endif /* CHECK_ALIGN */ + +#ifdef OFF_ALIGN +/* + * Routines to compute the alignement by using the knowledge + * of the C-compiler. + * We define a structure and check the padding that has been inserted + * by the compiler to keep the apropriate type on a properly aligned + * address. + */ +LOCAL int +off_short() +{ + struct ss { + char c; + short s; + } ss; + ss.c = 0; /* fool C-compiler */ + + return (sm_off(struct ss *, s)); +} + +LOCAL int +off_int() +{ + struct si { + char c; + int i; + } si; + si.c = 0; /* fool C-compiler */ + + return (sm_off(struct si *, i)); +} + +LOCAL int +off_long() +{ + struct sl { + char c; + long l; + } sl; + sl.c = 0; /* fool C-compiler */ + + return (sm_off(struct sl *, l)); +} + +#ifdef HAVE_LONGLONG +LOCAL int +off_longlong() +{ + struct sll { + char c; + long long ll; + } sll; + sll.c = 0; /* fool C-compiler */ + + return (sm_off(struct sll *, ll)); +} +#endif + +LOCAL int +off_float() +{ + struct sf { + char c; + float f; + } sf; + sf.c = 0; /* fool C-compiler */ + + return (sm_off(struct sf *, f)); +} + +LOCAL int +off_double() +{ + struct sd { + char c; + double d; + } sd; + sd.c = 0; /* fool C-compiler */ + + return (sm_off(struct sd *, d)); +} + +LOCAL int +off_ptr() +{ + struct sp { + char c; + char *p; + } sp; + sp.c = 0; /* fool C-compiler */ + + return (sm_off(struct sp *, p)); +} + +#endif /* OFF_ALIGN */ diff --git a/scsilib/inc/align_test.mk b/scsilib/inc/align_test.mk new file mode 100644 index 0000000..279ee9d --- /dev/null +++ b/scsilib/inc/align_test.mk @@ -0,0 +1,16 @@ +#ident %W% %E% %Q% +########################################################################### +SRCROOT= .. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +INSDIR= include +TARGET= align.h +TARGETC= align_test +CPPOPTS += -D__OPRINTF__ +CFILES= align_test.c + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.inc +########################################################################### diff --git a/scsilib/inc/avoffset.c b/scsilib/inc/avoffset.c new file mode 100644 index 0000000..ca407a5 --- /dev/null +++ b/scsilib/inc/avoffset.c @@ -0,0 +1,161 @@ +/* @(#)avoffset.c 1.24 04/05/09 Copyright 1987, 1995-2004 J. Schilling */ +#ifndef lint +static char sccsid[] = + "@(#)avoffset.c 1.24 04/05/09 Copyright 1987, 1995-2004 J. Schilling"; +#endif +/* + * This program is a tool to generate the file "avoffset.h". + * It is used by functions that trace the stack to get to the top of the stack. + * + * It generates two defines: + * AV_OFFSET - offset of argv relative to the main() frame pointer + * FP_INDIR - number of stack frames above main() + * before encountering a NULL pointer. + * + * Copyright (c) 1987, 1995-2004 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <stdio.h> +#include <standard.h> +#include <schily.h> +#include <stdxlib.h> +#include <signal.h> + +#ifdef HAVE_SCANSTACK +# include <stkframe.h> +#endif + +LOCAL RETSIGTYPE handler __PR((int signo)); +EXPORT int main __PR((int ac, char **av)); +LOCAL int stack_direction __PR((long *lp)); + +LOCAL RETSIGTYPE +handler(signo) + int signo; +{ + fprintf(stderr, "Warning: Cannot scan stack on this environment.\n"); + exit(0); +} + + +int +main(ac, av) + int ac; + char **av; +{ + int stdir; +#ifdef HAVE_SCANSTACK + register struct frame *fp; + register int i = 0; + register int o = 0; + + /* + * As the SCO OpenServer C-Compiler has a bug that may cause + * the first function call to getfp() been done before the + * new stack frame is created, we call getfp() twice. + */ + (void) getfp(); + fp = (struct frame *)getfp(); +#endif + +#ifdef SIGBUS + signal(SIGBUS, handler); +#endif + signal(SIGSEGV, handler); +#ifdef SIGILL + signal(SIGILL, handler); +#endif + + printf("/*\n"); + printf(" * This file has been generated automatically\n"); + printf(" * by %s\n", sccsid); + printf(" * do not edit by hand.\n"); + printf(" *\n"); + printf(" * This file includes definitions for AV_OFFSET and FP_INDIR.\n"); + printf(" * FP_INDIR is the number of fp chain elements above 'main'.\n"); + printf(" * AV_OFFSET is the offset of &av[0] relative to the frame pointer in 'main'.\n"); + printf(" *\n"); + printf(" * If getav0() does not work on a specific architecture\n"); + printf(" * the program which generated this include file may dump core.\n"); + printf(" * In this case, the generated include file does not include\n"); + printf(" * definitions for AV_OFFSET and FP_INDIR but ends after this comment.\n"); + printf(" * If AV_OFFSET or FP_INDIR are missing in this file, all programs\n"); + printf(" * which use the definitions are automatically disabled.\n"); + printf(" */\n"); + stdir = stack_direction(0); + printf("#define STACK_DIRECTION %d\n", stdir); + fflush(stdout); + +#ifdef HAVE_SCANSTACK + /* + * Note: Scanning the stack to look for argc/argv + * works only in the main thread. + */ + while (fp->fr_savfp) { + if (fp->fr_savpc == 0) + break; + + fp = (struct frame *)fp->fr_savfp; + + i++; + } + /* + * Do not add any printf()'s before this line to allow avoffset + * to abort without printing more than the comment above. + */ + fp = (struct frame *)getfp(); + o = ((char *)av) - ((char *)fp); + if ((o % sizeof (char *)) != 0) { + fprintf(stderr, "AV_OFFSET value (%d) not a multiple of pointer size.\n", o); + fprintf(stderr, "Disabling scanning the stack.\n"); + exit(0); + } + if (o < -1000 || o > 1000) { + fprintf(stderr, "AV_OFFSET value (%d) does not look reasonable.\n", o); + fprintf(stderr, "Disabling scanning the stack.\n"); + exit(0); + } + printf("#define AV_OFFSET %d\n", o); + printf("#define FP_INDIR %d\n", i); +#endif + exit(0); + return (0); /* keep lint happy */ +} + +LOCAL int +stack_direction(lp) + long *lp; +{ + auto long *dummy[4]; + int i; + + for (i = 0; i < 4; i++) + dummy[i] = lp; + + if (lp == 0) { + return (stack_direction((long *)dummy)); + } else { + if ((long *)dummy == lp) + return (0); + return (((long *)dummy > lp) ? 1 : -1); + } +} + +#define IS_AVOFFSET +#include <getfp.c> diff --git a/scsilib/inc/avoffset.mk b/scsilib/inc/avoffset.mk new file mode 100644 index 0000000..2bf2a79 --- /dev/null +++ b/scsilib/inc/avoffset.mk @@ -0,0 +1,17 @@ +#ident %W% %E% %Q% +########################################################################### +SRCROOT= .. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +INSDIR= include +TARGET= avoffset.h +TARGETC= avoffset +CPPOPTS += -DUSE_SCANSTACK +CPPOPTS += -D__OPRINTF__ +CFILES= avoffset.c + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.inc +########################################################################### diff --git a/scsilib/inc/getfp.c b/scsilib/inc/getfp.c new file mode 100644 index 0000000..03fe563 --- /dev/null +++ b/scsilib/inc/getfp.c @@ -0,0 +1,98 @@ +/* @(#)getfp.c 1.14 03/07/13 Copyright 1988-2003 J. Schilling */ +/* + * Get frame pointer + * + * Copyright (c) 1988-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <standard.h> +#include <schily.h> + +#ifndef IS_AVOFFSET +/* + * We usually don't like to compile a getfp() that returns junk data in case + * we cannot scan the stack. + * The only way to find this out is by including avoffset.h. Unfortunately, we + * need to be able to use getfp() from avoffset.c in order to check if the + * return value is usable or junk. To be able to do this, we include getfp.c + * from avoffset.c and define IS_AVOFFSET before. + */ +#include <avoffset.h> + +#if !defined(AV_OFFSET) || !defined(FP_INDIR) +# ifdef HAVE_SCANSTACK +# undef HAVE_SCANSTACK +# endif +#endif +#endif + +#ifdef HAVE_SCANSTACK +#include <stkframe.h> + +#define MAXWINDOWS 32 +#define NWINDOWS 7 + +#if defined(sparc) && defined(__GNUC__) +# define FP_OFF 0x10 /* some strange things on sparc gcc */ +#else +# define FP_OFF 0 +#endif + +EXPORT void **___fpoff __PR((char *cp)); + +EXPORT void ** +getfp() +{ + long **dummy[1]; + +#ifdef sparc + flush_reg_windows(MAXWINDOWS-2); +#endif + return ((void **)((struct frame *)___fpoff((char *)&dummy[0]))->fr_savfp); +} + +/* + * Don't make it static to avoid inline optimization. + * + * We need this function to fool GCCs check for returning addresses + * from outside the functions local address space. + */ +EXPORT void ** +___fpoff(cp) + char *cp; +{ + long ***lp; + + lp = (long ***)(cp + FP_OFF); + lp++; + return ((void **)lp); +} + +#ifdef sparc +EXPORT int +flush_reg_windows(n) + int n; +{ + if (--n > 0) + flush_reg_windows(n); + return (0); +} +#endif + +#endif /* HAVE_SCANSTACK */ diff --git a/scsilib/include/allocax.h b/scsilib/include/allocax.h new file mode 100644 index 0000000..320be47 --- /dev/null +++ b/scsilib/include/allocax.h @@ -0,0 +1,69 @@ +/* @(#)allocax.h 1.3 03/07/15 Copyright 2002 J. Schilling */ +/* + * Definitions for users of alloca() + * + * Important: #include this directly after <mconfig.h> + * and before any other include file. + * See comment in _AIX part below. + * + * Copyright (c) 2002 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +#ifndef _ALLOCAX_H +#define _ALLOCAX_H + +#ifdef __GNUC__ +# ifndef alloca +# define alloca(s) __builtin_alloca(s) +# endif +#else +# ifdef _MSC_VER +# include <malloc.h> +# define alloca _alloca +# else +# if HAVE_ALLOCA_H +# include <alloca.h> +# else +# ifdef _AIX + /* + * Indent so pre-ANSI compilers will ignore it + * + * Some versions of AIX may require this to be + * first in the file and only preceded by + * comments and preprocessor directives/ + */ + #pragma alloca +# else +# ifndef alloca + /* + * predefined by HP cc +Olibcalls + */ +# ifdef PROTOTYPES + extern void *alloca(); +# else + extern char *alloca(); +# endif +# endif +# endif +# endif +# endif +#endif + + +#endif /* _ALLOCAX_H */ diff --git a/scsilib/include/btorder.h b/scsilib/include/btorder.h new file mode 100644 index 0000000..946c592 --- /dev/null +++ b/scsilib/include/btorder.h @@ -0,0 +1,120 @@ +/* @(#)btorder.h 1.16 03/06/15 Copyright 1996 J. Schilling */ +/* + * Definitions for Bit and Byte ordering + * + * Copyright (c) 1996 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +#ifndef _BTORDER_H +#define _BTORDER_H + +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> /* try to load isa_defs.h on Solaris */ +#define _INCL_SYS_TYPES_H +#endif + +#ifndef _MCONFIG_H +#include <mconfig.h> /* load bit/byte-oder from xmconfig.h*/ +#endif + +/* + * Convert bit-order definitions from xconfig.h into our values + * and verify them. + */ +#if defined(HAVE_C_BITFIELDS) && \ + defined(BITFIELDS_LTOH) +#define _BIT_FIELDS_LTOH +#endif + +#if defined(HAVE_C_BITFIELDS) && \ + defined(BITFIELDS_HTOL) +#define _BIT_FIELDS_HTOL +#endif + +#if defined(HAVE_C_BITFIELDS) && \ + !defined(BITFIELDS_HTOL) +#define BITFIELDS_LTOH +#define _BIT_FIELDS_LTOH +#endif + +#if defined(_BIT_FIELDS_LTOH) && defined(_BIT_FIELDS_HTOL) +/* + * #error will not work for all compilers (e.g. sunos4) + * The following line will abort compilation on all compilers + * if none of the above is defines. And that's what we want. + */ +error Only one of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL may be defined +#endif + + +/* + * Convert byte-order definitions from xconfig.h into our values + * and verify them. + * Note that we cannot use the definitions _LITTLE_ENDIAN and _BIG_ENDIAN + * because they are used on IRIX-6.5 with different meaning. + */ +#if defined(HAVE_C_BIGENDIAN) && \ + !defined(WORDS_BIGENDIAN) +#define WORDS_LITTLEENDIAN +/*#define _LITTLE_ENDIAN*/ +#endif + +#if defined(HAVE_C_BIGENDIAN) && \ + defined(WORDS_BIGENDIAN) +#undef WORDS_LITTLEENDIAN +/*#define _BIG_ENDIAN*/ +#endif + +#if defined(_BIT_FIELDS_LTOH) || defined(_BIT_FIELDS_HTOL) +/* + * Bitorder is already known. + */ +#else +/* + * Bitorder not yet known. + */ +# if defined(sun3) || defined(mc68000) || \ + defined(sun4) || defined(__sparc) || defined(sparc) || \ + defined(__hppa) || defined(_ARCH_PPC) || defined(_IBMR2) +# define _BIT_FIELDS_HTOL +# endif + +# if defined(__sgi) && defined(__mips) +# define _BIT_FIELDS_HTOL +# endif + +# if defined(__i386__) || defined(__i386) || defined(i386) || \ + defined(__ia64__) || defined(__ia64) || defined(ia64) || \ + defined(__alpha__) || defined(__alpha) || defined(alpha) || \ + defined(__arm__) || defined(__arm) || defined(arm) +# define _BIT_FIELDS_LTOH +# endif + +# if defined(__ppc__) || defined(ppc) || defined(__ppc) || \ + defined(__PPC) || defined(powerpc) || defined(__powerpc__) + +# if defined(__BIG_ENDIAN__) +# define _BIT_FIELDS_HTOL +# else +# define _BIT_FIELDS_LTOH +# endif +# endif +#endif + +#endif /* _BTORDER_H */ diff --git a/scsilib/include/ccomdefs.h b/scsilib/include/ccomdefs.h new file mode 100644 index 0000000..baba8ae --- /dev/null +++ b/scsilib/include/ccomdefs.h @@ -0,0 +1,67 @@ +/* @(#)ccomdefs.h 1.3 03/06/15 Copyright 2000 J. Schilling */ +/* + * Various compiler dependant macros. + * + * Copyright (c) 2000 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _CCOMDEFS_H +#define _CCOMDEFS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Compiler-dependent macros to declare that functions take printf-like + * or scanf-like arguments. They are defined to nothing for versions of gcc + * that are not known to support the features properly (old versions of gcc-2 + * didn't permit keeping the keywords out of the application namespace). + */ +#if __GNUC__ < 2 || __GNUC__ == 2 && __GNUC_MINOR__ < 7 + +#define __printflike__(fmtarg, firstvararg) +#define __printf0like__(fmtarg, firstvararg) +#define __scanflike__(fmtarg, firstvararg) + +#else /* We found GCC that supports __attribute__ */ + +#define __printflike__(fmtarg, firstvararg) \ + __attribute__((__format__(__printf__, fmtarg, firstvararg))) +#define __printf0like__(fmtarg, firstvararg) \ + __attribute__((__format__(__printf0__, fmtarg, firstvararg))) + +/* + * FreeBSD GCC implements printf0 that allows the format string to + * be a NULL pointer. + */ +#if __FreeBSD_cc_version < 300001 +#undef __printf0like__ +#define __printf0like__ __printflike__ +#endif + +#define __scanflike__(fmtarg, firstvararg) \ + __attribute__((__format__(__scanf__, fmtarg, firstvararg))) + +#endif /* GNUC */ + +#ifdef __cplusplus +} +#endif + +#endif /* _CCOMDEFS_H */ diff --git a/scsilib/include/deflts.h b/scsilib/include/deflts.h new file mode 100644 index 0000000..bebaff6 --- /dev/null +++ b/scsilib/include/deflts.h @@ -0,0 +1,76 @@ +/* @(#)deflts.h 1.6 02/08/26 Copyright 1997 J. Schilling */ +/* + * Definitions for reading program defaults. + * + * Copyright (c) 1997 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _DEFLTS_H +#define _DEFLTS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define DEFLT "/etc/default" + +/* + * cmd's to defltcntl() + */ +#define DC_GETFLAGS 0 /* Get actual flags */ +#define DC_SETFLAGS 1 /* Set new flags */ + +/* + * flags to defltcntl() + * + * Make sure that when adding features, the default behaviour + * is the same as old behaviour. + */ +#define DC_CASE 0x0001 /* Don't ignore case */ + +#define DC_STD DC_CASE /* Default flags */ + +/* + * Macros to handle flags + */ +#ifndef TURNON +#define TURNON(flags, mask) flags |= mask +#define TURNOFF(flags, mask) flags &= ~(mask) +#define ISON(flags, mask) (((flags) & (mask)) == (mask)) +#define ISOFF(flags, mask) (((flags) & (mask)) != (mask)) +#endif + +extern int defltopen __PR((const char *name)); +extern int defltclose __PR((void)); +extern void defltfirst __PR((void)); +extern char *defltread __PR((const char *name)); +extern char *defltnext __PR((const char *name)); +extern int defltcntl __PR((int cmd, int flags)); + +#ifdef __cplusplus +} +#endif + +#endif /* _DEFLTS_H */ diff --git a/scsilib/include/device.h b/scsilib/include/device.h new file mode 100644 index 0000000..0be0487 --- /dev/null +++ b/scsilib/include/device.h @@ -0,0 +1,145 @@ +/* @(#)device.h 1.12 03/06/15 Copyright 1995 J. Schilling */ +/* + * Generic header for users of major(), minor() and makedev() + * + * Copyright (c) 1995 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _DEVICE_H +#define _DEVICE_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif + +/* + * On generic SVR4, major is a function (defined in sys/mkdev.h). + * On Solaris it is defined ... + * As we cannot just test if major is #define'd, we have to + * define _FOUND_MAJOR_ instead. + * + * WARNING: Do never include <sys/sysmacros.h> in SVR4, it contains + * an old definition for major()/minor() defining 8 minorbits. + * Use <sys/mkdev.h> instead. + */ +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> +#define _INCL_SYS_TYPES_H +#endif +/* + * Some systems define major in <sys/types.h>. + * We are ready... + */ +#ifdef major +# define _FOUND_MAJOR_ +#endif + +#ifdef MAJOR_IN_MKDEV +# ifndef _INCL_SYS_MKDEV_H +# include <sys/mkdev.h> +# define _INCL_SYS_MKDEV_H +# endif +# define _FOUND_MAJOR_ +#endif + +#ifndef _FOUND_MAJOR_ +# ifdef MAJOR_IN_SYSMACROS +# ifndef _INCL_SYS_SYSMACROS_H +# include <sys/sysmacros.h> +# define _INCL_SYS_SYSMACROS_H +# endif +# define _FOUND_MAJOR_ +# endif +#endif + +/* + * If we are on HP/UX before HP/UX 8, + * major/minor are not in <sys/sysmacros.h>. + */ +#ifndef _FOUND_MAJOR_ +# if defined(hpux) || defined(__hpux__) || defined(__hpux) +# ifndef _INCL_SYS_MKOD_H +# include <sys/mknod.h> +# define _INCL_SYS_MKOD_H +# endif +# define _FOUND_MAJOR_ +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * For all other systems define major()/minor() here. + * XXX Check if this definition will be usefull for ms dos too. + */ +#ifndef _FOUND_MAJOR_ +# define major(dev) (((dev) >> 8) & 0xFF) +# define minor(dev) ((dev) & 0xFF) +# define makedev(majo, mino) (((majo) << 8) | (mino)) +#endif + +/* + * Don't pollute namespace... + */ +#undef _FOUND_MAJOR_ + +#ifdef __XDEV__ +/* + * The following defines are currently only needed for 'star'. + * We make it conditional code to avoid to pollute the namespace. + */ +#define XDEV_T unsigned long + +extern int minorbits; +extern XDEV_T minormask; +extern XDEV_T _dev_mask[]; + +#define dev_major(dev) (((XDEV_T)(dev)) >> minorbits) +#define _dev_major(mbits, dev) (((XDEV_T)(dev)) >> (mbits)) + +#define dev_minor(dev) (((XDEV_T)(dev)) & minormask) +#define _dev_minor(mbits, dev) (((XDEV_T)(dev)) & _dev_mask[(mbits)]) + + +#define dev_make(majo, mino) ((((XDEV_T)(majo)) << minorbits) | \ + ((XDEV_T)(mino))) +#define _dev_make(mbits, majo, mino) ((((XDEV_T)(majo)) << (mbits) | \ + ((XDEV_T)(mino))) + +extern void dev_init __PR((BOOL debug)); +#ifndef dev_major +extern XDEV_T dev_major __PR((XDEV_T dev)); +extern XDEV_T _dev_major __PR((int mbits, XDEV_T dev)); +extern XDEV_T dev_minor __PR((XDEV_T dev)); +extern XDEV_T _dev_minor __PR((int mbits, XDEV_T dev)); +extern XDEV_T dev_make __PR((XDEV_T majo, XDEV_T mino)); +extern XDEV_T _dev_make __PR((int mbits, XDEV_T majo, XDEV_T mino)); +#endif + +#endif /* __XDEV__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _DEVICE_H */ diff --git a/scsilib/include/dirdefs.h b/scsilib/include/dirdefs.h new file mode 100644 index 0000000..30ab6c8 --- /dev/null +++ b/scsilib/include/dirdefs.h @@ -0,0 +1,177 @@ +/* @(#)dirdefs.h 1.15 04/06/16 Copyright 1987, 1998 J. Schilling */ +/* + * Copyright (c) 1987, 1998 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _DIRDEFS_H +#define _DIRDEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef JOS +# ifndef _INCL_SYS_STYPES_H +# include <sys/stypes.h> +# define _INCL_SYS_STYPES_H +# endif +# ifndef _INCL_SYS_FILEDESC_H +# include <sys/filedesc.h> +# define _INCL_SYS_FILEDESC_H +# endif +# define NEED_READDIR +# define dirent _direct +# define DIR_NAMELEN(dirent) strlen((dirent)->d_name) +# define DIRSIZE 30 +# define FOUND_DIRSIZE + typedef struct _dirent { + char name[DIRSIZE]; + short ino; + } dirent; + +#else /* !JOS */ + +# ifndef _INCL_SYS_TYPES_H +# include <sys/types.h> +# define _INCL_SYS_TYPES_H +# endif +# ifndef _INCL_SYS_STAT_H +# include <sys/stat.h> +# define _INCL_SYS_STAT_H +# endif +# ifdef HAVE_LIMITS_H +# ifndef _INCL_LIMITS_H +# include <limits.h> +# define _INCL_LIMITS_H +# endif +# endif +# ifdef HAVE_SYS_PARAM_H +# ifndef _INCL_SYS_PARAM_H +# include <sys/param.h> +# define _INCL_SYS_PARAM_H +# endif +# endif + +# ifdef HAVE_DIRENT_H /* This a POSIX compliant system */ +# ifndef _INCL_DIRENT_H +# include <dirent.h> +# define _INCL_DIRENT_H +# endif +# define DIR_NAMELEN(dirent) strlen((dirent)->d_name) +# define _FOUND_DIR_ +# else /* This is a Pre POSIX system */ + +# define dirent direct +# define DIR_NAMELEN(dirent) (dirent)->d_namlen + +# if defined(HAVE_SYS_DIR_H) +# ifndef _INCL_SYS_DIR_H +# include <sys/dir.h> +# define _INCL_SYS_DIR_H +# endif +# define _FOUND_DIR_ +# endif + +# if defined(HAVE_NDIR_H) && !defined(_FOUND_DIR_) +# ifndef _INCL_NDIR_H +# include <ndir.h> +# define _INCL_NDIR_H +# endif +# define _FOUND_DIR_ +# endif + +# if defined(HAVE_SYS_NDIR_H) && !defined(_FOUND_DIR_) +# ifndef _INCL_SYS_NDIR_H +# include <sys/ndir.h> +# define _INCL_SYS_NDIR_H +# endif +# define _FOUND_DIR_ +# endif +# endif /* HAVE_DIRENT_H */ + +# if defined(_FOUND_DIR_) +/* + * Don't use defaults here to allow recognition of problems. + */ +# ifdef MAXNAMELEN +# define DIRSIZE MAXNAMELEN /* From sys/param.h */ +# define FOUND_DIRSIZE +# else +# ifdef MAXNAMLEN +# define DIRSIZE MAXNAMLEN /* From dirent.h */ +# define FOUND_DIRSIZE +# else +# ifdef DIRSIZ +# define DIRSIZE DIRSIZ /* From sys/dir.h */ +# define FOUND_DIRSIZE +# endif +# endif +# endif +# else /* !_FOUND_DIR_ */ + +# define NEED_DIRENT +# define NEED_READDIR +# define dirent _direct +# define DIR_NAMELEN(dirent) strlen((dirent)->d_name) + +# endif /* _FOUND_DIR_ */ + + +#ifdef NEED_DIRENT + +#ifndef FOUND_DIRSIZE +#define DIRSIZE 14 /* The old UNIX standard value */ +#define FOUND_DIRSIZE +#endif + +typedef struct _dirent { + short ino; + char name[DIRSIZE]; +} dirent; + +#endif /* NEED_DIRENT */ + +#endif /* !JOS */ + +#ifdef NEED_READDIR + typedef struct __dirdesc { + FILE *dd_fd; + } DIR; + + struct _direct { + unsigned long d_ino; + unsigned short d_reclen; + unsigned short d_namlen; + char d_name[DIRSIZE +1]; + }; + +extern DIR *opendir(); +extern closedir(); +extern struct dirent *readdir(); + +#endif /* NEED_READDIR */ + +#ifdef __cplusplus +} +#endif + +#endif /* _DIRDEFS_H */ diff --git a/scsilib/include/fctldefs.h b/scsilib/include/fctldefs.h new file mode 100644 index 0000000..4889b96 --- /dev/null +++ b/scsilib/include/fctldefs.h @@ -0,0 +1,82 @@ +/* @(#)fctldefs.h 1.13 03/02/23 Copyright 1996 J. Schilling */ +/* + * Generic header for users of open(), creat() and chmod() + * + * Copyright (c) 1996 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _FCTLDEFS_H +#define _FCTLDEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifndef _STATDEFS_H +#include <statdefs.h> /* For 3rd arg of open() and chmod() */ +#endif + +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> /* Needed for fcntl.h */ +#define _INCL_SYS_TYPES_H +#endif + +#ifdef HAVE_SYS_FILE_H +/* + * Historical systems with flock() only need sys/file.h + */ +# ifndef _INCL_SYS_FILE_H +# include <sys/file.h> +# define _INCL_SYS_FILE_H +# endif +#endif +#ifdef HAVE_FCNTL_H +# ifndef _INCL_FCNTL_H +# include <fcntl.h> +# define _INCL_FCNTL_H +#endif +#endif + +/* + * Do not define more than O_RDONLY / O_WRONLY / O_RDWR / O_BINARY + * The values may differ. + * + * O_BINARY is defined here to allow all applications to compile on a non DOS + * environment without repeating this definition. + */ +#ifndef O_RDONLY +# define O_RDONLY 0 +#endif +#ifndef O_WRONLY +# define O_WRONLY 1 +#endif +#ifndef O_RDWR +# define O_RDWR 2 +#endif +#ifndef O_BINARY /* Only present on DOS or similar */ +# define O_BINARY 0 +#endif +#ifndef O_NDELAY /* This is undefined on BeOS :-( */ +# define O_NDELAY 0 +#endif + +#ifndef O_ACCMODE +#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) +#endif + +#endif /* _FCTLDEFS_H */ diff --git a/scsilib/include/getargs.h b/scsilib/include/getargs.h new file mode 100644 index 0000000..3c5787f --- /dev/null +++ b/scsilib/include/getargs.h @@ -0,0 +1,49 @@ +/* @(#)getargs.h 1.9 03/06/15 Copyright 1985 J. Schilling */ +/* + * Definitions for getargs()/getallargs()/getfiles() + * + * Copyright (c) 1985 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _GETARGS_H +#define _GETARGS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define NOARGS 0 /* No more args */ +#define NOTAFLAG 1 /* Not a flag type argument */ +#define BADFLAG (-1) /* Not a valid flag argument */ +#define BADFMT (-2) /* Error in format string */ +#define NOTAFILE (-3) /* Seems to be a flag type */ + +typedef int (*getargfun) __PR((const void *, void *)); + +#ifdef __cplusplus +} +#endif + +#endif /* _GETARGS_H */ diff --git a/scsilib/include/getcwd.h b/scsilib/include/getcwd.h new file mode 100644 index 0000000..9c4a35c --- /dev/null +++ b/scsilib/include/getcwd.h @@ -0,0 +1,43 @@ +/* @(#)getcwd.h 1.3 01/07/15 Copyright 1998 J. Schilling */ +/* + * Definitions for getcwd() + * + * Copyright (c) 1998 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _GETCWD_H +#define _GETCWD_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifdef JOS +# ifndef _INCL_SYS_STYPES_H +# include <sys/stypes.h> +# define _INCL_SYS_STYPES_H +# endif + extern char *gwd(); +# define getcwd(b, len) gwd(b) +#else +# ifndef HAVE_GETCWD +# define getcwd(b, len) getwd(b) +# endif +#endif + +#endif /* _GETCWD_H */ diff --git a/scsilib/include/intcvt.h b/scsilib/include/intcvt.h new file mode 100644 index 0000000..8d89683 --- /dev/null +++ b/scsilib/include/intcvt.h @@ -0,0 +1,113 @@ +/* @(#)intcvt.h 1.4 03/12/29 Copyright 1986-2003 J. Schilling */ +/* + * Definitions for conversion to/from integer data types of various size. + * + * Copyright (c) 1986-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _INTCVT_H +#define _INTCVT_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#define i_to_2_byte(a, i) (((Uchar *)(a))[0] = ((i) >> 8) & 0xFF,\ + ((Uchar *)(a))[1] = (i) & 0xFF) + +#define i_to_3_byte(a, i) (((Uchar *)(a))[0] = ((i) >> 16)& 0xFF,\ + ((Uchar *)(a))[1] = ((i) >> 8) & 0xFF,\ + ((Uchar *)(a))[2] = (i) & 0xFF) + +#define i_to_4_byte(a, i) (((Uchar *)(a))[0] = ((i) >> 24)& 0xFF,\ + ((Uchar *)(a))[1] = ((i) >> 16)& 0xFF,\ + ((Uchar *)(a))[2] = ((i) >> 8) & 0xFF,\ + ((Uchar *)(a))[3] = (i) & 0xFF) + + + +#define a_to_byte(a) (((Int8_t *) a)[0]) + +#define a_to_u_byte(a) ((UInt8_t) \ + (((Uchar *) a)[0] & 0xFF)) + +#define a_to_u_2_byte(a) ((UInt16_t) \ + ((((Uchar *) a)[1] & 0xFF) | \ + (((Uchar *) a)[0] << 8 & 0xFF00))) + +#define a_to_2_byte(a) (int)(Int16_t)a_to_u_2_byte(a) + +#define a_to_u_3_byte(a) ((Ulong) \ + ((((Uchar *) a)[2] & 0xFF) | \ + (((Uchar *) a)[1] << 8 & 0xFF00) | \ + (((Uchar *) a)[0] << 16 & 0xFF0000))) + +#define a_to_3_byte(a) a_to_u_3_byte(a) /* XXX Is there a signed version ? */ + +#ifdef __STDC__ +# define __TOP_4BYTE 0xFF000000UL +#else +# define __TOP_4BYTE 0xFF000000 +#endif + +#define a_to_u_4_byte(a) ((Ulong) \ + ((((Uchar*) a)[3] & 0xFF) | \ + (((Uchar*) a)[2] << 8 & 0xFF00) | \ + (((Uchar*) a)[1] << 16 & 0xFF0000) | \ + (((Uchar*) a)[0] << 24 & __TOP_4BYTE))) + +#define a_to_4_byte(a) (long)(Int32_t)a_to_u_4_byte(a) + +/* + * Little Endian versions of above macros + */ +#define li_to_2_byte(a, i) (((Uchar *)(a))[1] = ((i) >> 8) & 0xFF,\ + ((Uchar *)(a))[0] = (i) & 0xFF) + +#define li_to_3_byte(a, i) (((Uchar *)(a))[2] = ((i) >> 16)& 0xFF,\ + ((Uchar *)(a))[1] = ((i) >> 8) & 0xFF,\ + ((Uchar *)(a))[0] = (i) & 0xFF) + +#define li_to_4_byte(a, i) (((Uchar *)(a))[3] = ((i) >> 24)& 0xFF,\ + ((Uchar *)(a))[2] = ((i) >> 16)& 0xFF,\ + ((Uchar *)(a))[1] = ((i) >> 8) & 0xFF,\ + ((Uchar *)(a))[0] = (i) & 0xFF) + + +#define la_to_u_2_byte(a) ((UInt16_t) \ + ((((Uchar*) a)[0] & 0xFF) | \ + (((Uchar*) a)[1] << 8 & 0xFF00))) + +#define la_to_2_byte(a) (int)(Int16_t)la_to_u_2_byte(a) + +#define la_to_u_3_byte(a) ((Ulong) \ + ((((Uchar*) a)[0] & 0xFF) | \ + (((Uchar*) a)[1] << 8 & 0xFF00) | \ + (((Uchar*) a)[2] << 16 & 0xFF0000))) + +#define la_to_3_byte(a) la_to_u_3_byte(a) /* XXX Is there a signed version ? */ + +#define la_to_u_4_byte(a) ((Ulong) \ + ((((Uchar*) a)[0] & 0xFF) | \ + (((Uchar*) a)[1] << 8 & 0xFF00) | \ + (((Uchar*) a)[2] << 16 & 0xFF0000) | \ + (((Uchar*) a)[3] << 24 & __TOP_4BYTE))) + +#define la_to_4_byte(a) (long)(Int32_t)la_to_u_4_byte(a) + +#endif /* _INTCVT_H */ diff --git a/scsilib/include/jmpdefs.h b/scsilib/include/jmpdefs.h new file mode 100644 index 0000000..f4cbce4 --- /dev/null +++ b/scsilib/include/jmpdefs.h @@ -0,0 +1,38 @@ +/* @(#)jmpdefs.h 1.2 00/11/08 Copyright 1999 J. Schilling */ +/* + * Definitions that help to handle a jmp_buf + * + * Copyright (c) 1998 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _JMPDEFS_H +#define _JMPDEFS_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct { + jmp_buf jb; +} jmps_t; + +#ifdef __cplusplus +} +#endif + +#endif /* _JMPDEFS_H */ diff --git a/scsilib/include/libport.h b/scsilib/include/libport.h new file mode 100644 index 0000000..6870875 --- /dev/null +++ b/scsilib/include/libport.h @@ -0,0 +1,111 @@ +/* @(#)libport.h 1.9 03/06/15 Copyright 1995 J. Schilling */ +/* + * Copyright (c) 1995 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +#ifndef _LIBPORT_H +#define _LIBPORT_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif +#ifndef _STANDARD_H +#include <standard.h> +#endif + +/* + * Try to get HOST_NAME_MAX for gethostname() + */ +#ifndef _UNIXSTD_H +#include <unixstd.h> +#endif + +#ifndef HOST_NAME_MAX +#if defined(HAVE_NETDB_H) && !defined(HOST_NOT_FOUND) && \ + !defined(_INCL_NETDB_H) +#include <netdb.h> +#define _INCL_NETDB_H +#endif +#ifdef MAXHOSTNAMELEN +#define HOST_NAME_MAX MAXHOSTNAMELEN +#endif +#endif + +#ifndef HOST_NAME_MAX +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> /* Include various defs needed with some OS */ + /* Linux MAXHOSTNAMELEN */ +#endif +#ifdef MAXHOSTNAMELEN +#define HOST_NAME_MAX MAXHOSTNAMELEN +#endif +#endif + +#ifndef HOST_NAME_MAX +#define HOST_NAME_MAX 255 +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSERVER +/* + * Don't use the usleep() from libc on SCO's OPENSERVER. + * It will kill our processes with SIGALRM. + */ +/* + * Don't #undef HAVE_USLEEP in this file, SCO has a + * usleep() prototype in unistd.h + */ +/*#undef HAVE_USLEEP*/ +#endif + +#ifndef HAVE_GETHOSTID +extern long gethostid __PR((void)); +#endif +#ifndef HAVE_GETHOSTNAME +extern int gethostname __PR((char *name, int namelen)); +#endif +#ifndef HAVE_GETDOMAINNAME +extern int getdomainname __PR((char *name, int namelen)); +#endif +#ifndef HAVE_GETPAGESIZE +EXPORT int getpagesize __PR((void)); +#endif +#ifndef HAVE_USLEEP +extern int usleep __PR((int usec)); +#endif + +#if !defined(HAVE_STRDUP) || defined(__SVR4) +extern char *strdup __PR((const char *s)); +#endif + +#ifndef HAVE_RENAME +extern int rename __PR((const char *old, const char *new)); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBPORT_H */ diff --git a/scsilib/include/librmt.h b/scsilib/include/librmt.h new file mode 100644 index 0000000..792b088 --- /dev/null +++ b/scsilib/include/librmt.h @@ -0,0 +1,64 @@ +/* @(#)librmt.h 1.16 03/06/15 Copyright 1996 J. Schilling */ +/* + * Prototypes for rmt client subroutines + * + * Copyright (c) 1995,1996,2000-2002 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _LIBRMT_H +#define _LIBRMT_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif + +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> +#define _INCL_SYS_TYPES_H +#endif + +#include <rmtio.h> + +/* + * remote.c + */ +extern void rmtinit __PR((int (*errmsgn)(int, const char *, ...), + void (*eexit)(int))); +extern int rmtdebug __PR((int dlevel)); +extern char *rmtfilename __PR((char *name)); +extern char *rmthostname __PR((char *hostname, int hnsize, char *rmtspec)); +extern int rmtgetconn __PR((char *host, int trsize, int excode)); +extern int rmtopen __PR((int fd, char *fname, int fmode)); +extern int rmtclose __PR((int fd)); +extern int rmtread __PR((int fd, char *buf, int count)); +extern int rmtwrite __PR((int fd, char *buf, int count)); +extern off_t rmtseek __PR((int fd, off_t offset, int whence)); +extern int rmtioctl __PR((int fd, int cmd, int count)); +#ifdef MTWEOF +extern int rmtstatus __PR((int fd, struct mtget *mtp)); +#endif +extern int rmtxstatus __PR((int fd, struct rmtget *mtp)); +#ifdef MTWEOF +extern void _rmtg2mtg __PR((struct mtget *mtp, struct rmtget *rmtp)); +extern int _mtg2rmtg __PR((struct rmtget *rmtp, struct mtget *mtp)); +#endif + +#endif /* _LIBRMT_H */ diff --git a/scsilib/include/maxpath.h b/scsilib/include/maxpath.h new file mode 100644 index 0000000..2b412c9 --- /dev/null +++ b/scsilib/include/maxpath.h @@ -0,0 +1,75 @@ +/* @(#)maxpath.h 1.6 03/08/23 Copyright 1985, 1995, 1998 J. Schilling */ +/* + * Definitions for dealing with statically limitations on pathnames + * + * Copyright (c) 1985, 1995, 1998 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _MAXPATH_H +#define _MAXPATH_H + +#ifndef _DIRDEFS_H +#include <dirdefs.h> /* Includes mconfig.h if needed */ +#endif + +#ifdef JOS +#ifndef _JOS_MAXP_H +# include <jos_maxp.h> +#endif +# define FOUND_MAXPATHNAME +# define FOUND_MAXFILENAME +#else + +# ifdef MAXPATHLEN +# define MAXPATHNAME MAXPATHLEN /* From sys/param.h */ +# define FOUND_MAXPATHNAME +# else +# ifdef PATH_MAX +# define MAXPATHNAME PATH_MAX /* From limits.h */ +# define FOUND_MAXPATHNAME +# else +# define MAXPATHNAME 256 /* Is there a limit? */ +# endif +# endif + +/* + * Don't use defaults here to allow recognition of problems. + */ +# ifdef MAXNAMELEN +# define MAXFILENAME MAXNAMELEN /* From sys/param.h */ +# define FOUND_MAXFILENAME +# else +# ifdef MAXNAMLEN +# define MAXFILENAME MAXNAMLEN /* From dirent.h */ +# define FOUND_MAXFILENAME +# else +# ifdef DIRSIZ +# define MAXFILENAME DIRSIZ /* From sys/dir.h */ +# define FOUND_MAXFILENAME +# endif +# endif +# endif + +#if !defined(FOUND_MAXFILENAME) && defined(FOUND_DIRSIZE) +# define MAXFILENAME DIRSIZE /* From dirdefs.h */ +# define FOUND_MAXFILENAME +#endif + +#endif /* JOS */ + +#endif /* _MAXPATH_H */ diff --git a/scsilib/include/mconfig.h b/scsilib/include/mconfig.h new file mode 100644 index 0000000..d1d152e --- /dev/null +++ b/scsilib/include/mconfig.h @@ -0,0 +1,547 @@ +/* @(#)mconfig.h 1.50 04/07/11 Copyright 1995 J. Schilling */ +/* + * definitions for machine configuration + * + * Copyright (c) 1995 J. Schilling + * + * This file must be included before any other file. + * If this file is not included before stdio.h you will not be + * able to get LARGEFILE support + * + * Use only cpp instructions. + * + * NOTE: SING: (Schily Is Not Gnu) + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _MCONFIG_H +#define _MCONFIG_H + +/* + * Tell our users that this is a Schily SING compile environment. + */ +#define IS_SCHILY + +/* + * This hack that is needed as long as VMS has no POSIX shell. + */ +#ifdef VMS +# define USE_STATIC_CONF +#endif + +#ifdef USE_STATIC_CONF +#include <xmconfig.h> /* This is the current static autoconf stuff */ +#else +#include <xconfig.h> /* This is the current dynamic autoconf stuff */ +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + +#define HAVE_BROKEN_SRC_LINUX_EXT2_FS_H 1 /* whether /usr/src/linux/include/linux/ext2_fs.h is broken */ +#undef DEV_MINOR_BITS /* # if bits needed to hold minor device number */ +/* + * Byteorder/Bitorder + */ +#define HAVE_C_BIGENDIAN /* Flag that WORDS_BIGENDIAN test was done */ +#if defined(__BIG_ENDIAN__) +#define WORDS_BIGENDIAN 1 /* If using network byte order */ +#endif +#define HAVE_C_BITFIELDS /* Flag that BITFIELDS_HTOL test was done */ +#if defined(__BIG_ENDIAN__) +#define BITFIELDS_HTOL 1 /* If high bits come first in structures */ +#endif + +/* + * Types/Keywords + */ + +#if defined(__x86_64__) || defined(__ia64__) || defined(__powerpc64__) || defined(__s390x__) || defined(__sparc64__) +#define SIZEOF_LONG_INT 8 +#define SIZEOF_CHAR_P 8 +#define SIZEOF_UNSIGNED_LONG_INT 8 +#define SIZEOF_UNSIGNED_CHAR_P 8 +#elif defined(__i386__) || defined(__powerpc__) || defined(__s390__) || defined(__sparc__) +#define SIZEOF_LONG_INT 4 +#define SIZEOF_CHAR_P 4 +#define SIZEOF_UNSIGNED_LONG_INT 4 +#define SIZEOF_UNSIGNED_CHAR_P 4 +#else +#error Architecture not defined here! +#endif + +#define SIZEOF_CHAR 1 +#define SIZEOF_SHORT_INT 2 +#define SIZEOF_INT 4 +#define SIZEOF_LONG_LONG 8 +#define SIZEOF_UNSIGNED_CHAR 1 +#define SIZEOF_UNSIGNED_SHORT_INT 2 +#define SIZEOF_UNSIGNED_INT 4 +#define SIZEOF_UNSIGNED_LONG_LONG 8 + +#if defined(__LONG_LONG_MAX__) +#define HAVE_LONGLONG 1 /* Compiler defines long long type */ +#endif + +#if defined(__CHAR_UNSIGNED__) +#define CHAR_IS_UNSIGNED 1 /* Compiler defines char to be unsigned */ +#endif + +#define VA_LIST_IS_ARRAY 1 /* va_list is an array */ +#define _FILE_OFFSET_BITS 64 /* # of bits in off_t if settable */ +#define _LARGEFILE_SOURCE 1 /* To make ftello() visible (HP-UX 10.20). */ + +/* + * Strings that help to maintain OS/platform id's in C-programs + */ +#define HOST_ALIAS "pc-linux-gnu" /* Output from config.guess (orig) */ +#define HOST_SUB "pc-linux-gnu" /* Output from config.sub (modified) */ +#define HOST_CPU "cpu" /* CPU part from HOST_SUB */ +#define HOST_VENDOR "pc" /* VENDOR part from HOST_SUB */ +#define HOST_OS "linux-gnu" /* CPU part from HOST_SUB */ + + +/* + * The NetBSD people want to bother us. + * They removed the definition for 'unix' and are bleating for every test + * for #if defined(unix). So we need to check for NetBSD early. + */ +#ifndef IS_UNIX +# if defined(__NetBSD__) +# define IS_UNIX +# endif +#endif + +#ifndef IS_UNIX +# if (defined(unix) || defined(__unix) || defined(__unix__)) && !defined(__DJGPP__) +# define IS_UNIX +# endif +#endif + +#ifdef __MSDOS__ +# define IS_MSDOS +#endif + +#if defined(tos) || defined(__tos) +# define IS_TOS +#endif + +#ifdef THINK_C +# define IS_MAC +#endif + +#if defined(sun) || defined(__sun) || defined(__sun__) +# define IS_SUN +#endif + +#if defined(__CYGWIN32__) || defined(__CYGWIN__) +# define IS_GCC_WIN32 +# define IS_CYGWIN + +#if defined(unix) || defined(_X86) +# define IS_CYGWIN_1 +#endif +#endif + +/*--------------------------------------------------------------------------*/ +/* + * Some magic that cannot (yet) be figured out with autoconf. + */ + +#if defined(sun3) || defined(mc68000) || defined(mc68020) +# ifndef HAVE_SCANSTACK +# define HAVE_SCANSTACK +# endif +#endif +#ifdef sparc +# ifndef HAVE_LDSTUB +# define HAVE_LDSTUB +# endif +# ifndef HAVE_SCANSTACK +# define HAVE_SCANSTACK +# endif +#endif +#if defined(__i386_) || defined(i386) +# ifndef HAVE_XCHG +# define HAVE_XCHG +# endif +# ifndef HAVE_SCANSTACK +# define HAVE_SCANSTACK +# endif +#endif + +/* + * Use of SCANSTACK is disabled by default + */ +#ifndef USE_SCANSTACK +# undef HAVE_SCANSTACK +#else +/* + * But .... + * The tests are much better now, so always give it a chance. + */ +#ifndef HAVE_SCANSTACK +# define HAVE_SCANSTACK +#endif +#endif + +/* + * Allow to overwrite the defines in the makefiles by calling + * + * make COPTX=-DFORCE_SCANSTACK + */ +#ifdef FORCE_SCANSTACK +# undef NO_SCANSTACK +#ifndef HAVE_SCANSTACK +# define HAVE_SCANSTACK +#endif +#ifndef USE_SCANSTACK +# define USE_SCANSTACK +#endif +#endif + +/* + * This is the global switch to deactivate stack scanning + */ +#ifdef NO_SCANSTACK +# ifdef HAVE_SCANSTACK +# undef HAVE_SCANSTACK +# endif +#endif + +#ifdef NO_FORK +# ifdef HAVE_FORK +# undef HAVE_FORK +# endif +# ifdef HAVE_VFORK +# undef HAVE_VFORK +# endif +#endif +#ifdef NO_VFORK +# ifdef HAVE_VFORK +# undef HAVE_VFORK +# endif +#endif + +#if defined(SOL2) || defined(SOL2) || \ + defined(S5R4) || defined(__S5R4) || defined(SVR4) +# ifndef __SVR4 +# define __SVR4 +# endif +#endif + +#ifdef __SVR4 +# ifndef SVR4 +# define SVR4 +# endif +#endif + +/* + * SunOS 4.x / SunOS 5.x + */ +#if defined(IS_SUN) +# define HAVE_GETAV0 +#endif + +/* + * AIX + */ +#if defined(_IBMR2) || defined(_AIX) +# ifndef IS_UNIX +# define IS_UNIX /* ??? really ??? */ +# endif +#endif + +/* + * QNX + */ +#if defined(__QNX__) +# ifndef IS_UNIX +# define IS_UNIX +# endif +#endif + +/* + * Silicon Graphics (must be before SVR4) + */ +#if defined(sgi) || defined(__sgi) +# define __NOT_SVR4__ /* Not a real SVR4 implementation */ +#endif + +/* + * Data General + */ +#if defined(__DGUX__) +#ifdef XXXXXXX +# undef HAVE_MTGET_DSREG +# undef HAVE_MTGET_RESID +# undef HAVE_MTGET_FILENO +# undef HAVE_MTGET_BLKNO +#endif +# define mt_type mt_model +# define mt_dsreg mt_status1 +# define mt_erreg mt_status2 + /* + * DGUX hides its flock as dg_flock. + */ +# define HAVE_FLOCK +# define flock dg_flock + /* + * Use the BSD style wait on DGUX to get the resource usages of child + * processes. + */ +# define _BSD_WAIT_FLAVOR +#endif + +/* + * Apple Rhapsody (This is the name for Mac OS X beta) + */ +#if defined(__NeXT__) && defined(__TARGET_OSNAME) && __TARGET_OSNAME == rhapsody +# define HAVE_OSDEF /* prevent later definitions to overwrite current */ +# ifndef IS_UNIX +# define IS_UNIX +# endif +#endif + +/* + * NextStep + */ +#if defined(__NeXT__) && !defined(HAVE_OSDEF) +#define NO_PRINT_OVR +#undef HAVE_USG_STDIO /* + * NeXT Step 3.x uses __flsbuf(unsigned char, FILE *) + * instead of __flsbuf(int, FILE *) + */ +# ifndef IS_UNIX +# define IS_UNIX +# endif +#endif + +/* + * Mac OS X + */ +#if defined(__APPLE__) && defined(__MACH__) +# ifndef IS_UNIX +# define IS_UNIX +# endif +# define IS_MACOS_X +#endif + +/* + * NextStep 3.x has a broken linker that does not allow us to override + * these functions. + */ +#ifndef __OPRINTF__ + +#ifdef NO_PRINT_OVR +# define printf Xprintf +# define fprintf Xfprintf +# define sprintf Xsprintf +#endif + +#endif /* __OPRINTF__ */ + +/*--------------------------------------------------------------------------*/ +/* + * If there is no flock defined by the system, use emulation + * through fcntl record locking. + */ +#ifndef HAVE_FLOCK +#define LOCK_SH 1 /* shared lock */ +#define LOCK_EX 2 /* exclusive lock */ +#define LOCK_NB 4 /* don't block when locking */ +#define LOCK_UN 8 /* unlock */ +#endif + +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif + +/* + * gcc 2.x generally implements the long long type. + */ +#ifdef __GNUC__ +# if __GNUC__ > 1 +# ifndef HAVE_LONGLONG +# define HAVE_LONGLONG +# endif +# endif +#endif + +#ifdef __CHAR_UNSIGNED__ /* GNU GCC define (dynamic) */ +#ifndef CHAR_IS_UNSIGNED +#define CHAR_IS_UNSIGNED /* Sing Schily define (static) */ +#endif +#endif + +/* + * Convert to GNU name + */ +#ifdef HAVE_STDC_HEADERS +# ifndef STDC_HEADERS +# define STDC_HEADERS +# endif +#endif +/* + * Convert to SCHILY name + */ +#ifdef STDC_HEADERS +# ifndef HAVE_STDC_HEADERS +# define HAVE_STDC_HEADERS +# endif +#endif + +#ifdef IS_UNIX +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ':' +# define PATH_ENV_DELIM_STR ":" +# define far +# define near +#endif + +/* + * Win32 with Gygwin + */ +#ifdef IS_GCC_WIN32 +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ':' +# define PATH_ENV_DELIM_STR ":" +# define HAVE_DOS_DRIVELETTER +# define far +# define near +# define NEED_O_BINARY +#endif + +/* + * Win32 with Mingw32 + */ +#ifdef __MINGW32__ +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ';' +# define PATH_ENV_DELIM_STR ";" +# define HAVE_DOS_DRIVELETTER +# define far +# define near +# define NEED_O_BINARY +#endif + +/* + * OS/2 EMX + */ +#ifdef __EMX__ /* We don't want to call it UNIX */ +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ';' +# define PATH_ENV_DELIM_STR ";" +# define HAVE_DOS_DRIVELETTER +# define far +# define near +# define NEED_O_BINARY +#endif + +#ifdef __BEOS__ /* We don't want to call it UNIX */ +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ':' +# define PATH_ENV_DELIM_STR ":" +# define far +# define near +#endif + +/* + * DOS with DJGPP + */ +#ifdef __DJGPP__ /* We don't want to call it UNIX */ +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ';' +# define PATH_ENV_DELIM_STR ";" +# define HAVE_DOS_DRIVELETTER + +# define NEED_O_BINARY +#endif + +/* + * Vanilla DOS + */ +#if defined(IS_MSDOS) && !defined(__DJGPP__) +# define HAVE_PATH_DELIM +# define PATH_DELIM '\\' +# define PATH_DELIM_STR "\\" +# define PATH_ENV_DELIM ';' +# define PATH_ENV_DELIM_STR ";" +# define HAVE_DOS_DRIVELETTER + +# define NEED_O_BINARY +#endif + +/* + * ATARI TOS + */ +#ifdef IS_TOS +# define HAVE_PATH_DELIM +# define PATH_DELIM '\\' +# define PATH_DELIM_STR "\\" +# define PATH_ENV_DELIM ',' +# define PATH_ENV_DELIM_STR "," +# define HAVE_DOS_DRIVELETTER +# define far +# define near +#endif + +/* + * Mac OS 9 + */ +#ifdef IS_MAC +# define HAVE_PATH_DELIM +# define PATH_DELIM ':' +# define PATH_DELIM_STR ":" +# define PATH_ENV_DELIM ';' /* ??? */ +# define PATH_ENV_DELIM_STR ";" /* ??? */ +# define far +# define near +#endif + +/* + * I hope this will make compilation on unknown OS easier. + */ +#ifndef HAVE_PATH_DELIM /* Default to POSIX rules */ +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ':' +# define PATH_ENV_DELIM_STR ":" +# define far +# define near +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _MCONFIG_H */ diff --git a/scsilib/include/mconfig.h.orig b/scsilib/include/mconfig.h.orig new file mode 100644 index 0000000..3ed8acf --- /dev/null +++ b/scsilib/include/mconfig.h.orig @@ -0,0 +1,483 @@ +/* @(#)mconfig.h 1.50 04/07/11 Copyright 1995 J. Schilling */ +/* + * definitions for machine configuration + * + * Copyright (c) 1995 J. Schilling + * + * This file must be included before any other file. + * If this file is not included before stdio.h you will not be + * able to get LARGEFILE support + * + * Use only cpp instructions. + * + * NOTE: SING: (Schily Is Not Gnu) + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _MCONFIG_H +#define _MCONFIG_H + +/* + * Tell our users that this is a Schily SING compile environment. + */ +#define IS_SCHILY + +/* + * This hack that is needed as long as VMS has no POSIX shell. + */ +#ifdef VMS +# define USE_STATIC_CONF +#endif + +#ifdef USE_STATIC_CONF +#include <xmconfig.h> /* This is the current static autoconf stuff */ +#else +#include <xconfig.h> /* This is the current dynamic autoconf stuff */ +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * The NetBSD people want to bother us. + * They removed the definition for 'unix' and are bleating for every test + * for #if defined(unix). So we need to check for NetBSD early. + */ +#ifndef IS_UNIX +# if defined(__NetBSD__) +# define IS_UNIX +# endif +#endif + +#ifndef IS_UNIX +# if (defined(unix) || defined(__unix) || defined(__unix__)) && !defined(__DJGPP__) +# define IS_UNIX +# endif +#endif + +#ifdef __MSDOS__ +# define IS_MSDOS +#endif + +#if defined(tos) || defined(__tos) +# define IS_TOS +#endif + +#ifdef THINK_C +# define IS_MAC +#endif + +#if defined(sun) || defined(__sun) || defined(__sun__) +# define IS_SUN +#endif + +#if defined(__CYGWIN32__) || defined(__CYGWIN__) +# define IS_GCC_WIN32 +# define IS_CYGWIN + +#if defined(unix) || defined(_X86) +# define IS_CYGWIN_1 +#endif +#endif + +/*--------------------------------------------------------------------------*/ +/* + * Some magic that cannot (yet) be figured out with autoconf. + */ + +#if defined(sun3) || defined(mc68000) || defined(mc68020) +# ifndef HAVE_SCANSTACK +# define HAVE_SCANSTACK +# endif +#endif +#ifdef sparc +# ifndef HAVE_LDSTUB +# define HAVE_LDSTUB +# endif +# ifndef HAVE_SCANSTACK +# define HAVE_SCANSTACK +# endif +#endif +#if defined(__i386_) || defined(i386) +# ifndef HAVE_XCHG +# define HAVE_XCHG +# endif +# ifndef HAVE_SCANSTACK +# define HAVE_SCANSTACK +# endif +#endif + +/* + * Use of SCANSTACK is disabled by default + */ +#ifndef USE_SCANSTACK +# undef HAVE_SCANSTACK +#else +/* + * But .... + * The tests are much better now, so always give it a chance. + */ +#ifndef HAVE_SCANSTACK +# define HAVE_SCANSTACK +#endif +#endif + +/* + * Allow to overwrite the defines in the makefiles by calling + * + * make COPTX=-DFORCE_SCANSTACK + */ +#ifdef FORCE_SCANSTACK +# undef NO_SCANSTACK +#ifndef HAVE_SCANSTACK +# define HAVE_SCANSTACK +#endif +#ifndef USE_SCANSTACK +# define USE_SCANSTACK +#endif +#endif + +/* + * This is the global switch to deactivate stack scanning + */ +#ifdef NO_SCANSTACK +# ifdef HAVE_SCANSTACK +# undef HAVE_SCANSTACK +# endif +#endif + +#ifdef NO_FORK +# ifdef HAVE_FORK +# undef HAVE_FORK +# endif +# ifdef HAVE_VFORK +# undef HAVE_VFORK +# endif +#endif +#ifdef NO_VFORK +# ifdef HAVE_VFORK +# undef HAVE_VFORK +# endif +#endif + +#if defined(SOL2) || defined(SOL2) || \ + defined(S5R4) || defined(__S5R4) || defined(SVR4) +# ifndef __SVR4 +# define __SVR4 +# endif +#endif + +#ifdef __SVR4 +# ifndef SVR4 +# define SVR4 +# endif +#endif + +/* + * SunOS 4.x / SunOS 5.x + */ +#if defined(IS_SUN) +# define HAVE_GETAV0 +#endif + +/* + * AIX + */ +#if defined(_IBMR2) || defined(_AIX) +# ifndef IS_UNIX +# define IS_UNIX /* ??? really ??? */ +# endif +#endif + +/* + * QNX + */ +#if defined(__QNX__) +# ifndef IS_UNIX +# define IS_UNIX +# endif +#endif + +/* + * Silicon Graphics (must be before SVR4) + */ +#if defined(sgi) || defined(__sgi) +# define __NOT_SVR4__ /* Not a real SVR4 implementation */ +#endif + +/* + * Data General + */ +#if defined(__DGUX__) +#ifdef XXXXXXX +# undef HAVE_MTGET_DSREG +# undef HAVE_MTGET_RESID +# undef HAVE_MTGET_FILENO +# undef HAVE_MTGET_BLKNO +#endif +# define mt_type mt_model +# define mt_dsreg mt_status1 +# define mt_erreg mt_status2 + /* + * DGUX hides its flock as dg_flock. + */ +# define HAVE_FLOCK +# define flock dg_flock + /* + * Use the BSD style wait on DGUX to get the resource usages of child + * processes. + */ +# define _BSD_WAIT_FLAVOR +#endif + +/* + * Apple Rhapsody (This is the name for Mac OS X beta) + */ +#if defined(__NeXT__) && defined(__TARGET_OSNAME) && __TARGET_OSNAME == rhapsody +# define HAVE_OSDEF /* prevent later definitions to overwrite current */ +# ifndef IS_UNIX +# define IS_UNIX +# endif +#endif + +/* + * NextStep + */ +#if defined(__NeXT__) && !defined(HAVE_OSDEF) +#define NO_PRINT_OVR +#undef HAVE_USG_STDIO /* + * NeXT Step 3.x uses __flsbuf(unsigned char, FILE *) + * instead of __flsbuf(int, FILE *) + */ +# ifndef IS_UNIX +# define IS_UNIX +# endif +#endif + +/* + * Mac OS X + */ +#if defined(__APPLE__) && defined(__MACH__) +# ifndef IS_UNIX +# define IS_UNIX +# endif +# define IS_MACOS_X +#endif + +/* + * NextStep 3.x has a broken linker that does not allow us to override + * these functions. + */ +#ifndef __OPRINTF__ + +#ifdef NO_PRINT_OVR +# define printf Xprintf +# define fprintf Xfprintf +# define sprintf Xsprintf +#endif + +#endif /* __OPRINTF__ */ + +/*--------------------------------------------------------------------------*/ +/* + * If there is no flock defined by the system, use emulation + * through fcntl record locking. + */ +#ifndef HAVE_FLOCK +#define LOCK_SH 1 /* shared lock */ +#define LOCK_EX 2 /* exclusive lock */ +#define LOCK_NB 4 /* don't block when locking */ +#define LOCK_UN 8 /* unlock */ +#endif + +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif + +/* + * gcc 2.x generally implements the long long type. + */ +#ifdef __GNUC__ +# if __GNUC__ > 1 +# ifndef HAVE_LONGLONG +# define HAVE_LONGLONG +# endif +# endif +#endif + +#ifdef __CHAR_UNSIGNED__ /* GNU GCC define (dynamic) */ +#ifndef CHAR_IS_UNSIGNED +#define CHAR_IS_UNSIGNED /* Sing Schily define (static) */ +#endif +#endif + +/* + * Convert to GNU name + */ +#ifdef HAVE_STDC_HEADERS +# ifndef STDC_HEADERS +# define STDC_HEADERS +# endif +#endif +/* + * Convert to SCHILY name + */ +#ifdef STDC_HEADERS +# ifndef HAVE_STDC_HEADERS +# define HAVE_STDC_HEADERS +# endif +#endif + +#ifdef IS_UNIX +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ':' +# define PATH_ENV_DELIM_STR ":" +# define far +# define near +#endif + +/* + * Win32 with Gygwin + */ +#ifdef IS_GCC_WIN32 +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ':' +# define PATH_ENV_DELIM_STR ":" +# define HAVE_DOS_DRIVELETTER +# define far +# define near +# define NEED_O_BINARY +#endif + +/* + * Win32 with Mingw32 + */ +#ifdef __MINGW32__ +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ';' +# define PATH_ENV_DELIM_STR ";" +# define HAVE_DOS_DRIVELETTER +# define far +# define near +# define NEED_O_BINARY +#endif + +/* + * OS/2 EMX + */ +#ifdef __EMX__ /* We don't want to call it UNIX */ +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ';' +# define PATH_ENV_DELIM_STR ";" +# define HAVE_DOS_DRIVELETTER +# define far +# define near +# define NEED_O_BINARY +#endif + +#ifdef __BEOS__ /* We don't want to call it UNIX */ +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ':' +# define PATH_ENV_DELIM_STR ":" +# define far +# define near +#endif + +/* + * DOS with DJGPP + */ +#ifdef __DJGPP__ /* We don't want to call it UNIX */ +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ';' +# define PATH_ENV_DELIM_STR ";" +# define HAVE_DOS_DRIVELETTER + +# define NEED_O_BINARY +#endif + +/* + * Vanilla DOS + */ +#if defined(IS_MSDOS) && !defined(__DJGPP__) +# define HAVE_PATH_DELIM +# define PATH_DELIM '\\' +# define PATH_DELIM_STR "\\" +# define PATH_ENV_DELIM ';' +# define PATH_ENV_DELIM_STR ";" +# define HAVE_DOS_DRIVELETTER + +# define NEED_O_BINARY +#endif + +/* + * ATARI TOS + */ +#ifdef IS_TOS +# define HAVE_PATH_DELIM +# define PATH_DELIM '\\' +# define PATH_DELIM_STR "\\" +# define PATH_ENV_DELIM ',' +# define PATH_ENV_DELIM_STR "," +# define HAVE_DOS_DRIVELETTER +# define far +# define near +#endif + +/* + * Mac OS 9 + */ +#ifdef IS_MAC +# define HAVE_PATH_DELIM +# define PATH_DELIM ':' +# define PATH_DELIM_STR ":" +# define PATH_ENV_DELIM ';' /* ??? */ +# define PATH_ENV_DELIM_STR ";" /* ??? */ +# define far +# define near +#endif + +/* + * I hope this will make compilation on unknown OS easier. + */ +#ifndef HAVE_PATH_DELIM /* Default to POSIX rules */ +# define HAVE_PATH_DELIM +# define PATH_DELIM '/' +# define PATH_DELIM_STR "/" +# define PATH_ENV_DELIM ':' +# define PATH_ENV_DELIM_STR ":" +# define far +# define near +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _MCONFIG_H */ diff --git a/scsilib/include/mmapdefs.h b/scsilib/include/mmapdefs.h new file mode 100644 index 0000000..799f696 --- /dev/null +++ b/scsilib/include/mmapdefs.h @@ -0,0 +1,63 @@ +/* @(#)mmapdefs.h 1.1 01/02/25 Copyright 2001 J. Schilling */ +/* + * Definitions to be used for mmap() + * + * Copyright (c) 2001 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _MMAPDEFS_H +#define _MMAPDEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> +#define _INCL_SYS_TYPES_H +#endif + +#if defined(HAVE_SMMAP) + +#ifndef _INCL_SYS_MMAN_H +#include <sys/mman.h> +#define _INCL_SYS_MMAN_H +#endif + +#ifndef MAP_ANONYMOUS +# ifdef MAP_ANON +# define MAP_ANONYMOUS MAP_ANON +# endif +#endif + +#ifndef MAP_FILE +# define MAP_FILE 0 /* Needed on Apollo Domain/OS */ +#endif + +/* + * Needed for Apollo Domain/OS and may be for others? + */ +#ifdef _MMAP_WITH_SIZEP +# define mmap_sizeparm(s) (&(s)) +#else +# define mmap_sizeparm(s) (s) +#endif + +#endif /* defined(HAVE_SMMAP) */ + +#endif /* _MMAPDEFS_H */ diff --git a/scsilib/include/mtiodefs.h b/scsilib/include/mtiodefs.h new file mode 100644 index 0000000..7565ea4 --- /dev/null +++ b/scsilib/include/mtiodefs.h @@ -0,0 +1,103 @@ +/* @(#)mtiodefs.h 1.4 02/08/26 Copyright 1995,2000-2002 J. Schilling */ +/* + * Generic header for users of magnetic tape ioctl interface. + * + * If there is no local mtio.h or equivalent, define + * simplified mtio definitions here in order + * to be able to do at least remote mtio on systems + * that have no local mtio + * + * Copyright (c) 1995,2000-2002 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _MTIODEFS_H +#define _MTIODEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifdef HAVE_SYS_MTIO_H + +#include <sys/mtio.h> + +#else /* ! HAVE_SYS_MTIO_H */ + + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Definitions for magnetic tape io control commands + */ + +/* + * structure for MTIOCTOP - magnetic tape operation command + */ +struct mtop { + short mt_op; /* op code (see below) */ + daddr_t mt_count; /* repeat count or param */ +}; + +/* + * op code values for mt_op + */ +#define MTWEOF 0 /* write EOF record(s) */ +#define MTFSF 1 /* fwd space over file mark(s) */ +#define MTBSF 2 /* back space over file mark(s) (1/2" only ) */ +#define MTFSR 3 /* fwd space record(s) (to inter-record gap) */ +#define MTBSR 4 /* back space record(s) (to inter-record gap)*/ +#define MTREW 5 /* rewind tape */ +#define MTOFFL 6 /* rewind and put the drive offline */ +#define MTNOP 7 /* no operation (sets status ?) */ + +/* + * structure for MTIOCGET - magnetic tape get status command + */ +struct mtget { + short mt_type; /* type of magnetic tape device */ + /* the next two regs are device dependent */ + short mt_dsreg; /* drive status 'register' */ + short mt_erreg; /* error 'register' */ + daddr_t mt_resid; /* transfer residual count */ + daddr_t mt_fileno; /* file # for current position */ + daddr_t mt_blkno; /* block # for current position */ +}; + +#define HAVE_MTGET_TYPE +#define HAVE_MTGET_DSREG +#define HAVE_MTGET_ERREG +#define HAVE_MTGET_RESID +#define HAVE_MTGET_FILENO +#define HAVE_MTGET_BLKNO + +/* + * Define some junk here as software may assume that these two definitions + * are always present. + */ +#define MTIOCGET 0x12340001 +#define MTIOCTOP 0x12340002 + +#ifdef __cplusplus +} +#endif + +#endif /* HAVE_SYS_MTIO_H */ + +#endif /* _MTIODEFS_H */ diff --git a/scsilib/include/patmatch.h b/scsilib/include/patmatch.h new file mode 100644 index 0000000..96fac4f --- /dev/null +++ b/scsilib/include/patmatch.h @@ -0,0 +1,105 @@ +/* @(#)patmatch.h 1.10 03/08/24 Copyright 1985 J. Schilling */ + +#ifndef _PATMATCH_H +#define _PATMATCH_H +/* + * Definitions for the pattern matching functions. + * + * Copyright (c) 1985,1995 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +/* + * The pattern matching functions are based on the algorithm + * presented by Martin Richards in: + * + * "A Compact Function for Regular Expression Pattern Matching", + * Software-Practice and Experience, Vol. 9, 527-534 (1979) + * + * Several changes have been made to the original source which has been + * written in BCPL: + * + * '/' is replaced by '!' (to allow UNIX filenames) + * '(',')' are replaced by '{', '}' + * '\'' is replaced by '\\' (UNIX compatible quote) + * + * Character classes have been added to allow "[<character list>]" + * to be used. + * Start of line '^' and end of line '$' have been added. + * + * Any number in the following comment is zero or more occurrencies + */ +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#define ALT '!' /* Alternation in match i.e. this!that!the_other */ +#define REP '#' /* Any number of occurrences of the following expr */ +#define NIL '%' /* Empty string (exactly nothing) */ +#define STAR '*' /* Any number of any character (equivalent of #?) */ +#define ANY '?' /* Any one character */ +#define QUOTE '\\' /* Quotes the next character */ +#define LBRACK '{' /* Begin of precedence grouping */ +#define RBRACK '}' /* End of precedence grouping */ +#define LCLASS '[' /* Begin of character set */ +#define RCLASS ']' /* End of character set */ +#define NOT '^' /* If first in set: invert set content */ +#define RANGE '-' /* Range notation in sets */ +#define START '^' /* Begin of a line */ +#define END '$' /* End of a line */ + +/* + * A list of case statements that may be used for a issimple() or ispattern() + * funtion that checks whether a string conrtains characters that need the + * pattern matcher. + * + * Note that this list does not contain NOT or RANGE because you need + * LCLASS and RCLASS in addition. + */ +#define casePAT case ALT: case REP: case NIL: case STAR: case ANY: \ + case QUOTE: case LBRACK: case RBRACK: \ + case LCLASS: case RCLASS: case START: case END: + + +#define MAXPAT 128 /* Maximum length of pattern */ + +extern int patcompile __PR((const unsigned char * __pat, int __patlen, int * __aux)); + +extern unsigned char *opatmatch __PR((const unsigned char * __pat, const int * __aux, + const unsigned char * __str, int __soff, int __slen, + int __alt)); +extern unsigned char *opatlmatch __PR((const unsigned char * __pat, const int * __aux, + const unsigned char * __str, int __soff, int __slen, + int __alt)); +extern unsigned char *patmatch __PR((const unsigned char * __pat, const int * __aux, + const unsigned char * __str, int __soff, int __slen, + int __alt, int __state[])); +extern unsigned char *patlmatch __PR((const unsigned char * __pat, const int * __aux, + const unsigned char * __str, int __soff, int __slen, + int __alt, int __state[])); + +#ifdef __cplusplus +} +#endif + +#endif /* _PATMATCH_H */ diff --git a/scsilib/include/prototyp.h b/scsilib/include/prototyp.h new file mode 100644 index 0000000..45bb9c1 --- /dev/null +++ b/scsilib/include/prototyp.h @@ -0,0 +1,95 @@ +/* @(#)prototyp.h 1.11 03/08/23 Copyright 1995 J. Schilling */ +/* + * Definitions for dealing with ANSI / KR C-Compilers + * + * Copyright (c) 1995 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* + * mconfig.h includes prototype.h so we must do this include before we test + * for _PROTOTYP_H + */ +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifndef _PROTOTYP_H +#define _PROTOTYP_H + +#ifndef PROTOTYPES + /* + * If this has already been defined, + * someone else knows better than us... + */ +# ifdef __STDC__ +# if __STDC__ /* ANSI C */ +# define PROTOTYPES +# endif +# if defined(sun) && __STDC__ - 0 == 0 /* Sun C */ +# define PROTOTYPES +# endif +# endif +#endif /* PROTOTYPES */ + +#if !defined(PROTOTYPES) && (defined(__cplusplus) || defined(_MSC_VER)) + /* + * C++ always supports prototypes. + * Define PROTOTYPES so we are not forced to make + * a separtate autoconf run for C++ + * + * Microsoft C has prototypes but does not define __STDC__ + */ +# define PROTOTYPES +#endif + +/* + * If we have prototypes, we should have stdlib.h string.h stdarg.h + */ +#ifdef PROTOTYPES +#if !(defined(SABER) && defined(sun)) +# ifndef HAVE_STDARG_H +# define HAVE_STDARG_H +# endif +#endif +#ifndef JOS +# ifndef HAVE_STDLIB_H +# define HAVE_STDLIB_H +# endif +# ifndef HAVE_STRING_H +# define HAVE_STRING_H +# endif +# ifndef HAVE_STDC_HEADERS +# define HAVE_STDC_HEADERS +# endif +# ifndef STDC_HEADERS +# define STDC_HEADERS /* GNU name */ +# endif +#endif +#endif + +#ifdef NO_PROTOTYPES /* Force not to use prototypes */ +# undef PROTOTYPES +#endif + +#ifdef PROTOTYPES +# define __PR(a) a +#else +# define __PR(a) () +#endif + +#endif /* _PROTOTYP_H */ diff --git a/scsilib/include/rmtio.h b/scsilib/include/rmtio.h new file mode 100644 index 0000000..b934814 --- /dev/null +++ b/scsilib/include/rmtio.h @@ -0,0 +1,156 @@ +/* @(#)rmtio.h 1.5 03/06/15 Copyright 1995,2000 J. Schilling */ +/* + * Definition for enhanced remote tape IO + * + * Copyright (c) 1995,2000-2002 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _RMTIO_H +#define _RMTIO_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _UTYPES_H +#include <utypes.h> +#endif + +/* + * values for mt_op + */ +#define RMTWEOF 0 /* write an end-of-file record */ +#define RMTFSF 1 /* forward space over file mark */ +#define RMTBSF 2 /* backward space over file mark (1/2" only ) */ +#define RMTFSR 3 /* forward space to inter-record gap */ +#define RMTBSR 4 /* backward space to inter-record gap */ +#define RMTREW 5 /* rewind */ +#define RMTOFFL 6 /* rewind and put the drive offline */ +#define RMTNOP 7 /* no operation, sets status only */ + +#ifdef __needed__ +#define MTRETEN 8 /* retension the tape (cartridge tape only) */ +#define MTERASE 9 /* erase the entire tape */ +#define MTEOM 10 /* position to end of media */ +#define MTNBSF 11 /* backward space file to BOF */ + +#define MTSRSZ 12 /* set record size */ +#define MTGRSZ 13 /* get record size */ +#define MTLOAD 14 /* for loading a tape (use o_delay to open */ + /* the tape device) */ +#endif + +/* + * Definitions for the new RMT Protocol version 1 + * + * The new Protocol version tries to make the use + * of rmtioctl() more portable between different platforms. + */ +#define RMTIVERSION -1 /* Opcode to request version */ +#define RMT_NOVERSION -1 /* Old version code */ +#define RMT_VERSION 1 /* New (current) version code */ + +/* + * Support for commands bejond MTWEOF..MTNOP (0..7) + */ +#define RMTICACHE 0 /* enable controller cache */ +#define RMTINOCACHE 1 /* disable controller cache */ +#define RMTIRETEN 2 /* retension the tape (cartridge tape only) */ +#define RMTIERASE 3 /* erase the entire tape */ +#define RMTIEOM 4 /* position to end of media */ +#define RMTINBSF 5 /* backward space file to BOF */ + +/* + * Old MTIOCGET copies a binary version of struct mtget back + * over the wire. This is highly non portable. + * MTS_* retrieves ascii versions (%d format) of a single + * field in the struct mtget. + * NOTE: MTS_ERREG may only be valid on the first call and + * must be retrived first. + */ +#define MTS_TYPE 'T' /* mtget.mt_type */ +#define MTS_DSREG 'D' /* mtget.mt_dsreg */ +#define MTS_ERREG 'E' /* mtget.mt_erreg */ +#define MTS_RESID 'R' /* mtget.mt_resid */ +#define MTS_FILENO 'F' /* mtget.mt_fileno */ +#define MTS_BLKNO 'B' /* mtget.mt_blkno */ +#define MTS_FLAGS 'f' /* mtget.mt_flags */ +#define MTS_BF 'b' /* mtget.mt_bf */ + +/* + * structure for remote MTIOCGET - mag tape get status command + */ +struct rmtget { + Llong mt_type; /* type of magtape device */ + /* the following two registers are grossly device dependent */ + Llong mt_dsreg; /* ``drive status'' register */ + Int32_t mt_dsreg1; /* ``drive status'' register */ + Int32_t mt_dsreg2; /* ``drive status'' register */ + Llong mt_gstat; /* ``generic status'' register */ + Llong mt_erreg; /* ``error'' register */ + /* optional error info. */ + Llong mt_resid; /* residual count */ + Llong mt_fileno; /* file number of current position */ + Llong mt_blkno; /* block number of current position */ + Llong mt_flags; + Llong mt_gflags; /* generic flags */ + long mt_bf; /* optimum blocking factor */ + int mt_xflags; /* eXistence flags for struct members */ +}; + +/* + * Values for mt_xflags + */ +#define RMT_TYPE 0x0001 /* mt_type/mt_model present */ +#define RMT_DSREG 0x0002 /* mt_dsreg present */ +#define RMT_DSREG1 0x0004 /* mt_dsreg1 present */ +#define RMT_DSREG2 0x0008 /* mt_dsreg2 present */ +#define RMT_GSTAT 0x0010 /* mt_gstat present */ +#define RMT_ERREG 0x0020 /* mt_erreg present */ +#define RMT_RESID 0x0040 /* mt_resid present */ +#define RMT_FILENO 0x0080 /* mt_fileno present */ +#define RMT_BLKNO 0x0100 /* mt_blkno present */ +#define RMT_FLAGS 0x0200 /* mt_flags present */ +#define RMT_BF 0x0400 /* mt_bf present */ +#define RMT_COMPAT 0x0800 /* Created from old compat data */ + +/* + * values for mt_flags + */ +#define RMTF_SCSI 0x01 +#define RMTF_REEL 0x02 +#define RMTF_ASF 0x04 +#define RMTF_TAPE_HEAD_DIRTY 0x08 +#define RMTF_TAPE_CLN_SUPPORTED 0x10 + +/* + * these are recommended + */ +#ifdef __needed__ +#define MT_ISQIC 0x32 /* generic QIC tape drive */ +#define MT_ISREEL 0x33 /* generic reel tape drive */ +#define MT_ISDAT 0x34 /* generic DAT tape drive */ +#define MT_IS8MM 0x35 /* generic 8mm tape drive */ +#define MT_ISOTHER 0x36 /* generic other type of tape drive */ + +/* more Sun devices */ +#define MT_ISTAND25G 0x37 /* sun: SCSI Tandberg 2.5 Gig QIC */ +#define MT_ISDLT 0x38 /* sun: SCSI DLT tape drive */ +#define MT_ISSTK9840 0x39 /* sun: STK 9840 (Ironsides) */ +#endif + +#endif /* _RMTIO_H */ diff --git a/scsilib/include/scg/aspi-dos.h b/scsilib/include/scg/aspi-dos.h new file mode 100644 index 0000000..0affa60 --- /dev/null +++ b/scsilib/include/scg/aspi-dos.h @@ -0,0 +1,155 @@ +#ifndef __ASPI16_H_ +#define __ASPI16_H_ + +#define PACKED __attribute__((packed)) +#define FAR +typedef unsigned char BYTE; +typedef unsigned short WORD; +typedef unsigned long DWORD; + +//***************************************************************************** +// %%% SCSI MISCELLANEOUS EQUATES %%% +//***************************************************************************** + +#define SENSE_LEN 14 // Default sense buffer length +#define SRB_DIR_SCSI 0x00 // Direction determined by SCSI +#define SRB_POSTING 0x01 // Enable ASPI posting +#define SRB_ENABLE_RESIDUAL_COUNT 0x04 // Enable residual byte count reporting +#define SRB_DIR_IN 0x08 // Transfer from SCSI target to host +#define SRB_DIR_OUT 0x10 // Transfer from host to SCSI target + +//***************************************************************************** +// %%% ASPI Command Definitions %%% +//***************************************************************************** + +#define SC_HA_INQUIRY 0x00 // Host adapter inquiry +#define SC_GET_DEV_TYPE 0x01 // Get device type +#define SC_EXEC_SCSI_CMD 0x02 // Execute SCSI command +#define SC_ABORT_SRB 0x03 // Abort an SRB +#define SC_RESET_DEV 0x04 // SCSI bus device reset +#define SC_SET_HA_PARMS 0x05 // Set HA parameters +#define SC_GET_DISK_INFO 0x06 // Get Disk information + +//***************************************************************************** +// %%% SRB Status %%% +//***************************************************************************** + +#define SS_PENDING 0x00 // SRB being processed +#define SS_COMP 0x01 // SRB completed without error +#define SS_ABORTED 0x02 // SRB aborted +#define SS_ABORT_FAIL 0x03 // Unable to abort SRB +#define SS_ERR 0x04 // SRB completed with error + +#define SS_INVALID_CMD 0x80 // Invalid ASPI command +#define SS_INVALID_HA 0x81 // Invalid host adapter number +#define SS_NO_DEVICE 0x82 // SCSI device not installed + +//***************************************************************************** +// %%% Host Adapter Status %%% +//***************************************************************************** + +#define HASTAT_OK 0x00 // Host adapter did not detect an // error +#define HASTAT_SEL_TO 0x11 // Selection Timeout +#define HASTAT_DO_DU 0x12 // Data overrun data underrun +#define HASTAT_BUS_FREE 0x13 // Unexpected bus free +#define HASTAT_PHASE_ERR 0x14 // Target bus phase sequence // failure +#define HASTAT_TIMEOUT 0x09 // Timed out while SRB was waiting to beprocessed. +#define HASTAT_COMMAND_TIMEOUT 0x0B // Adapter timed out processing SRB. +#define HASTAT_MESSAGE_REJECT 0x0D // While processing SRB, the // adapter received a MESSAGE +#define HASTAT_BUS_RESET 0x0E // A bus reset was detected. +#define HASTAT_PARITY_ERROR 0x0F // A parity error was detected. +#define HASTAT_REQUEST_SENSE_FAILED 0x10 // The adapter failed in issuing + +typedef struct { + + BYTE Cmd; // 00/000 ASPI command code = SC_EXEC_SCSI_CMD + BYTE Status; // 01/001 ASPI command status byte + BYTE HaId; // 02/002 ASPI host adapter number + BYTE Flags; // 03/003 ASPI request flags + DWORD Hdr_Rsvd; // 04/004 Reserved, MUST = 0 + + union { + + struct { + + BYTE Count; // 08/008 Number of host adapters present + BYTE SCSI_ID; // 09/009 SCSI ID of host adapter + BYTE ManagerId[16]; // 0A/010 String describing the manager + BYTE Identifier[16]; // 1A/026 String describing the host adapter + BYTE Unique[16]; // 2A/042 Host Adapter Unique parameters + BYTE ExtBuffer[8]; // 3A/058 Extended inquiry data + + } PACKED HAInquiry; + + struct { + + BYTE Target; // 08/008 Target's SCSI ID + BYTE Lun; // 09/009 Target's LUN number + BYTE DeviceType; // 0A/010 Target's peripheral device type + + } PACKED GetDeviceType; + + struct { + + BYTE Target; // 08/008 Target's SCSI ID + BYTE Lun; // 09/009 Target's LUN number + DWORD BufLen; // 0A/010 Data Allocation Length + BYTE SenseLen; // 0E/014 Sense Allocation Length + BYTE FAR *BufPointer; // 0F/015 Data Buffer Pointer + DWORD Rsvd1; // 13/019 Reserved, MUST = 0 + BYTE CDBLen; // 17/023 CDB Length = 6/10/12 + BYTE HaStat; // 18/024 Host Adapter Status + BYTE TargStat; // 19/025 Target Status + VOID FAR *PostProc; // 1A/026 Post routine + BYTE Rsvd2[34]; // 1E/030 Reserved, MUST = 0 + + union { + + struct { + + BYTE CDBByte[6]; // 40/064 SCSI CDB + BYTE SenseArea[SENSE_LEN+2]; // 46/070 Request Sense buffer + + } PACKED _6; + + struct { + + BYTE CDBByte[10]; // 40/064 SCSI CDB + BYTE SenseArea[SENSE_LEN+2]; // 4A/074 Request Sense buffer + + } PACKED _10; + + struct { + + BYTE CDBByte[12]; // 40/064 SCSI CDB + BYTE SenseArea[SENSE_LEN+2]; // 4C/076 Request Sense buffer + + } PACKED _12; + + } PACKED CmdLen; + + } PACKED ExecSCSICmd; + + struct { + + VOID FAR *SRBToAbort; // 08/008 Pointer to SRB to abort + + } PACKED Abort; + + struct { + + BYTE Target; // 08/008 Target's SCSI ID + BYTE Lun; // 09/009 Target's LUN number + BYTE ResetRsvd1[14]; // 0A/010 Reserved, MUST = 0 + BYTE HaStat; // 18/024 Host Adapter Status + BYTE TargStat; // 19/025 Target Status + VOID FAR *PostProc; // 1A/026 Post routine + BYTE ResetRsvd2[34]; // 1E/030 Reserved, MUST = 0 + + } Reset; + + } PACKED Type; + + } PACKED SRB; + +#endif //__ASPI16_H_ diff --git a/scsilib/include/scg/aspi-win32.h b/scsilib/include/scg/aspi-win32.h new file mode 100644 index 0000000..02fb5ef --- /dev/null +++ b/scsilib/include/scg/aspi-win32.h @@ -0,0 +1,196 @@ +#ifndef __ASPI_WIN32_H_ +#define __ASPI_WIN32_H_ + +#include <Windows.h> + +/*************************************************************************** + ** SCSI MISCELLANEOUS EQUATES + ***************************************************************************/ +#define SENSE_LEN 14 /* Default sense buffer length */ +#define SRB_DIR_SCSI 0x00 /* Direction determined by SCSI */ +#define SRB_POSTING 0x01 /* Enable ASPI posting */ +#define SRB_ENABLE_RESIDUAL_COUNT 0x04 /* Enable residual byte count */ + /* reporting */ +#define SRB_DIR_IN 0x08 /* Transfer from SCSI target to */ + /* host */ +#define SRB_DIR_OUT 0x10 /* Transfer from host to SCSI */ + /* target */ +#define SRB_EVENT_NOTIFY 0x40 /* Enable ASPI event notification */ +#define RESIDUAL_COUNT_SUPPORTED 0x02 /* Extended buffer flag */ +#define MAX_SRB_TIMEOUT 1080001u /* 30 hour maximum timeout in sec */ +#define DEFAULT_SRB_TIMEOUT 1080001u /* use max.timeout by default */ + +/*************************************************************************** + ** ASPI command definitions + ***************************************************************************/ +#define SC_HA_INQUIRY 0x00 /* Host adapter inquiry */ +#define SC_GET_DEV_TYPE 0x01 /* Get device type */ +#define SC_EXEC_SCSI_CMD 0x02 /* Execute SCSI command */ +#define SC_ABORT_SRB 0x03 /* Abort an SRB */ +#define SC_RESET_DEV 0x04 /* SCSI bus device reset */ +#define SC_SET_HA_PARMS 0x05 /* Set HA parameters */ +#define SC_GET_DISK_INFO 0x06 /* Get Disk */ +#define SC_RESCAN_SCSI_BUS 0x07 /* Rebuild SCSI device map */ +#define SC_GETSET_TIMEOUTS 0x08 /* Get/Set target timeouts */ + + +/*************************************************************************** + ** SRB Status + ***************************************************************************/ +#define SS_PENDING 0x00 /* SRB being processed */ +#define SS_COMP 0x01 /* SRB completed without error */ +#define SS_ABORTED 0x02 /* SRB aborted */ +#define SS_ABORT_FAIL 0x03 /* Unable to abort SRB */ +#define SS_ERR 0x04 /* SRB completed with error */ +#define SS_INVALID_CMD 0x80 /* Invalid ASPI command */ +#define SS_INVALID_HA 0x81 /* Invalid host adapter number */ +#define SS_NO_DEVICE 0x82 /* SCSI device not installed */ +#define SS_INVALID_SRB 0xE0 /* Invalid parameter set in SRB */ +#define SS_OLD_MANAGER 0xE1 /* ASPI manager doesn't support */ + /* windows */ +#define SS_BUFFER_ALIGN 0xE1 /* Buffer not aligned (replaces */ + /* SS_OLD_MANAGER in Win32) */ +#define SS_ILLEGAL_MODE 0xE2 /* Unsupported Windows mode */ +#define SS_NO_ASPI 0xE3 /* No ASPI managers */ +#define SS_FAILED_INIT 0xE4 /* ASPI for windows failed init */ +#define SS_ASPI_IS_BUSY 0xE5 /* No resources available to */ + /* execute command */ +#define SS_BUFFER_TO_BIG 0xE6 /* Buffer size too big to handle */ +#define SS_BUFFER_TOO_BIG 0xE6 /* Correct spelling of 'too' */ +#define SS_MISMATCHED_COMPONENTS 0xE7 /* The DLLs/EXEs of ASPI don't */ + /* version check */ +#define SS_NO_ADAPTERS 0xE8 /* No host adapters to manager */ +#define SS_INSUFFICIENT_RESOURCES 0xE9 /* Couldn't allocate resources */ + /* needed to init */ +#define SS_ASPI_IS_SHUTDOWN 0xEA /* Call came to ASPI after */ + /* PROCESS_DETACH */ +#define SS_BAD_INSTALL 0xEB /* The DLL or other components */ + /* are installed wrong */ + +/*************************************************************************** + ** Host Adapter Status + ***************************************************************************/ +#define HASTAT_OK 0x00 /* No error detected by HA */ +#define HASTAT_SEL_TO 0x11 /* Selection Timeout */ +#define HASTAT_DO_DU 0x12 /* Data overrun/data underrun */ +#define HASTAT_BUS_FREE 0x13 /* Unexpected bus free */ +#define HASTAT_PHASE_ERR 0x14 /* Target bus phase sequence */ +#define HASTAT_TIMEOUT 0x09 /* Timed out while SRB was */ + /* waiting to be processed */ +#define HASTAT_COMMAND_TIMEOUT 0x0B /* Adapter timed out while */ + /* processing SRB */ +#define HASTAT_MESSAGE_REJECT 0x0D /* While processing the SRB, the */ + /* adapter received a MESSAGE */ +#define HASTAT_BUS_RESET 0x0E /* A bus reset was detected */ +#define HASTAT_PARITY_ERROR 0x0F /* A parity error was detected */ +#define HASTAT_REQUEST_SENSE_FAILED 0x10 /* The adapter failed in issuing */ + + +/*************************************************************************** + ** SRB - HOST ADAPTER INQUIRIY - SC_HA_INQUIRY (0) + ***************************************************************************/ +typedef struct { + BYTE SRB_Cmd; /* 00/000 ASPI command code == SC_HA_INQUIRY */ + BYTE SRB_Status; /* 01/001 ASPI command status byte */ + BYTE SRB_HaId; /* 02/002 ASPI host adapter number */ + BYTE SRB_Flags; /* 03/003 ASPI request flags */ + DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */ + BYTE HA_Count; /* 08/008 Number of host adapters present */ + BYTE HA_SCSI_ID; /* 09/009 SCSI ID of host adapter */ + BYTE HA_ManagerId[16]; /* 0a/010 String describing the manager */ + BYTE HA_Identifier[16]; /* 1a/026 String describing the host adapter */ + BYTE HA_Unique[16]; /* 2a/042 Host Adapter Unique parameters */ + WORD HA_Rsvd1; /* 3a/058 Reserved, must = 0 */ +} PACKED SRB_HAInquiry, *PSRB_HAInquiry, FAR *LPSRB_HAInquiry; + + +/*************************************************************************** + ** SRB - GET DEVICE TYPE - SC_GET_DEV_TYPE (1) + ***************************************************************************/ +typedef struct +{ + BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_GET_DEV_TYPE */ + BYTE SRB_Status; /* 01/001 ASPI command status byte */ + BYTE SRB_HaId; /* 02/002 ASPI host adapter number */ + BYTE SRB_Flags; /* 03/003 Reserved, must = 0 */ + DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */ + BYTE SRB_Target; /* 08/008 Target's SCSI ID */ + BYTE SRB_Lun; /* 09/009 Target's LUN number */ + BYTE SRB_DeviceType; /* 0a/010 Target's peripheral device type */ + BYTE SRB_Rsvd1; /* 0b/011 Reserved, must = 0 */ +} PACKED SRB_GDEVBlock, *PSRB_GDEVBlock, FAR *LPSRB_GDEVBlock; + + +/*************************************************************************** + ** SRB - EXECUTE SCSI COMMAND - SC_EXEC_SCSI_CMD (2) + ***************************************************************************/ +typedef struct +{ + BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_EXEC_SCSI_CMD */ + BYTE SRB_Status; /* 01/001 ASPI command status byte */ + BYTE SRB_HaId; /* 02/002 ASPI host adapter number */ + BYTE SRB_Flags; /* 03/003 Reserved, must = 0 */ + DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */ + BYTE SRB_Target; /* 08/008 Target's SCSI ID */ + BYTE SRB_Lun; /* 09/009 Target's LUN */ + WORD SRB_Rsvd1; /* 0a/010 Reserved for alignment */ + DWORD SRB_BufLen; /* 0c/012 Data Allocation Length */ + BYTE FAR *SRB_BufPointer; /* 10/016 Data Buffer Pointer */ + BYTE SRB_SenseLen; /* 14/020 Sense Allocation Length */ + BYTE SRB_CDBLen; /* 15/021 CDB Length */ + BYTE SRB_HaStat; /* 16/022 Host Adapter Status */ + BYTE SRB_TargStat; /* 17/023 Target Status */ + VOID FAR *SRB_PostProc; /* 18/024 Post routine */ + BYTE SRB_Rsvd2[20]; /* 1c/028 Reserved, must = 0 */ + BYTE CDBByte[16]; /* 30/048 SCSI CDB */ + BYTE SenseArea[SENSE_LEN+2]; /* 40/064 Request Sense buffer */ +} PACKED SRB_ExecSCSICmd, *PSRB_ExecSCSICmd, FAR *LPSRB_ExecSCSICmd; + + +typedef struct +{ + BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_ABORT_SRB */ + BYTE SRB_Status; /* 01/001 ASPI command status byte */ + BYTE SRB_HaId; /* 02/002 ASPI host adapter number */ + BYTE SRB_Flags; /* 03/003 Reserved, must = 0 */ + DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */ + void *SRB_ToAbort; /* 08/008 Pointer to SRB to abort */ +} PACKED SRB_Abort, *PSRB_Abort, FAR *LPSRB_Abort; + + +/*************************************************************************** + ** SRB - BUS DEVICE RESET - SC_RESET_DEV (4) + ***************************************************************************/ +typedef struct +{ + BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_RESET_DEV */ + BYTE SRB_Status; /* 01/001 ASPI command status byte */ + BYTE SRB_HaId; /* 02/002 ASPI host adapter number */ + DWORD SRB_Flags; /* 04/004 Reserved */ + BYTE SRB_Target; /* 08/008 Target's SCSI ID */ + BYTE SRB_Lun; /* 09/009 Target's LUN number */ + BYTE SRB_Rsvd1[12]; /* 0A/010 Reserved for alignment */ + BYTE SRB_HaStat; /* 16/022 Host Adapter Status */ + BYTE SRB_TargStat; /* 17/023 Target Status */ + VOID FAR *SRB_PostProc; /* 18/024 Post routine */ + BYTE SRB_Rsvd2[36]; /* 1C/028 Reserved, must = 0 */ +} SRB_BusDeviceReset, *PSRB_BusDeviceReset, FAR *LPSRB_BusDeviceReset; + +typedef struct tag_ASPI32BUFF +{ + PBYTE AB_BufPointer; + DWORD AB_BufLen; + DWORD AB_ZeroFill; + DWORD AB_Reserved; +} PACKED ASPI32BUFF, *PASPI32BUFF, FAR *LPASPI32BUFF; + +typedef struct +{ + BYTE SRB_Cmd; + BYTE SRB_Status; + BYTE SRB_HaId; + BYTE SRB_Flags; + DWORD SRB_Hdr_Rsvd; +} SRB, *PSRB, FAR *LPSRB; + +#endif diff --git a/scsilib/include/scg/scgcmd.h b/scsilib/include/scg/scgcmd.h new file mode 100644 index 0000000..4ce801b --- /dev/null +++ b/scsilib/include/scg/scgcmd.h @@ -0,0 +1,200 @@ +/* @(#)scgcmd.h 2.22 04/09/04 Copyright 1986 J. Schilling */ +/* + * Definitions for the SCSI 'scg_cmd' structure that has been created + * for the SCSI general driver 'scg' for SunOS and Solaris but + * now is used for wrapping general libscg SCSI transport requests. + * + * Copyright (c) 1986 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _SCG_SCGCMD_H +#define _SCG_SCGCMD_H + +#include <utypes.h> +#include <btorder.h> + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ +#else +# if defined(_BIT_FIELDS_HTOL) /* Motorola byteorder */ +# else +/* + * #error will not work for all compilers (e.g. sunos4) + * The following line will abort compilation on all compilers + * if none of the above is defines. And that's what we want. + */ +error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined +# endif +#endif + +#include <scg/scsisense.h> +#include <scg/scsicdb.h> +#include <intcvt.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Leave these definitions here if possible to avoid the need to + * include scsireg.h which makes problems on some OS because these + * OS define the same types as in scsireg.h + */ + +/* + * SCSI status bits. + */ +#define ST_VU_00 0x01 /* Vendor unique */ +#define ST_CHK_COND 0x02 /* Check condition */ +#define ST_COND_MET 0x04 /* Condition met */ +#define ST_BUSY 0x08 /* Busy */ +#define ST_IS_SEND 0x10 /* Intermediate status send */ +#define ST_VU_05 0x20 /* Vendor unique */ +#define ST_VU_06 0x40 /* Vendor unique */ +#define ST_RSVD_07 0x80 /* Reserved */ + +/* + * Sense key values for extended sense. + */ +#define SC_NO_SENSE 0x00 +#define SC_RECOVERABLE_ERROR 0x01 +#define SC_NOT_READY 0x02 +#define SC_MEDIUM_ERROR 0x03 +#define SC_HARDWARE_ERROR 0x04 +#define SC_ILLEGAL_REQUEST 0x05 +#define SC_UNIT_ATTENTION 0x06 +#define SC_WRITE_PROTECT 0x07 +#define SC_BLANK_CHECK 0x08 +#define SC_VENDOR_UNIQUE 0x09 +#define SC_COPY_ABORTED 0x0A +#define SC_ABORTED_COMMAND 0x0B +#define SC_EQUAL 0x0C +#define SC_VOLUME_OVERFLOW 0x0D +#define SC_MISCOMPARE 0x0E +#define SC_RESERVED 0x0F + +/* + * Messages that SCSI can send. + */ +#define SC_COMMAND_COMPLETE 0x00 +#define SC_SYNCHRONOUS 0x01 +#define SC_SAVE_DATA_PTR 0x02 +#define SC_RESTORE_PTRS 0x03 +#define SC_DISCONNECT 0x04 +#define SC_ABORT 0x06 +#define SC_MSG_REJECT 0x07 +#define SC_NO_OP 0x08 +#define SC_PARITY 0x09 +#define SC_IDENTIFY 0x80 +#define SC_DR_IDENTIFY 0xc0 +#define SC_DEVICE_RESET 0x0c + +#define SC_G0_CDBLEN 6 /* Len of Group 0 commands */ +#define SC_G1_CDBLEN 10 /* Len of Group 1 commands */ +#define SC_G5_CDBLEN 12 /* Len of Group 5 commands */ + +#define SCG_MAX_CMD 24 /* 24 bytes max. size is supported */ +#define SCG_MAX_STATUS 3 /* XXX (sollte 4 allign.) Mamimum Status Len */ +#define SCG_MAX_SENSE 32 /* Mamimum Sense Len for auto Req. Sense */ + +#define DEF_SENSE_LEN 16 /* Default Sense Len */ +#define CCS_SENSE_LEN 18 /* Sense Len for CCS compatible devices */ + +struct scg_cmd { + caddr_t addr; /* Address of data in user space */ + int size; /* DMA count for data transfer */ + int flags; /* see below for definition */ + int cdb_len; /* Size of SCSI command in bytes */ + /* NOTE: rel 4 uses this field only */ + /* with commands not in group 1 or 2*/ + int sense_len; /* for intr() if -1 don't get sense */ + int timeout; /* timeout in seconds */ + /* NOTE: actual resolution depends */ + /* on driver implementation */ + int kdebug; /* driver kernel debug level */ + int resid; /* Bytes not transfered */ + int error; /* Error code from scgintr() */ + int ux_errno; /* UNIX error code */ +#ifdef comment +XXX struct scsi_status scb; ??? /* Status returnd by command */ +#endif + union { + struct scsi_status Scb; /* Status returnd by command */ + Uchar cmd_scb[SCG_MAX_STATUS]; + } u_scb; +#define scb u_scb.Scb +#ifdef comment +XXX struct scsi_sense sense; ??? /* Sense bytes from command */ +#endif + union { + struct scsi_sense Sense; /* Sense bytes from command */ + Uchar cmd_sense[SCG_MAX_SENSE]; + } u_sense; +#define sense u_sense.Sense + int sense_count; /* Number of bytes valid in sense */ + int target; /* SCSI target id */ + /* NOTE: The SCSI target id field */ + /* does not need to be filled unless */ + /* the low level transport is a real */ + /* scg driver. In this case the low */ + /* level transport routine of libscg */ + /* will fill in the needed value */ + union { /* SCSI command descriptor block */ + struct scsi_g0cdb g0_cdb; + struct scsi_g1cdb g1_cdb; + struct scsi_g5cdb g5_cdb; + Uchar cmd_cdb[SCG_MAX_CMD]; + } cdb; /* 24 bytes max. size is supported */ +}; + +#define dma_read flags /* 1 if DMA to Sun, 0 otherwise */ + +/* + * definition for flags field in scg_cmd struct + */ +#define SCG_RECV_DATA 0x0001 /* DMA direction to Sun */ +#define SCG_DISRE_ENA 0x0002 /* enable disconnect/reconnect */ +#define SCG_SILENT 0x0004 /* be silent on errors */ +#define SCG_CMD_RETRY 0x0008 /* enable retries */ +#define SCG_NOPARITY 0x0010 /* disable parity for this command */ + +/* + * definition for error field in scg_cmd struct + * + * The codes refer to SCSI general errors, not to device + * specific errors. Device specific errors are discovered + * by checking the sense data. + * The distinction between retryable and fatal is somewhat ad hoc. + */ +#define SCG_NO_ERROR 0 /* cdb transported without error */ + /* SCG_NO_ERROR incudes all commands */ + /* where the SCSI status is valid */ + +#define SCG_RETRYABLE 1 /* any other case e.g. SCSI bus busy */ + /* SCSI cdb could not be send, */ + /* includes DMA errors other than */ + /* DMA underrun */ + +#define SCG_FATAL 2 /* could not select target */ +#define SCG_TIMEOUT 3 /* driver timed out */ + + +#ifdef __cplusplus +} +#endif + +#endif /* _SCG_SCGCMD_H */ diff --git a/scsilib/include/scg/scgio.h b/scsilib/include/scg/scgio.h new file mode 100644 index 0000000..0080656 --- /dev/null +++ b/scsilib/include/scg/scgio.h @@ -0,0 +1,68 @@ +/* @(#)scgio.h 2.16 00/11/07 Copyright 1986 J. Schilling */ +/* + * Definitions for the SCSI general driver 'scg' + * + * Copyright (c) 1986 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _SCG_SCGIO_H +#define _SCG_SCGIO_H + +#ifndef _SCG_SCGCMD_H +#include <scg/scgcmd.h> +#endif + +#if defined(SVR4) +#include <sys/ioccom.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) || defined(SVR4) +#define SCGIOCMD _IOWR('G', 1, struct scg_cmd) /* do a SCSI cmd */ +#define SCGIORESET _IO('G', 2) /* reset SCSI bus */ +#define SCGIOGDISRE _IOR('G', 4, int) /* get sc disre Val*/ +#define SCGIOSDISRE _IOW('G', 5, int) /* set sc disre Val*/ +#define SCGIOIDBG _IO('G', 100) /* Inc Debug Val */ +#define SCGIODDBG _IO('G', 101) /* Dec Debug Val */ +#define SCGIOGDBG _IOR('G', 102, int) /* get Debug Val */ +#define SCGIOSDBG _IOW('G', 103, int) /* set Debug Val */ +#define SCIOGDBG _IOR('G', 104, int) /* get sc Debug Val*/ +#define SCIOSDBG _IOW('G', 105, int) /* set sc Debug Val*/ +#else +#define SCGIOCMD _IOWR(G, 1, struct scg_cmd) /* do a SCSI cmd */ +#define SCGIORESET _IO(G, 2) /* reset SCSI bus */ +#define SCGIOGDISRE _IOR(G, 4, int) /* get sc disre Val*/ +#define SCGIOSDISRE _IOW(G, 5, int) /* set sc disre Val*/ +#define SCGIOIDBG _IO(G, 100) /* Inc Debug Val */ +#define SCGIODDBG _IO(G, 101) /* Dec Debug Val */ +#define SCGIOGDBG _IOR(G, 102, int) /* get Debug Val */ +#define SCGIOSDBG _IOW(G, 103, int) /* set Debug Val */ +#define SCIOGDBG _IOR(G, 104, int) /* get sc Debug Val*/ +#define SCIOSDBG _IOW(G, 105, int) /* set sc Debug Val*/ +#endif + +#define SCGIO_CMD SCGIOCMD /* backward ccompatibility */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SCG_SCGIO_H */ diff --git a/scsilib/include/scg/scgops.h b/scsilib/include/scg/scgops.h new file mode 100644 index 0000000..7df3897 --- /dev/null +++ b/scsilib/include/scg/scgops.h @@ -0,0 +1,69 @@ +/* @(#)scgops.h 1.5 02/10/19 Copyright 2000 J. Schilling */ +/* + * Copyright (c) 2000 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _SCG_SCGOPS_H +#define _SCG_SCGOPS_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct scg_ops { + int (*scgo_send) __PR((SCSI *scgp)); + + char * (*scgo_version) __PR((SCSI *scgp, int what)); +#ifdef EOF /* stdio.h has been included */ + int (*scgo_help) __PR((SCSI *scgp, FILE *f)); +#else + int (*scgo_help) __PR((SCSI *scgp, void *f)); +#endif + int (*scgo_open) __PR((SCSI *scgp, char *device)); + int (*scgo_close) __PR((SCSI *scgp)); + long (*scgo_maxdma) __PR((SCSI *scgp, long amt)); + void * (*scgo_getbuf) __PR((SCSI *scgp, long amt)); + void (*scgo_freebuf) __PR((SCSI *scgp)); + + + BOOL (*scgo_havebus) __PR((SCSI *scgp, int busno)); + int (*scgo_fileno) __PR((SCSI *scgp, int busno, int tgt, int tlun)); + int (*scgo_initiator_id) __PR((SCSI *scgp)); + int (*scgo_isatapi) __PR((SCSI *scgp)); + int (*scgo_reset) __PR((SCSI *scgp, int what)); +} scg_ops_t; + +#define SCGO_SEND(scgp) (*(scgp)->ops->scgo_send)(scgp) +#define SCGO_VERSION(scgp, what) (*(scgp)->ops->scgo_version)(scgp, what) +#define SCGO_HELP(scgp, f) (*(scgp)->ops->scgo_help)(scgp, f) +#define SCGO_OPEN(scgp, device) (*(scgp)->ops->scgo_open)(scgp, device) +#define SCGO_CLOSE(scgp) (*(scgp)->ops->scgo_close)(scgp) +#define SCGO_MAXDMA(scgp, amt) (*(scgp)->ops->scgo_maxdma)(scgp, amt) +#define SCGO_GETBUF(scgp, amt) (*(scgp)->ops->scgo_getbuf)(scgp, amt) +#define SCGO_FREEBUF(scgp) (*(scgp)->ops->scgo_freebuf)(scgp) +#define SCGO_HAVEBUS(scgp, busno) (*(scgp)->ops->scgo_havebus)(scgp, busno) +#define SCGO_FILENO(scgp, busno, tgt, tlun) (*(scgp)->ops->scgo_fileno)(scgp, busno, tgt, tlun) +#define SCGO_INITIATOR_ID(scgp) (*(scgp)->ops->scgo_initiator_id)(scgp) +#define SCGO_ISATAPI(scgp) (*(scgp)->ops->scgo_isatapi)(scgp) +#define SCGO_RESET(scgp, what) (*(scgp)->ops->scgo_reset)(scgp, what) + +#ifdef __cplusplus +} +#endif + +#endif /* _SCG_SCGOPS_H */ diff --git a/scsilib/include/scg/scsicdb.h b/scsilib/include/scg/scsicdb.h new file mode 100644 index 0000000..55e8188 --- /dev/null +++ b/scsilib/include/scg/scsicdb.h @@ -0,0 +1,249 @@ +/* @(#)scsicdb.h 2.19 04/09/04 Copyright 1986 J. Schilling */ +/* + * Definitions for the SCSI Command Descriptor Block + * + * Copyright (c) 1986 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _SCG_SCSICDB_H +#define _SCG_SCSICDB_H + +#ifndef _UTYPES_H +#include <utypes.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif +/* + * SCSI Operation codes. + */ +#define SC_TEST_UNIT_READY 0x00 +#define SC_REZERO_UNIT 0x01 +#define SC_REQUEST_SENSE 0x03 +#define SC_FORMAT 0x04 +#define SC_FORMAT_TRACK 0x06 +#define SC_REASSIGN_BLOCK 0x07 /* CCS only */ +#define SC_SEEK 0x0b +#define SC_TRANSLATE 0x0f /* ACB4000 only */ +#define SC_INQUIRY 0x12 /* CCS only */ +#define SC_MODE_SELECT 0x15 +#define SC_RESERVE 0x16 +#define SC_RELEASE 0x17 +#define SC_MODE_SENSE 0x1a +#define SC_START 0x1b +#define SC_READ_DEFECT_LIST 0x37 /* CCS only, group 1 */ +#define SC_READ_BUFFER 0x3c /* CCS only, group 1 */ + /* + * Note, these two commands use identical command blocks for all + * controllers except the Adaptec ACB 4000 which sets bit 1 of byte 1. + */ +#define SC_READ 0x08 +#define SC_WRITE 0x0a +#define SC_EREAD 0x28 /* 10 byte read */ +#define SC_EWRITE 0x2a /* 10 byte write */ +#define SC_WRITE_VERIFY 0x2e /* 10 byte write+verify */ +#define SC_WRITE_FILE_MARK 0x10 +#define SC_UNKNOWN 0xff /* cmd list terminator */ + + +/* + * Standard SCSI control blocks. + * These go in or out over the SCSI bus. + */ + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_g0cdb { /* scsi group 0 command description block */ + Uchar cmd; /* command code */ + Ucbit high_addr : 5; /* high part of block address */ + Ucbit lun : 3; /* logical unit number */ + Uchar mid_addr; /* middle part of block address */ + Uchar low_addr; /* low part of block address */ + Uchar count; /* transfer length */ + Ucbit link : 1; /* link (another command follows) */ + Ucbit fr : 1; /* flag request (interrupt at completion) */ + Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */ + Ucbit rsvd : 3; /* reserved */ + Ucbit vu_56 : 1; /* vendor unique (byte 5 bit 6) */ + Ucbit vu_57 : 1; /* vendor unique (byte 5 bit 7) */ +}; + +#else /* Motorola byteorder */ + +struct scsi_g0cdb { /* scsi group 0 command description block */ + Uchar cmd; /* command code */ + Ucbit lun : 3; /* logical unit number */ + Ucbit high_addr : 5; /* high part of block address */ + Uchar mid_addr; /* middle part of block address */ + Uchar low_addr; /* low part of block address */ + Uchar count; /* transfer length */ + Ucbit vu_57 : 1; /* vendor unique (byte 5 bit 7) */ + Ucbit vu_56 : 1; /* vendor unique (byte 5 bit 6) */ + Ucbit rsvd : 3; /* reserved */ + Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */ + Ucbit fr : 1; /* flag request (interrupt at completion) */ + Ucbit link : 1; /* link (another command follows) */ +}; +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_g1cdb { /* scsi group 1 command description block */ + Uchar cmd; /* command code */ + Ucbit reladr : 1; /* address is relative */ + Ucbit res : 4; /* reserved bits 1-4 of byte 1 */ + Ucbit lun : 3; /* logical unit number */ + Uchar addr[4]; /* logical block address */ + Uchar res6; /* reserved byte 6 */ + Uchar count[2]; /* transfer length */ + Ucbit link : 1; /* link (another command follows) */ + Ucbit fr : 1; /* flag request (interrupt at completion) */ + Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */ + Ucbit rsvd : 3; /* reserved */ + Ucbit vu_96 : 1; /* vendor unique (byte 5 bit 6) */ + Ucbit vu_97 : 1; /* vendor unique (byte 5 bit 7) */ +}; + +#else /* Motorola byteorder */ + +struct scsi_g1cdb { /* scsi group 1 command description block */ + Uchar cmd; /* command code */ + Ucbit lun : 3; /* logical unit number */ + Ucbit res : 4; /* reserved bits 1-4 of byte 1 */ + Ucbit reladr : 1; /* address is relative */ + Uchar addr[4]; /* logical block address */ + Uchar res6; /* reserved byte 6 */ + Uchar count[2]; /* transfer length */ + Ucbit vu_97 : 1; /* vendor unique (byte 5 bit 7) */ + Ucbit vu_96 : 1; /* vendor unique (byte 5 bit 6) */ + Ucbit rsvd : 3; /* reserved */ + Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */ + Ucbit fr : 1; /* flag request (interrupt at completion) */ + Ucbit link : 1; /* link (another command follows) */ +}; +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_g5cdb { /* scsi group 5 command description block */ + Uchar cmd; /* command code */ + Ucbit reladr : 1; /* address is relative */ + Ucbit res : 4; /* reserved bits 1-4 of byte 1 */ + Ucbit lun : 3; /* logical unit number */ + Uchar addr[4]; /* logical block address */ + Uchar count[4]; /* transfer length */ + Uchar res10; /* reserved byte 10 */ + Ucbit link : 1; /* link (another command follows) */ + Ucbit fr : 1; /* flag request (interrupt at completion) */ + Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */ + Ucbit rsvd : 3; /* reserved */ + Ucbit vu_B6 : 1; /* vendor unique (byte B bit 6) */ + Ucbit vu_B7 : 1; /* vendor unique (byte B bit 7) */ +}; + +#else /* Motorola byteorder */ + +struct scsi_g5cdb { /* scsi group 5 command description block */ + Uchar cmd; /* command code */ + Ucbit lun : 3; /* logical unit number */ + Ucbit res : 4; /* reserved bits 1-4 of byte 1 */ + Ucbit reladr : 1; /* address is relative */ + Uchar addr[4]; /* logical block address */ + Uchar count[4]; /* transfer length */ + Uchar res10; /* reserved byte 10 */ + Ucbit vu_B7 : 1; /* vendor unique (byte B bit 7) */ + Ucbit vu_B6 : 1; /* vendor unique (byte B bit 6) */ + Ucbit rsvd : 3; /* reserved */ + Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */ + Ucbit fr : 1; /* flag request (interrupt at completion) */ + Ucbit link : 1; /* link (another command follows) */ +}; +#endif + +#define g0_cdbaddr(cdb, a) ((cdb)->high_addr = (a) >> 16,\ + (cdb)->mid_addr = ((a) >> 8) & 0xFF,\ + (cdb)->low_addr = (a) & 0xFF) + +#define g1_cdbaddr(cdb, a) ((cdb)->addr[0] = (a) >> 24,\ + (cdb)->addr[1] = ((a) >> 16)& 0xFF,\ + (cdb)->addr[2] = ((a) >> 8) & 0xFF,\ + (cdb)->addr[3] = (a) & 0xFF) + +#define g5_cdbaddr(cdb, a) g1_cdbaddr(cdb, a) + + +#define g0_cdblen(cdb, len) ((cdb)->count = (len)) + +#define g1_cdblen(cdb, len) ((cdb)->count[0] = ((len) >> 8) & 0xFF,\ + (cdb)->count[1] = (len) & 0xFF) + +#define g5_cdblen(cdb, len) ((cdb)->count[0] = (len) >> 24L,\ + (cdb)->count[1] = ((len) >> 16L)& 0xFF,\ + (cdb)->count[2] = ((len) >> 8L) & 0xFF,\ + (cdb)->count[3] = (len) & 0xFF) + +/*#define XXXXX*/ +#ifdef XXXXX +#define i_to_long(a, i) (((Uchar *)(a))[0] = ((i) >> 24)& 0xFF,\ + ((Uchar *)(a))[1] = ((i) >> 16)& 0xFF,\ + ((Uchar *)(a))[2] = ((i) >> 8) & 0xFF,\ + ((Uchar *)(a))[3] = (i) & 0xFF) + +#define i_to_3_byte(a, i) (((Uchar *)(a))[0] = ((i) >> 16)& 0xFF,\ + ((Uchar *)(a))[1] = ((i) >> 8) & 0xFF,\ + ((Uchar *)(a))[2] = (i) & 0xFF) + +#define i_to_4_byte(a, i) (((Uchar *)(a))[0] = ((i) >> 24)& 0xFF,\ + ((Uchar *)(a))[1] = ((i) >> 16)& 0xFF,\ + ((Uchar *)(a))[2] = ((i) >> 8) & 0xFF,\ + ((Uchar *)(a))[3] = (i) & 0xFF) + +#define i_to_short(a, i) (((Uchar *)(a))[0] = ((i) >> 8) & 0xFF,\ + ((Uchar *)(a))[1] = (i) & 0xFF) + +#define a_to_u_short(a) ((unsigned short) \ + ((((Uchar*) a)[1] & 0xFF) | \ + (((Uchar*) a)[0] << 8 & 0xFF00))) + +#define a_to_3_byte(a) ((Ulong) \ + ((((Uchar*) a)[2] & 0xFF) | \ + (((Uchar*) a)[1] << 8 & 0xFF00) | \ + (((Uchar*) a)[0] << 16 & 0xFF0000))) + +#ifdef __STDC__ +#define a_to_u_long(a) ((Ulong) \ + ((((Uchar*) a)[3] & 0xFF) | \ + (((Uchar*) a)[2] << 8 & 0xFF00) | \ + (((Uchar*) a)[1] << 16 & 0xFF0000) | \ + (((Uchar*) a)[0] << 24 & 0xFF000000UL))) +#else +#define a_to_u_long(a) ((Ulong) \ + ((((Uchar*) a)[3] & 0xFF) | \ + (((Uchar*) a)[2] << 8 & 0xFF00) | \ + (((Uchar*) a)[1] << 16 & 0xFF0000) | \ + (((Uchar*) a)[0] << 24 & 0xFF000000))) +#endif +#endif /* XXXX */ + + +#ifdef __cplusplus +} +#endif + +#endif /* _SCG_SCSICDB_H */ diff --git a/scsilib/include/scg/scsidefs.h b/scsilib/include/scg/scsidefs.h new file mode 100644 index 0000000..b01c9bc --- /dev/null +++ b/scsilib/include/scg/scsidefs.h @@ -0,0 +1,111 @@ +/* @(#)scsidefs.h 1.28 04/09/04 Copyright 1988 J. Schilling */ +/* + * Definitions for SCSI devices i.e. for error strings in scsierrs.c + * + * Copyright (c) 1988 J. Schilling + */ +/*@@C@@*/ + +#ifndef _SCG_SCSIDEFS_H +#define _SCG_SCSIDEFS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Disks + */ +#ifdef DEV_UNKNOWN +/* + * True64 defines DEV_UNKNOWN in /usr/include/sys/devio.h as "UNKNOWN" + */ +#undef DEV_UNKNOWN +#endif +#define DEV_UNKNOWN 0 +#define DEV_ACB40X0 1 +#define DEV_ACB4000 2 +#define DEV_ACB4010 3 +#define DEV_ACB4070 4 +#define DEV_ACB5500 5 +#define DEV_ACB4520A 6 +#define DEV_ACB4525 7 +#define DEV_MD21 8 +#define DEV_MD23 9 +#define DEV_NON_CCS_DSK 10 +#define DEV_CCS_GENDISK 11 + +/* + * Tapes + */ +#define DEV_MT02 100 +#define DEV_SC4000 101 + +/* + * Printer + */ +#define DEV_PRT 200 + +/* + * Processors + */ +#define DEV_PROC 300 + +/* + * Worm + */ +#define DEV_WORM 400 +#define DEV_RXT800S 401 + +/* + * CD-ROM + */ +#define DEV_CDROM 500 +#define DEV_MMC_CDROM 501 +#define DEV_MMC_CDR 502 +#define DEV_MMC_CDRW 503 +#define DEV_MMC_DVD 504 +#define DEV_MMC_DVD_WR 505 + +#define DEV_CDD_521_OLD 510 +#define DEV_CDD_521 511 +#define DEV_CDD_522 512 +#define DEV_PCD_600 513 +#define DEV_CDD_2000 514 +#define DEV_CDD_2600 515 +#define DEV_TYUDEN_EW50 516 +#define DEV_YAMAHA_CDR_100 520 +#define DEV_YAMAHA_CDR_400 521 +#define DEV_PLASMON_RF_4100 530 +#define DEV_SONY_CDU_924 540 +#define DEV_RICOH_RO_1420C 550 +#define DEV_RICOH_RO_1060C 551 +#define DEV_TEAC_CD_R50S 560 +#define DEV_MATSUSHITA_7501 570 +#define DEV_MATSUSHITA_7502 571 +#define DEV_PIONEER_DW_S114X 580 +#define DEV_PIONEER_DVDR_S101 581 + +/* + * Scanners + */ +#define DEV_HRSCAN 600 +#define DEV_MS300A 601 + +/* + * Optical memory + */ +#define DEV_SONY_SMO 700 + + +#define old_acb(d) (((d) == DEV_ACB40X0) || \ + ((d) == DEV_ACB4000) || ((d) == DEV_ACB4010) || \ + ((d) == DEV_ACB4070) || ((d) == DEV_ACB5500)) + +#define is_ccs(d) (!old_acb(d)) + +#ifdef __cplusplus +} +#endif + +#endif /* _SCG_SCSIDEFS_H */ diff --git a/scsilib/include/scg/scsireg.h b/scsilib/include/scg/scsireg.h new file mode 100644 index 0000000..f835fb6 --- /dev/null +++ b/scsilib/include/scg/scsireg.h @@ -0,0 +1,1229 @@ +/* @(#)scsireg.h 1.31 04/09/04 Copyright 1987 J. Schilling */ +/* + * usefull definitions for dealing with CCS SCSI - devices + * + * Copyright (c) 1987 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _SCG_SCSIREG_H +#define _SCG_SCSIREG_H + +#include <utypes.h> +#include <btorder.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_inquiry { + Ucbit type : 5; /* 0 */ + Ucbit qualifier : 3; /* 0 */ + + Ucbit type_modifier : 7; /* 1 */ + Ucbit removable : 1; /* 1 */ + + Ucbit ansi_version : 3; /* 2 */ + Ucbit ecma_version : 3; /* 2 */ + Ucbit iso_version : 2; /* 2 */ + + Ucbit data_format : 4; /* 3 */ + Ucbit res3_54 : 2; /* 3 */ + Ucbit termiop : 1; /* 3 */ + Ucbit aenc : 1; /* 3 */ + + Ucbit add_len : 8; /* 4 */ + Ucbit sense_len : 8; /* 5 */ /* only Emulex ??? */ + Ucbit res2 : 8; /* 6 */ + + Ucbit softreset : 1; /* 7 */ + Ucbit cmdque : 1; + Ucbit res7_2 : 1; + Ucbit linked : 1; + Ucbit sync : 1; + Ucbit wbus16 : 1; + Ucbit wbus32 : 1; + Ucbit reladr : 1; /* 7 */ + + char vendor_info[8]; /* 8 */ + char prod_ident[16]; /* 16 */ + char prod_revision[4]; /* 32 */ +#ifdef comment + char vendor_uniq[20]; /* 36 */ + char reserved[40]; /* 56 */ +#endif +}; /* 96 */ + +#else /* Motorola byteorder */ + +struct scsi_inquiry { + Ucbit qualifier : 3; /* 0 */ + Ucbit type : 5; /* 0 */ + + Ucbit removable : 1; /* 1 */ + Ucbit type_modifier : 7; /* 1 */ + + Ucbit iso_version : 2; /* 2 */ + Ucbit ecma_version : 3; + Ucbit ansi_version : 3; /* 2 */ + + Ucbit aenc : 1; /* 3 */ + Ucbit termiop : 1; + Ucbit res3_54 : 2; + Ucbit data_format : 4; /* 3 */ + + Ucbit add_len : 8; /* 4 */ + Ucbit sense_len : 8; /* 5 */ /* only Emulex ??? */ + Ucbit res2 : 8; /* 6 */ + Ucbit reladr : 1; /* 7 */ + Ucbit wbus32 : 1; + Ucbit wbus16 : 1; + Ucbit sync : 1; + Ucbit linked : 1; + Ucbit res7_2 : 1; + Ucbit cmdque : 1; + Ucbit softreset : 1; + char vendor_info[8]; /* 8 */ + char prod_ident[16]; /* 16 */ + char prod_revision[4]; /* 32 */ +#ifdef comment + char vendor_uniq[20]; /* 36 */ + char reserved[40]; /* 56 */ +#endif +}; /* 96 */ +#endif + +#ifdef __SCG_COMPAT__ +#define info vendor_info +#define ident prod_ident +#define revision prod_revision +#endif + +/* Peripheral Device Qualifier */ + +#define INQ_DEV_PRESENT 0x00 /* Physical device present */ +#define INQ_DEV_NOTPR 0x01 /* Physical device not present */ +#define INQ_DEV_RES 0x02 /* Reserved */ +#define INQ_DEV_NOTSUP 0x03 /* Logical unit not supported */ + +/* Peripheral Device Type */ + +#define INQ_DASD 0x00 /* Direct-access device (disk) */ +#define INQ_SEQD 0x01 /* Sequential-access device (tape) */ +#define INQ_PRTD 0x02 /* Printer device */ +#define INQ_PROCD 0x03 /* Processor device */ +#define INQ_OPTD 0x04 /* Write once device (optical disk) */ +#define INQ_WORM 0x04 /* Write once device (optical disk) */ +#define INQ_ROMD 0x05 /* CD-ROM device */ +#define INQ_SCAN 0x06 /* Scanner device */ +#define INQ_OMEM 0x07 /* Optical Memory device */ +#define INQ_JUKE 0x08 /* Medium Changer device (jukebox) */ +#define INQ_COMM 0x09 /* Communications device */ +#define INQ_IT8_1 0x0A /* IT8 */ +#define INQ_IT8_2 0x0B /* IT8 */ +#define INQ_STARR 0x0C /* Storage array device */ +#define INQ_ENCL 0x0D /* Enclosure services device */ +#define INQ_SDAD 0x0E /* Simplyfied direct-access device */ +#define INQ_OCRW 0x0F /* Optical card reader/writer device */ +#define INQ_BRIDGE 0x10 /* Bridging expander device */ +#define INQ_OSD 0x11 /* Object based storage device */ +#define INQ_ADC 0x12 /* Automation/Drive interface */ +#define INQ_WELLKNOWN 0x1E /* Well known logical unit */ +#define INQ_NODEV 0x1F /* Unknown or no device */ +#define INQ_NOTPR 0x1F /* Logical unit not present (SCSI-1) */ + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_header { + Ucbit sense_data_len : 8; + Uchar medium_type; + Ucbit res2 : 4; + Ucbit cache : 1; + Ucbit res : 2; + Ucbit write_prot : 1; + Uchar blockdesc_len; +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_header { + Ucbit sense_data_len : 8; + Uchar medium_type; + Ucbit write_prot : 1; + Ucbit res : 2; + Ucbit cache : 1; + Ucbit res2 : 4; + Uchar blockdesc_len; +}; +#endif + +struct scsi_modesel_header { + Ucbit sense_data_len : 8; + Uchar medium_type; + Ucbit res2 : 8; + Uchar blockdesc_len; +}; + +struct scsi_mode_blockdesc { + Uchar density; + Uchar nlblock[3]; + Ucbit res : 8; + Uchar lblen[3]; +}; + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct acb_mode_data { + Uchar listformat; + Uchar ncyl[2]; + Uchar nhead; + Uchar start_red_wcurrent[2]; + Uchar start_precomp[2]; + Uchar landing_zone; + Uchar step_rate; + Ucbit : 2; + Ucbit hard_sec : 1; + Ucbit fixed_media : 1; + Ucbit : 4; + Uchar sect_per_trk; +}; + +#else /* Motorola byteorder */ + +struct acb_mode_data { + Uchar listformat; + Uchar ncyl[2]; + Uchar nhead; + Uchar start_red_wcurrent[2]; + Uchar start_precomp[2]; + Uchar landing_zone; + Uchar step_rate; + Ucbit : 4; + Ucbit fixed_media : 1; + Ucbit hard_sec : 1; + Ucbit : 2; + Uchar sect_per_trk; +}; +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_header { + Ucbit p_code : 6; + Ucbit res : 1; + Ucbit parsave : 1; + Uchar p_len; +}; + +/* + * This is a hack that allows mode pages without + * any further bitfileds to be defined bitorder independent. + */ +#define MP_P_CODE \ + Ucbit p_code : 6; \ + Ucbit p_res : 1; \ + Ucbit parsave : 1 + +#else /* Motorola byteorder */ + +struct scsi_mode_page_header { + Ucbit parsave : 1; + Ucbit res : 1; + Ucbit p_code : 6; + Uchar p_len; +}; + +/* + * This is a hack that allows mode pages without + * any further bitfileds to be defined bitorder independent. + */ +#define MP_P_CODE \ + Ucbit parsave : 1; \ + Ucbit p_res : 1; \ + Ucbit p_code : 6 + +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_01 { /* Error recovery Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0A = 12 Bytes */ + Ucbit disa_correction : 1; /* Byte 2 */ + Ucbit term_on_rec_err : 1; + Ucbit report_rec_err : 1; + Ucbit en_early_corr : 1; + Ucbit read_continuous : 1; + Ucbit tranfer_block : 1; + Ucbit en_auto_reall_r : 1; + Ucbit en_auto_reall_w : 1; /* Byte 2 */ + Uchar rd_retry_count; /* Byte 3 */ + Uchar correction_span; + char head_offset_count; + char data_strobe_offset; + Uchar res; + Uchar wr_retry_count; + Uchar res_tape[2]; + Uchar recov_timelim[2]; +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_page_01 { /* Error recovery Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0A = 12 Bytes */ + Ucbit en_auto_reall_w : 1; /* Byte 2 */ + Ucbit en_auto_reall_r : 1; + Ucbit tranfer_block : 1; + Ucbit read_continuous : 1; + Ucbit en_early_corr : 1; + Ucbit report_rec_err : 1; + Ucbit term_on_rec_err : 1; + Ucbit disa_correction : 1; /* Byte 2 */ + Uchar rd_retry_count; /* Byte 3 */ + Uchar correction_span; + char head_offset_count; + char data_strobe_offset; + Uchar res; + Uchar wr_retry_count; + Uchar res_tape[2]; + Uchar recov_timelim[2]; +}; +#endif + + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_02 { /* Device dis/re connect Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0E = 16 Bytes */ + Uchar buf_full_ratio; + Uchar buf_empt_ratio; + Uchar bus_inact_limit[2]; + Uchar disc_time_limit[2]; + Uchar conn_time_limit[2]; + Uchar max_burst_size[2]; /* Start SCSI-2 */ + Ucbit data_tr_dis_ctl : 2; + Ucbit : 6; + Uchar res[3]; +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_page_02 { /* Device dis/re connect Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0E = 16 Bytes */ + Uchar buf_full_ratio; + Uchar buf_empt_ratio; + Uchar bus_inact_limit[2]; + Uchar disc_time_limit[2]; + Uchar conn_time_limit[2]; + Uchar max_burst_size[2]; /* Start SCSI-2 */ + Ucbit : 6; + Ucbit data_tr_dis_ctl : 2; + Uchar res[3]; +}; +#endif + +#define DTDC_DATADONE 0x01 /* + * Target may not disconnect once + * data transfer is started until + * all data successfully transferred. + */ + +#define DTDC_CMDDONE 0x03 /* + * Target may not disconnect once + * data transfer is started until + * command completed. + */ + + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_03 { /* Direct access format Paramters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x16 = 24 Bytes */ + Uchar trk_per_zone[2]; + Uchar alt_sec_per_zone[2]; + Uchar alt_trk_per_zone[2]; + Uchar alt_trk_per_vol[2]; + Uchar sect_per_trk[2]; + Uchar bytes_per_phys_sect[2]; + Uchar interleave[2]; + Uchar trk_skew[2]; + Uchar cyl_skew[2]; + Ucbit : 3; + Ucbit inhibit_save : 1; + Ucbit fmt_by_surface : 1; + Ucbit removable : 1; + Ucbit hard_sec : 1; + Ucbit soft_sec : 1; + Uchar res[3]; +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_page_03 { /* Direct access format Paramters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x16 = 24 Bytes */ + Uchar trk_per_zone[2]; + Uchar alt_sec_per_zone[2]; + Uchar alt_trk_per_zone[2]; + Uchar alt_trk_per_vol[2]; + Uchar sect_per_trk[2]; + Uchar bytes_per_phys_sect[2]; + Uchar interleave[2]; + Uchar trk_skew[2]; + Uchar cyl_skew[2]; + Ucbit soft_sec : 1; + Ucbit hard_sec : 1; + Ucbit removable : 1; + Ucbit fmt_by_surface : 1; + Ucbit inhibit_save : 1; + Ucbit : 3; + Uchar res[3]; +}; +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_04 { /* Rigid disk Geometry Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x16 = 24 Bytes */ + Uchar ncyl[3]; + Uchar nhead; + Uchar start_precomp[3]; + Uchar start_red_wcurrent[3]; + Uchar step_rate[2]; + Uchar landing_zone[3]; + Ucbit rot_pos_locking : 2; /* Start SCSI-2 */ + Ucbit : 6; /* Start SCSI-2 */ + Uchar rotational_off; + Uchar res1; + Uchar rotation_rate[2]; + Uchar res2[2]; +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_page_04 { /* Rigid disk Geometry Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x16 = 24 Bytes */ + Uchar ncyl[3]; + Uchar nhead; + Uchar start_precomp[3]; + Uchar start_red_wcurrent[3]; + Uchar step_rate[2]; + Uchar landing_zone[3]; + Ucbit : 6; /* Start SCSI-2 */ + Ucbit rot_pos_locking : 2; /* Start SCSI-2 */ + Uchar rotational_off; + Uchar res1; + Uchar rotation_rate[2]; + Uchar res2[2]; +}; +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_05 { /* Flexible disk Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x1E = 32 Bytes */ + Uchar transfer_rate[2]; + Uchar nhead; + Uchar sect_per_trk; + Uchar bytes_per_phys_sect[2]; + Uchar ncyl[2]; + Uchar start_precomp[2]; + Uchar start_red_wcurrent[2]; + Uchar step_rate[2]; + Uchar step_pulse_width; + Uchar head_settle_delay[2]; + Uchar motor_on_delay; + Uchar motor_off_delay; + Ucbit spc : 4; + Ucbit : 4; + Ucbit : 5; + Ucbit mo : 1; + Ucbit ssn : 1; + Ucbit trdy : 1; + Uchar write_compensation; + Uchar head_load_delay; + Uchar head_unload_delay; + Ucbit pin_2_use : 4; + Ucbit pin_34_use : 4; + Ucbit pin_1_use : 4; + Ucbit pin_4_use : 4; + Uchar rotation_rate[2]; + Uchar res[2]; +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_page_05 { /* Flexible disk Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x1E = 32 Bytes */ + Uchar transfer_rate[2]; + Uchar nhead; + Uchar sect_per_trk; + Uchar bytes_per_phys_sect[2]; + Uchar ncyl[2]; + Uchar start_precomp[2]; + Uchar start_red_wcurrent[2]; + Uchar step_rate[2]; + Uchar step_pulse_width; + Uchar head_settle_delay[2]; + Uchar motor_on_delay; + Uchar motor_off_delay; + Ucbit trdy : 1; + Ucbit ssn : 1; + Ucbit mo : 1; + Ucbit : 5; + Ucbit : 4; + Ucbit spc : 4; + Uchar write_compensation; + Uchar head_load_delay; + Uchar head_unload_delay; + Ucbit pin_34_use : 4; + Ucbit pin_2_use : 4; + Ucbit pin_4_use : 4; + Ucbit pin_1_use : 4; + Uchar rotation_rate[2]; + Uchar res[2]; +}; +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_07 { /* Verify Error recovery */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0A = 12 Bytes */ + Ucbit disa_correction : 1; /* Byte 2 */ + Ucbit term_on_rec_err : 1; + Ucbit report_rec_err : 1; + Ucbit en_early_corr : 1; + Ucbit res : 4; /* Byte 2 */ + Uchar ve_retry_count; /* Byte 3 */ + Uchar ve_correction_span; + char res2[5]; /* Byte 5 */ + Uchar ve_recov_timelim[2]; /* Byte 10 */ +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_page_07 { /* Verify Error recovery */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0A = 12 Bytes */ + Ucbit res : 4; /* Byte 2 */ + Ucbit en_early_corr : 1; + Ucbit report_rec_err : 1; + Ucbit term_on_rec_err : 1; + Ucbit disa_correction : 1; /* Byte 2 */ + Uchar ve_retry_count; /* Byte 3 */ + Uchar ve_correction_span; + char res2[5]; /* Byte 5 */ + Uchar ve_recov_timelim[2]; /* Byte 10 */ +}; +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_08 { /* Caching Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0A = 12 Bytes */ + Ucbit disa_rd_cache : 1; /* Byte 2 */ + Ucbit muliple_fact : 1; + Ucbit en_wt_cache : 1; + Ucbit res : 5; /* Byte 2 */ + Ucbit wt_ret_pri : 4; /* Byte 3 */ + Ucbit demand_rd_ret_pri: 4; /* Byte 3 */ + Uchar disa_pref_tr_len[2]; /* Byte 4 */ + Uchar min_pref[2]; /* Byte 6 */ + Uchar max_pref[2]; /* Byte 8 */ + Uchar max_pref_ceiling[2]; /* Byte 10 */ +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_page_08 { /* Caching Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0A = 12 Bytes */ + Ucbit res : 5; /* Byte 2 */ + Ucbit en_wt_cache : 1; + Ucbit muliple_fact : 1; + Ucbit disa_rd_cache : 1; /* Byte 2 */ + Ucbit demand_rd_ret_pri: 4; /* Byte 3 */ + Ucbit wt_ret_pri : 4; + Uchar disa_pref_tr_len[2]; /* Byte 4 */ + Uchar min_pref[2]; /* Byte 6 */ + Uchar max_pref[2]; /* Byte 8 */ + Uchar max_pref_ceiling[2]; /* Byte 10 */ +}; +#endif + +struct scsi_mode_page_09 { /* Peripheral device Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* >= 0x06 = 8 Bytes */ + Uchar interface_id[2]; /* Byte 2 */ + Uchar res[4]; /* Byte 4 */ + Uchar vendor_specific[1]; /* Byte 8 */ +}; + +#define PDEV_SCSI 0x0000 /* scsi interface */ +#define PDEV_SMD 0x0001 /* SMD interface */ +#define PDEV_ESDI 0x0002 /* ESDI interface */ +#define PDEV_IPI2 0x0003 /* IPI-2 interface */ +#define PDEV_IPI3 0x0004 /* IPI-3 interface */ + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_0A { /* Common device Control Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x06 = 8 Bytes */ + Ucbit rep_log_exeption: 1; /* Byte 2 */ + Ucbit res : 7; /* Byte 2 */ + Ucbit dis_queuing : 1; /* Byte 3 */ + Ucbit queuing_err_man : 1; + Ucbit res2 : 2; + Ucbit queue_alg_mod : 4; /* Byte 3 */ + Ucbit EAENP : 1; /* Byte 4 */ + Ucbit UAENP : 1; + Ucbit RAENP : 1; + Ucbit res3 : 4; + Ucbit en_ext_cont_all : 1; /* Byte 4 */ + Ucbit res4 : 8; + Uchar ready_aen_hold_per[2]; /* Byte 6 */ +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_page_0A { /* Common device Control Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x06 = 8 Bytes */ + Ucbit res : 7; /* Byte 2 */ + Ucbit rep_log_exeption: 1; /* Byte 2 */ + Ucbit queue_alg_mod : 4; /* Byte 3 */ + Ucbit res2 : 2; + Ucbit queuing_err_man : 1; + Ucbit dis_queuing : 1; /* Byte 3 */ + Ucbit en_ext_cont_all : 1; /* Byte 4 */ + Ucbit res3 : 4; + Ucbit RAENP : 1; + Ucbit UAENP : 1; + Ucbit EAENP : 1; /* Byte 4 */ + Ucbit res4 : 8; + Uchar ready_aen_hold_per[2]; /* Byte 6 */ +}; +#endif + +#define CTRL_QMOD_RESTRICT 0x0 +#define CTRL_QMOD_UNRESTRICT 0x1 + + +struct scsi_mode_page_0B { /* Medium Types Supported Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x06 = 8 Bytes */ + Uchar res[2]; /* Byte 2 */ + Uchar medium_one_supp; /* Byte 4 */ + Uchar medium_two_supp; /* Byte 5 */ + Uchar medium_three_supp; /* Byte 6 */ + Uchar medium_four_supp; /* Byte 7 */ +}; + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_0C { /* Notch & Partition Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x16 = 24 Bytes */ + Ucbit res : 6; /* Byte 2 */ + Ucbit logical_notch : 1; + Ucbit notched_drive : 1; /* Byte 2 */ + Uchar res2; /* Byte 3 */ + Uchar max_notches[2]; /* Byte 4 */ + Uchar active_notch[2]; /* Byte 6 */ + Uchar starting_boundary[4]; /* Byte 8 */ + Uchar ending_boundary[4]; /* Byte 12 */ + Uchar pages_notched[8]; /* Byte 16 */ +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_page_0C { /* Notch & Partition Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x16 = 24 Bytes */ + Ucbit notched_drive : 1; /* Byte 2 */ + Ucbit logical_notch : 1; + Ucbit res : 6; /* Byte 2 */ + Uchar res2; /* Byte 3 */ + Uchar max_notches[2]; /* Byte 4 */ + Uchar active_notch[2]; /* Byte 6 */ + Uchar starting_boundary[4]; /* Byte 8 */ + Uchar ending_boundary[4]; /* Byte 12 */ + Uchar pages_notched[8]; /* Byte 16 */ +}; +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_0D { /* CD-ROM Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x06 = 8 Bytes */ + Uchar res; /* Byte 2 */ + Ucbit inact_timer_mult: 4; /* Byte 3 */ + Ucbit res2 : 4; /* Byte 3 */ + Uchar s_un_per_m_un[2]; /* Byte 4 */ + Uchar f_un_per_s_un[2]; /* Byte 6 */ +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_page_0D { /* CD-ROM Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x06 = 8 Bytes */ + Uchar res; /* Byte 2 */ + Ucbit res2 : 4; /* Byte 3 */ + Ucbit inact_timer_mult: 4; /* Byte 3 */ + Uchar s_un_per_m_un[2]; /* Byte 4 */ + Uchar f_un_per_s_un[2]; /* Byte 6 */ +}; +#endif + +struct sony_mode_page_20 { /* Sony Format Mode Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0A = 12 Bytes */ + Uchar format_mode; + Uchar format_type; +#define num_bands user_band_size /* Gilt bei Type 1 */ + Uchar user_band_size[4]; /* Gilt bei Type 0 */ + Uchar spare_band_size[2]; + Uchar res[2]; +}; + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct toshiba_mode_page_20 { /* Toshiba Speed Control Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x01 = 3 Bytes */ + Ucbit speed : 1; + Ucbit res : 7; +}; + +#else /* Motorola byteorder */ + +struct toshiba_mode_page_20 { /* Toshiba Speed Control Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x01 = 3 Bytes */ + Ucbit res : 7; + Ucbit speed : 1; +}; +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct ccs_mode_page_38 { /* CCS Caching Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0E = 14 Bytes */ + + Ucbit cache_table_size: 4; /* Byte 3 */ + Ucbit cache_en : 1; + Ucbit res2 : 1; + Ucbit wr_index_en : 1; + Ucbit res : 1; /* Byte 3 */ + Uchar threshold; /* Byte 4 Prefetch threshold */ + Uchar max_prefetch; /* Byte 5 Max. prefetch */ + Uchar max_multiplier; /* Byte 6 Max. prefetch multiplier */ + Uchar min_prefetch; /* Byte 7 Min. prefetch */ + Uchar min_multiplier; /* Byte 8 Min. prefetch multiplier */ + Uchar res3[8]; /* Byte 9 */ +}; + +#else /* Motorola byteorder */ + +struct ccs_mode_page_38 { /* CCS Caching Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0E = 14 Bytes */ + + Ucbit res : 1; /* Byte 3 */ + Ucbit wr_index_en : 1; + Ucbit res2 : 1; + Ucbit cache_en : 1; + Ucbit cache_table_size: 4; /* Byte 3 */ + Uchar threshold; /* Byte 4 Prefetch threshold */ + Uchar max_prefetch; /* Byte 5 Max. prefetch */ + Uchar max_multiplier; /* Byte 6 Max. prefetch multiplier */ + Uchar min_prefetch; /* Byte 7 Min. prefetch */ + Uchar min_multiplier; /* Byte 8 Min. prefetch multiplier */ + Uchar res3[8]; /* Byte 9 */ +}; +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct cd_mode_page_05 { /* write parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x32 = 50 Bytes */ + Ucbit write_type : 4; /* Session write type (PACKET/TAO...)*/ + Ucbit test_write : 1; /* Do not actually write data */ + Ucbit LS_V : 1; /* Link size valid */ + Ucbit BUFE : 1; /* Enable Bufunderrun free rec. */ + Ucbit res_2_7 : 1; + Ucbit track_mode : 4; /* Track mode (Q-sub control nibble) */ + Ucbit copy : 1; /* 1st higher gen of copy prot track ~*/ + Ucbit fp : 1; /* Fixed packed (if in packet mode) */ + Ucbit multi_session : 2; /* Multi session write type */ + Ucbit dbtype : 4; /* Data block type */ + Ucbit res_4 : 4; /* Reserved */ + Uchar link_size; /* Link Size (default is 7) */ + Uchar res_6; /* Reserved */ + Ucbit host_appl_code : 6; /* Host application code of disk */ + Ucbit res_7 : 2; /* Reserved */ + Uchar session_format; /* Session format (DA/CDI/XA) */ + Uchar res_9; /* Reserved */ + Uchar packet_size[4]; /* # of user datablocks/fixed packet */ + Uchar audio_pause_len[2]; /* # of blocks where index is zero */ + Uchar media_cat_number[16]; /* Media catalog Number (MCN) */ + Uchar ISRC[14]; /* ISRC for this track */ + Uchar sub_header[4]; + Uchar vendor_uniq[4]; +}; + +#else /* Motorola byteorder */ + +struct cd_mode_page_05 { /* write parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x32 = 50 Bytes */ + Ucbit res_2_7 : 1; + Ucbit BUFE : 1; /* Enable Bufunderrun free rec. */ + Ucbit LS_V : 1; /* Link size valid */ + Ucbit test_write : 1; /* Do not actually write data */ + Ucbit write_type : 4; /* Session write type (PACKET/TAO...)*/ + Ucbit multi_session : 2; /* Multi session write type */ + Ucbit fp : 1; /* Fixed packed (if in packet mode) */ + Ucbit copy : 1; /* 1st higher gen of copy prot track */ + Ucbit track_mode : 4; /* Track mode (Q-sub control nibble) */ + Ucbit res_4 : 4; /* Reserved */ + Ucbit dbtype : 4; /* Data block type */ + Uchar link_size; /* Link Size (default is 7) */ + Uchar res_6; /* Reserved */ + Ucbit res_7 : 2; /* Reserved */ + Ucbit host_appl_code : 6; /* Host application code of disk */ + Uchar session_format; /* Session format (DA/CDI/XA) */ + Uchar res_9; /* Reserved */ + Uchar packet_size[4]; /* # of user datablocks/fixed packet */ + Uchar audio_pause_len[2]; /* # of blocks where index is zero */ + Uchar media_cat_number[16]; /* Media catalog Number (MCN) */ + Uchar ISRC[14]; /* ISRC for this track */ + Uchar sub_header[4]; + Uchar vendor_uniq[4]; +}; + +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct cd_wr_speed_performance { + Uchar res0; /* Reserved */ + Ucbit rot_ctl_sel : 2; /* Rotational control selected */ + Ucbit res_1_27 : 6; /* Reserved */ + Uchar wr_speed_supp[2]; /* Supported write speed */ +}; + +struct cd_mode_page_2A { /* CD Cap / mech status */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x14 = 20 Bytes (MMC) */ + /* 0x18 = 24 Bytes (MMC-2) */ + /* 0x1C >= 28 Bytes (MMC-3) */ + Ucbit cd_r_read : 1; /* Reads CD-R media */ + Ucbit cd_rw_read : 1; /* Reads CD-RW media */ + Ucbit method2 : 1; /* Reads fixed packet method2 media */ + Ucbit dvd_rom_read : 1; /* Reads DVD ROM media */ + Ucbit dvd_r_read : 1; /* Reads DVD-R media */ + Ucbit dvd_ram_read : 1; /* Reads DVD-RAM media */ + Ucbit res_2_67 : 2; /* Reserved */ + Ucbit cd_r_write : 1; /* Supports writing CD-R media */ + Ucbit cd_rw_write : 1; /* Supports writing CD-RW media */ + Ucbit test_write : 1; /* Supports emulation write */ + Ucbit res_3_3 : 1; /* Reserved */ + Ucbit dvd_r_write : 1; /* Supports writing DVD-R media */ + Ucbit dvd_ram_write : 1; /* Supports writing DVD-RAM media */ + Ucbit res_3_67 : 2; /* Reserved */ + Ucbit audio_play : 1; /* Supports Audio play operation */ + Ucbit composite : 1; /* Deliveres composite A/V stream */ + Ucbit digital_port_2 : 1; /* Supports digital output on port 2 */ + Ucbit digital_port_1 : 1; /* Supports digital output on port 1 */ + Ucbit mode_2_form_1 : 1; /* Reads Mode-2 form 1 media (XA) */ + Ucbit mode_2_form_2 : 1; /* Reads Mode-2 form 2 media */ + Ucbit multi_session : 1; /* Reads multi-session media */ + Ucbit BUF : 1; /* Supports Buffer under. free rec. */ + Ucbit cd_da_supported : 1; /* Reads audio data with READ CD cmd */ + Ucbit cd_da_accurate : 1; /* READ CD data stream is accurate */ + Ucbit rw_supported : 1; /* Reads R-W sub channel information */ + Ucbit rw_deint_corr : 1; /* Reads de-interleved R-W sub chan */ + Ucbit c2_pointers : 1; /* Supports C2 error pointers */ + Ucbit ISRC : 1; /* Reads ISRC information */ + Ucbit UPC : 1; /* Reads media catalog number (UPC) */ + Ucbit read_bar_code : 1; /* Supports reading bar codes */ + Ucbit lock : 1; /* PREVENT/ALLOW may lock media */ + Ucbit lock_state : 1; /* Lock state 0=unlocked 1=locked */ + Ucbit prevent_jumper : 1; /* State of prev/allow jumper 0=pres */ + Ucbit eject : 1; /* Ejects disc/cartr with STOP LoEj */ + Ucbit res_6_4 : 1; /* Reserved */ + Ucbit loading_type : 3; /* Loading mechanism type */ + Ucbit sep_chan_vol : 1; /* Vol controls each channel separat */ + Ucbit sep_chan_mute : 1; /* Mute controls each channel separat*/ + Ucbit disk_present_rep: 1; /* Changer supports disk present rep */ + Ucbit sw_slot_sel : 1; /* Load empty slot in changer */ + Ucbit side_change : 1; /* Side change capable */ + Ucbit pw_in_lead_in : 1; /* Reads raw P-W sucode from lead in */ + Ucbit res_7 : 2; /* Reserved */ + Uchar max_read_speed[2]; /* Max. read speed in KB/s */ + Uchar num_vol_levels[2]; /* # of supported volume levels */ + Uchar buffer_size[2]; /* Buffer size for the data in KB */ + Uchar cur_read_speed[2]; /* Current read speed in KB/s */ + Uchar res_16; /* Reserved */ + Ucbit res_17_0 : 1; /* Reserved */ + Ucbit BCK : 1; /* Data valid on falling edge of BCK */ + Ucbit RCK : 1; /* Set: HIGH high LRCK=left channel */ + Ucbit LSBF : 1; /* Set: LSB first Clear: MSB first */ + Ucbit length : 2; /* 0=32BCKs 1=16BCKs 2=24BCKs 3=24I2c*/ + Ucbit res_17 : 2; /* Reserved */ + Uchar max_write_speed[2]; /* Max. write speed supported in KB/s*/ + Uchar cur_write_speed[2]; /* Current write speed in KB/s */ + + /* Byte 22 ... Only in MMC-2 */ + Uchar copy_man_rev[2]; /* Copy management revision supported*/ + Uchar res_24; /* Reserved */ + Uchar res_25; /* Reserved */ + + /* Byte 26 ... Only in MMC-3 */ + Uchar res_26; /* Reserved */ + Ucbit res_27_27 : 6; /* Reserved */ + Ucbit rot_ctl_sel : 2; /* Rotational control selected */ + Uchar v3_cur_write_speed[2]; /* Current write speed in KB/s */ + Uchar num_wr_speed_des[2]; /* # of wr speed perf descr. tables */ + struct cd_wr_speed_performance + wr_speed_des[1]; /* wr speed performance descriptor */ + /* Actually more (num_wr_speed_des) */ +}; + +#else /* Motorola byteorder */ + +struct cd_wr_speed_performance { + Uchar res0; /* Reserved */ + Ucbit res_1_27 : 6; /* Reserved */ + Ucbit rot_ctl_sel : 2; /* Rotational control selected */ + Uchar wr_speed_supp[2]; /* Supported write speed */ +}; + +struct cd_mode_page_2A { /* CD Cap / mech status */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x14 = 20 Bytes (MMC) */ + /* 0x18 = 24 Bytes (MMC-2) */ + /* 0x1C >= 28 Bytes (MMC-3) */ + Ucbit res_2_67 : 2; /* Reserved */ + Ucbit dvd_ram_read : 1; /* Reads DVD-RAM media */ + Ucbit dvd_r_read : 1; /* Reads DVD-R media */ + Ucbit dvd_rom_read : 1; /* Reads DVD ROM media */ + Ucbit method2 : 1; /* Reads fixed packet method2 media */ + Ucbit cd_rw_read : 1; /* Reads CD-RW media */ + Ucbit cd_r_read : 1; /* Reads CD-R media */ + Ucbit res_3_67 : 2; /* Reserved */ + Ucbit dvd_ram_write : 1; /* Supports writing DVD-RAM media */ + Ucbit dvd_r_write : 1; /* Supports writing DVD-R media */ + Ucbit res_3_3 : 1; /* Reserved */ + Ucbit test_write : 1; /* Supports emulation write */ + Ucbit cd_rw_write : 1; /* Supports writing CD-RW media */ + Ucbit cd_r_write : 1; /* Supports writing CD-R media */ + Ucbit BUF : 1; /* Supports Buffer under. free rec. */ + Ucbit multi_session : 1; /* Reads multi-session media */ + Ucbit mode_2_form_2 : 1; /* Reads Mode-2 form 2 media */ + Ucbit mode_2_form_1 : 1; /* Reads Mode-2 form 1 media (XA) */ + Ucbit digital_port_1 : 1; /* Supports digital output on port 1 */ + Ucbit digital_port_2 : 1; /* Supports digital output on port 2 */ + Ucbit composite : 1; /* Deliveres composite A/V stream */ + Ucbit audio_play : 1; /* Supports Audio play operation */ + Ucbit read_bar_code : 1; /* Supports reading bar codes */ + Ucbit UPC : 1; /* Reads media catalog number (UPC) */ + Ucbit ISRC : 1; /* Reads ISRC information */ + Ucbit c2_pointers : 1; /* Supports C2 error pointers */ + Ucbit rw_deint_corr : 1; /* Reads de-interleved R-W sub chan */ + Ucbit rw_supported : 1; /* Reads R-W sub channel information */ + Ucbit cd_da_accurate : 1; /* READ CD data stream is accurate */ + Ucbit cd_da_supported : 1; /* Reads audio data with READ CD cmd */ + Ucbit loading_type : 3; /* Loading mechanism type */ + Ucbit res_6_4 : 1; /* Reserved */ + Ucbit eject : 1; /* Ejects disc/cartr with STOP LoEj */ + Ucbit prevent_jumper : 1; /* State of prev/allow jumper 0=pres */ + Ucbit lock_state : 1; /* Lock state 0=unlocked 1=locked */ + Ucbit lock : 1; /* PREVENT/ALLOW may lock media */ + Ucbit res_7 : 2; /* Reserved */ + Ucbit pw_in_lead_in : 1; /* Reads raw P-W sucode from lead in */ + Ucbit side_change : 1; /* Side change capable */ + Ucbit sw_slot_sel : 1; /* Load empty slot in changer */ + Ucbit disk_present_rep: 1; /* Changer supports disk present rep */ + Ucbit sep_chan_mute : 1; /* Mute controls each channel separat*/ + Ucbit sep_chan_vol : 1; /* Vol controls each channel separat */ + Uchar max_read_speed[2]; /* Max. read speed in KB/s */ + Uchar num_vol_levels[2]; /* # of supported volume levels */ + Uchar buffer_size[2]; /* Buffer size for the data in KB */ + Uchar cur_read_speed[2]; /* Current read speed in KB/s */ + Uchar res_16; /* Reserved */ + Ucbit res_17 : 2; /* Reserved */ + Ucbit length : 2; /* 0=32BCKs 1=16BCKs 2=24BCKs 3=24I2c*/ + Ucbit LSBF : 1; /* Set: LSB first Clear: MSB first */ + Ucbit RCK : 1; /* Set: HIGH high LRCK=left channel */ + Ucbit BCK : 1; /* Data valid on falling edge of BCK */ + Ucbit res_17_0 : 1; /* Reserved */ + Uchar max_write_speed[2]; /* Max. write speed supported in KB/s*/ + Uchar cur_write_speed[2]; /* Current write speed in KB/s */ + + /* Byte 22 ... Only in MMC-2 */ + Uchar copy_man_rev[2]; /* Copy management revision supported*/ + Uchar res_24; /* Reserved */ + Uchar res_25; /* Reserved */ + + /* Byte 26 ... Only in MMC-3 */ + Uchar res_26; /* Reserved */ + Ucbit res_27_27 : 6; /* Reserved */ + Ucbit rot_ctl_sel : 2; /* Rotational control selected */ + Uchar v3_cur_write_speed[2]; /* Current write speed in KB/s */ + Uchar num_wr_speed_des[2]; /* # of wr speed perf descr. tables */ + struct cd_wr_speed_performance + wr_speed_des[1]; /* wr speed performance descriptor */ + /* Actually more (num_wr_speed_des) */ +}; + +#endif + +#define LT_CADDY 0 +#define LT_TRAY 1 +#define LT_POP_UP 2 +#define LT_RES3 3 +#define LT_CHANGER_IND 4 +#define LT_CHANGER_CART 5 +#define LT_RES6 6 +#define LT_RES7 7 + + +struct scsi_mode_data { + struct scsi_mode_header header; + struct scsi_mode_blockdesc blockdesc; + union pagex { + struct acb_mode_data acb; + struct scsi_mode_page_01 page1; + struct scsi_mode_page_02 page2; + struct scsi_mode_page_03 page3; + struct scsi_mode_page_04 page4; + struct scsi_mode_page_05 page5; + struct scsi_mode_page_07 page7; + struct scsi_mode_page_08 page8; + struct scsi_mode_page_09 page9; + struct scsi_mode_page_0A pageA; + struct scsi_mode_page_0B pageB; + struct scsi_mode_page_0C pageC; + struct scsi_mode_page_0D pageD; + struct sony_mode_page_20 sony20; + struct toshiba_mode_page_20 toshiba20; + struct ccs_mode_page_38 ccs38; + } pagex; +}; + +struct scsi_capacity { + Int32_t c_baddr; /* must convert byteorder!! */ + Int32_t c_bsize; /* must convert byteorder!! */ +}; + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_def_header { + Ucbit : 8; + Ucbit format : 3; + Ucbit gdl : 1; + Ucbit mdl : 1; + Ucbit : 3; + Uchar length[2]; +}; + +#else /* Motorola byteorder */ + +struct scsi_def_header { + Ucbit : 8; + Ucbit : 3; + Ucbit mdl : 1; + Ucbit gdl : 1; + Ucbit format : 3; + Uchar length[2]; +}; +#endif + + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_format_header { + Ucbit res : 8; /* Adaptec 5500: 1 --> format track */ + Ucbit vu : 1; /* Vendor Unique */ + Ucbit immed : 1; /* Return Immediately from Format */ + Ucbit tryout : 1; /* Check if format parameters OK */ + Ucbit ipattern : 1; /* Init patter descriptor present */ + Ucbit serr : 1; /* Stop on error */ + Ucbit dcert : 1; /* Disable certification */ + Ucbit dmdl : 1; /* Disable manufacturer defect list */ + Ucbit enable : 1; /* Enable to use the next 3 bits */ + Uchar length[2]; /* Length of following list in bytes*/ +}; + +#else /* Motorola byteorder */ + +struct scsi_format_header { + Ucbit res : 8; /* Adaptec 5500: 1 --> format track */ + Ucbit enable : 1; /* Enable to use the next 3 bits */ + Ucbit dmdl : 1; /* Disable manufacturer defect list */ + Ucbit dcert : 1; /* Disable certification */ + Ucbit serr : 1; /* Stop on error */ + Ucbit ipattern : 1; /* Init patter descriptor present */ + Ucbit tryout : 1; /* Check if format parameters OK */ + Ucbit immed : 1; /* Return Immediately from Format */ + Ucbit vu : 1; /* Vendor Unique */ + Uchar length[2]; /* Length of following list in bytes*/ +}; +#endif + +struct scsi_def_bfi { + Uchar cyl[3]; + Uchar head; + Uchar bfi[4]; +}; + +struct scsi_def_phys { + Uchar cyl[3]; + Uchar head; + Uchar sec[4]; +}; + +struct scsi_def_list { + struct scsi_def_header hd; + union { + Uchar list_block[1][4]; + struct scsi_def_bfi list_bfi[1]; + struct scsi_def_phys list_phys[1]; + } def_list; +}; + +struct scsi_format_data { + struct scsi_format_header hd; + union { + Uchar list_block[1][4]; + struct scsi_def_bfi list_bfi[1]; + struct scsi_def_phys list_phys[1]; + } def_list; +}; + +#define def_block def_list.list_block +#define def_bfi def_list.list_bfi +#define def_phys def_list.list_phys + +#define SC_DEF_BLOCK 0 +#define SC_DEF_BFI 4 +#define SC_DEF_PHYS 5 +#define SC_DEF_VU 6 +#define SC_DEF_RES 7 + +struct scsi_format_cap_header { + Uchar res[3]; /* Reserved */ + Uchar len; /* Len (a multiple of 8) */ +}; + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_format_cap_desc { + Uchar nblock[4]; /* Number of blocks */ + Ucbit desc_type : 2; /* Descriptor type */ + Ucbit fmt_type : 6; /* Format Taype */ + Uchar blen[3]; /* Logical block length */ +}; + +#else /* Motorola byteorder */ + +struct scsi_format_cap_desc { + Uchar nblock[4]; /* Number of blocks */ + Ucbit fmt_type : 6; /* Format Taype */ + Ucbit desc_type : 2; /* Descriptor type */ + Uchar blen[3]; /* Logical block length */ +}; +#endif + +/* + * Defines for 'fmt_type'. + */ +#define FCAP_TYPE_DVDPLUS_FULL 0x26 /* DVD+RW Full Format */ + +/* + * Defines for 'desc_type'. + * In case of FCAP_DESC_RES, the descriptor is a formatted capacity descriptor + * and the 'blen' field is type dependent. + * For all other cases, this is the Current/Maximum Capacity descriptor and + * the value of 'fmt_type' is reserved and must be zero. + */ +#define FCAP_DESC_RES 0 /* Reserved */ +#define FCAP_DESC_UNFORM 1 /* Unformatted Media */ +#define FCAP_DESC_FORM 2 /* Formatted Media */ +#define FCAP_DESC_NOMEDIA 3 /* No Media */ + +struct scsi_cap_data { + struct scsi_format_cap_header hd; + struct scsi_format_cap_desc list[1]; +}; + + +struct scsi_send_diag_cmd { + Uchar cmd; + Uchar addr[4]; + Ucbit : 8; +}; + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_sector_header { + Uchar cyl[2]; + Uchar head; + Uchar sec; + Ucbit : 5; + Ucbit rp : 1; + Ucbit sp : 1; + Ucbit dt : 1; +}; + +#else /* Motorola byteorder */ + +struct scsi_sector_header { + Uchar cyl[2]; + Uchar head; + Uchar sec; + Ucbit dt : 1; + Ucbit sp : 1; + Ucbit rp : 1; + Ucbit : 5; +}; +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _SCG_SCSIREG_H */ diff --git a/scsilib/include/scg/scsisense.h b/scsilib/include/scg/scsisense.h new file mode 100644 index 0000000..f0b53e6 --- /dev/null +++ b/scsilib/include/scg/scsisense.h @@ -0,0 +1,191 @@ +/* @(#)scsisense.h 2.18 04/09/04 Copyright 1986 J. Schilling */ +/* + * Definitions for the SCSI status code and sense structure + * + * Copyright (c) 1986 J. Schilling + */ +/*@@C@@*/ + +#ifndef _SCG_SCSISENSE_H +#define _SCG_SCSISENSE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * SCSI status completion block. + */ +#define SCSI_EXTENDED_STATUS + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_status { + Ucbit vu_00 : 1; /* vendor unique */ + Ucbit chk : 1; /* check condition: sense data available */ + Ucbit cm : 1; /* condition met */ + Ucbit busy : 1; /* device busy or reserved */ + Ucbit is : 1; /* intermediate status sent */ + Ucbit vu_05 : 1; /* vendor unique */ +#define st_scsi2 vu_05 /* SCSI-2 modifier bit */ + Ucbit vu_06 : 1; /* vendor unique */ + Ucbit st_rsvd : 1; /* reserved */ + +#ifdef SCSI_EXTENDED_STATUS +#define ext_st1 st_rsvd /* extended status (next byte valid) */ + /* byte 1 */ + Ucbit ha_er : 1; /* host adapter detected error */ + Ucbit reserved: 6; /* reserved */ + Ucbit ext_st2 : 1; /* extended status (next byte valid) */ + /* byte 2 */ + Uchar byte2; /* third byte */ +#endif /* SCSI_EXTENDED_STATUS */ +}; + +#else /* Motorola byteorder */ + +struct scsi_status { + Ucbit st_rsvd : 1; /* reserved */ + Ucbit vu_06 : 1; /* vendor unique */ + Ucbit vu_05 : 1; /* vendor unique */ +#define st_scsi2 vu_05 /* SCSI-2 modifier bit */ + Ucbit is : 1; /* intermediate status sent */ + Ucbit busy : 1; /* device busy or reserved */ + Ucbit cm : 1; /* condition met */ + Ucbit chk : 1; /* check condition: sense data available */ + Ucbit vu_00 : 1; /* vendor unique */ +#ifdef SCSI_EXTENDED_STATUS +#define ext_st1 st_rsvd /* extended status (next byte valid) */ + /* byte 1 */ + Ucbit ext_st2 : 1; /* extended status (next byte valid) */ + Ucbit reserved: 6; /* reserved */ + Ucbit ha_er : 1; /* host adapter detected error */ + /* byte 2 */ + Uchar byte2; /* third byte */ +#endif /* SCSI_EXTENDED_STATUS */ +}; +#endif + +/* + * OLD Standard (Non Extended) SCSI Sense. Used mainly by the + * Adaptec ACB 4000 which is the only controller that + * does not support the Extended sense format. + */ +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_sense { /* scsi sense for error classes 0-6 */ + Ucbit code : 7; /* error class/code */ + Ucbit adr_val : 1; /* sense data is valid */ +#ifdef comment + Ucbit high_addr:5; /* high byte of block addr */ + Ucbit rsvd : 3; +#else + Uchar high_addr; /* high byte of block addr */ +#endif + Uchar mid_addr; /* middle byte of block addr */ + Uchar low_addr; /* low byte of block addr */ +}; + +#else /* Motorola byteorder */ + +struct scsi_sense { /* scsi sense for error classes 0-6 */ + Ucbit adr_val : 1; /* sense data is valid */ + Ucbit code : 7; /* error class/code */ +#ifdef comment + Ucbit rsvd : 3; + Ucbit high_addr:5; /* high byte of block addr */ +#else + Uchar high_addr; /* high byte of block addr */ +#endif + Uchar mid_addr; /* middle byte of block addr */ + Uchar low_addr; /* low byte of block addr */ +}; +#endif + +/* + * SCSI extended sense parameter block. + */ +#ifdef comment +#define SC_CLASS_EXTENDED_SENSE 0x7 /* indicates extended sense */ +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_ext_sense { /* scsi extended sense for error class 7 */ + /* byte 0 */ + Ucbit type : 7; /* fixed at 0x70 */ + Ucbit adr_val : 1; /* sense data is valid */ + /* byte 1 */ + Uchar seg_num; /* segment number, applies to copy cmd only */ + /* byte 2 */ + Ucbit key : 4; /* sense key, see below */ + Ucbit : 1; /* reserved */ + Ucbit ili : 1; /* incorrect length indicator */ + Ucbit eom : 1; /* end of media */ + Ucbit fil_mk : 1; /* file mark on device */ + /* bytes 3 through 7 */ + Uchar info_1; /* information byte 1 */ + Uchar info_2; /* information byte 2 */ + Uchar info_3; /* information byte 3 */ + Uchar info_4; /* information byte 4 */ + Uchar add_len; /* number of additional bytes */ + /* bytes 8 through 13, CCS additions */ + Uchar optional_8; /* CCS search and copy only */ + Uchar optional_9; /* CCS search and copy only */ + Uchar optional_10; /* CCS search and copy only */ + Uchar optional_11; /* CCS search and copy only */ + Uchar sense_code; /* sense code */ + Uchar qual_code; /* sense code qualifier */ + Uchar fru_code; /* Field replacable unit code */ + Ucbit bptr : 3; /* bit pointer for failure (if bpv) */ + Ucbit bpv : 1; /* bit pointer is valid */ + Ucbit : 2; + Ucbit cd : 1; /* pointers refer to command not data */ + Ucbit sksv : 1; /* sense key specific valid */ + Uchar field_ptr[2]; /* field pointer for failure */ + Uchar add_info[2]; /* round up to 20 bytes */ +}; + +#else /* Motorola byteorder */ + +struct scsi_ext_sense { /* scsi extended sense for error class 7 */ + /* byte 0 */ + Ucbit adr_val : 1; /* sense data is valid */ + Ucbit type : 7; /* fixed at 0x70 */ + /* byte 1 */ + Uchar seg_num; /* segment number, applies to copy cmd only */ + /* byte 2 */ + Ucbit fil_mk : 1; /* file mark on device */ + Ucbit eom : 1; /* end of media */ + Ucbit ili : 1; /* incorrect length indicator */ + Ucbit : 1; /* reserved */ + Ucbit key : 4; /* sense key, see below */ + /* bytes 3 through 7 */ + Uchar info_1; /* information byte 1 */ + Uchar info_2; /* information byte 2 */ + Uchar info_3; /* information byte 3 */ + Uchar info_4; /* information byte 4 */ + Uchar add_len; /* number of additional bytes */ + /* bytes 8 through 13, CCS additions */ + Uchar optional_8; /* CCS search and copy only */ + Uchar optional_9; /* CCS search and copy only */ + Uchar optional_10; /* CCS search and copy only */ + Uchar optional_11; /* CCS search and copy only */ + Uchar sense_code; /* sense code */ + Uchar qual_code; /* sense code qualifier */ + Uchar fru_code; /* Field replacable unit code */ + Ucbit sksv : 1; /* sense key specific valid */ + Ucbit cd : 1; /* pointers refer to command not data */ + Ucbit : 2; + Ucbit bpv : 1; /* bit pointer is valid */ + Ucbit bptr : 3; /* bit pointer for failure (if bpv) */ + Uchar field_ptr[2]; /* field pointer for failure */ + Uchar add_info[2]; /* round up to 20 bytes */ +}; +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _SCG_SCSISENSE_H */ diff --git a/scsilib/include/scg/scsitransp.h b/scsilib/include/scg/scsitransp.h new file mode 100644 index 0000000..d413c85 --- /dev/null +++ b/scsilib/include/scg/scsitransp.h @@ -0,0 +1,257 @@ +/* @(#)scsitransp.h 1.54 03/05/03 Copyright 1995 J. Schilling */ +/* + * Definitions for commands that use functions from scsitransp.c + * + * Copyright (c) 1995 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _SCG_SCSITRANSP_H +#define _SCG_SCSITRANSP_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct scg_scsi SCSI; + +typedef struct { + int scsibus; /* SCSI bus # for next I/O */ + int target; /* SCSI target # for next I/O */ + int lun; /* SCSI lun # for next I/O */ +} scg_addr_t; + +#ifndef _SCG_SCGOPS_H +#include <scg/scgops.h> +#endif + +typedef int (*scg_cb_t) __PR((void *)); + +struct scg_scsi { + scg_ops_t *ops; /* Ptr to low level SCSI transport ops */ + int fd; /* File descriptor for next I/O */ + scg_addr_t addr; /* SCSI address for next I/O */ + int flags; /* Libscg flags (see below) */ + int dflags; /* Drive specific flags (see below) */ + int kdebug; /* Kernel debug value for next I/O */ + int debug; /* Debug value for SCSI library */ + int silent; /* Be silent if value > 0 */ + int verbose; /* Be verbose if value > 0 */ + int overbose; /* Be verbose in open() if value > 0 */ + int disre_disable; + int deftimeout; + int noparity; /* Do not use SCSI parity fo next I/O */ + int dev; /* from scsi_cdr.c */ + struct scg_cmd *scmd; + char *cmdname; + char *curcmdname; + BOOL running; + int error; /* libscg error number */ + + long maxdma; /* Max DMA limit for this open instance */ + long maxbuf; /* Cur DMA buffer limit for this inst. */ + /* This is the size behind bufptr */ + struct timeval *cmdstart; + struct timeval *cmdstop; + const char **nonstderrs; + void *local; /* Local data from the low level code */ + void *bufbase; /* needed for scsi_freebuf() */ + void *bufptr; /* DMA buffer pointer for appl. use */ + char *errstr; /* Error string for scsi_open/sendmcd */ + char *errbeg; /* Pointer to begin of not flushed data */ + char *errptr; /* Actual write pointer into errstr */ + void *errfile; /* FILE to write errors to. NULL for not*/ + /* writing and leaving errs in errstr */ + scg_cb_t cb_fun; + void *cb_arg; + + struct scsi_inquiry *inq; + struct scsi_capacity *cap; +}; + +/* + * Macros for accessing members of the scg address structure. + * scg_settarget() is the only function that is allowed to modify + * the values of the SCSI address. + */ +#define scg_scsibus(scgp) (scgp)->addr.scsibus +#define scg_target(scgp) (scgp)->addr.target +#define scg_lun(scgp) (scgp)->addr.lun + +/* + * Flags for struct SCSI: + */ +/* NONE yet */ + +/* + * Drive specific flags for struct SCSI: + */ +#define DRF_MODE_DMA_OVR 0x0001 /* Drive gives DMA overrun */ + /* on mode sense */ + +#define SCSI_ERRSTR_SIZE 4096 + +/* + * Libscg error codes: + */ +#define SCG_ERRBASE 1000000 +#define SCG_NOMEM 1000001 + +/* + * Function codes for scg_version(): + */ +#define SCG_VERSION 0 /* libscg or transport version */ +#define SCG_AUTHOR 1 /* Author of above */ +#define SCG_SCCS_ID 2 /* SCCS id of above */ +#define SCG_RVERSION 10 /* Remote transport version */ +#define SCG_RAUTHOR 11 /* Remote transport author */ +#define SCG_RSCCS_ID 12 /* Remote transport SCCS ID */ +#define SCG_KVERSION 20 /* Kernel transport version */ + +/* + * Function codes for scg_reset(): + */ +#define SCG_RESET_NOP 0 /* Test if reset is supported */ +#define SCG_RESET_TGT 1 /* Reset Target only */ +#define SCG_RESET_BUS 2 /* Reset complete SCSI Bus */ + +/* + * Helpers for the error buffer in SCSI* + */ +#define scg_errsize(scgp) ((scgp)->errptr - (scgp)->errstr) +#define scg_errrsize(scgp) (SCSI_ERRSTR_SIZE - scg_errsize(scgp)) + +/* + * From scsitransp.c: + */ +extern char *scg_version __PR((SCSI *scgp, int what)); +extern int scg__open __PR((SCSI *scgp, char *device)); +extern int scg__close __PR((SCSI *scgp)); +extern BOOL scg_havebus __PR((SCSI *scgp, int)); +extern int scg_initiator_id __PR((SCSI *scgp)); +extern int scg_isatapi __PR((SCSI *scgp)); +extern int scg_reset __PR((SCSI *scgp, int what)); +extern void *scg_getbuf __PR((SCSI *scgp, long)); +extern void scg_freebuf __PR((SCSI *scgp)); +extern long scg_bufsize __PR((SCSI *scgp, long)); +extern void scg_setnonstderrs __PR((SCSI *scgp, const char **)); +extern BOOL scg_yes __PR((char *)); +extern int scg_cmd __PR((SCSI *scgp)); +extern void scg_vhead __PR((SCSI *scgp)); +extern int scg_svhead __PR((SCSI *scgp, char *buf, int maxcnt)); +extern int scg_vtail __PR((SCSI *scgp)); +extern int scg_svtail __PR((SCSI *scgp, int *retp, char *buf, int maxcnt)); +extern void scg_vsetup __PR((SCSI *scgp)); +extern int scg_getresid __PR((SCSI *scgp)); +extern int scg_getdmacnt __PR((SCSI *scgp)); +extern BOOL scg_cmd_err __PR((SCSI *scgp)); +extern void scg_printerr __PR((SCSI *scgp)); +#ifdef EOF /* stdio.h has been included */ +extern void scg_fprinterr __PR((SCSI *scgp, FILE *f)); +#endif +extern int scg_sprinterr __PR((SCSI *scgp, char *buf, int maxcnt)); +extern int scg__sprinterr __PR((SCSI *scgp, char *buf, int maxcnt)); +extern void scg_printcdb __PR((SCSI *scgp)); +extern int scg_sprintcdb __PR((SCSI *scgp, char *buf, int maxcnt)); +extern void scg_printwdata __PR((SCSI *scgp)); +extern int scg_sprintwdata __PR((SCSI *scgp, char *buf, int maxcnt)); +extern void scg_printrdata __PR((SCSI *scgp)); +extern int scg_sprintrdata __PR((SCSI *scgp, char *buf, int maxcnt)); +extern void scg_printresult __PR((SCSI *scgp)); +extern int scg_sprintresult __PR((SCSI *scgp, char *buf, int maxcnt)); +extern void scg_printstatus __PR((SCSI *scgp)); +extern int scg_sprintstatus __PR((SCSI *scgp, char *buf, int maxcnt)); +#ifdef EOF /* stdio.h has been included */ +extern void scg_fprbytes __PR((FILE *, char *, unsigned char *, int)); +extern void scg_fprascii __PR((FILE *, char *, unsigned char *, int)); +#endif +extern void scg_prbytes __PR((char *, unsigned char *, int)); +extern void scg_prascii __PR((char *, unsigned char *, int)); +extern int scg_sprbytes __PR((char *buf, int maxcnt, char *, unsigned char *, int)); +extern int scg_sprascii __PR((char *buf, int maxcnt, char *, unsigned char *, int)); +#ifdef EOF /* stdio.h has been included */ +extern void scg_fprsense __PR((FILE *f, unsigned char *, int)); +#endif +extern void scg_prsense __PR((unsigned char *, int)); +extern int scg_sprsense __PR((char *buf, int maxcnt, unsigned char *, int)); +extern int scg_cmd_status __PR((SCSI *scgp)); +extern int scg_sense_key __PR((SCSI *scgp)); +extern int scg_sense_code __PR((SCSI *scgp)); +extern int scg_sense_qual __PR((SCSI *scgp)); +#ifdef _SCG_SCSIREG_H +#ifdef EOF /* stdio.h has been included */ +extern void scg_fprintdev __PR((FILE *, struct scsi_inquiry *)); +#endif +extern void scg_printdev __PR((struct scsi_inquiry *)); +#endif +extern int scg_printf __PR((SCSI *scgp, const char *form, ...)); +extern int scg_errflush __PR((SCSI *scgp)); +#ifdef EOF /* stdio.h has been included */ +extern int scg_errfflush __PR((SCSI *scgp, FILE *f)); +#endif + +/* + * From scsierrmsg.c: + */ +extern const char *scg_sensemsg __PR((int, int, int, + const char **, char *, int maxcnt)); +#ifdef _SCG_SCSISENSE_H +extern int scg__errmsg __PR((SCSI *scgp, char *obuf, int maxcnt, + struct scsi_sense *, + struct scsi_status *, + int)); +#endif + +/* + * From scsiopen.c: + */ +#ifdef EOF /* stdio.h has been included */ +extern int scg_help __PR((FILE *f)); +#endif +extern SCSI *scg_open __PR((char *scsidev, char *errs, int slen, int odebug, int be_verbose)); +extern int scg_close __PR((SCSI * scgp)); +extern void scg_settimeout __PR((SCSI * scgp, int timeout)); +extern SCSI *scg_smalloc __PR((void)); +extern void scg_sfree __PR((SCSI *scgp)); + +/* + * From scgsettarget.c: + */ +extern int scg_settarget __PR((SCSI *scgp, int scsibus, int target, int lun)); + +/* + * From scsi-remote.c: + */ +extern scg_ops_t *scg_remote __PR((void)); + +/* + * From scsihelp.c: + */ +#ifdef EOF /* stdio.h has been included */ +extern void __scg_help __PR((FILE *f, char *name, char *tcomment, + char *tind, + char *tspec, + char *texample, + BOOL mayscan, + BOOL bydev)); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _SCG_SCSITRANSP_H */ diff --git a/scsilib/include/scg/spti-wnt.h b/scsilib/include/scg/spti-wnt.h new file mode 100644 index 0000000..cad384e --- /dev/null +++ b/scsilib/include/scg/spti-wnt.h @@ -0,0 +1,131 @@ +/* + * distilled information from various header files from Microsoft's + * DDK for Windows NT 4.0 + */ +#ifndef _SCSIPT_H_INC +#define _SCSIPT_H_INC + +#include <windows.h> + +typedef struct { + USHORT Length; + UCHAR ScsiStatus; + UCHAR PathId; + UCHAR TargetId; + UCHAR Lun; + UCHAR CdbLength; + UCHAR SenseInfoLength; + UCHAR DataIn; + ULONG DataTransferLength; + ULONG TimeOutValue; + ULONG DataBufferOffset; + ULONG SenseInfoOffset; + UCHAR Cdb[16]; +} SCSI_PASS_THROUGH, *PSCSI_PASS_THROUGH; + + +typedef struct { + USHORT Length; + UCHAR ScsiStatus; + UCHAR PathId; + UCHAR TargetId; + UCHAR Lun; + UCHAR CdbLength; + UCHAR SenseInfoLength; + UCHAR DataIn; + ULONG DataTransferLength; + ULONG TimeOutValue; + PVOID DataBuffer; + ULONG SenseInfoOffset; + UCHAR Cdb[16]; +} SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT; + + +typedef struct { + SCSI_PASS_THROUGH spt; + ULONG Filler; + UCHAR ucSenseBuf[32]; + UCHAR ucDataBuf[512]; +} SCSI_PASS_THROUGH_WITH_BUFFERS, *PSCSI_PASS_THROUGH_WITH_BUFFERS; + + +typedef struct { + SCSI_PASS_THROUGH_DIRECT spt; + ULONG Filler; + UCHAR ucSenseBuf[32]; +} SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, *PSCSI_PASS_THROUGH_DIRECT_WITH_BUFFER; + + + +typedef struct { + UCHAR NumberOfLogicalUnits; + UCHAR InitiatorBusId; + ULONG InquiryDataOffset; +} SCSI_BUS_DATA, *PSCSI_BUS_DATA; + + +typedef struct { + UCHAR NumberOfBusses; + SCSI_BUS_DATA BusData[1]; +} SCSI_ADAPTER_BUS_INFO, *PSCSI_ADAPTER_BUS_INFO; + + +typedef struct { + UCHAR PathId; + UCHAR TargetId; + UCHAR Lun; + BOOLEAN DeviceClaimed; + ULONG InquiryDataLength; + ULONG NextInquiryDataOffset; + UCHAR InquiryData[1]; +} SCSI_INQUIRY_DATA, *PSCSI_INQUIRY_DATA; + + +typedef struct { + ULONG Length; + UCHAR PortNumber; + UCHAR PathId; + UCHAR TargetId; + UCHAR Lun; +} SCSI_ADDRESS, *PSCSI_ADDRESS; + + +/* + * method codes + */ +#define METHOD_BUFFERED 0 +#define METHOD_IN_DIRECT 1 +#define METHOD_OUT_DIRECT 2 +#define METHOD_NEITHER 3 + +/* + * file access values + */ +#define FILE_ANY_ACCESS 0 +#define FILE_READ_ACCESS 0x0001 +#define FILE_WRITE_ACCESS 0x0002 + + +#define IOCTL_SCSI_BASE 0x00000004 + +/* + * constants for DataIn member of SCSI_PASS_THROUGH* structures + */ +#define SCSI_IOCTL_DATA_OUT 0 +#define SCSI_IOCTL_DATA_IN 1 +#define SCSI_IOCTL_DATA_UNSPECIFIED 2 + +/* + * Standard IOCTL define + */ +#define CTL_CODE(DevType, Function, Method, Access) \ + (((DevType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method)) + +#define IOCTL_SCSI_PASS_THROUGH CTL_CODE(IOCTL_SCSI_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_SCSI_MINIPORT CTL_CODE(IOCTL_SCSI_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_SCSI_GET_INQUIRY_DATA CTL_CODE(IOCTL_SCSI_BASE, 0x0403, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_SCSI_GET_CAPABILITIES CTL_CODE(IOCTL_SCSI_BASE, 0x0404, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_SCSI_PASS_THROUGH_DIRECT CTL_CODE(IOCTL_SCSI_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_SCSI_GET_ADDRESS CTL_CODE(IOCTL_SCSI_BASE, 0x0406, METHOD_BUFFERED, FILE_ANY_ACCESS) + +#endif diff --git a/scsilib/include/scg/srb_os2.h b/scsilib/include/scg/srb_os2.h new file mode 100644 index 0000000..b1d3aa6 --- /dev/null +++ b/scsilib/include/scg/srb_os2.h @@ -0,0 +1,169 @@ +/* @(#)srb_os2.h 1.0 98/10/28 Copyright 1998 D. Dorau, C. Wohlgemuth */ +/* + * Definitions for ASPI-Router (ASPIROUT.SYS). + * + * Copyright (c) 1998 D. Dorau, C. Wohlgemuth + */ + + +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#pragma pack(1) + + /* SRB command */ +#define SRB_Inquiry 0x00 +#define SRB_Device 0x01 +#define SRB_Command 0x02 +#define SRB_Abort 0x03 +#define SRB_Reset 0x04 +#define SRB_Param 0x05 + + /* SRB status */ +#define SRB_Busy 0x00 /* SCSI request in progress */ +#define SRB_Done 0x01 /* SCSI request completed without error */ +#define SRB_Aborted 0x02 /* SCSI aborted by host */ +#define SRB_BadAbort 0x03 /* Unable to abort SCSI request */ +#define SRB_Error 0x04 /* SCSI request completed with error */ +#define SRB_BusyPost 0x10 /* SCSI request in progress with POST - Nokia */ +#define SRB_InvalidCmd 0x80 /* Invalid SCSI request */ +#define SRB_InvalidHA 0x81 /* Invalid Hhost adapter number */ +#define SRB_BadDevice 0x82 /* SCSI device not installed */ + + /* SRB flags */ +#define SRB_Post 0x01 /* Post vector valid */ +#define SRB_Link 0x02 /* Link vector valid */ +#define SRB_SG 0x04 /* Nokia: scatter/gather */ + /* S/G: n * (4 bytes length, 4 bytes addr) */ + /* No of s/g items not limited by HA spec. */ +#define SRB_NoCheck 0x00 /* determined by command, not checked */ +#define SRB_Read 0x08 /* target to host, length checked */ +#define SRB_Write 0x10 /* host to target, length checked */ +#define SRB_NoTransfer 0x18 /* no data transfer */ +#define SRB_DirMask 0x18 /* bit mask */ + + /* SRB host adapter status */ +#define SRB_NoError 0x00 /* No host adapter detected error */ +#define SRB_Timeout 0x11 /* Selection timeout */ +#define SRB_DataLength 0x12 /* Data over/underrun */ +#define SRB_BusFree 0x13 /* Unexpected bus free */ +#define SRB_BusSequence 0x14 /* Target bus sequence failure */ + + /* SRB target status field */ +#define SRB_NoStatus 0x00 /* No target status */ +#define SRB_CheckStatus 0x02 /* Check status (sense data valid) */ +#define SRB_LUN_Busy 0x08 /* Specified LUN is busy */ +#define SRB_Reserved 0x18 /* Reservation conflict */ + +#define MaxCDBStatus 64 /* max size of CDB + status */ + + +typedef struct SRb { + unsigned char cmd, /* 00 */ + status, /* 01 */ + ha_num, /* 02 */ + flags; /* 03 */ + unsigned long res_04_07; /* 04..07 */ + union { /* 08 */ + + /* SRB_Inquiry */ + struct { + unsigned char num_ha, /* 08 */ + ha_target, /* 09 */ + aspimgr_id[16], /* 0A..19 */ + host_id[16], /* 1A..29 */ + unique_id[16]; /* 2A..39 */ + } inq; + + /* SRB_Device */ + struct { + unsigned char target, /* 08 */ + lun, /* 09 */ + devtype; /* 0A */ + } dev; + + /* SRB_Command */ + struct { + unsigned char target, /* 08 */ + lun; /* 09 */ + unsigned long data_len; /* 0A..0D */ + unsigned char sense_len; /* 0E */ + unsigned long data_ptr; /* 0F..12 */ + unsigned long link_ptr; /* 13..16 */ + // void * _Seg16 data_ptr; /* 0F..12 */ + // void * _Seg16 link_ptr; /* 13..16 */ + unsigned char cdb_len, /* 17 */ + ha_status, /* 18 */ + target_status; /* 19 */ + unsigned char _Seg16postSRB[4]; + // void (* _Seg16 post) (SRB *); /* 1A..1D */ + unsigned char res_1E_29[12]; /* 1E..29 */ + unsigned char res_2A_3F[22]; /* 2A..3F */ + unsigned char cdb_st[64]; /* 40..7F CDB+status */ + unsigned char res_80_BF[64]; /* 80..BF */ + } cmd; + + /* SRB_Abort */ + struct { + unsigned char _Seg16srb[4]; + // void * _Seg16 srb; /* 08..0B */ + } abt; + + /* SRB_Reset */ + struct { + unsigned char target, /* 08 */ + lun, /* 09 */ + res_0A_17[14], /* 0A..17 */ + ha_status, /* 18 */ + target_status; /* 19 */ + } res; + + /* SRB_Param - unused by ASPI4OS2 */ + struct { + unsigned char unique[16]; /* 08..17 */ + } par; + + } u; +} SRB; + + +// SCSI sense codes +// Note! This list may not be complete. I did this compilation for use with tape drives. + +#define Sense_Current 0x70; // Current Error +#define Sense_Deferred 0x71; // Deferred Error +#define Sense_Filemark 0x80; // Filemark detected +#define Sense_EOM 0x40; // End of medium detected +#define Sense_ILI 0x20; // Incorrect length indicator + +// Sense Keys + +#define SK_NoSense 0x00; // No Sense +#define SK_RcvrdErr 0x01; // Recovered Error +#define SK_NotReady 0x02; // Not ready +#define SK_MedErr 0x03; // Medium Error +#define SK_HWErr 0x04; // Hardware Error +#define SK_IllReq 0x05; // Illegal Request +#define SK_UnitAtt 0x06; // Unit attention +#define SK_DataProt 0x07: // Data Protect +#define SK_BlankChk 0x08: // Blank Check +#define SK_VndSpec 0x09; // Vendor Specific +#define SK_CopyAbort 0x0A; // Copy Aborted +#define SK_AbtdCmd 0x0B; // Aborted Command +#define SK_Equal 0x0C; // Equal +#define SK_VolOvfl 0x0D; // Volume Overflow +#define SK_MisComp 0x0E; // Miscompare +#define SK_Reserved 0x0F; // Reserved diff --git a/scsilib/include/schily.h b/scsilib/include/schily.h new file mode 100644 index 0000000..8163a16 --- /dev/null +++ b/scsilib/include/schily.h @@ -0,0 +1,308 @@ +/* @(#)schily.h 1.52 04/03/05 Copyright 1985-2002 J. Schilling */ +/* + * Definitions for libschily + * + * This file should be included past: + * + * mconfig.h / config.h + * standard.h + * stdio.h + * stdlib.h (better use stdxlib.h) + * unistd.h (better use unixstd.h) needed LARGEFILE support + * string.h + * sys/types.h + * + * If you need stdio.h, you must include it before schily.h + * + * NOTE: If you need ctype.h and did not include stdio.h you need to + * include ctype.h past schily.h as OpenBSD does not follow POSIX and + * defines EOF in ctype.h + * + * Copyright (c) 1985-2002 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _SCHILY_H +#define _SCHILY_H + +#ifndef _STANDARD_H +#include <standard.h> +#endif +#ifndef _CCOMDEFS_H +#include <ccomdefs.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(_INCL_SYS_TYPES_H) || defined(off_t) +# ifndef FOUND_OFF_T +# define FOUND_OFF_T +# endif +#endif +#if defined(_INCL_SYS_TYPES_H) || defined(size_t) +# ifndef FOUND_SIZE_T +# define FOUND_SIZE_T +# endif +#endif + +#ifdef __never_def__ +/* + * It turns out that we cannot use the folloginw definition because there are + * some platforms that do not behave application friendly. These are mainly + * BSD-4.4 based systems (which #undef a definition when size_t is available. + * We actually removed this code because of a problem with QNX Neutrino. + * For this reason, it is important not to include <sys/types.h> directly but + * via the Schily SING include files so we know whether it has been included + * before we come here. + */ +#if defined(_SIZE_T) || defined(_T_SIZE_) || defined(_T_SIZE) || \ + defined(__SIZE_T) || defined(_SIZE_T_) || \ + defined(_GCC_SIZE_T) || defined(_SIZET_) || \ + defined(__sys_stdtypes_h) || defined(___int_size_t_h) || defined(size_t) + +#ifndef FOUND_SIZE_T +# define FOUND_SIZE_T /* We already included a size_t definition */ +#endif +#endif +#endif /* __never_def__ */ + +#if defined(HAVE_LARGEFILES) +# define _fcons _fcons64 +# define fdup fdup64 +# define fileluopen fileluopen64 +# define fileopen fileopen64 +# define filemopen filemopen64 +# define filepos filepos64 +# define filereopen filereopen64 +# define fileseek fileseek64 +# define filesize filesize64 +# define filestat filestat64 +# define _openfd _openfd64 +#endif + +#ifdef EOF /* stdio.h has been included */ +extern int _cvmod __PR((const char *, int *, int *)); +extern FILE *_fcons __PR((FILE *, int, int)); +extern FILE *fdup __PR((FILE *)); +extern int fdown __PR((FILE *)); +extern int fexecl __PR((const char *, FILE *, FILE *, FILE *, + const char *, ...)); +extern int fexecle __PR((const char *, FILE *, FILE *, FILE *, + const char *, ...)); + /* 6th arg not const, fexecv forces av[ac] = NULL */ +extern int fexecv __PR((const char *, FILE *, FILE *, FILE *, int, + char **)); +extern int fexecve __PR((const char *, FILE *, FILE *, FILE *, + char * const *, char * const *)); +extern int fspawnv __PR((FILE *, FILE *, FILE *, int, char * const *)); +extern int fspawnl __PR((FILE *, FILE *, FILE *, + const char *, const char *, ...)); +extern int fspawnv_nowait __PR((FILE *, FILE *, FILE *, + const char *, int, char *const*)); +extern int fgetline __PR((FILE *, char *, int)); +extern int fgetstr __PR((FILE *, char *, int)); +extern void file_raise __PR((FILE *, int)); +extern int fileclose __PR((FILE *)); +extern FILE *fileluopen __PR((int, const char *)); +extern FILE *fileopen __PR((const char *, const char *)); +#ifdef _INCL_SYS_TYPES_H +extern FILE *filemopen __PR((const char *, const char *, mode_t)); +#endif +#ifdef FOUND_OFF_T +extern off_t filepos __PR((FILE *)); +#endif +extern int fileread __PR((FILE *, void *, int)); +extern int ffileread __PR((FILE *, void *, int)); +extern FILE *filereopen __PR((const char *, const char *, FILE *)); +#ifdef FOUND_OFF_T +extern int fileseek __PR((FILE *, off_t)); +extern off_t filesize __PR((FILE *)); +#endif +#ifdef S_IFMT +extern int filestat __PR((FILE *, struct stat *)); +#endif +extern int filewrite __PR((FILE *, void *, int)); +extern int ffilewrite __PR((FILE *, void *, int)); +extern int flush __PR((void)); +extern int fpipe __PR((FILE **)); +/*extern int fprintf __PR((FILE *, const char *, ...)) __printflike__(2, 3);*/ +extern int getbroken __PR((FILE *, char *, char, char **, int)); +extern int ofindline __PR((FILE *, char, const char *, int, + char **, int)); +extern int peekc __PR((FILE *)); + +#ifdef __never_def__ +/* + * We cannot define this or we may get into problems with DOS based systems. + */ +extern int spawnv __PR((FILE *, FILE *, FILE *, int, char * const *)); +extern int spawnl __PR((FILE *, FILE *, FILE *, + const char *, const char *, ...)); +extern int spawnv_nowait __PR((FILE *, FILE *, FILE *, + const char *, int, char *const*)); +#endif /* __never_def__m */ +#endif /* EOF */ + +extern int _niread __PR((int, void *, int)); +extern int _niwrite __PR((int, void *, int)); +extern int _nixread __PR((int, void *, int)); +extern int _nixwrite __PR((int, void *, int)); +extern int _openfd __PR((const char *, int)); +extern int on_comerr __PR((void (*fun)(int, void *), void *arg)); +/*PRINTFLIKE1*/ +extern void comerr __PR((const char *, ...)) __printflike__(1, 2); +/*PRINTFLIKE2*/ +extern void comerrno __PR((int, const char *, ...)) __printflike__(2, 3); +/*PRINTFLIKE1*/ +extern int errmsg __PR((const char *, ...)) __printflike__(1, 2); +/*PRINTFLIKE2*/ +extern int errmsgno __PR((int, const char *, ...)) __printflike__(2, 3); +#ifdef FOUND_SIZE_T +/*PRINTFLIKE3*/ +extern int serrmsg __PR((char *, size_t, const char *, ...)) __printflike__(3, 4); +/*PRINTFLIKE4*/ +extern int serrmsgno __PR((int, char *, size_t, const char *, ...)) __printflike__(4, 5); +#endif +extern void comexit __PR((int)); +extern char *errmsgstr __PR((int)); +/*PRINTFLIKE1*/ +extern int error __PR((const char *, ...)) __printflike__(1, 2); +extern char *fillbytes __PR((void *, int, char)); +extern char *findbytes __PR((const void *, int, char)); +extern int findline __PR((const char *, char, const char *, + int, char **, int)); +extern int getline __PR((char *, int)); +extern int getstr __PR((char *, int)); +extern int breakline __PR((char *, char, char **, int)); +extern int getallargs __PR((int *, char * const**, const char *, ...)); +extern int getargs __PR((int *, char * const**, const char *, ...)); +extern int getfiles __PR((int *, char * const**, const char *)); +extern char *astoi __PR((const char *, int *)); +extern char *astol __PR((const char *, long *)); +extern char *astolb __PR((const char *, long *, int base)); +#ifdef _UTYPES_H +extern char *astoll __PR((const char *, Llong *)); +extern char *astollb __PR((const char *, Llong *, int base)); +#endif + +/*extern void handlecond __PR((const char *, SIGBLK *, int(*)(const char *, long, long), long));*/ +/*extern void unhandlecond __PR((SIGBLK *));*/ + +extern int patcompile __PR((const unsigned char *, int, int *)); +extern unsigned char *patmatch __PR((const unsigned char *, const int *, + const unsigned char *, int, int, int, int[])); +extern unsigned char *patlmatch __PR((const unsigned char *, const int *, + const unsigned char *, int, int, int, int[])); + +/*extern int printf __PR((const char *, ...)) __printflike__(1, 2);*/ +extern char *movebytes __PR((const void *, void *, int)); + +extern void save_args __PR((int, char **)); +extern int saved_ac __PR((void)); +extern char **saved_av __PR((void)); +extern char *saved_av0 __PR((void)); +#ifndef seterrno +extern int seterrno __PR((int)); +#endif +extern void set_progname __PR((const char *)); +extern char *get_progname __PR((void)); + +extern void setfp __PR((void * const *)); +extern int wait_chld __PR((int)); /* for fspawnv_nowait() */ +extern int geterrno __PR((void)); +extern void raisecond __PR((const char *, long)); +#ifdef FOUND_SIZE_T +/* + * We currently cannot define this here because there IXIX has a definition + * than violates the standard. + */ +#ifndef HAVE_SNPRINTF +/*PRINTFLIKE3*/ +extern int snprintf __PR((char *, size_t, const char *, ...)) __printflike__(3, 4); +#endif +#endif +/*extern int sprintf __PR((char *, const char *, ...)); ist woanders falsch deklariert !!!*/ +extern char *strcatl __PR((char *, ...)); +extern int streql __PR((const char *, const char *)); +#ifdef va_arg +extern int format __PR((void (*)(char, long), long, const char *, va_list)); +#else +extern int format __PR((void (*)(char, long), long, const char *, void *)); +#endif + +extern int ftoes __PR((char *, double, int, int)); +extern int ftofs __PR((char *, double, int, int)); + +#ifdef EOF /* stdio.h has been included */ +/*PRINTFLIKE2*/ +extern int js_fprintf __PR((FILE *, const char *, ...)) __printflike__(2, 3); +/*PRINTFLIKE1*/ +extern int js_printf __PR((const char *, ...)) __printflike__(1, 2); +#ifdef FOUND_SIZE_T +/*PRINTFLIKE3*/ +extern int js_snprintf __PR((char *, size_t, const char *, ...)) __printflike__(3, 4); +#endif +/*PRINTFLIKE2*/ +extern int js_sprintf __PR((char *, const char *, ...)) __printflike__(2, 3); +#endif /* EOF */ + +extern void swabbytes __PR((void *, int)); +extern char **getmainfp __PR((void)); +extern char **getavp __PR((void)); +extern char *getav0 __PR((void)); +extern void **getfp __PR((void)); +extern int flush_reg_windows __PR((int)); +extern int cmpbytes __PR((const void *, const void *, int)); +extern int cmpnullbytes __PR((const void *, int)); + +#ifdef nonono +#if defined(HAVE_LARGEFILES) +/* + * To allow this, we need to figure out how to do autoconfiguration for off64_t + */ +extern FILE *_fcons64 __PR((FILE *, int, int)); +extern FILE *fdup64 __PR((FILE *)); +extern FILE *fileluopen64 __PR((int, const char *)); +extern FILE *fileopen64 __PR((const char *, const char *)); +#ifdef FOUND_OFF_T +extern off64_t filepos64 __PR((FILE *)); +#endif +extern FILE *filereopen64 __PR((const char *, const char *, FILE *)); +#ifdef FOUND_OFF_T +extern int fileseek64 __PR((FILE *, off64_t)); +extern off64_t filesize64 __PR((FILE *)); +#endif +#ifdef S_IFMT +extern int filestat64 __PR((FILE *, struct stat *)); +#endif +extern int _openfd64 __PR((const char *, int)); +#endif +#endif + +#ifdef __cplusplus +} +#endif + +#if defined(_JOS) || defined(JOS) +# ifndef _JOS_IO_H +# include <jos_io.h> +# endif +#endif + +#endif /* _SCHILY_H */ diff --git a/scsilib/include/sigblk.h b/scsilib/include/sigblk.h new file mode 100644 index 0000000..4eefba0 --- /dev/null +++ b/scsilib/include/sigblk.h @@ -0,0 +1,69 @@ +/* @(#)sigblk.h 1.10 03/07/10 Copyright 1985, 1995-2003 J. Schilling */ +/* + * software signal block definition + * + * Copyright (c) 1985, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _SIGBLK_H +#define _SIGBLK_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _STANDARD_H +#include <standard.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct sigblk { + long **sb_savfp; /* Real saved framepointer */ + struct sigblk *sb_signext; /* Next sw signal blk for this func */ + short sb_siglen; /* Strlen for sb_signame */ + const char *sb_signame; /* Name of software signal */ + + /* sb_sigfun: function to call */ + int (*sb_sigfun) __PR((const char *, long, long)); + + long sb_sigarg; /* Second arg for sb_sigfun */ +} SIGBLK; + +/* + * The handler function is called with three arguments: + * + * 1) The name of the software signal + * 2) The argument from the handlecond() call + * 3) The argument from the raisecond() call + */ +typedef int (*handlefunc_t) __PR((const char *, long, long)); + +extern void handlecond __PR((const char *, SIGBLK *, + int(*)(const char *, long, long), + long)); +extern void raisecond __PR((const char *, long)); +extern void starthandlecond __PR((SIGBLK *)); +extern void unhandlecond __PR((SIGBLK *)); + +#ifdef __cplusplus +} +#endif + +#endif /* _SIGBLK_H */ diff --git a/scsilib/include/sigdefs.h b/scsilib/include/sigdefs.h new file mode 100644 index 0000000..6344599 --- /dev/null +++ b/scsilib/include/sigdefs.h @@ -0,0 +1,70 @@ +/* @(#)sigdefs.h 1.5 02/01/19 Copyright 1997 J. Schilling */ +/* + * Signal abstraction for BSD/SVR4 signals + * + * Copyright (c) 1997 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _SIGDEFS_H +#define _SIGDEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifdef HAVE_SIGSET +/* + * Try to by default use the function that sets up signal handlers in a way + * that does not reset the handler after it has been called. + */ +#define signal sigset +#endif + +#ifdef HAVE_SIGPROCMASK +#define block_sigs(a) { \ + sigset_t __new; \ + \ + sigfillset(&__new); \ + sigprocmask(SIG_BLOCK, &__new, &a);\ + } +#define unblock_sig(s) { \ + sigset_t __new; \ + \ + sigemptyset(&__new); \ + sigaddset(&__new, (s)); \ + sigprocmask(SIG_UNBLOCK, &__new, NULL);\ + } +#define restore_sigs(a) sigprocmask(SIG_SETMASK, &a, 0); + +#else /* !HAVE_SIGPROCMASK */ + +#define sigset_t int +#define block_sigs(a) a = sigblock(0xFFFFFFFF) +#define restore_sigs(a) sigsetmask(a); +#define unblock_sig(s) { \ + int __old, __new; \ + \ + block_sigs(__old); \ + __new = sigmask(s); \ + __new = __old & ~__new; \ + sigsetmask(__new); \ + } + +#endif /* HAVE_SIGPROCMASK */ + +#endif /* _SIGDEFS_H */ diff --git a/scsilib/include/standard.h b/scsilib/include/standard.h new file mode 100644 index 0000000..b8e576d --- /dev/null +++ b/scsilib/include/standard.h @@ -0,0 +1,154 @@ +/* @(#)standard.h 1.31 03/08/23 Copyright 1985 J. Schilling */ +/* + * standard definitions + * + * This file should be included past: + * + * mconfig.h / config.h + * stdio.h + * stdlib.h (better use stdxlib.h) + * unistd.h (better use unixstd.h) needed LARGEFILE support + * + * If you need stdio.h, you must include it before standard.h + * + * Copyright (c) 1985 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _STANDARD_H +#define _STANDARD_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif + +#ifdef M68000 +# ifndef tos +# define JOS 1 +# endif +#endif + +/* + * fundamental constants + */ +#ifndef NULL +# define NULL 0 +#endif +#ifndef TRUE +# define TRUE 1 +# define FALSE 0 +#endif + +/* + * Program exit codes + */ +#define EX_BAD (-1) + +/* + * standard storage class definitions + */ +#define GLOBAL extern +#define IMPORT extern +#define EXPORT +#define INTERN static +#define LOCAL static +#define FAST register + +#ifndef PROTOTYPES +# ifndef const +# define const +# endif +# ifndef signed +# define signed +# endif +# ifndef volatile +# define volatile +# endif +#endif /* PROTOTYPES */ + +/* + * standard type definitions + * + * The hidden Schily BOOL definition is used in case we need to deal + * with other BOOL defines on systems we like to port to. + */ +typedef int __SBOOL; +typedef int BOOL; +#ifdef JOS +# ifndef __GNUC__ +# define NO_VOID +# endif +#endif +#ifdef NO_VOID + typedef int VOID; +# ifndef lint + typedef int void; +# endif +#else + typedef void VOID; +#endif + +#if defined(_INCL_SYS_TYPES_H) || defined(off_t) +# ifndef FOUND_OFF_T +# define FOUND_OFF_T +# endif +#endif +#if defined(_INCL_SYS_TYPES_H) || defined(size_t) +# ifndef FOUND_SIZE_T +# define FOUND_SIZE_T +# endif +#endif + +#ifdef __never_def__ +/* + * It turns out that we cannot use the folloginw definition because there are + * some platforms that do not behave application friendly. These are mainly + * BSD-4.4 based systems (which #undef a definition when size_t is available. + * We actually removed this code because of a problem with QNX Neutrino. + * For this reason, it is important not to include <sys/types.h> directly but + * via the Schily SING include files so we know whether it has been included + * before we come here. + */ +#if defined(_SIZE_T) || defined(_T_SIZE_) || defined(_T_SIZE) || \ + defined(__SIZE_T) || defined(_SIZE_T_) || \ + defined(_GCC_SIZE_T) || defined(_SIZET_) || \ + defined(__sys_stdtypes_h) || defined(___int_size_t_h) || defined(size_t) + +#ifndef FOUND_SIZE_T +# define FOUND_SIZE_T /* We already included a size_t definition */ +#endif +#endif +#endif /* __never_def__ */ + +#if defined(_JOS) || defined(JOS) +# ifndef _SCHILY_H +# include <schily.h> +# endif + +# ifndef _JOS_DEFS_H +# include <jos_defs.h> +# endif + +# ifndef _JOS_IO_H +# include <jos_io.h> +# endif +#endif + +#endif /* _STANDARD_H */ diff --git a/scsilib/include/statdefs.h b/scsilib/include/statdefs.h new file mode 100644 index 0000000..9a28dae --- /dev/null +++ b/scsilib/include/statdefs.h @@ -0,0 +1,339 @@ +/* @(#)statdefs.h 1.9 03/06/15 Copyright 1998 J. Schilling */ +/* + * Definitions for stat() file mode + * + * Copyright (c) 1998 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _STATDEFS_H +#define _STATDEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> /* Needed for sys/stat.h */ +#define _INCL_SYS_TYPES_H +#endif +#ifndef _INCL_SYS_STAT_H +#include <sys/stat.h> /* For S_IS* and S_IF* */ +#define _INCL_SYS_STAT_H +#endif + +/* + * Apollo Domain/OS has a broken sys/stat.h that defines + * S_IFIFO == S_IFSOCK and creates trouble if the constants + * are used as case labels. + */ +#if S_IFIFO == S_IFSOCK +# undef S_IFSOCK +#endif + +#ifdef STAT_MACROS_BROKEN +#undef S_ISFIFO /* Named pipe */ +#undef S_ISCHR /* Character special */ +#undef S_ISMPC /* UNUSED multiplexed c */ +#undef S_ISDIR /* Directory */ +#undef S_ISNAM /* Named file (XENIX) */ +#undef S_ISBLK /* Block special */ +#undef S_ISMPB /* UNUSED multiplexed b */ +#undef S_ISREG /* Regular file */ +#undef S_ISCNT /* Contiguous file */ +#undef S_ISLNK /* Symbolic link */ +#undef S_ISSHAD /* Solaris shadow inode */ +#undef S_ISSOCK /* UNIX domain socket */ +#undef S_ISDOOR /* Solaris DOOR */ +#undef S_ISWHT /* BSD whiteout */ +#undef S_ISEVC /* UNOS eventcount */ +#endif + +#ifndef S_ISFIFO /* 1 Named pipe */ +# ifdef S_IFIFO +# define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) +# else +# define S_ISFIFO(m) (0) +# endif +#endif +#ifndef S_ISCHR /* 2 Character special */ +# ifdef S_IFCHR +# define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) +# else +# define S_ISCHR(m) (0) +# endif +#endif +#ifndef S_ISMPC /* 3 UNUSED multiplexed char */ +# ifdef S_IFMPC +# define S_ISMPC(m) (((m) & S_IFMT) == S_IFMPC) +# else +# define S_ISMPC(m) (0) +# endif +#endif +#ifndef S_ISDIR /* 4 Directory */ +# ifdef S_IFDIR +# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) +# else +# define S_ISDIR(m) (0) +# endif +#endif +#ifndef S_ISNAM /* 5 Named file (XENIX) */ +# ifdef S_IFNAM +# define S_ISNAM(m) (((m) & S_IFMT) == S_IFNAM) +# else +# define S_ISNAM(m) (0) +# endif +#endif +#ifndef S_ISBLK /* 6 Block special */ +# ifdef S_IFBLK +# define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) +# else +# define S_ISBLK(m) (0) +# endif +#endif +#ifndef S_ISMPB /* 7 UNUSED multiplexed block */ +# ifdef S_IFMPB +# define S_ISMPB(m) (((m) & S_IFMT) == S_IFMPB) +# else +# define S_ISMPB(m) (0) +# endif +#endif +#ifndef S_ISREG /* 8 Regular file */ +# ifdef S_IFREG +# define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) +# else +# define S_ISREG(m) (0) +# endif +#endif +#ifndef S_ISCNT /* 9 Contiguous file */ +# ifdef S_IFCNT +# define S_ISCNT(m) (((m) & S_IFMT) == S_IFCNT) +# else +# define S_ISCNT(m) (0) +# endif +#endif +#ifndef S_ISLNK /* 10 Symbolic link */ +# ifdef S_IFLNK +# define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) +# else +# define S_ISLNK(m) (0) +# endif +#endif +#ifndef S_ISSHAD /* 11 Solaris shadow inode */ +# ifdef S_IFSHAD +# define S_ISSHAD(m) (((m) & S_IFMT) == S_IFSHAD) +# else +# define S_ISSHAD(m) (0) +# endif +#endif +#ifndef S_ISSOCK /* 12 UNIX domain socket */ +# ifdef S_IFSOCK +# define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) +# else +# define S_ISSOCK(m) (0) +# endif +#endif +#ifndef S_ISDOOR /* 13 Solaris DOOR */ +# ifdef S_IFDOOR +# define S_ISDOOR(m) (((m) & S_IFMT) == S_IFDOOR) +# else +# define S_ISDOOR(m) (0) +# endif +#endif +#ifndef S_ISWHT /* 14 BSD whiteout */ +# ifdef S_IFWHT +# define S_ISWHT(m) (((m) & S_IFMT) == S_ISWHT) +# else +# define S_ISWHT(m) (0) +# endif +#endif +#ifndef S_IFEVC /* 15 UNOS eventcount */ +# ifdef S_IFEVC +# define S_ISEVC(m) (((m) & S_IFMT) == S_IFEVC) +# else +# define S_ISEVC(m) (0) +# endif +#endif + +#ifndef S_TYPEISMQ +/* + * XXX ??? where is a definition of a message queue ??? + */ +# define S_TYPEISMQ(_stbuf) (0) +#endif +#ifndef S_TYPEISSEM +# ifdef S_INSEM +# define S_TYPEISSEM(_stbuf) (S_ISNAM((_stbuf)->st_mode) && (_stbuf)->st_rdev == S_INSEM) +# else +# define S_TYPEISSEM(_stbuf) (0) +# endif +#endif +#ifndef S_TYPEISSHM +# ifdef S_INSHD +# define S_TYPEISSHM(_stbuf) (S_ISNAM((_stbuf)->st_mode) && (_stbuf)->st_rdev == S_INSHD) +# else +# define S_TYPEISSHM(_stbuf) (0) +# endif +#endif + +/* + * Mode permission bits. + * UNIX V.7 has only S_ISUID/S_ISGID/S_ISVTX and S_IREAD/S_IWRITE/S_IEXEC + */ +#ifndef S_ISUID /* Set-user-ID on execution */ +#define S_ISUID 0 /* If it is not defined, it is not supported */ +#endif +#ifndef S_ISGID /* Set-group-ID on execution */ +#define S_ISGID 0 /* If it is not defined, it is not supported */ +#endif +#ifndef S_ISVTX /* On directories, restricted deletion flag */ +#define S_ISVTX 0 /* If it is not defined, it is not supported */ +#endif + +#ifndef S_IRUSR /* Read permission, owner */ +#ifdef S_IREAD +#define S_IRUSR S_IREAD /* Needed on old UNIX systems */ +#else +#define S_IRUSR 0400 +#endif +#endif +#ifndef S_IWUSR /* Write permission, owner */ +#ifdef S_IWRITE +#define S_IWUSR S_IWRITE /* Needed on old UNIX systems */ +#else +#define S_IWUSR 0200 +#endif +#endif +#ifndef S_IXUSR /* Execute/search permission, owner */ +#ifdef S_IEXEC +#define S_IXUSR S_IEXEC /* Needed on old UNIX systems */ +#else +#define S_IXUSR 0100 +#endif +#endif +#ifndef S_IRGRP /* Read permission, group */ +#ifdef S_IREAD +#define S_IRGRP (S_IREAD >> 3) /* Needed on old UNIX systems */ +#else +#define S_IRGRP 040 +#endif +#endif +#ifndef S_IWGRP /* Write permission, group */ +#ifdef S_IWRITE +#define S_IWGRP (S_IWRITE >> 3) /* Needed on old UNIX systems */ +#else +#define S_IWGRP 020 +#endif +#endif +#ifndef S_IXGRP /* Execute/search permission, group */ +#ifdef S_IEXEC +#define S_IXGRP (S_IEXEC >> 3) /* Needed on old UNIX systems */ +#else +#define S_IXGRP 010 +#endif +#endif +#ifndef S_IROTH /* Read permission, others */ +#ifdef S_IREAD +#define S_IROTH (S_IREAD >> 6) /* Needed on old UNIX systems */ +#else +#define S_IROTH 004 +#endif +#endif +#ifndef S_IWOTH /* Write permission, others */ +#ifdef S_IWRITE +#define S_IWOTH (S_IWRITE >> 6) /* Needed on old UNIX systems */ +#else +#define S_IWOTH 002 +#endif +#endif +#ifndef S_IXOTH /* Execute/search permission, others */ +#ifdef S_IEXEC +#define S_IXOTH (S_IEXEC >> 6) /* Needed on old UNIX systems */ +#else +#define S_IXOTH 001 +#endif +#endif + +#ifndef S_IRWXU /* Read, write, execute/search by owner */ +#define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR) +#endif +#ifndef S_IRWXG /* Read, write, execute/search by group */ +#define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP) +#endif +#ifndef S_IRWXO /* Read, write, execute/search by others */ +#define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH) +#endif + +/* + * SCO UnixWare has st_atim.st__tim.tv_nsec but the st_atim.tv_nsec tests also + * succeeds. If we use st_atim.tv_nsec on UnixWare, we get a warning about + * illegal structure usage. For this reason, our code needs to have + * #ifdef HAVE_ST__TIM before #ifdef HAVE_ST_NSEC. + */ +#if defined(HAVE_ST_ATIMENSEC) + +#define stat_ansecs(s) ((s)->st_atimensec) +#define stat_mnsecs(s) ((s)->st_mtimensec) +#define stat_cnsecs(s) ((s)->st_ctimensec) + +#define _FOUND_STAT_NSECS_ +#endif + +#if defined(HAVE_ST_SPARE1) && !defined(_FOUND_STAT_NSECS_) + +#define stat_ansecs(s) ((s)->st_spare1 * 1000) +#define stat_mnsecs(s) ((s)->st_spare2 * 1000) +#define stat_cnsecs(s) ((s)->st_spare3 * 1000) + +#define _FOUND_STAT_USECS_ +#define _FOUND_STAT_NSECS_ +#endif + +#if defined(HAVE_ST__TIM) && !defined(_FOUND_STAT_NSECS_) + +#define stat_ansecs(s) ((s)->st_atim.st__tim.tv_nsec) +#define stat_mnsecs(s) ((s)->st_mtim.st__tim.tv_nsec) +#define stat_cnsecs(s) ((s)->st_ctim.st__tim.tv_nsec) + +#define _FOUND_STAT_NSECS_ +#endif + +#if defined(HAVE_ST_NSEC) && !defined(_FOUND_STAT_NSECS_) + +#define stat_ansecs(s) ((s)->st_atim.tv_nsec) +#define stat_mnsecs(s) ((s)->st_mtim.tv_nsec) +#define stat_cnsecs(s) ((s)->st_ctim.tv_nsec) + +#define _FOUND_STAT_NSECS_ +#endif + +#if defined(HAVE_ST_ATIMESPEC) && !defined(_FOUND_STAT_NSECS_) + +#define stat_ansecs(s) ((s)->st_atimespec.tv_nsec) +#define stat_mnsecs(s) ((s)->st_mtimespec.tv_nsec) +#define stat_cnsecs(s) ((s)->st_ctimespec.tv_nsec) + +#define _FOUND_STAT_NSECS_ +#endif + +#if !defined(_FOUND_STAT_NSECS_) +#define stat_ansecs(s) (0) +#define stat_mnsecs(s) (0) +#define stat_cnsecs(s) (0) +#endif + +#endif /* _STATDEFS_H */ diff --git a/scsilib/include/stdxlib.h b/scsilib/include/stdxlib.h new file mode 100644 index 0000000..3622ec6 --- /dev/null +++ b/scsilib/include/stdxlib.h @@ -0,0 +1,54 @@ +/* @(#)stdxlib.h 1.6 01/07/15 Copyright 1996 J. Schilling */ +/* + * Definitions for stdlib + * + * Copyright (c) 1996 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _STDXLIB_H +#define _STDXLIB_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifdef HAVE_STDLIB_H +#ifndef _INCL_STDLIB_H +#include <stdlib.h> +#define _INCL_STDLIB_H +#endif +#else + +extern char *malloc(); +extern char *realloc(); + +extern double atof(); + +#endif /* HAVE_STDLIB_H */ + +#ifndef EXIT_FAILURE +#define EXIT_FAILURE 1 +#endif +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#endif +#ifndef RAND_MAX +#define RAND_MAX 32767 +#endif + +#endif /* _STDXLIB_H */ diff --git a/scsilib/include/stkframe.h b/scsilib/include/stkframe.h new file mode 100644 index 0000000..10aed2b --- /dev/null +++ b/scsilib/include/stkframe.h @@ -0,0 +1,90 @@ +/* @(#)stkframe.h 1.10 03/06/15 Copyright 1995 J. Schilling */ +/* + * Common definitions for routines that parse the stack frame. + * + * This file has to be fixed if you want to port routines which use getfp(). + * Have a look at struct frame below and use it as a sample, + * the new struct frame must at least contain a member 'fr_savfp'. + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _STKFRAME_H +#define _STKFRAME_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#if defined(sun) && (defined(SVR4) || defined(__SVR4) || defined(__SVR4__)) + /* + * Solaris 2.x aka SunOS 5.x + */ +# ifdef i386 + /* + * On Solaris 2.1 x86 sys/frame.h is not useful at all + * On Solaris 2.4 x86 sys/frame.h is buggy (fr_savfp is int!!) + */ +# ifndef _INCL_SYS_REG_H +# include <sys/reg.h> +# define _INCL_SYS_REG_H +# endif +# endif +# ifndef _INCL_SYS_FRAME_H +# include <sys/frame.h> +# define _INCL_SYS_FRAME_H +# endif + +#else +# if defined(sun) + /* + * SunOS 4.x + */ +# ifndef _INCL_MACHINE_FRAME_H +# include <machine/frame.h> +# define _INCL_MACHINE_FRAME_H +# endif +# else + /* + * Anything that is not SunOS + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * XXX: I hope this will be useful on other machines (no guarantee) + * XXX: It is taken from a sun Motorola system, but should also be useful + * XXX: on a i386. + * XXX: In general you have to write a sample program, set a breakpoint + * XXX: on a small function and inspect the stackframe with adb. + */ + +struct frame { + struct frame *fr_savfp; /* saved frame pointer */ + int fr_savpc; /* saved program counter */ + int fr_arg[1]; /* array of arguments */ +}; + +#ifdef __cplusplus +} +#endif + +# endif /* ! defined (sun) */ +#endif /* ! defined (sun) && (defined(SVR4) || defined(__SVR4) || defined(__SVR4__)) */ + +#endif /* _STKFRAME_H */ diff --git a/scsilib/include/strdefs.h b/scsilib/include/strdefs.h new file mode 100644 index 0000000..4564c0a --- /dev/null +++ b/scsilib/include/strdefs.h @@ -0,0 +1,114 @@ +/* @(#)strdefs.h 1.8 03/03/09 Copyright 1996 J. Schilling */ +/* + * Definitions for strings + * + * Copyright (c) 1996 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _STRDEFS_H +#define _STRDEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif + +/* + * It may be that IBM's AIX has problems when doing + * #include <string.h> + * #include <strings.h> + * So I moved the #include <strings.h> to the top. As the file strings.h + * defines strcasecmp() we may need it... + * + * Note that the only real problem appears if we use rubbish FSF based code that + * #defines _NO_PROTO + */ +#ifdef HAVE_STRINGS_H +#ifndef _INCL_STRINGS_H +#include <strings.h> +#define _INCL_STRINGS_H +#endif +#endif /* HAVE_STRINGS_H */ + + +#ifdef HAVE_STRING_H +#ifndef _INCL_STRING_H +#include <string.h> +#define _INCL_STRING_H +#endif +#else /* HAVE_STRING_H */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef NULL +#define NULL 0 +#endif + +extern void *memcpy __PR((void *, const void *, int)); +extern void *memmove __PR((void *, const void *, int)); +extern char *strcpy __PR((char *, const char *)); +extern char *strncpy __PR((char *, const char *, int)); + +extern char *strcat __PR((char *, const char *)); +extern char *strncat __PR((char *, const char *, int)); + +extern int memcmp __PR((const void *, const void *, int)); +extern int strcmp __PR((const char *, const char *)); +extern int strcoll __PR((const char *, const char *)); +extern int strncmp __PR((const char *, const char *, int)); +extern int strxfrm __PR((char *, const char *, int)); + +extern void *memchr __PR((const void *, int, int)); +extern char *strchr __PR((const char *, int)); + +extern int strcspn __PR((const char *, const char *)); +/*#pragma int_to_unsigned strcspn*/ + +extern char *strpbrk __PR((const char *, const char *)); +extern char *strrchr __PR((const char *, int)); + +extern int strspn __PR((const char *, const char *)); +/*#pragma int_to_unsigned strspn*/ + +extern char *strstr __PR((const char *, const char *)); +extern char *strtok __PR((char *, const char *)); +extern void *memset __PR((void *, int, int)); +extern char *strerror __PR((int)); + +extern int strlen __PR((const char *)); +/*#pragma int_to_unsigned strlen*/ + +extern void *memccpy __PR((void *, const void *, int, int)); + +extern int strcasecmp __PR((const char *, const char *)); +extern int strncasecmp __PR((const char *, const char *, int)); + +/*#define index strchr*/ +/*#define rindex strrchr*/ + +#ifdef __cplusplus +} +#endif + +#endif /* HAVE_STRING_H */ + +#endif /* _STRDEFS_H */ diff --git a/scsilib/include/termcap.h b/scsilib/include/termcap.h new file mode 100644 index 0000000..957ca59 --- /dev/null +++ b/scsilib/include/termcap.h @@ -0,0 +1,62 @@ +/* @(#)termcap.h 1.6 03/06/15 Copyright 1995 J. Schilling */ +/* + * Copyright (c) 1995 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _TERMCAP_H +#define _TERMCAP_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Flags for tcsetflags() + */ +#define TCF_NO_TC 0x0001 /* Don't follow tc= entries */ +#define TCF_NO_SIZE 0x0002 /* Don't get actual ttysize (li#/co#)*/ +#define TCF_NO_STRIP 0x0004 /* Don't strip down termcap buffer */ + +extern char PC; /* Pad character */ +extern char *BC; /* Backspace if not "\b" from "bc" capability*/ +extern char *UP; /* Cursor up string from "up" capability */ +extern short ospeed; /* output speed coded as in ioctl */ + +extern int tgetent __PR((char *bp, char *name)); +extern int tcsetflags __PR((int flags)); +extern char *tcgetbuf __PR((void)); +extern int tgetnum __PR((char *ent)); +extern BOOL tgetflag __PR((char *ent)); +extern char *tgetstr __PR((char *ent, char **array)); +extern char *tdecode __PR((char *ep, char **array)); + +extern int tputs __PR((char *cp, int affcnt, int (*outc)(int c))); +extern char *tgoto __PR((char *cm, int destcol, int destline)); + +#ifdef __cplusplus +} +#endif + +#endif /* _TERMCAP_H */ diff --git a/scsilib/include/timedefs.h b/scsilib/include/timedefs.h new file mode 100644 index 0000000..7e56197 --- /dev/null +++ b/scsilib/include/timedefs.h @@ -0,0 +1,101 @@ +/* @(#)timedefs.h 1.11 03/11/24 Copyright 1996 J. Schilling */ +/* + * Generic header for users of time(), gettimeofday() ... + * + * It includes definitions for time_t, struct timeval, ... + * + * Copyright (c) 1996 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _TIMEDEFS_H +#define _TIMEDEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> /* Needed for time_t */ +#define _INCL_SYS_TYPES_H +#endif + +#ifdef TIME_WITH_SYS_TIME +# ifndef _INCL_SYS_TIME_H +# include <sys/time.h> +# define _INCL_SYS_TIME_H +# endif +# ifndef _INCL_TIME_H +# include <time.h> +# define _INCL_TIME_H +# endif +#else +#ifdef HAVE_SYS_TIME_H +# ifndef _INCL_SYS_TIME_H +# include <sys/time.h> +# define _INCL_SYS_TIME_H +# endif +#else +# ifndef _INCL_TIME_H +# include <time.h> +# define _INCL_TIME_H +# endif +#endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__CYGWIN32__) || defined(__EMX__) || defined(__linux__) || defined(__DJGPP__) +/* + * Cygnus defines struct timeval in sys/time.h but not timerclear + * timerclear is defined in windows32/Sockets.h ??? + * + * EMX for OS/2 defines struct timeval in sys/time.h but not timerclear + * + * Linux defines struct timeval in sys/time.h but if __USE_BSD is not + * defined, timerclear is missing. + */ +#ifndef timerclear +#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 +#endif +#endif + +#ifndef timerclear + +#ifndef VMS +struct timeval { + long tv_sec; + long tv_usec; +}; +#endif + +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; + +#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 + +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _TIMEDEFS_H */ diff --git a/scsilib/include/ttydefs.h b/scsilib/include/ttydefs.h new file mode 100644 index 0000000..9081523 --- /dev/null +++ b/scsilib/include/ttydefs.h @@ -0,0 +1,120 @@ +/* @(#)ttydefs.h 1.26 03/02/28 Copyright 1984-2003 J. Schilling */ +/* + * Terminal driver tty mode handling + * + * Copyright (c) 1984-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +#ifndef _TTYDEFS_H +#define _TTYDEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> +#define _INCL_SYS_TYPES_H +#endif + +#ifdef JOS +# include <ttymodes.h> +# include <spfcode.h> +#else +#ifdef HAVE_TERMIOS_H +# include <termios.h> +# define _INCL_TERMIOS_H +# ifdef TIOCGETA /* FreeBSD */ +# define TCGETS TIOCGETA +# define TCSETSW TIOCSETAW +# endif +# ifdef TCGETATTR +# define TCGETS TCGETATTR +# define TCSETSW TCSETATTRD +# endif +#else +# ifdef HAVE_TERMIO_H +# include <termio.h> +# define _INCL_TERMIO_H +# ifndef TCGETS +# define termios termio +# define TCGETS TCGETA +# define TCSETSW TCSETAW +# endif +# else +# define USE_V7_TTY +# endif +#endif +#endif + +#if !defined(HAVE_TCGETATTR) || !defined(HAVE_TCSETATTR) +# undef TCSANOW +#endif + +#ifndef TCSANOW +# if !defined(TCGETS) || !defined(TCSETSW) +# define USE_V7_TTY +# endif +#endif + +#if !defined(_INCL_TERMIOS_H) && !defined(_INCL_TERMIO_H) +#ifdef HAVE_SYS_IOCTL_H +# ifndef _INCL_SYS_IOCTl_H +# include <sys/ioctl.h> +# define _INCL_SYS_IOCTL_H +# endif +#endif +#endif + +#ifdef HAVE_SYS_BSDTTY_H +#include <sys/bsdtty.h> +#endif + +#if !defined(TIOCGWINSZ) && ! defined(TIOCGSIZE) +# ifndef _INCL_SYS_IOCTl_H +# include <sys/ioctl.h> +# define _INCL_SYS_IOCTL_H +# endif +#endif + +#ifndef OXTABS /* OS/2 EMX */ +#define OXTABS 0 +#endif +#ifndef XTABS +# ifndef TAB3 /* FreeBSD */ +# define TABDLY OXTABS +# define XTABS OXTABS +# else +# define XTABS TAB3 +# endif +#endif +#ifndef ONLCR /* OS/2 EMX */ +#define ONLCR 0 +#endif +#ifndef OCRNL /* FreeBSD */ +# define OCRNL 0 +#endif +#ifndef ONLRET /* FreeBSD */ +# define ONLRET 0 +#endif +#ifndef _POSIX_VDISABLE +# define _POSIX_VDISABLE 0 +#endif + +#endif /* _TTYDEFS_H */ diff --git a/scsilib/include/unixstd.h b/scsilib/include/unixstd.h new file mode 100644 index 0000000..93cbc37 --- /dev/null +++ b/scsilib/include/unixstd.h @@ -0,0 +1,121 @@ +/* @(#)unixstd.h 1.12 04/06/17 Copyright 1996 J. Schilling */ +/* + * Definitions for unix system interface + * + * Copyright (c) 1996 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _UNIXSTD_H +#define _UNIXSTD_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifdef HAVE_UNISTD_H + +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> +#define _INCL_SYS_TYPES_H +#endif +#ifndef _INCL_UNISTD_H +#include <unistd.h> +#define _INCL_UNISTD_H +#endif + +#ifndef _SC_PAGESIZE +#ifdef _SC_PAGE_SIZE /* HP/UX & OSF */ +#define _SC_PAGESIZE _SC_PAGE_SIZE +#endif +#endif + +#else /* HAVE_UNISTD_H */ + +/* + * unistd.h grants things like off_t to be typedef'd. + */ +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> +#define _INCL_SYS_TYPES_H +#endif + +#endif /* HAVE_UNISTD_H */ + +#ifndef STDIN_FILENO +# ifdef JOS +# ifndef _JOS_IO_H +# include <jos_io.h> +# endif +# else +# define STDIN_FILENO 0 +# define STDOUT_FILENO 1 +# define STDERR_FILENO 2 +# endif +#endif + +#ifndef R_OK +/* Symbolic constants for the "access" routine: */ +#define R_OK 4 /* Test for Read permission */ +#define W_OK 2 /* Test for Write permission */ +#define X_OK 1 /* Test for eXecute permission */ +#define F_OK 0 /* Test for existence of File */ +#endif +#ifndef E_OK +#ifdef HAVE_ACCESS_E_OK +#ifdef EFF_ONLY_OK +#define E_OK EFF_ONLY_OK /* Irix */ +#else +#ifdef EUID_OK +#define E_OK EUID_OK /* UNICOS (0400) */ +#else +#define E_OK 010 /* Test effective uids */ +#endif /* EUID_OK */ +#endif /* EFF_ONLY_OK */ +#else +#define E_OK 0 +#endif /* HAVE_ACCESS_E_OK */ +#endif /* !E_OK */ + +/* Symbolic constants for the "lseek" routine: */ +#ifndef SEEK_SET +#define SEEK_SET 0 /* Set file pointer to "offset" */ +#endif +#ifndef SEEK_CUR +#define SEEK_CUR 1 /* Set file pointer to current plus "offset" */ +#endif +#ifndef SEEK_END +#define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +#endif + +#if !defined(HAVE_UNISTD_H) || !defined(_POSIX_VERSION) +/* + * Maybe we need a lot more definitions here... + * It is not clear whether we should have prototyped definitions. + */ +extern int access __PR((const char *, int)); +extern int close __PR((int)); +extern int dup __PR((int)); +extern int dup2 __PR((int, int)); +extern void _exit __PR((int)); +extern int link __PR((const char *, const char *)); +extern int read __PR((int, void *, size_t)); +extern int unlink __PR((const char *)); +extern int write __PR((int, void *, size_t)); +#endif + +#endif /* _UNIXSTD_H */ diff --git a/scsilib/include/unls.h b/scsilib/include/unls.h new file mode 100644 index 0000000..bb06500 --- /dev/null +++ b/scsilib/include/unls.h @@ -0,0 +1,66 @@ +/* @(#)unls.h 1.5 03/06/15 2000 J. Schilling */ +/* + * Modifications to make the code portable Copyright (c) 2000 J. Schilling + * + * Code taken from the Linux kernel. + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _UNLS_H +#define _UNLS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif +#ifndef _PROTOTYP_H +#include <prototyp.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +struct nls_unicode { + unsigned char uni1; + unsigned char uni2; +}; + +struct nls_table { + char *charset; + unsigned char **page_uni2charset; + struct nls_unicode *charset2uni; + + void (*inc_use_count) __PR((void)); + void (*dec_use_count) __PR((void)); + struct nls_table *next; +}; + +extern int init_nls __PR((void)); +extern int register_nls __PR((struct nls_table *)); +extern int unregister_nls __PR((struct nls_table *)); +extern struct nls_table *find_nls __PR((char *)); +extern void list_nls __PR((void)); +extern struct nls_table *load_nls __PR((char *)); +extern void unload_nls __PR((struct nls_table *)); +extern struct nls_table *load_nls_default __PR((void)); +extern int init_nls_file __PR((char * name)); + +#ifdef __cplusplus +} +#endif + +#endif /* _UNLS_H */ diff --git a/scsilib/include/utimdefs.h b/scsilib/include/utimdefs.h new file mode 100644 index 0000000..a90f011 --- /dev/null +++ b/scsilib/include/utimdefs.h @@ -0,0 +1,76 @@ +/* @(#)utimdefs.h 1.5 03/06/15 Copyright 2001 J. Schilling */ +/* + * Defines for utimes() / utime() + * + * Copyright (c) 2001 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _UTIMDEFS_H +#define _UTIMDEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> +#define _INCL_SYS_TYPES_H +#endif + +#ifdef HAVE_UTIMES +#ifndef _TIMEDEFS_H +#include <timedefs.h> +#endif +#endif + +#ifdef HAVE_UTIME_H +#ifndef _INCL_UTIME_H +#include <utime.h> +#define _INCL_UTIME_H +#endif +#else +#ifdef HAVE_SYS_UTIME_H +#ifndef _INCL_SYS_UTIME_H +#include <sys/utime.h> +#define _INCL_SYS_UTIME_H +#endif +#else +struct utimbuf { + time_t actime; + time_t modtime; +}; +#endif +#endif + +#ifdef __comment__ +/* + * file.c contains this + * I am not sure if it is really needed. + * It may be a good idea to add a test for HAVE_STRUCT_UTIMBUF + * as in gnutar. + */ +#if (__COHERENT__ >= 0x420) +# include <sys/utime.h> +#else +# include <utime.h> +#endif + +#endif /* __comment__ */ + + +#endif /* _UTIMDEFS_H */ diff --git a/scsilib/include/utypes.h b/scsilib/include/utypes.h new file mode 100644 index 0000000..1cf29db --- /dev/null +++ b/scsilib/include/utypes.h @@ -0,0 +1,358 @@ +/* @(#)utypes.h 1.11 03/06/15 Copyright 1997 J. Schilling */ +/* + * Definitions for some user defined types + * + * Copyright (c) 1997 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _UTYPES_H +#define _UTYPES_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +/* + * Include limits.h for CHAR_BIT + */ +#ifdef HAVE_LIMITS_H +#ifndef _INCL_LIMITS_H +#include <limits.h> +#define _INCL_LIMITS_H +#endif +#endif + +#ifndef CHAR_BIT +#define CHAR_BIT 8 +#endif + +/* + * These macros may not work on all platforms but as we depend + * on two's complement in many places, they do not reduce portability. + */ +#define TYPE_ISSIGNED(t) (((t)-1) < ((t)0)) +#define TYPE_MSBVAL(t) ((t)(~((t)0) << (sizeof (t)*CHAR_BIT - 1))) +#define TYPE_MINVAL(t) (TYPE_ISSIGNED(t) \ + ? TYPE_MSBVAL(t) \ + : ((t)0)) +#define TYPE_MAXVAL(t) ((t)(~((t)0) - TYPE_MINVAL(t))) + +/* + * Let us include system defined types too. + */ +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> +#define _INCL_SYS_TYPES_H +#endif + +#ifdef __CHAR_UNSIGNED__ /* GNU GCC define (dynamic) */ +#ifndef CHAR_IS_UNSIGNED +#define CHAR_IS_UNSIGNED /* Sing Schily define (static) */ +#endif +#endif + +/* + * Several unsigned cardinal types + */ +typedef unsigned long Ulong; +typedef unsigned int Uint; +typedef unsigned short Ushort; +typedef unsigned char Uchar; + +/* + * Added these cause Linux distro's using kernel 2.6.x seems + * to want them. + */ +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned int u32; +#if defined(__GNUC__) /* this is defined gcc-3.x */ +typedef unsigned long long u64; +#endif + +/* + * Dodge the __attribute_const__ out of sneaky kernel includes. + * cdrtools is a userland program, so no kernel attribute's + */ +#ifndef __attribute_const__ +# define __attribute_const__ /* unimplemented */ +#endif + +/* + * This is a definition for a compiler dependant 64 bit type. + * It currently is silently a long if the compiler does not + * support it. Check if this is the right way. + */ +#ifndef NO_LONGLONG +# if defined(HAVE_LONGLONG) +# define USE_LONGLONG +# endif +#endif + +#ifdef USE_LONGLONG + +typedef long long Llong; +typedef unsigned long long Ullong; + +#define SIZEOF_LLONG SIZEOF_LONG_LONG +#define SIZEOF_ULLONG SIZEOF_UNSIGNED_LONG_LONG + +#else + +typedef long Llong; +typedef unsigned long Ullong; + +#define SIZEOF_LLONG SIZEOF_LONG +#define SIZEOF_ULLONG SIZEOF_UNSIGNED_LONG + +#endif + +/* + * The IBM AIX C-compiler seems to be the only compiler on the world + * which does not allow to use unsigned char bit fields as a hint + * for packed bit fields. Define a pesical type to avoid warnings. + * The packed attribute is honored wit unsigned int in this case too. + */ +#if defined(_AIX) && !defined(__GNUC__) + +typedef unsigned int Ucbit; + +#else + +typedef unsigned char Ucbit; + +#endif + +/* + * Start inttypes.h emulation. + * + * Thanks to Solaris 2.4 and even recent 1999 Linux versions, we + * cannot use the official UNIX-98 names here. Old Solaris versions + * define parts of the types in some exotic include files. + * Linux even defines incompatible types in <sys/types.h>. + */ + +#ifdef HAVE_INTTYPES_H +# ifndef _INCL_INTTYPES_H +# include <inttypes.h> +# define _INCL_INTTYPES_H +# endif +# define HAVE_INT64_T +# define HAVE_UINT64_T + +#define Int8_t int8_t +#define Int16_t int16_t +#define Int32_t int32_t +#define Int64_t int64_t +#define Intmax_t intmax_t +#define UInt8_t uint8_t +#define UInt16_t uint16_t +#define UInt32_t uint32_t +#define UInt64_t uint64_t +#define UIntmax_t uintmax_t + +#define Intptr_t intptr_t +#define UIntptr_t uintptr_t + +#else /* !HAVE_INTTYPES_H */ + +#if SIZEOF_CHAR != 1 || SIZEOF_UNSIGNED_CHAR != 1 +/* + * #error will not work for all compilers (e.g. sunos4) + * The following line will abort compilation on all compilers + * if the above is true. And that's what we want. + */ +error Sizeof char is not equal 1 +#endif + +#if defined(__STDC__) || defined(CHAR_IS_UNSIGNED) + typedef signed char Int8_t; +#else + typedef char Int8_t; +#endif + +#if SIZEOF_SHORT_INT == 2 + typedef short Int16_t; +#else + error No int16_t found +#endif + +#if SIZEOF_INT == 4 + typedef int Int32_t; +#else + error No int32_t found +#endif + +#if SIZEOF_LONG_INT == 8 + typedef long Int64_t; +# define HAVE_INT64_T +#else +#if SIZEOF_LONG_LONG == 8 + typedef long long Int64_t; +# define HAVE_INT64_T +#else +/* error No int64_t found*/ +#endif +#endif + +#if SIZEOF_CHAR_P == SIZEOF_INT + typedef int Intptr_t; +#else +#if SIZEOF_CHAR_P == SIZEOF_LONG_INT + typedef long Intptr_t; +#else + error No intptr_t found +#endif +#endif + +typedef unsigned char UInt8_t; + +#if SIZEOF_UNSIGNED_SHORT_INT == 2 + typedef unsigned short UInt16_t; +#else + error No uint16_t found +#endif + +#if SIZEOF_UNSIGNED_INT == 4 + typedef unsigned int UInt32_t; +#else + error No int32_t found +#endif + +#if SIZEOF_UNSIGNED_LONG_INT == 8 + typedef unsigned long UInt64_t; +# define HAVE_UINT64_T +#else +#if SIZEOF_UNSIGNED_LONG_LONG == 8 + typedef unsigned long long UInt64_t; +# define HAVE_UINT64_T +#else +/* error No uint64_t found*/ +#endif +#endif + +#define Intmax_t Llong +#define UIntmax_t Ullong + +#if SIZEOF_CHAR_P == SIZEOF_UNSIGNED_INT + typedef unsigned int UIntptr_t; +#else +#if SIZEOF_CHAR_P == SIZEOF_UNSIGNED_LONG_INT + typedef unsigned long UIntptr_t; +#else + error No uintptr_t found +#endif +#endif + +#endif /* HAVE_INTTYPES_H */ + +#ifndef CHAR_MIN +#define CHAR_MIN TYPE_MINVAL(char) +#endif +#ifndef CHAR_MAX +#define CHAR_MAX TYPE_MAXVAL(char) +#endif +#ifndef UCHAR_MAX +#define UCHAR_MAX TYPE_MAXVAL(unsigned char) +#endif + +#ifndef SHRT_MIN +#define SHRT_MIN TYPE_MINVAL(short) +#endif +#ifndef SHRT_MAX +#define SHRT_MAX TYPE_MAXVAL(short) +#endif +#ifndef USHRT_MAX +#define USHRT_MAX TYPE_MAXVAL(unsigned short) +#endif + +#ifndef INT_MIN +#define INT_MIN TYPE_MINVAL(int) +#endif +#ifndef INT_MAX +#define INT_MAX TYPE_MAXVAL(int) +#endif +#ifndef UINT_MAX +#define UINT_MAX TYPE_MAXVAL(unsigned int) +#endif + +#ifndef LONG_MIN +#define LONG_MIN TYPE_MINVAL(long) +#endif +#ifndef LONG_MAX +#define LONG_MAX TYPE_MAXVAL(long) +#endif +#ifndef ULONG_MAX +#define ULONG_MAX TYPE_MAXVAL(unsigned long) +#endif + +#ifndef INT8_MIN +#define INT8_MIN TYPE_MINVAL(Int8_t) +#endif +#ifndef INT8_MAX +#define INT8_MAX TYPE_MAXVAL(Int8_t) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX TYPE_MAXVAL(UInt8_t) +#endif + +#ifndef INT16_MIN +#define INT16_MIN TYPE_MINVAL(Int16_t) +#endif +#ifndef INT16_MAX +#define INT16_MAX TYPE_MAXVAL(Int16_t) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX TYPE_MAXVAL(UInt16_t) +#endif + +#ifndef INT32_MIN +#define INT32_MIN TYPE_MINVAL(Int32_t) +#endif +#ifndef INT32_MAX +#define INT32_MAX TYPE_MAXVAL(Int32_t) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX TYPE_MAXVAL(UInt32_t) +#endif + +#ifdef HAVE_INT64_T +#ifndef INT64_MIN +#define INT64_MIN TYPE_MINVAL(Int64_t) +#endif +#ifndef INT64_MAX +#define INT64_MAX TYPE_MAXVAL(Int64_t) +#endif +#endif +#ifdef HAVE_UINT64_T +#ifndef UINT64_MAX +#define UINT64_MAX TYPE_MAXVAL(UInt64_t) +#endif +#endif + +#ifndef INTMAX_MIN +#define INTMAX_MIN TYPE_MINVAL(Intmax_t) +#endif +#ifndef INTMAX_MAX +#define INTMAX_MAX TYPE_MAXVAL(Intmax_t) +#endif +#ifndef UINTMAX_MAX +#define UINTMAX_MAX TYPE_MAXVAL(UIntmax_t) +#endif + +#endif /* _UTYPES_H */ diff --git a/scsilib/include/vadefs.h b/scsilib/include/vadefs.h new file mode 100644 index 0000000..9b26fa2 --- /dev/null +++ b/scsilib/include/vadefs.h @@ -0,0 +1,120 @@ +/* @(#)vadefs.h 1.5 01/07/15 Copyright 1998 J. Schilling */ +/* + * Generic header for users of var args ... + * + * Includes a default definition for va_copy() + * and some magic know how about the SVr4 Power PC var args ABI + * to create a __va_arg_list() macro. + * + * Copyright (c) 1998 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _VADEFS_H +#define _VADEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +#ifdef PROTOTYPES +/* + * For ANSI C-compilers prefer stdarg.h + */ +# ifdef HAVE_STDARG_H +# ifndef _INCL_STDARG_H +# include <stdarg.h> +# define _INCL_STDARG_H +# endif +# else +# ifndef _INCL_VARARGS_H +# include <varargs.h> +# define _INCL_VARARGS_H +# endif +# endif +#else +/* + * For K&R C-compilers prefer varargs.h + */ +# ifdef HAVE_VARARGS_H +# ifndef _INCL_VARARGS_H +# include <varargs.h> +# define _INCL_VARARGS_H +# endif +# else +# ifndef _INCL_STDARG_H +# include <stdarg.h> +# define _INCL_STDARG_H +# endif +# endif +#endif + +#if (defined(__linux__) || defined(__linux) || defined(sun)) && \ + (defined(__ppc) || defined(__PPC) || defined(powerpc) || defined(__powerpc__)) + +# ifndef VA_LIST_IS_ARRAY +# define VA_LIST_IS_ARRAY +# endif +#endif + + +/* + * __va_copy() is used by GCC 2.8 or newer until va_copy() becomes + * a final ISO standard. + */ +#if !defined(va_copy) && !defined(HAVE_VA_COPY) +# if defined(__va_copy) +# define va_copy(to, from) __va_copy(to, from) +# endif +#endif + +/* + * va_copy() is a Solaris extension to provide a portable way to perform a + * variable argument list "bookmarking" function. + * If it is not available via stdarg.h, use a simple assignement for backward + * compatibility. + */ +#if !defined(va_copy) && !defined(HAVE_VA_COPY) +#ifdef VA_LIST_IS_ARRAY +# define va_copy(to, from) ((to)[0] = (from)[0]) +#else +# define va_copy(to, from) ((to) = (from)) +#endif +#endif + +/* + * I don't know any portable way to get an arbitrary + * C object from a var arg list so I use a + * system-specific routine __va_arg_list() that knows + * if 'va_list' is an array. You will not be able to + * assign the value of __va_arg_list() but it works + * to be used as an argument of a function. + * It is a requirement for recursive printf to be able + * to use this function argument. If your system + * defines va_list to be an array you need to know this + * via autoconf or another mechanism. + * It would be nice to have something like + * __va_arg_list() in stdarg.h + */ + +#ifdef VA_LIST_IS_ARRAY +# define __va_arg_list(list) va_arg(list, void *) +#else +# define __va_arg_list(list) va_arg(list, va_list) +#endif + +#endif /* _VADEFS_H */ diff --git a/scsilib/include/waitdefs.h b/scsilib/include/waitdefs.h new file mode 100644 index 0000000..bba1115 --- /dev/null +++ b/scsilib/include/waitdefs.h @@ -0,0 +1,141 @@ +/* @(#)waitdefs.h 1.10 03/02/25 Copyright 1995-2003 J. Schilling */ +/* + * Definitions to deal with various kinds of wait flavour + * + * Copyright (c) 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _WAITDEFS_H +#define _WAITDEFS_H + +#ifndef _MCONFIG_H +#include <mconfig.h> +#endif + +/* + * Needed for SysVr4 + */ +#ifndef _INCL_SYS_TYPES_H +#include <sys/types.h> +#define _INCL_SYS_TYPES_H +#endif + +#if defined(HAVE_WAIT_H) +# ifndef _INCL_WAIT_H +# include <wait.h> +# define _INCL_WAIT_H +# endif +#else +/* + * K&R Compiler doesn't like #elif + */ +# if defined(HAVE_SYS_WAIT_H) /* POSIX.1 compl. sys/wait.h */ +# undef HAVE_UNION_WAIT /* POSIX.1 doesn't use U_W */ +# ifndef _INCL_SYS_WAIT_H +# include <sys/wait.h> +# define _INCL_SYS_WAIT_H +# endif +# else +# if defined(HAVE_UNION_WAIT) /* Pure BSD U_W / sys/wait.h */ +# ifndef _INCL_SYS_WAIT_H +# include <sys/wait.h> +# define _INCL_SYS_WAIT_H +# endif +# endif +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef HAVE_UNION_WAIT +# define WAIT_T union wait +# ifndef WSTOPPED +# define WSTOPPED 0x7F +# endif +# ifndef WTERMSIG +# define WTERMSIG(status) ((status).w_termsig) +# endif +# ifndef WCOREDUMP +# define WCOREDUMP(status) ((status).w_coredump) +# endif +# ifndef WEXITSTATUS +# define WEXITSTATUS(status) ((status).w_retcode) +# endif +# ifndef WSTOPSIG +# define WSTOPSIG(status) ((status).w_stopsig) +# endif +# ifndef WIFSTOPPED +# define WIFSTOPPED(status) ((status).w_stopval == \ + WSTOPPED) +# endif +# ifndef WIFSIGNALED +# define WIFSIGNALED(status) ((status).w_stopval != \ + WSTOPPED && \ + (status).w_termsig != 0) +# endif +# ifndef WIFEXITED +# define WIFEXITED(status) ((status).w_stopval != \ + WSTOPPED && \ + (status).w_termsig == 0) +# endif +#else +# define WAIT_T int +# ifndef WTERMSIG +# define WTERMSIG(status) ((status) & 0x7F) +# endif +# ifndef WCOREDUMP +# define WCOREDUMP(status) ((status) & 0x80) +# endif +# ifndef WEXITSTATUS +# define WEXITSTATUS(status) (((status) >> 8) & 0xFF) +# endif +# ifndef WSTOPSIG +# define WSTOPSIG(status) (((status) >> 8) & 0xFF) +# endif +# ifndef WIFSTOPPED +# define WIFSTOPPED(status) (((status) & 0xFF) == 0x7F) +# endif +# ifndef WIFSIGNALED +# define WIFSIGNALED(status) (((status) & 0xFF) != 0x7F && \ + WTERMSIG(status) != 0) +# endif +# ifndef WIFEXITED +# define WIFEXITED(status) (((status) & 0xFF) == 0) +# endif +#endif + + +#ifndef WCOREFLG +#define WCOREFLG 0x80 +#endif + +#ifndef WSTOPFLG +#define WSTOPFLG 0x7F +#endif + +#ifndef WCONTFLG +#define WCONTFLG 0xFFFF +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _WAITDEFS_H */ diff --git a/scsilib/include/xmconfig.h b/scsilib/include/xmconfig.h new file mode 100644 index 0000000..3d32634 --- /dev/null +++ b/scsilib/include/xmconfig.h @@ -0,0 +1,1356 @@ +/* @(#)xmconfig.h 1.29 03/06/15 Copyright 1995 J. Schilling */ +/* + * Manual generated static definitions for machine configuration + * + * Copyright (c) 1995 J. Schilling + * + * This file is made to be included from <mconfig.h> and may be used + * instead of configurations that are dynamically autogenerated. + * Use only cpp instructions. + * + * NOTE: SING: (Schily Is Not Gnu) + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _XMCONFIG_H +#define _XMCONFIG_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * 1) Compiler and language related headers + * + * define PROTOTYPES to use ansi C prototypes + * + * define HAVE_ELF Object files are stored in System V.4 ELF format. + * + * define HAVE_COFF Object files are stored in System V.2 COFF format. + * + * define HAVE_AOUT Object files are stored in ATT/BSD a.out format. + * + * define HAVE_STDARG_H to use stdarg.h, else use varargs.h + * NOTE: SaberC on a Sun has prototypes but no stdarg.h. + * + * define HAVE_VA_COPY have va_copy() to do assignements of va_list type objects. + * define HAVE__VA_COPY have __va_copy() to do assignements of va_list type objects. + * + * define HAVE_STDLIB_H to use general utility defines (malloc(), size_t ...) + * some C library prototypes my be found here + * + * define HAVE_STRING_H to get NULL and string function prototypes + * + * define HAVE_STRINGS_H to get BSD string function prototypes + * + * define HAVE_STDC_HEADERS to declare the presence of other ansi C headers + * define STDC_HEADERS same as above (GNU name) + * + * define HAVE_LONGLONG to use long long for space/transfer calculations + * + * define HAVE_SIZE_T The type size_t is present + * define NO_SIZE_T The type size_t is not present + * + * + * 2) Operating system related headers + * + * define HAVE_OSDEF to prevent later definitions to overwrite current + * + * define __NOT_SVR4__ Not a real SVR4 implementation + * + * define HAVE_UNISTD_H to use access, lockf and lseek constants + * syscall prototypes may be found here also + * use sys/file.h otherwise for above constants + * + * define HAVE_FCNTL_H to use access, O_XXX constants for open() + * and open(), creat(), fcntl() prototypes + * use sys/file.h otherwise for above constants + * + * define HAVE_DIRENT_H to use dirent.h instead of the old BSD sys/dir.h + * define HAVE_SYS_DIR_H to use the old BSD sys/dir.h, otherwise no readdir() + * define HAVE_NDIR_H to use ndir.h + * define HAVE_SYS_NDIR_H to use sys/ndir.h + * + * define HAVE_MALLOC_H if malloc.h exists + * + * define HAVE_TERMIOS_H to use posix terminal and session control (termios.h) + * define HAVE_TERMIO_H to use SV terminal control (termio.h) *- no setpgrp -* + * Else use BSD style sgttyb and setpgrp (ioctl.h) + * XXX session control should be another define XXX + * + * define HAVE_SYS_TIME_H may include sys/time.h for struct timeval + * used internally in timedefs.h + * + * define HAVE_UTIMES to use BSD utimes() and sys/time.h + * define HAVE_UTIME_H to use utime.h for the utimbuf structure declaration + * Else declare struct utimbuf yourself. + * + * define HAVE_WAIT_H to use wait.h for prototypes and union wait + * define HAVE_SYS_WAIT_H else use sys/wait.h + * Else declare it by yourself. + * + * define HAVE_SYS_PARAM_H if it is ok to include sys/param.h + * + * define HAVE_SYS_SYSTEMINFO_H to use sysinfo() + * define HAVE_SYS_UTSNAME_H to use uname() + * + * define HAVE_SYS_PRIOCNTL_H to use priocntl() instead of nice()/setpriority() + * define HAVE_SYS_RTPRIOCNTL_H if the system supports real time classes. + * + * define HAVE_SYS_MTIO_H to use mtio definitions from sys/mtio.h + * define HAVE_MTGET_DSREG if struct mtget contains mt_dsreg (drive status) + * define HAVE_MTGET_RESID if struct mtget contains mt_resid (residual count) + * define HAVE_MTGET_FILENO if struct mtget contains mt_fileno (file #) + * define HAVE_MTGET_BLKNO if struct mtget contains mt_blkno (block #0 + * + * define MAJOR_IN_MKDEV if we should include sys/mkdev.h to get + * major(), minor() and makedev() + * + * define MAJOR_IN_SYSMACROS if we should include sys/sysmacros.h to get + * major(), minor() and makedev() + * + * ... else look in sys/types.h for major() + * + * 3) Miscellaneous operating system/library/processor related things + * + * define HAVE_USG_STDIO to enable the use USG stdio.h internals + * To to this we need: + * f->_flag & _IONBF ... Unbuffered + * f->_flag & _IOERR ... I/O error + * f->_flag & _IOEOF ... End of File + * f->_cnt ... r/w count in buf + * f->_ptr ... pointer into buf + * _filbuf(FILE * f) ... fill buffer, return 1st ch + * _flsbuf(unsigned char *, FILE * f) ... flush buffer + * + * define HAVE_BRK may use brk() + * + * define HAVE_SBRK may use sbrk() + * + * + * define HAVE_DTOA use the 4.4BSD function __dtoa() instead of + * the AT&T standard functions ecvt()/fcvt()/gcvt() + * + * define HAVE_GETCWD use SysV getcwd() instead of BSD getwd() + * + * define HAVE_STRERROR may use strerror() instead of sys_errlist[] and sys_nerr + * + * define HAVE_MEMMOVE should use memmove() instead of bcopy() + * + * define HAVE_MLOCKALL may use mlockall() to lock the whole process into memory + * + * define HAVE_MMAP may map memory (sys/types.h + sys/mman.h) + * define HAVE_SMMAP may map anonymous memory to get shared mem + * + * define HAVE_USGSHM may get shared memory SV style (sys/types.h + sys/ipc.h) + * + * define HAVE_USGSEM may use SysV style shared memory and semaphores. + * May use shared memory and semaphores to manage a + * sharing buffer and its synchronization. + * If this is not defined, use mmap and flock. + * + * define HAVE_MSEM Has OSF/1 style memory semaphores. + * Use instead of SysV semaphores or flock + * for shared memory synchronisation. + * + * define HAVE_LDSTUB Has SPARC ldstub atomic instruction. + * May be used instead of system V semaphores or flock + * for shared memory synchronisation. + * + * define HAVE_XCHG Has i386 xchg atomic instruction. + * May be used instead of system V semaphores or flock + * for shared memory synchronisation. + * + * define HAVE_FLOCK Use flock for synchronization on logfiles. + * If this is not defined use lockf. + * + * define HAVE_FCHDIR The fchdir system call may be used + * to change the current directory and back. + * Else remember the pathname and use chdir. + * + * define HAVE_STATVFS The statvfs and fstatvfs calls are available. + * Else get filesystem statistics with + * statfs or getmnt (on ultrix). + * + * define HAVE_QUOTA The quota or quotactl system calls are available. + * + * define HAVE_YP To use yellow pages. + * + * define HAVE_SHADOW To use shadow password file. + * + * define HAVE_SETREUID have BSD setreuid() + * define HAVE_SETRESUID have HPUX only ??? setresuid() + * define HAVE_SETEUID have SVr4 seteuid() + * + * define HAVE_LCHOWN Need to use lchown() instead of chown() on symlinks. + * + * define HAVE_PROCFS SVr4 style procfs is available. + * + * define HAVE_PROCFS2 SVr4.2 (SMP) style procfs is available. + * + * define HAVE_SIGINFO Use waitid and the siginfo_t structure for waiting + * for child processes. + * Else use wait3 and union wait. + * + * define HAVE_WAIT3 Have wait3. + * + * define HAVE_WAITPID Use waitpid and no resource usage instead of wait3. + * + * define HAVE_UNION_WAIT Have union wait in wait.h + * + * define HAVE_GETHOSTNAME to use gethostname() + * + * define HAVE_STREAMS Use streams networking calls. Else use sockets. + * + * define HAVE_STRPTYS Use SVr4 style streams pseudo ttys. + * + * define HAVE_POLL Use the poll system call to wait for I/O. + * Else use select. + * + * define HAVE_SELECT Use the select system call to wait for I/O. + * + * define HAVE_TIRPC The remote procedure call library is of the + * transport independent flavour. + * + * define GID_T The type to use for the getgroups() array. + * This should be gid_t, but some BSD based systems + * must have int there. + * + * + * 4) Specials for libschily + * + * define HAVE_SCANSTACK Scanning of the stack is implemented for this + * architecture: + * getfp() + * and the derived functions: + * handlecond(), raisecond() + * are working. + * + * XXX It is most likely that getfp() does not really work correctly + * XXX if getav0() is not working. + * XXX For this reason, HAVE_GETAV0 is not used anymore. + * XXX Instead avoffset.h is included and the existence of + * XXX AV_OFFSET and FP_INDIR is checked instead. + * + * define HAVE_GETAV0 Scanning of stack and locating the arg vector + * is implemented for this architecture: + * getav0() + * is working. + * get_progname() in saveargs.c will work in the main + * thread without a prior call to save_args(). + * + */ + +#if defined(sun) || defined(__sun) || defined(__sun__) +# ifndef IS_SUN +# define IS_SUN +# endif +#endif + +#if defined(SOL2) || defined(SOL2) || \ + defined(S5R4) || defined(__S5R4) || defined(SVR4) + +# ifndef __SVR4 +# define __SVR4 +# endif +#endif + +#ifdef __SVR4 +# ifndef SVR4 +# define SVR4 +# endif +#endif + +/* + * SunOS 4.x + */ +#if defined(IS_SUN) && !defined(__SVR4) + /* + * Sun C defines __STDC__ as zero. + */ +# ifdef __STDC__ +# define PROTOTYPES +# ifndef SABER +# define HAVE_STDARG_H +# define HAVE_LONGLONG +# endif +# endif +# define HAVE_AOUT +# define HAVE_STDLIB_H +# define HAVE_STRING_H +# define HAVE_UNISTD_H +# define HAVE_FCNTL_H +# define HAVE_DIRENT_H +# define HAVE_SYS_DIR_H +# define HAVE_TERMIOS_H +# define HAVE_TERMIO_H +# define HAVE_SYS_TIME_H +# define HAVE_UTIMES +# define HAVE_UTIME_H +# define HAVE_SYS_WAIT_H +# define HAVE_SYS_PARAM_H +# define HAVE_SYS_UTSNAME_H +# define HAVE_SYS_MTIO_H +# define HAVE_MTGET_DSREG +# define HAVE_MTGET_RESID +# define HAVE_MTGET_FILENO +# define HAVE_MTGET_BLKNO +# define MAJOR_IN_SYSMACROS +# define HAVE_UNION_WAIT +# define HAVE_USG_STDIO +# define HAVE_GETCWD +# define HAVE_MLOCKALL +# define HAVE_MMAP +# define HAVE_SMMAP +# define HAVE_USGSHM +# define HAVE_USGSEM +# ifdef sparc +# define HAVE_LDSTUB +# endif +# define HAVE_FLOCK +# define HAVE_FCHDIR +# define HAVE_QUOTA +# define HAVE_YP +# define HAVE_SETREUID +# define HAVE_WAIT3 +# define HAVE_GETHOSTNAME +# define HAVE_SELECT +# define GID_T int +# define USLEEPRETURN_T unsigned int +# define HAVE_GETAV0 /* SunOS < 5 only runs on sparc/mc680xx */ +# define HAVE_SCANSTACK /* SunOS < 5 only runs on sparc/mc680xx */ +#endif + +/* + * AIX + */ +#if defined(_IBMR2) || defined(_AIX) +# define IS_UNIX /* ??? really ??? */ +# define NO_FLOATINGPOINT /* XXX until isinf()/isnan() is solved */ +# define USE_FLOATINGARGS /* Use up args from floatingpoint format */ +#ifndef PROTOTYPES +# define PROTOTYPES +#endif +# define HAVE_COFF +# define HAVE_STDARG_H +# define HAVE_STDLIB_H +# define HAVE_STRING_H +# define HAVE_LONGLONG +# define HAVE_UNISTD_H +# define HAVE_FCNTL_H +# define HAVE_DIRENT_H +# define HAVE_TERMIOS_H +# define HAVE_TERMIO_H +# define HAVE_SYS_TIME_H +# define HAVE_UTIMES +# define HAVE_UTIME_H +# define HAVE_SYS_WAIT_H +# define HAVE_SYS_PARAM_H +# define HAVE_SYS_UTSNAME_H +# define MAJOR_IN_SYSMACROS +/*# define HAVE_USG_STDIO*/ +# define HAVE_GETCWD +# define HAVE_STRERROR +# define HAVE_MEMMOVE +# define HAVE_MMAP +# define HAVE_SMMAP +# define HAVE_USGSHM +# define HAVE_USGSEM +# define HAVE_MSEM +# define HAVE_FLOCK +# define HAVE_QUOTA +# define HAVE_YP +# define HAVE_WAIT3 +# define HAVE_WAITPID +# define HAVE_GETHOSTNAME +# define HAVE_STREAMS +# define HAVE_POLL +# define HAVE_SELECT + +# define GID_T gid_t +# define USLEEPRETURN_T int +#endif + +/* + * Silicon Graphics (must be before SVR4) + */ +#if defined(sgi) || defined(__sgi) +# define __NOT_SVR4__ /* Not a real SVR4 implementation */ + +# define PROTOTYPES +# define HAVE_ELF +# define HAVE_COFF +# define HAVE_STDARG_H +# define HAVE_LONGLONG +# define HAVE_UNISTD_H +# define HAVE_FCNTL_H +# define HAVE_DIRENT_H +# define HAVE_TERMIOS_H +# define HAVE_TERMIO_H +# define HAVE_SYS_TIME_H +# define HAVE_UTIMES +# define HAVE_UTIME_H +# define HAVE_WAIT_H +# define HAVE_SYS_WAIT_H +# define HAVE_SYS_PARAM_H +# define HAVE_SYS_SYSTEMINFO_H +# define HAVE_SYS_UTSNAME_H +# define HAVE_SYS_MTIO_H +# define HAVE_MTGET_DSREG +# define HAVE_MTGET_RESID +# define HAVE_MTGET_FILENO +# define HAVE_MTGET_BLKNO +# define MAJOR_IN_MKDEV +# define HAVE_USG_STDIO +# define HAVE_GETCWD +# define HAVE_STRERROR +# define HAVE_MEMMOVE +# define HAVE_MMAP +# define HAVE_SMMAP +# define HAVE_USGSHM +# define HAVE_USGSEM +# define HAVE_FLOCK +# define HAVE_FCHDIR +# define HAVE_STATVFS +# define HAVE_QUOTA +# define HAVE_YP +# define HAVE_SHADOW +# define HAVE_PROCFS +# define HAVE_SIGINFO +# define HAVE_WAIT3 +# define HAVE_WAITPID +# define HAVE_GETHOSTNAME +# define HAVE_STREAMS +# define HAVE_STRPTYS +# define HAVE_POLL +# define HAVE_SELECT +# define HAVE_STRPTYS +# define GID_T gid_t +/*# define USLEEPRETURN_T unsigned int*/ +# define vfork fork +#endif + +#if defined(mips) && !(defined(ultrix) || defined(sony) || defined(sgi)) +# define HAVE_COFF +# define HAVE_UNISTD_H +# define HAVE_USGSHM +# define HAVE_USGSEM +# define HAVE_FLOCK +# define HAVE_YP +# define GID_T int +# define USLEEPRETURN_T unsigned int +#endif + +#if defined(sony) +# ifdef mips +# define HAVE_COFF +# else +# define HAVE_AOUT +# endif +# define HAVE_USGSHM +# define HAVE_USGSEM +# define HAVE_FLOCK +# define HAVE_QUOTA +# define HAVE_YP +# define GID_T int +# define USLEEPRETURN_T unsigned int +# ifndef SEEK_SET +# define SEEK_SET 0 /* Set file pointer to "offset" */ +# define SEEK_CUR 1 /* Set file pointer to current plus "offset" */ +# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ +# endif +#endif + +/* + * Digital UNIX (OSF1) + */ +#if defined(__osf__) +# define PROTOTYPES +# define HAVE_OSDEF /* prevent later definitions to overwrite current */ +/*# define __NOT_SVR4__*/ /* Not a real SVR4 implementation */ + +/*# define HAVE_ELF*/ +# define HAVE_COFF +/*# define HAVE_AOUT*/ +# define HAVE_STDARG_H +/*# define HAVE_VA_COPY*/ +# define HAVE_STDLIB_H +# define HAVE_STRING_H +# define HAVE_STDC_HEADERS +# define STDC_HEADERS /* GNU name */ +# define HAVE_LONGLONG + +# define HAVE_UNISTD_H +# define HAVE_FCNTL_H +# define HAVE_DIRENT_H +# define HAVE_SYS_DIR_H +/*# define HAVE_NDIR_H*/ +/*# define HAVE_SYS_NDIR_H*/ +# define HAVE_TERMIOS_H +# define HAVE_TERMIO_H +# define HAVE_SYS_TIME_H +# define HAVE_UTIMES +# define HAVE_UTIME_H +# define HAVE_WAIT_H +# define HAVE_SYS_WAIT_H +# define HAVE_SYS_PARAM_H +# define HAVE_SYS_SYSTEMINFO_H +# define HAVE_SYS_UTSNAME_H +# define HAVE_SYS_PRIOCNTL_H +# define HAVE_SYS_RTPRIOCNTL_H +# define HAVE_SYS_MTIO_H +# define HAVE_MTGET_DSREG +# define HAVE_MTGET_RESID +# define HAVE_MTGET_FILENO +# define HAVE_MTGET_BLKNO +/*# define MAJOR_IN_MKDEV*/ +# define MAJOR_IN_SYSMACROS +# define HAVE_USG_STDIO +/*# define HAVE_DTOA*/ +# define HAVE_GETCWD +# define HAVE_STRERROR +# define HAVE_MEMMOVE +# define HAVE_MLOCKALL +# define HAVE_MMAP +# define HAVE_SMMAP +# define HAVE_USGSHM +# define HAVE_USGSEM +# define HAVE_MSEM +/*# define HAVE_LDSTUB*/ +/*# define HAVE_XCHG*/ +# define HAVE_FLOCK +# define HAVE_FCHDIR +# define HAVE_STATVFS +# define HAVE_QUOTA +# define HAVE_YP +/*# define HAVE_SHADOW*/ /* No, but C2 */ +# define HAVE_SETREUID +/*# define HAVE_SETRESUID*/ +# define HAVE_SETEUID +# define HAVE_LCHOWN +# define HAVE_PROCFS +/*# define HAVE_PROCFS2*/ /* No */ +# define HAVE_SIGINFO +# define HAVE_WAIT3 +# define HAVE_WAITPID +# define HAVE_UNION_WAIT +# define HAVE_GETHOSTNAME +# define HAVE_STREAMS +# define HAVE_STRPTYS +# define HAVE_POLL +# define HAVE_SELECT /* XXX needs sys/select.h */ +/*# define HAVE_TIRPC*/ +# define GID_T gid_t +# define USLEEPRETURN_T int +/*# define USLEEPRETURN_T void*/ +/*# define USLEEPISVOID*/ + +/*# define HAVE_GETAV0*/ +/*# define HAVE_SCANSTACK*/ +#endif + +#if defined(ultrix) +# ifdef mips +# define HAVE_COFF +# else +# define HAVE_AOUT +# endif +# define HAVE_STDLIB_H +# define HAVE_UNISTD_H +# define HAVE_SYS_DIR_H +# define HAVE_TERMIOS_H +# define HAVE_UTIME_H +# define HAVE_USGSHM +# define HAVE_USGSEM +# define HAVE_FLOCK +# define HAVE_QUOTA +# define HAVE_YP +# define GID_T int +# define USLEEPRETURN_T unsigned int +#endif + +/* + * HP/UX + */ +#if defined(__hpux) || defined(hpux) +/*# define PROTOTYPES*/ +# define HAVE_AOUT +# define HAVE_STDARG_H +# define HAVE_UNISTD_H +# define HAVE_FCNTL_H +# define HAVE_DIRENT_H +# define HAVE_TERMIOS_H +# define HAVE_TERMIO_H +# define HAVE_SYS_TIME_H +# define HAVE_UTIME_H +# define HAVE_SYS_WAIT_H +# define HAVE_SYS_PARAM_H +# define HAVE_SYS_UTSNAME_H +# define HAVE_SYS_MTIO_H +# define MAJOR_IN_SYSMACROS +# define HAVE_GETCWD +# define HAVE_STRERROR +# define HAVE_MEMMOVE +# define HAVE_MMAP +# define HAVE_SMMAP +# define HAVE_USGSHM +# define HAVE_USGSEM +#if 0 +# define HAVE_MSEM +# endif +# define HAVE_FCHDIR +# define HAVE_QUOTA +# define HAVE_YP +# define HAVE_SETRESUID +# define HAVE_WAIT3 +# define HAVE_WAITPID +# define HAVE_GETHOSTNAME +# define HAVE_STREAMS +# define HAVE_STRPTYS +# define HAVE_POLL +# define HAVE_SELECT +# define GID_T gid_t +/*# define USLEEPRETURN_T unsigned int*/ +#endif + +/* + * Data General + */ +#if defined(__DGUX__) +# define PROTOTYPES +# define HAVE_ELF +# define HAVE_STDARG_H +# define HAVE_UNISTD_H +# define HAVE_DIRENT_H +# define HAVE_TERMIOS_H +# define HAVE_SYS_TIME_H +# define HAVE_UTIMES +# define HAVE_UTIME_H +# define HAVE_SYS_PARAM_H +# undef HAVE_MTGET_DSREG +# undef HAVE_MTGET_RESID +# undef HAVE_MTGET_FILENO +# undef HAVE_MTGET_BLKNO +# define mt_type mt_model +# define mt_dsreg mt_status1 +# define mt_erreg mt_status2 +# define HAVE_GETCWD +# define HAVE_STRERROR +# define HAVE_MEMMOVE +# define HAVE_USGSEM +# if defined(__i386_) || defined(i386) +# define HAVE_XCHG +# endif + /* + * DGUX hides its flock as dg_flock. + */ +# define HAVE_FLOCK +# define flock dg_flock +# define HAVE_FCHDIR +# define HAVE_STATVFS +# undef HAVE_QUOTA +# define HAVE_YP +# define HAVE_SHADOW +# undef HAVE_PROCFS +# undef HAVE_PROCFS2 +# define HAVE_WAIT3 +# define HAVE_UNION_WAIT +/*# define HAVE_GETHOSTNAME*/ +# define HAVE_STREAMS +# define HAVE_STRPTYS +# define HAVE_POLL +# define HAVE_SELECT +# undef HAVE_TIRPC +# define GID_T gid_t +# define USLEEPRETURN_T unsigned int + /* + * Use the BSD style wait on DGUX to get the resource usages of child + * processes. + */ +# define _BSD_WAIT_FLAVOR + +/*# define HAVE_GETAV0*/ +# ifdef i386 +# define HAVE_SCANSTACK +# endif +#endif + +/* + * Linux + */ +#if defined(__linux__) || defined(__linux) +# define PROTOTYPES +# ifdef __ELF__ +# define HAVE_ELF +# else +# define HAVE_AOUT +# endif +# define HAVE_STDARG_H +# define HAVE_STDLIB_H +# define HAVE_STRING_H +# define HAVE_STDC_HEADERS +# define STDC_HEADERS /* GNU name */ +# define HAVE_LONGLONG +# define HAVE_UNISTD_H +# define HAVE_FCNTL_H +# define HAVE_DIRENT_H +# define HAVE_TERMIOS_H +# define HAVE_TERMIO_H +# define HAVE_SYS_TIME_H +# define HAVE_UTIMES +# define HAVE_UTIME_H +/*# define HAVE_WAIT_H*/ +# define HAVE_SYS_WAIT_H +# define HAVE_SYS_PARAM_H +# define HAVE_SYS_UTSNAME_H +# define HAVE_SYS_MTIO_H +# define HAVE_MTGET_DSREG +# define HAVE_MTGET_RESID +# define HAVE_MTGET_FILENO +# define HAVE_MTGET_BLKNO +# define MAJOR_IN_SYSMACROS +# define HAVE_GETCWD +# define HAVE_STRERROR +# define HAVE_MEMMOVE +# define HAVE_MLOCKALL +# define HAVE_MMAP +/*# define HAVE_SMMAP*/ +# define HAVE_USGSHM +# define HAVE_USGSEM +# define HAVE_FLOCK +# define HAVE_FCHDIR +# define HAVE_STATVFS +# define HAVE_QUOTA +# define HAVE_YP +# define HAVE_SETREUID /* >= Linux 1.1.37 */ +# define HAVE_SETEUID +/*# define HAVE_PROCFS*/ /* ??? */ +/*# define HAVE_PROCFS2*/ +# define HAVE_WAIT3 +# define HAVE_WAITPID +# define HAVE_GETHOSTNAME +# define HAVE_SELECT + +# define GID_T gid_t +# define USLEEPRETURN_T void +# define USLEEPISVOID + +/*# define HAVE_GETAV0*/ +# define HAVE_SCANSTACK +#endif + + +#if defined(OLD__bsdi__) +# define HAVE_MSEM /* ??? */ +# define F_ULOCK 0 /* Unlock a previously locked region */ +# define F_LOCK 1 /* Lock a region for exclusive use */ +# define F_TLOCK 2 /* Test and lock a region for exclusive use */ +# define F_TEST 3 /* Test a region for other processes locks */ +#endif + +/* + * Prototype for FreeBSD / NetBSD / OpenBSD / BSD/OS + */ +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__bsdi__) +# define PROTOTYPES +# define HAVE_AOUT +# define HAVE_STDARG_H +# define HAVE_STDLIB_H +# define HAVE_STRING_H +# define HAVE_STDC_HEADERS +# define STDC_HEADERS /* GNU name */ +# define HAVE_LONGLONG +# define HAVE_UNISTD_H +# define HAVE_FCNTL_H +# define HAVE_DIRENT_H +# define HAVE_TERMIOS_H +# define HAVE_SYS_TIME_H +# define HAVE_UTIMES +# define HAVE_UTIME_H +# define HAVE_SYS_WAIT_H +# define HAVE_SYS_PARAM_H +# define HAVE_SYS_UTSNAME_H +# define HAVE_SYS_MTIO_H +# define HAVE_MTGET_DSREG +# define HAVE_MTGET_RESID +# define HAVE_MTGET_FILENO +# define HAVE_MTGET_BLKNO +/*# define HAVE_USG_STDIO*/ +# define HAVE_DTOA +# define HAVE_GETCWD +# define HAVE_STRERROR +# define HAVE_MEMMOVE +# define HAVE_MMAP +# define HAVE_SMMAP +# define HAVE_USGSHM +# define HAVE_USGSEM +# ifdef sparc +# define HAVE_LDSTUB +# endif +# ifdef i386 +# define HAVE_XCHG +# endif +# define HAVE_FLOCK +# define HAVE_FCHDIR +# define HAVE_QUOTA +# define HAVE_YP +# define HAVE_SETREUID +/*# define HAVE_SETRESUID*/ +# define HAVE_SETEUID +/*# define HAVE_LCHOWN*/ +# define HAVE_WAIT3 +# define HAVE_WAITPID +# define HAVE_UNION_WAIT +# define HAVE_GETHOSTNAME +# define HAVE_SELECT +# define GID_T gid_t +/*# define USLEEPRETURN_T unsigned int*/ +# define USLEEPRETURN_T void +# define USLEEPISVOID + +/*# define HAVE_GETAV0*/ +/*# define HAVE_SCANSTACK*/ +#endif + +/* + * SysVr4 + */ +#if defined(__SVR4) && !defined(__NOT_SVR4__) +# define PROTOTYPES +# define HAVE_ELF +# define HAVE_STDARG_H +# if defined(IS_SUN) +# define HAVE_LONGLONG +# define HAVE_UTIMES +# define HAVE_QUOTA +# define HAVE_GETAV0 /* XXX what about PPC ??? */ +# define HAVE_SCANSTACK /* XXX what about PPC ??? */ +# define HAVE_STRSIGNAL +# define HAVE_STR2SIG +# define HAVE_SIG2STR +# endif +# define HAVE_UNISTD_H +# define HAVE_FCNTL_H +# define HAVE_DIRENT_H +# define HAVE_TERMIOS_H +# define HAVE_TERMIO_H +# define HAVE_SYS_TIME_H +# define HAVE_UTIME_H +# define HAVE_WAIT_H +# define HAVE_SYS_WAIT_H +# define HAVE_SYS_PARAM_H +# define HAVE_SYS_SYSTEMINFO_H +# define HAVE_SYS_UTSNAME_H +# define HAVE_SYS_PRIOCNTL_H +# define HAVE_SYS_RTPRIOCNTL_H +# define HAVE_SYS_MTIO_H +# define HAVE_MTGET_DSREG +# define HAVE_MTGET_RESID +# define HAVE_MTGET_FILENO +# define HAVE_MTGET_BLKNO +# define MAJOR_IN_MKDEV +# define HAVE_USG_STDIO +# define HAVE_GETCWD +# define HAVE_STRERROR +# define HAVE_MEMMOVE +# define HAVE_MLOCKALL +# define HAVE_MMAP +# define HAVE_SMMAP +# define HAVE_USGSHM +# define HAVE_USGSEM +# ifdef sparc +# define HAVE_LDSTUB +# endif +# ifdef i386 +# define HAVE_XCHG +# endif +# define HAVE_FCHDIR +# define HAVE_STATVFS +# define HAVE_YP +# define HAVE_SHADOW +# define HAVE_SETEUID +# define HAVE_LCHOWN +# define HAVE_PROCFS +# if (defined(i386) && !defined(IS_SUN)) +# define HAVE_PROCFS2 +# define HAVE_QUOTA +# endif +# define HAVE_SIGINFO +# define HAVE_WAITPID +# define HAVE_STREAMS +# define HAVE_STRPTYS +# define HAVE_POLL +# define HAVE_SELECT +# define HAVE_TIRPC +# define GID_T gid_t +# define USLEEPRETURN_T unsigned int +#endif + +/* + * Apple Rhapsody + */ +#if defined(__NeXT__) && defined(__TARGET_OSNAME) && __TARGET_OSNAME == rhapsody +# define HAVE_OSDEF /* prevent later definitions to overwrite current */ + +# define PROTOTYPES +/*# define HAVE_ELF*/ +/*# define HAVE_COFF*/ +/*# define HAVE_AOUT*/ +# define HAVE_STDARG_H +# define HAVE_STDLIB_H +# define HAVE_STRING_H +# define HAVE_STDC_HEADERS +# define STDC_HEADERS /* GNU name */ +# define HAVE_LONGLONG +# define HAVE_UNISTD_H +# define HAVE_FCNTL_H +# define HAVE_DIRENT_H +# define HAVE_SYS_DIR_H +/*# define HAVE_NDIR_H*/ +/*# define HAVE_SYS_NDIR_H*/ +# define HAVE_TERMIOS_H +/*# define HAVE_TERMIO_H*/ +# define HAVE_SYS_TIME_H +# define HAVE_UTIMES +# define HAVE_UTIME_H +/*# define HAVE_WAIT_H*/ +# define HAVE_SYS_WAIT_H +# define HAVE_SYS_PARAM_H +/*# define HAVE_SYS_SYSTEMINFO_H*/ +# define HAVE_SYS_UTSNAME_H +/*# define HAVE_SYS_PRIOCNTL_H*/ +/*# define HAVE_SYS_RTPRIOCNTL_H*/ +# define HAVE_SYS_MTIO_H +# define HAVE_MTGET_DSREG +# define HAVE_MTGET_RESID +# define HAVE_MTGET_FILENO +# define HAVE_MTGET_BLKNO +/*# define MAJOR_IN_MKDEV*/ +/*# define MAJOR_IN_SYSMACROS*/ +/*# define HAVE_USG_STDIO*/ +# define HAVE_DTOA +# define HAVE_GETCWD +# define HAVE_STRERROR +# define HAVE_MEMMOVE +# define HAVE_MMAP +# define HAVE_SMMAP +# define HAVE_USGSHM +# define HAVE_USGSEM +/*# define HAVE_MSEM*/ +/*# define HAVE_LDSTUB*/ +# if defined(__i386_) || defined(i386) +# define HAVE_XCHG +# endif +# define HAVE_FLOCK +/*# define HAVE_FCHDIR*/ +/*# define HAVE_STATVFS*/ +# define HAVE_QUOTA +# define HAVE_YP +/*# define HAVE_SHADOW*/ +# define HAVE_SETREUID +/*# define HAVE_SETRESUID*/ +# define HAVE_SETEUID +/*# define HAVE_LCHOWN*/ +/*# define HAVE_PROCFS*/ +/*# define HAVE_PROCFS2*/ +/*# define HAVE_SIGINFO*/ +# define HAVE_WAIT3 +/*# define HAVE_WAITPID*/ +# define HAVE_UNION_WAIT +# define HAVE_GETHOSTNAME +/*# define HAVE_STREAMS*/ +/*# define HAVE_STRPTYS*/ +# define HAVE_POLL +# define HAVE_SELECT +/*# define HAVE_TIRPC*/ +/*# define GID_T gid_t*/ +/*# define USLEEPRETURN_T unsigned int*/ +/*# define USLEEPRETURN_T void*/ +# define USLEEPISVOID + +/*# define HAVE_GETAV0*/ +/*# define HAVE_SCANSTACK*/ +#endif + +/* + * NextStep + */ +#if defined(__NeXT__) && !defined(HAVE_OSDEF) + +#define printf Xprintf +#define fprintf Xfprintf +#define sprintf Xsprintf +#ifdef XXX +# define __NOT_SVR4__ /* Not a real SVR4 implementation */ +#endif + +# define PROTOTYPES +/*# define HAVE_ELF*/ +/*# define HAVE_COFF*/ +/*# define HAVE_AOUT*/ +# define HAVE_STDARG_H +# define HAVE_STDLIB_H +# define HAVE_STRING_H +# define HAVE_STDC_HEADERS +# define STDC_HEADERS /* GNU name */ +# define HAVE_LONGLONG +# define HAVE_UNISTD_H +# define HAVE_FCNTL_H +/*# define HAVE_DIRENT_H XXX not posix compliant */ +# define HAVE_SYS_DIR_H +/*# define HAVE_NDIR_H*/ +/*# define HAVE_SYS_NDIR_H*/ +/*# define HAVE_TERMIOS_H XXX need buggy -lposix */ +/*# define HAVE_TERMIO_H*/ +# define HAVE_SYS_TIME_H +# define HAVE_UTIMES +# define HAVE_UTIME_H +/*# define HAVE_WAIT_H*/ +# define HAVE_SYS_WAIT_H +# define HAVE_SYS_PARAM_H +/*# define HAVE_SYS_SYSTEMINFO_H*/ +/*# define HAVE_SYS_UTSNAME_H XXX needs buggy -lposix */ +/*# define HAVE_SYS_PRIOCNTL_H*/ +/*# define HAVE_SYS_RTPRIOCNTL_H*/ +# define HAVE_SYS_MTIO_H +# define HAVE_MTGET_DSREG +# define HAVE_MTGET_RESID +# define HAVE_MTGET_FILENO +# define HAVE_MTGET_BLKNO +/*# define MAJOR_IN_MKDEV*/ +/*# define MAJOR_IN_SYSMACROS*/ +/*# define HAVE_USG_STDIO XXX different _flsbuf() */ +# define HAVE_STRERROR +/*# define HAVE_MEMMOVE*/ +/*# define HAVE_MMAP*/ +/*# define HAVE_SMMAP*/ +/*# define HAVE_USGSHM*/ +/*# define HAVE_USGSEM*/ +/*# define HAVE_MSEM*/ +/*# define HAVE_LDSTUB*/ +/*# define HAVE_XCHG*/ +# define HAVE_FLOCK +/*# define HAVE_FCHDIR*/ +/*# define HAVE_STATVFS*/ +/*# define HAVE_QUOTA*/ +/*# define HAVE_YP*/ +/*# define HAVE_SHADOW*/ +# define HAVE_SETREUID +/*# define HAVE_SETRESUID*/ +# define HAVE_SETEUID +/*# define HAVE_LCHOWN*/ +/*# define HAVE_PROCFS*/ +/*# define HAVE_PROCFS2*/ +/*# define HAVE_SIGINFO*/ +# define HAVE_WAIT3 +/*# define HAVE_WAITPID*/ +# define HAVE_UNION_WAIT +# define HAVE_GETHOSTNAME +/*# define HAVE_STREAMS*/ +/*# define HAVE_STRPTYS*/ +/*# define HAVE_POLL*/ +# define HAVE_SELECT +/*# define HAVE_TIRPC*/ +# define GID_T gid_t +# define USLEEPRETURN_T int +/*# define USLEEPRETURN_T void*/ +/*# define USLEEPISVOID*/ + +/*# define HAVE_GETAV0*/ +/*# define HAVE_SCANSTACK*/ +#endif + +/* + * Cygwin 32 (NT) + */ +#if defined(__CYGWIN32__) +# define PROTOTYPES +# define HAVE_OSDEF /* prevent later definitions to overwrite current */ +# define __NOT_SVR4__ /* Not a real SVR4 implementation */ + +/*# define HAVE_ELF*/ +/*# define HAVE_COFF*/ +# define HAVE_AOUT +# define HAVE_STDARG_H +/*# define HAVE_VA_COPY*/ +# define HAVE_STDLIB_H +# define HAVE_STRING_H +# define HAVE_STDC_HEADERS +# define STDC_HEADERS /* GNU name */ +# define HAVE_LONGLONG + +# define HAVE_UNISTD_H +# define HAVE_FCNTL_H +# define HAVE_DIRENT_H +/*# define HAVE_SYS_DIR_H*/ +/*# define HAVE_NDIR_H*/ +/*# define HAVE_SYS_NDIR_H*/ +# define HAVE_TERMIOS_H +# define HAVE_TERMIO_H +# define HAVE_SYS_TIME_H +/*# define HAVE_UTIMES*/ +# define HAVE_UTIME_H +/*# define HAVE_WAIT_H*/ +# define HAVE_SYS_WAIT_H +# define HAVE_SYS_PARAM_H +/*# define HAVE_SYS_SYSTEMINFO_H*/ +# define HAVE_SYS_UTSNAME_H +/*# define HAVE_SYS_PRIOCNTL_H*/ +/*# define HAVE_SYS_RTPRIOCNTL_H*/ +/*# define HAVE_SYS_MTIO_H*/ +/*# define HAVE_MTGET_DSREG*/ +/*# define HAVE_MTGET_RESID*/ +/*# define HAVE_MTGET_FILENO*/ +/*# define HAVE_MTGET_BLKNO*/ +/*# define MAJOR_IN_MKDEV*/ +/*# define MAJOR_IN_SYSMACROS*/ +/*# define HAVE_USG_STDIO*/ +/*# define HAVE_DTOA*/ /* XXX eigentlich doch da */ +# define HAVE_GETCWD +# define HAVE_STRERROR +# define HAVE_MEMMOVE +# define HAVE_MMAP +# define HAVE_SMMAP +/*# define HAVE_USGSHM*/ +/*# define HAVE_USGSEM*/ +/*# define HAVE_MSEM*/ +/*# define HAVE_LDSTUB*/ +# if defined(__i386_) || defined(i386) +# define HAVE_XCHG +# endif +/*# define HAVE_FLOCK*/ +/*# define HAVE_FCHDIR*/ +/*# define HAVE_STATVFS*/ +/*# define HAVE_QUOTA*/ +/*# define HAVE_YP*/ +/*# define HAVE_SHADOW*/ +/*# define HAVE_SETREUID*/ +/*# define HAVE_SETRESUID*/ +/*# define HAVE_SETEUID*/ +/*# define HAVE_LCHOWN*/ +/*# define HAVE_PROCFS*/ +/*# define HAVE_PROCFS2*/ +/*# define HAVE_SIGINFO*/ +# define HAVE_WAIT3 +# define HAVE_WAITPID +# define HAVE_UNION_WAIT +# define HAVE_GETHOSTNAME +/*# define HAVE_STREAMS*/ +/*# define HAVE_STRPTYS*/ +/*# define HAVE_POLL*/ +# define HAVE_SELECT +/*# define HAVE_TIRPC*/ +# define GID_T gid_t +# define USLEEPRETURN_T unsigned int +/*# define USLEEPRETURN_T void*/ +/*# define USLEEPISVOID*/ + +/*# define HAVE_GETAV0*/ +/*# define HAVE_SCANSTACK*/ +#endif /* __CYGWIN32__ */ + +#if defined(VMS) +# define PROTOTYPES +# define HAVE_OSDEF /* prevent later definitions to overwrite current */ +# define __NOT_SVR4__ /* Not a real SVR4 implementation */ + +# define HAVE_UNISTD_H +/* # define HAVE_SYS_TIME_H */ +# define HAVE_FCNTL_H +# define HAVE_USLEEP +# define HAVE_INTTYPES_H +# include <types.h> +# define HOST_CPU "Alpha/VAX" +# define HOST_VENDOR "CPQ" +# define HOST_OS "VMS/OpenVMS" +# define RETSIGTYPE void +/*# define HAVE_ELF */ +/*# define HAVE_COFF */ +/*# define HAVE_AOUT */ +/*# define HAVE_STDARG_H */ +/*# define HAVE_VA_COPY */ +/*# define HAVE_STDLIB_H */ +/*# define HAVE_STRING_H */ +/*# define HAVE_STDC_HEADERS */ +/*# define STDC_HEADERS */ +/*# define HAVE_LONGLONG */ + +/*# define HAVE_UNISTD_H */ +/*# define HAVE_FCNTL_H */ +/*# define HAVE_DIRENT_H */ +/*# define HAVE_SYS_DIR_H */ +/*# define HAVE_NDIR_H */ +/*# define HAVE_SYS_NDIR_H */ +/*# define HAVE_TERMIOS_H */ +/*# define HAVE_TERMIO_H */ +/*# define HAVE_SYS_TIME_H */ +/*# define HAVE_UTIMES */ +/*# define HAVE_UTIME_H */ +/*# define HAVE_WAIT_H */ +/*# define HAVE_SYS_WAIT_H */ +/*# define HAVE_SYS_SYSTEMINFO_H */ +/*# define HAVE_SYS_UTSNAME_H */ +/*# define HAVE_SYS_PRIOCNTL_H */ +/*# define HAVE_SYS_RTPRIOCNTL_H */ +/*# define HAVE_SYS_MTIO_H */ +/*# define HAVE_MTGET_DSREG */ +/*# define HAVE_MTGET_RESID */ +/*# define HAVE_MTGET_FILENO */ +/*# define HAVE_MTGET_BLKNO */ +/*# define MAJOR_IN_MKDEV */ +/*# define MAJOR_IN_SYSMACROS */ +/*# define HAVE_USG_STDIO */ +/*# define HAVE_DTOA */ +/*# define HAVE_STRERROR */ +# define HAVE_MEMMOVE +/*# define HAVE_MMAP */ +/*# define HAVE_SMMAP */ +/*# define HAVE_USGSHM */ +/*# define HAVE_USGSEM */ +/*# define HAVE_MSEM */ +/*# define HAVE_LDSTUB */ +/*# define HAVE_XCHG */ +/*# define HAVE_FLOCK */ +/*# define HAVE_FCHDIR */ +/*# define HAVE_STATVFS */ +/*# define HAVE_QUOTA */ +/*# define HAVE_YP */ +/*# define HAVE_SHADOW */ +/*# define HAVE_SETREUID */ +/*# define HAVE_SETRESUID */ +/*# define HAVE_SETEUID */ +/*# define HAVE_LCHOWN */ +/*# define HAVE_PROCFS */ +/*# define HAVE_PROCFS2 */ +/*# define HAVE_SIGINFO */ +/*# define HAVE_WAIT3 */ +/*# define HAVE_WAITPID */ +/*# define HAVE_UNION_WAIT */ +# define HAVE_GETHOSTNAME +/*# define HAVE_STREAMS */ +/*# define HAVE_STRPTYS */ +/*# define HAVE_POLL */ +# define HAVE_SELECT +/*# define HAVE_TIRPC */ +/*# define GID_T gid_t */ +# define USLEEPRETURN_T uint +/*# define USLEEPRETURN_T void */ +/*# define USLEEPISVOID */ +/*# define HAVE_GETAV0 */ +/*# define HAVE_SCANSTACK */ +#endif + +/* + * Prototype for new systems + */ +#if defined(__NEW_SYSTEM_TO_DEFINE__) +# define PROTOTYPES +# define HAVE_OSDEF /* prevent later definitions to overwrite current */ +# define __NOT_SVR4__ /* Not a real SVR4 implementation */ + +# define HAVE_ELF +# define HAVE_COFF +# define HAVE_AOUT +# define HAVE_STDARG_H +# define HAVE_VA_COPY +# define HAVE__VA_COPY +# define HAVE_STDLIB_H +# define HAVE_STRING_H +# define HAVE_STRINGS_H +# define HAVE_STDC_HEADERS +# define STDC_HEADERS /* GNU name */ +# define HAVE_LONGLONG +# define HAVE_SIZE_T +# define NO_SIZE_T + +# define HAVE_UNISTD_H +# define HAVE_FCNTL_H +# define HAVE_DIRENT_H +# define HAVE_SYS_DIR_H +# define HAVE_NDIR_H +# define HAVE_MALLOC_H +# define HAVE_SYS_NDIR_H +# define HAVE_TERMIOS_H +# define HAVE_TERMIO_H +# define HAVE_SYS_TIME_H +# define HAVE_UTIMES +# define HAVE_UTIME_H +# define HAVE_WAIT_H +# define HAVE_SYS_WAIT_H +# define HAVE_SYS_PARAM_H +# define HAVE_SYS_SYSTEMINFO_H +# define HAVE_SYS_UTSNAME_H +# define HAVE_SYS_PRIOCNTL_H +# define HAVE_SYS_RTPRIOCNTL_H +# define HAVE_SYS_MTIO_H +# define HAVE_MTGET_DSREG +# define HAVE_MTGET_RESID +# define HAVE_MTGET_FILENO +# define HAVE_MTGET_BLKNO +# define MAJOR_IN_MKDEV +# define MAJOR_IN_SYSMACROS +# define HAVE_USG_STDIO +# define HAVE_BRK +# define HAVE_SBRK +# define HAVE_DTOA +# define HAVE_GETCWD +# define HAVE_STRERROR +# define HAVE_MEMMOVE +# define HAVE_MLOCKALL +# define HAVE_MMAP +# define HAVE_SMMAP +# define HAVE_USGSHM +# define HAVE_USGSEM +# define HAVE_MSEM +# define HAVE_LDSTUB +# define HAVE_XCHG +# define HAVE_FLOCK +# define HAVE_FCHDIR +# define HAVE_STATVFS +# define HAVE_QUOTA +# define HAVE_YP +# define HAVE_SHADOW +# define HAVE_SETREUID +# define HAVE_SETRESUID +# define HAVE_SETEUID +# define HAVE_LCHOWN +# define HAVE_PROCFS +# define HAVE_PROCFS2 +# define HAVE_SIGINFO +# define HAVE_WAIT3 +# define HAVE_WAITPID +# define HAVE_UNION_WAIT +# define HAVE_GETHOSTNAME +# define HAVE_STREAMS +# define HAVE_STRPTYS +# define HAVE_POLL +# define HAVE_SELECT +# define HAVE_TIRPC +# define GID_T gid_t +# define USLEEPRETURN_T unsigned int +# define USLEEPRETURN_T void +# define USLEEPISVOID + +# define HAVE_GETAV0 +# define HAVE_SCANSTACK +#endif /* __NEW_SYSTEM_TO_DEFINE__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _XMCONFIG_H */ diff --git a/scsilib/lib/Makefile.off b/scsilib/lib/Makefile.off new file mode 100644 index 0000000..95d1c4c --- /dev/null +++ b/scsilib/lib/Makefile.off @@ -0,0 +1,14 @@ +#ident %W% %E% %Q% +########################################################################### +# Sample makefile for sub directory makes +########################################################################### +SRCROOT= .. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +include Targetdirs + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.dir +########################################################################### diff --git a/scsilib/lib/TARGETS/15conf b/scsilib/lib/TARGETS/15conf new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/scsilib/lib/TARGETS/15conf diff --git a/scsilib/lib/TARGETS/__slot b/scsilib/lib/TARGETS/__slot new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/scsilib/lib/TARGETS/__slot diff --git a/scsilib/lib/Targetdirs b/scsilib/lib/Targetdirs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/scsilib/lib/Targetdirs diff --git a/scsilib/librscg/Makefile b/scsilib/librscg/Makefile new file mode 100644 index 0000000..93284e0 --- /dev/null +++ b/scsilib/librscg/Makefile @@ -0,0 +1,12 @@ +#ident "%W% %E% %Q%" +########################################################################### +SRCROOT= .. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +MK_FILES= librscg.mk + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.mks +########################################################################### diff --git a/scsilib/librscg/librscg.mk b/scsilib/librscg/librscg.mk new file mode 100644 index 0000000..98269c9 --- /dev/null +++ b/scsilib/librscg/librscg.mk @@ -0,0 +1,23 @@ +#ident @(#)librscg.mk 1.2 02/11/22 +########################################################################### +SRCROOT= .. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +#.SEARCHLIST: . $(ARCHDIR) stdio $(ARCHDIR) +#VPATH= .:stdio:$(ARCHDIR) +INSDIR= lib +TARGETLIB= rscg +#CPPOPTS += -Ispecincl +CPPOPTS += -DUSE_PG +CPPOPTS += -DUSE_RCMD_RSH +#include Targets +CFILES= scsi-remote.c +LIBS= + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.lib +########################################################################### +#CC= echo " ==> COMPILING \"$@\""; cc +########################################################################### diff --git a/scsilib/librscg/scsi-remote.c b/scsilib/librscg/scsi-remote.c new file mode 100644 index 0000000..bb7aaf7 --- /dev/null +++ b/scsilib/librscg/scsi-remote.c @@ -0,0 +1,1157 @@ +#define USE_REMOTE +/* @(#)scsi-remote.c 1.16 04/08/24 Copyright 1990,2000-2003 J. Schilling */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-remote.c 1.16 04/08/24 Copyright 1990,2000-2003 J. Schilling"; +#endif +/* + * Remote SCSI user level command transport routines + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1990,2000-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> + +#if !defined(HAVE_FORK) || !defined(HAVE_SOCKETPAIR) || !defined(HAVE_DUP2) +#undef USE_RCMD_RSH +#endif +/* + * We may work without getservbyname() if we restructure the code not to + * use the port number if we only use _rcmdrsh(). + */ +#if !defined(HAVE_GETSERVBYNAME) +#undef USE_REMOTE /* Cannot get rcmd() port # */ +#endif +#if (!defined(HAVE_NETDB_H) || !defined(HAVE_RCMD)) && !defined(USE_RCMD_RSH) +#undef USE_REMOTE /* There is no rcmd() */ +#endif + +#ifdef USE_REMOTE +#include <stdio.h> +#include <sys/types.h> +#include <fctldefs.h> +#ifdef HAVE_SYS_SOCKET_H +#include <sys/socket.h> +#endif +#include <errno.h> +#include <signal.h> +#ifdef HAVE_NETDB_H +#include <netdb.h> +#endif +#ifdef HAVE_PWD_H +#include <pwd.h> +#endif +#include <standard.h> +#include <stdxlib.h> +#include <unixstd.h> +#include <strdefs.h> +#include <schily.h> + +#include <scg/scgcmd.h> +#include <scg/scsitransp.h> + +#if defined(SIGDEFER) || defined(SVR4) +#define signal sigset +#endif + +/* + * On Cygwin, there are no privilleged ports. + * On UNIX, rcmd() uses privilleged port that only work for root. + */ +#ifdef IS_CYGWIN +#define privport_ok() (1) +#else +#define privport_ok() (geteuid() == 0) +#endif + +#define CMD_SIZE 80 + +#define MAX_SCG 16 /* Max # of SCSI controllers */ +#define MAX_TGT 16 +#define MAX_LUN 8 + +/*extern BOOL debug;*/ +LOCAL BOOL debug = 1; + +LOCAL char _scg_trans_version[] = "remote-1.16"; /* The version for remote SCSI */ +LOCAL char _scg_auth_schily[] = "schily"; /* The author for this module */ + +LOCAL int scgo_rsend __PR((SCSI *scgp)); +LOCAL char * scgo_rversion __PR((SCSI *scgp, int what)); +LOCAL int scgo_rhelp __PR((SCSI *scgp, FILE *f)); +LOCAL int scgo_ropen __PR((SCSI *scgp, char *device)); +LOCAL int scgo_rclose __PR((SCSI *scgp)); +LOCAL long scgo_rmaxdma __PR((SCSI *scgp, long amt)); +LOCAL void * scgo_rgetbuf __PR((SCSI *scgp, long amt)); +LOCAL void scgo_rfreebuf __PR((SCSI *scgp)); +LOCAL BOOL scgo_rhavebus __PR((SCSI *scgp, int busno)); +LOCAL int scgo_rfileno __PR((SCSI *scgp, int busno, int tgt, int tlun)); +LOCAL int scgo_rinitiator_id __PR((SCSI *scgp)); +LOCAL int scgo_risatapi __PR((SCSI *scgp)); +LOCAL int scgo_rreset __PR((SCSI *scgp, int what)); + +/* + * XXX We should rethink the fd parameter now that we introduced + * XXX the rscsirchar() function and most access of remfd is done + * XXX via scglocal(scgp)->remfd. + */ +LOCAL void rscsiabrt __PR((int sig)); +LOCAL int rscsigetconn __PR((SCSI *scgp, char *host)); +LOCAL char *rscsiversion __PR((SCSI *scgp, int fd, int what)); +LOCAL int rscsiopen __PR((SCSI *scgp, int fd, char *fname)); +LOCAL int rscsiclose __PR((SCSI *scgp, int fd)); +LOCAL int rscsimaxdma __PR((SCSI *scgp, int fd, long amt)); +LOCAL int rscsigetbuf __PR((SCSI *scgp, int fd, long amt)); +LOCAL int rscsifreebuf __PR((SCSI *scgp, int fd)); +LOCAL int rscsihavebus __PR((SCSI *scgp, int fd, int bus)); +LOCAL int rscsifileno __PR((SCSI *scgp, int fd, int busno, int tgt, int tlun)); +LOCAL int rscsiinitiator_id __PR((SCSI *scgp, int fd)); +LOCAL int rscsiisatapi __PR((SCSI *scgp, int fd)); +LOCAL int rscsireset __PR((SCSI *scgp, int fd, int what)); +LOCAL int rscsiscmd __PR((SCSI *scgp, int fd, struct scg_cmd *sp)); +LOCAL int rscsifillrbuf __PR((SCSI *scgp)); +LOCAL int rscsirchar __PR((SCSI *scgp, char *cp)); +LOCAL int rscsireadbuf __PR((SCSI *scgp, int fd, char *buf, int count)); +LOCAL void rscsivoidarg __PR((SCSI *scgp, int fd, int count)); +LOCAL int rscsicmd __PR((SCSI *scgp, int fd, char *name, char *cbuf)); +LOCAL void rscsisendcmd __PR((SCSI *scgp, int fd, char *name, char *cbuf)); +LOCAL int rscsigetline __PR((SCSI *scgp, int fd, char *line, int count)); +LOCAL int rscsireadnum __PR((SCSI *scgp, int fd)); +LOCAL int rscsigetstatus __PR((SCSI *scgp, int fd, char *name)); +LOCAL int rscsiaborted __PR((SCSI *scgp, int fd)); +#ifdef USE_RCMD_RSH +LOCAL int _rcmdrsh __PR((char **ahost, int inport, + const char *locuser, + const char *remuser, + const char *cmd, + const char *rsh)); +#endif + +/*--------------------------------------------------------------------------*/ + +#define READBUF_SIZE 128 + +struct scg_local { + int remfd; + char readbuf[READBUF_SIZE]; + char *readbptr; + int readbcnt; + BOOL isopen; + int rsize; + int wsize; + char *v_version; + char *v_author; + char *v_sccs_id; +}; + + +#define scglocal(p) ((struct scg_local *)((p)->local)) + +scg_ops_t remote_ops = { + scgo_rsend, /* "S" end */ + scgo_rversion, /* "V" ersion */ + scgo_rhelp, /* help */ + scgo_ropen, /* "O" pen */ + scgo_rclose, /* "C" lose */ + scgo_rmaxdma, /* "D" MA */ + scgo_rgetbuf, /* "M" alloc */ + scgo_rfreebuf, /* "F" free */ + scgo_rhavebus, /* "B" us */ + scgo_rfileno, /* "T" arget */ + scgo_rinitiator_id, /* "I" nitiator */ + scgo_risatapi, /* "A" tapi */ + scgo_rreset, /* "R" eset */ +}; + +/* + * Return our ops ptr. + */ +scg_ops_t * +scg_remote() +{ + return (&remote_ops); +} + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_rversion(scgp, what) + SCSI *scgp; + int what; +{ + int f; + + if (scgp->local == NULL) + return ((char *)0); + + f = scglocal(scgp)->remfd; + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (__sccsid); + + case SCG_RVERSION: + if (scglocal(scgp)->v_version == NULL) + scglocal(scgp)->v_version = rscsiversion(scgp, f, SCG_VERSION); + return (scglocal(scgp)->v_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_RAUTHOR: + if (scglocal(scgp)->v_author == NULL) + scglocal(scgp)->v_author = rscsiversion(scgp, f, SCG_AUTHOR); + return (scglocal(scgp)->v_author); + case SCG_RSCCS_ID: + if (scglocal(scgp)->v_sccs_id == NULL) + scglocal(scgp)->v_sccs_id = rscsiversion(scgp, f, SCG_SCCS_ID); + return (scglocal(scgp)->v_sccs_id); + } + } + return ((char *)0); +} + +LOCAL int +scgo_rhelp(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "RSCSI", "Remote SCSI", + "REMOTE:", "rscsi@host:bus,target,lun", "REMOTE:rscsi@host:1,2,0", TRUE, FALSE); + return (0); +} + +LOCAL int +scgo_ropen(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + register int f; + register int nopen = 0; + char devname[128]; + char *p; + + if (scgp->overbose) + error("Warning: Using remote SCSI interface.\n"); + + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno, target or lun '%d,%d,%d'", + busno, tgt, tlun); + + return (-1); + } + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + scglocal(scgp)->remfd = -1; + scglocal(scgp)->readbptr = scglocal(scgp)->readbuf; + scglocal(scgp)->readbcnt = 0; + scglocal(scgp)->isopen = FALSE; + scglocal(scgp)->rsize = 0; + scglocal(scgp)->wsize = 0; + scglocal(scgp)->v_version = NULL; + scglocal(scgp)->v_author = NULL; + scglocal(scgp)->v_sccs_id = NULL; + } + + if (device == NULL || (strncmp(device, "REMOTE", 6) != 0) || + (device = strchr(device, ':')) == NULL) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal remote device syntax"); + return (-1); + } + device++; + /* + * Save non user@host:device + */ + js_snprintf(devname, sizeof (devname), "%s", device); + + if ((p = strchr(devname, ':')) != NULL) + *p++ = '\0'; + + f = rscsigetconn(scgp, devname); + if (f < 0) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot get connection to remote host"); + return (-1); + } + scglocal(scgp)->remfd = f; + debug = scgp->debug; + if (rscsiopen(scgp, f, p) >= 0) { + nopen++; + scglocal(scgp)->isopen = TRUE; + } + return (nopen); +} + +LOCAL int +scgo_rclose(scgp) + SCSI *scgp; +{ + register int f; + int ret; + + if (scgp->local == NULL) + return (-1); + + if (scglocal(scgp)->v_version != NULL) { + free(scglocal(scgp)->v_version); + scglocal(scgp)->v_version = NULL; + } + if (scglocal(scgp)->v_author != NULL) { + free(scglocal(scgp)->v_author); + scglocal(scgp)->v_author = NULL; + } + if (scglocal(scgp)->v_sccs_id != NULL) { + free(scglocal(scgp)->v_sccs_id); + scglocal(scgp)->v_sccs_id = NULL; + } + + f = scglocal(scgp)->remfd; + if (f < 0 || !scglocal(scgp)->isopen) + return (0); + ret = rscsiclose(scgp, f); + scglocal(scgp)->isopen = FALSE; + close(f); + scglocal(scgp)->remfd = -1; + return (ret); +} + +LOCAL long +scgo_rmaxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + if (scgp->local == NULL) + return (-1L); + + return (rscsimaxdma(scgp, scglocal(scgp)->remfd, amt)); +} + +LOCAL void * +scgo_rgetbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + int ret; + + if (scgp->local == NULL) + return ((void *)0); + + ret = rscsigetbuf(scgp, scglocal(scgp)->remfd, amt); + if (ret < 0) + return ((void *)0); + +#ifdef HAVE_VALLOC + scgp->bufbase = (void *)valloc((size_t)amt); +#else + scgp->bufbase = (void *)malloc((size_t)amt); +#endif + if (scgp->bufbase == NULL) { + scgo_rfreebuf(scgp); + return ((void *)0); + } + return (scgp->bufbase); +} + +LOCAL void +scgo_rfreebuf(scgp) + SCSI *scgp; +{ + int f; + + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; + + if (scgp->local == NULL) + return; + + f = scglocal(scgp)->remfd; + if (f < 0 || !scglocal(scgp)->isopen) + return; + rscsifreebuf(scgp, f); +} + +LOCAL BOOL +scgo_rhavebus(scgp, busno) + SCSI *scgp; + int busno; +{ + if (scgp->local == NULL || busno < 0 || busno >= MAX_SCG) + return (FALSE); + + return (rscsihavebus(scgp, scglocal(scgp)->remfd, busno)); +} + +LOCAL int +scgo_rfileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + int f; + + if (scgp->local == NULL || + busno < 0 || busno >= MAX_SCG || + tgt < 0 || tgt >= MAX_TGT || + tlun < 0 || tlun >= MAX_LUN) + return (-1); + + f = scglocal(scgp)->remfd; + if (f < 0 || !scglocal(scgp)->isopen) + return (-1); + return (rscsifileno(scgp, f, busno, tgt, tlun)); +} + +LOCAL int +scgo_rinitiator_id(scgp) + SCSI *scgp; +{ + if (scgp->local == NULL) + return (-1); + + return (rscsiinitiator_id(scgp, scglocal(scgp)->remfd)); +} + +LOCAL int +scgo_risatapi(scgp) + SCSI *scgp; +{ + if (scgp->local == NULL) + return (-1); + + return (rscsiisatapi(scgp, scglocal(scgp)->remfd)); +} + +LOCAL int +scgo_rreset(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp->local == NULL) + return (-1); + + return (rscsireset(scgp, scglocal(scgp)->remfd, what)); +} + +LOCAL int +scgo_rsend(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + int ret; + + if (scgp->local == NULL) + return (-1); + + if (scgp->fd < 0) { + sp->error = SCG_FATAL; + return (0); + } + ret = rscsiscmd(scgp, scglocal(scgp)->remfd, scgp->scmd); + + return (ret); +} + +/*--------------------------------------------------------------------------*/ +LOCAL void +rscsiabrt(sig) + int sig; +{ + rscsiaborted((SCSI *)0, -1); +} + +LOCAL int +rscsigetconn(scgp, host) + SCSI *scgp; + char *host; +{ + static struct servent *sp = 0; + static struct passwd *pw = 0; + char *name = "root"; + char *p; + char *rscsi; + char *rsh; + int rscsisock; + char *rscsipeer; + char rscsiuser[128]; + + + signal(SIGPIPE, rscsiabrt); + if (sp == 0) { + sp = getservbyname("shell", "tcp"); + if (sp == 0) { + comerrno(EX_BAD, "shell/tcp: unknown service\n"); + /* NOTREACHED */ + } + pw = getpwuid(getuid()); + if (pw == 0) { + comerrno(EX_BAD, "who are you? No passwd entry found.\n"); + /* NOTREACHED */ + } + } + if ((p = strchr(host, '@')) != NULL) { + size_t d = p - host; + + if (d > sizeof (rscsiuser)) + d = sizeof (rscsiuser); + js_snprintf(rscsiuser, sizeof (rscsiuser), "%.*s", (int)d, host); + name = rscsiuser; + host = &p[1]; + } else { + name = pw->pw_name; + } + if (scgp->debug > 0) + errmsgno(EX_BAD, "locuser: '%s' rscsiuser: '%s' host: '%s'\n", + pw->pw_name, name, host); + rscsipeer = host; + + if ((rscsi = getenv("RSCSI")) == NULL) + rscsi = "/opt/schily/sbin/rscsi"; + rsh = getenv("RSH"); + +#ifdef USE_RCMD_RSH + if (!privport_ok() || rsh != NULL) + rscsisock = _rcmdrsh(&rscsipeer, (unsigned short)sp->s_port, + pw->pw_name, name, rscsi, rsh); + else +#endif +#ifdef HAVE_RCMD + rscsisock = rcmd(&rscsipeer, (unsigned short)sp->s_port, + pw->pw_name, name, rscsi, 0); +#else + rscsisock = _rcmdrsh(&rscsipeer, (unsigned short)sp->s_port, + pw->pw_name, name, rscsi, rsh); +#endif + + return (rscsisock); +} + +LOCAL char * +rscsiversion(scgp, fd, what) + SCSI *scgp; + int fd; + int what; +{ + char cbuf[CMD_SIZE]; + char *p; + int ret; + + js_snprintf(cbuf, sizeof (cbuf), "V%d\n", what); + ret = rscsicmd(scgp, fd, "version", cbuf); + p = malloc(ret); + if (p == NULL) + return (p); + rscsireadbuf(scgp, fd, p, ret); + return (p); +} + +LOCAL int +rscsiopen(scgp, fd, fname) + SCSI *scgp; + int fd; + char *fname; +{ + char cbuf[CMD_SIZE]; + int ret; + int bus; + int chan; + int tgt; + int lun; + + js_snprintf(cbuf, sizeof (cbuf), "O%s\n", fname?fname:""); + ret = rscsicmd(scgp, fd, "open", cbuf); + if (ret < 0) + return (ret); + + bus = rscsireadnum(scgp, fd); + chan = rscsireadnum(scgp, fd); + tgt = rscsireadnum(scgp, fd); + lun = rscsireadnum(scgp, fd); + + scg_settarget(scgp, bus, tgt, lun); + return (ret); +} + +LOCAL int +rscsiclose(scgp, fd) + SCSI *scgp; + int fd; +{ + return (rscsicmd(scgp, fd, "close", "C\n")); +} + +LOCAL int +rscsimaxdma(scgp, fd, amt) + SCSI *scgp; + int fd; + long amt; +{ + char cbuf[CMD_SIZE]; + + js_snprintf(cbuf, sizeof (cbuf), "D%ld\n", amt); + return (rscsicmd(scgp, fd, "maxdma", cbuf)); +} + +LOCAL int +rscsigetbuf(scgp, fd, amt) + SCSI *scgp; + int fd; + long amt; +{ + char cbuf[CMD_SIZE]; + int size; + int ret; + + js_snprintf(cbuf, sizeof (cbuf), "M%ld\n", amt); + ret = rscsicmd(scgp, fd, "getbuf", cbuf); + if (ret < 0) + return (ret); + + size = ret + 1024; /* Add protocol overhead */ + +#ifdef SO_SNDBUF + if (size > scglocal(scgp)->wsize) while (size > 512 && + setsockopt(fd, SOL_SOCKET, SO_SNDBUF, + (char *)&size, sizeof (size)) < 0) { + size -= 512; + } + if (size > scglocal(scgp)->wsize) { + scglocal(scgp)->wsize = size; + if (scgp->debug > 0) + errmsgno(EX_BAD, "sndsize: %d\n", size); + } +#endif +#ifdef SO_RCVBUF + if (size > scglocal(scgp)->rsize) while (size > 512 && + setsockopt(fd, SOL_SOCKET, SO_RCVBUF, + (char *)&size, sizeof (size)) < 0) { + size -= 512; + } + if (size > scglocal(scgp)->rsize) { + scglocal(scgp)->rsize = size; + if (scgp->debug > 0) + errmsgno(EX_BAD, "rcvsize: %d\n", size); + } +#endif + return (ret); +} + +LOCAL int +rscsifreebuf(scgp, fd) + SCSI *scgp; + int fd; +{ + return (rscsicmd(scgp, fd, "freebuf", "F\n")); +} + +LOCAL int +rscsihavebus(scgp, fd, busno) + SCSI *scgp; + int fd; + int busno; +{ + char cbuf[2*CMD_SIZE]; + + js_snprintf(cbuf, sizeof (cbuf), "B%d\n%d\n", + busno, + 0); + return (rscsicmd(scgp, fd, "havebus", cbuf)); +} + +LOCAL int +rscsifileno(scgp, fd, busno, tgt, tlun) + SCSI *scgp; + int fd; + int busno; + int tgt; + int tlun; +{ + char cbuf[3*CMD_SIZE]; + + js_snprintf(cbuf, sizeof (cbuf), "T%d\n%d\n%d\n%d\n", + busno, + 0, + tgt, + tlun); + return (rscsicmd(scgp, fd, "fileno", cbuf)); +} + +LOCAL int +rscsiinitiator_id(scgp, fd) + SCSI *scgp; + int fd; +{ + return (rscsicmd(scgp, fd, "initiator id", "I\n")); +} + +LOCAL int +rscsiisatapi(scgp, fd) + SCSI *scgp; + int fd; +{ + return (rscsicmd(scgp, fd, "isatapi", "A\n")); +} + +LOCAL int +rscsireset(scgp, fd, what) + SCSI *scgp; + int fd; + int what; +{ + char cbuf[CMD_SIZE]; + + js_snprintf(cbuf, sizeof (cbuf), "R%d\n", what); + return (rscsicmd(scgp, fd, "reset", cbuf)); +} + +LOCAL int +rscsiscmd(scgp, fd, sp) + SCSI *scgp; + int fd; + struct scg_cmd *sp; +{ + char cbuf[1600]; + int ret; + int amt = 0; + int voidsize = 0; + + ret = js_snprintf(cbuf, sizeof (cbuf), "S%d\n%d\n%d\n%d\n%d\n", + sp->size, sp->flags, + sp->cdb_len, sp->sense_len, + sp->timeout); + movebytes(sp->cdb.cmd_cdb, &cbuf[ret], sp->cdb_len); + ret += sp->cdb_len; + + if ((sp->flags & SCG_RECV_DATA) == 0 && sp->size > 0) { + amt = sp->size; + if ((ret + amt) <= sizeof (cbuf)) { + movebytes(sp->addr, &cbuf[ret], amt); + ret += amt; + amt = 0; + } + } + errno = 0; + if (_nixwrite(fd, cbuf, ret) != ret) + rscsiaborted(scgp, fd); + + if (amt > 0) { + if (_nixwrite(fd, sp->addr, amt) != amt) + rscsiaborted(scgp, fd); + } + + ret = rscsigetstatus(scgp, fd, "sendcmd"); + if (ret < 0) + return (ret); + + sp->resid = sp->size - ret; + sp->error = rscsireadnum(scgp, fd); + sp->ux_errno = rscsireadnum(scgp, fd); + *(Uchar *)&sp->scb = rscsireadnum(scgp, fd); + sp->sense_count = rscsireadnum(scgp, fd); + + if (sp->sense_count > SCG_MAX_SENSE) { + voidsize = sp->sense_count - SCG_MAX_SENSE; + sp->sense_count = SCG_MAX_SENSE; + } + if (sp->sense_count > 0) { + rscsireadbuf(scgp, fd, (char *)sp->u_sense.cmd_sense, sp->sense_count); + rscsivoidarg(scgp, fd, voidsize); + } + + if ((sp->flags & SCG_RECV_DATA) != 0 && ret > 0) + rscsireadbuf(scgp, fd, sp->addr, ret); + + return (0); +} + +LOCAL int +rscsifillrbuf(scgp) + SCSI *scgp; +{ + scglocal(scgp)->readbptr = scglocal(scgp)->readbuf; + + return (scglocal(scgp)->readbcnt = + _niread(scglocal(scgp)->remfd, + scglocal(scgp)->readbuf, READBUF_SIZE)); +} + +LOCAL int +rscsirchar(scgp, cp) + SCSI *scgp; + char *cp; +{ + if (--(scglocal(scgp)->readbcnt) < 0) { + if (rscsifillrbuf(scgp) <= 0) + return (scglocal(scgp)->readbcnt); + --(scglocal(scgp)->readbcnt); + } + *cp = *(scglocal(scgp)->readbptr)++; + return (1); +} + +LOCAL int +rscsireadbuf(scgp, fd, buf, count) + SCSI *scgp; + int fd; + char *buf; + int count; +{ + register int n = count; + register int amt = 0; + register int cnt; + + if (scglocal(scgp)->readbcnt > 0) { + cnt = scglocal(scgp)->readbcnt; + if (cnt > n) + cnt = n; + movebytes(scglocal(scgp)->readbptr, buf, cnt); + scglocal(scgp)->readbptr += cnt; + scglocal(scgp)->readbcnt -= cnt; + amt += cnt; + } + while (amt < n) { + if ((cnt = _niread(fd, &buf[amt], n - amt)) <= 0) { + return (rscsiaborted(scgp, fd)); + } + amt += cnt; + } + return (amt); +} + +LOCAL void +rscsivoidarg(scgp, fd, n) + SCSI *scgp; + int fd; + register int n; +{ + register int i; + register int amt; + char buf[512]; + + for (i = 0; i < n; i += amt) { + amt = sizeof (buf); + if ((n - i) < amt) + amt = n - i; + rscsireadbuf(scgp, fd, buf, amt); + } +} + +LOCAL int +rscsicmd(scgp, fd, name, cbuf) + SCSI *scgp; + int fd; + char *name; + char *cbuf; +{ + rscsisendcmd(scgp, fd, name, cbuf); + return (rscsigetstatus(scgp, fd, name)); +} + +LOCAL void +rscsisendcmd(scgp, fd, name, cbuf) + SCSI *scgp; + int fd; + char *name; + char *cbuf; +{ + int buflen = strlen(cbuf); + + errno = 0; + if (_nixwrite(fd, cbuf, buflen) != buflen) + rscsiaborted(scgp, fd); +} + +LOCAL int +rscsigetline(scgp, fd, line, count) + SCSI *scgp; + int fd; + char *line; + int count; +{ + register char *cp; + + for (cp = line; cp < &line[count]; cp++) { + if (rscsirchar(scgp, cp) != 1) + return (rscsiaborted(scgp, fd)); + + if (*cp == '\n') { + *cp = '\0'; + return (cp - line); + } + } + return (rscsiaborted(scgp, fd)); +} + +LOCAL int +rscsireadnum(scgp, fd) + SCSI *scgp; + int fd; +{ + char cbuf[CMD_SIZE]; + + rscsigetline(scgp, fd, cbuf, sizeof (cbuf)); + return (atoi(cbuf)); +} + +LOCAL int +rscsigetstatus(scgp, fd, name) + SCSI *scgp; + int fd; + char *name; +{ + char cbuf[CMD_SIZE]; + char code; + int number; + int count; + int voidsize = 0; + + rscsigetline(scgp, fd, cbuf, sizeof (cbuf)); + code = cbuf[0]; + number = atoi(&cbuf[1]); + + if (code == 'E' || code == 'F') { + rscsigetline(scgp, fd, cbuf, sizeof (cbuf)); + if (code == 'F') /* should close file ??? */ + rscsiaborted(scgp, fd); + + rscsigetline(scgp, fd, cbuf, sizeof (cbuf)); + count = atoi(cbuf); + if (count > 0) { + if (scgp->errstr == NULL) { + voidsize = count; + count = 0; + } else if (count > SCSI_ERRSTR_SIZE) { + voidsize = count - SCSI_ERRSTR_SIZE; + count = SCSI_ERRSTR_SIZE; + } + rscsireadbuf(scgp, fd, scgp->errstr, count); + rscsivoidarg(scgp, fd, voidsize); + } + if (scgp->debug > 0) + errmsgno(number, "Remote status(%s): %d '%s'.\n", + name, number, cbuf); + errno = number; + return (-1); + } + if (code != 'A') { + /* XXX Hier kommt evt Command not found ... */ + if (scgp->debug > 0) + errmsgno(EX_BAD, "Protocol error (got %s).\n", cbuf); + return (rscsiaborted(scgp, fd)); + } + return (number); +} + +LOCAL int +rscsiaborted(scgp, fd) + SCSI *scgp; + int fd; +{ + if ((scgp && scgp->debug > 0) || debug) + errmsgno(EX_BAD, "Lost connection to remote host ??\n"); + /* if fd >= 0 */ + /* close file */ + if (errno == 0) + errno = EIO; + return (-1); +} + +/*--------------------------------------------------------------------------*/ +#ifdef USE_RCMD_RSH +/* + * If we make a separate file for libschily, we would need these include files: + * + * socketpair(): sys/types.h + sys/socket.h + * dup2(): unixstd.h (hat auch sys/types.h) + * strrchr(): strdefs.h + * + * and make sure that we use sigset() instead of signal() if possible. + */ +#include <waitdefs.h> +LOCAL int +_rcmdrsh(ahost, inport, locuser, remuser, cmd, rsh) + char **ahost; + int inport; /* port is ignored */ + const char *locuser; + const char *remuser; + const char *cmd; + const char *rsh; +{ + struct passwd *pw; + int pp[2]; + int pid; + + if (rsh == 0) + rsh = "rsh"; + + /* + * Verify that 'locuser' is present on local host. + */ + if ((pw = getpwnam(locuser)) == NULL) { + errmsgno(EX_BAD, "Unknown user: %s\n", locuser); + return (-1); + } + /* XXX Check the existence for 'ahost' here? */ + + /* + * rcmd(3) creates a single socket to be used for communication. + * We need a bi-directional pipe to implement the same interface. + * On newer OS that implement bi-directional we could use pipe(2) + * but it makes no sense unless we find an OS that implements a + * bi-directional pipe(2) but no socketpair(). + */ + if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, pp) == -1) { + errmsg("Cannot create socketpair.\n"); + return (-1); + } + + pid = fork(); + if (pid < 0) { + return (-1); + } else if (pid == 0) { + const char *p; + const char *av0; + int xpid; + + (void) close(pp[0]); + if (dup2(pp[1], 0) == -1 || /* Pipe becomes 'stdin' */ + dup2(0, 1) == -1) { /* Pipe becomes 'stdout' */ + + errmsg("dup2 failed.\n"); + _exit(EX_BAD); + /* NOTREACHED */ + } + (void) close(pp[1]); /* We don't need this anymore*/ + + /* + * Become 'locuser' to tell the rsh program the local user id. + */ + if (getuid() != pw->pw_uid && + setuid(pw->pw_uid) == -1) { + errmsg("setuid(%lld) failed.\n", + (Llong)pw->pw_uid); + _exit(EX_BAD); + /* NOTREACHED */ + } + if (getuid() != geteuid() && + seteuid(pw->pw_uid) == -1) { + errmsg("seteuid(%lld) failed.\n", + (Llong)pw->pw_uid); + _exit(EX_BAD); + /* NOTREACHED */ + } + + /* + * Fork again to completely detach from parent + * and avoid the need to wait(2). + */ + if ((xpid = fork()) == -1) { + errmsg("rcmdsh: fork to lose parent failed.\n"); + _exit(EX_BAD); + /* NOTREACHED */ + } + if (xpid > 0) { + _exit(0); + /* NOTREACHED */ + } + + /* + * Always use remote shell programm (even for localhost). + * The client command may call getpeername() for security + * reasons and this would fail on a simple pipe. + */ + + + /* + * By default, 'rsh' handles terminal created signals + * but this is not what we like. + * For this reason, we tell 'rsh' to ignore these signals. + * Ignoring these signals is important to allow 'star' / 'sdd' + * to e.g. implement SIGQUIT as signal to trigger intermediate + * status printing. + * + * For now (late 2002), we know that the following programs + * are broken and do not implement signal handling correctly: + * + * rsh on SunOS-5.0...SunOS-5.9 + * ssh from ssh.com + * ssh from openssh.org + * + * Sun already did accept a bug report for 'rsh'. For the ssh + * commands we need to send out bug reports. Meanwhile it could + * help to call setsid() if we are running under X so the ssh + * X pop up for passwd reading will work. + */ + signal(SIGINT, SIG_IGN); + signal(SIGQUIT, SIG_IGN); +#ifdef SIGTSTP + signal(SIGTSTP, SIG_IGN); /* We would not be able to continue*/ +#endif + + av0 = rsh; + if ((p = strrchr(rsh, '/')) != NULL) + av0 = ++p; + execlp(rsh, av0, *ahost, "-l", remuser, cmd, (char *)NULL); + + errmsg("execlp '%s' failed.\n", rsh); + _exit(EX_BAD); + /* NOTREACHED */ + } else { + (void) close(pp[1]); + /* + * Wait for the intermediate child. + * The real 'rsh' program is completely detached from us. + */ + wait(0); + return (pp[0]); + } + return (-1); /* keep gcc happy */ +} +#endif /* USE_RCMD_RSH */ + +#endif /* USE_REMOTE */ diff --git a/scsilib/libscg/Makefile b/scsilib/libscg/Makefile new file mode 100644 index 0000000..35522d6 --- /dev/null +++ b/scsilib/libscg/Makefile @@ -0,0 +1,12 @@ +#ident "%W% %E% %Q%" +########################################################################### +SRCROOT= .. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +MK_FILES= libscg.mk + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.mks +########################################################################### diff --git a/scsilib/libscg/Targets b/scsilib/libscg/Targets new file mode 100644 index 0000000..4e621d0 --- /dev/null +++ b/scsilib/libscg/Targets @@ -0,0 +1,3 @@ +CFILES= scsitransp.c scsihack.c scsiopen.c scgsettarget.c \ + scsierrs.c scgtimes.c scsihelp.c oexcl.c \ + rdummy.c diff --git a/scsilib/libscg/libscg.com b/scsilib/libscg/libscg.com new file mode 100644 index 0000000..48db7e3 --- /dev/null +++ b/scsilib/libscg/libscg.com @@ -0,0 +1,14 @@ +$ defs = "/float=ieee/pref=all" +$ incs = "/incl=([],[-.include])" +$ cc 'defs' 'incs' /define=("VMS") SCSIERRS.C +$ cc 'defs' 'incs' /define=("VMS") SCSITRANSP.C +$ cc 'defs' 'incs' /define=("VMS") SCSIOPEN.C +$ cc 'defs' 'incs' /define=("VMS") SCSIHACK.C +$ cc 'defs' 'incs' /define=("VMS") SCSIHELP.C +$ cc 'defs' 'incs' /define=("VMS") SCGSETTARGET.C +$ cc 'defs' 'incs' /define=("VMS") SCGTIMES.C +$ cc 'defs' 'incs' /define=("VMS") rdummy.c +$ library/crea [-.libs]libscg.olb +$ library/insert [-.libs]libscg.olb *.obj +$ delete *.obj;* +$ purge/nolog [-.libs]*.olb diff --git a/scsilib/libscg/libscg.mk b/scsilib/libscg/libscg.mk new file mode 100644 index 0000000..07da14f --- /dev/null +++ b/scsilib/libscg/libscg.mk @@ -0,0 +1,21 @@ +#ident %W% %E% %Q% +########################################################################### +SRCROOT= .. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +#.SEARCHLIST: . $(ARCHDIR) stdio $(ARCHDIR) +#VPATH= .:stdio:$(ARCHDIR) +INSDIR= lib +TARGETLIB= scg +#CPPOPTS += -Ispecincl +CPPOPTS += -DUSE_PG +include Targets +LIBS= + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.lib +########################################################################### +#CC= echo " ==> COMPILING \"$@\""; cc +########################################################################### diff --git a/scsilib/libscg/oexcl.c b/scsilib/libscg/oexcl.c new file mode 100644 index 0000000..c2276d2 --- /dev/null +++ b/scsilib/libscg/oexcl.c @@ -0,0 +1,29 @@ +#include <stdlib.h> +#include <unistd.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <stdio.h> + +int openexcl(const char *device, int mode) +{ + int f, i; + + f = open(device, mode | O_EXCL); + + if (f < 0) { + f = open(device, mode); + + if (f >= 0) { + close(f); + f = -1; + for (i = 0; (i < 10) && (f == -1); i++) { + fprintf(stderr, "Error trying to open %s exclusively ... retrying in 1 second.\n", device); + usleep(1000000 + 100000.0 * rand()/(RAND_MAX+1.0)); + f = open(device, O_RDONLY | O_NONBLOCK | O_EXCL); + } + } + } + + return f; +} diff --git a/scsilib/libscg/oexcl.h b/scsilib/libscg/oexcl.h new file mode 100644 index 0000000..0fc01b2 --- /dev/null +++ b/scsilib/libscg/oexcl.h @@ -0,0 +1,5 @@ +#ifndef OEXCL_H + +extern int openexcl(const char *device, int mode); + +#endif diff --git a/scsilib/libscg/pg.h b/scsilib/libscg/pg.h new file mode 100644 index 0000000..c752a97 --- /dev/null +++ b/scsilib/libscg/pg.h @@ -0,0 +1,63 @@ +/* pg.h (c) 1998 Grant R. Guenther <grant@torque.net> + Under the terms of the GNU public license + + + pg.h defines the user interface to the generic ATAPI packet + command driver for parallel port ATAPI devices (pg). The + driver is loosely modelled after the generic SCSI driver, sg, + although the actual interface is different. + + The pg driver provides a simple character device interface for + sending ATAPI commands to a device. With the exception of the + ATAPI reset operation, all operations are performed by a pair + of read and write operations to the appropriate /dev/pgN device. + A write operation delivers a command and any outbound data in + a single buffer. Normally, the write will succeed unless the + device is offline or malfunctioning, or there is already another + command pending. If the write succeeds, it should be followed + immediately by a read operation, to obtain any returned data and + status information. A read will fail if there is no operation + in progress. + + As a special case, the device can be reset with a write operation, + and in this case, no following read is expected, or permitted. + + There are no ioctl() operations. Any single operation + may transfer at most PG_MAX_DATA bytes. Note that the driver must + copy the data through an internal buffer. In keeping with all + current ATAPI devices, command packets are assumed to be exactly + 12 bytes in length. + + To permit future changes to this interface, the headers in the + read and write buffers contain a single character "magic" flag. + Currently this flag must be the character "P". + +*/ + +#define PG_MAGIC 'P' +#define PG_RESET 'Z' +#define PG_COMMAND 'C' + +#define PG_MAX_DATA 32768 + +struct pg_write_hdr { + + char magic; /* == PG_MAGIC */ + char func; /* PG_RESET or PG_COMMAND */ + int dlen; /* number of bytes expected to transfer */ + int timeout; /* number of seconds before timeout */ + char packet[12]; /* packet command */ + +}; + +struct pg_read_hdr { + + char magic; /* == PG_MAGIC */ + char scsi; /* "scsi" status == sense key */ + int dlen; /* size of device transfer request */ + int duration; /* time in seconds command took */ + char pad[12]; /* not used */ + +}; + +/* end of pg.h */ diff --git a/scsilib/libscg/rdummy.c b/scsilib/libscg/rdummy.c new file mode 100644 index 0000000..3b3d4f5 --- /dev/null +++ b/scsilib/libscg/rdummy.c @@ -0,0 +1,42 @@ +/* @(#)rdummy.c 1.1 00/08/26 Copyright 2000 J. Schilling */ +#ifndef lint +static char _sccsid[] = + "@(#)rdummy.c 1.1 00/08/26 Copyright 2000 J. Schilling"; +#endif +/* + * scg Library + * dummy remote ops + * + * Copyright (c) 2000 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <mconfig.h> +#include <standard.h> +#include <schily.h> + +#include <scg/scsitransp.h> + +EXPORT scg_ops_t *scg_remote __PR((void)); + +EXPORT scg_ops_t * +scg_remote() +{ +extern scg_ops_t scg_remote_ops; + + return (&scg_remote_ops); +} diff --git a/scsilib/libscg/scg/aspi-dos.h b/scsilib/libscg/scg/aspi-dos.h new file mode 100644 index 0000000..0affa60 --- /dev/null +++ b/scsilib/libscg/scg/aspi-dos.h @@ -0,0 +1,155 @@ +#ifndef __ASPI16_H_ +#define __ASPI16_H_ + +#define PACKED __attribute__((packed)) +#define FAR +typedef unsigned char BYTE; +typedef unsigned short WORD; +typedef unsigned long DWORD; + +//***************************************************************************** +// %%% SCSI MISCELLANEOUS EQUATES %%% +//***************************************************************************** + +#define SENSE_LEN 14 // Default sense buffer length +#define SRB_DIR_SCSI 0x00 // Direction determined by SCSI +#define SRB_POSTING 0x01 // Enable ASPI posting +#define SRB_ENABLE_RESIDUAL_COUNT 0x04 // Enable residual byte count reporting +#define SRB_DIR_IN 0x08 // Transfer from SCSI target to host +#define SRB_DIR_OUT 0x10 // Transfer from host to SCSI target + +//***************************************************************************** +// %%% ASPI Command Definitions %%% +//***************************************************************************** + +#define SC_HA_INQUIRY 0x00 // Host adapter inquiry +#define SC_GET_DEV_TYPE 0x01 // Get device type +#define SC_EXEC_SCSI_CMD 0x02 // Execute SCSI command +#define SC_ABORT_SRB 0x03 // Abort an SRB +#define SC_RESET_DEV 0x04 // SCSI bus device reset +#define SC_SET_HA_PARMS 0x05 // Set HA parameters +#define SC_GET_DISK_INFO 0x06 // Get Disk information + +//***************************************************************************** +// %%% SRB Status %%% +//***************************************************************************** + +#define SS_PENDING 0x00 // SRB being processed +#define SS_COMP 0x01 // SRB completed without error +#define SS_ABORTED 0x02 // SRB aborted +#define SS_ABORT_FAIL 0x03 // Unable to abort SRB +#define SS_ERR 0x04 // SRB completed with error + +#define SS_INVALID_CMD 0x80 // Invalid ASPI command +#define SS_INVALID_HA 0x81 // Invalid host adapter number +#define SS_NO_DEVICE 0x82 // SCSI device not installed + +//***************************************************************************** +// %%% Host Adapter Status %%% +//***************************************************************************** + +#define HASTAT_OK 0x00 // Host adapter did not detect an // error +#define HASTAT_SEL_TO 0x11 // Selection Timeout +#define HASTAT_DO_DU 0x12 // Data overrun data underrun +#define HASTAT_BUS_FREE 0x13 // Unexpected bus free +#define HASTAT_PHASE_ERR 0x14 // Target bus phase sequence // failure +#define HASTAT_TIMEOUT 0x09 // Timed out while SRB was waiting to beprocessed. +#define HASTAT_COMMAND_TIMEOUT 0x0B // Adapter timed out processing SRB. +#define HASTAT_MESSAGE_REJECT 0x0D // While processing SRB, the // adapter received a MESSAGE +#define HASTAT_BUS_RESET 0x0E // A bus reset was detected. +#define HASTAT_PARITY_ERROR 0x0F // A parity error was detected. +#define HASTAT_REQUEST_SENSE_FAILED 0x10 // The adapter failed in issuing + +typedef struct { + + BYTE Cmd; // 00/000 ASPI command code = SC_EXEC_SCSI_CMD + BYTE Status; // 01/001 ASPI command status byte + BYTE HaId; // 02/002 ASPI host adapter number + BYTE Flags; // 03/003 ASPI request flags + DWORD Hdr_Rsvd; // 04/004 Reserved, MUST = 0 + + union { + + struct { + + BYTE Count; // 08/008 Number of host adapters present + BYTE SCSI_ID; // 09/009 SCSI ID of host adapter + BYTE ManagerId[16]; // 0A/010 String describing the manager + BYTE Identifier[16]; // 1A/026 String describing the host adapter + BYTE Unique[16]; // 2A/042 Host Adapter Unique parameters + BYTE ExtBuffer[8]; // 3A/058 Extended inquiry data + + } PACKED HAInquiry; + + struct { + + BYTE Target; // 08/008 Target's SCSI ID + BYTE Lun; // 09/009 Target's LUN number + BYTE DeviceType; // 0A/010 Target's peripheral device type + + } PACKED GetDeviceType; + + struct { + + BYTE Target; // 08/008 Target's SCSI ID + BYTE Lun; // 09/009 Target's LUN number + DWORD BufLen; // 0A/010 Data Allocation Length + BYTE SenseLen; // 0E/014 Sense Allocation Length + BYTE FAR *BufPointer; // 0F/015 Data Buffer Pointer + DWORD Rsvd1; // 13/019 Reserved, MUST = 0 + BYTE CDBLen; // 17/023 CDB Length = 6/10/12 + BYTE HaStat; // 18/024 Host Adapter Status + BYTE TargStat; // 19/025 Target Status + VOID FAR *PostProc; // 1A/026 Post routine + BYTE Rsvd2[34]; // 1E/030 Reserved, MUST = 0 + + union { + + struct { + + BYTE CDBByte[6]; // 40/064 SCSI CDB + BYTE SenseArea[SENSE_LEN+2]; // 46/070 Request Sense buffer + + } PACKED _6; + + struct { + + BYTE CDBByte[10]; // 40/064 SCSI CDB + BYTE SenseArea[SENSE_LEN+2]; // 4A/074 Request Sense buffer + + } PACKED _10; + + struct { + + BYTE CDBByte[12]; // 40/064 SCSI CDB + BYTE SenseArea[SENSE_LEN+2]; // 4C/076 Request Sense buffer + + } PACKED _12; + + } PACKED CmdLen; + + } PACKED ExecSCSICmd; + + struct { + + VOID FAR *SRBToAbort; // 08/008 Pointer to SRB to abort + + } PACKED Abort; + + struct { + + BYTE Target; // 08/008 Target's SCSI ID + BYTE Lun; // 09/009 Target's LUN number + BYTE ResetRsvd1[14]; // 0A/010 Reserved, MUST = 0 + BYTE HaStat; // 18/024 Host Adapter Status + BYTE TargStat; // 19/025 Target Status + VOID FAR *PostProc; // 1A/026 Post routine + BYTE ResetRsvd2[34]; // 1E/030 Reserved, MUST = 0 + + } Reset; + + } PACKED Type; + + } PACKED SRB; + +#endif //__ASPI16_H_ diff --git a/scsilib/libscg/scg/aspi-win32.h b/scsilib/libscg/scg/aspi-win32.h new file mode 100644 index 0000000..02fb5ef --- /dev/null +++ b/scsilib/libscg/scg/aspi-win32.h @@ -0,0 +1,196 @@ +#ifndef __ASPI_WIN32_H_ +#define __ASPI_WIN32_H_ + +#include <Windows.h> + +/*************************************************************************** + ** SCSI MISCELLANEOUS EQUATES + ***************************************************************************/ +#define SENSE_LEN 14 /* Default sense buffer length */ +#define SRB_DIR_SCSI 0x00 /* Direction determined by SCSI */ +#define SRB_POSTING 0x01 /* Enable ASPI posting */ +#define SRB_ENABLE_RESIDUAL_COUNT 0x04 /* Enable residual byte count */ + /* reporting */ +#define SRB_DIR_IN 0x08 /* Transfer from SCSI target to */ + /* host */ +#define SRB_DIR_OUT 0x10 /* Transfer from host to SCSI */ + /* target */ +#define SRB_EVENT_NOTIFY 0x40 /* Enable ASPI event notification */ +#define RESIDUAL_COUNT_SUPPORTED 0x02 /* Extended buffer flag */ +#define MAX_SRB_TIMEOUT 1080001u /* 30 hour maximum timeout in sec */ +#define DEFAULT_SRB_TIMEOUT 1080001u /* use max.timeout by default */ + +/*************************************************************************** + ** ASPI command definitions + ***************************************************************************/ +#define SC_HA_INQUIRY 0x00 /* Host adapter inquiry */ +#define SC_GET_DEV_TYPE 0x01 /* Get device type */ +#define SC_EXEC_SCSI_CMD 0x02 /* Execute SCSI command */ +#define SC_ABORT_SRB 0x03 /* Abort an SRB */ +#define SC_RESET_DEV 0x04 /* SCSI bus device reset */ +#define SC_SET_HA_PARMS 0x05 /* Set HA parameters */ +#define SC_GET_DISK_INFO 0x06 /* Get Disk */ +#define SC_RESCAN_SCSI_BUS 0x07 /* Rebuild SCSI device map */ +#define SC_GETSET_TIMEOUTS 0x08 /* Get/Set target timeouts */ + + +/*************************************************************************** + ** SRB Status + ***************************************************************************/ +#define SS_PENDING 0x00 /* SRB being processed */ +#define SS_COMP 0x01 /* SRB completed without error */ +#define SS_ABORTED 0x02 /* SRB aborted */ +#define SS_ABORT_FAIL 0x03 /* Unable to abort SRB */ +#define SS_ERR 0x04 /* SRB completed with error */ +#define SS_INVALID_CMD 0x80 /* Invalid ASPI command */ +#define SS_INVALID_HA 0x81 /* Invalid host adapter number */ +#define SS_NO_DEVICE 0x82 /* SCSI device not installed */ +#define SS_INVALID_SRB 0xE0 /* Invalid parameter set in SRB */ +#define SS_OLD_MANAGER 0xE1 /* ASPI manager doesn't support */ + /* windows */ +#define SS_BUFFER_ALIGN 0xE1 /* Buffer not aligned (replaces */ + /* SS_OLD_MANAGER in Win32) */ +#define SS_ILLEGAL_MODE 0xE2 /* Unsupported Windows mode */ +#define SS_NO_ASPI 0xE3 /* No ASPI managers */ +#define SS_FAILED_INIT 0xE4 /* ASPI for windows failed init */ +#define SS_ASPI_IS_BUSY 0xE5 /* No resources available to */ + /* execute command */ +#define SS_BUFFER_TO_BIG 0xE6 /* Buffer size too big to handle */ +#define SS_BUFFER_TOO_BIG 0xE6 /* Correct spelling of 'too' */ +#define SS_MISMATCHED_COMPONENTS 0xE7 /* The DLLs/EXEs of ASPI don't */ + /* version check */ +#define SS_NO_ADAPTERS 0xE8 /* No host adapters to manager */ +#define SS_INSUFFICIENT_RESOURCES 0xE9 /* Couldn't allocate resources */ + /* needed to init */ +#define SS_ASPI_IS_SHUTDOWN 0xEA /* Call came to ASPI after */ + /* PROCESS_DETACH */ +#define SS_BAD_INSTALL 0xEB /* The DLL or other components */ + /* are installed wrong */ + +/*************************************************************************** + ** Host Adapter Status + ***************************************************************************/ +#define HASTAT_OK 0x00 /* No error detected by HA */ +#define HASTAT_SEL_TO 0x11 /* Selection Timeout */ +#define HASTAT_DO_DU 0x12 /* Data overrun/data underrun */ +#define HASTAT_BUS_FREE 0x13 /* Unexpected bus free */ +#define HASTAT_PHASE_ERR 0x14 /* Target bus phase sequence */ +#define HASTAT_TIMEOUT 0x09 /* Timed out while SRB was */ + /* waiting to be processed */ +#define HASTAT_COMMAND_TIMEOUT 0x0B /* Adapter timed out while */ + /* processing SRB */ +#define HASTAT_MESSAGE_REJECT 0x0D /* While processing the SRB, the */ + /* adapter received a MESSAGE */ +#define HASTAT_BUS_RESET 0x0E /* A bus reset was detected */ +#define HASTAT_PARITY_ERROR 0x0F /* A parity error was detected */ +#define HASTAT_REQUEST_SENSE_FAILED 0x10 /* The adapter failed in issuing */ + + +/*************************************************************************** + ** SRB - HOST ADAPTER INQUIRIY - SC_HA_INQUIRY (0) + ***************************************************************************/ +typedef struct { + BYTE SRB_Cmd; /* 00/000 ASPI command code == SC_HA_INQUIRY */ + BYTE SRB_Status; /* 01/001 ASPI command status byte */ + BYTE SRB_HaId; /* 02/002 ASPI host adapter number */ + BYTE SRB_Flags; /* 03/003 ASPI request flags */ + DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */ + BYTE HA_Count; /* 08/008 Number of host adapters present */ + BYTE HA_SCSI_ID; /* 09/009 SCSI ID of host adapter */ + BYTE HA_ManagerId[16]; /* 0a/010 String describing the manager */ + BYTE HA_Identifier[16]; /* 1a/026 String describing the host adapter */ + BYTE HA_Unique[16]; /* 2a/042 Host Adapter Unique parameters */ + WORD HA_Rsvd1; /* 3a/058 Reserved, must = 0 */ +} PACKED SRB_HAInquiry, *PSRB_HAInquiry, FAR *LPSRB_HAInquiry; + + +/*************************************************************************** + ** SRB - GET DEVICE TYPE - SC_GET_DEV_TYPE (1) + ***************************************************************************/ +typedef struct +{ + BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_GET_DEV_TYPE */ + BYTE SRB_Status; /* 01/001 ASPI command status byte */ + BYTE SRB_HaId; /* 02/002 ASPI host adapter number */ + BYTE SRB_Flags; /* 03/003 Reserved, must = 0 */ + DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */ + BYTE SRB_Target; /* 08/008 Target's SCSI ID */ + BYTE SRB_Lun; /* 09/009 Target's LUN number */ + BYTE SRB_DeviceType; /* 0a/010 Target's peripheral device type */ + BYTE SRB_Rsvd1; /* 0b/011 Reserved, must = 0 */ +} PACKED SRB_GDEVBlock, *PSRB_GDEVBlock, FAR *LPSRB_GDEVBlock; + + +/*************************************************************************** + ** SRB - EXECUTE SCSI COMMAND - SC_EXEC_SCSI_CMD (2) + ***************************************************************************/ +typedef struct +{ + BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_EXEC_SCSI_CMD */ + BYTE SRB_Status; /* 01/001 ASPI command status byte */ + BYTE SRB_HaId; /* 02/002 ASPI host adapter number */ + BYTE SRB_Flags; /* 03/003 Reserved, must = 0 */ + DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */ + BYTE SRB_Target; /* 08/008 Target's SCSI ID */ + BYTE SRB_Lun; /* 09/009 Target's LUN */ + WORD SRB_Rsvd1; /* 0a/010 Reserved for alignment */ + DWORD SRB_BufLen; /* 0c/012 Data Allocation Length */ + BYTE FAR *SRB_BufPointer; /* 10/016 Data Buffer Pointer */ + BYTE SRB_SenseLen; /* 14/020 Sense Allocation Length */ + BYTE SRB_CDBLen; /* 15/021 CDB Length */ + BYTE SRB_HaStat; /* 16/022 Host Adapter Status */ + BYTE SRB_TargStat; /* 17/023 Target Status */ + VOID FAR *SRB_PostProc; /* 18/024 Post routine */ + BYTE SRB_Rsvd2[20]; /* 1c/028 Reserved, must = 0 */ + BYTE CDBByte[16]; /* 30/048 SCSI CDB */ + BYTE SenseArea[SENSE_LEN+2]; /* 40/064 Request Sense buffer */ +} PACKED SRB_ExecSCSICmd, *PSRB_ExecSCSICmd, FAR *LPSRB_ExecSCSICmd; + + +typedef struct +{ + BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_ABORT_SRB */ + BYTE SRB_Status; /* 01/001 ASPI command status byte */ + BYTE SRB_HaId; /* 02/002 ASPI host adapter number */ + BYTE SRB_Flags; /* 03/003 Reserved, must = 0 */ + DWORD SRB_Hdr_Rsvd; /* 04/004 Reserved, must = 0 */ + void *SRB_ToAbort; /* 08/008 Pointer to SRB to abort */ +} PACKED SRB_Abort, *PSRB_Abort, FAR *LPSRB_Abort; + + +/*************************************************************************** + ** SRB - BUS DEVICE RESET - SC_RESET_DEV (4) + ***************************************************************************/ +typedef struct +{ + BYTE SRB_Cmd; /* 00/000 ASPI cmd code == SC_RESET_DEV */ + BYTE SRB_Status; /* 01/001 ASPI command status byte */ + BYTE SRB_HaId; /* 02/002 ASPI host adapter number */ + DWORD SRB_Flags; /* 04/004 Reserved */ + BYTE SRB_Target; /* 08/008 Target's SCSI ID */ + BYTE SRB_Lun; /* 09/009 Target's LUN number */ + BYTE SRB_Rsvd1[12]; /* 0A/010 Reserved for alignment */ + BYTE SRB_HaStat; /* 16/022 Host Adapter Status */ + BYTE SRB_TargStat; /* 17/023 Target Status */ + VOID FAR *SRB_PostProc; /* 18/024 Post routine */ + BYTE SRB_Rsvd2[36]; /* 1C/028 Reserved, must = 0 */ +} SRB_BusDeviceReset, *PSRB_BusDeviceReset, FAR *LPSRB_BusDeviceReset; + +typedef struct tag_ASPI32BUFF +{ + PBYTE AB_BufPointer; + DWORD AB_BufLen; + DWORD AB_ZeroFill; + DWORD AB_Reserved; +} PACKED ASPI32BUFF, *PASPI32BUFF, FAR *LPASPI32BUFF; + +typedef struct +{ + BYTE SRB_Cmd; + BYTE SRB_Status; + BYTE SRB_HaId; + BYTE SRB_Flags; + DWORD SRB_Hdr_Rsvd; +} SRB, *PSRB, FAR *LPSRB; + +#endif diff --git a/scsilib/libscg/scg/scgcmd.h b/scsilib/libscg/scg/scgcmd.h new file mode 100644 index 0000000..4ce801b --- /dev/null +++ b/scsilib/libscg/scg/scgcmd.h @@ -0,0 +1,200 @@ +/* @(#)scgcmd.h 2.22 04/09/04 Copyright 1986 J. Schilling */ +/* + * Definitions for the SCSI 'scg_cmd' structure that has been created + * for the SCSI general driver 'scg' for SunOS and Solaris but + * now is used for wrapping general libscg SCSI transport requests. + * + * Copyright (c) 1986 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _SCG_SCGCMD_H +#define _SCG_SCGCMD_H + +#include <utypes.h> +#include <btorder.h> + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ +#else +# if defined(_BIT_FIELDS_HTOL) /* Motorola byteorder */ +# else +/* + * #error will not work for all compilers (e.g. sunos4) + * The following line will abort compilation on all compilers + * if none of the above is defines. And that's what we want. + */ +error One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined +# endif +#endif + +#include <scg/scsisense.h> +#include <scg/scsicdb.h> +#include <intcvt.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Leave these definitions here if possible to avoid the need to + * include scsireg.h which makes problems on some OS because these + * OS define the same types as in scsireg.h + */ + +/* + * SCSI status bits. + */ +#define ST_VU_00 0x01 /* Vendor unique */ +#define ST_CHK_COND 0x02 /* Check condition */ +#define ST_COND_MET 0x04 /* Condition met */ +#define ST_BUSY 0x08 /* Busy */ +#define ST_IS_SEND 0x10 /* Intermediate status send */ +#define ST_VU_05 0x20 /* Vendor unique */ +#define ST_VU_06 0x40 /* Vendor unique */ +#define ST_RSVD_07 0x80 /* Reserved */ + +/* + * Sense key values for extended sense. + */ +#define SC_NO_SENSE 0x00 +#define SC_RECOVERABLE_ERROR 0x01 +#define SC_NOT_READY 0x02 +#define SC_MEDIUM_ERROR 0x03 +#define SC_HARDWARE_ERROR 0x04 +#define SC_ILLEGAL_REQUEST 0x05 +#define SC_UNIT_ATTENTION 0x06 +#define SC_WRITE_PROTECT 0x07 +#define SC_BLANK_CHECK 0x08 +#define SC_VENDOR_UNIQUE 0x09 +#define SC_COPY_ABORTED 0x0A +#define SC_ABORTED_COMMAND 0x0B +#define SC_EQUAL 0x0C +#define SC_VOLUME_OVERFLOW 0x0D +#define SC_MISCOMPARE 0x0E +#define SC_RESERVED 0x0F + +/* + * Messages that SCSI can send. + */ +#define SC_COMMAND_COMPLETE 0x00 +#define SC_SYNCHRONOUS 0x01 +#define SC_SAVE_DATA_PTR 0x02 +#define SC_RESTORE_PTRS 0x03 +#define SC_DISCONNECT 0x04 +#define SC_ABORT 0x06 +#define SC_MSG_REJECT 0x07 +#define SC_NO_OP 0x08 +#define SC_PARITY 0x09 +#define SC_IDENTIFY 0x80 +#define SC_DR_IDENTIFY 0xc0 +#define SC_DEVICE_RESET 0x0c + +#define SC_G0_CDBLEN 6 /* Len of Group 0 commands */ +#define SC_G1_CDBLEN 10 /* Len of Group 1 commands */ +#define SC_G5_CDBLEN 12 /* Len of Group 5 commands */ + +#define SCG_MAX_CMD 24 /* 24 bytes max. size is supported */ +#define SCG_MAX_STATUS 3 /* XXX (sollte 4 allign.) Mamimum Status Len */ +#define SCG_MAX_SENSE 32 /* Mamimum Sense Len for auto Req. Sense */ + +#define DEF_SENSE_LEN 16 /* Default Sense Len */ +#define CCS_SENSE_LEN 18 /* Sense Len for CCS compatible devices */ + +struct scg_cmd { + caddr_t addr; /* Address of data in user space */ + int size; /* DMA count for data transfer */ + int flags; /* see below for definition */ + int cdb_len; /* Size of SCSI command in bytes */ + /* NOTE: rel 4 uses this field only */ + /* with commands not in group 1 or 2*/ + int sense_len; /* for intr() if -1 don't get sense */ + int timeout; /* timeout in seconds */ + /* NOTE: actual resolution depends */ + /* on driver implementation */ + int kdebug; /* driver kernel debug level */ + int resid; /* Bytes not transfered */ + int error; /* Error code from scgintr() */ + int ux_errno; /* UNIX error code */ +#ifdef comment +XXX struct scsi_status scb; ??? /* Status returnd by command */ +#endif + union { + struct scsi_status Scb; /* Status returnd by command */ + Uchar cmd_scb[SCG_MAX_STATUS]; + } u_scb; +#define scb u_scb.Scb +#ifdef comment +XXX struct scsi_sense sense; ??? /* Sense bytes from command */ +#endif + union { + struct scsi_sense Sense; /* Sense bytes from command */ + Uchar cmd_sense[SCG_MAX_SENSE]; + } u_sense; +#define sense u_sense.Sense + int sense_count; /* Number of bytes valid in sense */ + int target; /* SCSI target id */ + /* NOTE: The SCSI target id field */ + /* does not need to be filled unless */ + /* the low level transport is a real */ + /* scg driver. In this case the low */ + /* level transport routine of libscg */ + /* will fill in the needed value */ + union { /* SCSI command descriptor block */ + struct scsi_g0cdb g0_cdb; + struct scsi_g1cdb g1_cdb; + struct scsi_g5cdb g5_cdb; + Uchar cmd_cdb[SCG_MAX_CMD]; + } cdb; /* 24 bytes max. size is supported */ +}; + +#define dma_read flags /* 1 if DMA to Sun, 0 otherwise */ + +/* + * definition for flags field in scg_cmd struct + */ +#define SCG_RECV_DATA 0x0001 /* DMA direction to Sun */ +#define SCG_DISRE_ENA 0x0002 /* enable disconnect/reconnect */ +#define SCG_SILENT 0x0004 /* be silent on errors */ +#define SCG_CMD_RETRY 0x0008 /* enable retries */ +#define SCG_NOPARITY 0x0010 /* disable parity for this command */ + +/* + * definition for error field in scg_cmd struct + * + * The codes refer to SCSI general errors, not to device + * specific errors. Device specific errors are discovered + * by checking the sense data. + * The distinction between retryable and fatal is somewhat ad hoc. + */ +#define SCG_NO_ERROR 0 /* cdb transported without error */ + /* SCG_NO_ERROR incudes all commands */ + /* where the SCSI status is valid */ + +#define SCG_RETRYABLE 1 /* any other case e.g. SCSI bus busy */ + /* SCSI cdb could not be send, */ + /* includes DMA errors other than */ + /* DMA underrun */ + +#define SCG_FATAL 2 /* could not select target */ +#define SCG_TIMEOUT 3 /* driver timed out */ + + +#ifdef __cplusplus +} +#endif + +#endif /* _SCG_SCGCMD_H */ diff --git a/scsilib/libscg/scg/scgio.h b/scsilib/libscg/scg/scgio.h new file mode 100644 index 0000000..0080656 --- /dev/null +++ b/scsilib/libscg/scg/scgio.h @@ -0,0 +1,68 @@ +/* @(#)scgio.h 2.16 00/11/07 Copyright 1986 J. Schilling */ +/* + * Definitions for the SCSI general driver 'scg' + * + * Copyright (c) 1986 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _SCG_SCGIO_H +#define _SCG_SCGIO_H + +#ifndef _SCG_SCGCMD_H +#include <scg/scgcmd.h> +#endif + +#if defined(SVR4) +#include <sys/ioccom.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__STDC__) || defined(SVR4) +#define SCGIOCMD _IOWR('G', 1, struct scg_cmd) /* do a SCSI cmd */ +#define SCGIORESET _IO('G', 2) /* reset SCSI bus */ +#define SCGIOGDISRE _IOR('G', 4, int) /* get sc disre Val*/ +#define SCGIOSDISRE _IOW('G', 5, int) /* set sc disre Val*/ +#define SCGIOIDBG _IO('G', 100) /* Inc Debug Val */ +#define SCGIODDBG _IO('G', 101) /* Dec Debug Val */ +#define SCGIOGDBG _IOR('G', 102, int) /* get Debug Val */ +#define SCGIOSDBG _IOW('G', 103, int) /* set Debug Val */ +#define SCIOGDBG _IOR('G', 104, int) /* get sc Debug Val*/ +#define SCIOSDBG _IOW('G', 105, int) /* set sc Debug Val*/ +#else +#define SCGIOCMD _IOWR(G, 1, struct scg_cmd) /* do a SCSI cmd */ +#define SCGIORESET _IO(G, 2) /* reset SCSI bus */ +#define SCGIOGDISRE _IOR(G, 4, int) /* get sc disre Val*/ +#define SCGIOSDISRE _IOW(G, 5, int) /* set sc disre Val*/ +#define SCGIOIDBG _IO(G, 100) /* Inc Debug Val */ +#define SCGIODDBG _IO(G, 101) /* Dec Debug Val */ +#define SCGIOGDBG _IOR(G, 102, int) /* get Debug Val */ +#define SCGIOSDBG _IOW(G, 103, int) /* set Debug Val */ +#define SCIOGDBG _IOR(G, 104, int) /* get sc Debug Val*/ +#define SCIOSDBG _IOW(G, 105, int) /* set sc Debug Val*/ +#endif + +#define SCGIO_CMD SCGIOCMD /* backward ccompatibility */ + +#ifdef __cplusplus +} +#endif + +#endif /* _SCG_SCGIO_H */ diff --git a/scsilib/libscg/scg/scgops.h b/scsilib/libscg/scg/scgops.h new file mode 100644 index 0000000..7df3897 --- /dev/null +++ b/scsilib/libscg/scg/scgops.h @@ -0,0 +1,69 @@ +/* @(#)scgops.h 1.5 02/10/19 Copyright 2000 J. Schilling */ +/* + * Copyright (c) 2000 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef _SCG_SCGOPS_H +#define _SCG_SCGOPS_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct scg_ops { + int (*scgo_send) __PR((SCSI *scgp)); + + char * (*scgo_version) __PR((SCSI *scgp, int what)); +#ifdef EOF /* stdio.h has been included */ + int (*scgo_help) __PR((SCSI *scgp, FILE *f)); +#else + int (*scgo_help) __PR((SCSI *scgp, void *f)); +#endif + int (*scgo_open) __PR((SCSI *scgp, char *device)); + int (*scgo_close) __PR((SCSI *scgp)); + long (*scgo_maxdma) __PR((SCSI *scgp, long amt)); + void * (*scgo_getbuf) __PR((SCSI *scgp, long amt)); + void (*scgo_freebuf) __PR((SCSI *scgp)); + + + BOOL (*scgo_havebus) __PR((SCSI *scgp, int busno)); + int (*scgo_fileno) __PR((SCSI *scgp, int busno, int tgt, int tlun)); + int (*scgo_initiator_id) __PR((SCSI *scgp)); + int (*scgo_isatapi) __PR((SCSI *scgp)); + int (*scgo_reset) __PR((SCSI *scgp, int what)); +} scg_ops_t; + +#define SCGO_SEND(scgp) (*(scgp)->ops->scgo_send)(scgp) +#define SCGO_VERSION(scgp, what) (*(scgp)->ops->scgo_version)(scgp, what) +#define SCGO_HELP(scgp, f) (*(scgp)->ops->scgo_help)(scgp, f) +#define SCGO_OPEN(scgp, device) (*(scgp)->ops->scgo_open)(scgp, device) +#define SCGO_CLOSE(scgp) (*(scgp)->ops->scgo_close)(scgp) +#define SCGO_MAXDMA(scgp, amt) (*(scgp)->ops->scgo_maxdma)(scgp, amt) +#define SCGO_GETBUF(scgp, amt) (*(scgp)->ops->scgo_getbuf)(scgp, amt) +#define SCGO_FREEBUF(scgp) (*(scgp)->ops->scgo_freebuf)(scgp) +#define SCGO_HAVEBUS(scgp, busno) (*(scgp)->ops->scgo_havebus)(scgp, busno) +#define SCGO_FILENO(scgp, busno, tgt, tlun) (*(scgp)->ops->scgo_fileno)(scgp, busno, tgt, tlun) +#define SCGO_INITIATOR_ID(scgp) (*(scgp)->ops->scgo_initiator_id)(scgp) +#define SCGO_ISATAPI(scgp) (*(scgp)->ops->scgo_isatapi)(scgp) +#define SCGO_RESET(scgp, what) (*(scgp)->ops->scgo_reset)(scgp, what) + +#ifdef __cplusplus +} +#endif + +#endif /* _SCG_SCGOPS_H */ diff --git a/scsilib/libscg/scg/scsicdb.h b/scsilib/libscg/scg/scsicdb.h new file mode 100644 index 0000000..55e8188 --- /dev/null +++ b/scsilib/libscg/scg/scsicdb.h @@ -0,0 +1,249 @@ +/* @(#)scsicdb.h 2.19 04/09/04 Copyright 1986 J. Schilling */ +/* + * Definitions for the SCSI Command Descriptor Block + * + * Copyright (c) 1986 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _SCG_SCSICDB_H +#define _SCG_SCSICDB_H + +#ifndef _UTYPES_H +#include <utypes.h> +#endif + +#ifdef __cplusplus +extern "C" { +#endif +/* + * SCSI Operation codes. + */ +#define SC_TEST_UNIT_READY 0x00 +#define SC_REZERO_UNIT 0x01 +#define SC_REQUEST_SENSE 0x03 +#define SC_FORMAT 0x04 +#define SC_FORMAT_TRACK 0x06 +#define SC_REASSIGN_BLOCK 0x07 /* CCS only */ +#define SC_SEEK 0x0b +#define SC_TRANSLATE 0x0f /* ACB4000 only */ +#define SC_INQUIRY 0x12 /* CCS only */ +#define SC_MODE_SELECT 0x15 +#define SC_RESERVE 0x16 +#define SC_RELEASE 0x17 +#define SC_MODE_SENSE 0x1a +#define SC_START 0x1b +#define SC_READ_DEFECT_LIST 0x37 /* CCS only, group 1 */ +#define SC_READ_BUFFER 0x3c /* CCS only, group 1 */ + /* + * Note, these two commands use identical command blocks for all + * controllers except the Adaptec ACB 4000 which sets bit 1 of byte 1. + */ +#define SC_READ 0x08 +#define SC_WRITE 0x0a +#define SC_EREAD 0x28 /* 10 byte read */ +#define SC_EWRITE 0x2a /* 10 byte write */ +#define SC_WRITE_VERIFY 0x2e /* 10 byte write+verify */ +#define SC_WRITE_FILE_MARK 0x10 +#define SC_UNKNOWN 0xff /* cmd list terminator */ + + +/* + * Standard SCSI control blocks. + * These go in or out over the SCSI bus. + */ + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_g0cdb { /* scsi group 0 command description block */ + Uchar cmd; /* command code */ + Ucbit high_addr : 5; /* high part of block address */ + Ucbit lun : 3; /* logical unit number */ + Uchar mid_addr; /* middle part of block address */ + Uchar low_addr; /* low part of block address */ + Uchar count; /* transfer length */ + Ucbit link : 1; /* link (another command follows) */ + Ucbit fr : 1; /* flag request (interrupt at completion) */ + Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */ + Ucbit rsvd : 3; /* reserved */ + Ucbit vu_56 : 1; /* vendor unique (byte 5 bit 6) */ + Ucbit vu_57 : 1; /* vendor unique (byte 5 bit 7) */ +}; + +#else /* Motorola byteorder */ + +struct scsi_g0cdb { /* scsi group 0 command description block */ + Uchar cmd; /* command code */ + Ucbit lun : 3; /* logical unit number */ + Ucbit high_addr : 5; /* high part of block address */ + Uchar mid_addr; /* middle part of block address */ + Uchar low_addr; /* low part of block address */ + Uchar count; /* transfer length */ + Ucbit vu_57 : 1; /* vendor unique (byte 5 bit 7) */ + Ucbit vu_56 : 1; /* vendor unique (byte 5 bit 6) */ + Ucbit rsvd : 3; /* reserved */ + Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */ + Ucbit fr : 1; /* flag request (interrupt at completion) */ + Ucbit link : 1; /* link (another command follows) */ +}; +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_g1cdb { /* scsi group 1 command description block */ + Uchar cmd; /* command code */ + Ucbit reladr : 1; /* address is relative */ + Ucbit res : 4; /* reserved bits 1-4 of byte 1 */ + Ucbit lun : 3; /* logical unit number */ + Uchar addr[4]; /* logical block address */ + Uchar res6; /* reserved byte 6 */ + Uchar count[2]; /* transfer length */ + Ucbit link : 1; /* link (another command follows) */ + Ucbit fr : 1; /* flag request (interrupt at completion) */ + Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */ + Ucbit rsvd : 3; /* reserved */ + Ucbit vu_96 : 1; /* vendor unique (byte 5 bit 6) */ + Ucbit vu_97 : 1; /* vendor unique (byte 5 bit 7) */ +}; + +#else /* Motorola byteorder */ + +struct scsi_g1cdb { /* scsi group 1 command description block */ + Uchar cmd; /* command code */ + Ucbit lun : 3; /* logical unit number */ + Ucbit res : 4; /* reserved bits 1-4 of byte 1 */ + Ucbit reladr : 1; /* address is relative */ + Uchar addr[4]; /* logical block address */ + Uchar res6; /* reserved byte 6 */ + Uchar count[2]; /* transfer length */ + Ucbit vu_97 : 1; /* vendor unique (byte 5 bit 7) */ + Ucbit vu_96 : 1; /* vendor unique (byte 5 bit 6) */ + Ucbit rsvd : 3; /* reserved */ + Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */ + Ucbit fr : 1; /* flag request (interrupt at completion) */ + Ucbit link : 1; /* link (another command follows) */ +}; +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_g5cdb { /* scsi group 5 command description block */ + Uchar cmd; /* command code */ + Ucbit reladr : 1; /* address is relative */ + Ucbit res : 4; /* reserved bits 1-4 of byte 1 */ + Ucbit lun : 3; /* logical unit number */ + Uchar addr[4]; /* logical block address */ + Uchar count[4]; /* transfer length */ + Uchar res10; /* reserved byte 10 */ + Ucbit link : 1; /* link (another command follows) */ + Ucbit fr : 1; /* flag request (interrupt at completion) */ + Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */ + Ucbit rsvd : 3; /* reserved */ + Ucbit vu_B6 : 1; /* vendor unique (byte B bit 6) */ + Ucbit vu_B7 : 1; /* vendor unique (byte B bit 7) */ +}; + +#else /* Motorola byteorder */ + +struct scsi_g5cdb { /* scsi group 5 command description block */ + Uchar cmd; /* command code */ + Ucbit lun : 3; /* logical unit number */ + Ucbit res : 4; /* reserved bits 1-4 of byte 1 */ + Ucbit reladr : 1; /* address is relative */ + Uchar addr[4]; /* logical block address */ + Uchar count[4]; /* transfer length */ + Uchar res10; /* reserved byte 10 */ + Ucbit vu_B7 : 1; /* vendor unique (byte B bit 7) */ + Ucbit vu_B6 : 1; /* vendor unique (byte B bit 6) */ + Ucbit rsvd : 3; /* reserved */ + Ucbit naca : 1; /* Normal ACA (Auto Contingent Allegiance) */ + Ucbit fr : 1; /* flag request (interrupt at completion) */ + Ucbit link : 1; /* link (another command follows) */ +}; +#endif + +#define g0_cdbaddr(cdb, a) ((cdb)->high_addr = (a) >> 16,\ + (cdb)->mid_addr = ((a) >> 8) & 0xFF,\ + (cdb)->low_addr = (a) & 0xFF) + +#define g1_cdbaddr(cdb, a) ((cdb)->addr[0] = (a) >> 24,\ + (cdb)->addr[1] = ((a) >> 16)& 0xFF,\ + (cdb)->addr[2] = ((a) >> 8) & 0xFF,\ + (cdb)->addr[3] = (a) & 0xFF) + +#define g5_cdbaddr(cdb, a) g1_cdbaddr(cdb, a) + + +#define g0_cdblen(cdb, len) ((cdb)->count = (len)) + +#define g1_cdblen(cdb, len) ((cdb)->count[0] = ((len) >> 8) & 0xFF,\ + (cdb)->count[1] = (len) & 0xFF) + +#define g5_cdblen(cdb, len) ((cdb)->count[0] = (len) >> 24L,\ + (cdb)->count[1] = ((len) >> 16L)& 0xFF,\ + (cdb)->count[2] = ((len) >> 8L) & 0xFF,\ + (cdb)->count[3] = (len) & 0xFF) + +/*#define XXXXX*/ +#ifdef XXXXX +#define i_to_long(a, i) (((Uchar *)(a))[0] = ((i) >> 24)& 0xFF,\ + ((Uchar *)(a))[1] = ((i) >> 16)& 0xFF,\ + ((Uchar *)(a))[2] = ((i) >> 8) & 0xFF,\ + ((Uchar *)(a))[3] = (i) & 0xFF) + +#define i_to_3_byte(a, i) (((Uchar *)(a))[0] = ((i) >> 16)& 0xFF,\ + ((Uchar *)(a))[1] = ((i) >> 8) & 0xFF,\ + ((Uchar *)(a))[2] = (i) & 0xFF) + +#define i_to_4_byte(a, i) (((Uchar *)(a))[0] = ((i) >> 24)& 0xFF,\ + ((Uchar *)(a))[1] = ((i) >> 16)& 0xFF,\ + ((Uchar *)(a))[2] = ((i) >> 8) & 0xFF,\ + ((Uchar *)(a))[3] = (i) & 0xFF) + +#define i_to_short(a, i) (((Uchar *)(a))[0] = ((i) >> 8) & 0xFF,\ + ((Uchar *)(a))[1] = (i) & 0xFF) + +#define a_to_u_short(a) ((unsigned short) \ + ((((Uchar*) a)[1] & 0xFF) | \ + (((Uchar*) a)[0] << 8 & 0xFF00))) + +#define a_to_3_byte(a) ((Ulong) \ + ((((Uchar*) a)[2] & 0xFF) | \ + (((Uchar*) a)[1] << 8 & 0xFF00) | \ + (((Uchar*) a)[0] << 16 & 0xFF0000))) + +#ifdef __STDC__ +#define a_to_u_long(a) ((Ulong) \ + ((((Uchar*) a)[3] & 0xFF) | \ + (((Uchar*) a)[2] << 8 & 0xFF00) | \ + (((Uchar*) a)[1] << 16 & 0xFF0000) | \ + (((Uchar*) a)[0] << 24 & 0xFF000000UL))) +#else +#define a_to_u_long(a) ((Ulong) \ + ((((Uchar*) a)[3] & 0xFF) | \ + (((Uchar*) a)[2] << 8 & 0xFF00) | \ + (((Uchar*) a)[1] << 16 & 0xFF0000) | \ + (((Uchar*) a)[0] << 24 & 0xFF000000))) +#endif +#endif /* XXXX */ + + +#ifdef __cplusplus +} +#endif + +#endif /* _SCG_SCSICDB_H */ diff --git a/scsilib/libscg/scg/scsidefs.h b/scsilib/libscg/scg/scsidefs.h new file mode 100644 index 0000000..b01c9bc --- /dev/null +++ b/scsilib/libscg/scg/scsidefs.h @@ -0,0 +1,111 @@ +/* @(#)scsidefs.h 1.28 04/09/04 Copyright 1988 J. Schilling */ +/* + * Definitions for SCSI devices i.e. for error strings in scsierrs.c + * + * Copyright (c) 1988 J. Schilling + */ +/*@@C@@*/ + +#ifndef _SCG_SCSIDEFS_H +#define _SCG_SCSIDEFS_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Disks + */ +#ifdef DEV_UNKNOWN +/* + * True64 defines DEV_UNKNOWN in /usr/include/sys/devio.h as "UNKNOWN" + */ +#undef DEV_UNKNOWN +#endif +#define DEV_UNKNOWN 0 +#define DEV_ACB40X0 1 +#define DEV_ACB4000 2 +#define DEV_ACB4010 3 +#define DEV_ACB4070 4 +#define DEV_ACB5500 5 +#define DEV_ACB4520A 6 +#define DEV_ACB4525 7 +#define DEV_MD21 8 +#define DEV_MD23 9 +#define DEV_NON_CCS_DSK 10 +#define DEV_CCS_GENDISK 11 + +/* + * Tapes + */ +#define DEV_MT02 100 +#define DEV_SC4000 101 + +/* + * Printer + */ +#define DEV_PRT 200 + +/* + * Processors + */ +#define DEV_PROC 300 + +/* + * Worm + */ +#define DEV_WORM 400 +#define DEV_RXT800S 401 + +/* + * CD-ROM + */ +#define DEV_CDROM 500 +#define DEV_MMC_CDROM 501 +#define DEV_MMC_CDR 502 +#define DEV_MMC_CDRW 503 +#define DEV_MMC_DVD 504 +#define DEV_MMC_DVD_WR 505 + +#define DEV_CDD_521_OLD 510 +#define DEV_CDD_521 511 +#define DEV_CDD_522 512 +#define DEV_PCD_600 513 +#define DEV_CDD_2000 514 +#define DEV_CDD_2600 515 +#define DEV_TYUDEN_EW50 516 +#define DEV_YAMAHA_CDR_100 520 +#define DEV_YAMAHA_CDR_400 521 +#define DEV_PLASMON_RF_4100 530 +#define DEV_SONY_CDU_924 540 +#define DEV_RICOH_RO_1420C 550 +#define DEV_RICOH_RO_1060C 551 +#define DEV_TEAC_CD_R50S 560 +#define DEV_MATSUSHITA_7501 570 +#define DEV_MATSUSHITA_7502 571 +#define DEV_PIONEER_DW_S114X 580 +#define DEV_PIONEER_DVDR_S101 581 + +/* + * Scanners + */ +#define DEV_HRSCAN 600 +#define DEV_MS300A 601 + +/* + * Optical memory + */ +#define DEV_SONY_SMO 700 + + +#define old_acb(d) (((d) == DEV_ACB40X0) || \ + ((d) == DEV_ACB4000) || ((d) == DEV_ACB4010) || \ + ((d) == DEV_ACB4070) || ((d) == DEV_ACB5500)) + +#define is_ccs(d) (!old_acb(d)) + +#ifdef __cplusplus +} +#endif + +#endif /* _SCG_SCSIDEFS_H */ diff --git a/scsilib/libscg/scg/scsireg.h b/scsilib/libscg/scg/scsireg.h new file mode 100644 index 0000000..f835fb6 --- /dev/null +++ b/scsilib/libscg/scg/scsireg.h @@ -0,0 +1,1229 @@ +/* @(#)scsireg.h 1.31 04/09/04 Copyright 1987 J. Schilling */ +/* + * usefull definitions for dealing with CCS SCSI - devices + * + * Copyright (c) 1987 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _SCG_SCSIREG_H +#define _SCG_SCSIREG_H + +#include <utypes.h> +#include <btorder.h> + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_inquiry { + Ucbit type : 5; /* 0 */ + Ucbit qualifier : 3; /* 0 */ + + Ucbit type_modifier : 7; /* 1 */ + Ucbit removable : 1; /* 1 */ + + Ucbit ansi_version : 3; /* 2 */ + Ucbit ecma_version : 3; /* 2 */ + Ucbit iso_version : 2; /* 2 */ + + Ucbit data_format : 4; /* 3 */ + Ucbit res3_54 : 2; /* 3 */ + Ucbit termiop : 1; /* 3 */ + Ucbit aenc : 1; /* 3 */ + + Ucbit add_len : 8; /* 4 */ + Ucbit sense_len : 8; /* 5 */ /* only Emulex ??? */ + Ucbit res2 : 8; /* 6 */ + + Ucbit softreset : 1; /* 7 */ + Ucbit cmdque : 1; + Ucbit res7_2 : 1; + Ucbit linked : 1; + Ucbit sync : 1; + Ucbit wbus16 : 1; + Ucbit wbus32 : 1; + Ucbit reladr : 1; /* 7 */ + + char vendor_info[8]; /* 8 */ + char prod_ident[16]; /* 16 */ + char prod_revision[4]; /* 32 */ +#ifdef comment + char vendor_uniq[20]; /* 36 */ + char reserved[40]; /* 56 */ +#endif +}; /* 96 */ + +#else /* Motorola byteorder */ + +struct scsi_inquiry { + Ucbit qualifier : 3; /* 0 */ + Ucbit type : 5; /* 0 */ + + Ucbit removable : 1; /* 1 */ + Ucbit type_modifier : 7; /* 1 */ + + Ucbit iso_version : 2; /* 2 */ + Ucbit ecma_version : 3; + Ucbit ansi_version : 3; /* 2 */ + + Ucbit aenc : 1; /* 3 */ + Ucbit termiop : 1; + Ucbit res3_54 : 2; + Ucbit data_format : 4; /* 3 */ + + Ucbit add_len : 8; /* 4 */ + Ucbit sense_len : 8; /* 5 */ /* only Emulex ??? */ + Ucbit res2 : 8; /* 6 */ + Ucbit reladr : 1; /* 7 */ + Ucbit wbus32 : 1; + Ucbit wbus16 : 1; + Ucbit sync : 1; + Ucbit linked : 1; + Ucbit res7_2 : 1; + Ucbit cmdque : 1; + Ucbit softreset : 1; + char vendor_info[8]; /* 8 */ + char prod_ident[16]; /* 16 */ + char prod_revision[4]; /* 32 */ +#ifdef comment + char vendor_uniq[20]; /* 36 */ + char reserved[40]; /* 56 */ +#endif +}; /* 96 */ +#endif + +#ifdef __SCG_COMPAT__ +#define info vendor_info +#define ident prod_ident +#define revision prod_revision +#endif + +/* Peripheral Device Qualifier */ + +#define INQ_DEV_PRESENT 0x00 /* Physical device present */ +#define INQ_DEV_NOTPR 0x01 /* Physical device not present */ +#define INQ_DEV_RES 0x02 /* Reserved */ +#define INQ_DEV_NOTSUP 0x03 /* Logical unit not supported */ + +/* Peripheral Device Type */ + +#define INQ_DASD 0x00 /* Direct-access device (disk) */ +#define INQ_SEQD 0x01 /* Sequential-access device (tape) */ +#define INQ_PRTD 0x02 /* Printer device */ +#define INQ_PROCD 0x03 /* Processor device */ +#define INQ_OPTD 0x04 /* Write once device (optical disk) */ +#define INQ_WORM 0x04 /* Write once device (optical disk) */ +#define INQ_ROMD 0x05 /* CD-ROM device */ +#define INQ_SCAN 0x06 /* Scanner device */ +#define INQ_OMEM 0x07 /* Optical Memory device */ +#define INQ_JUKE 0x08 /* Medium Changer device (jukebox) */ +#define INQ_COMM 0x09 /* Communications device */ +#define INQ_IT8_1 0x0A /* IT8 */ +#define INQ_IT8_2 0x0B /* IT8 */ +#define INQ_STARR 0x0C /* Storage array device */ +#define INQ_ENCL 0x0D /* Enclosure services device */ +#define INQ_SDAD 0x0E /* Simplyfied direct-access device */ +#define INQ_OCRW 0x0F /* Optical card reader/writer device */ +#define INQ_BRIDGE 0x10 /* Bridging expander device */ +#define INQ_OSD 0x11 /* Object based storage device */ +#define INQ_ADC 0x12 /* Automation/Drive interface */ +#define INQ_WELLKNOWN 0x1E /* Well known logical unit */ +#define INQ_NODEV 0x1F /* Unknown or no device */ +#define INQ_NOTPR 0x1F /* Logical unit not present (SCSI-1) */ + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_header { + Ucbit sense_data_len : 8; + Uchar medium_type; + Ucbit res2 : 4; + Ucbit cache : 1; + Ucbit res : 2; + Ucbit write_prot : 1; + Uchar blockdesc_len; +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_header { + Ucbit sense_data_len : 8; + Uchar medium_type; + Ucbit write_prot : 1; + Ucbit res : 2; + Ucbit cache : 1; + Ucbit res2 : 4; + Uchar blockdesc_len; +}; +#endif + +struct scsi_modesel_header { + Ucbit sense_data_len : 8; + Uchar medium_type; + Ucbit res2 : 8; + Uchar blockdesc_len; +}; + +struct scsi_mode_blockdesc { + Uchar density; + Uchar nlblock[3]; + Ucbit res : 8; + Uchar lblen[3]; +}; + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct acb_mode_data { + Uchar listformat; + Uchar ncyl[2]; + Uchar nhead; + Uchar start_red_wcurrent[2]; + Uchar start_precomp[2]; + Uchar landing_zone; + Uchar step_rate; + Ucbit : 2; + Ucbit hard_sec : 1; + Ucbit fixed_media : 1; + Ucbit : 4; + Uchar sect_per_trk; +}; + +#else /* Motorola byteorder */ + +struct acb_mode_data { + Uchar listformat; + Uchar ncyl[2]; + Uchar nhead; + Uchar start_red_wcurrent[2]; + Uchar start_precomp[2]; + Uchar landing_zone; + Uchar step_rate; + Ucbit : 4; + Ucbit fixed_media : 1; + Ucbit hard_sec : 1; + Ucbit : 2; + Uchar sect_per_trk; +}; +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_header { + Ucbit p_code : 6; + Ucbit res : 1; + Ucbit parsave : 1; + Uchar p_len; +}; + +/* + * This is a hack that allows mode pages without + * any further bitfileds to be defined bitorder independent. + */ +#define MP_P_CODE \ + Ucbit p_code : 6; \ + Ucbit p_res : 1; \ + Ucbit parsave : 1 + +#else /* Motorola byteorder */ + +struct scsi_mode_page_header { + Ucbit parsave : 1; + Ucbit res : 1; + Ucbit p_code : 6; + Uchar p_len; +}; + +/* + * This is a hack that allows mode pages without + * any further bitfileds to be defined bitorder independent. + */ +#define MP_P_CODE \ + Ucbit parsave : 1; \ + Ucbit p_res : 1; \ + Ucbit p_code : 6 + +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_01 { /* Error recovery Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0A = 12 Bytes */ + Ucbit disa_correction : 1; /* Byte 2 */ + Ucbit term_on_rec_err : 1; + Ucbit report_rec_err : 1; + Ucbit en_early_corr : 1; + Ucbit read_continuous : 1; + Ucbit tranfer_block : 1; + Ucbit en_auto_reall_r : 1; + Ucbit en_auto_reall_w : 1; /* Byte 2 */ + Uchar rd_retry_count; /* Byte 3 */ + Uchar correction_span; + char head_offset_count; + char data_strobe_offset; + Uchar res; + Uchar wr_retry_count; + Uchar res_tape[2]; + Uchar recov_timelim[2]; +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_page_01 { /* Error recovery Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0A = 12 Bytes */ + Ucbit en_auto_reall_w : 1; /* Byte 2 */ + Ucbit en_auto_reall_r : 1; + Ucbit tranfer_block : 1; + Ucbit read_continuous : 1; + Ucbit en_early_corr : 1; + Ucbit report_rec_err : 1; + Ucbit term_on_rec_err : 1; + Ucbit disa_correction : 1; /* Byte 2 */ + Uchar rd_retry_count; /* Byte 3 */ + Uchar correction_span; + char head_offset_count; + char data_strobe_offset; + Uchar res; + Uchar wr_retry_count; + Uchar res_tape[2]; + Uchar recov_timelim[2]; +}; +#endif + + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_02 { /* Device dis/re connect Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0E = 16 Bytes */ + Uchar buf_full_ratio; + Uchar buf_empt_ratio; + Uchar bus_inact_limit[2]; + Uchar disc_time_limit[2]; + Uchar conn_time_limit[2]; + Uchar max_burst_size[2]; /* Start SCSI-2 */ + Ucbit data_tr_dis_ctl : 2; + Ucbit : 6; + Uchar res[3]; +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_page_02 { /* Device dis/re connect Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0E = 16 Bytes */ + Uchar buf_full_ratio; + Uchar buf_empt_ratio; + Uchar bus_inact_limit[2]; + Uchar disc_time_limit[2]; + Uchar conn_time_limit[2]; + Uchar max_burst_size[2]; /* Start SCSI-2 */ + Ucbit : 6; + Ucbit data_tr_dis_ctl : 2; + Uchar res[3]; +}; +#endif + +#define DTDC_DATADONE 0x01 /* + * Target may not disconnect once + * data transfer is started until + * all data successfully transferred. + */ + +#define DTDC_CMDDONE 0x03 /* + * Target may not disconnect once + * data transfer is started until + * command completed. + */ + + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_03 { /* Direct access format Paramters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x16 = 24 Bytes */ + Uchar trk_per_zone[2]; + Uchar alt_sec_per_zone[2]; + Uchar alt_trk_per_zone[2]; + Uchar alt_trk_per_vol[2]; + Uchar sect_per_trk[2]; + Uchar bytes_per_phys_sect[2]; + Uchar interleave[2]; + Uchar trk_skew[2]; + Uchar cyl_skew[2]; + Ucbit : 3; + Ucbit inhibit_save : 1; + Ucbit fmt_by_surface : 1; + Ucbit removable : 1; + Ucbit hard_sec : 1; + Ucbit soft_sec : 1; + Uchar res[3]; +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_page_03 { /* Direct access format Paramters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x16 = 24 Bytes */ + Uchar trk_per_zone[2]; + Uchar alt_sec_per_zone[2]; + Uchar alt_trk_per_zone[2]; + Uchar alt_trk_per_vol[2]; + Uchar sect_per_trk[2]; + Uchar bytes_per_phys_sect[2]; + Uchar interleave[2]; + Uchar trk_skew[2]; + Uchar cyl_skew[2]; + Ucbit soft_sec : 1; + Ucbit hard_sec : 1; + Ucbit removable : 1; + Ucbit fmt_by_surface : 1; + Ucbit inhibit_save : 1; + Ucbit : 3; + Uchar res[3]; +}; +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_04 { /* Rigid disk Geometry Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x16 = 24 Bytes */ + Uchar ncyl[3]; + Uchar nhead; + Uchar start_precomp[3]; + Uchar start_red_wcurrent[3]; + Uchar step_rate[2]; + Uchar landing_zone[3]; + Ucbit rot_pos_locking : 2; /* Start SCSI-2 */ + Ucbit : 6; /* Start SCSI-2 */ + Uchar rotational_off; + Uchar res1; + Uchar rotation_rate[2]; + Uchar res2[2]; +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_page_04 { /* Rigid disk Geometry Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x16 = 24 Bytes */ + Uchar ncyl[3]; + Uchar nhead; + Uchar start_precomp[3]; + Uchar start_red_wcurrent[3]; + Uchar step_rate[2]; + Uchar landing_zone[3]; + Ucbit : 6; /* Start SCSI-2 */ + Ucbit rot_pos_locking : 2; /* Start SCSI-2 */ + Uchar rotational_off; + Uchar res1; + Uchar rotation_rate[2]; + Uchar res2[2]; +}; +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_05 { /* Flexible disk Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x1E = 32 Bytes */ + Uchar transfer_rate[2]; + Uchar nhead; + Uchar sect_per_trk; + Uchar bytes_per_phys_sect[2]; + Uchar ncyl[2]; + Uchar start_precomp[2]; + Uchar start_red_wcurrent[2]; + Uchar step_rate[2]; + Uchar step_pulse_width; + Uchar head_settle_delay[2]; + Uchar motor_on_delay; + Uchar motor_off_delay; + Ucbit spc : 4; + Ucbit : 4; + Ucbit : 5; + Ucbit mo : 1; + Ucbit ssn : 1; + Ucbit trdy : 1; + Uchar write_compensation; + Uchar head_load_delay; + Uchar head_unload_delay; + Ucbit pin_2_use : 4; + Ucbit pin_34_use : 4; + Ucbit pin_1_use : 4; + Ucbit pin_4_use : 4; + Uchar rotation_rate[2]; + Uchar res[2]; +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_page_05 { /* Flexible disk Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x1E = 32 Bytes */ + Uchar transfer_rate[2]; + Uchar nhead; + Uchar sect_per_trk; + Uchar bytes_per_phys_sect[2]; + Uchar ncyl[2]; + Uchar start_precomp[2]; + Uchar start_red_wcurrent[2]; + Uchar step_rate[2]; + Uchar step_pulse_width; + Uchar head_settle_delay[2]; + Uchar motor_on_delay; + Uchar motor_off_delay; + Ucbit trdy : 1; + Ucbit ssn : 1; + Ucbit mo : 1; + Ucbit : 5; + Ucbit : 4; + Ucbit spc : 4; + Uchar write_compensation; + Uchar head_load_delay; + Uchar head_unload_delay; + Ucbit pin_34_use : 4; + Ucbit pin_2_use : 4; + Ucbit pin_4_use : 4; + Ucbit pin_1_use : 4; + Uchar rotation_rate[2]; + Uchar res[2]; +}; +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_07 { /* Verify Error recovery */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0A = 12 Bytes */ + Ucbit disa_correction : 1; /* Byte 2 */ + Ucbit term_on_rec_err : 1; + Ucbit report_rec_err : 1; + Ucbit en_early_corr : 1; + Ucbit res : 4; /* Byte 2 */ + Uchar ve_retry_count; /* Byte 3 */ + Uchar ve_correction_span; + char res2[5]; /* Byte 5 */ + Uchar ve_recov_timelim[2]; /* Byte 10 */ +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_page_07 { /* Verify Error recovery */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0A = 12 Bytes */ + Ucbit res : 4; /* Byte 2 */ + Ucbit en_early_corr : 1; + Ucbit report_rec_err : 1; + Ucbit term_on_rec_err : 1; + Ucbit disa_correction : 1; /* Byte 2 */ + Uchar ve_retry_count; /* Byte 3 */ + Uchar ve_correction_span; + char res2[5]; /* Byte 5 */ + Uchar ve_recov_timelim[2]; /* Byte 10 */ +}; +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_08 { /* Caching Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0A = 12 Bytes */ + Ucbit disa_rd_cache : 1; /* Byte 2 */ + Ucbit muliple_fact : 1; + Ucbit en_wt_cache : 1; + Ucbit res : 5; /* Byte 2 */ + Ucbit wt_ret_pri : 4; /* Byte 3 */ + Ucbit demand_rd_ret_pri: 4; /* Byte 3 */ + Uchar disa_pref_tr_len[2]; /* Byte 4 */ + Uchar min_pref[2]; /* Byte 6 */ + Uchar max_pref[2]; /* Byte 8 */ + Uchar max_pref_ceiling[2]; /* Byte 10 */ +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_page_08 { /* Caching Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0A = 12 Bytes */ + Ucbit res : 5; /* Byte 2 */ + Ucbit en_wt_cache : 1; + Ucbit muliple_fact : 1; + Ucbit disa_rd_cache : 1; /* Byte 2 */ + Ucbit demand_rd_ret_pri: 4; /* Byte 3 */ + Ucbit wt_ret_pri : 4; + Uchar disa_pref_tr_len[2]; /* Byte 4 */ + Uchar min_pref[2]; /* Byte 6 */ + Uchar max_pref[2]; /* Byte 8 */ + Uchar max_pref_ceiling[2]; /* Byte 10 */ +}; +#endif + +struct scsi_mode_page_09 { /* Peripheral device Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* >= 0x06 = 8 Bytes */ + Uchar interface_id[2]; /* Byte 2 */ + Uchar res[4]; /* Byte 4 */ + Uchar vendor_specific[1]; /* Byte 8 */ +}; + +#define PDEV_SCSI 0x0000 /* scsi interface */ +#define PDEV_SMD 0x0001 /* SMD interface */ +#define PDEV_ESDI 0x0002 /* ESDI interface */ +#define PDEV_IPI2 0x0003 /* IPI-2 interface */ +#define PDEV_IPI3 0x0004 /* IPI-3 interface */ + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_0A { /* Common device Control Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x06 = 8 Bytes */ + Ucbit rep_log_exeption: 1; /* Byte 2 */ + Ucbit res : 7; /* Byte 2 */ + Ucbit dis_queuing : 1; /* Byte 3 */ + Ucbit queuing_err_man : 1; + Ucbit res2 : 2; + Ucbit queue_alg_mod : 4; /* Byte 3 */ + Ucbit EAENP : 1; /* Byte 4 */ + Ucbit UAENP : 1; + Ucbit RAENP : 1; + Ucbit res3 : 4; + Ucbit en_ext_cont_all : 1; /* Byte 4 */ + Ucbit res4 : 8; + Uchar ready_aen_hold_per[2]; /* Byte 6 */ +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_page_0A { /* Common device Control Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x06 = 8 Bytes */ + Ucbit res : 7; /* Byte 2 */ + Ucbit rep_log_exeption: 1; /* Byte 2 */ + Ucbit queue_alg_mod : 4; /* Byte 3 */ + Ucbit res2 : 2; + Ucbit queuing_err_man : 1; + Ucbit dis_queuing : 1; /* Byte 3 */ + Ucbit en_ext_cont_all : 1; /* Byte 4 */ + Ucbit res3 : 4; + Ucbit RAENP : 1; + Ucbit UAENP : 1; + Ucbit EAENP : 1; /* Byte 4 */ + Ucbit res4 : 8; + Uchar ready_aen_hold_per[2]; /* Byte 6 */ +}; +#endif + +#define CTRL_QMOD_RESTRICT 0x0 +#define CTRL_QMOD_UNRESTRICT 0x1 + + +struct scsi_mode_page_0B { /* Medium Types Supported Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x06 = 8 Bytes */ + Uchar res[2]; /* Byte 2 */ + Uchar medium_one_supp; /* Byte 4 */ + Uchar medium_two_supp; /* Byte 5 */ + Uchar medium_three_supp; /* Byte 6 */ + Uchar medium_four_supp; /* Byte 7 */ +}; + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_0C { /* Notch & Partition Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x16 = 24 Bytes */ + Ucbit res : 6; /* Byte 2 */ + Ucbit logical_notch : 1; + Ucbit notched_drive : 1; /* Byte 2 */ + Uchar res2; /* Byte 3 */ + Uchar max_notches[2]; /* Byte 4 */ + Uchar active_notch[2]; /* Byte 6 */ + Uchar starting_boundary[4]; /* Byte 8 */ + Uchar ending_boundary[4]; /* Byte 12 */ + Uchar pages_notched[8]; /* Byte 16 */ +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_page_0C { /* Notch & Partition Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x16 = 24 Bytes */ + Ucbit notched_drive : 1; /* Byte 2 */ + Ucbit logical_notch : 1; + Ucbit res : 6; /* Byte 2 */ + Uchar res2; /* Byte 3 */ + Uchar max_notches[2]; /* Byte 4 */ + Uchar active_notch[2]; /* Byte 6 */ + Uchar starting_boundary[4]; /* Byte 8 */ + Uchar ending_boundary[4]; /* Byte 12 */ + Uchar pages_notched[8]; /* Byte 16 */ +}; +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_mode_page_0D { /* CD-ROM Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x06 = 8 Bytes */ + Uchar res; /* Byte 2 */ + Ucbit inact_timer_mult: 4; /* Byte 3 */ + Ucbit res2 : 4; /* Byte 3 */ + Uchar s_un_per_m_un[2]; /* Byte 4 */ + Uchar f_un_per_s_un[2]; /* Byte 6 */ +}; + +#else /* Motorola byteorder */ + +struct scsi_mode_page_0D { /* CD-ROM Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x06 = 8 Bytes */ + Uchar res; /* Byte 2 */ + Ucbit res2 : 4; /* Byte 3 */ + Ucbit inact_timer_mult: 4; /* Byte 3 */ + Uchar s_un_per_m_un[2]; /* Byte 4 */ + Uchar f_un_per_s_un[2]; /* Byte 6 */ +}; +#endif + +struct sony_mode_page_20 { /* Sony Format Mode Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0A = 12 Bytes */ + Uchar format_mode; + Uchar format_type; +#define num_bands user_band_size /* Gilt bei Type 1 */ + Uchar user_band_size[4]; /* Gilt bei Type 0 */ + Uchar spare_band_size[2]; + Uchar res[2]; +}; + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct toshiba_mode_page_20 { /* Toshiba Speed Control Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x01 = 3 Bytes */ + Ucbit speed : 1; + Ucbit res : 7; +}; + +#else /* Motorola byteorder */ + +struct toshiba_mode_page_20 { /* Toshiba Speed Control Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x01 = 3 Bytes */ + Ucbit res : 7; + Ucbit speed : 1; +}; +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct ccs_mode_page_38 { /* CCS Caching Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0E = 14 Bytes */ + + Ucbit cache_table_size: 4; /* Byte 3 */ + Ucbit cache_en : 1; + Ucbit res2 : 1; + Ucbit wr_index_en : 1; + Ucbit res : 1; /* Byte 3 */ + Uchar threshold; /* Byte 4 Prefetch threshold */ + Uchar max_prefetch; /* Byte 5 Max. prefetch */ + Uchar max_multiplier; /* Byte 6 Max. prefetch multiplier */ + Uchar min_prefetch; /* Byte 7 Min. prefetch */ + Uchar min_multiplier; /* Byte 8 Min. prefetch multiplier */ + Uchar res3[8]; /* Byte 9 */ +}; + +#else /* Motorola byteorder */ + +struct ccs_mode_page_38 { /* CCS Caching Parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x0E = 14 Bytes */ + + Ucbit res : 1; /* Byte 3 */ + Ucbit wr_index_en : 1; + Ucbit res2 : 1; + Ucbit cache_en : 1; + Ucbit cache_table_size: 4; /* Byte 3 */ + Uchar threshold; /* Byte 4 Prefetch threshold */ + Uchar max_prefetch; /* Byte 5 Max. prefetch */ + Uchar max_multiplier; /* Byte 6 Max. prefetch multiplier */ + Uchar min_prefetch; /* Byte 7 Min. prefetch */ + Uchar min_multiplier; /* Byte 8 Min. prefetch multiplier */ + Uchar res3[8]; /* Byte 9 */ +}; +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct cd_mode_page_05 { /* write parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x32 = 50 Bytes */ + Ucbit write_type : 4; /* Session write type (PACKET/TAO...)*/ + Ucbit test_write : 1; /* Do not actually write data */ + Ucbit LS_V : 1; /* Link size valid */ + Ucbit BUFE : 1; /* Enable Bufunderrun free rec. */ + Ucbit res_2_7 : 1; + Ucbit track_mode : 4; /* Track mode (Q-sub control nibble) */ + Ucbit copy : 1; /* 1st higher gen of copy prot track ~*/ + Ucbit fp : 1; /* Fixed packed (if in packet mode) */ + Ucbit multi_session : 2; /* Multi session write type */ + Ucbit dbtype : 4; /* Data block type */ + Ucbit res_4 : 4; /* Reserved */ + Uchar link_size; /* Link Size (default is 7) */ + Uchar res_6; /* Reserved */ + Ucbit host_appl_code : 6; /* Host application code of disk */ + Ucbit res_7 : 2; /* Reserved */ + Uchar session_format; /* Session format (DA/CDI/XA) */ + Uchar res_9; /* Reserved */ + Uchar packet_size[4]; /* # of user datablocks/fixed packet */ + Uchar audio_pause_len[2]; /* # of blocks where index is zero */ + Uchar media_cat_number[16]; /* Media catalog Number (MCN) */ + Uchar ISRC[14]; /* ISRC for this track */ + Uchar sub_header[4]; + Uchar vendor_uniq[4]; +}; + +#else /* Motorola byteorder */ + +struct cd_mode_page_05 { /* write parameters */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x32 = 50 Bytes */ + Ucbit res_2_7 : 1; + Ucbit BUFE : 1; /* Enable Bufunderrun free rec. */ + Ucbit LS_V : 1; /* Link size valid */ + Ucbit test_write : 1; /* Do not actually write data */ + Ucbit write_type : 4; /* Session write type (PACKET/TAO...)*/ + Ucbit multi_session : 2; /* Multi session write type */ + Ucbit fp : 1; /* Fixed packed (if in packet mode) */ + Ucbit copy : 1; /* 1st higher gen of copy prot track */ + Ucbit track_mode : 4; /* Track mode (Q-sub control nibble) */ + Ucbit res_4 : 4; /* Reserved */ + Ucbit dbtype : 4; /* Data block type */ + Uchar link_size; /* Link Size (default is 7) */ + Uchar res_6; /* Reserved */ + Ucbit res_7 : 2; /* Reserved */ + Ucbit host_appl_code : 6; /* Host application code of disk */ + Uchar session_format; /* Session format (DA/CDI/XA) */ + Uchar res_9; /* Reserved */ + Uchar packet_size[4]; /* # of user datablocks/fixed packet */ + Uchar audio_pause_len[2]; /* # of blocks where index is zero */ + Uchar media_cat_number[16]; /* Media catalog Number (MCN) */ + Uchar ISRC[14]; /* ISRC for this track */ + Uchar sub_header[4]; + Uchar vendor_uniq[4]; +}; + +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct cd_wr_speed_performance { + Uchar res0; /* Reserved */ + Ucbit rot_ctl_sel : 2; /* Rotational control selected */ + Ucbit res_1_27 : 6; /* Reserved */ + Uchar wr_speed_supp[2]; /* Supported write speed */ +}; + +struct cd_mode_page_2A { /* CD Cap / mech status */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x14 = 20 Bytes (MMC) */ + /* 0x18 = 24 Bytes (MMC-2) */ + /* 0x1C >= 28 Bytes (MMC-3) */ + Ucbit cd_r_read : 1; /* Reads CD-R media */ + Ucbit cd_rw_read : 1; /* Reads CD-RW media */ + Ucbit method2 : 1; /* Reads fixed packet method2 media */ + Ucbit dvd_rom_read : 1; /* Reads DVD ROM media */ + Ucbit dvd_r_read : 1; /* Reads DVD-R media */ + Ucbit dvd_ram_read : 1; /* Reads DVD-RAM media */ + Ucbit res_2_67 : 2; /* Reserved */ + Ucbit cd_r_write : 1; /* Supports writing CD-R media */ + Ucbit cd_rw_write : 1; /* Supports writing CD-RW media */ + Ucbit test_write : 1; /* Supports emulation write */ + Ucbit res_3_3 : 1; /* Reserved */ + Ucbit dvd_r_write : 1; /* Supports writing DVD-R media */ + Ucbit dvd_ram_write : 1; /* Supports writing DVD-RAM media */ + Ucbit res_3_67 : 2; /* Reserved */ + Ucbit audio_play : 1; /* Supports Audio play operation */ + Ucbit composite : 1; /* Deliveres composite A/V stream */ + Ucbit digital_port_2 : 1; /* Supports digital output on port 2 */ + Ucbit digital_port_1 : 1; /* Supports digital output on port 1 */ + Ucbit mode_2_form_1 : 1; /* Reads Mode-2 form 1 media (XA) */ + Ucbit mode_2_form_2 : 1; /* Reads Mode-2 form 2 media */ + Ucbit multi_session : 1; /* Reads multi-session media */ + Ucbit BUF : 1; /* Supports Buffer under. free rec. */ + Ucbit cd_da_supported : 1; /* Reads audio data with READ CD cmd */ + Ucbit cd_da_accurate : 1; /* READ CD data stream is accurate */ + Ucbit rw_supported : 1; /* Reads R-W sub channel information */ + Ucbit rw_deint_corr : 1; /* Reads de-interleved R-W sub chan */ + Ucbit c2_pointers : 1; /* Supports C2 error pointers */ + Ucbit ISRC : 1; /* Reads ISRC information */ + Ucbit UPC : 1; /* Reads media catalog number (UPC) */ + Ucbit read_bar_code : 1; /* Supports reading bar codes */ + Ucbit lock : 1; /* PREVENT/ALLOW may lock media */ + Ucbit lock_state : 1; /* Lock state 0=unlocked 1=locked */ + Ucbit prevent_jumper : 1; /* State of prev/allow jumper 0=pres */ + Ucbit eject : 1; /* Ejects disc/cartr with STOP LoEj */ + Ucbit res_6_4 : 1; /* Reserved */ + Ucbit loading_type : 3; /* Loading mechanism type */ + Ucbit sep_chan_vol : 1; /* Vol controls each channel separat */ + Ucbit sep_chan_mute : 1; /* Mute controls each channel separat*/ + Ucbit disk_present_rep: 1; /* Changer supports disk present rep */ + Ucbit sw_slot_sel : 1; /* Load empty slot in changer */ + Ucbit side_change : 1; /* Side change capable */ + Ucbit pw_in_lead_in : 1; /* Reads raw P-W sucode from lead in */ + Ucbit res_7 : 2; /* Reserved */ + Uchar max_read_speed[2]; /* Max. read speed in KB/s */ + Uchar num_vol_levels[2]; /* # of supported volume levels */ + Uchar buffer_size[2]; /* Buffer size for the data in KB */ + Uchar cur_read_speed[2]; /* Current read speed in KB/s */ + Uchar res_16; /* Reserved */ + Ucbit res_17_0 : 1; /* Reserved */ + Ucbit BCK : 1; /* Data valid on falling edge of BCK */ + Ucbit RCK : 1; /* Set: HIGH high LRCK=left channel */ + Ucbit LSBF : 1; /* Set: LSB first Clear: MSB first */ + Ucbit length : 2; /* 0=32BCKs 1=16BCKs 2=24BCKs 3=24I2c*/ + Ucbit res_17 : 2; /* Reserved */ + Uchar max_write_speed[2]; /* Max. write speed supported in KB/s*/ + Uchar cur_write_speed[2]; /* Current write speed in KB/s */ + + /* Byte 22 ... Only in MMC-2 */ + Uchar copy_man_rev[2]; /* Copy management revision supported*/ + Uchar res_24; /* Reserved */ + Uchar res_25; /* Reserved */ + + /* Byte 26 ... Only in MMC-3 */ + Uchar res_26; /* Reserved */ + Ucbit res_27_27 : 6; /* Reserved */ + Ucbit rot_ctl_sel : 2; /* Rotational control selected */ + Uchar v3_cur_write_speed[2]; /* Current write speed in KB/s */ + Uchar num_wr_speed_des[2]; /* # of wr speed perf descr. tables */ + struct cd_wr_speed_performance + wr_speed_des[1]; /* wr speed performance descriptor */ + /* Actually more (num_wr_speed_des) */ +}; + +#else /* Motorola byteorder */ + +struct cd_wr_speed_performance { + Uchar res0; /* Reserved */ + Ucbit res_1_27 : 6; /* Reserved */ + Ucbit rot_ctl_sel : 2; /* Rotational control selected */ + Uchar wr_speed_supp[2]; /* Supported write speed */ +}; + +struct cd_mode_page_2A { /* CD Cap / mech status */ + MP_P_CODE; /* parsave & pagecode */ + Uchar p_len; /* 0x14 = 20 Bytes (MMC) */ + /* 0x18 = 24 Bytes (MMC-2) */ + /* 0x1C >= 28 Bytes (MMC-3) */ + Ucbit res_2_67 : 2; /* Reserved */ + Ucbit dvd_ram_read : 1; /* Reads DVD-RAM media */ + Ucbit dvd_r_read : 1; /* Reads DVD-R media */ + Ucbit dvd_rom_read : 1; /* Reads DVD ROM media */ + Ucbit method2 : 1; /* Reads fixed packet method2 media */ + Ucbit cd_rw_read : 1; /* Reads CD-RW media */ + Ucbit cd_r_read : 1; /* Reads CD-R media */ + Ucbit res_3_67 : 2; /* Reserved */ + Ucbit dvd_ram_write : 1; /* Supports writing DVD-RAM media */ + Ucbit dvd_r_write : 1; /* Supports writing DVD-R media */ + Ucbit res_3_3 : 1; /* Reserved */ + Ucbit test_write : 1; /* Supports emulation write */ + Ucbit cd_rw_write : 1; /* Supports writing CD-RW media */ + Ucbit cd_r_write : 1; /* Supports writing CD-R media */ + Ucbit BUF : 1; /* Supports Buffer under. free rec. */ + Ucbit multi_session : 1; /* Reads multi-session media */ + Ucbit mode_2_form_2 : 1; /* Reads Mode-2 form 2 media */ + Ucbit mode_2_form_1 : 1; /* Reads Mode-2 form 1 media (XA) */ + Ucbit digital_port_1 : 1; /* Supports digital output on port 1 */ + Ucbit digital_port_2 : 1; /* Supports digital output on port 2 */ + Ucbit composite : 1; /* Deliveres composite A/V stream */ + Ucbit audio_play : 1; /* Supports Audio play operation */ + Ucbit read_bar_code : 1; /* Supports reading bar codes */ + Ucbit UPC : 1; /* Reads media catalog number (UPC) */ + Ucbit ISRC : 1; /* Reads ISRC information */ + Ucbit c2_pointers : 1; /* Supports C2 error pointers */ + Ucbit rw_deint_corr : 1; /* Reads de-interleved R-W sub chan */ + Ucbit rw_supported : 1; /* Reads R-W sub channel information */ + Ucbit cd_da_accurate : 1; /* READ CD data stream is accurate */ + Ucbit cd_da_supported : 1; /* Reads audio data with READ CD cmd */ + Ucbit loading_type : 3; /* Loading mechanism type */ + Ucbit res_6_4 : 1; /* Reserved */ + Ucbit eject : 1; /* Ejects disc/cartr with STOP LoEj */ + Ucbit prevent_jumper : 1; /* State of prev/allow jumper 0=pres */ + Ucbit lock_state : 1; /* Lock state 0=unlocked 1=locked */ + Ucbit lock : 1; /* PREVENT/ALLOW may lock media */ + Ucbit res_7 : 2; /* Reserved */ + Ucbit pw_in_lead_in : 1; /* Reads raw P-W sucode from lead in */ + Ucbit side_change : 1; /* Side change capable */ + Ucbit sw_slot_sel : 1; /* Load empty slot in changer */ + Ucbit disk_present_rep: 1; /* Changer supports disk present rep */ + Ucbit sep_chan_mute : 1; /* Mute controls each channel separat*/ + Ucbit sep_chan_vol : 1; /* Vol controls each channel separat */ + Uchar max_read_speed[2]; /* Max. read speed in KB/s */ + Uchar num_vol_levels[2]; /* # of supported volume levels */ + Uchar buffer_size[2]; /* Buffer size for the data in KB */ + Uchar cur_read_speed[2]; /* Current read speed in KB/s */ + Uchar res_16; /* Reserved */ + Ucbit res_17 : 2; /* Reserved */ + Ucbit length : 2; /* 0=32BCKs 1=16BCKs 2=24BCKs 3=24I2c*/ + Ucbit LSBF : 1; /* Set: LSB first Clear: MSB first */ + Ucbit RCK : 1; /* Set: HIGH high LRCK=left channel */ + Ucbit BCK : 1; /* Data valid on falling edge of BCK */ + Ucbit res_17_0 : 1; /* Reserved */ + Uchar max_write_speed[2]; /* Max. write speed supported in KB/s*/ + Uchar cur_write_speed[2]; /* Current write speed in KB/s */ + + /* Byte 22 ... Only in MMC-2 */ + Uchar copy_man_rev[2]; /* Copy management revision supported*/ + Uchar res_24; /* Reserved */ + Uchar res_25; /* Reserved */ + + /* Byte 26 ... Only in MMC-3 */ + Uchar res_26; /* Reserved */ + Ucbit res_27_27 : 6; /* Reserved */ + Ucbit rot_ctl_sel : 2; /* Rotational control selected */ + Uchar v3_cur_write_speed[2]; /* Current write speed in KB/s */ + Uchar num_wr_speed_des[2]; /* # of wr speed perf descr. tables */ + struct cd_wr_speed_performance + wr_speed_des[1]; /* wr speed performance descriptor */ + /* Actually more (num_wr_speed_des) */ +}; + +#endif + +#define LT_CADDY 0 +#define LT_TRAY 1 +#define LT_POP_UP 2 +#define LT_RES3 3 +#define LT_CHANGER_IND 4 +#define LT_CHANGER_CART 5 +#define LT_RES6 6 +#define LT_RES7 7 + + +struct scsi_mode_data { + struct scsi_mode_header header; + struct scsi_mode_blockdesc blockdesc; + union pagex { + struct acb_mode_data acb; + struct scsi_mode_page_01 page1; + struct scsi_mode_page_02 page2; + struct scsi_mode_page_03 page3; + struct scsi_mode_page_04 page4; + struct scsi_mode_page_05 page5; + struct scsi_mode_page_07 page7; + struct scsi_mode_page_08 page8; + struct scsi_mode_page_09 page9; + struct scsi_mode_page_0A pageA; + struct scsi_mode_page_0B pageB; + struct scsi_mode_page_0C pageC; + struct scsi_mode_page_0D pageD; + struct sony_mode_page_20 sony20; + struct toshiba_mode_page_20 toshiba20; + struct ccs_mode_page_38 ccs38; + } pagex; +}; + +struct scsi_capacity { + Int32_t c_baddr; /* must convert byteorder!! */ + Int32_t c_bsize; /* must convert byteorder!! */ +}; + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_def_header { + Ucbit : 8; + Ucbit format : 3; + Ucbit gdl : 1; + Ucbit mdl : 1; + Ucbit : 3; + Uchar length[2]; +}; + +#else /* Motorola byteorder */ + +struct scsi_def_header { + Ucbit : 8; + Ucbit : 3; + Ucbit mdl : 1; + Ucbit gdl : 1; + Ucbit format : 3; + Uchar length[2]; +}; +#endif + + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_format_header { + Ucbit res : 8; /* Adaptec 5500: 1 --> format track */ + Ucbit vu : 1; /* Vendor Unique */ + Ucbit immed : 1; /* Return Immediately from Format */ + Ucbit tryout : 1; /* Check if format parameters OK */ + Ucbit ipattern : 1; /* Init patter descriptor present */ + Ucbit serr : 1; /* Stop on error */ + Ucbit dcert : 1; /* Disable certification */ + Ucbit dmdl : 1; /* Disable manufacturer defect list */ + Ucbit enable : 1; /* Enable to use the next 3 bits */ + Uchar length[2]; /* Length of following list in bytes*/ +}; + +#else /* Motorola byteorder */ + +struct scsi_format_header { + Ucbit res : 8; /* Adaptec 5500: 1 --> format track */ + Ucbit enable : 1; /* Enable to use the next 3 bits */ + Ucbit dmdl : 1; /* Disable manufacturer defect list */ + Ucbit dcert : 1; /* Disable certification */ + Ucbit serr : 1; /* Stop on error */ + Ucbit ipattern : 1; /* Init patter descriptor present */ + Ucbit tryout : 1; /* Check if format parameters OK */ + Ucbit immed : 1; /* Return Immediately from Format */ + Ucbit vu : 1; /* Vendor Unique */ + Uchar length[2]; /* Length of following list in bytes*/ +}; +#endif + +struct scsi_def_bfi { + Uchar cyl[3]; + Uchar head; + Uchar bfi[4]; +}; + +struct scsi_def_phys { + Uchar cyl[3]; + Uchar head; + Uchar sec[4]; +}; + +struct scsi_def_list { + struct scsi_def_header hd; + union { + Uchar list_block[1][4]; + struct scsi_def_bfi list_bfi[1]; + struct scsi_def_phys list_phys[1]; + } def_list; +}; + +struct scsi_format_data { + struct scsi_format_header hd; + union { + Uchar list_block[1][4]; + struct scsi_def_bfi list_bfi[1]; + struct scsi_def_phys list_phys[1]; + } def_list; +}; + +#define def_block def_list.list_block +#define def_bfi def_list.list_bfi +#define def_phys def_list.list_phys + +#define SC_DEF_BLOCK 0 +#define SC_DEF_BFI 4 +#define SC_DEF_PHYS 5 +#define SC_DEF_VU 6 +#define SC_DEF_RES 7 + +struct scsi_format_cap_header { + Uchar res[3]; /* Reserved */ + Uchar len; /* Len (a multiple of 8) */ +}; + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_format_cap_desc { + Uchar nblock[4]; /* Number of blocks */ + Ucbit desc_type : 2; /* Descriptor type */ + Ucbit fmt_type : 6; /* Format Taype */ + Uchar blen[3]; /* Logical block length */ +}; + +#else /* Motorola byteorder */ + +struct scsi_format_cap_desc { + Uchar nblock[4]; /* Number of blocks */ + Ucbit fmt_type : 6; /* Format Taype */ + Ucbit desc_type : 2; /* Descriptor type */ + Uchar blen[3]; /* Logical block length */ +}; +#endif + +/* + * Defines for 'fmt_type'. + */ +#define FCAP_TYPE_DVDPLUS_FULL 0x26 /* DVD+RW Full Format */ + +/* + * Defines for 'desc_type'. + * In case of FCAP_DESC_RES, the descriptor is a formatted capacity descriptor + * and the 'blen' field is type dependent. + * For all other cases, this is the Current/Maximum Capacity descriptor and + * the value of 'fmt_type' is reserved and must be zero. + */ +#define FCAP_DESC_RES 0 /* Reserved */ +#define FCAP_DESC_UNFORM 1 /* Unformatted Media */ +#define FCAP_DESC_FORM 2 /* Formatted Media */ +#define FCAP_DESC_NOMEDIA 3 /* No Media */ + +struct scsi_cap_data { + struct scsi_format_cap_header hd; + struct scsi_format_cap_desc list[1]; +}; + + +struct scsi_send_diag_cmd { + Uchar cmd; + Uchar addr[4]; + Ucbit : 8; +}; + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_sector_header { + Uchar cyl[2]; + Uchar head; + Uchar sec; + Ucbit : 5; + Ucbit rp : 1; + Ucbit sp : 1; + Ucbit dt : 1; +}; + +#else /* Motorola byteorder */ + +struct scsi_sector_header { + Uchar cyl[2]; + Uchar head; + Uchar sec; + Ucbit dt : 1; + Ucbit sp : 1; + Ucbit rp : 1; + Ucbit : 5; +}; +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _SCG_SCSIREG_H */ diff --git a/scsilib/libscg/scg/scsisense.h b/scsilib/libscg/scg/scsisense.h new file mode 100644 index 0000000..f0b53e6 --- /dev/null +++ b/scsilib/libscg/scg/scsisense.h @@ -0,0 +1,191 @@ +/* @(#)scsisense.h 2.18 04/09/04 Copyright 1986 J. Schilling */ +/* + * Definitions for the SCSI status code and sense structure + * + * Copyright (c) 1986 J. Schilling + */ +/*@@C@@*/ + +#ifndef _SCG_SCSISENSE_H +#define _SCG_SCSISENSE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * SCSI status completion block. + */ +#define SCSI_EXTENDED_STATUS + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_status { + Ucbit vu_00 : 1; /* vendor unique */ + Ucbit chk : 1; /* check condition: sense data available */ + Ucbit cm : 1; /* condition met */ + Ucbit busy : 1; /* device busy or reserved */ + Ucbit is : 1; /* intermediate status sent */ + Ucbit vu_05 : 1; /* vendor unique */ +#define st_scsi2 vu_05 /* SCSI-2 modifier bit */ + Ucbit vu_06 : 1; /* vendor unique */ + Ucbit st_rsvd : 1; /* reserved */ + +#ifdef SCSI_EXTENDED_STATUS +#define ext_st1 st_rsvd /* extended status (next byte valid) */ + /* byte 1 */ + Ucbit ha_er : 1; /* host adapter detected error */ + Ucbit reserved: 6; /* reserved */ + Ucbit ext_st2 : 1; /* extended status (next byte valid) */ + /* byte 2 */ + Uchar byte2; /* third byte */ +#endif /* SCSI_EXTENDED_STATUS */ +}; + +#else /* Motorola byteorder */ + +struct scsi_status { + Ucbit st_rsvd : 1; /* reserved */ + Ucbit vu_06 : 1; /* vendor unique */ + Ucbit vu_05 : 1; /* vendor unique */ +#define st_scsi2 vu_05 /* SCSI-2 modifier bit */ + Ucbit is : 1; /* intermediate status sent */ + Ucbit busy : 1; /* device busy or reserved */ + Ucbit cm : 1; /* condition met */ + Ucbit chk : 1; /* check condition: sense data available */ + Ucbit vu_00 : 1; /* vendor unique */ +#ifdef SCSI_EXTENDED_STATUS +#define ext_st1 st_rsvd /* extended status (next byte valid) */ + /* byte 1 */ + Ucbit ext_st2 : 1; /* extended status (next byte valid) */ + Ucbit reserved: 6; /* reserved */ + Ucbit ha_er : 1; /* host adapter detected error */ + /* byte 2 */ + Uchar byte2; /* third byte */ +#endif /* SCSI_EXTENDED_STATUS */ +}; +#endif + +/* + * OLD Standard (Non Extended) SCSI Sense. Used mainly by the + * Adaptec ACB 4000 which is the only controller that + * does not support the Extended sense format. + */ +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_sense { /* scsi sense for error classes 0-6 */ + Ucbit code : 7; /* error class/code */ + Ucbit adr_val : 1; /* sense data is valid */ +#ifdef comment + Ucbit high_addr:5; /* high byte of block addr */ + Ucbit rsvd : 3; +#else + Uchar high_addr; /* high byte of block addr */ +#endif + Uchar mid_addr; /* middle byte of block addr */ + Uchar low_addr; /* low byte of block addr */ +}; + +#else /* Motorola byteorder */ + +struct scsi_sense { /* scsi sense for error classes 0-6 */ + Ucbit adr_val : 1; /* sense data is valid */ + Ucbit code : 7; /* error class/code */ +#ifdef comment + Ucbit rsvd : 3; + Ucbit high_addr:5; /* high byte of block addr */ +#else + Uchar high_addr; /* high byte of block addr */ +#endif + Uchar mid_addr; /* middle byte of block addr */ + Uchar low_addr; /* low byte of block addr */ +}; +#endif + +/* + * SCSI extended sense parameter block. + */ +#ifdef comment +#define SC_CLASS_EXTENDED_SENSE 0x7 /* indicates extended sense */ +#endif + +#if defined(_BIT_FIELDS_LTOH) /* Intel byteorder */ + +struct scsi_ext_sense { /* scsi extended sense for error class 7 */ + /* byte 0 */ + Ucbit type : 7; /* fixed at 0x70 */ + Ucbit adr_val : 1; /* sense data is valid */ + /* byte 1 */ + Uchar seg_num; /* segment number, applies to copy cmd only */ + /* byte 2 */ + Ucbit key : 4; /* sense key, see below */ + Ucbit : 1; /* reserved */ + Ucbit ili : 1; /* incorrect length indicator */ + Ucbit eom : 1; /* end of media */ + Ucbit fil_mk : 1; /* file mark on device */ + /* bytes 3 through 7 */ + Uchar info_1; /* information byte 1 */ + Uchar info_2; /* information byte 2 */ + Uchar info_3; /* information byte 3 */ + Uchar info_4; /* information byte 4 */ + Uchar add_len; /* number of additional bytes */ + /* bytes 8 through 13, CCS additions */ + Uchar optional_8; /* CCS search and copy only */ + Uchar optional_9; /* CCS search and copy only */ + Uchar optional_10; /* CCS search and copy only */ + Uchar optional_11; /* CCS search and copy only */ + Uchar sense_code; /* sense code */ + Uchar qual_code; /* sense code qualifier */ + Uchar fru_code; /* Field replacable unit code */ + Ucbit bptr : 3; /* bit pointer for failure (if bpv) */ + Ucbit bpv : 1; /* bit pointer is valid */ + Ucbit : 2; + Ucbit cd : 1; /* pointers refer to command not data */ + Ucbit sksv : 1; /* sense key specific valid */ + Uchar field_ptr[2]; /* field pointer for failure */ + Uchar add_info[2]; /* round up to 20 bytes */ +}; + +#else /* Motorola byteorder */ + +struct scsi_ext_sense { /* scsi extended sense for error class 7 */ + /* byte 0 */ + Ucbit adr_val : 1; /* sense data is valid */ + Ucbit type : 7; /* fixed at 0x70 */ + /* byte 1 */ + Uchar seg_num; /* segment number, applies to copy cmd only */ + /* byte 2 */ + Ucbit fil_mk : 1; /* file mark on device */ + Ucbit eom : 1; /* end of media */ + Ucbit ili : 1; /* incorrect length indicator */ + Ucbit : 1; /* reserved */ + Ucbit key : 4; /* sense key, see below */ + /* bytes 3 through 7 */ + Uchar info_1; /* information byte 1 */ + Uchar info_2; /* information byte 2 */ + Uchar info_3; /* information byte 3 */ + Uchar info_4; /* information byte 4 */ + Uchar add_len; /* number of additional bytes */ + /* bytes 8 through 13, CCS additions */ + Uchar optional_8; /* CCS search and copy only */ + Uchar optional_9; /* CCS search and copy only */ + Uchar optional_10; /* CCS search and copy only */ + Uchar optional_11; /* CCS search and copy only */ + Uchar sense_code; /* sense code */ + Uchar qual_code; /* sense code qualifier */ + Uchar fru_code; /* Field replacable unit code */ + Ucbit sksv : 1; /* sense key specific valid */ + Ucbit cd : 1; /* pointers refer to command not data */ + Ucbit : 2; + Ucbit bpv : 1; /* bit pointer is valid */ + Ucbit bptr : 3; /* bit pointer for failure (if bpv) */ + Uchar field_ptr[2]; /* field pointer for failure */ + Uchar add_info[2]; /* round up to 20 bytes */ +}; +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _SCG_SCSISENSE_H */ diff --git a/scsilib/libscg/scg/scsitransp.h b/scsilib/libscg/scg/scsitransp.h new file mode 100644 index 0000000..d413c85 --- /dev/null +++ b/scsilib/libscg/scg/scsitransp.h @@ -0,0 +1,257 @@ +/* @(#)scsitransp.h 1.54 03/05/03 Copyright 1995 J. Schilling */ +/* + * Definitions for commands that use functions from scsitransp.c + * + * Copyright (c) 1995 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _SCG_SCSITRANSP_H +#define _SCG_SCSITRANSP_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct scg_scsi SCSI; + +typedef struct { + int scsibus; /* SCSI bus # for next I/O */ + int target; /* SCSI target # for next I/O */ + int lun; /* SCSI lun # for next I/O */ +} scg_addr_t; + +#ifndef _SCG_SCGOPS_H +#include <scg/scgops.h> +#endif + +typedef int (*scg_cb_t) __PR((void *)); + +struct scg_scsi { + scg_ops_t *ops; /* Ptr to low level SCSI transport ops */ + int fd; /* File descriptor for next I/O */ + scg_addr_t addr; /* SCSI address for next I/O */ + int flags; /* Libscg flags (see below) */ + int dflags; /* Drive specific flags (see below) */ + int kdebug; /* Kernel debug value for next I/O */ + int debug; /* Debug value for SCSI library */ + int silent; /* Be silent if value > 0 */ + int verbose; /* Be verbose if value > 0 */ + int overbose; /* Be verbose in open() if value > 0 */ + int disre_disable; + int deftimeout; + int noparity; /* Do not use SCSI parity fo next I/O */ + int dev; /* from scsi_cdr.c */ + struct scg_cmd *scmd; + char *cmdname; + char *curcmdname; + BOOL running; + int error; /* libscg error number */ + + long maxdma; /* Max DMA limit for this open instance */ + long maxbuf; /* Cur DMA buffer limit for this inst. */ + /* This is the size behind bufptr */ + struct timeval *cmdstart; + struct timeval *cmdstop; + const char **nonstderrs; + void *local; /* Local data from the low level code */ + void *bufbase; /* needed for scsi_freebuf() */ + void *bufptr; /* DMA buffer pointer for appl. use */ + char *errstr; /* Error string for scsi_open/sendmcd */ + char *errbeg; /* Pointer to begin of not flushed data */ + char *errptr; /* Actual write pointer into errstr */ + void *errfile; /* FILE to write errors to. NULL for not*/ + /* writing and leaving errs in errstr */ + scg_cb_t cb_fun; + void *cb_arg; + + struct scsi_inquiry *inq; + struct scsi_capacity *cap; +}; + +/* + * Macros for accessing members of the scg address structure. + * scg_settarget() is the only function that is allowed to modify + * the values of the SCSI address. + */ +#define scg_scsibus(scgp) (scgp)->addr.scsibus +#define scg_target(scgp) (scgp)->addr.target +#define scg_lun(scgp) (scgp)->addr.lun + +/* + * Flags for struct SCSI: + */ +/* NONE yet */ + +/* + * Drive specific flags for struct SCSI: + */ +#define DRF_MODE_DMA_OVR 0x0001 /* Drive gives DMA overrun */ + /* on mode sense */ + +#define SCSI_ERRSTR_SIZE 4096 + +/* + * Libscg error codes: + */ +#define SCG_ERRBASE 1000000 +#define SCG_NOMEM 1000001 + +/* + * Function codes for scg_version(): + */ +#define SCG_VERSION 0 /* libscg or transport version */ +#define SCG_AUTHOR 1 /* Author of above */ +#define SCG_SCCS_ID 2 /* SCCS id of above */ +#define SCG_RVERSION 10 /* Remote transport version */ +#define SCG_RAUTHOR 11 /* Remote transport author */ +#define SCG_RSCCS_ID 12 /* Remote transport SCCS ID */ +#define SCG_KVERSION 20 /* Kernel transport version */ + +/* + * Function codes for scg_reset(): + */ +#define SCG_RESET_NOP 0 /* Test if reset is supported */ +#define SCG_RESET_TGT 1 /* Reset Target only */ +#define SCG_RESET_BUS 2 /* Reset complete SCSI Bus */ + +/* + * Helpers for the error buffer in SCSI* + */ +#define scg_errsize(scgp) ((scgp)->errptr - (scgp)->errstr) +#define scg_errrsize(scgp) (SCSI_ERRSTR_SIZE - scg_errsize(scgp)) + +/* + * From scsitransp.c: + */ +extern char *scg_version __PR((SCSI *scgp, int what)); +extern int scg__open __PR((SCSI *scgp, char *device)); +extern int scg__close __PR((SCSI *scgp)); +extern BOOL scg_havebus __PR((SCSI *scgp, int)); +extern int scg_initiator_id __PR((SCSI *scgp)); +extern int scg_isatapi __PR((SCSI *scgp)); +extern int scg_reset __PR((SCSI *scgp, int what)); +extern void *scg_getbuf __PR((SCSI *scgp, long)); +extern void scg_freebuf __PR((SCSI *scgp)); +extern long scg_bufsize __PR((SCSI *scgp, long)); +extern void scg_setnonstderrs __PR((SCSI *scgp, const char **)); +extern BOOL scg_yes __PR((char *)); +extern int scg_cmd __PR((SCSI *scgp)); +extern void scg_vhead __PR((SCSI *scgp)); +extern int scg_svhead __PR((SCSI *scgp, char *buf, int maxcnt)); +extern int scg_vtail __PR((SCSI *scgp)); +extern int scg_svtail __PR((SCSI *scgp, int *retp, char *buf, int maxcnt)); +extern void scg_vsetup __PR((SCSI *scgp)); +extern int scg_getresid __PR((SCSI *scgp)); +extern int scg_getdmacnt __PR((SCSI *scgp)); +extern BOOL scg_cmd_err __PR((SCSI *scgp)); +extern void scg_printerr __PR((SCSI *scgp)); +#ifdef EOF /* stdio.h has been included */ +extern void scg_fprinterr __PR((SCSI *scgp, FILE *f)); +#endif +extern int scg_sprinterr __PR((SCSI *scgp, char *buf, int maxcnt)); +extern int scg__sprinterr __PR((SCSI *scgp, char *buf, int maxcnt)); +extern void scg_printcdb __PR((SCSI *scgp)); +extern int scg_sprintcdb __PR((SCSI *scgp, char *buf, int maxcnt)); +extern void scg_printwdata __PR((SCSI *scgp)); +extern int scg_sprintwdata __PR((SCSI *scgp, char *buf, int maxcnt)); +extern void scg_printrdata __PR((SCSI *scgp)); +extern int scg_sprintrdata __PR((SCSI *scgp, char *buf, int maxcnt)); +extern void scg_printresult __PR((SCSI *scgp)); +extern int scg_sprintresult __PR((SCSI *scgp, char *buf, int maxcnt)); +extern void scg_printstatus __PR((SCSI *scgp)); +extern int scg_sprintstatus __PR((SCSI *scgp, char *buf, int maxcnt)); +#ifdef EOF /* stdio.h has been included */ +extern void scg_fprbytes __PR((FILE *, char *, unsigned char *, int)); +extern void scg_fprascii __PR((FILE *, char *, unsigned char *, int)); +#endif +extern void scg_prbytes __PR((char *, unsigned char *, int)); +extern void scg_prascii __PR((char *, unsigned char *, int)); +extern int scg_sprbytes __PR((char *buf, int maxcnt, char *, unsigned char *, int)); +extern int scg_sprascii __PR((char *buf, int maxcnt, char *, unsigned char *, int)); +#ifdef EOF /* stdio.h has been included */ +extern void scg_fprsense __PR((FILE *f, unsigned char *, int)); +#endif +extern void scg_prsense __PR((unsigned char *, int)); +extern int scg_sprsense __PR((char *buf, int maxcnt, unsigned char *, int)); +extern int scg_cmd_status __PR((SCSI *scgp)); +extern int scg_sense_key __PR((SCSI *scgp)); +extern int scg_sense_code __PR((SCSI *scgp)); +extern int scg_sense_qual __PR((SCSI *scgp)); +#ifdef _SCG_SCSIREG_H +#ifdef EOF /* stdio.h has been included */ +extern void scg_fprintdev __PR((FILE *, struct scsi_inquiry *)); +#endif +extern void scg_printdev __PR((struct scsi_inquiry *)); +#endif +extern int scg_printf __PR((SCSI *scgp, const char *form, ...)); +extern int scg_errflush __PR((SCSI *scgp)); +#ifdef EOF /* stdio.h has been included */ +extern int scg_errfflush __PR((SCSI *scgp, FILE *f)); +#endif + +/* + * From scsierrmsg.c: + */ +extern const char *scg_sensemsg __PR((int, int, int, + const char **, char *, int maxcnt)); +#ifdef _SCG_SCSISENSE_H +extern int scg__errmsg __PR((SCSI *scgp, char *obuf, int maxcnt, + struct scsi_sense *, + struct scsi_status *, + int)); +#endif + +/* + * From scsiopen.c: + */ +#ifdef EOF /* stdio.h has been included */ +extern int scg_help __PR((FILE *f)); +#endif +extern SCSI *scg_open __PR((char *scsidev, char *errs, int slen, int odebug, int be_verbose)); +extern int scg_close __PR((SCSI * scgp)); +extern void scg_settimeout __PR((SCSI * scgp, int timeout)); +extern SCSI *scg_smalloc __PR((void)); +extern void scg_sfree __PR((SCSI *scgp)); + +/* + * From scgsettarget.c: + */ +extern int scg_settarget __PR((SCSI *scgp, int scsibus, int target, int lun)); + +/* + * From scsi-remote.c: + */ +extern scg_ops_t *scg_remote __PR((void)); + +/* + * From scsihelp.c: + */ +#ifdef EOF /* stdio.h has been included */ +extern void __scg_help __PR((FILE *f, char *name, char *tcomment, + char *tind, + char *tspec, + char *texample, + BOOL mayscan, + BOOL bydev)); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _SCG_SCSITRANSP_H */ diff --git a/scsilib/libscg/scg/spti-wnt.h b/scsilib/libscg/scg/spti-wnt.h new file mode 100644 index 0000000..cad384e --- /dev/null +++ b/scsilib/libscg/scg/spti-wnt.h @@ -0,0 +1,131 @@ +/* + * distilled information from various header files from Microsoft's + * DDK for Windows NT 4.0 + */ +#ifndef _SCSIPT_H_INC +#define _SCSIPT_H_INC + +#include <windows.h> + +typedef struct { + USHORT Length; + UCHAR ScsiStatus; + UCHAR PathId; + UCHAR TargetId; + UCHAR Lun; + UCHAR CdbLength; + UCHAR SenseInfoLength; + UCHAR DataIn; + ULONG DataTransferLength; + ULONG TimeOutValue; + ULONG DataBufferOffset; + ULONG SenseInfoOffset; + UCHAR Cdb[16]; +} SCSI_PASS_THROUGH, *PSCSI_PASS_THROUGH; + + +typedef struct { + USHORT Length; + UCHAR ScsiStatus; + UCHAR PathId; + UCHAR TargetId; + UCHAR Lun; + UCHAR CdbLength; + UCHAR SenseInfoLength; + UCHAR DataIn; + ULONG DataTransferLength; + ULONG TimeOutValue; + PVOID DataBuffer; + ULONG SenseInfoOffset; + UCHAR Cdb[16]; +} SCSI_PASS_THROUGH_DIRECT, *PSCSI_PASS_THROUGH_DIRECT; + + +typedef struct { + SCSI_PASS_THROUGH spt; + ULONG Filler; + UCHAR ucSenseBuf[32]; + UCHAR ucDataBuf[512]; +} SCSI_PASS_THROUGH_WITH_BUFFERS, *PSCSI_PASS_THROUGH_WITH_BUFFERS; + + +typedef struct { + SCSI_PASS_THROUGH_DIRECT spt; + ULONG Filler; + UCHAR ucSenseBuf[32]; +} SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, *PSCSI_PASS_THROUGH_DIRECT_WITH_BUFFER; + + + +typedef struct { + UCHAR NumberOfLogicalUnits; + UCHAR InitiatorBusId; + ULONG InquiryDataOffset; +} SCSI_BUS_DATA, *PSCSI_BUS_DATA; + + +typedef struct { + UCHAR NumberOfBusses; + SCSI_BUS_DATA BusData[1]; +} SCSI_ADAPTER_BUS_INFO, *PSCSI_ADAPTER_BUS_INFO; + + +typedef struct { + UCHAR PathId; + UCHAR TargetId; + UCHAR Lun; + BOOLEAN DeviceClaimed; + ULONG InquiryDataLength; + ULONG NextInquiryDataOffset; + UCHAR InquiryData[1]; +} SCSI_INQUIRY_DATA, *PSCSI_INQUIRY_DATA; + + +typedef struct { + ULONG Length; + UCHAR PortNumber; + UCHAR PathId; + UCHAR TargetId; + UCHAR Lun; +} SCSI_ADDRESS, *PSCSI_ADDRESS; + + +/* + * method codes + */ +#define METHOD_BUFFERED 0 +#define METHOD_IN_DIRECT 1 +#define METHOD_OUT_DIRECT 2 +#define METHOD_NEITHER 3 + +/* + * file access values + */ +#define FILE_ANY_ACCESS 0 +#define FILE_READ_ACCESS 0x0001 +#define FILE_WRITE_ACCESS 0x0002 + + +#define IOCTL_SCSI_BASE 0x00000004 + +/* + * constants for DataIn member of SCSI_PASS_THROUGH* structures + */ +#define SCSI_IOCTL_DATA_OUT 0 +#define SCSI_IOCTL_DATA_IN 1 +#define SCSI_IOCTL_DATA_UNSPECIFIED 2 + +/* + * Standard IOCTL define + */ +#define CTL_CODE(DevType, Function, Method, Access) \ + (((DevType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method)) + +#define IOCTL_SCSI_PASS_THROUGH CTL_CODE(IOCTL_SCSI_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_SCSI_MINIPORT CTL_CODE(IOCTL_SCSI_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_SCSI_GET_INQUIRY_DATA CTL_CODE(IOCTL_SCSI_BASE, 0x0403, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_SCSI_GET_CAPABILITIES CTL_CODE(IOCTL_SCSI_BASE, 0x0404, METHOD_BUFFERED, FILE_ANY_ACCESS) +#define IOCTL_SCSI_PASS_THROUGH_DIRECT CTL_CODE(IOCTL_SCSI_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS) +#define IOCTL_SCSI_GET_ADDRESS CTL_CODE(IOCTL_SCSI_BASE, 0x0406, METHOD_BUFFERED, FILE_ANY_ACCESS) + +#endif diff --git a/scsilib/libscg/scg/srb_os2.h b/scsilib/libscg/scg/srb_os2.h new file mode 100644 index 0000000..b1d3aa6 --- /dev/null +++ b/scsilib/libscg/scg/srb_os2.h @@ -0,0 +1,169 @@ +/* @(#)srb_os2.h 1.0 98/10/28 Copyright 1998 D. Dorau, C. Wohlgemuth */ +/* + * Definitions for ASPI-Router (ASPIROUT.SYS). + * + * Copyright (c) 1998 D. Dorau, C. Wohlgemuth + */ + + +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#pragma pack(1) + + /* SRB command */ +#define SRB_Inquiry 0x00 +#define SRB_Device 0x01 +#define SRB_Command 0x02 +#define SRB_Abort 0x03 +#define SRB_Reset 0x04 +#define SRB_Param 0x05 + + /* SRB status */ +#define SRB_Busy 0x00 /* SCSI request in progress */ +#define SRB_Done 0x01 /* SCSI request completed without error */ +#define SRB_Aborted 0x02 /* SCSI aborted by host */ +#define SRB_BadAbort 0x03 /* Unable to abort SCSI request */ +#define SRB_Error 0x04 /* SCSI request completed with error */ +#define SRB_BusyPost 0x10 /* SCSI request in progress with POST - Nokia */ +#define SRB_InvalidCmd 0x80 /* Invalid SCSI request */ +#define SRB_InvalidHA 0x81 /* Invalid Hhost adapter number */ +#define SRB_BadDevice 0x82 /* SCSI device not installed */ + + /* SRB flags */ +#define SRB_Post 0x01 /* Post vector valid */ +#define SRB_Link 0x02 /* Link vector valid */ +#define SRB_SG 0x04 /* Nokia: scatter/gather */ + /* S/G: n * (4 bytes length, 4 bytes addr) */ + /* No of s/g items not limited by HA spec. */ +#define SRB_NoCheck 0x00 /* determined by command, not checked */ +#define SRB_Read 0x08 /* target to host, length checked */ +#define SRB_Write 0x10 /* host to target, length checked */ +#define SRB_NoTransfer 0x18 /* no data transfer */ +#define SRB_DirMask 0x18 /* bit mask */ + + /* SRB host adapter status */ +#define SRB_NoError 0x00 /* No host adapter detected error */ +#define SRB_Timeout 0x11 /* Selection timeout */ +#define SRB_DataLength 0x12 /* Data over/underrun */ +#define SRB_BusFree 0x13 /* Unexpected bus free */ +#define SRB_BusSequence 0x14 /* Target bus sequence failure */ + + /* SRB target status field */ +#define SRB_NoStatus 0x00 /* No target status */ +#define SRB_CheckStatus 0x02 /* Check status (sense data valid) */ +#define SRB_LUN_Busy 0x08 /* Specified LUN is busy */ +#define SRB_Reserved 0x18 /* Reservation conflict */ + +#define MaxCDBStatus 64 /* max size of CDB + status */ + + +typedef struct SRb { + unsigned char cmd, /* 00 */ + status, /* 01 */ + ha_num, /* 02 */ + flags; /* 03 */ + unsigned long res_04_07; /* 04..07 */ + union { /* 08 */ + + /* SRB_Inquiry */ + struct { + unsigned char num_ha, /* 08 */ + ha_target, /* 09 */ + aspimgr_id[16], /* 0A..19 */ + host_id[16], /* 1A..29 */ + unique_id[16]; /* 2A..39 */ + } inq; + + /* SRB_Device */ + struct { + unsigned char target, /* 08 */ + lun, /* 09 */ + devtype; /* 0A */ + } dev; + + /* SRB_Command */ + struct { + unsigned char target, /* 08 */ + lun; /* 09 */ + unsigned long data_len; /* 0A..0D */ + unsigned char sense_len; /* 0E */ + unsigned long data_ptr; /* 0F..12 */ + unsigned long link_ptr; /* 13..16 */ + // void * _Seg16 data_ptr; /* 0F..12 */ + // void * _Seg16 link_ptr; /* 13..16 */ + unsigned char cdb_len, /* 17 */ + ha_status, /* 18 */ + target_status; /* 19 */ + unsigned char _Seg16postSRB[4]; + // void (* _Seg16 post) (SRB *); /* 1A..1D */ + unsigned char res_1E_29[12]; /* 1E..29 */ + unsigned char res_2A_3F[22]; /* 2A..3F */ + unsigned char cdb_st[64]; /* 40..7F CDB+status */ + unsigned char res_80_BF[64]; /* 80..BF */ + } cmd; + + /* SRB_Abort */ + struct { + unsigned char _Seg16srb[4]; + // void * _Seg16 srb; /* 08..0B */ + } abt; + + /* SRB_Reset */ + struct { + unsigned char target, /* 08 */ + lun, /* 09 */ + res_0A_17[14], /* 0A..17 */ + ha_status, /* 18 */ + target_status; /* 19 */ + } res; + + /* SRB_Param - unused by ASPI4OS2 */ + struct { + unsigned char unique[16]; /* 08..17 */ + } par; + + } u; +} SRB; + + +// SCSI sense codes +// Note! This list may not be complete. I did this compilation for use with tape drives. + +#define Sense_Current 0x70; // Current Error +#define Sense_Deferred 0x71; // Deferred Error +#define Sense_Filemark 0x80; // Filemark detected +#define Sense_EOM 0x40; // End of medium detected +#define Sense_ILI 0x20; // Incorrect length indicator + +// Sense Keys + +#define SK_NoSense 0x00; // No Sense +#define SK_RcvrdErr 0x01; // Recovered Error +#define SK_NotReady 0x02; // Not ready +#define SK_MedErr 0x03; // Medium Error +#define SK_HWErr 0x04; // Hardware Error +#define SK_IllReq 0x05; // Illegal Request +#define SK_UnitAtt 0x06; // Unit attention +#define SK_DataProt 0x07: // Data Protect +#define SK_BlankChk 0x08: // Blank Check +#define SK_VndSpec 0x09; // Vendor Specific +#define SK_CopyAbort 0x0A; // Copy Aborted +#define SK_AbtdCmd 0x0B; // Aborted Command +#define SK_Equal 0x0C; // Equal +#define SK_VolOvfl 0x0D; // Volume Overflow +#define SK_MisComp 0x0E; // Miscompare +#define SK_Reserved 0x0F; // Reserved diff --git a/scsilib/libscg/scgsettarget.c b/scsilib/libscg/scgsettarget.c new file mode 100644 index 0000000..522b22e --- /dev/null +++ b/scsilib/libscg/scgsettarget.c @@ -0,0 +1,55 @@ +/* @(#)scgsettarget.c 1.2 04/01/14 Copyright 2000 J. Schilling */ +#ifndef lint +static char _sccsid[] = + "@(#)scgsettarget.c 1.2 04/01/14 Copyright 2000 J. Schilling"; +#endif +/* + * scg Library + * set target SCSI address + * + * This is the only place in libscg that is allowed to assign + * values to the scg address structure. + * + * Copyright (c) 2000 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <standard.h> +#include <schily.h> + +#include <scg/scsitransp.h> + +EXPORT int scg_settarget __PR((SCSI *scgp, int, int, int)); + +EXPORT int +scg_settarget(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + int fd = -1; + + if (scgp->ops != NULL) + fd = SCGO_FILENO(scgp, busno, tgt, tlun); + scgp->fd = fd; + scg_scsibus(scgp) = busno; + scg_target(scgp) = tgt; + scg_lun(scgp) = tlun; + return (fd); +} diff --git a/scsilib/libscg/scgtimes.c b/scsilib/libscg/scgtimes.c new file mode 100644 index 0000000..7c74c95 --- /dev/null +++ b/scsilib/libscg/scgtimes.c @@ -0,0 +1,54 @@ +/* @(#)scgtimes.c 1.1 00/08/25 Copyright 1995,2000 J. Schilling */ +#ifndef lint +static char sccsid[] = + "@(#)scgtimes.c 1.1 00/08/25 Copyright 1995,2000 J. Schilling"; +#endif +/* + * SCSI user level command timing + * + * Copyright (c) 1995,2000 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <mconfig.h> +#include <standard.h> +#include <timedefs.h> +#include <schily.h> + +#include <scg/scsitransp.h> +#include "scgtimes.h" + +EXPORT void __scg_times __PR((SCSI *scgp)); + +/* + * We don't like to make this a public interface to prevent bad users + * from making our timing incorrect. + */ +EXPORT void +__scg_times(scgp) + SCSI *scgp; +{ + struct timeval *stp = scgp->cmdstop; + + gettimeofday(stp, (struct timezone *)0); + stp->tv_sec -= scgp->cmdstart->tv_sec; + stp->tv_usec -= scgp->cmdstart->tv_usec; + while (stp->tv_usec < 0) { + stp->tv_sec -= 1; + stp->tv_usec += 1000000; + } +} diff --git a/scsilib/libscg/scgtimes.h b/scsilib/libscg/scgtimes.h new file mode 100644 index 0000000..ac80f46 --- /dev/null +++ b/scsilib/libscg/scgtimes.h @@ -0,0 +1,23 @@ +/* @(#)scgtimes.h 1.1 00/08/25 Copyright 1995,2000 J. Schilling */ +/* + * SCSI user level command timing + * + * Copyright (c) 1995,2000 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +extern void __scg_times __PR((SCSI *scgp)); diff --git a/scsilib/libscg/scsi-aix.c b/scsilib/libscg/scsi-aix.c new file mode 100644 index 0000000..46a7538 --- /dev/null +++ b/scsilib/libscg/scsi-aix.c @@ -0,0 +1,448 @@ +/* @(#)scsi-aix.c 1.36 04/01/14 Copyright 1997 J. Schilling */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-aix.c 1.36 04/01/14 Copyright 1997 J. Schilling"; +#endif +/* + * Interface for the AIX generic SCSI implementation. + * + * This is a hack, that tries to emulate the functionality + * of the scg driver. + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1997 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <sys/scdisk.h> + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-aix.c-1.36"; /* The version for this transport*/ + + +#define MAX_SCG 16 /* Max # of SCSI controllers */ +#define MAX_TGT 16 +#define MAX_LUN 8 + +struct scg_local { + short scgfiles[MAX_SCG][MAX_TGT][MAX_LUN]; +}; +#define scglocal(p) ((struct scg_local *)((p)->local)) + +#define MAX_DMA_AIX (64*1024) + +LOCAL int do_scg_cmd __PR((SCSI *scgp, struct scg_cmd *sp)); +LOCAL int do_scg_sense __PR((SCSI *scgp, struct scg_cmd *sp)); + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (__sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "DKIOCMD", "SCSI transport for targets known by AIX drivers", + "", "bus,target,lun or UNIX device", "1,2,0 or /dev/rcd0@", FALSE, TRUE); + return (0); +} + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + register int f; + register int b; + register int t; + register int l; + register int nopen = 0; + char devname[32]; + + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno, target or lun '%d,%d,%d'", + busno, tgt, tlun); + return (-1); + } + + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + scglocal(scgp)->scgfiles[b][t][l] = (short)-1; + } + } + } + + if ((device != NULL && *device != '\0') || (busno == -2 && tgt == -2)) + goto openbydev; + + if (busno >= 0 && tgt >= 0 && tlun >= 0) { + + js_snprintf(devname, sizeof (devname), "/dev/rcd%d", tgt); + f = openx(devname, 0, 0, SC_DIAGNOSTIC); + if (f < 0) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '%s'. Specify device number (1 for cd1) as target (1,0)", + devname); + return (0); + } + scglocal(scgp)->scgfiles[busno][tgt][tlun] = f; + return (1); + } else { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Unable to scan on AIX"); + return (0); + } +openbydev: + if (device != NULL && *device != '\0' && busno >= 0 && tgt >= 0 && tlun >= 0) { + f = openx(device, 0, 0, SC_DIAGNOSTIC); + if (f < 0) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '%s'", + devname); + return (0); + } + + scglocal(scgp)->scgfiles[busno][tgt][tlun] = f; + scg_settarget(scgp, busno, tgt, tlun); + + return (++nopen); + } + return (nopen); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + register int f; + register int b; + register int t; + register int l; + + if (scgp->local == NULL) + return (-1); + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + f = scglocal(scgp)->scgfiles[b][t][l]; + if (f >= 0) + close(f); + scglocal(scgp)->scgfiles[b][t][l] = (short)-1; + } + } + } + return (0); +} + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + return (MAX_DMA_AIX); +} + +#define palign(x, a) (((char *)(x)) + ((a) - 1 - (((UIntptr_t)((x)-1))%(a)))) + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + void *ret; + int pagesize; + +#ifdef _SC_PAGESIZE + pagesize = sysconf(_SC_PAGESIZE); +#else + pagesize = getpagesize(); +#endif + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_getbuf: %ld bytes\n", amt); + } + /* + * Damn AIX is a paged system but has no valloc() + */ + scgp->bufbase = ret = malloc((size_t)(amt+pagesize)); + if (ret == NULL) + return (ret); + ret = palign(ret, pagesize); + return (ret); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + register int t; + register int l; + + if (busno < 0 || busno >= MAX_SCG) + return (FALSE); + + if (scgp->local == NULL) + return (FALSE); + + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + if (scglocal(scgp)->scgfiles[busno][t][l] >= 0) + return (TRUE); + } + return (FALSE); +} + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (busno < 0 || busno >= MAX_SCG || + tgt < 0 || tgt >= MAX_TGT || + tlun < 0 || tlun >= MAX_LUN) + return (-1); + + if (scgp->local == NULL) + return (-1); + + return ((int)scglocal(scgp)->scgfiles[busno][tgt][tlun]); +} + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + return (-1); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; +{ + return (FALSE); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + if (what == SCG_RESET_NOP) + return (0); + if (what != SCG_RESET_BUS) { + errno = EINVAL; + return (-1); + } + /* + * XXX Does this reset TGT or BUS ??? + */ + return (ioctl(scgp->fd, SCIORESET, IDLUN(scg_target(scgp), scg_lun(scgp)))); +} + +LOCAL int +do_scg_cmd(scgp, sp) + SCSI *scgp; + struct scg_cmd *sp; +{ + struct sc_iocmd req; + int ret; + + if (sp->cdb_len > 12) + comerrno(EX_BAD, "Can't do %d byte command.\n", sp->cdb_len); + + fillbytes(&req, sizeof (req), '\0'); + + req.flags = SC_ASYNC; + if (sp->flags & SCG_RECV_DATA) { + req.flags |= B_READ; + } else if (sp->size > 0) { + req.flags |= B_WRITE; + } + req.data_length = sp->size; + req.buffer = sp->addr; + req.timeout_value = sp->timeout; + req.command_length = sp->cdb_len; + + movebytes(&sp->cdb, req.scsi_cdb, 12); + errno = 0; + ret = ioctl(scgp->fd, DKIOCMD, &req); + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, "ret: %d errno: %d (%s)\n", ret, errno, errmsgstr(errno)); + js_fprintf((FILE *)scgp->errfile, "data_length: %d\n", req.data_length); + js_fprintf((FILE *)scgp->errfile, "buffer: 0x%X\n", req.buffer); + js_fprintf((FILE *)scgp->errfile, "timeout_value: %d\n", req.timeout_value); + js_fprintf((FILE *)scgp->errfile, "status_validity: %d\n", req.status_validity); + js_fprintf((FILE *)scgp->errfile, "scsi_bus_status: 0x%X\n", req.scsi_bus_status); + js_fprintf((FILE *)scgp->errfile, "adapter_status: 0x%X\n", req.adapter_status); + js_fprintf((FILE *)scgp->errfile, "adap_q_status: 0x%X\n", req.adap_q_status); + js_fprintf((FILE *)scgp->errfile, "q_tag_msg: 0x%X\n", req.q_tag_msg); + js_fprintf((FILE *)scgp->errfile, "flags: 0X%X\n", req.flags); + } + if (ret < 0) { + sp->ux_errno = geterrno(); + /* + * Check if SCSI command cound not be send at all. + */ + if (sp->ux_errno == ENOTTY || sp->ux_errno == ENXIO || + sp->ux_errno == EINVAL || sp->ux_errno == EACCES) { + return (-1); + } + } else { + sp->ux_errno = 0; + } + ret = 0; + sp->sense_count = 0; + sp->resid = 0; /* AIX is the same rubbish as Linux here */ + + fillbytes(&sp->scb, sizeof (sp->scb), '\0'); + fillbytes(&sp->u_sense.cmd_sense, sizeof (sp->u_sense.cmd_sense), '\0'); + + if (req.status_validity == 0) { + sp->error = SCG_NO_ERROR; + return (0); + } + if (req.status_validity & 1) { + sp->u_scb.cmd_scb[0] = req.scsi_bus_status; + sp->error = SCG_RETRYABLE; + } + if (req.status_validity & 2) { + if (req.adapter_status & SC_NO_DEVICE_RESPONSE) { + sp->error = SCG_FATAL; + + } else if (req.adapter_status & SC_CMD_TIMEOUT) { + sp->error = SCG_TIMEOUT; + + } else if (req.adapter_status != 0) { + sp->error = SCG_RETRYABLE; + } + } + + return (ret); +} + +LOCAL int +do_scg_sense(scgp, sp) + SCSI *scgp; + struct scg_cmd *sp; +{ + int ret; + struct scg_cmd s_cmd; + + fillbytes((caddr_t)&s_cmd, sizeof (s_cmd), '\0'); + s_cmd.addr = sp->u_sense.cmd_sense; + s_cmd.size = sp->sense_len; + s_cmd.flags = SCG_RECV_DATA|SCG_DISRE_ENA; + s_cmd.cdb_len = SC_G0_CDBLEN; + s_cmd.sense_len = CCS_SENSE_LEN; + s_cmd.cdb.g0_cdb.cmd = SC_REQUEST_SENSE; + s_cmd.cdb.g0_cdb.lun = sp->cdb.g0_cdb.lun; + s_cmd.cdb.g0_cdb.count = sp->sense_len; + ret = do_scg_cmd(scgp, &s_cmd); + + if (ret < 0) + return (ret); + if (s_cmd.u_scb.cmd_scb[0] & 02) { + /* XXX ??? Check condition on request Sense ??? */ + } + sp->sense_count = sp->sense_len - s_cmd.resid; + return (ret); +} + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + int ret; + + if (scgp->fd < 0) { + sp->error = SCG_FATAL; + return (0); + } + ret = do_scg_cmd(scgp, sp); + if (ret < 0) + return (ret); + if (sp->u_scb.cmd_scb[0] & 02) + ret = do_scg_sense(scgp, sp); + return (ret); +} diff --git a/scsilib/libscg/scsi-amigaos.c b/scsilib/libscg/scsi-amigaos.c new file mode 100644 index 0000000..9d44d43 --- /dev/null +++ b/scsilib/libscg/scsi-amigaos.c @@ -0,0 +1,797 @@ +/* @(#)scsi-amigaos.c 1.6 04/01/14 Copyright 1997,2000-2003 J. Schilling */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-amigaos.c 1.6 04/01/14 Copyright 1997,2000-2003 J. Schilling"; +#endif +/* + * Interface for the AmigaOS generic SCSI implementation. + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1997, 2000-2003 J. Schilling + * AmigaOS support code written by T. Langer + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#define BOOL int + +#include <strdefs.h> +#include <exec/ports.h> +#include <exec/io.h> +#include <exec/errors.h> +#include <devices/scsidisk.h> +#include <devices/timer.h> +#include <exec/semaphores.h> +#include <exec/memory.h> +#include <exec/execbase.h> +#include <clib/exec_protos.h> +#include <clib/alib_protos.h> + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-amigaos.c-1.6"; /* The version for this transport */ +LOCAL char _scg_auth[] = "T. Langer"; + +#define MAX_SCG 8 /* Max # of SCSI controllers */ +#define MAX_TGT 8 +#define MAX_LUN 8 +#define MAX_DEV MAX_SCG*MAX_TGT*MAX_LUN + +struct scg_local { + int scgfiles[MAX_SCG][MAX_TGT][MAX_LUN]; +}; + +#define scglocal(p) ((struct scg_local *)((p)->local)) + +#define MAX_DMA_AMIGAOS (64*1024) + +LOCAL struct IOReq { + struct IOStdReq *ioReq; + int ref_count; +} request[MAX_DEV]; + +LOCAL char *devs[MAX_SCG]; +LOCAL struct MsgPort *ioMsgPort = NULL; +LOCAL struct timerequest *timer_io = NULL; +LOCAL struct MsgPort *timerMsgPort = NULL; +LOCAL int initialized = 0; +LOCAL int last_bus = -1; +/* my private var: for debug purpose only */ +LOCAL int ami_debug = 0; + +extern struct ExecBase *SysBase; +#define IOERR_TIMEOUT (-8) +#define CHECK_CONDITION 0x02 +#define DUNIT(b, t, l) (100 * b) + (10 * (l < 0 ? 0:l)) + t + +LOCAL void amiga_init __PR((void)); +LOCAL int amiga_open_scsi __PR((int bus, int tgt, int lun, SCSI *scgp)); +LOCAL void amiga_close_scsi __PR((int fd)); +LOCAL void amiga_close_scsi_all __PR((void)); +LOCAL void amiga_scan_devices __PR((void)); +LOCAL int amiga_find_device __PR((char *device)); +LOCAL int amiga_open_timer __PR((void)); +LOCAL void amiga_close_timer __PR((void)); +LOCAL int amiga_get_scsi_bus __PR((char *device)); + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: +/* return (_scg_auth_schily);*/ + return (_scg_auth); + case SCG_SCCS_ID: + return (__sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "Amiga SCSI", "Generic SCSI", + "", "bus,target,lun or xxx.device:b,t,l", "1,2,0 or scsi.device:1,2,0", TRUE, FALSE); + return (0); +} + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + register int f; + register int b; + register int t; + register int l; + register int nopen = 0; + + if (initialized == 0) { + amiga_init(); + initialized = 1; + } + + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno, target or lun '%d,%d,%d'", + busno, tgt, tlun); + } + return (-1); + } + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + scglocal(scgp)->scgfiles[b][t][l] = -1; + } + } + } + } + + if (device == NULL || *device == '\0') { + + if (last_bus == -1) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "No scsi device found"); + return (-1); + } + if (busno < 0 && tgt < 0 && tlun < 0) { + /* cdrecord -scanbus */ + for (b = 0; b <= last_bus; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + f = amiga_open_scsi(b, t, l, scgp); + if (f != -1) { + scglocal(scgp)->scgfiles[b][t][l] = f; + nopen++; + } + } + } + } + } else { + /* cdrecord [-scanbus] dev=b,t,l */ + f = amiga_open_scsi(busno, tgt, tlun, scgp); + if (f != -1) { + scglocal(scgp)->scgfiles[busno][tgt][tlun] = f; + nopen++; + } + } + } else { + if (busno < 0 && tgt < 0 && tlun < 0) { + /* cdrecord -scanbus dev=xxx.device */ + b = amiga_get_scsi_bus(device); + if (b != -1) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + f = amiga_open_scsi(b, t, l, scgp); + if (f != -1) { + scglocal(scgp)->scgfiles[b][t][l] = f; + nopen++; + } + } + } + } else { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Scsi device %s not found", device); + } + } else { + /* cdrecord [-scanbus] dev=xxx.device:b,t,l */ + /* + * this is a special case, in which the scsi device is accessed just by + * name, bus parameter from the command is ignored. + */ + b = amiga_get_scsi_bus(device); + if (b != -1) { + f = amiga_open_scsi(b, tgt, tlun, scgp); + if (f != -1) { + scglocal(scgp)->scgfiles[busno][tgt][tlun] = f; + nopen++; + } + } else { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Scsi device %s not found", device); + } + } + } + + return (nopen); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + register int b; + register int t; + register int l; + + if (scgp->local == NULL) + return (-1); + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + if (scglocal(scgp)->scgfiles[b][t][l] >= 0) + amiga_close_scsi(scglocal(scgp)->scgfiles[b][t][l]); + scglocal(scgp)->scgfiles[b][t][l] = -1; + } + } + } + return (0); +} + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + return (MAX_DMA_AMIGAOS); +} + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_getbuf: %ld bytes\n", amt); + } + scgp->bufbase = valloc((size_t)(amt)); + return (scgp->bufbase); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + register int t; + register int l; + + if (busno < 0 || busno >= MAX_SCG) + return (FALSE); + + if (scgp->local == NULL) + return (FALSE); + + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + if (scglocal(scgp)->scgfiles[busno][t][l] != -1) + return (TRUE); + } + return (FALSE); +} + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (busno < 0 || busno >= MAX_SCG || + tgt < 0 || tgt >= MAX_TGT || + tlun < 0 || tlun >= MAX_LUN) + return (-1); + + if (scgp->local == NULL) + return (-1); + + return ((int)scglocal(scgp)->scgfiles[busno][tgt][tlun]); +} + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + return (-1); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; +{ + return (FALSE); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + /* XXX Is there really no reset function on AmigaOS? */ + errno = EINVAL; + return (-1); +} + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + register struct IOStdReq *ioreq = NULL; + struct SCSICmd Cmd; + int ret = 0; + struct scg_cmd *sp = scgp->scmd; + + sp->error = SCG_NO_ERROR; + sp->sense_count = 0; + sp->u_scb.cmd_scb[0] = 0; + sp->resid = 0; + + if (scgp->fd < 0) { + sp->error = SCG_FATAL; + return (0); + } + ioreq = request[scgp->fd].ioReq; + if (ioreq == NULL) { + sp->error = SCG_FATAL; + return (0); + } + ioreq->io_Length = sizeof (struct SCSICmd); + ioreq->io_Data = &Cmd; + ioreq->io_Command = HD_SCSICMD; + + Cmd.scsi_Flags = SCSIF_AUTOSENSE; /* We set the SCSI cmd len */ + if (sp->flags & SCG_RECV_DATA) + Cmd.scsi_Flags |= SCSIF_READ; + else if (sp->size > 0) + Cmd.scsi_Flags |= SCSIF_WRITE; + + Cmd.scsi_Command = sp->cdb.cmd_cdb; + Cmd.scsi_CmdLength = sp->cdb_len; + Cmd.scsi_Data = (UWORD *) sp->addr; + Cmd.scsi_Length = sp->size; + Cmd.scsi_Actual = 0; + + Cmd.scsi_SenseData = sp->u_sense.cmd_sense; + Cmd.scsi_SenseLength = sp->sense_len; + Cmd.scsi_SenseActual = 0; + Cmd.scsi_Status = 0; + + do_scsi_cmd(ioreq, sp->timeout); + + fillbytes(&sp->scb, sizeof (sp->scb), '\0'); + sp->resid = Cmd.scsi_Length - Cmd.scsi_Actual; + + if (sp->resid < 0) + sp->resid = 0; + sp->sense_count = Cmd.scsi_SenseActual; + if (sp->sense_count < 0) + sp->sense_count; + + if (sp->sense_count > SCG_MAX_SENSE) + sp->sense_count = SCG_MAX_SENSE; + sp->u_scb.cmd_scb[0] = Cmd.scsi_Status; + + if (ioreq->io_Error) + sp->ux_errno = EIO; + + if (ami_debug) + printf("ioreq->io_Error: %ld; status %ld\n", ioreq->io_Error, Cmd.scsi_Status); + + switch (ioreq->io_Error) { + case 0: + sp->error = SCG_NO_ERROR; + break; + case IOERR_TIMEOUT: + sp->error = SCG_TIMEOUT; + break; + case HFERR_DMA: + case IOERR_UNITBUSY: + case HFERR_Phase: + case HFERR_Parity: + case HFERR_BadStatus: + if (Cmd.scsi_Status == CHECK_CONDITION) { + sp->error = SCG_NO_ERROR; + } else { + sp->error = SCG_RETRYABLE; + } + break; + default: + /* XXX was kann sonst noch passieren? */ + sp->error = SCG_FATAL; + break; + } + + return (ret); +} + +LOCAL int +do_scsi_cmd(scsi_io, timeout) + struct IOStdReq *scsi_io; + int timeout; +{ + ULONG scsi_flag = 0; + ULONG timer_flag = 0; + ULONG wait_sigs = 0; + ULONG wait_ret = 0; + int ret = 0; + + scsi_flag = 1L<<scsi_io->io_Message.mn_ReplyPort->mp_SigBit; + wait_sigs = scsi_flag; + + SetSignal(0L, scsi_flag); + SendIO((struct IORequest *)scsi_io); + if (timer_io) { + timer_flag = 1L<<timerMsgPort->mp_SigBit; + wait_sigs |= timer_flag; + timer_io->tr_time.tv_secs = timeout; + SetSignal(0L, timer_flag); + SendIO((struct IORequest *)timer_io); + } + + wait_ret = Wait(wait_sigs); + + if (wait_ret & scsi_flag) { + WaitIO((struct IORequest *)scsi_io); + if (timer_io) { + if (!CheckIO((struct IORequest *) timer_io)) { + AbortIO((struct IORequest *)timer_io); + WaitIO((struct IORequest *)timer_io); + } + } + } else if (wait_ret & timer_flag) { + WaitIO((struct IORequest *)timer_io); + if (!CheckIO((struct IORequest *) scsi_io)) { + AbortIO((struct IORequest *)scsi_io); + if (scsi_io->io_Error == IOERR_ABORTED) { + WaitIO((struct IORequest *)scsi_io); + } + } + scsi_io->io_Error = IOERR_TIMEOUT; + } + + return (scsi_io->io_Error); +} + +/*--------------------------------------------------------------------------*/ + +/* strlwr: seems not to be implemented in ixemul */ +LOCAL char * +strlwr(s) + char *s; +{ + unsigned char *s1; + + s1 = (unsigned char *)s; + while (*s1) { + if ((*s1 > ('A'-1)) && (*s1 < ('Z'+1))) + *s1 += 'a'-'A'; + s1++; + } + return (s); +} + +/* + * amiga specific functions + */ +LOCAL void +amiga_init() +{ + memset(request, 0, sizeof (request)); + amiga_scan_devices(); + if (ami_debug) + printf("scanning bus. %ld device(s) found\n", last_bus + 1); + + atexit(amiga_close_scsi_all); +} + +LOCAL void +amiga_scan_devices() +{ + /* + * searching all known scsi devices + * for first there is only a (full) support for scsi.device and amithlon.device. + * This are devices i tested. + * All the other devices have to be specified by name (i.e. cdrecord dev=blabla.device:0,0,0) + * but didn't appear in the scanbus list. Later they should/may be also added to the + * main_dev_list (after testing). + */ + const char *main_dev_list[] = { "scsi.device", "amithlon.device", NULL }; + + int i; + char **main_dev; + + main_dev = (char **)main_dev_list; + while (*main_dev) { + if (last_bus == MAX_SCG - 1) + break; + if (amiga_find_device(*main_dev)) { + last_bus++; + devs[last_bus] = strdup(*main_dev); + for (i = 2; i < MAX_SCG; i++) { + char tmp[256]; + if (last_bus == MAX_SCG - 1) + break; + if (i == 2) { + sprintf(tmp, "2nd.%s", *main_dev); + } else if (i == 3) { + sprintf(tmp, "3rd.%s", *main_dev); + } else { + sprintf(tmp, "%ldth.%s", i, *main_dev); + } + if (amiga_find_device(tmp)) { + last_bus++; + devs[last_bus] = strdup(tmp); + } else { + break; + } + } + } + main_dev++; + } +} + +LOCAL void +amiga_close_scsi(fd) + int fd; +{ + if (request[fd].ref_count > 0) { + request[fd].ref_count--; + if (request[fd].ref_count == 0) { + CloseDevice((struct IORequest *) request[fd].ioReq); + DeleteStdIO(request[fd].ioReq); + request[fd].ioReq = NULL; + if (ami_debug) { + printf("closing device fd %ld\n", fd); + } + } + } +} + +LOCAL void +amiga_close_scsi_all() +{ + int i; + + for (i = 0; i < MAX_DEV; i++) { + if (request[i].ioReq != NULL) { + if (ami_debug) { + printf("closing device fd %ld\n", i); + } + CloseDevice((struct IORequest *) request[i].ioReq); + DeleteStdIO(request[i].ioReq); + request[i].ioReq = NULL; + } + } + + if (ioMsgPort) { + DeletePort(ioMsgPort); + ioMsgPort = NULL; + } + amiga_close_timer(); + + for (i = 0; i < MAX_SCG; i++) { + free(devs[i]); + } +} + +LOCAL int +amiga_open_scsi(bus, tgt, lun, scgp) + int bus; + int tgt; + int lun; + SCSI *scgp; +{ + int fd = bus * MAX_TGT * MAX_LUN + tgt * MAX_LUN + lun; + int unit = DUNIT(bus, tgt, lun); + char *dev = devs[bus]; + + if (dev == NULL) { + if (scgp->errstr) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "No scsi device found at bus %ld\n", bus); + } + return (-1); + } + + if (ioMsgPort == NULL) { + ioMsgPort = CreatePort(NULL, 0); + } + + if (ioMsgPort != NULL) { + if (request[fd].ioReq == NULL) { + request[fd].ioReq = CreateStdIO(ioMsgPort); + } + + if (request[fd].ioReq != NULL) { + if (ami_debug) + printf("trying %s, unit %ld\n", dev, unit); + if (OpenDevice(dev, unit, (struct IORequest *)request[fd].ioReq, 0L)) { + if (scgp->errstr) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open %s\n", dev); + } + if (request[fd].ref_count == 0) { + DeleteStdIO(request[fd].ioReq); + request[fd].ioReq = NULL; + } + fd = -1; + } else { + request[fd].ref_count++; + if (ami_debug) + printf("opening %s, unit %ld as fd %ld count %ld\n", dev, unit, fd, request[fd].ref_count); + } + } else { + if (scgp->errstr) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot create IOReq"); + } + } + } else { + if (scgp->errstr) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open Message Port"); + } + } + + return (fd); +} + +LOCAL int +amiga_open_timer() +{ + int ret = 0; + + /* we need the timer to catch scsi timeouts */ + if (timer_io == NULL) { + if (ami_debug) + printf("opening timer\n"); + + timerMsgPort = CreatePort(NULL, 0); + if (timerMsgPort) { + timer_io = (struct timerequest *)CreateExtIO(timerMsgPort, sizeof (struct timerequest)); + if (timer_io) { + if (OpenDevice("timer.device", UNIT_MICROHZ, (struct IORequest *)timer_io, 0)) { + printf("Warning: can't open timer device\n"); + DeleteExtIO((struct IORequest *) timer_io); + DeletePort(timerMsgPort); + timer_io = NULL; + timerMsgPort = NULL; + ret = 1; + } else { + timer_io->tr_node.io_Command = TR_ADDREQUEST; + timer_io->tr_time.tv_micro = 0; + } + } else { + printf("Warning: can't create timer request\n"); + DeletePort(timerMsgPort); + timerMsgPort = NULL; + ret = 1; + } + } else { + printf("Warning: can't create timer port\n"); + ret = 1; + } + } + return (ret); +} + +LOCAL void +amiga_close_timer() +{ + if (timer_io) { + if (ami_debug) + printf("closing timer\n"); + + AbortIO((struct IORequest *) timer_io); + WaitIO((struct IORequest *) timer_io); + CloseDevice((struct IORequest *)timer_io); + DeleteExtIO((struct IORequest *) timer_io); + DeletePort(timerMsgPort); + timer_io = NULL; + timerMsgPort = NULL; + } +} + +LOCAL int +amiga_get_scsi_bus(device) + char *device; +{ + int i; + char *tmp = strdup(device); + + strlwr(tmp); + for (i = 0; i <= last_bus; i++) { + if (strcmp(devs[i], tmp) == 0) { + return (i); + } + } + + if (amiga_find_device(tmp)) { + devs[i] = tmp; + last_bus = i; + return (i); + } + + return (-1); +} + +LOCAL int +amiga_find_device(device) + char *device; +{ + char tmp[256]; + struct Node *DeviceLibNode = SysBase->DeviceList.lh_Head; + + if (ami_debug) + printf("looking for %s ", device); + + Forbid(); + while (DeviceLibNode->ln_Succ) { + DeviceLibNode = DeviceLibNode->ln_Succ; + strcpy(tmp, DeviceLibNode->ln_Name); + strlwr(tmp); + if (strcmp(tmp, device) == 0) { + if (ami_debug) + printf(" ... found\n"); + return (1); + } + } + Permit(); + + if (ami_debug) + printf(" ... not found\n"); + + return (0); +} diff --git a/scsilib/libscg/scsi-apollo.c b/scsilib/libscg/scsi-apollo.c new file mode 100644 index 0000000..64a3725 --- /dev/null +++ b/scsilib/libscg/scsi-apollo.c @@ -0,0 +1,568 @@ +/* @(#)scsi-apollo.c 1.5 04/01/14 Copyright 1997,2000 J. Schilling */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-apollo.c 1.5 04/01/14 Copyright 1997,2000 J. Schilling"; +#endif +/* + * Code to support Apollo Domain/OS 10.4.1 + * + * Copyright (c) 1997,2000 J. Schilling + * Apollo support code written by Paul Walker. + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <apollo/base.h> +#include <apollo/scsi.h> +#include <assert.h> +#define DomainScsiTimeout 100000 + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-apollo.c-1.5"; /* The version for this transport */ + + +#define MAX_SCG 1 /* Max # of SCSI controllers */ +#define MAX_TGT 1 /* Max # of SCSI targets */ +#define MAX_LUN 1 /* Max # of SCSI logical units */ + +struct scg_local { + scsi_$handle_t handle; + unsigned char *DomainSensePointer; + short scgfiles[MAX_SCG][MAX_TGT][MAX_LUN]; +}; + +#define scglocal(p) ((struct scg_local *)((p)->local)) + +#ifndef SG_MAX_SENSE +#define SG_MAX_SENSE 16 /* Too small for CCS / SCSI-2 */ +#endif /* But cannot be changed */ + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return ("Paul Walker"); + case SCG_SCCS_ID: + return (__sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "scsi_$do_command_2", "SCSI transport from Apollo DomainOS drivers", + "", "DomainOS driver name", "A DomainOS device node name", FALSE, TRUE); + return (0); +} + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + register int nopen = 0; + status_$t status; + + if (scgp->debug > 1) + printf("Entered scsi_open, scgp=%p, device='%s'\n", scgp, device); + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + } + if (device == NULL || *device == '\0') { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, "Must give device name"); + return (0); + } + + scsi_$acquire(device, strlen(device), &scglocal(scgp)->handle, &status); + if (status.all) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, "Cannot open '%s', status %08x", device, status.all); + return (0); + } + /* + * Allocate the sense buffer + */ + scglocal(scgp)->DomainSensePointer = (Uchar *)valloc((size_t) (SCG_MAX_SENSE + getpagesize())); + assert(status.all == 0); + /* + * Wire the sense buffer + */ + scsi_$wire(scglocal(scgp)->handle, (caddr_t)(scglocal(scgp)->DomainSensePointer), SCG_MAX_SENSE, &status); + assert(status.all == 0); + + if (scglocal(scgp)->scgfiles[0][0][0] == -1) + scglocal(scgp)->scgfiles[0][0][0] = 1; + scg_settarget(scgp, 0, 0, 0); + return (++nopen); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + status_$t status; + + if (scgp->debug > 1) + printf("Entering scsi_close\n"); + scsi_$release(scglocal(scgp)->handle, &status); + /* + * should also unwire the sense buffer + */ + return (status.all); +} + + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + status_$t status; + scsi_$info_t info; + + scsi_$get_info(scglocal(scgp)->handle, sizeof (info), &info, &status); + if (status.all) { + /* + * Should have some better error handling here + */ + printf("scsi_$get_info returned %08x\n", status.all); + return (0); + } + return (info.max_xfer); +} + + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + void *ret; + + if (scgp->debug > 1) + printf("scsi_getbuf: %ld bytes\n", amt); + ret = valloc((size_t)amt); + if (ret == NULL) + return (ret); + scgp->bufbase = ret; + return (ret); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->debug > 1) + printf("Entering scsi_freebuf\n"); + + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + register int t; + register int l; + + if (scgp->debug > 1) + printf("Entered scsi_havebus: scgp=%p, busno=%d\n", scgp, busno); + + if (busno < 0 || busno >= MAX_SCG) + return (FALSE); + + if (scgp->local == NULL) + return (FALSE); + + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + if (scglocal(scgp)->scgfiles[busno][t][l] >= 0) + return (TRUE); + } + return (FALSE); +} + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (scgp->debug > 1) + printf("Entered scsi_fileno: scgp=%p, busno=%d, tgt=%d, tlun=%d\n", scgp, busno, tgt, tlun); + if (busno < 0 || busno >= MAX_SCG || + tgt < 0 || tgt >= MAX_TGT || + tlun < 0 || tlun >= MAX_LUN) + return (-1); + + if (scgp->local == NULL) + return (-1); + if (scgp->debug > 1) + printf("exiting scsi_fileno, returning %d\n", scglocal(scgp)->scgfiles[busno][tgt][tlun]); + return ((int) scglocal(scgp)->scgfiles[busno][tgt][tlun]); +} + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + if (scgp->debug > 1) + printf("Entering scsi_initiator\n"); + + return (-1); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; +{ + return (FALSE); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + status_$t status; + + if (scgp->debug > 0) + printf("Entering scsi_reset\n"); + + if (what == SCG_RESET_NOP) + return (0); + + if (what == SCG_RESET_TGT) { + scsi_$reset_device(scglocal(scgp)->handle, &status); + if (status.all) + printf("Error - scsi_$reset_device failed, status is 0x%08x\n", status.all); + return (status.all); + } else { + errno = EINVAL; + return (-1); + } +} + +LOCAL void +scsi_do_sense(scgp, sp) + SCSI *scgp; + struct scg_cmd *sp; +{ + scsi_$op_status_t op_status; + static scsi_$cdb_t sense_cdb; + static linteger sense_cdb_size; + static linteger sense_buffer_size; + static scsi_$operation_id_t sense_op_id; + static status_$t sense_status; + static pinteger sense_return_count; + int i; + + /* + * Issue the sense command (wire, issue, wait, unwire + */ + sense_buffer_size = sp->sense_len; + sense_cdb_size = SC_G0_CDBLEN; + memset(sense_cdb.all, 0, sense_cdb_size); /* Assuming Apollo sense */ + /* structure is correct */ + /* size */ + sense_cdb.g0.cmd = SC_REQUEST_SENSE; + sense_cdb.g0.lun = sp->cdb.g0_cdb.lun; + sense_cdb.g0.len = sp->sense_len; + scsi_$do_command_2(scglocal(scgp)->handle, sense_cdb, sense_cdb_size, (caddr_t) (scglocal(scgp)->DomainSensePointer), sense_buffer_size, scsi_read, &sense_op_id, &sense_status); + if (sense_status.all) { + printf("Error executing sense command, status is 0x%08x\n", sense_status.all); + } + scsi_$wait(scglocal(scgp)->handle, DomainScsiTimeout, true, sense_op_id, 1, &op_status, &sense_return_count, &sense_status); + /* + * Print the sense information if debug is on, or if the information is + * "unusual" + */ + if (scgp->debug > 0 || + /* + * I don't prinqqt info for sense codes 0, 2, 5, 6 because + * they aren't interesting + */ + (((u_char *) scglocal(scgp)->DomainSensePointer)[2] == 1) || + (((u_char *) scglocal(scgp)->DomainSensePointer)[2] == 3) || + (((u_char *) scglocal(scgp)->DomainSensePointer)[2] == 4) || + (((u_char *) scglocal(scgp)->DomainSensePointer)[2] >= 7)) { + printf(" Sense dump:\n"); + for (i = 0; i < sp->sense_len; i++) + printf(" %02x", ((u_char *) scglocal(scgp)->DomainSensePointer)[i]); + printf("\n"); + } + if (((u_char *) scglocal(scgp)->DomainSensePointer)[2] == 5) { + /* + * Illegal command + */ + printf("Illegal command detected, ASC=0x%02x, ASQ=0x%02x\n", ((u_char *) scglocal(scgp)->DomainSensePointer)[12], ((u_char *) scglocal(scgp)->DomainSensePointer)[13]); + } + /* + * Copy the sense information to the driver + */ + memcpy(sp->u_sense.cmd_sense, scglocal(scgp)->DomainSensePointer, sp->sense_len); + sp->sense_count = sp->sense_len; +} + + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + linteger buffer_length; + linteger cdb_len; + scsi_$operation_id_t operation; + scsi_$wait_index_t wait_index; + scsi_$op_status_t op_status; + pinteger return_count; + status_$t status; + char *ascii_wait_status; + int i; + struct scg_cmd *sp = scgp->scmd; + + if (scgp->fd < 0) { + sp->error = SCG_FATAL; + return (0); + } + + if (scgp->debug > 0) { + printf("Entered scgo_send, scgp=%p, sp=%p\n", scgp, sp); + printf("scgcmd dump:\n"); + printf(" addr=%p\n", sp->addr); + printf(" size=0x%x\n", sp->size); + printf(" flags=0x%x\n", sp->flags); + printf(" cdb_len=%d\n", sp->cdb_len); + printf(" sense_len=%d\n", sp->sense_len); + printf(" timeout=%d\n", sp->timeout); + printf(" kdebug=%d\n", sp->kdebug); + printf(" CDB:"); + for (i = 0; i < sp->cdb_len; i++) + printf(" %02x", sp->cdb.cmd_cdb[i]); + printf("\n"); + } + + /* + * Assume complete transfer, so residual count = 0 + */ + sp->resid = 0; + buffer_length = sp->size; + if (sp->addr) { + if (scgp->debug > 0) + printf(" wiring 0x%x bytes at 0x%x\n", buffer_length, sp->addr); + scsi_$wire(scglocal(scgp)->handle, sp->addr, buffer_length, &status); + if (status.all) { + /* + * Need better error handling + */ + printf("scsi_$wire failed, 0x%08x\n", status.all); + } + } + cdb_len = sp->cdb_len; + scsi_$do_command_2(scglocal(scgp)->handle, /* device handle*/ + *(scsi_$cdb_t *) &(sp->cdb.cmd_cdb[0]), /* SCSI CDB */ + cdb_len, /* CDB len */ + sp->addr, /* DMA buf */ + buffer_length, /* DMA len */ + (sp->flags & SCG_RECV_DATA) ? scsi_read : scsi_write, + &operation, /* OP ID */ + &status); /* Status ret */ + + if (status.all) { + /* + * Need better error handling + */ + printf("scsi_$do_command failed, 0x%08x\n", status.all); + sp->error = SCG_FATAL; + sp->ux_errno = EIO; + return (0); + } else if (scgp->debug > 0) { + printf("Command submitted, operation=0x%x\n", operation); + } + wait_index = scsi_$wait(scglocal(scgp)->handle, /* device handle*/ + sp->timeout * 1000, /* timeout */ + 0, /* async enable */ + operation, /* OP ID */ + 1, /* max count */ + &op_status, /* status list */ + &return_count, /* count ret */ + &status); /* Status ret */ + if (status.all) { + /* + * Need better error handling + */ + printf("scsi_$wait failed, 0x%08x\n", status.all); + sp->error = SCG_FATAL; + sp->ux_errno = EIO; + return (0); + } else { + if (scgp->debug > 0) { + printf("wait_index=%d, return_count=%d, op_status: op=0x%x, cmd_status=0x%x, op_status=0x%x\n", + wait_index, return_count, op_status.op, op_status.cmd_status, op_status.op_status); + } + switch (wait_index) { + + case scsi_device_advance: + ascii_wait_status = "scsi_device_advance"; + break; + case scsi_timeout: + ascii_wait_status = "scsi_timeout"; + break; + case scsi_async_fault: + ascii_wait_status = "scsi_async_fault"; + break; + default: + ascii_wait_status = "unknown"; + break; + } + /* + * See if the scsi_$wait terminated "abnormally" + */ + if (wait_index != scsi_device_advance) { + printf("scsi_$wait terminated abnormally, status='%s'\n", ascii_wait_status); + sp->error = SCG_FATAL; + sp->ux_errno = EIO; + return (0); + } + /* + * Normal termination, what's the scoop? + */ + assert(return_count == 1); + switch (op_status.cmd_status.all) { + + case status_$ok: + switch (op_status.op_status) { + + case scsi_good_status: + sp->error = SCG_NO_ERROR; + sp->ux_errno = 0; + break; + case scsi_busy: + sp->error = SCG_NO_ERROR; + sp->ux_errno = 0; + break; + case scsi_check_condition: + if (scgp->debug > 0) + printf("SCSI ERROR - CheckCondition\n"); + scsi_do_sense(scgp, sp); + /* + * If this was a media error, then call it retryable, + * instead of no error + */ + if ((((u_char *) scglocal(scgp)->DomainSensePointer)[0] == 0xf0) && + (((u_char *) scglocal(scgp)->DomainSensePointer)[2] == 0x03)) { + if (scgp->debug > 0) + printf(" (retryable)\n"); + sp->error = SCG_RETRYABLE; + sp->ux_errno = EIO; + } else { + /* printf(" (no error)\n"); */ + sp->error = SCG_NO_ERROR; + sp->ux_errno = 0; + } + break; + default: + /* + * I fault out in this case because I want to know + * about this error, and this guarantees that it will + * get attention. + */ + printf("Unhandled Domain/OS op_status error: status=%08x\n", + op_status.op_status); + exit(EXIT_FAILURE); + } + break; + /* + * Handle recognized error conditions by copying the error + * code over + */ + case scsi_$operation_timeout: + printf("SCSI ERROR - Timeout\n"); + scsi_do_sense(scgp, sp); + sp->error = SCG_TIMEOUT; + sp->ux_errno = EIO; + break; + case scsi_$dma_underrun: + /* + * This condition seems to occur occasionaly. I no longer + * complain because it doesn't seem to matter. + */ + if (scgp->debug > 0) + printf("SCSI ERROR - Underrun\n"); + scsi_do_sense(scgp, sp); + sp->resid = sp->size; /* We don't have the right number */ + sp->error = SCG_RETRYABLE; + sp->ux_errno = EIO; + break; + case scsi_$hdwr_failure: /* received when both scanners were active */ + printf("SCSI ERROR - Hardware Failure\n"); + scsi_do_sense(scgp, sp); + sp->error = SCG_RETRYABLE; + sp->ux_errno = EIO; + break; + default: + printf("\nUnhandled Domain/OS cmd_status error: status=%08x\n", op_status.cmd_status.all); + error_$print(op_status.cmd_status); + exit(EXIT_FAILURE); + } + } + if (sp->addr) { + if (scgp->debug > 0) + printf(" unwiring buffer\n"); + scsi_$unwire(scglocal(scgp)->handle, sp->addr, buffer_length, sp->flags & SCG_RECV_DATA, &status); + if (status.all) { + /* + * Need better error handling + */ + printf("scsi_$unwire failed, 0x%08x\n", status.all); + sp->error = SCG_FATAL; + sp->ux_errno = EIO; + return (0); + } + } + return (0); +} diff --git a/scsilib/libscg/scsi-beos.c b/scsilib/libscg/scsi-beos.c new file mode 100644 index 0000000..e5ffb6a --- /dev/null +++ b/scsilib/libscg/scsi-beos.c @@ -0,0 +1,398 @@ +/* @(#)scsi-beos.c 1.22 04/01/15 Copyright 1998 J. Schilling */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-beos.c 1.22 04/01/15 Copyright 1998 J. Schilling"; +#endif +/* + * Interface for the BeOS user-land raw SCSI implementation. + * + * This is a hack, that tries to emulate the functionality + * of the scg driver. + * + * First version done by swetland@be.com + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1998 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-beos.c-1.22"; /* The version for this transport*/ + +/* + * There are also defines for: + * B_BEOS_VERSION_4 + * B_BEOS_VERSION_4_5 + * + * in BeOS 5 + */ +#ifndef B_BEOS_VERSION_5 +/* + * New BeOS seems to include <be/kernel/OS.h> from device/scsi.h + */ + +/* nasty hack to avoid broken def of bool in SupportDefs.h */ +#define _SUPPORT_DEFS_H + +#ifndef _SYS_TYPES_H +typedef unsigned long ulong; +typedef unsigned int uint; +typedef unsigned short ushort; +#endif /* _SYS_TYPES_H */ + +#include <BeBuild.h> +#include <sys/types.h> +#include <Errors.h> + + +/*-------------------------------------------------------------*/ +/*----- Shorthand type formats --------------------------------*/ + +typedef signed char int8; +typedef unsigned char uint8; +typedef volatile signed char vint8; +typedef volatile unsigned char vuint8; + +typedef short int16; +typedef unsigned short uint16; +typedef volatile short vint16; +typedef volatile unsigned short vuint16; + +typedef long int32; +typedef unsigned long uint32; +typedef volatile long vint32; +typedef volatile unsigned long vuint32; + +typedef long long int64; +typedef unsigned long long uint64; +typedef volatile long long vint64; +typedef volatile unsigned long long vuint64; + +typedef volatile long vlong; +typedef volatile int vint; +typedef volatile short vshort; +typedef volatile char vchar; + +typedef volatile unsigned long vulong; +typedef volatile unsigned int vuint; +typedef volatile unsigned short vushort; +typedef volatile unsigned char vuchar; + +typedef unsigned char uchar; +typedef unsigned short unichar; + + + +/*-------------------------------------------------------------*/ +/*----- Descriptive formats -----------------------------------*/ +typedef int32 status_t; +typedef int64 bigtime_t; +typedef uint32 type_code; +typedef uint32 perform_code; + +/* end nasty hack */ + +#endif /* ! B_BEOS_VERSION_5 */ + + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <sys/stat.h> +#include <scg/scgio.h> + +/* this is really really dumb (tm) */ +/*#undef sense*/ +/*#undef scb*/ +#include <device/scsi.h> + +#undef bool +#include <drivers/CAM.h> + +struct _fdmap_ { + struct _fdmap_ *next; + int bus; + int targ; + int lun; + int fd; +}; + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (__sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "CAM", "Generic transport independent SCSI (BeOS CAM variant)", + "", "bus,target,lun", "1,2,0", TRUE, FALSE); + return (0); +} + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + +#ifdef nonono + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno, target or lun '%d,%d,%d'", + busno, tgt, tlun); + return (-1); + } +#endif + + if ((device != NULL && *device != '\0') || (busno == -2 && tgt == -2)) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Open by 'devname' not supported on this OS"); + return (-1); + } + return (1); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + struct _fdmap_ *f; + struct _fdmap_ *fnext; + + for (f = (struct _fdmap_ *)scgp->local; f; f = fnext) { + scgp->local = 0; + fnext = f->next; + close(f->fd); + free(f); + } + return (0); +} + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + return (256*1024); +} + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_getbuf: %ld bytes\n", amt); + } + scgp->bufbase = malloc((size_t)(amt)); + return (scgp->bufbase); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + struct stat sb; + char buf[128]; + + if (busno < 8) + js_snprintf(buf, sizeof (buf), "/dev/bus/scsi/%d", busno); + else + js_snprintf(buf, sizeof (buf), "/dev/disk/ide/atapi/%d", busno-8); + if (stat(buf, &sb)) + return (FALSE); + return (TRUE); +} + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + struct _fdmap_ *f; + char buf[128]; + int fd; + + for (f = (struct _fdmap_ *)scgp->local; f; f = f->next) { + if (f->bus == busno && f->targ == tgt && f->lun == tlun) + return (f->fd); + } + if (busno < 8) { + js_snprintf(buf, sizeof (buf), + "/dev/bus/scsi/%d/%d/%d/raw", + busno, tgt, tlun); + } else { + char *tgtstr = (tgt == 0) ? "master" : (tgt == 1) ? "slave" : "dummy"; + js_snprintf(buf, sizeof (buf), + "/dev/disk/ide/atapi/%d/%s/%d/raw", + busno-8, tgtstr, tlun); + } + fd = open(buf, 0); + + if (fd >= 0) { + f = (struct _fdmap_ *) malloc(sizeof (struct _fdmap_)); + f->bus = busno; + f->targ = tgt; + f->lun = tlun; + f->fd = fd; + f->next = (struct _fdmap_ *)scgp->local; + scgp->local = f; + } + return (fd); +} + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + return (-1); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; +{ + /* + * XXX Should check for ATAPI + */ + return (-1); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + errno = EINVAL; + return (-1); +} + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + int e; + int scsi_error; + int cam_error; + raw_device_command rdc; + + if (scgp->fd < 0) { + sp->error = SCG_FATAL; + return (0); + } + + memcpy(rdc.command, &(sp->cdb), 12); + rdc.command_length = sp->cdb_len; + rdc.data = sp->addr; + rdc.data_length = sp->size; + rdc.sense_data_length = sp->sense_len; + rdc.sense_data = sp->u_sense.cmd_sense; + rdc.flags = sp->flags & SCG_RECV_DATA ? B_RAW_DEVICE_DATA_IN : 0; + rdc.timeout = sp->timeout * 1000000; + + if (scgp->debug > 0) { + error("SEND(%d): cmd %02x, cdb = %d, data = %d, sense = %d\n", + scgp->fd, rdc.command[0], rdc.command_length, + rdc.data_length, rdc.sense_data_length); + } + e = ioctl(scgp->fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof (rdc)); + sp->ux_errno = 0; + if (!e) { + cam_error = rdc.cam_status; + scsi_error = rdc.scsi_status; + if (scgp->debug > 0) + error("result: cam %02x scsi %02x\n", cam_error, scsi_error); + sp->u_scb.cmd_scb[0] = scsi_error; + + switch (cam_error) { + + case CAM_REQ_CMP: + sp->resid = 0; + sp->error = SCG_NO_ERROR; + break; + case CAM_REQ_CMP_ERR: + sp->sense_count = sp->sense_len; /* XXX */ + sp->error = SCG_RETRYABLE; + break; + default: + sp->error = SCG_FATAL; + } + } else { + sp->error = SCG_FATAL; + } + return (0); +} diff --git a/scsilib/libscg/scsi-bsd-os.c b/scsilib/libscg/scsi-bsd-os.c new file mode 100644 index 0000000..f788bce --- /dev/null +++ b/scsilib/libscg/scsi-bsd-os.c @@ -0,0 +1,464 @@ +/* @(#)scsi-bsd-os.c 1.28 04/01/15 Copyright 1997 J. Schilling */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-bsd-os.c 1.28 04/01/15 Copyright 1997 J. Schilling"; +#endif +/* + * Interface for the BSD/OS user-land raw SCSI implementation. + * + * This is a hack, that tries to emulate the functionality + * of the scg driver. + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1997 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#undef sense + +#define scsi_sense bsdi_scsi_sense +#define scsi_inquiry bsdi_scsi_inquiry + +/* + * Must use -I/sys... + * The next two files are in /sys/dev/scsi + */ +#include <dev/scsi/scsi.h> +#include <dev/scsi/scsi_ioctl.h> + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-bsd-os.c-1.28"; /* The version for this transport*/ + +#define MAX_SCG 16 /* Max # of SCSI controllers */ +#define MAX_TGT 16 +#define MAX_LUN 8 + +struct scg_local { + short scgfiles[MAX_SCG][MAX_TGT][MAX_LUN]; +}; +#define scglocal(p) ((struct scg_local *)((p)->local)) + +#include <machine/param.h> + +#define MAX_DMA_BSDI MAXPHYS /* More makes problems */ + + +LOCAL BOOL scg_setup __PR((SCSI *scgp, int f, int busno, int tgt, int tlun)); + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (__sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "SCSIRAWCDB", "Generic SCSI for devices known by BSDi", + "", "devname:@,lun", "/dev/rsr0a:@,0", FALSE, TRUE); + return (0); +} + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + register int f; + register int b; + register int t; + register int l; + register int nopen = 0; + char devname[64]; + + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno, target or lun '%d,%d,%d'", + busno, tgt, tlun); + return (-1); + } + + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + scglocal(scgp)->scgfiles[b][t][l] = (short)-1; + } + } + } + + if ((device != NULL && *device != '\0') || (busno == -2 && tgt == -2)) + goto openbydev; + + if (busno >= 0 && tgt >= 0 && tlun >= 0) { + + js_snprintf(devname, sizeof (devname), + "/dev/su%d-%d-%d", busno, tgt, tlun); + f = open(devname, O_RDWR|O_NONBLOCK); + if (f < 0) { + goto openbydev; + } + scglocal(scgp)->scgfiles[busno][tgt][tlun] = f; + return (1); + + } else for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + js_snprintf(devname, sizeof (devname), + "/dev/su%d-%d-%d", b, t, l); + f = open(devname, O_RDWR|O_NONBLOCK); +/* error("open (%s) = %d\n", devname, f);*/ + + if (f < 0) { + if (errno != ENOENT && + errno != ENXIO && + errno != ENODEV) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '%s'", + devname); + return (0); + } + } else { + if (scg_setup(scgp, f, b, t, l)) + nopen++; + } + } + } + } + /* + * Could not open /dev/su-* or got dev=devname:b,l,l / dev=devname:@,l + * We do the apropriate tests and try our best. + */ +openbydev: + if (nopen == 0) { + if (device == NULL || device[0] == '\0') + return (0); + f = open(device, O_RDWR|O_NONBLOCK); + if (f < 0) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '%s'", + device); + return (0); + } + if (tlun == -2) { /* If 'lun' is not known, we reject */ + close(f); + errno = EINVAL; + return (0); + } + busno = 0; /* use fake number, we cannot get it */ + tgt = 0; /* use fake number, we cannot get it */ + scg_settarget(scgp, busno, tgt, tlun); + /* 'lun' has been specified on command line */ + if (scg_setup(scgp, f, busno, tgt, tlun)) + nopen++; + } + return (nopen); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + register int f; + register int b; + register int t; + register int l; + + if (scgp->local == NULL) + return (-1); + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + f = scglocal(scgp)->scgfiles[b][t][l]; + if (f >= 0) + close(f); + scglocal(scgp)->scgfiles[b][t][l] = (short)-1; + } + } + } + return (0); +} + +LOCAL BOOL +scg_setup(scgp, f, busno, tgt, tlun) + SCSI *scgp; + int f; + int busno; + int tgt; + int tlun; +{ + int Bus; + int Target; + int Lun; + BOOL onetarget = FALSE; + + if (scg_scsibus(scgp) >= 0 && scg_target(scgp) >= 0 && scg_lun(scgp) >= 0) + onetarget = TRUE; + + /* + * Unfortunately there is no way to get the right values from kernel. + */ + Bus = busno; + Target = tgt; + Lun = tlun; + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "Bus: %d Target: %d Lun: %d\n", Bus, Target, Lun); + } + + if (Bus >= MAX_SCG || Target >= MAX_TGT || Lun >= MAX_LUN) { + close(f); + return (FALSE); + } + + if (scglocal(scgp)->scgfiles[Bus][Target][Lun] == (short)-1) + scglocal(scgp)->scgfiles[Bus][Target][Lun] = (short)f; + + if (onetarget) { + if (Bus == busno && Target == tgt && Lun == tlun) { + return (TRUE); + } else { + scglocal(scgp)->scgfiles[Bus][Target][Lun] = (short)-1; + close(f); + } + } + return (FALSE); +} + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + long maxdma = MAX_DMA_BSDI; + + return (maxdma); +} + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_getbuf: %ld bytes\n", amt); + } + scgp->bufbase = malloc((size_t)(amt)); + return (scgp->bufbase); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + register int t; + register int l; + + if (busno < 0 || busno >= MAX_SCG) + return (FALSE); + + if (scgp->local == NULL) + return (FALSE); + + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + if (scglocal(scgp)->scgfiles[busno][t][l] >= 0) + return (TRUE); + } + return (FALSE); +} + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (busno < 0 || busno >= MAX_SCG || + tgt < 0 || tgt >= MAX_TGT || + tlun < 0 || tlun >= MAX_LUN) + return (-1); + + if (scgp->local == NULL) + return (-1); + + return ((int)scglocal(scgp)->scgfiles[busno][tgt][tlun]); +} + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + return (-1); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; +{ + return (FALSE); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + /* + * Cannot reset on BSD/OS + */ + errno = EINVAL; + return (-1); +} + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + scsi_user_cdb_t suc; + int ret = 0; + +/* js_fprintf((FILE *)scgp->errfile, "f: %d\n", f);*/ + if (scgp->fd < 0) { + sp->error = SCG_FATAL; + return (0); + } + + /* Zero the structure... */ + fillbytes(&suc, sizeof (suc), '\0'); + + /* Read or write? */ + if (sp->flags & SCG_RECV_DATA) { + suc.suc_flags |= SUC_READ; + } else if (sp->size > 0) { + suc.suc_flags |= SUC_WRITE; + } + + suc.suc_timeout = sp->timeout; + + suc.suc_cdblen = sp->cdb_len; + movebytes(sp->cdb.cmd_cdb, suc.suc_cdb, suc.suc_cdblen); + + suc.suc_datalen = sp->size; + suc.suc_data = sp->addr; + + if (ioctl(scgp->fd, SCSIRAWCDB, &suc) < 0) { + ret = -1; + sp->ux_errno = geterrno(); + if (sp->ux_errno != ENOTTY) + ret = 0; + } else { + sp->ux_errno = 0; + if (suc.suc_sus.sus_status != STS_GOOD) + sp->ux_errno = EIO; + } + fillbytes(&sp->scb, sizeof (sp->scb), '\0'); + fillbytes(&sp->u_sense.cmd_sense, sizeof (sp->u_sense.cmd_sense), '\0'); +#if 0 + /* + * Unfortunalety, BSD/OS has no idea of DMA residual count. + */ + sp->resid = req.datalen - req.datalen_used; + sp->sense_count = req.senselen_used; +#else + sp->resid = 0; + sp->sense_count = sizeof (suc.suc_sus.sus_sense); +#endif + if (sp->sense_count > SCG_MAX_SENSE) + sp->sense_count = SCG_MAX_SENSE; + movebytes(suc.suc_sus.sus_sense, sp->u_sense.cmd_sense, sp->sense_count); + sp->u_scb.cmd_scb[0] = suc.suc_sus.sus_status; + + switch (suc.suc_sus.sus_status) { + + case STS_GOOD: + sp->error = SCG_NO_ERROR; break; + case STS_CMD_TERMINATED:sp->error = SCG_TIMEOUT; break; + case STS_BUSY: sp->error = SCG_RETRYABLE; break; + case STS_CHECKCOND: sp->error = SCG_RETRYABLE; break; + case STS_QUEUE_FULL: sp->error = SCG_RETRYABLE; break; + default: sp->error = SCG_FATAL; break; + } + + return (ret); +} + +#define sense u_sense.Sense + +#undef scsi_sense +#undef scsi_inquiry diff --git a/scsilib/libscg/scsi-bsd.c b/scsilib/libscg/scsi-bsd.c new file mode 100644 index 0000000..334661b --- /dev/null +++ b/scsilib/libscg/scsi-bsd.c @@ -0,0 +1,1040 @@ +/* @(#)scsi-bsd.c 1.42 04/01/15 Copyright 1997 J. Schilling */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-bsd.c 1.42 04/01/15 Copyright 1997 J. Schilling"; +#endif +/* + * Interface for the NetBSD/FreeBSD/OpenBSD generic SCSI implementation. + * + * This is a hack, that tries to emulate the functionality + * of the scg driver. + * The SCSI tranport of the generic *BSD implementation is very + * similar to the SCSI command transport of the + * 6 years older scg driver. + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1997 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef HAVE_CAMLIB_H + +#undef sense +#include <sys/scsiio.h> + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-bsd.c-1.42"; /* The version for this transport*/ + +#define MAX_SCG 16 /* Max # of SCSI controllers */ +#define MAX_TGT 16 +#define MAX_LUN 8 + +struct scg_local { + short scgfiles[MAX_SCG][MAX_TGT][MAX_LUN]; +}; +#define scglocal(p) ((struct scg_local *)((p)->local)) + +/*#define MAX_DMA_BSD (32*1024)*/ +#define MAX_DMA_BSD (60*1024) /* More seems to make problems */ + +#if defined(__NetBSD__) && defined(TYPE_ATAPI) +/* + * NetBSD 1.3 has a merged SCSI/ATAPI system, so this structure + * is slightly different. + */ +#define MAYBE_ATAPI +#define SADDR_ISSCSI(a) ((a).type == TYPE_SCSI) + +#define SADDR_BUS(a) (SADDR_ISSCSI(a)?(a).addr.scsi.scbus:(MAX_SCG-1)) +#define SADDR_TARGET(a) (SADDR_ISSCSI(a)?(a).addr.scsi.target:(a).addr.atapi.atbus*2+(a).addr.atapi.drive) +#define SADDR_LUN(a) (SADDR_ISSCSI(a)?(a).addr.scsi.lun:0) +#else + +#if defined(__OpenBSD__) && defined(TYPE_ATAPI) +#define SADDR_ISSCSI(a) ((a).type == TYPE_SCSI) +#else +#define SADDR_ISSCSI(a) (1) +#endif + +#define SADDR_BUS(a) (a).scbus +#define SADDR_TARGET(a) (a).target +#define SADDR_LUN(a) (a).lun +#endif /* __NetBSD__ && TYPE_ATAPI */ + +LOCAL BOOL scg_setup __PR((SCSI *scgp, int f, int busno, int tgt, int tlun)); + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (__sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "SCIOCCOMMAND", "SCSI for devices known by *BSD", + "", "device or bus,target,lun", "/dev/rcd0a:@ or 1,2,0", FALSE, TRUE); + return (0); +} + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + register int f; + register int b; + register int t; + register int l; + register int nopen = 0; + char devname[64]; + + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno, target or lun '%d,%d,%d'", + busno, tgt, tlun); + return (-1); + } + + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + scglocal(scgp)->scgfiles[b][t][l] = (short)-1; + } + } + } + + if ((device != NULL && *device != '\0') || (busno == -2 && tgt == -2)) + goto openbydev; + + if (busno >= 0 && tgt >= 0 && tlun >= 0) { + + js_snprintf(devname, sizeof (devname), + "/dev/su%d-%d-%d", busno, tgt, tlun); + f = open(devname, O_RDWR); + if (f < 0) { + goto openbydev; + } + scglocal(scgp)->scgfiles[busno][tgt][tlun] = f; + return (1); + + } else for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + js_snprintf(devname, sizeof (devname), + "/dev/su%d-%d-%d", b, t, l); + f = open(devname, O_RDWR); +/* error("open (%s) = %d\n", devname, f);*/ + + if (f < 0) { + if (errno != ENOENT && + errno != ENXIO && + errno != ENODEV) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '%s'", + devname); + return (0); + } + } else { + if (scg_setup(scgp, f, b, t, l)) + nopen++; + } + } + } + } + /* + * Could not open /dev/su-* or got dev=devname:b,l,l / dev=devname:@,l + * We do the apropriate tests and try our best. + */ +openbydev: + if (nopen == 0) { + struct scsi_addr saddr; + + if (device == NULL || device[0] == '\0') + return (0); + f = open(device, O_RDWR); + if (f < 0) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '%s'", + device); + return (0); + } + if (tgt == -2) { + if (ioctl(f, SCIOCIDENTIFY, &saddr) < 0) { + close(f); + errno = EINVAL; + return (0); + } + busno = SADDR_BUS(saddr); + tgt = SADDR_TARGET(saddr); + if ((tlun >= 0) && (tlun != SADDR_LUN(saddr))) { + close(f); + errno = EINVAL; + return (0); + } + tlun = SADDR_LUN(saddr); + scg_settarget(scgp, busno, tgt, tlun); + } + if (scg_setup(scgp, f, busno, tgt, tlun)) + nopen++; + } + return (nopen); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + register int f; + register int b; + register int t; + register int l; + + if (scgp->local == NULL) + return (-1); + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + f = scglocal(scgp)->scgfiles[b][t][l]; + if (f >= 0) + close(f); + scglocal(scgp)->scgfiles[b][t][l] = (short)-1; + } + } + } + return (0); +} + +LOCAL BOOL +scg_setup(scgp, f, busno, tgt, tlun) + SCSI *scgp; + int f; + int busno; + int tgt; + int tlun; +{ + struct scsi_addr saddr; + int Bus; + int Target; + int Lun; + BOOL onetarget = FALSE; + + if (scg_scsibus(scgp) >= 0 && scg_target(scgp) >= 0 && scg_lun(scgp) >= 0) + onetarget = TRUE; + + if (ioctl(f, SCIOCIDENTIFY, &saddr) < 0) { + errmsg("Cannot get SCSI addr.\n"); + close(f); + return (FALSE); + } + Bus = SADDR_BUS(saddr); + Target = SADDR_TARGET(saddr); + Lun = SADDR_LUN(saddr); + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "Bus: %d Target: %d Lun: %d\n", Bus, Target, Lun); + } + + if (Bus >= MAX_SCG || Target >= MAX_TGT || Lun >= MAX_LUN) { + close(f); + return (FALSE); + } + + if (scglocal(scgp)->scgfiles[Bus][Target][Lun] == (short)-1) + scglocal(scgp)->scgfiles[Bus][Target][Lun] = (short)f; + + if (onetarget) { + if (Bus == busno && Target == tgt && Lun == tlun) { + return (TRUE); + } else { + scglocal(scgp)->scgfiles[Bus][Target][Lun] = (short)-1; + close(f); + } + } + return (FALSE); +} + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + long maxdma = MAX_DMA_BSD; + + return (maxdma); +} + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_getbuf: %ld bytes\n", amt); + } + scgp->bufbase = valloc((size_t)(amt)); + return (scgp->bufbase); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + register int t; + register int l; + + if (busno < 0 || busno >= MAX_SCG) + return (FALSE); + + if (scgp->local == NULL) + return (FALSE); + + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + if (scglocal(scgp)->scgfiles[busno][t][l] >= 0) + return (TRUE); + } + return (FALSE); +} + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (busno < 0 || busno >= MAX_SCG || + tgt < 0 || tgt >= MAX_TGT || + tlun < 0 || tlun >= MAX_LUN) + return (-1); + + if (scgp->local == NULL) + return (-1); + + return ((int)scglocal(scgp)->scgfiles[busno][tgt][tlun]); +} + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + return (-1); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; + +{ +#ifdef MAYBE_ATAPI + struct scsi_addr saddr; + + if (ioctl(scgp->fd, SCIOCIDENTIFY, &saddr) < 0) + return (-1); + + if (!SADDR_ISSCSI(saddr)) + return (TRUE); +#endif + return (FALSE); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + if (what == SCG_RESET_NOP) + return (0); + if (what != SCG_RESET_BUS) { + errno = EINVAL; + return (-1); + } + /* + * XXX Does this reset TGT or BUS ??? + */ + return (ioctl(scgp->fd, SCIOCRESET, 0)); +} + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + scsireq_t req; + register long *lp1; + register long *lp2; + int ret = 0; + +/* js_fprintf((FILE *)scgp->errfile, "fd: %d\n", scgp->fd);*/ + if (scgp->fd < 0) { + sp->error = SCG_FATAL; + return (0); + } + req.flags = SCCMD_ESCAPE; /* We set the SCSI cmd len */ + if (sp->flags & SCG_RECV_DATA) + req.flags |= SCCMD_READ; + else if (sp->size > 0) + req.flags |= SCCMD_WRITE; + + req.timeout = sp->timeout * 1000; + lp1 = (long *)sp->cdb.cmd_cdb; + lp2 = (long *)req.cmd; + *lp2++ = *lp1++; + *lp2++ = *lp1++; + *lp2++ = *lp1++; + *lp2++ = *lp1++; + req.cmdlen = sp->cdb_len; + req.databuf = sp->addr; + req.datalen = sp->size; + req.datalen_used = 0; + fillbytes(req.sense, sizeof (req.sense), '\0'); + if (sp->sense_len > sizeof (req.sense)) + req.senselen = sizeof (req.sense); + else if (sp->sense_len < 0) + req.senselen = 0; + else + req.senselen = sp->sense_len; + req.senselen_used = 0; + req.status = 0; + req.retsts = 0; + req.error = 0; + + if (ioctl(scgp->fd, SCIOCCOMMAND, (void *)&req) < 0) { + ret = -1; + sp->ux_errno = geterrno(); + if (sp->ux_errno != ENOTTY) + ret = 0; + } else { + sp->ux_errno = 0; + if (req.retsts != SCCMD_OK) + sp->ux_errno = EIO; + } + fillbytes(&sp->scb, sizeof (sp->scb), '\0'); + fillbytes(&sp->u_sense.cmd_sense, sizeof (sp->u_sense.cmd_sense), '\0'); + sp->resid = req.datalen - req.datalen_used; + sp->sense_count = req.senselen_used; + if (sp->sense_count > SCG_MAX_SENSE) + sp->sense_count = SCG_MAX_SENSE; + movebytes(req.sense, sp->u_sense.cmd_sense, sp->sense_count); + sp->u_scb.cmd_scb[0] = req.status; + + switch (req.retsts) { + + case SCCMD_OK: +#ifdef BSD_SCSI_SENSE_BUG + sp->u_scb.cmd_scb[0] = 0; + sp->ux_errno = 0; +#endif + sp->error = SCG_NO_ERROR; break; + case SCCMD_TIMEOUT: sp->error = SCG_TIMEOUT; break; + default: + case SCCMD_BUSY: sp->error = SCG_RETRYABLE; break; + case SCCMD_SENSE: sp->error = SCG_RETRYABLE; break; + case SCCMD_UNKNOWN: sp->error = SCG_FATAL; break; + } + + return (ret); +} +#define sense u_sense.Sense + +#else /* BSD_CAM */ +/* + * Interface for the FreeBSD CAM passthrough device. + * + * Copyright (c) 1998 Michael Smith <msmith@freebsd.org> + * Copyright (c) 1998 Kenneth D. Merry <ken@kdm.org> + * Copyright (c) 1998 Joerg Schilling <schilling@fokus.gmd.de> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#undef sense +#define scsi_sense CAM_scsi_sense +#define scsi_inquiry CAM_scsi_inquiry +#include <sys/param.h> +#include <cam/cam.h> +#include <cam/cam_ccb.h> +#include <cam/scsi/scsi_message.h> +#include <cam/scsi/scsi_pass.h> +#include <camlib.h> + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-bsd.c-1.42"; /* The version for this transport*/ + +#define CAM_MAXDEVS 128 +struct scg_local { + struct cam_device *cam_devices[CAM_MAXDEVS + 1]; +}; +#define scglocal(p) ((struct scg_local *)((p)->local)) + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (__sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "CAM", "Generic transport independent SCSI (Common Access Method)", + "", "bus,target,lun", "1,2,0", TRUE, FALSE); + return (0); +} + +/* + * Build a list of everything we can find. + */ +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + char name[16]; + int unit; + int nopen = 0; + union ccb ccb; + int bufsize; + struct periph_match_pattern *match_pat; + int fd; + + if ((device != NULL && *device != '\0') || (busno == -2 && tgt == -2)) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Open by 'devname' not supported on this OS"); + return (-1); + } + + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + + for (unit = 0; unit <= CAM_MAXDEVS; unit++) { + scglocal(scgp)->cam_devices[unit] = (struct cam_device *)-1; + } + } + + + /* + * If we're not scanning the bus, just open one device. + */ + if (busno >= 0 && tgt >= 0 && tlun >= 0) { + scglocal(scgp)->cam_devices[0] = cam_open_btl(busno, tgt, tlun, O_RDWR, NULL); + if (scglocal(scgp)->cam_devices[0] == NULL) + return (-1); + nopen++; + return (nopen); + } + + /* + * First open the transport layer device. There's no point in the + * rest of this if we can't open it. + */ + + if ((fd = open(XPT_DEVICE, O_RDWR)) < 0) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Open of %s failed", XPT_DEVICE); + return (-1); + } + fillbytes(&ccb, sizeof (union ccb), '\0'); + + /* + * Get a list of up to CAM_MAXDEVS passthrough devices in the + * system. + */ + ccb.ccb_h.func_code = XPT_DEV_MATCH; + ccb.ccb_h.path_id = CAM_XPT_PATH_ID; + ccb.ccb_h.target_id = CAM_TARGET_WILDCARD; + ccb.ccb_h.target_lun = CAM_LUN_WILDCARD; + + /* + * Setup the result buffer. + */ + bufsize = sizeof (struct dev_match_result) * CAM_MAXDEVS; + ccb.cdm.match_buf_len = bufsize; + ccb.cdm.matches = (struct dev_match_result *)malloc(bufsize); + if (ccb.cdm.matches == NULL) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Couldn't malloc match buffer"); + close(fd); + return (-1); + } + ccb.cdm.num_matches = 0; + + /* + * Setup the pattern buffer. We're matching against all + * peripherals named "pass". + */ + ccb.cdm.num_patterns = 1; + ccb.cdm.pattern_buf_len = sizeof (struct dev_match_pattern); + ccb.cdm.patterns = (struct dev_match_pattern *)malloc( + sizeof (struct dev_match_pattern)); + if (ccb.cdm.patterns == NULL) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Couldn't malloc pattern buffer"); + close(fd); + free(ccb.cdm.matches); + return (-1); + } + ccb.cdm.patterns[0].type = DEV_MATCH_PERIPH; + match_pat = &ccb.cdm.patterns[0].pattern.periph_pattern; + js_snprintf(match_pat->periph_name, sizeof (match_pat->periph_name), + "pass"); + match_pat->flags = PERIPH_MATCH_NAME; + + if (ioctl(fd, CAMIOCOMMAND, &ccb) == -1) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "CAMIOCOMMAND ioctl failed"); + close(fd); + free(ccb.cdm.matches); + free(ccb.cdm.patterns); + return (-1); + } + + if ((ccb.ccb_h.status != CAM_REQ_CMP) || + ((ccb.cdm.status != CAM_DEV_MATCH_LAST) && + (ccb.cdm.status != CAM_DEV_MATCH_MORE))) { +/* errmsgno(EX_BAD, "Got CAM error 0x%X, CDM error %d.\n",*/ + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Got CAM error 0x%X, CDM error %d", + ccb.ccb_h.status, ccb.cdm.status); + close(fd); + free(ccb.cdm.matches); + free(ccb.cdm.patterns); + return (-1); + } + + free(ccb.cdm.patterns); + close(fd); + + for (unit = 0; unit < MIN(CAM_MAXDEVS, ccb.cdm.num_matches); unit++) { + struct periph_match_result *periph_result; + + /* + * We shouldn't have anything other than peripheral + * matches in here. If we do, it means an error in the + * device matching code in the transport layer. + */ + if (ccb.cdm.matches[unit].type != DEV_MATCH_PERIPH) { +/* errmsgno(EX_BAD, "Kernel error! got periph match type %d!!\n",*/ + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Kernel error! got periph match type %d!!", + ccb.cdm.matches[unit].type); + free(ccb.cdm.matches); + return (-1); + } + periph_result = &ccb.cdm.matches[unit].result.periph_result; + + js_snprintf(name, sizeof (name), + "/dev/%s%d", periph_result->periph_name, + periph_result->unit_number); + + /* + * cam_open_pass() avoids all lookup and translation from + * "regular device name" to passthrough unit number and + * just opens the device in question as a passthrough device. + */ + scglocal(scgp)->cam_devices[unit] = cam_open_pass(name, O_RDWR, NULL); + + /* + * If we get back NULL from the open routine, it wasn't + * able to open the given passthrough device for one reason + * or another. + */ + if (scglocal(scgp)->cam_devices[unit] == NULL) { +#ifdef OLD + errmsgno(EX_BAD, "Error opening /dev/%s%d\n", + periph_result->periph_name, + periph_result->unit_number); + errmsgno(EX_BAD, "%s\n", cam_errbuf); +#endif + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Error opening /dev/%s%d Cam error '%s'", + periph_result->periph_name, + periph_result->unit_number, + cam_errbuf); + break; + } + nopen++; + } + + free(ccb.cdm.matches); + return (nopen); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + register int i; + + if (scgp->local == NULL) + return (-1); + + for (i = 0; i <= CAM_MAXDEVS; i++) { + if (scglocal(scgp)->cam_devices[i] != (struct cam_device *)-1) + cam_close_device(scglocal(scgp)->cam_devices[i]); + scglocal(scgp)->cam_devices[i] = (struct cam_device *)-1; + } + return (0); +} + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ +#ifdef DFLTPHYS + return (DFLTPHYS); +#else + return (MAXPHYS); +#endif +} + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_getbuf: %ld bytes\n", amt); + } + scgp->bufbase = valloc((size_t)(amt)); + return (scgp->bufbase); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + int unit; + + if (scgp->local == NULL) + return (FALSE); + + /* + * There's a "cleaner" way to do this, using the matching code, but + * it would involve more code than this solution... + */ + for (unit = 0; scglocal(scgp)->cam_devices[unit] != (struct cam_device *)-1; unit++) { + if (scglocal(scgp)->cam_devices[unit] == NULL) + continue; + if (scglocal(scgp)->cam_devices[unit]->path_id == busno) + return (TRUE); + } + return (FALSE); +} + +LOCAL int +scgo_fileno(scgp, busno, unit, tlun) + SCSI *scgp; + int busno; + int unit; + int tlun; +{ + int i; + + if (scgp->local == NULL) + return (-1); + + for (i = 0; scglocal(scgp)->cam_devices[i] != (struct cam_device *)-1; i++) { + if (scglocal(scgp)->cam_devices[i] == NULL) + continue; + if ((scglocal(scgp)->cam_devices[i]->path_id == busno) && + (scglocal(scgp)->cam_devices[i]->target_id == unit) && + (scglocal(scgp)->cam_devices[i]->target_lun == tlun)) + return (i); + } + return (-1); +} + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + return (-1); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; +{ + return (FALSE); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + /* XXX synchronous reset command - is this wise? */ + errno = EINVAL; + return (-1); +} + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + struct cam_device *dev; + union ccb ccb_space; + union ccb *ccb = &ccb_space; + int rv, result; + u_int32_t ccb_flags; + + if (scgp->fd < 0) { +#if 0 + js_fprintf((FILE *)scgp->errfile, + "attempt to reference invalid unit %d\n", scgp->fd); +#endif + sp->error = SCG_FATAL; + return (0); + } + + dev = scglocal(scgp)->cam_devices[scgp->fd]; + fillbytes(&ccb->ccb_h, sizeof (struct ccb_hdr), '\0'); + ccb->ccb_h.path_id = dev->path_id; + ccb->ccb_h.target_id = dev->target_id; + ccb->ccb_h.target_lun = dev->target_lun; + + /* Build the CCB */ + fillbytes(&(&ccb->ccb_h)[1], sizeof (struct ccb_scsiio), '\0'); + movebytes(sp->cdb.cmd_cdb, &ccb->csio.cdb_io.cdb_bytes, sp->cdb_len); + + /* + * Set the data direction flags. + */ + if (sp->size != 0) { + ccb_flags = (sp->flags & SCG_RECV_DATA) ? CAM_DIR_IN : + CAM_DIR_OUT; + } else { + ccb_flags = CAM_DIR_NONE; + } + + ccb_flags |= CAM_DEV_QFRZDIS; + + /* + * If you don't want to bother with sending tagged commands under CAM, + * we don't need to do anything to cdrecord. If you want to send + * tagged commands to those devices that support it, we'll need to set + * the tag action valid field like this in scgo_send(): + * + * ccb_flags |= CAM_DEV_QFRZDIS | CAM_TAG_ACTION_VALID; + */ + + cam_fill_csio(&ccb->csio, + /* retries */ 1, + /* cbfncp */ NULL, + /* flags */ ccb_flags, + /* tag_action */ MSG_SIMPLE_Q_TAG, + /* data_ptr */ (u_int8_t *)sp->addr, + /* dxfer_len */ sp->size, + /* sense_len */ SSD_FULL_SIZE, + /* cdb_len */ sp->cdb_len, + /* timeout */ sp->timeout * 1000); + + /* Run the command */ + errno = 0; + if ((rv = cam_send_ccb(dev, ccb)) == -1) { + return (rv); + } else { + /* + * Check for command status. Selection timeouts are fatal. + * For command timeouts, we pass back the appropriate + * error. If we completed successfully, there's (obviously) + * no error. We declare anything else "retryable". + */ + switch (ccb->ccb_h.status & CAM_STATUS_MASK) { + case CAM_SEL_TIMEOUT: + result = SCG_FATAL; + break; + case CAM_CMD_TIMEOUT: + result = SCG_TIMEOUT; + break; + case CAM_REQ_CMP: + result = SCG_NO_ERROR; + break; + default: + result = SCG_RETRYABLE; + break; + } + } + + sp->error = result; + if (result != SCG_NO_ERROR) + sp->ux_errno = EIO; + + /* Pass the result back up */ + fillbytes(&sp->scb, sizeof (sp->scb), '\0'); + fillbytes(&sp->u_sense.cmd_sense, sizeof (sp->u_sense.cmd_sense), '\0'); + sp->resid = ccb->csio.resid; + sp->sense_count = SSD_FULL_SIZE - ccb->csio.sense_resid; + + /* + * Determine how much room we have for sense data. + */ + if (sp->sense_count > SCG_MAX_SENSE) + sp->sense_count = SCG_MAX_SENSE; + + /* Copy the sense data out */ + movebytes(&ccb->csio.sense_data, &sp->u_sense.cmd_sense, sp->sense_count); + + sp->u_scb.cmd_scb[0] = ccb->csio.scsi_status; + + return (0); +} + +#undef scsi_sense +#undef scsi_inquiry +#define sense u_sense.Sense + +#endif /* BSD_CAM */ diff --git a/scsilib/libscg/scsi-dos.c b/scsilib/libscg/scsi-dos.c new file mode 100644 index 0000000..4a1bfe5 --- /dev/null +++ b/scsilib/libscg/scsi-dos.c @@ -0,0 +1,582 @@ +/* @(#)scsi-dos.c 1.11 03/12/10 Copyright 1998-2003 J. Schilling, 2003 Alex Kopylov reanimatolog@yandex.ru */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-dos.c 1.11 03/12/10 Copyright 1998-2003 J. Schilling, 2003 Alex Kopylov reanimatolog@yandex.ru"; +#endif +/* + * Interface for the MS-DOS ASPI managers. + * You need ASPI manager installed in your config.sys: + * aspi*.sys for SCSI devices + * oakaspi.sys for ATAPI devices + * usbaspi.sys for USB devices + * + * Made from Win32 ASPI library template. + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1998-2003 J. Schilling + * Copyright (c) 1999 A.L. Faber for the first implementation + * of this interface. + * Copyright (c) 2003 Alex Kopylov reanimatolog@yandex.ru + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <dos.h> +#include <dpmi.h> +#include <go32.h> +#include <scg/aspi-dos.h> + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-dos.c-1.11"; /* The version for this transport*/ + +#define MAX_SCG 8 +#define MAX_TGT 8 +#define MAX_LUN 8 + +struct scg_local { + int dummy; +}; +#define scglocal(p) ((struct scg_local *)((p)->local)) + +#define MAX_DMA_DOS (63L*1024L) + +LOCAL BYTE busses = 1; +LOCAL DWORD SCSIMgrEntry = 0; +LOCAL int AspiLoaded = 0; + +LOCAL BOOL _callback_flag; +LOCAL _go32_dpmi_seginfo _callback_info; +LOCAL _go32_dpmi_registers _callback_regs; + +LOCAL BOOL SCSIMgrOpen __PR((SCSI *)); +LOCAL void SCSIMgrClose __PR((void)); +LOCAL int SCSIMgrSendSRB __PR((SRB *, time_t)); +LOCAL void SCSIMgrCallBack __PR((_go32_dpmi_registers *regs)); + +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (__sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "ASPI", "Generic transport independent SCSI", + "", "bus,target,lun", "1,2,0", TRUE, FALSE); + return (0); +} + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno, target or lun '%d,%d,%d'", + busno, tgt, tlun); + return (-1); + } + + if ((device != NULL && *device != '\0') || (busno == -2 && tgt == -2)) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Open by 'devname' not supported on this OS"); + return (-1); + } + + /* + * Check if variables are within the range + */ + if (tgt >= 0 && tgt >= 0 && tlun >= 0) { + /* + * This is the non -scanbus case. + */ + ; + } else if (tgt != -1 || tgt != -1 || tlun != -1) { + errno = EINVAL; + return (-1); + } + + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + } + /* + * Try to open ASPI-Router + */ + if (!SCSIMgrOpen(scgp)) + return (-1); + + /* + * More than we have ... + */ + if (busno >= busses) { + SCSIMgrClose(); + return (-1); + } + + /* + * Install Exit Function which closes the ASPI-Router + */ + atexit(SCSIMgrClose); + + /* + * Success after all + */ + return (1); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + SCSIMgrClose(); + return (0); +} + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + return (MAX_DMA_DOS); +} + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_getbuf: %ld bytes\n", amt); + } + scgp->bufbase = malloc((size_t)(amt)); + return (scgp->bufbase); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL __SBOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + if (busno < 0 || busno >= busses) + return (FALSE); + + return (TRUE); +} + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (busno < 0 || busno >= busses || + tgt < 0 || tgt >= MAX_TGT || + tlun < 0 || tlun >= MAX_LUN) + return (-1); + + /* + * Return fake + */ + return (1); +} + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + return (-1); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; +{ + return (-1); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + errno = EINVAL; + return (-1); +} + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + SRB Srb; + int dos_memory_data_seg; + int dos_memory_data_sel; + DWORD dos_memory_data_ptr; + + /* + * Check if ASPI library is loaded + */ + if (!SCSIMgrEntry) { + errmsgno(EX_BAD, "error in scgo_send: ASPI driver not loaded.\n"); + sp->error = SCG_FATAL; + return (-1); + } + + if (scgp->fd < 0) { + sp->error = SCG_FATAL; + return (0); + } + + /* + * Initialize variables + */ + sp->error = SCG_NO_ERROR; + sp->sense_count = 0; + sp->u_scb.cmd_scb[0] = 0; + sp->resid = 0; + + memset(&Srb, 0, sizeof (Srb)); + + switch (sp->cdb_len) { + + case 6: + movebytes(&sp->cdb, &(Srb.Type.ExecSCSICmd.CmdLen._6.CDBByte), sp->cdb_len); + break; + case 10: + movebytes(&sp->cdb, &(Srb.Type.ExecSCSICmd.CmdLen._10.CDBByte), sp->cdb_len); + break; + case 12: + movebytes(&sp->cdb, &(Srb.Type.ExecSCSICmd.CmdLen._12.CDBByte), sp->cdb_len); + break; + default: + sp->error = SCG_FATAL; + sp->ux_errno = EINVAL; + js_fprintf((FILE *)scgp->errfile, + "Unsupported sp->cdb_len: %u. Fatal error in scgo_send, exiting...\n", sp->cdb_len); + return (-1); + } + + if ((dos_memory_data_seg = __dpmi_allocate_dos_memory((sp->size>>4)+1, &dos_memory_data_sel)) == -1) { + sp->error = SCG_FATAL; + return (-1); + } + dos_memory_data_ptr = dos_memory_data_seg<<16; + + _dosmemputb(sp->addr, sp->size, dos_memory_data_seg<<4); + + Srb.Cmd = SC_EXEC_SCSI_CMD; + Srb.HaId = scg_scsibus(scgp); + Srb.Type.ExecSCSICmd.Target = scg_target(scgp); + Srb.Type.ExecSCSICmd.Lun = scg_lun(scgp); + Srb.Type.ExecSCSICmd.BufLen = sp->size; + Srb.Type.ExecSCSICmd.BufPointer = (void *)dos_memory_data_ptr; + Srb.Type.ExecSCSICmd.CDBLen = sp->cdb_len; + if (sp->sense_len <= (SENSE_LEN+2)) + Srb.Type.ExecSCSICmd.SenseLen = sp->sense_len; + else + Srb.Type.ExecSCSICmd.SenseLen = (SENSE_LEN+2); + + /* + * Enable SCSIMgrCallBack() + */ + Srb.Flags |= SRB_POSTING; + Srb.Type.ExecSCSICmd.PostProc = (void *)(_callback_info.rm_offset|(_callback_info.rm_segment<<16)); + + /* + * Do we receive data from this ASPI command? + */ + if (sp->flags & SCG_RECV_DATA) { + + Srb.Flags |= SRB_DIR_IN; + } else { + /* + * Set direction to output + */ + if (sp->size > 0) { + Srb.Flags |= SRB_DIR_OUT; + } + } + + SCSIMgrSendSRB(&Srb, scgp->scmd->timeout); + Srb.Type.ExecSCSICmd.BufPointer = sp->addr; + _dosmemgetb(dos_memory_data_seg<<4, sp->size, sp->addr); + __dpmi_free_dos_memory(dos_memory_data_sel); + + if (Srb.Status == SS_PENDING) { /* Check if we got a timeout*/ + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "Timeout....\n"); + } + sp->error = SCG_TIMEOUT; + return (1); /* Return error */ + } + + /* + * Check ASPI command status + */ + if (Srb.Status != SS_COMP) { + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "Error in scgo_send: Srb.Status is 0x%x\n", Srb.Status); + } + + switch (Srb.Status) { + + case SS_COMP: /* 0x01 SRB completed without error */ + sp->error = SCG_NO_ERROR; + sp->ux_errno = 0; + break; + + case SS_PENDING: /* 0x00 SRB being processed */ + case SS_ABORTED: /* 0x02 SRB aborted */ + case SS_ABORT_FAIL: /* 0x03 Unable to abort SRB */ + default: + sp->error = SCG_RETRYABLE; + sp->ux_errno = EIO; + break; + + case SS_ERR: /* 0x04 SRB completed with error */ + /* + * If the SCSI Status byte is != 0, we definitely could send + * the command to the target. We signal NO transport error. + */ + sp->error = SCG_NO_ERROR; + sp->ux_errno = EIO; + if (Srb.Type.ExecSCSICmd.TargStat) + break; + + case SS_INVALID_CMD: /* 0x80 Invalid ASPI command */ + case SS_INVALID_HA: /* 0x81 Invalid host adapter number */ + case SS_NO_DEVICE: /* 0x82 SCSI device not installed */ + sp->error = SCG_FATAL; + sp->ux_errno = EINVAL; + break; + } + + sp->sense_count = Srb.Type.ExecSCSICmd.SenseLen; + if (sp->sense_count > sp->sense_len) + sp->sense_count = sp->sense_len; + + memset(&sp->u_sense.Sense, 0x00, sizeof (sp->u_sense.Sense)); + + switch (sp->cdb_len) { + + case 6: + memcpy(&sp->u_sense.Sense, Srb.Type.ExecSCSICmd.CmdLen._6.SenseArea, sp->sense_count); + break; + case 10: + memcpy(&sp->u_sense.Sense, Srb.Type.ExecSCSICmd.CmdLen._10.SenseArea, sp->sense_count); + break; + case 12: + memcpy(&sp->u_sense.Sense, Srb.Type.ExecSCSICmd.CmdLen._12.SenseArea, sp->sense_count); + break; + } + sp->u_scb.cmd_scb[0] = Srb.Type.ExecSCSICmd.TargStat; + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "Mapped to: error %d errno: %d\n", sp->error, sp->ux_errno); + } + return (1); + } + + return (0); +} + +LOCAL BOOL +SCSIMgrOpen(scgp) + SCSI *scgp; +{ + int hSCSIMgr; + int dos_memory_seg; + int dos_memory_sel; + __dpmi_regs _regs; + SRB Srb; + + if (SCSIMgrEntry) { + AspiLoaded++; + return (TRUE); + } + + /* + * Open "SCSIMRG$" + */ + if (!_dos_open("SCSIMGR$", 0, &hSCSIMgr)) { + + /* Alloc 16 bytes DOS memory */ + if ((dos_memory_seg = __dpmi_allocate_dos_memory(1, &dos_memory_sel)) != -1) { + + /* Look for SCSIMgr entry point */ + memset(&_regs, 0, sizeof (_regs)); + _regs.x.ax = 0x4402; + _regs.x.bx = hSCSIMgr; + _regs.x.cx = 0x0004; + _regs.x.ds = dos_memory_seg; + _regs.x.dx = 0x0000; + if (!__dpmi_simulate_real_mode_interrupt(0x21, &_regs)) { + _dosmemgetb(dos_memory_seg<<4, 4, &SCSIMgrEntry); + } + + /* Free DOS memory */ + __dpmi_free_dos_memory(dos_memory_sel); + } + + /* Close "SCSIMRG$" */ + _dos_close(hSCSIMgr); + + /* Allocate real mode callback */ + _callback_info.pm_offset = (unsigned long)&SCSIMgrCallBack; + if (_go32_dpmi_allocate_real_mode_callback_retf(&_callback_info, &_callback_regs) == -1) { + js_fprintf((FILE *)scgp->errfile, "Cannot allocate callback address!\n"); + SCSIMgrEntry = 0; + } + } + + /* SCSIMgr entry point founded? */ + if (!SCSIMgrEntry) { + js_fprintf((FILE *)scgp->errfile, "Cannot open ASPI manager! Try to get one from http://bootcd.narod.ru/\n"); + return (FALSE); + } + + memset(&Srb, 0, sizeof (Srb)); + Srb.Cmd = SC_HA_INQUIRY; + + SCSIMgrSendSRB(&Srb, 10); + + if (scgp->debug) { + js_fprintf((FILE *)scgp->errfile, "Status : %ld\n", Srb.Status); + js_fprintf((FILE *)scgp->errfile, "hacount: %d\n", Srb.Type.HAInquiry.Count); + js_fprintf((FILE *)scgp->errfile, "SCSI id: %d\n", Srb.Type.HAInquiry.SCSI_ID); + js_fprintf((FILE *)scgp->errfile, "Manager: '%.16s'\n", Srb.Type.HAInquiry.ManagerId); + js_fprintf((FILE *)scgp->errfile, "Identif: '%.16s'\n", Srb.Type.HAInquiry.Identifier); + scg_prbytes("Unique:", Srb.Type.HAInquiry.Unique, 16); + } + + AspiLoaded++; + return (TRUE); +} + +LOCAL void +SCSIMgrClose() +{ + if (--AspiLoaded > 0) + return; + if (SCSIMgrEntry) { + _go32_dpmi_free_real_mode_callback(&_callback_info); + SCSIMgrEntry = 0; + } +} + +LOCAL int +SCSIMgrSendSRB(Srb, timeout) + SRB *Srb; + time_t timeout; +{ + int dos_memory_srb_seg; + int dos_memory_srb_sel; + DWORD dos_memory_srb_ptr; + struct timeval st; + struct timeval cr; + __dpmi_regs _regs; + + /* Alloc DOS memory */ + if ((dos_memory_srb_seg = __dpmi_allocate_dos_memory((sizeof (SRB) >> 4) + 1, &dos_memory_srb_sel)) == -1) { + Srb->Status = SS_NO_DEVICE; /* ??? fatal error */ + return (Srb->Status); + } + dos_memory_srb_ptr = dos_memory_srb_seg<<16; + + /* Copy SRB to DOS memory */ + _dosmemputb((void *)Srb, sizeof (SRB), dos_memory_srb_seg<<4); + + /* Reset callback flag */ + _callback_flag = 0; + + /* Call SCSIMgr */ + memset(&_regs, 0, sizeof (_regs)); + _regs.x.ip = SCSIMgrEntry & 0xffff; + _regs.x.cs = SCSIMgrEntry >> 16; + __dpmi_simulate_real_mode_procedure_retf_stack(&_regs, 2, &dos_memory_srb_ptr); + + /* Wait 'timeout' seconds for Srb->Status != SS_PENDING */ + gettimeofday(&st, NULL); + do { + _dosmemgetb(dos_memory_srb_seg << 4, sizeof (SRB), (void *)Srb); + gettimeofday(&cr, NULL); + } while ((Srb->Status == SS_PENDING) && (cr.tv_sec - st.tv_sec < timeout)); + + /* Free DOS memory */ + __dpmi_free_dos_memory(dos_memory_srb_sel); + + return (Srb->Status); +} + +LOCAL void +SCSIMgrCallBack(regs) + _go32_dpmi_registers *regs; +{ + _callback_flag = 1; +} diff --git a/scsilib/libscg/scsi-hpux.c b/scsilib/libscg/scsi-hpux.c new file mode 100644 index 0000000..7215ced --- /dev/null +++ b/scsilib/libscg/scsi-hpux.c @@ -0,0 +1,379 @@ +/* @(#)scsi-hpux.c 1.31 04/01/15 Copyright 1997 J. Schilling */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-hpux.c 1.31 04/01/15 Copyright 1997 J. Schilling"; +#endif +/* + * Interface for the HP-UX generic SCSI implementation. + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1997 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#undef sense +#include <sys/scsi.h> + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-hpux.c-1.31"; /* The version for this transport*/ + +#define MAX_SCG 16 /* Max # of SCSI controllers */ +#define MAX_TGT 16 +#define MAX_LUN 8 + +struct scg_local { + short scgfiles[MAX_SCG][MAX_TGT][MAX_LUN]; +}; +#define scglocal(p) ((struct scg_local *)((p)->local)) + +#ifdef SCSI_MAXPHYS +# define MAX_DMA_HP SCSI_MAXPHYS +#else +# define MAX_DMA_HP (63*1024) /* Check if this is not too big */ +#endif + + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (__sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "SIOC", "Generic SCSI", + "", "bus,target,lun", "1,2,0", TRUE, FALSE); + return (0); +} + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + register int f; + register int b; + register int t; + register int l; + register int nopen = 0; + char devname[64]; + + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno, target or lun '%d,%d,%d'", + busno, tgt, tlun); + return (-1); + } + + if ((device != NULL && *device != '\0') || (busno == -2 && tgt == -2)) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Open by 'devname' not supported on this OS"); + return (-1); + } + + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + scglocal(scgp)->scgfiles[b][t][l] = (short)-1; + } + } + } + + if (busno >= 0 && tgt >= 0 && tlun >= 0) { + + js_snprintf(devname, sizeof (devname), + "/dev/rscsi/c%xt%xl%x", busno, tgt, tlun); + f = open(devname, O_RDWR); + if (f < 0) + return (-1); + scglocal(scgp)->scgfiles[busno][tgt][tlun] = f; + return (1); + } else { + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { +/* for (l = 0; l < MAX_LUN; l++) {*/ + for (l = 0; l < 1; l++) { + js_snprintf(devname, sizeof (devname), + "/dev/rscsi/c%xt%xl%x", b, t, l); +/*error("name: '%s'\n", devname);*/ + f = open(devname, O_RDWR); + if (f >= 0) { + scglocal(scgp)->scgfiles[b][t][l] = (short)f; + nopen++; + } else if (scgp->debug > 0) { + errmsg("open '%s'\n", devname); + } + } + } + } + } + return (nopen); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + register int f; + register int b; + register int t; + register int l; + + if (scgp->local == NULL) + return (-1); + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + f = scglocal(scgp)->scgfiles[b][t][l]; + if (f >= 0) + close(f); + scglocal(scgp)->scgfiles[b][t][l] = (short)-1; + } + } + } + return (0); +} + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + return (MAX_DMA_HP); +} + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_getbuf: %ld bytes\n", amt); + } + scgp->bufbase = valloc((size_t)(amt)); + return (scgp->bufbase); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + register int t; + register int l; + + if (busno < 0 || busno >= MAX_SCG) + return (FALSE); + + if (scgp->local == NULL) + return (FALSE); + + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + if (scglocal(scgp)->scgfiles[busno][t][l] >= 0) + return (TRUE); + } + return (FALSE); +} + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (busno < 0 || busno >= MAX_SCG || + tgt < 0 || tgt >= MAX_TGT || + tlun < 0 || tlun >= MAX_LUN) + return (-1); + + if (scgp->local == NULL) + return (-1); + + return ((int)scglocal(scgp)->scgfiles[busno][tgt][tlun]); +} + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + return (-1); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; +{ + return (FALSE); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + if (what == SCG_RESET_NOP) + return (0); + if (what != SCG_RESET_BUS) { + errno = EINVAL; + return (-1); + } + return (ioctl(scgp->fd, SIOC_RESET_BUS, 0)); +} + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + int ret; + int flags; + struct sctl_io sctl_io; + + if ((scgp->fd < 0) || (sp->cdb_len > sizeof (sctl_io.cdb))) { + sp->error = SCG_FATAL; + return (0); + } + + fillbytes((caddr_t)&sctl_io, sizeof (sctl_io), '\0'); + + flags = 0; +/* flags = SCTL_INIT_WDTR|SCTL_INIT_SDTR;*/ + if (sp->flags & SCG_RECV_DATA) + flags |= SCTL_READ; + if ((sp->flags & SCG_DISRE_ENA) == 0) + flags |= SCTL_NO_ATN; + + sctl_io.flags = flags; + + movebytes(&sp->cdb, sctl_io.cdb, sp->cdb_len); + sctl_io.cdb_length = sp->cdb_len; + + sctl_io.data_length = sp->size; + sctl_io.data = sp->addr; + + if (sp->timeout == 0) + sctl_io.max_msecs = 0; + else + sctl_io.max_msecs = (sp->timeout * 1000) + 500; + + errno = 0; + sp->error = SCG_NO_ERROR; + sp->sense_count = 0; + sp->u_scb.cmd_scb[0] = 0; + sp->resid = 0; + + ret = ioctl(scgp->fd, SIOC_IO, &sctl_io); + if (ret < 0) { + sp->error = SCG_FATAL; + sp->ux_errno = errno; + return (ret); + } +if (scgp->debug > 0) +error("cdb_status: %X, size: %d xfer: %d\n", sctl_io.cdb_status, sctl_io.data_length, sctl_io.data_xfer); + + if (sctl_io.cdb_status == 0 || sctl_io.cdb_status == 0x02) + sp->resid = sp->size - sctl_io.data_xfer; + + if (sctl_io.cdb_status & SCTL_SELECT_TIMEOUT || + sctl_io.cdb_status & SCTL_INVALID_REQUEST) { + sp->error = SCG_FATAL; + } else if (sctl_io.cdb_status & SCTL_INCOMPLETE) { + sp->error = SCG_TIMEOUT; + } else if (sctl_io.cdb_status > 0xFF) { + errmsgno(EX_BAD, "SCSI problems: cdb_status: %X\n", sctl_io.cdb_status); + + } else if ((sctl_io.cdb_status & 0xFF) != 0) { + sp->error = SCG_RETRYABLE; + sp->ux_errno = EIO; + + sp->u_scb.cmd_scb[0] = sctl_io.cdb_status & 0xFF; + + sp->sense_count = sctl_io.sense_xfer; + if (sp->sense_count > SCG_MAX_SENSE) + sp->sense_count = SCG_MAX_SENSE; + + if (sctl_io.sense_status != S_GOOD) { + sp->sense_count = 0; + } else { + movebytes(sctl_io.sense, sp->u_sense.cmd_sense, sp->sense_count); + } + + } + return (ret); +} +#define sense u_sense.Sense diff --git a/scsilib/libscg/scsi-linux-ata.c b/scsilib/libscg/scsi-linux-ata.c new file mode 100644 index 0000000..7546a9b --- /dev/null +++ b/scsilib/libscg/scsi-linux-ata.c @@ -0,0 +1,1184 @@ +/* @(#)scsi-linux-ata.c 1.7 04/06/12 Copyright 2002 J. Schilling */ +#ifndef lint +static char ata_sccsid[] = + "@(#)scsi-linux-ata.c 1.7 04/06/12 Copyright 2002 J. Schilling"; +#endif +/* + * Interface for Linux generic SCSI implementation (sg). + * + * This is the interface for the broken Linux SCSI generic driver. + * This is a hack, that tries to emulate the functionality + * of the scg driver. + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 2002 J. Schilling + * + * Thanks to Alexander Kern <alex.kern@gmx.de> for the idea and first + * code fragments for supporting the CDROM_SEND_PACKET ioctl() from + * the cdrom.c kernel driver. Please note that this interface in priciple + * is completely unneeded but the Linux kernel is just a cluster of + * code and does not support planned orthogonal interface systems. + * For this reason we need CDROM_SEND_PACKET in order to work around a + * bug in the linux kernel that prevents to use PCATA drives because + * the kernel panics if you try to put ide-scsi on top of the PCATA + * driver. + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifdef USE_ATA + +LOCAL char _scg_atrans_version[] = "scsi-linux-ata.c-1.7"; /* The version for ATAPI transport*/ + +LOCAL char * scgo_aversion __PR((SCSI *scgp, int what)); +LOCAL int scgo_ahelp __PR((SCSI *scgp, FILE *f)); +LOCAL int scgo_aopen __PR((SCSI *scgp, char *device)); +LOCAL int scgo_aclose __PR((SCSI *scgp)); +LOCAL long scgo_amaxdma __PR((SCSI *scgp, long amt)); +LOCAL BOOL scgo_ahavebus __PR((SCSI *scgp, int)); +LOCAL int scgo_afileno __PR((SCSI *scgp, int, int, int)); +LOCAL int scgo_ainitiator_id __PR((SCSI *scgp)); +LOCAL int scgo_aisatapi __PR((SCSI *scgp)); +LOCAL int scgo_areset __PR((SCSI *scgp, int what)); +LOCAL int scgo_asend __PR((SCSI *scgp)); + +LOCAL scg_ops_t ata_ops = { + scgo_asend, + scgo_aversion, + scgo_ahelp, + scgo_aopen, + scgo_aclose, + scgo_amaxdma, + scgo_getbuf, /* Shared with SG driver */ + scgo_freebuf, /* Shared with SG driver */ + scgo_ahavebus, + scgo_afileno, + scgo_ainitiator_id, + scgo_aisatapi, + scgo_areset, +}; + +#define HOST_EMPTY 0xF +#define HOST_SCSI 0x0 +#define HOST_IDE 0x1 +#define HOST_USB 0x2 +#define HOST_IEEE1389 0x3 +#define HOST_PARALLEL 0x4 +#define HOST_OTHER 0xE + + +#define typlocal(p, schillybus) scglocal(p)->bc[schillybus].typ +#define buslocal(p, schillybus) scglocal(p)->bc[schillybus].bus +#define hostlocal(p, schillybus) scglocal(p)->bc[schillybus].host + +#define MAX_DMA_ATA (131072-1) /* EINVAL (hart) ENOMEM (weich) bei mehr ... */ + /* Bei fehlerhaftem Sense Pointer kommt EFAULT */ + +LOCAL int scgo_send __PR((SCSI * scgp)); +LOCAL BOOL sg_amapdev __PR((SCSI * scgp, int f, char *device, int *bus, + int *target, int *lun)); +LOCAL BOOL sg_amapdev_scsi __PR((SCSI * scgp, int f, int *busp, int *tgtp, + int *lunp, int *chanp, int *inop)); +LOCAL int scgo_aget_first_free_shillybus __PR((SCSI * scgp, int subsystem, + int host, int bus)); +LOCAL int scgo_amerge __PR((char *path, char *readedlink, + char *buffer, int buflen)); + +/* + * uncomment this when you will get a debug file #define DEBUG + */ +#ifdef DEBUG +#define LOGFILE "scsi-linux-ata.log" +#define log(a) sglog a + +LOCAL void sglog __PR((const char *fmt, ...)); + +#include <vadefs.h> +#include "oexcl.h" + +/* VARARGS1 */ +#ifdef PROTOTYPES +LOCAL void +sglog(const char *fmt, ...) +#else +LOCAL void +error(fmt, va_alist) + char *fmt; + va_dcl +#endif +{ + va_list args; + FILE *f = fopen(LOGFILE, "a"); + + if (f == NULL) + return; + +#ifdef PROTOTYPES + va_start(args, fmt); +#else + va_start(args); +#endif + js_fprintf(f, "%r", fmt, args); + va_end(args); + fclose(f); +} +#else +#define log(a) +#endif /* DEBUG */ + +LOCAL int scan_internal __PR((SCSI * scgp, int *fatal)); + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_aversion(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_atrans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (ata_sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_ahelp(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "ATA", "ATA Packet specific SCSI transport", + "ATAPI:", "bus,target,lun", "ATAPI:1,2,0", TRUE, FALSE); + return (0); +} + +LOCAL int +scgo_aopen(scgp, device) + SCSI *scgp; + char *device; +{ + int bus = scg_scsibus(scgp); + int target = scg_target(scgp); + int lun = scg_lun(scgp); + + register int f; + register int b; + register int t; + register int l; + int nopen = 0; + + if (scgp->overbose) + error("Warning: Using ATA Packet interface.\n"); + if (scgp->overbose) { + error("Warning: The related Linux kernel interface code seems to be unmaintained.\n"); + error("Warning: There is absolutely NO DMA, operations thus are slow.\n"); + } + + log(("\n<<<<<<<<<<<<<<<< LOGGING ON >>>>>>>>>>>>>>>>>\n")); + if (bus >= MAX_SCHILLY_HOSTS || target >= MAX_TGT || lun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for bus, target or lun '%d,%d,%d'", + bus, target, lun); + + return (-1); + } + + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) { + return (0); + } + + scglocal(scgp)->scgfile = -1; + scglocal(scgp)->pgbus = -2; + scglocal(scgp)->SCSIbuf = (char *)-1; + scglocal(scgp)->pack_id = 5; + scglocal(scgp)->drvers = -1; + scglocal(scgp)->isold = -1; + scglocal(scgp)->xbufsize = 0L; + scglocal(scgp)->xbuf = NULL; + + + for (b = 0; b < MAX_SCHILLY_HOSTS; b++) { + typlocal(scgp, b) = HOST_EMPTY; + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + scglocal(scgp)->scgfiles[b][t][l] = (short) -1; + } + } + } + + if (device != NULL && strcmp(device, "ATAPI") == 0) + goto atascan; + + /* if not scanning */ + if ((device != NULL && *device != '\0') || (bus == -2 && target == -2)) + goto openbydev; + +atascan: + if (scan_internal(scgp, &nopen)) { + if (scgp->errstr) + js_printf(scgp->errstr, "INFO: scan_internal(...) failed"); + return (-1); + } + return (nopen); + +openbydev: + if (device != NULL && strncmp(device, "ATAPI:", 6) == 0) + device += 6; + if (scgp->debug > 3) { + js_fprintf((FILE *) scgp->errfile, "INFO: do scgo_open openbydev"); + } + if (device != NULL && *device != '\0') { + int schilly_bus, + starget, + slun; + + f = openexcl(device, O_RDWR | O_NONBLOCK); + + if (f < 0) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '%s'", device); + return (0); + } + if (sg_amapdev(scgp, f, device, &schilly_bus, &starget, &slun)) { + scg_settarget(scgp, schilly_bus, starget, slun); + return (++nopen); + } + } + return (nopen); +} + +#include <glob.h> + + +LOCAL int +scan_internal(scgp, nopen) + SCSI *scgp; + int *nopen; +{ + int i, + f; + int schilly_bus, + target, + lun; + char *device; + glob_t globbuf; + + /* + * try always with devfs + * unfortunatelly the solution with test of existing + * of '/dev/.devfsd' don't work, because it root.root 700 + * and i don't like run suid root + */ + BOOL DEVFS = FALSE; + + glob("/dev/cdroms/cdrom*", + GLOB_NOSORT, + NULL, &globbuf); + glob("/dev/hd[a-z]", + GLOB_NOSORT|GLOB_APPEND, + NULL, &globbuf); + /*glob("/dev/scd*", + GLOB_NOSORT|GLOB_APPEND, + NULL, &globbuf);*/ + + for (i = 0; globbuf.gl_pathv && globbuf.gl_pathv[i] != NULL ; i++) { + device = globbuf.gl_pathv[i]; + if ((f = open(device, O_RDWR | O_NONBLOCK)) < 0) { + if (errno != ENOENT && errno != ENXIO && errno != ENODEV && errno != EACCES) { + if (scgp->debug > 4) { + js_fprintf((FILE *) scgp->errfile, + "try open(%s) return %i, errno %i, cancel\n", device, f, errno); + } + globfree(&globbuf); + return (-2); + } + if (scgp->debug > 4) { + if (errno == EACCES) { + js_fprintf((FILE *) scgp->errfile, + "errno (EACCESS), you don't have the needed rights for %s\n", + device); + } + js_fprintf((FILE *) scgp->errfile, + "try open(%s) return %i, errno %i, trying next cdrom\n", + device, f, errno); + } + } else { + if (scgp->debug > 4) { + js_fprintf((FILE *) scgp->errfile, + "try open(%s) return %i errno %i calling sg_mapdev(...)\n", + device, f, errno); + } + if (sg_amapdev(scgp, f, device, &schilly_bus, &target, &lun)) { + (++(*nopen)); + } else { + close(f); + } + } + } + globfree(&globbuf); + return (0); +} + +LOCAL int +scgo_aclose(scgp) + SCSI *scgp; +{ + register int f; + register int h; + register int t; + register int l; + + if (scgp->local == NULL) + return (-1); + + for (h = 0; h < MAX_SCHILLY_HOSTS; h++) { + typlocal(scgp, h) = (HOST_EMPTY); + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + f = scglocal(scgp)->scgfiles[h][t][l]; + if (f >= 0) + close(f); + scglocal(scgp)->scgfiles[h][t][l] = (short) -1; + } + } + } + + if (scglocal(scgp)->xbuf != NULL) { + free(scglocal(scgp)->xbuf); + scglocal(scgp)->xbufsize = 0L; + scglocal(scgp)->xbuf = NULL; + } + log(("<<<<<<<<<<<<<<<< LOGGING OFF >>>>>>>>>>>>>>>>>\n\n")); + return (0); +} + +LOCAL int +scgo_aget_first_free_shillybus(scgp, subsystem, host, bus) + SCSI *scgp; + int subsystem; + int host; + int bus; +{ + int first_free_schilly_bus; + + for (first_free_schilly_bus = 0; + first_free_schilly_bus < MAX_SCHILLY_HOSTS; + first_free_schilly_bus++) { + + if (typlocal(scgp, first_free_schilly_bus) == HOST_EMPTY || + (typlocal(scgp, first_free_schilly_bus) == subsystem && + hostlocal(scgp, first_free_schilly_bus) == host && + buslocal(scgp, first_free_schilly_bus) == bus)) + break; + } + + if (first_free_schilly_bus >= MAX_SCHILLY_HOSTS) { + errmsgno(EX_BAD, "ERROR: in scgo_get_first_free_shillybus(...). Too many CDROMs, more than %i", + MAX_SCHILLY_HOSTS); + errmsgno(EX_BAD, "Increase MAX_SCHILLY_HOSTS in scsi-linux-ata.c and recompile!"); + return (-1); + } + return (first_free_schilly_bus); +} + +LOCAL int +scgo_amerge(path, readedlink, buffer, buflen) + char *path; + char *readedlink; + char *buffer; + int buflen; +{ + char *aa; + +#define TOKEN_ARRAY 20 +#define LAST_CHAR(x) (x)[strlen((x))-1] +#define ONE_CHAR_BACK(x) (x)[strlen((x))-1] = '\0' + char *ppa[TOKEN_ARRAY]; + char *pa; + + int i; + int len; + char seps[] = "/"; + char *last_slash; + + if (!path || !readedlink || !buffer) + return (-EINVAL); + + if ('/' == readedlink[0]) { + aa = (char *) malloc(strlen(readedlink) + 1); + if (!aa) + return (-ENOMEM); + + strcpy(aa, readedlink); + } else { + aa = (char *) malloc(strlen(path) + strlen(readedlink) + 1); + if (!aa) + return (-ENOMEM); + + strcpy(aa, path); + if (LAST_CHAR(aa) == '/') { + ONE_CHAR_BACK(aa); + } + last_slash = strrchr(aa, '/'); + if (last_slash == NULL) + strcpy(aa, "/"); + else + *(++last_slash) = '\0'; + strcat(aa, readedlink); + } + memset(ppa, 0x00, sizeof (ppa)); + + for (i = 0, pa = strtok(aa, seps); + i < TOKEN_ARRAY && pa != NULL; + ++i, pa = strtok(NULL, seps)) { + ppa[i] = pa; + } + + if (i == TOKEN_ARRAY) { + free(aa); + return (-ENOMEM); + } + for (i = 0; i < TOKEN_ARRAY && ppa[i]; i++) { + if (strcmp(ppa[i], "..") == 0) { + ppa[i] = NULL; + if (i > 1) + ppa[i - 1] = NULL; + } + } + + /* dry run */ + len = 0; + for (i = 0; i < TOKEN_ARRAY; i++) { + if (ppa[i]) { + len += 1; + len += strlen(ppa[i]); + } + } + if (0 == len) + len = 1; + + if (len + 1 <= buflen) { + strcpy(buffer, ""); + for (i = 0; i < TOKEN_ARRAY; i++) { + if (ppa[i]) { + strcat(buffer, "/"); + strcat(buffer, ppa[i]); + } + } + + if (strlen(buffer) == 0) + strcpy(buffer, "/"); + } + free(aa); + + return (len + 1); +} + +/* + * /dev/cdroms/cdrom0 first CD-ROM + * /dev/cdroms/cdrom1 second CD-ROM + * + * + * SCSI Devices + * + * To uniquely identify any SCSI device requires the following information: + * + * controller (host adapter) + * bus (SCSI channel) + * target (SCSI ID) + * unit (Logical Unit Number) + * + * All SCSI devices are placed under /dev/scsi (assuming devfs is mounted on /dev). + * Hence, a SCSI device with the following parameters: + * c=1,b=2,t=3,u=4 would appear as: + * + * /dev/scsi/host1/bus2/target3/lun4 device directory + * + * Inside this directory, a number of device entries may be created, + * depending on which SCSI device-type drivers were installed. + * + * See the section on the disc naming scheme to see what entries + * the SCSI disc driver creates. + * + * See the section on the tape naming scheme to see what entries + * the SCSI tape driver creates. + * + * The SCSI CD-ROM driver creates: cd + * The SCSI generic driver creates: generic + * + * IDE Devices + * + * To uniquely identify any IDE device requires the following information: + * + * controller + * bus (0/1 aka. primary/secondary) + * target (0/1 aka. master/slave) + * unit + * + * All IDE devices are placed under /dev/ide, and uses a similar + * naming scheme to the SCSI subsystem. + * + * + * Example /dev/cdroms/cdrom0 -> /dev/scsi/host1/bus2/target3/lun4/cd + * Example /dev/cdroms/cdrom1 -> /dev/ide/host1/bus0/target1/lun4/cd + * + */ +LOCAL BOOL +sg_amapdev(scgp, f, device, schillybus, target, lun) + SCSI *scgp; + int f; + char *device; + int *schillybus; + int *target; + int *lun; +{ + struct host { + char host[4]; + char host_no; + }; + struct bus { + char bus[3]; + char bus_no; + }; + struct target { + char target[6]; + char target_no; + }; + struct lun { + char lun[3]; + char lun_no; + }; + + int h, + b, + t, + l; + +#define TOKEN_DEV "dev" +#define TOKEN_SUBSYSTEM_SCSI "scsi" +#define TOKEN_SUBSYSTEM_IDE "ide" +#define TOKEN_HOST "host" +#define TOKEN_BUS "bus" +#define TOKEN_TARGET "target" +#define TOKEN_LUN "lun" +#define TOKEN_CD "cd" + +#define ID_TOKEN_DEV 0 +#define ID_TOKEN_SUBSYSTEM 1 +#define ID_TOKEN_HOST 2 +#define ID_TOKEN_BUS 3 +#define ID_TOKEN_TARGET 4 +#define ID_TOKEN_LUN 5 +#define ID_TOKEN_CD 6 +#define ID_TOKEN_LAST ID_TOKEN_CD +#define ID_TOKEN_MAX ID_TOKEN_LAST + 2 +#define CHARTOINT(x) (abs(atoi(&x))) + + char *token[ID_TOKEN_MAX], + *seps = "/"; + int i, + result; + struct stat buf; + +#ifndef MAX_PATH +#define MAX_PATH 260 +#endif +#define LOCAL_MAX_PATH MAX_PATH + char tmp[LOCAL_MAX_PATH], + tmp1[LOCAL_MAX_PATH]; + int first_free_schilly_bus; + int subsystem = HOST_EMPTY; + + /* old DEV */ + typedef struct { + char prefix[2]; + char device; + } old_dev; + /* strtok need char* instead of const char* */ + result = stat(device, &buf); + if (result || !S_ISBLK(buf.st_mode)) + return (FALSE); + + result = lstat(device, &buf); + if (0 && !result && S_ISLNK(buf.st_mode)) { + result = readlink(device, tmp, LOCAL_MAX_PATH); + if (result > 0 && result < LOCAL_MAX_PATH) { + tmp[result] = '\0'; + + result = scgo_amerge(device, tmp, tmp1, LOCAL_MAX_PATH); + if (result > 0 && result < LOCAL_MAX_PATH) { + tmp1[result] = '\0'; + strcpy(tmp, tmp1); + } else { + errmsgno(EX_BAD, + "ERROR: with link merging! base %s link %s, result of merging %i\n", + device, tmp, result); + return (FALSE); + } + } else { + errmsgno(EX_BAD, + "ERROR: with link reading! link %s, result of readlink %i\n", + device, result); + return (FALSE); + } + } else { + strncpy(tmp, device, sizeof (tmp)); + } + if (scgp->debug > 3) { + js_fprintf((FILE *) scgp->errfile, "INFO: %s -> %s\n", device, tmp); + } + memset(token, 0x00, sizeof (token)); + i = 0; + token[i] = strtok(tmp, seps); + while (token[i] != NULL && (++i) && i < ID_TOKEN_MAX) { + token[i] = strtok(NULL, seps); + } + + if (i == ID_TOKEN_MAX || + !(token[ID_TOKEN_DEV]) || + strcmp(token[ID_TOKEN_DEV], TOKEN_DEV)) { + + errmsgno(EX_BAD, "ERROR: unknow format\n"); + errmsgno(EX_BAD, "EXAMPLE: /dev/scsi/host1/bus2/target3/lun4/cd\n"); + errmsgno(EX_BAD, "EXAMPLE: /dev/ide/host0/bus0/target1/lun0/cd\n"); + errmsgno(EX_BAD, "EXAMPLE: /dev/hda or /dev/sr0\n"); + return (FALSE); + } + if (!(strcmp(token[ID_TOKEN_SUBSYSTEM], TOKEN_SUBSYSTEM_SCSI)) || + !(strcmp(token[ID_TOKEN_SUBSYSTEM], TOKEN_SUBSYSTEM_IDE))) { + h = CHARTOINT(((struct host *) token[ID_TOKEN_HOST])->host_no); + b = CHARTOINT(((struct bus *) token[ID_TOKEN_BUS])->bus_no); + t = CHARTOINT(((struct target *) token[ID_TOKEN_TARGET])->target_no); + l = CHARTOINT(((struct lun *) token[ID_TOKEN_LUN])->lun_no); +#ifdef PARANOID + if (strncmp(token[ID_TOKEN_HOST], TOKEN_HOST, strlen(TOKEN_HOST))) { + log(("ERROR: invalid host specified\n")); + return (FALSE); + } + if (strncmp(token[ID_TOKEN_BUS], TOKEN_BUS, strlen(TOKEN_BUS))) { + log(("ERROR: invalid bus specified\n")); + return (FALSE); + } + if (strncmp(token[ID_TOKEN_TARGET], TOKEN_TARGET, strlen(TOKEN_TARGET))) { + log(("ERROR: invalid target specified\n")); + return (FALSE); + } + if (strncmp(token[ID_TOKEN_LUN], TOKEN_LUN, strlen(TOKEN_LUN))) { + log(("ERROR: invalid lun specified\n")); + return (FALSE); + } + if (!(strcmp(token[ID_TOKEN_SUBSYSTEM], TOKEN_SUBSYSTEM_IDE))) { + if (b > 1 || t > 1) { + log(("ERROR: invalid bus or target for IDE specified\n")); + return (FALSE); + } + } +#endif /* PARANOID */ + + if (!(strcmp(token[ID_TOKEN_SUBSYSTEM], TOKEN_SUBSYSTEM_IDE))) { + subsystem = HOST_IDE; + } else if (!(strcmp(token[ID_TOKEN_SUBSYSTEM], TOKEN_SUBSYSTEM_SCSI))) { + subsystem = HOST_SCSI; + } else { + subsystem = HOST_OTHER; + } + } else if (!token[ID_TOKEN_HOST] && + strlen(token[ID_TOKEN_SUBSYSTEM]) == sizeof (old_dev)) { + char j; + + old_dev *pDev = (old_dev *) token[ID_TOKEN_SUBSYSTEM]; + + if (strncmp(pDev->prefix, "hd", 2) == 0) { + j = pDev->device - ('a'); + + subsystem = HOST_IDE; + h = j / 4; + b = (j % 4) / 2; + t = (j % 4) % 2; + l = 0; + } else if (strncmp(pDev->prefix, "sr", 2) == 0) { +#ifdef nonono + if (pDev->device >= '0' && pDev->device <= '9') + j = pDev->device - ('0'); + else + j = pDev->device - ('a'); + + + h = j / 4; + b = (j % 4) / 2; + t = (j % 4) % 2; + l = 0; +#endif /* nonono */ + /* other solution, with ioctl */ + int Chan, + Ino, + Bus, + Target, + Lun; + + subsystem = HOST_SCSI; + sg_amapdev_scsi(scgp, f, &Bus, &Target, &Lun, &Chan, &Ino); + + /* For old kernels try to make the best guess. */ +#ifdef nonono + int n; + Ino |= Chan << 8; + n = sg_mapbus(scgp, Bus, Ino); + if (Bus == -1) { + Bus = n; + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "SCSI Bus: %d (mapped from %d)\n", + Bus, Ino); + } + } +/* It is me too high ;-()*/ +#endif /* nonono */ + h = Ino; + b = Chan; + t = Target; + l = Lun; + } else { + errmsgno(EX_BAD, "ERROR: unknow subsystem (%s) in (%s)\n", + token[ID_TOKEN_SUBSYSTEM], device); + return (FALSE); + } + } else { + errmsgno(EX_BAD, "ERROR: unknow subsystem (%s) in (%s)\n", + token[ID_TOKEN_SUBSYSTEM], device); + return (FALSE); + } + + if (scgp->verbose) + js_printf(scgp->errstr, "INFO: subsystem %s: h %i, b %i, t %i, l %i", + token[ID_TOKEN_SUBSYSTEM], h, b, t, l); + + first_free_schilly_bus = scgo_aget_first_free_shillybus(scgp, subsystem, h, b); + if (-1 == first_free_schilly_bus) { + return (FALSE); + } + if (scglocal(scgp)->scgfiles[first_free_schilly_bus][t][l] != (-1)) { + errmsgno(EX_BAD, "ERROR: this cdrom is already mapped %s(%d,%d,%d)\n", + device, first_free_schilly_bus, t, l); + return (FALSE); + } else { + scglocal(scgp)->scgfiles[first_free_schilly_bus][t][l] = f; + typlocal(scgp, first_free_schilly_bus) = subsystem; + hostlocal(scgp, first_free_schilly_bus) = h; + buslocal(scgp, first_free_schilly_bus) = b; + *schillybus = first_free_schilly_bus; + *target = t; + *lun = l; + + if (scgp->debug > 1) { + js_fprintf((FILE *) scgp->errfile, + "INFO: /dev/%s, (host%d/bus%d/target%d/lun%d) will be mapped on the schilly bus No %d (%d,%d,%d)\n", + token[ID_TOKEN_SUBSYSTEM], h, b, t, l, + first_free_schilly_bus, first_free_schilly_bus, t, l); + } + } + return (TRUE); +} + +LOCAL BOOL +sg_amapdev_scsi(scgp, f, busp, tgtp, lunp, chanp, inop) + SCSI *scgp; + int f; + int *busp; + int *tgtp; + int *lunp; + int *chanp; + int *inop; +{ + struct sg_id { + long l1; /* target | lun << 8 | channel << 16 | low_ino << 24 */ + long l2; /* Unique id */ + } sg_id; + int Chan; + int Ino; + int Bus; + int Target; + int Lun; + + if (ioctl(f, SCSI_IOCTL_GET_IDLUN, &sg_id)) + return (FALSE); + + if (scgp->debug > 0) { + js_fprintf((FILE *) scgp->errfile, + "INFO: l1: 0x%lX l2: 0x%lX\n", sg_id.l1, sg_id.l2); + } + if (ioctl(f, SCSI_IOCTL_GET_BUS_NUMBER, &Bus) < 0) { + Bus = -1; + } + Target = sg_id.l1 & 0xFF; + Lun = (sg_id.l1 >> 8) & 0xFF; + Chan = (sg_id.l1 >> 16) & 0xFF; + Ino = (sg_id.l1 >> 24) & 0xFF; + if (scgp->debug > 0) { + js_fprintf((FILE *) scgp->errfile, + "INFO: Bus: %d Target: %d Lun: %d Chan: %d Ino: %d\n", + Bus, Target, Lun, Chan, Ino); + } + *busp = Bus; + *tgtp = Target; + *lunp = Lun; + if (chanp) + *chanp = Chan; + if (inop) + *inop = Ino; + return (TRUE); +} + +LOCAL long +scgo_amaxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + /* + * EINVAL (hart) ENOMEM (weich) bei mehr ... + * Bei fehlerhaftem Sense Pointer kommt EFAULT + */ + return (MAX_DMA_ATA); +} + +LOCAL BOOL +scgo_ahavebus(scgp, busno) + SCSI *scgp; + int busno; +{ + register int t; + register int l; + + if (busno < 0 || busno >= MAX_SCHILLY_HOSTS) + return (FALSE); + + if (scgp->local == NULL) + return (FALSE); + + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + if (scglocal(scgp)->scgfiles[busno][t][l] >= 0) + return (TRUE); + } + return (FALSE); +} + +LOCAL int +scgo_afileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (busno < 0 || busno >= MAX_SCHILLY_HOSTS || + tgt < 0 || tgt >= MAX_TGT || + tlun < 0 || tlun >= MAX_LUN) + return (-1); + + if (scgp->local == NULL) + return (-1); + + return ((int) scglocal(scgp)->scgfiles[busno][tgt][tlun]); +} + +LOCAL int +scgo_ainitiator_id(scgp) + SCSI *scgp; +{ + js_printf(scgp->errstr, "NOT IMPELEMENTED: scgo_initiator_id"); + return (-1); +} + +LOCAL int +scgo_aisatapi(scgp) + SCSI *scgp; +{ + int schillybus = scgp->addr.scsibus; + int typ = typlocal(scgp, schillybus); + if (typ == HOST_EMPTY) + return (-1); + if (typ != HOST_SCSI) + return (1); + else + return (0); +} + +LOCAL int +scgo_areset(scgp, what) + SCSI *scgp; + int what; +{ + if (what == SCG_RESET_NOP) + return (0); + + if (what == SCG_RESET_TGT || what == SCG_RESET_BUS) + return (ioctl(what, CDROMRESET)); + + return (-1); +} + +LOCAL int +scgo_asend(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + int ret, + i; + struct cdrom_generic_command sg_cgc; + struct request_sense sense_cgc; + +#ifdef DEBUG + char tmp_send[340], + tmp_read[340], + tmp_sense[340], + tmp1[30]; + int j; + char *p; +#endif + + if (scgp->fd < 0) { + sp->error = SCG_FATAL; + sp->ux_errno = EIO; + return (0); + } + if (sp->cdb_len > CDROM_PACKET_SIZE) { + sp->error = SCG_FATAL; + sp->ux_errno = EIO; + return (0); + } + /* initialize */ + fillbytes((caddr_t) & sg_cgc, sizeof (sg_cgc), '\0'); + fillbytes((caddr_t) & sense_cgc, sizeof (sense_cgc), '\0'); + + if (sp->flags & SCG_RECV_DATA) { + sg_cgc.data_direction = CGC_DATA_READ; + } else if (sp->size > 0) { + sg_cgc.data_direction = CGC_DATA_WRITE; + } else { + sg_cgc.data_direction = CGC_DATA_NONE; + } +#if LINUX_VERSION_CODE >= 0x020403 + if (sp->flags & SCG_SILENT) { + sg_cgc.quiet = 1; + } +#endif + for (i = 0; i < sp->cdb_len; i++) { + sg_cgc.cmd[i] = sp->cdb.cmd_cdb[i]; + } + + sg_cgc.buflen = sp->size; + sg_cgc.buffer = sp->addr; + + if (sp->sense_len > sizeof (sense_cgc)) + sense_cgc.add_sense_len = sizeof (sense_cgc) - 8; + else + sense_cgc.add_sense_len = sp->sense_len - 8; + + sg_cgc.sense = &sense_cgc; +#if LINUX_VERSION_CODE >= 0x020403 + sg_cgc.timeout = sp->timeout * 1000; +#endif +#ifdef DEBUG + strcpy(tmp_send, "send cmd:\n"); + for (j = 0; j < sp->cdb_len; j++) { + sprintf(tmp1, " %02X", sp->cdb.cmd_cdb[j]); + strcat(tmp_send, tmp1); + } + strcat(tmp_send, "\n"); + + if (sg_cgc.data_direction == CGC_DATA_WRITE) { + int z; + + sprintf(tmp1, "data_write: %i bytes\n", sp->size); + strcat(tmp_send, tmp1); + for (j = 0, z = 1; j < 80 && j < sp->size; j++, z++) { + if (z > 16) { + z = 1; + strcat(tmp_send, "\n"); + } + sprintf(tmp1, " %02X", (unsigned char) (sp->addr[j])); + strcat(tmp_send, tmp1); + } + strcat(tmp_send, "\n"); + + if (sp->size > 80) { + strcat(tmp_send, "...\n"); + } + } +#endif /* DEBUG */ + if ((ret = ioctl(scgp->fd, CDROM_SEND_PACKET, &sg_cgc)) < 0) + sp->ux_errno = geterrno(); + + if (ret < 0 && scgp->debug > 4) { + js_fprintf((FILE *) scgp->errfile, + "ioctl(CDROM_SEND_PACKET) ret: %d\n", ret); + } + /* + * copy scsi data back + */ + if (sp->flags & SCG_RECV_DATA && ((void *) sp->addr != (void *) sg_cgc.buffer)) { + memcpy(sp->addr, sg_cgc.buffer, (sp->size < sg_cgc.buflen) ? sp->size : sg_cgc.buflen); + if (sg_cgc.buflen > sp->size) + sp->resid = sg_cgc.buflen - sp->size; + } + sp->error = SCG_NO_ERROR; +#ifdef DEBUG + if (ret < 0) { + switch (sp->ux_errno) { + case ENOTTY: + p = "ENOTTY"; + break; + case EINVAL: + p = "EINVAL"; + break; + case ENXIO: + p = "ENXIO"; + break; + case EACCES: + p = "EACCES"; + break; + case EIO: + p = "EIO"; + break; + case ENOMEDIUM: + p = "ENOMEDIUM"; + break; + case EDRIVE_CANT_DO_THIS: + p = "EDRIVE_CANT_DO_THIS"; + break; + default: + p = "UNKNOW"; + }; + log(("%s", tmp_send)); + log(("ERROR: returns %i errno %i(%s)\n", ret, sp->ux_errno, p)); + } +#endif /* DEBUG */ + if (ret < 0) { + /* + * Check if SCSI command cound not be send at all. + * Linux usually returns EINVAL for an unknoen ioctl. + * In case somebody from the Linux kernel team learns that the + * corect errno would be ENOTTY, we check for this errno too. + */ + if (sp->ux_errno == EINVAL) { + /* + * Try to work around broken Linux kernel design... + * If SCSI Sense Key is 0x05 (Illegal request), Linux + * returns a useless EINVAL making it close to + * impossible distinct from "Illegal ioctl()" or + * "Invalid parameter". + */ + if ((((Uchar *)sg_cgc.sense)[0] != 0) || + (((Uchar *)sg_cgc.sense)[2] != 0)) + sp->ux_errno = EIO; + + } else if ((sp->ux_errno == ENOTTY || sp->ux_errno == EINVAL)) { + /* + * May be "Illegal ioctl()". + */ + return (-1); + } + if (sp->ux_errno == ENXIO || sp->ux_errno == EACCES) { + return (-1); + } + } else if (ret == 0) { +#ifdef DEBUG + if (sg_cgc.data_direction == CGC_DATA_READ) { + int z; + + sprintf(tmp_read, "data_read: %i bytes\n", sp->size); + for (j = 0, z = 1; j < 80 && j < sp->size; j++, z++) { + if (z > 16) { + z = 1; + strcat(tmp_read, "\n"); + } + sprintf(tmp1, " %02X", (unsigned char) (sp->addr[j])); + strcat(tmp_read, tmp1); + } + strcat(tmp_read, "\n"); + if (sp->size > 80) { + strcat(tmp_read, "...\n"); + } + } +#endif /* DEBUG */ + } + /* + * copy sense back + */ + if (ret < 0 && sg_cgc.sense->error_code) { + sp->sense_count = sense_cgc.add_sense_len + 8; +#ifdef DEBUG + sprintf(tmp_sense, "sense_data: length %i\n", sp->sense_count); + for (j = 0; j < sp->sense_count; j++) { + sprintf(tmp1, " %02X", (((unsigned char *) (&sense_cgc))[j])); + strcat(tmp_sense, tmp1); + } + log(("%s\n", tmp_sense)); + + sprintf(tmp_sense, "sense_data: error code 0x%02X, sense key 0x%02X," + " additional length %i, ASC 0x%02X, ASCQ 0x%02X\n", + sg_cgc.sense->error_code, sg_cgc.sense->sense_key, + sg_cgc.sense->add_sense_len, sg_cgc.sense->asc, + sg_cgc.sense->ascq); + + log(("%s\n", tmp_sense)); +#endif /* DEBUG */ + memcpy(sp->u_sense.cmd_sense, /* (caddr_t) */ &sense_cgc, SCG_MAX_SENSE); + sp->u_scb.cmd_scb[0] = ST_CHK_COND; + + switch (sg_cgc.sense->sense_key) { + case SC_UNIT_ATTENTION: + case SC_NOT_READY: + sp->error = SCG_RETRYABLE; /* may be BUS_BUSY */ + sp->u_scb.cmd_scb[0] |= ST_BUSY; + break; + case SC_ILLEGAL_REQUEST: + break; + default: + break; + } + } else { + sp->u_scb.cmd_scb[0] = 0x00; + } + + sp->resid = 0; + return (0); +} +#endif /* USE_ATA */ diff --git a/scsilib/libscg/scsi-linux-pg.c b/scsilib/libscg/scsi-linux-pg.c new file mode 100644 index 0000000..8ad3e7f --- /dev/null +++ b/scsilib/libscg/scsi-linux-pg.c @@ -0,0 +1,618 @@ +/* @(#)scsi-linux-pg.c 1.43 04/01/15 Copyright 1997 J. Schilling */ +#ifndef lint +static char ___sccsid[] = + "@(#)scsi-linux-pg.c 1.43 04/01/15 Copyright 1997 J. Schilling"; +#endif +/* + * Interface for the Linux PARIDE implementation. + * + * We emulate the functionality of the scg driver, via the pg driver. + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1997 J. Schilling + * Copyright (c) 1998 Grant R. Guenther <grant@torque.net> + * Under the terms of the GNU public license. + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <string.h> +#ifdef HAVE_LINUX_PG_H +#include <linux/pg.h> +#else +#include "pg.h" /* Use local version as Linux sometimes doesn't have */ +#endif /* installed. Now libscg always supports PP SCSI */ + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version_pg[] = "scsi-linux-pg.c-1.43"; /* The version for this transport*/ + +#ifdef USE_PG_ONLY + +#define MAX_SCG 1 /* Max # of SCSI controllers */ +#define MAX_TGT 8 +#define MAX_LUN 8 + +struct scg_local { + short scgfiles[MAX_SCG][MAX_TGT][MAX_LUN]; + short buscookies[MAX_SCG]; + int pgbus; + char *SCSIbuf; +}; +#define scglocal(p) ((struct scg_local *)((p)->local)) + +#else + +#define scgo_version pg_version +#define scgo_help pg_help +#define scgo_open pg_open +#define scgo_close pg_close +#define scgo_send pg_send +#define scgo_maxdma pg_maxdma +#define scgo_initiator_id pg_initiator_id +#define scgo_isatapi pg_isatapi +#define scgo_reset pg_reset + +LOCAL char *pg_version __PR((SCSI *scgp, int what)); +LOCAL int pg_help __PR((SCSI *scgp, FILE *f)); +LOCAL int pg_open __PR((SCSI *scgp, char *device)); +LOCAL int pg_close __PR((SCSI *scgp)); +LOCAL long pg_maxdma __PR((SCSI *scgp, long amt)); +LOCAL int pg_initiator_id __PR((SCSI *scgp)); +LOCAL int pg_isatapi __PR((SCSI *scgp)); +LOCAL int pg_reset __PR((SCSI *scgp, int what)); +LOCAL int pg_send __PR((SCSI *scgp)); + +#endif + +LOCAL int do_scg_cmd __PR((SCSI *scgp, struct scg_cmd *sp)); +LOCAL int do_scg_sense __PR((SCSI *scgp, struct scg_cmd *sp)); + + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version_pg); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (___sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "pg", "SCSI transport for ATAPI over Parallel Port", + "", "bus,target,lun", "1,2,0", TRUE, FALSE); + return (0); +} + +#include <glob.h> + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + register int f; + register int b; +#ifdef USE_PG_ONLY + register int t; + register int l; +#endif + register int nopen = 0; + char devname[32]; + glob_t globbuf; + int i; + + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno, target or lun '%d,%d,%d'", + busno, tgt, tlun); + return (-1); + } + +#ifndef USE_PG_ONLY + /* + * We need to find a fake bus number for the parallel port interface. + * Unfortunatly, the buscookie array may contain holes if + * SCSI_IOCTL_GET_BUS_NUMBER works, so we are searching backwards + * for some place for us. + * XXX Should add extra space in buscookies for a "PP bus". + */ + + if (scglocal(scgp)->buscookies[MAX_SCG-1] != (short)-1) + return (0); /* No space for pgbus */ + + for (b = MAX_SCG-1; b >= 0; b--) { + if (scglocal(scgp)->buscookies[b] != (short)-1) { + scglocal(scgp)->pgbus = ++b; + break; + } + } + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "PP Bus: %d\n", scglocal(scgp)->pgbus); + } +#else + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + + scglocal(scgp)->pgbus = -2; + scglocal(scgp)->SCSIbuf = (char *)-1; + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + scglocal(scgp)->scgfiles[b][t][l] = (short)-1; + } + } + } +#endif + if (scglocal(scgp)->pgbus < 0) + scglocal(scgp)->pgbus = 0; + + if ((device != NULL && *device != '\0') || (busno == -2 && tgt == -2)) + goto openbydev; + + if (busno >= 0 && tgt >= 0 && tlun >= 0) { +#ifndef USE_PG_ONLY + if (scglocal(scgp)->pgbus != busno) + return (0); +#endif + js_snprintf(devname, sizeof (devname), "/dev/pg%d", tgt); + f = open(devname, O_RDWR | O_NONBLOCK); + if (f < 0) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '%s'", devname); + return (0); + } + scglocal(scgp)->scgfiles[busno][tgt][tlun] = f; + return (1); + } else { + const char *dev; + tlun = 0; + glob("/dev/pg[0-9]", GLOB_NOSORT, NULL, &globbuf); + glob("/dev/pg[0-9][0-9]", GLOB_NOSORT|GLOB_APPEND, NULL, &globbuf); + for (i = 0; globbuf.gl_pathv && globbuf.gl_pathv[i] != NULL ; i++) { + dev = globbuf.gl_pathv[i]; + tgt = atoi(&dev[7]); + f = open(dev, O_RDWR | O_NONBLOCK); + if (f < 0) { + /* + * Set up error string but let us clear it later + * if at least one open succeeded. + */ + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '/dev/pg*'"); + if (errno != ENOENT && errno != ENXIO && errno != ENODEV) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '%s'", dev); + globfree(&globbuf); + return (0); + } + } else { + scglocal(scgp)->scgfiles[scglocal(scgp)->pgbus][tgt][tlun] = f; + nopen++; + } + } + globfree(&globbuf); + + } + if (nopen > 0 && scgp->errstr) + scgp->errstr[0] = '\0'; + +openbydev: + if (device != NULL && *device != '\0') { + char *p; + + if (tlun < 0) + return (0); + f = open(device, O_RDWR | O_NONBLOCK); +/* if (f < 0 && errno == ENOENT) {*/ + if (f < 0) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '%s'", + device); + return (0); + } + + p = device + strlen(device) -1; + tgt = *p - '0'; + if (tgt < 0 || tgt > 9) + return (0); + scglocal(scgp)->scgfiles[scglocal(scgp)->pgbus][tgt][tlun] = f; + scg_settarget(scgp, scglocal(scgp)->pgbus, tgt, tlun); + + return (++nopen); + } + return (nopen); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + register int f; + register int b; + register int t; + register int l; + + if (scgp->local == NULL) + return (-1); + if (scglocal(scgp)->pgbus < 0) + return (0); + b = scglocal(scgp)->pgbus; + scglocal(scgp)->buscookies[b] = (short)-1; + + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + f = scglocal(scgp)->scgfiles[b][t][l]; + if (f >= 0) + close(f); + scglocal(scgp)->scgfiles[b][t][l] = (short)-1; + } + } + return (0); +} + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + return (PG_MAX_DATA); +} + +#ifdef USE_PG_ONLY + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + char *ret; + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_getbuf: %ld bytes\n", amt); + } + ret = valloc((size_t)(amt+getpagesize())); + if (ret == NULL) + return (ret); + scgp->bufbase = ret; + ret += getpagesize(); + scglocal(scgp)->SCSIbuf = ret; + return ((void *)ret); + +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + register int t; + register int l; + + if (busno < 0 || busno >= MAX_SCG) + return (FALSE); + + if (scgp->local == NULL) + return (FALSE); + + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + if (scglocal(scgp)->scgfiles[busno][t][l] >= 0) + return (TRUE); + } + return (FALSE); +} + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (busno < 0 || busno >= MAX_SCG || + tgt < 0 || tgt >= MAX_TGT || + tlun < 0 || tlun >= MAX_LUN) + return (-1); + + if (scgp->local == NULL) + return (-1); + + return ((int)scglocal(scgp)->scgfiles[busno][tgt][tlun]); +} +#endif /* USE_PG_ONLY */ + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + return (-1); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; +{ + return (TRUE); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + struct pg_write_hdr hdr = {PG_MAGIC, PG_RESET, 0}; + + if (what == SCG_RESET_NOP) + return (0); + if (what != SCG_RESET_BUS) { + errno = EINVAL; + return (-1); + } + /* + * XXX Does this reset TGT or BUS ??? + */ + return (write(scgp->fd, (char *)&hdr, sizeof (hdr))); + +} + +#ifndef MAX +#define MAX(a, b) ((a) > (b) ? (a):(b)) +#endif + +#define RHSIZE sizeof (struct pg_read_hdr) +#define WHSIZE sizeof (struct pg_write_hdr) +#define LEAD MAX(RHSIZE, WHSIZE) + +LOCAL int +do_scg_cmd(scgp, sp) + SCSI *scgp; + struct scg_cmd *sp; +{ + + char local[LEAD+PG_MAX_DATA]; + int use_local, i, r; + int inward = (sp->flags & SCG_RECV_DATA); + + struct pg_write_hdr *whp; + struct pg_read_hdr *rhp; + char *dbp; + + if (sp->cdb_len > 12) + comerrno(EX_BAD, "Can't do %d byte command.\n", sp->cdb_len); + + if (sp->addr == scglocal(scgp)->SCSIbuf) { + use_local = 0; + dbp = sp->addr; + } else { + use_local = 1; + dbp = &local[LEAD]; + if (!inward) + movebytes(sp->addr, dbp, sp->size); + } + + whp = (struct pg_write_hdr *)(dbp - WHSIZE); + rhp = (struct pg_read_hdr *)(dbp - RHSIZE); + + whp->magic = PG_MAGIC; + whp->func = PG_COMMAND; + whp->dlen = sp->size; + whp->timeout = sp->timeout; + + for (i = 0; i < 12; i++) { + if (i < sp->cdb_len) + whp->packet[i] = sp->cdb.cmd_cdb[i]; + else + whp->packet[i] = 0; + } + + i = WHSIZE; + if (!inward) + i += sp->size; + + r = write(scgp->fd, (char *)whp, i); + + if (r < 0) { /* command was not sent */ + sp->ux_errno = geterrno(); + if (sp->ux_errno == ETIME) { + /* + * If the previous command timed out, we cannot send + * any further command until the command in the drive + * is ready. So we behave as if the drive did not + * respond to the command. + */ + sp->error = SCG_FATAL; + return (0); + } + return (-1); + } + + if (r != i) + errmsg("scgo_send(%s) wrote %d bytes (expected %d).\n", + scgp->cmdname, r, i); + + sp->ux_errno = 0; + sp->sense_count = 0; + + r = read(scgp->fd, (char *)rhp, RHSIZE+sp->size); + + if (r < 0) { + sp->ux_errno = geterrno(); + if (sp->ux_errno == ETIME) { + sp->error = SCG_TIMEOUT; + return (0); + } + sp->error = SCG_FATAL; + return (-1); + } + + i = rhp->dlen; + if (i > sp->size) { + /* + * "DMA overrun" should be handled in the kernel. + * However this may happen with flaky PP adapters. + */ + errmsgno(EX_BAD, + "DMA (read) overrun by %d bytes (requested %d bytes).\n", + i - sp->size, sp->size); + sp->resid = sp->size - i; + sp->error = SCG_RETRYABLE; + i = sp->size; + } else { + sp->resid = sp->size - i; + } + + if (use_local && inward) + movebytes(dbp, sp->addr, i); + + fillbytes(&sp->scb, sizeof (sp->scb), '\0'); + fillbytes(&sp->u_sense.cmd_sense, sizeof (sp->u_sense.cmd_sense), '\0'); + + sp->error = SCG_NO_ERROR; + i = rhp->scsi?2:0; +/* i = rhp->scsi;*/ + sp->u_scb.cmd_scb[0] = i; + if (i & 2) { + if (sp->ux_errno == 0) + sp->ux_errno = EIO; + /* + * If there is no DMA overrun and there is a + * SCSI Status byte != 0 then the SCSI cdb transport was OK + * and sp->error must be SCG_NO_ERROR. + */ +/* sp->error = SCG_RETRYABLE;*/ + } + + return (0); + +} + +LOCAL int +do_scg_sense(scgp, sp) + SCSI *scgp; + struct scg_cmd *sp; +{ + int ret; + struct scg_cmd s_cmd; + + fillbytes((caddr_t)&s_cmd, sizeof (s_cmd), '\0'); + s_cmd.addr = (caddr_t)sp->u_sense.cmd_sense; + s_cmd.size = sp->sense_len; + s_cmd.flags = SCG_RECV_DATA|SCG_DISRE_ENA; + s_cmd.cdb_len = SC_G0_CDBLEN; + s_cmd.sense_len = CCS_SENSE_LEN; + s_cmd.cdb.g0_cdb.cmd = SC_REQUEST_SENSE; + s_cmd.cdb.g0_cdb.lun = sp->cdb.g0_cdb.lun; + s_cmd.cdb.g0_cdb.count = sp->sense_len; + ret = do_scg_cmd(scgp, &s_cmd); + + if (ret < 0) + return (ret); + + sp->sense_count = sp->sense_len - s_cmd.resid; + return (ret); +} + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + int ret; + + if (scgp->fd < 0) { + sp->error = SCG_FATAL; + return (0); + } + ret = do_scg_cmd(scgp, sp); + if (ret < 0) + return (ret); + if (sp->u_scb.cmd_scb[0] & 2) + ret = do_scg_sense(scgp, sp); + return (ret); +} + +/* end of scsi-linux-pg.c */ + +#ifndef USE_PG_ONLY + +#undef scgo_version +#undef scgo_help +#undef scgo_open +#undef scgo_close +#undef scgo_send +#undef scgo_maxdma +#undef scgo_initiator_id +#undef scgo_isatapi +#undef scgo_reset + +#endif diff --git a/scsilib/libscg/scsi-linux-sg.c b/scsilib/libscg/scsi-linux-sg.c new file mode 100644 index 0000000..f71d058 --- /dev/null +++ b/scsilib/libscg/scsi-linux-sg.c @@ -0,0 +1,1641 @@ +/* @(#)scsi-linux-sg.c 1.83 04/05/20 Copyright 1997 J. Schilling */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-linux-sg.c 1.83 04/05/20 Copyright 1997 J. Schilling"; +#endif +/* + * Interface for Linux generic SCSI implementation (sg). + * + * This is the interface for the broken Linux SCSI generic driver. + * This is a hack, that tries to emulate the functionality + * of the scg driver. + * + * Design flaws of the sg driver: + * - cannot see if SCSI command could not be send + * - cannot get SCSI status byte + * - cannot get real dma count of tranfer + * - cannot get number of bytes valid in auto sense data + * - to few data in auto sense (CCS/SCSI-2/SCSI-3 needs >= 18) + * + * This code contains support for the sg driver version 2 by + * H. Ei�feld & J. Schilling + * Although this enhanced version has been announced to Linus and Alan, + * there was no reaction at all. + * + * About half a year later there occured a version in the official + * Linux that was also called version 2. The interface of this version + * looks like a playground - the enhancements from this version are + * more or less useless for a portable real-world program. + * + * With Linux 2.4 the official version of the sg driver is called 3.x + * and seems to be usable again. The main problem now is the curious + * interface that is provided to raise the DMA limit from 32 kB to a + * more reasonable value. To do this in a reliable way, a lot of actions + * are required. + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1997 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <linux/version.h> + +#ifndef LINUX_VERSION_CODE /* Very old kernel? */ +# define LINUX_VERSION_CODE 0 +#endif + +#if LINUX_VERSION_CODE >= 0x01031a /* <linux/scsi.h> introduced in 1.3.26 */ +#if LINUX_VERSION_CODE >= 0x020000 /* <scsi/scsi.h> introduced somewhere. */ + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) + #define __KERNEL__ + #include <asm/types.h> + #include <asm/byteorder.h> + #undef __KERNEL__ +#endif + +/* Need to fine tune the ifdef so we get the transition point right. */ +#include <scsi/scsi.h> +#else +#include <linux/scsi.h> +#endif +#else /* LINUX_VERSION_CODE == 0 Very old kernel? */ +#define __KERNEL__ /* Some Linux Include files are inconsistent */ +#include <linux/fs.h> /* From ancient versions, really needed? */ +#undef __KERNEL__ +#include "block/blk.h" /* From ancient versions, really needed? */ +#include "scsi/scsi.h" +#endif + +#include "scsi/sg.h" +#include "oexcl.h" + +#undef sense /* conflict in struct cdrom_generic_command */ +#include <linux/cdrom.h> + +#if defined(CDROM_PACKET_SIZE) && defined(CDROM_SEND_PACKET) +#define USE_ATA +#endif + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-linux-sg.c-1.83-RH"; /* The version for this transport*/ + +#ifndef SCSI_IOCTL_GET_BUS_NUMBER +#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386 +#endif + +/* + * XXX There must be a better way than duplicating things from system include + * XXX files. This is stolen from /usr/src/linux/drivers/scsi/scsi.h + */ +#ifndef DID_OK +#define DID_OK 0x00 /* NO error */ +#define DID_NO_CONNECT 0x01 /* Couldn't connect before timeout period */ +#define DID_BUS_BUSY 0x02 /* BUS stayed busy through time out period */ +#define DID_TIME_OUT 0x03 /* TIMED OUT for other reason */ +#define DID_BAD_TARGET 0x04 /* BAD target. */ +#define DID_ABORT 0x05 /* Told to abort for some other reason */ +#define DID_PARITY 0x06 /* Parity error */ +#define DID_ERROR 0x07 /* Internal error */ +#define DID_RESET 0x08 /* Reset by somebody. */ +#define DID_BAD_INTR 0x09 /* Got an interrupt we weren't expecting. */ +#endif + +/* + * These indicate the error that occurred, and what is available. + */ +#ifndef DRIVER_BUSY +#define DRIVER_BUSY 0x01 +#define DRIVER_SOFT 0x02 +#define DRIVER_MEDIA 0x03 +#define DRIVER_ERROR 0x04 + +#define DRIVER_INVALID 0x05 +#define DRIVER_TIMEOUT 0x06 +#define DRIVER_HARD 0x07 +#define DRIVER_SENSE 0x08 +#endif + +/* + * XXX Should add extra space in buscookies and scgfiles for a "PP bus" + * XXX and for two or more "ATAPI busses". + */ +#define MAX_SCG 256 /* Max # of SCSI controllers */ +#define MAX_TGT 16 +#define MAX_LUN 8 + +#ifdef USE_ATA +/* + * # of virtual buses (schilly_host number) + */ +#define MAX_SCHILLY_HOSTS MAX_SCG +typedef struct { + Uchar typ:4; + Uchar bus:4; + Uchar host:8; +} ata_buscookies; +#endif + +struct scg_local { + int scgfile; /* Used for SG_GET_BUFSIZE ioctl()*/ + short scgfiles[MAX_SCG][MAX_TGT][MAX_LUN]; + short buscookies[MAX_SCG]; + int pgbus; + int pack_id; /* Should be a random number */ + int drvers; + short isold; + short flags; + long xbufsize; + char *xbuf; + char *SCSIbuf; +#ifdef USE_ATA + ata_buscookies bc[MAX_SCHILLY_HOSTS]; +#endif +}; +#define scglocal(p) ((struct scg_local *)((p)->local)) + +/* + * Flag definitions + */ +#define LF_ATA 0x01 /* Using /dev/hd* ATA interface */ + +#ifdef SG_BIG_BUFF +#define MAX_DMA_LINUX SG_BIG_BUFF /* Defined in include/scsi/sg.h */ +#else +#define MAX_DMA_LINUX (4*1024) /* Old Linux versions */ +#endif + +#ifndef SG_MAX_SENSE +# define SG_MAX_SENSE 16 /* Too small for CCS / SCSI-2 */ +#endif /* But cannot be changed */ + +#if !defined(__i386) && !defined(i386) && !defined(mc68000) +#define MISALIGN +#endif +/*#define MISALIGN*/ +/*#undef SG_GET_BUFSIZE*/ + +#if defined(USE_PG) && !defined(USE_PG_ONLY) +#include "scsi-linux-pg.c" +#endif +#ifdef USE_ATA +#include "scsi-linux-ata.c" +#endif + + +#ifdef MISALIGN +LOCAL int sg_getint __PR((int *ip)); +#endif +LOCAL int scgo_send __PR((SCSI *scgp)); +#ifdef SG_IO +LOCAL int sg_rwsend __PR((SCSI *scgp)); +#endif +LOCAL void sg_clearnblock __PR((int f)); +LOCAL BOOL sg_setup __PR((SCSI *scgp, int f, int busno, int tgt, int tlun, int ataidx)); +LOCAL void sg_initdev __PR((SCSI *scgp, int f)); +LOCAL int sg_mapbus __PR((SCSI *scgp, int busno, int ino)); +LOCAL BOOL sg_mapdev __PR((SCSI *scgp, int f, int *busp, int *tgtp, int *lunp, + int *chanp, int *inop, int ataidx)); +#if defined(SG_SET_RESERVED_SIZE) && defined(SG_GET_RESERVED_SIZE) +LOCAL long sg_raisedma __PR((SCSI *scgp, long newmax)); +#endif +LOCAL void sg_settimeout __PR((int f, int timeout)); + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { +#ifdef USE_PG + /* + * If we only have a Parallel port or only opened a handle + * for PP, just return PP version. + */ + if (scglocal(scgp)->pgbus == 0 || + (scg_scsibus(scgp) >= 0 && + scg_scsibus(scgp) == scglocal(scgp)->pgbus)) + return (pg_version(scgp, what)); +#endif + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return ("schily - Red Hat"); + case SCG_SCCS_ID: + return (__sccsid); + case SCG_KVERSION: + { + static char kv[16]; + int n; + + if (scglocal(scgp)->drvers >= 0) { + n = scglocal(scgp)->drvers; + js_snprintf(kv, sizeof (kv), + "%d.%d.%d", + n/10000, (n%10000)/100, n%100); + + return (kv); + } + } + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "sg", "Generic transport independent SCSI", + "", "bus,target,lun", "1,2,0", TRUE, FALSE); +#ifdef USE_PG + pg_help(scgp, f); +#endif +#ifdef USE_ATA + scgo_ahelp(scgp, f); +#endif + __scg_help(f, "ATA", "ATA Packet specific SCSI transport using sg interface", + "ATA:", "bus,target,lun", "1,2,0", TRUE, FALSE); + return (0); +} + +#include <glob.h> + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + register int f; + register int i; + register int b; + register int t; + register int l; + register int nopen = 0; + char *devname; + BOOL use_ata = FALSE; + glob_t globbuf; + + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno, target or lun '%d,%d,%d'", + busno, tgt, tlun); + return (-1); + } + if (device != NULL && *device != '\0') { +#ifdef USE_ATA + if (strncmp(device, "ATAPI", 5) == 0) { + if (scgp->overbose) { + js_fprintf((FILE *)scgp->errfile, + "Use of ATA is preferred over ATAPI.\n"); + } + scgp->ops = &ata_ops; + return (SCGO_OPEN(scgp, device)); + } +#endif + if (strcmp(device, "ATA") == 0) { + /* + * Sending generic SCSI commands via /dev/hd* is a + * really bad idea when there also is a generic + * SCSI driver interface - it breaks the protocol + * layering model. A better idea would be to + * have a SCSI host bus adapter driver that sends + * the SCSI commands via the ATA hardware. This way, + * the layering model would be honored. + * + * People like Jens Axboe should finally fix the DMA + * bugs in the ide-scsi hostadaptor emulation module + * from Linux instead of publishing childish patches + * to the comment above. + */ + use_ata = TRUE; + device = NULL; + } + } + + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + + scglocal(scgp)->scgfile = -1; + scglocal(scgp)->pgbus = -2; + scglocal(scgp)->SCSIbuf = (char *)-1; + scglocal(scgp)->pack_id = 5; + scglocal(scgp)->drvers = -1; + scglocal(scgp)->isold = -1; + scglocal(scgp)->flags = 0; + if (use_ata) + scglocal(scgp)->flags |= LF_ATA; + scglocal(scgp)->xbufsize = 0L; + scglocal(scgp)->xbuf = NULL; + + for (b = 0; b < MAX_SCG; b++) { + scglocal(scgp)->buscookies[b] = (short)-1; + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + scglocal(scgp)->scgfiles[b][t][l] = (short)-1; + } + } + } + + if (use_ata) + goto scanopen; + + if ((device != NULL && *device != '\0') || (busno == -2 && tgt == -2)) + goto openbydev; + +scanopen: + /* + * Note that it makes no sense to scan less than all /dev/hd* devices + * as even /dev/hda may be a device that talks SCSI (e.g. a ATAPI + * notebook disk or a CD/DVD writer). The CD/DVD writer case may + * look silly but there may be users that did boot from a SCSI hdd + * and connected 4 CD/DVD writers to both IDE cables in the PC. + */ + if (use_ata) { + glob("/dev/hd[a-z]", GLOB_NOSORT, NULL, &globbuf); + + for (i = 0; globbuf.gl_pathv && globbuf.gl_pathv[i] != NULL ; i++) { + devname = globbuf.gl_pathv[i]; + f = open(devname, O_RDWR | O_NONBLOCK); + if (f < 0) { + /* + * Set up error string but let us clear it later + * if at least one open succeeded. + */ + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '/dev/hd*'"); + if (errno != ENOENT && errno != ENXIO && errno != ENODEV && errno != EACCES) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '%s'", devname); + globfree(&globbuf); + return (0); + } + } else { + int iparm; + + if (ioctl(f, SG_GET_TIMEOUT, &iparm) < 0) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "SCSI unsupported with '/dev/hd*'"); + close(f); + continue; + } + sg_clearnblock(f); /* Be very proper about this */ + if (sg_setup(scgp, f, busno, tgt, tlun, devname[7]-'a')) { + globfree(&globbuf); + return (++nopen); + } + if (busno < 0 && tgt < 0 && tlun < 0) + nopen++; + } + } + globfree(&globbuf); + } + if (use_ata && nopen == 0) + return (0); + if (nopen > 0 && scgp->errstr) + scgp->errstr[0] = '\0'; + + if (nopen == 0) { + glob("/dev/scd[0-9]", GLOB_NOSORT, NULL, &globbuf); + glob("/dev/scd[0-9][0-9]", GLOB_NOSORT|GLOB_APPEND, NULL, &globbuf); + glob("/dev/sg[a-z]", GLOB_NOSORT|GLOB_APPEND, NULL, &globbuf); + glob("/dev/sg[0-9]", GLOB_NOSORT|GLOB_APPEND, NULL, &globbuf); + glob("/dev/sr[0-9]", GLOB_NOSORT|GLOB_APPEND, NULL, &globbuf); + + for (i = 0; globbuf.gl_pathv && globbuf.gl_pathv[i] != NULL ; i++) { + devname = globbuf.gl_pathv[i]; + + f = open(devname, O_RDWR | O_NONBLOCK); + if (f < 0) { + /* + * Set up error string but let us clear it later + * if at least one open succeeded. + */ + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '/dev/scd*'"); + } else { + sg_clearnblock(f); /* Be very proper about this */ + if (sg_setup(scgp, f, busno, tgt, tlun, -1)) { + globfree(&globbuf); + return (++nopen); + } + if (busno < 0 && tgt < 0 && tlun < 0) + nopen++; + } + } + } + if (nopen > 0 && scgp->errstr) + scgp->errstr[0] = '\0'; + + +openbydev: + if (device != NULL && *device != '\0') { + b = -1; + if (strlen(device) == 8 && strncmp(device, "/dev/hd", 7) == 0) { + b = device[7] - 'a'; + if (b < 0 || b > 25) + b = -1; + } + /* O_NONBLOCK is dangerous */ + f = openexcl(device, O_RDWR | O_NONBLOCK); +/* if (f < 0 && errno == ENOENT)*/ +/* goto openpg;*/ + + if (f < 0) { + /* + * The pg driver has the same rules to decide whether + * to use openbydev. If we cannot open the device, it + * makes no sense to try the /dev/pg* driver. + */ + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '%s'", + device); + return (0); + } + + sg_clearnblock(f); /* Be very proper about this */ + if (!sg_mapdev(scgp, f, &busno, &tgt, &tlun, 0, 0, b)) { + close(f); + /* + * If sg_mapdev() failes, this may be /dev/pg* device. + */ + goto openpg; + } + +#ifdef OOO + if (scg_scsibus(scgp) < 0) + scg_scsibus(scgp) = busno; + if (scg_target(scgp) < 0) + scg_target(scgp) = tgt; + if (scg_lun(scgp) < 0) + scg_lun(scgp) = tlun; +#endif + + scg_settarget(scgp, busno, tgt, tlun); + if (sg_setup(scgp, f, busno, tgt, tlun, b)) + return (++nopen); + } +openpg: +#ifdef USE_PG + nopen += pg_open(scgp, device); +#endif + if (scgp->debug > 0) for (b = 0; b < MAX_SCG; b++) { + js_fprintf((FILE *)scgp->errfile, + "Bus: %d cookie: %X\n", + b, scglocal(scgp)->buscookies[b]); + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + if (scglocal(scgp)->scgfiles[b][t][l] != (short)-1) { + js_fprintf((FILE *)scgp->errfile, + "file (%d,%d,%d): %d\n", + b, t, l, scglocal(scgp)->scgfiles[b][t][l]); + } + } + } + } + return (nopen); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + register int f; + register int b; + register int t; + register int l; + + if (scgp->local == NULL) + return (-1); + + for (b = 0; b < MAX_SCG; b++) { + if (b == scglocal(scgp)->pgbus) + continue; + scglocal(scgp)->buscookies[b] = (short)-1; + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + f = scglocal(scgp)->scgfiles[b][t][l]; + if (f >= 0) + close(f); + scglocal(scgp)->scgfiles[b][t][l] = (short)-1; + } + } + } + if (scglocal(scgp)->xbuf != NULL) { + free(scglocal(scgp)->xbuf); + scglocal(scgp)->xbufsize = 0L; + scglocal(scgp)->xbuf = NULL; + } +#ifdef USE_PG + pg_close(scgp); +#endif + return (0); +} + +/* + * The Linux kernel becomes more and more unmaintainable. + * Every year, a new incompatible SCSI transport interface is added. + * Each of them has it's own contradictory constraints. + * While you cannot have O_NONBLOCK set during operation, at least one + * of the drivers requires O_NONBLOCK to be set during open(). + * This is used to clear O_NONBLOCK immediately after open() succeeded. + */ +LOCAL void +sg_clearnblock(f) + int f; +{ + int n; + + n = fcntl(f, F_GETFL); + n &= ~O_NONBLOCK; + fcntl(f, F_SETFL, n); +} + +LOCAL BOOL +sg_setup(scgp, f, busno, tgt, tlun, ataidx) + SCSI *scgp; + int f; + int busno; + int tgt; + int tlun; + int ataidx; +{ + int n; + int Chan; + int Ino; + int Bus; + int Target; + int Lun; + BOOL onetarget = FALSE; + +#ifdef SG_GET_VERSION_NUM + if (scglocal(scgp)->drvers < 0) { + scglocal(scgp)->drvers = 0; + if (ioctl(f, SG_GET_VERSION_NUM, &n) >= 0) { + scglocal(scgp)->drvers = n; + if (scgp->overbose) { + js_fprintf((FILE *)scgp->errfile, + "Linux sg driver version: %d.%d.%d\n", + n/10000, (n%10000)/100, n%100); + } + } + } +#endif + if (scg_scsibus(scgp) >= 0 && scg_target(scgp) >= 0 && scg_lun(scgp) >= 0) + onetarget = TRUE; + + sg_mapdev(scgp, f, &Bus, &Target, &Lun, &Chan, &Ino, ataidx); + + /* + * For old kernels try to make the best guess. + */ + Ino |= Chan << 8; + n = sg_mapbus(scgp, Bus, Ino); + if (Bus == -1) { + Bus = n; + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "SCSI Bus: %d (mapped from %d)\n", Bus, Ino); + } + } + + if (Bus < 0 || Bus >= MAX_SCG || Target < 0 || Target >= MAX_TGT || + Lun < 0 || Lun >= MAX_LUN) { + return (FALSE); + } + + if (scglocal(scgp)->scgfiles[Bus][Target][Lun] == (short)-1) + scglocal(scgp)->scgfiles[Bus][Target][Lun] = (short)f; + + if (onetarget) { + if (Bus == busno && Target == tgt && Lun == tlun) { + sg_initdev(scgp, f); + scglocal(scgp)->scgfile = f; /* remember file for ioctl's */ + return (TRUE); + } else { + scglocal(scgp)->scgfiles[Bus][Target][Lun] = (short)-1; + close(f); + } + } else { + /* + * SCSI bus scanning may cause other generic SCSI activities to + * fail because we set the default timeout and clear command + * queues (in case of the old sg driver interface). + */ + sg_initdev(scgp, f); + if (scglocal(scgp)->scgfile < 0) + scglocal(scgp)->scgfile = f; /* remember file for ioctl's */ + } + return (FALSE); +} + +LOCAL void +sg_initdev(scgp, f) + SCSI *scgp; + int f; +{ + struct sg_rep { + struct sg_header hd; + unsigned char rbuf[100]; + } sg_rep; + int n; + int i; + struct stat sb; + + sg_settimeout(f, scgp->deftimeout); + + /* + * If it's a block device, don't read.... pre Linux-2.4 /dev/sg* + * definitely is a character device and we only need to clear the + * queue for old /dev/sg* versions. If somebody ever implements + * raw disk access for Linux, this test may fail. + */ + if (fstat(f, &sb) >= 0 && S_ISBLK(sb.st_mode)) + return; + + /* Eat any unwanted garbage from prior use of this device */ + + n = fcntl(f, F_GETFL); /* Be very proper about this */ + fcntl(f, F_SETFL, n|O_NONBLOCK); + + fillbytes((caddr_t)&sg_rep, sizeof (struct sg_header), '\0'); + sg_rep.hd.reply_len = sizeof (struct sg_header); + + /* + * This is really ugly. + * We come here if 'f' is related to a raw device. If Linux + * will ever have raw devices for /dev/hd* we may get problems. + * As long as there is no clean way to find out whether the + * filedescriptor 'f' is related to an old /dev/sg* or to + * /dev/hd*, we must assume that we found an old /dev/sg* and + * clean it up. Unfortunately, reading from /dev/hd* will + * Access the medium. + */ + for (i = 0; i < 1000; i++) { /* Read at least 32k from /dev/sg* */ + int ret; + + ret = read(f, &sg_rep, sizeof (sg_rep)); + if (ret > 0) + continue; + if (ret == 0 || errno == EAGAIN || errno == EIO) + break; + if (ret < 0 && i > 10) /* Stop on repeated unknown error */ + break; + } + fcntl(f, F_SETFL, n); +} + +LOCAL int +sg_mapbus(scgp, busno, ino) + SCSI *scgp; + int busno; + int ino; +{ + register int i; + + if (busno >= 0 && busno < MAX_SCG) { + /* + * SCSI_IOCTL_GET_BUS_NUMBER worked. + * Now we have the problem that Linux does not properly number + * SCSI busses. The Bus number that Linux creates really is + * the controller (card) number. I case of multi SCSI bus + * cards we are lost. + */ + if (scglocal(scgp)->buscookies[busno] == (short)-1) { + scglocal(scgp)->buscookies[busno] = ino; + return (busno); + } + if (scglocal(scgp)->buscookies[busno] != (short)ino) + errmsgno(EX_BAD, "Warning Linux Bus mapping botch.\n"); + return (busno); + + } else for (i = 0; i < MAX_SCG; i++) { + if (scglocal(scgp)->buscookies[i] == (short)-1) { + scglocal(scgp)->buscookies[i] = ino; + return (i); + } + + if (scglocal(scgp)->buscookies[i] == ino) + return (i); + } + return (0); +} + +LOCAL BOOL +sg_mapdev(scgp, f, busp, tgtp, lunp, chanp, inop, ataidx) + SCSI *scgp; + int f; + int *busp; + int *tgtp; + int *lunp; + int *chanp; + int *inop; + int ataidx; +{ + struct sg_id { + long l1; /* target | lun << 8 | channel << 16 | low_ino << 24 */ + long l2; /* Unique id */ + } sg_id; + int Chan; + int Ino; + int Bus; + int Target; + int Lun; + + if (ataidx >= 0) { + /* + * The badly designed /dev/hd* interface maps everything + * to 0,0,0 so we need to do the mapping ourselves. + */ + *busp = ataidx / 2; + *tgtp = ataidx % 2; + *lunp = 0; + if (chanp) + *chanp = 0; + if (inop) + *inop = 0; + return (TRUE); + } + if (ioctl(f, SCSI_IOCTL_GET_IDLUN, &sg_id)) + return (FALSE); + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "l1: 0x%lX l2: 0x%lX\n", sg_id.l1, sg_id.l2); + } + if (ioctl(f, SCSI_IOCTL_GET_BUS_NUMBER, &Bus) < 0) { + Bus = -1; + } + + Target = sg_id.l1 & 0xFF; + Lun = (sg_id.l1 >> 8) & 0xFF; + Chan = (sg_id.l1 >> 16) & 0xFF; + Ino = (sg_id.l1 >> 24) & 0xFF; + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "Bus: %d Target: %d Lun: %d Chan: %d Ino: %d\n", + Bus, Target, Lun, Chan, Ino); + } + *busp = Bus; + *tgtp = Target; + *lunp = Lun; + if (chanp) + *chanp = Chan; + if (inop) + *inop = Ino; + return (TRUE); +} + +#if defined(SG_SET_RESERVED_SIZE) && defined(SG_GET_RESERVED_SIZE) +/* + * The way Linux does DMA resouce management is a bit curious. + * It totally deviates from all other OS and forces long ugly code. + * If we are opening all drivers for a SCSI bus scan operation, we need + * to set the limit for all open devices. + * This may use up all kernel memory ... so do the job carefully. + * + * A big problem is that SG_SET_RESERVED_SIZE does not return any hint + * on whether the request did fail. The only way to find if it worked + * is to use SG_GET_RESERVED_SIZE to read back the current values. + */ +LOCAL long +sg_raisedma(scgp, newmax) + SCSI *scgp; + long newmax; +{ + register int b; + register int t; + register int l; + register int f; + int val; + int old; + + /* + * First try to raise the DMA limit to a moderate value that + * most likely does not use up all kernel memory. + */ + val = 126*1024; + + if (val > MAX_DMA_LINUX) { + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + if ((f = SCGO_FILENO(scgp, b, t, l)) < 0) + continue; + old = 0; + if (ioctl(f, SG_GET_RESERVED_SIZE, &old) < 0) + continue; + if (val > old) + ioctl(f, SG_SET_RESERVED_SIZE, &val); + } + } + } + } + + /* + * Now to raise the DMA limit to what we really need. + */ + if (newmax > val) { + val = newmax; + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + if ((f = SCGO_FILENO(scgp, b, t, l)) < 0) + continue; + old = 0; + if (ioctl(f, SG_GET_RESERVED_SIZE, &old) < 0) + continue; + if (val > old) + ioctl(f, SG_SET_RESERVED_SIZE, &val); + } + } + } + } + + /* + * To make sure we did not fail (the ioctl does not report errors) + * we need to check the DMA limits. We return the smallest value. + */ + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + if ((f = SCGO_FILENO(scgp, b, t, l)) < 0) + continue; + if (ioctl(f, SG_GET_RESERVED_SIZE, &val) < 0) + continue; + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "Target (%d,%d,%d): DMA max %d old max: %ld\n", + b, t, l, val, newmax); + } + if (val < newmax) + newmax = val; + } + } + } + return ((long)newmax); +} +#endif + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + long maxdma = MAX_DMA_LINUX; + +#if defined(SG_SET_RESERVED_SIZE) && defined(SG_GET_RESERVED_SIZE) + /* + * Use the curious new kernel interface found on Linux >= 2.2.10 + * This interface first appeared in 2.2.6 but it was not working. + */ + if (scglocal(scgp)->drvers >= 20134) + maxdma = sg_raisedma(scgp, amt); +#endif +#ifdef SG_GET_BUFSIZE + /* + * We assume that all /dev/sg instances use the same + * maximum buffer size. + */ + maxdma = ioctl(scglocal(scgp)->scgfile, SG_GET_BUFSIZE, 0); +#endif + if (maxdma < 0) { +#ifdef USE_PG + /* + * If we only have a Parallel port, just return PP maxdma. + */ + if (scglocal(scgp)->pgbus == 0) + return (pg_maxdma(scgp, amt)); +#endif + if (scglocal(scgp)->scgfile >= 0) + maxdma = MAX_DMA_LINUX; + } +#ifdef USE_PG + if (scg_scsibus(scgp) == scglocal(scgp)->pgbus) + return (pg_maxdma(scgp, amt)); + if ((scg_scsibus(scgp) < 0) && (pg_maxdma(scgp, amt) < maxdma)) + return (pg_maxdma(scgp, amt)); +#endif + return (maxdma); +} + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + char *ret; + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_getbuf: %ld bytes\n", amt); + } + /* + * For performance reason, we allocate pagesize() + * bytes before the SCSI buffer to avoid + * copying the whole buffer contents when + * setting up the /dev/sg data structures. + */ + ret = valloc((size_t)(amt+getpagesize())); + if (ret == NULL) + return (ret); + scgp->bufbase = ret; + ret += getpagesize(); + scglocal(scgp)->SCSIbuf = ret; + return ((void *)ret); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + register int t; + register int l; + + if (busno < 0 || busno >= MAX_SCG) + return (FALSE); + + if (scgp->local == NULL) + return (FALSE); + + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + if (scglocal(scgp)->scgfiles[busno][t][l] >= 0) + return (TRUE); + } + return (FALSE); +} + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (busno < 0 || busno >= MAX_SCG || + tgt < 0 || tgt >= MAX_TGT || + tlun < 0 || tlun >= MAX_LUN) + return (-1); + + if (scgp->local == NULL) + return (-1); + + return ((int)scglocal(scgp)->scgfiles[busno][tgt][tlun]); +} + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ +#ifdef USE_PG + if (scg_scsibus(scgp) == scglocal(scgp)->pgbus) + return (pg_initiator_id(scgp)); +#endif + return (-1); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; +{ +#ifdef USE_PG + if (scg_scsibus(scgp) == scglocal(scgp)->pgbus) + return (pg_isatapi(scgp)); +#endif + + /* + * The /dev/hd* interface always returns TRUE for SG_EMULATED_HOST. + * So this is completely useless. + */ + if (scglocal(scgp)->flags & LF_ATA) + return (-1); + +#ifdef SG_EMULATED_HOST + { + int emulated = FALSE; + + /* + * XXX Should we use this at all? + * XXX The badly designed /dev/hd* interface always + * XXX returns TRUE, even when used with e.g. /dev/sr0. + */ + if (ioctl(scgp->fd, SG_EMULATED_HOST, &emulated) >= 0) + return (emulated != 0); + } +#endif + return (-1); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ +#ifdef SG_SCSI_RESET + int f = scgp->fd; + int func = -1; +#endif +#ifdef USE_PG + if (scg_scsibus(scgp) == scglocal(scgp)->pgbus) + return (pg_reset(scgp, what)); +#endif + /* + * Do we have a SCSI reset in the Linux sg driver? + */ +#ifdef SG_SCSI_RESET + /* + * Newer Linux sg driver seem to finally implement it... + */ +#ifdef SG_SCSI_RESET_NOTHING + func = SG_SCSI_RESET_NOTHING; + if (ioctl(f, SG_SCSI_RESET, &func) >= 0) { + if (what == SCG_RESET_NOP) + return (0); +#ifdef SG_SCSI_RESET_DEVICE + if (what == SCG_RESET_TGT) { + func = SG_SCSI_RESET_DEVICE; + if (ioctl(f, SG_SCSI_RESET, &func) >= 0) + return (0); + } +#endif +#ifdef SG_SCSI_RESET_BUS + if (what == SCG_RESET_BUS) { + func = SG_SCSI_RESET_BUS; + if (ioctl(f, SG_SCSI_RESET, &func) >= 0) + return (0); + } +#endif + } +#endif +#endif + return (-1); +} + +LOCAL void +sg_settimeout(f, tmo) + int f; + int tmo; +{ + tmo *= HZ; + if (tmo) + tmo += HZ/2; + + if (ioctl(f, SG_SET_TIMEOUT, &tmo) < 0) + comerr("Cannot set SG_SET_TIMEOUT.\n"); +} + +/* + * Get misaligned int. + * Needed for all recent processors (sparc/ppc/alpha) + * because the /dev/sg design forces us to do misaligned + * reads of integers. + */ +#ifdef MISALIGN +LOCAL int +sg_getint(ip) + int *ip; +{ + int ret; + register char *cp = (char *)ip; + register char *tp = (char *)&ret; + register int i; + + for (i = sizeof (int); --i >= 0; ) + *tp++ = *cp++; + + return (ret); +} +#define GETINT(a) sg_getint(&(a)) +#else +#define GETINT(a) (a) +#endif + +#ifdef SG_IO +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + int ret; + sg_io_hdr_t sg_io; + struct timeval to; + + if (scgp->fd < 0) { + sp->error = SCG_FATAL; + sp->ux_errno = EIO; + return (0); + } + if (scglocal(scgp)->isold > 0) { + return (sg_rwsend(scgp)); + } + fillbytes((caddr_t)&sg_io, sizeof (sg_io), '\0'); + + sg_io.interface_id = 'S'; + + if (sp->flags & SCG_RECV_DATA) { + sg_io.dxfer_direction = SG_DXFER_FROM_DEV; + } else if (sp->size > 0) { + sg_io.dxfer_direction = SG_DXFER_TO_DEV; + } else { + sg_io.dxfer_direction = SG_DXFER_NONE; + } + sg_io.cmd_len = sp->cdb_len; + if (sp->sense_len > SG_MAX_SENSE) + sg_io.mx_sb_len = SG_MAX_SENSE; + else + sg_io.mx_sb_len = sp->sense_len; + sg_io.dxfer_len = sp->size; + sg_io.dxferp = sp->addr; + sg_io.cmdp = sp->cdb.cmd_cdb; + sg_io.sbp = sp->u_sense.cmd_sense; + sg_io.timeout = sp->timeout*1000; + sg_io.flags |= SG_FLAG_DIRECT_IO; + + ret = ioctl(scgp->fd, SG_IO, &sg_io); + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "ioctl ret: %d\n", ret); + } + + if (ret < 0) { + sp->ux_errno = geterrno(); + /* + * Check if SCSI command cound not be send at all. + * Linux usually returns EINVAL for an unknoen ioctl. + * In case somebody from the Linux kernel team learns that the + * corect errno would be ENOTTY, we check for this errno too. + */ + if ((sp->ux_errno == ENOTTY || sp->ux_errno == EINVAL) && + scglocal(scgp)->isold < 0) { + scglocal(scgp)->isold = 1; + return (sg_rwsend(scgp)); + } + if (sp->ux_errno == ENXIO || + sp->ux_errno == EINVAL || sp->ux_errno == EACCES) { + return (-1); + } + } + + sp->u_scb.cmd_scb[0] = sg_io.status; + sp->sense_count = sg_io.sb_len_wr; + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "host_status: %02X driver_status: %02X\n", + sg_io.host_status, sg_io.driver_status); + } + + switch (sg_io.host_status) { + + case DID_OK: + /* + * If there is no DMA overrun and there is a + * SCSI Status byte != 0 then the SCSI cdb transport + * was OK and sp->error must be SCG_NO_ERROR. + */ + if ((sg_io.driver_status & DRIVER_SENSE) != 0) { + if (sp->ux_errno == 0) + sp->ux_errno = EIO; + + if (sp->u_sense.cmd_sense[0] != 0 && + sp->u_scb.cmd_scb[0] == 0) { + /* + * The Linux SCSI system up to 2.4.xx + * trashes the status byte in the + * kernel. This is true at least for + * ide-scsi emulation. Until this gets + * fixed, we need this hack. + */ + sp->u_scb.cmd_scb[0] = ST_CHK_COND; + if (sp->sense_count == 0) + sp->sense_count = SG_MAX_SENSE; + + if ((sp->u_sense.cmd_sense[2] == 0) && + (sp->u_sense.cmd_sense[12] == 0) && + (sp->u_sense.cmd_sense[13] == 0)) { + /* + * The Linux SCSI system will + * send a request sense for + * even a dma underrun error. + * Clear CHECK CONDITION state + * in case of No Sense. + */ + sp->u_scb.cmd_scb[0] = 0; + sp->u_sense.cmd_sense[0] = 0; + sp->sense_count = 0; + } + } + } + break; + + case DID_NO_CONNECT: /* Arbitration won, retry NO_CONNECT? */ + sp->error = SCG_RETRYABLE; + break; + case DID_BAD_TARGET: + sp->error = SCG_FATAL; + break; + + case DID_TIME_OUT: + __scg_times(scgp); + + if (sp->timeout > 1 && scgp->cmdstop->tv_sec == 0) { + sp->u_scb.cmd_scb[0] = 0; + sp->error = SCG_FATAL; /* a selection timeout */ + } else { + sp->error = SCG_TIMEOUT; + } + break; + + default: + to.tv_sec = sp->timeout; + to.tv_usec = 500000; + __scg_times(scgp); + + if (scgp->cmdstop->tv_sec < to.tv_sec || + (scgp->cmdstop->tv_sec == to.tv_sec && + scgp->cmdstop->tv_usec < to.tv_usec)) { + + sp->ux_errno = 0; + sp->error = SCG_TIMEOUT; /* a timeout */ + } else { + sp->error = SCG_RETRYABLE; + } + break; + } + if (sp->error && sp->ux_errno == 0) + sp->ux_errno = EIO; + + sp->resid = sg_io.resid; + return (0); +} +#else +# define sg_rwsend scgo_send +#endif + +LOCAL int +sg_rwsend(scgp) + SCSI *scgp; +{ + int f = scgp->fd; + struct scg_cmd *sp = scgp->scmd; + struct sg_rq *sgp; + struct sg_rq *sgp2; + int i; + int pack_len; + int reply_len; + int amt = sp->cdb_len; + struct sg_rq { + struct sg_header hd; + unsigned char buf[MAX_DMA_LINUX+SCG_MAX_CMD]; + } sg_rq; +#ifdef SG_GET_BUFSIZE /* We may use a 'sg' version 2 driver */ + char driver_byte; + char host_byte; + char msg_byte; + char status_byte; +#endif + + if (f < 0) { + sp->error = SCG_FATAL; + sp->ux_errno = EIO; + return (0); + } +#ifdef USE_PG + if (scg_scsibus(scgp) == scglocal(scgp)->pgbus) + return (pg_send(scgp)); +#endif + if (sp->timeout != scgp->deftimeout) + sg_settimeout(f, sp->timeout); + + + sgp2 = sgp = &sg_rq; + if (sp->addr == scglocal(scgp)->SCSIbuf) { + sgp = (struct sg_rq *) + (scglocal(scgp)->SCSIbuf - (sizeof (struct sg_header) + amt)); + sgp2 = (struct sg_rq *) + (scglocal(scgp)->SCSIbuf - (sizeof (struct sg_header))); + } else { + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "DMA addr: 0x%8.8lX size: %d - using copy buffer\n", + (long)sp->addr, sp->size); + } + if (sp->size > (int)(sizeof (sg_rq.buf) - SCG_MAX_CMD)) { + + if (scglocal(scgp)->xbuf == NULL) { + scglocal(scgp)->xbufsize = scgp->maxbuf; + scglocal(scgp)->xbuf = + malloc(scglocal(scgp)->xbufsize + + SCG_MAX_CMD + + sizeof (struct sg_header)); + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "Allocated DMA copy buffer, addr: 0x%8.8lX size: %ld\n", + (long)scglocal(scgp)->xbuf, + scgp->maxbuf); + } + } + if (scglocal(scgp)->xbuf == NULL || + sp->size > scglocal(scgp)->xbufsize) { + errno = ENOMEM; + return (-1); + } + sgp2 = sgp = (struct sg_rq *)scglocal(scgp)->xbuf; + } + } + + /* + * This is done to avoid misaligned access of sgp->some_int + */ + pack_len = sizeof (struct sg_header) + amt; + reply_len = sizeof (struct sg_header); + if (sp->flags & SCG_RECV_DATA) { + reply_len += sp->size; + } else { + pack_len += sp->size; + } + +#ifdef MISALIGN + /* + * sgp->some_int may be misaligned if (sp->addr == SCSIbuf) + * This is no problem on Intel porocessors, however + * all other processors don't like it. + * sizeof (struct sg_header) + amt is usually not a multiple of + * sizeof (int). For this reason, we fill in the values into sg_rq + * which is always corectly aligned and then copy it to the real + * location if this location differs from sg_rq. + * Never read/write directly to sgp->some_int !!!!! + */ + fillbytes((caddr_t)&sg_rq, sizeof (struct sg_header), '\0'); + + sg_rq.hd.pack_len = pack_len; + sg_rq.hd.reply_len = reply_len; + sg_rq.hd.pack_id = scglocal(scgp)->pack_id++; +/* sg_rq.hd.result = 0; not needed because of fillbytes() */ + + if ((caddr_t)&sg_rq != (caddr_t)sgp) + movebytes((caddr_t)&sg_rq, (caddr_t)sgp, sizeof (struct sg_header)); +#else + fillbytes((caddr_t)sgp, sizeof (struct sg_header), '\0'); + + sgp->hd.pack_len = pack_len; + sgp->hd.reply_len = reply_len; + sgp->hd.pack_id = scglocal(scgp)->pack_id++; +/* sgp->hd.result = 0; not needed because of fillbytes() */ +#endif + if (amt == 12) + sgp->hd.twelve_byte = 1; + + + for (i = 0; i < amt; i++) { + sgp->buf[i] = sp->cdb.cmd_cdb[i]; + } + if (!(sp->flags & SCG_RECV_DATA)) { + if ((void *)sp->addr != (void *)&sgp->buf[amt]) + movebytes(sp->addr, &sgp->buf[amt], sp->size); + amt += sp->size; + } +#ifdef SG_GET_BUFSIZE + sgp->hd.want_new = 1; /* Order new behaviour */ + sgp->hd.cdb_len = sp->cdb_len; /* Set CDB length */ + if (sp->sense_len > SG_MAX_SENSE) + sgp->hd.sense_len = SG_MAX_SENSE; + else + sgp->hd.sense_len = sp->sense_len; +#endif + i = sizeof (struct sg_header) + amt; + if ((amt = write(f, sgp, i)) < 0) { /* write */ + sg_settimeout(f, scgp->deftimeout); + return (-1); + } else if (amt != i) { + errmsg("scgo_send(%s) wrote %d bytes (expected %d).\n", + scgp->cmdname, amt, i); + } + + if (sp->addr == scglocal(scgp)->SCSIbuf) { + movebytes(sgp, sgp2, sizeof (struct sg_header)); + sgp = sgp2; + } + sgp->hd.sense_buffer[0] = 0; + if ((amt = read(f, sgp, reply_len)) < 0) { /* read */ + sg_settimeout(f, scgp->deftimeout); + return (-1); + } + + if (sp->flags & SCG_RECV_DATA && ((void *)sgp->buf != (void *)sp->addr)) { + movebytes(sgp->buf, sp->addr, sp->size); + } + sp->ux_errno = GETINT(sgp->hd.result); /* Unaligned read */ + sp->error = SCG_NO_ERROR; + +#ifdef SG_GET_BUFSIZE + if (sgp->hd.grant_new) { + sp->sense_count = sgp->hd.sense_len; + pack_len = GETINT(sgp->hd.sg_cmd_status); /* Unaligned read */ + driver_byte = (pack_len >> 24) & 0xFF; + host_byte = (pack_len >> 16) & 0xFF; + msg_byte = (pack_len >> 8) & 0xFF; + status_byte = pack_len & 0xFF; + + switch (host_byte) { + + case DID_OK: + if ((driver_byte & DRIVER_SENSE || + sgp->hd.sense_buffer[0] != 0) && + status_byte == 0) { + /* + * The Linux SCSI system up to 2.4.xx + * trashes the status byte in the + * kernel. This is true at least for + * ide-scsi emulation. Until this gets + * fixed, we need this hack. + */ + status_byte = ST_CHK_COND; + if (sgp->hd.sense_len == 0) + sgp->hd.sense_len = SG_MAX_SENSE; + + if ((sp->u_sense.cmd_sense[2] == 0) && + (sp->u_sense.cmd_sense[12] == 0) && + (sp->u_sense.cmd_sense[13] == 0)) { + /* + * The Linux SCSI system will + * send a request sense for + * even a dma underrun error. + * Clear CHECK CONDITION state + * in case of No Sense. + */ + sp->u_scb.cmd_scb[0] = 0; + sp->u_sense.cmd_sense[0] = 0; + sp->sense_count = 0; + } + } + break; + + case DID_NO_CONNECT: /* Arbitration won, retry NO_CONNECT? */ + sp->error = SCG_RETRYABLE; + break; + + case DID_BAD_TARGET: + sp->error = SCG_FATAL; + break; + + case DID_TIME_OUT: + sp->error = SCG_TIMEOUT; + break; + + default: + sp->error = SCG_RETRYABLE; + + if ((driver_byte & DRIVER_SENSE || + sgp->hd.sense_buffer[0] != 0) && + status_byte == 0) { + status_byte = ST_CHK_COND; + sp->error = SCG_NO_ERROR; + } + if (status_byte != 0 && sgp->hd.sense_len == 0) { + sgp->hd.sense_len = SG_MAX_SENSE; + sp->error = SCG_NO_ERROR; + } + break; + + } + if ((host_byte != DID_OK || status_byte != 0) && sp->ux_errno == 0) + sp->ux_errno = EIO; + sp->u_scb.cmd_scb[0] = status_byte; + if (status_byte & ST_CHK_COND) { + sp->sense_count = sgp->hd.sense_len; + movebytes(sgp->hd.sense_buffer, sp->u_sense.cmd_sense, sp->sense_count); + } + } else +#endif + { + if (GETINT(sgp->hd.result) == EBUSY) { /* Unaligned read */ + struct timeval to; + + to.tv_sec = sp->timeout; + to.tv_usec = 500000; + __scg_times(scgp); + + if (sp->timeout > 1 && scgp->cmdstop->tv_sec == 0) { + sp->u_scb.cmd_scb[0] = 0; + sp->ux_errno = EIO; + sp->error = SCG_FATAL; /* a selection timeout */ + } else if (scgp->cmdstop->tv_sec < to.tv_sec || + (scgp->cmdstop->tv_sec == to.tv_sec && + scgp->cmdstop->tv_usec < to.tv_usec)) { + + sp->ux_errno = EIO; + sp->error = SCG_TIMEOUT; /* a timeout */ + } else { + sp->error = SCG_RETRYABLE; /* may be BUS_BUSY */ + } + } + + if (sp->flags & SCG_RECV_DATA) + sp->resid = (sp->size + sizeof (struct sg_header)) - amt; + else + sp->resid = 0; /* sg version1 cannot return DMA resid count */ + + if (sgp->hd.sense_buffer[0] != 0) { + sp->scb.chk = 1; + sp->sense_count = SG_MAX_SENSE; + movebytes(sgp->hd.sense_buffer, sp->u_sense.cmd_sense, sp->sense_count); + if (sp->ux_errno == 0) + sp->ux_errno = EIO; + } + } + + if (scgp->verbose > 0 && scgp->debug > 0) { +#ifdef SG_GET_BUFSIZE + js_fprintf((FILE *)scgp->errfile, + "status: 0x%08X pack_len: %d, reply_len: %d pack_id: %d result: %d wn: %d gn: %d cdb_len: %d sense_len: %d sense[0]: %02X\n", + GETINT(sgp->hd.sg_cmd_status), + GETINT(sgp->hd.pack_len), + GETINT(sgp->hd.reply_len), + GETINT(sgp->hd.pack_id), + GETINT(sgp->hd.result), + sgp->hd.want_new, + sgp->hd.grant_new, + sgp->hd.cdb_len, + sgp->hd.sense_len, + sgp->hd.sense_buffer[0]); +#else + js_fprintf((FILE *)scgp->errfile, + "pack_len: %d, reply_len: %d pack_id: %d result: %d sense[0]: %02X\n", + GETINT(sgp->hd.pack_len), + GETINT(sgp->hd.reply_len), + GETINT(sgp->hd.pack_id), + GETINT(sgp->hd.result), + sgp->hd.sense_buffer[0]); +#endif +#ifdef DEBUG + js_fprintf((FILE *)scgp->errfile, "sense: "); + for (i = 0; i < 16; i++) + js_fprintf((FILE *)scgp->errfile, "%02X ", sgp->hd.sense_buffer[i]); + js_fprintf((FILE *)scgp->errfile, "\n"); +#endif + } + + if (sp->timeout != scgp->deftimeout) + sg_settimeout(f, scgp->deftimeout); + return (0); +} diff --git a/scsilib/libscg/scsi-linux-sg.c.orig b/scsilib/libscg/scsi-linux-sg.c.orig new file mode 100644 index 0000000..bb86880 --- /dev/null +++ b/scsilib/libscg/scsi-linux-sg.c.orig @@ -0,0 +1,1675 @@ +/* @(#)scsi-linux-sg.c 1.83 04/05/20 Copyright 1997 J. Schilling */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-linux-sg.c 1.83 04/05/20 Copyright 1997 J. Schilling"; +#endif +/* + * Interface for Linux generic SCSI implementation (sg). + * + * This is the interface for the broken Linux SCSI generic driver. + * This is a hack, that tries to emulate the functionality + * of the scg driver. + * + * Design flaws of the sg driver: + * - cannot see if SCSI command could not be send + * - cannot get SCSI status byte + * - cannot get real dma count of tranfer + * - cannot get number of bytes valid in auto sense data + * - to few data in auto sense (CCS/SCSI-2/SCSI-3 needs >= 18) + * + * This code contains support for the sg driver version 2 by + * H. Ei�feld & J. Schilling + * Although this enhanced version has been announced to Linus and Alan, + * there was no reaction at all. + * + * About half a year later there occured a version in the official + * Linux that was also called version 2. The interface of this version + * looks like a playground - the enhancements from this version are + * more or less useless for a portable real-world program. + * + * With Linux 2.4 the official version of the sg driver is called 3.x + * and seems to be usable again. The main problem now is the curious + * interface that is provided to raise the DMA limit from 32 kB to a + * more reasonable value. To do this in a reliable way, a lot of actions + * are required. + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1997 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <linux/version.h> + +#ifndef LINUX_VERSION_CODE /* Very old kernel? */ +# define LINUX_VERSION_CODE 0 +#endif + +#if LINUX_VERSION_CODE >= 0x01031a /* <linux/scsi.h> introduced in 1.3.26 */ +#if LINUX_VERSION_CODE >= 0x020000 /* <scsi/scsi.h> introduced somewhere. */ + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) + #define __KERNEL__ + #include <asm/types.h> + #include <asm/byteorder.h> + #undef __KERNEL__ +#endif + +/* Need to fine tune the ifdef so we get the transition point right. */ +#include <scsi/scsi.h> +#else +#include <linux/scsi.h> +#endif +#else /* LINUX_VERSION_CODE == 0 Very old kernel? */ +#define __KERNEL__ /* Some Linux Include files are inconsistent */ +#include <linux/fs.h> /* From ancient versions, really needed? */ +#undef __KERNEL__ +#include "block/blk.h" /* From ancient versions, really needed? */ +#include "scsi/scsi.h" +#endif + +#include "scsi/sg.h" + +#undef sense /* conflict in struct cdrom_generic_command */ +#include <linux/cdrom.h> + +#if defined(CDROM_PACKET_SIZE) && defined(CDROM_SEND_PACKET) +#define USE_ATA +#endif + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-linux-sg.c-1.83"; /* The version for this transport*/ + +#ifndef SCSI_IOCTL_GET_BUS_NUMBER +#define SCSI_IOCTL_GET_BUS_NUMBER 0x5386 +#endif + +/* + * XXX There must be a better way than duplicating things from system include + * XXX files. This is stolen from /usr/src/linux/drivers/scsi/scsi.h + */ +#ifndef DID_OK +#define DID_OK 0x00 /* NO error */ +#define DID_NO_CONNECT 0x01 /* Couldn't connect before timeout period */ +#define DID_BUS_BUSY 0x02 /* BUS stayed busy through time out period */ +#define DID_TIME_OUT 0x03 /* TIMED OUT for other reason */ +#define DID_BAD_TARGET 0x04 /* BAD target. */ +#define DID_ABORT 0x05 /* Told to abort for some other reason */ +#define DID_PARITY 0x06 /* Parity error */ +#define DID_ERROR 0x07 /* Internal error */ +#define DID_RESET 0x08 /* Reset by somebody. */ +#define DID_BAD_INTR 0x09 /* Got an interrupt we weren't expecting. */ +#endif + +/* + * These indicate the error that occurred, and what is available. + */ +#ifndef DRIVER_BUSY +#define DRIVER_BUSY 0x01 +#define DRIVER_SOFT 0x02 +#define DRIVER_MEDIA 0x03 +#define DRIVER_ERROR 0x04 + +#define DRIVER_INVALID 0x05 +#define DRIVER_TIMEOUT 0x06 +#define DRIVER_HARD 0x07 +#define DRIVER_SENSE 0x08 +#endif + +/* + * XXX Should add extra space in buscookies and scgfiles for a "PP bus" + * XXX and for two or more "ATAPI busses". + */ +#define MAX_SCG 256 /* Max # of SCSI controllers */ +#define MAX_TGT 16 +#define MAX_LUN 8 + +#ifdef USE_ATA +/* + * # of virtual buses (schilly_host number) + */ +#define MAX_SCHILLY_HOSTS MAX_SCG +typedef struct { + Uchar typ:4; + Uchar bus:4; + Uchar host:8; +} ata_buscookies; +#endif + +struct scg_local { + int scgfile; /* Used for SG_GET_BUFSIZE ioctl()*/ + short scgfiles[MAX_SCG][MAX_TGT][MAX_LUN]; + short buscookies[MAX_SCG]; + int pgbus; + int pack_id; /* Should be a random number */ + int drvers; + short isold; + short flags; + long xbufsize; + char *xbuf; + char *SCSIbuf; +#ifdef USE_ATA + ata_buscookies bc[MAX_SCHILLY_HOSTS]; +#endif +}; +#define scglocal(p) ((struct scg_local *)((p)->local)) + +/* + * Flag definitions + */ +#define LF_ATA 0x01 /* Using /dev/hd* ATA interface */ + +#ifdef SG_BIG_BUFF +#define MAX_DMA_LINUX SG_BIG_BUFF /* Defined in include/scsi/sg.h */ +#else +#define MAX_DMA_LINUX (4*1024) /* Old Linux versions */ +#endif + +#ifndef SG_MAX_SENSE +# define SG_MAX_SENSE 16 /* Too small for CCS / SCSI-2 */ +#endif /* But cannot be changed */ + +#if !defined(__i386) && !defined(i386) && !defined(mc68000) +#define MISALIGN +#endif +/*#define MISALIGN*/ +/*#undef SG_GET_BUFSIZE*/ + +#if defined(USE_PG) && !defined(USE_PG_ONLY) +#include "scsi-linux-pg.c" +#endif +#ifdef USE_ATA +#include "scsi-linux-ata.c" +#endif + + +#ifdef MISALIGN +LOCAL int sg_getint __PR((int *ip)); +#endif +LOCAL int scgo_send __PR((SCSI *scgp)); +#ifdef SG_IO +LOCAL int sg_rwsend __PR((SCSI *scgp)); +#endif +LOCAL void sg_clearnblock __PR((int f)); +LOCAL BOOL sg_setup __PR((SCSI *scgp, int f, int busno, int tgt, int tlun, int ataidx)); +LOCAL void sg_initdev __PR((SCSI *scgp, int f)); +LOCAL int sg_mapbus __PR((SCSI *scgp, int busno, int ino)); +LOCAL BOOL sg_mapdev __PR((SCSI *scgp, int f, int *busp, int *tgtp, int *lunp, + int *chanp, int *inop, int ataidx)); +#if defined(SG_SET_RESERVED_SIZE) && defined(SG_GET_RESERVED_SIZE) +LOCAL long sg_raisedma __PR((SCSI *scgp, long newmax)); +#endif +LOCAL void sg_settimeout __PR((int f, int timeout)); + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { +#ifdef USE_PG + /* + * If we only have a Parallel port or only opened a handle + * for PP, just return PP version. + */ + if (scglocal(scgp)->pgbus == 0 || + (scg_scsibus(scgp) >= 0 && + scg_scsibus(scgp) == scglocal(scgp)->pgbus)) + return (pg_version(scgp, what)); +#endif + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (__sccsid); + case SCG_KVERSION: + { + static char kv[16]; + int n; + + if (scglocal(scgp)->drvers >= 0) { + n = scglocal(scgp)->drvers; + js_snprintf(kv, sizeof (kv), + "%d.%d.%d", + n/10000, (n%10000)/100, n%100); + + return (kv); + } + } + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "sg", "Generic transport independent SCSI", + "", "bus,target,lun", "1,2,0", TRUE, FALSE); +#ifdef USE_PG + pg_help(scgp, f); +#endif +#ifdef USE_ATA + scgo_ahelp(scgp, f); +#endif + __scg_help(f, "ATA", "ATA Packet specific SCSI transport using sg interface", + "ATA:", "bus,target,lun", "1,2,0", TRUE, FALSE); + return (0); +} + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + register int f; + register int i; + register int b; + register int t; + register int l; + register int nopen = 0; + char devname[64]; + BOOL use_ata = FALSE; + + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno, target or lun '%d,%d,%d'", + busno, tgt, tlun); + return (-1); + } + if (device != NULL && *device != '\0') { +#ifdef USE_ATA + if (strncmp(device, "ATAPI", 5) == 0) { + scgp->ops = &ata_ops; + return (SCGO_OPEN(scgp, device)); + } +#endif + if (strcmp(device, "ATA") == 0) { + /* + * Sending generic SCSI commands via /dev/hd* is a + * really bad idea when there also is a generic + * SCSI driver interface - it breaks the protocol + * layering model. A better idea would be to + * have a SCSI host bus adapter driver that sends + * the SCSI commands via the ATA hardware. This way, + * the layering model would be honored. + * + * People like Jens Axboe should finally fix the DMA + * bugs in the ide-scsi hostadaptor emulation module + * from Linux instead of publishing childish patches + * to the comment above. + */ + use_ata = TRUE; + device = NULL; + if (scgp->overbose) { + /* + * I strongly encourage people who believe that + * they need to patch this message away to read + * the messages in the Solaris USCSI libscg + * layer instead of wetting their tissues while + * being unwilling to look besides their + * own belly button. + */ + js_fprintf((FILE *)scgp->errfile, + "Warning: Using badly designed ATAPI via /dev/hd* interface.\n"); + } + } + } + + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + + scglocal(scgp)->scgfile = -1; + scglocal(scgp)->pgbus = -2; + scglocal(scgp)->SCSIbuf = (char *)-1; + scglocal(scgp)->pack_id = 5; + scglocal(scgp)->drvers = -1; + scglocal(scgp)->isold = -1; + scglocal(scgp)->flags = 0; + if (use_ata) + scglocal(scgp)->flags |= LF_ATA; + scglocal(scgp)->xbufsize = 0L; + scglocal(scgp)->xbuf = NULL; + + for (b = 0; b < MAX_SCG; b++) { + scglocal(scgp)->buscookies[b] = (short)-1; + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + scglocal(scgp)->scgfiles[b][t][l] = (short)-1; + } + } + } + + if (use_ata) + goto scanopen; + + if ((device != NULL && *device != '\0') || (busno == -2 && tgt == -2)) + goto openbydev; + +scanopen: + /* + * Note that it makes no sense to scan less than all /dev/hd* devices + * as even /dev/hda may be a device that talks SCSI (e.g. a ATAPI + * notebook disk or a CD/DVD writer). The CD/DVD writer case may + * look silly but there may be users that did boot from a SCSI hdd + * and connected 4 CD/DVD writers to both IDE cables in the PC. + */ + if (use_ata) for (i = 0; i <= 25; i++) { + js_snprintf(devname, sizeof (devname), "/dev/hd%c", i+'a'); + /* O_NONBLOCK is dangerous */ + f = open(devname, O_RDWR | O_NONBLOCK); + if (f < 0) { + /* + * Set up error string but let us clear it later + * if at least one open succeeded. + */ + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '/dev/hd*'"); + if (errno != ENOENT && errno != ENXIO && errno != ENODEV) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '%s'", devname); + return (0); + } + } else { + int iparm; + + if (ioctl(f, SG_GET_TIMEOUT, &iparm) < 0) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "SCSI unsupported with '/dev/hd*'"); + close(f); + continue; + } + sg_clearnblock(f); /* Be very proper about this */ + if (sg_setup(scgp, f, busno, tgt, tlun, i)) + return (++nopen); + if (busno < 0 && tgt < 0 && tlun < 0) + nopen++; + } + } + if (use_ata && nopen == 0) + return (0); + if (nopen > 0 && scgp->errstr) + scgp->errstr[0] = '\0'; + + if (nopen == 0) for (i = 0; i < 32; i++) { + js_snprintf(devname, sizeof (devname), "/dev/sg%d", i); + /* O_NONBLOCK is dangerous */ + f = open(devname, O_RDWR | O_NONBLOCK); + if (f < 0) { + /* + * Set up error string but let us clear it later + * if at least one open succeeded. + */ + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '/dev/sg*'"); + if (errno != ENOENT && errno != ENXIO && errno != ENODEV) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '%s'", devname); + return (0); + } + } else { + sg_clearnblock(f); /* Be very proper about this */ + if (sg_setup(scgp, f, busno, tgt, tlun, -1)) + return (++nopen); + if (busno < 0 && tgt < 0 && tlun < 0) + nopen++; + } + } + if (nopen > 0 && scgp->errstr) + scgp->errstr[0] = '\0'; + + if (nopen == 0) for (i = 0; i <= 25; i++) { + js_snprintf(devname, sizeof (devname), "/dev/sg%c", i+'a'); + /* O_NONBLOCK is dangerous */ + f = open(devname, O_RDWR | O_NONBLOCK); + if (f < 0) { + /* + * Set up error string but let us clear it later + * if at least one open succeeded. + */ + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '/dev/sg*'"); + if (errno != ENOENT && errno != ENXIO && errno != ENODEV) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '%s'", devname); + return (0); + } + } else { + sg_clearnblock(f); /* Be very proper about this */ + if (sg_setup(scgp, f, busno, tgt, tlun, -1)) + return (++nopen); + if (busno < 0 && tgt < 0 && tlun < 0) + nopen++; + } + } + if (nopen > 0 && scgp->errstr) + scgp->errstr[0] = '\0'; + +openbydev: + if (device != NULL && *device != '\0') { + b = -1; + if (strlen(device) == 8 && strncmp(device, "/dev/hd", 7) == 0) { + b = device[7] - 'a'; + if (b < 0 || b > 25) + b = -1; + } + if (scgp->overbose) { + /* + * Before you patch this away, are you sure that you + * know what you are going to to? + * + * Note that this is a warning that helps users from + * cdda2wav, mkisofs and other programs (that + * distinguish SCSI addresses from file names) from + * getting unexpected results. + */ + js_fprintf((FILE *)scgp->errfile, + "Warning: Open by 'devname' is unintentional and not supported.\n"); + } + /* O_NONBLOCK is dangerous */ + f = open(device, O_RDWR | O_NONBLOCK); +/* if (f < 0 && errno == ENOENT)*/ +/* goto openpg;*/ + + if (f < 0) { + /* + * The pg driver has the same rules to decide whether + * to use openbydev. If we cannot open the device, it + * makes no sense to try the /dev/pg* driver. + */ + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '%s'", + device); + return (0); + } + + sg_clearnblock(f); /* Be very proper about this */ + if (!sg_mapdev(scgp, f, &busno, &tgt, &tlun, 0, 0, b)) { + close(f); + /* + * If sg_mapdev() failes, this may be /dev/pg* device. + */ + goto openpg; + } + +#ifdef OOO + if (scg_scsibus(scgp) < 0) + scg_scsibus(scgp) = busno; + if (scg_target(scgp) < 0) + scg_target(scgp) = tgt; + if (scg_lun(scgp) < 0) + scg_lun(scgp) = tlun; +#endif + + scg_settarget(scgp, busno, tgt, tlun); + if (sg_setup(scgp, f, busno, tgt, tlun, b)) + return (++nopen); + } +openpg: +#ifdef USE_PG + nopen += pg_open(scgp, device); +#endif + if (scgp->debug > 0) for (b = 0; b < MAX_SCG; b++) { + js_fprintf((FILE *)scgp->errfile, + "Bus: %d cookie: %X\n", + b, scglocal(scgp)->buscookies[b]); + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + if (scglocal(scgp)->scgfiles[b][t][l] != (short)-1) { + js_fprintf((FILE *)scgp->errfile, + "file (%d,%d,%d): %d\n", + b, t, l, scglocal(scgp)->scgfiles[b][t][l]); + } + } + } + } + return (nopen); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + register int f; + register int b; + register int t; + register int l; + + if (scgp->local == NULL) + return (-1); + + for (b = 0; b < MAX_SCG; b++) { + if (b == scglocal(scgp)->pgbus) + continue; + scglocal(scgp)->buscookies[b] = (short)-1; + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + f = scglocal(scgp)->scgfiles[b][t][l]; + if (f >= 0) + close(f); + scglocal(scgp)->scgfiles[b][t][l] = (short)-1; + } + } + } + if (scglocal(scgp)->xbuf != NULL) { + free(scglocal(scgp)->xbuf); + scglocal(scgp)->xbufsize = 0L; + scglocal(scgp)->xbuf = NULL; + } +#ifdef USE_PG + pg_close(scgp); +#endif + return (0); +} + +/* + * The Linux kernel becomes more and more unmaintainable. + * Every year, a new incompatible SCSI transport interface is added. + * Each of them has it's own contradictory constraints. + * While you cannot have O_NONBLOCK set during operation, at least one + * of the drivers requires O_NONBLOCK to be set during open(). + * This is used to clear O_NONBLOCK immediately after open() succeeded. + */ +LOCAL void +sg_clearnblock(f) + int f; +{ + int n; + + n = fcntl(f, F_GETFL); + n &= ~O_NONBLOCK; + fcntl(f, F_SETFL, n); +} + +LOCAL BOOL +sg_setup(scgp, f, busno, tgt, tlun, ataidx) + SCSI *scgp; + int f; + int busno; + int tgt; + int tlun; + int ataidx; +{ + int n; + int Chan; + int Ino; + int Bus; + int Target; + int Lun; + BOOL onetarget = FALSE; + +#ifdef SG_GET_VERSION_NUM + if (scglocal(scgp)->drvers < 0) { + scglocal(scgp)->drvers = 0; + if (ioctl(f, SG_GET_VERSION_NUM, &n) >= 0) { + scglocal(scgp)->drvers = n; + if (scgp->overbose) { + js_fprintf((FILE *)scgp->errfile, + "Linux sg driver version: %d.%d.%d\n", + n/10000, (n%10000)/100, n%100); + } + } + } +#endif + if (scg_scsibus(scgp) >= 0 && scg_target(scgp) >= 0 && scg_lun(scgp) >= 0) + onetarget = TRUE; + + sg_mapdev(scgp, f, &Bus, &Target, &Lun, &Chan, &Ino, ataidx); + + /* + * For old kernels try to make the best guess. + */ + Ino |= Chan << 8; + n = sg_mapbus(scgp, Bus, Ino); + if (Bus == -1) { + Bus = n; + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "SCSI Bus: %d (mapped from %d)\n", Bus, Ino); + } + } + + if (Bus < 0 || Bus >= MAX_SCG || Target < 0 || Target >= MAX_TGT || + Lun < 0 || Lun >= MAX_LUN) { + return (FALSE); + } + + if (scglocal(scgp)->scgfiles[Bus][Target][Lun] == (short)-1) + scglocal(scgp)->scgfiles[Bus][Target][Lun] = (short)f; + + if (onetarget) { + if (Bus == busno && Target == tgt && Lun == tlun) { + sg_initdev(scgp, f); + scglocal(scgp)->scgfile = f; /* remember file for ioctl's */ + return (TRUE); + } else { + scglocal(scgp)->scgfiles[Bus][Target][Lun] = (short)-1; + close(f); + } + } else { + /* + * SCSI bus scanning may cause other generic SCSI activities to + * fail because we set the default timeout and clear command + * queues (in case of the old sg driver interface). + */ + sg_initdev(scgp, f); + if (scglocal(scgp)->scgfile < 0) + scglocal(scgp)->scgfile = f; /* remember file for ioctl's */ + } + return (FALSE); +} + +LOCAL void +sg_initdev(scgp, f) + SCSI *scgp; + int f; +{ + struct sg_rep { + struct sg_header hd; + unsigned char rbuf[100]; + } sg_rep; + int n; + int i; + struct stat sb; + + sg_settimeout(f, scgp->deftimeout); + + /* + * If it's a block device, don't read.... pre Linux-2.4 /dev/sg* + * definitely is a character device and we only need to clear the + * queue for old /dev/sg* versions. If somebody ever implements + * raw disk access for Linux, this test may fail. + */ + if (fstat(f, &sb) >= 0 && S_ISBLK(sb.st_mode)) + return; + + /* Eat any unwanted garbage from prior use of this device */ + + n = fcntl(f, F_GETFL); /* Be very proper about this */ + fcntl(f, F_SETFL, n|O_NONBLOCK); + + fillbytes((caddr_t)&sg_rep, sizeof (struct sg_header), '\0'); + sg_rep.hd.reply_len = sizeof (struct sg_header); + + /* + * This is really ugly. + * We come here if 'f' is related to a raw device. If Linux + * will ever have raw devices for /dev/hd* we may get problems. + * As long as there is no clean way to find out whether the + * filedescriptor 'f' is related to an old /dev/sg* or to + * /dev/hd*, we must assume that we found an old /dev/sg* and + * clean it up. Unfortunately, reading from /dev/hd* will + * Access the medium. + */ + for (i = 0; i < 1000; i++) { /* Read at least 32k from /dev/sg* */ + int ret; + + ret = read(f, &sg_rep, sizeof (sg_rep)); + if (ret > 0) + continue; + if (ret == 0 || errno == EAGAIN || errno == EIO) + break; + if (ret < 0 && i > 10) /* Stop on repeated unknown error */ + break; + } + fcntl(f, F_SETFL, n); +} + +LOCAL int +sg_mapbus(scgp, busno, ino) + SCSI *scgp; + int busno; + int ino; +{ + register int i; + + if (busno >= 0 && busno < MAX_SCG) { + /* + * SCSI_IOCTL_GET_BUS_NUMBER worked. + * Now we have the problem that Linux does not properly number + * SCSI busses. The Bus number that Linux creates really is + * the controller (card) number. I case of multi SCSI bus + * cards we are lost. + */ + if (scglocal(scgp)->buscookies[busno] == (short)-1) { + scglocal(scgp)->buscookies[busno] = ino; + return (busno); + } + if (scglocal(scgp)->buscookies[busno] != (short)ino) + errmsgno(EX_BAD, "Warning Linux Bus mapping botch.\n"); + return (busno); + + } else for (i = 0; i < MAX_SCG; i++) { + if (scglocal(scgp)->buscookies[i] == (short)-1) { + scglocal(scgp)->buscookies[i] = ino; + return (i); + } + + if (scglocal(scgp)->buscookies[i] == ino) + return (i); + } + return (0); +} + +LOCAL BOOL +sg_mapdev(scgp, f, busp, tgtp, lunp, chanp, inop, ataidx) + SCSI *scgp; + int f; + int *busp; + int *tgtp; + int *lunp; + int *chanp; + int *inop; + int ataidx; +{ + struct sg_id { + long l1; /* target | lun << 8 | channel << 16 | low_ino << 24 */ + long l2; /* Unique id */ + } sg_id; + int Chan; + int Ino; + int Bus; + int Target; + int Lun; + + if (ataidx >= 0) { + /* + * The badly designed /dev/hd* interface maps everything + * to 0,0,0 so we need to do the mapping ourselves. + */ + *busp = ataidx / 2; + *tgtp = ataidx % 2; + *lunp = 0; + if (chanp) + *chanp = 0; + if (inop) + *inop = 0; + return (TRUE); + } + if (ioctl(f, SCSI_IOCTL_GET_IDLUN, &sg_id)) + return (FALSE); + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "l1: 0x%lX l2: 0x%lX\n", sg_id.l1, sg_id.l2); + } + if (ioctl(f, SCSI_IOCTL_GET_BUS_NUMBER, &Bus) < 0) { + Bus = -1; + } + + Target = sg_id.l1 & 0xFF; + Lun = (sg_id.l1 >> 8) & 0xFF; + Chan = (sg_id.l1 >> 16) & 0xFF; + Ino = (sg_id.l1 >> 24) & 0xFF; + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "Bus: %d Target: %d Lun: %d Chan: %d Ino: %d\n", + Bus, Target, Lun, Chan, Ino); + } + *busp = Bus; + *tgtp = Target; + *lunp = Lun; + if (chanp) + *chanp = Chan; + if (inop) + *inop = Ino; + return (TRUE); +} + +#if defined(SG_SET_RESERVED_SIZE) && defined(SG_GET_RESERVED_SIZE) +/* + * The way Linux does DMA resouce management is a bit curious. + * It totally deviates from all other OS and forces long ugly code. + * If we are opening all drivers for a SCSI bus scan operation, we need + * to set the limit for all open devices. + * This may use up all kernel memory ... so do the job carefully. + * + * A big problem is that SG_SET_RESERVED_SIZE does not return any hint + * on whether the request did fail. The only way to find if it worked + * is to use SG_GET_RESERVED_SIZE to read back the current values. + */ +LOCAL long +sg_raisedma(scgp, newmax) + SCSI *scgp; + long newmax; +{ + register int b; + register int t; + register int l; + register int f; + int val; + int old; + + /* + * First try to raise the DMA limit to a moderate value that + * most likely does not use up all kernel memory. + */ + val = 126*1024; + + if (val > MAX_DMA_LINUX) { + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + if ((f = SCGO_FILENO(scgp, b, t, l)) < 0) + continue; + old = 0; + if (ioctl(f, SG_GET_RESERVED_SIZE, &old) < 0) + continue; + if (val > old) + ioctl(f, SG_SET_RESERVED_SIZE, &val); + } + } + } + } + + /* + * Now to raise the DMA limit to what we really need. + */ + if (newmax > val) { + val = newmax; + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + if ((f = SCGO_FILENO(scgp, b, t, l)) < 0) + continue; + old = 0; + if (ioctl(f, SG_GET_RESERVED_SIZE, &old) < 0) + continue; + if (val > old) + ioctl(f, SG_SET_RESERVED_SIZE, &val); + } + } + } + } + + /* + * To make sure we did not fail (the ioctl does not report errors) + * we need to check the DMA limits. We return the smallest value. + */ + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + if ((f = SCGO_FILENO(scgp, b, t, l)) < 0) + continue; + if (ioctl(f, SG_GET_RESERVED_SIZE, &val) < 0) + continue; + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "Target (%d,%d,%d): DMA max %d old max: %ld\n", + b, t, l, val, newmax); + } + if (val < newmax) + newmax = val; + } + } + } + return ((long)newmax); +} +#endif + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + long maxdma = MAX_DMA_LINUX; + +#if defined(SG_SET_RESERVED_SIZE) && defined(SG_GET_RESERVED_SIZE) + /* + * Use the curious new kernel interface found on Linux >= 2.2.10 + * This interface first appeared in 2.2.6 but it was not working. + */ + if (scglocal(scgp)->drvers >= 20134) + maxdma = sg_raisedma(scgp, amt); +#endif +#ifdef SG_GET_BUFSIZE + /* + * We assume that all /dev/sg instances use the same + * maximum buffer size. + */ + maxdma = ioctl(scglocal(scgp)->scgfile, SG_GET_BUFSIZE, 0); +#endif + if (maxdma < 0) { +#ifdef USE_PG + /* + * If we only have a Parallel port, just return PP maxdma. + */ + if (scglocal(scgp)->pgbus == 0) + return (pg_maxdma(scgp, amt)); +#endif + if (scglocal(scgp)->scgfile >= 0) + maxdma = MAX_DMA_LINUX; + } +#ifdef USE_PG + if (scg_scsibus(scgp) == scglocal(scgp)->pgbus) + return (pg_maxdma(scgp, amt)); + if ((scg_scsibus(scgp) < 0) && (pg_maxdma(scgp, amt) < maxdma)) + return (pg_maxdma(scgp, amt)); +#endif + return (maxdma); +} + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + char *ret; + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_getbuf: %ld bytes\n", amt); + } + /* + * For performance reason, we allocate pagesize() + * bytes before the SCSI buffer to avoid + * copying the whole buffer contents when + * setting up the /dev/sg data structures. + */ + ret = valloc((size_t)(amt+getpagesize())); + if (ret == NULL) + return (ret); + scgp->bufbase = ret; + ret += getpagesize(); + scglocal(scgp)->SCSIbuf = ret; + return ((void *)ret); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + register int t; + register int l; + + if (busno < 0 || busno >= MAX_SCG) + return (FALSE); + + if (scgp->local == NULL) + return (FALSE); + + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + if (scglocal(scgp)->scgfiles[busno][t][l] >= 0) + return (TRUE); + } + return (FALSE); +} + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (busno < 0 || busno >= MAX_SCG || + tgt < 0 || tgt >= MAX_TGT || + tlun < 0 || tlun >= MAX_LUN) + return (-1); + + if (scgp->local == NULL) + return (-1); + + return ((int)scglocal(scgp)->scgfiles[busno][tgt][tlun]); +} + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ +#ifdef USE_PG + if (scg_scsibus(scgp) == scglocal(scgp)->pgbus) + return (pg_initiator_id(scgp)); +#endif + return (-1); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; +{ +#ifdef USE_PG + if (scg_scsibus(scgp) == scglocal(scgp)->pgbus) + return (pg_isatapi(scgp)); +#endif + + /* + * The /dev/hd* interface always returns TRUE for SG_EMULATED_HOST. + * So this is completely useless. + */ + if (scglocal(scgp)->flags & LF_ATA) + return (-1); + +#ifdef SG_EMULATED_HOST + { + int emulated = FALSE; + + /* + * XXX Should we use this at all? + * XXX The badly designed /dev/hd* interface always + * XXX returns TRUE, even when used with e.g. /dev/sr0. + */ + if (ioctl(scgp->fd, SG_EMULATED_HOST, &emulated) >= 0) + return (emulated != 0); + } +#endif + return (-1); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ +#ifdef SG_SCSI_RESET + int f = scgp->fd; + int func = -1; +#endif +#ifdef USE_PG + if (scg_scsibus(scgp) == scglocal(scgp)->pgbus) + return (pg_reset(scgp, what)); +#endif + /* + * Do we have a SCSI reset in the Linux sg driver? + */ +#ifdef SG_SCSI_RESET + /* + * Newer Linux sg driver seem to finally implement it... + */ +#ifdef SG_SCSI_RESET_NOTHING + func = SG_SCSI_RESET_NOTHING; + if (ioctl(f, SG_SCSI_RESET, &func) >= 0) { + if (what == SCG_RESET_NOP) + return (0); +#ifdef SG_SCSI_RESET_DEVICE + if (what == SCG_RESET_TGT) { + func = SG_SCSI_RESET_DEVICE; + if (ioctl(f, SG_SCSI_RESET, &func) >= 0) + return (0); + } +#endif +#ifdef SG_SCSI_RESET_BUS + if (what == SCG_RESET_BUS) { + func = SG_SCSI_RESET_BUS; + if (ioctl(f, SG_SCSI_RESET, &func) >= 0) + return (0); + } +#endif + } +#endif +#endif + return (-1); +} + +LOCAL void +sg_settimeout(f, tmo) + int f; + int tmo; +{ + tmo *= HZ; + if (tmo) + tmo += HZ/2; + + if (ioctl(f, SG_SET_TIMEOUT, &tmo) < 0) + comerr("Cannot set SG_SET_TIMEOUT.\n"); +} + +/* + * Get misaligned int. + * Needed for all recent processors (sparc/ppc/alpha) + * because the /dev/sg design forces us to do misaligned + * reads of integers. + */ +#ifdef MISALIGN +LOCAL int +sg_getint(ip) + int *ip; +{ + int ret; + register char *cp = (char *)ip; + register char *tp = (char *)&ret; + register int i; + + for (i = sizeof (int); --i >= 0; ) + *tp++ = *cp++; + + return (ret); +} +#define GETINT(a) sg_getint(&(a)) +#else +#define GETINT(a) (a) +#endif + +#ifdef SG_IO +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + int ret; + sg_io_hdr_t sg_io; + struct timeval to; + + if (scgp->fd < 0) { + sp->error = SCG_FATAL; + sp->ux_errno = EIO; + return (0); + } + if (scglocal(scgp)->isold > 0) { + return (sg_rwsend(scgp)); + } + fillbytes((caddr_t)&sg_io, sizeof (sg_io), '\0'); + + sg_io.interface_id = 'S'; + + if (sp->flags & SCG_RECV_DATA) { + sg_io.dxfer_direction = SG_DXFER_FROM_DEV; + } else if (sp->size > 0) { + sg_io.dxfer_direction = SG_DXFER_TO_DEV; + } else { + sg_io.dxfer_direction = SG_DXFER_NONE; + } + sg_io.cmd_len = sp->cdb_len; + if (sp->sense_len > SG_MAX_SENSE) + sg_io.mx_sb_len = SG_MAX_SENSE; + else + sg_io.mx_sb_len = sp->sense_len; + sg_io.dxfer_len = sp->size; + sg_io.dxferp = sp->addr; + sg_io.cmdp = sp->cdb.cmd_cdb; + sg_io.sbp = sp->u_sense.cmd_sense; + sg_io.timeout = sp->timeout*1000; + sg_io.flags |= SG_FLAG_DIRECT_IO; + + ret = ioctl(scgp->fd, SG_IO, &sg_io); + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "ioctl ret: %d\n", ret); + } + + if (ret < 0) { + sp->ux_errno = geterrno(); + /* + * Check if SCSI command cound not be send at all. + * Linux usually returns EINVAL for an unknoen ioctl. + * In case somebody from the Linux kernel team learns that the + * corect errno would be ENOTTY, we check for this errno too. + */ + if ((sp->ux_errno == ENOTTY || sp->ux_errno == EINVAL) && + scglocal(scgp)->isold < 0) { + scglocal(scgp)->isold = 1; + return (sg_rwsend(scgp)); + } + if (sp->ux_errno == ENXIO || + sp->ux_errno == EINVAL || sp->ux_errno == EACCES) { + return (-1); + } + } + + sp->u_scb.cmd_scb[0] = sg_io.status; + sp->sense_count = sg_io.sb_len_wr; + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "host_status: %02X driver_status: %02X\n", + sg_io.host_status, sg_io.driver_status); + } + + switch (sg_io.host_status) { + + case DID_OK: + /* + * If there is no DMA overrun and there is a + * SCSI Status byte != 0 then the SCSI cdb transport + * was OK and sp->error must be SCG_NO_ERROR. + */ + if ((sg_io.driver_status & DRIVER_SENSE) != 0) { + if (sp->ux_errno == 0) + sp->ux_errno = EIO; + + if (sp->u_sense.cmd_sense[0] != 0 && + sp->u_scb.cmd_scb[0] == 0) { + /* + * The Linux SCSI system up to 2.4.xx + * trashes the status byte in the + * kernel. This is true at least for + * ide-scsi emulation. Until this gets + * fixed, we need this hack. + */ + sp->u_scb.cmd_scb[0] = ST_CHK_COND; + if (sp->sense_count == 0) + sp->sense_count = SG_MAX_SENSE; + + if ((sp->u_sense.cmd_sense[2] == 0) && + (sp->u_sense.cmd_sense[12] == 0) && + (sp->u_sense.cmd_sense[13] == 0)) { + /* + * The Linux SCSI system will + * send a request sense for + * even a dma underrun error. + * Clear CHECK CONDITION state + * in case of No Sense. + */ + sp->u_scb.cmd_scb[0] = 0; + sp->u_sense.cmd_sense[0] = 0; + sp->sense_count = 0; + } + } + } + break; + + case DID_NO_CONNECT: /* Arbitration won, retry NO_CONNECT? */ + sp->error = SCG_RETRYABLE; + break; + case DID_BAD_TARGET: + sp->error = SCG_FATAL; + break; + + case DID_TIME_OUT: + __scg_times(scgp); + + if (sp->timeout > 1 && scgp->cmdstop->tv_sec == 0) { + sp->u_scb.cmd_scb[0] = 0; + sp->error = SCG_FATAL; /* a selection timeout */ + } else { + sp->error = SCG_TIMEOUT; + } + break; + + default: + to.tv_sec = sp->timeout; + to.tv_usec = 500000; + __scg_times(scgp); + + if (scgp->cmdstop->tv_sec < to.tv_sec || + (scgp->cmdstop->tv_sec == to.tv_sec && + scgp->cmdstop->tv_usec < to.tv_usec)) { + + sp->ux_errno = 0; + sp->error = SCG_TIMEOUT; /* a timeout */ + } else { + sp->error = SCG_RETRYABLE; + } + break; + } + if (sp->error && sp->ux_errno == 0) + sp->ux_errno = EIO; + + sp->resid = sg_io.resid; + return (0); +} +#else +# define sg_rwsend scgo_send +#endif + +LOCAL int +sg_rwsend(scgp) + SCSI *scgp; +{ + int f = scgp->fd; + struct scg_cmd *sp = scgp->scmd; + struct sg_rq *sgp; + struct sg_rq *sgp2; + int i; + int pack_len; + int reply_len; + int amt = sp->cdb_len; + struct sg_rq { + struct sg_header hd; + unsigned char buf[MAX_DMA_LINUX+SCG_MAX_CMD]; + } sg_rq; +#ifdef SG_GET_BUFSIZE /* We may use a 'sg' version 2 driver */ + char driver_byte; + char host_byte; + char msg_byte; + char status_byte; +#endif + + if (f < 0) { + sp->error = SCG_FATAL; + sp->ux_errno = EIO; + return (0); + } +#ifdef USE_PG + if (scg_scsibus(scgp) == scglocal(scgp)->pgbus) + return (pg_send(scgp)); +#endif + if (sp->timeout != scgp->deftimeout) + sg_settimeout(f, sp->timeout); + + + sgp2 = sgp = &sg_rq; + if (sp->addr == scglocal(scgp)->SCSIbuf) { + sgp = (struct sg_rq *) + (scglocal(scgp)->SCSIbuf - (sizeof (struct sg_header) + amt)); + sgp2 = (struct sg_rq *) + (scglocal(scgp)->SCSIbuf - (sizeof (struct sg_header))); + } else { + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "DMA addr: 0x%8.8lX size: %d - using copy buffer\n", + (long)sp->addr, sp->size); + } + if (sp->size > (int)(sizeof (sg_rq.buf) - SCG_MAX_CMD)) { + + if (scglocal(scgp)->xbuf == NULL) { + scglocal(scgp)->xbufsize = scgp->maxbuf; + scglocal(scgp)->xbuf = + malloc(scglocal(scgp)->xbufsize + + SCG_MAX_CMD + + sizeof (struct sg_header)); + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "Allocated DMA copy buffer, addr: 0x%8.8lX size: %ld\n", + (long)scglocal(scgp)->xbuf, + scgp->maxbuf); + } + } + if (scglocal(scgp)->xbuf == NULL || + sp->size > scglocal(scgp)->xbufsize) { + errno = ENOMEM; + return (-1); + } + sgp2 = sgp = (struct sg_rq *)scglocal(scgp)->xbuf; + } + } + + /* + * This is done to avoid misaligned access of sgp->some_int + */ + pack_len = sizeof (struct sg_header) + amt; + reply_len = sizeof (struct sg_header); + if (sp->flags & SCG_RECV_DATA) { + reply_len += sp->size; + } else { + pack_len += sp->size; + } + +#ifdef MISALIGN + /* + * sgp->some_int may be misaligned if (sp->addr == SCSIbuf) + * This is no problem on Intel porocessors, however + * all other processors don't like it. + * sizeof (struct sg_header) + amt is usually not a multiple of + * sizeof (int). For this reason, we fill in the values into sg_rq + * which is always corectly aligned and then copy it to the real + * location if this location differs from sg_rq. + * Never read/write directly to sgp->some_int !!!!! + */ + fillbytes((caddr_t)&sg_rq, sizeof (struct sg_header), '\0'); + + sg_rq.hd.pack_len = pack_len; + sg_rq.hd.reply_len = reply_len; + sg_rq.hd.pack_id = scglocal(scgp)->pack_id++; +/* sg_rq.hd.result = 0; not needed because of fillbytes() */ + + if ((caddr_t)&sg_rq != (caddr_t)sgp) + movebytes((caddr_t)&sg_rq, (caddr_t)sgp, sizeof (struct sg_header)); +#else + fillbytes((caddr_t)sgp, sizeof (struct sg_header), '\0'); + + sgp->hd.pack_len = pack_len; + sgp->hd.reply_len = reply_len; + sgp->hd.pack_id = scglocal(scgp)->pack_id++; +/* sgp->hd.result = 0; not needed because of fillbytes() */ +#endif + if (amt == 12) + sgp->hd.twelve_byte = 1; + + + for (i = 0; i < amt; i++) { + sgp->buf[i] = sp->cdb.cmd_cdb[i]; + } + if (!(sp->flags & SCG_RECV_DATA)) { + if ((void *)sp->addr != (void *)&sgp->buf[amt]) + movebytes(sp->addr, &sgp->buf[amt], sp->size); + amt += sp->size; + } +#ifdef SG_GET_BUFSIZE + sgp->hd.want_new = 1; /* Order new behaviour */ + sgp->hd.cdb_len = sp->cdb_len; /* Set CDB length */ + if (sp->sense_len > SG_MAX_SENSE) + sgp->hd.sense_len = SG_MAX_SENSE; + else + sgp->hd.sense_len = sp->sense_len; +#endif + i = sizeof (struct sg_header) + amt; + if ((amt = write(f, sgp, i)) < 0) { /* write */ + sg_settimeout(f, scgp->deftimeout); + return (-1); + } else if (amt != i) { + errmsg("scgo_send(%s) wrote %d bytes (expected %d).\n", + scgp->cmdname, amt, i); + } + + if (sp->addr == scglocal(scgp)->SCSIbuf) { + movebytes(sgp, sgp2, sizeof (struct sg_header)); + sgp = sgp2; + } + sgp->hd.sense_buffer[0] = 0; + if ((amt = read(f, sgp, reply_len)) < 0) { /* read */ + sg_settimeout(f, scgp->deftimeout); + return (-1); + } + + if (sp->flags & SCG_RECV_DATA && ((void *)sgp->buf != (void *)sp->addr)) { + movebytes(sgp->buf, sp->addr, sp->size); + } + sp->ux_errno = GETINT(sgp->hd.result); /* Unaligned read */ + sp->error = SCG_NO_ERROR; + +#ifdef SG_GET_BUFSIZE + if (sgp->hd.grant_new) { + sp->sense_count = sgp->hd.sense_len; + pack_len = GETINT(sgp->hd.sg_cmd_status); /* Unaligned read */ + driver_byte = (pack_len >> 24) & 0xFF; + host_byte = (pack_len >> 16) & 0xFF; + msg_byte = (pack_len >> 8) & 0xFF; + status_byte = pack_len & 0xFF; + + switch (host_byte) { + + case DID_OK: + if ((driver_byte & DRIVER_SENSE || + sgp->hd.sense_buffer[0] != 0) && + status_byte == 0) { + /* + * The Linux SCSI system up to 2.4.xx + * trashes the status byte in the + * kernel. This is true at least for + * ide-scsi emulation. Until this gets + * fixed, we need this hack. + */ + status_byte = ST_CHK_COND; + if (sgp->hd.sense_len == 0) + sgp->hd.sense_len = SG_MAX_SENSE; + + if ((sp->u_sense.cmd_sense[2] == 0) && + (sp->u_sense.cmd_sense[12] == 0) && + (sp->u_sense.cmd_sense[13] == 0)) { + /* + * The Linux SCSI system will + * send a request sense for + * even a dma underrun error. + * Clear CHECK CONDITION state + * in case of No Sense. + */ + sp->u_scb.cmd_scb[0] = 0; + sp->u_sense.cmd_sense[0] = 0; + sp->sense_count = 0; + } + } + break; + + case DID_NO_CONNECT: /* Arbitration won, retry NO_CONNECT? */ + sp->error = SCG_RETRYABLE; + break; + + case DID_BAD_TARGET: + sp->error = SCG_FATAL; + break; + + case DID_TIME_OUT: + sp->error = SCG_TIMEOUT; + break; + + default: + sp->error = SCG_RETRYABLE; + + if ((driver_byte & DRIVER_SENSE || + sgp->hd.sense_buffer[0] != 0) && + status_byte == 0) { + status_byte = ST_CHK_COND; + sp->error = SCG_NO_ERROR; + } + if (status_byte != 0 && sgp->hd.sense_len == 0) { + sgp->hd.sense_len = SG_MAX_SENSE; + sp->error = SCG_NO_ERROR; + } + break; + + } + if ((host_byte != DID_OK || status_byte != 0) && sp->ux_errno == 0) + sp->ux_errno = EIO; + sp->u_scb.cmd_scb[0] = status_byte; + if (status_byte & ST_CHK_COND) { + sp->sense_count = sgp->hd.sense_len; + movebytes(sgp->hd.sense_buffer, sp->u_sense.cmd_sense, sp->sense_count); + } + } else +#endif + { + if (GETINT(sgp->hd.result) == EBUSY) { /* Unaligned read */ + struct timeval to; + + to.tv_sec = sp->timeout; + to.tv_usec = 500000; + __scg_times(scgp); + + if (sp->timeout > 1 && scgp->cmdstop->tv_sec == 0) { + sp->u_scb.cmd_scb[0] = 0; + sp->ux_errno = EIO; + sp->error = SCG_FATAL; /* a selection timeout */ + } else if (scgp->cmdstop->tv_sec < to.tv_sec || + (scgp->cmdstop->tv_sec == to.tv_sec && + scgp->cmdstop->tv_usec < to.tv_usec)) { + + sp->ux_errno = EIO; + sp->error = SCG_TIMEOUT; /* a timeout */ + } else { + sp->error = SCG_RETRYABLE; /* may be BUS_BUSY */ + } + } + + if (sp->flags & SCG_RECV_DATA) + sp->resid = (sp->size + sizeof (struct sg_header)) - amt; + else + sp->resid = 0; /* sg version1 cannot return DMA resid count */ + + if (sgp->hd.sense_buffer[0] != 0) { + sp->scb.chk = 1; + sp->sense_count = SG_MAX_SENSE; + movebytes(sgp->hd.sense_buffer, sp->u_sense.cmd_sense, sp->sense_count); + if (sp->ux_errno == 0) + sp->ux_errno = EIO; + } + } + + if (scgp->verbose > 0 && scgp->debug > 0) { +#ifdef SG_GET_BUFSIZE + js_fprintf((FILE *)scgp->errfile, + "status: 0x%08X pack_len: %d, reply_len: %d pack_id: %d result: %d wn: %d gn: %d cdb_len: %d sense_len: %d sense[0]: %02X\n", + GETINT(sgp->hd.sg_cmd_status), + GETINT(sgp->hd.pack_len), + GETINT(sgp->hd.reply_len), + GETINT(sgp->hd.pack_id), + GETINT(sgp->hd.result), + sgp->hd.want_new, + sgp->hd.grant_new, + sgp->hd.cdb_len, + sgp->hd.sense_len, + sgp->hd.sense_buffer[0]); +#else + js_fprintf((FILE *)scgp->errfile, + "pack_len: %d, reply_len: %d pack_id: %d result: %d sense[0]: %02X\n", + GETINT(sgp->hd.pack_len), + GETINT(sgp->hd.reply_len), + GETINT(sgp->hd.pack_id), + GETINT(sgp->hd.result), + sgp->hd.sense_buffer[0]); +#endif +#ifdef DEBUG + js_fprintf((FILE *)scgp->errfile, "sense: "); + for (i = 0; i < 16; i++) + js_fprintf((FILE *)scgp->errfile, "%02X ", sgp->hd.sense_buffer[i]); + js_fprintf((FILE *)scgp->errfile, "\n"); +#endif + } + + if (sp->timeout != scgp->deftimeout) + sg_settimeout(f, scgp->deftimeout); + return (0); +} diff --git a/scsilib/libscg/scsi-mac-iokit.c b/scsilib/libscg/scsi-mac-iokit.c new file mode 100644 index 0000000..846d347 --- /dev/null +++ b/scsilib/libscg/scsi-mac-iokit.c @@ -0,0 +1,556 @@ +/* @(#)scsi-mac-iokit.c 1.9 04/01/15 Copyright 1997,2001-2004 J. Schilling */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-mac-iokit.c 1.9 04/01/15 Copyright 1997,2001-2004 J. Schilling"; +#endif +/* + * Interface to the Darwin IOKit SCSI drivers + * + * Notes: Uses the IOKit/scsi-commands/SCSITaskLib interface + * + * As of October 2001, this interface does not support SCSI parallel bus + * (old-fashioned SCSI). It does support ATAPI, Firewire, and USB. + * + * First version done by Constantine Sapuntzakis <csapuntz@Stanford.EDU> + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1997,2001-2004 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-mac-iokit.c-1.9"; /* The version for this transport */ + +#define MAX_SCG 16 /* Max # of SCSI controllers */ +#define MAX_TGT 16 +#define MAX_LUN 8 + +#include <statdefs.h> +#include <mach/mach.h> +#include <Carbon/Carbon.h> +#include <IOKit/IOKitLib.h> +#include <IOKit/IOCFPlugIn.h> +#include <IOKit/scsi-commands/SCSITaskLib.h> +#include <mach/mach_error.h> + +struct scg_local { + MMCDeviceInterface **mmcDeviceInterface; + SCSITaskDeviceInterface **scsiTaskDeviceInterface; + mach_port_t masterPort; +}; +#define scglocal(p) ((struct scg_local *)((p)->local)) + +#define MAX_DMA_NEXT (32*1024) +#if 0 +#define MAX_DMA_NEXT (64*1024) /* Check if this is not too big */ +#endif + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (__sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "SCSITaskDeviceInterface", "Apple SCSI", + "", "Mac Prom device name", "IOCompactDiscServices/0", + FALSE, FALSE); + return (0); +} + + +/* + * Valid Device names: + * IOCompactDiscServices + * IODVDServices + * IOSCSIPeripheralDeviceNub + * + * Also a / and a number can be appended to refer to something + * more than the first device (e.g. IOCompactDiscServices/5 for the 5th + * compact disc attached) + */ +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + mach_port_t masterPort = NULL; + io_iterator_t scsiObjectIterator = NULL; + IOReturn ioReturnValue = kIOReturnSuccess; + CFMutableDictionaryRef dict = NULL; + io_object_t scsiDevice = NULL; + HRESULT plugInResult; + IOCFPlugInInterface **plugInInterface = NULL; + MMCDeviceInterface **mmcDeviceInterface = NULL; + SCSITaskDeviceInterface **scsiTaskDeviceInterface = NULL; + SInt32 score = 0; + int err = -1; + char *realdevice = NULL, *tmp; + int driveidx = 1, idx = 1; + + if (device == NULL) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Please specify a device name (e.g. IOCompactDiscServices,0)"); + goto out; + } + + realdevice = tmp = strdup(device); + tmp = strchr(tmp, '/'); + if (tmp != NULL) { + *tmp++ = '\0'; + driveidx = atoi(tmp); + } + + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + goto out; + } + + ioReturnValue = IOMasterPort(bootstrap_port, &masterPort); + + if (ioReturnValue != kIOReturnSuccess) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Couldn't get a master IOKit port. Error %d", + ioReturnValue); + goto out; + } + + dict = IOServiceMatching(realdevice); + if (dict == NULL) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Couldn't create dictionary for searching"); + goto out; + } + + ioReturnValue = IOServiceGetMatchingServices(masterPort, dict, + &scsiObjectIterator); + dict = NULL; + + if (scsiObjectIterator == NULL || + (ioReturnValue != kIOReturnSuccess)) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "No matching device %s found.", device); + goto out; + } + + if (driveidx <= 0) + driveidx = 1; + + idx = 1; + while ((scsiDevice = IOIteratorNext(scsiObjectIterator)) != NULL) { + if (idx == driveidx) + break; + IOObjectRelease(scsiDevice); + scsiDevice = NULL; + idx++; + } + + if (scsiDevice == NULL) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "No matching device found. Iterator failed."); + goto out; + } + + ioReturnValue = IOCreatePlugInInterfaceForService(scsiDevice, + kIOMMCDeviceUserClientTypeID, + kIOCFPlugInInterfaceID, + &plugInInterface, &score); + if (ioReturnValue != kIOReturnSuccess) { + goto try_generic; + } + + plugInResult = (*plugInInterface)->QueryInterface(plugInInterface, + CFUUIDGetUUIDBytes(kIOMMCDeviceInterfaceID), + (LPVOID)&mmcDeviceInterface); + + if (plugInResult != KERN_SUCCESS) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Unable to get MMC Interface: 0x%lX", + (long)plugInResult); + + goto out; + } + + scsiTaskDeviceInterface = + (*mmcDeviceInterface)->GetSCSITaskDeviceInterface(mmcDeviceInterface); + + if (scsiTaskDeviceInterface == NULL) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Failed to get taskDeviceInterface"); + goto out; + } + + goto init; + +try_generic: + ioReturnValue = IOCreatePlugInInterfaceForService(scsiDevice, + kIOSCSITaskDeviceUserClientTypeID, + kIOCFPlugInInterfaceID, + &plugInInterface, &score); + if (ioReturnValue != kIOReturnSuccess) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Unable to get plugin Interface: %x", + ioReturnValue); + goto out; + } + + plugInResult = (*plugInInterface)->QueryInterface(plugInInterface, + CFUUIDGetUUIDBytes(kIOSCSITaskDeviceInterfaceID), + (LPVOID)&scsiTaskDeviceInterface); + + if (plugInResult != KERN_SUCCESS) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Unable to get generic Interface: 0x%lX", + (long)plugInResult); + + goto out; + } + +init: + ioReturnValue = + (*scsiTaskDeviceInterface)->ObtainExclusiveAccess(scsiTaskDeviceInterface); + + if (ioReturnValue != kIOReturnSuccess) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Unable to get exclusive access to device"); + goto out; + } + + if (mmcDeviceInterface) { + (*mmcDeviceInterface)->AddRef(mmcDeviceInterface); + } + (*scsiTaskDeviceInterface)->AddRef(scsiTaskDeviceInterface); + scglocal(scgp)->mmcDeviceInterface = mmcDeviceInterface; + scglocal(scgp)->scsiTaskDeviceInterface = scsiTaskDeviceInterface; + scglocal(scgp)->masterPort = masterPort; + scg_settarget(scgp, 0, 0, 0); + err = 1; + +out: + if (scsiTaskDeviceInterface != NULL) { + (*scsiTaskDeviceInterface)->Release(scsiTaskDeviceInterface); + } + + if (plugInInterface != NULL) { + (*plugInInterface)->Release(plugInInterface); + } + + if (scsiDevice != NULL) { + IOObjectRelease(scsiDevice); + } + + if (scsiObjectIterator != NULL) { + IOObjectRelease(scsiObjectIterator); + } + + if (err < 0) { + if (scgp->local) { + free(scgp->local); + scgp->local = NULL; + } + + if (masterPort) { + mach_port_deallocate(mach_task_self(), masterPort); + } + } + + if (dict != NULL) { + CFRelease(dict); + } + + if (realdevice != NULL) { + free(realdevice); + } + return (err); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + SCSITaskDeviceInterface **sc; + MMCDeviceInterface **mmc; + + if (scgp->local == NULL) + return (-1); + + sc = scglocal(scgp)->scsiTaskDeviceInterface; + (*sc)->ReleaseExclusiveAccess(sc); + (*sc)->Release(sc); + scglocal(scgp)->scsiTaskDeviceInterface = NULL; + + mmc = scglocal(scgp)->mmcDeviceInterface; + if (mmc != NULL) + (*mmc)->Release(mmc); + + mach_port_deallocate(mach_task_self(), scglocal(scgp)->masterPort); + + free(scgp->local); + scgp->local = NULL; + + return (0); +} + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + long maxdma = MAX_DMA_NEXT; +#ifdef SGIOCMAXDMA + int m; + + if (ioctl(scglocal(scgp)->scgfile, SGIOCMAXDMA, &m) >= 0) { + maxdma = m; + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "maxdma: %d\n", maxdma); + } + } +#endif + return (maxdma); +} + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_getbuf: %ld bytes\n", amt); + } + scgp->bufbase = malloc((size_t)(amt)); + return (scgp->bufbase); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + if (busno == 0) + return (TRUE); + return (FALSE); +} + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + return (-1); +} + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + return (-1); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; + +{ + return (FALSE); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + if (what == SCG_RESET_NOP) + return (0); + if (what != SCG_RESET_BUS) { + errno = EINVAL; + return (-1); + } + + errno = 0; + return (-1); +} + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + SCSITaskDeviceInterface **sc = NULL; + SCSITaskInterface **cmd = NULL; + IOVirtualRange iov; + SCSI_Sense_Data senseData; + SCSITaskStatus status; + UInt64 bytesTransferred; + IOReturn ioReturnValue; + int ret = 0; + + if (scgp->local == NULL) { + return (-1); + } + + sc = scglocal(scgp)->scsiTaskDeviceInterface; + + cmd = (*sc)->CreateSCSITask(sc); + if (cmd == NULL) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Failed to create SCSI task"); + ret = -1; + + sp->error = SCG_FATAL; + sp->ux_errno = EIO; + goto out; + } + + + iov.address = (IOVirtualAddress) sp->addr; + iov.length = sp->size; + + ioReturnValue = (*cmd)->SetCommandDescriptorBlock(cmd, + sp->cdb.cmd_cdb, sp->cdb_len); + + if (ioReturnValue != kIOReturnSuccess) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "SetCommandDescriptorBlock failed with status %x", + ioReturnValue); + ret = -1; + goto out; + } + + ioReturnValue = (*cmd)->SetScatterGatherEntries(cmd, &iov, 1, sp->size, + (sp->flags & SCG_RECV_DATA) ? + kSCSIDataTransfer_FromTargetToInitiator : + kSCSIDataTransfer_FromInitiatorToTarget); + if (ioReturnValue != kIOReturnSuccess) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "SetScatterGatherEntries failed with status %x", + ioReturnValue); + ret = -1; + goto out; + } + + ioReturnValue = (*cmd)->SetTimeoutDuration(cmd, sp->timeout * 1000); + if (ioReturnValue != kIOReturnSuccess) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "SetTimeoutDuration failed with status %x", + ioReturnValue); + ret = -1; + goto out; + } + + memset(&senseData, 0, sizeof (senseData)); + + seterrno(0); + ioReturnValue = (*cmd)->ExecuteTaskSync(cmd, + &senseData, &status, &bytesTransferred); + + sp->resid = sp->size - bytesTransferred; + sp->error = SCG_NO_ERROR; + sp->ux_errno = geterrno(); + + if (ioReturnValue != kIOReturnSuccess) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Command execution failed with status %x", + ioReturnValue); + sp->error = SCG_RETRYABLE; + ret = -1; + goto out; + } + + memset(&sp->scb, 0, sizeof (sp->scb)); + memset(&sp->u_sense.cmd_sense, 0, sizeof (sp->u_sense.cmd_sense)); + if (senseData.VALID_RESPONSE_CODE != 0 || status == 0x02) { + /* + * There is no sense length - we need to asume that + * we always get 18 bytes. + */ + sp->sense_count = kSenseDefaultSize; + memmove(&sp->u_sense.cmd_sense, &senseData, kSenseDefaultSize); + if (sp->ux_errno == 0) + sp->ux_errno = EIO; + } + + sp->u_scb.cmd_scb[0] = status; + + /* ??? */ + if (status == kSCSITaskStatus_No_Status) { + sp->error = SCG_RETRYABLE; + ret = -1; + goto out; + } + /* + * XXX Is it possible to have other senseful SCSI transport error codes? + */ + +out: + if (cmd != NULL) { + (*cmd)->Release(cmd); + } + + return (ret); +} diff --git a/scsilib/libscg/scsi-next.c b/scsilib/libscg/scsi-next.c new file mode 100644 index 0000000..94a3c8e --- /dev/null +++ b/scsilib/libscg/scsi-next.c @@ -0,0 +1,442 @@ +/* @(#)scsi-next.c 1.32 04/01/15 Copyright 1997 J. Schilling */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-next.c 1.32 04/01/15 Copyright 1997 J. Schilling"; +#endif +/* + * Interface for the NeXT Step generic SCSI implementation. + * + * This is a hack, that tries to emulate the functionality + * of the scg driver. + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1997 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <bsd/dev/scsireg.h> + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-next.c-1.32"; /* The version for this transport*/ + +#define MAX_SCG 16 /* Max # of SCSI controllers */ +#define MAX_TGT 16 +#define MAX_LUN 8 + +struct scg_local { + short scgfiles[MAX_SCG][MAX_TGT][MAX_LUN]; + int scgfile; + int max_scsibus; + int cur_scsibus; + int cur_target; + int cur_lun; +}; +#define scglocal(p) ((struct scg_local *)((p)->local)) + +/*#define MAX_DMA_NEXT (32*1024)*/ +#define MAX_DMA_NEXT (64*1024) /* Check if this is not too big */ + + +LOCAL BOOL scg_setup __PR((SCSI *scgp, int busno, int tgt, int tlun, + BOOL ex)); + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (__sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "SGIOCREQ", "Generic SCSI", + "", "bus,target,lun", "1,2,0", TRUE, FALSE); + return (0); +} + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + register int f; + register int i; + char devname[64]; + + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno, target or lun '%d,%d,%d'", + busno, tgt, tlun); + return (-1); + } + + if ((device != NULL && *device != '\0') || (busno == -2 && tgt == -2)) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Open by 'devname' not supported on this OS"); + return (-1); + } + + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + + scglocal(scgp)->scgfile = -1; + scglocal(scgp)->max_scsibus = -1; + scglocal(scgp)->cur_scsibus = -1; + scglocal(scgp)->cur_target = -1; + scglocal(scgp)->cur_lun = -1; + } + + for (i = 0; i < 4; i++) { + js_snprintf(devname, sizeof (devname), "/dev/sg%d", i); + f = open(devname, O_RDWR); + if (scgp->debug > 0) + errmsg("open(devname: '%s') : %d\n", devname, f); + if (f < 0) + continue; + scglocal(scgp)->scgfile = f; + break; + + } + if (f >= 0) { + if (scglocal(scgp)->max_scsibus < 0) { + for (i = 0; i < MAX_SCG; i++) { + if (!SCGO_HAVEBUS(scgp, i)) + break; + } + scglocal(scgp)->max_scsibus = i; + } + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "maxbus: %d\n", scglocal(scgp)->max_scsibus); + } + if (scglocal(scgp)->max_scsibus <= 0) { + scglocal(scgp)->max_scsibus = 1; + scglocal(scgp)->cur_scsibus = 0; + } + + ioctl(f, SGIOCENAS); + if (busno > 0 && tgt > 0 && tlun > 0) + scg_setup(scgp, busno, tgt, tlun, TRUE); + return (1); + } + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '/dev/sg*'"); + return (0); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + if (scgp->local == NULL) + return (-1); + + if (scglocal(scgp)->scgfile >= 0) + close(scglocal(scgp)->scgfile); + scglocal(scgp)->scgfile = -1; + return (0); +} + +LOCAL BOOL +scg_setup(scgp, busno, tgt, tlun, ex) + SCSI *scgp; + int busno; + int tgt; + int tlun; + BOOL ex; +{ + scsi_adr_t sadr; + + sadr.sa_target = tgt; + sadr.sa_lun = tlun; + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scg_setup curbus %d -> %d\n", scglocal(scgp)->cur_scsibus, busno); + } + + if (scgp->debug > 0 && ((scglocal(scgp)->cur_scsibus < 0 || scglocal(scgp)->cur_scsibus != busno))) + js_fprintf((FILE *)scgp->errfile, "setting SCSI bus to: %d\n", busno); + if ((scglocal(scgp)->cur_scsibus < 0 || scglocal(scgp)->cur_scsibus != busno) && + ioctl(scglocal(scgp)->scgfile, SGIOCCNTR, &busno) < 0) { + + scglocal(scgp)->cur_scsibus = -1; /* Driver is in undefined state */ + if (ex) +/* comerr("Cannot set SCSI bus\n");*/ + errmsg("Cannot set SCSI bus\n"); + return (FALSE); + } + scglocal(scgp)->cur_scsibus = busno; + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "setting target/lun to: %d/%d\n", tgt, tlun); + } + if (ioctl(scglocal(scgp)->scgfile, SGIOCSTL, &sadr) < 0) { + if (ex) + comerr("Cannot set SCSI address\n"); + return (FALSE); + } + scglocal(scgp)->cur_scsibus = busno; + scglocal(scgp)->cur_target = tgt; + scglocal(scgp)->cur_lun = tlun; + return (TRUE); +} + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + long maxdma = MAX_DMA_NEXT; +#ifdef SGIOCMAXDMA + int m; + + if (ioctl(scglocal(scgp)->scgfile, SGIOCMAXDMA, &m) >= 0) { + maxdma = m; + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "maxdma: %d\n", maxdma); + } + } +#endif + return (maxdma); +} +#ifdef XXX +#define SGIOCENAS _IO('s', 2) /* enable autosense */ +#define SGIOCDAS _IO('s', 3) /* disable autosense */ +#define SGIOCRST _IO('s', 4) /* reset SCSI bus */ +#define SGIOCCNTR _IOW('s', 6, int) /* select controller */ +#define SGIOCGAS _IOR('s', 7, int) /* get autosense */ +#define SGIOCMAXDMA _IOR('s', 8, int) /* max DMA size */ +#define SGIOCNUMTARGS _IOR('s', 9, int) /* # of targets/bus */ +#endif + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_getbuf: %ld bytes\n", amt); + } + scgp->bufbase = valloc((size_t)(amt)); + return (scgp->bufbase); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + if (busno < 0 || busno >= MAX_SCG) + return (FALSE); + + if (scgp->local == NULL) + return (FALSE); + + if (scglocal(scgp)->max_scsibus > 0 && busno >= scglocal(scgp)->max_scsibus) + return (FALSE); + + return (scg_setup(scgp, busno, 0, 0, FALSE)); +} + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (busno < 0 || busno >= MAX_SCG || + tgt < 0 || tgt >= MAX_TGT || + tlun < 0 || tlun >= MAX_LUN) + return (-1); + if (scglocal(scgp)->max_scsibus > 0 && busno >= scglocal(scgp)->max_scsibus) + return (-1); + + if (scgp->local == NULL) + return (-1); + + if ((busno != scglocal(scgp)->cur_scsibus) || (tgt != scglocal(scgp)->cur_target) || (tlun != scglocal(scgp)->cur_lun)) { + if (!scg_setup(scgp, busno, tgt, tlun, FALSE)) + return (-1); + } + return (scglocal(scgp)->scgfile); +} + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + return (-1); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; + +{ + return (FALSE); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + if (what == SCG_RESET_NOP) + return (0); + if (what != SCG_RESET_BUS) { + errno = EINVAL; + return (-1); + } + return (ioctl(scgp->fd, SGIOCRST, 0)); +} + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + struct scsi_req req; + register long *lp1; + register long *lp2; + int ret = 0; + + if (scgp->fd < 0 || (sp->cdb_len > sizeof (req.sr_cdb))) { + sp->error = SCG_FATAL; + sp->ux_errno = EIO; + return (0); + } + fillbytes(&req, sizeof (req), '\0'); + movebytes(sp->cdb.cmd_cdb, &req.sr_cdb, sp->cdb_len); + if (sp->size) { + req.sr_dma_dir = SR_DMA_WR; + if (sp->flags & SCG_RECV_DATA) + req.sr_dma_dir = SR_DMA_RD; + } + req.sr_addr = sp->addr; + req.sr_dma_max = sp->size; + req.sr_ioto = sp->timeout; + if (ioctl(scgp->fd, SGIOCREQ, (void *)&req) < 0) { + ret = -1; + sp->ux_errno = geterrno(); + if (sp->ux_errno != ENOTTY) + ret = 0; + } else { + sp->ux_errno = 0; + } + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, "dma_dir: %X\n", req.sr_dma_dir); + js_fprintf((FILE *)scgp->errfile, "dma_addr: %X\n", req.sr_addr); + js_fprintf((FILE *)scgp->errfile, "io_time: %d\n", req.sr_ioto); + js_fprintf((FILE *)scgp->errfile, "io_status: %d\n", req.sr_io_status); + js_fprintf((FILE *)scgp->errfile, "scsi_status: %X\n", req.sr_scsi_status); + js_fprintf((FILE *)scgp->errfile, "dma_xfer: %d\n", req.sr_dma_xfr); + } + sp->u_scb.cmd_scb[0] = req.sr_scsi_status; + sp->sense_count = sizeof (esense_reply_t); + if (sp->sense_count > sp->sense_len) + sp->sense_count = sp->sense_len; + if (sp->sense_count > SCG_MAX_SENSE) + sp->sense_count = SCG_MAX_SENSE; + if (sp->sense_count < 0) + sp->sense_count = 0; + movebytes(&req.sr_esense, sp->u_sense.cmd_sense, sp->sense_count); + sp->resid = sp->size - req.sr_dma_xfr; + + switch (req.sr_io_status) { + + case SR_IOST_GOOD: sp->error = SCG_NO_ERROR; break; + + case SR_IOST_CHKSNV: sp->sense_count = 0; + case SR_IOST_CHKSV: sp->error = SCG_RETRYABLE; + break; + + case SR_IOST_SELTO: + case SR_IOST_DMAOR: + sp->error = SCG_FATAL; break; + + case SR_IOST_IOTO: sp->error = SCG_TIMEOUT; break; + + case SR_IOST_PERM: + case SR_IOST_NOPEN: + sp->error = SCG_FATAL; + ret = (-1); + break; + + default: sp->error = SCG_RETRYABLE; break; + + } + return (ret); +} diff --git a/scsilib/libscg/scsi-openserver.c b/scsilib/libscg/scsi-openserver.c new file mode 100644 index 0000000..f4d5b77 --- /dev/null +++ b/scsilib/libscg/scsi-openserver.c @@ -0,0 +1,1038 @@ +/* @(#)scsi-openserver.c 1.31 04/01/15 Copyright 1998 J. Schilling, Santa Cruz Operation */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-openserver.c 1.31 04/01/15 Copyright 1998 J. Schilling, Santa Cruz Operation"; +#endif +/* + * Interface for the SCO SCSI implementation. + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1998 J. Schilling, Santa Cruz Operation + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#undef sense + +#include <sys/scsicmd.h> + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-openserver.c-1.31"; /* The version for this transport*/ + +#define MAX_SCG 16 /* Max # of cdrom devices */ +#define MAX_TGT 16 /* Not really needed */ +#define MAX_LUN 8 /* Not really needed */ + +#define MAX_DMA (64*1024) + +#define MAXPATH 256 /* max length of devicepath */ +#define MAXLINE 80 /* max length of input line */ +#define MAXSCSI 99 /* max number of mscsi lines */ +#define MAXDRVN 10 /* max length of drivername */ + +#define DEV_DIR "/tmp" +#define DEV_NAME "scg.s%1dt%1dl%1d" + +/* + * --------------------------------------------------------------------- + * We will only deal with cdroms by default! Only if you set a specific + * environment variable, we will scan "all" devices ! + * Set LIBSCG_SCAN_ALL to any value to enable access to all your SCSI + * devices. + * + * The upcoming support for USB will be for USB 1.1, so as this is not + * tested yet, we will currently ignore drives connect to the USB stack + * (usbha controller) regardless of having set LIBSCG_SCAN_ALL or not! + */ + +#define DEV_ROOT "/dev/dsk/0s0" + +#define DEV_SDSK "/dev/rdsk/%ds0" +#define DEV_SROM "/dev/rcd%d" +#define DEV_STP "/dev/xStp%d" +#define DEV_SFLP "/dev/rdsk/fp%dh" + +#define SCAN_DEV "%s%s%d%d%d%d" + +#define SCSI_CFG "/etc/sconf -r" /* no. of configured devices */ +#define SCSI_DEV "/etc/sconf -g %d" /* read line 'n' of mscsi tbl */ + +#define DRV_ATAPI "wd" /* SCO OpenServer IDE driver */ +#define DRV_USB "usbha" /* SCO OpenServer USB driver */ +#define DRV_NOHA "noha" /* IDE/ATAPI device configured, */ + /* but missing ! */ + + +#define T_DISK "Sdsk" /* SCO OpenServer SCSI disk */ +#define T_CDROM "Srom" /* SCO OpenServer SCSI cdrom */ +#define T_TAPE "Stp" /* SCO OpenServer SCSI tape */ +#define T_FLOPPY "Sflp" /* SCO OpenServer SCSI floppy */ + + +/* + * --------------------------------------------------------------------- + * Environment variables to control certain functionality + */ + +#define SCAN_ALL "LIBSCG_SCAN_ALL" /* enable access for all devices */ +#define SCSI_USER_CMD "LIBSCG_SCSIUSERCMD" /* use old SCSIUSERCMD ioctl() */ +#define DMA_OVERRIDE "LIBSCG_MAX_DMA" /* override MAX_DMA value */ +#define ENABLE_USB "LIBSCG_ENABLE_USB" /* enable access of USB devices */ + +LOCAL int scan_all = 0; /* don't scan all devices by default */ +LOCAL int scsiusercmd = 0; /* use SCSIUSERCMD2 ioctl by default */ +LOCAL int enable_usb = 0; /* don't scan USB devices by default */ +LOCAL long max_dma = MAX_DMA; /* use MAX_DMA DMA buffer by default */ + + +/* + * --------------------------------------------------------------------- + * There are two scsi passthrough ioctl() on SCO OpenServer 5.0.[45], + * while there is only one available on SCO OpenServer 5.0.[02]. + * + * The SCSIUSERCMD ioctl is available on all OpenServer 5 + * + * The SCSIUSERCMD2 ioctl which executes the usercmd and reads the sense + * in one go, is only available from 5.0.4 onwards. + * + * By default we will use the SCSIUSERCMD2 ioctl(), in order to execute + * the SCSIUSERCMD ioctl() instead set the environment variable + * LIBSCG_SCSIUSERCMD to any value. Using the olderSCSIUSERCMD ioctl() will + * if the SCSI commands returns a CHECK CONDITION status, run a seperate + * REQUEST_SENSE command immediately. But we need to remember that in a + * multi-tasking environment, there might be other code which has accessed + * the device in between these two steps and therefore the sense code + * is no longer valid !!! + * + * NOTE: There are problems with the usage of AHA 154X controllers + * and SCSIUSERCMD2 such as nonsense (weird) output on cdrecord -scanbus + * + */ + + +typedef struct scg2sdi { + + int valid; + int open; + int atapi; + int fd; + int lmscsi; + +} scg2sdi_t; + +LOCAL scg2sdi_t sdidevs [MAX_SCG][MAX_TGT][MAX_LUN]; + +typedef struct amscsi { + char typ[MAXDRVN]; + char drv[MAXDRVN]; + int hba; + int bus; + int scg; + int tgt; + int lun; + char dev[MAXPATH]; + +} amscsi_t; + +struct scg_local { + short scgfiles[MAX_SCG][MAX_TGT][MAX_LUN]; +}; +#define scglocal(p) ((struct scg_local *)((p)->local)) + +LOCAL int sort_mscsi __PR((const void *l1, const void *l2)); +LOCAL int openserver_init __PR((SCSI *scgp)); +LOCAL void cp_scg2sco __PR((struct scsicmd2 *sco, struct scg_cmd *scg)); +LOCAL void cp_sco2scg __PR((struct scsicmd2 *sco, struct scg_cmd *scg)); + +/* + * ------------------------------------------------------------------------- + * SCO OpenServer does not have a generic scsi device driver, which can + * be used to access any configured scsi device. But we can use the "Sxxx" + * scsi peripherial drivers passthrough ioctl() (SCSIUSERCMD / SCSIUSERCMD2) + * to send scsi user comands to any target device controlled by the + * corresponding target driver. + * + * This passthrough implementation for libscg currently allows to + * handle the following devices classes: + * + * 1. DISK handled by Sdsk + * 2. CD-ROM handled by Srom + * 3. TAPES handled by Stp + * 4. FLOPPY handled by Sflp + * + * NOTE: The libscg OpenServer passthrough routines have changed with + * cdrecord-1.8 to enable the -scanbus option. Therefore the + * addressing scheme is now the same as used on many other platforms + * like Solaris, Linux etc. + * + * =============================================================== + * RUN 'cdrecord -scanbus' TO SEE THE DEVICE ADDRESSES YOU CAN USE + * =============================================================== + * + */ + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (__sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "SCSIUSERCMD/SCSIUSERCMD2", "Generic SCSI", + "", "bus,target,lun", "1,2,0", TRUE, FALSE); + return (0); +} + +/* + * --------------------------------------------------------------- + * This routine sorts the amscsi_t lines on the following columns + * in ascending order: + * + * 1. drv - driver name + * 2. bus - scsibus per controller + * 3. tgt - target id of device + * 4. lun - lun of the device + * + */ + + +LOCAL int +sort_mscsi(l1, l2) + const void *l1; + const void *l2; +{ + amscsi_t *t1 = (amscsi_t *) l1; + amscsi_t *t2 = (amscsi_t *) l2; + + if (strcmp(t1->drv, t2->drv) == 0) { + if (t1->bus < t2->bus) { + return (-1); + + } else if (t1->bus > t2->bus) { + return (1); + + } else if (t1->tgt < t2->tgt) { + return (-1); + + } else if (t1->tgt > t2->tgt) { + return (1); + + } else if (t1->lun < t2->lun) { + return (-1); + + } else if (t1->lun > t2->lun) { + return (1); + } else { + return (0); + } + } else { + return (strcmp(t1->drv, t2->drv)); + } +} + +/* + * --------------------------------------------------------------- + * This routine is introduced to find all scsi devices which are + * currently configured into the kernel. This is done by reading + * the dynamic kernel mscsi tables and parse the resulting lines. + * As the output of 'sconf' is not directly usable the information + * found is to be sorted and re-arranged to be used with the libscg + * routines. + * + * NOTE: One problem is currently still not solved ! If you don't + * have a media in your CD-ROM/CD-Writer we are not able to + * do an open() and therefore will set the drive to be not + * available (valid=0). + * + * This will for example cause cdrecord to not list the drive + * in the -scanbus output. + * + */ + +LOCAL int +openserver_init(scgp) + SCSI *scgp; +{ + FILE *cmd; + int nscg = -1, lhba = -1, lbus = -1; + int nSrom = -1, nSdsk = -1, nStp = -1, nSflp = -1; + int atapi, fd, nopen = 0; + int pos = 0, len = 0, nlm = 0; + int s = 0, t = 0, l = 0; + int ide_rootdisk = 0; + long dma_override = 0; + int mscsi; + char sconf[MAXLINE]; + char lines[MAXLINE]; + char drvid[MAXDRVN]; + amscsi_t cmtbl[MAXSCSI]; + char dname[MAXPATH]; + char **evsave; +extern char **environ; + + + for (s = 0; s < MAX_SCG; s++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + sdidevs[s][t][l].valid = 0; + sdidevs[s][t][l].open = -1; + sdidevs[s][t][l].atapi = -1; + sdidevs[s][t][l].fd = -1; + sdidevs[s][t][l].lmscsi = -1; + } + } + } + + /* Check whether we want to use the older SCSIUSERCMD ioctl() */ + + if (getenv(SCSI_USER_CMD) != NULL) { + scsiusercmd = 1; + } + + /* + * Check whether we want to scan all devices + */ + if (getenv(SCAN_ALL) != NULL) { + scan_all = 1; + } + + /* + * Check whether we want to use USB devices + */ + if (getenv(ENABLE_USB) != NULL) { + enable_usb = 1; + } + + /* + * Check whether we want to override the MAX_DMA value + */ + if (getenv(DMA_OVERRIDE) != NULL) { + dma_override = atol(getenv(DMA_OVERRIDE)); + if ((dma_override >= 1) && (dma_override <= (256))) + max_dma = dma_override * 1024; + } + + + /* read sconf -r and get number of kernel mscsi lines ! */ + + evsave = environ; + environ = 0; + if ((cmd = popen(SCSI_CFG, "r")) == NULL) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Error popen() for \"%s\"", + SCSI_CFG); + environ = evsave; + return (-1); + } + environ = evsave; + + if (fgets(lines, MAXLINE, cmd) == NULL) { + errno = EIO; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Error reading popen() for \"%s\"", + SCSI_CFG); + return (-1); + } else + nlm = atoi(lines); + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, "-------------------- \n"); + js_fprintf((FILE *)scgp->errfile, "mscsi lines = %d\n", nlm); + js_fprintf((FILE *)scgp->errfile, "-------------------- \n"); + } + + if (pclose(cmd) == -1) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Error pclose() for \"%s\"", + SCSI_CFG); + return (-1); + } + + for (l = 0; l < nlm; l++) { + + /* initialize cmtbl entry */ + + cmtbl[l].hba = -1; + cmtbl[l].bus = -1; + cmtbl[l].tgt = -1; + cmtbl[l].lun = -1; + cmtbl[l].scg = -1; + + memset(cmtbl[l].typ, '\0', MAXDRVN); + memset(cmtbl[l].drv, '\0', MAXDRVN); + memset(cmtbl[l].dev, '\0', MAXDRVN); + + /* read sconf -g 'n' and get line of kernel mscsi table! */ + /* the order the lines will be received in will determine */ + /* the device name we can use to open the device */ + + js_snprintf(sconf, sizeof (sconf), + SCSI_DEV, l + 1); /* enumeration starts with 1 */ + + evsave = environ; + environ = 0; + if ((cmd = popen(sconf, "r")) == NULL) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Error popen() for \"%s\"", + sconf); + environ = evsave; + return (-1); + } + environ = evsave; + + if (fgets(lines, MAXLINE, cmd) == NULL) + break; + + if (pclose(cmd) == -1) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Error pclose() for \"%s\"", + sconf); + return (-1); + } + + sscanf(lines, SCAN_DEV, cmtbl[l].typ, + cmtbl[l].drv, + &cmtbl[l].hba, + &cmtbl[l].bus, + &cmtbl[l].tgt, + &cmtbl[l].lun); + + if (strstr(cmtbl[l].typ, T_DISK) != NULL) { + js_snprintf(cmtbl[l].dev, sizeof (cmtbl[l].dev), + DEV_SDSK, ++nSdsk); + } + + if (strstr(cmtbl[l].typ, T_CDROM) != NULL) { + js_snprintf(cmtbl[l].dev, sizeof (cmtbl[l].dev), + DEV_SROM, ++nSrom); + } + + if (strstr(cmtbl[l].typ, T_TAPE) != NULL) { + js_snprintf(cmtbl[l].dev, sizeof (cmtbl[l].dev), + DEV_STP, ++nStp); + } + + if (strstr(cmtbl[l].typ, T_FLOPPY) != NULL) { + js_snprintf(cmtbl[l].dev, sizeof (cmtbl[l].dev), + DEV_SFLP, ++nSflp); + } + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "%-4s = %5s(%d,%d,%d,%d) -> %s\n", + cmtbl[l].typ, + cmtbl[l].drv, + cmtbl[l].hba, + cmtbl[l].bus, + cmtbl[l].tgt, + cmtbl[l].lun, + cmtbl[l].dev); + } + + } + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, "-------------------- \n"); + js_fprintf((FILE *)scgp->errfile, "%2d DISK \n", nSdsk + 1); + js_fprintf((FILE *)scgp->errfile, "%2d CD-ROM\n", nSrom + 1); + js_fprintf((FILE *)scgp->errfile, "%2d TAPE \n", nStp + 1); + js_fprintf((FILE *)scgp->errfile, "%2d FLOPPY\n", nSflp + 1); + js_fprintf((FILE *)scgp->errfile, "-------------------- \n"); + } + + /* ok, now let's sort this array of scsi devices */ + + qsort((void *) cmtbl, nlm, sizeof (amscsi_t), sort_mscsi); + + if (scgp->debug > 0) { + for (l = 0; l < nlm; l++) + js_fprintf((FILE *)scgp->errfile, + "%-4s = %5s(%d,%d,%d,%d) -> %s\n", + cmtbl[l].typ, + cmtbl[l].drv, + cmtbl[l].hba, + cmtbl[l].bus, + cmtbl[l].tgt, + cmtbl[l].lun, + cmtbl[l].dev); + js_fprintf((FILE *)scgp->errfile, "-------------------- \n"); + } + + /* find root disk controller to make it scg 0 */ + + /* + * if we have disk(s) found in the mscsi table, we still + * don't know if the rootdisk is among these, there can + * be a IDE rootdisk as well, but it's not listed in + * the mscsi table. + */ + + t = 0; + if (nSdsk > 0) { + for (l = 0; l < nlm; l++) + if (strcmp(cmtbl[l].dev, DEV_ROOT) == 0) + t = l; + } else { + + /* + * we haven't found a disk in mscsi, so we definitely + * have an IDE disk on a wd adapter as IDE disks are + * not listed as SCSI disks in the kernel mscsi table + */ + ide_rootdisk = 1; + + } + + if (!(ide_rootdisk) && (scgp->debug > 0)) { + js_fprintf((FILE *)scgp->errfile, + "root = %5s(%d,%d,%d,%d) -> %s\n", + cmtbl[t].drv, + cmtbl[t].hba, + cmtbl[t].bus, + cmtbl[t].tgt, + cmtbl[t].lun, + cmtbl[t].dev); + js_fprintf((FILE *)scgp->errfile, "-------------------- \n"); + } + + /* calculate scg from drv, hba and bus */ + + strcpy(drvid, ""); + + for (l = 0, s = t; l < nlm; l++, s = (t + l) % nlm) { + + if (strcmp(drvid, cmtbl[s].drv) != 0) { + strcpy(drvid, cmtbl[s].drv); + lhba = cmtbl[s].hba; + lbus = cmtbl[s].bus; + cmtbl[s].scg = ++nscg; + + } else if (cmtbl[s].hba != lhba) { + lhba = cmtbl[s].hba; + lbus = cmtbl[s].bus; + cmtbl[s].scg = ++nscg; + + } else if (cmtbl[s].bus != lbus) { + lbus = cmtbl[s].bus; + cmtbl[s].scg = ++nscg; + } else { + cmtbl[s].scg = nscg; + } + sdidevs[cmtbl[s].scg][cmtbl[s].tgt][cmtbl[s].lun].open = 0; + + /* check whether we want to open all devices or it's a CDROM */ + + if ((scan_all) || (strcmp(cmtbl[s].typ, T_CDROM) == 0)) + sdidevs[cmtbl[s].scg][cmtbl[s].tgt][cmtbl[s].lun].valid = 1; + + /* check whether we have an IDE/ATAPI device */ + + if (strcmp(cmtbl[s].drv, DRV_ATAPI) == 0) + sdidevs[cmtbl[s].scg][cmtbl[s].tgt][cmtbl[s].lun].atapi = 1; + + /* don't open a USB device if enable_usb is not set */ + + if (strcmp(cmtbl[s].drv, DRV_USB) == 0) + sdidevs[cmtbl[s].scg][cmtbl[s].tgt][cmtbl[s].lun].valid = enable_usb; + + /* don't open a IDE/ATAPI device which is missing but configured */ + + if (strcmp(cmtbl[s].drv, DRV_NOHA) == 0) + sdidevs[cmtbl[s].scg][cmtbl[s].tgt][cmtbl[s].lun].valid = 0; + + + sdidevs[cmtbl[s].scg][cmtbl[s].tgt][cmtbl[s].lun].lmscsi = s; + + } + + + /* open all yet valid device nodes */ + + for (s = 0; s < MAX_SCG; s++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + + if (sdidevs[s][t][l].valid == 0) + continue; + + /* Open pass-through device node */ + + mscsi = sdidevs[s][t][l].lmscsi; + + strcpy(dname, cmtbl[mscsi].dev); + + /* + * ------------------------------------------------------------------ + * NOTE: If we can't open the device, we will set the device invalid! + * ------------------------------------------------------------------ + */ + errno = 0; + if ((fd = open(dname, (O_RDONLY | O_NONBLOCK))) < 0) { + sdidevs[s][t][l].valid = 0; + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "%5s(%d,%d,%d,%d) -> %s open() failed: errno = %d (%s)\n", + cmtbl[mscsi].drv, + cmtbl[mscsi].hba, + cmtbl[mscsi].bus, + cmtbl[mscsi].tgt, + cmtbl[mscsi].lun, + cmtbl[mscsi].dev, + errno, + strerror(errno)); + } + continue; + } + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "%d,%d,%d => %5s(%d,%d,%d,%d) -> %d : %s \n", + s, t, l, + cmtbl[mscsi].drv, + cmtbl[mscsi].hba, + cmtbl[mscsi].bus, + cmtbl[mscsi].tgt, + cmtbl[mscsi].lun, + cmtbl[mscsi].scg, + cmtbl[mscsi].dev); + } + + sdidevs[s][t][l].fd = fd; + sdidevs[s][t][l].open = 1; + nopen++; + scglocal(scgp)->scgfiles[s][t][l] = (short) fd; + } + } + } + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, "-------------------- \n"); + js_fprintf((FILE *)scgp->errfile, "nopen = %d devices \n", nopen); + js_fprintf((FILE *)scgp->errfile, "-------------------- \n"); + } + + return (nopen); +} + + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + int f, b, t, l; + int nopen = 0; + char devname[64]; + + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno, target or lun '%d,%d,%d'", + busno, tgt, tlun); + return (-1); + } + + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + scglocal(scgp)->scgfiles[b][t][l] = (short)-1; + } + } + } + + if (*device != '\0') { /* we don't allow old dev usage */ + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Open by 'devname' no longer supported on this OS"); + return (-1); + } + + return (openserver_init(scgp)); + +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + register int f; + register int b; + register int t; + register int l; + + if (scgp->local == NULL) + return (-1); + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + + f = scglocal(scgp)->scgfiles[b][t][l]; + if (f >= 0) + close(f); + + sdidevs[b][t][l].fd = -1; + sdidevs[b][t][l].open = 0; + sdidevs[b][t][l].valid = 0; + + scglocal(scgp)->scgfiles[b][t][l] = (short)-1; + } + } + } + return (0); +} + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + return (max_dma); +} + + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_getbuf: %ld bytes\n", amt); + } + scgp->bufbase = valloc((size_t)(amt)); + + return (scgp->bufbase); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + register int t; + register int l; + + if (busno < 0 || busno >= MAX_SCG) + return (FALSE); + + if (scgp->local == NULL) + return (FALSE); + + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + if (scglocal(scgp)->scgfiles[busno][t][l] >= 0) + return (TRUE); + } + return (FALSE); +} + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (busno < 0 || busno >= MAX_SCG || + tgt < 0 || tgt >= MAX_TGT || + tlun < 0 || tlun >= MAX_LUN) + return (-1); + + if (scgp->local == NULL) + return (-1); + + return ((int)scglocal(scgp)->scgfiles[busno][tgt][tlun]); +} + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + return (-1); + + /* + * We don't know the initiator ID yet, but we can if we parse the + * output of the command 'cat /dev/string/cfg | grep "%adapter"' + * + * Sample line: + * + * %adapter 0xE800-0xE8FF 11 - type=alad ha=0 bus=0 id=7 fts=sto + * + * This tells us that the alad controller 0 has an id of 7 ! + * The parsing should be done in openserver_init(). + * + */ +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; +{ + return (sdidevs[scg_scsibus(scgp)][scg_target(scgp)][scg_lun(scgp)].atapi); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + errno = EINVAL; + return (-1); /* no scsi reset available */ +} + +LOCAL void +cp_scg2sco(sco, scg) + struct scsicmd2 *sco; + struct scg_cmd *scg; +{ + sco->cmd.data_ptr = (char *) scg->addr; + sco->cmd.data_len = scg->size; + sco->cmd.cdb_len = scg->cdb_len; + + sco->sense_len = scg->sense_len; + sco->sense_ptr = scg->u_sense.cmd_sense; + + if (!(scg->flags & SCG_RECV_DATA) && (scg->size > 0)) + sco->cmd.is_write = 1; + + if (scg->cdb_len == SC_G0_CDBLEN) + memcpy(sco->cmd.cdb, &scg->cdb.g0_cdb, scg->cdb_len); + + if (scg->cdb_len == SC_G1_CDBLEN) + memcpy(sco->cmd.cdb, &scg->cdb.g1_cdb, scg->cdb_len); + + if (scg->cdb_len == SC_G5_CDBLEN) + memcpy(sco->cmd.cdb, &scg->cdb.g5_cdb, scg->cdb_len); +} + + +LOCAL void +cp_sco2scg(sco, scg) + struct scsicmd2 *sco; + struct scg_cmd *scg; +{ + scg->size = sco->cmd.data_len; + + memset(&scg->scb, 0, sizeof (scg->scb)); + + if (sco->sense_len > SCG_MAX_SENSE) + scg->sense_count = SCG_MAX_SENSE; + else + scg->sense_count = sco->sense_len; + + scg->resid = 0; + + scg->u_scb.cmd_scb[0] = sco->cmd.target_sts; + +} + + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + struct scsicmd2 scsi_cmd; + int i; + Uchar sense_buf[SCG_MAX_SENSE]; + + if (scgp->fd < 0) { + sp->error = SCG_FATAL; + return (0); + } + + memset(&scsi_cmd, 0, sizeof (scsi_cmd)); + memset(sense_buf, 0, sizeof (sense_buf)); + scsi_cmd.sense_ptr = sense_buf; + scsi_cmd.sense_len = sizeof (sense_buf); + cp_scg2sco(&scsi_cmd, sp); + + errno = 0; + sp->ux_errno = 0; + sp->error = SCG_NO_ERROR; + for (;;) { + int ioctlStatus; + struct scsicmd s_cmd; + + if (scsiusercmd) { /* Use SCSIUSERCMD ioctl() */ + if (scgp->debug > 1) { + js_fprintf((FILE *)scgp->errfile, "calling SCSIUSERCMD ioctl()\n"); + } + + if ((ioctlStatus = ioctl(scgp->fd, SCSIUSERCMD, &(scsi_cmd.cmd))) < 0) { + if (scgp->debug > 1) { + js_fprintf((FILE *)scgp->errfile, "returning from SCSIUSERCMD ioctl()\n"); + } + if (errno == EINTR) + continue; + + cp_sco2scg(&scsi_cmd, sp); + sp->ux_errno = errno; + if (errno == 0) + sp->ux_errno = EIO; + sp->error = SCG_RETRYABLE; + + return (0); + } + + if (scgp->debug > 1) { + js_fprintf((FILE *)scgp->errfile, "returning from SCSIUSERCMD ioctl()\n"); + } + cp_sco2scg(&scsi_cmd, sp); + sp->ux_errno = errno; + + if (scsi_cmd.cmd.target_sts & 0x02) { /* Check Condition & get Sense */ + + if (sp->sense_len > SCG_MAX_SENSE) + sp->sense_len = SCG_MAX_SENSE; + + memset((caddr_t)&s_cmd, 0, sizeof (s_cmd)); + + s_cmd.data_ptr = (caddr_t) sp->u_sense.cmd_sense; + s_cmd.data_len = sp->sense_len; + s_cmd.is_write = 0; + s_cmd.cdb[0] = SC_REQUEST_SENSE; + + while (((ioctlStatus = ioctl(scgp->fd, SCSIUSERCMD, &s_cmd)) < 0) && + (errno == EINTR)) + ; + + sp->sense_count = sp->sense_len; + sp->ux_errno = errno; + + if (errno == 0) + sp->ux_errno = EIO; + sp->error = SCG_NO_ERROR; + } + + if (scgp->debug > 0) { + if (errno != 0) + js_fprintf((FILE *)scgp->errfile, "ux_errno: %d (%s) \n", sp->ux_errno, strerror(sp->ux_errno)); + if (sp->u_scb.cmd_scb[0] != 0) + js_fprintf((FILE *)scgp->errfile, "tgt_stat: %d \n", sp->u_scb.cmd_scb[0]); + } + break; + + } else { /* Use SCSIUSERCMD2 ioctl() */ + if (scgp->debug > 1) { + js_fprintf((FILE *)scgp->errfile, "calling SCSIUSERCMD2 ioctl()\n"); + } + + if ((ioctlStatus = ioctl(scgp->fd, SCSIUSERCMD2, &scsi_cmd)) < 0) { + if (scgp->debug > 1) { + js_fprintf((FILE *)scgp->errfile, "returning from SCSIUSERCMD2 ioctl()\n"); + } + if (errno == EINTR) + continue; + + cp_sco2scg(&scsi_cmd, sp); + sp->ux_errno = errno; + if (errno == 0) + sp->ux_errno = EIO; + sp->error = SCG_RETRYABLE; + + return (0); + } + if (scgp->debug > 1) { + js_fprintf((FILE *)scgp->errfile, "returning from SCSIUSERCMD2 ioctl()\n"); + } + + cp_sco2scg(&scsi_cmd, sp); + sp->ux_errno = errno; + + if (scsi_cmd.cmd.target_sts & 0x02) { /* Check Condition */ + if (errno == 0) + sp->ux_errno = EIO; + sp->error = SCG_NO_ERROR; + } + + if (scgp->debug > 0) { + if (errno != 0) + js_fprintf((FILE *)scgp->errfile, "ux_errno: %d (%s) \n", sp->ux_errno, strerror(sp->ux_errno)); + if (sp->u_scb.cmd_scb[0] != 0) + js_fprintf((FILE *)scgp->errfile, "tgt_stat: %d \n", sp->u_scb.cmd_scb[0]); + } + break; + + } + } + + return (0); +} + +#define sense u_sense.Sense diff --git a/scsilib/libscg/scsi-os2.c b/scsilib/libscg/scsi-os2.c new file mode 100644 index 0000000..7918a87 --- /dev/null +++ b/scsilib/libscg/scsi-os2.c @@ -0,0 +1,650 @@ +/* @(#)scsi-os2.c 1.25 04/01/15 Copyright 1998 J. Schilling, C. Wohlgemuth */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-os2.c 1.25 04/01/15 Copyright 1998 J. Schilling, C. Wohlgemuth"; +#endif +/* + * Interface for the OS/2 ASPI-Router ASPIROUT.SYS ((c) D. Dorau). + * This additional driver is a prerequisite for using cdrecord. + * Get it from HOBBES or LEO. + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * XXX it currently uses static SRB and for this reason is not reentrant + * + * Copyright (c) 1998 J. Schilling + * Copyright (c) 1998 C. Wohlgemuth for this interface. + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#undef sense + +/*#define DEBUG*/ + +/* For AspiRouter */ +#include "scg/srb_os2.h" + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-os2.c-1.25"; /* The version for this transport*/ + +#define FILE_OPEN 0x0001 +#define OPEN_SHARE_DENYREADWRITE 0x0010 +#define OPEN_ACCESS_READWRITE 0x0002 +#define DC_SEM_SHARED 0x01 +#define OBJ_TILE 0x0040 +#define PAG_READ 0x0001 +#define PAG_WRITE 0x0002 +#define PAG_COMMIT 0x0010 + +typedef unsigned long LHANDLE; +typedef unsigned long ULONG; +typedef unsigned char *PSZ; +typedef unsigned short USHORT; +typedef unsigned char UCHAR; + +typedef LHANDLE HFILE; +typedef ULONG HEV; + +#define MAX_SCG 16 /* Max # of SCSI controllers */ +#define MAX_TGT 16 +#define MAX_LUN 8 + +struct scg_local { + int dummy; +}; +#define scglocal(p) ((struct scg_local *)((p)->local)) + +#define MAX_DMA_OS2 (63*1024) /* ASPI-Router allows up to 64k */ + +LOCAL void *buffer = NULL; +LOCAL HFILE driver_handle = 0; +LOCAL HEV postSema = 0; + +LOCAL BOOL open_driver __PR((SCSI *scgp)); +LOCAL BOOL close_driver __PR((void)); +LOCAL ULONG wait_post __PR((ULONG ulTimeOut)); +LOCAL BOOL init_buffer __PR((void* mem)); +LOCAL void exit_func __PR((void)); +LOCAL void set_error __PR((SRB *srb, struct scg_cmd *sp)); + + +LOCAL void +exit_func() +{ + if (!close_driver()) + js_fprintf(stderr, "Cannot close OS/2-ASPI-Router!\n"); +} + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (__sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "ASPI", "Generic transport independent SCSI", + "", "bus,target,lun", "1,2,0", TRUE, FALSE); + return (0); +} + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno, target or lun '%d,%d,%d'", + busno, tgt, tlun); + return (-1); + } + + if ((device != NULL && *device != '\0') || (busno == -2 && tgt == -2)) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Open by 'devname' not supported on this OS"); + return (-1); + } + + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + } + + if (!open_driver(scgp)) /* Try to open ASPI-Router */ + return (-1); + atexit(exit_func); /* Install Exit Function which closes the ASPI-Router */ + + /* + * Success after all + */ + return (1); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + exit_func(); + return (0); +} + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + long maxdma = MAX_DMA_OS2; + return (maxdma); +} + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + ULONG rc; + +#ifdef DEBUG + js_fprintf((FILE *)scgp->errfile, "scgo_getbuf: %ld bytes\n", amt); +#endif + rc = DosAllocMem(&buffer, amt, OBJ_TILE | PAG_READ | PAG_WRITE | PAG_COMMIT); + + if (rc) { + js_fprintf((FILE *)scgp->errfile, "Cannot allocate buffer.\n"); + return ((void *)0); + } + scgp->bufbase = buffer; + +#ifdef DEBUG + js_fprintf((FILE *)scgp->errfile, "Buffer allocated at: 0x%x\n", scgp->bufbase); +#endif + + /* Lock memory */ + if (init_buffer(scgp->bufbase)) + return (scgp->bufbase); + + js_fprintf((FILE *)scgp->errfile, "Cannot lock memory buffer.\n"); + return ((void *)0); /* Error */ +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase && DosFreeMem(scgp->bufbase)) { + js_fprintf((FILE *)scgp->errfile, + "Cannot free buffer memory for ASPI-Router!\n"); /* Free our memory buffer if not already done */ + } + if (buffer == scgp->bufbase) + buffer = NULL; + scgp->bufbase = NULL; +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + register int t; + register int l; + + if (busno < 0 || busno >= MAX_SCG) + return (FALSE); + + return (TRUE); +} + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (busno < 0 || busno >= MAX_SCG || + tgt < 0 || tgt >= MAX_TGT || + tlun < 0 || tlun >= MAX_LUN) + return (-1); + + /* + * Return fake + */ + return (1); +} + + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + return (-1); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; +{ + return (FALSE); +} + + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + ULONG rc; /* return value */ + ULONG cbreturn; + ULONG cbParam; + BOOL success; +static SRB SRBlock; /* XXX makes it non reentrant */ + + if (what == SCG_RESET_NOP) + return (0); + if (what != SCG_RESET_BUS) { + errno = EINVAL; + return (-1); + } + /* + * XXX Does this reset TGT or BUS ??? + */ + SRBlock.cmd = SRB_Reset; /* reset device */ + SRBlock.ha_num = scg_scsibus(scgp); /* host adapter number */ + SRBlock.flags = SRB_Post; /* posting enabled */ + SRBlock.u.res.target = scg_target(scgp); /* target id */ + SRBlock.u.res.lun = scg_lun(scgp); /* target LUN */ + + rc = DosDevIOCtl(driver_handle, 0x92, 0x02, (void*) &SRBlock, sizeof (SRB), &cbParam, + (void*) &SRBlock, sizeof (SRB), &cbreturn); + if (rc) { + js_fprintf((FILE *)scgp->errfile, + "DosDevIOCtl() failed in resetDevice.\n"); + return (1); /* DosDevIOCtl failed */ + } else { + success = wait_post(40000); /** wait for SRB being processed */ + if (success) + return (2); + } + if (SRBlock.status != SRB_Done) + return (3); +#ifdef DEBUG + js_fprintf((FILE *)scgp->errfile, + "resetDevice of host: %d target: %d lun: %d successful.\n", scg_scsibus(scgp), scg_target(scgp), scg_lun(scgp)); + js_fprintf((FILE *)scgp->errfile, + "SRBlock.ha_status: 0x%x, SRBlock.target_status: 0x%x, SRBlock.satus: 0x%x\n", + SRBlock.u.cmd.ha_status, SRBlock.u.cmd.target_status, SRBlock.status); +#endif + return (0); +} + +/* + * Set error flags + */ +LOCAL void +set_error(srb, sp) + SRB *srb; + struct scg_cmd *sp; +{ + switch (srb->status) { + + case SRB_InvalidCmd: /* 0x80 Invalid SCSI request */ + case SRB_InvalidHA: /* 0x81 Invalid host adapter number */ + case SRB_BadDevice: /* 0x82 SCSI device not installed */ + sp->error = SCG_FATAL; + sp->ux_errno = EINVAL; /* Should we ever return != EIO */ + sp->ux_errno = EIO; + break; + + + case SRB_Busy: /* 0x00 SCSI request in progress */ + case SRB_Aborted: /* 0x02 SCSI aborted by host */ + case SRB_BadAbort: /* 0x03 Unable to abort SCSI request */ + case SRB_Error: /* 0x04 SCSI request completed with error */ + default: + sp->error = SCG_RETRYABLE; + sp->ux_errno = EIO; + break; + } +} + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + ULONG rc; /* return value */ +static SRB SRBlock; /* XXX makes it non reentrant */ + Ulong cbreturn; + Ulong cbParam; + UCHAR* ptr; + + if (scgp->fd < 0) { /* Set in scgo_open() */ + sp->error = SCG_FATAL; + return (0); + } + + if (sp->cdb_len > sizeof (SRBlock.u.cmd.cdb_st)) { /* commandsize too big */ + sp->error = SCG_FATAL; + sp->ux_errno = EINVAL; + js_fprintf((FILE *)scgp->errfile, + "sp->cdb_len > SRBlock.u.cmd.cdb_st. Fatal error in scgo_send, exiting...\n"); + return (-1); + } + + /* clear command block */ + fillbytes((caddr_t)&SRBlock.u.cmd.cdb_st, sizeof (SRBlock.u.cmd.cdb_st), '\0'); + /* copy cdrecord command into SRB */ + movebytes(&sp->cdb, &SRBlock.u.cmd.cdb_st, sp->cdb_len); + + /* Build SRB command block */ + SRBlock.cmd = SRB_Command; + SRBlock.ha_num = scg_scsibus(scgp); /* host adapter number */ + + SRBlock.flags = SRB_Post; /* flags */ + + SRBlock.u.cmd.target = scg_target(scgp); /* Target SCSI ID */ + SRBlock.u.cmd.lun = scg_lun(scgp); /* Target SCSI LUN */ + SRBlock.u.cmd.data_len = sp->size; /* # of bytes transferred */ + SRBlock.u.cmd.data_ptr = 0; /* pointer to data buffer */ + SRBlock.u.cmd.sense_len = sp->sense_len; /* length of sense buffer */ + + SRBlock.u.cmd.link_ptr = 0; /* pointer to next SRB */ + SRBlock.u.cmd.cdb_len = sp->cdb_len; /* SCSI command length */ + + /* Specify direction */ + if (sp->flags & SCG_RECV_DATA) { + SRBlock.flags |= SRB_Read; + } else { + if (sp->size > 0) { + SRBlock.flags |= SRB_Write; + if (scgp->bufbase != sp->addr) { /* Copy only if data not in ASPI-Mem */ + movebytes(sp->addr, scgp->bufbase, sp->size); + } + } else { + SRBlock.flags |= SRB_NoTransfer; + } + } + sp->error = SCG_NO_ERROR; + sp->sense_count = 0; + sp->u_scb.cmd_scb[0] = 0; + sp->resid = 0; + + /* execute SCSI command */ + rc = DosDevIOCtl(driver_handle, 0x92, 0x02, + (void*) &SRBlock, sizeof (SRB), &cbParam, + (void*) &SRBlock, sizeof (SRB), &cbreturn); + + if (rc) { /* An error occured */ + js_fprintf((FILE *)scgp->errfile, + "DosDevIOCtl() in sendCommand failed.\n"); + sp->error = SCG_FATAL; + sp->ux_errno = EIO; /* Sp�ter vielleicht errno einsetzen */ + return (rc); + } else { + /* Wait until the command is processed */ + rc = wait_post(sp->timeout*1000); + if (rc) { /* An error occured */ + if (rc == 640) { + /* Timeout */ + sp->error = SCG_TIMEOUT; + sp->ux_errno = EIO; + js_fprintf((FILE *)scgp->errfile, + "Timeout during SCSI-Command.\n"); + return (1); + } + sp->error = SCG_FATAL; + sp->ux_errno = EIO; + js_fprintf((FILE *)scgp->errfile, + "Fatal Error during DosWaitEventSem().\n"); + return (1); + } + + /* The command is processed */ + if (SRBlock.status == SRB_Done) { /* succesful completion */ +#ifdef DEBUG + js_fprintf((FILE *)scgp->errfile, + "Command successful finished. SRBlock.status=0x%x\n\n", SRBlock.status); +#endif + sp->sense_count = 0; + sp->resid = 0; + if (sp->flags & SCG_RECV_DATA) { /* We read data */ + if (sp->addr && sp->size) { + if (scgp->bufbase != sp->addr) /* Copy only if data not in ASPI-Mem */ + movebytes(scgp->bufbase, sp->addr, SRBlock.u.cmd.data_len); + ptr = (UCHAR*)sp->addr; + sp->resid = sp->size - SRBlock.u.cmd.data_len; /*nicht �bertragene bytes. Korrekt berechnet???*/ + } + } /* end of if (sp->flags & SCG_RECV_DATA) */ + if (SRBlock.u.cmd.target_status == SRB_CheckStatus) { /* Sense data valid */ + sp->sense_count = (int)SRBlock.u.cmd.sense_len; + if (sp->sense_count > sp->sense_len) + sp->sense_count = sp->sense_len; + + ptr = (UCHAR*)&SRBlock.u.cmd.cdb_st; + ptr += SRBlock.u.cmd.cdb_len; + + fillbytes(&sp->u_sense.Sense, sizeof (sp->u_sense.Sense), '\0'); + movebytes(ptr, &sp->u_sense.Sense, sp->sense_len); + + sp->u_scb.cmd_scb[0] = SRBlock.u.cmd.target_status; + sp->ux_errno = EIO; /* Sp�ter differenzieren? */ + } + return (0); + } + /* SCSI-Error occured */ + set_error(&SRBlock, sp); + + if (SRBlock.u.cmd.target_status == SRB_CheckStatus) { /* Sense data valid */ + sp->sense_count = (int)SRBlock.u.cmd.sense_len; + if (sp->sense_count > sp->sense_len) + sp->sense_count = sp->sense_len; + + ptr = (UCHAR*)&SRBlock.u.cmd.cdb_st; + ptr += SRBlock.u.cmd.cdb_len; + + fillbytes(&sp->u_sense.Sense, sizeof (sp->u_sense.Sense), '\0'); + movebytes(ptr, &sp->u_sense.Sense, sp->sense_len); + + sp->u_scb.cmd_scb[0] = SRBlock.u.cmd.target_status; + } + if (sp->flags & SCG_RECV_DATA) { + if (sp->addr && sp->size) { + if (scgp->bufbase != sp->addr) /* Copy only if data not in ASPI-Mem */ + movebytes(scgp->bufbase, sp->addr, SRBlock.u.cmd.data_len); + } + } +#ifdef really + sp->resid = SRBlock.u.cmd.data_len; /* XXXXX Got no Data ????? */ +#else + sp->resid = sp->size - SRBlock.u.cmd.data_len; +#endif + return (1); + } +} + +/*************************************************************************** + * * + * BOOL open_driver() * + * * + * Opens the ASPI Router device driver and sets device_handle. * + * Returns: * + * TRUE - Success * + * FALSE - Unsuccessful opening of device driver * + * * + * Preconditions: ASPI Router driver has be loaded * + * * + ***************************************************************************/ +LOCAL BOOL +open_driver(scgp) + SCSI *scgp; +{ + ULONG rc; /* return value */ + ULONG ActionTaken; /* return value */ + USHORT openSemaReturn; /* return value */ + ULONG cbreturn; + ULONG cbParam; + + if (driver_handle) /* ASPI-Router already opened */ + return (TRUE); + + rc = DosOpen((PSZ) "aspirou$", /* open driver*/ + &driver_handle, + &ActionTaken, + 0, + 0, + FILE_OPEN, + OPEN_SHARE_DENYREADWRITE | OPEN_ACCESS_READWRITE, + NULL); + if (rc) { + js_fprintf((FILE *)scgp->errfile, + "Cannot open ASPI-Router!\n"); + + return (FALSE); /* opening failed -> return false*/ + } + + /* Init semaphore */ + if (DosCreateEventSem(NULL, &postSema, /* create event semaphore */ + DC_SEM_SHARED, 0)) { + DosClose(driver_handle); + js_fprintf((FILE *)scgp->errfile, + "Cannot create event semaphore!\n"); + + return (FALSE); + } + rc = DosDevIOCtl(driver_handle, 0x92, 0x03, /* pass semaphore handle */ + (void*) &postSema, sizeof (HEV), /* to driver */ + &cbParam, (void*) &openSemaReturn, + sizeof (USHORT), &cbreturn); + + if (rc||openSemaReturn) { /* Error */ + DosCloseEventSem(postSema); + DosClose(driver_handle); + return (FALSE); + } + return (TRUE); +} + +/*************************************************************************** + * * + * BOOL close_driver() * + * * + * Closes the device driver * + * Returns: * + * TRUE - Success * + * FALSE - Unsuccessful closing of device driver * + * * + * Preconditions: ASPI Router driver has be opened with open_driver * + * * + ***************************************************************************/ +LOCAL BOOL +close_driver() +{ + ULONG rc; /* return value */ + + if (driver_handle) { + rc = DosClose(driver_handle); + if (rc) + return (FALSE); /* closing failed -> return false */ + driver_handle = 0; + if (DosCloseEventSem(postSema)) + js_fprintf(stderr, "Cannot close event semaphore!\n"); + if (buffer && DosFreeMem(buffer)) { + js_fprintf(stderr, + "Cannot free buffer memory for ASPI-Router!\n"); /* Free our memory buffer if not already done */ + } + buffer = NULL; + } + return (TRUE); +} + +LOCAL ULONG +wait_post(ULONG ulTimeOut) +{ + ULONG count = 0; + ULONG rc; /* return value */ + +/* rc = DosWaitEventSem(postSema, -1);*/ /* wait forever*/ + rc = DosWaitEventSem(postSema, ulTimeOut); + DosResetEventSem(postSema, &count); + return (rc); +} + +LOCAL BOOL +init_buffer(mem) + void *mem; +{ + ULONG rc; /* return value */ + USHORT lockSegmentReturn; /* return value */ + Ulong cbreturn; + Ulong cbParam; + + rc = DosDevIOCtl(driver_handle, 0x92, 0x04, /* pass buffers pointer */ + (void*) mem, sizeof (void*), /* to driver */ + &cbParam, (void*) &lockSegmentReturn, + sizeof (USHORT), &cbreturn); + if (rc) + return (FALSE); /* DosDevIOCtl failed */ + if (lockSegmentReturn) + return (FALSE); /* Driver could not lock segment */ + return (TRUE); +} +#define sense u_sense.Sense diff --git a/scsilib/libscg/scsi-osf.c b/scsilib/libscg/scsi-osf.c new file mode 100644 index 0000000..c67be6a --- /dev/null +++ b/scsilib/libscg/scsi-osf.c @@ -0,0 +1,466 @@ +/* @(#)scsi-osf.c 1.26 04/01/15 Copyright 1998 J. Schilling */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-osf.c 1.26 04/01/15 Copyright 1998 J. Schilling"; +#endif +/* + * Interface for Digital UNIX (OSF/1 generic SCSI implementation (/dev/cam). + * + * Created out of the hacks from: + * Stefan Traby <stefan@sime.com> and + * Bruno Achauer <bruno@tk.uni-linz.ac.at> + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1998 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <sys/types.h> +#include <io/common/iotypes.h> +#include <io/cam/cam.h> +#include <io/cam/uagt.h> + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-osf.c-1.26"; /* The version for this transport*/ + +#define MAX_SCG 16 /* Max # of SCSI controllers */ +#define MAX_TGT 16 +#define MAX_LUN 8 + +struct scg_local { + int scgfile; /* Used for ioctl() */ + short scgfiles[MAX_SCG][MAX_TGT][MAX_LUN]; +}; +#define scglocal(p) ((struct scg_local *)((p)->local)) + +LOCAL BOOL scsi_checktgt __PR((SCSI *scgp, int f, int busno, int tgt, int tlun)); + +/* + * I don't have any documentation about CAM + */ +#define MAX_DMA_OSF_CAM (64*1024) + +#ifndef AUTO_SENSE_LEN +# define AUTO_SENSE_LEN 32 /* SCG_MAX_SENSE */ +#endif + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (__sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "CAM", "Generic transport independent SCSI (Common Access Method)", + "", "bus,target,lun", "1,2,0", TRUE, FALSE); + return (0); +} + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + register int b; + register int t; + register int l; + + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno, target or lun '%d,%d,%d'", + busno, tgt, tlun); + return (-1); + } + + if ((device != NULL && *device != '\0') || (busno == -2 && tgt == -2)) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Open by 'devname' not supported on this OS"); + return (-1); + } + + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + scglocal(scgp)->scgfile = -1; + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + scglocal(scgp)->scgfiles[b][t][l] = 0; + } + } + } + + if (scglocal(scgp)->scgfile != -1) /* multiple opens ??? */ + return (1); /* not yet ready .... */ + + if ((scglocal(scgp)->scgfile = open("/dev/cam", O_RDWR, 0)) < 0) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '/dev/cam'"); + return (-1); + } + + if (busno >= 0 && tgt >= 0 && tlun >= 0) { + /* scsi_checktgt() ??? */ + for (l = 0; l < MAX_LUN; l++) + scglocal(scgp)->scgfiles[b][t][l] = 1; + return (1); + } + /* + * There seems to be no clean way to check whether + * a SCSI bus is present in the current system. + * scsi_checktgt() is used as a workaround for this problem. + */ + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + if (scsi_checktgt(scgp, scglocal(scgp)->scgfile, b, t, 0)) { + for (l = 0; l < MAX_LUN; l++) + scglocal(scgp)->scgfiles[b][t][l] = 1; + /* + * Found a target on this bus. + * Comment the 'break' for a complete scan. + */ + break; + } + } + } + return (1); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + if (scgp->local == NULL) + return (-1); + + if (scglocal(scgp)->scgfile >= 0) + close(scglocal(scgp)->scgfile); + scglocal(scgp)->scgfile = -1; + return (0); +} + +/* + * We send a test unit ready command to the target to check whether the + * OS is considering this target to be valid. + * XXX Is this really needed? We should rather let the cmd fail later. + */ +LOCAL BOOL +scsi_checktgt(scgp, f, busno, tgt, tlun) + SCSI *scgp; + int f; + int busno; + int tgt; + int tlun; +{ + struct scg_cmd *sp = scgp->scmd; + struct scg_cmd sc; + int ret; + int ofd = scgp->fd; + int obus = scg_scsibus(scgp); + int otgt = scg_target(scgp); + int olun = scg_lun(scgp); + + scg_settarget(scgp, busno, tgt, tlun); + scgp->fd = f; + + sc = *sp; + fillbytes((caddr_t)sp, sizeof (*sp), '\0'); + sp->addr = (caddr_t)0; + sp->size = 0; + sp->flags = SCG_DISRE_ENA | SCG_SILENT; + sp->cdb_len = SC_G0_CDBLEN; + sp->sense_len = CCS_SENSE_LEN; + sp->cdb.g0_cdb.cmd = SC_TEST_UNIT_READY; + sp->cdb.g0_cdb.lun = scg_lun(scgp); + + scgo_send(scgp); + scg_settarget(scgp, obus, otgt, olun); + scgp->fd = ofd; + + if (sp->error != SCG_FATAL) + return (TRUE); + ret = sp->ux_errno != EINVAL; + *sp = sc; + return (ret); +} + + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + long maxdma = MAX_DMA_OSF_CAM; + + return (maxdma); +} + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_getbuf: %ld bytes\n", amt); + } + scgp->bufbase = valloc((size_t)(amt)); + return (scgp->bufbase); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + register int t; + + if (busno < 0 || busno >= MAX_SCG) + return (FALSE); + + if (scgp->local == NULL) + return (FALSE); + + for (t = 0; t < MAX_TGT; t++) { + if (scglocal(scgp)->scgfiles[busno][t][0] != 0) + return (TRUE); + } + return (FALSE); +} + + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (scgp->local == NULL) + return (-1); + + return ((busno < 0 || busno >= MAX_SCG) ? -1 : scglocal(scgp)->scgfile); +} + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + return (-1); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; +{ + return (FALSE); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + errno = EINVAL; + return (-1); +} + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + CCB_SCSIIO ccb; + UAGT_CAM_CCB ua; + unsigned char *cdb; + CCB_RELSIM relsim; + UAGT_CAM_CCB relua; + int i; + + if (scgp->fd < 0) { + sp->error = SCG_FATAL; + return (0); + } + + fillbytes(&ua, sizeof (UAGT_CAM_CCB), 0); + fillbytes(&ccb, sizeof (CCB_SCSIIO), 0); + + ua.uagt_ccb = (CCB_HEADER *) &ccb; + ua.uagt_ccblen = sizeof (CCB_SCSIIO); + ccb.cam_ch.my_addr = (CCB_HEADER *) &ccb; + ccb.cam_ch.cam_ccb_len = sizeof (CCB_SCSIIO); + + ua.uagt_snsbuf = ccb.cam_sense_ptr = sp->u_sense.cmd_sense; + ua.uagt_snslen = ccb.cam_sense_len = AUTO_SENSE_LEN; + + cdb = (unsigned char *) ccb.cam_cdb_io.cam_cdb_bytes; + + ccb.cam_timeout = sp->timeout; + + ccb.cam_data_ptr = ua.uagt_buffer = (Uchar *) sp->addr; + ccb.cam_dxfer_len = ua.uagt_buflen = sp->size; + ccb.cam_ch.cam_func_code = XPT_SCSI_IO; + ccb.cam_ch.cam_flags = 0; /* CAM_DIS_CALLBACK; */ + + if (sp->size == 0) { + ccb.cam_data_ptr = ua.uagt_buffer = (Uchar *) NULL; + ccb.cam_ch.cam_flags |= CAM_DIR_NONE; + } else { + if (sp->flags & SCG_RECV_DATA) { + ccb.cam_ch.cam_flags |= CAM_DIR_IN; + } else { + ccb.cam_ch.cam_flags |= CAM_DIR_OUT; + } + } + + ccb.cam_cdb_len = sp->cdb_len; + for (i = 0; i < sp->cdb_len; i++) + cdb[i] = sp->cdb.cmd_cdb[i]; + + ccb.cam_ch.cam_path_id = scg_scsibus(scgp); + ccb.cam_ch.cam_target_id = scg_target(scgp); + ccb.cam_ch.cam_target_lun = scg_lun(scgp); + + sp->sense_count = 0; + sp->ux_errno = 0; + sp->error = SCG_NO_ERROR; + + + if (ioctl(scgp->fd, UAGT_CAM_IO, (caddr_t) &ua) < 0) { + sp->ux_errno = geterrno(); + sp->error = SCG_FATAL; + if (scgp->debug > 0) { + errmsg("ioctl(fd, UAGT_CAM_IO, dev=%d,%d,%d) failed.\n", + scg_scsibus(scgp), scg_target(scgp), scg_lun(scgp)); + } + return (0); + } + if (scgp->debug > 0) { + errmsgno(EX_BAD, "cam_status = 0x%.2X scsi_status = 0x%.2X dev=%d,%d,%d\n", + ccb.cam_ch.cam_status, + ccb.cam_scsi_status, + scg_scsibus(scgp), scg_target(scgp), scg_lun(scgp)); + fflush(stderr); + } + switch (ccb.cam_ch.cam_status & CAM_STATUS_MASK) { + + case CAM_REQ_CMP: break; + + case CAM_SEL_TIMEOUT: sp->error = SCG_FATAL; + sp->ux_errno = EIO; + break; + + case CAM_CMD_TIMEOUT: sp->error = SCG_TIMEOUT; + sp->ux_errno = EIO; + break; + + default: sp->error = SCG_RETRYABLE; + sp->ux_errno = EIO; + break; + } + + sp->u_scb.cmd_scb[0] = ccb.cam_scsi_status; + + if (ccb.cam_ch.cam_status & CAM_AUTOSNS_VALID) { + sp->sense_count = MIN(ccb.cam_sense_len - ccb.cam_sense_resid, + SCG_MAX_SENSE); + sp->sense_count = MIN(sp->sense_count, sp->sense_len); + if (sp->sense_len < 0) + sp->sense_count = 0; + } + sp->resid = ccb.cam_resid; + + + /* + * this is perfectly wrong. + * But without this, we hang... + */ + if (ccb.cam_ch.cam_status & CAM_SIM_QFRZN) { + fillbytes(&relsim, sizeof (CCB_RELSIM), 0); + relsim.cam_ch.cam_ccb_len = sizeof (CCB_SCSIIO); + relsim.cam_ch.cam_func_code = XPT_REL_SIMQ; + relsim.cam_ch.cam_flags = CAM_DIR_IN | CAM_DIS_CALLBACK; + relsim.cam_ch.cam_path_id = scg_scsibus(scgp); + relsim.cam_ch.cam_target_id = scg_target(scgp); + relsim.cam_ch.cam_target_lun = scg_lun(scgp); + + relua.uagt_ccb = (struct ccb_header *) & relsim; /* wrong cast */ + relua.uagt_ccblen = sizeof (relsim); + relua.uagt_buffer = NULL; + relua.uagt_buflen = 0; + + if (ioctl(scgp->fd, UAGT_CAM_IO, (caddr_t) & relua) < 0) + errmsg("DEC CAM -> LMA\n"); + } + return (0); +} diff --git a/scsilib/libscg/scsi-qnx.c b/scsilib/libscg/scsi-qnx.c new file mode 100644 index 0000000..8725a07 --- /dev/null +++ b/scsilib/libscg/scsi-qnx.c @@ -0,0 +1,332 @@ +/* @(#)scsi-qnx.c 1.3 04/01/15 Copyright 1998-2003 J. Schilling */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-qnx.c 1.3 04/01/15 Copyright 1998-2003 J. Schilling"; +#endif +/* + * Interface for QNX (Neutrino generic SCSI implementation). + * First version adopted from the OSF-1 version by + * Kevin Chiles <kchiles@qnx.com> + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1998-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <sys/mman.h> +#include <sys/types.h> +#include <sys/dcmd_cam.h> +#include <sys/cam_device.h> + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-qnx.c-1.3"; /* The version for this transport*/ + +#define MAX_SCG 16 /* Max # of SCSI controllers */ +#define MAX_TGT 16 +#define MAX_LUN 8 + +struct scg_local { + int fd; +}; + +#define scglocal(p) ((struct scg_local *)((p)->local)) +#define QNX_CAM_MAX_DMA (32*1024) + +#ifndef AUTO_SENSE_LEN +# define AUTO_SENSE_LEN 32 /* SCG_MAX_SENSE */ +#endif + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return ("Initial Version adopted from OSF-1 by QNX-people"); + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (__sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "CAM", "Generic transport independent SCSI (Common Access Method)", + "", "bus,target,lun", "1,2,0", TRUE, FALSE); + return (0); +} + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int fd; + + if (device == NULL || *device == '\0') { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "'devname' must be specified on this OS"); + return (-1); + } + + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + scglocal(scgp)->fd = -1; + } + + if (scglocal(scgp)->fd != -1) /* multiple open? */ + return (1); + + if ((scglocal(scgp)->fd = open(device, O_RDONLY, 0)) < 0) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '%s'", device); + return (-1); + } + + scg_settarget(scgp, 0, 0, 0); + + return (1); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + if (scgp->local == NULL) + return (-1); + + if (scglocal(scgp)->fd >= 0) + close(scglocal(scgp)->fd); + scglocal(scgp)->fd = -1; + return (0); +} + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + long maxdma = QNX_CAM_MAX_DMA; + + return (maxdma); +} + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + void *addr; + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, "scgo_getbuf: %ld bytes\n", amt); + } + + if ((addr = mmap(NULL, amt, PROT_READ | PROT_WRITE | PROT_NOCACHE, + MAP_ANON | MAP_PHYS | MAP_NOX64K, NOFD, 0)) == MAP_FAILED) { + return (NULL); + } + + scgp->bufbase = addr; + return (addr); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + munmap(scgp->bufbase, QNX_CAM_MAX_DMA); + scgp->bufbase = NULL; +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + return (FALSE); +} + + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (scgp->local == NULL) + return (-1); + + return ((busno < 0 || busno >= MAX_SCG) ? -1 : scglocal(scgp)->fd); +} + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + return (-1); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; +{ + cam_devinfo_t cinfo; + + if (devctl(scgp->fd, DCMD_CAM_DEVINFO, &cinfo, sizeof (cinfo), NULL) != EOK) { + return (TRUE); /* default to ATAPI */ + } + return ((cinfo.flags & DEV_ATAPI) ? TRUE : FALSE); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + errno = EINVAL; + return (-1); +} + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + int i; + struct scg_cmd *sp; + int icnt; + iov_t iov[3]; + CAM_PASS_THRU cpt; + + icnt = 1; + sp = scgp->scmd; + if (scgp->fd < 0) { + sp->error = SCG_FATAL; + return (0); + } + + memset(&cpt, 0, sizeof (cpt)); + + sp->sense_count = 0; + sp->ux_errno = 0; + sp->error = SCG_NO_ERROR; + cpt.cam_timeout = sp->timeout; + cpt.cam_cdb_len = sp->cdb_len; + memcpy(cpt.cam_cdb, sp->cdb.cmd_cdb, sp->cdb_len); + + if (sp->sense_len != -1) { + cpt.cam_sense_len = sp->sense_len; + cpt.cam_sense_ptr = sizeof (cpt); /* XXX Offset from start of struct to data ??? */ + icnt++; + } else { + cpt.cam_flags |= CAM_DIS_AUTOSENSE; + } + + if (cpt.cam_dxfer_len = sp->size) { + icnt++; + cpt.cam_data_ptr = (paddr_t)sizeof (cpt) + cpt.cam_sense_len; + if (sp->flags & SCG_RECV_DATA) { + cpt.cam_flags |= CAM_DIR_IN; + } else { + cpt.cam_flags |= CAM_DIR_OUT; + } + } else { + cpt.cam_flags |= CAM_DIR_NONE; + } + + SETIOV(&iov[0], &cpt, sizeof (cpt)); + SETIOV(&iov[1], sp->u_sense.cmd_sense, cpt.cam_sense_len); + SETIOV(&iov[2], sp->addr, sp->size); + if (devctlv(scglocal(scgp)->fd, DCMD_CAM_PASS_THRU, icnt, icnt, iov, iov, NULL)) { + sp->ux_errno = geterrno(); + sp->error = SCG_FATAL; + if (scgp->debug > 0) { + errmsg("cam_io failed\n"); + } + return (0); + } + + sp->resid = cpt.cam_resid; + sp->u_scb.cmd_scb[0] = cpt.cam_scsi_status; + + switch (cpt.cam_status & CAM_STATUS_MASK) { + case CAM_REQ_CMP: + break; + + case CAM_SEL_TIMEOUT: + sp->error = SCG_FATAL; + sp->ux_errno = EIO; + break; + + case CAM_CMD_TIMEOUT: + sp->error = SCG_TIMEOUT; + sp->ux_errno = EIO; + break; + + default: + sp->error = SCG_RETRYABLE; + sp->ux_errno = EIO; + break; + } + + if (cpt.cam_status & CAM_AUTOSNS_VALID) { + sp->sense_count = min(cpt.cam_sense_len - cpt.cam_sense_resid, + SCG_MAX_SENSE); + sp->sense_count = min(sp->sense_count, sp->sense_len); + if (sp->sense_len < 0) + sp->sense_count = 0; + } + + return (0); +} diff --git a/scsilib/libscg/scsi-sgi.c b/scsilib/libscg/scsi-sgi.c new file mode 100644 index 0000000..4ea78f3 --- /dev/null +++ b/scsilib/libscg/scsi-sgi.c @@ -0,0 +1,498 @@ +/* @(#)scsi-sgi.c 1.36 04/01/15 Copyright 1997 J. Schilling */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-sgi.c 1.36 04/01/15 Copyright 1997 J. Schilling"; +#endif +/* + * Interface for the SGI generic SCSI implementation. + * + * First Hacky implementation + * (needed libds, did not support bus scanning and had no error checking) + * from "Frank van Beek" <frank@neogeo.nl> + * + * Actual implementation supports all scg features. + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1997 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <dslib.h> + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-sgi.c-1.36"; /* The version for this transport*/ + +#ifdef USE_DSLIB + +struct dsreq * dsp = 0; +#define MAX_SCG 1 /* Max # of SCSI controllers */ + +#else + +#define MAX_SCG 16 /* Max # of SCSI controllers */ +#define MAX_TGT 16 +#define MAX_LUN 8 + +struct scg_local { + short scgfiles[MAX_SCG][MAX_TGT][MAX_LUN]; +}; +#define scglocal(p) ((struct scg_local *)((p)->local)) + +#endif + +#define MAX_DMA_SGI (256*1024) /* Check if this is not too big */ + + +#ifndef USE_DSLIB +LOCAL int scg_sendreq __PR((SCSI *scgp, struct scg_cmd *sp, struct dsreq *dsp)); +#endif + + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (__sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "DS", "Generic SCSI", + "", "bus,target,lun", "1,2,0", TRUE, FALSE); + return (0); +} + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + register int f; + register int b; + register int t; + register int l; + register int nopen = 0; + char devname[64]; + + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno, target or lun '%d,%d,%d'", + busno, tgt, tlun); + return (-1); + } + + if ((device != NULL && *device != '\0') || (busno == -2 && tgt == -2)) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Open by 'devname' not supported on this OS"); + return (-1); + } + + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + scglocal(scgp)->scgfiles[b][t][l] = (short)-1; + } + } + } + + if (busno >= 0 && tgt >= 0 && tlun >= 0) { + + js_snprintf(devname, sizeof (devname), + "/dev/scsi/sc%dd%dl%d", busno, tgt, tlun); +#ifdef USE_DSLIB + dsp = dsopen(devname, O_RDWR); + if (dsp == 0) + return (-1); +#else + f = open(devname, O_RDWR); + if (f < 0) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '%s'", + devname); + return (-1); + } + scglocal(scgp)->scgfiles[busno][tgt][tlun] = f; +#endif + return (1); + } else { +#ifdef USE_DSLIB + return (-1); +#else + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { +/* for (l = 0; l < MAX_LUN; l++) {*/ + for (l = 0; l < 1; l++) { + js_snprintf(devname, sizeof (devname), + "/dev/scsi/sc%dd%dl%d", b, t, l); + f = open(devname, O_RDWR); + if (f >= 0) { + scglocal(scgp)->scgfiles[b][t][l] = (short)f; + nopen++; + } + } + } + } +#endif + } + return (nopen); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ +#ifndef USE_DSLIB + register int f; + register int b; + register int t; + register int l; + + if (scgp->local == NULL) + return (-1); + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + f = scglocal(scgp)->scgfiles[b][t][l]; + if (f >= 0) + close(f); + scglocal(scgp)->scgfiles[b][t][l] = (short)-1; + } + } + } +#else + dsclose(dsp); +#endif + return (0); +} + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + return (MAX_DMA_SGI); +} + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_getbuf: %ld bytes\n", amt); + } + scgp->bufbase = valloc((size_t)(amt)); + return (scgp->bufbase); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + register int t; + register int l; + + if (busno < 0 || busno >= MAX_SCG) + return (FALSE); + + if (scgp->local == NULL) + return (FALSE); + + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + if (scglocal(scgp)->scgfiles[busno][t][l] >= 0) + return (TRUE); + } + return (FALSE); +} + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ +#ifdef USE_DSLIB + if (dsp == NULL) + return (-1); + return (getfd(dsp)); +#else + if (busno < 0 || busno >= MAX_SCG || + tgt < 0 || tgt >= MAX_TGT || + tlun < 0 || tlun >= MAX_LUN) + return (-1); + + if (scgp->local == NULL) + return (-1); + + return ((int)scglocal(scgp)->scgfiles[busno][tgt][tlun]); +#endif +} + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + return (-1); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; +{ + return (FALSE); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + /* + * Do we have a SCSI reset on SGI? + */ +#ifdef DS_RESET + if (what == SCG_RESET_NOP) + return (0); + if (what != SCG_RESET_BUS) { + errno = EINVAL; + return (-1); + } + /* + * XXX Does this reset TGT or BUS ??? + */ + return (ioctl(scgp->fd, DS_RESET, 0)); +#else + return (-1); +#endif +} + +#ifndef USE_DSLIB +LOCAL int +scg_sendreq(scgp, sp, dsp) + SCSI *scgp; + struct scg_cmd *sp; + struct dsreq *dsp; +{ + int ret; + int retries = 4; + Uchar status; + +/* if ((sp->flags & SCG_CMD_RETRY) == 0)*/ +/* retries = 0;*/ + + while (--retries > 0) { + ret = ioctl(scgp->fd, DS_ENTER, dsp); + if (ret < 0) { + RET(dsp) = DSRT_DEVSCSI; + return (-1); + } + /* + * SGI implementattion botch!!! + * If a target does not select the bus, + * the return code is DSRT_TIMEOUT + */ + if (RET(dsp) == DSRT_TIMEOUT) { + struct timeval to; + + to.tv_sec = TIME(dsp)/1000; + to.tv_usec = TIME(dsp)%1000; + __scg_times(scgp); + + if (sp->cdb.g0_cdb.cmd == SC_TEST_UNIT_READY && + scgp->cmdstop->tv_sec < to.tv_sec || + (scgp->cmdstop->tv_sec == to.tv_sec && + scgp->cmdstop->tv_usec < to.tv_usec)) { + + RET(dsp) = DSRT_NOSEL; + return (-1); + } + } + if (RET(dsp) == DSRT_NOSEL) + continue; /* retry noselect 3X */ + + status = STATUS(dsp); + switch (status) { + + case 0x08: /* BUSY */ + case 0x18: /* RESERV CONFLICT */ + if (retries > 0) + sleep(2); + continue; + case 0x00: /* GOOD */ + case 0x02: /* CHECK CONDITION */ + case 0x10: /* INTERM/GOOD */ + default: + return (status); + } + } + return (-1); /* failed retry limit */ +} +#endif + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + int ret; + int i; + int amt = sp->cdb_len; + int flags; +#ifndef USE_DSLIB + struct dsreq ds; + struct dsreq *dsp = &ds; + + dsp->ds_iovbuf = 0; + dsp->ds_iovlen = 0; +#endif + + if (scgp->fd < 0) { + sp->error = SCG_FATAL; + return (0); + } + + flags = DSRQ_SENSE; + if (sp->flags & SCG_RECV_DATA) + flags |= DSRQ_READ; + else if (sp->size > 0) + flags |= DSRQ_WRITE; + + dsp->ds_flags = flags; + dsp->ds_link = 0; + dsp->ds_synch = 0; + dsp->ds_ret = 0; + + DATABUF(dsp) = sp->addr; + DATALEN(dsp) = sp->size; + CMDBUF(dsp) = (void *) &sp->cdb; + CMDLEN(dsp) = sp->cdb_len; + SENSEBUF(dsp) = (caddr_t)sp->u_sense.cmd_sense; + SENSELEN(dsp) = sizeof (sp->u_sense.cmd_sense); + TIME(dsp) = (sp->timeout * 1000) + 100; + + errno = 0; + sp->ux_errno = 0; + sp->sense_count = 0; + +#ifdef USE_DSLIB + ret = doscsireq(scgp->fd, dsp); +#else + ret = scg_sendreq(scgp, sp, dsp); +#endif + + if (RET(dsp) != DSRT_DEVSCSI) + ret = 0; + + if (RET(dsp)) { + if (RET(dsp) == DSRT_SHORT) { + sp->resid = DATALEN(dsp)- DATASENT(dsp); + } else if (errno) { + sp->ux_errno = errno; + } else { + sp->ux_errno = EIO; + } + + sp->u_scb.cmd_scb[0] = STATUS(dsp); + + sp->sense_count = SENSESENT(dsp); + if (sp->sense_count > SCG_MAX_SENSE) + sp->sense_count = SCG_MAX_SENSE; + + } + switch (RET(dsp)) { + + default: + sp->error = SCG_RETRYABLE; break; + + case 0: /* OK */ + case DSRT_SHORT: /* not implemented */ + sp->error = SCG_NO_ERROR; break; + + case DSRT_UNIMPL: /* not implemented */ + case DSRT_REVCODE: /* software obsolete must recompile */ + case DSRT_NOSEL: + sp->u_scb.cmd_scb[0] = 0; + sp->error = SCG_FATAL; break; + + case DSRT_TIMEOUT: + sp->u_scb.cmd_scb[0] = 0; + sp->error = SCG_TIMEOUT; break; + } + return (ret); +} diff --git a/scsilib/libscg/scsi-sun.c b/scsilib/libscg/scsi-sun.c new file mode 100644 index 0000000..a114195 --- /dev/null +++ b/scsilib/libscg/scsi-sun.c @@ -0,0 +1,1170 @@ +/* @(#)scsi-sun.c 1.82 04/01/14 Copyright 1988,1995,2000-2004 J. Schilling */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-sun.c 1.82 04/01/14 Copyright 1988,1995,2000-2004 J. Schilling"; +#endif +/* + * SCSI user level command transport routines for + * the SCSI general driver 'scg'. + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1988,1995,2000-2004 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <scg/scgio.h> + +#include <libport.h> /* Needed for gethostid() */ +#ifdef HAVE_SUN_DKIO_H +# include <sun/dkio.h> + +# define dk_cinfo dk_conf +# define dki_slave dkc_slave +# define DKIO_GETCINFO DKIOCGCONF +#endif +#ifdef HAVE_SYS_DKIO_H +# include <sys/dkio.h> + +# define DKIO_GETCINFO DKIOCINFO +#endif + +#define TARGET(slave) ((slave) >> 3) +#define LUN(slave) ((slave) & 07) + +/* + * Tht USCSI ioctl() is not usable on SunOS 4.x + */ +#ifdef __SVR4 +/*#define VOLMGT_DEBUG*/ +#include <volmgt.h> +#include <statdefs.h> +# define USE_USCSI +#endif + +LOCAL char _scg_trans_version[] = "scg-1.82"; /* The version for /dev/scg */ +LOCAL char _scg_utrans_version[] = "uscsi-1.82"; /* The version for USCSI */ + +#ifdef USE_USCSI +LOCAL int scgo_uhelp __PR((SCSI *scgp, FILE *f)); +LOCAL int scgo_uopen __PR((SCSI *scgp, char *device)); +LOCAL int scgo_volopen __PR((SCSI *scgp, char *devname)); +LOCAL int scgo_openmedia __PR((SCSI *scgp, char *mname)); +LOCAL int scgo_uclose __PR((SCSI *scgp)); +LOCAL int scgo_ucinfo __PR((int f, struct dk_cinfo *cp, int debug)); +LOCAL int scgo_ugettlun __PR((int f, int *tgtp, int *lunp)); +LOCAL long scgo_umaxdma __PR((SCSI *scgp, long amt)); +LOCAL int scgo_openide __PR((void)); +LOCAL BOOL scgo_uhavebus __PR((SCSI *scgp, int)); +LOCAL int scgo_ufileno __PR((SCSI *scgp, int, int, int)); +LOCAL int scgo_uinitiator_id __PR((SCSI *scgp)); +LOCAL int scgo_uisatapi __PR((SCSI *scgp)); +LOCAL int scgo_ureset __PR((SCSI *scgp, int what)); +LOCAL int scgo_usend __PR((SCSI *scgp)); + +LOCAL int have_volmgt = -1; + +LOCAL scg_ops_t sun_uscsi_ops = { + scgo_usend, + scgo_version, /* Shared with SCG driver */ + scgo_uhelp, + scgo_uopen, + scgo_uclose, + scgo_umaxdma, + scgo_getbuf, /* Shared with SCG driver */ + scgo_freebuf, /* Shared with SCG driver */ + scgo_uhavebus, + scgo_ufileno, + scgo_uinitiator_id, + scgo_uisatapi, + scgo_ureset, +}; +#endif + +/* + * Need to move this into an scg driver ioctl. + */ +/*#define MAX_DMA_SUN4M (1024*1024)*/ +#define MAX_DMA_SUN4M (124*1024) /* Currently max working size */ +/*#define MAX_DMA_SUN4C (126*1024)*/ +#define MAX_DMA_SUN4C (124*1024) /* Currently max working size */ +#define MAX_DMA_SUN3 (63*1024) +#define MAX_DMA_SUN386 (56*1024) +#define MAX_DMA_OTHER (32*1024) + +#define ARCH_MASK 0xF0 +#define ARCH_SUN2 0x00 +#define ARCH_SUN3 0x10 +#define ARCH_SUN4 0x20 +#define ARCH_SUN386 0x30 +#define ARCH_SUN3X 0x40 +#define ARCH_SUN4C 0x50 +#define ARCH_SUN4E 0x60 +#define ARCH_SUN4M 0x70 +#define ARCH_SUNX 0x80 + +/* + * We are using a "real" /dev/scg? + */ +#define scsi_xsend(scgp) ioctl((scgp)->fd, SCGIO_CMD, (scgp)->scmd) +#define MAX_SCG 16 /* Max # of SCSI controllers */ +#define MAX_TGT 16 +#define MAX_LUN 8 + +struct scg_local { + union { + int SCG_files[MAX_SCG]; +#ifdef USE_USCSI + short scg_files[MAX_SCG][MAX_TGT][MAX_LUN]; +#endif + } u; +}; +#define scglocal(p) ((struct scg_local *)((p)->local)) +#define scgfiles(p) (scglocal(p)->u.SCG_files) + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: +#ifdef USE_USCSI + if (scgp->ops == &sun_uscsi_ops) + return (_scg_utrans_version); +#endif + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (__sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "scg", "Generic transport independent SCSI", + "", "bus,target,lun", "1,2,0", TRUE, FALSE); +#ifdef USE_USCSI + scgo_uhelp(scgp, f); +#endif + return (0); +} + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); +/* int tlun = scg_lun(scgp);*/ + register int f; + register int i; + register int nopen = 0; + char devname[32]; + + if (busno >= MAX_SCG) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno '%d'", busno); + return (-1); + } + + if ((device != NULL && *device != '\0') || (busno == -2 && tgt == -2)) { +#ifdef USE_USCSI + scgp->ops = &sun_uscsi_ops; + return (SCGO_OPEN(scgp, device)); +#else + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Open by 'devname' not supported on this OS"); + return (-1); +#endif + } + + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, "No memory for scg_local"); + return (0); + } + + for (i = 0; i < MAX_SCG; i++) { + scgfiles(scgp)[i] = -1; + } + } + + + for (i = 0; i < MAX_SCG; i++) { + /* + * Skip unneeded devices if not in SCSI Bus scan open mode + */ + if (busno >= 0 && busno != i) + continue; + js_snprintf(devname, sizeof (devname), "/dev/scg%d", i); + f = open(devname, O_RDWR); + if (f < 0) { + if (errno != ENOENT && errno != ENXIO) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Cannot open '%s'", devname); + return (-1); + } + } else { + nopen++; + } + scgfiles(scgp)[i] = f; + } +#ifdef USE_USCSI + if (nopen <= 0) { + if (scgp->local != NULL) { + free(scgp->local); + scgp->local = NULL; + } + scgp->ops = &sun_uscsi_ops; + return (SCGO_OPEN(scgp, device)); + } +#endif + return (nopen); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + register int i; + + if (scgp->local == NULL) + return (-1); + + for (i = 0; i < MAX_SCG; i++) { + if (scgfiles(scgp)[i] >= 0) + close(scgfiles(scgp)[i]); + scgfiles(scgp)[i] = -1; + } + return (0); +} + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + long maxdma = MAX_DMA_OTHER; +#if !defined(__i386_) && !defined(i386) + int cpu_type; +#endif + +#if defined(__i386_) || defined(i386) + maxdma = MAX_DMA_SUN386; +#else + cpu_type = gethostid() >> 24; + + switch (cpu_type & ARCH_MASK) { + + case ARCH_SUN4C: + case ARCH_SUN4E: + maxdma = MAX_DMA_SUN4C; + break; + + case ARCH_SUN4M: + case ARCH_SUNX: + maxdma = MAX_DMA_SUN4M; + break; + + default: + maxdma = MAX_DMA_SUN3; + } +#endif + +#ifndef __SVR4 + /* + * SunOS 4.x allows esp hardware on VME boards and thus + * limits DMA on esp to 64k-1 + */ + if (maxdma > MAX_DMA_SUN3) + maxdma = MAX_DMA_SUN3; +#endif + return (maxdma); +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + if (scgp->local == NULL) + return (FALSE); + + return (busno < 0 || busno >= MAX_SCG) ? FALSE : (scgfiles(scgp)[busno] >= 0); +} + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (scgp->local == NULL) + return (-1); + + return ((busno < 0 || busno >= MAX_SCG) ? -1 : scgfiles(scgp)[busno]); +} + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + int id = -1; +#ifdef DKIO_GETCINFO + struct dk_cinfo conf; +#endif + +#ifdef DKIO_GETCINFO + if (scgp->fd < 0) + return (id); + if (ioctl(scgp->fd, DKIO_GETCINFO, &conf) < 0) + return (id); + if (TARGET(conf.dki_slave) != -1) + id = TARGET(conf.dki_slave); +#endif + return (id); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; +{ + return (FALSE); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + if (what == SCG_RESET_NOP) + return (0); + if (what != SCG_RESET_BUS) { + errno = EINVAL; + return (-1); + } + return (ioctl(scgp->fd, SCGIORESET, 0)); +} + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + scgp->bufbase = (void *)valloc((size_t)amt); + return (scgp->bufbase); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + scgp->scmd->target = scg_target(scgp); + return (ioctl(scgp->fd, SCGIO_CMD, scgp->scmd)); +} + +/*--------------------------------------------------------------------------*/ +/* + * This is Sun USCSI interface code ... + */ +#ifdef USE_USCSI +#include <sys/scsi/impl/uscsi.h> + +/* + * Bit Mask definitions, for use accessing the status as a byte. + */ +#define STATUS_MASK 0x3E +#define STATUS_GOOD 0x00 +#define STATUS_CHECK 0x02 + +#define STATUS_RESERVATION_CONFLICT 0x18 +#define STATUS_TERMINATED 0x22 + +#ifdef nonono +#define STATUS_MASK 0x3E +#define STATUS_GOOD 0x00 +#define STATUS_CHECK 0x02 + +#define STATUS_MET 0x04 +#define STATUS_BUSY 0x08 +#define STATUS_INTERMEDIATE 0x10 +#define STATUS_SCSI2 0x20 +#define STATUS_INTERMEDIATE_MET 0x14 +#define STATUS_RESERVATION_CONFLICT 0x18 +#define STATUS_TERMINATED 0x22 +#define STATUS_QFULL 0x28 +#define STATUS_ACA_ACTIVE 0x30 +#endif + +LOCAL int +scgo_uhelp(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "USCSI", "SCSI transport for targets known by Solaris drivers", + "USCSI:", "bus,target,lun", "USCSI:1,2,0", TRUE, TRUE); + return (0); +} + +LOCAL int +scgo_uopen(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + register int f; + register int b; + register int t; + register int l; + register int nopen = 0; + char devname[32]; + + if (have_volmgt < 0) + have_volmgt = volmgt_running(); + + if (scgp->overbose) { + js_fprintf((FILE *)scgp->errfile, + "Warning: Using USCSI interface.\n"); + } + if (scgp->overbose > 0 && have_volmgt) { + js_fprintf((FILE *)scgp->errfile, + "Warning: Volume management is running, medialess managed drives are invisible.\n"); + } + + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) { + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno, target or lun '%d,%d,%d'", + busno, tgt, tlun); + } + return (-1); + } + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, "No memory for scg_local"); + return (0); + } + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + scglocal(scgp)->u.scg_files[b][t][l] = (short)-1; + } + } + } + + if (device != NULL && strcmp(device, "USCSI") == 0) + goto uscsiscan; + + if ((device != NULL && *device != '\0') || (busno == -2 && tgt == -2)) + goto openbydev; + +uscsiscan: + if (busno >= 0 && tgt >= 0 && tlun >= 0) { + + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) + return (-1); + + js_snprintf(devname, sizeof (devname), "/dev/rdsk/c%dt%dd%ds2", + busno, tgt, tlun); + f = open(devname, O_RDONLY | O_NDELAY); + if (f < 0 && geterrno() == EBUSY) + f = scgo_volopen(scgp, devname); + if (f < 0) { + js_snprintf(scgp->errstr, + SCSI_ERRSTR_SIZE, + "Cannot open '%s'", devname); + return (0); + } + scglocal(scgp)->u.scg_files[busno][tgt][tlun] = f; + return (1); + } else { + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + js_snprintf(devname, sizeof (devname), + "/dev/rdsk/c%dt%dd%ds2", + b, t, l); + f = open(devname, O_RDONLY | O_NDELAY); + if (f < 0 && geterrno() == EBUSY) { + f = scgo_volopen(scgp, devname); + /* + * Hack to mark inaccessible + * drives with fd == -2 + */ + if (f < 0 && + scglocal(scgp)->u.scg_files[b][t][l] < 0) + scglocal(scgp)->u.scg_files[b][t][l] = f; + } + if (f < 0 && errno != ENOENT && + errno != ENXIO && + errno != ENODEV) { + if (scgp->errstr) + js_snprintf(scgp->errstr, + SCSI_ERRSTR_SIZE, + "Cannot open '%s'", devname); + } + if (f < 0 && l == 0) + break; + if (f >= 0) { + nopen ++; + if (scglocal(scgp)->u.scg_files[b][t][l] == -1) + scglocal(scgp)->u.scg_files[b][t][l] = f; + else + close(f); + } + } + } + } + } +openbydev: + if (nopen == 0) { + int target; + int lun; + + if (device != NULL && strncmp(device, "USCSI:", 6) == 0) + device += 6; + if (device == NULL || device[0] == '\0') + return (0); + + f = open(device, O_RDONLY | O_NDELAY); + if (f < 0) + f = scgo_volopen(scgp, device); + if (f < 0) { + js_snprintf(scgp->errstr, + SCSI_ERRSTR_SIZE, + "Cannot open '%s'", device); + return (0); + } + + if (busno < 0) + busno = 0; /* Use Fake number if not specified */ + + if (scgo_ugettlun(f, &target, &lun) >= 0) { + if (tgt >= 0 && tlun >= 0) { + if (tgt != target || tlun != lun) { + close(f); + return (0); + } + } + tgt = target; + tlun = lun; + } else { + if (tgt < 0 || tlun < 0) { + close(f); + return (0); + } + } + + if (scglocal(scgp)->u.scg_files[busno][tgt][tlun] == -1) + scglocal(scgp)->u.scg_files[busno][tgt][tlun] = f; + scg_settarget(scgp, busno, tgt, tlun); + + return (++nopen); + } + return (nopen); +} + +LOCAL int +scgo_volopen(scgp, devname) + SCSI *scgp; + char *devname; +{ + int oerr = geterrno(); + int f = -1; + char *name = NULL; /* Volume symbolic device name */ + char *symdev = NULL; /* /dev/... name based on "name" */ + char *mname = NULL; /* Volume media name based on "name" */ + + if (!have_volmgt) + return (-1); + +#ifdef VOLMGT_DEBUG + scgp->debug++; +#endif + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_volopen(%s)\n", devname); + } + + /* + * We come here because trying to open "devname" did not work. + * First try to translate between a symbolic name and a /dev/... + * based device name. Then translate back to a symbolic name. + */ + symdev = volmgt_symdev(devname); + if (symdev) + name = volmgt_symname(symdev); + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "volmgt_symdev(%s)=%s -> %s\n", devname, symdev, name); + } + + /* + * If "devname" is not a symbolic device name, then it must be + * a /dev/... based device name. Try to translate it into a + * symbolic name. Then translate back to a /dev/... name. + */ + if (name == NULL) { + name = volmgt_symname(devname); + if (name) + symdev = volmgt_symdev(name); + } + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "volmgt_symdev(%s)=%s -> %s\n", devname, symdev, name); + } + + /* + * If we have been able to translate to a symbolic device name, + * translate this name into a volume management media name that + * may be used for opening. + */ + if (name) + mname = media_findname(name); + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "symdev %s name %s mname %s\n", symdev, name, mname); + } + + /* + * Das scheint nur mit dem normierten /dev/rdsk/ *s2 Namen zu gehen. + */ + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "volmgt_inuse(%s) %d\n", symdev, volmgt_inuse(symdev)); + } + if (mname) + f = scgo_openmedia(scgp, mname); + else if (name) + f = -2; /* Mark inaccessible drives with fd == -2 */ + + /* + * Besonderen Fehlertext oder fprintf/errfile bei non-scanbus Open und + * wenn errrno == EBUSY && kein Mapping? + */ + if (name) + free(name); + if (symdev) + free(symdev); + if (mname) + free(mname); + seterrno(oerr); +#ifdef VOLMGT_DEBUG + scgp->debug--; +#endif + return (f); +} + +LOCAL int +scgo_openmedia(scgp, mname) + SCSI *scgp; + char *mname; +{ + int f = -1; + char *device = NULL; + struct stat sb; + + if (mname == NULL) + return (-1); + + /* + * Check whether the media name refers to a directory. + * In this case, the medium is partitioned and we need to + * check all partitions. + */ + if (stat(mname, &sb) >= 0) { + if (S_ISDIR(sb.st_mode)) { + char name[128]; + int i; + + /* + * First check partition '2', the whole disk. + */ + js_snprintf(name, sizeof (name), "%s/s2", mname); + f = open(name, O_RDONLY | O_NDELAY); + if (f >= 0) + return (f); + /* + * Now try all other partitions. + */ + for (i = 0; i < 16; i++) { + if (i == 2) + continue; + js_snprintf(name, sizeof (name), + "%s/s%d", mname, i); + if (stat(name, &sb) >= 0) + break; + } + if (i < 16) { + device = mname; + } + } else { + device = mname; + } + } + if (device) + f = open(device, O_RDONLY | O_NDELAY); + return (f); +} + +LOCAL int +scgo_uclose(scgp) + SCSI *scgp; +{ + register int f; + register int b; + register int t; + register int l; + + if (scgp->local == NULL) + return (-1); + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + f = scglocal(scgp)->u.scg_files[b][t][l]; + if (f >= 0) + close(f); + scglocal(scgp)->u.scg_files[b][t][l] = (short)-1; + } + } + } + return (0); +} + +LOCAL int +scgo_ucinfo(f, cp, debug) + int f; + struct dk_cinfo *cp; + int debug; +{ + fillbytes(cp, sizeof (*cp), '\0'); + + if (ioctl(f, DKIOCINFO, cp) < 0) + return (-1); + + if (debug <= 0) + return (0); + + js_fprintf(stderr, "cname: '%s'\n", cp->dki_cname); + js_fprintf(stderr, "ctype: 0x%04hX %hd\n", cp->dki_ctype, cp->dki_ctype); + js_fprintf(stderr, "cflags: 0x%04hX\n", cp->dki_flags); + js_fprintf(stderr, "cnum: %hd\n", cp->dki_cnum); +#ifdef __EVER__ + js_fprintf(stderr, "addr: %d\n", cp->dki_addr); + js_fprintf(stderr, "space: %d\n", cp->dki_space); + js_fprintf(stderr, "prio: %d\n", cp->dki_prio); + js_fprintf(stderr, "vec: %d\n", cp->dki_vec); +#endif + js_fprintf(stderr, "dname: '%s'\n", cp->dki_dname); + js_fprintf(stderr, "unit: %d\n", cp->dki_unit); + js_fprintf(stderr, "slave: %d %04o Tgt: %d Lun: %d\n", + cp->dki_slave, cp->dki_slave, + TARGET(cp->dki_slave), LUN(cp->dki_slave)); + js_fprintf(stderr, "partition: %hd\n", cp->dki_partition); + js_fprintf(stderr, "maxtransfer: %d (%d)\n", + cp->dki_maxtransfer, + cp->dki_maxtransfer * DEV_BSIZE); + return (0); +} + +LOCAL int +scgo_ugettlun(f, tgtp, lunp) + int f; + int *tgtp; + int *lunp; +{ + struct dk_cinfo ci; + + if (scgo_ucinfo(f, &ci, 0) < 0) + return (-1); + if (tgtp) + *tgtp = TARGET(ci.dki_slave); + if (lunp) + *lunp = LUN(ci.dki_slave); + return (0); +} + +LOCAL long +scgo_umaxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + register int b; + register int t; + register int l; + long maxdma = -1L; + int f; + struct dk_cinfo ci; + BOOL found_ide = FALSE; + + if (scgp->local == NULL) + return (-1L); + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + if ((f = scglocal(scgp)->u.scg_files[b][t][l]) < 0) + continue; + if (scgo_ucinfo(f, &ci, scgp->debug) < 0) + continue; + if (maxdma < 0) + maxdma = (long)(ci.dki_maxtransfer * DEV_BSIZE); + if (maxdma > (long)(ci.dki_maxtransfer * DEV_BSIZE)) + maxdma = (long)(ci.dki_maxtransfer * DEV_BSIZE); + if (streql(ci.dki_cname, "ide")) + found_ide = TRUE; + } + } + } + +#if defined(__i386_) || defined(i386) + /* + * At least on Solaris 9 x86, DKIOCINFO returns a wrong value + * for dki_maxtransfer if the target is an ATAPI drive. + * Without DMA, it seems to work if we use 256 kB DMA size for ATAPI, + * but if we allow DMA, only 68 kB will work (for more we get a silent + * DMA residual count == DMA transfer count). + * For this reason, we try to figure out the correct value for 'ide' + * by retrieving the (correct) value from a ide hard disk. + */ + if (found_ide) { + if ((f = scgo_openide()) >= 0) { +#ifdef sould_we + long omaxdma = maxdma; +#endif + + if (scgo_ucinfo(f, &ci, scgp->debug) >= 0) { + if (maxdma < 0) + maxdma = (long)(ci.dki_maxtransfer * DEV_BSIZE); + if (maxdma > (long)(ci.dki_maxtransfer * DEV_BSIZE)) + maxdma = (long)(ci.dki_maxtransfer * DEV_BSIZE); + } + close(f); +#ifdef sould_we + /* + * The kernel returns 56 kB but we tested that 68 kB works. + */ + if (omaxdma > maxdma && maxdma == (112 * DEV_BSIZE)) + maxdma = 136 * DEV_BSIZE; +#endif + } else { + /* + * No IDE disk on this system? + */ + if (maxdma == (512 * DEV_BSIZE)) + maxdma = MAX_DMA_SUN386; + } + } +#endif + /* + * The Sun tape driver does not support to retrieve the max DMA count. + * Use the knwoledge about default DMA sizes in this case. + */ + if (maxdma < 0) + maxdma = scgo_maxdma(scgp, amt); + + return (maxdma); +} + +#if defined(__i386_) || defined(i386) +LOCAL int +scgo_openide() +{ + char buf[20]; + int b; + int t; + int f = -1; + + for (b = 0; b < 5; b++) { + for (t = 0; t < 2; t++) { + js_snprintf(buf, sizeof (buf), + "/dev/rdsk/c%dd%dp0", b, t); + if ((f = open(buf, O_RDONLY | O_NDELAY)) >= 0) + goto out; + } + } +out: + return (f); +} +#endif + +LOCAL BOOL +scgo_uhavebus(scgp, busno) + SCSI *scgp; + int busno; +{ + register int t; + register int l; + + if (scgp->local == NULL || busno < 0 || busno >= MAX_SCG) + return (FALSE); + + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + if (scglocal(scgp)->u.scg_files[busno][t][l] >= 0) + return (TRUE); + } + return (FALSE); +} + +LOCAL int +scgo_ufileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (scgp->local == NULL || + busno < 0 || busno >= MAX_SCG || + tgt < 0 || tgt >= MAX_TGT || + tlun < 0 || tlun >= MAX_LUN) + return (-1); + + return ((int)scglocal(scgp)->u.scg_files[busno][tgt][tlun]); +} + +LOCAL int +scgo_uinitiator_id(scgp) + SCSI *scgp; +{ + return (-1); +} + +LOCAL int +scgo_uisatapi(scgp) + SCSI *scgp; +{ + char devname[32]; + char symlinkname[MAXPATHLEN]; + int len; + struct dk_cinfo ci; + + if (ioctl(scgp->fd, DKIOCINFO, &ci) < 0) + return (-1); + + js_snprintf(devname, sizeof (devname), "/dev/rdsk/c%dt%dd%ds2", + scg_scsibus(scgp), scg_target(scgp), scg_lun(scgp)); + + symlinkname[0] = '\0'; + len = readlink(devname, symlinkname, sizeof (symlinkname)); + if (len > 0) + symlinkname[len] = '\0'; + + if (len >= 0 && strstr(symlinkname, "ide") != NULL) + return (TRUE); + else + return (FALSE); +} + +LOCAL int +scgo_ureset(scgp, what) + SCSI *scgp; + int what; +{ + struct uscsi_cmd req; + + if (what == SCG_RESET_NOP) + return (0); + + fillbytes(&req, sizeof (req), '\0'); + + if (what == SCG_RESET_TGT) { + req.uscsi_flags = USCSI_RESET | USCSI_SILENT; /* reset target */ + } else if (what != SCG_RESET_BUS) { + req.uscsi_flags = USCSI_RESET_ALL | USCSI_SILENT; /* reset bus */ + } else { + errno = EINVAL; + return (-1); + } + + return (ioctl(scgp->fd, USCSICMD, &req)); +} + +LOCAL int +scgo_usend(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + struct uscsi_cmd req; + int ret; +static uid_t cureuid = 0; /* XXX Hack until we have uid management */ + + if (scgp->fd < 0) { + sp->error = SCG_FATAL; + return (0); + } + + fillbytes(&req, sizeof (req), '\0'); + + req.uscsi_flags = USCSI_SILENT | USCSI_DIAGNOSE | USCSI_RQENABLE; + + if (sp->flags & SCG_RECV_DATA) { + req.uscsi_flags |= USCSI_READ; + } else if (sp->size > 0) { + req.uscsi_flags |= USCSI_WRITE; + } + req.uscsi_buflen = sp->size; + req.uscsi_bufaddr = sp->addr; + req.uscsi_timeout = sp->timeout; + req.uscsi_cdblen = sp->cdb_len; + req.uscsi_rqbuf = (caddr_t) sp->u_sense.cmd_sense; + req.uscsi_rqlen = sp->sense_len; + req.uscsi_cdb = (caddr_t) &sp->cdb; + + if (cureuid != 0) + seteuid(0); +again: + errno = 0; + ret = ioctl(scgp->fd, USCSICMD, &req); + + if (ret < 0 && geterrno() == EPERM) { /* XXX Hack until we have uid management */ + cureuid = geteuid(); + if (seteuid(0) >= 0) + goto again; + } + if (cureuid != 0) + seteuid(cureuid); + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, "ret: %d errno: %d (%s)\n", ret, errno, errmsgstr(errno)); + js_fprintf((FILE *)scgp->errfile, "uscsi_flags: 0x%x\n", req.uscsi_flags); + js_fprintf((FILE *)scgp->errfile, "uscsi_status: 0x%x\n", req.uscsi_status); + js_fprintf((FILE *)scgp->errfile, "uscsi_timeout: %d\n", req.uscsi_timeout); + js_fprintf((FILE *)scgp->errfile, "uscsi_bufaddr: 0x%lx\n", (long)req.uscsi_bufaddr); + /* + * Cast auf int OK solange sp->size + * auch ein int bleibt. + */ + js_fprintf((FILE *)scgp->errfile, "uscsi_buflen: %d\n", (int)req.uscsi_buflen); + js_fprintf((FILE *)scgp->errfile, "uscsi_resid: %d\n", (int)req.uscsi_resid); + js_fprintf((FILE *)scgp->errfile, "uscsi_rqlen: %d\n", req.uscsi_rqlen); + js_fprintf((FILE *)scgp->errfile, "uscsi_rqstatus: 0x%x\n", req.uscsi_rqstatus); + js_fprintf((FILE *)scgp->errfile, "uscsi_rqresid: %d\n", req.uscsi_rqresid); + js_fprintf((FILE *)scgp->errfile, "uscsi_rqbuf ptr: 0x%lx\n", (long)req.uscsi_rqbuf); + js_fprintf((FILE *)scgp->errfile, "uscsi_rqbuf: "); + if (req.uscsi_rqbuf != NULL && req.uscsi_rqlen > req.uscsi_rqresid) { + int i; + int len = req.uscsi_rqlen - req.uscsi_rqresid; + + for (i = 0; i < len; i++) { + js_fprintf((FILE *)scgp->errfile, "0x%02X ", ((char *)req.uscsi_rqbuf)[i]); + } + js_fprintf((FILE *)scgp->errfile, "\n"); + } else { + js_fprintf((FILE *)scgp->errfile, "<data not available>\n"); + } + } + if (ret < 0) { + sp->ux_errno = geterrno(); + /* + * Check if SCSI command cound not be send at all. + */ + if (sp->ux_errno == ENOTTY && scgo_uisatapi(scgp) == TRUE) { + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "ENOTTY atapi: %d\n", scgo_uisatapi(scgp)); + } + sp->error = SCG_FATAL; + return (0); + } + if (errno == ENXIO) { + sp->error = SCG_FATAL; + return (0); + } + if (errno == ENOTTY || errno == EINVAL || errno == EACCES) { + return (-1); + } + } else { + sp->ux_errno = 0; + } + ret = 0; + sp->sense_count = req.uscsi_rqlen - req.uscsi_rqresid; + sp->resid = req.uscsi_resid; + sp->u_scb.cmd_scb[0] = req.uscsi_status; + + if ((req.uscsi_status & STATUS_MASK) == STATUS_GOOD) { + sp->error = SCG_NO_ERROR; + return (0); + } + if (req.uscsi_rqstatus == 0 && + ((req.uscsi_status & STATUS_MASK) == STATUS_CHECK)) { + sp->error = SCG_NO_ERROR; + return (0); + } + if (req.uscsi_status & (STATUS_TERMINATED | + STATUS_RESERVATION_CONFLICT)) { + sp->error = SCG_FATAL; + } + if (req.uscsi_status != 0) { + /* + * This is most likely wrong. There seems to be no way + * to produce SCG_RETRYABLE with USCSI. + */ + sp->error = SCG_RETRYABLE; + } + + return (ret); +} +#endif /* USE_USCSI */ diff --git a/scsilib/libscg/scsi-unixware.c b/scsilib/libscg/scsi-unixware.c new file mode 100644 index 0000000..888b6a9 --- /dev/null +++ b/scsilib/libscg/scsi-unixware.c @@ -0,0 +1,946 @@ +/* @(#)scsi-unixware.c 1.36 04/01/15 Copyright 1998 J. Schilling, Santa Cruz Operation */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-unixware.c 1.36 04/01/15 Copyright 1998 J. Schilling, Santa Cruz Operation"; +#endif +/* + * Interface for the SCO UnixWare SCSI implementation. + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1998 J. Schilling, Santa Cruz Operation + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#undef sense +#undef SC_PARITY +#undef scb + +#include <sys/sysmacros.h> /* XXX Falsch, richtig -> sys/mkdev.h */ +#include <sys/scsi.h> +#include <sys/sdi_edt.h> +#include <sys/sdi.h> + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-unixware.c-1.36"; /* The version for this transport*/ + +/* Max. number of scg scsibusses. The real limit would be */ +/* MAX_HBA * MAX_BUS (which would be 32 * 8 on UnixWare 2.1/7.x), */ +/* but given that we will hardly see such a beast, lets take 32 */ + +#define MAX_SCG 32 + + /* maximum defines for UnixWare 2.x/7.x from <sys/sdi_edt.h> */ + +#define MAX_TGT MAX_EXTCS /* Max # of target id's */ +#define MAX_LUN MAX_EXLUS /* Max # of lun's */ + +#define MAX_DMA (32*1024) +#ifdef __WHAT_TODO__ +#define MAX_DMA (16*1024) /* On UnixWare 2.1.x w/ AHA2940 HBA */ + /* the max DMA size is 16KB. */ +#endif + +#define MAXLINE 80 +#define MAXPATH 256 + +#define DEV_DIR "/tmp" +#define DEV_NAME "scg.s%1dt%1dl%1d" + +#define SCAN_HBA "%d:%d,%d,%d:%7s : %n" +#define SCAN_DEV "%d,%d,%d:%7s : %n" + +#define PRIM_HBA "/dev/hba/hba1" +#define SCSI_CFG "LC_ALL=C /etc/scsi/pdiconfig -l" + +#define SCAN_ALL "LIBSCG_SCAN_ALL" + +#define SDI_VALID 0x01 /* Entry may be used (non disk) */ +#define SDI_ATAPI 0x02 /* Connected via IDE HBA */ +#define SDI_INITIATOR 0x04 /* This is the initiator target ID */ + +typedef struct scg2sdi { + short open; + short flags; + short fd; + char hba; + char bus; + char tgt; + char lun; + + dev_t node; + dev_t major; + dev_t minor; +/*#define SCG_DEBUG*/ +#ifdef SCG_DEBUG + char type[20]; + char vend[40]; + char devn[32]; +#endif +} scg2sdi_t; + +LOCAL scg2sdi_t sdidevs [MAX_SCG][MAX_TGT][MAX_LUN]; +LOCAL BOOL sdiinit = FALSE; + +struct scg_local { + short scgfiles[MAX_SCG][MAX_TGT][MAX_LUN]; +}; +#define scglocal(p) ((struct scg_local *)((p)->local)) + +LOCAL int unixware_init __PR((SCSI *scgp)); +LOCAL int do_scg_cmd __PR((SCSI *scgp, struct scg_cmd *sp)); +LOCAL int do_scg_sense __PR((SCSI *scgp, struct scg_cmd *sp)); +LOCAL FILE *xpopen __PR((char *cmd, char *type)); +LOCAL int xpclose __PR((FILE *f)); + +/* + * ------------------------------------------------------------------------- + * SCO UnixWare 2.1.x / UnixWare 7 provides a scsi pass-through mechanism, + * which can be used to access any configured scsi device. + * + * NOTE: The libscg UnixWare passthrough routines have changed with + * cdrecord-1.8 to enable the -scanbus, -load, -eject option + * regardless of the status of media and the addressing + * scheme is now the same as used on many other platforms like + * Solaris, Linux etc. + * + * =============================================================== + * RUN 'cdrecord -scanbus' TO SEE THE DEVICE ADDRESSES YOU CAN USE + * =============================================================== + */ + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + * + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (__sccsid); + } + } + return ((char *)0); +} + + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "SDI_SEND", "Generic SCSI", + "", "bus,target,lun", "1,2,0", TRUE, FALSE); + return (0); +} + +/* + * --------------------------------------------------------------- + * This routine is introduced to create all device nodes necessary + * to access any detected scsi device. It parses the output of + * /etc/scsi/pdiconfig -l and creates passthru device node for each + * found scsi device apart from the listed hba's. + * + */ + +LOCAL int +unixware_init(scgp) + SCSI *scgp; +{ + FILE *cmd; + int hba = 0, bus = 0, scg = 0, tgt = 0, lun = 0; + int nscg = -1, lhba = -1, lbus = 0; + int atapi, fd, nopen = 0, pos = 0, len = 0; + int s, t, l; + int scan_disks; + char lines[MAXLINE]; + char class[MAXLINE]; + char ident[MAXLINE]; + char devnm[MAXPATH]; + char dname[MAXPATH]; + struct stat stbuf; + dev_t ptdev, major, minor, node; + char **evsave; +extern char **environ; + + /* Check for validity of primary hostbus adapter node */ + + if (stat(PRIM_HBA, &stbuf) < 0) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Can not stat() primary hba (%s)", + PRIM_HBA); + return (-1); + } + + if (!S_ISCHR(stbuf.st_mode)) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Primary hba (%s) not a character device", + PRIM_HBA); + return (-1); + } + + major = getmajor(stbuf.st_rdev); + + /* + * Check whether we want to scan all devices + */ + if (getenv(SCAN_ALL) != NULL) { + scan_disks = 1; + } else { + scan_disks = 0; + } + + /* read pdiconfig output and get all attached scsi devices ! */ + + evsave = environ; + environ = 0; + if ((cmd = xpopen(SCSI_CFG, "r")) == NULL) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Error popen() for \"%s\"", + SCSI_CFG); + environ = evsave; + return (-1); + } + environ = evsave; + + + for (;;) { + if (fgets(lines, MAXLINE, cmd) == NULL) + break; + + memset(class, '\0', sizeof (class)); + memset(ident, '\0', sizeof (ident)); + + if (lines[0] == ' ') { + sscanf(lines, SCAN_DEV, &bus, &tgt, &lun, class, &pos); + hba = lhba; + } else { + sscanf(lines, SCAN_HBA, &hba, &bus, &tgt, &lun, class, &pos); + nscg++; + lhba = hba; + atapi = 0; + } + + /* We can't sscanf() the ident string of the device */ + /* as it may contain characters sscanf() will */ + /* recognize as a delimiter. So do a strcpy() instead ! */ + + len = strlen(lines) - pos - 1; /* don't copy the '\n' */ + + strncpy(ident, &lines[pos], len); + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "SDI -> %d:%d,%d,%d: %-7s : %s\n", + hba, bus, tgt, lun, class, ident); + } + if (bus != lbus) { + nscg++; + lbus = bus; + } + + scg = nscg; + + /* check whether we have a HBA or a SCSI device, don't */ + /* let HBA's be valid device for cdrecord, but mark */ + /* them as a controller (initiator = 1). */ + + /* Don't detect disks, opening a mounted disk can hang */ + /* the disk subsystem !!! So unless we set an */ + /* environment variable LIBSCG_SCAN_ALL, we will ignore */ + /* disks */ + + if (strstr(class, "HBA") == NULL) { + if (strstr(class, "DISK") != NULL) { + if (scan_disks) + sdidevs[scg][tgt][lun].flags |= SDI_VALID; + else + sdidevs[scg][tgt][lun].flags &= ~SDI_VALID; + } else { + sdidevs[scg][tgt][lun].flags |= SDI_VALID; + } + } else { + sdidevs[scg][tgt][lun].flags |= SDI_INITIATOR; + } + + + /* There is no real flag that shows a HBA as an ATAPI */ + /* controller, so as we know the driver is called 'ide' */ + /* we can check the ident string for the occurence of it*/ + + if (strstr(ident, "(ide,") != NULL) { + atapi = 1; + } + + /* + * Fill the sdidevs array with all we know now. + * Do not overwrite fields that may contain old state like + * sdidevs[scg][tgt][lun].open + */ + + if (atapi) + sdidevs[scg][tgt][lun].flags |= SDI_ATAPI; + else + sdidevs[scg][tgt][lun].flags &= ~SDI_ATAPI; + + sdidevs[scg][tgt][lun].hba = hba; + sdidevs[scg][tgt][lun].bus = bus; + sdidevs[scg][tgt][lun].tgt = tgt; + sdidevs[scg][tgt][lun].lun = lun; + +#ifdef SCG_DEBUG + strcpy(sdidevs[scg][tgt][lun].type, class); + strcpy(sdidevs[scg][tgt][lun].vend, ident); + + js_snprintf(sdidevs[scg][tgt][lun].devn, + sizeof (sdidevs[scg][tgt][lun].devn), + DEV_NAME, scg, tgt, lun); +#endif + js_snprintf(devnm, sizeof (devnm), + DEV_NAME, scg, tgt, lun); + + minor = SDI_MINOR(hba, tgt, lun, bus); + node = makedevice(major, minor); + + sdidevs[scg][tgt][lun].major = major; + sdidevs[scg][tgt][lun].minor = minor; + sdidevs[scg][tgt][lun].node = node; + + if (scgp->debug > 0) { + + js_fprintf((FILE *)scgp->errfile, + "h = %d; b = %d, s = %d, t = %d, l = %d, a = %d, ma = %d, mi = %2d, dev = '%s', id = '%s'\n", + hba, bus, scg, tgt, lun, + (sdidevs[scg][tgt][lun].flags & SDI_ATAPI) != 0, + sdidevs[scg][tgt][lun].major, + sdidevs[scg][tgt][lun].minor, + devnm, + ident); + } + + + } + + if (xpclose(cmd) == -1) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Error pclose() for \"%s\"", + SCSI_CFG); + return (-1); + } + + + /* create all temporary device nodes */ + + for (s = 0; s < MAX_SCG; s++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + + if ((sdidevs[s][t][l].flags & SDI_VALID) == 0) { + if (sdidevs[s][t][l].fd >= 0) { + close(sdidevs[s][t][l].fd); + } + sdidevs[s][t][l].fd = -1; + sdidevs[s][t][l].open = 0; + continue; + } + + /* Make pass-through interface device node */ + + js_snprintf(devnm, + sizeof (devnm), + DEV_NAME, s, t, l); + + js_snprintf(dname, sizeof (dname), + "%s/%s", DEV_DIR, devnm); + + ptdev = sdidevs[s][t][l].node; + + if (mknod(dname, S_IFCHR | 0700, ptdev) < 0) { + if (errno == EEXIST) { + unlink(dname); + + if (mknod(dname, S_IFCHR | 0700, ptdev) < 0) { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "mknod() error for \"%s\"", dname); + return (-1); + } + } else { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "mknod() error for \"%s\"", dname); + return (-1); + } + } + + /* Open pass-through device node */ + + if ((fd = open(dname, O_RDONLY)) < 0) { + if (errno == EBUSY && sdidevs[s][t][l].open > 0) { + /* + * Device has already been opened, just + * return the saved file desc. + */ + fd = sdidevs[s][t][l].fd; + } else { + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "can not open pass-through %s", dname); + return (-1); + } + } + + /* + * If for whatever reason we may open a pass through + * device more than once, this will waste fs's as we + * do not check for sdidevs[s][t][l].fd == -1. + */ + sdidevs[s][t][l].fd = fd; + sdidevs[s][t][l].open++; + nopen++; + scglocal(scgp)->scgfiles[s][t][l] = (short) fd; + + if (scgp->debug > 0) { + + js_fprintf((FILE *)scgp->errfile, + "s = %d, t = %d, l = %d, dev = %s, fd = %d\n", + s, t, l, + devnm, + sdidevs[s][t][l].fd); + } + + } + } + } + + return (nopen); +} + + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + int b, t, l; + + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno, target or lun '%d,%d,%d'", + busno, tgt, tlun); + return (-1); + } + + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + scglocal(scgp)->scgfiles[b][t][l] = (short)-1; + } + } + } + + if (!sdiinit) { + sdiinit = TRUE; + memset(sdidevs, 0, sizeof (sdidevs)); /* init tmp_structure */ + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + + sdidevs[b][t][l].flags = 0; + sdidevs[b][t][l].fd = -1; + sdidevs[b][t][l].open = 0; + } + } + } + } + + if (*device != '\0') { /* we don't allow old dev usage */ + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Open by 'devname' no longer supported on this OS"); + return (-1); + } else { /* this is the new stuff */ + /* it will do the initialisation */ + /* and return the number of */ + /* detected devices to be used */ + /* with the new addressing */ + /* scheme. */ + + return (unixware_init(scgp)); + } + +} + + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + register int f; + register int b; + register int t; + register int l; + + if (scgp->local == NULL) + return (-1); + + for (b = 0; b < MAX_SCG; b++) { + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) { + + f = scglocal(scgp)->scgfiles[b][t][l]; + if (f >= 0) { + if (sdidevs[b][t][l].open > 0) + sdidevs[b][t][l].open--; + if (sdidevs[b][t][l].open <= 0) { + if (sdidevs[b][t][l].fd >= 0) + close(sdidevs[b][t][l].fd); + sdidevs[b][t][l].fd = -1; + sdidevs[b][t][l].flags &= ~SDI_VALID; + } + } + scglocal(scgp)->scgfiles[b][t][l] = (short)-1; + } + } + } + return (0); +} + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + return (MAX_DMA); +} + + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_getbuf: %ld bytes\n", amt); + } + scgp->bufbase = (void *) valloc((size_t)(amt)); + + return (scgp->bufbase); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + register int t; + register int l; + + if (busno < 0 || busno >= MAX_SCG) + return (FALSE); + + if (scgp->local == NULL) + return (FALSE); + + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + if (scglocal(scgp)->scgfiles[busno][t][l] >= 0) + return (TRUE); + } + return (FALSE); +} + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (busno < 0 || busno >= MAX_SCG || + tgt < 0 || tgt >= MAX_TGT || + tlun < 0 || tlun >= MAX_LUN) + return (-1); + + if (scgp->local == NULL) + return (-1); + + return ((int)scglocal(scgp)->scgfiles[busno][tgt][tlun]); +} + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + register int t; + register int l; + register int busno; + + busno = scg_scsibus(scgp); + + if (busno < 0 || busno >= MAX_SCG) + return (FALSE); + + for (t = 0; t < MAX_TGT; t++) { + for (l = 0; l < MAX_LUN; l++) + if ((sdidevs[busno][t][l].flags & SDI_INITIATOR) != 0) { + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_initiator_id: id = %d\n", t); + } + return (t); + } + } + + return (-1); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; +{ + /* if the new address method is used we know if this is ATAPI */ + + return ((sdidevs[scg_scsibus(scgp)][scg_target(scgp)][scg_lun(scgp)].flags & SDI_ATAPI) != 0); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + int f = scgp->fd; + + errno = EINVAL; + +#if defined(SDI_TRESET) || defined(SDI_BRESET) + if (what == SCG_RESET_NOP) { + errno = 0; + return (0); + } + +#ifdef SDI_TRESET + if (what == SCG_RESET_TGT) { + errno = 0; + if (ioctl(f, SDI_TRESET, 0) >= 0) + return (0); + } +#endif + +#ifdef SDI_BRESET + if (what == SCG_RESET_BUS) { + errno = 0; + if (ioctl(f, SDI_BRESET, 0) >= 0) + return (0); + } +#endif + +#endif /* defined(SDI_TRESET) || defined(SDI_BRESET) */ + + return (-1); +} + +LOCAL int +do_scg_cmd(scgp, sp) + SCSI *scgp; + struct scg_cmd *sp; +{ + int ret; + int i; + struct sb scsi_cmd; + struct scb *scbp; + + memset(&scsi_cmd, 0, sizeof (scsi_cmd)); + + scsi_cmd.sb_type = ISCB_TYPE; + scbp = &scsi_cmd.SCB; + + scbp->sc_cmdpt = (caddr_t) sp->cdb.cmd_cdb; + scbp->sc_cmdsz = sp->cdb_len; + + scbp->sc_datapt = sp->addr; + scbp->sc_datasz = sp->size; + + if (!(sp->flags & SCG_RECV_DATA) && (sp->size > 0)) + scbp->sc_mode = SCB_WRITE; + else + scbp->sc_mode = SCB_READ; + + scbp->sc_time = sp->timeout; + + sp->error = SCG_NO_ERROR; + errno = 0; + for (;;) { + if ((ret = ioctl(scgp->fd, SDI_SEND, &scsi_cmd)) < 0) { + if (errno == EAGAIN) { + sleep(1); + errno = 0; + continue; + } + sp->ux_errno = errno; + if (errno == 0) + sp->ux_errno = EIO; + sp->error = SCG_RETRYABLE; + +#ifdef __needed__ + if (errno == ENOTTY || errno == EINVAL || + errno == EACCES) { + return (-1); + } +#endif + return (ret); + } + break; + } + sp->ux_errno = errno; + sp->resid = scbp->sc_resid; + memset(&sp->u_scb.Scb, 0, sizeof (sp->u_scb.Scb)); + sp->u_scb.cmd_scb[0] = scbp->sc_status; + + if (sp->u_scb.cmd_scb[0] & 0x02) { + if (sp->ux_errno == 0) + sp->ux_errno = EIO; + } + + switch (scbp->sc_comp_code) { + + case SDI_ASW : /* Job completed normally */ + case SDI_LINKF0 : /* Linked command done without flag */ + case SDI_LINKF1 : /* Linked command done with flag */ + + sp->error = SCG_NO_ERROR; + break; + + case SDI_CKSTAT : /* Check the status byte */ + + sp->error = SCG_NO_ERROR; + break; + + case SDI_NOALLOC : /* This block is not allocated */ + case SDI_NOTEQ : /* Addressed device not present */ + case SDI_OOS : /* Device is out of service */ + case SDI_NOSELE : /* The SCSI bus select failed */ + case SDI_SBRESC : /* SCSI bus reservation conflict */ + + sp->error = SCG_FATAL; + if (sp->ux_errno == 0) + sp->ux_errno = EIO; + break; + + case SDI_QFLUSH : /* Job was flushed */ + case SDI_ABORT : /* Command was aborted */ + case SDI_RESET : /* Reset was detected on the bus */ + case SDI_CRESET : /* Reset was caused by this unit */ + case SDI_V2PERR : /* vtop failed */ + case SDI_HAERR : /* Host adapter error */ + case SDI_MEMERR : /* Memory fault */ + case SDI_SBUSER : /* SCSI bus error */ + case SDI_SCBERR : /* SCB error */ + case SDI_MISMAT : /* parameter mismatch */ + + case SDI_PROGRES : /* Job in progress */ + case SDI_UNUSED : /* Job not in use */ + + case SDI_ONEIC : /* More than one immediate request */ + case SDI_SFBERR : /* SFB error */ + case SDI_TCERR : /* Target protocol error detected */ + default: + sp->error = SCG_RETRYABLE; + if (sp->ux_errno == 0) + sp->ux_errno = EIO; + break; + + case SDI_TIME : /* Job timed out */ + case SDI_TIME_NOABORT : /* Job timed out, but could not be aborted */ + + sp->error = SCG_TIMEOUT; + if (sp->ux_errno == 0) + sp->ux_errno = EIO; + break; + } + return (0); +} + + +LOCAL int +do_scg_sense(scgp, sp) + SCSI *scgp; + struct scg_cmd *sp; +{ + int ret; + struct scg_cmd s_cmd; + + memset((caddr_t)&s_cmd, 0, sizeof (s_cmd)); + + s_cmd.addr = (caddr_t) sp->u_sense.cmd_sense; + s_cmd.size = sp->sense_len; + s_cmd.flags = SCG_RECV_DATA|SCG_DISRE_ENA; + s_cmd.cdb_len = SC_G0_CDBLEN; + s_cmd.sense_len = CCS_SENSE_LEN; + + s_cmd.cdb.g0_cdb.cmd = SC_REQUEST_SENSE; + s_cmd.cdb.g0_cdb.lun = sp->cdb.g0_cdb.lun; + s_cmd.cdb.g0_cdb.count = sp->sense_len; + + ret = do_scg_cmd(scgp, &s_cmd); + + if (ret < 0) + return (ret); + + sp->sense_count = sp->sense_len - s_cmd.resid; + return (ret); +} + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + int ret; + + if (scgp->fd < 0) { + sp->error = SCG_FATAL; + return (0); + } + + ret = do_scg_cmd(scgp, sp); + if (ret < 0) + return (ret); + + if (sp->u_scb.cmd_scb[0] & S_CKCON) + ret = do_scg_sense(scgp, sp); + + return (ret); +} + +#define sense u_sense.Sense +#undef SC_PARITY +#define SC_PARITY 0x09 +#define scb u_scb.Scb + +/*--------------------------------------------------------------------------*/ +#include <unixstd.h> +#include <waitdefs.h> +/* + * Simplified version of popen() + * This version of popen() is not usable more than once at a time. + * Needed because /etc/scsi/pdiconfig will not work if euid != uid + */ +LOCAL pid_t po_pid; + +LOCAL FILE * +xpopen(cmd, type) + char *cmd; + char *type; +{ + FILE *ret; + FILE *pp[2]; + + if (po_pid != 0) + return ((FILE *)NULL); + + if (*type != 'r') + return ((FILE *)NULL); + + if (fpipe(pp) == 0) + return ((FILE *)NULL); + + + if ((po_pid = fork()) == 0) { + setuid(0); + + fclose(pp[0]); + (void) fexecl("/bin/sh", stdin, pp[1], stderr, + "sh", "-c", cmd, (char *)0); + _exit(1); + } + fclose(pp[1]); + + if (po_pid == (pid_t)-1) { + fclose(pp[0]); + return ((FILE *)NULL); + } + return (pp[0]); +} + +LOCAL int +xpclose(f) + FILE *f; +{ + int ret = 0; + + if (po_pid == 0) + return (-1); + + fclose(f); + + if (waitpid(po_pid, &ret, 0) < 0) + ret = -1; + + po_pid = 0; + return (ret); +} diff --git a/scsilib/libscg/scsi-vms.c b/scsilib/libscg/scsi-vms.c new file mode 100644 index 0000000..6bae407 --- /dev/null +++ b/scsilib/libscg/scsi-vms.c @@ -0,0 +1,560 @@ +/* @(#)scsi-vms.c 1.33 04/01/15 Copyright 1997 J. Schilling */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-vms.c 1.33 04/01/15 Copyright 1997 J. Schilling"; +#endif +/* + * Interface for the VMS generic SCSI implementation. + * + * The idea for an elegant mapping to VMS device dontroller names + * is from Chip Dancy Chip.Dancy@hp.com. This allows up to + * 26 IDE controllers (DQ[A-Z][0-1]). + * + * This is a hack, that tries to emulate the functionality + * of the scg driver. + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1997 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <iodef.h> +#include <ssdef.h> +#include <descrip.h> +#include <starlet.h> +#include <string.h> +#include <LIB$ROUTINES.H> + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-vms.c-1.33"; /* The version for this transport*/ + +#define VMS_MAX_DK 4 /* DK[A-D] VMS device controllers */ +#define VMS_MAX_GK 4 /* GK[A-D] VMS device controllers */ +#define VMS_MAX_DQ 26 /* DQ[A-Z] VMS device controllers */ + +#define VMS_DKRANGE_MAX VMS_MAX_DK +#define VMS_GKRANGE_MAX (VMS_DKRANGE_MAX + VMS_MAX_GK) +#define VMS_DQRANGE_MAX (VMS_GKRANGE_MAX + VMS_MAX_DQ) + +#define MAX_SCG VMS_DQRANGE_MAX /* Max # of SCSI controllers */ +#define MAX_TGT 16 +#define MAX_LUN 8 + +#define MAX_DMA_VMS (63*1024) /* Check if this is not too big */ +#define MAX_PHSTMO_VMS 300 +#define MAX_DSCTMO_VMS ((64*1024)-1) /* max value for OpenVMS/AXP 7.1 ehh*/ + +/* + * Define a mapping from the scsi busno to the three character + * VMS device controller. + * The valid busno values are broken into three ranges, one for each of + * the three supported devices: dk, gk, and dq. + * The vmschar[] and vmschar1[] arrays are subscripted by an offset + * corresponding to each of the three ranges [0,1,2] to provide the + * two characters of the VMS device. + * The offset of the busno value within its range is used to define the + * third character, using the vmschar2[] array. + */ +LOCAL char vmschar[] = {'d', 'g', 'd'}; +LOCAL char vmschar1[] = {'k', 'k', 'q'}; +LOCAL char vmschar2[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', + 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', + 'u', 'v', 'w', 'x', 'y', 'z'}; + + +LOCAL int do_scg_cmd __PR((SCSI *scgp, struct scg_cmd *sp)); +LOCAL int do_scg_sense __PR((SCSI *scgp, struct scg_cmd *sp)); + +#define DEVICE_NAMELEN 8 + +struct SCSI$DESC { + Uint SCSI$L_OPCODE; /* SCSI Operation Code */ + Uint SCSI$L_FLAGS; /* SCSI Flags Bit Map */ + char *SCSI$A_CMD_ADDR; /* ->SCSI command buffer */ + Uint SCSI$L_CMD_LEN; /* SCSI command length, bytes */ + char *SCSI$A_DATA_ADDR; /* ->SCSI data buffer */ + Uint SCSI$L_DATA_LEN; /* SCSI data length, bytes */ + Uint SCSI$L_PAD_LEN; /* SCSI pad length, bytes */ + Uint SCSI$L_PH_CH_TMOUT; /* SCSI phase change timeout */ + Uint SCSI$L_DISCON_TMOUT; /* SCSI disconnect timeout */ + Uint SCSI$L_RES_1; /* Reserved */ + Uint SCSI$L_RES_2; /* Reserved */ + Uint SCSI$L_RES_3; /* Reserved */ + Uint SCSI$L_RES_4; /* Reserved */ + Uint SCSI$L_RES_5; /* Reserved */ + Uint SCSI$L_RES_6; /* Reserved */ +}; + +#ifdef __ALPHA +#pragma member_alignment save +#pragma nomember_alignment +#endif + +struct SCSI$IOSB { + Ushort SCSI$W_VMS_STAT; /* VMS status code */ + Ulong SCSI$L_IOSB_TFR_CNT; /* Actual #bytes transferred */ + char SCSI$B_IOSB_FILL_1; + Uchar SCSI$B_IOSB_STS; /* SCSI device status */ +}; + +#ifdef __ALPHA +#pragma member_alignment restore +#endif + +#define SCSI$K_GOOD_STATUS 0 +#define SCSI$K_CHECK_CONDITION 0x2 +#define SCSI$K_CONDITION_MET 0x4 +#define SCSI$K_BUSY 0x8 +#define SCSI$K_INTERMEDIATE 0x10 +#define SCSI$K_INTERMEDIATE_C_MET 0x14 +#define SCSI$K_RESERVATION_CONFLICT 0x18 +#define SCSI$K_COMMAND_TERMINATED 0x22 +#define SCSI$K_QUEUE_FULL 0x28 + + +#define SCSI$K_WRITE 0X0 /* direction of transfer=write */ +#define SCSI$K_READ 0X1 /* direction of transfer=read */ +#define SCSI$K_FL_ENAB_DIS 0X2 /* enable disconnects */ +#define SCSI$K_FL_ENAB_SYNC 0X4 /* enable sync */ +#define GK_EFN 0 /* Event flag number */ + +static char gk_device[8]; /* XXX JS hoffentlich gibt es keinen Ueberlauf */ +static Ushort gk_chan; +static Ushort transfer_length; +static int i; +static int status; +static $DESCRIPTOR(gk_device_desc, gk_device); +static struct SCSI$IOSB gk_iosb; +static struct SCSI$DESC gk_desc; +static FILE *fp; + + +struct scg_local { + Ushort gk_chan; +}; +#define scglocal(p) ((struct scg_local *)((p)->local)) + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (__sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "IO$_DIAGNOSE", "Generic SCSI", + "", "bus,target,lun", "1,2,0", FALSE, FALSE); + return (0); +} + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + char devname[DEVICE_NAMELEN]; + char buschar; + char buschar1; + char buschar2; + int range; + int range_offset; + + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno, target or lun '%d,%d,%d'", + busno, tgt, tlun); + return (-1); + } + + if ((device != NULL && *device != '\0') || (busno == -2 && tgt == -2)) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Open by 'devname' not supported on this OS"); + return (-1); + } + if (busno < 0 || tgt < 0 || tlun < 0) { + /* + * There is no real reason why we cannot scan on VMS, + * but for now it is not possible. + */ + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Unable to scan on VMS"); + return (0); + } + + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + } + + if (busno < VMS_DKRANGE_MAX) { /* in the dk range? */ + range = 0; + range_offset = busno; + } else if (busno < VMS_GKRANGE_MAX) { /* in the gk range? */ + range = 1; + range_offset = busno - VMS_DKRANGE_MAX; + } else if (busno < VMS_DQRANGE_MAX) { /* in the dq range? */ + range = 2; + range_offset = busno - VMS_GKRANGE_MAX; + } + buschar = vmschar[range]; /* get first device char*/ + buschar1 = vmschar1[range]; /* get 2nd device char*/ + buschar2 = vmschar2[range_offset]; /* get controller char*/ + + js_snprintf(devname, sizeof (devname), "%c%c%c%d0%d:", + buschar, buschar1, buschar2, + tgt, tlun); + strcpy(gk_device, devname); + status = sys$assign(&gk_device_desc, &gk_chan, 0, 0); + if (!(status & 1)) { + js_fprintf((FILE *)scgp->errfile, + "Unable to access scsi-device \"%s\"\n", &gk_device[0]); + return (-1); + } + if (scgp->debug > 0) { + fp = fopen("cdrecord_io.log", "w", "rfm=stmlf", "rat=cr"); + if (fp == NULL) { + perror("Failing opening i/o-logfile"); + exit(SS$_NORMAL); + } + } + return (status); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + /* + * XXX close gk_chan ??? + */ + /* + * sys$dassgn() + */ + + status = sys$dassgn(gk_chan); + + return (status); +} + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + return (MAX_DMA_VMS); +} + +LOCAL BOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + if (gk_chan == 0) + return (FALSE); + return (TRUE); +} + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (gk_chan == 0) + return (-1); + return (gk_chan); +} + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + return (-1); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; +{ + int busno = scg_scsibus(scgp); + + if (busno >= 8) + return (TRUE); + + return (FALSE); +} + +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + errno = EINVAL; + return (-1); +} + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_getbuf: %ld bytes\n", amt); + } + scgp->bufbase = malloc((size_t)(amt)); /* XXX JS XXX valloc() ??? */ + return (scgp->bufbase); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL int +do_scg_cmd(scgp, sp) + SCSI *scgp; + struct scg_cmd *sp; +{ + char *cmdadr; + int notcmdretry; + int len; + Uchar scsi_sts; + int severity; + + /* XXX JS XXX This cannot be OK */ + notcmdretry = (sp->flags & SCG_CMD_RETRY)^SCG_CMD_RETRY; + /* error corrected ehh */ +/* + * XXX JS Wenn das notcmdretry Flag bei VMS auch 0x08 ist und Du darauf hoffst, + * XXX Dasz ich den Wert nie aendere, dann ist das richtig. + * XXX Siehe unten: Das gleiche gilt fuer SCG_RECV_DATA und SCG_DISRE_ENA !!! + */ + + cmdadr = (char *)sp->cdb.cmd_cdb; + /* XXX JS XXX This cannot be OK */ + gk_desc.SCSI$L_FLAGS = ((sp->flags & SCG_RECV_DATA) | + (sp->flags & SCG_DISRE_ENA)| + notcmdretry); + /* XXX siehe oben, das ist ein bitweises oder!!! */ + gk_desc.SCSI$A_DATA_ADDR = sp->addr; + gk_desc.SCSI$L_DATA_LEN = sp->size; + gk_desc.SCSI$A_CMD_ADDR = cmdadr; + gk_desc.SCSI$L_CMD_LEN = sp->cdb_len; + gk_desc.SCSI$L_PH_CH_TMOUT = sp->timeout; + gk_desc.SCSI$L_DISCON_TMOUT = sp->timeout; + if (gk_desc.SCSI$L_PH_CH_TMOUT > MAX_PHSTMO_VMS) + gk_desc.SCSI$L_PH_CH_TMOUT = MAX_PHSTMO_VMS; + if (gk_desc.SCSI$L_DISCON_TMOUT > MAX_DSCTMO_VMS) + gk_desc.SCSI$L_DISCON_TMOUT = MAX_DSCTMO_VMS; + gk_desc.SCSI$L_OPCODE = 1; /* SCSI Operation Code */ + gk_desc.SCSI$L_PAD_LEN = 0; /* SCSI pad length, bytes */ + gk_desc.SCSI$L_RES_1 = 0; /* Reserved */ + gk_desc.SCSI$L_RES_2 = 0; /* Reserved */ + gk_desc.SCSI$L_RES_3 = 0; /* Reserved */ + gk_desc.SCSI$L_RES_4 = 0; /* Reserved */ + gk_desc.SCSI$L_RES_5 = 0; /* Reserved */ + gk_desc.SCSI$L_RES_6 = 0; /* Reserved */ + if (scgp->debug > 0) { + js_fprintf(fp, "***********************************************************\n"); + js_fprintf(fp, "SCSI VMS-I/O parameters\n"); + js_fprintf(fp, "OPCODE: %d", gk_desc.SCSI$L_OPCODE); + js_fprintf(fp, " FLAGS: %d\n", gk_desc.SCSI$L_FLAGS); + js_fprintf(fp, "CMD:"); + for (i = 0; i < gk_desc.SCSI$L_CMD_LEN; i++) { + js_fprintf(fp, "%x ", sp->cdb.cmd_cdb[i]); + } + js_fprintf(fp, "\n"); + js_fprintf(fp, "DATA_LEN: %d\n", gk_desc.SCSI$L_DATA_LEN); + js_fprintf(fp, "PH_CH_TMOUT: %d", gk_desc.SCSI$L_PH_CH_TMOUT); + js_fprintf(fp, " DISCON_TMOUT: %d\n", gk_desc.SCSI$L_DISCON_TMOUT); + } + status = sys$qiow(GK_EFN, gk_chan, IO$_DIAGNOSE, &gk_iosb, 0, 0, + &gk_desc, sizeof (gk_desc), 0, 0, 0, 0); + + + if (scgp->debug > 0) { + js_fprintf(fp, "qiow-status: %i\n", status); + js_fprintf(fp, "VMS status code %i\n", gk_iosb.SCSI$W_VMS_STAT); + js_fprintf(fp, "Actual #bytes transferred %i\n", gk_iosb.SCSI$L_IOSB_TFR_CNT); + js_fprintf(fp, "SCSI device status %i\n", gk_iosb.SCSI$B_IOSB_STS); + if (gk_iosb.SCSI$L_IOSB_TFR_CNT != gk_desc.SCSI$L_DATA_LEN) { + js_fprintf(fp, "#bytes transferred != DATA_LEN\n"); + } + } + + if (!(status & 1)) { /* Fehlerindikation fuer sys$qiow() */ + sp->ux_errno = geterrno(); + /* schwerwiegender nicht SCSI bedingter Fehler => return (-1) */ + if (sp->ux_errno == ENOTTY || sp->ux_errno == ENXIO || + sp->ux_errno == EINVAL || sp->ux_errno == EACCES) { + return (-1); + } + if (sp->ux_errno == 0) + sp->ux_errno == EIO; + } else { + sp->ux_errno = 0; + } + + sp->resid = gk_desc.SCSI$L_DATA_LEN - gk_iosb.SCSI$L_IOSB_TFR_CNT; + + if (scgo_isatapi(scgp)) { + scsi_sts = ((gk_iosb.SCSI$B_IOSB_STS >> 4) & 0x7); + } else { + scsi_sts = gk_iosb.SCSI$B_IOSB_STS; + } + + if (gk_iosb.SCSI$W_VMS_STAT == SS$_NORMAL && scsi_sts == 0) { + sp->error = SCG_NO_ERROR; + if (scgp->debug > 0) { + js_fprintf(fp, "scsi_sts == 0\n"); + js_fprintf(fp, "gk_iosb.SCSI$B_IOSB_STS == 0\n"); + js_fprintf(fp, "sp->error %i\n", sp->error); + js_fprintf(fp, "sp->resid %i\n", sp->resid); + } + return (0); + } + + severity = gk_iosb.SCSI$W_VMS_STAT & 0x7; + + if (severity == 4) { + sp->error = SCG_FATAL; + if (scgp->debug > 0) { + js_fprintf(fp, "scsi_sts & 2\n"); + js_fprintf(fp, "gk_iosb.SCSI$B_IOSB_STS & 2\n"); + js_fprintf(fp, "gk_iosb.SCSI$W_VMS_STAT & 0x7 == SS$_FATAL\n"); + js_fprintf(fp, "sp->error %i\n", sp->error); + } + return (0); + } + if (gk_iosb.SCSI$W_VMS_STAT == SS$_TIMEOUT) { + sp->error = SCG_TIMEOUT; + if (scgp->debug > 0) { + js_fprintf(fp, "scsi_sts & 2\n"); + js_fprintf(fp, "gk_iosb.SCSI$B_IOSB_STS & 2\n"); + js_fprintf(fp, "gk_iosb.SCSI$W_VMS_STAT == SS$_TIMEOUT\n"); + js_fprintf(fp, "sp->error %i\n", sp->error); + } + return (0); + } + sp->error = SCG_RETRYABLE; + sp->u_scb.cmd_scb[0] = scsi_sts; + if (scgp->debug > 0) { + js_fprintf(fp, "scsi_sts & 2\n"); + js_fprintf(fp, "gk_iosb.SCSI$B_IOSB_STS & 2\n"); + js_fprintf(fp, "gk_iosb.SCSI$W_VMS_STAT != 0\n"); + js_fprintf(fp, "sp->error %i\n", sp->error); + } + return (0); +} + +LOCAL int +do_scg_sense(scgp, sp) + SCSI *scgp; + struct scg_cmd *sp; +{ + int ret; + struct scg_cmd s_cmd; + + fillbytes((caddr_t)&s_cmd, sizeof (s_cmd), '\0'); + s_cmd.addr = (char *)sp->u_sense.cmd_sense; + s_cmd.size = sp->sense_len; + s_cmd.flags = SCG_RECV_DATA|SCG_DISRE_ENA; + s_cmd.cdb_len = SC_G0_CDBLEN; + s_cmd.sense_len = CCS_SENSE_LEN; + s_cmd.cdb.g0_cdb.cmd = SC_REQUEST_SENSE; + s_cmd.cdb.g0_cdb.lun = sp->cdb.g0_cdb.lun; + s_cmd.cdb.g0_cdb.count = sp->sense_len; + ret = do_scg_cmd(scgp, &s_cmd); + + if (ret < 0) + return (ret); + if (s_cmd.u_scb.cmd_scb[0] & 02) { + /* XXX ??? Check condition on request Sense ??? */ + } + sp->sense_count = sp->sense_len - s_cmd.resid; + return (ret); +} + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + int ret; + + if (scgp->fd < 0) { + sp->error = SCG_FATAL; + return (0); + } + ret = do_scg_cmd(scgp, sp); + if (ret < 0) + return (ret); + if (sp->u_scb.cmd_scb[0] & 02) + ret = do_scg_sense(scgp, sp); + return (ret); +} diff --git a/scsilib/libscg/scsi-wnt.c b/scsilib/libscg/scsi-wnt.c new file mode 100644 index 0000000..ce73cd0 --- /dev/null +++ b/scsilib/libscg/scsi-wnt.c @@ -0,0 +1,1796 @@ +/* @(#)scsi-wnt.c 1.45 04/07/19 Copyright 1998-2004 J. Schilling, A.L. Faber, J.A. Key */ +#ifndef lint +static char __sccsid[] = + "@(#)scsi-wnt.c 1.45 04/07/19 Copyright 1998-2004 J. Schilling, A.L. Faber, J.A. Key"; +#endif +/* + * Interface for the Win32 ASPI library. + * You need wnaspi32.dll and aspi32.sys + * Both can be installed from ASPI_ME + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1998-2004 J. Schilling + * Copyright (c) 1999 A.L. Faber for the first implementation + * of this interface. + * TODO: + * - DMA resid handling + * - better handling of maxDMA + * - SCSI reset support + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + + +/* + * Include for Win32 ASPI AspiRouter + * + * NOTE: aspi-win32.h includes Windows.h and Windows.h includes + * Base.h which has a second typedef for BOOL. + * We define BOOL to make all local code use BOOL + * from Windows.h and use the hidden __SBOOL for + * our global interfaces. + */ +#define BOOL WBOOL /* This is the Win BOOL */ +#define format __format +#include <scg/aspi-win32.h> +#include <scg/spti-wnt.h> +#undef format + +#ifdef __CYGWIN32__ /* Use dlopen() */ +#include <dlfcn.h> +#endif + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_version[] = "scsi-wnt.c-1.45"; /* The version for this transport*/ +LOCAL char _scg_itrans_version[] = "SPTI-scsi-wnt.c-1.45"; /* The version for SPTI */ + +/* + * Local defines and constants + */ +/*#define DEBUG_WNTASPI*/ + +#define MAX_SCG 16 /* Max # of SCSI controllers */ +#define MAX_TGT 16 /* Max # of SCSI Targets */ +#define MAX_LUN 8 /* Max # of SCSI LUNs */ + +#ifdef DEBUG_WNTASPI +#endif + +struct scg_local { + int dummy; +}; +#define scglocal(p) ((struct scg_local *)((p)->local)) + +/* + * Local variables + */ +LOCAL int busses; +LOCAL DWORD (*pfnGetASPI32SupportInfo)(void) = NULL; +LOCAL DWORD (*pfnSendASPI32Command)(LPSRB) = NULL; +LOCAL BOOL (*pfnGetASPI32Buffer)(PASPI32BUFF) = NULL; +LOCAL BOOL (*pfnFreeASPI32Buffer)(PASPI32BUFF) = NULL; +LOCAL BOOL (*pfnTranslateASPI32Address)(PDWORD, PDWORD) = NULL; + +LOCAL int AspiLoaded = 0; /* ASPI or SPTI */ +LOCAL HANDLE hAspiLib = NULL; /* Used for Loadlib */ + +#define MAX_DMA_WNT (63L*1024L) /* ASPI-Driver allows up to 64k ??? */ + +/* + * Local function prototypes + */ +LOCAL void exit_func __PR((void)); +#ifdef DEBUG_WNTASPI +LOCAL void DebugScsiSend __PR((SCSI *scgp, SRB_ExecSCSICmd *s, int bDisplayBuffer)); +#endif +LOCAL void copy_sensedata __PR((SRB_ExecSCSICmd *cp, struct scg_cmd *sp)); +LOCAL void set_error __PR((SRB_ExecSCSICmd *cp, struct scg_cmd *sp)); +LOCAL BOOL open_driver __PR((SCSI *scgp)); +LOCAL BOOL load_aspi __PR((SCSI *scgp)); +LOCAL BOOL close_driver __PR((void)); +LOCAL int ha_inquiry __PR((SCSI *scgp, int id, SRB_HAInquiry *ip)); +#ifdef __USED__ +LOCAL int resetSCSIBus __PR((SCSI *scgp)); +#endif +LOCAL int scsiabort __PR((SCSI *scgp, SRB_ExecSCSICmd *sp)); + + +/* SPTI Start ---------------------------------------------------------------*/ +/* + * From scsipt.c - Copyright (C) 1999 Jay A. Key + * Homepage: http://akrip.sourceforge.net/ + * Native NT support functions via the SCSI Pass Through interface instead + * of ASPI. Although based on information from the NT 4.0 DDK from + * Microsoft, the information has been sufficiently distilled to allow + * compilation w/o having the DDK installed. + * added to scsi-wnt.c by Richard Stemmer, rs@epost.de + * See http://www.ste-home.de/cdrtools-spti/ + */ + +#define PREFER_SPTI 1 /* Prefer SPTI if available, else try ASPI, force ASPI with dev=ASPI: */ +/* #define CREATE_NONSHARED 1 */ /* open CDROM-Device not SHARED if possible */ +/* #define _DEBUG_SCSIPT 1 */ +#ifdef _DEBUG_SCSIPT +FILE *scgp_errfile; /* File for SPTI-Debug-Messages */ +#endif + +#define SENSE_LEN_SPTI 32 /* Sense length for ASPI is only 14 */ +#define NUM_MAX_NTSCSI_DRIVES 26 /* a: ... z: */ +#define NUM_FLOPPY_DRIVES 2 +#define NUM_MAX_NTSCSI_HA NUM_MAX_NTSCSI_DRIVES + +#define NTSCSI_HA_INQUIRY_SIZE 36 + +#define SCSI_CMD_INQUIRY 0x12 + +typedef struct { + BYTE ha; /* SCSI Bus # */ + BYTE tgt; /* SCSI Target # */ + BYTE lun; /* SCSI Lun # */ + BYTE PortNumber; /* SCSI Card # (\\.\SCSI%d) */ + BYTE PathId; /* SCSI Bus/Channel # on card n */ + BYTE driveLetter; /* Win32 drive letter (e.g. c:) */ + BOOL bUsed; /* Win32 drive letter is used */ + HANDLE hDevice; /* Win32 handle for ioctl() */ + BYTE inqData[NTSCSI_HA_INQUIRY_SIZE]; +} DRIVE; + +typedef struct { + BYTE numAdapters; + DRIVE drive[NUM_MAX_NTSCSI_DRIVES]; +} SPTIGLOBAL; + +LOCAL int InitSCSIPT(void); +LOCAL int DeinitSCSIPT(void); +LOCAL void GetDriveInformation(BYTE i, DRIVE *pDrive); +LOCAL BYTE SPTIGetNumAdapters(void); +LOCAL BYTE SPTIGetDeviceIndex(BYTE ha, BYTE tgt, BYTE lun); +LOCAL DWORD SPTIHandleHaInquiry(LPSRB_HAInquiry lpsrb); +LOCAL DWORD SPTIExecSCSICommand(LPSRB_ExecSCSICmd lpsrb, int sptTimeOutValue, BOOL bBeenHereBefore); +LOCAL HANDLE GetFileHandle(BYTE i, BOOL openshared); + +LOCAL BOOL bSCSIPTInit = FALSE; +LOCAL SPTIGLOBAL sptiglobal; +LOCAL BOOL bUsingSCSIPT = FALSE; +LOCAL BOOL bForceAccess = FALSE; +LOCAL int sptihamax; +LOCAL USHORT sptihasortarr[NUM_MAX_NTSCSI_HA]; + +/* + * Initialization of SCSI Pass Through Interface code. Responsible for + * setting up the array of SCSI devices. This code will be a little + * different from the normal code -- it will query each drive letter from + * C: through Z: to see if it is a CD. When we identify a CD, we then + * send CDB with the INQUIRY command to it -- NT will automagically fill in + * the PathId, TargetId, and Lun for us. + */ +LOCAL int +InitSCSIPT(void) +{ + BYTE i; + BYTE j; + char buf[4]; + UINT uDriveType; + int retVal = 0; + USHORT hasortval; + char adapter_name[20]; + HANDLE fh; + ULONG returned; + BOOL status; + char InquiryBuffer[2048]; + PSCSI_ADAPTER_BUS_INFO ai; + BYTE bus; + + if (bSCSIPTInit) + return (0); + + /* + * Detect all Busses on all SCSI-Adapters + * Fill up map array that allows us to later assign devices to + * bus numbers. + */ + sptihamax = 0; + i = 0; + do { + js_snprintf(adapter_name, sizeof (adapter_name), "\\\\.\\SCSI%d:", i); + fh = CreateFile(adapter_name, GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, 0, NULL); + if (fh != INVALID_HANDLE_VALUE) { + status = DeviceIoControl(fh, + IOCTL_SCSI_GET_INQUIRY_DATA, + NULL, + 0, + InquiryBuffer, + 2048, + &returned, + FALSE); + if (status) { + ai = (PSCSI_ADAPTER_BUS_INFO) InquiryBuffer; + for (bus = 0; bus < ai->NumberOfBusses; bus++) { + sptihasortarr[sptihamax] = ((i<<8) | bus); + sptihamax++; + } + } + CloseHandle(fh); + } + i++; + } while (fh != INVALID_HANDLE_VALUE); + + errno = 0; + memset(&sptiglobal, 0, sizeof (SPTIGLOBAL)); + for (i = 0; i < NUM_MAX_NTSCSI_DRIVES; i++) + sptiglobal.drive[i].hDevice = INVALID_HANDLE_VALUE; + + for (i = NUM_FLOPPY_DRIVES; i < NUM_MAX_NTSCSI_DRIVES; i++) { + js_snprintf(buf, sizeof (buf), "%c:\\", (char)('A'+i)); + uDriveType = GetDriveType(buf); +#ifdef CDROM_ONLY + if (uDriveType == DRIVE_CDROM) { +#else + if (TRUE) { +#endif + GetDriveInformation(i, &sptiglobal.drive[i]); + if (sptiglobal.drive[i].bUsed) { + retVal++; + hasortval = (sptiglobal.drive[i].PortNumber<<8) | sptiglobal.drive[i].PathId; + for (j = 0; j < sptihamax; j++) { + if (hasortval <= sptihasortarr[j]) + break; + } + if (j == sptihamax) { + sptihasortarr[j] = hasortval; + sptihamax++; + } else if (hasortval < sptihasortarr[j]) { + memmove(&sptihasortarr[j+1], &sptihasortarr[j], (sptihamax-j) * sizeof (USHORT)); + sptihasortarr[j] = hasortval; + sptihamax++; + } + } + } + } + if (sptihamax > 0) { + for (i = NUM_FLOPPY_DRIVES; i < NUM_MAX_NTSCSI_DRIVES; i++) + if (sptiglobal.drive[i].bUsed) + for (j = 0; j < sptihamax; j++) { + if (sptihasortarr[j] == ((sptiglobal.drive[i].PortNumber<<8) | sptiglobal.drive[i].PathId)) { + sptiglobal.drive[i].ha = j; + break; + } + } + } + sptiglobal.numAdapters = SPTIGetNumAdapters(); + + bSCSIPTInit = TRUE; + + if (retVal > 0) + bUsingSCSIPT = TRUE; + + return (retVal); +} + + +LOCAL int +DeinitSCSIPT(void) +{ + BYTE i; + + if (!bSCSIPTInit) + return (0); + + for (i = NUM_FLOPPY_DRIVES; i < NUM_MAX_NTSCSI_DRIVES; i++) { + if (sptiglobal.drive[i].bUsed) { + CloseHandle(sptiglobal.drive[i].hDevice); + } + } + + sptiglobal.numAdapters = SPTIGetNumAdapters(); + + memset(&sptiglobal, 0, sizeof (SPTIGLOBAL)); + bSCSIPTInit = FALSE; + return (-1); +} + + +/* + * Returns the number of "adapters" present. + */ +LOCAL BYTE +SPTIGetNumAdapters(void) +{ + BYTE buf[256]; + WORD i; + BYTE numAdapters = 0; + + memset(buf, 0, 256); + + /* + * PortNumber 0 should exist, so pre-mark it. This avoids problems + * when the primary IDE drives are on PortNumber 0, but can't be opened + * because of insufficient privelege (ie. non-admin). + */ + buf[0] = 1; + for (i = 0; i < NUM_MAX_NTSCSI_DRIVES; i++) { + if (sptiglobal.drive[i].bUsed) + buf[sptiglobal.drive[i].ha] = 1; + } + + for (i = 0; i <= 255; i++) + if (buf[i]) + numAdapters = (BYTE)(i + 1); + +/* numAdapters++; */ + + return (numAdapters); +} + +#include <ctype.h> +LOCAL BOOL +w2k_or_newer(void) +{ + OSVERSIONINFO osver; + + memset(&osver, 0, sizeof (osver)); + osver.dwOSVersionInfoSize = sizeof (osver); + GetVersionEx(&osver); + if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) { + /* + * Win2000 is NT-5.0, Win-XP is NT-5.1 + */ + if (osver.dwMajorVersion > 4) + return (TRUE); + } + return (FALSE); +} + +LOCAL BOOL +w2kstyle_create(void) +{ + OSVERSIONINFO osver; + +/* return FALSE; */ + memset(&osver, 0, sizeof (osver)); + osver.dwOSVersionInfoSize = sizeof (osver); + GetVersionEx(&osver); + if (osver.dwPlatformId == VER_PLATFORM_WIN32_NT) { + /* + * Win2000 is NT-5.0, Win-XP is NT-5.1 + */ + if (osver.dwMajorVersion > 4) + return (TRUE); + + if (osver.dwMajorVersion == 4) { /* NT-4.x */ + char *vers = osver.szCSDVersion; + + if (strlen(vers) == 0) + return (FALSE); + + /* + * Servicepack is installed, skip over non-digit part + */ + while (*vers != '\0' && !isdigit(*vers)) + vers++; + if (*vers == '\0') + return (FALSE); + + if (isdigit(vers[0]) && + (atoi(vers) >= 4 || isdigit(vers[1]))) /* Fom Service Pack 4 */ + return (TRUE); /* same as for W2K */ + } + } + return (FALSE); +} + + +/* + * Universal function to get a file handle to the CD device. Since + * NT 4.0 wants just the GENERIC_READ flag, and Win2K wants both + * GENERIC_READ and GENERIC_WRITE (why a read-only CD device needs + * GENERIC_WRITE access is beyond me...), the easist workaround is to just + * try them both. + */ +LOCAL HANDLE +GetFileHandle(BYTE i, BOOL openshared) +{ + char buf[12]; + HANDLE fh; + DWORD dwFlags = GENERIC_READ; + DWORD dwAccessMode = 0; + + dwAccessMode = FILE_SHARE_READ; + if (w2kstyle_create()) { /* if Win2K or greater, add GENERIC_WRITE */ + dwFlags |= GENERIC_WRITE; + dwAccessMode |= FILE_SHARE_WRITE; +#ifdef _DEBUG_SCSIPT + js_fprintf(scgp_errfile, "SPTI: GetFileHandle(): Setting for Win2K\n"); +#endif + } + js_snprintf(buf, sizeof (buf), "\\\\.\\%c:", (char)('A'+i)); +#ifdef CREATE_NONSHARED + if (openshared) { + fh = CreateFile(buf, dwFlags, dwAccessMode, NULL, + OPEN_EXISTING, 0, NULL); + } else { + fh = CreateFile(buf, dwFlags, 0, NULL, + OPEN_EXISTING, 0, NULL); + } + if (!openshared && fh == INVALID_HANDLE_VALUE && GetLastError() == ERROR_SHARING_VIOLATION) +#endif + fh = CreateFile(buf, dwFlags, dwAccessMode, NULL, + OPEN_EXISTING, 0, NULL); + if (fh == INVALID_HANDLE_VALUE) { + /* + * it went foobar somewhere, so try it with the GENERIC_WRITE + * bit flipped + */ + dwFlags ^= GENERIC_WRITE; + dwAccessMode ^= FILE_SHARE_WRITE; +#ifdef CREATE_NONSHARED + if (openshared) { + fh = CreateFile(buf, dwFlags, dwAccessMode, NULL, + OPEN_EXISTING, 0, NULL); + } else { + fh = CreateFile(buf, dwFlags, 0, NULL, + OPEN_EXISTING, 0, NULL); + } + if (!openshared && fh == INVALID_HANDLE_VALUE && GetLastError() == ERROR_SHARING_VIOLATION) +#endif + fh = CreateFile(buf, dwFlags, dwAccessMode, NULL, + OPEN_EXISTING, 0, NULL); + } +#ifdef _DEBUG_SCSIPT + if (fh == INVALID_HANDLE_VALUE) + js_fprintf(scgp_errfile, "SPTI: CreateFile() failed! -> %d\n", GetLastError()); + else + js_fprintf(scgp_errfile, "SPTI: CreateFile() returned %d\n", GetLastError()); +#endif + + return (fh); +} + + +/* + * fills in a pDrive structure with information from a SCSI_INQUIRY + * and obtains the ha:tgt:lun values via IOCTL_SCSI_GET_ADDRESS + */ +LOCAL void +GetDriveInformation(BYTE i, DRIVE *pDrive) +{ + HANDLE fh; + BOOL status; + SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER swb; + SCSI_ADDRESS scsiAddr; + ULONG length; + ULONG returned; + BYTE inqData[NTSCSI_HA_INQUIRY_SIZE]; + +#ifdef _DEBUG_SCSIPT + js_fprintf(scgp_errfile, "SPTI: Checking drive %c:", 'A'+i); +#endif + + fh = GetFileHandle(i, TRUE); /* No NONSHARED Create for inquiry */ + + if (fh == INVALID_HANDLE_VALUE) { +#ifdef _DEBUG_SCSIPT + js_fprintf(scgp_errfile, " : fh == INVALID_HANDLE_VALUE\n"); +#endif + return; + } + +#ifdef _DEBUG_SCSIPT + js_fprintf(scgp_errfile, " : Index %d: fh == %08X\n", i, fh); +#endif + + + /* + * Get the drive inquiry data + */ + memset(&swb, 0, sizeof (swb)); + memset(inqData, 0, sizeof (inqData)); + swb.spt.Length = sizeof (SCSI_PASS_THROUGH_DIRECT); + swb.spt.CdbLength = 6; + swb.spt.SenseInfoLength = 24; + swb.spt.DataIn = SCSI_IOCTL_DATA_IN; + swb.spt.DataTransferLength = 100; + swb.spt.TimeOutValue = 2; + swb.spt.DataBuffer = inqData; + swb.spt.SenseInfoOffset = offsetof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, ucSenseBuf); + swb.spt.Cdb[0] = SCSI_CMD_INQUIRY; + swb.spt.Cdb[4] = NTSCSI_HA_INQUIRY_SIZE; + + length = sizeof (SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER); + status = DeviceIoControl(fh, + IOCTL_SCSI_PASS_THROUGH_DIRECT, + &swb, + sizeof (swb), + &swb, + sizeof (swb), + &returned, + NULL); + + if (!status) { + CloseHandle(fh); +#ifdef _DEBUG_SCSIPT + js_fprintf(scgp_errfile, "SPTI: Error DeviceIoControl() -> %d\n", GetLastError()); +#endif + return; + } + + memcpy(pDrive->inqData, inqData, NTSCSI_HA_INQUIRY_SIZE); + + /* + * get the address (path/tgt/lun) of the drive via IOCTL_SCSI_GET_ADDRESS + */ + memset(&scsiAddr, 0, sizeof (SCSI_ADDRESS)); + scsiAddr.Length = sizeof (SCSI_ADDRESS); + if (DeviceIoControl(fh, IOCTL_SCSI_GET_ADDRESS, NULL, 0, + &scsiAddr, sizeof (SCSI_ADDRESS), &returned, + NULL)) { +#ifdef _DEBUG_SCSIPT + js_fprintf(scgp_errfile, "Device %c: Port=%d, PathId=%d, TargetId=%d, Lun=%d\n", + (char)i+'A', scsiAddr.PortNumber, scsiAddr.PathId, + scsiAddr.TargetId, scsiAddr.Lun); +#endif + pDrive->bUsed = TRUE; + pDrive->ha = scsiAddr.PortNumber; /* preliminary */ + pDrive->PortNumber = scsiAddr.PortNumber; + pDrive->PathId = scsiAddr.PathId; + pDrive->tgt = scsiAddr.TargetId; + pDrive->lun = scsiAddr.Lun; + pDrive->driveLetter = i; + pDrive->hDevice = INVALID_HANDLE_VALUE; + + } else if (GetLastError() == 50) { /* support USB/FIREWIRE devices where this call is not supported assign drive letter as device ID */ + pDrive->bUsed = TRUE; + pDrive->ha = i; + pDrive->PortNumber = i+64; /* hopefully no conflict with other PortNumber */ + pDrive->PathId = 0; + pDrive->tgt = 0; + pDrive->lun = 0; + pDrive->driveLetter = i; + pDrive->hDevice = INVALID_HANDLE_VALUE; +#ifdef _DEBUG_SCSIPT + js_fprintf(scgp_errfile, "USB/Firewire Device %c: Port=%d, TargetId=%d, Lun=%d\n", (char)i+'A', i, 0, 0); +#endif + } else { + pDrive->bUsed = FALSE; +#ifdef _DEBUG_SCSIPT + js_fprintf(scgp_errfile, "SPTI: Device %s: Error DeviceIoControl(): %d\n", (char)i+'A', GetLastError()); +#endif + CloseHandle(fh); + return; + } +#ifdef _DEBUG_SCSIPT + js_fprintf(scgp_errfile, "SPTI: Adding drive %c: (%d:%d:%d)\n", 'A'+i, + pDrive->ha, pDrive->tgt, pDrive->lun); +#endif + CloseHandle(fh); +} + + + +LOCAL DWORD +SPTIHandleHaInquiry(LPSRB_HAInquiry lpsrb) +{ + DWORD *pMTL; + + lpsrb->HA_Count = sptiglobal.numAdapters; + if (lpsrb->SRB_HaId >= sptiglobal.numAdapters) { + lpsrb->SRB_Status = SS_INVALID_HA; + return (SS_INVALID_HA); + } + lpsrb->HA_SCSI_ID = 7; /* who cares... we're not really an ASPI manager */ + memcpy(lpsrb->HA_ManagerId, "AKASPI v0.000001", 16); + memcpy(lpsrb->HA_Identifier, "SCSI Adapter ", 16); + lpsrb->HA_Identifier[13] = (char)('0'+lpsrb->SRB_HaId); + memset(lpsrb->HA_Unique, 0, 16); + lpsrb->HA_Unique[3] = 8; + pMTL = (LPDWORD)&lpsrb->HA_Unique[4]; + *pMTL = 64 * 1024; + + lpsrb->SRB_Status = SS_COMP; + return (SS_COMP); +} + +/* + * Looks up the index in the drive array for a given ha:tgt:lun triple + */ +LOCAL BYTE +SPTIGetDeviceIndex(BYTE ha, BYTE tgt, BYTE lun) +{ + BYTE i; + +#ifdef _DEBUG_SCSIPT + js_fprintf(scgp_errfile, "SPTI: SPTIGetDeviceIndex\n"); +#endif + + for (i = NUM_FLOPPY_DRIVES; i < NUM_MAX_NTSCSI_DRIVES; i++) { + if (sptiglobal.drive[i].bUsed) { + DRIVE *lpd; + + lpd = &sptiglobal.drive[i]; + if ((lpd->ha == ha) && (lpd->tgt == tgt) && (lpd->lun == lun)) + return (i); + } + } + + return (0); +} + +/* + * Converts ASPI-style SRB to SCSI Pass Through IOCTL + */ + +LOCAL DWORD +SPTIExecSCSICommand(LPSRB_ExecSCSICmd lpsrb, int sptTimeOutValue, BOOL bBeenHereBefore) +{ + BOOL status; + SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER swb; + ULONG length; + ULONG returned; + BYTE idx; + BYTE j; + + idx = SPTIGetDeviceIndex(lpsrb->SRB_HaId, lpsrb->SRB_Target, lpsrb->SRB_Lun); + + if (idx == 0) { + lpsrb->SRB_Status = SS_NO_DEVICE; + return (SS_NO_DEVICE); + } + + if (lpsrb->CDBByte[0] == SCSI_CMD_INQUIRY) { + lpsrb->SRB_Status = SS_COMP; + memcpy(lpsrb->SRB_BufPointer, sptiglobal.drive[idx].inqData, NTSCSI_HA_INQUIRY_SIZE); + return (SS_COMP); + } + + if (sptiglobal.drive[idx].hDevice == INVALID_HANDLE_VALUE) + sptiglobal.drive[idx].hDevice = GetFileHandle(sptiglobal.drive[idx].driveLetter, FALSE); + + memset(&swb, 0, sizeof (swb)); + swb.spt.Length = sizeof (SCSI_PASS_THROUGH); + swb.spt.CdbLength = lpsrb->SRB_CDBLen; + if (lpsrb->SRB_Flags & SRB_DIR_IN) + swb.spt.DataIn = SCSI_IOCTL_DATA_IN; + else if (lpsrb->SRB_Flags & SRB_DIR_OUT) + swb.spt.DataIn = SCSI_IOCTL_DATA_OUT; + else + swb.spt.DataIn = SCSI_IOCTL_DATA_UNSPECIFIED; + swb.spt.DataTransferLength = lpsrb->SRB_BufLen; + swb.spt.TimeOutValue = sptTimeOutValue; + swb.spt.SenseInfoLength = lpsrb->SRB_SenseLen; + swb.spt.DataBuffer = lpsrb->SRB_BufPointer; + swb.spt.SenseInfoOffset = offsetof(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, ucSenseBuf); + memcpy(swb.spt.Cdb, lpsrb->CDBByte, lpsrb->SRB_CDBLen); + length = sizeof (swb); + +#ifdef _DEBUG_SCSIPT + js_fprintf(scgp_errfile, "SPTI: SPTIExecSCSICmd: calling DeviceIoControl()"); + js_fprintf(scgp_errfile, " : cmd == 0x%02X", swb.spt.Cdb[0]); +#endif + status = DeviceIoControl(sptiglobal.drive[idx].hDevice, + IOCTL_SCSI_PASS_THROUGH_DIRECT, + &swb, + length, + &swb, + length, + &returned, + NULL); + + lpsrb->SRB_SenseLen = swb.spt.SenseInfoLength; + memcpy(lpsrb->SenseArea, swb.ucSenseBuf, lpsrb->SRB_SenseLen); + if (status && swb.spt.ScsiStatus == 0) { + lpsrb->SRB_Status = SS_COMP; +#ifdef _DEBUG_SCSIPT + js_fprintf(scgp_errfile, " : SRB_Status == SS_COMP\n"); +#endif + } else { + DWORD dwErrCode; + + lpsrb->SRB_Status = SS_ERR; +/* lpsrb->SRB_TargStat = 0x0004;*/ + lpsrb->SRB_TargStat = swb.spt.ScsiStatus; + + dwErrCode = GetLastError(); +#ifdef _DEBUG_SCSIPT + js_fprintf(scgp_errfile, " : error == %d handle == %08X\n", dwErrCode, sptiglobal.drive[idx].hDevice); +#endif + /* + * KLUDGE ALERT! KLUDGE ALERT! KLUDGE ALERT! + * Whenever a disk changer switches disks, it may render the device + * handle invalid. We try to catch these errors here and recover + * from them. + */ + if (!bBeenHereBefore && + ((dwErrCode == ERROR_MEDIA_CHANGED) || (dwErrCode == ERROR_INVALID_HANDLE))) { + if (dwErrCode != ERROR_INVALID_HANDLE) + CloseHandle(sptiglobal.drive[idx].hDevice); + GetDriveInformation(idx, &sptiglobal.drive[idx]); + if (sptihamax > 0) { + if (sptiglobal.drive[idx].bUsed) + for (j = 0; j < sptihamax; j++) { + if (sptihasortarr[j] == + ((sptiglobal.drive[idx].PortNumber << 8) | sptiglobal.drive[idx].PathId)) { + sptiglobal.drive[idx].ha = j; + break; + } + } + } +#ifdef _DEBUG_SCSIPT + js_fprintf(scgp_errfile, "SPTI: SPTIExecSCSICommand: Retrying after ERROR_MEDIA_CHANGED\n"); +#endif + return (SPTIExecSCSICommand(lpsrb, sptTimeOutValue, TRUE)); + } + } + return (lpsrb->SRB_Status); +} +/* SPTI End -----------------------------------------------------------------*/ + + +LOCAL void +exit_func() +{ + if (!close_driver()) + errmsgno(EX_BAD, "Cannot close Win32-ASPI-Driver.\n"); +} + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + if (bUsingSCSIPT) + return (_scg_itrans_version); + return (_scg_trans_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (__sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_help(scgp, f) + SCSI *scgp; + FILE *f; +{ + __scg_help(f, "ASPI", "Generic transport independent SCSI", + "ASPI:", "bus,target,lun", "ASPI:1,2,0", TRUE, FALSE); + __scg_help(f, "SPTI", "Generic SCSI for Windows NT/2000/XP", + "SPTI:", "bus,target,lun", "SPTI:1,2,0", TRUE, FALSE); + return (0); +} + +LOCAL int +scgo_open(scgp, device) + SCSI *scgp; + char *device; +{ + int busno = scg_scsibus(scgp); + int tgt = scg_target(scgp); + int tlun = scg_lun(scgp); + + if (busno >= MAX_SCG || tgt >= MAX_TGT || tlun >= MAX_LUN) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Illegal value for busno, target or lun '%d,%d,%d'", + busno, tgt, tlun); + return (-1); + } + + if (device != NULL && + (strcmp(device, "SPTI") == 0 || strcmp(device, "ASPI") == 0)) + goto devok; + + if ((device != NULL && *device != '\0') || (busno == -2 && tgt == -2)) { + errno = EINVAL; + if (scgp->errstr) + js_snprintf(scgp->errstr, SCSI_ERRSTR_SIZE, + "Open by 'devname' not supported on this OS"); + return (-1); + } +devok: + if (AspiLoaded <= 0) { /* do not change access method on open driver */ + bForceAccess = FALSE; +#ifdef PREFER_SPTI + bUsingSCSIPT = TRUE; +#else + bUsingSCSIPT = FALSE; +#endif + if (!w2k_or_newer()) + bUsingSCSIPT = FALSE; + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_open: Prefered SCSI transport: %s\n", + bUsingSCSIPT ? "SPTI":"ASPI"); + } + if (device != NULL && strcmp(device, "SPTI") == 0) { + bUsingSCSIPT = TRUE; + bForceAccess = TRUE; + } else if (device != NULL && strcmp(device, "ASPI") == 0) { + bUsingSCSIPT = FALSE; + bForceAccess = TRUE; + } + if (device != NULL && scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_open: Selected SCSI transport: %s\n", + bUsingSCSIPT ? "SPTI":"ASPI"); + } + } + + /* + * Check if variables are within the range + */ + if (tgt >= 0 && tgt >= 0 && tlun >= 0) { + /* + * This is the non -scanbus case. + */ + ; + } else if (tgt == -2 && tgt == -2 && + (tgt == -2 || tlun >= 0)) { + /* + * This is the dev=ASPI case. + */ + ; + } else if (tgt != -1 || tgt != -1 || tlun != -1) { + errno = EINVAL; + return (-1); + } + + if (scgp->local == NULL) { + scgp->local = malloc(sizeof (struct scg_local)); + if (scgp->local == NULL) + return (0); + } + /* + * Try to open ASPI-Router + */ + if (!open_driver(scgp)) + return (-1); + + /* + * More than we have ... + */ + if (busno >= busses) { + close_driver(); + return (-1); + } + + /* + * Install Exit Function which closes the ASPI-Router + */ + atexit(exit_func); + + /* + * Success after all + */ + return (1); +} + +LOCAL int +scgo_close(scgp) + SCSI *scgp; +{ + exit_func(); + return (0); +} + +LOCAL long +scgo_maxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + return (MAX_DMA_WNT); +} + +LOCAL void * +scgo_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "scgo_getbuf: %ld bytes\n", amt); + } + scgp->bufbase = malloc((size_t)(amt)); + return (scgp->bufbase); +} + +LOCAL void +scgo_freebuf(scgp) + SCSI *scgp; +{ + if (scgp->bufbase) + free(scgp->bufbase); + scgp->bufbase = NULL; +} + +LOCAL __SBOOL +scgo_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + if (busno < 0 || busno >= busses) + return (FALSE); + + return (TRUE); +} + +LOCAL int +scgo_fileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + if (busno < 0 || busno >= busses || + tgt < 0 || tgt >= MAX_TGT || + tlun < 0 || tlun >= MAX_LUN) + return (-1); + + /* + * Return fake + */ + return (1); +} + + +LOCAL int +scgo_initiator_id(scgp) + SCSI *scgp; +{ + SRB_HAInquiry s; + + if (ha_inquiry(scgp, scg_scsibus(scgp), &s) < 0) + return (-1); + return (s.HA_SCSI_ID); +} + +LOCAL int +scgo_isatapi(scgp) + SCSI *scgp; +{ + return (-1); /* XXX Need to add real test */ +} + + +/* + * XXX scgo_reset not yet tested + */ +LOCAL int +scgo_reset(scgp, what) + SCSI *scgp; + int what; +{ + + DWORD Status = 0; + DWORD EventStatus = WAIT_OBJECT_0; + HANDLE Event = NULL; + SRB_BusDeviceReset s; + + if (what == SCG_RESET_NOP) { + if (bUsingSCSIPT) + return (-1); + else + return (0); /* Can ASPI really reset? */ + } + if (what != SCG_RESET_BUS) { + errno = EINVAL; + return (-1); + } + if (bUsingSCSIPT) { + js_fprintf((FILE *)scgp->errfile, + "Reset SCSI device not implemented with SPTI\n"); + return (-1); + } + + /* + * XXX Does this reset TGT or BUS ??? + */ + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "Attempting to reset SCSI device\n"); + } + + /* + * Check if ASPI library is loaded + */ + if (AspiLoaded <= 0) { + js_fprintf((FILE *)scgp->errfile, + "error in scgo_reset: ASPI driver not loaded !\n"); + return (-1); + } + + memset(&s, 0, sizeof (s)); /* Clear SRB_BesDeviceReset structure */ + + Event = CreateEvent(NULL, TRUE, FALSE, NULL); + + /* + * Set structure variables + */ + s.SRB_Cmd = SC_RESET_DEV; /* ASPI command code = SC_RESET_DEV */ + s.SRB_HaId = scg_scsibus(scgp); /* ASPI host adapter number */ + s.SRB_Flags = SRB_EVENT_NOTIFY; /* Flags */ + s.SRB_Target = scg_target(scgp); /* Target's SCSI ID */ + s.SRB_Lun = scg_lun(scgp); /* Target's LUN number */ + s.SRB_PostProc = (LPVOID)Event; /* Post routine */ + + /* + * Initiate SCSI command + */ + Status = pfnSendASPI32Command((LPSRB)&s); + + /* + * Check status + */ + if (Status == SS_PENDING) { + /* + * Wait till command completes + */ + EventStatus = WaitForSingleObject(Event, INFINITE); + } + + + /**************************************************/ + /* Reset event to non-signaled state. */ + /**************************************************/ + + if (EventStatus == WAIT_OBJECT_0) { + /* + * Clear event + */ + ResetEvent(Event); + } + + /* + * Close the event handle + */ + CloseHandle(Event); + + /* + * Check condition + */ + if (s.SRB_Status != SS_COMP) { + js_fprintf((FILE *)scgp->errfile, + "ERROR! 0x%08X\n", s.SRB_Status); + + /* + * Indicate that error has occured + */ + return (-1); + } + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "Reset SCSI device completed\n"); + } + + /* + * Everything went OK + */ + return (0); +} + + +#ifdef DEBUG_WNTASPI +LOCAL void +DebugScsiSend(scgp, s, bDisplayBuffer) + SCSI *scgp; + SRB_ExecSCSICmd *s; + int bDisplayBuffer; +{ + int i; + + js_fprintf((FILE *)scgp->errfile, "\n\nDebugScsiSend\n"); + js_fprintf((FILE *)scgp->errfile, "s->SRB_Cmd = 0x%02x\n", s->SRB_Cmd); + js_fprintf((FILE *)scgp->errfile, "s->SRB_HaId = 0x%02x\n", s->SRB_HaId); + js_fprintf((FILE *)scgp->errfile, "s->SRB_Flags = 0x%02x\n", s->SRB_Flags); + js_fprintf((FILE *)scgp->errfile, "s->SRB_Target = 0x%02x\n", s->SRB_Target); + js_fprintf((FILE *)scgp->errfile, "s->SRB_Lun = 0x%02x\n", s->SRB_Lun); + js_fprintf((FILE *)scgp->errfile, "s->SRB_BufLen = 0x%02x\n", s->SRB_BufLen); + js_fprintf((FILE *)scgp->errfile, "s->SRB_BufPointer = %x\n", s->SRB_BufPointer); + js_fprintf((FILE *)scgp->errfile, "s->SRB_CDBLen = 0x%02x\n", s->SRB_CDBLen); + js_fprintf((FILE *)scgp->errfile, "s->SRB_SenseLen = 0x%02x\n", s->SRB_SenseLen); + js_fprintf((FILE *)scgp->errfile, "s->CDBByte ="); + for (i = 0; i < min(s->SRB_CDBLen, 16); i++) { + js_fprintf((FILE *)scgp->errfile, " %02X ", s->CDBByte[i]); + } + js_fprintf((FILE *)scgp->errfile, "\n"); + + /* + if (bDisplayBuffer != 0 && s->SRB_BufLen >= 8) { + + js_fprintf((FILE *)scgp->errfile, "s->SRB_BufPointer ="); + for (i = 0; i < 8; i++) { + js_fprintf((FILE *)scgp->errfile, + " %02X ", ((char *)s->SRB_BufPointer)[i]); + } + js_fprintf((FILE *)scgp->errfile, "\n"); + } +*/ + js_fprintf((FILE *)scgp->errfile, "Debug done\n"); +} +#endif + +LOCAL void +copy_sensedata(cp, sp) + SRB_ExecSCSICmd *cp; + struct scg_cmd *sp; +{ + sp->sense_count = cp->SRB_SenseLen; + if (sp->sense_count > sp->sense_len) + sp->sense_count = sp->sense_len; + + memset(&sp->u_sense.Sense, 0x00, sizeof (sp->u_sense.Sense)); + memcpy(&sp->u_sense.Sense, cp->SenseArea, sp->sense_count); + + sp->u_scb.cmd_scb[0] = cp->SRB_TargStat; +} + +/* + * Set error flags + */ +LOCAL void +set_error(cp, sp) + SRB_ExecSCSICmd *cp; + struct scg_cmd *sp; +{ + switch (cp->SRB_Status) { + + case SS_COMP: /* 0x01 SRB completed without error */ + sp->error = SCG_NO_ERROR; + sp->ux_errno = 0; + break; + + case SS_ERR: /* 0x04 SRB completed with error */ + /* + * If the SCSI Status byte is != 0, we definitely could send + * the command to the target. We signal NO transport error. + */ + sp->error = SCG_NO_ERROR; + sp->ux_errno = EIO; + if (cp->SRB_TargStat) + break; + + case SS_PENDING: /* 0x00 SRB being processed */ + /* + * XXX Could SS_PENDING happen ??? + */ + case SS_ABORTED: /* 0x02 SRB aborted */ + case SS_ABORT_FAIL: /* 0x03 Unable to abort SRB */ + default: + sp->error = SCG_RETRYABLE; + sp->ux_errno = EIO; + break; + + case SS_INVALID_CMD: /* 0x80 Invalid ASPI command */ + case SS_INVALID_HA: /* 0x81 Invalid host adapter number */ + case SS_NO_DEVICE: /* 0x82 SCSI device not installed */ + + case SS_INVALID_SRB: /* 0xE0 Invalid parameter set in SRB */ + case SS_ILLEGAL_MODE: /* 0xE2 Unsupported Windows mode */ + case SS_NO_ASPI: /* 0xE3 No ASPI managers */ + case SS_FAILED_INIT: /* 0xE4 ASPI for windows failed init */ + case SS_MISMATCHED_COMPONENTS: /* 0xE7 The DLLs/EXEs of ASPI don't */ + /* version check */ + case SS_NO_ADAPTERS: /* 0xE8 No host adapters to manager */ + + case SS_ASPI_IS_SHUTDOWN: /* 0xEA Call came to ASPI after */ + /* PROCESS_DETACH */ + case SS_BAD_INSTALL: /* 0xEB The DLL or other components */ + /* are installed wrong */ + sp->error = SCG_FATAL; + sp->ux_errno = EINVAL; + break; + +#ifdef XXX + case SS_OLD_MANAGER: /* 0xE1 ASPI manager doesn't support */ + /* windows */ +#endif + case SS_BUFFER_ALIGN: /* 0xE1 Buffer not aligned (replaces */ + /* SS_OLD_MANAGER in Win32) */ + sp->error = SCG_FATAL; + sp->ux_errno = EFAULT; + break; + + case SS_ASPI_IS_BUSY: /* 0xE5 No resources available to */ + /* execute command */ + sp->error = SCG_RETRYABLE; + sp->ux_errno = EBUSY; + break; + +#ifdef XXX + case SS_BUFFER_TO_BIG: /* 0xE6 Buffer size too big to handle*/ +#endif + case SS_BUFFER_TOO_BIG: /* 0xE6 Correct spelling of 'too' */ + case SS_INSUFFICIENT_RESOURCES: /* 0xE9 Couldn't allocate resources */ + /* needed to init */ + sp->error = SCG_RETRYABLE; + sp->ux_errno = ENOMEM; + break; + } +} + + +struct aspi_cmd { + SRB_ExecSCSICmd s; + char pad[32]; +}; + +LOCAL int +scgo_send(scgp) + SCSI *scgp; +{ + struct scg_cmd *sp = scgp->scmd; + DWORD Status = 0; + DWORD EventStatus = WAIT_OBJECT_0; + HANDLE Event = NULL; + struct aspi_cmd ac; + SRB_ExecSCSICmd *s; + + s = &ac.s; + + /* + * Check if ASPI library is loaded + */ + if (AspiLoaded <= 0) { + errmsgno(EX_BAD, "error in scgo_send: ASPI driver not loaded.\n"); + sp->error = SCG_FATAL; + return (0); + } + + if (scgp->fd < 0) { + sp->error = SCG_FATAL; + return (-1); + } + + /* + * Initialize variables + */ + sp->error = SCG_NO_ERROR; + sp->sense_count = 0; + sp->u_scb.cmd_scb[0] = 0; + sp->resid = 0; + + memset(&ac, 0, sizeof (ac)); /* Clear SRB structure */ + + /* + * Check cbd_len > the maximum command pakket that can be handled by ASPI + */ + if (sp->cdb_len > 16) { + sp->error = SCG_FATAL; + sp->ux_errno = EINVAL; + js_fprintf((FILE *)scgp->errfile, + "sp->cdb_len > sizeof (SRB_ExecSCSICmd.CDBByte). Fatal error in scgo_send, exiting...\n"); + return (-1); + } + /* + * copy cdrecord command into SRB + */ + movebytes(&sp->cdb, &(s->CDBByte), sp->cdb_len); + + Event = CreateEvent(NULL, TRUE, FALSE, NULL); + + /* + * Fill ASPI structure + */ + s->SRB_Cmd = SC_EXEC_SCSI_CMD; /* SCSI Command */ + s->SRB_HaId = scg_scsibus(scgp); /* Host adapter number */ + s->SRB_Flags = SRB_EVENT_NOTIFY; /* Flags */ + s->SRB_Target = scg_target(scgp); /* Target SCSI ID */ + s->SRB_Lun = scg_lun(scgp); /* Target SCSI LUN */ + s->SRB_BufLen = sp->size; /* # of bytes transferred */ + s->SRB_BufPointer = sp->addr; /* pointer to data buffer */ + s->SRB_CDBLen = sp->cdb_len; /* SCSI command length */ + s->SRB_PostProc = Event; /* Post proc event */ + if (bUsingSCSIPT) + s->SRB_SenseLen = SENSE_LEN_SPTI; /* Length of sense buffer, SPTI returns SenseInfoLength */ + else + s->SRB_SenseLen = SENSE_LEN; /* fixed length 14 for ASPI */ + /* + * Do we receive data from this ASPI command? + */ + if (sp->flags & SCG_RECV_DATA) { + + s->SRB_Flags |= SRB_DIR_IN; + } else { + /* + * Set direction to output + */ + if (sp->size > 0) { + s->SRB_Flags |= SRB_DIR_OUT; + } + } + +#ifdef DEBUG_WNTASPI + /* + * Dump some debug information when enabled + */ + DebugScsiSend(scgp, s, TRUE); +/* DebugScsiSend(scgp, s, (s->SRB_Flags&SRB_DIR_OUT) == SRB_DIR_OUT);*/ +#endif + + /* + * ------------ Send SCSI command -------------------------- + */ + + ResetEvent(Event); /* Clear event handle */ + if (bUsingSCSIPT) { +#ifdef _DEBUG_SCSIPT + scgp_errfile = (FILE *)scgp->errfile; +#endif + Status = SPTIExecSCSICommand(s, sp->timeout, FALSE); + } + else + Status = pfnSendASPI32Command((LPSRB)s); /* Initiate SCSI command */ + if (Status == SS_PENDING) { /* If in progress */ + /* + * Wait untill command completes, or times out. + */ + EventStatus = WaitForSingleObject(Event, sp->timeout*1000L); +/* EventStatus = WaitForSingleObject(Event, 10L);*/ + + if (EventStatus == WAIT_OBJECT_0) + ResetEvent(Event); /* Clear event, time out */ + + if (s->SRB_Status == SS_PENDING) { /* Check if we got a timeout */ + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "Timeout....\n"); + } + scsiabort(scgp, s); + ResetEvent(Event); /* Clear event, time out */ + CloseHandle(Event); /* Close the event handle */ + + sp->error = SCG_TIMEOUT; + return (1); /* Return error */ + } + } + CloseHandle(Event); /* Close the event handle */ + + /* + * Check ASPI command status + */ + if (s->SRB_Status != SS_COMP) { + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "Error in scgo_send: s->SRB_Status is 0x%x\n", s->SRB_Status); + } + + set_error(s, sp); /* Set error flags */ + copy_sensedata(s, sp); /* Copy sense and status */ + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "Mapped to: error %d errno: %d\n", sp->error, sp->ux_errno); + } + return (1); + } + + /* + * Return success + */ + return (0); +} + +/*************************************************************************** + * * + * BOOL open_driver() * + * * + * Opens the ASPI Router device driver and sets device_handle. * + * Returns: * + * TRUE - Success * + * FALSE - Unsuccessful opening of device driver * + * * + * Preconditions: ASPI Router driver has be loaded * + * * + ***************************************************************************/ +LOCAL BOOL +open_driver(scgp) + SCSI *scgp; +{ + DWORD astatus; + BYTE HACount; + BYTE ASPIStatus; + int i; + +#ifdef DEBUG_WNTASPI + js_fprintf((FILE *)scgp->errfile, "enter open_driver\n"); +#endif + + /* + * Check if ASPI library is already loaded yet + */ + if (AspiLoaded > 0) { + AspiLoaded++; + return (TRUE); + } + + /* + * Load the ASPI library or SPTI + */ +#ifdef _DEBUG_SCSIPT + scgp_errfile = (FILE *)scgp->errfile; +#endif +#ifdef PREFER_SPTI + if (bUsingSCSIPT) + if (InitSCSIPT() > 0) AspiLoaded++; +#endif +#ifdef PREFER_SPTI + if ((!bUsingSCSIPT || !bForceAccess) && AspiLoaded <= 0) { +#else + if (!bUsingSCSIPT || !bForceAccess) { +#endif + if (load_aspi(scgp)) { + AspiLoaded++; + bUsingSCSIPT = FALSE; + } + } + +#ifndef PREFER_SPTI + if ((bUsingSCSIPT || !bForceAccess) && AspiLoaded <= 0) + if (InitSCSIPT() > 0) + AspiLoaded++; +#endif /*PREFER_SPTI*/ + + if (AspiLoaded <= 0) { + if (bUsingSCSIPT) { + if (errno == 0) + errno = ENOSYS; + } + js_fprintf((FILE *)scgp->errfile, "Can not load %s driver! ", + bUsingSCSIPT ? "SPTI":"ASPI"); + return (FALSE); + } + + if (bUsingSCSIPT) { + if (scgp->debug > 0) + js_fprintf((FILE *)scgp->errfile, "using SPTI Transport\n"); + + if (!sptiglobal.numAdapters) + astatus = (DWORD)(MAKEWORD(0, SS_NO_ADAPTERS)); + else + astatus = (DWORD)(MAKEWORD(sptiglobal.numAdapters, SS_COMP)); + } else { + astatus = pfnGetASPI32SupportInfo(); + } + + ASPIStatus = HIBYTE(LOWORD(astatus)); + HACount = LOBYTE(LOWORD(astatus)); + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "open_driver %lX HostASPIStatus=0x%x HACount=0x%x\n", astatus, ASPIStatus, HACount); + } + + if (ASPIStatus != SS_COMP && ASPIStatus != SS_NO_ADAPTERS) { + js_fprintf((FILE *)scgp->errfile, "Could not find any host adapters\n"); + js_fprintf((FILE *)scgp->errfile, "ASPIStatus == 0x%02X", ASPIStatus); + return (FALSE); + } + busses = HACount; + +#ifdef DEBUG_WNTASPI + js_fprintf((FILE *)scgp->errfile, "open_driver HostASPIStatus=0x%x HACount=0x%x\n", ASPIStatus, HACount); + js_fprintf((FILE *)scgp->errfile, "leaving open_driver\n"); +#endif + + for (i = 0; i < busses; i++) { + SRB_HAInquiry s; + + ha_inquiry(scgp, i, &s); + } + + /* + * Indicate that library loaded/initialized properly + */ + return (TRUE); +} + +LOCAL BOOL +load_aspi(scgp) + SCSI *scgp; +{ +#ifdef __CYGWIN32__ + hAspiLib = dlopen("WNASPI32", RTLD_NOW); +#else + hAspiLib = LoadLibrary("WNASPI32"); +#endif + /* + * Check if ASPI library is loaded correctly + */ + if (hAspiLib == NULL) { +#ifdef not_done_later + js_fprintf((FILE *)scgp->errfile, "Can not load ASPI driver! "); +#endif + return (FALSE); + } + + /* + * Get a pointer to GetASPI32SupportInfo function + * and a pointer to SendASPI32Command function + */ +#ifdef __CYGWIN32__ + pfnGetASPI32SupportInfo = (DWORD(*)(void))dlsym(hAspiLib, "GetASPI32SupportInfo"); + pfnSendASPI32Command = (DWORD(*)(LPSRB))dlsym(hAspiLib, "SendASPI32Command"); +#else + pfnGetASPI32SupportInfo = (DWORD(*)(void))GetProcAddress(hAspiLib, "GetASPI32SupportInfo"); + pfnSendASPI32Command = (DWORD(*)(LPSRB))GetProcAddress(hAspiLib, "SendASPI32Command"); +#endif + + if ((pfnGetASPI32SupportInfo == NULL) || (pfnSendASPI32Command == NULL)) { + js_fprintf((FILE *)scgp->errfile, + "ASPI function not found in library! "); + return (FALSE); + } + + /* + * The following functions are currently not used by libscg. + * If we start to use them, we need to check whether the founctions + * could be found in the ASPI library that just has been loaded. + */ +#ifdef __CYGWIN32__ + pfnGetASPI32Buffer = (BOOL(*)(PASPI32BUFF))dlsym(hAspiLib, "GetASPI32Buffer"); + pfnFreeASPI32Buffer = (BOOL(*)(PASPI32BUFF))dlsym(hAspiLib, "FreeASPI32Buffer"); + pfnTranslateASPI32Address = (BOOL(*)(PDWORD, PDWORD))dlsym(hAspiLib, "TranslateASPI32Address"); +#else + pfnGetASPI32Buffer = (BOOL(*)(PASPI32BUFF))GetProcAddress(hAspiLib, "GetASPI32Buffer"); + pfnFreeASPI32Buffer = (BOOL(*)(PASPI32BUFF))GetProcAddress(hAspiLib, "FreeASPI32Buffer"); + pfnTranslateASPI32Address = (BOOL(*)(PDWORD, PDWORD))GetProcAddress(hAspiLib, "TranslateASPI32Address"); +#endif + return (TRUE); +} + +/*************************************************************************** + * * + * BOOL close_driver() * + * * + * Closes the device driver * + * Returns: * + * TRUE - Success * + * FALSE - Unsuccessful closing of device driver * + * * + * Preconditions: ASPI Router driver has be opened with open_driver * + * * + ***************************************************************************/ +LOCAL BOOL +close_driver() +{ + if (--AspiLoaded > 0) + return (TRUE); + /* + * If library is loaded + */ + DeinitSCSIPT(); + /* + * Clear all variables + */ + if (hAspiLib) { + pfnGetASPI32SupportInfo = NULL; + pfnSendASPI32Command = NULL; + pfnGetASPI32Buffer = NULL; + pfnFreeASPI32Buffer = NULL; + pfnTranslateASPI32Address = NULL; + + /* + * Free ASPI library, we do not need it any longer + */ +#ifdef __CYGWIN32__ + dlclose(hAspiLib); +#else + FreeLibrary(hAspiLib); +#endif + hAspiLib = NULL; + } + + /* + * Indicate that shutdown has been finished properly + */ + return (TRUE); +} + +LOCAL int +ha_inquiry(scgp, id, ip) + SCSI *scgp; + int id; + SRB_HAInquiry *ip; +{ + DWORD Status; + + ip->SRB_Cmd = SC_HA_INQUIRY; + ip->SRB_HaId = id; + ip->SRB_Flags = 0; + ip->SRB_Hdr_Rsvd = 0; + + if (bUsingSCSIPT) + Status = SPTIHandleHaInquiry(ip); + else + Status = pfnSendASPI32Command((LPSRB)ip); + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, "Status : %ld\n", Status); + js_fprintf((FILE *)scgp->errfile, "hacount: %d\n", ip->HA_Count); + js_fprintf((FILE *)scgp->errfile, "SCSI id: %d\n", ip->HA_SCSI_ID); + js_fprintf((FILE *)scgp->errfile, "Manager: '%.16s'\n", ip->HA_ManagerId); + js_fprintf((FILE *)scgp->errfile, "Identif: '%.16s'\n", ip->HA_Identifier); + scg_prbytes("Unique:", ip->HA_Unique, 16); + } + if (ip->SRB_Status != SS_COMP) + return (-1); + return (0); +} + +#ifdef __USED__ +LOCAL int +resetSCSIBus(scgp) + SCSI *scgp; +{ + DWORD Status; + HANDLE Event; + SRB_BusDeviceReset s; + + if (bUsingSCSIPT) { + js_fprintf((FILE *)scgp->errfile, + "Reset SCSI bus not implemented with SPTI\n"); + return (FALSE); + } + + js_fprintf((FILE *)scgp->errfile, "Attempting to reset SCSI bus\n"); + + Event = CreateEvent(NULL, TRUE, FALSE, NULL); + + memset(&s, 0, sizeof (s)); /* Clear SRB_BesDeviceReset structure */ + + /* + * Set structure variables + */ + s.SRB_Cmd = SC_RESET_DEV; + s.SRB_PostProc = (LPVOID)Event; + + /* + * Clear event + */ + ResetEvent(Event); + + /* + * Initiate SCSI command + */ + Status = pfnSendASPI32Command((LPSRB)&s); + + /* + * Check status + */ + if (Status == SS_PENDING) { + /* + * Wait till command completes + */ + WaitForSingleObject(Event, INFINITE); + } + + /* + * Close the event handle + */ + CloseHandle(Event); + + /* + * Check condition + */ + if (s.SRB_Status != SS_COMP) { + js_fprintf((FILE *)scgp->errfile, "ERROR 0x%08X\n", s.SRB_Status); + + /* + * Indicate that error has occured + */ + return (FALSE); + } + + /* + * Everything went OK + */ + return (TRUE); +} +#endif /* __USED__ */ + +LOCAL int +scsiabort(scgp, sp) + SCSI *scgp; + SRB_ExecSCSICmd *sp; +{ + DWORD Status = 0; + SRB_Abort s; + + if (bUsingSCSIPT) { + js_fprintf((FILE *)scgp->errfile, + "Abort SCSI not implemented with SPTI\n"); + return (FALSE); + } + + if (scgp->debug > 0) { + js_fprintf((FILE *)scgp->errfile, + "Attempting to abort SCSI command\n"); + } + + /* + * Check if ASPI library is loaded + */ + if (AspiLoaded <= 0) { + js_fprintf((FILE *)scgp->errfile, + "error in scsiabort: ASPI driver not loaded !\n"); + return (FALSE); + } + + /* + * Set structure variables + */ + s.SRB_Cmd = SC_ABORT_SRB; /* ASPI command code = SC_ABORT_SRB */ + s.SRB_HaId = scg_scsibus(scgp); /* ASPI host adapter number */ + s.SRB_Flags = 0; /* Flags */ + s.SRB_ToAbort = (LPSRB)&sp; /* sp */ + + /* + * Initiate SCSI abort + */ + Status = pfnSendASPI32Command((LPSRB)&s); + + /* + * Check condition + */ + if (s.SRB_Status != SS_COMP) { + js_fprintf((FILE *)scgp->errfile, "Abort ERROR! 0x%08X\n", s.SRB_Status); + + /* + * Indicate that error has occured + */ + return (FALSE); + } + + if (scgp->debug > 0) + js_fprintf((FILE *)scgp->errfile, "Abort SCSI command completed\n"); + + /* + * Everything went OK + */ + return (TRUE); +} diff --git a/scsilib/libscg/scsierrs.c b/scsilib/libscg/scsierrs.c new file mode 100644 index 0000000..9be6f9f --- /dev/null +++ b/scsilib/libscg/scsierrs.c @@ -0,0 +1,1009 @@ +/* @(#)scsierrs.c 2.29 04/06/17 Copyright 1987-1996 J. Schilling */ +#ifndef lint +static char sccsid[] = + "@(#)scsierrs.c 2.29 04/06/17 Copyright 1987-1996 J. Schilling"; +#endif +/* + * Error printing for scsitransp.c + * + * Copyright (c) 1987-1996 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> + +#include <stdio.h> +#include <unixstd.h> /* for sys/types.h needed in schily.h for sprintf() */ +#include <standard.h> +#include <schily.h> + +#include <scg/scsireg.h> +#include <scg/scsidefs.h> +#include <scg/scgcmd.h> /*XXX JS wird eigentlich nicht benoetigt!! */ + /*XXX JS kommt weg, wenn struct sense und status */ + /*XXX JS von scgio.h nach scsireg.h kommen */ +#include <scg/scsitransp.h> + +#define CTYPE_CCS 0 +#define CTYPE_MD21 1 +#define CTYPE_ACB4000 2 +#define CTYPE_SMO_C501 3 + +#define SMO_C501 + +EXPORT const char *scg_sensemsg __PR((int, int, int, + const char **, char *, int maxcnt)); +EXPORT int scg__errmsg __PR((SCSI *scgp, char *obuf, int maxcnt, + struct scsi_sense *, + struct scsi_status *, + int)); +/* + * Map old non extended sense to sense key. + */ +static Uchar sd_adaptec_keys[] = { + 0, 4, 4, 4, 2, 2, 4, 4, /* 0x00-0x07 */ + 4, 4, 4, 4, 4, 4, 4, 4, /* 0x08-0x0f */ + 4, 3, 3, 3, 3, 4, 3, 1, /* 0x10-0x17 */ + 1, 1, 3, 4, 3, 4, 3, 3, /* 0x18-0x1f */ + 5, 5, 5, 5, 5, 5, 5, 7, /* 0x20-0x27 */ + 6, 6, 6, 5, 4,11,11,11 /* 0x28-0x2f */ +}; +#define MAX_ADAPTEC_KEYS (sizeof (sd_adaptec_keys)) + +/* + * Deviations to CCS found on old pre CCS devices + */ +static const char *sd_adaptec_error_str[] = { + "\031\000ECC error during verify", /* 0x19 */ + "\032\000interleave error", /* 0x1a */ + "\034\000bad format on drive", /* 0x1c */ + "\035\000self test failed", /* 0x1d */ + "\036\000defective track", /* 0x1e */ + "\043\000volume overflow", /* 0x23 */ + "\053\000set limit violation", /* 0x2b */ + "\054\000error counter overflow", /* 0x2c */ + "\055\000initiator detected error", /* 0x2d */ + "\056\000scsi parity error", /* 0x2e */ + "\057\000adapter parity error", /* 0x2f */ + NULL +}; + +/* + * The sense codes of SCSI-1/CCS, SCSI-2 and SCSI-3 devices. + */ +static const char *sd_ccs_error_str[] = { + "\000\000no additional sense information", /* 00 00 */ + "\000\001filemark detected", /* 00 01 */ + "\000\002end-of-partition/medium detected", /* 00 02 */ + "\000\003setmark detected", /* 00 03 */ + "\000\004beginning-of-partition/medium detected", /* 00 04 */ + "\000\005end-of-data detected", /* 00 05 */ + "\000\006i/o process terminated", /* 00 06 */ + "\000\021audio play operation in progress", /* 00 11 */ + "\000\022audio play operation paused", /* 00 12 */ + "\000\023audio play operation successfully completed", /* 00 13 */ + "\000\024audio play operation stopped due to error", /* 00 14 */ + "\000\025no current audio status to return", /* 00 15 */ + "\000\026operation in progress", /* 00 16 */ + "\000\027cleaning requested", /* 00 17 */ + "\001\000no index/sector signal", /* 01 00 */ + "\002\000no seek complete", /* 02 00 */ + "\003\000peripheral device write fault", /* 03 00 */ + "\003\001no write current", /* 03 01 */ + "\003\002excessive write errors", /* 03 02 */ + "\004\000logical unit not ready, cause not reportable", /* 04 00 */ + "\004\001logical unit is in process of becoming ready", /* 04 01 */ + "\004\002logical unit not ready, initializing cmd. required", /* 04 02 */ + "\004\003logical unit not ready, manual intervention required", /* 04 03 */ + "\004\004logical unit not ready, format in progress", /* 04 04 */ + "\004\005logical unit not ready, rebuild in progress", /* 04 05 */ + "\004\006logical unit not ready, recalculation in progress", /* 04 06 */ + "\004\007logical unit not ready, operation in progress",/* 04 07 */ + "\004\010logical unit not ready, long write in progress", /* 04 08 */ + "\004\011logical unit not ready, self-test in progress",/* 04 09 */ + "\004\012asymmetric access code 3 (00-232) [proposed]", /* 04 0A */ + "\004\013asymmetric access code 1 (00-232) [proposed]", /* 04 0B */ + "\004\014asymmetric access code 2 (00-232) [proposed]", /* 04 0C */ + "\004\020auxiliary memory code 2 (99-148) [proposed]", /* 04 10 */ + "\005\000logical unit does not respond to selection", /* 05 00 */ + "\006\000no reference position found", /* 06 00 */ + "\007\000multiple peripheral devices selected", /* 07 00 */ + "\010\000logical unit communication failure", /* 08 00 */ + "\010\001logical unit communication time-out", /* 08 01 */ + "\010\002logical unit communication parity error", /* 08 02 */ + "\010\003logical unit communication crc error (ultra-dma/32)", /* 08 03 */ + "\010\004unreachable copy target", /* 08 04 */ + "\011\000track following error", /* 09 00 */ + "\011\001tracking servo failure", /* 09 01 */ + "\011\002focus servo failure", /* 09 02 */ + "\011\003spindle servo failure", /* 09 03 */ + "\011\004head select fault", /* 09 04 */ + "\012\000error log overflow", /* 0A 00 */ + "\013\000warning", /* 0B 00 */ + "\013\001warning - specified temperature exceeded", /* 0B 01 */ + "\013\002warning - enclosure degraded", /* 0B 02 */ + "\014\000write error", /* 0C 00 */ + "\014\001write error - recovered with auto reallocation", /* 0C 01 */ + "\014\002write error - auto reallocation failed", /* 0C 02 */ + "\014\003write error - recommend reassignment", /* 0C 03 */ + "\014\004compression check miscompare error", /* 0C 04 */ + "\014\005data expansion occurred during compression", /* 0C 05 */ + "\014\006block not compressible", /* 0C 06 */ + "\014\007write error - recovery needed", /* 0C 07 */ + "\014\010write error - recovery failed", /* 0C 08 */ + "\014\011write error - loss of streaming", /* 0C 09 */ + "\014\012write error - padding blocks added", /* 0C 0A */ + "\014\013auxiliary memory code 4 (99-148) [proposed]", /* 0C 0B */ + "\015\000error detected by third party temporary initiator", /* 0D 00 */ + "\015\001third party device failure", /* 0D 01 */ + "\015\002copy target device not reachable", /* 0D 02 */ + "\015\003incorrect copy target device type", /* 0D 03 */ + "\015\004copy target device data underrun", /* 0D 04 */ + "\015\005copy target device data overrun", /* 0D 05 */ +#ifdef __used__ + "\016\000", /* 0E 00 */ + "\017\000", /* 0F 00 */ +#endif + "\020\000id crc or ecc error", /* 10 00 */ + "\021\000unrecovered read error", /* 11 00 */ + "\021\001read retries exhausted", /* 11 01 */ + "\021\002error too long to correct", /* 11 02 */ + "\021\003multiple read errors", /* 11 03 */ + "\021\004unrecovered read error - auto reallocate failed", /* 11 04 */ + "\021\005l-ec uncorrectable error", /* 11 05 */ + "\021\006circ unrecovered error", /* 11 06 */ + "\021\007data re-synchronization error", /* 11 07 */ + "\021\010incomplete block read", /* 11 08 */ + "\021\011no gap found", /* 11 09 */ + "\021\012miscorrected error", /* 11 0A */ + "\021\013unrecovered read error - recommend reassignment", /* 11 0B */ + "\021\014unrecovered read error - recommend rewrite the data", /* 11 0C */ + "\021\015de-compression crc error", /* 11 0D */ + "\021\016cannot decompress using declared algorithm", /* 11 0E */ + "\021\017error reading upc/ean number", /* 11 0F */ + "\021\020error reading isrc number", /* 11 10 */ + "\021\021read error - loss of streaming", /* 11 11 */ + "\021\022auxiliary memory code 3 (99-148) [proposed]", /* 11 12 */ + "\022\000address mark not found for id field", /* 12 00 */ + "\023\000address mark not found for data field", /* 13 00 */ + "\024\000recorded entity not found", /* 14 00 */ + "\024\001record not found", /* 14 01 */ + "\024\002filemark or setmark not found", /* 14 02 */ + "\024\003end-of-data not found", /* 14 03 */ + "\024\004block sequence error", /* 14 04 */ + "\024\005record not found - recommend reassignment", /* 14 05 */ + "\024\006record not found - data auto-reallocated", /* 14 06 */ + "\025\000random positioning error", /* 15 00 */ + "\025\001mechanical positioning error", /* 15 01 */ + "\025\002positioning error detected by read of medium", /* 15 02 */ + "\026\000data synchronization mark error", /* 16 00 */ + "\026\001data sync error - data rewritten", /* 16 01 */ + "\026\002data sync error - recommend rewrite", /* 16 02 */ + "\026\003data sync error - data auto-reallocated", /* 16 03 */ + "\026\004data sync error - recommend reassignment", /* 16 04 */ + "\027\000recovered data with no error correction applied", /* 17 00 */ + "\027\001recovered data with retries", /* 17 01 */ + "\027\002recovered data with positive head offset", /* 17 02 */ + "\027\003recovered data with negative head offset", /* 17 03 */ + "\027\004recovered data with retries and/or circ applied", /* 17 04 */ + "\027\005recovered data using previous sector id", /* 17 05 */ + "\027\006recovered data without ecc - data auto-reallocated", /* 17 06 */ + "\027\007recovered data without ecc - recommend reassignment", /* 17 07 */ + "\027\010recovered data without ecc - recommend rewrite", /* 17 08 */ + "\027\011recovered data without ecc - data rewritten", /* 17 09 */ + "\030\000recovered data with error correction applied", /* 18 00 */ + "\030\001recovered data with error corr. & retries applied", /* 18 01 */ + "\030\002recovered data - data auto-reallocated", /* 18 02 */ + "\030\003recovered data with circ", /* 18 03 */ + "\030\004recovered data with l-ec", /* 18 04 */ + "\030\005recovered data - recommend reassignment", /* 18 05 */ + "\030\006recovered data - recommend rewrite", /* 18 06 */ + "\030\007recovered data with ecc - data rewritten", /* 18 07 */ + "\030\010recovered data with linking", /* 18 08 */ + "\031\000defect list error", /* 19 00 */ + "\031\001defect list not available", /* 19 01 */ + "\031\002defect list error in primary list", /* 19 02 */ + "\031\003defect list error in grown list", /* 19 03 */ + "\032\000parameter list length error", /* 1A 00 */ + "\033\000synchronous data transfer error", /* 1B 00 */ + "\034\000defect list not found", /* 1C 00 */ + "\034\001primary defect list not found", /* 1C 01 */ + "\034\002grown defect list not found", /* 1C 02 */ + "\035\000miscompare during verify operation", /* 1D 00 */ + "\036\000recovered id with ecc correction", /* 1E 00 */ + "\037\000partial defect list transfer", /* 1F 00 */ + "\040\000invalid command operation code", /* 20 00 */ + "\040\001access controls code 1 (99-314) [proposed]", /* 20 01 */ + "\040\002access controls code 2 (99-314) [proposed]", /* 20 02 */ + "\040\003access controls code 3 (99-314) [proposed]", /* 20 03 */ + "\040\004read type operation while in write capable state", /* 20 04 */ + "\040\005write type operation while in read capable state", /* 20 05 */ + "\040\006illegal command while in explicit address model", /* 20 06 */ + "\040\007illegal command while in implicit address model", /* 20 07 */ + "\040\010access controls code 5 (99-245) [proposed]", /* 20 08 */ + "\040\011access controls code 6 (99-245) [proposed]", /* 20 09 */ + "\040\012access controls code 7 (99-245) [proposed]", /* 20 0A */ + "\040\013access controls code 8 (99-245) [proposed]", /* 20 0B */ + "\041\000logical block address out of range", /* 21 00 */ + "\041\001invalid element address", /* 21 01 */ + "\041\002invalid address for write", /* 21 02 */ + "\042\000illegal function (use 20 00, 24 00, or 26 00)",/* 22 00 */ +#ifdef __used__ + "\043\000", /* 23 00 */ +#endif + "\044\000invalid field in cdb", /* 24 00 */ + "\044\001cdb decryption error", /* 24 01 */ + "\044\002invalid cdb field while in explicit block address model", /* 24 02 */ + "\044\003invalid cdb field while in implicit block address model", /* 24 03 */ + "\045\000logical unit not supported", /* 25 00 */ + "\046\000invalid field in parameter list", /* 26 00 */ + "\046\001parameter not supported", /* 26 01 */ + "\046\002parameter value invalid", /* 26 02 */ + "\046\003threshold parameters not supported", /* 26 03 */ + "\046\004invalid release of persistent reservation", /* 26 04 */ + "\046\005data decryption error", /* 26 05 */ + "\046\006too many target descriptors", /* 26 06 */ + "\046\007unsupported target descriptor type code", /* 26 07 */ + "\046\010too many segment descriptors", /* 26 08 */ + "\046\011unsupported segment descriptor type code", /* 26 09 */ + "\046\012unexpected inexact segment", /* 26 0A */ + "\046\013inline data length exceeded", /* 26 0B */ + "\046\014invalid operation for copy source or destination", /* 26 0C */ + "\046\015copy segment granularity violation", /* 26 0D */ + "\047\000write protected", /* 27 00 */ + "\047\001hardware write protected", /* 27 01 */ + "\047\002logical unit software write protected", /* 27 02 */ + "\047\003associated write protect", /* 27 03 */ + "\047\004persistent write protect", /* 27 04 */ + "\047\005permanent write protect", /* 27 05 */ + "\047\006conditional write protect", /* 27 06 */ + "\050\000not ready to ready change, medium may have changed", /* 28 00 */ + "\050\001import or export element accessed", /* 28 01 */ + "\051\000power on, reset, or bus device reset occurred",/* 29 00 */ + "\051\001power on occurred", /* 29 01 */ + "\051\002scsi bus reset occurred", /* 29 02 */ + "\051\003bus device reset function occurred", /* 29 03 */ + "\051\004device internal reset", /* 29 04 */ + "\051\005transceiver mode changed to single-ended", /* 29 05 */ + "\051\006transceiver mode changed to lvd", /* 29 06 */ + "\052\000parameters changed", /* 2A 00 */ + "\052\001mode parameters changed", /* 2A 01 */ + "\052\002log parameters changed", /* 2A 02 */ + "\052\003reservations preempted", /* 2A 03 */ + "\052\004reservations released", /* 2A 04 */ + "\052\005registrations preempted", /* 2A 05 */ + "\052\006asymmetric access code 6 (00-232) [proposed]", /* 2A 06 */ + "\052\007asymmetric access code 7 (00-232) [proposed]", /* 2A 07 */ + "\053\000copy cannot execute since host cannot disconnect", /* 2B 00 */ + "\054\000command sequence error", /* 2C 00 */ + "\054\001too many windows specified", /* 2C 01 */ + "\054\002invalid combination of windows specified", /* 2C 02 */ + "\054\003current program area is not empty", /* 2C 03 */ + "\054\004current program area is empty", /* 2C 04 */ + "\054\005illegal power condition request", /* 2C 05 */ + "\054\006persistent prevent conflict", /* 2C 06 */ + "\055\000overwrite error on update in place", /* 2D 00 */ + "\056\000insufficient time for operation", /* 2E 00 */ + "\057\000commands cleared by another initiator", /* 2F 00 */ + "\060\000incompatible medium installed", /* 30 00 */ + "\060\001cannot read medium - unknown format", /* 30 01 */ + "\060\002cannot read medium - incompatible format", /* 30 02 */ + "\060\003cleaning cartridge installed", /* 30 03 */ + "\060\004cannot write medium - unknown format", /* 30 04 */ + "\060\005cannot write medium - incompatible format", /* 30 05 */ + "\060\006cannot format medium - incompatible medium", /* 30 06 */ + "\060\007cleaning failure", /* 30 07 */ + "\060\010cannot write - application code mismatch", /* 30 08 */ + "\060\011current session not fixated for append", /* 30 09 */ + "\060\020medium not formatted", /* 30 10 */ + "\061\000medium format corrupted", /* 31 00 */ + "\061\001format command failed", /* 31 01 */ + "\061\002zoned formatting failed due to spare linking", /* 31 02 */ + "\062\000no defect spare location available", /* 32 00 */ + "\062\001defect list update failure", /* 32 01 */ + "\063\000tape length error", /* 33 00 */ + "\064\000enclosure failure", /* 34 00 */ + "\065\000enclosure services failure", /* 35 00 */ + "\065\001unsupported enclosure function", /* 35 01 */ + "\065\002enclosure services unavailable", /* 35 02 */ + "\065\003enclosure services transfer failure", /* 35 03 */ + "\065\004enclosure services transfer refused", /* 35 04 */ + "\066\000ribbon, ink, or toner failure", /* 36 00 */ + "\067\000rounded parameter", /* 37 00 */ + "\070\000event status notification", /* 38 00 */ + "\070\002esn - power management class event", /* 38 02 */ + "\070\004esn - media class event", /* 38 04 */ + "\070\006esn - device busy class event", /* 38 06 */ + "\071\000saving parameters not supported", /* 39 00 */ + "\072\000medium not present", /* 3A 00 */ + "\072\001medium not present - tray closed", /* 3A 01 */ + "\072\002medium not present - tray open", /* 3A 02 */ + "\072\003medium not present - loadable", /* 3A 03 */ + "\072\004medium not present - medium auxiliary memory accessible", /* 3A 04 */ + "\073\000sequential positioning error", /* 3B 00 */ + "\073\001tape position error at beginning-of-medium", /* 3B 01 */ + "\073\002tape position error at end-of-medium", /* 3B 02 */ + "\073\003tape or electronic vertical forms unit not ready", /* 3B 03 */ + "\073\004slew failure", /* 3B 04 */ + "\073\005paper jam", /* 3B 05 */ + "\073\006failed to sense top-of-form", /* 3B 06 */ + "\073\007failed to sense bottom-of-form", /* 3B 07 */ + "\073\010reposition error", /* 3B 08 */ + "\073\011read past end of medium", /* 3B 09 */ + "\073\012read past beginning of medium", /* 3B 0A */ + "\073\013position past end of medium", /* 3B 0B */ + "\073\014position past beginning of medium", /* 3B 0C */ + "\073\015medium destination element full", /* 3B 0D */ + "\073\016medium source element empty", /* 3B 0E */ + "\073\017end of medium reached", /* 3B 0F */ + "\073\021medium magazine not accessible", /* 3B 11 */ + "\073\022medium magazine removed", /* 3B 12 */ + "\073\023medium magazine inserted", /* 3B 13 */ + "\073\024medium magazine locked", /* 3B 14 */ + "\073\025medium magazine unlocked", /* 3B 15 */ + "\073\026mechanical positioning or changer error", /* 3B 16 */ +#ifdef __used__ + "\074\000", /* 3C 00 */ +#endif + "\075\000invalid bits in identify message", /* 3D 00 */ + "\076\000logical unit has not self-configured yet", /* 3E 00 */ + "\076\001logical unit failure", /* 3E 01 */ + "\076\002timeout on logical unit", /* 3E 02 */ + "\076\003logical unit failed self-test", /* 3E 03 */ + "\076\004logical unit unable to update self-test log", /* 3E 04 */ + "\077\000target operating conditions have changed", /* 3F 00 */ + "\077\001microcode has been changed", /* 3F 01 */ + "\077\002changed operating definition", /* 3F 02 */ + "\077\003inquiry data has changed", /* 3F 03 */ + "\077\004component device attached", /* 3F 04 */ + "\077\005device identifier changed", /* 3F 05 */ + "\077\006redundancy group created or modified", /* 3F 06 */ + "\077\007redundancy group deleted", /* 3F 07 */ + "\077\010spare created or modified", /* 3F 08 */ + "\077\011spare deleted", /* 3F 09 */ + "\077\012volume set created or modified", /* 3F 0A */ + "\077\013volume set deleted", /* 3F 0B */ + "\077\014volume set deassigned", /* 3F 0C */ + "\077\015volume set reassigned", /* 3F 0D */ + "\077\016reported luns data has changed", /* 3F 0E */ + "\077\017echo buffer overwritten", /* 3F 0F */ + "\077\020medium loadable", /* 3F 10 */ + "\077\021medium auxiliary memory accessible", /* 3F 11 */ + "\100\000ram failure (should use 40 nn)", /* 40 00 */ +#ifdef XXX + "\100\000nn diagnostic failure on component nn (80h-ffh)", /* 40 00 */ +#endif + "\100\000diagnostic failure on component nn (80h-ffh)", /* 40 00 */ + "\101\000data path failure (should use 40 nn)", /* 41 00 */ + "\102\000power-on or self-test failure (should use 40 nn)", /* 42 00 */ + "\103\000message error", /* 43 00 */ + "\104\000internal target failure", /* 44 00 */ + "\105\000select or reselect failure", /* 45 00 */ + "\106\000unsuccessful soft reset", /* 46 00 */ + "\107\000scsi parity error", /* 47 00 */ + "\107\001data phase crc error detected", /* 47 01 */ + "\107\002scsi parity error detected during st data phase", /* 47 02 */ + "\107\003information unit crc error detected", /* 47 03 */ + "\107\004asynchronous information protection error detected", /* 47 04 */ + "\110\000initiator detected error message received", /* 48 00 */ + "\111\000invalid message error", /* 49 00 */ + "\112\000command phase error", /* 4A 00 */ + "\113\000data phase error", /* 4B 00 */ + "\114\000logical unit failed self-configuration", /* 4C 00 */ +#ifdef XXX + "\115\000nn tagged overlapped commands (nn = queue tag)", /* 4D 00 */ +#endif + "\115\000tagged overlapped commands (nn = queue tag)", /* 4D 00 */ + "\116\000overlapped commands attempted", /* 4E 00 */ +#ifdef __used__ + "\117\000", /* 4F 00 */ +#endif + "\120\000write append error", /* 50 00 */ + "\120\001write append position error", /* 50 01 */ + "\120\002position error related to timing", /* 50 02 */ + "\121\000erase failure", /* 51 00 */ + "\121\001erase failure - incomplete erase operation detected", /* 51 01 */ + "\122\000cartridge fault", /* 52 00 */ + "\123\000media load or eject failed", /* 53 00 */ + "\123\001unload tape failure", /* 53 01 */ + "\123\002medium removal prevented", /* 53 02 */ + "\124\000scsi to host system interface failure", /* 54 00 */ + "\125\000system resource failure", /* 55 00 */ + "\125\001system buffer full", /* 55 01 */ + "\125\002insufficient reservation resources", /* 55 02 */ + "\125\003insufficient resources", /* 55 03 */ + "\125\004insufficient registration resources", /* 55 04 */ + "\125\005access controls code 4 (99-314) [proposed]", /* 55 05 */ + "\125\006auxiliary memory code 1 (99-148) [proposed]", /* 55 06 */ +#ifdef __used__ + "\126\000", /* 56 00 */ +#endif + "\127\000unable to recover table-of-contents", /* 57 00 */ + "\130\000generation does not exist", /* 58 00 */ + "\131\000updated block read", /* 59 00 */ + "\132\000operator request or state change input", /* 5A 00 */ + "\132\001operator medium removal request", /* 5A 01 */ + "\132\002operator selected write protect", /* 5A 02 */ + "\132\003operator selected write permit", /* 5A 03 */ + "\133\000log exception", /* 5B 00 */ + "\133\001threshold condition met", /* 5B 01 */ + "\133\002log counter at maximum", /* 5B 02 */ + "\133\003log list codes exhausted", /* 5B 03 */ + "\134\000rpl status change", /* 5C 00 */ + "\134\001spindles synchronized", /* 5C 01 */ + "\134\002spindles not synchronized", /* 5C 02 */ + "\135\000failure prediction threshold exceeded", /* 5D 00 */ + "\135\001media failure prediction threshold exceeded", /* 5D 01 */ + "\135\002logical unit failure prediction threshold exceeded", /* 5D 02 */ + "\135\003spare area exhaustion prediction threshold exceeded", /* 5D 03 */ + "\135\020hardware impending failure general hard drive failure",/* 5D 10 */ + "\135\021hardware impending failure drive error rate too high", /* 5D 11 */ + "\135\022hardware impending failure data error rate too high", /* 5D 12 */ + "\135\023hardware impending failure seek error rate too high", /* 5D 13 */ + "\135\024hardware impending failure too many block reassigns", /* 5D 14 */ + "\135\025hardware impending failure access times too high", /* 5D 15 */ + "\135\026hardware impending failure start unit times too high", /* 5D 16 */ + "\135\027hardware impending failure channel parametrics",/* 5D 17 */ + "\135\030hardware impending failure controller detected",/* 5D 18 */ + "\135\031hardware impending failure throughput performance", /* 5D 19 */ + "\135\032hardware impending failure seek time performance", /* 5D 1A */ + "\135\033hardware impending failure spin-up retry count", /* 5D 1B */ + "\135\034hardware impending failure drive calibration retry count", /* 5D 1C */ + "\135\040controller impending failure general hard drive failure", /* 5D 20 */ + "\135\041controller impending failure drive error rate too high", /* 5D 21 */ + "\135\042controller impending failure data error rate too high",/* 5D 22 */ + "\135\043controller impending failure seek error rate too high",/* 5D 23 */ + "\135\044controller impending failure too many block reassigns",/* 5D 24 */ + "\135\045controller impending failure access times too high", /* 5D 25 */ + "\135\046controller impending failure start unit times too high", /* 5D 26 */ + "\135\047controller impending failure channel parametrics", /* 5D 27 */ + "\135\050controller impending failure controller detected", /* 5D 28 */ + "\135\051controller impending failure throughput performance", /* 5D 29 */ + "\135\052controller impending failure seek time performance", /* 5D 2A */ + "\135\053controller impending failure spin-up retry count", /* 5D 2B */ + "\135\054controller impending failure drive calibration retry count", /* 5D 2C */ + "\135\060data channel impending failure general hard drive failure", /* 5D 30 */ + "\135\061data channel impending failure drive error rate too high", /* 5D 31 */ + "\135\062data channel impending failure data error rate too high", /* 5D 32 */ + "\135\063data channel impending failure seek error rate too high", /* 5D 33 */ + "\135\064data channel impending failure too many block reassigns", /* 5D 34 */ + "\135\065data channel impending failure access times too high", /* 5D 35 */ + "\135\066data channel impending failure start unit times too high", /* 5D 36 */ + "\135\067data channel impending failure channel parametrics", /* 5D 37 */ + "\135\070data channel impending failure controller detected", /* 5D 38 */ + "\135\071data channel impending failure throughput performance",/* 5D 39 */ + "\135\072data channel impending failure seek time performance", /* 5D 3A */ + "\135\073data channel impending failure spin-up retry count", /* 5D 3B */ + "\135\074data channel impending failure drive calibration retry count", /* 5D 3C */ + "\135\100servo impending failure general hard drive failure", /* 5D 40 */ + "\135\101servo impending failure drive error rate too high", /* 5D 41 */ + "\135\102servo impending failure data error rate too high", /* 5D 42 */ + "\135\103servo impending failure seek error rate too high", /* 5D 43 */ + "\135\104servo impending failure too many block reassigns", /* 5D 44 */ + "\135\105servo impending failure access times too high",/* 5D 45 */ + "\135\106servo impending failure start unit times too high", /* 5D 46 */ + "\135\107servo impending failure channel parametrics", /* 5D 47 */ + "\135\110servo impending failure controller detected", /* 5D 48 */ + "\135\111servo impending failure throughput performance", /* 5D 49 */ + "\135\112servo impending failure seek time performance",/* 5D 4A */ + "\135\113servo impending failure spin-up retry count", /* 5D 4B */ + "\135\114servo impending failure drive calibration retry count",/* 5D 4C */ + "\135\120spindle impending failure general hard drive failure", /* 5D 50 */ + "\135\121spindle impending failure drive error rate too high", /* 5D 51 */ + "\135\122spindle impending failure data error rate too high", /* 5D 52 */ + "\135\123spindle impending failure seek error rate too high", /* 5D 53 */ + "\135\124spindle impending failure too many block reassigns", /* 5D 54 */ + "\135\125spindle impending failure access times too high", /* 5D 55 */ + "\135\126spindle impending failure start unit times too high", /* 5D 56 */ + "\135\127spindle impending failure channel parametrics",/* 5D 57 */ + "\135\130spindle impending failure controller detected",/* 5D 58 */ + "\135\131spindle impending failure throughput performance", /* 5D 59 */ + "\135\132spindle impending failure seek time performance", /* 5D 5A */ + "\135\133spindle impending failure spin-up retry count",/* 5D 5B */ + "\135\134spindle impending failure drive calibration retry count", /* 5D 5C */ + "\135\140firmware impending failure general hard drive failure",/* 5D 60 */ + "\135\141firmware impending failure drive error rate too high", /* 5D 61 */ + "\135\142firmware impending failure data error rate too high", /* 5D 62 */ + "\135\143firmware impending failure seek error rate too high", /* 5D 63 */ + "\135\144firmware impending failure too many block reassigns", /* 5D 64 */ + "\135\145firmware impending failure access times too high", /* 5D 65 */ + "\135\146firmware impending failure start unit times too high", /* 5D 66 */ + "\135\147firmware impending failure channel parametrics", /* 5D 67 */ + "\135\150firmware impending failure controller detected", /* 5D 68 */ + "\135\151firmware impending failure throughput performance", /* 5D 69 */ + "\135\152firmware impending failure seek time performance", /* 5D 6A */ + "\135\153firmware impending failure spin-up retry count", /* 5D 6B */ + "\135\154firmware impending failure drive calibration retry count", /* 5D 6C */ + "\135\377failure prediction threshold exceeded (false)",/* 5D FF */ + "\136\000low power condition on", /* 5E 00 */ + "\136\001idle condition activated by timer", /* 5E 01 */ + "\136\002standby condition activated by timer", /* 5E 02 */ + "\136\003idle condition activated by command", /* 5E 03 */ + "\136\004standby condition activated by command", /* 5E 04 */ + "\136\101power state change to active", /* 5E 41 */ + "\136\102power state change to idle", /* 5E 42 */ + "\136\103power state change to standby", /* 5E 43 */ + "\136\105power state change to sleep", /* 5E 45 */ + "\136\107power state change to device control", /* 5E 47 */ +#ifdef __used__ + "\137\000", /* 5F 00 */ +#endif + "\140\000lamp failure", /* 60 00 */ + "\141\000video acquisition error", /* 61 00 */ + "\141\001unable to acquire video", /* 61 01 */ + "\141\002out of focus", /* 61 02 */ + "\142\000scan head positioning error", /* 62 00 */ + "\143\000end of user area encountered on this track", /* 63 00 */ + "\143\001packet does not fit in available space", /* 63 01 */ + "\144\000illegal mode for this track", /* 64 00 */ + "\144\001invalid packet size", /* 64 01 */ + "\145\000voltage fault", /* 65 00 */ + "\146\000automatic document feeder cover up", /* 66 00 */ + "\146\001automatic document feeder lift up", /* 66 01 */ + "\146\002document jam in automatic document feeder", /* 66 02 */ + "\146\003document miss feed automatic in document feeder", /* 66 03 */ + "\147\000configuration failure", /* 67 00 */ + "\147\001configuration of incapable logical units failed", /* 67 01 */ + "\147\002add logical unit failed", /* 67 02 */ + "\147\003modification of logical unit failed", /* 67 03 */ + "\147\004exchange of logical unit failed", /* 67 04 */ + "\147\005remove of logical unit failed", /* 67 05 */ + "\147\006attachment of logical unit failed", /* 67 06 */ + "\147\007creation of logical unit failed", /* 67 07 */ + "\147\010assign failure occurred", /* 67 08 */ + "\147\011multiply assigned logical unit", /* 67 09 */ + "\147\012asymmetric access code 4 (00-232) [proposed]", /* 67 0A */ + "\147\013asymmetric access code 5 (00-232) [proposed]", /* 67 0B */ + "\150\000logical unit not configured", /* 68 00 */ + "\151\000data loss on logical unit", /* 69 00 */ + "\151\001multiple logical unit failures", /* 69 01 */ + "\151\002parity/data mismatch", /* 69 02 */ + "\152\000informational, refer to log", /* 6A 00 */ + "\153\000state change has occurred", /* 6B 00 */ + "\153\001redundancy level got better", /* 6B 01 */ + "\153\002redundancy level got worse", /* 6B 02 */ + "\154\000rebuild failure occurred", /* 6C 00 */ + "\155\000recalculate failure occurred", /* 6D 00 */ + "\156\000command to logical unit failed", /* 6E 00 */ + "\157\000copy protection key exchange failure - authentication failure",/* 6F 00 */ + "\157\001copy protection key exchange failure - key not present", /* 6F 01 */ + "\157\002copy protection key exchange failure - key not established", /* 6F 02 */ + "\157\003read of scrambled sector without authentication", /* 6F 03 */ + "\157\004media region code is mismatched to logical unit region", /* 6F 04 */ + "\157\005drive region must be permanent/region reset count error", /* 6F 05 */ +#ifdef XXX + "\160\000nn decompression exception short algorithm id of nn", /* 70 00 */ +#endif + "\160\000decompression exception short algorithm id of nn", /* 70 00 */ + "\161\000decompression exception long algorithm id", /* 71 00 */ + "\162\000session fixation error", /* 72 00 */ + "\162\001session fixation error writing lead-in", /* 72 01 */ + "\162\002session fixation error writing lead-out", /* 72 02 */ + "\162\003session fixation error - incomplete track in session", /* 72 03 */ + "\162\004empty or partially written reserved track", /* 72 04 */ + "\162\005no more track reservations allowed", /* 72 05 */ + "\163\000cd control error", /* 73 00 */ + "\163\001power calibration area almost full", /* 73 01 */ + "\163\002power calibration area is full", /* 73 02 */ + "\163\003power calibration area error", /* 73 03 */ + "\163\004program memory area update failure", /* 73 04 */ + "\163\005program memory area is full", /* 73 05 */ + "\163\006rma/pma is almost full", /* 73 06 */ +#ifdef __used__ + "\164\000", /* 74 00 */ + "\165\000", /* 75 00 */ + "\166\000", /* 76 00 */ + "\167\000", /* 77 00 */ + "\170\000", /* 78 00 */ + "\171\000", /* 79 00 */ + "\172\000", /* 7A 00 */ + "\173\000", /* 7B 00 */ + "\174\000", /* 7C 00 */ + "\175\000", /* 7D 00 */ + "\176\000", /* 7E 00 */ + "\177\000", /* 7F 00 */ +#endif +#ifdef XXX + "\200\000start vendor unique", /* 80 00 */ +#endif + NULL +}; + +#ifdef SMO_C501 +static const char *sd_smo_c501_error_str[] = { + "\012\000disk not inserted", /* 0x0a */ + "\013\000load/unload failure", /* 0x0b */ + "\014\000spindle failure", /* 0x0c */ + "\015\000focus failure", /* 0x0d */ + "\016\000tracking failure", /* 0x0e */ + "\017\000bias magnet failure", /* 0x0f */ + "\043\000illegal function for medium type", /* 0x23 */ +/*XXX*/ "\070\000recoverable write error", /* 0x38 */ +/*XXX*/ "\071\000write error recovery failed", /* 0x39 */ + "\072\000defect list update failed", /* 0x3a */ + "\075\000defect list not available", /* 0x3d */ + "\200\000limited laser life", /* 0x80 */ + "\201\000laser focus coil over-current", /* 0x81 */ + "\202\000laser tracking coil over-current", /* 0x82 */ + "\203\000temperature alarm", /* 0x83 */ + NULL +}; +#endif + +static char *sd_sense_keys[] = { + "No Additional Sense", /* 0x00 */ + "Recovered Error", /* 0x01 */ + "Not Ready", /* 0x02 */ + "Medium Error", /* 0x03 */ + "Hardware Error", /* 0x04 */ + "Illegal Request", /* 0x05 */ + "Unit Attention", /* 0x06 */ + "Data Protect", /* 0x07 */ + "Blank Check", /* 0x08 */ + "Vendor Unique", /* 0x09 */ + "Copy Aborted", /* 0x0a */ + "Aborted Command", /* 0x0b */ + "Equal", /* 0x0c */ + "Volume Overflow", /* 0x0d */ + "Miscompare", /* 0x0e */ + "Reserved" /* 0x0f */ +}; + +static char *sd_cmds[] = { + "\000test unit ready", /* 0x00 */ + "\001rezero", /* 0x01 */ + "\003request sense", /* 0x03 */ + "\004format", /* 0x04 */ + "\007reassign", /* 0x07 */ + "\010read", /* 0x08 */ + "\012write", /* 0x0a */ + "\013seek", /* 0x0b */ + "\022inquiry", /* 0x12 */ + "\025mode select", /* 0x15 */ + "\026reserve", /* 0x16 */ + "\027release", /* 0x17 */ + "\030copy", /* 0x18 */ + "\032mode sense", /* 0x1a */ + "\033start/stop", /* 0x1b */ + "\036door lock", /* 0x1e */ + "\067read defect data", /* 0x37 */ + NULL +}; + +EXPORT +const char * +scg_sensemsg(ctype, code, qual, vec, sbuf, maxcnt) + register int ctype; + register int code; + register int qual; + register const char **vec; + char *sbuf; + int maxcnt; +{ + register int i; + + /* + * Ignore controller type if error vec is supplied. + */ + if (vec == (const char **)NULL) switch (ctype) { + case DEV_MD21: + vec = sd_ccs_error_str; + break; + + case DEV_ACB40X0: + case DEV_ACB4000: + case DEV_ACB4010: + case DEV_ACB4070: + case DEV_ACB5500: + vec = sd_adaptec_error_str; + break; + +#ifdef SMO_C501 + case DEV_SONY_SMO: + vec = sd_smo_c501_error_str; + break; +#endif + + default: + vec = sd_ccs_error_str; + } + if (vec == (const char **)NULL) + return (""); + + for (i = 0; i < 2; i++) { + while (*vec != (char *) NULL) { + if (code == (Uchar)(*vec)[0] && + qual == (Uchar)(*vec)[1]) { + return (&(*vec)[2]); + } else { + vec++; /* Next entry */ + } + } + if (*vec == (char *) NULL) /* End of List: switch over */ + vec = sd_ccs_error_str; + } + if (code == 0x40) { + js_snprintf(sbuf, maxcnt, + "diagnostic failure on component 0x%X", qual); + return (sbuf); + } + if (code == 0x4D) { + js_snprintf(sbuf, maxcnt, + "tagged overlapped commands, queue tag is 0x%X", + qual); + return (sbuf); + } + if (code == 0x70) { + js_snprintf(sbuf, maxcnt, + "decompression exception short algorithm id of 0x%X", + qual); + return (sbuf); + } + if (qual != 0) + return ((char *)NULL); + + if (code < 0x80) { + js_snprintf(sbuf, maxcnt, "invalid sense code 0x%X", code); + return (sbuf); + } + js_snprintf(sbuf, maxcnt, "vendor unique sense code 0x%X", code); + return (sbuf); +} + +#undef sense /*XXX JS Hack, solange scgio.h noch nicht fertig ist */ +EXPORT int +scg__errmsg(scgp, obuf, maxcnt, sense, status, sense_code) + SCSI *scgp; + char *obuf; + int maxcnt; + register struct scsi_sense *sense; + register struct scsi_status *status; + int sense_code; +{ + char sbuf[80]; + const char *sensemsg, *cmdname, *sensekey; +#define ext_sense ((struct scsi_ext_sense* ) sense) + register int blkno = 0; + register int code; + int badqual = 0; + int qual = 0; + int fru = 0; + int key = 0; + int segment = 0; + int blkvalid = 0; + int fm = 0; + int eom = 0; + int ili = 0; + int sksv = 0; + int n; + int sizeleft = maxcnt; + + sensekey = sensemsg = "[]"; + if (sense->code >= 0x70) { + if (sense_code >= 0) + code = sense_code; + else + code = ext_sense->sense_code; + segment = ext_sense->seg_num; + qual = ext_sense->qual_code; + fru = ext_sense->fru_code; + sksv = ext_sense->sksv; + } else { + code = sense->code; + } + if (status->chk == 0) { + sensemsg = "no sense"; + } else { + if (sense->code >= 0x70) { + key = ext_sense->key; + if (key < 0x10) + sensekey = sd_sense_keys[ext_sense->key]; + else + sensekey = "invalid sensekey"; + blkno = (ext_sense->info_1 << 24) | + (ext_sense->info_2 << 16) | + (ext_sense->info_3 << 8) | + ext_sense->info_4; + fm = ext_sense->fil_mk; + eom = ext_sense->eom; + ili = ext_sense->ili; + } else { + key = -1; + sensekey = "[]"; + blkno = (sense->high_addr << 16) | + (sense->mid_addr << 8) | + sense->low_addr; + fm = eom = 0; + } + blkvalid = sense->adr_val; + + sensemsg = scg_sensemsg(scgp->dev, code, qual, scgp->nonstderrs, sbuf, sizeof(sbuf)); + if (sensemsg == NULL) { + sensemsg = scg_sensemsg(scgp->dev, code, 0, scgp->nonstderrs, sbuf, sizeof(sbuf)); + badqual = 1; + } + } +/* + if (un->un_cmd < sizeof(scsi_cmds)) { + cmdname = scsi_cmds[un->un_cmd]; + } else { + cmdname = "unknown cmd"; + } +*/ + cmdname = ""; + n = js_snprintf(obuf, sizeleft, "%sSense Key: 0x%X %s%s, Segment %d\n", + cmdname, key, sensekey, + (sense->code == 0x71)?", deferred error":"", + segment); + if (n <= 0) { + obuf[0] = '\0'; + return (maxcnt - sizeleft); + } + obuf += n; + sizeleft -= n; + n = js_snprintf(obuf, sizeleft, "Sense Code: 0x%02X Qual 0x%02X %s%s%s%s Fru 0x%X\n", + code, qual, *sensemsg?"(":"", sensemsg, *sensemsg?")":"", + badqual? " [No matching qualifier]":"", + fru); + if (n <= 0) { + obuf[0] = '\0'; + return (maxcnt - sizeleft); + } + obuf += n; + sizeleft -= n; + n = js_snprintf(obuf, sizeleft, "Sense flags: Blk %d %s%s%s%s", + blkno, blkvalid?"(valid) ":"(not valid) ", + fm?"file mark detected ":"", + eom?"end of medium ":"", + ili?"illegal block length ":""); + if (n <= 0) { + obuf[0] = '\0'; + return (maxcnt - sizeleft); + } + obuf += n; + sizeleft -= n; + if (!sksv) { + n = js_snprintf(obuf, sizeleft, "\n"); + if (n <= 0) { + obuf[0] = '\0'; + return (maxcnt - sizeleft); + } + obuf += n; + sizeleft -= n; + return (maxcnt - sizeleft); + } + switch (key) { + + case SC_ILLEGAL_REQUEST: + n = js_snprintf(obuf, sizeleft, "error refers to %s part, bit ptr %d %s field ptr %d", + ext_sense->cd? "command":"data", + (int)ext_sense->bptr, + ext_sense->bpv? "(valid)":"(not valid)", + ext_sense->field_ptr[0] << 8 | + ext_sense->field_ptr[1]); + if (n <= 0) { + obuf[0] = '\0'; + return (maxcnt - sizeleft); + } + obuf += n; + sizeleft -= n; + break; + + case SC_RECOVERABLE_ERROR: + case SC_HARDWARE_ERROR: + case SC_MEDIUM_ERROR: + n = js_snprintf(obuf, sizeleft, "actual retry count %d", + ext_sense->field_ptr[0] << 8 | + ext_sense->field_ptr[1]); + if (n <= 0) { + obuf[0] = '\0'; + return (maxcnt - sizeleft); + } + obuf += n; + sizeleft -= n; + break; + + case SC_NOT_READY: + n = js_snprintf(obuf, sizeleft, "operation %d%% done", + (100*(ext_sense->field_ptr[0] << 8 | + ext_sense->field_ptr[1]))/(unsigned)65536); + if (n < 0) { + obuf[0] = '\0'; + return (maxcnt - sizeleft); + } + obuf += n; + sizeleft -= n; + break; + } + n = js_snprintf(obuf, sizeleft, "\n"); + if (n <= 0) { + obuf[0] = '\0'; + return (maxcnt - sizeleft); + } + obuf += n; + sizeleft -= n; + return (maxcnt - sizeleft); +} + +#ifdef DEBUG +print_err(code, ctype) +{ + register int i; + register char **vec = (char **)NULL; + + switch (ctype) { + case CTYPE_MD21: + case CTYPE_CCS: + vec = sd_ccs_error_str; + break; + + case CTYPE_ACB4000: + vec = sd_adaptec_error_str; + break; + +#ifdef SMO_C501 + case CTYPE_SMO_C501: + vec = sd_smo_c501_error_str; + break; +#endif + +#ifdef CDD_521 + case DEV_CDD_521: + vec = sd_cdd_521_error_str; + break; +#endif + } + js_printf("error code: 0x%x", code); + if (vec == (char **)NULL) + return; + + for (i = 0; i < 2; i++) { + while (*vec != (char *) NULL) { + if (code == (Uchar)*vec[0]) { + js_printf(" (%s)", (char *)((int)(*vec)+1)); + return; + } else + vec++; + } + if (*vec == (char *) NULL) + vec = sd_ccs_error_str; + } +} + + +main() +{ + int i; + +#ifdef ACB + for (i = 0; i < 0x30; i++) { +/* js_printf("Code: 0x%x Key: 0x%x ", i, sd_adaptec_keys[i]);*/ + js_printf("Key: 0x%x %-16s ", sd_adaptec_keys[i], + sd_sense_keys[sd_adaptec_keys[i]] ); + js_print_err(i, CTYPE_ACB4000); + js_printf("\n"); + } +#else +/* for (i = 0; i < 0x84; i++) {*/ + for (i = 0; i < 0xd8; i++) { +/* print_err(i, CTYPE_SMO_C501);*/ + print_err(i, DEV_CDD_521); + js_printf("\n"); + } +#endif +} +#endif diff --git a/scsilib/libscg/scsihack.c b/scsilib/libscg/scsihack.c new file mode 100644 index 0000000..b1a45c8 --- /dev/null +++ b/scsilib/libscg/scsihack.c @@ -0,0 +1,493 @@ +/* @(#)scsihack.c 1.43 03/11/28 Copyright 1997,2000,2001 J. Schilling */ +#ifndef lint +static char _sccsid[] = + "@(#)scsihack.c 1.43 03/11/28 Copyright 1997,2000,2001 J. Schilling"; +#endif +/* + * Interface for other generic SCSI implementations. + * Emulate the functionality of /dev/scg? with the local + * SCSI user land implementation. + * + * To add a new hack, add something like: + * + * #ifdef __FreeBSD__ + * #define SCSI_IMPL + * #include some code + * #endif + * + * Warning: you may change this source or add new SCSI tranport + * implementations, but if you do that you need to change the + * _scg_version and _scg_auth* string that are returned by the + * SCSI transport code. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * If your version has been integrated into the main steam release, + * the return value will be set to "schily". + * + * Copyright (c) 1997,2000,2001 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> + +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> /* Include various defs needed with some OS */ +#endif +#include <stdio.h> +#include <standard.h> +#include <stdxlib.h> +#include <unixstd.h> +#include <errno.h> +#include <timedefs.h> +#include <sys/ioctl.h> +#include <fctldefs.h> +#include <strdefs.h> +#include <schily.h> + +#include <scg/scgcmd.h> +#include <scg/scsitransp.h> +#include "scgtimes.h" + +#ifndef HAVE_ERRNO_DEF +extern int errno; +#endif + +LOCAL int scgo_send __PR((SCSI *scgp)); +LOCAL char * scgo_version __PR((SCSI *scgp, int what)); +LOCAL int scgo_help __PR((SCSI *scgp, FILE *f)); +LOCAL int scgo_open __PR((SCSI *scgp, char *device)); +LOCAL int scgo_close __PR((SCSI *scgp)); +LOCAL long scgo_maxdma __PR((SCSI *scgp, long amt)); +LOCAL void * scgo_getbuf __PR((SCSI *scgp, long amt)); +LOCAL void scgo_freebuf __PR((SCSI *scgp)); + +LOCAL BOOL scgo_havebus __PR((SCSI *scgp, int busno)); +LOCAL int scgo_fileno __PR((SCSI *scgp, int busno, int tgt, int tlun)); +LOCAL int scgo_initiator_id __PR((SCSI *scgp)); +LOCAL int scgo_isatapi __PR((SCSI *scgp)); +LOCAL int scgo_reset __PR((SCSI *scgp, int what)); + +LOCAL char _scg_auth_schily[] = "schily"; /* The author for this module */ + +EXPORT scg_ops_t scg_std_ops = { + scgo_send, + scgo_version, + scgo_help, + scgo_open, + scgo_close, + scgo_maxdma, + scgo_getbuf, + scgo_freebuf, + scgo_havebus, + scgo_fileno, + scgo_initiator_id, + scgo_isatapi, + scgo_reset, +}; + +/*#undef sun*/ +/*#undef __sun*/ +/*#undef __sun__*/ + +#if defined(sun) || defined(__sun) || defined(__sun__) +#define SCSI_IMPL /* We have a SCSI implementation for Sun */ + +#include "scsi-sun.c" + +#endif /* Sun */ + + +#ifdef linux +#define SCSI_IMPL /* We have a SCSI implementation for Linux */ + +#ifdef not_needed /* We now have a local vrersion of pg.h */ +#ifndef HAVE_LINUX_PG_H /* If we are compiling on an old version */ +# undef USE_PG_ONLY /* there is no 'pg' driver and we cannot */ +# undef USE_PG /* include <linux/pg.h> which is needed */ +#endif /* by the pg transport code. */ +#endif + +#ifdef USE_PG_ONLY +#include "scsi-linux-pg.c" +#else +#include "scsi-linux-sg.c" +#endif + +#endif /* linux */ + +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) +#define SCSI_IMPL /* We have a SCSI implementation for *BSD */ + +#include "scsi-bsd.c" + +#endif /* *BSD */ + +#if defined(__bsdi__) /* We have a SCSI implementation for BSD/OS 3.x (and later?) */ +# include <sys/param.h> +# if (_BSDI_VERSION >= 199701) +# define SCSI_IMPL + +# include "scsi-bsd-os.c" + +# endif /* BSD/OS >= 3.0 */ +#endif /* BSD/OS */ + +#ifdef __sgi +#define SCSI_IMPL /* We have a SCSI implementation for SGI */ + +#include "scsi-sgi.c" + +#endif /* SGI */ + +#ifdef __hpux +#define SCSI_IMPL /* We have a SCSI implementation for HP-UX */ + +#include "scsi-hpux.c" + +#endif /* HP-UX */ + +#if defined(_IBMR2) || defined(_AIX) +#define SCSI_IMPL /* We have a SCSI implementation for AIX */ + +#include "scsi-aix.c" + +#endif /* AIX */ + +#if defined(__NeXT__) || defined(IS_MACOS_X) +#if defined(HAVE_BSD_DEV_SCSIREG_H) +/* + * This is the + */ +#define SCSI_IMPL /* We found a SCSI implementation for NextStep and Mac OS X */ + +#include "scsi-next.c" +#else + +#define SCSI_IMPL /* We found a SCSI implementation for Mac OS X (Darwin-1.4) */ + +#include "scsi-mac-iokit.c" + +#endif /* HAVE_BSD_DEV_SCSIREG_H */ + +#endif /* NEXT / Mac OS X */ + +#if defined(__osf__) +#define SCSI_IMPL /* We have a SCSI implementation for OSF/1 */ + +#include "scsi-osf.c" + +#endif /* OSF/1 */ + +#ifdef VMS +#define SCSI_IMPL /* We have a SCSI implementation for VMS */ + +#include "scsi-vms.c" + +#endif /* VMS */ + +#ifdef OPENSERVER +#define SCSI_IMPL /* We have a SCSI implementation for SCO OpenServer */ + +#include "scsi-openserver.c" + +#endif /* SCO */ + +#ifdef UNIXWARE +#define SCSI_IMPL /* We have a SCSI implementation for SCO UnixWare */ + +#include "scsi-unixware.c" + +#endif /* UNIXWARE */ + +#ifdef __OS2 +#define SCSI_IMPL /* We have a SCSI implementation for OS/2 */ + +#include "scsi-os2.c" + +#endif /* OS/2 */ + +#ifdef __BEOS__ +#define SCSI_IMPL /* Yep, BeOS does that funky scsi stuff */ +#include "scsi-beos.c" +#endif + +#ifdef __CYGWIN32__ +#define SCSI_IMPL /* Yep, we support WNT and W9? */ +#include "scsi-wnt.c" +#endif + +#ifdef apollo +#define SCSI_IMPL /* We have a SCSI implementation for Apollo Domain/OS */ +#include "scsi-apollo.c" +#endif + +#ifdef AMIGA /* We have a SCSI implementation for AmigaOS */ +#define SCSI_IMPL +#include "scsi-amigaos.c" +#endif + +#if defined(__QNXNTO__) || defined(__QNX__) +#define SCSI_IMPL /* We have a SCSI implementation for QNX */ +#include "scsi-qnx.c" +#endif /* QNX */ + +#ifdef __DJGPP__ /* We have a SCSI implementation for MS-DOS/DJGPP */ +#define SCSI_IMPL +#include "scsi-dos.c" +#endif + +#ifdef __NEW_ARCHITECTURE +#define SCSI_IMPL /* We have a SCSI implementation for XXX */ +/* + * Add new hacks here + */ +#include "scsi-new-arch.c" +#endif + + +#ifndef SCSI_IMPL +/* + * To make scsihack.c compile on all architectures. + * This does not mean that you may use it, but you can see + * if other problems exist. + */ +#define scgo_dversion scgo_version +#define scgo_dhelp scgo_help +#define scgo_dopen scgo_open +#define scgo_dclose scgo_close +#define scgo_dmaxdma scgo_maxdma +#define scgo_dgetbuf scgo_getbuf +#define scgo_dfreebuf scgo_freebuf +#define scgo_dhavebus scgo_havebus +#define scgo_dfileno scgo_fileno +#define scgo_dinitiator_id scgo_initiator_id +#define scgo_disatapi scgo_isatapi +#define scgo_dreset scgo_reset +#define scgo_dsend scgo_send +#endif /* SCSI_IMPL */ + +LOCAL int scgo_dsend __PR((SCSI *scgp)); +LOCAL char * scgo_dversion __PR((SCSI *scgp, int what)); +LOCAL int scgo_dhelp __PR((SCSI *scgp, FILE *f)); +LOCAL int scgo_nohelp __PR((SCSI *scgp, FILE *f)); +LOCAL int scgo_ropen __PR((SCSI *scgp, char *device)); +LOCAL int scgo_dopen __PR((SCSI *scgp, char *device)); +LOCAL int scgo_dclose __PR((SCSI *scgp)); +LOCAL long scgo_dmaxdma __PR((SCSI *scgp, long amt)); +LOCAL void * scgo_dgetbuf __PR((SCSI *scgp, long amt)); +LOCAL void scgo_dfreebuf __PR((SCSI *scgp)); +LOCAL BOOL scgo_dhavebus __PR((SCSI *scgp, int busno)); +LOCAL int scgo_dfileno __PR((SCSI *scgp, int busno, int tgt, int tlun)); +LOCAL int scgo_dinitiator_id __PR((SCSI *scgp)); +LOCAL int scgo_disatapi __PR((SCSI *scgp)); +LOCAL int scgo_dreset __PR((SCSI *scgp, int what)); + +EXPORT scg_ops_t scg_remote_ops = { + scgo_dsend, + scgo_dversion, + scgo_nohelp, + scgo_ropen, + scgo_dclose, + scgo_dmaxdma, + scgo_dgetbuf, + scgo_dfreebuf, + scgo_dhavebus, + scgo_dfileno, + scgo_dinitiator_id, + scgo_disatapi, + scgo_dreset, +}; + +EXPORT scg_ops_t scg_dummy_ops = { + scgo_dsend, + scgo_dversion, + scgo_dhelp, + scgo_dopen, + scgo_dclose, + scgo_dmaxdma, + scgo_dgetbuf, + scgo_dfreebuf, + scgo_dhavebus, + scgo_dfileno, + scgo_dinitiator_id, + scgo_disatapi, + scgo_dreset, +}; + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_trans_dversion[] = "scsihack.c-1.43"; /* The version for this transport*/ + +/* + * Return version information for the low level SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + */ +LOCAL char * +scgo_dversion(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp != (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_trans_dversion); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (_sccsid); + } + } + return ((char *)0); +} + +LOCAL int +scgo_dhelp(scgp, f) + SCSI *scgp; + FILE *f; +{ + printf("None.\n"); + return (0); +} + +LOCAL int +scgo_nohelp(scgp, f) + SCSI *scgp; + FILE *f; +{ + return (0); +} + +LOCAL int +scgo_ropen(scgp, device) + SCSI *scgp; + char *device; +{ + comerrno(EX_BAD, "No remote SCSI transport available.\n"); + return (-1); /* Keep lint happy */ +} + +#ifndef SCSI_IMPL +LOCAL int +scgo_dopen(scgp, device) + SCSI *scgp; + char *device; +{ + comerrno(EX_BAD, "No local SCSI transport implementation for this architecture.\n"); + return (-1); /* Keep lint happy */ +} +#else +LOCAL int +scgo_dopen(scgp, device) + SCSI *scgp; + char *device; +{ + comerrno(EX_BAD, "SCSI open usage error.\n"); + return (-1); /* Keep lint happy */ +} +#endif /* SCSI_IMPL */ + +LOCAL int +scgo_dclose(scgp) + SCSI *scgp; +{ + errno = EINVAL; + return (-1); +} + +LOCAL long +scgo_dmaxdma(scgp, amt) + SCSI *scgp; + long amt; +{ + errno = EINVAL; + return (0L); +} + +LOCAL void * +scgo_dgetbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + errno = EINVAL; + return ((void *)0); +} + +LOCAL void +scgo_dfreebuf(scgp) + SCSI *scgp; +{ +} + +LOCAL BOOL +scgo_dhavebus(scgp, busno) + SCSI *scgp; + int busno; +{ + return (FALSE); +} + +LOCAL int +scgo_dfileno(scgp, busno, tgt, tlun) + SCSI *scgp; + int busno; + int tgt; + int tlun; +{ + return (-1); +} + +LOCAL int +scgo_dinitiator_id(scgp) + SCSI *scgp; +{ + return (-1); +} + +LOCAL int +scgo_disatapi(scgp) + SCSI *scgp; +{ + return (FALSE); +} + +LOCAL int +scgo_dreset(scgp, what) + SCSI *scgp; + int what; +{ + errno = EINVAL; + return (-1); +} + +LOCAL int +scgo_dsend(scgp) + SCSI *scgp; +{ + errno = EINVAL; + return (-1); +} diff --git a/scsilib/libscg/scsihelp.c b/scsilib/libscg/scsihelp.c new file mode 100644 index 0000000..f916233 --- /dev/null +++ b/scsilib/libscg/scsihelp.c @@ -0,0 +1,60 @@ +/* @(#)scsihelp.c 1.4 04/01/14 Copyright 2002 J. Schilling */ +#ifndef lint +static char sccsid[] = + "@(#)scsihelp.c 1.4 04/01/14 Copyright 2002 J. Schilling"; +#endif +/* + * scg Library + * Help subsystem + * + * Copyright (c) 2002 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <stdio.h> +#include <standard.h> +#include <schily.h> + +#include <scg/scsitransp.h> + +EXPORT void __scg_help __PR((FILE *f, char *name, char *tcomment, + char *tind, + char *tspec, + char *texample, + BOOL mayscan, + BOOL bydev)); + +EXPORT void +__scg_help(f, name, tcomment, tind, tspec, texample, mayscan, bydev) + FILE *f; + char *name; + char *tcomment; + char *tind; + char *tspec; + char *texample; + BOOL mayscan; + BOOL bydev; +{ + fprintf(f, "\nTransport name: %s\n", name); + fprintf(f, "Transport descr.: %s\n", tcomment); + fprintf(f, "Transp. layer ind.: %s\n", tind); + fprintf(f, "Target specifier: %s\n", tspec); + fprintf(f, "Target example: %s\n", texample); + fprintf(f, "SCSI Bus scanning: %ssupported\n", mayscan? "":"not "); + fprintf(f, "Open via UNIX device: %ssupported\n", bydev? "":"not "); +} diff --git a/scsilib/libscg/scsiopen.c b/scsilib/libscg/scsiopen.c new file mode 100644 index 0000000..f7bef10 --- /dev/null +++ b/scsilib/libscg/scsiopen.c @@ -0,0 +1,463 @@ +/* @(#)scsiopen.c 1.95 04/01/14 Copyright 1995,2000 J. Schilling */ +#ifndef lint +static char sccsid[] = + "@(#)scsiopen.c 1.95 04/01/14 Copyright 1995,2000 J. Schilling"; +#endif +/* + * SCSI command functions for cdrecord + * + * Copyright (c) 1995,2000 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/* + * NOTICE: The Philips CDD 521 has several firmware bugs. + * One of them is not to respond to a SCSI selection + * within 200ms if the general load on the + * SCSI bus is high. To deal with this problem + * most of the SCSI commands are send with the + * SCG_CMD_RETRY flag enabled. + * + * Note that the only legal place to assign + * values to scg_scsibus() scg_target() and scg_lun() + * is scg_settarget(). + */ +#include <mconfig.h> + +#include <stdio.h> +#include <standard.h> +#include <stdxlib.h> +#include <unixstd.h> +#include <fctldefs.h> +#include <errno.h> +#include <strdefs.h> +#include <timedefs.h> + +#include <utypes.h> +#include <btorder.h> +#include <schily.h> + +#include <scg/scgcmd.h> +#include <scg/scsidefs.h> +#include <scg/scsireg.h> +#include <scg/scsitransp.h> + +#define strbeg(s1, s2) (strstr((s2), (s1)) == (s2)) + +extern int lverbose; + +EXPORT SCSI *scg_open __PR((char *scsidev, char *errs, int slen, int debug, + int be_verbose)); +EXPORT int scg_help __PR((FILE *f)); +LOCAL int scg_scandev __PR((char *devp, char *errs, int slen, + int *busp, int *tgtp, int *lunp)); +EXPORT int scg_close __PR((SCSI * scgp)); + +EXPORT void scg_settimeout __PR((SCSI * scgp, int timeout)); + +EXPORT SCSI *scg_smalloc __PR((void)); +EXPORT void scg_sfree __PR((SCSI *scgp)); + +/* + * Open a SCSI device. + * + * Possible syntax is: + * + * Preferred: + * dev=target,lun / dev=scsibus,target,lun + * + * Needed on some systems: + * dev=devicename:target,lun / dev=devicename:scsibus,target,lun + * + * On systems that don't support SCSI Bus scanning this syntax helps: + * dev=devicename:@ / dev=devicename:@,lun + * or dev=devicename (undocumented) + * + * NOTE: As the 'lun' is part of the SCSI command descriptor block, it + * must always be known. If the OS cannot map it, it must be + * specified on command line. + */ +EXPORT SCSI * +scg_open(scsidev, errs, slen, debug, be_verbose) + char *scsidev; + char *errs; + int slen; + int debug; + int be_verbose; +{ + char devname[256]; + char *devp = NULL; + char *sdev = NULL; + int x1; + int bus = 0; + int tgt = 0; + int lun = 0; + int n = 0; + SCSI *scgp; + + if (errs) + errs[0] = '\0'; + scgp = scg_smalloc(); + if (scgp == NULL) { + if (errs) + js_snprintf(errs, slen, "No memory for SCSI structure"); + return ((SCSI *)0); + } + scgp->debug = debug; + scgp->overbose = be_verbose; + + devname[0] = '\0'; + if (scsidev != NULL && scsidev[0] != '\0') { + sdev = scsidev; + if ((strncmp(scsidev, "HELP", 4) == 0) || + (strncmp(scsidev, "help", 4) == 0)) { + + return ((SCSI *)0); + } + if (strncmp(scsidev, "REMOTE", 6) == 0) { + /* + * REMOTE:user@host:scsidev or + * REMOTE(transp):user@host:scsidev + * e.g.: REMOTE(/usr/bin/ssh):user@host:scsidev + * + * We must send the complete device spec to the remote + * site to allow parsing on both sites. + */ + strncpy(devname, scsidev, sizeof (devname)-1); + devname[sizeof (devname)-1] = '\0'; + if (sdev[6] == '(' || sdev[6] == ':') + sdev = strchr(sdev, ':'); + else + sdev = NULL; + + if (sdev == NULL) { + /* + * This seems to be an illegal remote dev spec. + * Give it a chance with a standard parsing. + */ + sdev = scsidev; + devname[0] = '\0'; + } else { + /* + * Now try to go past user@host spec. + */ + if (sdev) + sdev = strchr(&sdev[1], ':'); + if (sdev) + sdev++; /* Device name follows ... */ + else + goto nulldevice; + } + } + if ((devp = strchr(sdev, ':')) == NULL) { + if (strchr(sdev, ',') == NULL) { + /* Notation form: 'devname' (undocumented) */ + /* Forward complete name to scg__open() */ + /* Fetch bus/tgt/lun values from OS */ + /* We may come here too with 'USCSI' */ + n = -1; + lun = -2; /* Lun must be known */ + if (devname[0] == '\0') { + strncpy(devname, scsidev, + sizeof (devname)-1); + devname[sizeof (devname)-1] = '\0'; + } + } else { + /* Basic notation form: 'bus,tgt,lun' */ + devp = sdev; + } + } else { + /* Notation form: 'devname:bus,tgt,lun'/'devname:@' */ + /* We may come here too with 'USCSI:' */ + if (devname[0] == '\0') { + /* + * Copy over the part before the ':' + */ + x1 = devp - scsidev; + if (x1 >= (int)sizeof (devname)) + x1 = sizeof (devname)-1; + strncpy(devname, scsidev, x1); + devname[x1] = '\0'; + } + devp++; + /* Check for a notation in the form 'devname:@' */ + if (devp[0] == '@') { + if (devp[1] == '\0') { + lun = -2; + } else if (devp[1] == ',') { + if (*astoi(&devp[2], &lun) != '\0') { + errno = EINVAL; + if (errs) + js_snprintf(errs, slen, + "Invalid lun specifier '%s'", + &devp[2]); + return ((SCSI *)0); + } + } + n = -1; + /* + * Got device:@ or device:@,lun + * Make sure not to call scg_scandev() + */ + devp = NULL; + } else if (devp[0] == '\0') { + /* + * Got USCSI: or ATAPI: + * Make sure not to call scg_scandev() + */ + devp = NULL; + } else if (strchr(sdev, ',') == NULL) { + /* We may come here with 'ATAPI:/dev/hdc' */ + strncpy(devname, scsidev, + sizeof (devname)-1); + devname[sizeof (devname)-1] = '\0'; + n = -1; + lun = -2; /* Lun must be known */ + /* + * Make sure not to call scg_scandev() + */ + devp = NULL; + } + } + } +nulldevice: + +/*error("10 scsidev '%s' sdev '%s' devp '%s' b: %d t: %d l: %d\n", scsidev, sdev, devp, bus, tgt, lun);*/ + + if (devp != NULL) { + n = scg_scandev(devp, errs, slen, &bus, &tgt, &lun); + if (n < 0) { + errno = EINVAL; + return ((SCSI *)0); + } + } + if (n >= 1 && n <= 3) { /* Got bus,target,lun or target,lun or tgt*/ + scg_settarget(scgp, bus, tgt, lun); + } else if (n == -1) { /* Got device:@, fetch bus/lun from OS */ + scg_settarget(scgp, -2, -2, lun); + } else if (devp != NULL) { + /* + * XXX May this happen after we allow tgt to repesent tgt,0 ? + */ + js_fprintf(stderr, "WARNING: device not valid, trying to use default target...\n"); + scg_settarget(scgp, 0, 6, 0); + } + if (be_verbose && scsidev != NULL) { + js_fprintf(stderr, "scsidev: '%s'\n", scsidev); + if (devname[0] != '\0') + js_fprintf(stderr, "devname: '%s'\n", devname); + js_fprintf(stderr, "scsibus: %d target: %d lun: %d\n", + scg_scsibus(scgp), scg_target(scgp), scg_lun(scgp)); + } + if (debug > 0) { + js_fprintf(stderr, "scg__open(%s) %d,%d,%d\n", + devname, + scg_scsibus(scgp), scg_target(scgp), scg_lun(scgp)); + } + if (scg__open(scgp, devname) <= 0) { + if (errs && scgp->errstr) + js_snprintf(errs, slen, "%s", scgp->errstr); + scg_sfree(scgp); + return ((SCSI *)0); + } + return (scgp); +} + +EXPORT int +scg_help(f) + FILE *f; +{ + SCSI *scgp; + + scgp = scg_smalloc(); + if (scgp != NULL) { +extern scg_ops_t scg_std_ops; + + scgp->ops = &scg_std_ops; + + printf("Supported SCSI transports for this platform:\n"); + SCGO_HELP(scgp, f); + scg_remote()->scgo_help(scgp, f); + scg_sfree(scgp); + } + return (0); +} + +/* + * Convert target,lun or scsibus,target,lun syntax. + * Check for bad syntax and invalid values. + * This is definitely better than using scanf() as it checks for syntax errors. + */ +LOCAL int +scg_scandev(devp, errs, slen, busp, tgtp, lunp) + char *devp; + char *errs; + int slen; + int *busp; + int *tgtp; + int *lunp; +{ + int x1, x2, x3; + int n = 0; + char *p = devp; + + x1 = x2 = x3 = 0; + *busp = *tgtp = *lunp = 0; + + if (*p != '\0') { + p = astoi(p, &x1); + if (*p == ',') { + p++; + n++; + } else { + if (errs) + js_snprintf(errs, slen, "Invalid bus or target specifier in '%s'", devp); + return (-1); + } + } + if (*p != '\0') { + p = astoi(p, &x2); + if (*p == ',' || *p == '\0') { + if (*p != '\0') + p++; + n++; + } else { + if (errs) + js_snprintf(errs, slen, "Invalid target or lun specifier in '%s'", devp); + return (-1); + } + } + if (*p != '\0') { + p = astoi(p, &x3); + if (*p == '\0') { + n++; + } else { + if (errs) + js_snprintf(errs, slen, "Invalid lun specifier in '%s'", devp); + return (-1); + } + } + if (n == 3) { + *busp = x1; + *tgtp = x2; + *lunp = x3; + } + if (n == 2) { + *tgtp = x1; + *lunp = x2; + } + if (n == 1) { + *tgtp = x1; + } + + if (x1 < 0 || x2 < 0 || x3 < 0) { + if (errs) + js_snprintf(errs, slen, "Invalid value for bus, target or lun (%d,%d,%d)", + *busp, *tgtp, *lunp); + return (-1); + } + return (n); +} + +EXPORT int +scg_close(scgp) + SCSI *scgp; +{ + scg__close(scgp); + scg_sfree(scgp); + return (0); +} + +EXPORT void +scg_settimeout(scgp, timeout) + SCSI *scgp; + int timeout; +{ +#ifdef nonono + if (timeout >= 0) + scgp->deftimeout = timeout; +#else + scgp->deftimeout = timeout; +#endif +} + +EXPORT SCSI * +scg_smalloc() +{ + SCSI *scgp; +extern scg_ops_t scg_dummy_ops; + + scgp = (SCSI *)malloc(sizeof (*scgp)); + if (scgp == NULL) + return ((SCSI *)0); + + fillbytes(scgp, sizeof (*scgp), 0); + scgp->ops = &scg_dummy_ops; + scg_settarget(scgp, -1, -1, -1); + scgp->fd = -1; + scgp->deftimeout = 20; + scgp->running = FALSE; + + scgp->cmdstart = (struct timeval *)malloc(sizeof (struct timeval)); + if (scgp->cmdstart == NULL) + goto err; + scgp->cmdstop = (struct timeval *)malloc(sizeof (struct timeval)); + if (scgp->cmdstop == NULL) + goto err; + scgp->scmd = (struct scg_cmd *)malloc(sizeof (struct scg_cmd)); + if (scgp->scmd == NULL) + goto err; + scgp->errstr = malloc(SCSI_ERRSTR_SIZE); + if (scgp->errstr == NULL) + goto err; + scgp->errptr = scgp->errbeg = scgp->errstr; + scgp->errstr[0] = '\0'; + scgp->errfile = (void *)stderr; + scgp->inq = (struct scsi_inquiry *)malloc(sizeof (struct scsi_inquiry)); + if (scgp->inq == NULL) + goto err; + scgp->cap = (struct scsi_capacity *)malloc(sizeof (struct scsi_capacity)); + if (scgp->cap == NULL) + goto err; + + return (scgp); +err: + scg_sfree(scgp); + return ((SCSI *)0); +} + +EXPORT void +scg_sfree(scgp) + SCSI *scgp; +{ + if (scgp->cmdstart) + free(scgp->cmdstart); + if (scgp->cmdstop) + free(scgp->cmdstop); + if (scgp->scmd) + free(scgp->scmd); + if (scgp->inq) + free(scgp->inq); + if (scgp->cap) + free(scgp->cap); + if (scgp->local) + free(scgp->local); + scg_freebuf(scgp); + if (scgp->errstr) + free(scgp->errstr); + free(scgp); +} diff --git a/scsilib/libscg/scsitransp.c b/scsilib/libscg/scsitransp.c new file mode 100644 index 0000000..eeb60c1 --- /dev/null +++ b/scsilib/libscg/scsitransp.c @@ -0,0 +1,1447 @@ +/* @(#)scsitransp.c 1.91 04/06/17 Copyright 1988,1995,2000-2004 J. Schilling */ +/*#ifndef lint*/ +static char sccsid[] = + "@(#)scsitransp.c 1.91 04/06/17 Copyright 1988,1995,2000-2004 J. Schilling"; +/*#endif*/ +/* + * SCSI user level command transport routines (generic part). + * + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + * + * Copyright (c) 1988,1995,2000-2004 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <stdio.h> +#include <standard.h> +#include <stdxlib.h> +#include <unixstd.h> +#include <errno.h> +#include <timedefs.h> +#include <strdefs.h> +#include <schily.h> + +#include <scg/scgcmd.h> +#include <scg/scsireg.h> +#include <scg/scsitransp.h> +#include "scgtimes.h" + +/* + * Warning: you may change this source, but if you do that + * you need to change the _scg_version and _scg_auth* string below. + * You may not return "schily" for an SCG_AUTHOR request anymore. + * Choose your name instead of "schily" and make clear that the version + * string is related to a modified source. + */ +LOCAL char _scg_version[] = "0.8"; /* The global libscg version */ +LOCAL char _scg_auth_schily[] = "schily"; /* The author for this module */ + +#define DEFTIMEOUT 20 /* Default timeout for SCSI command transport */ + +EXPORT char *scg_version __PR((SCSI *scgp, int what)); +EXPORT int scg__open __PR((SCSI *scgp, char *device)); +EXPORT int scg__close __PR((SCSI *scgp)); +EXPORT BOOL scg_havebus __PR((SCSI *scgp, int)); +EXPORT int scg_initiator_id __PR((SCSI *scgp)); +EXPORT int scg_isatapi __PR((SCSI *scgp)); +EXPORT int scg_reset __PR((SCSI *scgp, int what)); +EXPORT void *scg_getbuf __PR((SCSI *scgp, long)); +EXPORT void scg_freebuf __PR((SCSI *scgp)); +EXPORT long scg_bufsize __PR((SCSI *scgp, long)); +EXPORT void scg_setnonstderrs __PR((SCSI *scgp, const char **)); +EXPORT BOOL scg_yes __PR((char *)); +#ifdef nonono +LOCAL void scg_sighandler __PR((int)); +#endif +EXPORT int scg_cmd __PR((SCSI *scgp)); +EXPORT void scg_vhead __PR((SCSI *scgp)); +EXPORT int scg_svhead __PR((SCSI *scgp, char *buf, int maxcnt)); +EXPORT int scg_vtail __PR((SCSI *scgp)); +EXPORT int scg_svtail __PR((SCSI *scgp, int *retp, char *buf, int maxcnt)); +EXPORT void scg_vsetup __PR((SCSI *scgp)); +EXPORT int scg_getresid __PR((SCSI *scgp)); +EXPORT int scg_getdmacnt __PR((SCSI *scgp)); +EXPORT BOOL scg_cmd_err __PR((SCSI *scgp)); +EXPORT void scg_printerr __PR((SCSI *scgp)); +EXPORT void scg_fprinterr __PR((SCSI *scgp, FILE *f)); +EXPORT int scg_sprinterr __PR((SCSI *scgp, char *buf, int maxcnt)); +EXPORT int scg__sprinterr __PR((SCSI *scgp, char *buf, int maxcnt)); +EXPORT void scg_printcdb __PR((SCSI *scgp)); +EXPORT int scg_sprintcdb __PR((SCSI *scgp, char *buf, int maxcnt)); +EXPORT void scg_printwdata __PR((SCSI *scgp)); +EXPORT int scg_sprintwdata __PR((SCSI *scgp, char *buf, int maxcnt)); +EXPORT void scg_printrdata __PR((SCSI *scgp)); +EXPORT int scg_sprintrdata __PR((SCSI *scgp, char *buf, int maxcnt)); +EXPORT void scg_printresult __PR((SCSI *scgp)); +EXPORT int scg_sprintresult __PR((SCSI *scgp, char *buf, int maxcnt)); +EXPORT void scg_printstatus __PR((SCSI *scgp)); +EXPORT int scg_sprintstatus __PR((SCSI *scgp, char *buf, int maxcnt)); +EXPORT void scg_fprbytes __PR((FILE *, char *, unsigned char *, int)); +EXPORT void scg_fprascii __PR((FILE *, char *, unsigned char *, int)); +EXPORT void scg_prbytes __PR((char *, unsigned char *, int)); +EXPORT void scg_prascii __PR((char *, unsigned char *, int)); +EXPORT int scg_sprbytes __PR((char *buf, int maxcnt, char *, unsigned char *, int)); +EXPORT int scg_sprascii __PR((char *buf, int maxcnt, char *, unsigned char *, int)); +EXPORT void scg_fprsense __PR((FILE *f, unsigned char *, int)); +EXPORT int scg_sprsense __PR((char *buf, int maxcnt, unsigned char *, int)); +EXPORT void scg_prsense __PR((unsigned char *, int)); +EXPORT int scg_cmd_status __PR((SCSI *scgp)); +EXPORT int scg_sense_key __PR((SCSI *scgp)); +EXPORT int scg_sense_code __PR((SCSI *scgp)); +EXPORT int scg_sense_qual __PR((SCSI *scgp)); +EXPORT void scg_fprintdev __PR((FILE *, struct scsi_inquiry *)); +EXPORT void scg_printdev __PR((struct scsi_inquiry *)); +EXPORT int scg_printf __PR((SCSI *scgp, const char *form, ...)); +EXPORT int scg_errflush __PR((SCSI *scgp)); +EXPORT int scg_errfflush __PR((SCSI *scgp, FILE *f)); + +/* + * Return version information for the SCSI transport code. + * This has been introduced to make it easier to trace down problems + * in applications. + * + * If scgp is NULL, return general library version information. + * If scgp is != NULL, return version information for the low level transport. + */ +EXPORT char * +scg_version(scgp, what) + SCSI *scgp; + int what; +{ + if (scgp == (SCSI *)0) { + switch (what) { + + case SCG_VERSION: + return (_scg_version); + /* + * If you changed this source, you are not allowed to + * return "schily" for the SCG_AUTHOR request. + */ + case SCG_AUTHOR: + return (_scg_auth_schily); + case SCG_SCCS_ID: + return (sccsid); + default: + return ((char *)0); + } + } + return (SCGO_VERSION(scgp, what)); +} + +/* + * Call low level SCSI open routine from transport abstraction layer. + */ +EXPORT int +scg__open(scgp, device) + SCSI *scgp; + char *device; +{ + int ret; + scg_ops_t *ops; +extern scg_ops_t scg_std_ops; + + /* + * Begin restricted code for quality assurance. + * + * Warning: you are not allowed to modify the quality ensurance code below. + * + * This restiction is introduced because this way, I hope that people + * contribute to the project instead of creating branches. + */ +#if !defined(IS_SCHILY_XCONFIG) + printf("\nWarning: This version of libscg has not been configured via the standard\n"); + printf("autoconfiguration method of the Schily makefile system. There is a high risk\n"); + printf("that the code is not configured correctly and for this reason will not behave\n"); + printf("as expected.\n"); +#endif + /* + * End restricted code for quality assurance. + */ + + scgp->ops = &scg_std_ops; + + if (device && strncmp(device, "REMOTE", 6) == 0) { + ops = scg_remote(); + if (ops != NULL) + scgp->ops = ops; + } + + ret = SCGO_OPEN(scgp, device); + if (ret < 0) + return (ret); + + /* + * Now make scgp->fd valid if possible. + * Note that scg_scsibus(scgp)/scg_target(scgp)/scg_lun(scgp) may have + * changed in SCGO_OPEN(). + */ + scg_settarget(scgp, scg_scsibus(scgp), scg_target(scgp), scg_lun(scgp)); + return (ret); +} + +/* + * Call low level SCSI close routine from transport abstraction layer. + */ +EXPORT int +scg__close(scgp) + SCSI *scgp; +{ + return (SCGO_CLOSE(scgp)); +} + +/* + * Retrieve max DMA count for this target. + */ +EXPORT long +scg_bufsize(scgp, amt) + SCSI *scgp; + long amt; +{ + long maxdma; + + maxdma = SCGO_MAXDMA(scgp, amt); + if (amt <= 0 || amt > maxdma) + amt = maxdma; + + scgp->maxdma = maxdma; /* Max possible */ + scgp->maxbuf = amt; /* Current value */ + + return (amt); +} + +/* + * Allocate a buffer that may be used for DMA. + */ +EXPORT void * +scg_getbuf(scgp, amt) + SCSI *scgp; + long amt; +{ + void *buf; + + if (amt <= 0 || amt > scg_bufsize(scgp, amt)) + return ((void *)0); + + buf = SCGO_GETBUF(scgp, amt); + scgp->bufptr = buf; + return (buf); +} + +/* + * Free DMA buffer. + */ +EXPORT void +scg_freebuf(scgp) + SCSI *scgp; +{ + SCGO_FREEBUF(scgp); + scgp->bufptr = NULL; +} + +/* + * Check if 'busno' is a valid SCSI bus number. + */ +EXPORT BOOL +scg_havebus(scgp, busno) + SCSI *scgp; + int busno; +{ + return (SCGO_HAVEBUS(scgp, busno)); +} + +/* + * Return SCSI initiator ID for current SCSI bus if available. + */ +EXPORT int +scg_initiator_id(scgp) + SCSI *scgp; +{ + return (SCGO_INITIATOR_ID(scgp)); +} + +/* + * Return a hint whether current SCSI target refers to a ATAPI device. + */ +EXPORT int +scg_isatapi(scgp) + SCSI *scgp; +{ + return (SCGO_ISATAPI(scgp)); +} + +/* + * Reset SCSI bus or target. + */ +EXPORT int +scg_reset(scgp, what) + SCSI *scgp; + int what; +{ + return (SCGO_RESET(scgp, what)); +} + +/* + * Set up nonstd error vector for curren target. + * To clear additional error table, call scg_setnonstderrs(scgp, NULL); + * Note: do not use this when scanning the SCSI bus. + */ +EXPORT void +scg_setnonstderrs(scgp, vec) + SCSI *scgp; + const char **vec; +{ + scgp->nonstderrs = vec; +} + +/* + * Simple Yes/No answer checker. + */ +EXPORT BOOL +scg_yes(msg) + char *msg; +{ + char okbuf[10]; + + js_printf("%s", msg); + flush(); + if (getline(okbuf, sizeof (okbuf)) == EOF) + exit(EX_BAD); + if (streql(okbuf, "y") || streql(okbuf, "yes") || + streql(okbuf, "Y") || streql(okbuf, "YES")) + return (TRUE); + else + return (FALSE); +} + +#ifdef nonono +LOCAL void +scg_sighandler(sig) + int sig; +{ + js_printf("\n"); + if (scsi_running) { + js_printf("Running command: %s\n", scsi_command); + js_printf("Resetting SCSI - Bus.\n"); + if (scg_reset(scgp) < 0) + errmsg("Cannot reset SCSI - Bus.\n"); + } + if (scg_yes("EXIT ? ")) + exit(sig); +} +#endif + +/* + * Send a SCSI command. + * Do error checking and reporting depending on the values of + * scgp->verbose, scgp->debug and scgp->silent. + */ +EXPORT int +scg_cmd(scgp) + SCSI *scgp; +{ + int ret; + register struct scg_cmd *scmd = scgp->scmd; + + /* + * Reset old error messages in scgp->errstr + */ + scgp->errptr = scgp->errbeg = scgp->errstr; + + scmd->kdebug = scgp->kdebug; + if (scmd->timeout == 0 || scmd->timeout < scgp->deftimeout) + scmd->timeout = scgp->deftimeout; + if (scgp->disre_disable) + scmd->flags &= ~SCG_DISRE_ENA; + if (scgp->noparity) + scmd->flags |= SCG_NOPARITY; + + scmd->u_sense.cmd_sense[0] = 0; /* Paranioa */ + if (scmd->sense_len > SCG_MAX_SENSE) + scmd->sense_len = SCG_MAX_SENSE; + else if (scmd->sense_len < 0) + scmd->sense_len = 0; + + if (scgp->verbose) { + scg_vhead(scgp); + scg_errflush(scgp); + } + + if (scgp->running) { + if (scgp->curcmdname) { + error("Currently running '%s' command.\n", + scgp->curcmdname); + } + raisecond("SCSI ALREADY RUNNING !!", 0L); + } + scgp->cb_fun = NULL; + gettimeofday(scgp->cmdstart, (struct timezone *)0); + scgp->curcmdname = scgp->cmdname; + scgp->running = TRUE; + ret = SCGO_SEND(scgp); + scgp->running = FALSE; + __scg_times(scgp); + if (ret < 0) { + /* + * Old /dev/scg versions will not allow to access targets > 7. + * Include a workaround to make this non fatal. + */ + if (scg_target(scgp) < 8 || geterrno() != EINVAL) + comerr("Cannot send SCSI cmd via ioctl\n"); + if (scmd->ux_errno == 0) + scmd->ux_errno = geterrno(); + if (scmd->error == SCG_NO_ERROR) + scmd->error = SCG_FATAL; + if (scgp->debug > 0) { + errmsg("ret < 0 errno: %d ux_errno: %d error: %d\n", + geterrno(), scmd->ux_errno, scmd->error); + } + } + + ret = scg_vtail(scgp); + scg_errflush(scgp); + if (scgp->cb_fun != NULL) + (*scgp->cb_fun)(scgp->cb_arg); + return (ret); +} + +/* + * Fill the head of verbose printing into the SCSI error buffer. + * Action depends on SCSI verbose status. + */ +EXPORT void +scg_vhead(scgp) + SCSI *scgp; +{ + scgp->errptr += scg_svhead(scgp, scgp->errptr, scg_errrsize(scgp)); +} + +/* + * Fill the head of verbose printing into a buffer. + * Action depends on SCSI verbose status. + */ +EXPORT int +scg_svhead(scgp, buf, maxcnt) + SCSI *scgp; + char *buf; + int maxcnt; +{ + register char *p = buf; + register int amt; + + if (scgp->verbose <= 0) + return (0); + + amt = js_snprintf(p, maxcnt, + "\nExecuting '%s' command on Bus %d Target %d, Lun %d timeout %ds\n", + /* XXX Really this ??? */ +/* scgp->cmdname, scg_scsibus(scgp), scg_target(scgp), scgp->scmd->cdb.g0_cdb.lun,*/ + scgp->cmdname, scg_scsibus(scgp), scg_target(scgp), scg_lun(scgp), + scgp->scmd->timeout); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + + amt = scg_sprintcdb(scgp, p, maxcnt); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + + if (scgp->verbose > 1) { + amt = scg_sprintwdata(scgp, p, maxcnt); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + } + return (p - buf); +} + +/* + * Fill the tail of verbose printing into the SCSI error buffer. + * Action depends on SCSI verbose status. + */ +EXPORT int +scg_vtail(scgp) + SCSI *scgp; +{ + int ret; + + scgp->errptr += scg_svtail(scgp, &ret, scgp->errptr, scg_errrsize(scgp)); + return (ret); +} + +/* + * Fill the tail of verbose printing into a buffer. + * Action depends on SCSI verbose status. + */ +EXPORT int +scg_svtail(scgp, retp, buf, maxcnt) + SCSI *scgp; + int *retp; + char *buf; + int maxcnt; +{ + register char *p = buf; + register int amt; + int ret; + + ret = scg_cmd_err(scgp) ? -1 : 0; + if (retp) + *retp = ret; + if (ret) { + if (scgp->silent <= 0 || scgp->verbose) { + amt = scg__sprinterr(scgp, p, maxcnt); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + } + } + if ((scgp->silent <= 0 || scgp->verbose) && scgp->scmd->resid) { + if (scgp->scmd->resid < 0) { + /* + * An operating system that does DMA the right way + * will not allow DMA overruns - it will stop DMA + * before bad things happen. + * A DMA residual count < 0 (-1) is a hint for a DMA + * overrun but does not affect the transfer count. + */ + amt = js_snprintf(p, maxcnt, "DMA overrun, "); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + } + amt = js_snprintf(p, maxcnt, "resid: %d\n", scgp->scmd->resid); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + } + if (scgp->verbose > 0 || (ret < 0 && scgp->silent <= 0)) { + amt = scg_sprintresult(scgp, p, maxcnt); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + } + return (p - buf); +} + +/* + * Set up SCSI error buffer with verbose print data. + * Action depends on SCSI verbose status. + */ +EXPORT void +scg_vsetup(scgp) + SCSI *scgp; +{ + scg_vhead(scgp); + scg_vtail(scgp); +} + +/* + * Return the residual DMA count for last command. + * If this count is < 0, then a DMA overrun occured. + */ +EXPORT int +scg_getresid(scgp) + SCSI *scgp; +{ + return (scgp->scmd->resid); +} + +/* + * Return the actual DMA count for last command. + */ +EXPORT int +scg_getdmacnt(scgp) + SCSI *scgp; +{ + register struct scg_cmd *scmd = scgp->scmd; + + if (scmd->resid < 0) + return (scmd->size); + + return (scmd->size - scmd->resid); +} + +/* + * Test if last SCSI command got an error. + */ +EXPORT BOOL +scg_cmd_err(scgp) + SCSI *scgp; +{ + register struct scg_cmd *cp = scgp->scmd; + + if (cp->error != SCG_NO_ERROR || + cp->ux_errno != 0 || + *(Uchar *)&cp->scb != 0 || + cp->u_sense.cmd_sense[0] != 0) /* Paranioa */ + return (TRUE); + return (FALSE); +} + +/* + * Used to print error messges if the command itself has been run silently. + * + * print the following SCSI codes: + * + * - command transport status + * - CDB + * - SCSI status byte + * - Sense Bytes + * - Decoded Sense data + * - DMA status + * - SCSI timing + * + * to SCSI errfile. + */ +EXPORT void +scg_printerr(scgp) + SCSI *scgp; +{ + scg_fprinterr(scgp, (FILE *)scgp->errfile); +} + +/* + * print the following SCSI codes: + * + * - command transport status + * - CDB + * - SCSI status byte + * - Sense Bytes + * - Decoded Sense data + * - DMA status + * - SCSI timing + * + * to a file. + */ +EXPORT void +scg_fprinterr(scgp, f) + SCSI *scgp; + FILE *f; +{ + char errbuf[SCSI_ERRSTR_SIZE]; + int amt; + + amt = scg_sprinterr(scgp, errbuf, sizeof (errbuf)); + if (amt > 0) { + filewrite(f, errbuf, amt); + fflush(f); + } +} + +/* + * print the following SCSI codes: + * + * - command transport status + * - CDB + * - SCSI status byte + * - Sense Bytes + * - Decoded Sense data + * - DMA status + * - SCSI timing + * + * into a buffer. + */ +EXPORT int +scg_sprinterr(scgp, buf, maxcnt) + SCSI *scgp; + char *buf; + int maxcnt; +{ + int amt; + int osilent = scgp->silent; + int overbose = scgp->verbose; + + scgp->silent = 0; + scgp->verbose = 0; + amt = scg_svtail(scgp, NULL, buf, maxcnt); + scgp->silent = osilent; + scgp->verbose = overbose; + return (amt); +} + +/* + * print the following SCSI codes: + * + * - command transport status + * - CDB + * - SCSI status byte + * - Sense Bytes + * - Decoded Sense data + * + * into a buffer. + */ +EXPORT int +scg__sprinterr(scgp, buf, maxcnt) + SCSI *scgp; + char *buf; + int maxcnt; +{ + register struct scg_cmd *cp = scgp->scmd; + register char *err; + char *cmdname = "SCSI command name not set by caller"; + char errbuf[64]; + register char *p = buf; + register int amt; + + switch (cp->error) { + + case SCG_NO_ERROR : err = "no error"; break; + case SCG_RETRYABLE: err = "retryable error"; break; + case SCG_FATAL : err = "fatal error"; break; + /* + * We need to cast timeval->* to long because + * of the broken sys/time.h in Linux. + */ + case SCG_TIMEOUT : js_snprintf(errbuf, sizeof (errbuf), + "cmd timeout after %ld.%03ld (%d) s", + (long)scgp->cmdstop->tv_sec, + (long)scgp->cmdstop->tv_usec/1000, + cp->timeout); + err = errbuf; + break; + default: js_snprintf(errbuf, sizeof (errbuf), + "error: %d", cp->error); + err = errbuf; + } + + if (scgp->cmdname != NULL && scgp->cmdname[0] != '\0') + cmdname = scgp->cmdname; + amt = serrmsgno(cp->ux_errno, p, maxcnt, "%s: scsi sendcmd: %s\n", cmdname, err); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + + amt = scg_sprintcdb(scgp, p, maxcnt); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + + if (cp->error <= SCG_RETRYABLE) { + amt = scg_sprintstatus(scgp, p, maxcnt); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + } + + if (cp->scb.chk) { + amt = scg_sprsense(p, maxcnt, (Uchar *)&cp->sense, cp->sense_count); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + amt = scg__errmsg(scgp, p, maxcnt, &cp->sense, &cp->scb, -1); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + } + return (p - buf); +} + +/* + * XXX Do we need this function? + * + * print the SCSI Command descriptor block to XXX stderr. + */ +EXPORT void +scg_printcdb(scgp) + SCSI *scgp; +{ + scg_prbytes("CDB: ", scgp->scmd->cdb.cmd_cdb, scgp->scmd->cdb_len); +} + +/* + * print the SCSI Command descriptor block into a buffer. + */ +EXPORT int +scg_sprintcdb(scgp, buf, maxcnt) + SCSI *scgp; + char *buf; + int maxcnt; +{ + int cnt; + + cnt = scg_sprbytes(buf, maxcnt, "CDB: ", scgp->scmd->cdb.cmd_cdb, scgp->scmd->cdb_len); + if (cnt < 0) + cnt = 0; + return (cnt); +} + +/* + * XXX Do we need this function? + * XXX scg_printrdata() is used. + * XXX We need to check if we should write to stderr or better to scg->errfile + * + * print the SCSI send data to stderr. + */ +EXPORT void +scg_printwdata(scgp) + SCSI *scgp; +{ + register struct scg_cmd *scmd = scgp->scmd; + + if (scmd->size > 0 && (scmd->flags & SCG_RECV_DATA) == 0) { + js_fprintf(stderr, "Sending %d (0x%X) bytes of data.\n", + scmd->size, scmd->size); + scg_prbytes("Write Data: ", + (Uchar *)scmd->addr, + scmd->size > 100 ? 100 : scmd->size); + } +} + +/* + * print the SCSI send data into a buffer. + */ +EXPORT int +scg_sprintwdata(scgp, buf, maxcnt) + SCSI *scgp; + char *buf; + int maxcnt; +{ + register struct scg_cmd *scmd = scgp->scmd; + register char *p = buf; + register int amt; + + if (scmd->size > 0 && (scmd->flags & SCG_RECV_DATA) == 0) { + amt = js_snprintf(p, maxcnt, + "Sending %d (0x%X) bytes of data.\n", + scmd->size, scmd->size); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + amt = scg_sprbytes(p, maxcnt, "Write Data: ", + (Uchar *)scmd->addr, + scmd->size > 100 ? 100 : scmd->size); + if (amt < 0) + return (amt); + p += amt; + } + return (p - buf); +} + +/* + * XXX We need to check if we should write to stderr or better to scg->errfile + * + * print the SCSI received data to stderr. + */ +EXPORT void +scg_printrdata(scgp) + SCSI *scgp; +{ + register struct scg_cmd *scmd = scgp->scmd; + register int trcnt = scg_getdmacnt(scgp); + + if (scmd->size > 0 && (scmd->flags & SCG_RECV_DATA) != 0) { + js_fprintf(stderr, "Got %d (0x%X), expecting %d (0x%X) bytes of data.\n", + trcnt, trcnt, + scmd->size, scmd->size); + scg_prbytes("Received Data: ", + (Uchar *)scmd->addr, + trcnt > 100 ? 100 : trcnt); + } +} + +/* + * print the SCSI received data into a buffer. + */ +EXPORT int +scg_sprintrdata(scgp, buf, maxcnt) + SCSI *scgp; + char *buf; + int maxcnt; +{ + register struct scg_cmd *scmd = scgp->scmd; + register char *p = buf; + register int amt; + register int trcnt = scg_getdmacnt(scgp); + + if (scmd->size > 0 && (scmd->flags & SCG_RECV_DATA) != 0) { + amt = js_snprintf(p, maxcnt, + "Got %d (0x%X), expecting %d (0x%X) bytes of data.\n", + trcnt, trcnt, + scmd->size, scmd->size); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + amt = scg_sprbytes(p, maxcnt, + "Received Data: ", + (Uchar *)scmd->addr, + trcnt > 100 ? 100 : trcnt); + if (amt < 0) + return (amt); + p += amt; + } + return (p - buf); +} + +/* + * XXX We need to check if we should write to stderr or better to scg->errfile + * + * print the SCSI timings and (depending on verbose) received data to stderr. + */ +EXPORT void +scg_printresult(scgp) + SCSI *scgp; +{ + js_fprintf(stderr, "cmd finished after %ld.%03lds timeout %ds\n", + (long)scgp->cmdstop->tv_sec, + (long)scgp->cmdstop->tv_usec/1000, + scgp->scmd->timeout); + if (scgp->verbose > 1) + scg_printrdata(scgp); + flush(); +} + +/* + * print the SCSI timings and (depending on verbose) received data into a buffer. + */ +EXPORT int +scg_sprintresult(scgp, buf, maxcnt) + SCSI *scgp; + char *buf; + int maxcnt; +{ + register char *p = buf; + register int amt; + + amt = js_snprintf(p, maxcnt, + "cmd finished after %ld.%03lds timeout %ds\n", + (long)scgp->cmdstop->tv_sec, + (long)scgp->cmdstop->tv_usec/1000, + scgp->scmd->timeout); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + if (scgp->verbose > 1) { + amt = scg_sprintrdata(scgp, p, maxcnt); + if (amt < 0) + return (amt); + p += amt; + } + return (p - buf); +} + +/* + * XXX Do we need this function? + * + * print the SCSI status byte in human readable form to the SCSI error file. + */ +EXPORT void +scg_printstatus(scgp) + SCSI *scgp; +{ + char errbuf[SCSI_ERRSTR_SIZE]; + int amt; + + amt = scg_sprintstatus(scgp, errbuf, sizeof (errbuf)); + if (amt > 0) { + filewrite((FILE *)scgp->errfile, errbuf, amt); + fflush((FILE *)scgp->errfile); + } +} + +/* + * print the SCSI status byte in human readable form into a buffer. + */ +EXPORT int +scg_sprintstatus(scgp, buf, maxcnt) + SCSI *scgp; + char *buf; + int maxcnt; +{ + register struct scg_cmd *cp = scgp->scmd; + char *err; + char *err2 = ""; + register char *p = buf; + register int amt; + + amt = js_snprintf(p, maxcnt, "status: 0x%x ", *(Uchar *)&cp->scb); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; +#ifdef SCSI_EXTENDED_STATUS + if (cp->scb.ext_st1) { + amt = js_snprintf(p, maxcnt, "0x%x ", ((Uchar *)&cp->scb)[1]); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + } + if (cp->scb.ext_st2) { + amt = js_snprintf(p, maxcnt, "0x%x ", ((Uchar *)&cp->scb)[2]); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + } +#endif + switch (*(Uchar *)&cp->scb & 036) { + + case 0 : err = "GOOD STATUS"; break; + case 02 : err = "CHECK CONDITION"; break; + case 04 : err = "CONDITION MET/GOOD"; break; + case 010: err = "BUSY"; break; + case 020: err = "INTERMEDIATE GOOD STATUS"; break; + case 024: err = "INTERMEDIATE CONDITION MET/GOOD"; break; + case 030: err = "RESERVATION CONFLICT"; break; + default : err = "Reserved"; break; + } +#ifdef SCSI_EXTENDED_STATUS + if (cp->scb.ext_st1 && cp->scb.ha_er) + err2 = " host adapter detected error"; +#endif + amt = js_snprintf(p, maxcnt, "(%s%s)\n", err, err2); + if (amt < 0) + return (amt); + p += amt; + return (p - buf); +} + +/* + * print some bytes in hex to a file. + */ +EXPORT void +scg_fprbytes(f, s, cp, n) + FILE *f; + char *s; + register Uchar *cp; + register int n; +{ + js_fprintf(f, "%s", s); + while (--n >= 0) + js_fprintf(f, " %02X", *cp++); + js_fprintf(f, "\n"); +} + +/* + * print some bytes in ascii to a file. + */ +EXPORT void +scg_fprascii(f, s, cp, n) + FILE *f; + char *s; + register Uchar *cp; + register int n; +{ + register int c; + + js_fprintf(f, "%s", s); + while (--n >= 0) { + c = *cp++; + if (c >= ' ' && c < 0177) + js_fprintf(f, "%c", c); + else + js_fprintf(f, "."); + } + js_fprintf(f, "\n"); +} + +/* + * XXX We need to check if we should write to stderr or better to scg->errfile + * + * print some bytes in hex to stderr. + */ +EXPORT void +scg_prbytes(s, cp, n) + char *s; + register Uchar *cp; + register int n; +{ + scg_fprbytes(stderr, s, cp, n); +} + +/* + * XXX We need to check if we should write to stderr or better to scg->errfile + * + * print some bytes in ascii to stderr. + */ +EXPORT void +scg_prascii(s, cp, n) + char *s; + register Uchar *cp; + register int n; +{ + scg_fprascii(stderr, s, cp, n); +} + +/* + * print some bytes in hex into a buffer. + */ +EXPORT int +scg_sprbytes(buf, maxcnt, s, cp, n) + char *buf; + int maxcnt; + char *s; + register Uchar *cp; + register int n; +{ + register char *p = buf; + register int amt; + + amt = js_snprintf(p, maxcnt, "%s", s); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + + while (--n >= 0) { + amt = js_snprintf(p, maxcnt, " %02X", *cp++); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + } + amt = js_snprintf(p, maxcnt, "\n"); + if (amt < 0) + return (amt); + p += amt; + return (p - buf); +} + +/* + * print some bytes in ascii into a buffer. + */ +EXPORT int +scg_sprascii(buf, maxcnt, s, cp, n) + char *buf; + int maxcnt; + char *s; + register Uchar *cp; + register int n; +{ + register char *p = buf; + register int amt; + register int c; + + amt = js_snprintf(p, maxcnt, "%s", s); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + + while (--n >= 0) { + c = *cp++; + if (c >= ' ' && c < 0177) + amt = js_snprintf(p, maxcnt, "%c", c); + else + amt = js_snprintf(p, maxcnt, "."); + if (amt < 0) + return (amt); + p += amt; + maxcnt -= amt; + } + amt = js_snprintf(p, maxcnt, "\n"); + if (amt < 0) + return (amt); + p += amt; + return (p - buf); +} + +/* + * print the SCSI sense data for last command in hex to a file. + */ +EXPORT void +scg_fprsense(f, cp, n) + FILE *f; + Uchar *cp; + int n; +{ + scg_fprbytes(f, "Sense Bytes:", cp, n); +} + +/* + * XXX We need to check if we should write to stderr or better to scg->errfile + * + * print the SCSI sense data for last command in hex to stderr. + */ +EXPORT void +scg_prsense(cp, n) + Uchar *cp; + int n; +{ + scg_fprsense(stderr, cp, n); +} + +/* + * print the SCSI sense data for last command in hex into a buffer. + */ +EXPORT int +scg_sprsense(buf, maxcnt, cp, n) + char *buf; + int maxcnt; + Uchar *cp; + int n; +{ + return (scg_sprbytes(buf, maxcnt, "Sense Bytes:", cp, n)); +} + +/* + * Return the SCSI status byte for last command. + */ +EXPORT int +scg_cmd_status(scgp) + SCSI *scgp; +{ + struct scg_cmd *cp = scgp->scmd; + int cmdstatus = *(Uchar *)&cp->scb; + + return (cmdstatus); +} + +/* + * Return the SCSI sense key for last command. + */ +EXPORT int +scg_sense_key(scgp) + SCSI *scgp; +{ + register struct scg_cmd *cp = scgp->scmd; + int key = -1; + + if (!scg_cmd_err(scgp)) + return (0); + + if (cp->sense.code >= 0x70) + key = ((struct scsi_ext_sense *)&(cp->sense))->key; + return (key); +} + +/* + * Return the SCSI sense code for last command. + */ +EXPORT int +scg_sense_code(scgp) + SCSI *scgp; +{ + register struct scg_cmd *cp = scgp->scmd; + int code = -1; + + if (!scg_cmd_err(scgp)) + return (0); + + if (cp->sense.code >= 0x70) + code = ((struct scsi_ext_sense *)&(cp->sense))->sense_code; + else + code = cp->sense.code; + return (code); +} + +/* + * Return the SCSI sense qualifier for last command. + */ +EXPORT int +scg_sense_qual(scgp) + SCSI *scgp; +{ + register struct scg_cmd *cp = scgp->scmd; + + if (!scg_cmd_err(scgp)) + return (0); + + if (cp->sense.code >= 0x70) + return (((struct scsi_ext_sense *)&(cp->sense))->qual_code); + else + return (0); +} + +/* + * Print the device type from the SCSI inquiry buffer to file. + */ +EXPORT void +scg_fprintdev(f, ip) + FILE *f; + struct scsi_inquiry *ip; +{ + if (ip->removable) + js_fprintf(f, "Removable "); + if (ip->data_format >= 2) { + switch (ip->qualifier) { + + case INQ_DEV_PRESENT: + break; + case INQ_DEV_NOTPR: + js_fprintf(f, "not present "); + break; + case INQ_DEV_RES: + js_fprintf(f, "reserved "); + break; + case INQ_DEV_NOTSUP: + if (ip->type == INQ_NODEV) { + js_fprintf(f, "unsupported\n"); return; + } + js_fprintf(f, "unsupported "); + break; + default: + js_fprintf(f, "vendor specific %d ", + (int)ip->qualifier); + } + } + switch (ip->type) { + + case INQ_DASD: + js_fprintf(f, "Disk"); break; + case INQ_SEQD: + js_fprintf(f, "Tape"); break; + case INQ_PRTD: + js_fprintf(f, "Printer"); break; + case INQ_PROCD: + js_fprintf(f, "Processor"); break; + case INQ_WORM: + js_fprintf(f, "WORM"); break; + case INQ_ROMD: + js_fprintf(f, "CD-ROM"); break; + case INQ_SCAN: + js_fprintf(f, "Scanner"); break; + case INQ_OMEM: + js_fprintf(f, "Optical Storage"); break; + case INQ_JUKE: + js_fprintf(f, "Juke Box"); break; + case INQ_COMM: + js_fprintf(f, "Communication"); break; + case INQ_IT8_1: + js_fprintf(f, "IT8 1"); break; + case INQ_IT8_2: + js_fprintf(f, "IT8 2"); break; + case INQ_STARR: + js_fprintf(f, "Storage array"); break; + case INQ_ENCL: + js_fprintf(f, "Enclosure services"); break; + case INQ_SDAD: + js_fprintf(f, "Simple direct access"); break; + case INQ_OCRW: + js_fprintf(f, "Optical card r/w"); break; + case INQ_BRIDGE: + js_fprintf(f, "Bridging expander"); break; + case INQ_OSD: + js_fprintf(f, "Object based storage"); break; + case INQ_ADC: + js_fprintf(f, "Automation/Drive Interface"); break; + case INQ_WELLKNOWN: + js_fprintf(f, "Well known lun"); break; + + case INQ_NODEV: + if (ip->data_format >= 2) { + js_fprintf(f, "unknown/no device"); + break; + } else if (ip->qualifier == INQ_DEV_NOTSUP) { + js_fprintf(f, "unit not present"); + break; + } + default: + js_fprintf(f, "unknown device type 0x%x", + (int)ip->type); + } + js_fprintf(f, "\n"); +} + +/* + * Print the device type from the SCSI inquiry buffer to stdout. + */ +EXPORT void +scg_printdev(ip) + struct scsi_inquiry *ip; +{ + scg_fprintdev(stdout, ip); +} + +#include <vadefs.h> + +/* + * print into the SCSI error buffer, adjust the next write pointer. + */ +/* VARARGS2 */ +EXPORT int +#ifdef PROTOTYPES +scg_printf(SCSI *scgp, const char *form, ...) +#else +scg_printf(scgp, form, va_alist) + SCSI *scgp; + char *form; + va_dcl +#endif +{ + int cnt; + va_list args; + +#ifdef PROTOTYPES + va_start(args, form); +#else + va_start(args); +#endif + cnt = js_snprintf(scgp->errptr, scg_errrsize(scgp), "%r", form, args); + va_end(args); + + if (cnt < 0) { + scgp->errptr[0] = '\0'; + } else { + scgp->errptr += cnt; + } + return (cnt); +} + +/* + * Flush the SCSI error buffer to SCSI errfile. + * Clear error buffer after flushing. + */ +EXPORT int +scg_errflush(scgp) + SCSI *scgp; +{ + if (scgp->errfile == NULL) + return (0); + + return (scg_errfflush(scgp, (FILE *)scgp->errfile)); +} + +/* + * Flush the SCSI error buffer to a file. + * Clear error buffer after flushing. + */ +EXPORT int +scg_errfflush(scgp, f) + SCSI *scgp; + FILE *f; +{ + int cnt; + + cnt = scgp->errptr - scgp->errbeg; + if (cnt > 0) { + filewrite(f, scgp->errbeg, cnt); + fflush(f); + scgp->errbeg = scgp->errptr; + } + return (cnt); +} diff --git a/scsilib/libschily/Makefile b/scsilib/libschily/Makefile new file mode 100644 index 0000000..6e0967d --- /dev/null +++ b/scsilib/libschily/Makefile @@ -0,0 +1,13 @@ +#ident "%W% %E% %Q%" +########################################################################### +SRCROOT= .. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +#MK_FILES= libschily.mk libschily_p.mk shlschily.mk +MK_FILES= libschily.mk + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.mks +########################################################################### diff --git a/scsilib/libschily/Targets b/scsilib/libschily/Targets new file mode 100644 index 0000000..2503c82 --- /dev/null +++ b/scsilib/libschily/Targets @@ -0,0 +1,35 @@ +CFILES_STDIO= cvmod.c dat.c fcons.c fdown.c fdup.c \ + ffileread.c ffilewrite.c \ + fgetline.c fgetstr.c file_raise.c \ + fileclose.c fileluopen.c fileopen.c filemopen.c \ + filepos.c fileread.c filereopen.c fileseek.c filesize.c \ + filestat.c filewrite.c flag.c flush.c fpipe.c \ + niread.c niwrite.c nixread.c nixwrite.c openfd.c peekc.c \ + fcons64.c fdup64.c fileluopen64.c fileopen64.c filemopen64.c \ + filepos64.c filereopen64.c fileseek64.c filesize64.c \ + filestat64.c openfd64.c + +# +# Note: getfp.c must be before getav0.c +# Otherwise getfp.o would be made as dependency of avoffset +# + +CFILES_REST= astoi.c astoll.c breakline.c \ + comerr.c cmpbytes.c cmpnullbytes.c \ + error.c \ + fconv.c fexec.c fillbytes.c \ + findbytes.c findline.c format.c \ + getargs.c getav0.c geterrno.c getfp.c \ + getdomainname.c gethostid.c gethostname.c getpagesize.c \ + handlecond.c \ + jsprintf.c jssnprintf.c jssprintf.c \ + match.c matchl.c movebytes.c \ + printf.c \ + raisecond.c rename.c \ + saveargs.c serrmsg.c seterrno.c setfp.c \ + snprintf.c spawn.c \ + sprintf.c strcatl.c strdup.c streql.c \ + swabbytes.c \ + usleep.c + +CFILES= $(CFILES_STDIO) $(CFILES_REST) diff --git a/scsilib/libschily/astoi.c b/scsilib/libschily/astoi.c new file mode 100644 index 0000000..9e0381c --- /dev/null +++ b/scsilib/libschily/astoi.c @@ -0,0 +1,140 @@ +/* @(#)astoi.c 1.8 03/06/15 Copyright 1985, 1995-2003 J. Schilling */ +/* + * astoi() converts a string to int + * astol() converts a string to long + * + * Leading tabs and spaces are ignored. + * Both return pointer to the first char that has not been used. + * Caller must check if this means a bad conversion. + * + * leading "+" is ignored + * leading "0" makes conversion octal (base 8) + * leading "0x" makes conversion hex (base 16) + * + * Copyright (c) 1985, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <standard.h> +#include <schily.h> + +#define is_space(c) ((c) == ' ' || (c) == '\t') +#define is_digit(c) ((c) >= '0' && (c) <= '9') +#define is_hex(c) (\ + ((c) >= 'a' && (c) <= 'f') || \ + ((c) >= 'A' && (c) <= 'F')) + +#define to_lower(c) (((c) >= 'A' && (c) <= 'Z') ? (c) - 'A'+'a' : (c)) + +#ifdef notdef +EXPORT int +atoi(s) + char *s; +{ + long l; + + (void) astol(s, &l); + return ((int) l); +} + +EXPORT long +atol(s) + char *s; +{ + long l; + + (void) astol(s, &l); + return (l); +} +#endif + +EXPORT char * +astoi(s, i) + const char *s; + int *i; +{ + long l; + char *ret; + + ret = astol(s, &l); + *i = l; + return (ret); +} + +EXPORT char * +astol(s, l) + register const char *s; + long *l; +{ + return (astolb(s, l, 0)); +} + +EXPORT char * +astolb(s, l, base) + register const char *s; + long *l; + register int base; +{ + int neg = 0; + register long ret = 0L; + register int digit; + register char c; + + while (is_space(*s)) + s++; + + if (*s == '+') { + s++; + } else if (*s == '-') { + s++; + neg++; + } + + if (base == 0) { + if (*s == '0') { + base = 8; + s++; + if (*s == 'x' || *s == 'X') { + s++; + base = 16; + } + } else { + base = 10; + } + } + for (; (c = *s) != 0; s++) { + + if (is_digit(c)) { + digit = c - '0'; + } else if (is_hex(c)) { + digit = to_lower(c) - 'a' + 10; + } else { + break; + } + + if (digit < base) { + ret *= base; + ret += digit; + } else { + break; + } + } + if (neg) + ret = -ret; + *l = ret; + return ((char *)s); +} diff --git a/scsilib/libschily/astoll.c b/scsilib/libschily/astoll.c new file mode 100644 index 0000000..eee9097 --- /dev/null +++ b/scsilib/libschily/astoll.c @@ -0,0 +1,109 @@ +/* @(#)astoll.c 1.3 03/06/15 Copyright 1985, 2000-2003 J. Schilling */ +/* + * astoll() converts a string to long long + * + * Leading tabs and spaces are ignored. + * Both return pointer to the first char that has not been used. + * Caller must check if this means a bad conversion. + * + * leading "+" is ignored + * leading "0" makes conversion octal (base 8) + * leading "0x" makes conversion hex (base 16) + * + * Llong is silently reverted to long if the compiler does not + * support long long. + * + * Copyright (c) 1985, 2000-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <standard.h> +#include <utypes.h> +#include <schily.h> + +#define is_space(c) ((c) == ' ' || (c) == '\t') +#define is_digit(c) ((c) >= '0' && (c) <= '9') +#define is_hex(c) (\ + ((c) >= 'a' && (c) <= 'f') || \ + ((c) >= 'A' && (c) <= 'F')) + +#define to_lower(c) (((c) >= 'A' && (c) <= 'Z') ? (c) - 'A'+'a' : (c)) + +char * +astoll(s, l) + register const char *s; + Llong *l; +{ + return (astollb(s, l, 0)); +} + +char * +astollb(s, l, base) + register const char *s; + Llong *l; + register int base; +{ + int neg = 0; + register Llong ret = (Llong)0; + register int digit; + register char c; + + while (is_space(*s)) + s++; + + if (*s == '+') { + s++; + } else if (*s == '-') { + s++; + neg++; + } + + if (base == 0) { + if (*s == '0') { + base = 8; + s++; + if (*s == 'x' || *s == 'X') { + s++; + base = 16; + } + } else { + base = 10; + } + } + for (; (c = *s) != 0; s++) { + + if (is_digit(c)) { + digit = c - '0'; + } else if (is_hex(c)) { + digit = to_lower(c) - 'a' + 10; + } else { + break; + } + + if (digit < base) { + ret *= base; + ret += digit; + } else { + break; + } + } + if (neg) + ret = -ret; + *l = ret; + return ((char *)s); +} diff --git a/scsilib/libschily/breakline.c b/scsilib/libschily/breakline.c new file mode 100644 index 0000000..37d9be9 --- /dev/null +++ b/scsilib/libschily/breakline.c @@ -0,0 +1,65 @@ +/* @(#)breakline.c 1.9 03/06/15 Copyright 1985, 1995-2003 J. Schilling */ +/* + * break a line pointed to by *buf into fields + * returns the number of tokens, the line was broken into (>= 1) + * + * delim is the delimiter to break at + * array[0 .. found-1] point to strings from broken line + * array[found ... len] point to '\0' + * len is the size of the array + * + * Copyright (c) 1985, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <standard.h> +#include <schily.h> + +#ifdef PROTOTYPES +EXPORT int +breakline(char *buf, + register char delim, + register char *array[], + register int len) +#else +EXPORT int +breakline(buf, delim, array, len) + char *buf; + register char delim; + register char *array[]; + register int len; +#endif +{ + register char *bp = buf; + register char *dp; + register int i; + register int found; + + for (i = 0, found = 1; i < len; i++) { + for (dp = bp; *dp != '\0' && *dp != delim; dp++) + ; + + array[i] = bp; + if (*dp == delim) { + *dp++ = '\0'; + found++; + } + bp = dp; + } + return (found); +} diff --git a/scsilib/libschily/cmpbytes.c b/scsilib/libschily/cmpbytes.c new file mode 100644 index 0000000..b4ff871 --- /dev/null +++ b/scsilib/libschily/cmpbytes.c @@ -0,0 +1,115 @@ +/* @(#)cmpbytes.c 1.15 03/06/15 Copyright 1988, 1995-2003 J. Schilling */ +#ifndef lint +static char sccsid[] = + "@(#)cmpbytes.c 1.15 03/06/15 Copyright 1988, 1995-2003 J. Schilling"; +#endif /* lint */ +/* + * compare data + * + * Copyright (c) 1988, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <standard.h> +#include <align.h> +#include <schily.h> + +#define DO8(a) a; a; a; a; a; a; a; a; + +EXPORT int +cmpbytes(fromp, top, cnt) + const void *fromp; + const void *top; + int cnt; +{ + register const char *from = (char *)fromp; + register const char *to = (char *)top; + register int n; + register int i; + + /* + * If we change cnt to be unsigned, check for == instead of <= + */ + if ((n = cnt) <= 0) + return (cnt); + + /* + * Compare byte-wise until properly aligned for a long pointer. + */ + i = sizeof (long) - 1; + while (--n >= 0 && --i >= 0 && !l2aligned(from, to)) { + if (*to++ != *from++) + goto cdiff; + } + n++; + + if (n >= (int)(8 * sizeof (long))) { + if (l2aligned(from, to)) { + register const long *froml = (const long *)from; + register const long *tol = (const long *)to; + register int rem = n % (8 * sizeof (long)); + + n /= (8 * sizeof (long)); + do { + DO8( + if (*tol++ != *froml++) + break; + ); + } while (--n > 0); + + if (n > 0) { + --froml; + --tol; + to = (const char *)tol; + from = (const char *)froml; + goto ldiff; + } + to = (const char *)tol; + from = (const char *)froml; + n = rem; + } + + if (n >= 8) { + n -= 8; + do { + DO8( + if (*to++ != *from++) + goto cdiff; + ); + } while ((n -= 8) >= 0); + n += 8; + } + if (n > 0) do { + if (*to++ != *from++) + goto cdiff; + } while (--n > 0); + return (cnt); + } + if (n > 0) do { + if (*to++ != *from++) + goto cdiff; + } while (--n > 0); + return (cnt); +ldiff: + n = sizeof (long); + do { + if (*to++ != *from++) + goto cdiff; + } while (--n > 0); +cdiff: + return (--from - (char *)fromp); +} diff --git a/scsilib/libschily/cmpnullbytes.c b/scsilib/libschily/cmpnullbytes.c new file mode 100644 index 0000000..5f6a8e8 --- /dev/null +++ b/scsilib/libschily/cmpnullbytes.c @@ -0,0 +1,107 @@ +/* @(#)cmpnullbytes.c 1.2 03/06/15 Copyright 1988,2002-2003 J. Schilling */ +#ifndef lint +static char sccsid[] = + "@(#)cmpnullbytes.c 1.2 03/06/15 Copyright 1988,2002-2003 J. Schilling"; +#endif /* lint */ +/* + * compare data against null + * + * Copyright (c) 1988,2002-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <standard.h> +#include <align.h> +#include <schily.h> + +#define DO8(a) a; a; a; a; a; a; a; a; + +EXPORT int +cmpnullbytes(fromp, cnt) + const void *fromp; + int cnt; +{ + register const char *from = (char *)fromp; + register int n; + + /* + * If we change cnt to be unsigned, check for == instead of <= + */ + if ((n = cnt) <= 0) + return (cnt); + + /* + * Compare byte-wise until properly aligned for a long pointer. + */ + while (--n >= 0 && !laligned(from)) { + if (*from++ != 0) + goto cdiff; + } + n++; + + if (n >= (int)(8 * sizeof (long))) { + if (laligned(from)) { + register const long *froml = (const long *)from; + register int rem = n % (8 * sizeof (long)); + + n /= (8 * sizeof (long)); + do { + DO8( + if (*froml++ != 0) + break; + ); + } while (--n > 0); + + if (n > 0) { + --froml; + from = (const char *)froml; + goto ldiff; + } + from = (const char *)froml; + n = rem; + } + + if (n >= 8) { + n -= 8; + do { + DO8( + if (*from++ != 0) + goto cdiff; + ); + } while ((n -= 8) >= 0); + n += 8; + } + if (n > 0) do { + if (*from++ != 0) + goto cdiff; + } while (--n > 0); + return (cnt); + } + if (n > 0) do { + if (*from++ != 0) + goto cdiff; + } while (--n > 0); + return (cnt); +ldiff: + n = sizeof (long); + do { + if (*from++ != 0) + goto cdiff; + } while (--n > 0); +cdiff: + return (--from - (char *)fromp); +} diff --git a/scsilib/libschily/comerr.c b/scsilib/libschily/comerr.c new file mode 100644 index 0000000..dddf5ff --- /dev/null +++ b/scsilib/libschily/comerr.c @@ -0,0 +1,255 @@ +/* @(#)comerr.c 1.29 03/06/15 Copyright 1985-1989, 1995-2003 J. Schilling */ +/* + * Routines for printing command errors + * + * Copyright (c) 1985-1989, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <unixstd.h> /* include <sys/types.h> try to get size_t */ +#include <stdio.h> /* Try again for size_t */ +#include <stdxlib.h> /* Try again for size_t */ +#include <standard.h> +#include <vadefs.h> +#include <strdefs.h> +#include <schily.h> +#include <errno.h> +#ifndef HAVE_STRERROR +extern char *sys_errlist[]; +extern int sys_nerr; +#endif + +EXPORT int on_comerr __PR((void (*fun)(int, void *), void *arg)); +EXPORT void comerr __PR((const char *, ...)); +EXPORT void comerrno __PR((int, const char *, ...)); +EXPORT int errmsg __PR((const char *, ...)); +EXPORT int errmsgno __PR((int, const char *, ...)); +LOCAL int _comerr __PR((int, int, const char *, va_list)); +EXPORT void comexit __PR((int)); +EXPORT char *errmsgstr __PR((int)); + +typedef struct ex { + struct ex *next; + void (*func) __PR((int, void *)); + void *arg; +} ex_t; + +LOCAL ex_t *exfuncs; + +EXPORT int +on_comerr(func, arg) + void (*func) __PR((int, void *)); + void *arg; +{ + ex_t *fp; + + fp = malloc(sizeof (*fp)); + if (fp == NULL) + return (-1); + + fp->func = func; + fp->arg = arg; + fp->next = exfuncs; + exfuncs = fp; + return (0); +} + +/* VARARGS1 */ +#ifdef PROTOTYPES +EXPORT void +comerr(const char *msg, ...) +#else +EXPORT void +comerr(msg, va_alist) + char *msg; + va_dcl +#endif +{ + va_list args; + +#ifdef PROTOTYPES + va_start(args, msg); +#else + va_start(args); +#endif + (void) _comerr(TRUE, geterrno(), msg, args); + /* NOTREACHED */ + va_end(args); +} + +/* VARARGS2 */ +#ifdef PROTOTYPES +EXPORT void +comerrno(int err, const char *msg, ...) +#else +EXPORT void +comerrno(err, msg, va_alist) + int err; + char *msg; + va_dcl +#endif +{ + va_list args; + +#ifdef PROTOTYPES + va_start(args, msg); +#else + va_start(args); +#endif + (void) _comerr(TRUE, err, msg, args); + /* NOTREACHED */ + va_end(args); +} + +/* VARARGS1 */ +#ifdef PROTOTYPES +EXPORT int +errmsg(const char *msg, ...) +#else +EXPORT int +errmsg(msg, va_alist) + char *msg; + va_dcl +#endif +{ + va_list args; + int ret; + +#ifdef PROTOTYPES + va_start(args, msg); +#else + va_start(args); +#endif + ret = _comerr(FALSE, geterrno(), msg, args); + va_end(args); + return (ret); +} + +/* VARARGS2 */ +#ifdef PROTOTYPES +EXPORT int +errmsgno(int err, const char *msg, ...) +#else +EXPORT int +errmsgno(err, msg, va_alist) + int err; + char *msg; + va_dcl +#endif +{ + va_list args; + int ret; + +#ifdef PROTOTYPES + va_start(args, msg); +#else + va_start(args); +#endif + ret = _comerr(FALSE, err, msg, args); + va_end(args); + return (ret); +} + +#ifdef __BEOS__ + /* + * On BeOS errno is a big negative number (0x80000000 + small number). + * We assume that small negative numbers are safe to be used as special + * values that prevent printing the errno text. + * + * We tried to use #if EIO < 0 but this does not work because EIO is + * defined to a enum. ENODEV may work as ENODEV is defined to a number + * directly. + */ +#define silent_error(e) ((e) < 0 && (e) >= -1024) +#else + /* + * On UNIX errno is a small non-negative number, so we assume that + * negative values cannot be a valid errno and don't print the error + * string in this case. However the value may still be used as exit() + * code if 'exflg' is set. + */ +#define silent_error(e) ((e) < 0) +#endif +LOCAL int +_comerr(exflg, err, msg, args) + int exflg; + int err; + const char *msg; + va_list args; +{ + char errbuf[20]; + char *errnam; + char *prognam = get_progname(); + + if (silent_error(err)) { + error("%s: %r", prognam, msg, args); + } else { + errnam = errmsgstr(err); + if (errnam == NULL) { + (void) js_snprintf(errbuf, sizeof (errbuf), + "Error %d", err); + errnam = errbuf; + } + error("%s: %s. %r", prognam, errnam, msg, args); + } + if (exflg) { + comexit(err); + /* NOTREACHED */ + } + return (err); +} + +EXPORT void +comexit(err) + int err; +{ + while (exfuncs) { + (*exfuncs->func)(err, exfuncs->arg); + exfuncs = exfuncs->next; + } + exit(err); + /* NOTREACHED */ +} + +EXPORT char * +errmsgstr(err) + int err; +{ +#ifdef HAVE_STRERROR + /* + * POSIX compliance may look strange... + */ + int errsav = geterrno(); + char *ret; + + seterrno(0); + ret = strerror(err); + err = geterrno(); + seterrno(errsav); + + if (ret == NULL || err) + return (NULL); + return (ret); +#else + if (err < 0 || err >= sys_nerr) { + return (NULL); + } else { + return (sys_errlist[err]); + } +#endif +} diff --git a/scsilib/libschily/cvt.c b/scsilib/libschily/cvt.c new file mode 100644 index 0000000..8d57e70 --- /dev/null +++ b/scsilib/libschily/cvt.c @@ -0,0 +1,263 @@ +/* @(#)cvt.c 1.7 03/06/15 Copyright 1998 J. Schilling */ +/* + * Compatibility routines for 4.4BSD based C-libraries ecvt()/fcvt() + * and a working gcvt() that is needed on 4.4BSD and GNU libc systems. + * + * On 4.4BSD, gcvt() is missing, the gcvt() implementation from GNU libc + * is not working correctly. + * + * Neither __dtoa() nor [efg]cvt() are MT safe. + * + * Copyright (c) 1998 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <stdxlib.h> +#include <utypes.h> +#include <standard.h> + +#ifdef HAVE_DTOA /* 4.4BSD floating point implementation */ +#ifdef HAVE_DTOA_R +extern char *__dtoa __PR((double value, int mode, int ndigit, int *decpt, int *sign, char **ep, char **resultp)); +#else +extern char *__dtoa __PR((double value, int mode, int ndigit, int *decpt, int *sign, char **ep)); +#endif +#else + +#if !defined(HAVE_ECVT) +/* + * As a hint from Thomas Langer <Langer.Thomas@gmx.net>, we use strtod.c in + * hope that we then will be able to print floating point numbers on all + * platforms, even those without *cvt() and without __dtoa() in libc. + * + * ... of course, we need to decide when we need to include strtod.c ... + * + * We come into this file if autoconf found that gcvt(), fcvt() or ecvt() is + * missing. If we are on a *BSD alike system, there is __dtoa() but neither + * gcvt() nor fcvt() or ecvt(), so we emulate all three functions via __dtoa(). + * Glibc has a buggy gcvt() which causes an endless recursion, + * fcvt() from Cygwin32 is buggy, so we emulate fcvt() via ecvt() on Cygwin. + * + * If at least ecvt() is present, we don't need __dtoa() from strtod.c + */ +#include "strtod.c" +#define HAVE_DTOA +#endif /* !defined(HAVE_ECVT) */ + +#endif /* HAVE_DTOA */ + +#ifndef HAVE_ECVT +EXPORT char *ecvt __PR((double value, int ndigit, int *decpt, int *sign)); +#endif +#ifndef HAVE_FCVT +EXPORT char *fcvt __PR((double value, int ndigit, int *decpt, int *sign)); +#endif +#ifndef HAVE_GCVT +EXPORT char *gcvt __PR((double value, int ndigit, char *buf)); +#endif + +#if !defined(HAVE_ECVT) && defined(HAVE_DTOA) +#define HAVE_ECVT +char * +ecvt(value, ndigit, decpt, sign) + double value; + int ndigit; + int *decpt; + int *sign; +{ +static Uint bufsize; +static char *buf; + char *bufend; + char *ep; + char *bp; +#ifdef HAVE_DTOA_R +static char *result; +#endif + +#ifdef HAVE_DTOA_R + if (result) { + free(result); + result = NULL; + } + bp = __dtoa(value, 2, ndigit, decpt, sign, &ep, &result); +#else + bp = __dtoa(value, 2, ndigit, decpt, sign, &ep); +#endif + + if (value == 0.0) { + /* + * Handle __dtoa()'s deviation from ecvt(): + * 0.0 is converted to "0" instead of 'ndigit' zeroes. + * The string "0" is not allocated, so + * we need to allocate buffer to hold 'ndigit' zeroes. + */ + if (bufsize < ndigit + 1) { + if (buf != (char *)0) + free(buf); + bufsize = ndigit + 1; + buf = malloc(bufsize); + } + ep = bp = buf; + } + + /* + * Fill up trailing zeroes suppressed by __dtoa() + * From an internal __dtoa() comment: + * Sufficient space is allocated to the return value + * to hold the suppressed trailing zeros. + */ + for (bufend = &bp[ndigit]; ep < bufend; ) + *ep++ = '0'; + *ep = '\0'; + + return (bp); +} +#endif + +#if !defined(HAVE_FCVT) && defined(HAVE_DTOA) +#define HAVE_FCVT +char * +fcvt(value, ndigit, decpt, sign) + double value; + int ndigit; + int *decpt; + int *sign; +{ +static Uint bufsize; +static char *buf; + char *bufend; + char *ep; + char *bp; +#ifdef HAVE_DTOA_R +static char *result; +#endif + +#ifdef HAVE_DTOA_R + if (result) { + free(result); + result = NULL; + } + bp = __dtoa(value, 3, ndigit, decpt, sign, &ep, &result); +#else + bp = __dtoa(value, 3, ndigit, decpt, sign, &ep); +#endif + + if (value == 0.0) { + /* + * Handle __dtoa()'s deviation from fcvt(): + * 0.0 is converted to "0" instead of 'ndigit' zeroes. + * The string "0" is not allocated, so + * we need to allocate buffer to hold 'ndigit' zeroes. + */ + if (bufsize < ndigit + 1) { + if (buf != (char *)0) + free(buf); + bufsize = ndigit + 1; + buf = malloc(bufsize); + } + ep = bp = buf; + *decpt = 0; + } + + /* + * Fill up trailing zeroes suppressed by __dtoa() + * From an internal __dtoa() comment: + * Sufficient space is allocated to the return value + * to hold the suppressed trailing zeros. + */ + for (bufend = &bp[*decpt + ndigit]; ep < bufend; ) + *ep++ = '0'; + *ep = '\0'; + + return (bp); +} +#endif + +#ifndef HAVE_GCVT +#define HAVE_GCVT +char * +gcvt(number, ndigit, buf) + double number; + int ndigit; + char *buf; +{ + int sign; + int decpt; + register char *b; + register char *rs; + register int i; + + b = ecvt(number, ndigit, &decpt, &sign); + rs = buf; + if (sign) + *rs++ = '-'; + for (i = ndigit-1; i > 0 && b[i] == '0'; i--) + ndigit--; +#ifdef V7_FLOATSTYLE + if ((decpt >= 0 && decpt-ndigit > 4) || +#else + if ((decpt >= 0 && decpt-ndigit > 0) || +#endif + (decpt < 0 && decpt < -3)) { /* e-format */ + decpt--; + *rs++ = *b++; + *rs++ = '.'; + for (i = 1; i < ndigit; i++) + *rs++ = *b++; + *rs++ = 'e'; + if (decpt < 0) { + decpt = -decpt; + *rs++ = '-'; + } else { + *rs++ = '+'; + } + if (decpt >= 100) { + *rs++ = decpt / 100 + '0'; + decpt %= 100; + } + *rs++ = decpt / 10 + '0'; + *rs++ = decpt % 10 + '0'; + } else { /* f-format */ + if (decpt <= 0) { + if (*b != '0') { +#ifndef V7_FLOATSTYLE + *rs++ = '0'; +#endif + *rs++ = '.'; + } + while (decpt < 0) { + decpt++; + *rs++ = '0'; + } + } + for (i = 1; i <= ndigit; i++) { + *rs++ = *b++; + if (i == decpt) + *rs++ = '.'; + } + if (ndigit < decpt) { + while (ndigit++ < decpt) + *rs++ = '0'; + *rs++ = '.'; + } + } + if (rs[-1] == '.') + rs--; + *rs = '\0'; + return (buf); +} +#endif diff --git a/scsilib/libschily/error.c b/scsilib/libschily/error.c new file mode 100644 index 0000000..d965cac --- /dev/null +++ b/scsilib/libschily/error.c @@ -0,0 +1,51 @@ +/* @(#)error.c 1.13 03/06/15 Copyright 1985, 1989, 1995-2003 J. Schilling */ +/* + * fprintf() on standard error stdio stream + * + * Copyright (c) 1985, 1989, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <stdio.h> +#include <standard.h> +#include <vadefs.h> +#include <schily.h> + +/* VARARGS1 */ +#ifdef PROTOTYPES +EXPORT int +error(const char *fmt, ...) +#else +EXPORT int +error(fmt, va_alist) + char *fmt; + va_dcl +#endif +{ + va_list args; + int ret; + +#ifdef PROTOTYPES + va_start(args, fmt); +#else + va_start(args); +#endif + ret = js_fprintf(stderr, "%r", fmt, args); + va_end(args); + return (ret); +} diff --git a/scsilib/libschily/fconv.c b/scsilib/libschily/fconv.c new file mode 100644 index 0000000..d88e741 --- /dev/null +++ b/scsilib/libschily/fconv.c @@ -0,0 +1,268 @@ +/* @(#)fconv.c 1.33 03/11/23 Copyright 1985, 1995-2003 J. Schilling */ +/* + * Convert floating point numbers to strings for format.c + * Should rather use the MT-safe routines [efg]convert() + * + * Copyright (c) 1985, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> /* <- may define NO_FLOATINGPOINT */ +#ifndef NO_FLOATINGPOINT + +#include <stdxlib.h> +#include <standard.h> +#include <strdefs.h> +#include <schily.h> + +#if !defined(HAVE_STDLIB_H) || defined(HAVE_DTOA) +extern char *ecvt __PR((double, int, int *, int *)); +extern char *fcvt __PR((double, int, int *, int *)); +#endif + +#if defined(HAVE_ISNAN) && defined(HAVE_ISINF) +/* + * *BSD alike libc + */ +#define FOUND_ISXX +#endif + +#include <math.h> + +#if defined(HAVE_FP_H) && !defined(FOUND_ISXX) +/* + * WAS: + * #if defined(__osf__) || defined(_IBMR2) || defined(_AIX) + */ +/* + * Moved before HAVE_IEEEFP_H for True64 due to a hint + * from Bert De Knuydt <Bert.Deknuydt@esat.kuleuven.ac.be> + * + * True64 has both fp.h & ieeefp.h but the functions + * isnand() & finite() seem to be erreneously not implemented + * as a macro and the function lives in libm. + * Let's hope that we will not get problems with the new order. + */ +#include <fp.h> +#ifndef isnan +#define isnan IS_NAN +#endif +#ifndef isinf +#define isinf !FINITE +/*#define isinf IS_INF*/ +#endif +#define FOUND_ISXX +#endif + +#if defined(HAVE_IEEEFP_H) && !defined(FOUND_ISXX) +/* + * SVR4 + */ +#include <ieeefp.h> +#ifndef isnan +#define isnan isnand +#endif +#ifndef isinf +#define isinf !finite +#endif +#define FOUND_ISXX +#endif + +/* + * WAS: + * #if defined(__hpux) || defined(VMS) || defined(_SCO_DS) || defined(__QNX__) + */ +#if defined(__hpux) || defined(__QNX__) || defined(__DJGPP__) +#undef isnan +#undef isinf +#endif + +#if !defined(isnan) && !defined(HAVE_ISNAN) +#define isnan(val) (0) +#endif +#if !defined(isinf) && !defined(HAVE_ISINF) +#define isinf(val) (0) +#endif + +#if !defined(HAVE_ECVT) || !defined(HAVE_FCVT) || !defined(HAVE_GCVT) +#include "cvt.c" +#endif + +static char _js_nan[] = "(NaN)"; +static char _js_inf[] = "(Infinity)"; + +static int _ferr __PR((char *, double)); + +#ifdef abs +# undef abs +#endif +#define abs(i) ((i) < 0 ? -(i) : (i)) + +EXPORT int +ftoes(s, val, fieldwidth, ndigits) + register char *s; + double val; + register int fieldwidth; + register int ndigits; +{ + register char *b; + register char *rs; + register int len; + register int rdecpt; + int decpt; + int sign; + + if ((len = _ferr(s, val)) > 0) + return (len); + rs = s; +#ifdef V7_FLOATSTYLE + b = ecvt(val, ndigits, &decpt, &sign); + rdecpt = decpt; +#else + b = ecvt(val, ndigits+1, &decpt, &sign); + rdecpt = decpt-1; +#endif + len = ndigits + 6; /* Punkt e +/- nnn */ + if (sign) + len++; + if (fieldwidth > len) + while (fieldwidth-- > len) + *rs++ = ' '; + if (sign) + *rs++ = '-'; +#ifndef V7_FLOATSTYLE + if (*b) + *rs++ = *b++; +#endif + *rs++ = '.'; + while (*b && ndigits-- > 0) + *rs++ = *b++; + *rs++ = 'e'; + *rs++ = rdecpt >= 0 ? '+' : '-'; + rdecpt = abs(rdecpt); +#ifndef V7_FLOATSTYLE + if (rdecpt >= 100) +#endif + { + *rs++ = rdecpt / 100 + '0'; + rdecpt %= 100; + } + *rs++ = rdecpt / 10 + '0'; + *rs++ = rdecpt % 10 + '0'; + *rs = '\0'; + return (rs - s); +} + +/* + * fcvt() from Cygwin32 is buggy. + */ +#if !defined(HAVE_FCVT) && defined(HAVE_ECVT) +#define USE_ECVT +#endif + +EXPORT int +ftofs(s, val, fieldwidth, ndigits) + register char *s; + double val; + register int fieldwidth; + register int ndigits; +{ + register char *b; + register char *rs; + register int len; + register int rdecpt; + int decpt; + int sign; + + if ((len = _ferr(s, val)) > 0) + return (len); + rs = s; +#ifdef USE_ECVT + /* + * Needed on systems with broken fcvt() implementation + * (e.g. Cygwin32) + */ + b = ecvt(val, ndigits, &decpt, &sign); + /* + * The next call is needed to force higher precision. + */ + if (decpt > 0) + b = ecvt(val, ndigits+decpt, &decpt, &sign); +#else + b = fcvt(val, ndigits, &decpt, &sign); +#endif + rdecpt = decpt; + len = rdecpt + ndigits + 1; + if (rdecpt < 0) + len -= rdecpt; + if (sign) + len++; + if (fieldwidth > len) + while (fieldwidth-- > len) + *rs++ = ' '; + if (sign) + *rs++ = '-'; + if (rdecpt > 0) { + len = rdecpt; + while (*b && len-- > 0) + *rs++ = *b++; +#ifdef USE_ECVT + while (len-- > 0) + *rs++ = '0'; +#endif + } +#ifndef V7_FLOATSTYLE + else { + *rs++ = '0'; + } +#endif + *rs++ = '.'; + if (rdecpt < 0) { + len = rdecpt; + while (len++ < 0 && ndigits-- > 0) + *rs++ = '0'; + } + while (*b && ndigits-- > 0) + *rs++ = *b++; +#ifdef USE_ECVT + while (ndigits-- > 0) + *rs++ = '0'; +#endif + *rs = '\0'; + return (rs - s); +} + +LOCAL int +_ferr(s, val) + char *s; + double val; +{ + if (isnan(val)) { + strcpy(s, _js_nan); + return (sizeof (_js_nan) - 1); + } + + /* + * Check first for NaN because finite() will return 1 on Nan too. + */ + if (isinf(val)) { + strcpy(s, _js_inf); + return (sizeof (_js_inf) - 1); + } + return (0); +} +#endif /* NO_FLOATINGPOINT */ diff --git a/scsilib/libschily/fexec.c b/scsilib/libschily/fexec.c new file mode 100644 index 0000000..e945725 --- /dev/null +++ b/scsilib/libschily/fexec.c @@ -0,0 +1,408 @@ +/* @(#)fexec.c 1.24 04/06/06 Copyright 1985, 1995-2004 J. Schilling */ +/* + * Execute a program with stdio redirection + * + * Copyright (c) 1985, 1995-2004 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <stdio.h> +#include <standard.h> +#define fexecl __nothing_1_ /* prototype in schily.h is wrong */ +#define fexecle __nothing_2_ /* prototype in schily.h is wrong */ +#include <schily.h> +#undef fexecl +#undef fexecle + int fexecl __PR((const char *, FILE *, FILE *, FILE *, ...)); + int fexecle __PR((const char *, FILE *, FILE *, FILE *, ...)); +#include <unixstd.h> +#include <stdxlib.h> +#include <strdefs.h> +#include <vadefs.h> + +#ifdef JOS +# include <error.h> +#else +# include <errno.h> +#endif +#include <fctldefs.h> +#include <dirdefs.h> +#include <maxpath.h> + +#define MAX_F_ARGS 16 + +extern char **environ; + +LOCAL void fdcopy __PR((int, int)); +LOCAL void fdmove __PR((int, int)); +LOCAL const char *chkname __PR((const char *, const char *)); +LOCAL const char *getpath __PR((char * const *)); + +#ifdef PROTOTYPES +EXPORT int +fexecl(const char *name, FILE *in, FILE *out, FILE *err, ...) +#else +EXPORT int +fexecl(name, in, out, err, va_alist) + char *name; + FILE *in; + FILE *out; + FILE *err; + va_dcl +#endif +{ + va_list args; + int ac = 0; + char *xav[MAX_F_ARGS]; + char **av; + char **pav; + char *p; + int ret; + +#ifdef PROTOTYPES + va_start(args, err); +#else + va_start(args); +#endif + while (va_arg(args, char *) != NULL) + ac++; + va_end(args); + + if (ac < MAX_F_ARGS) { + pav = av = xav; + } else { + pav = av = (char **)malloc((ac+1)*sizeof (char *)); + if (av == 0) + return (-1); + } + +#ifdef PROTOTYPES + va_start(args, err); +#else + va_start(args); +#endif + do { + p = va_arg(args, char *); + *pav++ = p; + } while (p != NULL); + va_end(args); + + ret = fexecv(name, in, out, err, ac, av); + if (av != xav) + free(av); + return (ret); +} + +#ifdef PROTOTYPES +EXPORT int +fexecle(const char *name, FILE *in, FILE *out, FILE *err, ...) +#else +EXPORT int +fexecle(name, in, out, err, va_alist) + char *name; + FILE *in; + FILE *out; + FILE *err; + va_dcl +#endif +{ + va_list args; + int ac = 0; + char *xav[MAX_F_ARGS]; + char **av; + char **pav; + char *p; + char **env; + int ret; + +#ifdef PROTOTYPES + va_start(args, err); +#else + va_start(args); +#endif + while (va_arg(args, char *) != NULL) + ac++; + env = va_arg(args, char **); + va_end(args); + + if (ac < MAX_F_ARGS) { + pav = av = xav; + } else { + pav = av = (char **)malloc((ac+1)*sizeof (char *)); + if (av == 0) + return (-1); + } + +#ifdef PROTOTYPES + va_start(args, err); +#else + va_start(args); +#endif + do { + p = va_arg(args, char *); + *pav++ = p; + } while (p != NULL); + va_end(args); + + ret = fexecve(name, in, out, err, av, env); + if (av != xav) + free(av); + return (ret); +} + +EXPORT int +fexecv(name, in, out, err, ac, av) + const char *name; + FILE *in, *out, *err; + int ac; + char *av[]; +{ + av[ac] = NULL; /* force list to be null terminated */ + return (fexecve(name, in, out, err, av, environ)); +} + +EXPORT int +fexecve(name, in, out, err, av, env) + const char *name; + FILE *in, *out, *err; + char * const av[], * const env[]; +{ + char nbuf[MAXPATHNAME+1]; + char *np; + const char *path; + int ret; + int fin; + int fout; + int ferr; +#ifndef JOS + int o[3]; + int f[3]; + int errsav; +#endif + + fflush(out); + fflush(err); + fin = fdown(in); + fout = fdown(out); + ferr = fdown(err); +#ifdef JOS + + /* + * If name contains a pathdelimiter ('/' on unix) + * or name is too long ... + * try exec without path search. + */ + if (find('/', name) || strlen(name) > MAXFILENAME) { + ret = exec_env(name, fin, fout, ferr, av, env); + + } else if ((path = getpath(env)) == NULL) { + ret = exec_env(name, fin, fout, ferr, av, env); + if ((ret == ENOFILE) && strlen(name) <= (sizeof (nbuf) - 6)) { + strcatl(nbuf, "/bin/", name, (char *)NULL); + ret = exec_env(nbuf, fin, fout, ferr, av, env); + if (ret == EMISSDIR) + ret = ENOFILE; + } + } else { + int nlen = strlen(name); + + for (;;) { + np = nbuf; + /* + * JOS always uses ':' as PATH Environ separator + */ + while (*path != ':' && *path != '\0' && + np < &nbuf[MAXPATHNAME-nlen-2]) { + + *np++ = *path++; + } + *np = '\0'; + if (*nbuf == '\0') + strcatl(nbuf, name, (char *)NULL); + else + strcatl(nbuf, nbuf, "/", name, (char *)NULL); + ret = exec_env(nbuf, fin, fout, ferr, av, env); + if (ret == EMISSDIR) + ret = ENOFILE; + if (ret != ENOFILE || *path == '\0') + break; + path++; + } + } + return (ret); + +#else /* JOS */ + + if (fin != 0) { + f[0] = fcntl(0, F_GETFD, 0); + o[0] = dup(0); + fcntl(o[0], F_SETFD, 1); + fdcopy(fin, 0); + } + if (fout != 1) { + f[1] = fcntl(1, F_GETFD, 0); + o[1] = dup(1); + fcntl(o[1], F_SETFD, 1); + fdcopy(fout, 1); + } + if (ferr != 2) { + f[2] = fcntl(2, F_GETFD, 0); + o[2] = dup(2); + fcntl(o[2], F_SETFD, 1); + fdcopy(ferr, 2); + } + if (fin != 0) + close(fin); + if (fout != 1) + close(fout); + if (ferr != 2) + close(ferr); + + /* + * If name contains a pathdelimiter ('/' on unix) + * or name is too long ... + * try exec without path search. + */ +#ifdef FOUND_MAXFILENAME + if (strchr(name, '/') || strlen(name) > (unsigned)MAXFILENAME) { +#else + if (strchr(name, '/')) { +#endif + ret = execve(name, av, env); + + } else if ((path = getpath(env)) == NULL) { + ret = execve(name, av, env); + if ((geterrno() == ENOENT) && strlen(name) <= (sizeof (nbuf) - 6)) { + strcatl(nbuf, "/bin/", name, (char *)NULL); + ret = execve(nbuf, av, env); + } + } else { + int nlen = strlen(name); + + for (;;) { + np = nbuf; + while (*path != PATH_ENV_DELIM && *path != '\0' && + np < &nbuf[MAXPATHNAME-nlen-2]) { + + *np++ = *path++; + } + *np = '\0'; + if (*nbuf == '\0') + strcatl(nbuf, name, (char *)NULL); + else + strcatl(nbuf, nbuf, "/", name, (char *)NULL); + ret = execve(nbuf, av, env); + if (geterrno() != ENOENT || *path == '\0') + break; + path++; + } + } + errsav = geterrno(); + /* reestablish old files */ + if (ferr != 2) { + fdmove(2, ferr); + fdmove(o[2], 2); + if (f[2] == 0) + fcntl(2, F_SETFD, 0); + } + if (fout != 1) { + fdmove(1, fout); + fdmove(o[1], 1); + if (f[1] == 0) + fcntl(1, F_SETFD, 0); + } + if (fin != 0) { + fdmove(0, fin); + fdmove(o[0], 0); + if (f[0] == 0) + fcntl(0, F_SETFD, 0); + } + seterrno(errsav); + return (ret); + +#endif /* JOS */ +} + +#ifndef JOS + +LOCAL void +fdcopy(fd1, fd2) + int fd1; + int fd2; +{ + close(fd2); + fcntl(fd1, F_DUPFD, fd2); +} + +LOCAL void +fdmove(fd1, fd2) + int fd1; + int fd2; +{ + fdcopy(fd1, fd2); + close(fd1); +} + +#endif + +/*---------------------------------------------------------------------------- +| +| get PATH from env +| ++----------------------------------------------------------------------------*/ + +LOCAL const char * +getpath(env) + char * const *env; +{ + char * const *p = env; + const char *p2; + + if (p != NULL) { + while (*p != NULL) { + if ((p2 = chkname("PATH", *p)) != NULL) + return (p2); + p++; + } + } + return (NULL); +} + + +/*---------------------------------------------------------------------------- +| +| Check if name is in environment. +| Return pointer to value name is found. +| ++----------------------------------------------------------------------------*/ + +LOCAL const char * +chkname(name, ev) + const char *name; + const char *ev; +{ + for (;;) { + if (*name != *ev) { + if (*ev == '=' && *name == '\0') + return (++ev); + return (NULL); + } + name++; + ev++; + } +} diff --git a/scsilib/libschily/fillbytes.c b/scsilib/libschily/fillbytes.c new file mode 100644 index 0000000..7c96c8b --- /dev/null +++ b/scsilib/libschily/fillbytes.c @@ -0,0 +1,99 @@ +/* @(#)fillbytes.c 1.13 03/06/15 Copyright 1987, 1995-2003 J. Schilling */ +/* + * fill memory with data + * + * Copyright (c) 1987, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <standard.h> +#include <align.h> +#include <schily.h> + +#define DO8(a) a; a; a; a; a; a; a; a; + +#define cval ((char) lval) + +#ifdef PROTOTYPES +EXPORT char * +fillbytes(void *tov, int cnt, char val) +#else +EXPORT char * +fillbytes(tov, cnt, val) + void *tov; + int cnt; + char val; +#endif +{ + register char *to = (char *)tov; + register int n; + register long lval; + + /* + * If we change cnt to be unsigned, check for == instead of <= + */ + if ((n = cnt) <= 0) + return (to); + + lval = val & 0xFF; + + /* + * Assign byte-wise until properly aligned for a long pointer. + */ + while (--n >= 0 && !laligned(to)) { + *to++ = cval; + } + n++; + + if (n >= (int)(8 * sizeof (long))) { + register int rem = n % (8 * sizeof (long)); + + lval |= (lval<<8); + lval |= (lval<<16); +#if SIZE_LONG > SIZE_INT + lval |= (lval<<32); +#endif + + n /= (8 * sizeof (long)); + { + register long *tol = (long *)to; + + do { + DO8 (*tol++ = lval); + } while (--n > 0); + + to = (char *)tol; + } + n = rem; + + if (n >= 8) { + n -= 8; + do { + DO8 (*to++ = cval); + } while ((n -= 8) >= 0); + n += 8; + } + if (n > 0) do { + *to++ = cval; + } while (--n > 0); + return (to); + } + if (n > 0) do { + *to++ = cval; + } while (--n > 0); + return (to); +} diff --git a/scsilib/libschily/findbytes.c b/scsilib/libschily/findbytes.c new file mode 100644 index 0000000..d931c5c --- /dev/null +++ b/scsilib/libschily/findbytes.c @@ -0,0 +1,153 @@ +/* @(#)findbytes.c 1.2 03/06/15 Copyright 2000-2003 J. Schilling */ +/* + * Find a byte with specific value in memory. + * + * Copyright (c) 2000-2003 J. Schilling + * + * Based on a strlen() idea from Torbjorn Granlund (tege@sics.se) and + * Dan Sahlin (dan@sics.se) and the memchr() suggestion + * from Dick Karpinski (dick@cca.ucsf.edu). + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <stdxlib.h> +#include <utypes.h> +#include <align.h> +#include <standard.h> +#include <strdefs.h> +#include <schily.h> + +#ifdef PROTOTYPES +EXPORT char * +findbytes(const void *vp, int cnt, char val) +#else +EXPORT char * +findbytes(vp, cnt, val) + const void *vp; + register int cnt; + char val; +#endif +{ + register Uchar uval = (Uchar)val; + register const Uchar *cp = (Uchar *)vp; + register const Ulong *lp; + register Ulong lval; + register Ulong lmask; + register Ulong magic_mask; + + /* + * Test byte-wise until cp is properly aligned for a long pointer. + */ + while (--cnt >= 0 && !laligned(cp)) { + if (*cp++ == uval) + return ((char *)--cp); + } + cnt++; + + /* + * The magic mask is a long word where all carry bits a clear. + * This are bits 8, 16, 24 ... + * In addition, the top bit is not set (e.g bit 31 or 63). The magic + * mask will look this way: + * + * bits: 01111110 11111110 ... 11111110 11111111 + * bytes: AAAAAAAA BBBBBBBB ... CCCCCCCC DDDDDDDD + * + * If we add anything to this magic number, no carry bit will change if + * it is the first carry bit left to a 0 byte. Adding anything != 0 + * to the magic number will just turn the carry bit left to the byte + * but does not propagate any further. + */ +#if SIZE_LONG == 4 + magic_mask = 0x7EFEFEFFL; +#else +#if SIZE_LONG == 8 + magic_mask = 0x7EFEFEFEFEFEFEFFL; +#else + /* + * #error will not work for all compilers (e.g. sunos4) + * The following line will abort compilation on all compilers + * if none of the above is defines. And that's what we want. + */ + error SIZE_LONG has unknown value +#endif +#endif + + lmask = val & 0xFF; + lmask |= lmask << 8; + lmask |= lmask << 16; +#if SIZE_LONG > 4 + lmask |= lmask << 32; +#endif +#if SIZE_LONG > 8 + error SIZE_LONG has unknown value +#endif + for (lp = (const Ulong *)cp; cnt >= sizeof (long); cnt -= sizeof (long)) { + /* + * We are not looking for 0 bytes so we need to xor with the + * long mask of repeated bytes. If any of the bytes matches our + * wanted char, we will create a 0 byte in the current long. + * But how will we find if at least one byte in a long is zero? + * + * If we add 'magic_mask' and any of the holes in the magic + * mask do not change, we most likely found a 0 byte in the + * long word. It is only a most likely match because if bits + * 24..30 (ot bits 56..62) are 0 but bit 31 (or bit 63) is set + * we will believe that we found a match but there is none. + * This will happen if there is 0x80nnnnnn / 0x80nnnnnnnnnnnnnn + */ + lval = (*lp++ ^ lmask); /* create 0 byte on match */ + lval = (lval + magic_mask) ^ ~lval; /* set bits unchanged by +*/ + if ((lval & ~magic_mask) != 0) { /* a magic hole was set */ + /* + * If any of the hole bits did not change by addition, + * we most likely had a match. + * If this was a correct match, find the matching byte. + */ + cp = (const Uchar *)(lp - 1); + + if (cp[0] == uval) + return ((char *)cp); + if (cp[1] == uval) + return ((char *)&cp[1]); + if (cp[2] == uval) + return ((char *)&cp[2]); + if (cp[3] == uval) + return ((char *)&cp[3]); +#if SIZE_LONG > 4 + if (cp[4] == uval) + return ((char *)&cp[4]); + if (cp[5] == uval) + return ((char *)&cp[5]); + if (cp[6] == uval) + return ((char *)&cp[6]); + if (cp[7] == uval) + return ((char *)&cp[7]); +#endif +#if SIZE_LONG > 8 + error SIZE_LONG has unknown value +#endif + } + } + + for (cp = (const Uchar *)lp; --cnt >= 0; ) { + if (*cp++ == uval) + return ((char *)--cp); + } + return ((char *)NULL); +} diff --git a/scsilib/libschily/findline.c b/scsilib/libschily/findline.c new file mode 100644 index 0000000..2e7ea17 --- /dev/null +++ b/scsilib/libschily/findline.c @@ -0,0 +1,176 @@ +/* @(#)findline.c 1.15 04/09/04 Copyright 1985, 1995-2003 J. Schilling */ +/* + * findline + * get a line from a file with matching string in a given field + * + * ofindline + * get a line from open file with matching string in a given field + * + * getbroken + * separate a line into fields + * + * all fill pointers into the given array, allocated to new storage + * + * Copyright (c) 1985, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#define USE_LARGEFILES /* We must make this module large file aware */ + +#include <mconfig.h> +#include <stdio.h> +#include <standard.h> +#include <stdxlib.h> +#include <unixstd.h> /* Include sys/types.h to make off_t available */ +#include <strdefs.h> +#include <schily.h> + +#define MAXLBUF 4096 + +/* + * Return codes: + */ +#define SUCCESS 1 /* Found match */ +#define NO_MATCH -1 /* Found no line with matching string */ +#define ARG_ERROR -2 /* Bad parameter combination: */ + /* calls raisecond("findline_arg_err") before */ +#define OPEN_ERROR -3 /* Cannot open file */ +#define NO_MEM -4 /* No memory: */ + /* calls raisescond("findline_storage") before */ + +EXPORT int ofindline __PR((FILE *, char, const char *, int, + char **, int)); +EXPORT int findline __PR((const char *, char, const char *, int, + char **, int)); +EXPORT int getbroken __PR((FILE *, char *, char, char **, int)); + +LOCAL char *savestr __PR((const char *)); + +#ifdef PROTOTYPES +EXPORT int +ofindline(FILE *f, + char delim, + const char *string, + int field, + char *array[], + int arraysize) +#else +EXPORT int +ofindline(f, delim, string, field, array, arraysize) + FILE *f; + char delim; + char *string; + int field; + char *array[]; + int arraysize; +#endif +{ + int i; + char lbuf[MAXLBUF]; + + if (field >= arraysize) { + raisecond("findline_arg_err", 0L); + return (ARG_ERROR); + } + + fileseek(f, (off_t)0); /* XXX ??? Interface �ndern!!! */ + for (;;) { + if (getbroken(f, lbuf, delim, array, arraysize) < 0) { + return (NO_MATCH); + } + if (streql(string, array[field])) { + for (i = 0; i < arraysize; i++) { + if ((array[i] = savestr(array[i])) == NULL) { + raisecond("findline_storage", 0L); + while (--i >= 0) + free(array[i]); + return (NO_MEM); + } + } + return (SUCCESS); + } + } +} + +#ifdef PROTOTYPES +EXPORT int +findline(const char *fname, + char delim, + const char *string, + int field, + char *array[], + int arraysize) +#else +EXPORT int +findline(fname, delim, string, field, array, arraysize) + char *fname; + char delim; + char *string; + int field; + char *array[]; + int arraysize; +#endif +{ + FILE *f; + int ret; + + if ((f = fileopen(fname, "r")) == 0) + return (OPEN_ERROR); + + ret = ofindline(f, delim, string, field, array, arraysize); + fclose(f); + return (ret); +} + +#ifdef PROTOTYPES +EXPORT int +getbroken(FILE *f, + char *linebuf, + char delim, + char *array[], + int len) +#else +EXPORT int +getbroken(f, linebuf, delim, array, len) + FILE *f; + char *linebuf; + char delim; + char *array[]; + int len; +#endif +{ + if (fgetline(f, linebuf, MAXLBUF) < 0) + return (EOF); + + breakline(linebuf, delim, array, len); + return (SUCCESS); +} + +LOCAL char * +savestr(s) + register const char *s; +{ + register char *p; + char *ret; + + if ((p = malloc(strlen(s)+1)) == NULL) + return (p); + ret = p; + while ((*p++ = *s++) != '\0') + ; + return (ret); +} diff --git a/scsilib/libschily/format.c b/scsilib/libschily/format.c new file mode 100644 index 0000000..43a11ca --- /dev/null +++ b/scsilib/libschily/format.c @@ -0,0 +1,966 @@ +/* @(#)format.c 1.38 03/10/18 Copyright 1985-2003 J. Schilling */ +/* + * format + * common code for printf fprintf & sprintf + * + * allows recursive printf with "%r", used in: + * error, comerr, comerrno, errmsg, errmsgno and the like + * + * Copyright (c) 1985-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <vadefs.h> +#include <strdefs.h> +#include <stdxlib.h> +#ifdef DEBUG +#include <unixstd.h> +#endif +#if !defined(HAVE_STDLIB_H) || !defined(HAVE_GCVT) +extern char *gcvt __PR((double, int, char *)); +#endif +#include <standard.h> +#include <utypes.h> +#include <schily.h> + +/* + * As Llong is currently a 'best effort' long long, we usually need to + * include long long print formats. + * This may go away, if we implement maxint_t formats. + */ +#define USE_LONGLONG + +#ifdef NO_LONGLONG +#undef USE_LONGLONG +#endif + +/* + * Some CPU's (e.g. PDP-11) cannot do logical shifts. + * They use rotate instead. Masking the low bits before, + * makes rotate work too. + */ +#define allmask(t) ((unsigned t)~((unsigned t)0)) +#define lowmask(t, x) ((unsigned t)~((unsigned t)((1 << (x))-1))) +#define rshiftmask(t, s)((allmask(t) & lowmask(t, s)) >> (s)) + +#define CHARMASK makemask(char) +#define SHORTMASK makemask(short) +#define INTMASK makemask(int) +#define LONGMASK makemask(long) + +#ifdef DIVLBYS +extern long divlbys(); +extern long modlbys(); +#else +#define divlbys(val, base) ((val)/(base)) +#define modlbys(val, base) ((val)%(base)) +#endif + +/* + * We use macros here to avoid the need to link to the international + * character routines. + * We don't need internationalization for our purpose. + */ +#define is_dig(c) (((c) >= '0') && ((c) <= '9')) +#define is_cap(c) ((c) >= 'A' && (c) <= 'Z') +#define to_cap(c) (is_cap(c) ? c : c - 'a' + 'A') +#define cap_ty(c) (is_cap(c) ? 'L' : 'I') + +#ifdef HAVE_LONGLONG +typedef union { + Ullong ll; + Ulong l[2]; + char c[8]; +} quad_u; +#endif + +typedef struct f_args { + void (*outf)__PR((char, long)); /* Func from format(fun, arg) */ + long farg; /* Arg from format (fun, arg) */ + int minusflag; /* Fieldwidth is negative */ + int flags; /* General flags (+-#) */ + int fldwidth; /* Field width as in %3d */ + int signific; /* Significant chars as in %.4d */ + int lzero; /* Left '0' pad flag */ + char *buf; /* Out print buffer */ + char *bufp; /* Write ptr into buffer */ + char fillc; /* Left fill char (' ' or '0') */ + char *prefix; /* Prefix to print before buf */ + int prefixlen; /* Len of prefix ('+','-','0x') */ +} f_args; + +#define MINUSFLG 1 /* '-' flag */ +#define PLUSFLG 2 /* '+' flag */ +#define SPACEFLG 4 /* ' ' flag */ +#define HASHFLG 8 /* '#' flag */ + +LOCAL void prnum __PR((Ulong, unsigned, f_args *)); +LOCAL void prdnum __PR((Ulong, f_args *)); +LOCAL void pronum __PR((Ulong, f_args *)); +LOCAL void prxnum __PR((Ulong, f_args *)); +LOCAL void prXnum __PR((Ulong, f_args *)); +#ifdef USE_LONGLONG +LOCAL void prlnum __PR((Ullong, unsigned, f_args *)); +LOCAL void prldnum __PR((Ullong, f_args *)); +LOCAL void prlonum __PR((Ullong, f_args *)); +LOCAL void prlxnum __PR((Ullong, f_args *)); +LOCAL void prlXnum __PR((Ullong, f_args *)); +#endif +LOCAL int prbuf __PR((const char *, f_args *)); +LOCAL int prc __PR((char, f_args *)); +LOCAL int prstring __PR((const char *, f_args *)); +#ifdef DEBUG +LOCAL void dbg_print __PR((char *fmt, int a, int b, int c, int d, int e, int f, int g, int h, int i)); +#endif + + +#ifdef PROTOTYPES +EXPORT int +format(void (*fun)(char, long), + long farg, + const char *fmt, + va_list args) +#else +EXPORT int +format(fun, farg, fmt, args) + register void (*fun)(); + register long farg; + register char *fmt; + va_list args; +#endif +{ +#ifdef FORMAT_LOW_MEM + char buf[512]; +#else + char buf[8192]; +#endif + const char *sfmt; + register int unsflag; + register long val; + register char type; + register char mode; + register char c; + int count; + int i; + short sh; + const char *str; + double dval; +#ifdef USE_LONGLONG + Llong llval = 0; +#endif + Ulong res; + char *rfmt; + f_args fa; + + fa.outf = fun; + fa.farg = farg; + count = 0; + /* + * Main loop over the format string. + * Increment and check for end of string is made here. + */ + for (; *fmt != '\0'; fmt++) { + c = *fmt; + while (c != '%') { + if (c == '\0') + return (count); + (*fun)(c, farg); + c = *(++fmt); + count++; + } + + /* + * We reached a '%' sign. + */ + buf[0] = '\0'; + fa.buf = fa.bufp = buf; + fa.minusflag = 0; + fa.flags = 0; + fa.fldwidth = 0; + fa.signific = -1; + fa.lzero = 0; + fa.fillc = ' '; + fa.prefixlen = 0; + sfmt = fmt; + unsflag = FALSE; + type = '\0'; + mode = '\0'; + newflag: + switch (*(++fmt)) { + + case '+': + fa.flags |= PLUSFLG; + goto newflag; + + case '-': + fa.minusflag++; + goto newflag; + + case ' ': + /* + * If the space and the + flag are present, + * the space flag will be ignored. + */ + fa.flags |= SPACEFLG; + goto newflag; + + case '#': + fa.flags |= HASHFLG; + goto newflag; + + case '0': + /* + * '0' is a flag. + */ + fa.fillc = '0'; + goto newflag; + } + if (*fmt == '*') { + fmt++; + fa.fldwidth = va_arg(args, int); + /* + * A negative fieldwith is a minus flag with a + * positive fieldwidth. + */ + if (fa.fldwidth < 0) { + fa.fldwidth = -fa.fldwidth; +/* fa.minusflag ^= 1;*/ + fa.minusflag = 1; + } + } else while (c = *fmt, is_dig(c)) { + fa.fldwidth *= 10; + fa.fldwidth += c - '0'; + fmt++; + } + if (*fmt == '.') { + fmt++; + fa.signific = 0; + if (*fmt == '*') { + fmt++; + fa.signific = va_arg(args, int); + if (fa.signific < 0) + fa.signific = 0; + } else while (c = *fmt, is_dig(c)) { + fa.signific *= 10; + fa.signific += c - '0'; + fmt++; + } + } + if (strchr("UCSIL", *fmt)) { + /* + * Enhancements to K&R and ANSI: + * + * got a type specifyer + * + * XXX 'S' in C99 is %ls, 'S' should become 'H' + */ + if (*fmt == 'U') { + fmt++; + unsflag = TRUE; + } + if (!strchr("CSILZODX", *fmt)) { + /* + * Got only 'U'nsigned specifyer, + * use default type and mode. + */ + type = 'I'; + mode = 'D'; + fmt--; + } else if (!strchr("CSIL", *fmt)) { + /* + * no type, use default + */ + type = 'I'; + mode = *fmt; + } else { + /* + * got CSIL + */ + type = *fmt++; + if (!strchr("ZODX", mode = *fmt)) { + fmt--; + mode = 'D'; /* default mode */ + } + } + } else switch (*fmt) { + + case 'h': + if (!type) + type = 'H'; /* convert to short type */ + goto getmode; + + case 'l': + if (!type) + type = 'L'; /* convert to long type */ + goto getmode; + + case 'j': + if (!type) + type = 'J'; /* convert to intmax_t type */ + /* + * XXX Future length modifiers: + * XXX 'z' size_t + * XXX 't' ptrdiff_t + * XXX 'L' with double: long double + */ + + getmode: + if (!strchr("udioxX", *(++fmt))) { + if (type == 'H' && *fmt == 'h') { + type = 'C'; + goto getmode; + } +#ifdef USE_LONGLONG + if (type == 'L' && *fmt == 'l') { + type = 'Q'; + goto getmode; + } +#endif + fmt--; + mode = 'D'; + } else { + mode = *fmt; + if (mode != 'x') + mode = to_cap(mode); + if (mode == 'U') + unsflag = TRUE; + else if (mode == 'I') /*XXX */ + mode = 'D'; + } + break; + case 'x': + mode = 'x'; + goto havemode; + case 'X': + mode = 'X'; + type = 'I'; + goto havemode; + case 'u': + unsflag = TRUE; + /* + * XXX Need to remove uppercase letters for 'long' + * XXX in future for POSIX/C99 compliance. + */ + case 'o': case 'O': + case 'd': case 'D': + case 'i': case 'I': + case 'z': case 'Z': + mode = to_cap(*fmt); + havemode: + if (!type) + type = cap_ty(*fmt); +#ifdef DEBUG +/*dbg_print("*fmt: '%c' mode: '%c' type: '%c'\n", *fmt, mode, type);*/ +#endif + if (mode == 'I') /*XXX kann entfallen*/ + mode = 'D'; /*wenn besseres uflg*/ + break; + case 'p': + mode = 'P'; + type = 'L'; + break; + + case '%': + count += prc('%', &fa); + continue; + case ' ': + count += prbuf("", &fa); + continue; + case 'c': + c = va_arg(args, int); + count += prc(c, &fa); + continue; + case 's': + str = va_arg(args, char *); + count += prstring(str, &fa); + continue; + case 'b': + str = va_arg(args, char *); + fa.signific = va_arg(args, int); + count += prstring(str, &fa); + continue; + +#ifndef NO_FLOATINGPOINT + case 'e': + if (fa.signific == -1) + fa.signific = 6; + dval = va_arg(args, double); + ftoes(buf, dval, 0, fa.signific); + count += prbuf(buf, &fa); + continue; + case 'f': + if (fa.signific == -1) + fa.signific = 6; + dval = va_arg(args, double); + ftofs(buf, dval, 0, fa.signific); + count += prbuf(buf, &fa); + continue; + case 'g': + if (fa.signific == -1) + fa.signific = 6; + if (fa.signific == 0) + fa.signific = 1; + dval = va_arg(args, double); + gcvt(dval, fa.signific, buf); + count += prbuf(buf, &fa); + continue; +#else +# ifdef USE_FLOATINGARGS + case 'e': + case 'f': + case 'g': + dval = va_arg(args, double); + continue; +# endif +#endif + + case 'r': /* recursive printf */ + case 'R': /* recursive printf */ + rfmt = va_arg(args, char *); + /* + * I don't know any portable way to get an arbitrary + * C object from a var arg list so I use a + * system-specific routine __va_arg_list() that knows + * if 'va_list' is an array. You will not be able to + * assign the value of __va_arg_list() but it works + * to be used as an argument of a function. + * It is a requirement for recursive printf to be able + * to use this function argument. If your system + * defines va_list to be an array you need to know this + * via autoconf or another mechanism. + * It would be nice to have something like + * __va_arg_list() in stdarg.h + */ + count += format(fun, farg, rfmt, __va_arg_list(args)); + continue; + + case 'n': + { + int *ip = va_arg(args, int *); + + *ip = count; + } + continue; + + default: /* Unknown '%' format */ + sfmt++; /* Dont't print '%' */ + count += fmt - sfmt; + while (sfmt < fmt) + (*fun)(*(sfmt++), farg); + if (*fmt == '\0') { + fmt--; + continue; + } else { + (*fun)(*fmt, farg); + count++; + continue; + } + } + /* + * print numbers: + * first prepare type 'C'har, s'H'ort, 'I'nt, or 'L'ong + * or 'Q'ad and 'J'==maxint_t + */ + switch (type) { + + case 'C': + c = va_arg(args, int); + val = c; /* extend sign here */ + if (unsflag || mode != 'D') +#ifdef DO_MASK + val &= CHARMASK; +#else + val = (unsigned char)val; +#endif + break; + case 'H': + case 'S': /* XXX remove 'S' in future */ + sh = va_arg(args, int); + val = sh; /* extend sign here */ + if (unsflag || mode != 'D') +#ifdef DO_MASK + val &= SHORTMASK; +#else + val = (unsigned short)val; +#endif + break; + case 'I': + default: + i = va_arg(args, int); + val = i; /* extend sign here */ + if (unsflag || mode != 'D') +#ifdef DO_MASK + val &= INTMASK; +#else + val = (unsigned int)val; +#endif + break; + case 'P': + case 'L': + val = va_arg(args, long); + break; +#ifdef USE_LONGLONG + case 'J': /* For now Intmax_t is Llong */ + case 'Q': + llval = va_arg(args, Llong); + val = llval != 0; + break; +#endif + } + + /* + * Final print out, take care of mode: + * mode is one of: 'O'ctal, 'D'ecimal, or he'X' + * oder 'Z'weierdarstellung. + */ + fa.bufp = &buf[sizeof (buf)-1]; + *--fa.bufp = '\0'; + + if (val == 0 && mode != 'D') { + printzero: + /* + * Printing '0' with fieldwidth 0 results in no chars. + */ + fa.lzero = -1; + if (fa.signific >= 0) + fa.fillc = ' '; + count += prstring("0", &fa); + continue; + } else switch (mode) { + + case 'D': +#ifdef USE_LONGLONG + if (type == 'Q') { + if (!unsflag && llval < 0) { + fa.prefix = "-"; + fa.prefixlen = 1; + llval = -llval; + } else if (fa.flags & PLUSFLG) { + fa.prefix = "+"; + fa.prefixlen = 1; + } else if (fa.flags & SPACEFLG) { + fa.prefix = " "; + fa.prefixlen = 1; + } + if (llval == 0) + goto printzero; + goto prunsigned; + } +#endif + if (!unsflag && val < 0) { + fa.prefix = "-"; + fa.prefixlen = 1; + val = -val; + } else if (fa.flags & PLUSFLG) { + fa.prefix = "+"; + fa.prefixlen = 1; + } else if (fa.flags & SPACEFLG) { + fa.prefix = " "; + fa.prefixlen = 1; + } + if (val == 0) + goto printzero; + case 'U': + /* output a long unsigned decimal number */ +#ifdef USE_LONGLONG + prunsigned: + if (type == 'Q') + prldnum(llval, &fa); + else +#endif + prdnum(val, &fa); + break; + case 'O': + /* output a long octal number */ + if (fa.flags & HASHFLG) { + fa.prefix = "0"; + fa.prefixlen = 1; + } +#ifdef USE_LONGLONG + if (type == 'Q') { + prlonum(llval, &fa); + } else +#endif + { + pronum(val & 07, &fa); + if ((res = (val>>3) & rshiftmask(long, 3)) != 0) + pronum(res, &fa); + } + break; + case 'p': + case 'x': + /* output a hex long */ + if (fa.flags & HASHFLG) { + fa.prefix = "0x"; + fa.prefixlen = 2; + } +#ifdef USE_LONGLONG + if (type == 'Q') + prlxnum(llval, &fa); + else +#endif + { + prxnum(val & 0xF, &fa); + if ((res = (val>>4) & rshiftmask(long, 4)) != 0) + prxnum(res, &fa); + } + break; + case 'P': + case 'X': + /* output a hex long */ + if (fa.flags & HASHFLG) { + fa.prefix = "0X"; + fa.prefixlen = 2; + } +#ifdef USE_LONGLONG + if (type == 'Q') + prlXnum(llval, &fa); + else +#endif + { + prXnum(val & 0xF, &fa); + if ((res = (val>>4) & rshiftmask(long, 4)) != 0) + prXnum(res, &fa); + } + break; + case 'Z': + /* output a binary long */ +#ifdef USE_LONGLONG + if (type == 'Q') + prlnum(llval, 2, &fa); + else +#endif + { + prnum(val & 0x1, 2, &fa); + if ((res = (val>>1) & rshiftmask(long, 1)) != 0) + prnum(res, 2, &fa); + } + } + fa.lzero = -1; + /* + * If a precision (fielwidth) is specified + * on diouXx conversions, the '0' flag is ignored. + */ + if (fa.signific >= 0) + fa.fillc = ' '; + count += prbuf(fa.bufp, &fa); + } + return (count); +} + +/* + * Routines to print (not negative) numbers in an arbitrary base + */ +LOCAL unsigned char dtab[] = "0123456789abcdef"; +LOCAL unsigned char udtab[] = "0123456789ABCDEF"; + +LOCAL void +prnum(val, base, fa) + register Ulong val; + register unsigned base; + f_args *fa; +{ + register char *p = fa->bufp; + + do { + *--p = dtab[modlbys(val, base)]; + val = divlbys(val, base); + } while (val > 0); + + fa->bufp = p; +} + +LOCAL void +prdnum(val, fa) + register Ulong val; + f_args *fa; +{ + register char *p = fa->bufp; + + do { + *--p = dtab[modlbys(val, (unsigned)10)]; + val = divlbys(val, (unsigned)10); + } while (val > 0); + + fa->bufp = p; +} + +/* + * We may need to use division here too (PDP-11, non two's complement ...) + */ +LOCAL void +pronum(val, fa) + register Ulong val; + f_args *fa; +{ + register char *p = fa->bufp; + + do { + *--p = dtab[val & 7]; + val >>= 3; + } while (val > 0); + + fa->bufp = p; +} + +LOCAL void +prxnum(val, fa) + register Ulong val; + f_args *fa; +{ + register char *p = fa->bufp; + + do { + *--p = dtab[val & 15]; + val >>= 4; + } while (val > 0); + + fa->bufp = p; +} + +LOCAL void +prXnum(val, fa) + register Ulong val; + f_args *fa; +{ + register char *p = fa->bufp; + + do { + *--p = udtab[val & 15]; + val >>= 4; + } while (val > 0); + + fa->bufp = p; +} + +#ifdef USE_LONGLONG +LOCAL void +prlnum(val, base, fa) + register Ullong val; + register unsigned base; + f_args *fa; +{ + register char *p = fa->bufp; + + do { + *--p = dtab[modlbys(val, base)]; + val = divlbys(val, base); + } while (val > 0); + + fa->bufp = p; +} + +LOCAL void +prldnum(val, fa) + register Ullong val; + f_args *fa; +{ + register char *p = fa->bufp; + + do { + *--p = dtab[val % (unsigned)10]; + val = val / (unsigned)10; + } while (val > 0); + + fa->bufp = p; +} + +LOCAL void +prlonum(val, fa) + register Ullong val; + f_args *fa; +{ + register char *p = fa->bufp; + + do { + *--p = dtab[val & 7]; + val >>= 3; + } while (val > 0); + + fa->bufp = p; +} + +LOCAL void +prlxnum(val, fa) + register Ullong val; + f_args *fa; +{ + register char *p = fa->bufp; + + do { + *--p = dtab[val & 15]; + val >>= 4; + } while (val > 0); + + fa->bufp = p; +} + +LOCAL void +prlXnum(val, fa) + register Ullong val; + f_args *fa; +{ + register char *p = fa->bufp; + + do { + *--p = udtab[val & 15]; + val >>= 4; + } while (val > 0); + + fa->bufp = p; +} + +#endif + +/* + * Final buffer print out routine. + */ +LOCAL int +prbuf(s, fa) + register const char *s; + f_args *fa; +{ + register int diff; + register int rfillc; + register long arg = fa->farg; + register void (*fun) __PR((char, long)) = fa->outf; + register int count; + register int lzero = 0; + + count = strlen(s); + + /* + * lzero becomes the number of left fill chars needed to reach signific + */ + if (fa->lzero < 0 && count < fa->signific) + lzero = fa->signific - count; + count += lzero + fa->prefixlen; + diff = fa->fldwidth - count; + if (diff > 0) + count += diff; + + if (fa->prefixlen && fa->fillc != ' ') { + while (*fa->prefix != '\0') + (*fun)(*fa->prefix++, arg); + } + if (!fa->minusflag) { + rfillc = fa->fillc; + while (--diff >= 0) + (*fun)(rfillc, arg); + } + if (fa->prefixlen && fa->fillc == ' ') { + while (*fa->prefix != '\0') + (*fun)(*fa->prefix++, arg); + } + if (lzero > 0) { + rfillc = '0'; + while (--lzero >= 0) + (*fun)(rfillc, arg); + } + while (*s != '\0') + (*fun)(*s++, arg); + if (fa->minusflag) { + rfillc = ' '; + while (--diff >= 0) + (*fun)(rfillc, arg); + } + return (count); +} + +/* + * Print out one char, allowing prc('\0') + * Similar to prbuf() + */ +#ifdef PROTOTYPES + +LOCAL int +prc(char c, f_args *fa) + +#else + +LOCAL int +prc(c, fa) + char c; + f_args *fa; +#endif +{ + register int diff; + register int rfillc; + register long arg = fa->farg; + register void (*fun) __PR((char, long)) = fa->outf; + register int count; + + count = 1; + diff = fa->fldwidth - 1; + if (diff > 0) + count += diff; + + if (!fa->minusflag) { + rfillc = fa->fillc; + while (--diff >= 0) + (*fun)(rfillc, arg); + } + (*fun)(c, arg); + if (fa->minusflag) { + rfillc = ' '; + while (--diff >= 0) + (*fun)(rfillc, arg); + } + return (count); +} + +/* + * String output routine. + * If fa->signific is >= 0, it uses only fa->signific chars. + * If fa->signific is 0, print no characters. + */ +LOCAL int +prstring(s, fa) + register const char *s; + f_args *fa; +{ + register char *bp; + register int signific; + + if (s == NULL) + return (prbuf("(NULL POINTER)", fa)); + + if (fa->signific < 0) + return (prbuf(s, fa)); + + bp = fa->buf; + signific = fa->signific; + + while (--signific >= 0 && *s != '\0') + *bp++ = *s++; + *bp = '\0'; + + return (prbuf(fa->buf, fa)); +} + +#ifdef DEBUG +LOCAL void +dbg_print(fmt, a, b, c, d, e, f, g, h, i) +char *fmt; +{ + char ff[1024]; + + sprintf(ff, fmt, a, b, c, d, e, f, g, h, i); + write(STDERR_FILENO, ff, strlen(ff)); +} +#endif diff --git a/scsilib/libschily/getargs.c b/scsilib/libschily/getargs.c new file mode 100644 index 0000000..132cd8e --- /dev/null +++ b/scsilib/libschily/getargs.c @@ -0,0 +1,828 @@ +/* @(#)getargs.c 2.35 03/10/06 Copyright 1985, 1988, 1994-2003 J. Schilling */ +#ifndef lint +static char sccsid[] = + "@(#)getargs.c 2.35 03/10/06 Copyright 1985, 1988, 1994-2003 J. Schilling"; +#endif +#define NEW +/* + * Copyright (c) 1985, 1988, 1994-2003 J. Schilling + * + * 1.3.88 Start implementation of release 2 + */ +/* + * Parse arguments on a command line. + * Format string type specifier (appearing directly after flag name): + * '' BOOL + * '*' string + * '?' char + * '#' number + * '&' call function + * '+' inctype +++ NEU +++ + * + * The '#' and '+' types may have size modifiers added: + * 'c'/'C' char + * 's'/'S' short + * 'i'/'I' int (default) + * 'l'/'L' long + * 'll'/'LL' long long + * + * The format string 'f* ' may be used to disallow -ffoo for f* + * + * XXX This is currently only implemented for the '*' format + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +/* LINTLIBRARY */ +#include <mconfig.h> +#include <standard.h> +#include <utypes.h> +#include <getargs.h> +#include <vadefs.h> +#include <strdefs.h> +#include <schily.h> +#include <ctype.h> + +#define NOARGS 0 /* No more args */ +#define NOTAFLAG 1 /* Not a flag type argument */ +#define BADFLAG (-1) /* Not a valid flag argument */ +#define BADFMT (-2) /* Error in format string */ +#define NOTAFILE (-3) /* Seems to be a flag type arg */ + + + int _getargs __PR((int *, char *const **, const char *, + BOOL, va_list)); +LOCAL int dofile __PR((int *, char *const **, const char **)); +LOCAL int doflag __PR((int *, char *const **, const char *, + const char *, BOOL, va_list)); +LOCAL int dosflags __PR((const char *, const char *, BOOL, va_list)); +LOCAL int checkfmt __PR((const char *)); +LOCAL int checkeql __PR((const char *)); + +LOCAL va_list va_dummy; + +LOCAL char fmtspecs[] = "#?*&+"; + +#define isfmtspec(c) (strchr(fmtspecs, c) != NULL) + +/*--------------------------------------------------------------------------- +| +| get flags until a non flag type argument is reached +| ++---------------------------------------------------------------------------*/ +/* VARARGS3 */ +#ifdef PROTOTYPES +EXPORT int +getargs(int *pac, char *const **pav, const char *fmt, ...) +#else +EXPORT int +getargs(pac, pav, fmt, va_alist) + int *pac; + char **pav[]; + char *fmt; + va_dcl +#endif +{ + va_list args; + int ret; + +#ifdef PROTOTYPES + va_start(args, fmt); +#else + va_start(args); +#endif + ret = _getargs(pac, pav, fmt, TRUE, args); + va_end(args); + return (ret); +} + + +/*--------------------------------------------------------------------------- +| +| get all flags on the command line, do not stop on files +| ++---------------------------------------------------------------------------*/ +/* VARARGS3 */ +#ifdef PROTOTYPES +EXPORT int +getallargs(int *pac, char *const **pav, const char *fmt, ...) +#else +EXPORT int +getallargs(pac, pav, fmt, va_alist) + int *pac; + char **pav[]; + char *fmt; + va_dcl +#endif +{ + va_list args; + int ret; + +#ifdef PROTOTYPES + va_start(args, fmt); +#else + va_start(args); +#endif + for (; ; (*pac)--, (*pav)++) { + if ((ret = _getargs(pac, pav, fmt, TRUE, args)) != NOTAFLAG) + break; + } + va_end(args); + return (ret); +} + + +/*--------------------------------------------------------------------------- +| +| get next non flag type argument (i.e. a file) +| ++---------------------------------------------------------------------------*/ +EXPORT int +getfiles(pac, pav, fmt) + int *pac; + char *const *pav[]; + const char *fmt; +{ + return (_getargs(pac, pav, fmt, FALSE, va_dummy)); +} + + +/*--------------------------------------------------------------------------- +| +| check args until the next non flag type argmument is reached +| *pac is decremented, *pav is incremented so that the +| non flag type argument is at *pav[0] +| +| return code: +| NOARGS no more args +| NOTAFLAG not a flag type argument +| BADFLAG a non-matching flag type argument +| BADFMT bad syntax in format string +| +| ++---------------------------------------------------------------------------*/ +/*LOCAL*/ int +_getargs(pac, pav, fmt, setargs, args) + register int *pac; + register char *const **pav; + const char *fmt; + BOOL setargs; + va_list args; +{ + const char *argp; + int ret; + + + for (; *pac > 0; (*pac)--, (*pav)++) { + argp = **pav; + + ret = dofile(pac, pav, &argp); + + if (ret != NOTAFILE) + return (ret); + + ret = doflag(pac, pav, argp, fmt, setargs, args); + + if (ret != NOTAFLAG) + return (ret); + } + return (NOARGS); +} + + +/*--------------------------------------------------------------------------- +| +| check if *pargp is a file type argument +| ++---------------------------------------------------------------------------*/ +LOCAL int +dofile(pac, pav, pargp) + register int *pac; + register char *const **pav; + const char **pargp; +{ + register const char *argp = *pargp; + + + if (argp[0] == '-') { + /* + * "-" is a special non flag type argument + * that usually means take stdin instead of a named file + */ + if (argp[1] == '\0') + return (NOTAFLAG); + /* + * "--" is a prefix to take the next argument + * as non flag type argument + * NOTE: Posix requires "--" to indicate the end of the + * flags on the command line. But we are currently not + * Posix. + */ + if (argp[1] == '-' && argp[2] == '\0') { + if (--(*pac) > 0) { + (*pav)++; + return (NOTAFLAG); + } else { + return (NOARGS); + } + } + } + + /* + * now check if it may be flag type argument + * flag type arguments begin with a '-', a '+' or contain a '=' + * i.e. -flag +flag or flag= + */ + if (argp[0] != '-' && argp[0] != '+' && (!checkeql(argp))) + return (NOTAFLAG); + + return (NOTAFILE); +} + + +/*--------------------------------------------------------------------------- +| +| compare argp with the format string +| if a match is found store the result a la scanf in one of the +| arguments pointed to in the va_list +| +| If setargs is FALSE, only check arguments for getfiles() +| in this case, va_list may be a dummy arg. +| ++---------------------------------------------------------------------------*/ +LOCAL int +doflag(pac, pav, argp, fmt, setargs, oargs) + int *pac; + char *const **pav; + register const char *argp; + register const char *fmt; + BOOL setargs; + va_list oargs; +{ + char argstr[2]; + long val; + Llong llval; + int singlecharflag = 0; + BOOL isspec; + BOOL hasdash = FALSE; + BOOL doubledash = FALSE; + BOOL haseql = checkeql(argp); + const char *sargp; + const char *sfmt = fmt; + va_list args; + char *const *spav = *pav; + int spac = *pac; + void *curarg = (void *)0; + + /* + * flags beginning with '-' don't have to include the '-' in + * the format string. + * flags beginning with '+' have to include it in the format string. + */ + if (argp[0] == '-') { + argp++; + hasdash = TRUE; + /* + * Implement legacy support for --longopt + * If we find a double dash, we do not look for combinations + * of boolean single char flags. + */ + if (argp[0] == '-') { + argp++; + doubledash = TRUE; + /* + * Allow -- only for long options. + */ + if (argp[1] == '\0') { + return (BADFLAG); + } + } + } + sargp = argp; + + /* + * Initialize 'args' to the start of the argument list. + * I don't know any portable way to copy an arbitrary + * C object so I use a system-specific routine + * (probably a macro) from stdarg.h. (Remember that + * if va_list is an array, 'args' will be a pointer + * and '&args' won't be what I would need for memcpy.) + * It is a system requirement for SVr4 compatibility + * to be able to do this assgignement. If your system + * defines va_list to be an array but does not define + * va_copy() you are lost. + * This is needed to make sure, that 'oargs' will not + * be clobbered. + */ + va_copy(args, oargs); + + if (setargs) + curarg = va_arg(args, void *); + + /* + * check if the first flag in format string is a singlechar flag + */ + if (fmt[1] == ',' || fmt[1] == '+' || fmt[1] == '\0') + singlecharflag++; + /* + * check the whole format string for a match + */ + for (;;) { + for (; *fmt; fmt++, argp++) { + if (*fmt == '\\') { + /* + * Allow "#?*&+" to appear inside a flag. + * NOTE: they must be escaped by '\\' only + * inside the the format string. + */ + fmt++; + isspec = FALSE; + } else { + isspec = isfmtspec(*fmt); + } + /* + * If isspec is TRUE, the arg beeing checked starts + * like a valid flag. Argp now points to the rest. + */ + if (isspec) { + /* + * If *argp is '+' and we are on the + * beginning of the arg that is currently + * checked, this cannot be an inc type flag. + */ + if (*argp == '+' && argp == sargp) + continue; + /* + * skip over to arg of flag + */ + if (*argp == '=') { + argp++; + } else if (*argp != '\0' && haseql) { + /* + * Flag and arg are not separated by a + * space. + * Check here for: + * xxxxx=yyyyy match on '&' + * Checked before: + * abc=yyyyy match on 'abc&' + * or 'abc*' + * or 'abc#' + * We come here if 'argp' starts with + * the same sequence as a valid flag + * and contains an equal sign. + * We have tested before if the text + * before 'argp' matches exactly. + * At this point we have no exact match + * and we only allow to match + * the special pattern '&'. + * We need this e.g. for 'make'. + * We allow any flag type argument to + * match the format string "&" to set + * up a function that handles all odd + * stuff that getargs will not grok. + * In addition, to allow getargs to be + * used for CPP type flags we allow to + * match -Dabc=xyz on 'D&'. Note that + * Dabc=xyz will not match 'D&'. + */ + if ((!hasdash && argp != sargp) || *fmt != '&') + goto nextarg; + } + + /* + * The format string 'f* ' may be used + * to disallow -ffoo for f* + * + * XXX This is currently only implemented for + * XXX the '*' format + */ + if (!haseql && *argp != '\0' && fmt[0] == '*' && fmt[1] == ' ') + goto nextarg; + /* + * *arpp == '\0' || !haseql + * We come here if 'argp' starts with + * the same sequence as a valid flag. + * This will match on the following args: + * -farg match on 'f*' + * -f12 match on 'f#' + * +12 match on '+#' + * -12 match on '#' + * and all args that are separated from + * their flags. + * In the switch statement below, we check + * if the text after 'argp' (if *argp != 0) or + * the next arg is a valid arg for this flag. + */ + break; + } else if (*fmt == *argp) { + if (argp[1] == '\0' && + (fmt[1] == '\0' || fmt[1] == ',')) { + + if (setargs) + *((int *)curarg) = TRUE; + + + return (checkfmt(fmt)); /* XXX */ + } + } else { + /* + * skip over to next format identifier + * & reset arg pointer + */ + nextarg: + while (*fmt != ',' && *fmt != '\0') { + /* function has extra arg on stack */ + if (*fmt == '&' && setargs) + curarg = va_arg(args, void *); + fmt++; + } + argp = sargp; + break; + } + } + switch (*fmt) { + + case '\0': + /* + * Boolean type has been tested before. + */ + if (singlecharflag && !doubledash && + (val = dosflags(sargp, sfmt, setargs, oargs)) != + BADFLAG) + return (val); + + + return (BADFLAG); + + case ',': + fmt++; + if (fmt[1] == ',' || fmt[1] == '+' || fmt[1] == '\0') + singlecharflag++; + if (setargs) + curarg = va_arg(args, void *); + continue; + + case '*': + if (*argp == '\0') { + if (*pac > 1) { + (*pac)--; + (*pav)++; + argp = **pav; + } else { + return (BADFLAG); + } + } + if (fmt[1] == ' ') /* To disallow -ffoo for f* */ + fmt++; + if (setargs) + *((const char **)curarg) = argp; + + + return (checkfmt(fmt)); + + case '?': + /* + * If more than one char arg, it + * cannot be a character argument. + */ + if (argp[1] != '\0') + goto nextchance; + if (setargs) + *((char *)curarg) = *argp; + + + return (checkfmt(fmt)); + + case '+': + /* + * inc type is similar to boolean, + * there is no arg in argp to convert. + */ + if (*argp != '\0') + goto nextchance; + /* + * If *fmt is '+' and we are on the beginning + * of the format desciptor that is currently + * checked, this cannot be an inc type flag. + */ + if (fmt == sfmt || fmt[-1] == ',') + goto nextchance; + + if (fmt[1] == 'l' || fmt[1] == 'L') { + if (fmt[2] == 'l' || fmt[2] == 'L') { + if (setargs) + *((Llong *)curarg) += 1; + fmt += 2; + } else { + if (setargs) + *((long *)curarg) += 1; + fmt++; + } + } else if (fmt[1] == 's' || fmt[1] == 'S') { + if (setargs) + *((short *)curarg) += 1; + fmt++; + } else if (fmt[1] == 'c' || fmt[1] == 'C') { + if (setargs) + *((char *)curarg) += 1; + fmt++; + } else { + if (fmt[1] == 'i' || fmt[1] == 'I') + fmt++; + if (setargs) + *((int *)curarg) += 1; + } + + argstr[0] = *fmt; + argstr[1] = '\0'; + + return (checkfmt(fmt)); + + case '#': + if (*argp == '\0') { + if (*pac > 1) { + (*pac)--; + (*pav)++; + argp = **pav; + } else { + return (BADFLAG); + } + } + if (*astoll(argp, &llval) != '\0') { + /* + * arg is not a valid number! + * go to next format in the format string + * and check if arg matches any other type + * in the format specs. + */ + nextchance: + while (*fmt != ',' && *fmt != '\0') { + if (*fmt == '&' && setargs) + curarg = va_arg(args, void *); + fmt++; + } + argp = sargp; + *pac = spac; + *pav = spav; + continue; + } + val = (long)llval; + if (fmt[1] == 'l' || fmt[1] == 'L') { + if (fmt[2] == 'l' || fmt[2] == 'L') { + if (setargs) + *((Llong *)curarg) = llval; + fmt += 2; + } else { + if (setargs) + *((long *)curarg) = val; + fmt++; + } + } else if (fmt[1] == 's' || fmt[1] == 'S') { + if (setargs) + *((short *)curarg) = (short)val; + fmt++; + } else if (fmt[1] == 'c' || fmt[1] == 'C') { + if (setargs) + *((char *)curarg) = (char)val; + fmt++; + } else { + if (fmt[1] == 'i' || fmt[1] == 'I') + fmt++; + if (setargs) + *((int *)curarg) = (int)val; + } + argstr[0] = *fmt; + argstr[1] = '\0'; + + return (checkfmt(fmt)); + + case '&': + if (*argp == '\0') { + if (*pac > 1) { + (*pac)--; + (*pav)++; + argp = **pav; + } else { + return (BADFLAG); + } + } + + if ((val = checkfmt(fmt)) != NOTAFLAG) + return (val); + + if (setargs) { + int ret; + void *funarg = va_arg(args, void *); + + ret = ((*(getargfun)curarg) (argp, funarg)); + if (ret != NOTAFILE) + return (ret); + fmt++; + } else { + return (val); + } + /* + * Called function returns NOTAFILE: try next format. + */ + } + } +} + + +/*--------------------------------------------------------------------------- +| +| parse args for combined single char flags +| ++---------------------------------------------------------------------------*/ +typedef struct { + void *curarg; + short count; + char c; + char type; +} sflags; + +LOCAL int +dosflags(argp, fmt, setargs, oargs) + register const char *argp; + register const char *fmt; + BOOL setargs; + va_list oargs; +{ +#define MAXSF 32 + sflags sf[MAXSF]; + va_list args; + register sflags *rsf = sf; + register int nsf = 0; + register const char *p = argp; + register int i; + register void *curarg = (void *)0; + char type; + + /* + * Initialize 'args' to the start of the argument list. + * I don't know any portable way to copy an arbitrary + * C object so I use a system-specific routine + * (probably a macro) from stdarg.h. (Remember that + * if va_list is an array, 'args' will be a pointer + * and '&args' won't be what I would need for memcpy.) + * It is a system requirement for SVr4 compatibility + * to be able to do this assgignement. If your system + * defines va_list to be an array but does not define + * va_copy() you are lost. + * This is needed to make sure, that 'oargs' will not + * be clobbered. + */ + va_copy(args, oargs); + + if (setargs) + curarg = va_arg(args, void *); + + while (*p) { + for (i = 0; i < nsf; i++) { + if (rsf[i].c == *p) + break; + } + if (i >= MAXSF) + return (BADFLAG); + if (i == nsf) { + rsf[i].curarg = (void *)0; + rsf[i].count = 0; + rsf[i].c = *p; + rsf[i].type = (char)-1; + nsf++; + } + rsf[i].count++; + p++; + } + + while (*fmt) { + if (!isfmtspec(*fmt) && + (fmt[1] == ',' || fmt[1] == '+' || fmt[1] == '\0') && + strchr(argp, *fmt)) { + for (i = 0; i < nsf; i++) { + if (rsf[i].c == *fmt) { + if (fmt[1] == '+') { + fmt++; + if (fmt[1] == ',' || + fmt[1] == '\0') { + rsf[i].type = 'i'; + } else if ((fmt[1] == 'l' || + fmt[1] == 'L') && + (fmt[2] == 'l' || + fmt[2] == 'L')) { + /* + * Type 'Q'uad (ll) + */ + rsf[i].type = 'Q'; + fmt++; + } else { + /* + * Type 'l','i','s','c' + */ + rsf[i].type = fmt[1]; + } + } else { + /* + * ',' or '\0' for BOOL + */ + rsf[i].type = fmt[1]; + } + rsf[i].curarg = curarg; + break; + } + } + } + while (*fmt != ',' && *fmt != '\0') { + /* function has extra arg on stack */ + if (*fmt == '&' && setargs) + curarg = va_arg(args, void *); + fmt++; + } + if (*fmt != '\0') + fmt++; + + if (setargs) + curarg = va_arg(args, void *); + } + for (i = 0; i < nsf; i++) { + type = rsf[i].type; + if (type == (char)-1) { + return (BADFLAG); + } + if (rsf[i].curarg) { + if (type == ',' || type == '\0') { + *((int *)rsf[i].curarg) = TRUE; + } else if (type == 'i' || type == 'I') { + *((int *)rsf[i].curarg) += rsf[i].count; + } else if (type == 'l' || type == 'L') { + *((long *)rsf[i].curarg) += rsf[i].count; + } else if (type == 'Q') { + *((Llong *)rsf[i].curarg) += rsf[i].count; + } else if (type == 's' || type == 'S') { + *((short *)rsf[i].curarg) += rsf[i].count; + } else if (type == 'c' || type == 'C') { + *((char *)rsf[i].curarg) += rsf[i].count; + } else { + return (BADFLAG); + } + } + } + return (NOTAFLAG); +} + +/*--------------------------------------------------------------------------- +| +| If the next format character is a comma or the string delimiter, +| there are no invalid format specifiers. Return success. +| Otherwise raise the getarg_bad_format condition. +| ++---------------------------------------------------------------------------*/ +LOCAL int +checkfmt(fmt) + const char *fmt; +{ + char c; + + c = *(++fmt); /* non constant expression */ + + + if (c == ',' || c == '\0') { + return (NOTAFLAG); + } else { + raisecond("getarg_bad_format", (long)fmt); + return (BADFMT); + } +} + +/*--------------------------------------------------------------------------- +| +| Parse the string as long as valid characters can be found. +| Valid flag identifiers are chosen from the set of +| alphanumeric characters, '-' and '_'. +| If the next character is an equal sign the string +| contains a valid flag identifier. +| ++---------------------------------------------------------------------------*/ +LOCAL int +checkeql(str) + register const char *str; +{ + register unsigned char c; + + for (c = (unsigned char)*str; + isalnum(c) || c == '_' || c == '-'; c = *str++) + ; + return (c == '='); +} diff --git a/scsilib/libschily/getav0.c b/scsilib/libschily/getav0.c new file mode 100644 index 0000000..71df533 --- /dev/null +++ b/scsilib/libschily/getav0.c @@ -0,0 +1,148 @@ +/* @(#)getav0.c 1.16 04/05/09 Copyright 1985, 1995-2004 J. Schilling */ +#ifndef lint +static char sccsid[] = + "@(#)getav0.c 1.16 04/05/09 Copyright 1985, 1995-2004 J. Schilling"; +#endif +/* + * Get arg vector by scanning the stack + * + * Copyright (c) 1985, 1995-2004 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <sigblk.h> +#include <avoffset.h> +#include <standard.h> +#include <schily.h> + +#if !defined(AV_OFFSET) || !defined(FP_INDIR) +# ifdef HAVE_SCANSTACK +# undef HAVE_SCANSTACK +# endif +#endif + +#ifdef HAVE_SCANSTACK + +#include <stkframe.h> + +#define is_even(p) ((((long)(p)) & 1) == 0) +#define even(p) (((long)(p)) & ~1L) +#ifdef __future__ +#define even(p) (((long)(p)) - 1) /* will this work with 64 bit ?? */ +#endif + +EXPORT char **getmainfp __PR((void)); +EXPORT char **getavp __PR((void)); +EXPORT char *getav0 __PR((void)); + + +EXPORT char ** +getmainfp() +{ + register struct frame *fp; + char **av; +#if FP_INDIR > 0 + register int i = 0; +#endif + + /* + * As the SCO OpenServer C-Compiler has a bug that may cause + * the first function call to getfp() been done before the + * new stack frame is created, we call getfp() twice. + */ + (void) getfp(); + fp = (struct frame *)getfp(); + if (fp == NULL) + return (NULL); + + while (fp->fr_savfp) { + if (fp->fr_savpc == NULL) + break; + + if (!is_even(fp->fr_savfp)) { + fp = (struct frame *)even(fp->fr_savfp); + if (fp == NULL) + break; + fp = (struct frame *)((SIGBLK *)fp)->sb_savfp; + continue; + } + fp = (struct frame *)fp->fr_savfp; + +#if FP_INDIR > 0 + i++; +#endif + } + +#if FP_INDIR > 0 + i -= FP_INDIR; + fp = (struct frame *)getfp(); + if (fp == NULL) + return (NULL); + + while (fp->fr_savfp) { + if (fp->fr_savpc == NULL) + break; + + if (!is_even(fp->fr_savfp)) { + fp = (struct frame *)even(fp->fr_savfp); + if (fp == NULL) + break; + fp = (struct frame *)((SIGBLK *)fp)->sb_savfp; + continue; + } + fp = (struct frame *)fp->fr_savfp; + + if (--i <= 0) + break; + } +#endif + + av = (char **)fp; + return (av); +} + +EXPORT char ** +getavp() +{ + register struct frame *fp; + char **av; + + fp = (struct frame *)getmainfp(); + if (fp == NULL) + return (NULL); + + av = (char **)(((char *)fp) + AV_OFFSET); /* aus avoffset.h */ + /* -> avoffset.c */ + return (av); +} + +EXPORT char * +getav0() +{ + return (getavp()[0]); +} + +#else + +EXPORT char * +getav0() +{ + return ("???"); +} + +#endif /* HAVE_SCANSTACK */ diff --git a/scsilib/libschily/getdomainname.c b/scsilib/libschily/getdomainname.c new file mode 100644 index 0000000..ef56d2e --- /dev/null +++ b/scsilib/libschily/getdomainname.c @@ -0,0 +1,108 @@ +/* @(#)getdomainname.c 1.16 03/06/15 Copyright 1995-2003 J. Schilling */ +#ifndef lint +static char sccsid[] = + "@(#)getdomainname.c 1.16 03/06/15 Copyright 1995-2003 J. Schilling"; +#endif +/* + * Copyright (c) 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <standard.h> +#include <stdxlib.h> +#ifdef HAVE_SYS_SYSTEMINFO_H +#include <sys/systeminfo.h> +#endif +#include <libport.h> + +#ifndef HAVE_GETDOMAINNAME +EXPORT int getdomainname __PR((char *name, int namelen)); +#endif + + +/*#undef HAVE_GETDOMAINNAME*/ +/*#undef SI_SRPC_DOMAIN*/ + +#if !defined(HAVE_GETDOMAINNAME) && defined(SI_SRPC_DOMAIN) +#define FUNC_GETDOMAINNAME + +EXPORT int +getdomainname(name, namelen) + char *name; + int namelen; +{ + if (sysinfo(SI_SRPC_DOMAIN, name, namelen) < 0) + return (-1); + return (0); +} +#endif + +#if !defined(HAVE_GETDOMAINNAME) && !defined(FUNC_GETDOMAINNAME) +#define FUNC_GETDOMAINNAME + +#include <stdio.h> +#include <strdefs.h> +#include <schily.h> + +EXPORT int +getdomainname(name, namelen) + char *name; + int namelen; +{ + FILE *f; + char name1[1024]; + char *p; + char *p2; + + name[0] = '\0'; + + f = fileopen("/etc/resolv.conf", "r"); + + if (f == NULL) + return (-1); + + while (fgetline(f, name1, sizeof (name1)) >= 0) { + if ((p = strchr(name1, '#')) != NULL) + *p = '\0'; + + /* + * Skip leading whitespace. + */ + p = name1; + while (*p != '\0' && (*p == ' ' || *p == '\t')) + p++; + + if (strncmp(p, "domain", 6) == 0) { + p += 6; + while (*p != '\0' && (*p == ' ' || *p == '\t')) + p++; + if ((p2 = strchr(p, ' ')) != NULL) + *p2 = '\0'; + if ((p2 = strchr(p, '\t')) != NULL) + *p2 = '\0'; + + strncpy(name, p, namelen); + + fclose(f); + return (0); + } + } + fclose(f); + return (0); +} +#endif diff --git a/scsilib/libschily/geterrno.c b/scsilib/libschily/geterrno.c new file mode 100644 index 0000000..5fc6c65 --- /dev/null +++ b/scsilib/libschily/geterrno.c @@ -0,0 +1,40 @@ +/* @(#)geterrno.c 1.9 03/06/15 Copyright 1985, 1995-2003 J. Schilling */ +/* + * Get error number + * + * Copyright (c) 1985, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <errno.h> +#include <standard.h> +#include <schily.h> + +#ifndef HAVE_ERRNO_DEF +extern int errno; +#endif + +#ifdef geterrno +#undef geterrno +#endif + +EXPORT int +geterrno() + +{ + return (errno); +} diff --git a/scsilib/libschily/getfp.c b/scsilib/libschily/getfp.c new file mode 100644 index 0000000..03fe563 --- /dev/null +++ b/scsilib/libschily/getfp.c @@ -0,0 +1,98 @@ +/* @(#)getfp.c 1.14 03/07/13 Copyright 1988-2003 J. Schilling */ +/* + * Get frame pointer + * + * Copyright (c) 1988-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <standard.h> +#include <schily.h> + +#ifndef IS_AVOFFSET +/* + * We usually don't like to compile a getfp() that returns junk data in case + * we cannot scan the stack. + * The only way to find this out is by including avoffset.h. Unfortunately, we + * need to be able to use getfp() from avoffset.c in order to check if the + * return value is usable or junk. To be able to do this, we include getfp.c + * from avoffset.c and define IS_AVOFFSET before. + */ +#include <avoffset.h> + +#if !defined(AV_OFFSET) || !defined(FP_INDIR) +# ifdef HAVE_SCANSTACK +# undef HAVE_SCANSTACK +# endif +#endif +#endif + +#ifdef HAVE_SCANSTACK +#include <stkframe.h> + +#define MAXWINDOWS 32 +#define NWINDOWS 7 + +#if defined(sparc) && defined(__GNUC__) +# define FP_OFF 0x10 /* some strange things on sparc gcc */ +#else +# define FP_OFF 0 +#endif + +EXPORT void **___fpoff __PR((char *cp)); + +EXPORT void ** +getfp() +{ + long **dummy[1]; + +#ifdef sparc + flush_reg_windows(MAXWINDOWS-2); +#endif + return ((void **)((struct frame *)___fpoff((char *)&dummy[0]))->fr_savfp); +} + +/* + * Don't make it static to avoid inline optimization. + * + * We need this function to fool GCCs check for returning addresses + * from outside the functions local address space. + */ +EXPORT void ** +___fpoff(cp) + char *cp; +{ + long ***lp; + + lp = (long ***)(cp + FP_OFF); + lp++; + return ((void **)lp); +} + +#ifdef sparc +EXPORT int +flush_reg_windows(n) + int n; +{ + if (--n > 0) + flush_reg_windows(n); + return (0); +} +#endif + +#endif /* HAVE_SCANSTACK */ diff --git a/scsilib/libschily/gethostid.c b/scsilib/libschily/gethostid.c new file mode 100644 index 0000000..36488ea --- /dev/null +++ b/scsilib/libschily/gethostid.c @@ -0,0 +1,70 @@ +/* @(#)gethostid.c 1.15 03/06/15 Copyright 1995-2003 J. Schilling */ +#ifndef lint +static char sccsid[] = + "@(#)gethostid.c 1.15 03/06/15 Copyright 1995-2003 J. Schilling"; +#endif +/* + * Copyright (c) 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <standard.h> +#include <stdxlib.h> +#include <utypes.h> +#ifdef HAVE_SYS_SYSTEMINFO_H +#include <sys/systeminfo.h> +#endif +#include <libport.h> + +#ifndef HAVE_GETHOSTID +EXPORT long gethostid __PR((void)); +#endif + + +#if !defined(HAVE_GETHOSTID) + +#if defined(SI_HW_SERIAL) + +EXPORT long +gethostid() +{ + long id; + + char hbuf[257]; + sysinfo(SI_HW_SERIAL, hbuf, sizeof (hbuf)); + id = atoi(hbuf); + return (id); +} +#else + +#include <errno.h> +EXPORT long +gethostid() +{ + long id = -1L; + +#ifdef ENOSYS + seterrno(ENOSYS); +#else + seterrno(EINVAL); +#endif + return (id); +} +#endif + +#endif diff --git a/scsilib/libschily/gethostname.c b/scsilib/libschily/gethostname.c new file mode 100644 index 0000000..487ff79 --- /dev/null +++ b/scsilib/libschily/gethostname.c @@ -0,0 +1,71 @@ +/* @(#)gethostname.c 1.15 03/10/04 Copyright 1995 J. Schilling */ +#ifndef lint +static char sccsid[] = + "@(#)gethostname.c 1.15 03/10/04 Copyright 1995 J. Schilling"; +#endif +/* + * Copyright (c) 1995 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <standard.h> +#include <stdxlib.h> +#ifdef HAVE_SYS_SYSTEMINFO_H +#include <sys/systeminfo.h> +#endif +#include <libport.h> + +#ifndef HAVE_GETHOSTNAME +EXPORT int gethostname __PR((char *name, int namelen)); + + +#ifdef SI_HOSTNAME + +EXPORT int +gethostname(name, namelen) + char *name; + int namelen; +{ + if (sysinfo(SI_HOSTNAME, name, namelen) < 0) + return (-1); + return (0); +} +#else + +#if defined(HAVE_UNAME) && defined(HAVE_SYS_UTSNAME_H) +#include <sys/utsname.h> +#include <strdefs.h> + +EXPORT int +gethostname(name, namelen) + char *name; + int namelen; +{ + struct utsname uts; + + if (uname(&uts) < 0) + return (-1); + + strncpy(name, uts.nodename, namelen); + return (0); +} +#endif + +#endif + +#endif /* HAVE_GETHOSTNAME */ diff --git a/scsilib/libschily/getpagesize.c b/scsilib/libschily/getpagesize.c new file mode 100644 index 0000000..87e9f01 --- /dev/null +++ b/scsilib/libschily/getpagesize.c @@ -0,0 +1,69 @@ +/* @(#)getpagesize.c 1.1 01/11/28 Copyright 2001 J. Schilling */ +#ifndef lint +static char sccsid[] = + "@(#)getpagesize.c 1.1 01/11/28 Copyright 2001 J. Schilling"; +#endif +/* + * Copyright (c) 2001 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <mconfig.h> + +#ifndef HAVE_GETPAGESIZE +#include <unixstd.h> +#include <standard.h> +#ifdef HAVE_SYS_PARAM_H +#include <sys/param.h> +#endif +#include <libport.h> + +#ifdef HAVE_OS_H +#include <OS.h> /* BeOS for B_PAGE_SIZE */ +#endif + +EXPORT int getpagesize __PR((void)); + +EXPORT int +getpagesize() +{ + register int pagesize; + +#ifdef _SC_PAGESIZE + pagesize = sysconf(_SC_PAGESIZE); +#else /* ! _SC_PAGESIZE */ + + +#ifdef PAGESIZE /* Traditional UNIX page size from param.h */ + pagesize = PAGESIZE; + +#else /* ! PAGESIZE */ + +#ifdef B_PAGE_SIZE /* BeOS page size from OS.h */ + pagesize = B_PAGE_SIZE; + +#else /* ! B_PAGE_SIZE */ + + pagesize = 512; +#endif /* ! B_PAGE_SIZE */ +#endif /* ! PAGESIZE */ +#endif /* ! _SC_PAGESIZE */ + + return (pagesize); +} + +#endif /* HAVE_GETPAGESIZE */ diff --git a/scsilib/libschily/handlecond.c b/scsilib/libschily/handlecond.c new file mode 100644 index 0000000..533aefd --- /dev/null +++ b/scsilib/libschily/handlecond.c @@ -0,0 +1,276 @@ +/* @(#)handlecond.c 1.22 04/05/09 Copyright 1985-2004 J. Schilling */ +/* + * setup/clear a condition handler for a software signal + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +/* + * A procedure frame is marked to have handlers if the + * previous freme pointer for this procedure is odd. + * The even base value, in this case actually points to a SIGBLK which + * holds the saved "real" frame pointer. + * The SIGBLK mentioned above may me the start of a chain of SIGBLK's, + * containing different handlers. + * + * This will work on processors which support a frame pointer chain + * on the stack. + * On a processor which doesn't support this I think of a method + * where handlecond() has an own chain of frames, holding chains of + * SIGBLK's. + * In this case, a parameter has to be added to handlecond() and + * unhandlecond(). This parameter will be an opaque cookie which is zero + * on the first call to handlecond() in a procedure. + * A new cookie will be returned by handlecond() which must be used on + * each subsequent call to handlecond() and unhandlecond() in the same + * procedure. + * + * Copyright (c) 1985-2004 J. Schilling + */ +#include <mconfig.h> +#include <sigblk.h> +#include <standard.h> +#include <stdxlib.h> +#include <strdefs.h> +#include <avoffset.h> +#include <utypes.h> +#include <schily.h> + +#if !defined(AV_OFFSET) || !defined(FP_INDIR) +# ifdef HAVE_SCANSTACK +# undef HAVE_SCANSTACK +# endif +#endif + +#ifdef HAVE_SCANSTACK +#include <stkframe.h> +#else +extern SIGBLK *__roothandle; +#endif /* HAVE_SCANSTACK */ + +#define is_even(p) ((((long)(p)) & 1) == 0) +#define even(p) (((long)(p)) & ~1L) +#if defined(__sun) && defined(__i386) +/* + * Solaris x86 has a broken frame.h which defines the frame ptr to int. + */ +#define odd(p) (((Intptr_t)(p)) | 1) +#else +#define odd(p) (void *)(((Intptr_t)(p)) | 1) +#endif + +#ifdef __future__ +#define even(p) (((long)(p)) - 1) /* will this work with 64 bit ?? */ +#endif + +EXPORT void starthandlecond __PR((SIGBLK *sp)); + +#ifdef PROTOTYPES +EXPORT void +handlecond(const char *signame, + register SIGBLK *sp, + int (*func)(const char *, long, long), + long arg1) +#else +EXPORT void +handlecond(signame, sp, func, arg1) + char *signame; + register SIGBLK *sp; + BOOL (*func)(); + long arg1; +#endif +{ + register SIGBLK *this; + register SIGBLK *last = (SIGBLK *)NULL; +#ifdef HAVE_SCANSTACK + struct frame *fp = (struct frame *)NULL; +#endif + int slen; + + if (signame == NULL || (slen = strlen(signame)) == 0) { + raisecond("handle_bad_name", (long)signame); + abort(); + } + +#ifdef HAVE_SCANSTACK + fp = (struct frame *)getfp(); + fp = (struct frame *)fp->fr_savfp; /* point to frame of caller */ + if (is_even(fp->fr_savfp)) { + /* + * Easy case: no handlers yet + * save real framepointer in sp->sb_savfp + */ + sp->sb_savfp = (long **)fp->fr_savfp; + this = (SIGBLK *)NULL; + } else { + this = (SIGBLK *)even(fp->fr_savfp); + } +#else + this = __roothandle; +#endif + + for (; this; this = this->sb_signext) { + if (this == sp) { + /* + * If a SIGBLK is reused, the name must not change. + */ + if (this->sb_signame != NULL && + !streql(this->sb_signame, signame)) { + raisecond("handle_reused_block", (long)signame); + abort(); + } + sp->sb_sigfun = func; + sp->sb_sigarg = arg1; + return; + } + if (this->sb_signame != NULL && + streql(this->sb_signame, signame)) { + if (last == (SIGBLK *)NULL) { + /* + * 'this' is the first entry in chain + */ + if (this->sb_signext == (SIGBLK *)NULL) { + /* + * only 'this' entry is in chain, copy + * saved real frame pointer into new sp + */ + sp->sb_savfp = this->sb_savfp; + } else { +#ifdef HAVE_SCANSTACK + /* + * make second entry first link in chain + */ + this->sb_signext->sb_savfp = + this->sb_savfp; + fp->fr_savfp = odd(this->sb_signext); +#else + /* + * Cannot happen if scanning the stack + * is not possible... + */ + raisecond("handle_is_empty", (long)0); + abort(); +#endif + } + continue; /* don't trash 'last' ptr */ + } else { + last->sb_signext = this->sb_signext; + } + } + last = this; + } + sp->sb_signext = (SIGBLK *)NULL; + sp->sb_signame = signame; + sp->sb_siglen = slen; + sp->sb_sigfun = func; + sp->sb_sigarg = arg1; + /* + * If there is a chain append to end of the chain, else make it first + */ + if (last) + last->sb_signext = sp; +#ifdef HAVE_SCANSTACK + else + fp->fr_savfp = odd(sp); +#else + /* + * Cannot happen if scanning the stack is not possible... + */ + else { + raisecond("handle_is_empty", (long)0); + abort(); + } +#endif +} + +EXPORT void +starthandlecond(sp) + register SIGBLK *sp; +{ +#ifdef HAVE_SCANSTACK + struct frame *fp = NULL; + + /* + * As the SCO OpenServer C-Compiler has a bug that may cause + * the first function call to getfp() been done before the + * new stack frame is created, we call getfp() twice. + */ + (void) getfp(); +#endif + + sp->sb_signext = (SIGBLK *)NULL; + sp->sb_signame = NULL; + sp->sb_siglen = 0; + sp->sb_sigfun = (handlefunc_t)NULL; + sp->sb_sigarg = 0; + +#ifdef HAVE_SCANSTACK + fp = (struct frame *)getfp(); + fp = (struct frame *)fp->fr_savfp; /* point to frame of caller */ + + if (is_even(fp->fr_savfp)) { + /* + * Easy case: no handlers yet + * save real framepointer in sp + */ + sp->sb_savfp = (long **)fp->fr_savfp; + fp->fr_savfp = odd(sp); + } else { + raisecond("handle_not_empty", (long)0); + abort(); + } +#else + sp->sb_savfp = (long **)__roothandle; + __roothandle = sp; +#endif +} + +EXPORT void +unhandlecond(sp) + register SIGBLK *sp; +{ +#ifdef HAVE_SCANSTACK + register struct frame *fp; + register SIGBLK *sps; + + /* + * As the SCO OpenServer C-Compiler has a bug that may cause + * the first function call to getfp() been done before the + * new stack frame is created, we call getfp() twice. + */ + (void) getfp(); + fp = (struct frame *)getfp(); + fp = (struct frame *)fp->fr_savfp; /* point to frame of caller */ + + if (!is_even(fp->fr_savfp)) { /* if handlers */ + sps = (SIGBLK *)even(fp->fr_savfp); /* point to SIGBLK */ + /* real framepointer */ +#if defined(__sun) && defined(__i386) + fp->fr_savfp = (intptr_t)sps->sb_savfp; +#else + fp->fr_savfp = (struct frame *)sps->sb_savfp; +#endif + } +#else + if (__roothandle == NULL) { + raisecond("handle_is_empty", (long)0); + abort(); + } + /* + * Pop top level handler chain. + */ + __roothandle = (SIGBLK *)__roothandle->sb_savfp; +#endif +} diff --git a/scsilib/libschily/jsprintf.c b/scsilib/libschily/jsprintf.c new file mode 100644 index 0000000..6fff1a3 --- /dev/null +++ b/scsilib/libschily/jsprintf.c @@ -0,0 +1,129 @@ +/* @(#)jsprintf.c 1.14 03/06/15 Copyright 1985, 1995-2003 J. Schilling */ +/* + * Copyright (c) 1985, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <stdio.h> +#include <vadefs.h> +#include <standard.h> +#include <schily.h> + +#define BFSIZ 256 + +typedef struct { + short cnt; + char *ptr; + char buf[BFSIZ]; + int count; + FILE *f; +} *BUF, _BUF; + +LOCAL void _bflush __PR((BUF)); +LOCAL void _bput __PR((char, long)); +EXPORT int js_fprintf __PR((FILE *, const char *, ...)); +EXPORT int js_printf __PR((const char *, ...)); + +LOCAL void +_bflush(bp) + register BUF bp; +{ + bp->count += bp->ptr - bp->buf; + if (filewrite(bp->f, bp->buf, bp->ptr - bp->buf) < 0) + bp->count = EOF; + bp->ptr = bp->buf; + bp->cnt = BFSIZ; +} + +#ifdef PROTOTYPES +LOCAL void +_bput(char c, long l) +#else +LOCAL void +_bput(c, l) + char c; + long l; +#endif +{ + register BUF bp = (BUF)l; + + *bp->ptr++ = c; + if (--bp->cnt <= 0) + _bflush(bp); +} + +/* VARARGS2 */ +#ifdef PROTOTYPES +EXPORT int +js_printf(const char *form, ...) +#else +EXPORT int +js_printf(form, va_alist) + char *form; + va_dcl +#endif +{ + va_list args; + _BUF bb; + + bb.ptr = bb.buf; + bb.cnt = BFSIZ; + bb.count = 0; + bb.f = stdout; +#ifdef PROTOTYPES + va_start(args, form); +#else + va_start(args); +#endif + format(_bput, (long)&bb, form, args); + va_end(args); + if (bb.cnt < BFSIZ) + _bflush(&bb); + return (bb.count); +} + +/* VARARGS3 */ +#ifdef PROTOTYPES +EXPORT int +js_fprintf(FILE *file, const char *form, ...) +#else +EXPORT int +js_fprintf(file, form, va_alist) + FILE *file; + char *form; + va_dcl +#endif +{ + va_list args; + _BUF bb; + + bb.ptr = bb.buf; + bb.cnt = BFSIZ; + bb.count = 0; + bb.f = file; +#ifdef PROTOTYPES + va_start(args, form); +#else + va_start(args); +#endif + format(_bput, (long)&bb, form, args); + va_end(args); + if (bb.cnt < BFSIZ) + _bflush(&bb); + return (bb.count); +} diff --git a/scsilib/libschily/jssnprintf.c b/scsilib/libschily/jssnprintf.c new file mode 100644 index 0000000..292d041 --- /dev/null +++ b/scsilib/libschily/jssnprintf.c @@ -0,0 +1,89 @@ +/* @(#)jssnprintf.c 1.10 04/05/09 Copyright 1985, 1995-2004 J. Schilling */ +/* + * Copyright (c) 1985, 1995-2004 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <unixstd.h> /* include <sys/types.h> try to get size_t */ +#include <stdio.h> /* Try again for size_t */ +#include <stdxlib.h> /* Try again for size_t */ +#include <vadefs.h> +#include <standard.h> +#include <schily.h> + +EXPORT int js_snprintf __PR((char *, size_t maxcnt, const char *, ...)); + +typedef struct { + char *ptr; + int count; +} *BUF, _BUF; + +#ifdef PROTOTYPES +static void _cput(char c, long l) +#else +static void _cput(c, l) + char c; + long l; +#endif +{ + register BUF bp = (BUF)l; + + if (--bp->count > 0) { + *bp->ptr++ = c; + } else { + /* + * Make sure that there will never be a negative overflow. + */ + bp->count++; + } +} + +/* VARARGS2 */ +#ifdef PROTOTYPES +EXPORT int +js_snprintf(char *buf, size_t maxcnt, const char *form, ...) +#else +EXPORT int +js_snprintf(buf, maxcnt, form, va_alist) + char *buf; + unsigned maxcnt; + char *form; + va_dcl +#endif +{ + va_list args; + int cnt; + _BUF bb; + + bb.ptr = buf; + bb.count = maxcnt; + +#ifdef PROTOTYPES + va_start(args, form); +#else + va_start(args); +#endif + cnt = format(_cput, (long)&bb, form, args); + va_end(args); + if (maxcnt > 0) + *(bb.ptr) = '\0'; + if (bb.count < 0) + return (-1); + + return (cnt); +} diff --git a/scsilib/libschily/jssprintf.c b/scsilib/libschily/jssprintf.c new file mode 100644 index 0000000..609feec --- /dev/null +++ b/scsilib/libschily/jssprintf.c @@ -0,0 +1,68 @@ +/* @(#)jssprintf.c 1.15 03/06/15 Copyright 1985, 1995-2003 J. Schilling */ +/* + * Copyright (c) 1985, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <vadefs.h> +#include <standard.h> +#include <schily.h> + +/* + * Do not include stdio.h, BSD systems define sprintf the wrong way! + */ +EXPORT int js_sprintf __PR((char *, const char *, ...)); + +#ifdef PROTOTYPES +static void _cput(char c, long ba) +#else +static void _cput(c, ba) + char c; + long ba; +#endif +{ + *(*(char **) ba)++ = c; +} + +/* VARARGS2 */ +#ifdef PROTOTYPES +EXPORT int +js_sprintf(char *buf, const char *form, ...) +#else +EXPORT int +js_sprintf(buf, form, va_alist) + char *buf; + char *form; + va_dcl +#endif +{ + va_list args; + int cnt; + char *bp = buf; + +#ifdef PROTOTYPES + va_start(args, form); +#else + va_start(args); +#endif + cnt = format(_cput, (long)&bp, form, args); + va_end(args); + *bp = '\0'; + + return (cnt); +} diff --git a/scsilib/libschily/libschily.com b/scsilib/libschily/libschily.com new file mode 100644 index 0000000..a94157a --- /dev/null +++ b/scsilib/libschily/libschily.com @@ -0,0 +1,60 @@ +$ define/nolog scg [-.libscg.scg] +$ set default [-.inc] +$ cc/float=ieee/pref=all/obj/incl=([],[-.include])/define=("VMS") ALIGN_TEST.C +$ link ALIGN_TEST +$ delete ALIGN_TEST.obj;* +$ def/user sys$output [-.libschily]ALIGN.H +$ r ALIGN_TEST +$ cc/float=ieee/pref=all/obj/incl=([],[-.include])/define=("VMS") AVOFFSET.C +$ link AVOFFSET +$ delete AVOFFSET.obj;* +$ def/user sys$output [-.libschily]AVOFFSET.H +$ r AVOFFSET +$ set default [-.libschily] +$ opts = "/float=ieee/pref=all/obj" +$ incs = "/incl=([],[-.include],[-.inc])" +$ cc 'opts' 'incs' /define=("VMS") ASTOI.C +$ cc 'opts' 'incs' /define=("VMS") ASTOLL.C +$ cc 'opts' 'incs' /define=("VMS") COMERR.C +$ cc 'opts' 'incs' /define=("VMS") ERROR.C +$ cc 'opts' 'incs' /define=("VMS") FCONV.C +$ cc 'opts' 'incs' /define=("VMS") FILLBYTES.C +$ cc 'opts' 'incs' /define=("VMS") FORMAT.C +$ cc 'opts' 'incs' /define=("VMS") GETARGS.C +$ cc 'opts' 'incs' /define=("VMS") GETAV0.C +$ cc 'opts' 'incs' /define=("VMS") GETERRNO.C +$ cc 'opts' 'incs' /define=("VMS") GETFP.C +$ cc 'opts' 'incs' /define=("VMS") MOVEBYTES.C +$ cc 'opts' 'incs' /define=("VMS") PRINTF.C +$ cc 'opts' 'incs' /define=("VMS") RAISECOND.C +$ cc 'opts' 'incs' /define=("VMS") SAVEARGS.C +$ cc 'opts' 'incs' /define=("VMS") jsprintf.C +$ cc 'opts' 'incs' /define=("VMS") jssnprintf.C +$ cc 'opts' 'incs' /define=("VMS") STREQL.C +$ cc 'opts' 'incs' /define=("VMS") SWABBYTES.C +$ cc 'opts' 'incs' /define=("VMS") SERRMSG.C +$ cc 'opts' 'incs' /define=("VMS") CMPBYTES.C +$ cc 'opts' 'incs' /define=("VMS") SETERRNO.C +$ libr/crea [-.libs]libschily.olb +$ libr/ins [-.libs]libschily.olb *.obj +$ delete *.obj;* +$ purge/nolog [-.libs]*.olb +$ set default [.stdio] +$ incs1 = "/INCL=([],[--.INCLUDE])" +$ cc'opts' 'incs1'/DEFINE=("VMS") CVMOD.C +$ cc'opts' 'incs1'/DEFINE=("VMS") DAT.C +$ cc'opts' 'incs1'/DEFINE=("VMS") FCONS.C +$ cc'opts' 'incs1'/DEFINE=("VMS") FGETLINE.C +$ cc'opts' 'incs1'/DEFINE=("VMS") FILEOPEN.C +$ cc'opts' 'incs1'/DEFINE=("VMS") FILEREAD.C +$ cc'opts' 'incs1'/DEFINE=("VMS") FILEWRITE.C +$ cc'opts' 'incs1'/DEFINE=("VMS") FLAG.C +$ cc'opts' 'incs1'/DEFINE=("VMS") FLUSH.C +$ cc'opts' 'incs1'/DEFINE=("VMS") NIREAD.C +$ cc'opts' 'incs1'/DEFINE=("VMS") FILELUOPEN.C +$ cc'opts' 'incs1'/DEFINE=("VMS") FILESIZE.C +$ libr/cre [--.libs]stdio.olb +$ libr/ins [--.libs]stdio.olb *.obj +$ delete *.obj;* +$ purge/nolog [--.libs]*.olb +$ set default [-] diff --git a/scsilib/libschily/libschily.mk b/scsilib/libschily/libschily.mk new file mode 100644 index 0000000..2683ba2 --- /dev/null +++ b/scsilib/libschily/libschily.mk @@ -0,0 +1,19 @@ +#ident @(#)libschily.mk 1.3 03/07/13 +########################################################################### +SRCROOT= .. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +.SEARCHLIST: . $(ARCHDIR) stdio $(ARCHDIR) +VPATH= .:stdio:$(ARCHDIR) +INSDIR= lib +TARGETLIB= schily +CPPOPTS += -Istdio +CPPOPTS += -DUSE_SCANSTACK +include Targets +LIBS= + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.lib +########################################################################### diff --git a/scsilib/libschily/libschily_p.mk b/scsilib/libschily/libschily_p.mk new file mode 100644 index 0000000..85ee767 --- /dev/null +++ b/scsilib/libschily/libschily_p.mk @@ -0,0 +1,21 @@ +#ident @(#)libschily_p.mk 1.3 03/07/13 +########################################################################### +SRCROOT= .. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +SUBARCHDIR= /profiled +.SEARCHLIST: . $(ARCHDIR) stdio $(ARCHDIR) +VPATH= .:stdio:$(ARCHDIR) +INSDIR= lib +TARGETLIB= schily_p +CPPOPTS += -Istdio +CPPOPTS += -DUSE_SCANSTACK +COPTS += $(COPTGPROF) +include Targets +LIBS= + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.lib +########################################################################### diff --git a/scsilib/libschily/match.c b/scsilib/libschily/match.c new file mode 100644 index 0000000..643cda0 --- /dev/null +++ b/scsilib/libschily/match.c @@ -0,0 +1,456 @@ +/* @(#)match.c 1.20 03/10/22 Copyright 1985, 1995-2003 J. Schilling */ +#include <standard.h> +#include <patmatch.h> +/* + * Pattern matching functions + * + * Copyright (c) 1985, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +/* + * The pattern matching functions below are based on the algorithm + * presented by Martin Richards in: + * + * "A Compact Function for Regular Expression Pattern Matching", + * Software-Practice and Experience, Vol. 9, 527-534 (1979) + * + * Several changes have been made to the original source which has been + * written in BCPL: + * + * '/' is replaced by '!' (to allow UNIX filenames) + * '(',')' are replaced by '{', '}' + * '\'' is replaced by '\\' (UNIX compatible quote) + * + * Character classes have been added to allow "[<character list>]" + * to be used. + * Start of line '^' and end of line '$' have been added. + */ + +#ifdef __LINE_MATCH +#define opatmatch opatlmatch +#define patmatch patlmatch +#endif + +#define ENDSTATE (-1) +typedef unsigned char Uchar; + +/*--------------------------------------------------------------------------- +| +| The Interpreter +| ++---------------------------------------------------------------------------*/ + + +/* + * put adds a new state to the active list + */ +#define put(ret, state, sp, n) { \ + register int *lstate = state; \ + register int *lsp = sp; \ + register int ln = n; \ + \ + while (lstate < lsp) { \ + if (*lstate++ == ln) { \ + ret = lsp; \ + lsp = 0; \ + break; \ + } \ + } \ + if (lsp) { \ + *lstate++ = ln; \ + ret = lstate; \ + } \ +} + + +/* + * match a character in class + */ +#define in_class(found, pat, c) { \ + register const Uchar *lpat = pat; \ + register int lc = c; \ + int lo_bound; \ + int hi_bound; \ + \ + found = FALSE; \ + \ + if (*lpat == NOT) { \ + lpat++; \ + found = TRUE; \ + } \ + while (*lpat != RCLASS) { \ + if (*lpat == QUOTE) \ + lpat++; \ + lo_bound = *lpat++; \ + if (*lpat == RANGE) { \ + lpat++; \ + if (*lpat == QUOTE) \ + lpat++; \ + hi_bound = *lpat++; \ + } else { \ + hi_bound = lo_bound; \ + } \ + if (lo_bound <= lc && lc <= hi_bound) { \ + found = !found; \ + break; \ + } \ + } \ +} + +/* + * opatmatch - the old external interpreter interface. + * + * Trys to match a string beginning at offset + * against the compiled pattern. + */ +EXPORT Uchar +*opatmatch(pat, aux, str, soff, slen, alt) + const Uchar *pat; + const int *aux; + const Uchar *str; + int soff; + int slen; + int alt; +{ + int state[MAXPAT]; + + return (patmatch(pat, aux, str, soff, slen, alt, state)); +} + +/* + * patmatch - the external interpreter interface. + * + * Trys to match a string beginning at offset + * against the compiled pattern. + */ +EXPORT Uchar * +patmatch(pat, aux, str, soff, slen, alt, state) + const Uchar *pat; + const int *aux; + const Uchar *str; + int soff; + int slen; + int alt; + int state[]; +{ + register int *sp; + register int *n; + register int *i; + register int p; + register int q, s, k; + int c; + const Uchar *lastp = (Uchar *)NULL; + +#ifdef __LINE_MATCH +for (; soff <= slen; soff++) { +#endif + + sp = state; + put(sp, state, state, 0); + if (alt != ENDSTATE) + put(sp, state, sp, alt); + + for (s = soff; ; s++) { + /* + * next char from input string + */ + if (s >= slen) + c = 0; + else + c = str[s]; + /* + * first complete the closure + */ + for (n = state; n < sp; ) { + p = *n++; /* next state number */ + if (p == ENDSTATE) + continue; + q = aux[p]; /* get next state for pat */ + k = pat[p]; /* get next char from pat */ + switch (k) { + + case REP: + put(sp, state, sp, p+1); + case NIL: /* NIL matches always */ + case STAR: + put(sp, state, sp, q); + break; + case LBRACK: /* alternations */ + case ALT: + put(sp, state, sp, p+1); + if (q != ENDSTATE) + put(sp, state, sp, q); + break; + case START: + if (s == 0) + put(sp, state, sp, q); + break; + case END: + if (c == '\0') + put(sp, state, sp, q); + break; + } + } + + for (i = state; i < sp; ) { + if (*i++ == ENDSTATE) { + lastp = &str[s]; + break; + } + } + if (c == 0) + return ((Uchar *)lastp); + + /* + * now try to match next character + */ + n = sp; + sp = state; + for (i = sp; i < n; ) { + p = *i++; /* next active state number */ + if (p == ENDSTATE) + continue; + k = pat[p]; + switch (k) { + + case ALT: + case REP: + case NIL: + case LBRACK: + case START: + case END: + continue; + case LCLASS: + in_class(q, &pat[p+1], c); + if (!q) + continue; + break; + case STAR: + put(sp, state, sp, p); + continue; + case QUOTE: + k = pat[p+1]; + default: + if (k != c) + continue; + case ANY: + break; + } + put(sp, state, sp, aux[p]); + } + if (sp == state) { /* if no new states return */ +#ifdef __LINE_MATCH + + if (lastp || (soff == slen - 1)) + return ((Uchar *)lastp); + else + break; +#else + return ((Uchar *)lastp); +#endif + } + } +#ifdef __LINE_MATCH +} +return ((Uchar *)lastp); +#endif +} + + +#ifndef __LINE_MATCH +/*--------------------------------------------------------------------------- +| +| The Compiler +| ++---------------------------------------------------------------------------*/ + +typedef struct args { + const Uchar *pattern; + int *aux; + int patp; + int length; + Uchar Ch; +} arg_t; + +LOCAL void nextitem __PR((arg_t *)); +LOCAL int prim __PR((arg_t *)); +LOCAL int expr __PR((arg_t *, int *)); +LOCAL void setexits __PR((int *, int, int)); +LOCAL int join __PR((int *, int, int)); + +/* + * 'read' the next character from pattern + */ +#define rch(ap) \ +{ \ + if (++(ap)->patp >= (ap)->length) \ + (ap)->Ch = 0; \ + else \ + (ap)->Ch = (ap)->pattern[(ap)->patp]; \ +} + +/* + * get the next item from pattern + */ +LOCAL void +nextitem(ap) + arg_t *ap; +{ + if (ap->Ch == QUOTE) + rch(ap); + rch(ap); +} + +/* + * parse a primary + */ +LOCAL int +prim(ap) + arg_t *ap; +{ + int a = ap->patp; + int op = ap->Ch; + int t; + + nextitem(ap); + switch (op) { + + case '\0': + case ALT: + case RBRACK: + return (ENDSTATE); + case LCLASS: + while (ap->Ch != RCLASS && ap->Ch != '\0') + nextitem(ap); + if (ap->Ch == '\0') + return (ENDSTATE); + nextitem(ap); + break; + case REP: + t = prim(ap); + if (t == ENDSTATE) + return (ENDSTATE); + setexits(ap->aux, t, a); + break; + case LBRACK: + a = expr(ap, &ap->aux[a]); + if (a == ENDSTATE || ap->Ch != RBRACK) + return (ENDSTATE); + nextitem(ap); + break; + } + return (a); +} + +/* + * parse an expression (a sequence of primaries) + */ +LOCAL int +expr(ap, altp) + arg_t *ap; + int *altp; +{ + int exits = ENDSTATE; + int a; + int *aux = ap->aux; + Uchar Ch; + + for (;;) { + a = prim(ap); + Ch = ap->Ch; + if (Ch == ALT || Ch == RBRACK || Ch == '\0') { + exits = join(aux, exits, a); + if (Ch != ALT) + return (exits); + *altp = ap->patp; + altp = &aux[ap->patp]; + nextitem(ap); + } else + setexits(aux, a, ap->patp); + } +} + +/* + * set all exits in a list to a specified value + */ +LOCAL void +setexits(aux, list, val) + int *aux; + int list; + int val; +{ + int a; + + while (list != ENDSTATE) { + a = aux[list]; + aux[list] = val; + list = a; + } +} + +/* + * concatenate two lists + */ +LOCAL int +join(aux, a, b) + int *aux; + int a; + int b; +{ + int t; + + if (a == ENDSTATE) + return (b); + t = a; + while (aux[t] != ENDSTATE) + t = aux[t]; + aux[t] = b; + return (a); +} + +/* + * patcompile - the external compiler interface. + * + * The pattern is compiled into the aux array. + * Return value on success, is the outermost alternate which is != 0. + * Error is indicated by return of 0. + */ +EXPORT int +patcompile(pat, len, aux) + const Uchar *pat; + int len; + int *aux; +{ + arg_t a; + int alt = ENDSTATE; + int i; + + a.pattern = pat; + a.length = len; + a.aux = aux; + a.patp = -1; + + for (i = 0; i < len; i++) + aux[i] = ENDSTATE; + rch(&a); + i = expr(&a, &alt); + if (i == ENDSTATE) + return (0); + setexits(aux, i, ENDSTATE); + return (alt); +} +#endif /* LMATCH */ diff --git a/scsilib/libschily/matchl.c b/scsilib/libschily/matchl.c new file mode 100644 index 0000000..6cb35fe --- /dev/null +++ b/scsilib/libschily/matchl.c @@ -0,0 +1,24 @@ +/* @(#)matchl.c 1.1 00/11/10 Copyright 1998 J. Schilling */ +/* + * Pattern matching function for line match (grep like). + * + * Copyright (c) 1998 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#define __LINE_MATCH +#include "match.c" diff --git a/scsilib/libschily/movebytes.c b/scsilib/libschily/movebytes.c new file mode 100644 index 0000000..5075e59 --- /dev/null +++ b/scsilib/libschily/movebytes.c @@ -0,0 +1,125 @@ +/* @(#)movebytes.c 1.13 03/06/15 Copyright 1985, 1989, 1995-2003 J. Schilling */ +/* + * move data + * + * Copyright (c) 1985, 1989, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <standard.h> +#include <align.h> +#include <schily.h> + +#define DO8(a) a; a; a; a; a; a; a; a; + +EXPORT char * +movebytes(fromv, tov, cnt) + const void *fromv; + void *tov; + int cnt; +{ + register const char *from = fromv; + register char *to = tov; + register int n; + + /* + * If we change cnt to be unsigned, check for == instead of <= + */ + if ((n = cnt) <= 0) + return (to); + + if (from >= to) { + /* + * source is on higher adresses than destination: + * move bytes forwards + */ + if (n >= (int)(8 * sizeof (long))) { + if (l2aligned(from, to)) { + register const long *froml = (const long *)from; + register long *tol = (long *)to; + register int rem = n % (8 * sizeof (long)); + + n /= (8 * sizeof (long)); + do { + DO8 (*tol++ = *froml++); + } while (--n > 0); + + from = (const char *)froml; + to = (char *)tol; + n = rem; + } + + if (n >= 8) { + n -= 8; + do { + DO8 (*to++ = *from++); + } while ((n -= 8) >= 0); + n += 8; + } + + if (n > 0) do { + *to++ = *from++; + } while (--n > 0); + return (to); + } + if (n > 0) do { + *to++ = *from++; + } while (--n > 0); + return (to); + } else { + char *ep; + + /* + * source is on lower adresses than destination: + * move bytes backwards + */ + to += n; + from += n; + ep = to; + if (n >= (int)(8 * sizeof (long))) { + if (l2aligned(from, to)) { + register const long *froml = (const long *)from; + register long *tol = (long *)to; + register int rem = n % (8 * sizeof (long)); + + n /= (8 * sizeof (long)); + do { + DO8 (*--tol = *--froml); + } while (--n > 0); + + from = (const char *)froml; + to = (char *)tol; + n = rem; + } + if (n >= 8) { + n -= 8; + do { + DO8 (*--to = *--from); + } while ((n -= 8) >= 0); + n += 8; + } + if (n > 0) do { + *--to = *--from; + } while (--n > 0); + return (ep); + } + if (n > 0) do { + *--to = *--from; + } while (--n > 0); + return (ep); + } +} diff --git a/scsilib/libschily/printf.c b/scsilib/libschily/printf.c new file mode 100644 index 0000000..b0ecd96 --- /dev/null +++ b/scsilib/libschily/printf.c @@ -0,0 +1,148 @@ +/* @(#)printf.c 1.14 03/06/15 Copyright 1985, 1989, 1995-2003 J. Schilling */ +/* + * Copyright (c) 1985, 1989, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> + +#ifdef printf +# define __no_undef__ +#else +# define printf __nothing__ +#endif +#ifdef fprintf +# define __no_undef2__ +#else +# define fprintf __nothing2__ +#endif + +#include <stdio.h> +#include <vadefs.h> +#include <standard.h> +#include <schily.h> + +#ifndef __no_undef__ +# undef printf +#endif +#ifndef __no_undef2__ +# undef fprintf +#endif + +#define BFSIZ 256 + +typedef struct { + short cnt; + char *ptr; + char buf[BFSIZ]; + int count; + FILE *f; +} *BUF, _BUF; + +LOCAL void _bflush __PR((BUF)); +LOCAL void _bput __PR((char, long)); +EXPORT int fprintf __PR((FILE *, const char *, ...)) __printflike__(2, 3); +EXPORT int printf __PR((const char *, ...)) __printflike__(1, 2); + +LOCAL void +_bflush(bp) + register BUF bp; +{ + bp->count += bp->ptr - bp->buf; + if (filewrite(bp->f, bp->buf, bp->ptr - bp->buf) < 0) + bp->count = EOF; + bp->ptr = bp->buf; + bp->cnt = BFSIZ; +} + +#ifdef PROTOTYPES +LOCAL void +_bput(char c, long l) +#else +LOCAL void +_bput(c, l) + char c; + long l; +#endif +{ + register BUF bp = (BUF)l; + + *bp->ptr++ = c; + if (--bp->cnt <= 0) + _bflush(bp); +} + +/* VARARGS2 */ +#ifdef PROTOTYPES +EXPORT int +printf(const char *form, ...) +#else +EXPORT int +printf(form, va_alist) + char *form; + va_dcl +#endif +{ + va_list args; + _BUF bb; + + bb.ptr = bb.buf; + bb.cnt = BFSIZ; + bb.count = 0; + bb.f = stdout; +#ifdef PROTOTYPES + va_start(args, form); +#else + va_start(args); +#endif + format(_bput, (long)&bb, form, args); + va_end(args); + if (bb.cnt < BFSIZ) + _bflush(&bb); + return (bb.count); +} + +/* VARARGS3 */ +#ifdef PROTOTYPES +EXPORT int +fprintf(FILE *file, const char *form, ...) +#else +EXPORT int +fprintf(file, form, va_alist) + FILE *file; + char *form; + va_dcl +#endif +{ + va_list args; + _BUF bb; + + bb.ptr = bb.buf; + bb.cnt = BFSIZ; + bb.count = 0; + bb.f = file; +#ifdef PROTOTYPES + va_start(args, form); +#else + va_start(args); +#endif + format(_bput, (long)&bb, form, args); + va_end(args); + if (bb.cnt < BFSIZ) + _bflush(&bb); + return (bb.count); +} diff --git a/scsilib/libschily/raisecond.c b/scsilib/libschily/raisecond.c new file mode 100644 index 0000000..3820fbe --- /dev/null +++ b/scsilib/libschily/raisecond.c @@ -0,0 +1,168 @@ +/* @(#)raisecond.c 1.18 04/05/09 Copyright 1985, 1989, 1995-2004 J. Schilling */ +/* + * raise a condition (software signal) + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ +/* + * Check for installed condition handlers. + * If a handler is found, the function is called with the appropriate args. + * If no handler is found or no handler signals success, + * the program will be aborted. + * + * Copyright (c) 1985, 1989, 1995-2004 J. Schilling + */ +#include <mconfig.h> +#include <stdio.h> +#include <standard.h> +#include <sigblk.h> +#include <unixstd.h> +#include <stdxlib.h> +#include <strdefs.h> +#include <avoffset.h> +#include <schily.h> + +#if !defined(AV_OFFSET) || !defined(FP_INDIR) +# ifdef HAVE_SCANSTACK +# undef HAVE_SCANSTACK +# endif +#endif + +/* + * Macros to print to stderr without stdio, to avoid screwing up. + */ +#ifndef STDERR_FILENO +#define STDERR_FILENO 2 +#endif +#define eprints(a) (void)write(STDERR_FILENO, (a), sizeof (a)-1) +#define eprintl(a) (void)write(STDERR_FILENO, (a), strlen(a)) + +#define is_even(p) ((((long)(p)) & 1) == 0) +#define even(p) (((long)(p)) & ~1L) +#ifdef __future__ +#define even(p) (((long)(p)) - 1) /* will this work with 64 bit ?? */ +#endif + + +LOCAL void raiseabort __PR((const char *)); + +#ifdef HAVE_SCANSTACK +#include <stkframe.h> +#define next_frame(vp) do { \ + if (((struct frame *)(vp))->fr_savfp == 0) { \ + vp = (void *)0; \ + break; \ + } \ + if (((struct frame *)(vp))->fr_savpc == 0) { \ + vp = (void *)0; \ + break; \ + } \ + vp = \ + (void *)((struct frame *)(vp))->fr_savfp; \ + } while (vp != NULL && is_even(vp)); \ + vp = (struct frame *)even(vp); +#else +EXPORT SIGBLK *__roothandle; + +#define next_frame(vp) vp = (((SIGBLK *)(vp))->sb_savfp); +#endif + +LOCAL BOOL framehandle __PR((SIGBLK *, const char *, const char *, long)); + +/* + * Loop through the chain of procedure frames on the stack. + * + * Frame pointers normally have even values. + * Frame pointers of procedures with an installed handler are marked odd. + * The even base value, in this case actually points to a SIGBLK which + * holds the saved "real" frame pointer. + * The SIGBLK mentioned above may me the start of a chain of SIGBLK's, + * containing different handlers. + */ +EXPORT void +raisecond(signame, arg2) + const char *signame; + long arg2; +{ + register void *vp = NULL; + +#ifdef HAVE_SCANSTACK + /* + * As the SCO OpenServer C-Compiler has a bug that may cause + * the first function call to getfp() been done before the + * new stack frame is created, we call getfp() twice. + */ + (void) getfp(); + vp = getfp(); + next_frame(vp); +#else + vp = __roothandle; +#endif + + while (vp) { + if (framehandle((SIGBLK *)vp, signame, signame, arg2)) + return; + else if (framehandle((SIGBLK *)vp, "any_other", signame, arg2)) + return; +#ifdef HAVE_SCANSTACK + vp = (struct frame *)((SIGBLK *)vp)->sb_savfp; +#endif + next_frame(vp); + } + /* + * No matching handler that signals success found. + * Print error message and abort. + */ + raiseabort(signame); + /* NOTREACHED */ +} + +/* + * Loop through the handler chain for a procedure frame. + * + * If no handler with matching name is found, return FALSE, + * otherwise the first handler with matching name is called. + * The return value in the latter case depends on the called function. + */ +LOCAL BOOL +framehandle(sp, handlename, signame, arg2) + register SIGBLK *sp; + const char *handlename; + const char *signame; + long arg2; +{ + for (; sp; sp = sp->sb_signext) { + if (sp->sb_signame != NULL && + streql(sp->sb_signame, handlename)) { + if (sp->sb_sigfun == NULL) { /* deactivated */ + return (FALSE); + } else { + return (*sp->sb_sigfun)(signame, + sp->sb_sigarg, arg2); + } + } + } + return (FALSE); +} + +LOCAL void +raiseabort(signame) + const char *signame; +{ + eprints("Condition not caught: "); eprintl(signame); eprints(".\n"); + abort(); + /* NOTREACHED */ +} diff --git a/scsilib/libschily/rename.c b/scsilib/libschily/rename.c new file mode 100644 index 0000000..139e88b --- /dev/null +++ b/scsilib/libschily/rename.c @@ -0,0 +1,137 @@ +/* @(#)rename.c 1.6 04/09/04 Copyright 1998-2003 J. Schilling */ +#ifndef lint +static char sccsid[] = + "@(#)rename.c 1.6 04/09/04 Copyright 1998-2003 J. Schilling"; +#endif +/* + * rename() for old systems that don't have it. + * + * Copyright (c) 1998-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#define rename __nothing__ +#include <mconfig.h> + +#ifndef HAVE_RENAME + +#include <stdio.h> /* XXX not OK but needed for js_xx() in schily.h */ +#include <unixstd.h> +#include <strdefs.h> +#include <statdefs.h> +#include <maxpath.h> +#include <standard.h> +#include <utypes.h> +#include <schily.h> +#include <errno.h> +#undef rename +#include <libport.h> + +#ifndef MAXPATHNAME +#define MAXPATHNAME 1024 +#endif + +#if MAXPATHNAME < 1024 +#undef MAXPATHNAME +#define MAXPATHNAME 1024 +#endif + +#define MAXNAME MAXPATHNAME + +#define FILEDESC struct stat + +#ifndef HAVE_LSTAT +#define lstat stat +#endif + +EXPORT int +rename(old, new) + const char *old; + const char *new; +{ + char nname[MAXNAME]; + char bakname[MAXNAME]; + char strpid[32]; + int strplen; + BOOL savpresent = FALSE; + BOOL newpresent = FALSE; + int serrno; + FILEDESC ostat; + FILEDESC xstat; + + serrno = geterrno(); + + if (lstat(old, &ostat) < 0) + return (-1); + + if (lstat(new, &xstat) >= 0) { + newpresent = TRUE; + if (ostat.st_dev == xstat.st_dev && + ostat.st_ino == xstat.st_ino) + return (0); /* old == new we are done */ + } + + strplen = js_snprintf(strpid, sizeof (strpid), ".%lld", + (Llong)getpid()); + + if (strlen(new) <= (MAXNAME-strplen) || + strchr(&new[MAXNAME-strplen], '/') == NULL) { + /* + * Save old version of file 'new'. + */ + strncpy(nname, new, MAXNAME-strplen); + nname[MAXNAME-strplen] = '\0'; + js_snprintf(bakname, sizeof (bakname), "%s%s", nname, strpid); + unlink(bakname); + if (link(new, bakname) >= 0) + savpresent = TRUE; + } + + if (newpresent) { + if (rmdir(new) < 0) { + if (geterrno() == ENOTDIR) { + if (unlink(new) < 0) + return (-1); + } else { + return (-1); + } + } + } + + /* + * Now add 'new' name to 'old'. + */ + if (link(old, new) < 0) { + serrno = geterrno(); + /* + * Make sure not to loose old version of 'new'. + */ + if (savpresent) { + unlink(new); + link(bakname, new); + unlink(bakname); + } + seterrno(serrno); + return (-1); + } + if (unlink(old) < 0) + return (-1); + unlink(bakname); /* Fails in most cases... */ + seterrno(serrno); /* ...so restore errno */ + return (0); +} +#endif /* HAVE_RENAME */ diff --git a/scsilib/libschily/saveargs.c b/scsilib/libschily/saveargs.c new file mode 100644 index 0000000..8626581 --- /dev/null +++ b/scsilib/libschily/saveargs.c @@ -0,0 +1,124 @@ +/* @(#)saveargs.c 1.11 03/07/13 Copyright 1995-2003 J. Schilling */ +/* + * save argc, argv for command error printing routines + * + * Copyright (c) 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <standard.h> +#include <strdefs.h> +#include <stdxlib.h> +#include <avoffset.h> +#include <schily.h> + +#if !defined(AV_OFFSET) || !defined(FP_INDIR) +# ifdef HAVE_SCANSTACK +# undef HAVE_SCANSTACK +# endif +#endif + +static int ac_saved; +static char **av_saved; +static char *av0_saved; +static char *progname_saved; + +static char av0_sp[32]; /* av0 space, avoid malloc() in most cases */ +static char prn_sp[32]; /* name space, avoid malloc() in most cases */ +static char dfl_str[] = "?"; + +EXPORT void +save_args(ac, av) + int ac; + char *av[]; +{ + int slen; + + ac_saved = ac; + av_saved = av; + + if (av0_saved && av0_saved != av0_sp) + free(av0_saved); + + slen = strlen(av[0]) + 1; + + if (slen <= (int)sizeof (av0_sp)) + av0_saved = av0_sp; + else + av0_saved = malloc(slen); + + if (av0_saved) + strcpy(av0_saved, av[0]); +} + +EXPORT int +saved_ac() +{ + return (ac_saved); +} + +EXPORT char ** +saved_av() +{ + return (av_saved); +} + +EXPORT char * +saved_av0() +{ + return (av0_saved); +} + +EXPORT void +set_progname(name) + const char *name; +{ + int slen; + + if (progname_saved && progname_saved != prn_sp) + free(progname_saved); + + slen = strlen(name) + 1; + + if (slen <= sizeof (prn_sp)) + progname_saved = prn_sp; + else + progname_saved = malloc(slen); + + if (progname_saved) + strcpy(progname_saved, name); +} + +EXPORT char * +get_progname() +{ +#ifdef HAVE_SCANSTACK + char *progname; +#endif + + if (progname_saved) + return (progname_saved); + if (av0_saved) + return (av0_saved); +#ifdef HAVE_SCANSTACK + progname = getav0(); /* scan stack to get argv[0] */ + if (progname) + return (progname); +#endif + return (dfl_str); +} diff --git a/scsilib/libschily/serrmsg.c b/scsilib/libschily/serrmsg.c new file mode 100644 index 0000000..ae29204 --- /dev/null +++ b/scsilib/libschily/serrmsg.c @@ -0,0 +1,118 @@ +/* @(#)serrmsg.c 1.3 03/06/15 Copyright 1985, 2000-2003 J. Schilling */ +/* + * Routines for printing command errors + * + * Copyright (c) 1985, 2000-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <unixstd.h> /* include <sys/types.h> try to get size_t */ +#include <stdio.h> /* Try again for size_t */ +#include <stdxlib.h> /* Try again for size_t */ +#include <standard.h> +#include <stdxlib.h> +#include <vadefs.h> +#include <strdefs.h> +#include <schily.h> +#ifndef HAVE_STRERROR +extern char *sys_errlist[]; +extern int sys_nerr; +#endif + +EXPORT int serrmsg __PR((char *buf, size_t maxcnt, const char *, ...)); +EXPORT int serrmsgno __PR((int, char *buf, size_t maxcnt, const char *, ...)); +LOCAL int _serrmsg __PR((int, char *buf, size_t maxcnt, const char *, va_list)); + +/* VARARGS1 */ +EXPORT int +#ifdef PROTOTYPES +serrmsg(char *buf, size_t maxcnt, const char *msg, ...) +#else +serrmsg(buf, maxcnt, msg, va_alist) + char *buf; + size_t maxcnt; + char *msg; + va_dcl +#endif +{ + va_list args; + int ret; + +#ifdef PROTOTYPES + va_start(args, msg); +#else + va_start(args); +#endif + ret = _serrmsg(geterrno(), buf, maxcnt, msg, args); + va_end(args); + return (ret); +} + +/* VARARGS2 */ +#ifdef PROTOTYPES +EXPORT int +serrmsgno(int err, char *buf, size_t maxcnt, const char *msg, ...) +#else +serrmsgno(err, buf, maxcnt, msg, va_alist) + int err; + char *buf; + size_t maxcnt; + char *msg; + va_dcl +#endif +{ + va_list args; + int ret; + +#ifdef PROTOTYPES + va_start(args, msg); +#else + va_start(args); +#endif + ret = _serrmsg(err, buf, maxcnt, msg, args); + va_end(args); + return (ret); +} + +LOCAL int +_serrmsg(err, buf, maxcnt, msg, args) + int err; + char *buf; + size_t maxcnt; + const char *msg; + va_list args; +{ + int ret; + char errbuf[20]; + char *errnam; + char *prognam = get_progname(); + + if (err < 0) { + ret = js_snprintf(buf, maxcnt, "%s: %r", prognam, msg, args); + } else { + errnam = errmsgstr(err); + if (errnam == NULL) { + (void) js_snprintf(errbuf, sizeof (errbuf), + "Error %d", err); + errnam = errbuf; + } + ret = js_snprintf(buf, maxcnt, + "%s: %s. %r", prognam, errnam, msg, args); + } + return (ret); +} diff --git a/scsilib/libschily/seterrno.c b/scsilib/libschily/seterrno.c new file mode 100644 index 0000000..e5844c7 --- /dev/null +++ b/scsilib/libschily/seterrno.c @@ -0,0 +1,43 @@ +/* @(#)seterrno.c 1.8 03/06/15 Copyright 1985, 1995-2003 J. Schilling */ +/* + * Set error number + * + * Copyright (c) 1985, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <standard.h> +#include <errno.h> +#include <schily.h> + +#ifndef HAVE_ERRNO_DEF +extern int errno; +#endif + +#ifdef seterrno +#undef seterrno +#endif + +EXPORT int +seterrno(err) + int err; +{ + int old = errno; + + errno = err; + return (old); +} diff --git a/scsilib/libschily/setfp.c b/scsilib/libschily/setfp.c new file mode 100644 index 0000000..c274635 --- /dev/null +++ b/scsilib/libschily/setfp.c @@ -0,0 +1,67 @@ +/* @(#)setfp.c 1.11 03/07/13 Copyright 1988, 1995-2003 J. Schilling */ +/* + * Set frame pointer + * + * Copyright (c) 1988, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <standard.h> +#include <avoffset.h> +#include <schily.h> + +#if !defined(AV_OFFSET) || !defined(FP_INDIR) +# ifdef HAVE_SCANSTACK +# undef HAVE_SCANSTACK +# endif +#endif + +# ifdef HAVE_SCANSTACK +#include <stkframe.h> + +#define MAXWINDOWS 32 +#define NWINDOWS 7 + +extern void **___fpoff __PR((char *cp)); + +EXPORT void +setfp(fp) + void * const *fp; +{ + long **dummy[1]; + +#ifdef sparc + flush_reg_windows(MAXWINDOWS-2); +#endif + *(long ***)(&((struct frame *)___fpoff((char *)&dummy[0]))->fr_savfp) = + (long **)fp; +#ifdef sparc + flush_reg_windows(MAXWINDOWS-2); +#endif +} + +#else + +EXPORT void +setfp(fp) + void * const *fp; +{ + raisecond("setfp_not_implemented", 0L); +} + +#endif diff --git a/scsilib/libschily/shlschily.mk b/scsilib/libschily/shlschily.mk new file mode 100644 index 0000000..d21485d --- /dev/null +++ b/scsilib/libschily/shlschily.mk @@ -0,0 +1,20 @@ +#ident @(#)shlschily.mk 1.4 03/07/13 +########################################################################### +SRCROOT= .. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +SUBARCHDIR= /pic +.SEARCHLIST: . $(ARCHDIR) stdio $(ARCHDIR) +VPATH= .:stdio:$(ARCHDIR) +INSDIR= lib +TARGETLIB= schily +CPPOPTS += -Istdio +CPPOPTS += -DUSE_SCANSTACK +include Targets +LIBS= + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.shl +########################################################################### diff --git a/scsilib/libschily/snprintf.c b/scsilib/libschily/snprintf.c new file mode 100644 index 0000000..ed3cb9e --- /dev/null +++ b/scsilib/libschily/snprintf.c @@ -0,0 +1,91 @@ +/* @(#)snprintf.c 1.9 04/05/09 Copyright 1985, 1996-2004 J. Schilling */ +/* + * Copyright (c) 1985, 1996-2004 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#define snprintf __nothing__ /* prototype may be wrong (e.g. IRIX) */ +#include <mconfig.h> +#include <unixstd.h> /* include <sys/types.h> try to get size_t */ +#include <stdio.h> /* Try again for size_t */ +#include <stdxlib.h> /* Try again for size_t */ +#include <vadefs.h> +#include <standard.h> +#include <schily.h> +#undef snprintf + +EXPORT int snprintf __PR((char *, size_t maxcnt, const char *, ...)); + +typedef struct { + char *ptr; + int count; +} *BUF, _BUF; + +#ifdef PROTOTYPES +static void _cput(char c, long l) +#else +static void _cput(c, l) + char c; + long l; +#endif +{ + register BUF bp = (BUF)l; + + if (--bp->count > 0) { + *bp->ptr++ = c; + } else { + /* + * Make sure that there will never be a negative overflow. + */ + bp->count++; + } +} + +/* VARARGS2 */ +#ifdef PROTOTYPES +EXPORT int +snprintf(char *buf, size_t maxcnt, const char *form, ...) +#else +EXPORT int +snprintf(buf, maxcnt, form, va_alist) + char *buf; + unsigned maxcnt; + char *form; + va_dcl +#endif +{ + va_list args; + int cnt; + _BUF bb; + + bb.ptr = buf; + bb.count = maxcnt; + +#ifdef PROTOTYPES + va_start(args, form); +#else + va_start(args); +#endif + cnt = format(_cput, (long)&bb, form, args); + va_end(args); + if (maxcnt > 0) + *(bb.ptr) = '\0'; + if (bb.count < 0) + return (-1); + + return (cnt); +} diff --git a/scsilib/libschily/spawn.c b/scsilib/libschily/spawn.c new file mode 100644 index 0000000..7c99b5a --- /dev/null +++ b/scsilib/libschily/spawn.c @@ -0,0 +1,162 @@ +/* @(#)spawn.c 1.16 03/07/13 Copyright 1985, 1989, 1995-2003 J. Schilling */ +/* + * Spawn another process/ wait for child process + * + * Copyright (c) 1985, 1989, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <stdio.h> +#include <standard.h> +#define fspawnl __nothing__ /* prototype in schily.h is wrong */ +#define spawnl __nothing__ /* prototype in schily.h is wrong */ +#include <schily.h> +#undef fspawnl +#undef spawnl +#include <unixstd.h> +#include <stdxlib.h> +#include <vadefs.h> +#include <waitdefs.h> +#include <errno.h> + +#define MAX_F_ARGS 16 + +EXPORT int fspawnl __PR((FILE *, FILE *, FILE *, ...)); + +EXPORT int +fspawnv(in, out, err, argc, argv) + FILE *in; + FILE *out; + FILE *err; + int argc; + char * const argv[]; +{ + int pid; + + if ((pid = fspawnv_nowait(in, out, err, argv[0], argc, argv)) < 0) + return (pid); + + return (wait_chld(pid)); +} + +/* VARARGS5 */ +#ifdef PROTOTYPES +EXPORT int +fspawnl(FILE *in, FILE *out, FILE *err, ...) +#else +EXPORT int +fspawnl(in, out, err, va_alist) + FILE *in; + FILE *out; + FILE *err; + va_dcl +#endif +{ + va_list args; + int ac = 0; + char *xav[MAX_F_ARGS]; + char **av; + char **pav; + char *p; + int ret; + +#ifdef PROTOTYPES + va_start(args, err); +#else + va_start(args); +#endif + while (va_arg(args, char *) != NULL) + ac++; + va_end(args); + + if (ac < MAX_F_ARGS) { + pav = av = xav; + } else { + pav = av = (char **)malloc((ac+1)*sizeof (char *)); + if (av == 0) + return (-1); + } + +#ifdef PROTOTYPES + va_start(args, err); +#else + va_start(args); +#endif + do { + p = va_arg(args, char *); + *pav++ = p; + } while (p != NULL); + va_end(args); + + ret = fspawnv(in, out, err, ac, av); + if (av != xav) + free(av); + return (ret); +} + +EXPORT int +fspawnv_nowait(in, out, err, name, argc, argv) + FILE *in; + FILE *out; + FILE *err; + const char *name; + int argc; + char * const argv[]; +{ + int pid = -1; /* Initialization needed to make GCC happy */ + int i; + + for (i = 1; i < 64; i *= 2) { + if ((pid = fork()) >= 0) + break; + sleep(i); + } + if (pid != 0) + return (pid); + /* + * silly: fexecv must set av[ac] = NULL + * so we have to cast argv tp (char **) + */ + fexecv(name, in, out, err, argc, (char **)argv); + exit(geterrno()); + /* NOTREACHED */ +#ifndef lint + return (0); /* keep gnu compiler happy */ +#endif +} + +EXPORT int +wait_chld(pid) + int pid; +{ + int died; + WAIT_T status; + + do { + do { + died = wait(&status); + } while (died < 0 && geterrno() == EINTR); + if (died < 0) + return (died); + } while (died != pid); + + if (WCOREDUMP(status)) + unlink("core"); + + return (WEXITSTATUS(status)); +} diff --git a/scsilib/libschily/sprintf.c b/scsilib/libschily/sprintf.c new file mode 100644 index 0000000..83c83c7 --- /dev/null +++ b/scsilib/libschily/sprintf.c @@ -0,0 +1,68 @@ +/* @(#)sprintf.c 1.14 03/06/15 Copyright 1985, 1988-2003 J. Schilling */ +/* + * Copyright (c) 1985, 1988-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <vadefs.h> +#include <standard.h> +#include <schily.h> + +/* + * Do not include stdio.h, BSD systems define sprintf the wrong way! + */ +EXPORT int sprintf __PR((char *, const char *, ...)); + +#ifdef PROTOTYPES +static void _cput(char c, long ba) +#else +static void _cput(c, ba) + char c; + long ba; +#endif +{ + *(*(char **) ba)++ = c; +} + +/* VARARGS2 */ +#ifdef PROTOTYPES +EXPORT int +sprintf(char *buf, const char *form, ...) +#else +EXPORT int +sprintf(buf, form, va_alist) + char *buf; + char *form; + va_dcl +#endif +{ + va_list args; + int cnt; + char *bp = buf; + +#ifdef PROTOTYPES + va_start(args, form); +#else + va_start(args); +#endif + cnt = format(_cput, (long)&bp, form, args); + va_end(args); + *bp = '\0'; + + return (cnt); +} diff --git a/scsilib/libschily/stdio/cvmod.c b/scsilib/libschily/stdio/cvmod.c new file mode 100644 index 0000000..2cf3094 --- /dev/null +++ b/scsilib/libschily/stdio/cvmod.c @@ -0,0 +1,63 @@ +/* @(#)cvmod.c 2.9 04/08/08 Copyright 1986, 1995-2003 J. Schilling */ +/* + * Copyright (c) 1986, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +#ifndef O_BINARY +#define O_BINARY 0 +#endif +#ifndef O_LARGEFILE +#define O_LARGEFILE 0 +#endif + +EXPORT int +_cvmod(mode, omode, flag) + const char *mode; + int *omode; + int *flag; +{ + while (*mode) { + switch (*mode) { + + case 'r': *omode |= O_RDONLY; *flag |= FI_READ; break; + case 'w': *omode |= O_WRONLY; *flag |= FI_WRITE; break; + case 'e': *omode |= O_EXCL; break; + case 'c': *omode |= O_CREAT; *flag |= FI_CREATE; break; + case 't': *omode |= O_TRUNC; *flag |= FI_TRUNC; break; + case 'a': *omode |= O_APPEND; *flag |= FI_APPEND; break; + case 'u': *flag |= FI_UNBUF; break; + /* dummy on UNIX */ + case 'b': *omode |= O_BINARY; *flag |= FI_BINARY; break; + /* + * XXX do we need this ? + * XXX May this be a problem? + */ + case 'l': *omode |= O_LARGEFILE; break; + default: raisecond(_badmode, 0L); + return (0); + } + mode++; + } + if (*flag & FI_READ && *flag & FI_WRITE) { + *omode &= ~(O_RDONLY|O_WRONLY); + *omode |= O_RDWR; + } + return (1); +} diff --git a/scsilib/libschily/stdio/dat.c b/scsilib/libschily/stdio/dat.c new file mode 100644 index 0000000..18b401d --- /dev/null +++ b/scsilib/libschily/stdio/dat.c @@ -0,0 +1,23 @@ +/* @(#)dat.c 1.3 03/06/15 Copyright 1986, 1996-2003 J. Schilling */ +/* + * Copyright (c) 1986, 1996-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +char _badfile[] = "bad_file"; +char _badmode[] = "bad_file_mode"; +char _badop[] = "bad_file_op"; diff --git a/scsilib/libschily/stdio/fcons.c b/scsilib/libschily/stdio/fcons.c new file mode 100644 index 0000000..7056b7d --- /dev/null +++ b/scsilib/libschily/stdio/fcons.c @@ -0,0 +1,83 @@ +/* @(#)fcons.c 2.17 04/08/08 Copyright 1986, 1995-2003 J. Schilling */ +/* + * Copyright (c) 1986, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +/* + * Note that because of a definition in schilyio.h we are using fseeko()/ftello() + * instead of fseek()/ftell() if available. + */ + +LOCAL char *fmtab[] = { + "", /* 0 FI_NONE */ + "r", /* 1 FI_READ */ + "w", /* 2 FI_WRITE **1) */ + "r+", /* 3 FI_READ | FI_WRITE */ + "b", /* 4 FI_NONE | FI_BINARY */ + "rb", /* 5 FI_READ | FI_BINARY */ + "wb", /* 6 FI_WRITE | FI_BINARY **1) */ + "r+b", /* 7 FI_READ | FI_WRITE | FI_BINARY */ + +/* + FI_APPEND */ "", /* 0 FI_NONE */ +/* ... */ "r", /* 1 FI_READ */ + "a", /* 2 FI_WRITE **1) */ + "a+", /* 3 FI_READ | FI_WRITE */ + "b", /* 4 FI_NONE | FI_BINARY */ + "rb", /* 5 FI_READ | FI_BINARY */ + "ab", /* 6 FI_WRITE | FI_BINARY **1) */ + "a+b", /* 7 FI_READ | FI_WRITE | FI_BINARY */ + }; +/* + * NOTES: + * 1) fdopen() guarantees not to create/trunc files in this case + * + * "w" will create/trunc files with fopen() + * "a" will create files with fopen() + */ + + +EXPORT FILE * +_fcons(fd, f, flag) + register FILE *fd; + int f; + int flag; +{ + int my_gflag = _io_glflag; + + if (fd == (FILE *)NULL) + fd = fdopen(f, + fmtab[flag&(FI_READ|FI_WRITE|FI_BINARY | FI_APPEND)]); + + if (fd != (FILE *)NULL) { + if (flag & FI_APPEND) { + (void) fseek(fd, (off_t)0, SEEK_END); + } + if (flag & FI_UNBUF) { + setbuf(fd, NULL); + my_gflag |= _IOUNBUF; + } + set_my_flag(fd, my_gflag); /* must clear it if fd is reused */ + return (fd); + } + if (flag & FI_CLOSE) + close(f); + + return ((FILE *) NULL); +} diff --git a/scsilib/libschily/stdio/fcons64.c b/scsilib/libschily/stdio/fcons64.c new file mode 100644 index 0000000..6da4ad5 --- /dev/null +++ b/scsilib/libschily/stdio/fcons64.c @@ -0,0 +1,30 @@ +/* @(#)fcons64.c 1.6 04/08/08 Copyright 2000 J. Schilling */ +/* + * Copyright (c) 2000 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#define USE_LARGEFILES + +#include "schilyio.h" + +/*#if _LFS_LARGEFILE*/ +#ifdef HAVE_LARGEFILES + +#include "fcons.c" + +#endif diff --git a/scsilib/libschily/stdio/fdown.c b/scsilib/libschily/stdio/fdown.c new file mode 100644 index 0000000..df7932b --- /dev/null +++ b/scsilib/libschily/stdio/fdown.c @@ -0,0 +1,29 @@ +/* @(#)fdown.c 1.10 04/08/08 Copyright 1986, 1995-2003 J. Schilling */ +/* + * Copyright (c) 1986, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +EXPORT int +fdown(f) + register FILE *f; +{ + down(f); + return (fileno(f)); +} diff --git a/scsilib/libschily/stdio/fdup.c b/scsilib/libschily/stdio/fdup.c new file mode 100644 index 0000000..1858ce5 --- /dev/null +++ b/scsilib/libschily/stdio/fdup.c @@ -0,0 +1,40 @@ +/* @(#)fdup.c 1.14 04/08/08 Copyright 1986, 1995-2003 J. Schilling */ +/* + * Copyright (c) 1986, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +/* + * Note that because of a definition in schilyio.h we are using fseeko()/ftello() + * instead of fseek()/ftell() if available. + */ + +EXPORT FILE * +fdup(f) + register FILE *f; +{ + int newfd; + + down(f); + if ((newfd = dup(fileno(f))) < 0) + return ((FILE *) NULL); + + lseek(newfd, ftell(f), SEEK_SET); + return (_fcons((FILE *)0, newfd, (FI_READ | FI_WRITE | FI_CLOSE))); +} diff --git a/scsilib/libschily/stdio/fdup64.c b/scsilib/libschily/stdio/fdup64.c new file mode 100644 index 0000000..ed5662a --- /dev/null +++ b/scsilib/libschily/stdio/fdup64.c @@ -0,0 +1,30 @@ +/* @(#)fdup64.c 1.6 04/08/08 Copyright 2000 J. Schilling */ +/* + * Copyright (c) 2000 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#define USE_LARGEFILES + +#include "schilyio.h" + +/*#if _LFS_LARGEFILE*/ +#ifdef HAVE_LARGEFILES + +#include "fdup.c" + +#endif diff --git a/scsilib/libschily/stdio/ffileread.c b/scsilib/libschily/stdio/ffileread.c new file mode 100644 index 0000000..1979ecd --- /dev/null +++ b/scsilib/libschily/stdio/ffileread.c @@ -0,0 +1,39 @@ +/* @(#)ffileread.c 1.9 04/08/08 Copyright 1986, 1996-2003 J. Schilling */ +/* + * Copyright (c) 1986, 1996-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" +#include <errno.h> + +EXPORT int +ffileread(f, buf, len) + register FILE *f; + void *buf; + int len; +{ + register int fd; + register int ret; + + down2(f, _IOREAD, _IORW); + fd = fileno(f); + + while ((ret = read(fd, buf, len)) < 0 && geterrno() == EINTR) + ; + return (ret); +} diff --git a/scsilib/libschily/stdio/ffilewrite.c b/scsilib/libschily/stdio/ffilewrite.c new file mode 100644 index 0000000..c95d921 --- /dev/null +++ b/scsilib/libschily/stdio/ffilewrite.c @@ -0,0 +1,32 @@ +/* @(#)ffilewrite.c 1.6 04/08/08 Copyright 1986 J. Schilling */ +/* + * Copyright (c) 1986 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +EXPORT int +ffilewrite(f, buf, len) + register FILE *f; + void *buf; + int len; +{ + down2(f, _IORWT, _IORW); + + return (write(fileno(f), (char *)buf, len)); +} diff --git a/scsilib/libschily/stdio/fgetline.c b/scsilib/libschily/stdio/fgetline.c new file mode 100644 index 0000000..bcf6f2c --- /dev/null +++ b/scsilib/libschily/stdio/fgetline.c @@ -0,0 +1,72 @@ +/* @(#)fgetline.c 1.7 04/08/08 Copyright 1986, 1996-2003 J. Schilling */ +/* + * Copyright (c) 1986, 1996-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +/* + * XXX should we check if HAVE_USG_STDIO is defined and + * XXX use something line memccpy to speed things up ??? + */ + +EXPORT int +fgetline(f, buf, len) + register FILE *f; + char *buf; + register int len; +{ + register int c = '\0'; + register char *bp = buf; + register int nl = '\n'; + + down2(f, _IOREAD, _IORW); + + for (;;) { + if ((c = getc(f)) < 0) + break; + if (c == nl) + break; + if (--len > 0) { + *bp++ = c; + } else { + /* + * Read up to end of line + */ + while ((c = getc(f)) >= 0 && c != nl) + ; + break; + } + } + *bp = '\0'; + /* + * If buffer is empty and we hit EOF, return EOF + */ + if (c < 0 && bp == buf) + return (c); + + return (bp - buf); +} + +EXPORT int +getline(buf, len) + char *buf; + int len; +{ + return (fgetline(stdin, buf, len)); +} diff --git a/scsilib/libschily/stdio/fgetstr.c b/scsilib/libschily/stdio/fgetstr.c new file mode 100644 index 0000000..962e567 --- /dev/null +++ b/scsilib/libschily/stdio/fgetstr.c @@ -0,0 +1,64 @@ +/* @(#)fgetstr.c 1.8 04/08/08 Copyright 1986, 1996-2003 J. Schilling */ +/* + * Copyright (c) 1986, 1996-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +/* + * XXX should we check if HAVE_USG_STDIO is defined and + * XXX use something line memccpy to speed things up ??? + */ + +EXPORT int +fgetstr(f, buf, len) + register FILE *f; + char *buf; + register int len; +{ + register int c = '\0'; + register char *bp = buf; + register int nl = '\n'; + + down2(f, _IOREAD, _IORW); + + for (;;) { + if ((c = getc(f)) < 0) + break; + if (--len > 0) + *bp++ = c; + if (c == nl) + break; + } + *bp = '\0'; + /* + * If buffer is empty and we hit EOF, return EOF + */ + if (c < 0 && bp == buf) + return (c); + + return (bp - buf); +} + +EXPORT int +getstr(buf, len) + char *buf; + int len; +{ + return (fgetstr(stdin, buf, len)); +} diff --git a/scsilib/libschily/stdio/file_raise.c b/scsilib/libschily/stdio/file_raise.c new file mode 100644 index 0000000..3bedf94 --- /dev/null +++ b/scsilib/libschily/stdio/file_raise.c @@ -0,0 +1,48 @@ +/* @(#)file_raise.c 1.8 04/08/08 Copyright 1986, 1995-2003 J. Schilling */ +/* + * Copyright (c) 1986, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +EXPORT void +file_raise(f, flg) + register FILE *f; + int flg; +{ + int oflag; +extern int _io_glflag; + + if (f == (FILE *)NULL) { + if (flg) + _io_glflag &= ~_IONORAISE; + else + _io_glflag |= _IONORAISE; + return; + } + down(f); + + oflag = my_flag(f); + + if (flg) + oflag &= ~_IONORAISE; + else + oflag |= _IONORAISE; + + set_my_flag(f, oflag); +} diff --git a/scsilib/libschily/stdio/fileclose.c b/scsilib/libschily/stdio/fileclose.c new file mode 100644 index 0000000..d9b5f81 --- /dev/null +++ b/scsilib/libschily/stdio/fileclose.c @@ -0,0 +1,29 @@ +/* @(#)fileclose.c 1.7 04/08/08 Copyright 1986 J. Schilling */ +/* + * Copyright (c) 1988 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +EXPORT int +fileclose(f) + FILE *f; +{ + down(f); + return (fclose(f)); +} diff --git a/scsilib/libschily/stdio/fileluopen.c b/scsilib/libschily/stdio/fileluopen.c new file mode 100644 index 0000000..c0266e5 --- /dev/null +++ b/scsilib/libschily/stdio/fileluopen.c @@ -0,0 +1,73 @@ +/* @(#)fileluopen.c 1.17 04/08/08 Copyright 1986, 1995-2003 J. Schilling */ +/* + * Copyright (c) 1986, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +/* + * Note that because of a definition in schilyio.h we are using fseeko()/ftello() + * instead of fseek()/ftell() if available. + */ + +#ifndef O_NDELAY /* This is undefined on BeOS :-( */ +#define O_NDELAY 0 +#endif +#ifndef O_CREAT +#define O_CREAT 0 +#endif +#ifndef O_TRUNC +#define O_TRUNC 0 +#endif +#ifndef O_EXCL +#define O_EXCL 0 +#endif + +/* + * fileluopen - open a stream for lun + */ +EXPORT FILE * +fileluopen(f, mode) + int f; + const char *mode; +{ + int omode = 0; + int flag = 0; + + if (!_cvmod(mode, &omode, &flag)) + return ((FILE *) NULL); + + if (omode & (O_NDELAY|O_CREAT|O_TRUNC|O_EXCL)) { + raisecond(_badmode, 0L); + return ((FILE *) NULL); + } + +#ifdef F_GETFD + if (fcntl(f, F_GETFD, 0) < 0) { + raisecond(_badfile, 0L); + return ((FILE *) NULL); + } +#endif + +#ifdef O_APPEND + if (omode & O_APPEND) + lseek(f, (off_t)0, SEEK_END); +#endif + + return (_fcons((FILE *)0, f, flag)); +} diff --git a/scsilib/libschily/stdio/fileluopen64.c b/scsilib/libschily/stdio/fileluopen64.c new file mode 100644 index 0000000..350cfd2 --- /dev/null +++ b/scsilib/libschily/stdio/fileluopen64.c @@ -0,0 +1,30 @@ +/* @(#)fileluopen64.c 1.6 04/08/08 Copyright 2000 J. Schilling */ +/* + * Copyright (c) 2000 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#define USE_LARGEFILES + +#include "schilyio.h" + +/*#if _LFS_LARGEFILE*/ +#ifdef HAVE_LARGEFILES + +#include "fileluopen.c" + +#endif diff --git a/scsilib/libschily/stdio/filemopen.c b/scsilib/libschily/stdio/filemopen.c new file mode 100644 index 0000000..1f9706b --- /dev/null +++ b/scsilib/libschily/stdio/filemopen.c @@ -0,0 +1,45 @@ +/* @(#)filemopen.c 1.3 04/08/08 Copyright 1986, 1995-2004 J. Schilling */ +/* + * Copyright (c) 1986, 1995-2004 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +EXPORT FILE * +#ifdef PROTOTYPES +filemopen(const char *name, const char *mode, mode_t cmode) +#else +filemopen(name, mode, cmode) + const char *name; + const char *mode; + mode_t cmode; +#endif +{ + int ret; + int omode = 0; + int flag = 0; + + if (!_cvmod(mode, &omode, &flag)) + return ((FILE *) NULL); + +/* if ((ret = _openfd(name, omode)) < 0)*/ + if ((ret = open(name, omode, cmode)) < 0) + return ((FILE *) NULL); + + return (_fcons((FILE *)0, ret, flag)); +} diff --git a/scsilib/libschily/stdio/filemopen64.c b/scsilib/libschily/stdio/filemopen64.c new file mode 100644 index 0000000..0237587 --- /dev/null +++ b/scsilib/libschily/stdio/filemopen64.c @@ -0,0 +1,30 @@ +/* @(#)filemopen64.c 1.2 04/08/08 Copyright 2000-2004 J. Schilling */ +/* + * Copyright (c) 2000-2004 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#define USE_LARGEFILES + +#include "schilyio.h" + +/*#if _LFS_LARGEFILE*/ +#ifdef HAVE_LARGEFILES + +#include "filemopen.c" + +#endif diff --git a/scsilib/libschily/stdio/fileopen.c b/scsilib/libschily/stdio/fileopen.c new file mode 100644 index 0000000..97c4b08 --- /dev/null +++ b/scsilib/libschily/stdio/fileopen.c @@ -0,0 +1,39 @@ +/* @(#)fileopen.c 1.10 04/08/08 Copyright 1986, 1995-2003 J. Schilling */ +/* + * Copyright (c) 1986, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +EXPORT FILE * +fileopen(name, mode) + const char *name; + const char *mode; +{ + int ret; + int omode = 0; + int flag = 0; + + if (!_cvmod(mode, &omode, &flag)) + return ((FILE *) NULL); + + if ((ret = _openfd(name, omode)) < 0) + return ((FILE *) NULL); + + return (_fcons((FILE *)0, ret, flag)); +} diff --git a/scsilib/libschily/stdio/fileopen64.c b/scsilib/libschily/stdio/fileopen64.c new file mode 100644 index 0000000..ce838f3 --- /dev/null +++ b/scsilib/libschily/stdio/fileopen64.c @@ -0,0 +1,30 @@ +/* @(#)fileopen64.c 1.6 04/08/08 Copyright 2000 J. Schilling */ +/* + * Copyright (c) 2000 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#define USE_LARGEFILES + +#include "schilyio.h" + +/*#if _LFS_LARGEFILE*/ +#ifdef HAVE_LARGEFILES + +#include "fileopen.c" + +#endif diff --git a/scsilib/libschily/stdio/filepos.c b/scsilib/libschily/stdio/filepos.c new file mode 100644 index 0000000..d82ce9c --- /dev/null +++ b/scsilib/libschily/stdio/filepos.c @@ -0,0 +1,34 @@ +/* @(#)filepos.c 1.10 04/08/08 Copyright 1986, 1996-2003 J. Schilling */ +/* + * Copyright (c) 1986, 1996-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +/* + * Note that because of a definition in schilyio.h we are using fseeko()/ftello() + * instead of fseek()/ftell() if available. + */ + +EXPORT off_t +filepos(f) + register FILE *f; +{ + down(f); + return (ftell(f)); +} diff --git a/scsilib/libschily/stdio/filepos64.c b/scsilib/libschily/stdio/filepos64.c new file mode 100644 index 0000000..a7a3063 --- /dev/null +++ b/scsilib/libschily/stdio/filepos64.c @@ -0,0 +1,30 @@ +/* @(#)filepos64.c 1.6 04/08/08 Copyright 2000 J. Schilling */ +/* + * Copyright (c) 2000 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#define USE_LARGEFILES + +#include "schilyio.h" + +/*#if _LFS_LARGEFILE*/ +#ifdef HAVE_LARGEFILES + +#include "filepos.c" + +#endif diff --git a/scsilib/libschily/stdio/fileread.c b/scsilib/libschily/stdio/fileread.c new file mode 100644 index 0000000..9b5bd98 --- /dev/null +++ b/scsilib/libschily/stdio/fileread.c @@ -0,0 +1,94 @@ +/* @(#)fileread.c 1.14 04/08/08 Copyright 1986, 1995-2003 J. Schilling */ +/* + * Copyright (c) 1986, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +static char _readerr[] = "file_read_err"; + +#ifdef HAVE_USG_STDIO + +EXPORT int +fileread(f, buf, len) + register FILE *f; + void *buf; + int len; +{ + int cnt; + register int n; + + down2(f, _IOREAD, _IORW); + + if (f->_flag & _IONBF) { + cnt = _niread(fileno(f), buf, len); + if (cnt < 0) { + f->_flag |= _IOERR; + if (!(my_flag(f) & _IONORAISE)) + raisecond(_readerr, 0L); + } + if (cnt == 0 && len) + f->_flag |= _IOEOF; + return (cnt); + } + cnt = 0; + while (len > 0) { + if (f->_cnt <= 0) { + if (usg_filbuf(f) == EOF) + break; + f->_cnt++; + f->_ptr--; + } + n = f->_cnt >= len ? len : f->_cnt; + buf = (void *)movebytes(f->_ptr, buf, n); + f->_ptr += n; + f->_cnt -= n; + cnt += n; + len -= n; + } + if (!ferror(f)) + return (cnt); + if (!(my_flag(f) & _IONORAISE)) + raisecond(_readerr, 0L); + return (-1); +} + +#else + +EXPORT int +fileread(f, buf, len) + register FILE *f; + void *buf; + int len; +{ + int cnt; + + down2(f, _IOREAD, _IORW); + + if (my_flag(f) & _IOUNBUF) + return (_niread(fileno(f), buf, len)); + cnt = fread(buf, 1, len, f); + + if (!ferror(f)) + return (cnt); + if (!(my_flag(f) & _IONORAISE)) + raisecond(_readerr, 0L); + return (-1); +} + +#endif /* HAVE_USG_STDIO */ diff --git a/scsilib/libschily/stdio/filereopen.c b/scsilib/libschily/stdio/filereopen.c new file mode 100644 index 0000000..57c354f --- /dev/null +++ b/scsilib/libschily/stdio/filereopen.c @@ -0,0 +1,93 @@ +/* @(#)filereopen.c 1.15 04/08/08 Copyright 1986, 1995 J. Schilling */ +/* + * open new file on old stream + * + * Copyright (c) 1986, 1995 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +/* + * Note that because of a definition in schilyio.h we are using fseeko()/ftello() + * instead of fseek()/ftell() if available. + */ + +LOCAL char *fmtab[] = { + "", /* 0 FI_NONE */ + "r", /* 1 FI_READ */ + "r+", /* 2 FI_WRITE **1) */ + "r+", /* 3 FI_READ | FI_WRITE */ + "b", /* 4 FI_NONE | FI_BINARY */ + "rb", /* 5 FI_READ | FI_BINARY */ + "r+b", /* 6 FI_WRITE | FI_BINARY **1) */ + "r+b", /* 7 FI_READ | FI_WRITE | FI_BINARY */ + +/* + FI_APPEND */ "", /* 0 FI_NONE */ +/* ... */ "r", /* 1 FI_READ */ + "a", /* 2 FI_WRITE **1) */ + "a+", /* 3 FI_READ | FI_WRITE */ + "b", /* 4 FI_NONE | FI_BINARY */ + "rb", /* 5 FI_READ | FI_BINARY */ + "ab", /* 6 FI_WRITE | FI_BINARY **1) */ + "a+b", /* 7 FI_READ | FI_WRITE | FI_BINARY */ + }; +/* + * NOTES: + * 1) there is no fopen() mode that opens for writing + * without creating/truncating at the same time. + * + * "w" will create/trunc files with fopen() + * "a" will create files with fopen() + */ + +EXPORT FILE * +filereopen(name, mode, fp) + const char *name; + const char *mode; + FILE *fp; +{ + int ret; + int omode = 0; + int flag = 0; + + if (!_cvmod(mode, &omode, &flag)) + return ((FILE *) NULL); + + /* + * create/truncate file if necessary + */ + if ((ret = _openfd(name, omode)) < 0) + return ((FILE *) NULL); + close(ret); + + fp = freopen(name, + fmtab[flag & (FI_READ | FI_WRITE | FI_BINARY | FI_APPEND)], fp); + + if (fp != (FILE *) NULL) { + set_my_flag(fp, 0); /* must clear it if fp is reused */ + + if (flag & FI_APPEND) { + (void) fseek(fp, (off_t)0, SEEK_END); + } + if (flag & FI_UNBUF) { + setbuf(fp, NULL); + add_my_flag(fp, _IOUNBUF); + } + } + return (fp); +} diff --git a/scsilib/libschily/stdio/filereopen64.c b/scsilib/libschily/stdio/filereopen64.c new file mode 100644 index 0000000..98bac9c --- /dev/null +++ b/scsilib/libschily/stdio/filereopen64.c @@ -0,0 +1,29 @@ +/* @(#)filereopen64.c 1.7 04/08/08 Copyright 2000-2003 J. Schilling */ +/* + * Copyright (c) 2000-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#define USE_LARGEFILES + +#include "schilyio.h" + +#ifdef HAVE_LARGEFILES + +#include "filereopen.c" + +#endif diff --git a/scsilib/libschily/stdio/fileseek.c b/scsilib/libschily/stdio/fileseek.c new file mode 100644 index 0000000..4a8a4b9 --- /dev/null +++ b/scsilib/libschily/stdio/fileseek.c @@ -0,0 +1,42 @@ +/* @(#)fileseek.c 1.12 04/08/08 Copyright 1986, 1996-2003 J. Schilling */ +/* + * Copyright (c) 1986, 1996-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +/* + * Note that because of a definition in schilyio.h we are using fseeko()/ftello() + * instead of fseek()/ftell() if available. + */ + +static char _seekerr[] = "file_seek_err"; + +EXPORT int +fileseek(f, pos) + register FILE *f; + off_t pos; +{ + int ret; + + down(f); + ret = fseek(f, pos, SEEK_SET); + if (ret < 0 && !(my_flag(f) & _IONORAISE)) + raisecond(_seekerr, 0L); + return (ret); +} diff --git a/scsilib/libschily/stdio/fileseek64.c b/scsilib/libschily/stdio/fileseek64.c new file mode 100644 index 0000000..34128b1 --- /dev/null +++ b/scsilib/libschily/stdio/fileseek64.c @@ -0,0 +1,30 @@ +/* @(#)fileseek64.c 1.6 04/08/08 Copyright 2000 J. Schilling */ +/* + * Copyright (c) 2000 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#define USE_LARGEFILES + +#include "schilyio.h" + +/*#if _LFS_LARGEFILE*/ +#ifdef HAVE_LARGEFILES + +#include "fileseek.c" + +#endif diff --git a/scsilib/libschily/stdio/filesize.c b/scsilib/libschily/stdio/filesize.c new file mode 100644 index 0000000..22eb423 --- /dev/null +++ b/scsilib/libschily/stdio/filesize.c @@ -0,0 +1,36 @@ +/* @(#)filesize.c 1.13 04/08/08 Copyright 1986, 1995-2003 J. Schilling */ +/* + * Copyright (c) 1986, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" +#include <statdefs.h> + +EXPORT off_t +filesize(f) + register FILE *f; +{ + struct stat buf; + + down(f); + if (fstat(fileno(f), &buf) < 0) { + raisecond("filesize", 0L); + return (-1); + } + return (buf.st_size); +} diff --git a/scsilib/libschily/stdio/filesize64.c b/scsilib/libschily/stdio/filesize64.c new file mode 100644 index 0000000..6e1a0bd --- /dev/null +++ b/scsilib/libschily/stdio/filesize64.c @@ -0,0 +1,30 @@ +/* @(#)filesize64.c 1.6 04/08/08 Copyright 2000 J. Schilling */ +/* + * Copyright (c) 2000 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#define USE_LARGEFILES + +#include "schilyio.h" + +/*#if _LFS_LARGEFILE*/ +#ifdef HAVE_LARGEFILES + +#include "filesize.c" + +#endif diff --git a/scsilib/libschily/stdio/filestat.c b/scsilib/libschily/stdio/filestat.c new file mode 100644 index 0000000..7bc6790 --- /dev/null +++ b/scsilib/libschily/stdio/filestat.c @@ -0,0 +1,31 @@ +/* @(#)filestat.c 1.9 04/08/08 Copyright 1985 J. Schilling */ +/* + * Copyright (c) 1985 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" +#include <statdefs.h> + +EXPORT int +filestat(f, stbuf) + FILE *f; + struct stat *stbuf; +{ + down(f); + return (fstat(fileno(f), stbuf)); +} diff --git a/scsilib/libschily/stdio/filestat64.c b/scsilib/libschily/stdio/filestat64.c new file mode 100644 index 0000000..ae99651 --- /dev/null +++ b/scsilib/libschily/stdio/filestat64.c @@ -0,0 +1,30 @@ +/* @(#)filestat64.c 1.6 04/08/08 Copyright 2000 J. Schilling */ +/* + * Copyright (c) 2000 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#define USE_LARGEFILES + +#include "schilyio.h" + +/*#if _LFS_LARGEFILE*/ +#ifdef HAVE_LARGEFILES + +#include "filestat.c" + +#endif diff --git a/scsilib/libschily/stdio/filewrite.c b/scsilib/libschily/stdio/filewrite.c new file mode 100644 index 0000000..936b192 --- /dev/null +++ b/scsilib/libschily/stdio/filewrite.c @@ -0,0 +1,96 @@ +/* @(#)filewrite.c 1.14 04/08/08 Copyright 1986, 1995-2003 J. Schilling */ +/* + * Copyright (c) 1986, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +static char _writeerr[] = "file_write_err"; + +#ifdef HAVE_USG_STDIO + +EXPORT int +filewrite(f, vbuf, len) + register FILE *f; + void *vbuf; + int len; +{ + register int n; + int cnt; + char *buf = vbuf; + + down2(f, _IOWRT, _IORW); + + if (f->_flag & _IONBF) { + cnt = write(fileno(f), buf, len); + if (cnt < 0) { + f->_flag |= _IOERR; + if (!(my_flag(f) & _IONORAISE)) + raisecond(_writeerr, 0L); + } + return (cnt); + } + cnt = 0; + while (len > 0) { + if (f->_cnt <= 0) { + if (usg_flsbuf((unsigned char) *buf++, f) == EOF) + break; + cnt++; + if (--len == 0) + break; + } + if ((n = f->_cnt >= len ? len : f->_cnt) > 0) { + f->_ptr = (unsigned char *)movebytes(buf, f->_ptr, n); + buf += n; + f->_cnt -= n; + cnt += n; + len -= n; + } + } + if (!ferror(f)) + return (cnt); + if (!(my_flag(f) & _IONORAISE)) + raisecond(_writeerr, 0L); + return (-1); +} + +#else + +EXPORT int +filewrite(f, vbuf, len) + register FILE *f; + void *vbuf; + int len; +{ + int cnt; + char *buf = vbuf; + + down2(f, _IOWRT, _IORW); + + if (my_flag(f) & _IOUNBUF) + return (write(fileno(f), buf, len)); + cnt = fwrite(buf, 1, len, f); + + if (!ferror(f)) + return (cnt); + if (!(my_flag(f) & _IONORAISE)) + raisecond(_writeerr, 0L); + return (-1); +} + +#endif /* HAVE_USG_STDIO */ diff --git a/scsilib/libschily/stdio/flag.c b/scsilib/libschily/stdio/flag.c new file mode 100644 index 0000000..16c4b09 --- /dev/null +++ b/scsilib/libschily/stdio/flag.c @@ -0,0 +1,131 @@ +/* @(#)flag.c 2.9 04/08/08 Copyright 1986-2003 J. Schilling */ +/* + * Copyright (c) 1986-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" +#include <stdxlib.h> + +#ifdef DO_MYFLAG + +#define FL_INIT 10 + +int _io_glflag; /* global default flag */ +int _fl_inc = 10; /* increment for expanding flag struct */ +int _fl_max = FL_INIT; /* max fd currently in _io_myfl */ +_io_fl _io_smyfl[FL_INIT]; /* initial static space */ +_io_fl *_io_myfl = _io_smyfl; /* init to static space */ + +LOCAL int _more_flags __PR((FILE *)); + +LOCAL int +_more_flags(fp) + FILE *fp; +{ + register int f = fileno(fp); + register int n = _fl_max; + register _io_fl *np; + + while (n <= f) + n += _fl_inc; + + if (_io_myfl == _io_smyfl) { + np = (_io_fl *) malloc(n * sizeof (*np)); + fillbytes(np, n * sizeof (*np), '\0'); + movebytes(_io_smyfl, np, sizeof (_io_smyfl)/sizeof (*np)); + } else { + np = (_io_fl *) realloc(_io_myfl, n * sizeof (*np)); + if (np) + fillbytes(&np[_fl_max], (n-_fl_max)*sizeof (*np), '\0'); + } + if (np) { + _io_myfl = np; + _fl_max = n; + return (_io_get_my_flag(fp)); + } else { + return (_IONORAISE); + } +} + +EXPORT int +_io_get_my_flag(fp) + register FILE *fp; +{ + register int f = fileno(fp); + register _io_fl *fl; + + if (f >= _fl_max) + return (_more_flags(fp)); + + fl = &_io_myfl[f]; + + if (fl->fl_io == 0 || fl->fl_io == fp) + return (fl->fl_flags); + + while (fl && fl->fl_io != fp) + fl = fl->fl_next; + + if (fl == 0) + return (0); + + return (fl->fl_flags); +} + +EXPORT void +_io_set_my_flag(fp, flag) + FILE *fp; + int flag; +{ + register int f = fileno(fp); + register _io_fl *fl; + register _io_fl *fl2; + + if (f >= _fl_max) + (void) _more_flags(fp); + + fl = &_io_myfl[f]; + + if (fl->fl_io != (FILE *)0) { + fl2 = fl; + + while (fl && fl->fl_io != fp) + fl = fl->fl_next; + if (fl == 0) { + if ((fl = (_io_fl *) malloc(sizeof (*fl))) == 0) + return; + fl->fl_next = fl2->fl_next; + fl2->fl_next = fl; + } + } + fl->fl_io = fp; + fl->fl_flags = flag; +} + +EXPORT void +_io_add_my_flag(fp, flag) + FILE *fp; + int flag; +{ + int oflag = _io_get_my_flag(fp); + + oflag |= flag; + + _io_set_my_flag(fp, oflag); +} + +#endif /* DO_MYFLAG */ diff --git a/scsilib/libschily/stdio/flush.c b/scsilib/libschily/stdio/flush.c new file mode 100644 index 0000000..566e15d --- /dev/null +++ b/scsilib/libschily/stdio/flush.c @@ -0,0 +1,27 @@ +/* @(#)flush.c 1.7 04/08/08 Copyright 1986 J. Schilling */ +/* + * Copyright (c) 1986 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +EXPORT int +flush() +{ + return (fflush(stdout)); +} diff --git a/scsilib/libschily/stdio/fpipe.c b/scsilib/libschily/stdio/fpipe.c new file mode 100644 index 0000000..2654e99 --- /dev/null +++ b/scsilib/libschily/stdio/fpipe.c @@ -0,0 +1,42 @@ +/* @(#)fpipe.c 1.12 04/08/08 Copyright 1986, 1995-2003 J. Schilling */ +/* + * Copyright (c) 1986, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +EXPORT int +fpipe(pipef) + FILE *pipef[]; +{ + int filedes[2]; + + if (pipe(filedes) < 0) + return (0); + + if ((pipef[0] = _fcons((FILE *)0, + filedes[0], FI_READ|FI_CLOSE)) != (FILE *)0) { + if ((pipef[1] = _fcons((FILE *)0, + filedes[1], FI_WRITE|FI_CLOSE)) != (FILE *)0) { + return (1); + } + fclose(pipef[0]); + } + close(filedes[1]); + return (0); +} diff --git a/scsilib/libschily/stdio/niread.c b/scsilib/libschily/stdio/niread.c new file mode 100644 index 0000000..f4c038b --- /dev/null +++ b/scsilib/libschily/stdio/niread.c @@ -0,0 +1,43 @@ +/* @(#)niread.c 1.12 04/08/08 Copyright 1986, 1996-2003 J. Schilling */ +/* + * Non interruptable read + * + * Copyright (c) 1986, 1996-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" +#include <errno.h> + +EXPORT int +_niread(f, buf, count) + int f; + void *buf; + int count; +{ + int ret; + int oerrno = geterrno(); + + while ((ret = read(f, buf, count)) < 0 && geterrno() == EINTR) { + /* + * Set back old 'errno' so we don't change the errno visible + * to the outside if we did not fail. + */ + seterrno(oerrno); + } + return (ret); +} diff --git a/scsilib/libschily/stdio/niwrite.c b/scsilib/libschily/stdio/niwrite.c new file mode 100644 index 0000000..1c1de2d --- /dev/null +++ b/scsilib/libschily/stdio/niwrite.c @@ -0,0 +1,43 @@ +/* @(#)niwrite.c 1.5 04/08/08 Copyright 1986, 2001-2003 J. Schilling */ +/* + * Non interruptable write + * + * Copyright (c) 1986, 2001-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" +#include <errno.h> + +EXPORT int +_niwrite(f, buf, count) + int f; + void *buf; + int count; +{ + int ret; + int oerrno = geterrno(); + + while ((ret = write(f, buf, count)) < 0 && geterrno() == EINTR) { + /* + * Set back old 'errno' so we don't change the errno visible + * to the outside if we did not fail. + */ + seterrno(oerrno); + } + return (ret); +} diff --git a/scsilib/libschily/stdio/nixread.c b/scsilib/libschily/stdio/nixread.c new file mode 100644 index 0000000..0c18ecb --- /dev/null +++ b/scsilib/libschily/stdio/nixread.c @@ -0,0 +1,58 @@ +/* @(#)nixread.c 1.12 04/08/08 Copyright 1986, 1996-2003 J. Schilling */ +/* + * Non interruptable extended read + * + * Copyright (c) 1986, 1996-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" +#include <errno.h> + +EXPORT int +_nixread(f, buf, count) + int f; + void *buf; + int count; +{ + register char *p = (char *)buf; + register int ret; + register int total = 0; + int oerrno = geterrno(); + + while (count > 0) { + while ((ret = read(f, p, count)) < 0) { + if (geterrno() == EINTR) { + /* + * Set back old 'errno' so we don't change the + * errno visible to the outside if we did + * not fail. + */ + seterrno(oerrno); + continue; + } + return (ret); /* Any other error */ + } + if (ret == 0) /* Something went wrong */ + break; + + total += ret; + count -= ret; + p += ret; + } + return (total); +} diff --git a/scsilib/libschily/stdio/nixwrite.c b/scsilib/libschily/stdio/nixwrite.c new file mode 100644 index 0000000..ed74a0b --- /dev/null +++ b/scsilib/libschily/stdio/nixwrite.c @@ -0,0 +1,58 @@ +/* @(#)nixwrite.c 1.5 04/08/08 Copyright 1986, 2001-2003 J. Schilling */ +/* + * Non interruptable extended write + * + * Copyright (c) 1986, 2001-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" +#include <errno.h> + +EXPORT int +_nixwrite(f, buf, count) + int f; + void *buf; + int count; +{ + register char *p = (char *)buf; + register int ret; + register int total = 0; + int oerrno = geterrno(); + + while (count > 0) { + while ((ret = write(f, p, count)) < 0) { + if (geterrno() == EINTR) { + /* + * Set back old 'errno' so we don't change the + * errno visible to the outside if we did + * not fail. + */ + seterrno(oerrno); + continue; + } + return (ret); /* Any other error */ + } + if (ret == 0) /* EOF */ + break; + + total += ret; + count -= ret; + p += ret; + } + return (total); +} diff --git a/scsilib/libschily/stdio/openfd.c b/scsilib/libschily/stdio/openfd.c new file mode 100644 index 0000000..98ebac5 --- /dev/null +++ b/scsilib/libschily/stdio/openfd.c @@ -0,0 +1,33 @@ +/* @(#)openfd.c 1.9 04/08/08 Copyright 1986, 1995 J. Schilling */ +/* + * Copyright (c) 1986, 1995 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +#if defined(_openfd) && !defined(USE_LARGEFILES) +# undef _openfd +#endif + +EXPORT int +_openfd(name, omode) + const char *name; + int omode; +{ + return (open(name, omode, 0666)); +} diff --git a/scsilib/libschily/stdio/openfd64.c b/scsilib/libschily/stdio/openfd64.c new file mode 100644 index 0000000..c5fbf05 --- /dev/null +++ b/scsilib/libschily/stdio/openfd64.c @@ -0,0 +1,30 @@ +/* @(#)openfd64.c 1.7 04/08/08 Copyright 2000-2003 J. Schilling */ +/* + * Copyright (c) 2000-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#define USE_LARGEFILES + +#define _OPENFD_SRC +#include "schilyio.h" + +#ifdef HAVE_LARGEFILES + +#include "openfd.c" + +#endif diff --git a/scsilib/libschily/stdio/peekc.c b/scsilib/libschily/stdio/peekc.c new file mode 100644 index 0000000..2a4e374 --- /dev/null +++ b/scsilib/libschily/stdio/peekc.c @@ -0,0 +1,36 @@ +/* @(#)peekc.c 1.7 04/08/08 Copyright 1986, 1996-2003 J. Schilling */ +/* + * Copyright (c) 1986, 1996-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include "schilyio.h" + +EXPORT int +peekc(f) + FILE *f; +{ + int c; + + down2(f, _IOREAD, _IORW); + + if (ferror(f)) + return (EOF); + if ((c = getc(f)) != EOF) + ungetc(c, f); + return (c); +} diff --git a/scsilib/libschily/stdio/schilyio.h b/scsilib/libschily/stdio/schilyio.h new file mode 100644 index 0000000..ce7fa36 --- /dev/null +++ b/scsilib/libschily/stdio/schilyio.h @@ -0,0 +1,237 @@ +/* @(#)schilyio.h 2.22 04/09/04 Copyright 1986, 1995-2003 J. Schilling */ +/* + * Copyright (c) 1986, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#ifndef _STDIO_SCHILYIO_H +#define _STDIO_SCHILYIO_H + +#include <mconfig.h> +#include <stdio.h> +#include <standard.h> +#include <unixstd.h> +#include <fctldefs.h> +#include <schily.h> + +#ifdef NO_USG_STDIO +# ifdef HAVE_USG_STDIO +# undef HAVE_USG_STDIO +# endif +#endif + +/*#if _LFS_LARGEFILE*/ +#ifdef HAVE_LARGEFILES +/* + * XXX We may need to put this code to a more global place to allow all + * XXX users of fseek()/ftell() to automaticaly use fseeko()/ftello() + * XXX if the latter are available. + * + * If HAVE_LARGEFILES is defined, it is guaranteed that fseeko()/ftello() + * both are available. + */ +# define fseek fseeko +# define ftell ftello + +#else /* !HAVE_LARGEFILES */ +/* + * If HAVE_LARGEFILES is not defined, we depend on specific tests for + * fseeko()/ftello() which must have been done before the tests for + * Large File support have been done. + * Note that this only works if the tests used below are really done before + * the Large File autoconf test is run. This is because autoconf does no + * clean testing but instead cumulatively modifes the envivonment used for + * testing. + */ +#ifdef HAVE_FSEEKO +# define fseek fseeko +#endif +#ifdef HAVE_FTELLO +# define ftell ftello +#endif + +#endif + +/* + * speed things up... + */ +#ifndef _OPENFD_SRC +#ifdef _openfd +#undef _openfd +#endif +#define _openfd(name, omode) (open(name, omode, 0666)) +#endif + +#define DO_MYFLAG /* use local flags */ + +/* + * Flags used during fileopen(), ... by _fcons()/ _cvmod() + */ +#define FI_NONE 0x0000 /* no flags defined */ + +#define FI_READ 0x0001 /* open for reading */ +#define FI_WRITE 0x0002 /* open for writing */ +#define FI_BINARY 0x0004 /* open in binary mode */ +#define FI_APPEND 0x0008 /* append on each write */ + +#define FI_CREATE 0x0010 /* create if nessecary */ +#define FI_TRUNC 0x0020 /* truncate file on open */ +#define FI_UNBUF 0x0080 /* dont't buffer io */ +#define FI_CLOSE 0x1000 /* close file on error */ + +/* + * local flags + */ +#define _IONORAISE 01 /* do no raisecond() on errors */ +#define _IOUNBUF 02 /* do unbuffered i/o */ + +#ifdef DO_MYFLAG + +struct _io_flags { + FILE *fl_io; /* file pointer */ + struct _io_flags /* pointer to next struct */ + *fl_next; /* if more file pointer to same fd */ + int fl_flags; /* my flags */ +}; + +typedef struct _io_flags _io_fl; + +extern int _io_glflag; /* global default flag */ +extern _io_fl *_io_myfl; /* array of structs to hold my flags */ +extern int _fl_max; /* max fd currently in _io_myfl */ + +/* + * if fileno > max + * expand + * else if map[fileno].pointer == 0 + * return 0 + * else if map[fileno].pointer == p + * return map[fileno].flags + * else + * search list + */ +#define flp(p) (&_io_myfl[fileno(p)]) + +#ifdef MY_FLAG_IS_MACRO +#define my_flag(p) ((int)fileno(p) >= _fl_max ? \ + _io_get_my_flag(p) : \ + ((flp(p)->fl_io == 0 || flp(p)->fl_io == p) ? \ + flp(p)->fl_flags : \ + _io_get_my_flag(p))) +#else +#define my_flag(p) _io_get_my_flag(p) +#endif + +#define set_my_flag(p, v) _io_set_my_flag(p, v) +#define add_my_flag(p, v) _io_add_my_flag(p, v) + +extern int _io_get_my_flag __PR((FILE *)); +extern void _io_set_my_flag __PR((FILE *, int)); +extern void _io_add_my_flag __PR((FILE *, int)); + +#else /* DO_MYFLAG */ + +#define my_flag(p) _IONORAISE /* Always noraise */ +#define set_my_flag(p, v) /* Ignore */ +#define add_my_flag(p, v) /* Ignore */ + +#endif /* DO_MYFLAG */ + +#ifdef HAVE_USG_STDIO + +/* + * Use the right filbuf()/flsbuf() function. + */ +#ifdef HAVE___FILBUF +# define usg_filbuf(fp) __filbuf(fp) +# define usg_flsbuf(c, fp) __flsbuf(c, fp) +/* + * Define prototypes to verify if our interface is right + */ +extern int __filbuf __PR((FILE *)); +/*extern int __flsbuf __PR(());*/ +#else +# ifdef HAVE__FILBUF +# define usg_filbuf(fp) _filbuf(fp) +# define usg_flsbuf(c, fp) _flsbuf(c, fp) +/* + * Define prototypes to verify if our interface is right + */ +extern int _filbuf __PR((FILE *)); +/*extern int _flsbuf __PR(());*/ +# else +/* + * no filbuf() but this will not happen on USG_STDIO systems. + */ +# endif +#endif +/* + * Do not check this because flsbuf()'s 1st parameter may be + * int SunOS + * unsigned int Apollo + * unsigned char HP-UX-11 + * + * Note that the interface is now checked by autoconf. + */ +/*extern int _flsbuf __PR((int, FILE *));*/ +#else +/* + * If we are on a non USG system we cannot down file pointers + */ +#undef DO_DOWN +#endif + +#ifndef DO_DOWN +/* + * No stream checking + */ +#define down(f) +#define down1(f, fl1) +#define down2(f, fl1, fl2) +#else +/* + * Do stream checking (works only on USG stdio) + * + * New version of USG stdio. + * _iob[] holds only a small amount of pointers. + * Aditional space is allocated. + * We may check only if the file pointer is != NULL + * and if iop->_flag refers to a stream with appropriate modes. + * If _iob[] gets expanded by malloc() we cannot check upper bound. + */ +#define down(f) ((f) == 0 || (f)->_flag == 0 ? \ + (raisecond(_badfile, 0L), (FILE *)0) : (f)) + +#define down1(f, fl1) ((f) == 0 || (f)->_flag == 0 ? \ + (raisecond(_badfile, 0L), (FILE *)0) : \ + (((f)->_flag & fl1) != fl1 ? \ + (raisecond(_badop, 0L), (FILE *)0) : \ + (f))) + +#define down2(f, fl1, fl2) ((f) == 0 || (f)->_flag == 0 ? \ + (raisecond(_badfile, 0L), (FILE *)0) : \ + (((f)->_flag & fl1) != fl1 && \ + ((f)->_flag & fl2) != fl2 ? \ + (raisecond(_badop, 0L), (FILE *)0) : \ + (f))) +#endif /* DO_DOWN */ + +extern char _badfile[]; +extern char _badmode[]; +extern char _badop[]; + +#endif /* _STDIO_SCHILYIO_H */ diff --git a/scsilib/libschily/strcatl.c b/scsilib/libschily/strcatl.c new file mode 100644 index 0000000..8561cb4 --- /dev/null +++ b/scsilib/libschily/strcatl.c @@ -0,0 +1,63 @@ +/* @(#)strcatl.c 1.12 03/10/29 Copyright 1985, 1989, 1995-2003 J. Schilling */ +/* + * list version of strcat() + * + * concatenates all past first parameter until a NULL pointer is reached + * + * WARNING: a NULL constant is not a NULL pointer, so a caller must + * cast a NULL constant to a pointer: (char *)NULL + * + * returns pointer past last character (to '\0' byte) + * + * Copyright (c) 1985, 1989, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <vadefs.h> +#include <standard.h> +#include <schily.h> + +/* VARARGS3 */ +#ifdef PROTOTYPES +EXPORT char * +strcatl(char *to, ...) +#else +EXPORT char * +strcatl(to, va_alist) + char *to; + va_dcl +#endif +{ + va_list args; + register char *p; + register char *tor = to; + +#ifdef PROTOTYPES + va_start(args, to); +#else + va_start(args); +#endif + while ((p = va_arg(args, char *)) != NULL) { + while ((*tor = *p++) != '\0') { + tor++; + } + } + *tor = '\0'; + va_end(args); + return (tor); +} diff --git a/scsilib/libschily/strdup.c b/scsilib/libschily/strdup.c new file mode 100644 index 0000000..0a4b3a8 --- /dev/null +++ b/scsilib/libschily/strdup.c @@ -0,0 +1,55 @@ +/* @(#)strdup.c 1.1 03/02/27 Copyright 2003 J. Schilling */ +#ifndef lint +static char sccsid[] = + "@(#)strdup.c 1.1 03/02/27 Copyright 2003 J. Schilling"; +#endif +/* + * strdup() to be used if missing on libc + * + * Copyright (c) 2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#include <standard.h> +#include <stdxlib.h> +#include <strdefs.h> +#include <schily.h> +#include <libport.h> + +#ifndef HAVE_STRDUP + +EXPORT char * +strdup(s) + const char *s; +{ + unsigned i = strlen(s) + 1; + char *res = malloc(i); + + if (res == NULL) + return (NULL); + if (i > 16) { + movebytes(s, res, (int) i); + } else { + char *s2 = res; + + while ((*s2++ = *s++) != '\0') + ; + } + return (res); +} +#endif /* HAVE_STRDUP */ diff --git a/scsilib/libschily/streql.c b/scsilib/libschily/streql.c new file mode 100644 index 0000000..4017bd5 --- /dev/null +++ b/scsilib/libschily/streql.c @@ -0,0 +1,42 @@ +/* @(#)streql.c 1.7 03/06/15 Copyright 1985, 1995-2003 J. Schilling */ +/* + * Check if two strings are equal + * + * Copyright (c) 1985, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <standard.h> +#include <schily.h> + +EXPORT int +streql(a, b) + const char *a; + const char *b; +{ + register const char *s1 = a; + register const char *s2 = b; + + if (s1 == NULL || s2 == NULL) + return (FALSE); + + while (*s1 == *s2++) + if (*s1++ == '\0') + return (TRUE); + + return (FALSE); +} diff --git a/scsilib/libschily/strtod.c b/scsilib/libschily/strtod.c new file mode 100644 index 0000000..078c2d3 --- /dev/null +++ b/scsilib/libschily/strtod.c @@ -0,0 +1,2535 @@ +/* $NetBSD: strtod.c,v 1.23 1996/10/13 00:07:55 christos Exp $ */ + +/**************************************************************** + * + * The author of this software is David M. Gay. + * + * Copyright (c) 1991 by AT&T. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose without fee is hereby granted, provided that this entire notice + * is included in all copies of any software which is or includes a copy + * or modification of this software and in all copies of the supporting + * documentation for such software. + * + * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR AT&T MAKES ANY + * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY + * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. + * + ***************************************************************/ + +/* Please send bug reports to + David M. Gay + AT&T Bell Laboratories, Room 2C-463 + 600 Mountain Avenue + Murray Hill, NJ 07974-2070 + U.S.A. + dmg@research.att.com or research!dmg + */ + +/* strtod for IEEE-, VAX-, and IBM-arithmetic machines. + * + * This strtod returns a nearest machine number to the input decimal + * string (or sets errno to ERANGE). With IEEE arithmetic, ties are + * broken by the IEEE round-even rule. Otherwise ties are broken by + * biased rounding (add half and chop). + * + * Inspired loosely by William D. Clinger's paper "How to Read Floating + * Point Numbers Accurately" [Proc. ACM SIGPLAN '90, pp. 92-101]. + * + * Modifications: + * + * 1. We only require IEEE, IBM, or VAX double-precision + * arithmetic (not IEEE double-extended). + * 2. We get by with floating-point arithmetic in a case that + * Clinger missed -- when we're computing d * 10^n + * for a small integer d and the integer n is not too + * much larger than 22 (the maximum integer k for which + * we can represent 10^k exactly), we may be able to + * compute (d*10^k) * 10^(e-k) with just one roundoff. + * 3. Rather than a bit-at-a-time adjustment of the binary + * result in the hard case, we use floating-point + * arithmetic to determine the adjustment to within + * one bit; only in really hard cases do we need to + * compute a second residual. + * 4. Because of 3., we don't need a large table of powers of 10 + * for ten-to-e (just some small tables, e.g. of 10^k + * for 0 <= k <= 22). + */ + +/* + * #define IEEE_LITTLE_ENDIAN for IEEE-arithmetic machines where the least + * significant byte has the lowest address. + * #define IEEE_BIG_ENDIAN for IEEE-arithmetic machines where the most + * significant byte has the lowest address. + * #define Long int on machines with 32-bit ints and 64-bit longs. + * #define Sudden_Underflow for IEEE-format machines without gradual + * underflow (i.e., that flush to zero on underflow). + * #define IBM for IBM mainframe-style floating-point arithmetic. + * #define VAX for VAX-style floating-point arithmetic. + * #define Unsigned_Shifts if >> does treats its left operand as unsigned. + * #define No_leftright to omit left-right logic in fast floating-point + * computation of dtoa. + * #define Check_FLT_ROUNDS if FLT_ROUNDS can assume the values 2 or 3. + * #define RND_PRODQUOT to use rnd_prod and rnd_quot (assembly routines + * that use extended-precision instructions to compute rounded + * products and quotients) with IBM. + * #define ROUND_BIASED for IEEE-format with biased rounding. + * #define Inaccurate_Divide for IEEE-format with correctly rounded + * products but inaccurate quotients, e.g., for Intel i860. + * #define Just_16 to store 16 bits per 32-bit Long when doing high-precision + * integer arithmetic. Whether this speeds things up or slows things + * down depends on the machine and the number being converted. + * #define KR_headers for old-style C function headers. + * #define Bad_float_h if your system lacks a float.h or if it does not + * define some or all of DBL_DIG, DBL_MAX_10_EXP, DBL_MAX_EXP, + * FLT_RADIX, FLT_ROUNDS, and DBL_MAX. + * #define MALLOC your_malloc, where your_malloc(n) acts like malloc(n) + * if memory is available and otherwise does something you deem + * appropriate. If MALLOC is undefined, malloc will be invoked + * directly -- and assumed always to succeed. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char *rcsid = "$NetBSD: strtod.c,v 1.23 1996/10/13 00:07:55 christos Exp $"; +#endif /* LIBC_SCCS and not lint */ + +#include <mconfig.h> +#include <btorder.h> + +#ifdef __OLD_NETBSD_DEFINES__ + +#if defined(__m68k__) || defined(__sparc__) || defined(__i386__) || \ + defined(__mips__) || defined(__ns32k__) || defined(__alpha__) || \ + defined(__powerpc__) +#include <sys/types.h> +#if BYTE_ORDER == BIG_ENDIAN +#define IEEE_BIG_ENDIAN +#else +#define IEEE_LITTLE_ENDIAN +#endif +#endif + +#else /* __OLD_NETBSD_DEFINES__ */ + +#if !defined(__arm32__) && !defined(vax) && !defined(IBM) + +/*#ifdef _BIG_ENDIAN*/ +#ifdef WORDS_BIGENDIAN +#define IEEE_BIG_ENDIAN +#else +#define IEEE_LITTLE_ENDIAN +#endif + +#endif /* !defined(__arm32__) && !defined(vax) && !defined(IBM) */ + +#endif /* __OLD_NETBSD_DEFINES__ */ + +#ifdef __arm32__ +/* + * Although the CPU is little endian the FP has different + * byte and word endianness. The byte order is still little endian + * but the word order is big endian. + */ +#define IEEE_BIG_ENDIAN +#endif + +#ifdef vax +#define VAX +#endif + +#include <utypes.h> +#define Long Int32_t +#define ULong UInt32_t + +#ifdef DEBUG +#include "stdio.h" +#define Bug(x) {fprintf(stderr, "%s\n", x); exit(1);} +#endif + +#ifdef __cplusplus +#include "malloc.h" +#include "memory.h" +#else +#ifndef KR_headers +#include "stdlib.h" +#include "string.h" +#include "locale.h" +#else +#include "malloc.h" +#include "memory.h" +#endif +#endif + +#ifdef MALLOC +#ifdef KR_headers +extern char *MALLOC(); +#else +extern void *MALLOC(size_t); +#endif +#else +#define MALLOC malloc +#endif + +#include "ctype.h" +#include "errno.h" +#ifndef HAVE_ERRNO_DEF +extern int errno; +#endif + +#ifdef Bad_float_h +#undef __STDC__ +#ifdef IEEE_BIG_ENDIAN +#define IEEE_ARITHMETIC +#endif +#ifdef IEEE_LITTLE_ENDIAN +#define IEEE_ARITHMETIC +#endif + +#ifdef IEEE_ARITHMETIC +#define DBL_DIG 15 +#define DBL_MAX_10_EXP 308 +#define DBL_MAX_EXP 1024 +#define FLT_RADIX 2 +#define FLT_ROUNDS 1 +#define DBL_MAX 1.7976931348623157e+308 +#endif + +#ifdef IBM +#define DBL_DIG 16 +#define DBL_MAX_10_EXP 75 +#define DBL_MAX_EXP 63 +#define FLT_RADIX 16 +#define FLT_ROUNDS 0 +#define DBL_MAX 7.2370055773322621e+75 +#endif + +#ifdef VAX +#define DBL_DIG 16 +#define DBL_MAX_10_EXP 38 +#define DBL_MAX_EXP 127 +#define FLT_RADIX 2 +#define FLT_ROUNDS 1 +#define DBL_MAX 1.7014118346046923e+38 +#endif + +#ifndef LONG_MAX +#define LONG_MAX 2147483647 +#endif +#else +#include "float.h" +#endif +#ifndef __MATH_H__ +#include "math.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef CONST +#ifdef KR_headers +#define CONST /* blank */ +#else +#define CONST const +#endif +#endif + +#ifdef Unsigned_Shifts +#define Sign_Extend(a,b) if (b < 0) a |= 0xffff0000; +#else +#define Sign_Extend(a,b) /*no-op*/ +#endif + +#if defined(IEEE_LITTLE_ENDIAN) + defined(IEEE_BIG_ENDIAN) + defined(VAX) + \ + defined(IBM) != 1 +Exactly one of IEEE_LITTLE_ENDIAN IEEE_BIG_ENDIAN, VAX, or +IBM should be defined. +#endif + +#ifdef IEEE_LITTLE_ENDIAN +#define word0(x) ((ULong *)&x)[1] +#define word1(x) ((ULong *)&x)[0] +#else +#define word0(x) ((ULong *)&x)[0] +#define word1(x) ((ULong *)&x)[1] +#endif + +/* The following definition of Storeinc is appropriate for MIPS processors. + * An alternative that might be better on some machines is + * #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff) + */ +#if defined(IEEE_LITTLE_ENDIAN) + defined(VAX) + defined(__arm32__) +#define Storeinc(a,b,c) (((unsigned short *)a)[1] = (unsigned short)b, \ +((unsigned short *)a)[0] = (unsigned short)c, a++) +#else +#define Storeinc(a,b,c) (((unsigned short *)a)[0] = (unsigned short)b, \ +((unsigned short *)a)[1] = (unsigned short)c, a++) +#endif + +/* #define P DBL_MANT_DIG */ +/* Ten_pmax = floor(P*log(2)/log(5)) */ +/* Bletch = (highest power of 2 < DBL_MAX_10_EXP) / 16 */ +/* Quick_max = floor((P-1)*log(FLT_RADIX)/log(10) - 1) */ +/* Int_max = floor(P*log(FLT_RADIX)/log(10) - 1) */ + +#if defined(IEEE_LITTLE_ENDIAN) + defined(IEEE_BIG_ENDIAN) +#define Exp_shift 20 +#define Exp_shift1 20 +#define Exp_msk1 0x100000 +#define Exp_msk11 0x100000 +#define Exp_mask 0x7ff00000 +#define P 53 +#define Bias 1023 +#define IEEE_Arith +#define Emin (-1022) +#define Exp_1 0x3ff00000 +#define Exp_11 0x3ff00000 +#define Ebits 11 +#define Frac_mask 0xfffff +#define Frac_mask1 0xfffff +#define Ten_pmax 22 +#define Bletch 0x10 +#define Bndry_mask 0xfffff +#define Bndry_mask1 0xfffff +#define LSB 1 +#define Sign_bit 0x80000000 +#define Log2P 1 +#define Tiny0 0 +#define Tiny1 1 +#define Quick_max 14 +#define Int_max 14 +#define Infinite(x) (word0(x) == 0x7ff00000) /* sufficient test for here */ +#else +#undef Sudden_Underflow +#define Sudden_Underflow +#ifdef IBM +#define Exp_shift 24 +#define Exp_shift1 24 +#define Exp_msk1 0x1000000 +#define Exp_msk11 0x1000000 +#define Exp_mask 0x7f000000 +#define P 14 +#define Bias 65 +#define Exp_1 0x41000000 +#define Exp_11 0x41000000 +#define Ebits 8 /* exponent has 7 bits, but 8 is the right value in b2d */ +#define Frac_mask 0xffffff +#define Frac_mask1 0xffffff +#define Bletch 4 +#define Ten_pmax 22 +#define Bndry_mask 0xefffff +#define Bndry_mask1 0xffffff +#define LSB 1 +#define Sign_bit 0x80000000 +#define Log2P 4 +#define Tiny0 0x100000 +#define Tiny1 0 +#define Quick_max 14 +#define Int_max 15 +#else /* VAX */ +#define Exp_shift 23 +#define Exp_shift1 7 +#define Exp_msk1 0x80 +#define Exp_msk11 0x800000 +#define Exp_mask 0x7f80 +#define P 56 +#define Bias 129 +#define Exp_1 0x40800000 +#define Exp_11 0x4080 +#define Ebits 8 +#define Frac_mask 0x7fffff +#define Frac_mask1 0xffff007f +#define Ten_pmax 24 +#define Bletch 2 +#define Bndry_mask 0xffff007f +#define Bndry_mask1 0xffff007f +#define LSB 0x10000 +#define Sign_bit 0x8000 +#define Log2P 1 +#define Tiny0 0x80 +#define Tiny1 0 +#define Quick_max 15 +#define Int_max 15 +#endif +#endif + +#ifndef IEEE_Arith +#define ROUND_BIASED +#endif + +#ifdef RND_PRODQUOT +#define rounded_product(a,b) a = rnd_prod(a, b) +#define rounded_quotient(a,b) a = rnd_quot(a, b) +#ifdef KR_headers +extern double rnd_prod(), rnd_quot(); +#else +extern double rnd_prod(double, double), rnd_quot(double, double); +#endif +#else +#define rounded_product(a,b) a *= b +#define rounded_quotient(a,b) a /= b +#endif + +#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1)) +#define Big1 0xffffffff + +#ifndef Just_16 +/* When Pack_32 is not defined, we store 16 bits per 32-bit Long. + * This makes some inner loops simpler and sometimes saves work + * during multiplications, but it often seems to make things slightly + * slower. Hence the default is now to store 32 bits per Long. + */ +#ifndef Pack_32 +#define Pack_32 +#endif +#endif + +#define Kmax 15 + +#ifdef __cplusplus +extern "C" double strtod(const char *s00, char **se); +extern "C" char *__dtoa(double d, int mode, int ndigits, + int *decpt, int *sign, char **rve); +#endif + + struct +Bigint { + struct Bigint *next; + int k, maxwds, sign, wds; + ULong x[1]; + }; + + typedef struct Bigint Bigint; + + static Bigint *freelist[Kmax+1]; + + static Bigint * +Balloc +#ifdef KR_headers + (k) int k; +#else + (int k) +#endif +{ + int x; + Bigint *rv; + + if (rv = freelist[k]) { + freelist[k] = rv->next; + } + else { + x = 1 << k; + rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(Long)); + rv->k = k; + rv->maxwds = x; + } + rv->sign = rv->wds = 0; + return rv; + } + + static void +Bfree +#ifdef KR_headers + (v) Bigint *v; +#else + (Bigint *v) +#endif +{ + if (v) { + v->next = freelist[v->k]; + freelist[v->k] = v; + } + } + +#define Bcopy(x,y) memcpy((char *)&x->sign, (char *)&y->sign, \ +y->wds*sizeof(Long) + 2*sizeof(int)) + + static Bigint * +multadd +#ifdef KR_headers + (b, m, a) Bigint *b; int m, a; +#else + (Bigint *b, int m, int a) /* multiply by m and add a */ +#endif +{ + int i, wds; + ULong *x, y; +#ifdef Pack_32 + ULong xi, z; +#endif + Bigint *b1; + + wds = b->wds; + x = b->x; + i = 0; + do { +#ifdef Pack_32 + xi = *x; + y = (xi & 0xffff) * m + a; + z = (xi >> 16) * m + (y >> 16); + a = (int)(z >> 16); + *x++ = (z << 16) + (y & 0xffff); +#else + y = *x * m + a; + a = (int)(y >> 16); + *x++ = y & 0xffff; +#endif + } + while(++i < wds); + if (a) { + if (wds >= b->maxwds) { + b1 = Balloc(b->k+1); + Bcopy(b1, b); + Bfree(b); + b = b1; + } + b->x[wds++] = a; + b->wds = wds; + } + return b; + } + + static Bigint * +s2b +#ifdef KR_headers + (s, nd0, nd, y9) CONST char *s; int nd0, nd; ULong y9; +#else + (CONST char *s, int nd0, int nd, ULong y9) +#endif +{ + Bigint *b; + int i, k; + Long x, y; + + x = (nd + 8) / 9; + for(k = 0, y = 1; x > y; y <<= 1, k++) ; +#ifdef Pack_32 + b = Balloc(k); + b->x[0] = y9; + b->wds = 1; +#else + b = Balloc(k+1); + b->x[0] = y9 & 0xffff; + b->wds = (b->x[1] = y9 >> 16) ? 2 : 1; +#endif + + i = 9; + if (9 < nd0) { + s += 9; + do b = multadd(b, 10, *s++ - '0'); + while(++i < nd0); + s++; + } + else + s += 10; + for(; i < nd; i++) + b = multadd(b, 10, *s++ - '0'); + return b; + } + + static int +hi0bits +#ifdef KR_headers + (x) register ULong x; +#else + (register ULong x) +#endif +{ + register int k = 0; + + if (!(x & 0xffff0000)) { + k = 16; + x <<= 16; + } + if (!(x & 0xff000000)) { + k += 8; + x <<= 8; + } + if (!(x & 0xf0000000)) { + k += 4; + x <<= 4; + } + if (!(x & 0xc0000000)) { + k += 2; + x <<= 2; + } + if (!(x & 0x80000000)) { + k++; + if (!(x & 0x40000000)) + return 32; + } + return k; + } + + static int +lo0bits +#ifdef KR_headers + (y) ULong *y; +#else + (ULong *y) +#endif +{ + register int k; + register ULong x = *y; + + if (x & 7) { + if (x & 1) + return 0; + if (x & 2) { + *y = x >> 1; + return 1; + } + *y = x >> 2; + return 2; + } + k = 0; + if (!(x & 0xffff)) { + k = 16; + x >>= 16; + } + if (!(x & 0xff)) { + k += 8; + x >>= 8; + } + if (!(x & 0xf)) { + k += 4; + x >>= 4; + } + if (!(x & 0x3)) { + k += 2; + x >>= 2; + } + if (!(x & 1)) { + k++; + x >>= 1; + if (!x & 1) + return 32; + } + *y = x; + return k; + } + + static Bigint * +i2b +#ifdef KR_headers + (i) int i; +#else + (int i) +#endif +{ + Bigint *b; + + b = Balloc(1); + b->x[0] = i; + b->wds = 1; + return b; + } + + static Bigint * +mult +#ifdef KR_headers + (a, b) Bigint *a, *b; +#else + (Bigint *a, Bigint *b) +#endif +{ + Bigint *c; + int k, wa, wb, wc; + ULong carry, y, z; + ULong *x, *xa, *xae, *xb, *xbe, *xc, *xc0; +#ifdef Pack_32 + ULong z2; +#endif + + if (a->wds < b->wds) { + c = a; + a = b; + b = c; + } + k = a->k; + wa = a->wds; + wb = b->wds; + wc = wa + wb; + if (wc > a->maxwds) + k++; + c = Balloc(k); + for(x = c->x, xa = x + wc; x < xa; x++) + *x = 0; + xa = a->x; + xae = xa + wa; + xb = b->x; + xbe = xb + wb; + xc0 = c->x; +#ifdef Pack_32 + for(; xb < xbe; xb++, xc0++) { + if (y = *xb & 0xffff) { + x = xa; + xc = xc0; + carry = 0; + do { + z = (*x & 0xffff) * y + (*xc & 0xffff) + carry; + carry = z >> 16; + z2 = (*x++ >> 16) * y + (*xc >> 16) + carry; + carry = z2 >> 16; + Storeinc(xc, z2, z); + } + while(x < xae); + *xc = carry; + } + if (y = *xb >> 16) { + x = xa; + xc = xc0; + carry = 0; + z2 = *xc; + do { + z = (*x & 0xffff) * y + (*xc >> 16) + carry; + carry = z >> 16; + Storeinc(xc, z, z2); + z2 = (*x++ >> 16) * y + (*xc & 0xffff) + carry; + carry = z2 >> 16; + } + while(x < xae); + *xc = z2; + } + } +#else + for(; xb < xbe; xc0++) { + if (y = *xb++) { + x = xa; + xc = xc0; + carry = 0; + do { + z = *x++ * y + *xc + carry; + carry = z >> 16; + *xc++ = z & 0xffff; + } + while(x < xae); + *xc = carry; + } + } +#endif + for(xc0 = c->x, xc = xc0 + wc; wc > 0 && !*--xc; --wc) ; + c->wds = wc; + return c; + } + + static Bigint *p5s; + + static Bigint * +pow5mult +#ifdef KR_headers + (b, k) Bigint *b; int k; +#else + (Bigint *b, int k) +#endif +{ + Bigint *b1, *p5, *p51; + int i; + static int p05[3] = { 5, 25, 125 }; + + if (i = k & 3) + b = multadd(b, p05[i-1], 0); + + if (!(k >>= 2)) + return b; + if (!(p5 = p5s)) { + /* first time */ + p5 = p5s = i2b(625); + p5->next = 0; + } + for(;;) { + if (k & 1) { + b1 = mult(b, p5); + Bfree(b); + b = b1; + } + if (!(k >>= 1)) + break; + if (!(p51 = p5->next)) { + p51 = p5->next = mult(p5,p5); + p51->next = 0; + } + p5 = p51; + } + return b; + } + + static Bigint * +lshift +#ifdef KR_headers + (b, k) Bigint *b; int k; +#else + (Bigint *b, int k) +#endif +{ + int i, k1, n, n1; + Bigint *b1; + ULong *x, *x1, *xe, z; + +#ifdef Pack_32 + n = k >> 5; +#else + n = k >> 4; +#endif + k1 = b->k; + n1 = n + b->wds + 1; + for(i = b->maxwds; n1 > i; i <<= 1) + k1++; + b1 = Balloc(k1); + x1 = b1->x; + for(i = 0; i < n; i++) + *x1++ = 0; + x = b->x; + xe = x + b->wds; +#ifdef Pack_32 + if (k &= 0x1f) { + k1 = 32 - k; + z = 0; + do { + *x1++ = *x << k | z; + z = *x++ >> k1; + } + while(x < xe); + if (*x1 = z) + ++n1; + } +#else + if (k &= 0xf) { + k1 = 16 - k; + z = 0; + do { + *x1++ = *x << k & 0xffff | z; + z = *x++ >> k1; + } + while(x < xe); + if (*x1 = z) + ++n1; + } +#endif + else do + *x1++ = *x++; + while(x < xe); + b1->wds = n1 - 1; + Bfree(b); + return b1; + } + + static int +cmp +#ifdef KR_headers + (a, b) Bigint *a, *b; +#else + (Bigint *a, Bigint *b) +#endif +{ + ULong *xa, *xa0, *xb, *xb0; + int i, j; + + i = a->wds; + j = b->wds; +#ifdef DEBUG + if (i > 1 && !a->x[i-1]) + Bug("cmp called with a->x[a->wds-1] == 0"); + if (j > 1 && !b->x[j-1]) + Bug("cmp called with b->x[b->wds-1] == 0"); +#endif + if (i -= j) + return i; + xa0 = a->x; + xa = xa0 + j; + xb0 = b->x; + xb = xb0 + j; + for(;;) { + if (*--xa != *--xb) + return *xa < *xb ? -1 : 1; + if (xa <= xa0) + break; + } + return 0; + } + + static Bigint * +diff +#ifdef KR_headers + (a, b) Bigint *a, *b; +#else + (Bigint *a, Bigint *b) +#endif +{ + Bigint *c; + int i, wa, wb; + Long borrow, y; /* We need signed shifts here. */ + ULong *xa, *xae, *xb, *xbe, *xc; +#ifdef Pack_32 + Long z; +#endif + + i = cmp(a,b); + if (!i) { + c = Balloc(0); + c->wds = 1; + c->x[0] = 0; + return c; + } + if (i < 0) { + c = a; + a = b; + b = c; + i = 1; + } + else + i = 0; + c = Balloc(a->k); + c->sign = i; + wa = a->wds; + xa = a->x; + xae = xa + wa; + wb = b->wds; + xb = b->x; + xbe = xb + wb; + xc = c->x; + borrow = 0; +#ifdef Pack_32 + do { + y = (*xa & 0xffff) - (*xb & 0xffff) + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + z = (*xa++ >> 16) - (*xb++ >> 16) + borrow; + borrow = z >> 16; + Sign_Extend(borrow, z); + Storeinc(xc, z, y); + } + while(xb < xbe); + while(xa < xae) { + y = (*xa & 0xffff) + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + z = (*xa++ >> 16) + borrow; + borrow = z >> 16; + Sign_Extend(borrow, z); + Storeinc(xc, z, y); + } +#else + do { + y = *xa++ - *xb++ + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + *xc++ = y & 0xffff; + } + while(xb < xbe); + while(xa < xae) { + y = *xa++ + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + *xc++ = y & 0xffff; + } +#endif + while(!*--xc) + wa--; + c->wds = wa; + return c; + } + + static double +ulp +#ifdef KR_headers + (x) double x; +#else + (double x) +#endif +{ + register Long L; + double a; + + L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1; +#ifndef Sudden_Underflow + if (L > 0) { +#endif +#ifdef IBM + L |= Exp_msk1 >> 4; +#endif + word0(a) = L; + word1(a) = 0; +#ifndef Sudden_Underflow + } + else { + L = -L >> Exp_shift; + if (L < Exp_shift) { + word0(a) = 0x80000 >> L; + word1(a) = 0; + } + else { + word0(a) = 0; + L -= Exp_shift; + word1(a) = L >= 31 ? 1 : 1 << 31 - L; + } + } +#endif + return a; + } + + static double +b2d +#ifdef KR_headers + (a, e) Bigint *a; int *e; +#else + (Bigint *a, int *e) +#endif +{ + ULong *xa, *xa0, w, y, z; + int k; + double d; +#ifdef VAX + ULong d0, d1; +#else +#define d0 word0(d) +#define d1 word1(d) +#endif + + xa0 = a->x; + xa = xa0 + a->wds; + y = *--xa; +#ifdef DEBUG + if (!y) Bug("zero y in b2d"); +#endif + k = hi0bits(y); + *e = 32 - k; +#ifdef Pack_32 + if (k < Ebits) { + d0 = Exp_1 | y >> Ebits - k; + w = xa > xa0 ? *--xa : 0; + d1 = y << (32-Ebits) + k | w >> Ebits - k; + goto ret_d; + } + z = xa > xa0 ? *--xa : 0; + if (k -= Ebits) { + d0 = Exp_1 | y << k | z >> 32 - k; + y = xa > xa0 ? *--xa : 0; + d1 = z << k | y >> 32 - k; + } + else { + d0 = Exp_1 | y; + d1 = z; + } +#else + if (k < Ebits + 16) { + z = xa > xa0 ? *--xa : 0; + d0 = Exp_1 | y << k - Ebits | z >> Ebits + 16 - k; + w = xa > xa0 ? *--xa : 0; + y = xa > xa0 ? *--xa : 0; + d1 = z << k + 16 - Ebits | w << k - Ebits | y >> 16 + Ebits - k; + goto ret_d; + } + z = xa > xa0 ? *--xa : 0; + w = xa > xa0 ? *--xa : 0; + k -= Ebits + 16; + d0 = Exp_1 | y << k + 16 | z << k | w >> 16 - k; + y = xa > xa0 ? *--xa : 0; + d1 = w << k + 16 | y << k; +#endif + ret_d: +#ifdef VAX + word0(d) = d0 >> 16 | d0 << 16; + word1(d) = d1 >> 16 | d1 << 16; +#else +#undef d0 +#undef d1 +#endif + return d; + } + + static Bigint * +d2b +#ifdef KR_headers + (d, e, bits) double d; int *e, *bits; +#else + (double d, int *e, int *bits) +#endif +{ + Bigint *b; + int de, i, k; + ULong *x, y, z; +#ifdef VAX + ULong d0, d1; + d0 = word0(d) >> 16 | word0(d) << 16; + d1 = word1(d) >> 16 | word1(d) << 16; +#else +#define d0 word0(d) +#define d1 word1(d) +#endif + +#ifdef Pack_32 + b = Balloc(1); +#else + b = Balloc(2); +#endif + x = b->x; + + z = d0 & Frac_mask; + d0 &= 0x7fffffff; /* clear sign bit, which we ignore */ +#ifdef Sudden_Underflow + de = (int)(d0 >> Exp_shift); +#ifndef IBM + z |= Exp_msk11; +#endif +#else + if (de = (int)(d0 >> Exp_shift)) + z |= Exp_msk1; +#endif +#ifdef Pack_32 + if (y = d1) { + if (k = lo0bits(&y)) { + x[0] = y | z << 32 - k; + z >>= k; + } + else + x[0] = y; + i = b->wds = (x[1] = z) ? 2 : 1; + } + else { +#ifdef DEBUG + if (!z) + Bug("Zero passed to d2b"); +#endif + k = lo0bits(&z); + x[0] = z; + i = b->wds = 1; + k += 32; + } +#else + if (y = d1) { + if (k = lo0bits(&y)) + if (k >= 16) { + x[0] = y | z << 32 - k & 0xffff; + x[1] = z >> k - 16 & 0xffff; + x[2] = z >> k; + i = 2; + } + else { + x[0] = y & 0xffff; + x[1] = y >> 16 | z << 16 - k & 0xffff; + x[2] = z >> k & 0xffff; + x[3] = z >> k+16; + i = 3; + } + else { + x[0] = y & 0xffff; + x[1] = y >> 16; + x[2] = z & 0xffff; + x[3] = z >> 16; + i = 3; + } + } + else { +#ifdef DEBUG + if (!z) + Bug("Zero passed to d2b"); +#endif + k = lo0bits(&z); + if (k >= 16) { + x[0] = z; + i = 0; + } + else { + x[0] = z & 0xffff; + x[1] = z >> 16; + i = 1; + } + k += 32; + } + while(!x[i]) + --i; + b->wds = i + 1; +#endif +#ifndef Sudden_Underflow + if (de) { +#endif +#ifdef IBM + *e = (de - Bias - (P-1) << 2) + k; + *bits = 4*P + 8 - k - hi0bits(word0(d) & Frac_mask); +#else + *e = de - Bias - (P-1) + k; + *bits = P - k; +#endif +#ifndef Sudden_Underflow + } + else { + *e = de - Bias - (P-1) + 1 + k; +#ifdef Pack_32 + *bits = 32*i - hi0bits(x[i-1]); +#else + *bits = (i+2)*16 - hi0bits(x[i]); +#endif + } +#endif + return b; + } +#undef d0 +#undef d1 + + static double +ratio +#ifdef KR_headers + (a, b) Bigint *a, *b; +#else + (Bigint *a, Bigint *b) +#endif +{ + double da, db; + int k, ka, kb; + + da = b2d(a, &ka); + db = b2d(b, &kb); +#ifdef Pack_32 + k = ka - kb + 32*(a->wds - b->wds); +#else + k = ka - kb + 16*(a->wds - b->wds); +#endif +#ifdef IBM + if (k > 0) { + word0(da) += (k >> 2)*Exp_msk1; + if (k &= 3) + da *= 1 << k; + } + else { + k = -k; + word0(db) += (k >> 2)*Exp_msk1; + if (k &= 3) + db *= 1 << k; + } +#else + if (k > 0) + word0(da) += k*Exp_msk1; + else { + k = -k; + word0(db) += k*Exp_msk1; + } +#endif + return da / db; + } + +static CONST double +tens[] = { + 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, + 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, + 1e20, 1e21, 1e22 +#ifdef VAX + , 1e23, 1e24 +#endif + }; + +#ifdef IEEE_Arith +static CONST double bigtens[] = { 1e16, 1e32, 1e64, 1e128, 1e256 }; +static CONST double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128, 1e-256 }; +#define n_bigtens 5 +#else +#ifdef IBM +static CONST double bigtens[] = { 1e16, 1e32, 1e64 }; +static CONST double tinytens[] = { 1e-16, 1e-32, 1e-64 }; +#define n_bigtens 3 +#else +static CONST double bigtens[] = { 1e16, 1e32 }; +static CONST double tinytens[] = { 1e-16, 1e-32 }; +#define n_bigtens 2 +#endif +#endif + + double +strtod +#ifdef KR_headers + (s00, se) CONST char *s00; char **se; +#else + (CONST char *s00, char **se) +#endif +{ + int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, dsign, + e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign; + CONST char *s, *s0, *s1; + double aadj, aadj1, adj, rv, rv0; + Long L; + ULong y, z; + Bigint *bb, *bb1, *bd, *bd0, *bs, *delta; + +#ifndef KR_headers + CONST char decimal_point = localeconv()->decimal_point[0]; +#else + CONST char decimal_point = '.'; +#endif + + sign = nz0 = nz = 0; + rv = 0.; + + + for(s = s00; isspace((unsigned char) *s); s++) + ; + + if (*s == '-') { + sign = 1; + s++; + } else if (*s == '+') { + s++; + } + + if (*s == '\0') { + s = s00; + goto ret; + } + + if (*s == '0') { + nz0 = 1; + while(*++s == '0') ; + if (!*s) + goto ret; + } + s0 = s; + y = z = 0; + for(nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++) + if (nd < 9) + y = 10*y + c - '0'; + else if (nd < 16) + z = 10*z + c - '0'; + nd0 = nd; + if (c == decimal_point) { + c = *++s; + if (!nd) { + for(; c == '0'; c = *++s) + nz++; + if (c > '0' && c <= '9') { + s0 = s; + nf += nz; + nz = 0; + goto have_dig; + } + goto dig_done; + } + for(; c >= '0' && c <= '9'; c = *++s) { + have_dig: + nz++; + if (c -= '0') { + nf += nz; + for(i = 1; i < nz; i++) + if (nd++ < 9) + y *= 10; + else if (nd <= DBL_DIG + 1) + z *= 10; + if (nd++ < 9) + y = 10*y + c; + else if (nd <= DBL_DIG + 1) + z = 10*z + c; + nz = 0; + } + } + } + dig_done: + e = 0; + if (c == 'e' || c == 'E') { + if (!nd && !nz && !nz0) { + s = s00; + goto ret; + } + s00 = s; + esign = 0; + switch(c = *++s) { + case '-': + esign = 1; + case '+': + c = *++s; + } + if (c >= '0' && c <= '9') { + while(c == '0') + c = *++s; + if (c > '0' && c <= '9') { + L = c - '0'; + s1 = s; + while((c = *++s) >= '0' && c <= '9') + L = 10*L + c - '0'; + if (s - s1 > 8 || L > 19999) + /* Avoid confusion from exponents + * so large that e might overflow. + */ + e = 19999; /* safe for 16 bit ints */ + else + e = (int)L; + if (esign) + e = -e; + } + else + e = 0; + } + else + s = s00; + } + if (!nd) { + if (!nz && !nz0) + s = s00; + goto ret; + } + e1 = e -= nf; + + /* Now we have nd0 digits, starting at s0, followed by a + * decimal point, followed by nd-nd0 digits. The number we're + * after is the integer represented by those digits times + * 10**e */ + + if (!nd0) + nd0 = nd; + k = nd < DBL_DIG + 1 ? nd : DBL_DIG + 1; + rv = y; + if (k > 9) + rv = tens[k - 9] * rv + z; + bd0 = 0; + if (nd <= DBL_DIG +#ifndef RND_PRODQUOT + && FLT_ROUNDS == 1 +#endif + ) { + if (!e) + goto ret; + if (e > 0) { + if (e <= Ten_pmax) { +#ifdef VAX + goto vax_ovfl_check; +#else + /* rv = */ rounded_product(rv, tens[e]); + goto ret; +#endif + } + i = DBL_DIG - nd; + if (e <= Ten_pmax + i) { + /* A fancier test would sometimes let us do + * this for larger i values. + */ + e -= i; + rv *= tens[i]; +#ifdef VAX + /* VAX exponent range is so narrow we must + * worry about overflow here... + */ + vax_ovfl_check: + word0(rv) -= P*Exp_msk1; + /* rv = */ rounded_product(rv, tens[e]); + if ((word0(rv) & Exp_mask) + > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) + goto ovfl; + word0(rv) += P*Exp_msk1; +#else + /* rv = */ rounded_product(rv, tens[e]); +#endif + goto ret; + } + } +#ifndef Inaccurate_Divide + else if (e >= -Ten_pmax) { + /* rv = */ rounded_quotient(rv, tens[-e]); + goto ret; + } +#endif + } + e1 += nd - k; + + /* Get starting approximation = rv * 10**e1 */ + + if (e1 > 0) { + if (i = e1 & 15) + rv *= tens[i]; + if (e1 &= ~15) { + if (e1 > DBL_MAX_10_EXP) { + ovfl: + errno = ERANGE; +#ifdef __STDC__ + rv = HUGE_VAL; +#else + /* Can't trust HUGE_VAL */ +#ifdef IEEE_Arith + word0(rv) = Exp_mask; + word1(rv) = 0; +#else + word0(rv) = Big0; + word1(rv) = Big1; +#endif +#endif + if (bd0) + goto retfree; + goto ret; + } + if (e1 >>= 4) { + for(j = 0; e1 > 1; j++, e1 >>= 1) + if (e1 & 1) + rv *= bigtens[j]; + /* The last multiplication could overflow. */ + word0(rv) -= P*Exp_msk1; + rv *= bigtens[j]; + if ((z = word0(rv) & Exp_mask) + > Exp_msk1*(DBL_MAX_EXP+Bias-P)) + goto ovfl; + if (z > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) { + /* set to largest number */ + /* (Can't trust DBL_MAX) */ + word0(rv) = Big0; + word1(rv) = Big1; + } + else + word0(rv) += P*Exp_msk1; + } + + } + } + else if (e1 < 0) { + e1 = -e1; + if (i = e1 & 15) + rv /= tens[i]; + if (e1 &= ~15) { + e1 >>= 4; + if (e1 >= 1 << n_bigtens) + goto undfl; + for(j = 0; e1 > 1; j++, e1 >>= 1) + if (e1 & 1) + rv *= tinytens[j]; + /* The last multiplication could underflow. */ + rv0 = rv; + rv *= tinytens[j]; + if (!rv) { + rv = 2.*rv0; + rv *= tinytens[j]; + if (!rv) { + undfl: + rv = 0.; + errno = ERANGE; + if (bd0) + goto retfree; + goto ret; + } + word0(rv) = Tiny0; + word1(rv) = Tiny1; + /* The refinement below will clean + * this approximation up. + */ + } + } + } + + /* Now the hard part -- adjusting rv to the correct value.*/ + + /* Put digits into bd: true value = bd * 10^e */ + + bd0 = s2b(s0, nd0, nd, y); + + for(;;) { + bd = Balloc(bd0->k); + Bcopy(bd, bd0); + bb = d2b(rv, &bbe, &bbbits); /* rv = bb * 2^bbe */ + bs = i2b(1); + + if (e >= 0) { + bb2 = bb5 = 0; + bd2 = bd5 = e; + } + else { + bb2 = bb5 = -e; + bd2 = bd5 = 0; + } + if (bbe >= 0) + bb2 += bbe; + else + bd2 -= bbe; + bs2 = bb2; +#ifdef Sudden_Underflow +#ifdef IBM + j = 1 + 4*P - 3 - bbbits + ((bbe + bbbits - 1) & 3); +#else + j = P + 1 - bbbits; +#endif +#else + i = bbe + bbbits - 1; /* logb(rv) */ + if (i < Emin) /* denormal */ + j = bbe + (P-Emin); + else + j = P + 1 - bbbits; +#endif + bb2 += j; + bd2 += j; + i = bb2 < bd2 ? bb2 : bd2; + if (i > bs2) + i = bs2; + if (i > 0) { + bb2 -= i; + bd2 -= i; + bs2 -= i; + } + if (bb5 > 0) { + bs = pow5mult(bs, bb5); + bb1 = mult(bs, bb); + Bfree(bb); + bb = bb1; + } + if (bb2 > 0) + bb = lshift(bb, bb2); + if (bd5 > 0) + bd = pow5mult(bd, bd5); + if (bd2 > 0) + bd = lshift(bd, bd2); + if (bs2 > 0) + bs = lshift(bs, bs2); + delta = diff(bb, bd); + dsign = delta->sign; + delta->sign = 0; + i = cmp(delta, bs); + if (i < 0) { + /* Error is less than half an ulp -- check for + * special case of mantissa a power of two. + */ + if (dsign || word1(rv) || word0(rv) & Bndry_mask) + break; + delta = lshift(delta,Log2P); + if (cmp(delta, bs) > 0) + goto drop_down; + break; + } + if (i == 0) { + /* exactly half-way between */ + if (dsign) { + if ((word0(rv) & Bndry_mask1) == Bndry_mask1 + && word1(rv) == 0xffffffff) { + /*boundary case -- increment exponent*/ + word0(rv) = (word0(rv) & Exp_mask) + + Exp_msk1 +#ifdef IBM + | Exp_msk1 >> 4 +#endif + ; + word1(rv) = 0; + break; + } + } + else if (!(word0(rv) & Bndry_mask) && !word1(rv)) { + drop_down: + /* boundary case -- decrement exponent */ +#ifdef Sudden_Underflow + L = word0(rv) & Exp_mask; +#ifdef IBM + if (L < Exp_msk1) +#else + if (L <= Exp_msk1) +#endif + goto undfl; + L -= Exp_msk1; +#else + L = (word0(rv) & Exp_mask) - Exp_msk1; +#endif + word0(rv) = L | Bndry_mask1; + word1(rv) = 0xffffffff; +#ifdef IBM + goto cont; +#else + break; +#endif + } +#ifndef ROUND_BIASED + if (!(word1(rv) & LSB)) + break; +#endif + if (dsign) + rv += ulp(rv); +#ifndef ROUND_BIASED + else { + rv -= ulp(rv); +#ifndef Sudden_Underflow + if (!rv) + goto undfl; +#endif + } +#endif + break; + } + if ((aadj = ratio(delta, bs)) <= 2.) { + if (dsign) + aadj = aadj1 = 1.; + else if (word1(rv) || word0(rv) & Bndry_mask) { +#ifndef Sudden_Underflow + if (word1(rv) == Tiny1 && !word0(rv)) + goto undfl; +#endif + aadj = 1.; + aadj1 = -1.; + } + else { + /* special case -- power of FLT_RADIX to be */ + /* rounded down... */ + + if (aadj < 2./FLT_RADIX) + aadj = 1./FLT_RADIX; + else + aadj *= 0.5; + aadj1 = -aadj; + } + } + else { + aadj *= 0.5; + aadj1 = dsign ? aadj : -aadj; +#ifdef Check_FLT_ROUNDS + switch(FLT_ROUNDS) { + case 2: /* towards +infinity */ + aadj1 -= 0.5; + break; + case 0: /* towards 0 */ + case 3: /* towards -infinity */ + aadj1 += 0.5; + } +#else + if (FLT_ROUNDS == 0) + aadj1 += 0.5; +#endif + } + y = word0(rv) & Exp_mask; + + /* Check for overflow */ + + if (y == Exp_msk1*(DBL_MAX_EXP+Bias-1)) { + rv0 = rv; + word0(rv) -= P*Exp_msk1; + adj = aadj1 * ulp(rv); + rv += adj; + if ((word0(rv) & Exp_mask) >= + Exp_msk1*(DBL_MAX_EXP+Bias-P)) { + if (word0(rv0) == Big0 && word1(rv0) == Big1) + goto ovfl; + word0(rv) = Big0; + word1(rv) = Big1; + goto cont; + } + else + word0(rv) += P*Exp_msk1; + } + else { +#ifdef Sudden_Underflow + if ((word0(rv) & Exp_mask) <= P*Exp_msk1) { + rv0 = rv; + word0(rv) += P*Exp_msk1; + adj = aadj1 * ulp(rv); + rv += adj; +#ifdef IBM + if ((word0(rv) & Exp_mask) < P*Exp_msk1) +#else + if ((word0(rv) & Exp_mask) <= P*Exp_msk1) +#endif + { + if (word0(rv0) == Tiny0 + && word1(rv0) == Tiny1) + goto undfl; + word0(rv) = Tiny0; + word1(rv) = Tiny1; + goto cont; + } + else + word0(rv) -= P*Exp_msk1; + } + else { + adj = aadj1 * ulp(rv); + rv += adj; + } +#else + /* Compute adj so that the IEEE rounding rules will + * correctly round rv + adj in some half-way cases. + * If rv * ulp(rv) is denormalized (i.e., + * y <= (P-1)*Exp_msk1), we must adjust aadj to avoid + * trouble from bits lost to denormalization; + * example: 1.2e-307 . + */ + if (y <= (P-1)*Exp_msk1 && aadj >= 1.) { + aadj1 = (double)(int)(aadj + 0.5); + if (!dsign) + aadj1 = -aadj1; + } + adj = aadj1 * ulp(rv); + rv += adj; +#endif + } + z = word0(rv) & Exp_mask; + if (y == z) { + /* Can we stop now? */ + L = aadj; + aadj -= L; + /* The tolerances below are conservative. */ + if (dsign || word1(rv) || word0(rv) & Bndry_mask) { + if (aadj < .4999999 || aadj > .5000001) + break; + } + else if (aadj < .4999999/FLT_RADIX) + break; + } + cont: + Bfree(bb); + Bfree(bd); + Bfree(bs); + Bfree(delta); + } + retfree: + Bfree(bb); + Bfree(bd); + Bfree(bs); + Bfree(bd0); + Bfree(delta); + ret: + if (se) + *se = (char *)s; + return sign ? -rv : rv; + } + + static int +quorem +#ifdef KR_headers + (b, S) Bigint *b, *S; +#else + (Bigint *b, Bigint *S) +#endif +{ + int n; + Long borrow, y; + ULong carry, q, ys; + ULong *bx, *bxe, *sx, *sxe; +#ifdef Pack_32 + Long z; + ULong si, zs; +#endif + + n = S->wds; +#ifdef DEBUG + /*debug*/ if (b->wds > n) + /*debug*/ Bug("oversize b in quorem"); +#endif + if (b->wds < n) + return 0; + sx = S->x; + sxe = sx + --n; + bx = b->x; + bxe = bx + n; + q = *bxe / (*sxe + 1); /* ensure q <= true quotient */ +#ifdef DEBUG + /*debug*/ if (q > 9) + /*debug*/ Bug("oversized quotient in quorem"); +#endif + if (q) { + borrow = 0; + carry = 0; + do { +#ifdef Pack_32 + si = *sx++; + ys = (si & 0xffff) * q + carry; + zs = (si >> 16) * q + (ys >> 16); + carry = zs >> 16; + y = (*bx & 0xffff) - (ys & 0xffff) + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + z = (*bx >> 16) - (zs & 0xffff) + borrow; + borrow = z >> 16; + Sign_Extend(borrow, z); + Storeinc(bx, z, y); +#else + ys = *sx++ * q + carry; + carry = ys >> 16; + y = *bx - (ys & 0xffff) + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + *bx++ = y & 0xffff; +#endif + } + while(sx <= sxe); + if (!*bxe) { + bx = b->x; + while(--bxe > bx && !*bxe) + --n; + b->wds = n; + } + } + if (cmp(b, S) >= 0) { + q++; + borrow = 0; + carry = 0; + bx = b->x; + sx = S->x; + do { +#ifdef Pack_32 + si = *sx++; + ys = (si & 0xffff) + carry; + zs = (si >> 16) + (ys >> 16); + carry = zs >> 16; + y = (*bx & 0xffff) - (ys & 0xffff) + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + z = (*bx >> 16) - (zs & 0xffff) + borrow; + borrow = z >> 16; + Sign_Extend(borrow, z); + Storeinc(bx, z, y); +#else + ys = *sx++ + carry; + carry = ys >> 16; + y = *bx - (ys & 0xffff) + borrow; + borrow = y >> 16; + Sign_Extend(borrow, y); + *bx++ = y & 0xffff; +#endif + } + while(sx <= sxe); + bx = b->x; + bxe = bx + n; + if (!*bxe) { + while(--bxe > bx && !*bxe) + --n; + b->wds = n; + } + } + return q; + } + +/* dtoa for IEEE arithmetic (dmg): convert double to ASCII string. + * + * Inspired by "How to Print Floating-Point Numbers Accurately" by + * Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 92-101]. + * + * Modifications: + * 1. Rather than iterating, we use a simple numeric overestimate + * to determine k = floor(log10(d)). We scale relevant + * quantities using O(log2(k)) rather than O(k) multiplications. + * 2. For some modes > 2 (corresponding to ecvt and fcvt), we don't + * try to generate digits strictly left to right. Instead, we + * compute with fewer bits and propagate the carry if necessary + * when rounding the final digit up. This is often faster. + * 3. Under the assumption that input will be rounded nearest, + * mode 0 renders 1e23 as 1e23 rather than 9.999999999999999e22. + * That is, we allow equality in stopping tests when the + * round-nearest rule will give the same floating-point value + * as would satisfaction of the stopping test with strict + * inequality. + * 4. We remove common factors of powers of 2 from relevant + * quantities. + * 5. When converting floating-point integers less than 1e16, + * we use floating-point arithmetic rather than resorting + * to multiple-precision integers. + * 6. When asked to produce fewer than 15 digits, we first try + * to get by with floating-point arithmetic; we resort to + * multiple-precision integer arithmetic only if we cannot + * guarantee that the floating-point calculation has given + * the correctly rounded result. For k requested digits and + * "uniformly" distributed input, the probability is + * something like 10^(k-15) that we must resort to the Long + * calculation. + */ + + char * +__dtoa +#ifdef KR_headers + (d, mode, ndigits, decpt, sign, rve) + double d; int mode, ndigits, *decpt, *sign; char **rve; +#else + (double d, int mode, int ndigits, int *decpt, int *sign, char **rve) +#endif +{ + /* Arguments ndigits, decpt, sign are similar to those + of ecvt and fcvt; trailing zeros are suppressed from + the returned string. If not null, *rve is set to point + to the end of the return value. If d is +-Infinity or NaN, + then *decpt is set to 9999. + + mode: + 0 ==> shortest string that yields d when read in + and rounded to nearest. + 1 ==> like 0, but with Steele & White stopping rule; + e.g. with IEEE P754 arithmetic , mode 0 gives + 1e23 whereas mode 1 gives 9.999999999999999e22. + 2 ==> max(1,ndigits) significant digits. This gives a + return value similar to that of ecvt, except + that trailing zeros are suppressed. + 3 ==> through ndigits past the decimal point. This + gives a return value similar to that from fcvt, + except that trailing zeros are suppressed, and + ndigits can be negative. + 4-9 should give the same return values as 2-3, i.e., + 4 <= mode <= 9 ==> same return as mode + 2 + (mode & 1). These modes are mainly for + debugging; often they run slower but sometimes + faster than modes 2-3. + 4,5,8,9 ==> left-to-right digit generation. + 6-9 ==> don't try fast floating-point estimate + (if applicable). + + Values of mode other than 0-9 are treated as mode 0. + + Sufficient space is allocated to the return value + to hold the suppressed trailing zeros. + */ + + int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1, + j, j1, k, k0, k_check, leftright, m2, m5, s2, s5, + spec_case, try_quick; + Long L; +#ifndef Sudden_Underflow + int denorm; + ULong x; +#endif + Bigint *b, *b1, *delta, *mlo, *mhi, *S; + double d2, ds, eps; + char *s, *s0; + static Bigint *result; + static int result_k; + + if (result) { + result->k = result_k; + result->maxwds = 1 << result_k; + Bfree(result); + result = 0; + } + + if (word0(d) & Sign_bit) { + /* set sign for everything, including 0's and NaNs */ + *sign = 1; + word0(d) &= ~Sign_bit; /* clear sign bit */ + } + else + *sign = 0; + +#if defined(IEEE_Arith) + defined(VAX) +#ifdef IEEE_Arith + if ((word0(d) & Exp_mask) == Exp_mask) +#else + if (word0(d) == 0x8000) +#endif + { + /* Infinity or NaN */ + *decpt = 9999; + s = +#ifdef IEEE_Arith + !word1(d) && !(word0(d) & 0xfffff) ? "Infinity" : +#endif + "NaN"; + if (rve) + *rve = +#ifdef IEEE_Arith + s[3] ? s + 8 : +#endif + s + 3; + return s; + } +#endif +#ifdef IBM + d += 0; /* normalize */ +#endif + if (!d) { + *decpt = 1; + s = "0"; + if (rve) + *rve = s + 1; + return s; + } + + b = d2b(d, &be, &bbits); +#ifdef Sudden_Underflow + i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1)); +#else + if (i = (int)(word0(d) >> Exp_shift1 & (Exp_mask>>Exp_shift1))) { +#endif + d2 = d; + word0(d2) &= Frac_mask1; + word0(d2) |= Exp_11; +#ifdef IBM + if (j = 11 - hi0bits(word0(d2) & Frac_mask)) + d2 /= 1 << j; +#endif + + /* log(x) ~=~ log(1.5) + (x-1.5)/1.5 + * log10(x) = log(x) / log(10) + * ~=~ log(1.5)/log(10) + (x-1.5)/(1.5*log(10)) + * log10(d) = (i-Bias)*log(2)/log(10) + log10(d2) + * + * This suggests computing an approximation k to log10(d) by + * + * k = (i - Bias)*0.301029995663981 + * + ( (d2-1.5)*0.289529654602168 + 0.176091259055681 ); + * + * We want k to be too large rather than too small. + * The error in the first-order Taylor series approximation + * is in our favor, so we just round up the constant enough + * to compensate for any error in the multiplication of + * (i - Bias) by 0.301029995663981; since |i - Bias| <= 1077, + * and 1077 * 0.30103 * 2^-52 ~=~ 7.2e-14, + * adding 1e-13 to the constant term more than suffices. + * Hence we adjust the constant term to 0.1760912590558. + * (We could get a more accurate k by invoking log10, + * but this is probably not worthwhile.) + */ + + i -= Bias; +#ifdef IBM + i <<= 2; + i += j; +#endif +#ifndef Sudden_Underflow + denorm = 0; + } + else { + /* d is denormalized */ + + i = bbits + be + (Bias + (P-1) - 1); + x = i > 32 ? word0(d) << 64 - i | word1(d) >> i - 32 + : word1(d) << 32 - i; + d2 = x; + word0(d2) -= 31*Exp_msk1; /* adjust exponent */ + i -= (Bias + (P-1) - 1) + 1; + denorm = 1; + } +#endif + ds = (d2-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981; + k = (int)ds; + if (ds < 0. && ds != k) + k--; /* want k = floor(ds) */ + k_check = 1; + if (k >= 0 && k <= Ten_pmax) { + if (d < tens[k]) + k--; + k_check = 0; + } + j = bbits - i - 1; + if (j >= 0) { + b2 = 0; + s2 = j; + } + else { + b2 = -j; + s2 = 0; + } + if (k >= 0) { + b5 = 0; + s5 = k; + s2 += k; + } + else { + b2 -= k; + b5 = -k; + s5 = 0; + } + if (mode < 0 || mode > 9) + mode = 0; + try_quick = 1; + if (mode > 5) { + mode -= 4; + try_quick = 0; + } + leftright = 1; + switch(mode) { + case 0: + case 1: + ilim = ilim1 = -1; + i = 18; + ndigits = 0; + break; + case 2: + leftright = 0; + /* no break */ + case 4: + if (ndigits <= 0) + ndigits = 1; + ilim = ilim1 = i = ndigits; + break; + case 3: + leftright = 0; + /* no break */ + case 5: + i = ndigits + k + 1; + ilim = i; + ilim1 = i - 1; + if (i <= 0) + i = 1; + } + j = sizeof(ULong); + for(result_k = 0; sizeof(Bigint) - sizeof(ULong) + j <= i; + j <<= 1) result_k++; + result = Balloc(result_k); + s = s0 = (char *)result; + + if (ilim >= 0 && ilim <= Quick_max && try_quick) { + + /* Try to get by with floating-point arithmetic. */ + + i = 0; + d2 = d; + k0 = k; + ilim0 = ilim; + ieps = 2; /* conservative */ + if (k > 0) { + ds = tens[k&0xf]; + j = k >> 4; + if (j & Bletch) { + /* prevent overflows */ + j &= Bletch - 1; + d /= bigtens[n_bigtens-1]; + ieps++; + } + for(; j; j >>= 1, i++) + if (j & 1) { + ieps++; + ds *= bigtens[i]; + } + d /= ds; + } + else if (j1 = -k) { + d *= tens[j1 & 0xf]; + for(j = j1 >> 4; j; j >>= 1, i++) + if (j & 1) { + ieps++; + d *= bigtens[i]; + } + } + if (k_check && d < 1. && ilim > 0) { + if (ilim1 <= 0) + goto fast_failed; + ilim = ilim1; + k--; + d *= 10.; + ieps++; + } + eps = ieps*d + 7.; + word0(eps) -= (P-1)*Exp_msk1; + if (ilim == 0) { + S = mhi = 0; + d -= 5.; + if (d > eps) + goto one_digit; + if (d < -eps) + goto no_digits; + goto fast_failed; + } +#ifndef No_leftright + if (leftright) { + /* Use Steele & White method of only + * generating digits needed. + */ + eps = 0.5/tens[ilim-1] - eps; + for(i = 0;;) { + L = d; + d -= L; + *s++ = '0' + (int)L; + if (d < eps) + goto ret1; + if (1. - d < eps) + goto bump_up; + if (++i >= ilim) + break; + eps *= 10.; + d *= 10.; + } + } + else { +#endif + /* Generate ilim digits, then fix them up. */ + eps *= tens[ilim-1]; + for(i = 1;; i++, d *= 10.) { + L = d; + d -= L; + *s++ = '0' + (int)L; + if (i == ilim) { + if (d > 0.5 + eps) + goto bump_up; + else if (d < 0.5 - eps) { + while(*--s == '0'); + s++; + goto ret1; + } + break; + } + } +#ifndef No_leftright + } +#endif + fast_failed: + s = s0; + d = d2; + k = k0; + ilim = ilim0; + } + + /* Do we have a "small" integer? */ + + if (be >= 0 && k <= Int_max) { + /* Yes. */ + ds = tens[k]; + if (ndigits < 0 && ilim <= 0) { + S = mhi = 0; + if (ilim < 0 || d <= 5*ds) + goto no_digits; + goto one_digit; + } + for(i = 1;; i++) { + L = d / ds; + d -= L*ds; +#ifdef Check_FLT_ROUNDS + /* If FLT_ROUNDS == 2, L will usually be high by 1 */ + if (d < 0) { + L--; + d += ds; + } +#endif + *s++ = '0' + (int)L; + if (i == ilim) { + d += d; + if (d > ds || d == ds && L & 1) { + bump_up: + while(*--s == '9') + if (s == s0) { + k++; + *s = '0'; + break; + } + ++*s++; + } + break; + } + if (!(d *= 10.)) + break; + } + goto ret1; + } + + m2 = b2; + m5 = b5; + mhi = mlo = 0; + if (leftright) { + if (mode < 2) { + i = +#ifndef Sudden_Underflow + denorm ? be + (Bias + (P-1) - 1 + 1) : +#endif +#ifdef IBM + 1 + 4*P - 3 - bbits + ((bbits + be - 1) & 3); +#else + 1 + P - bbits; +#endif + } + else { + j = ilim - 1; + if (m5 >= j) + m5 -= j; + else { + s5 += j -= m5; + b5 += j; + m5 = 0; + } + if ((i = ilim) < 0) { + m2 -= i; + i = 0; + } + } + b2 += i; + s2 += i; + mhi = i2b(1); + } + if (m2 > 0 && s2 > 0) { + i = m2 < s2 ? m2 : s2; + b2 -= i; + m2 -= i; + s2 -= i; + } + if (b5 > 0) { + if (leftright) { + if (m5 > 0) { + mhi = pow5mult(mhi, m5); + b1 = mult(mhi, b); + Bfree(b); + b = b1; + } + if (j = b5 - m5) + b = pow5mult(b, j); + } + else + b = pow5mult(b, b5); + } + S = i2b(1); + if (s5 > 0) + S = pow5mult(S, s5); + + /* Check for special case that d is a normalized power of 2. */ + + if (mode < 2) { + if (!word1(d) && !(word0(d) & Bndry_mask) +#ifndef Sudden_Underflow + && word0(d) & Exp_mask +#endif + ) { + /* The special case */ + b2 += Log2P; + s2 += Log2P; + spec_case = 1; + } + else + spec_case = 0; + } + + /* Arrange for convenient computation of quotients: + * shift left if necessary so divisor has 4 leading 0 bits. + * + * Perhaps we should just compute leading 28 bits of S once + * and for all and pass them and a shift to quorem, so it + * can do shifts and ors to compute the numerator for q. + */ +#ifdef Pack_32 + if (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0x1f) + i = 32 - i; +#else + if (i = ((s5 ? 32 - hi0bits(S->x[S->wds-1]) : 1) + s2) & 0xf) + i = 16 - i; +#endif + if (i > 4) { + i -= 4; + b2 += i; + m2 += i; + s2 += i; + } + else if (i < 4) { + i += 28; + b2 += i; + m2 += i; + s2 += i; + } + if (b2 > 0) + b = lshift(b, b2); + if (s2 > 0) + S = lshift(S, s2); + if (k_check) { + if (cmp(b,S) < 0) { + k--; + b = multadd(b, 10, 0); /* we botched the k estimate */ + if (leftright) + mhi = multadd(mhi, 10, 0); + ilim = ilim1; + } + } + if (ilim <= 0 && mode > 2) { + if (ilim < 0 || cmp(b,S = multadd(S,5,0)) <= 0) { + /* no digits, fcvt style */ + no_digits: + k = -1 - ndigits; + goto ret; + } + one_digit: + *s++ = '1'; + k++; + goto ret; + } + if (leftright) { + if (m2 > 0) + mhi = lshift(mhi, m2); + + /* Compute mlo -- check for special case + * that d is a normalized power of 2. + */ + + mlo = mhi; + if (spec_case) { + mhi = Balloc(mhi->k); + Bcopy(mhi, mlo); + mhi = lshift(mhi, Log2P); + } + + for(i = 1;;i++) { + dig = quorem(b,S) + '0'; + /* Do we yet have the shortest decimal string + * that will round to d? + */ + j = cmp(b, mlo); + delta = diff(S, mhi); + j1 = delta->sign ? 1 : cmp(b, delta); + Bfree(delta); +#ifndef ROUND_BIASED + if (j1 == 0 && !mode && !(word1(d) & 1)) { + if (dig == '9') + goto round_9_up; + if (j > 0) + dig++; + *s++ = dig; + goto ret; + } +#endif + if (j < 0 || j == 0 && !mode +#ifndef ROUND_BIASED + && !(word1(d) & 1) +#endif + ) { + if (j1 > 0) { + b = lshift(b, 1); + j1 = cmp(b, S); + if ((j1 > 0 || j1 == 0 && dig & 1) + && dig++ == '9') + goto round_9_up; + } + *s++ = dig; + goto ret; + } + if (j1 > 0) { + if (dig == '9') { /* possible if i == 1 */ + round_9_up: + *s++ = '9'; + goto roundoff; + } + *s++ = dig + 1; + goto ret; + } + *s++ = dig; + if (i == ilim) + break; + b = multadd(b, 10, 0); + if (mlo == mhi) + mlo = mhi = multadd(mhi, 10, 0); + else { + mlo = multadd(mlo, 10, 0); + mhi = multadd(mhi, 10, 0); + } + } + } + else + for(i = 1;; i++) { + *s++ = dig = quorem(b,S) + '0'; + if (i >= ilim) + break; + b = multadd(b, 10, 0); + } + + /* Round off last digit */ + + b = lshift(b, 1); + j = cmp(b, S); + if (j > 0 || j == 0 && dig & 1) { + roundoff: + while(*--s == '9') + if (s == s0) { + k++; + *s++ = '1'; + goto ret; + } + ++*s++; + } + else { + while(*--s == '0'); + s++; + } + ret: + Bfree(S); + if (mhi) { + if (mlo && mlo != mhi) + Bfree(mlo); + Bfree(mhi); + } + ret1: + Bfree(b); + if (s == s0) { /* don't return empty string */ + *s++ = '0'; + k = 0; + } + *s = 0; + *decpt = k + 1; + if (rve) + *rve = s; + return s0; + } +#ifdef __cplusplus +} +#endif diff --git a/scsilib/libschily/swabbytes.c b/scsilib/libschily/swabbytes.c new file mode 100644 index 0000000..6342774 --- /dev/null +++ b/scsilib/libschily/swabbytes.c @@ -0,0 +1,44 @@ +/* @(#)swabbytes.c 1.6 03/06/15 Copyright 1988, 1995-2003 J. Schilling */ +/* + * swab bytes in memory + * + * Copyright (c) 1988, 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <standard.h> +#include <schily.h> + +#define DO8(a) a; a; a; a; a; a; a; a; + +EXPORT void +swabbytes(vp, cnt) + void *vp; + register int cnt; +{ + register char *bp = (char *)vp; + register char c; + + cnt /= 2; /* even count only */ + while ((cnt -= 8) >= 0) { + DO8(c = *bp++; bp[-1] = *bp; *bp++ = c;); + } + cnt += 8; + while (--cnt >= 0) { + c = *bp++; bp[-1] = *bp; *bp++ = c; + } +} diff --git a/scsilib/libschily/usleep.c b/scsilib/libschily/usleep.c new file mode 100644 index 0000000..622a5e6 --- /dev/null +++ b/scsilib/libschily/usleep.c @@ -0,0 +1,132 @@ +/* @(#)usleep.c 1.17 03/06/15 Copyright 1995-2003 J. Schilling */ +#ifndef lint +static char sccsid[] = + "@(#)usleep.c 1.17 03/06/15 Copyright 1995-2003 J. Schilling"; +#endif +/* + * Copyright (c) 1995-2003 J. Schilling + */ +/* + * This program 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, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; see the file COPYING. If not, write to the Free Software + * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +#include <mconfig.h> +#define usleep __nothing_ /* prototype in unistd.h may be different */ +#include <standard.h> +#include <stdxlib.h> +#include <timedefs.h> +#ifdef HAVE_POLL_H +# include <poll.h> +#else +# ifdef HAVE_SYS_POLL_H +# include <sys/poll.h> +# endif +#endif +#ifdef HAVE_SYS_SYSTEMINFO_H +#include <sys/systeminfo.h> +#endif +#include <libport.h> +#undef usleep + +#ifndef HAVE_USLEEP +EXPORT int usleep __PR((int usec)); +#endif + +#ifdef OPENSERVER +/* + * Don't use the usleep() from libc on SCO's OPENSERVER. + * It will kill our processes with SIGALRM. + * SCO has a usleep() prototype in unistd.h, for this reason we + * #define usleep to __nothing__ before including unistd.h + */ +#undef HAVE_USLEEP +#endif + +#ifdef apollo +/* + * Apollo sys5.3 usleep is broken. Define a version based on time_$wait. + */ +#include <apollo/base.h> +#include <apollo/time.h> +#undef HAVE_USLEEP +#endif + +#if !defined(HAVE_USLEEP) + +EXPORT int +usleep(usec) + int usec; +{ +#if defined(apollo) + /* + * Need to check apollo before HAVE_SELECT, because Apollo has select, + * but it's time wait feature is also broken :-( + */ +#define HAVE_USLEEP + /* + * XXX Do these vars need to be static on Domain/OS ??? + */ + static time_$clock_t DomainDelay; + static status_$t DomainStatus; + + /* + * DomainDelay is a 48 bit value that defines how many 4uS periods to + * delay. Since the input value range is 32 bits, the upper 16 bits of + * DomainDelay must be zero. So we just divide the input value by 4 to + * determine how many "ticks" to wait + */ + DomainDelay.c2.high16 = 0; + DomainDelay.c2.low32 = usec / 4; + time_$wait(time_$relative, DomainDelay, &DomainStatus); +#endif /* Apollo */ + +#if defined(HAVE_SELECT) && !defined(HAVE_USLEEP) +#define HAVE_USLEEP + + struct timeval tv; + tv.tv_sec = usec / 1000000; + tv.tv_usec = usec % 1000000; + select(0, 0, 0, 0, &tv); +#endif + +#if defined(HAVE_POLL) && !defined(HAVE_USLEEP) +#define HAVE_USLEEP + + if (poll(0, 0, usec/1000) < 0) + comerr("poll delay failed.\n"); + +#endif + +#if defined(HAVE_NANOSLEEP) && !defined(HAVE_USLEEP) +#define HAVE_USLEEP + + struct timespec ts; + + ts.tv_sec = usec / 1000000; + ts.tv_nsec = (usec % 1000000) * 1000; + + nanosleep(&ts, 0); +#endif + + +#if !defined(HAVE_USLEEP) +#define HAVE_USLEEP + + sleep((usec+500000)/1000000); +#endif + + return (0); +} +#endif diff --git a/scsilib/make_diskt@2.sh b/scsilib/make_diskt@2.sh new file mode 100644 index 0000000..a93c8ed --- /dev/null +++ b/scsilib/make_diskt@2.sh @@ -0,0 +1,56 @@ +#!/bin/sh + +# exit on all errors +set -e + +if [ ! -f "$1" ];then + echo "Usage: `basename $0` [imagefile.ext] [-o|-i]" + echo "-o will make the bottom of the image be on the outside of the disk" + echo "-i will make the bottom of the image be on the inside of the disk" + echo + echo "Image must be greyscale" + echo + echo "make sure the imagefile has the right x-y format" + echo "run cdrecord driveropts=tattooinfo -checkdrive" + echo "to find out" + exit 1 +fi + + +case "$2" in + -i) + convopts="-flip" + ;; + -o) + convopts="-flop" + ;; + *) + echo "error: arg2 must be -o or -i" + exit 1 + ;; +esac + +echo "Make sure the imagefile has the right size" +echo "run cdrecord dev=a,b,c driveropts=tattooinfo -checkdrive" +echo "to find out" +echo +echo -n "Converting $1 to disktattoo_image format: " + +## convert it tp ppm format +## note.. -flop = flip horizontally +convert $convopts "$1" "$1-TMP-$$.ppm" + +## We only need the data, which is the last line in a ppm file +## tail works mighty fine for this (insert evil dirty-coder-laughter here) +tail -n+4 "$1-TMP-$$.ppm" > "$1.disktattoo_image" + +## clean up like a good boy +rm "$1-TMP-$$.ppm" + +## notify user that we're done converting +echo "done" +echo + +## stop with stupid code commenting +echo "You may now burn '$1.disktattoo_image' to your cd with the command:" +echo "cdrecord driveropts=tattoofile=\"$1.disktattoo_image\" -checkdrive" diff --git a/scsilib/man/Makefile b/scsilib/man/Makefile new file mode 100644 index 0000000..8d62749 --- /dev/null +++ b/scsilib/man/Makefile @@ -0,0 +1,14 @@ +#ident %W% %E% %Q% +########################################################################### +# Sample makefile for sub directory makes +########################################################################### +SRCROOT= .. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +DIRS= man4 + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.dir +########################################################################### diff --git a/scsilib/man/man4/Makefile b/scsilib/man/man4/Makefile new file mode 100644 index 0000000..3b1c906 --- /dev/null +++ b/scsilib/man/man4/Makefile @@ -0,0 +1,14 @@ +#ident "%W% %E% %Q%" +########################################################################### +# Sample makefile for sub-makes in one directory +########################################################################### +SRCROOT= ../.. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +MK_FILES= makefiles.mk makerules.mk + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.mks +########################################################################### diff --git a/scsilib/man/man4/makefiles.4 b/scsilib/man/man4/makefiles.4 new file mode 100644 index 0000000..93d6b77 --- /dev/null +++ b/scsilib/man/man4/makefiles.4 @@ -0,0 +1,1975 @@ +. \" @(#)makefiles.4 1.6 01/04/29 Copyr 1996 J. Schilling +. \" User Manual page for makefile system +. \" +.if t .ds a \v'-0.55m'\h'0.00n'\z.\h'0.40n'\z.\v'0.55m'\h'-0.40n'a +.if t .ds o \v'-0.55m'\h'0.00n'\z.\h'0.45n'\z.\v'0.55m'\h'-0.45n'o +.if t .ds u \v'-0.55m'\h'0.00n'\z.\h'0.40n'\z.\v'0.55m'\h'-0.40n'u +.if t .ds A \v'-0.77m'\h'0.25n'\z.\h'0.45n'\z.\v'0.77m'\h'-0.70n'A +.if t .ds O \v'-0.77m'\h'0.25n'\z.\h'0.45n'\z.\v'0.77m'\h'-0.70n'O +.if t .ds U \v'-0.77m'\h'0.30n'\z.\h'0.45n'\z.\v'0.77m'\h'-.75n'U +.if t .ds s \(*b +.if t .ds S SS +.if n .ds a ae +.if n .ds o oe +.if n .ds u ue +.if n .ds s sz +.\".TH makefiles 4L "14. February 1997" "J\*org Schilling" "Schily\'s FILE FORMATS" +.TH makefiles 4L "14. February 1997" "J\*org Schilling" "GMD FOKUS FILE FORMATS" +.SH NAME +makefiles \- users guide for compiling projects on different platforms +.SH SYNOPSIS +.B "make [target] +.br +.B "gmake [target] +.br +.B "smake [target] +.br +.PP +Target may be one of: +.TP 10 +\&.help +to get a list of possible targets and a short description. +.TP +all +to make the default targets +.TP +install +to make and install the default targets +(see +.IR INS_BASE " and " INS_KBASE +to learn how to modify the installation path). +.TP +ibins +to make and install a target in +.I SRCROOT/bins +.TP +depend +to re-make dependency rules for all default targets. +Note: All dependency files will automatically remade +on the next run of make before they are included. +.TP +clean +to remove +.I core +files and all intermediate object files. +.TP +clobber +to remove the targets from +.IR clean , +all dependency files and all final targets +.TP +distclean +to remove the targets from +.IR clean " and " clobber +and all made files for all architectures. +.TP +tags +to make +.IR vi (1) +compatible tags +.TP +TAGS +to make +.IR emacs (1) +compatible tags +.TP +config +reserved for future use. +.TP +rmtarget +to remove the default target +.TP +relink +to remove the default target and remake it immediately. This can be +used to change .e.g LD_RUN_PATH in the executable. + +.SH DESCRIPTION +Makefiles is a set of rules that allows compiling of structured +projects with small and uniformly structured makefiles. +All rules are located in a central directory. +Compiling the projects on different platforms can be done +simultaneously without +the need to modify any of the makefiles that are located +in the projects directories. +.PP +Makefiles is a set of high level portability tools superior to +.B autoconf +and easier to use. +.PP +Three make programs are supported: +.IR "Sunpro make" , +.I "GNU make" +and +.IR smake . +.PP +.I BSDmake +could be supported if it supports pattern matching rules correctly. +.PP +The main design goal was to have a set of small and easy to read +makefiles, each located in the project's leaf directory and therefore +called +.IR leaf -makefile. +.PP +Each of these +.IR leaf -makefiles, +in fact contains no rule at all. It simply defines some macros +for the +.IR make -program +and includes two files from a central make rule depository. +The included files and the files that are recursively included +define the rules that are needed to compile the project. +.PP +Each +.IR leaf -makefile +is formed in a really simple way: +.TP +\(bu +It first defines two macros that define the relative location +of the project's root directory and the name of the directory +that contains the complete set of of rules and then includes +the rule file +.I rules.top +from the directory that forms the central rule depository. +You only have to edit the macro +.I SRCROOT +to reflect the relative location of the project's root directory. +.TP +\(bu +The next part of a +.IR leaf -makefile +defines macros that describe the target and the source. +You can only have one target per +.IR leaf -makefile. +Of course, there may be many source files, that are needed to create +that target. +If you want to make more than one target in a specific directory, +you have to put more than one makefile into that directory. +This is the part of a makefile that describes a unique target. +Edit this part to contain all source files, all local include files +and all non global compile time flags that are needed for your target. +For a typical target this is as simple as filling in a form. +.TP +\(bu +Each +.IR leaf -makefile +finally includes a file from the rules directory that contains +rules for the appropriate type of target that is to be made +from this +.IR leaf -makefile. +.PP +The makefile in each directory has to be called +.IR Makefile . +If you want to have more than one makefile in a specific directory, +you have to choose different names for the other makefiles. +.PP +There are rules for the following type of targets: +.TP 20 +commands +The make rules for user level commands like +.IR cat ", " ls +etc. are located in the file +.I rules.cmd +.TP +drivers +The make rules for device drivers +are located in the file +.I rules.drv +.TP +libraries +The make rules for non shared libraries +are located in the file +.I rules.lib +.TP +shared libraries +The make rules for shared libraries +are located in the file +.I rules.shl +.TP +localized files +The make rules for localized files +are located in the file +.I rules.loc +.TP +nonlocalized files +The make rules for non localized files +are located in the file +.I rules.aux +.TP +shell scripts +The make rules for shell scripts (a variant of localized files) +are located in the file +.I rules.scr +.TP +manual pages +The make rules for manual pages (a variant of localized files) +are located in the file +.I rules.man +.TP +diverted makefiles +The make rules for projects that need to have more than +one makefile in a specific directory +are located in the file +.I rules.mks +It contains a rule that diverts to the listed sub makefiles. +Each sub makefile may be of any type. +.TP +directories +The make rules for sub directories +are located in the file +.I rules.dir + +.SH "Macros/Variables Used In Rules +.PP +The following is a description of the most important macros +used within the make rules. +.I NOTE: +not all of them might be changed in a specific makefile. +Carefully read the description and change only those macros +that are intended to be used to change the behavior of +the compilation. + +.TP 13 +ARCHDIR +contains the location where object files and make targets will be placed. +A typical name would be: +.I "OBJ/sparc\-sunos5\-cc +.br +Do not change this macro. +. +.TP +ASFLAGS +The flags that are used with the assembler. +.br +Do not change this macro. +. +.TP +ASMFILES +a list of assembler source files, to be specified in a +leaf makefile. +. +.TP +ASOPTS +The internal macro that contains the flags for the assembler. +Change this macro if you want to change the behavior. +Use: +.B "ASOPTS= value" +If you want to override the default value. If you want to +override the default assembler flags from the command line +call: +.B "make 'ASOPTS=value'" +Use: +.B "ASOPTS += value" +If you want to add flags to the default value from within a makefile. +. +.TP +ASOPTX +may be used if you want to add flags to the assembler flags from the +command line. Use: +.B "make 'ASOPTX=value' +. +.TP +C_ARCH +this macro contains the c-compiler architecture name. +.br +Do not change this macro. +. +.TP +CCOM +This macro may be used from the command line to use a different +c-compiler than the default. +Use: +.B "make 'CCOM=gcc' +to use +.I gcc +for the next run. +Note: The value of +.I CCOM +must not necessarily be identical to the real name of the c-compiler. +It refers to a filename which contains the definition for that +c-compiler. This hint applies as well to all other macros that deal with +the name of the c-compiler. +The only macro, that contains the real invocation name of the c-compiler, +is +.IR CC . +.I CC +is set inside the machine dependent configuration file in the central +rules depository and must not be changed elsewhere. +. +.TP +CFILES +a list of C source files, to be specified in a +leaf makefile. +. +.TP +CFLAGS +The flags that are used with the c-compiler. +Do not use flags that belong to the c-preprocessor in the +.IR COPTOPT ", " COPTS " and " COPTX +macros. +.br +Do not change this macro. +. +.TP +CLEAN_FILES +A list of files ( besides the object files ) that will be +removed with +.IR "make clean" . +.br +Do not change this macro. +. +.TP +CLEAN_FILEX +this macro may be used to define additional files that should +be removed with +.IR "make clean" . +. +.TP +CLOBBER_FILEX +this macro may be used to define additional files that should +be removed with +.IR "make clobber" . +. +.TP +COPTOPT +The c-compiler optimization flag. This flag is intended to +be overridden either from a makefile or from command line. +. +.TP +COPTS +The internal macro that contains the flags for the c-compiler. +Change this macro if you want to change the behavior. +Use: +.B "COPTS= value" +If you want to override the default value. If you want to +override the default c-compiler flags from the command line +call: +.B "make 'COPTS=value'" +Use: +.B "COPTS += value" +If you want to add flags to the default value from within a makefile. +. +.TP +COPTX +may be used if you want to add flags to the c-compiler flags from the +command line. Use: +.B "make 'COPTX=value' +. +.TP +CPPFLAGS +The flags that are used with the c-preprocessor. +This macro as well as: +.IR CPPOPTS " and " CPPOPTX +are also used when compiling c-programs. +They should contain only the following flags: +.IR "\-Dname=value ", " \-Uname " , " +.IR \-Idirectory " and " \-Ydirectory . +.br +Do not change this macro. +. +.TP +CPPOPTS +The internal macro that contains the flags for the c-preprocessor. +Change this macro if you want to change the behavior. +Use: +.B "CPPOPTS= value" +If you want to override the default value. If you want to +override the default c-preprocessor flags from the command line +call: +.B "make 'CPPOPTS=value'" +Use: +.B "CPPOPTS += value" +If you want to add flags to the default value from within a makefile. +. +.TP +CPPOPTX +may be used if you want to add flags to the c-preprocessor flags from the +command line. Use: +.B "make 'CPPOPTX=value' +. +.TP +CURDIR +This macro contains the name of the sub directory that is currently processed. +.br +Do not change this macro. +. +.TP +CWARNOPTS +This macro may be set in +.I $(DEFLTSROOT)/$(DEFLTSDIR)/Defaults +or +.I $(DEFLTSROOT)/$(DEFLTSDIR)/Defaults.$(O_ARCH) +to overwrite the default c-compiler warn options. +. +.TP +CWOPTS +This macro is set inside the machine dependent configuration file in the central +rules depository and must not be changed elsewhere. +It contains the flags that set the default warning level for the c-compiler. +. +.TP +DEFINSGRP +this macro may be set in the projects defaults file to set up the +default group id for installation +.TP +DEFINSMODE +this macro may be set in the projects defaults file to set up the +default file permission for installation +.TP +DEFINSUSR +this macro may be set in the projects defaults file to set up the +default user id for installation +.TP +DEFUMASK +this macro may be set in the projects defaults file to set up the +default +.I umask +value for creating sub directories +. +.TP +DEFAULTSDIR +this macro may be set from command line or from the shell environment +if the user wants to use a different set of +.I Defaults +files that is not located in the directory +.B DEFAULTS +in the source root directory. +This may be used to hold two or more set of defaults that differ e.g. in the +installation path or the C-compiler. +. +.TP +DEFAULTSROOT +this macro may be set in a leaf makefile, if that makefile wants to use +a +.I Defaults +file that is not located in +.I $(DEFAULTSDIR) +in the source root. +This may be used, if a sub tree in a big project needs a different setup. +. +.TP +DEFLTSDIR +This is an internally used macro that is set from +.I $(DEFAULTSDIR) +or from the internal defaults. +.br +Do not change this macro. +. +.TP +DEFLTSROOT +This is an internally used macro that is set from +.I $(DEFAULTSROOT) +or from the internal defaults. +.br +Do not change this macro. +. +.TP +DEFCCOM +the default name of the c-compiler. This is usually set in the file +.I $(DEFLTSROOT)/$(DEFLTSDIR)/Defaults +or +.IR $(DEFLTSROOT)/$(DEFLTSDIR)/Defaults.$(O_ARCH) . +. +.TP +DEFINCDIRS +a list of directories that are searched by default in addition to +the system include directories. If this macro is not set, +.I $(SRCROOT)/include +is used. +. +.TP +DIRNAME +this macro needs to be set in the makefile that is located in +the +.I "$(SRCROOT) +directory. +The value should be either set to the name of the directory +where the makefile is located or to +.BR SRCROOT . +The value of this macro is updated automatically +to follow the directory hierarchy. +Do not change this macro in a make file other than the make file +in the source root. +. +.TP +DIRS +this macro needs to be set in a makefile that is located in +a directory that contains diversion directories. +It must contain a list of directory names where the diversions +go to e.g. +.BR "DIRS= libfoo libbar libgarbage" . +. +.TP +HFILES +for normal operation, +.I makefiles +will automatically find which include files are needed +for compilation. +However, if you want to create a tag file that includes +tags for definitions that occur within include files, +you should set +.I HFILES +to be a list of include files containing such definitions. +. +.TP +INCDIRS +this macro will normally be a copy from +.IR DEFINCDIRS . +You may however specify a different value in a leaf makefile +or from command line. This will overwrite the defaults value. +. +.TP +INS_BASE +this macro has to be specified in the file +.I $(DEFLTSROOT)/$(DEFLTSDIR)/Defaults +or +.IR $(DEFLTSROOT)/$(DEFLTSDIR)/Defaults.$(O_ARCH) . +It must contain the path name of the root for installing +general targets of the project. +See +.IR INSDIR . +. +.TP +INS_KBASE +this macro has to be specified in the file +.I $(DEFLTSROOT)/$(DEFLTSDIR)/Defaults +or +.IR $(DEFLTSROOT)/$(DEFLTSDIR)/Defaults.$(O_ARCH) . +It must contain the path name of the root for installing +kernel modules from the project. +See +.IR INSDIR . +. +.TP +INSDIR +this macro has to be specified in the leaf makefile. +It must contain the path name of a directory relative to +.IR INS_BASE " or " INS_KBASE . +The target will be installed into +.I "$(INS_BASE)/$(INSDIR)" . +. +.TP +INSGRP +this macro may be set in a leaf makefile to set up the +group id for installation +.TP +INSMODE +this macro may be set in a leaf makefile to set up the +file permission for installation +.TP +INSUSR +this macro may be set in a leaf makefile to set up the +user id for installation +. +.TP +K_ARCH +this macro contains the kernel/machine architecture for the +target machine (e.g. +.IR "sun3 sun4c sun4m sun4u 9000\-725 aviion" ). +It is set to the output of +.I "uname \-m +converted to lower case. +.br +Do not change this macro. +. +.TP +KARCH +this macro contains the kernel/machine architecture for the +target machine (e.g. +.IR "sun3 sun4c sun4m sun4u 9000\-725 aviion" ). +It is set to the output of +.I "uname \-m +converted to lower case. +.br +Do not change this macro unless you want to do a cross compilation. +. +.TP +LDFLAGS +The flags that are used with the linker. +.br +Do not change this macro. +. +.TP +LDLIBS +The internal macro that holds the +libraries that are used while linking the target. +.br +Do not change this macro. +. +.TP +LDOPTS +The internal macro that contains the flags for the linker. +Change this macro if you want to change the behavior. +Use: +.B "LDOPTS= value" +If you want to override the default value. If you want to +override the default linker flags from the command line +call: +.B "make 'LDOPTS=value'" +Use: +.B "LDOPTS += value" +If you want to add flags to the default value from within a makefile. +. +.TP +LDOPTX +may be used if you want to add flags to the linker flags from the +command line. Use: +.B "make 'LDOPTX=value' +. +.TP +LDPATH +the default library search path for the linker. +This is usually set in the file +.I $(DEFLTSROOT)/$(DEFLTSDIR)/Defaults +or +.IR $(DEFLTSROOT)/$(DEFLTSDIR)/Defaults.$(O_ARCH) . +. +.TP +LIB_KVM +a predefined macro that contains the operating system dependent +name of a library +that is needed by programs that read/write kernel virtual memory. +Add +.I "$(LIB_KVM) +to your list of libraries (e.g. +.BR "LIBS= \-lintl $(LIB_KVM)" ), +if your target uses kvm. +. +.TP +LIB_MATH +a predefined macro that contains the operating system dependent +name of a library +that is needed by programs that use routines of the math library. +Add +.I "$(LIB_MATH) +to your list of libraries (e.g. +.BR "LIBS= \-lintl $(LIB_MATH)" ), +if your target uses math subroutines. +. +.TP +LIB_SOCKET +a predefined macro that contains the operating system dependent +name of a library +that is needed by programs that use socket calls. +Add +.I "$(LIB_SOCKET) +to your list of libraries (e.g. +.BR "LIBS= \-lintl $(LIB_SOCKET)" ), +if your target uses sockets. Note: this should (for portability reasons) +even be done on systems that don't require a socket library because +they have the socket interface inside libc. +. +.TP +LIBS_PATH +this macro contains the path to a directory where those +libraries are located, that have been build during +a make run inside the current project. +.br +Do not change this macro. +. +.TP +M_ARCH +this macro contains the machine architecture for the +target machine (e.g. +.IR "sun3 sun4 ip22 i86pc i586 9000\-725 aviion" ). +It is set to the output of +.I "arch +converted to lower case. +On systems, where +.I M_ARCH +is not available, it is set to the content of +.IR K_ARCH . +.br +Do not change this macro. +. +.TP +MK_FILES +makefiles that divert into sub makes within the same directory +must set +.I MK_FILES +to be a list of makefile names for the sub makes. +Makefile names for sub makes should have a name that is build +by adding +.I .mk +to the base name of the target that is defined inside the +specific makefile. +. +.TP +MAKEPROG +Set this macro to the name of your make program if it does +not support the macro +.IR MAKE_NAME . +The make program +.I smake +is able to identify itself. +If you want to use a make program that is not able +to identify itself +and it's name is not +.IR make , +set +.I MAKEPROG +to the name of the make program. +Currently only +.I gmake +is supported as alternate value for +.IR MAKEPROG . +If you want to use an unsupported make program +you have to check if it supports the needed features +for +.IR makefiles . +You must write your own rule files for that make program. +If you want to use +.IR gmake , +you should do +.B "setenv MAKEPROG gmake +before you start +.I gmake +or use a shell script that does this job for you. +. +.TP +MAKE +This macro is set up by the +.I make +program. +It contains a path name that is sufficient to recursively +call the same +.I make +program again (either that last path component or the full path +name of the make program). +.br +Do not change this macro. +. +.TP +MAKEFLAGS +This macro is set up by the +.I make +program. +It contains the command line flags, +.I make +is called with. +.br +Do not change this macro. +. +.TP +MAKE_ARCH +This macro is currently set up by +.B smake +only. +It contains the processor architecture of the target machine +(e.g. mc68020, sparc, pentium). +.br +Do not change this macro. +. +.TP +MAKE_BRAND +This macro is currently set up by +.B smake +only. +It contains the brand of the target machine +(e.g. Sun_Microsystems(e.g. ). +.br +Do not change this macro. +. +.TP +MAKE_HOST +This macro is currently set up by +.B smake +only. +It contains the host name of the target machine +(e.g. duffy, sherwood, ghost). +.br +Do not change this macro. +. +.TP +MAKE_MACH +This macro is currently set up by +.B smake +only. +It contains the kernel architecture of the target machine +(e.g. sun3, sun4c, sun4m, sun4u). +.br +Do not change this macro. +. +.TP +MAKE_MODEL +This macro is currently set up by +.B smake +only. +It contains the model name of the target machine +(e.g. SUNW,SPARCstation-20). +.br +Do not change this macro. +. +.TP +MAKE_M_ARCH +This macro is currently set up by +.B smake +only. +It contains the machine architecture of the target machine +(e.g. sun3, sun4). +.br +Do not change this macro. +. +.TP +MAKE_NAME +This macro is currently set up by +.B smake +only. +It contains the official name of the +make program +(e.g. make, smake, gmake). +.br +Do not change this macro. +. +.TP +MAKE_OS +This macro is currently set up by +.B smake +only. +It contains the operating system name of the target machine +(e.g. sunos, linux, dgux). +.br +Do not change this macro. +. +.TP +MAKE_OSDEFS +This macro is currently set up by +.B smake +only. +It contains operating system specific defines for the compiler +(e.g. -D__SVR4). +.br +Do not change this macro. +. +.TP +MAKE_OSREL +This macro is currently set up by +.B smake +only. +It contains the operating system release name of the target machine +(e.g. 5.5, 4.1.1). +.br +Do not change this macro. +. +.TP +MAKE_OSVERSION +This macro is currently set up by +.B smake +only. +It contains the operating system version of the target machine +(e.g. generic). +.br +Do not change this macro. +. +.TP +MAKE_SERIAL +This macro is currently set up by +.B smake +only. +It contains the serial number of the target machine +(e.g. 1920098175). +.br +Do not change this macro. +. +.TP +MANDIR +all makefiles for manual pages must set this macro to the +path name relative to +.I INS_BASE +where the manual page root dir for the project should be. +Possible values for english manual pages are +.IR man " or " share/man , +possible values for german manual pages are +.IR man/de " or " share/man/de . +. +.TP +MANFILE +makefiles for manual pages set this macro to the name of the +troff source file for the manual page +. +.TP +MANSECT +makefiles for manual pages set this macro to the macro name that +contains the real section name for this manual page. This is +necessary because bsd based system have different naming conventions than +system V based systems. See below for a valid list of manual section +macros. +.TP +MANSECT_ADMIN +This macro contains the name of the sub directory for administrative +commands and maintenance procedures. +.br +Do not change this macro. +.TP +MANSECT_CMD +This macro contains the name of the sub directory for general +user commands. +.br +Do not change this macro. +.TP +MANSECT_DEMOS +This macro contains the name of the sub directory for demo +commands. +.br +Do not change this macro. +.TP +MANSECT_DEVICE +This macro contains the name of the sub directory for +user level device interfaces. +.br +Do not change this macro. +.TP +MANSECT_DRIVER +This macro contains the name of the sub directory for +kernel level device driver interfaces. +.br +Do not change this macro. +.TP +MANSECT_FILEFORM +This macro contains the name of the sub directory for +file formats. +.br +Do not change this macro. +.TP +MANSECT_GAMES +This macro contains the name of the sub directory for +games. +.br +Do not change this macro. +.TP +MANSECT_HDR +This macro contains the name of the sub directory for +header files. +.br +Do not change this macro. +.TP +MANSECT_LIB +This macro contains the name of the sub directory for +library function interfaces. +.br +Do not change this macro. +.TP +MANSECT_MACROS +This macro contains the name of the sub directory for +troff macros. +.br +Do not change this macro. +.TP +MANSECT_NETWORK +This macro contains the name of the sub directory for +user level network interfaces. +.br +Do not change this macro. +.TP +MANSECT_SYSCALL +This macro contains the name of the sub directory for +system call interfaces. +Do not change this macro. +.TP +MANSECT_TABLES +This macro contains the name of the sub directory for +tables. +Do not change this macro. +.TP +MANSTYLE +This macro contains the name that is used to find the right +ordering conventions for manual pages. +Do not change this macro. +.TP +MANSUFFIX +makefiles for manual pages set this macro to the macro name that +contains the real suffix for this manual page. This is +necessary because bsd based system have different naming conventions than +system V based systems. See below for a valid list of manual suffix +macros. +.TP +MANSUFF_ADMIN +This macro contains the name of the file suffix for administrative +commands and maintenance procedures. +.br +Do not change this macro. +.TP +MANSUFF_CMD +This macro contains the name of the file suffix for general +user commands. +.br +Do not change this macro. +.TP +MANSUFF_DEMOS +This macro contains the name of the file suffix for demo +commands. +.br +Do not change this macro. +.TP +MANSUFF_DEVICE +This macro contains the name of the file suffix for +user level device interfaces. +.br +Do not change this macro. +.TP +MANSUFF_DRIVER +This macro contains the name of the file suffix for +kernel level device driver interfaces. +.br +Do not change this macro. +.TP +MANSUFF_FILEFORM +This macro contains the name of the file suffix for +file formats. +.br +Do not change this macro. +.TP +MANSUFF_GAMES +This macro contains the name of the file suffix for +games. +.br +Do not change this macro. +.TP +MANSUFF_HDR +This macro contains the name of the file suffix for +header files. +.br +Do not change this macro. +.TP +MANSUFF_LIB +This macro contains the name of the file suffix for +library function interfaces. +.br +Do not change this macro. +.TP +MANSUFF_MACROS +This macro contains the name of the file suffix for +troff macros. +.br +Do not change this macro. +.TP +MANSUFF_NETWORK +This macro contains the name of the file suffix for +user level network interfaces. +.br +Do not change this macro. +.TP +MANSUFF_SYSCALL +This macro contains the name of the file suffix for +system call interfaces. +Do not change this macro. +.TP +MANSUFF_TABLES +This macro contains the name of the file suffix for +tables. +Do not change this macro. +.TP +MARCH +this macro contains the machine architecture for the +target machine (e.g. +.IR "sun3 sun4 ip22 i86pc i586 9000\-725 aviion" ). +It is set to the output of +.I "arch +converted to lower case. +On systems, where +.I M_ARCH +is not available, it is set to the content of +.IR K_ARCH . +.br +Do not change this macro unless you want to do a cross compilation. +. +.TP +O_ARCH +this macro contains the name of the operating system +converted to lower case. +It is usually the output of: +.IR "uname \-s" . +It may contain a modified name if the compilation rules +for different version of the operating system differ (e.g. +on +.IR SunOS " and " Solaris , +the official operation system name in both cases is +.IR SunOS ). +.br +Do not change this macro. +. +.TP +OARCH +this macro contains the object architecture that is used +for architecture dependent sub directories. +It is set to: +.IR "$(PARCH)\-$(O_ARCH)\-$(C_ARCH)" . +.br +Do not change this macro. +. +.TP +OARCHDIR +this macro contains the concatenation of +.I OBJ/ +and +.IR "$(OARCH)" . +.br +Do not change this macro. +. +.TP +OFILES +this macro contains the list of objects that are the +the dependency list for the target. +It is constructed from the list of +assembler source files, +c source files, +lex source files and +yacc source files. +.br +Do not change this macro. +. +.TP +OINCSDIR +this macro contains the concatenation of +.I $(SRCROOT)/incs/ +and +.IR "$(OARCH)" . +It is the location where include files that are made within a make run +and subject to global use will be placed. +.br +Do not change this macro. +.TP +OLIBSDIR +this macro contains the concatenation of +.I $(SRCROOT)/libs/ +and +.IR "$(OARCH)" . +It is the location where libraries that are made within a make run +will be placed. +.br +Do not change this macro. +. +.TP +OSDEFS +this macro contains operating system specific c-preprocessor +definitions. +.br +Do not change this macro. +. +.TP +OSNAME +the unmodified name of the operating system converted to lower case. +See +.IR O_ARCH . +.br +Do not change this macro. +. +.TP +OSREL +the release of the operating system. +.br +Do not change this macro. +. +.TP +P_ARCH +this macro contains the processor architecture for the +target machine (e.g. +.IR "mc68020 mc88200 sparc pentium" ). +It is set to the output of +.I "uname \-p +converted to lower case. +On systems, where +.I P_ARCH +is not available, it is set to the content of +.IR K_ARCH . +.br +Do not change this macro. +. +.TP +PARCH +this macro contains the processor architecture for the +target machine (e.g. +.IR "mc68020 mc88200 sparc pentium" ). +It is set to the output of +.I "uname \-p +converted to lower case. +On systems, where +.I P_ARCH +is not available, it is set to the content of +.IR K_ARCH . +.br +Do not change this macro unless you want to do a cross compilation. +. +.TP +RULESDIR +the value of this macro must be set before +the rules file +.I "$(SRCROOT)/$(RULESDIR/rules.top +is included. +If you want to test the behavior of a modified version +of the +.I makefiles +in +.IR RULESDIR , +put a copy into an alternate directory, modify one or more +files in it and then use make with a different value of +.IR RULESDIR , +that points to the alternate directory. +. +.TP +RUNPATH +is evaluated on systems, where +.I LD_RUN_PATH +is supported. +It contains the default library search path for dynamic linked targets +on runtime. +This search path will be stored inside the target. +This is usually set in the file +.I $(DEFLTSROOT)/$(DEFLTSDIR)/Defaults +or +.IR $(DEFLTSROOT)/$(DEFLTSDIR)/Defaults.$(O_ARCH) . +Note that older systems will use +.I LD_LIBRARY_PATH +for this purpose too. +. +.TP +SCRFILE +this macro must be set in a leaf makefile for shell scripts to define +the source for that script file. +. +.TP +SRCFILE +this macro must be set in a leaf makefile for localized files to define +the source for that file. +. +.TP +SRCROOT +this macro contains the relative position to the project's +source root directory. +The value of this macro must be set before +the rules file +.I "$(SRCROOT)/$(RULESDIR/rules.top +is included. +.I SRCROOT +should be set to +.I ../.. +if the appropriate leaf makefile is located two directory +levels below the source route. +. +.TP +SUBARCHDIR +may be set to put the object files and the target into +a different directory than usual. +.I SUBARCHDIR +will modify the value of +.IR ARCHDIR . +If you want to make a target that is compiled for +.I dbx +you may use: +.IR "make COPTX=\-g SUBARCHDIR=\-dbx" . +. +.TP +TARGET +all makefiles, that are not referring to library targets or +sub makes / sub dir makes, +must define +.I TARGET +to be the output file name of the final link operation. +. +.TP +TARGETLIB +all makefiles that are used to make libraries +must define +.I TARGETLIB +to be the central part of the target library. +If you want to make e.g. +.I libfoo +define +.IR "TARGETLIB= foo" . +This is needed to allow operating systems to have different naming +conventions for libraries. +If you are making a non shared library, the example above +would result in a filename: +.I libfoo.a +for the real target. +. +.TP +TARGETMAN +this macro must be set in a leaf makefile for manual pages to define +the base name for that manual page (not including the suffix). +. +.TP +XMK_FILE +makefiles that want to install manual pages should set +.I XMK_FILE +to +.B Makefile.man +to avoid having to install a diversion make file. +The make file found in +.I XMK_FILE +will be processed only if +.I make +is called with the target +.IR install . + +.SH "GETTING STARTED +.PP +To set up a new project, first copy the +.IR RULES " and " TEMPLATES +directories and all its content into the project's root directory. +.PP +Then copy a top level makefile, a +.I Defaults +file and a +.I Targetdirs.archname +file into the project's root directory. +.PP +Then create the following directories: +.IR cmd ", " lib ", " include . +.PP +Now start creating target directories e.g below +.IR cmd " and " lib . +Don't forget to create a makefile and an appropriate +.I Targetdirs.archname +file on each node directory. + +.SH EXAMPLES +.PP +If you want to set up a private copy of parts of a project, +you should choose a directory inside your directory tree that will become +the shadow projects source root directory. +Then create symbolic links named +.IR RULES " and " TEMPLATES +to the real source root. +If you don't want to modify the global include files, +create a symbolic link to the +.I include +directory too, else copy the include directory and its content. +copy the top level makefile, the +.I Defaults +file and the +.I Targetdirs.archname +file. +.PP +Finally copy the desired sub tree together with all +makefiles and the +.I Targetdirs.archname +files that are located in the directories above +your part of the project that you want to have separately. + +.SH FILES +\&.\|.\|./RULES/* +.br +\&.\|.\|./DEFAULTS/* +.br +\&.\|.\|./TARGETS/* +.br +\&.\|.\|./TEMPLATES/* + +.SH "SEE ALSO" +.BR makerules (4), +.BR make (1), +.BR gmake (1), +.BR smake (1). +.PP +If you want to know, how to add new rules or how to add support +for new operating systems or compilers look into +.BR makerules (4). + +.SH DIAGNOSTICS +Diagnostic messages depend on the make program. +Have a look at the appropriate man page. + +.SH NOTES +The scope of this manual is only the usage of +.BR "leaf makefiles" . +If you want to make changes to the +.B make rules +have a look at +.BR makerules (4). +.PP +.I makefiles +can be used with +.IR "Sunpro make" ", " "Gnu make" +and +.IR smake . +Although Gnu make runs on many platforms, it has no useful debug +output. +.PP +Use +.IR "Sunpro make" " or " "smake" +if you have problems with a makefile. +.IR "Sunpro make" " and " "smake" , +both have a \-D flag, that allows you to watch the makefiles +after the first expansion. Use this option, if you are in doubt +if your makefile gets expanded the right way and if the right +rules are included. +There is also a \-d option that gives debugging output while +make is running. If you want more output, use \-dd, \-ddd and so on. +.PP +.I Smake +has an option \-xM that shows you the include dependency for +make rules. + +.PP +.ne 20 +The following is a list of all macros that are used in +.IR makefiles . +Do not use them unless their meaning has been explained +before. +.PP + +.BR \-O_ARCH , +.BR .OBJDIR , +.BR .SEARCHLIST , +.BR ALLTARGETS , +.BR AR , +.BR ARCH , +.BR ARCHDIR , +.BR ARCHDIRX , +.BR ARCH_DONE , +.BR ARFLAGS , +.BR AS , +.BR ASFLAGS , +.BR ASMFILES , +.BR ASOPTS , +.BR ASOPTX , +.BR CC , +.BR CCOM , +.BR CCOM_DEF , +.BR CFILES , +.BR CFLAGS , +.BR CHGRP , +.BR CHMOD , +.BR CHOWN , +.BR CLEAN_FILES , +.BR CLEAN_FILEX , +.BR CLOBBER_FILEX , +.BR COPTDYN , +.BR COPTGPROF , +.BR COPTOPT , +.BR COPTS , +.BR COPTX , +.BR CPP , +.BR CPPFLAGS , +.BR CPPOPTS , +.BR CPPOPTX , +.BR CTAGS , +.BR CURDIR , +.BR CWARNOPTS , +.BR CWOPTS , +.BR C_ARCH , +.BR DEFAULTSDIR , +.BR DEFAULTSROOT , +.BR DEFCCOM , +.BR DEFCCOM_DEF , +.BR DEFINCDIRS , +.BR DEFINCDIRS_DEF , +.BR DEFINSGRP , +.BR DEFINSMODE , +.BR DEFINSUSR , +.BR DEFUMASK , +.BR DEF_ROOT , +.BR DEP_DEP , +.BR DEP_FILE , +.BR DEP_SUFFIX , +.BR DIRNAME , +.BR DIRS , +.BR DYNLD , +.BR ETAGS , +.BR FLOAT_OPTIONS , +.BR HFILES , +.BR HOSTNAME , +.BR INCDIRS , +.BR INSDIR , +.BR INSGRP , +.BR INSGRP_DEF , +.BR INSMODE , +.BR INSMODE_DEF , +.BR INSTALL , +.BR INSUSR , +.BR INSUSR_DEF , +.BR INS_BASE , +.BR INS_KBASE , +.BR KARCH , +.BR KARCH_DEF , +.BR KDEFINES , +.BR K_ARCH , +.BR LD , +.BR LDCC , +.BR LDFLAGS , +.BR LDLIBS , +.BR LDOPTDYN , +.BR LDOPTS , +.BR LDOPTX , +.BR LDPATH , +.BR LIBS , +.BR LIBS_PATH , +.BR LIBX , +.BR LIB_KVM , +.BR LIB_MATH , +.BR LIB_PREFIX , +.BR LIB_SOCKET , +.BR LIB_SUFFIX , +.BR LN , +.BR LNDYNLIB , +.BR LOCALIZE , +.BR LORDER , +.BR MAKE , +.BR MK_FILES , +.BR MAKEPROG , +.BR MAKE_ARCH , +.BR MAKE_HOST , +.BR MAKE_MACH , +.BR MAKE_M_ARCH , +.BR MAKE_NAME , +.BR MAKE_OS , +.BR MAKE_OSDEFS , +.BR MAKE_OSREL , +.BR MANDIR , +.BR MANFILE , +.BR MANSECT , +.BR MANSECT_ADMIN , +.BR MANSECT_CMD , +.BR MANSECT_DEMOS , +.BR MANSECT_DEVICE , +.BR MANSECT_DRIVER , +.BR MANSECT_FILEFORM , +.BR MANSECT_GAMES , +.BR MANSECT_HDR , +.BR MANSECT_LIB , +.BR MANSECT_MACROS , +.BR MANSECT_NETWORK , +.BR MANSECT_SYSCALL , +.BR MANSECT_TABLES , +.BR MANSTYLE , +.BR MANSUFFIX , +.BR MANSUFF_ADMIN , +.BR MANSUFF_CMD , +.BR MANSUFF_DEMOS , +.BR MANSUFF_DEVICE , +.BR MANSUFF_DRIVER , +.BR MANSUFF_FILEFORM , +.BR MANSUFF_GAMES , +.BR MANSUFF_HDR , +.BR MANSUFF_LIB , +.BR MANSUFF_MACROS , +.BR MANSUFF_NETWORK , +.BR MANSUFF_SYSCALL , +.BR MANSUFF_TABLES , +.BR MARCH , +.BR MARCH_DEF , +.BR MKDEP , +.BR MKDEP_OUT , +.BR MKDIR , +.BR MV , +.BR M_ARCH , +.BR OARCH , +.BR OARCHDIR , +.BR OFILES , +.BR OINCSDIR , +.BR OLIBSDIR , +.BR OSDEFS , +.BR OSNAME , +.BR OSREL , +.BR O_ARCH , +.BR PALLDEP_FILE , +.BR PARCH , +.BR PARCH_DEF , +.BR PASMFILES , +.BR PDEP_FILE , +.BR PLOFILES , +.BR POFILES , +.BR PTARGET , +.BR PTARGET_BASE , +.BR PYOFILES , +.BR P_ARCH , +.BR RANLIB , +.BR RM , +.BR RMDEP , +.BR RMTARGET , +.BR RM_FORCE , +.BR RM_RECURS , +.BR RM_RF , +.BR RULESDIR , +.BR RUNPATH , +.BR SCRFILE , +.BR SHELL , +.BR SHL_SUFFIX , +.BR SRCFILE , +.BR SRCLIBS , +.BR SRCROOT , +.BR SUBARCH , +.BR SUBARCHDIR , +.BR SYMLINK , +.BR TAGS , +.BR TARGET , +.BR TARGETLIB , +.BR TARGETMAN , +.BR TARGET_BASE , +.BR TARGET_PATH , +.BR TSORT , +.BR UMASK , +.BR UMASK_DEF , +.BR UMASK_VAL , +.BR XARCH , +.BR XK_ARCH , +.BR XMK_FILE , +.BR XMAKEPROG , +.BR XM_ARCH , +.BR XP_ARCH , +.BR _CCOM , +.BR _DEFAULTSDIR , +.BR _DEFCCOM , +.BR _DEFINSGRP , +.BR _DEFINSMODE , +.BR _DEFINSUSR , +.BR _DEFUMASK , +.BR _DIRNAME , +.BR _INCDIRS , +.BR _MAKEPROG , +.BR _MARCH , +.BR _M_ARCH , +.BR _O_ARCH , +.BR _PARCH , +.BR _P_ARCH , +.BR _UNIQ , +.BR __CCOM , +.BR __DEFAULTSDIR , +.BR __DEFCCOM , +.BR __DEFINSGRP , +.BR __DEFINSMODE , +.BR __DEFINSUSR , +.BR __DEFUMASK , +.BR __DIRNAME , +.BR __INCDIRS , +.BR __MAKEPROG , +.BR __MARCH , +.BR __M_ARCH , +.BR __PARCH , +.BR __P_ARCH , + +.SH BUGS + +.SH "Source Tree Hierarchy +.LP +The following outline gives a quick tour through a typical +source hierarchy: +.LP +.na +.nh +.PD 0 +.TP +.B .../ +root directory of the source tree +. +.RS +.TP +.B Makefile +the top Makefile +.TP +.B Targetdirs +a file containing a list of directories that are needed +for that project. +If the system needs different target lists depending +on the target system architecture , use target specific files in +.B .../TARGETS/ +.TP +\&.\|.\|. +.RE +. +.TP +.B .../RULES/ +the location of makefiles (included rules) +. +.RS +.TP +.B rules.top +the mandatory include rules (needed to setup basic rules) +.TP +.B rules.aux +rules needed to install a non localized auxiliary file +.TP +.B rules.cmd +rules needed to make an ordinary command (like /bin/sh) +.TP +.B rules.drv +rules needed to make a device driver +.TP +.B rules.lib +rules needed to make a standard (nonshared) library +.TP +.B rules.loc +rules needed to install a localized auxiliary file +.TP +.B rules.man +rules needed to install a localized manual page +.TP +.B rules.scr +rules needed to install a localized shell script +.TP +.B rules.shl +rules needed to make a shared library +.TP +.B rules.mks +rules needed to make more than one target in a specific directory +.TP +.B rules.dir +rules needed to make targets that are located in sub directories +to the current directory +.TP +\&.\|.\|. +.RE +. +.TP +.B .../DEFAULTS/ +default definitions for various target architectures are +located in this directory. Templates for some architectures can +be found in the +.I .../TEMPLATES/ +directory. +.RS +.TP +.B Defaults +default definitions for that source tree. System dependent +definitions are in +.B .../DEFAULTS/Defaults.* +.RE +.TP +.B .../TARGETS/ +target list definitions for various target architectures are +located in this directory. +.TP +.B .../TEMPLATES/ +templates that should be used inside the project +(rename to Makefile, if it is the only makefile in that directory, +rename to +.I target.mk, +if there is more than one target in that directory) +. +.RS +.TP +.B Defaults +Defaults file for the source root directory +.TP +.B Defaults.linux +Defaults file for +.IR linux . +This should be installed in the +.B .../DEFAULTS/ +directory. +.TP +.B Makefile.root +Makefile for the source root directory +.TP +.B Makefile.aux +Makefile for a non localized auxiliary file +.TP +.B Makefile.cmd +Makefile for an ordinary command (like /bin/sh) +.TP +.B Makefile.lib +Makefile for a standard (nonshared) library +.TP +.B Makefile.loc +Makefile for a localized auxiliary file +.TP +.B Makefile.man +Makefile for a localized manual page +.TP +.B Makefile_de.man +Makefile for a localized manual page in the german locale +.TP +.B Makefile.scr +Makefile for a localized shell script +.TP +.B Makefile.shl +Makefile for a shared library +.TP +.B Makefile.drv +Makefile for a device driver +.TP +.B Makefile.mks +Makefile for more than one target in a specific directory +.TP +.B Makefile.dir +Makefile for targets that are located in sub directories +to the current directory +.TP +\&.\|.\|. +.RE +. +.TP +.B .../cmd/ +source tree for normal commands +. +.RS +.TP +.B Makefile +the makefile for the +.I cmd +sub directory +.TP +.B Targetdirs.sun4m +a file containing a list of directories like +.I myprog +(see below) that are needed +for that specific architecture. +.TP +.B myprog/ +directory where the sources for a specific command are located +. +.RS +.TP +Makefile +makefile for +.I myprog +.TP +Makefile.man +makefile for the manual page of +.I myprog +.TP +mprog.c +source for myprog +.TP +mprog.tr +troff source for the manual page of myprog +.TP +.B OBJ/ +directory where system specific sub directories are located +. +.RS +.TP +.B sparc\-sunos5\-cc/ +directory for binaries that belong to a specific system +.TP +\&.\|.\|. +.RE +.TP +\&.\|.\|. +.RE +.br +.TP +\&.\|.\|. +.RE +.br +.ne 5 +.TP +.B .../lib/ +directory where the sources for a libraries are located +. +.RS +.TP +.B Makefile +the makefile for the +.I lib +sub directory +.TP +.B Targetdirs.sun4m +a file containing a list of directories like +.I libfoo +(see below) that are needed +for that specific architecture. +.TP +.B libfoo/ +directory where all source files for libfoo are located +.TP +\&.\|.\|. +.RE +. +.TP +.B .../kernel +directory for kernel modules +. +.RS +.TP +.B Makefile +the makefile for the +.I kernel +sub directory +.TP +.B Targetdirs.sun4m +a file containing a list of directories like +.I drv +(see below) that are needed +for that specific architecture. +.TP +.B drv/ +directory where drivers are located +. +.RS +.TP +.B Makefile +the makefile for the +.I drv +sub directory +.TP +.B Targetdirs.sun4m +a file containing a list of directories like +.I mydrv +(see below) that are needed +for that specific architecture. +.TP +.B mydrv/ +source for a specific driver +.TP +\&.\|.\|. +.RE +. +.TP +\&.\|.\|. +.RE +. +.TP +.B .../include +directory for global include files that are used in that project +. +.TP +.B .../bins +directory for binary programs that are created/needed while compiling +the project +.RS +.TP +.B sparc\-sunos5\-cc/ +directory for binaries that belong to a specific system +.TP +\&.\|.\|. +.RE +. +.TP +.B .../libs +directory for libraries that are created/needed while compiling +the project +.RS +.TP +.B sparc\-sunos5\-cc/ +directory for libraries that belong to a specific system +.TP +\&.\|.\|. +.RE +. +.TP +.B .../incs +directory for include files that are created/needed while compiling +the project +.RS +.TP +.B sparc\-sunos5\-cc/ +directory for include files that belong to a specific system +.TP +\&.\|.\|. +.RE +.TP +\&.\|.\|. +.RE +. +.ad +.PD + +.SH AUTHOR +.nf +J\*org Schilling +Seestr. 110 +D-13353 Berlin +Germany +.fi +.PP +Mail bugs and suggestions to: +.PP +.B +joerg@schily.isdn.cs.tu-berlin.de +or +.B +js@cs.tu-berlin.de +or +.B +jes@fokus.gmd.de diff --git a/scsilib/man/man4/makefiles.mk b/scsilib/man/man4/makefiles.mk new file mode 100644 index 0000000..2f1ea70 --- /dev/null +++ b/scsilib/man/man4/makefiles.mk @@ -0,0 +1,18 @@ +#ident %W% %E% %Q% +########################################################################### +# Sample makefile for installing manual pages +########################################################################### +SRCROOT= ../.. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +MANDIR= man +TARGETMAN= makefiles +MANSECT= $(MANSECT_FILEFORM) +MANSUFFIX= $(MANSUFF_FILEFORM) +MANFILE= makefiles.4 + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.man +########################################################################### diff --git a/scsilib/man/man4/makerules.4 b/scsilib/man/man4/makerules.4 new file mode 100644 index 0000000..9c46663 --- /dev/null +++ b/scsilib/man/man4/makerules.4 @@ -0,0 +1,1013 @@ +. \" @(#)makerules.4 1.3 01/04/29 Copyr 1996 J. Schilling +. \" System Manual page for makefile system +. \" +.if t .ds a \v'-0.55m'\h'0.00n'\z.\h'0.40n'\z.\v'0.55m'\h'-0.40n'a +.if t .ds o \v'-0.55m'\h'0.00n'\z.\h'0.45n'\z.\v'0.55m'\h'-0.45n'o +.if t .ds u \v'-0.55m'\h'0.00n'\z.\h'0.40n'\z.\v'0.55m'\h'-0.40n'u +.if t .ds A \v'-0.77m'\h'0.25n'\z.\h'0.45n'\z.\v'0.77m'\h'-0.70n'A +.if t .ds O \v'-0.77m'\h'0.25n'\z.\h'0.45n'\z.\v'0.77m'\h'-0.70n'O +.if t .ds U \v'-0.77m'\h'0.30n'\z.\h'0.45n'\z.\v'0.77m'\h'-.75n'U +.if t .ds s \(*b +.if t .ds S SS +.if n .ds a ae +.if n .ds o oe +.if n .ds u ue +.if n .ds s sz +.\".TH makefiles 4L "14. February 1997" "J\*org Schilling" "Schily\'s FILE FORMATS" +.TH makerules 4L "14. February 1997" "J\*org Schilling" "GMD FOKUS FILE FORMATS" +.SH NAME +makerules \- system programmers guide for compiling projects on different platforms +.SH SYNOPSIS +.B "SRCROOT= .\|. +.br +.B "RULESDIR= RULES +.br +.B "include $(SRCROOT)/$(RULESDIR)/rules.top +.br +.I "local defines are here +.br +.B "include $(SRCROOT)/$(RULESDIR)/rules.* +.PP +See chapter CURRENTLY SUPPORTED TARGET TYPES for possible values of +.BR "rules.*" . + +.SH DESCRIPTION +Makerules is a set of rules that allows compiling of structured +projects with small and uniformly structured makefiles. +All rules are located in a central directory. +Compiling the projects on different platforms can be done +simultaneously without +the need to modify any of the makefiles that are located +in the projects directories. +.PP +Makerules is a set of high level portability tools superior to +.B autoconf +and easier to use. +.PP +Three make programs are currently supported: +.IR "Sunpro make" , +.I "GNU make" +and +.IR smake . +If you want to add support for other make programs, read the +sections about the minimum requirements for a make program +and about the structure of the +.B "make rule +system. +.PP +This manual will help programmers who need to make modifications +on the make rule system itself. If you want to know something +on how to use the +.B "makefile system +have a look at +.BR makefiles (4). +.PP +The main design goal was to have no definition on more than place +in the make rules. This implies that system programmers who +want to add or modify rules must follow this goal in order not to +destroy functionality in other places. +.PP +The visible result for the user is a set of small and easy to read +makefiles, each located in the project's leaf directory and therefore +called +.IR leaf -makefile. +.PP +Each of these +.IR leaf -makefiles, +in fact contains no rule at all. It simply defines some macros +for the +.IR make -program +and includes two files from a central make rule depository. +These included files define the rules that are needed to compile +the project. +.PP +Each +.IR leaf -makefile +is formed in a really simple way: +.TP +\(bu +It first defines two macros that define the relative location +of the project's root directory and the name of the directory +that contains the complete set of of rules and then includes +the rule file +.I rules.top +from the directory that forms the central rule depository. +You only have to edit the macro +.I SRCROOT +to reflect the relative location of the project's root directory. +.TP +\(bu +The next part of a +.IR leaf -makefile +defines macros that describe the target and the source. +You can only have one target per +.IR leaf -makefile. +Of course, there may be many source files, that are needed to create +that target. +If you want to make more than one target in a specific directory, +you have to put more than one makefile into that directory. +This is the part of a makefile that describes a unique target. +Edit this part to contain all source files, all local include files +and all non global compile time flags that are needed for your target. +For a typical target this is as simple as filling in a form. +.TP +\(bu +Each +.IR leaf -makefile +finally includes a file from the rules directory that contains +rules for the appropriate type of target that is to be made +from this +.IR leaf -makefile. +.PP +The makefile in each directory has to be called +.IR Makefile . +If you want to have more than one makefile in a specific directory, +you have to choose different names for the other makefiles. + +.SH "Currently Supported Target Types +.PP +There are rules for the following type of targets: +.TP 20 +commands +The make rules for user level commands like +.IR cat ", " ls +etc. are located in the file +.I rules.cmd +.TP +drivers +The make rules for device drivers +are located in the file +.I rules.drv +.TP +libraries +The make rules for non shared libraries +are located in the file +.I rules.lib +.TP +shared libraries +The make rules for shared libraries +are located in the file +.I rules.shl +.TP +localized files +The make rules for localized files +are located in the file +.I rules.loc +.TP +nonlocalized files +The make rules for non localized files +are located in the file +.I rules.aux +.TP +shell scripts +The make rules for shell scripts (a variant of localized files) +are located in the file +.I rules.scr +.TP +manual pages +The make rules for manual pages (a variant of localized files) +are located in the file +.I rules.man +.TP +diverted makefiles +The make rules for projects that need to have more than +one makefile in a specific directory +are located in the file +.I rules.mks +It contains a rule that diverts to the listed sub makefiles. +Each sub makefile may be of any type. +.TP +directories +The make rules for sub directories +are located in the file +.I rules.dir + +.SH "Minimum Requirements For A Make Program +The make rules currently have support for +.IR "Sunpro make" , +.I "GNU make" +and +.IR smake . +If you like to add support for other make programs, +they need to have some minimal features that go +beyond the capabilities of the standard +.SM "UNIX +.B make +program. +.I BSDmake +could be supported if it supports pattern matching rules correctly. +.TP 20 +include +The make program must be able to recursively include other files +from within a +.I makefile. +The name if the file to include must be allowed to be a macro. +The make program must be able to do this in a way that +if the file that should be included may be a result of make rule. +e.g if the file to be included does not exist or is outdated, +it should be built before an attempt is made to actually include it. +.TP +appending to a macro +A macro reference of the form: +.sp +.B "macro += addval +.sp +should append +.B addval +to the string that is currently in +.BR macro . +.TP +suffix macro replacement +A macro reference of the form: +.sp +.B "out= $(macro\|:\|string1\|=\|string2) +.sp +should replace a suffix +.I string1 +to +.I string2 +in all words that are in +.BR macro , +where string1 is either a suffix, or a word to be replaced +in the macro definition, and string2 is the replacement +suffix or word. +.I String1 +and +.I string2 +must be replaced correctly even if they are macros themselves. +Words in a macro value are separated by SPACE, +TAB, and escaped NEWLINE characters. +.TP +pattern macro replacement +A macro reference of the form: +.sp +.B "out= $(macro\|:\|op%os\|=\|np%ns) +.sp +should replace a central pattern in +.BR macro , +where +.B op +is the existing (old) prefix and +.B os +is the existing +(old) suffix, +.B np +and +.B ns +are the new prefix and new suffix, +respectively, and the pattern matched by % (a string of zero +or more characters), is carried forward from the value being +replaced. +For example: +.sp +.B "PROGRAM=fabricate +.br +.B "DEBUG= $(PROGRAM:%=tmp/%\-g) +.sp +sets the value of DEBUG to tmp/fabricate\-g. +.IR Op ", " os ", " +.IR np " and " ns +must be replaced correctly even if they are macros themselves. + +.SH "Understanding Basic Algorithms +One of the basic algorithms used in the make rule system +is needed to set an undefined macro to a guaranteed default value. +Because not all make programs have support for +.I "if then else +structures, a different method has to be used. +.PP +The method used in +.B "make rules +is implemented by using +.B "suffix macro replacement +and +.BR "pattern macro replacement" . +.PP +.ne 5 +First, a macro that contains a unique suffix is defined: +.sp +.B " # Define magic unique cookie +.br +.B " _UNIQ= .XxZzy\- +.sp +This macro is used for all places where it is necessary to have +a macro with a guaranteed default value. +The following example shows the basic algorithm that is used to +implement the phrase: +.B If +.I $(MAKE_NAME) +contains a value, +.B then +.I $(XMAKEPROG) +will be set to +.I $(MAKE_NAME) +.B else +.I $(XMAKEPROG) +will be set to +.IR $(MAKEPROG) . +.sp +.B " _MAKEPROG= $(_UNIQ)$(MAKE_NAME) +.br +.B " __MAKEPROG= $(_MAKEPROG:$(_UNIQ)=$(MAKEPROG)) +.br +.B " XMAKEPROG= $(__MAKEPROG:$(_UNIQ)%=%) +.sp +The first line in this example, sets the macro +.I _MAKEPROG +to the concatenation of the value of +.I MAKE_NAME +and +.BR .XxZzy\- . +If the macro +.I MAKE_NAME +is empty at this time, +.I _MAKEPROG +will contain only +.BR .XxZzy\- . +.PP +In the second line, +.I __MAKEPROG +is set to the value of +.IR _MAKEPROG . +If +.I _MAKEPROG +contains only +.B .XxZzy\- +this implies, that +.B .XxZzy\- +is the suffix. This suffix is then replaced +by the value of +.IR MAKEPROG , +in this case +.I __MAKEPROG +will contain the unmodified value of +.IR MAKEPROG . +If +.I _MAKEPROG +contains a concatenation of +.B .XxZzy\- +and something else, +.B .XxZzy\- +will not be a suffix, but a prefix of +.I _MAKEPROG +and for this reason +.I __MAKEPROG +will contain the unmodified value of +.IR _MAKEPROG , +which is a concatenation of +.B .XxZzy\- +and the value of +.IR MAKE_NAME . +.PP +In the third line, +.I XMAKEPROG +is set to the value of +.IR __MAKEPROG . +If +.I __MAKEPROG +has the prefix +.B .XxZzy\- +at this time, +.B .XxZzy\- +is stripped of. + +.SH "The Structure in Make Macro names +.PP +The names used for +.B "make macros +are structured in a way that allows to use +.BR grep (1) +to look for the names in the +.B make rules. +To allow this, no name must be a substring of another name. +.PP +If a command needs options that have to be specified +in macros, there is a +.B "make macro +that is named +.I XXXFLAGS. +This is compliant to usual make file rules. +The are internal +.B "make macros +called +.I XXXOPTS +and +.I XXXOPTX +that will be combined for +.IR XXXFLAGS : +.sp +.B "LDFLAGS= $(LDOPTS) $(LDOPTX) +.sp +Where +.I XXXOPTS +is the name of the macro that is used internally +and +.I XXXOPTX +is the name of the macro that may be used from the +command line of the make program. +.I XXXOPTX +therefore is used to append to the content of +.I XXXFLAGS +If the value of +.I XXXFLAGS +need to be overwritten, +.I XXXOPTS +may be used within the command line flags of the make program. + +.SH "The Structure Of The Make Rule System +.SH "The Structure Of The Basic Rules in rules.top +The file +.B RULES/rules.top +first includes a rule file that depends on the +make program that is used. +The name of this file is +.BI RULES/mk\- makeprog .id +where +.I makeprog +has to be replaced by the real name of +the makeprogram e.g. +.BR make ", " gmake ", " smake . +The purpose of this file is to set up a list of macros +that identify the system where the project is currently built. +These macros have values that contain only lower case letters and define: +.TP 28 +the processor architecture +If two systems run the same operating system, this +is a unique value if a simple user level program will +not need to be recompiled in order to run on the other system. +Possible values are +.BR sparc ", " mc68020 ", " pentium . +This is the output of +.BR "uname \-p" . +The value is stored in +.BR P_ARCH . +.TP +the kernel architecture +If two systems may use the same value for +.B P_ARCH +but a heavily system dependent user level program +need to be recompiled in order to run on the other +system, These two systems have different +kernel architectures. +This is the output of +.BR "uname \-m" . +Possible values are +.BR sun3 ", " sun4c ", " sun4m . +The value is stored in +.BR K_ARCH . +.TP +the machine architecture +An outdated macro that is useful only on sun systems. +Do not use this, use +.B P_ARCH +instead. +This is the output of +.BR arch . +Possible values are +.BR sun3 ", " sun4 . +The value is stored in +.BR M_ARCH . +.TP +the hostname +The name of the machine where the compilation takes place. +This is the output of +.BR "uname \-n" . +The value is stored in +.BR HOSTNAME . +.TP +the name of the operating system +This is the output of +.BR "uname \-s" . +Possible values are +.BR sunos ", " dgux ", " hp\-ux ", " irix . +The value is stored in +.BR OSNAME . +.TP +the release of the operating system +This is the output of +.BR "uname \-r" . +Possible values are +.BR 5.5 ", " 4.1.4 . +The value is stored in +.BR OSREL . +.PP +The next file to be included from +.B RULES/rules.top +is +.BI RULES/os\- "operating system" .id . +It defines the macros +.B O_ARCH +and +.B \-O_ARCH +and may modify one of the macros that are defined +in +.BI RULES/mk\- makeprog .id . +The macros +.B O_ARCH +and +.B \-O_ARCH +are used to distinguish between different operating systems. +The names of the compiler configuration files have +.B \-O_ARCH +as a central part. +On some operating systems e.g. +.B SunOS +and +.B DG\-UX +it is necessary to distinguish between +.B "SunOS 4.x +and +.B "SunOS 5.x +or +.B "DG\-UX 3.x +and +.B "DG\-UX 4.x. +.PP +The next file to be included from +.B RULES/rules.top +is +.BR Defaults . +It defines the macros +.B DEFCCOM +, +.B DEFINCDIRS +, +.B LDPATH +, +.B RUNPATH +, +.B INS_BASE +and +.BR INS_KBASE . +If the definitions have to be different on +different systems, this file may contain a line int the form: +.sp +.BI include " $(SRCROOT)" /Defaults. $(O_ARCH) +.sp +The actual definitions then have to be moved into +these files. +.PP +Next, after setting up some internal defaults, +.B RULES/rules.top +includes the compiler configuration file with +the name: +.sp +.I $(SRCROOT)/$(RULESDIR)/$(XARCH).rul +.sp +This file contains all necessary +.B system dependent +stuff that is needed to configure the C-compiler +on the appropriate system. +It is a bad idea to create a new one from scratch. +Have a look at the other compiler configuration +files and modify a similar file for your needs. +Note that there are basically two criterias to +that are important in a compiler configuration file. +One is whether the system uses the +.I ELF +header format or not. +The other is whether the system uses +.I shared libraries +or not. + +.SH "The Structure Of The Application Specific Rules +.PP +The application specific rule files are designed in +such a way that they include all necessary stuff that +is needed for that specific task. The application specific +rule files are: +.TP 25 +$(RULES)/rules.aux +Rules for installing non localized auxiliary files. +.TP +$(RULES)/rules.cmd +Rules for commands like +.I sh. +.TP +$(RULES)/rules.dir +Rules for sub directories. +.TP +$(RULES)/rules.drv +Rules for lodable drivers. +.TP +$(RULES)/rules.lib +Rules for static libraries. +.TP +$(RULES)/rules.loc +Rules for installing localized auxiliary files. +.TP +$(RULES)/rules.man +Rules for installing localized manual pages. +.TP +$(RULES)/rules.mks +Rules for sub makefiles. +.TP +$(RULES)/rules.mod +Rules for lodable stream modules. +.TP +$(RULES)/rules.scr +Rules for installing localized shell scripts. +.TP +$(RULES)/rules.shl +Rules for shared libraries. + +.SH "Understanding The Structure Of The Make Rule System +.PP +To understand the structure of the +.B "make rule +system while doing changes, try to use the +.B \-xM +flag +in the +.B smake +program. +This flag will print out the include dependency list +(i.e. a list that tell you which make rules is included +from which other rule). +.PP +Note that some of the rules are make program dependent. +If you want to make changes to these rules you may need to +place the definitions into separate rule files +each for the appropriate make program. +Have a look into the +.B RULES +directory +for some examples. + +.SH FILES +\&.\|.\|./RULES/* +.br +\&.\|.\|./DEFAULTS/* +.br +\&.\|.\|./TARGETS/* +.br +\&.\|.\|./TEMPLATES/* + +.SH "SEE ALSO" +.BR makefiles (4), +.BR make (1), +.BR gmake (1), +.BR smake (1). + +.SH DIAGNOSTICS +Diagnostic messages depend on the make program. +Have a look at the appropriate man page. + +.SH NOTES +.PP +The make rules +can be used with +.IR "Sunpro make" ", " "Gnu make" +and +.IR smake . +Although Gnu make runs on many platforms, it has no useful debug +output. +.PP +Use +.IR "Sunpro make" " or " "smake" +if you have problems with a makefile. +.IR "Sunpro make" " and " "smake" , +both have a \-D flag, that allows you to watch the makefiles +after the first expansion. Use this option, if you are in doubt +if your makefile gets expanded the right way and if the right +rules are included. +There is also a \-d option that gives debugging output while +make is running. If you want more output, use \-dd, \-ddd and so on. +.PP +.I Smake +has an option \-xM that shows you the include dependency for +make rules. + +.SH BUGS + +.SH "Source Tree Hierarchy +.LP +The following outline gives a quick tour through a typical +source hierarchy: +.LP +.na +.nh +.PD 0 +.TP +.B .../ +root directory of the source tree +. +.RS +.TP +.B Makefile +the top Makefile +.TP +.B Defaults +default definitions for that source tree. System dependent +definitions are in +.B .../DEFAULTS/ +.TP +.B Targetdirs +a file containing a list of directories that are needed +for that project. +If the system needs different target lists depending +on the target system architecture , use target specific files in +.B .../TARGETS/ +.TP +\&.\|.\|. +.RE +. +.TP +.B .../RULES/ +the location of makefiles (included rules) +. +.RS +.TP +.B rules.top +the mandatory include rules (needed to setup basic rules) +.TP +.B rules.aux +rules needed to install a non localized auxiliary file +.TP +.B rules.cmd +rules needed to make an ordinary command (like /bin/sh) +.TP +.B rules.drv +rules needed to make a device driver +.TP +.B rules.lib +rules needed to make a standard (nonshared) library +.TP +.B rules.loc +rules needed to install a localized auxiliary file +.TP +.B rules.man +rules needed to install a localized manual page +.TP +.B rules.scr +rules needed to install a localized shell script +.TP +.B rules.shl +rules needed to make a shared library +.TP +.B rules.mks +rules needed to make more than one target in a specific directory +.TP +.B rules.dir +rules needed to make targets that are located in sub directories +to the current directory +.TP +\&.\|.\|. +.RE +. +.TP +.B .../DEFAULTS/ +default definitions for various target architectures are +located in this directory. Templates for some architectures can +be found in the +.I .../TEMPLATES/ +directory. +.TP +.B .../TARGETS/ +target list definitions for various target architectures are +located in this directory. +.TP +.B .../TEMPLATES/ +templates that should be used inside the project +(rename to Makefile, if it is the only makefile on that directory, +rename to +.I target.mk, +if there is more than one target in that directory) +. +.RS +.TP +.B Defaults +Defaults file for the source root directory +.TP +.B Defaults.linux +Defaults file for +.IR linux . +This sould be installed in the +.B .../DEFAULTS/ +directory. +.TP +.B Makefile.root +Makefile for the source root directory +.TP +.B Makefile.aux +Makefile for a non localized auxiliary file +.TP +.B Makefile.cmd +Makefile for an ordinary command (like /bin/sh) +.TP +.B Makefile.lib +Makefile for a standard (nonshared) library +.TP +.B Makefile.loc +Makefile for a localized auxiliary file +.TP +.B Makefile.man +Makefile for a localized manual page +.TP +.B Makefile_de.man +Makefile for a localized manual page in the german locale +.TP +.B Makefile.scr +Makefile for a localized shell script +.TP +.B Makefile.shl +Makefile for a shared library +.TP +.B Makefile.drv +Makefile for a device driver +.TP +.B Makefile.mks +Makefile for more than one target in a specific directory +.TP +.B Makefile.dir +Makefile for targets that are located in sub directories +to the current directory +.TP +\&.\|.\|. +.RE +. +.TP +.B .../cmd/ +source tree for normal commands +. +.RS +.TP +.B Makefile +the makefile for the +.I cmd +sub directory +.TP +.B Targetdirs.sun4m +a file containing a list of directories like +.I myprog +(see below) that are needed +for that specific architecture. +.TP +.B myprog/ +directory where the sources for a specific command are located +. +.RS +.TP +Makefile +makefile for +.I myprog +.TP +Makefile.man +makefile for the manual page of +.I myprog +.TP +mprog.c +source for myprog +.TP +mprog.tr +troff source for the manual page of myprog +.TP +.B OBJ/ +directory where system specific sub directories are located +. +.RS +.TP +.B sparc\-sunos5\-cc/ +directory for binaries that belong to a specific system +.TP +\&.\|.\|. +.RE +.TP +\&.\|.\|. +.RE +.br +.TP +\&.\|.\|. +.RE +.br +.ne 5 +.TP +.B .../lib/ +directory where the sources for a libraries are located +. +.RS +.TP +.B Makefile +the makefile for the +.I lib +sub directory +.TP +.B Targetdirs.sun4m +a file containing a list of directories like +.I libfoo +(see below) that are needed +for that specific architecture. +.TP +.B libfoo/ +directory where all source files for libfoo are located +.TP +\&.\|.\|. +.RE +. +.TP +.B .../kernel +directory for kernel modules +. +.RS +.TP +.B Makefile +the makefile for the +.I kernel +sub directory +.TP +.B Targetdirs.sun4m +a file containing a list of directories like +.I drv +(see below) that are needed +for that specific architecture. +.TP +.B drv/ +directory where drivers are located +. +.RS +.TP +.B Makefile +the makefile for the +.I drv +sub directory +.TP +.B Targetdirs.sun4m +a file containing a list of directories like +.I mydrv +(see below) that are needed +for that specific architecture. +.TP +.B mydrv/ +source for a specific driver +.TP +\&.\|.\|. +.RE +. +.TP +\&.\|.\|. +.RE +. +.TP +.B .../include +directory for global include files that are used in that project +. +.TP +.B .../bins +directory for binary programs that are created/needed while compiling +the project +.RS +.TP +.B sparc\-sunos5\-cc/ +directory for binaries that belong to a specific system +.TP +\&.\|.\|. +.RE +. +.TP +.B .../libs +directory for libraries that are created/needed while compiling +the project +.RS +.TP +.B sparc\-sunos5\-cc/ +directory for libraries that belong to a specific system +.TP +\&.\|.\|. +.RE +. +.TP +.B .../incs +directory for include files that are created/needed while compiling +the project +.RS +.TP +.B sparc\-sunos5\-cc/ +directory for include files that belong to a specific system +.TP +\&.\|.\|. +.RE +.TP +\&.\|.\|. +.RE +. +.ad +.PD + +.SH AUTHOR +.nf +J\*org Schilling +Seestr. 110 +D-13353 Berlin +Germany +.fi +.PP +Mail bugs and suggestions to: +.PP +.B +joerg@schily.isdn.cs.tu-berlin.de +or +.B +js@cs.tu-berlin.de +or +.B +jes@fokus.gmd.de diff --git a/scsilib/man/man4/makerules.mk b/scsilib/man/man4/makerules.mk new file mode 100644 index 0000000..ee6295a --- /dev/null +++ b/scsilib/man/man4/makerules.mk @@ -0,0 +1,18 @@ +#ident %W% %E% %Q% +########################################################################### +# Sample makefile for installing manual pages +########################################################################### +SRCROOT= ../.. +RULESDIR= RULES +include $(SRCROOT)/$(RULESDIR)/rules.top +########################################################################### + +MANDIR= man +TARGETMAN= makerules +MANSECT= $(MANSECT_FILEFORM) +MANSUFFIX= $(MANSUFF_FILEFORM) +MANFILE= makerules.4 + +########################################################################### +include $(SRCROOT)/$(RULESDIR)/rules.man +########################################################################### diff --git a/scsilib/rc.pp b/scsilib/rc.pp new file mode 100755 index 0000000..734cfd5 --- /dev/null +++ b/scsilib/rc.pp @@ -0,0 +1,76 @@ +#!/bin/sh + +# +# Note: The adapter shell var must updated in order to reflect your actual hardware. +# The current value "friq" is the right value for the FreeCom PP adapter. +# See paride documentation for the list of other drivers. +# +adapter=friq + +case "$1" in + +'start') + echo "Starting Parallel Port IDE/ATAPI" + modprobe paride + modprobe "$adapter" +# modprobe pg +# modprobe pg verbose=2 drive0=0x378,0,0,-1,-1,0 + modprobe pg verbose=0 drive0=0x378,0,0,-1,-1,0 + ;; + +'stop') + echo "Stopping Parallel Port IDE/ATAPI" + rmmod pg + rmmod "$adapter" + rmmod paride + ;; + +*) + echo "Usage: rc.pp start|stop" +esac + +exit + +############################################################################### +When you load pg, you need to specify some parameters like: + + drive0=0x378,0,0,4,0,0 + +The parameters are: + + <prt>,<pro>,<uni>,<mod>,<slv>,<dly> + + Where, + + <prt> is the base of the parallel port address for + the corresponding drive. (required) + + <pro> is the protocol number for the adapter that + supports this drive. These numbers are + logged by 'paride' when the protocol modules + are initialised. (0 if not given) + + <uni> for those adapters that support chained + devices, this is the unit selector for the + chain of devices on the given port. It should + be zero for devices that don't support chaining. + (0 if not given) + + <mod> this can be -1 to choose the best mode, or one + of the mode numbers supported by the adapter. + (-1 if not given) + + <slv> ATAPI devices can be jumpered to master or slave. + Set this to 0 to choose the master drive, 1 to + choose the slave, -1 (the default) to choose the + first drive found. + + <dly> some parallel ports require the driver to + go more slowly. -1 sets a default value that + should work with the chosen protocol. Otherwise, + set this to a small integer, the larger it is + the slower the port i/o. In some cases, setting + this to zero will speed up the device. (default -1) + +EPP mode is best. Your BIOS may not give you that option, unfortunately. +What options does it support ? diff --git a/specs/cdrdao.fedora.spec.in b/specs/cdrdao.fedora.spec.in new file mode 100644 index 0000000..8524997 --- /dev/null +++ b/specs/cdrdao.fedora.spec.in @@ -0,0 +1,87 @@ +Name: cdrdao +Version: @PACKAGE_VERSION@ +Release: 1 +Epoch: 0 +Summary: A Disk-At-Once (DAO) Audio CD writer and GUI editor + +Group: Applications/Multimedia +License: GPL +URL: http://cdrdao.sourceforge.net/ +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Source0: http://dl.sourceforge.net/sourceforge/cdrdao/%{name}-%{version}.tar.gz + +%description +Writes audio CD-Rs in disc-at-once (DAO) mode allowing control over +pre-gaps (length down to 0, nonzero audio data) and sub-channel +information like ISRC codes. All data that is written to the disc must +be specified with a text file. Audio data may be in WAVE or raw +format. + +%package -n gcdmaster +Summary: The Gnome2/GTK2 GUI front-end to cdrdao +Group: Applications/Multimedia +Requires: %{name} = %{epoch}:%{version}-%{release} +BuildRequires: gtkmm24-devel >= 0:2.4 +BuildRequires: libgnomeuimm26-devel >= 0:2.6 +BuildRequires: libsigc++20-devel >= 0:1.2 +BuildRequires: libvorbis-devel >= 0:1.0 +BuildRequires: libao-devel >= 0:0.8 +# BuildRequires: libmad-devel + +%description -n gcdmaster +Gcdmaster is a GNOME2 GUI front-end to cdrdao that makes it easy to +visualize and manipulate audio information before burning it onto +CD. Its features include: cut/copy/paste of sound samples, track marks +edition and silence insertion. + +%prep +%setup -q + + +%build +%configure +make %{?_smp_mflags} + + +%install +rm -rf $RPM_BUILD_ROOT +%makeinstall + +find $RPM_BUILD_ROOT -type f -name "*.la" -exec rm -f {} ';' + + +%clean +rm -rf $RPM_BUILD_ROOT + + +%post + + +%files +%defattr(-, root, root, -) +%doc AUTHORS COPYING CREDITS ChangeLog INSTALL README NEWS README.PlexDAE README.Win32 +%{_bindir}/cdrdao +%{_datadir}/cdrdao +%{_bindir}/toc2* +%{_bindir}/cue2toc +%{_mandir}/man1/cdrdao* +%{_mandir}/man1/cue2toc* + +%files -n gcdmaster +%defattr(-, root, root, -) +%{_bindir}/gcdmaster +%{_datadir}/gcdmaster +%{_datadir}/mime-info/gcdmaster* +%{_datadir}/mime/packages/gcdmaster.xml +%{_datadir}/applications/gcdmaster.desktop +%{_datadir}/application-registry/gcdmaster.applications +%{_datadir}/pixmaps/gcdmaster* +%{_mandir}/man1/gcdmaster* + +%changelog +* Mon Jul 20 2004 Denis Leroy <denis@poolshark.org> - 0:1.1.9pre1-0.fdr.1 +- Added Ogg and libao dependencies +- Switch to gtkmm 2.4 APIs + +* Mon Jun 26 2004 Denis Leroy <denis@poolshark.org> - 0:1.1.9-0.fdr.1 +- Initial FC2 spec diff --git a/testtocs/cdtext.toc b/testtocs/cdtext.toc new file mode 100644 index 0000000..c3146bd --- /dev/null +++ b/testtocs/cdtext.toc @@ -0,0 +1,48 @@ +CD_DA + +// global CD-TEXT data + +CD_TEXT { + + // Mapping from language number (0..7) used in 'LANGUAGE' statements + // to language code. + LANGUAGE_MAP { + 0 : EN // 9 is the code for ENGLISH, + // I don't know any other language code, yet + } + + // Language number should always start with 0 + LANGUAGE 0 { + // Required fields - at least all CD-TEXT CDs I've seen so far have them. + TITLE "CD Title" + PERFORMER "Performer" + DISC_ID "XY12345" + UPC_EAN "" // usually empty + + // Further possible items, all of them are optional + ARRANGER "" + SONGWRITER "" + MESSAGE "" + GENRE "" // I'm not sure if this should be really ascii data + } +} + + +TRACK AUDIO +// track specific CD-TEXT data +CD_TEXT { + LANGUAGE 0 { + // if an item is defined for one track it should be defined for all tracks + TITLE "Track Title" + + PERFORMER "Performer" + ISRC "US-XX1-98-01234" + + ARRANGER "" + SONGWRITER "" + MESSAGE "" + } +} + +SILENCE 1:0:0 + diff --git a/testtocs/data1.toc b/testtocs/data1.toc new file mode 100644 index 0000000..7874c8b --- /dev/null +++ b/testtocs/data1.toc @@ -0,0 +1,6 @@ +// Just a single MODE1 track. + +CD_ROM + +TRACK MODE1 +ZERO 1:0:0 diff --git a/testtocs/data2.toc b/testtocs/data2.toc new file mode 100644 index 0000000..8eb6500 --- /dev/null +++ b/testtocs/data2.toc @@ -0,0 +1,10 @@ +// MODE1 track followed by an AUDIO track + +CD_ROM + +TRACK MODE1 +ZERO 1:0:0 + +TRACK AUDIO +PREGAP 0:2:0 +SILENCE 1:0:0 diff --git a/testtocs/data3.toc b/testtocs/data3.toc new file mode 100644 index 0000000..508863e --- /dev/null +++ b/testtocs/data3.toc @@ -0,0 +1,13 @@ +// AUDIO track followed by a MODE1 track. +// Causes my PlexWriter to hang until a SCSI bus reset occus when the +// first sector of the MODE1 track is written. + +CD_ROM + +TRACK AUDIO +SILENCE 1:0:0 + +TRACK MODE1 +PREGAP 0:2:0 +ZERO 1:0:0 + diff --git a/testtocs/data4.toc b/testtocs/data4.toc new file mode 100644 index 0000000..34362d6 --- /dev/null +++ b/testtocs/data4.toc @@ -0,0 +1,17 @@ +// MODE1 track followed by an AUDIO track followed by a MODE1 track. +// This works on my PlexWriter in contrast to 'data3.toc'. + +CD_ROM + +TRACK MODE1 +ZERO 1:0:0 + +TRACK AUDIO +PREGAP 0:2:0 +SILENCE 1:0:0 + +TRACK MODE1 +PREGAP 0:2:0 +ZERO 1:0:0 + + diff --git a/testtocs/data5.toc b/testtocs/data5.toc new file mode 100644 index 0000000..caf46a3 --- /dev/null +++ b/testtocs/data5.toc @@ -0,0 +1,11 @@ +// XA disk +// + +CD_ROM_XA + +TRACK MODE2_FORM2 +ZERO 1:0:0 + +TRACK MODE2_FORM1 +PREGAP 0:2:0 +ZERO 2:0:0 diff --git a/testtocs/data6.toc b/testtocs/data6.toc new file mode 100644 index 0000000..4f16d69 --- /dev/null +++ b/testtocs/data6.toc @@ -0,0 +1,7 @@ +// MODE2 track +// + +CD_ROM + +TRACK MODE2 +ZERO 1:0:0 diff --git a/testtocs/data7.toc b/testtocs/data7.toc new file mode 100644 index 0000000..94ac0cf --- /dev/null +++ b/testtocs/data7.toc @@ -0,0 +1,11 @@ +// Video CD +// + +CD_ROM_XA + +TRACK MODE1 // ISO filesystem +ZERO 1:0:0 + +TRACK MODE2_FORM_MIX // XA track with form 1 and form 2 sectors +PREGAP 0:2:0 +ZERO 1:0:0 diff --git a/testtocs/mode1_rw.toc b/testtocs/mode1_rw.toc new file mode 100644 index 0000000..c91eda4 --- /dev/null +++ b/testtocs/mode1_rw.toc @@ -0,0 +1,4 @@ +CD_DA + +TRACK MODE1 RW +ZERO 10:0:0 diff --git a/testtocs/mode1_rw_raw.toc b/testtocs/mode1_rw_raw.toc new file mode 100644 index 0000000..3dd96e6 --- /dev/null +++ b/testtocs/mode1_rw_raw.toc @@ -0,0 +1,4 @@ +CD_DA + +TRACK MODE1 RW_RAW +ZERO 10:0:0 diff --git a/testtocs/pregap1.toc b/testtocs/pregap1.toc new file mode 100644 index 0000000..b2d7c06 --- /dev/null +++ b/testtocs/pregap1.toc @@ -0,0 +1,8 @@ +CD_DA + +TRACK AUDIO +SILENCE 00:10:00 + +TRACK AUDIO +START 00:02:00 +SILENCE 00:10:00 diff --git a/testtocs/pregap2.toc b/testtocs/pregap2.toc new file mode 100644 index 0000000..ec705ef --- /dev/null +++ b/testtocs/pregap2.toc @@ -0,0 +1,8 @@ +CD_DA + +TRACK AUDIO +SILENCE 00:10:00 + +TRACK AUDIO +PREGAP 00:02:00 +SILENCE 00:10:00 diff --git a/testtocs/t1.toc b/testtocs/t1.toc new file mode 100644 index 0000000..5e62766 --- /dev/null +++ b/testtocs/t1.toc @@ -0,0 +1,5 @@ +// simplest cue sheet + +TRACK AUDIO +NO COPY // so that all CTL flags are 0 +SILENCE 1:0:0 diff --git a/testtocs/t2.toc b/testtocs/t2.toc new file mode 100644 index 0000000..781c643 --- /dev/null +++ b/testtocs/t2.toc @@ -0,0 +1,6 @@ +// additional pre-gap for track 1 + +TRACK AUDIO +NO COPY // so that all CTL flags are 0 +SILENCE 1:0:0 +START 0:10:0 // 10 second pre-gap diff --git a/testtocs/t3.toc b/testtocs/t3.toc new file mode 100644 index 0000000..8242262 --- /dev/null +++ b/testtocs/t3.toc @@ -0,0 +1,10 @@ +// simplest cue sheet for two tracks + +TRACK AUDIO +NO COPY // so that all CTL flags are 0 +SILENCE 1:0:0 + +TRACK AUDIO +NO COPY // so that all CTL flags are 0 +SILENCE 1:0:0 + diff --git a/testtocs/t4.toc b/testtocs/t4.toc new file mode 100644 index 0000000..621cedb --- /dev/null +++ b/testtocs/t4.toc @@ -0,0 +1,8 @@ +// non default CTL flag of track 1 + +TRACK AUDIO +COPY +PRE_EMPHASIS +FOUR_CHANNEL_AUDIO +SILENCE 1:0:0 + diff --git a/testtocs/t5.toc b/testtocs/t5.toc new file mode 100644 index 0000000..0e3a09d --- /dev/null +++ b/testtocs/t5.toc @@ -0,0 +1,8 @@ +// test catalog number + +CATALOG "1234567890123" + +TRACK AUDIO +NO COPY +SILENCE 1:0:0 + diff --git a/testtocs/t6.toc b/testtocs/t6.toc new file mode 100644 index 0000000..27dde65 --- /dev/null +++ b/testtocs/t6.toc @@ -0,0 +1,7 @@ +// test ISRC code + + +TRACK AUDIO +NO COPY +ISRC "DEMUA9800001" +SILENCE 1:0:0 diff --git a/testtocs/t7.toc b/testtocs/t7.toc new file mode 100644 index 0000000..4083782 --- /dev/null +++ b/testtocs/t7.toc @@ -0,0 +1,12 @@ +// check two tracks with pre-gap and ISRC + + +TRACK AUDIO +NO COPY +SILENCE 1:0:0 + +TRACK AUDIO +NO COPY +ISRC "DEMUA9800001" +SILENCE 1:0:0 +START 0:5:0 // pre-gap diff --git a/testtocs/t8.toc b/testtocs/t8.toc new file mode 100644 index 0000000..61331c6 --- /dev/null +++ b/testtocs/t8.toc @@ -0,0 +1,14 @@ +// check index increments + + +TRACK AUDIO +NO COPY +SILENCE 3:0:0 +INDEX 1:0:0 +INDEX 2:0:0 + + +TRACK AUDIO +NO COPY +SILENCE 1:0:0 +START 0:5:0 // pre-gap diff --git a/testtocs/t9.toc b/testtocs/t9.toc new file mode 100644 index 0000000..3a60499 --- /dev/null +++ b/testtocs/t9.toc @@ -0,0 +1,31 @@ +CD_DA +// check mulitple tracks +CATALOG "0724385356926" + +TRACK AUDIO +ISRC "USEM39600078" +COPY +SILENCE 0:10:0 +START 0:5:0 + +TRACK AUDIO +NO COPY +ISRC "USEM39600079" +SILENCE 0:10:0 +START 0:2:0 + +TRACK AUDIO +COPY +SILENCE 0:10:0 +START 0:1:30 + +TRACK AUDIO +NO COPY +START 0:0:0 +SILENCE 0:10:0 + +TRACK AUDIO +ISRC "EDUMA9892346" +NO COPY +SILENCE 0:6:1 +START 0:2:1 diff --git a/trackdb/CdTextContainer.cc b/trackdb/CdTextContainer.cc new file mode 100644 index 0000000..146781f --- /dev/null +++ b/trackdb/CdTextContainer.cc @@ -0,0 +1,263 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <assert.h> + +#include "CdTextContainer.h" +#include "CdTextItem.h" + +struct LanguageCode { + int code; + const char *name; +}; + +static LanguageCode LANGUAGE_CODES[] = { + { 0x75, "Chinese" }, + { 0x06, "Czech" }, + { 0x07, "Danish" }, + { 0x1d, "Dutch" }, + { 0x09, "English" }, + { 0x27, "Finnish" }, + { 0x0f, "French" }, + { 0x08, "German" }, + { 0x70, "Greek" }, + { 0x1b, "Hungarian" }, + { 0x15, "Italian" }, + { 0x69, "Japanese" }, + { 0x65, "Korean" }, + { 0x1e, "Norwegian" }, + { 0x20, "Polish" }, + { 0x21, "Portuguese" }, + { 0x56, "Russian" }, + { 0x26, "Slovene" }, + { 0x0a, "Spanish" }, + { 0x28, "Swedish" } +}; + +static int NOF_LANGUAGE_CODES = sizeof(LANGUAGE_CODES) / sizeof(LanguageCode); + +CdTextContainer::CdTextContainer() +{ + count_ = 0; + items_ = 0; + + setDefaultLanguageMapping(); +} + +CdTextContainer::CdTextContainer(const CdTextContainer &obj) +{ + CdTextItem *run; + CdTextItem *last = NULL; + int i; + + items_ = NULL; + count_ = 0; + + for (run = obj.items_; run != NULL; run = run->next_) { + if (last == NULL) { + items_ = new CdTextItem(*run); + last = items_; + } + else { + last->next_ = new CdTextItem(*run);; + last = last->next_; + } + count_++; + } + + // copy language map + for (i = 0; i < 8; i++) + language_[i] = obj.language_[i]; +} + +CdTextContainer::~CdTextContainer() +{ + CdTextItem *next; + + while (items_ != NULL) { + next = items_->next_; + delete items_; + items_ = next; + } + + count_ = 0; +} + +void CdTextContainer::setDefaultLanguageMapping() +{ + int i; + + // set all to undefined + for (i = 0; i < 8; i++) + language_[i] = -1; +} + +void CdTextContainer::print(int isTrack, std::ostream &out) const +{ + CdTextItem *run; + int i; + int foundLanguageMapping; + + if (count_ > 0) { + int actBlockNr = items_->blockNr(); + + out << "CD_TEXT {\n"; + + if (!isTrack) { + foundLanguageMapping = 0; + for (i = 0; i < 8; i++) { + if (language_[i] >= 0) { + foundLanguageMapping = 1; + break; + } + } + + if (foundLanguageMapping) { + out << " LANGUAGE_MAP {\n"; + + for (i = 0; i < 8; i++) { + if (language_[i] >= 0) + out << " " << i << ": " << language_[i] << "\n"; + } + + out << " }\n"; + } + } + + out << " LANGUAGE " << actBlockNr << " {\n"; + + + for (run = items_; run != NULL; run = run->next_) { + if (run->blockNr() != actBlockNr) { + actBlockNr = run->blockNr(); + out << " }\n LANGUAGE " << actBlockNr << " {\n"; + } + out << " "; + run->print(isTrack, out); + out << "\n"; + } + + out << " }\n}\n"; + } +} + +void CdTextContainer::add(CdTextItem *item) +{ + CdTextItem *pred; + CdTextItem *run; + + assert(item->next_ == NULL); + + remove(item->packType(), item->blockNr()); + + for (pred = NULL, run = items_; run != NULL; pred = run, run = run->next_) { + if (item->blockNr() < run->blockNr() || + (item->blockNr() == run->blockNr() && + item->packType() < run->packType())) + break; + } + + if (pred == NULL) { + item->next_ = items_; + items_ = item; + } + else { + item->next_ = pred->next_; + pred->next_ = item; + } + + count_++; +} + +void CdTextContainer::remove(CdTextItem::PackType type, int blockNr) +{ + CdTextItem *run, *pred; + + for (pred = NULL, run = items_; run != NULL; pred = run, run = run->next_) { + if (run->packType() == type && run->blockNr() == blockNr) { + if (pred == NULL) + items_ = run->next_; + else + pred->next_ = run->next_; + + count_--; + + delete run; + return; + } + } +} + +int CdTextContainer::existBlock(int blockNr) const +{ + CdTextItem *run; + + for (run = items_; run != NULL; run = run->next_) { + if (run->blockNr() == blockNr) { + return 1; + } + } + + return 0; +} + +const CdTextItem *CdTextContainer::getPack(int blockNr, + CdTextItem::PackType type) const +{ + CdTextItem *run; + + for (run = items_; run != NULL; run = run->next_) { + if (run->blockNr() == blockNr && run->packType() == type) { + return run; + } + } + + return NULL; +} + +void CdTextContainer::language(int blockNr, int lang) +{ + assert(blockNr >= 0 && blockNr <= 7); + assert(lang >= -1 && lang <= 255); + + language_[blockNr] = lang; +} + + +int CdTextContainer::language(int blockNr) const +{ + assert(blockNr >= 0 && blockNr <= 7); + + return language_[blockNr]; +} + +const char *CdTextContainer::languageName(int lang) +{ + int i; + + if (lang < 0) + return "Undefined"; + + for (i = 0; i < NOF_LANGUAGE_CODES; i++) { + if (lang == LANGUAGE_CODES[i].code) + return LANGUAGE_CODES[i].name; + } + + return "Unknown"; +} diff --git a/trackdb/CdTextContainer.h b/trackdb/CdTextContainer.h new file mode 100644 index 0000000..be34e85 --- /dev/null +++ b/trackdb/CdTextContainer.h @@ -0,0 +1,65 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __CDTEXTCONTAINER_H__ +#define __CDTEXTCONTAINER_H__ + +#include <iostream> + +#include "CdTextItem.h" + + +class CdTextContainer { +public: + CdTextContainer(); + CdTextContainer(const CdTextContainer &); + + ~CdTextContainer(); + + long count() const { return count_; } + + void add(CdTextItem *); + + void remove(CdTextItem::PackType, int blockNr); + + void print(int isTrack, std::ostream &) const; + + // checks if a pack exists for given 'blockNr' (language) + int existBlock(int blockNr) const; + + // return pack for given 'blockNr' and pack type + const CdTextItem *getPack(int blockNr, CdTextItem::PackType) const; + + // sets/returns language code for block nr + void language(int blockNr, int lang); + int language(int blockNr) const; + + static const char *languageName(int lang); + +private: + long count_; + CdTextItem *items_; + + int language_[8]; // mapping from block nr to language code + + void setDefaultLanguageMapping(); + +}; + +#endif diff --git a/trackdb/CdTextItem.cc b/trackdb/CdTextItem.cc new file mode 100644 index 0000000..e4da9be --- /dev/null +++ b/trackdb/CdTextItem.cc @@ -0,0 +1,348 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <assert.h> +#include <string.h> +#include <ctype.h> +#include <stdio.h> + +#include "CdTextItem.h" + +CdTextItem::CdTextItem(PackType packType, int blockNr, const char *data) +{ + assert(blockNr >= 0 && blockNr <= 7); + + next_ = NULL; + + dataType_ = SBCC; + packType_ = packType; + blockNr_ = blockNr; + + dataLen_ = strlen(data) + 1; + + data_ = new unsigned char[dataLen_]; + + strcpy((char *)data_, data); +} + + +CdTextItem::CdTextItem(PackType packType, int blockNr, + const unsigned char *data, long len) +{ + assert(blockNr >= 0 && blockNr <= 7); + + next_ = NULL; + + dataType_ = BINARY; + packType_ = packType; + blockNr_ = blockNr; + + dataLen_ = len; + + if (len > 0) { + data_ = new unsigned char[len]; + memcpy(data_, data, len); + } + else { + data_ = NULL; + } +} + +CdTextItem::CdTextItem(int blockNr, unsigned char genreCode1, + unsigned char genreCode2, const char *description) +{ + assert(blockNr >= 0 && blockNr <= 7); + + next_ = NULL; + + dataType_ = BINARY; + packType_ = CDTEXT_GENRE; + blockNr_ = blockNr; + + dataLen_ = 2; + + if (description != NULL) + dataLen_ += strlen(description) + 1; + + data_ = new unsigned char[dataLen_]; + data_[0] = genreCode1; + data_[1] = genreCode2; + + if (description != NULL) + memcpy(data_ + 2, description, dataLen_ - 2); +} + +CdTextItem::CdTextItem(const CdTextItem &obj) +{ + next_ = NULL; + + dataType_ = obj.dataType_; + packType_ = obj.packType_; + blockNr_ = obj.blockNr_; + + dataLen_ = obj.dataLen_; + + if (dataLen_ > 0) { + data_ = new unsigned char[dataLen_]; + memcpy(data_, obj.data_, dataLen_); + } + else { + data_ = NULL; + } +} + +CdTextItem::~CdTextItem() +{ + delete[] data_; + data_ = NULL; + + next_ = NULL; +} + +void CdTextItem::print(int isTrack, std::ostream &out) const +{ + int i; + char buf[20]; + out << packType2String(isTrack, packType_); + + if (dataType() == SBCC) { + out << " \""; + for (i = 0; i < dataLen_ - 1; i++) { + if (data_[i] == '"') { + out << "\\\""; + } + else if (isprint(data_[i])) { + out << data_[i]; + } + else { + sprintf(buf, "\\%03o", (unsigned int)data_[i]); + out << buf; + } + } + + out << "\""; + } + else { + long i; + + out << " {"; + for (i = 0; i < dataLen_; i++) { + if (i == 0) { + sprintf(buf, "%2d", (unsigned int)data_[i]); + out << buf; + } + else { + if (i % 12 == 0) + out << ",\n "; + else + out << ", "; + + sprintf(buf, "%2d", (unsigned int)data_[i]); + out << buf; + } + } + + out << "}"; + } +} + +int CdTextItem::operator==(const CdTextItem &obj) +{ + if (packType_ != obj.packType_ || blockNr_ != obj.blockNr_ || + dataType_ != obj.dataType_ || dataLen_ != obj.dataLen_) + return 0; + + return (memcmp(data_, obj.data_, dataLen_) == 0) ? 1 : 0; +} + +int CdTextItem::operator!=(const CdTextItem &obj) +{ + return (*this == obj) ? 0 : 1; +} + +const char *CdTextItem::packType2String(int isTrack, int packType) +{ + const char *ret = "UNKNOWN"; + + switch (packType) { + case CDTEXT_TITLE: + ret = "TITLE"; + break; + case CDTEXT_PERFORMER: + ret = "PERFORMER"; + break; + case CDTEXT_SONGWRITER: + ret = "SONGWRITER"; + break; + case CDTEXT_COMPOSER: + ret = "COMPOSER"; + break; + case CDTEXT_ARRANGER: + ret = "ARRANGER"; + break; + case CDTEXT_MESSAGE: + ret = "MESSAGE"; + break; + case CDTEXT_DISK_ID: + ret = "DISC_ID"; + break; + case CDTEXT_GENRE: + ret = "GENRE"; + break; + case CDTEXT_TOC_INFO1: + ret = "TOC_INFO1"; + break; + case CDTEXT_TOC_INFO2: + ret = "TOC_INFO2"; + break; + case CDTEXT_RES1: + ret = "RESERVED1"; + break; + case CDTEXT_RES2: + ret = "RESERVED2"; + break; + case CDTEXT_RES3: + ret = "RESERVED3"; + break; + case CDTEXT_RES4: + ret = "RESERVED4"; + break; + case CDTEXT_UPCEAN_ISRC: + if (isTrack) + ret = "ISRC"; + else + ret = "UPC_EAN"; + break; + case CDTEXT_SIZE_INFO: + ret = "SIZE_INFO"; + break; + } + + return ret; +} + +CdTextItem::PackType CdTextItem::int2PackType(int i) +{ + PackType t = CDTEXT_TITLE; + + switch (i) { + case 0x80: + t = CDTEXT_TITLE; + break; + case 0x81: + t = CDTEXT_PERFORMER; + break; + case 0x82: + t = CDTEXT_SONGWRITER; + break; + case 0x83: + t = CDTEXT_COMPOSER; + break; + case 0x84: + t = CDTEXT_ARRANGER; + break; + case 0x85: + t = CDTEXT_MESSAGE; + break; + case 0x86: + t = CDTEXT_DISK_ID; + break; + case 0x87: + t = CDTEXT_GENRE; + break; + case 0x88: + t = CDTEXT_TOC_INFO1; + break; + case 0x89: + t = CDTEXT_TOC_INFO2; + break; + case 0x8a: + t = CDTEXT_RES1; + break; + case 0x8b: + t = CDTEXT_RES2; + break; + case 0x8c: + t = CDTEXT_RES3; + break; + case 0x8d: + t = CDTEXT_RES4; + break; + case 0x8e: + t = CDTEXT_UPCEAN_ISRC; + break; + case 0x8f: + t = CDTEXT_SIZE_INFO; + break; + } + + return t; +} + +int CdTextItem::isBinaryPack(PackType type) +{ + int ret; + + switch (type) { + case CDTEXT_TOC_INFO1: + case CDTEXT_TOC_INFO2: + case CDTEXT_SIZE_INFO: + case CDTEXT_GENRE: + ret = 1; + break; + + default: + ret = 0; + break; + } + + return ret; +} + +int CdTextItem::isTrackPack(PackType type) +{ + int ret; + + switch (type) { + case CDTEXT_DISK_ID: + case CDTEXT_GENRE: + case CDTEXT_TOC_INFO1: + case CDTEXT_TOC_INFO2: + case CDTEXT_RES1: + case CDTEXT_RES2: + case CDTEXT_RES3: + case CDTEXT_RES4: + case CDTEXT_SIZE_INFO: + case CDTEXT_TITLE: + case CDTEXT_PERFORMER: + case CDTEXT_SONGWRITER: + case CDTEXT_COMPOSER: + case CDTEXT_ARRANGER: + case CDTEXT_MESSAGE: + case CDTEXT_UPCEAN_ISRC: + ret = 1; + break; + + default: + ret = 0; + break; + } + + return ret; +} diff --git a/trackdb/CdTextItem.h b/trackdb/CdTextItem.h new file mode 100644 index 0000000..8efbe35 --- /dev/null +++ b/trackdb/CdTextItem.h @@ -0,0 +1,92 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __CDTEXTITEM_H__ +#define __CDTEXTITEM_H__ + +#include <iostream> + +class CdTextItem { +public: + enum DataType { SBCC, DBCC, BINARY }; + + enum PackType { CDTEXT_TITLE = 0x80, + CDTEXT_PERFORMER = 0x81, + CDTEXT_SONGWRITER = 0x82, + CDTEXT_COMPOSER = 0x83, + CDTEXT_ARRANGER = 0x84, + CDTEXT_MESSAGE = 0x85, + CDTEXT_DISK_ID = 0x86, + CDTEXT_GENRE = 0x87, + CDTEXT_TOC_INFO1 = 0x88, + CDTEXT_TOC_INFO2 = 0x89, + CDTEXT_RES1 = 0x8a, + CDTEXT_RES2 = 0x8b, + CDTEXT_RES3 = 0x8c, + CDTEXT_RES4 = 0x8d, + CDTEXT_UPCEAN_ISRC = 0x8e, + CDTEXT_SIZE_INFO = 0x8f }; + + CdTextItem(PackType packType, int blockNr, const char *data); + + CdTextItem(PackType packType, int blockNr, + const unsigned char *data, long len); + + CdTextItem(int blockNr, unsigned char genreCode1, unsigned char genreCode2, + const char *description); + + CdTextItem(const CdTextItem &); + + ~CdTextItem(); + + DataType dataType() const { return dataType_; } + + PackType packType() const { return packType_; } + + int blockNr() const { return blockNr_; } + + const unsigned char *data() const { return data_; } + + long dataLen() const { return dataLen_; } + + void print(int isTrack, std::ostream &) const; + + int operator==(const CdTextItem &); + int operator!=(const CdTextItem &); + + static const char *packType2String(int isTrack, int packType); + + static PackType int2PackType(int); + static int isBinaryPack(PackType); + static int isTrackPack(PackType); + +private: + friend class CdTextContainer; + + DataType dataType_; + PackType packType_; + int blockNr_; // 0 ... 7 + + unsigned char *data_; + long dataLen_; + + CdTextItem *next_; +}; + +#endif diff --git a/trackdb/Cddb.cc b/trackdb/Cddb.cc new file mode 100644 index 0000000..eaa975f --- /dev/null +++ b/trackdb/Cddb.cc @@ -0,0 +1,1504 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <stdio.h> +#include <assert.h> +#include <errno.h> +#include <string.h> +#include <ctype.h> +#include <netdb.h> +#include <stdlib.h> +#include <unistd.h> +#include <signal.h> +#include <fcntl.h> +#include <sys/types.h> +#include <sys/socket.h> +#include <sys/time.h> +#include <sys/stat.h> +#include <netinet/in.h> +#include <arpa/inet.h> + +#include "Toc.h" +#include "CdTextItem.h" +#include "util.h" +#include "log.h" + +#include "Cddb.h" + + +#define CDDB_MAX_LINE_LEN 1024 +#define CDDB_DEFAULT_PORT_CDDBP 888 +#define CDDB_DEFAULT_PORT_HTTP 80 + + +static int getCode(const char *line, int code[3]); +static unsigned int cddbSum(unsigned int n); +static void convertEscapeSequences(const char *in, char *out); +static int parseQueryResult(char *line, char *category, char *diskId, + char *title); + + +static RETSIGTYPE alarmHandler(int sig) +{ + log_message(0, "ALARM"); +#if RETSIGTYPE != void + return 0; +#endif +} + +Cddb::Cddb(const Toc *t) +{ + toc_ = t; + + serverList_ = NULL; + selectedServer_ = NULL; + localCddbDirectory_ = NULL; + + fd_ = -1; + connected_ = 0; + queryResults_ = NULL; + cddbEntry_ = NULL; + httpCmd_ = NULL; + httpData_ = NULL; + httpMode_ = 0; + + timeout_ = 20; +} + +Cddb::~Cddb() +{ + ServerList *snext; + + shutdown(); + + clearQueryResults(); + clearCddbEntry(); + + delete[] localCddbDirectory_; + localCddbDirectory_ = NULL; + + delete[] httpCmd_; + httpCmd_ = NULL; + + delete[] httpData_; + httpData_ = NULL; + + while (serverList_ != NULL) { + snext = serverList_->next; + + delete[] serverList_->server; + serverList_->server = NULL; + + delete[] serverList_->httpCgiBin; + serverList_->httpCgiBin = NULL; + + delete[] serverList_->httpProxyServer; + serverList_->httpProxyServer = NULL; + + delete serverList_; + + serverList_ = snext; + } +} + +void Cddb::timeout(int t) +{ + if (t > 0) + timeout_ = t; +} + +void Cddb::localCddbDirectory(const char *dir) +{ + const char *homeDir; + + delete[] localCddbDirectory_; + + // replace ~/ by the path to the home directory as indicated by $HOME + if (dir[0] == '~' && dir[1] == '/' && (homeDir = getenv("HOME")) != NULL) { + localCddbDirectory_ = strdupvCC(homeDir, dir + 1, NULL); + } + else { + localCddbDirectory_ = strdupCC(dir); + } +} + +void Cddb::appendQueryResult(const char *category, const char *diskId, + const char *title, int exactMatch) +{ + QueryResults *run, *ent; + + for (run = queryResults_; run != NULL && run->next != NULL; + run = run->next) ; + + ent = new QueryResults; + + ent->category = strdupCC(category); + ent->diskId = strdupCC(diskId); + ent->title = strdupCC(title); + ent->exactMatch = (exactMatch != 0) ? 1 : 0; + + ent->next = NULL; + + if (run == NULL) + queryResults_ = ent; + else + run->next = ent; +} + +void Cddb::clearQueryResults() +{ + QueryResults *next; + + while (queryResults_ != NULL) { + next = queryResults_->next; + + delete[] queryResults_->category; + queryResults_->category = NULL; + + delete[] queryResults_->diskId; + queryResults_->diskId = NULL; + + delete[] queryResults_->title; + queryResults_->title = NULL; + + delete queryResults_; + queryResults_ = next; + } +} + +void Cddb::clearCddbEntry() +{ + int i; + + if (cddbEntry_ != NULL) { + delete[] cddbEntry_->diskTitle; + cddbEntry_->diskTitle = NULL; + + delete[] cddbEntry_->diskArtist; + cddbEntry_->diskArtist = NULL; + + delete[] cddbEntry_->diskExt; + cddbEntry_->diskExt = NULL; + + for (i = 0; i < cddbEntry_->ntracks; i++) { + delete[] cddbEntry_->trackTitles[i]; + cddbEntry_->trackTitles[i] = NULL; + + delete[] cddbEntry_->trackExt[i]; + cddbEntry_->trackExt[i] = NULL; + } + + delete[] cddbEntry_->trackTitles; + cddbEntry_->trackTitles = NULL; + + delete[] cddbEntry_->trackExt; + cddbEntry_->trackExt = NULL; + + delete cddbEntry_; + cddbEntry_ = NULL; + } +} + +/* Appends a CDDB server name to the server list. Format of server strings: + * <server> + * connect to <server>, default cddbp port, use cddbp protocol + * + * <server>:<port> + * connect to <server>, port <port>, use cddbp protocol + * + * <server>:<cgi-bin-path> + * connect to <server>, default http port, use http protocol, + * url: <cgi-bin-path> + * + * <server>:<port>:<cgi-bin-path> + * connect to <server>, port <port>, use http protocol, url: <cgi-bin-path> + * + * <server>:<port>:<cgi-bin-path>:<proxy-server> + * connect to <proxy-server>, default http port, use http protocol, + * url: http://<server>:<port>/<cgi-bin-path> + * + * <server>:<port>:<cgi-bin-path>:<proxy-server>:<proxy-port> + * connect to <proxy-server>, port <proxy-port>, use http protocol, + * url: http://<server>:<port>/<cgi-bin-path> + */ +void Cddb::appendServer(const char *s) +{ + ServerList *run, *ent; + char *name; + char *port; + char *httpCgiBin = NULL; + char *httpProxyServer = NULL; + char *httpProxyPort = NULL; + unsigned short portNr = CDDB_DEFAULT_PORT_CDDBP; + unsigned short httpProxyPortNr = CDDB_DEFAULT_PORT_HTTP; + + if (s == NULL || *s == 0) + return; + + name = strdupCC(s); + + if ((port = strchr(name, ':')) != NULL) { + *port = 0; + port++; + + if (!isdigit(*port)) { + httpCgiBin = port; + port = NULL; + portNr = CDDB_DEFAULT_PORT_HTTP; + } + else { + if ((httpCgiBin = strchr(port, ':')) != NULL) { + *httpCgiBin = 0; + httpCgiBin++; + } + } + + if (httpCgiBin != NULL && + (httpProxyServer = strchr(httpCgiBin, ':')) != NULL) { + *httpProxyServer = 0; + httpProxyServer++; + } + + if (httpProxyServer != NULL && + (httpProxyPort = strchr(httpProxyServer, ':')) != NULL) { + *httpProxyPort = 0; + httpProxyPort++; + } + } + + for (run = serverList_; run != NULL && run->next != NULL; run = run->next) { + if (strcmp(run->server, name) == 0) { + delete[] name; + return; + } + } + + if (run != NULL && strcmp(run->server, s) == 0) { + delete[] name; + return; + } + + if (port != NULL) + portNr = (unsigned short)strtoul(port, NULL, 0); + + if (httpProxyPort != NULL) + httpProxyPortNr = (unsigned short)strtoul(httpProxyPort, NULL, 0); + + ent = new ServerList; + ent->server = name; + ent->port = portNr; + ent->httpCgiBin = (httpCgiBin != NULL) ? strdupCC(httpCgiBin) : NULL; + if (httpProxyServer != NULL) { + ent->httpProxyServer = strdupCC(httpProxyServer); + ent->httpProxyPort = httpProxyPortNr; + } + else { + ent->httpProxyServer = NULL; + ent->httpProxyPort = 0; + } + ent->next = NULL; + + if (run == NULL) + serverList_ = ent; + else + run->next = ent; +} + +/* Tries to connect to a CDDB server. If no server was previously connected + * (selectedServer_ == NULL) all servers from the server list will be tested + * and the first successful connected server will be taken. + * Return: 0: OK + * 1: could not connect to any server + */ + +int Cddb::openConnection() +{ + ServerList *run; + struct hostent *hostEnt; + struct sockaddr_in sockAddr; + const char *server; + unsigned short port; + struct sigaction newAlarmHandler; + struct sigaction oldAlarmHandler; +#ifndef HAVE_INET_ATON + long inetAddr; +#endif + + if (fd_ >= 0) // already connected + return 0; + + memset(&newAlarmHandler, 0, sizeof(newAlarmHandler)); + sigemptyset(&(newAlarmHandler.sa_mask)); + +#ifdef UNIXWARE + newAlarmHandler.sa_handler = (void (*)()) alarmHandler; +#else + newAlarmHandler.sa_handler = alarmHandler; +#endif + + if (sigaction(SIGALRM, &newAlarmHandler, &oldAlarmHandler) != 0) { + log_message(-2, "CDDB: Cannot install alarm signal handler: %s", + strerror(errno)); + return 1; + } + alarm(0); + + for (run = (selectedServer_ != NULL) ? selectedServer_ : serverList_; + run != NULL; + run = (selectedServer_ != NULL) ? (ServerList*)0 : run->next) { + + server = run->server; + port = run->port; + + if (run->httpCgiBin != NULL) { + if (run->httpProxyServer != NULL) { + server = run->httpProxyServer; + port = run->httpProxyPort; + + log_message(1, + "CDDB: Connecting to http://%s:%u%s via proxy %s:%u ...", + run->server, run->port, run->httpCgiBin, server, port); + } + else { + log_message(1, + "CDDB: Connecting to http://%s:%u%s ...", server, port, + run->httpCgiBin); + } + } + else { + log_message(1, "CDDB: Connecting to cddbp://%s:%u ...", server, port); + } + +#ifdef HAVE_INET_ATON + if (!inet_aton(server, &sockAddr.sin_addr)) { +#else + if ((inetAddr = (long)inet_addr(server)) == -1) { +#endif + if ((hostEnt = gethostbyname(server)) == NULL || + hostEnt->h_addrtype != AF_INET) { + alarm(0); + log_message(-1, "CDDB: Cannot resolve hostname '%s' - skipping.", server); + continue; + } + else { + memcpy((char*) &sockAddr.sin_addr, hostEnt->h_addr, hostEnt->h_length); + } + } +#ifndef HAVE_INET_ATON + else { + memcpy((char*)&sockAddr.sin_addr, (char*)&inetAddr, sizeof(inetAddr)); + } +#endif + + log_message(4, "CDDB: Hostname: %s -> IP: %s", server, + inet_ntoa(sockAddr.sin_addr)); + + if ((fd_ = socket(AF_INET, SOCK_STREAM, 0)) < 0) { + log_message(-2, "CDDB: Cannot create socket: %s", strerror(errno)); + goto fail; + } + + sockAddr.sin_family = AF_INET; + sockAddr.sin_port = htons(port); + + alarm(timeout_); + + if (connect(fd_, (struct sockaddr*)&sockAddr, sizeof(sockAddr)) == 0) { + alarm(0); + log_message(1, "CDDB: Ok."); + selectedServer_ = run; + break; + } + else { + alarm(0); + log_message(-1, "CDDB: Failed to connect to '%s:%u: %s", server, port, + strerror(errno)); + closeConnection(); + } + } + + fail: + connected_ = 0; + + alarm(0); + + if (sigaction(SIGALRM, &oldAlarmHandler, NULL) != 0) { + log_message(-1, "CDDB: Cannot restore alarm signal handler: %s", + strerror(errno)); + } + + if (fd_ < 0) + return 1; + + return 0; +} + +/* Closes connection. + */ + +void Cddb::closeConnection() +{ + if (fd_ >= 0) { + close(fd_); + fd_ = -1; + connected_ = 0; + } +} + +/* Create some strings that are used for all communications via the http + * protocol. + */ +void Cddb::setupHttpData(const char *userName, const char *hostName, + const char *clientName, const char *version) +{ + delete[] httpCmd_; + + httpCmd_ = strdupvCC("&hello=", userName, "+", hostName, "+", + clientName, "+", version, + "&proto=1", NULL); + + delete[] httpData_; + + httpData_ = strdupvCC("User-Agent: ", clientName, "/", version, "\r\n", + "Accept: text/plain\r\n", NULL); + +} + +/* Tries to connect to a server of the internal server list and performs the + * the client-server handshake. + * Return: 0: OK + * 1: could not connect to any server + * 2: handshake failed + */ + +int Cddb::connectDb(const char *userName, const char *hostName, + const char *clientName, const char *version) +{ + int code[3]; + const char *response; + const char *cmdArgs[6]; + + if (connected_) + return 0; + + if (openConnection() != 0) + return 1; + + if (selectedServer_->httpCgiBin != NULL) { + httpMode_ = 1; + setupHttpData(userName, hostName, clientName, version); + return 0; + } + + response = getServerResponse(code); + + if (response == NULL) { + log_message(-2, "CDDB: EOF while waiting for server greeting."); + closeConnection(); + return 2; + } + + if (code[0] != 2) { + log_message(-2, "CDDB: Connection to server denied: %s", response); + return 2; + } + + log_message(4, "CDDB: Server greeting: %s", response); + + connected_ = 1; + + cmdArgs[0] = "cddb"; + cmdArgs[1] = "hello"; + cmdArgs[2] = userName; + cmdArgs[3] = hostName; + cmdArgs[4] = clientName; + cmdArgs[5] = version; + + if (sendCommand(6, cmdArgs) != 0) { + log_message(-2, "CDDB: Failed to send handshake command."); + return 2; + } + + response = getServerResponse(code); + + if (response == NULL) { + log_message(-2, "CDDB: EOF while waiting for server handshake response."); + return 2; + } + + if (code[0] != 2) { + log_message(-2, "CDDB: Server handshake failed: %s", response); + return 2; + } + + log_message(4, "CDDB: Handshake response: %s", response); + + return 0; +} + + +/* Print query for current toc + */ +void Cddb::printDbQuery() +{ + const char *cddbId; + int ntracks; + const Track *t; + Msf start, end; + long diskLength; + + ntracks = toc_->nofTracks(); + + cddbId = calcCddbId(); + + printf("%s ", cddbId); + + printf("%d ", ntracks); + + TrackIterator itr(toc_); + + for (t = itr.first(start, end); t != NULL; t = itr.next(start, end)) { + long trackStart = start.lba() + 150; + + printf("%ld ", trackStart); + } + + diskLength = toc_->length().min() * 60 + toc_->length().sec() + 2; + printf("%ld\n", diskLength); +} + +bool Cddb::printDbEntry() +{ + if (!cddbEntry_) + return false; + + if (cddbEntry_->diskArtist) + printf("Artist: %s\n", cddbEntry_->diskArtist); + if (cddbEntry_->diskTitle) + printf("Title: %s\n", cddbEntry_->diskTitle); + if (cddbEntry_->diskExt) + printf("Ext: %s\n", cddbEntry_->diskExt); + for (int i = 0; i < cddbEntry_->ntracks; i++) { + printf("Track %02d: %s\n", i+1, cddbEntry_->trackTitles[i]); + if (cddbEntry_->trackExt && + cddbEntry_->trackExt[i]) + printf("Trach %02d ext: %s\n", i+1, cddbEntry_->trackExt[i]); + } + + return true; +} + +/* Queries for entries that match the current 'toc_'. + * 'results' will be filled with a list of matching diskIds/category/title + * triples. 'results' will be NULL if no matching entry is found. + * Return: 0: OK + * 1: communication error occured + */ +int Cddb::queryDb(QueryResults **results) +{ + const char *cddbId; + const char **args; + const char *resp; + char qtitle[CDDB_MAX_LINE_LEN]; + char qcategory[CDDB_MAX_LINE_LEN]; + char qdiskId[CDDB_MAX_LINE_LEN]; + char respBuf[CDDB_MAX_LINE_LEN]; + char *buf; + int code[3]; + int err = 0; + int nargs; + int arg, i; + int ntracks; + const Track *t; + Msf start, end; + long diskLength; + + // clear previous results + clearQueryResults(); + + if (httpMode_) { + if (openConnection() != 0) + return 1; + } + + ntracks = toc_->nofTracks(); + + nargs = ntracks + 5; + + args = new const char*[nargs]; + arg = 0; + + args[arg++] = "cddb"; + args[arg++] = "query"; + + cddbId = calcCddbId(); + + args[arg++] = cddbId; + + buf = new char[20]; + sprintf(buf, "%d", ntracks); + args[arg++] = buf; + + TrackIterator itr(toc_); + + for (t = itr.first(start, end); t != NULL; t = itr.next(start, end)) { + long trackStart = start.lba() + 150; + buf = new char[20]; + + sprintf(buf, "%ld", trackStart); + args[arg++] = buf; + } + + buf = new char[20]; + diskLength = toc_->length().min() * 60 + toc_->length().sec() + 2; + sprintf(buf, "%ld", diskLength); + args[arg++] = buf; + + if (sendCommand(nargs, args) != 0) { + log_message(-2, "CDDB: Failed to send QUERY command."); + err = 1; goto fail; + } + + if ((resp = getServerResponse(code)) == NULL) { + log_message(-2, "CDDB: EOF while waiting for QUERY response."); + err = 1; goto fail; + } + + log_message(4, "CDDB: QUERY response: %s", resp); + + if (code[0] != 2) { + log_message(-2, "CDDB: QUERY failed: %s", resp); + err = 1; goto fail; + } + else { + if (code[2] == 0) { + // found exact match + strcpy(respBuf, resp + 3); + if (parseQueryResult(respBuf, qcategory, qdiskId, qtitle)) { + appendQueryResult(qcategory, qdiskId, qtitle, 1); + } + else { + log_message(-2, "CDDB: Received invalid QUERY response: %s", resp); + err = 1; goto fail; + } + } + else if(code[2] == 1) { + // found inexact matches + while ((resp = readLine()) != NULL && + strcmp(resp, ".") != 0) { + strcpy(respBuf, resp); + + log_message(4, "CDDB: Query data: %s", resp); + + if (parseQueryResult(respBuf, qcategory, qdiskId, qtitle)) { + appendQueryResult(qcategory, qdiskId, qtitle, 0); + } + else { + log_message(-2, "CDDB: Received invalid QUERY data: %s", resp); + err = 1; goto fail; + } + } + + if (resp == NULL) { + log_message(-2, "CDDB: EOF while reading QUERY data."); + err = 1; goto fail; + } + } + else { + // found no match + } + } + + + fail: + + if (httpMode_) + closeConnection(); + + for (i = 3; i < arg; i++) + delete[] args[i]; + + delete[] args; + + *results = queryResults_; + return err; + +} + +/* Reads CDDB entry for specified category and disk id. 'entry' will be + * set to the stucture containing the record data. + * Return: 0: OK + * 1: communication error or could not retrieve CDDB entry + */ +int Cddb::readDb(const char *category, const char *diskId, CddbEntry **entry) +{ + int code[3]; + const char *args[4]; + const char *resp; + int localRecordFd = -1; + + clearCddbEntry(); + + if (httpMode_) { + if (openConnection() != 0) + return 1; + } + + args[0] = "cddb"; + args[1] = "read"; + args[2] = category; + args[3] = diskId; + + if (sendCommand(4, args) != 0) { + log_message(-2, "CDDB: Failed to send READ command."); + goto fail; + } + + if ((resp = getServerResponse(code)) == NULL) { + log_message(-2, "CDDB: EOF while waiting for READ response."); + goto fail; + } + + log_message(4, "CDDB: READ response: %s", resp); + + if (code[0] == 2) { + if ((localRecordFd = createLocalCddbFile(category, diskId)) == -2) { + log_message(-1, "Existing local CDDB record for %s/%s will not be overwritten.", category, diskId); + } + if (readDbEntry(localRecordFd) != 0) { + log_message(-2, "CDDB: Received invalid database entry."); + goto fail; + } + } + else { + log_message(-2, "CDDB: READ failed: %s", resp); + goto fail; + } + + *entry = cddbEntry_; + + if (httpMode_) + closeConnection(); + + if (localRecordFd >= 0) + close(localRecordFd); + + return 0; + + fail: + + if (httpMode_) + closeConnection(); + + if (localRecordFd >= 0) + close(localRecordFd); + + *entry = NULL; + return 1; +} + +/* Shuts down the connection to the CDDB server. + */ +void Cddb::shutdown() +{ + const char *resp; + const char *args[1]; + int code[3]; + + if (fd_ < 0) + return; + + if (!connected_) { + closeConnection(); + return; + } + + args[0] = "quit"; + + if (sendCommand(1, args) == 0) { + if ((resp = getServerResponse(code)) == NULL) { + log_message(-1, "CDDB: EOF while waiting for QUIT response."); + } + else { + log_message(4, "CDDB: QUIT response: %s", resp); + } + } + else { + log_message(-1, "CDDB: Failed to send QUIT command."); + } + + closeConnection(); +} + + +/* Filter characters of given string so that it is suitable as CD-TEXT data. + */ +static char *cdTextFilter(char *s) +{ + char *p = s; + + while (*p != 0) { + if (*p == '\n' || *p == '\t') + *p = ' '; + + p++; + } + + return s; +} + +/* Adds the data of the retrieved CDDB record stored in 'cddbEntry_' to + * the given toc as CD-TEXT data. + * Return: 1: CD-TEXT data was added + * 0: toc was not modified + */ +int Cddb::addAsCdText(Toc *toc) +{ + int havePerformer = 0; + int haveTitle = 0; + int haveMessage = 0; + int trun; + CdTextItem *item; + + if (cddbEntry_ == NULL) + return 0; + + if (cddbEntry_->diskTitle != NULL) + haveTitle = 1; + + if (cddbEntry_->diskArtist != NULL) + havePerformer = 1; + + if (cddbEntry_->diskExt != NULL) + haveMessage = 1; + + for (trun = 0; trun < cddbEntry_->ntracks; trun++) { + if (cddbEntry_->trackTitles[trun] != NULL) + haveTitle = 1; + + if (cddbEntry_->trackExt[trun] != NULL) + haveMessage = 1; + } + + if (!haveTitle && !havePerformer && !haveMessage) + return 0; + + toc->cdTextLanguage(0, 9); + + if (haveTitle) { + item = new CdTextItem(CdTextItem::CDTEXT_TITLE, 0, + (cddbEntry_->diskTitle != NULL) ? cdTextFilter(cddbEntry_->diskTitle) : ""); + + toc->addCdTextItem(0, item); + } + + if (havePerformer) { + item = new CdTextItem(CdTextItem::CDTEXT_PERFORMER, 0, + (cddbEntry_->diskArtist != NULL) ? cdTextFilter(cddbEntry_->diskArtist) : ""); + + toc->addCdTextItem(0, item); + } + + if (haveMessage) { + item = new CdTextItem(CdTextItem::CDTEXT_MESSAGE, 0, + (cddbEntry_->diskExt != NULL) ? cdTextFilter(cddbEntry_->diskExt) : ""); + + toc->addCdTextItem(0, item); + } + + for (trun = 0; trun < toc->nofTracks(); trun++) { + if (haveTitle) { + + item = new CdTextItem(CdTextItem::CDTEXT_TITLE, 0, + (trun < cddbEntry_->ntracks && cddbEntry_->trackTitles[trun] != NULL) ? cdTextFilter(cddbEntry_->trackTitles[trun]) : ""); + + toc->addCdTextItem(trun + 1, item); + } + + if (havePerformer) { + item = new CdTextItem(CdTextItem::CDTEXT_PERFORMER, 0, + (cddbEntry_->diskArtist != NULL) ? cdTextFilter(cddbEntry_->diskArtist) : ""); + + toc->addCdTextItem(trun + 1, item); + } + + if (haveMessage) { + item = new CdTextItem(CdTextItem::CDTEXT_MESSAGE, 0, + (trun < cddbEntry_->ntracks && cddbEntry_->trackExt[trun] != NULL) ? cdTextFilter(cddbEntry_->trackExt[trun]) : ""); + + toc->addCdTextItem(trun + 1, item); + } + } + + return 1; +} + + +/* Reads a line (until '\n') from 'fd_'. Checks for timeouts. + */ +const char *Cddb::readLine() +{ + static char buf[CDDB_MAX_LINE_LEN]; + int pos = 0; + struct timeval tv; + fd_set readFds; + int ret; + char *s; + int characterRead = 0; + + while (pos < CDDB_MAX_LINE_LEN) { + FD_ZERO(&readFds); + FD_SET(fd_, &readFds); + + tv.tv_sec = timeout_; + tv.tv_usec = 0; + + ret = select(fd_ + 1, &readFds, NULL, NULL, &tv); + + if (ret == 0) { + log_message(-2, "CDDB: Timeout while reading data."); + return NULL; + } + + if (ret < 0) { + log_message(-2, "CDDB: Error while waiting for data: %s", strerror(errno)); + return NULL; + } + + ret = read(fd_, &(buf[pos]), 1); + + if (ret == 0) { + // end of file + break; + } + + if (ret < 0) { + log_message(-2, "CDDB: Error while reading data: %s", strerror(errno)); + return NULL; + } + + characterRead = 1; + + if (buf[pos] == '\n') + break; + + pos++; + } + + if (pos >= CDDB_MAX_LINE_LEN) + buf[CDDB_MAX_LINE_LEN - 1] = 0; + else + buf[pos] = 0; + + if (buf[0] == 0 && !characterRead) { + // end of file + return NULL; + } + + // skip leading blanks + for (s = buf; *s != 0 && isspace(*s); s++) ; + + // skip trailing blanks + for (pos = strlen(s) - 1; pos >= 0 && isspace(s[pos]); pos--) + s[pos] = 0; + + log_message(5, "CDDB: Data read: %s", s); + + return s; +} + +/* Checks if 'line' contains a cddb server status and sets 'code' to the + * server code. + * Return: 0: 'line' is not a cddb server status line + * 1: 'line' is a cddb server status line, 'code' contains valid data + */ +static int getCode(const char *line, int code[3]) +{ + if (isdigit(line[0]) && isdigit(line[1]) && isdigit(line[2]) && + isspace(line[3])) { + code[0] = line[0] - '0'; + code[1] = line[1] - '0'; + code[2] = line[2] - '0'; + + return 1; + } + + return 0; +} + + +/* Reads lines from 'fd_' until a valid server status line is encountered. + * 'code' is set to the server status code on success. + * Return: server status line or 'NULL' on timeout or communication error + */ +const char *Cddb::getServerResponse(int code[3]) +{ + const char *line; + + while ((line = readLine()) != NULL && + !getCode(line, code)) ; + + return line; +} + +/* Sends command in 'args' to 'fd_'. cdbbp and http protocols are handled. + * Return: 0: OK + * 1: communication error occured. + */ +int Cddb::sendCommand(int nargs, const char *args[]) +{ + char portBuf[20]; + int len = 0; + int err = 0; + char *cmd, *p; + char *httpCmd = NULL; + int run, ret; + struct timeval tv; + fd_set writeFds; + + // build command line + for (run = 0; run < nargs; run++) + len += strlen(args[run]) + 1; + + cmd = new char[len + 1]; + *cmd = 0; + + for (run = 0; run < nargs; run++) { + strcat(cmd, args[run]); + if (run != nargs - 1) { + if (httpMode_) + strcat(cmd, "+"); + else + strcat(cmd, " "); + } + } + + if (httpMode_) { + if (selectedServer_->httpProxyServer != NULL) { + sprintf(portBuf, ":%u", selectedServer_->port); + httpCmd = strdupvCC("GET http://", selectedServer_->server, + portBuf, selectedServer_->httpCgiBin, + "?cmd=", cmd, httpCmd_, " HTTP/1.0\r\n", + "Host: ", selectedServer_->server, "\r\n", + httpData_, "\r\n", NULL); + } + else { + httpCmd = strdupvCC("GET ", selectedServer_->httpCgiBin, + "?cmd=", cmd, httpCmd_, " HTTP/1.0\r\n", + "Host: ", selectedServer_->server, "\r\n", + httpData_, "\r\n", NULL); + } + + delete[] cmd; + cmd = httpCmd; + httpCmd = NULL; + + log_message(4, "CDDB: Sending command '%s'...", cmd); + } + else { + log_message(4, "CDDB: Sending command '%s'...", cmd); + + strcat(cmd, "\n"); + } + + len = strlen(cmd); + p = cmd; + + while (len > 0) { + FD_ZERO(&writeFds); + FD_SET(fd_, &writeFds); + + tv.tv_sec = timeout_; + tv.tv_usec = 0; + + ret = select(fd_ + 1, NULL, &writeFds, NULL, &tv); + + if (ret == 0) { + log_message(-2, "CDDB: Timeout while sending data."); + err = 1; goto fail; + } + + if (ret < 0) { + log_message(-2, "CDDB: Error while waiting for send: %s", strerror(errno)); + err = 1; goto fail; + } + + ret = write(fd_, p, 1); + + if (ret < 0) { + log_message(-2, "CDDB: Failed to send command '%s': %s", cmd, + strerror(errno)); + err = 1; goto fail; + } + + if (ret != 1) { + log_message(-2, "CDDB: Failed to send command '%s'.", cmd); + err = 1; goto fail; + } + + len--; + p++; + } + + log_message(4, "CDDB: Ok."); + + fail: + delete[] cmd; + + return err; +} + +static unsigned int cddbSum(unsigned int n) +{ + unsigned int ret; + + ret = 0; + while (n > 0) { + ret += (n % 10); + n /= 10; + } + + return ret; +} + +const char *Cddb::calcCddbId() +{ + const Track *t; + Msf start, end; + unsigned int n = 0; + unsigned int o = 0; + int tcount = 0; + static char buf[20]; + unsigned long id; + + TrackIterator itr(toc_); + + for (t = itr.first(start, end); t != NULL; t = itr.next(start, end)) { + if (t->type() == TrackData::AUDIO) { + n += cddbSum(start.min() * 60 + start.sec() + 2/* gap offset */); + o = end.min() * 60 + end.sec(); + tcount++; + } + } + + id = (n % 0xff) << 24 | o << 8 | tcount; + sprintf(buf, "%08lx", id); + + return buf; +} + +static void convertEscapeSequences(const char *in, char *out) +{ + while (*in != 0) { + if (*in == '\\') { + switch (*(in + 1)) { + case 'n': + *out++ = '\n'; + in++; + break; + + case 't': + *out++ = '\t'; + in++; + break; + + case '\\': + *out++ = '\\'; + in++; + break; + + default: + *out++ = '\\'; + break; + } + } + else { + *out++ = *in; + } + + in++; + } + + *out = 0; +} + +/* Retrieves the category, disk ID and title from a query response string. + * The provided strings 'category', 'diskId' and 'title' must point to + * existing buffers with at least the same length as 'line'. + * Return: 1 if 'line' was successfully parsed, else 0 + */ +static int parseQueryResult(char *line, char *category, char *diskId, + char *title) +{ + const char *sep = " \t"; + char *p; + + if ((p = strtok(line, sep)) != NULL) { + strcpy(category, p); + + if ((p = strtok(NULL, sep)) != NULL) { + strcpy(diskId, p); + + if ((p = strtok(NULL, "")) != NULL) { + // remove leading white space + while (*p != 0 && isspace(*p)) + p++; + + convertEscapeSequences(p, title); + + // remove newline from title string + if ((p = strchr(title, '\n')) != NULL) + *p = 0; + + return 1; + } + } + } + + return 0; +} + +/* Reads a CDDB record from 'fd_' and fills 'cddbEntry_' with the required + * data. + * Return: 0: OK + * 1: communication error occured + */ +int Cddb::readDbEntry(int localRecordFd) +{ + const char *resp; + char buf[CDDB_MAX_LINE_LEN]; + char *line; + char *p, *s; + char *val; + int ntracks = toc_->nofTracks(); + int i, trackNr; + + cddbEntry_ = new CddbEntry; + + cddbEntry_->diskTitle = NULL; + cddbEntry_->diskArtist = NULL; + cddbEntry_->diskExt = NULL; + cddbEntry_->ntracks = ntracks; + cddbEntry_->trackTitles = new char*[ntracks]; + cddbEntry_->trackExt = new char*[ntracks]; + + for (i = 0; i < ntracks; i++) { + cddbEntry_->trackTitles[i] = NULL; + cddbEntry_->trackExt[i] = NULL; + } + + + + while ((resp = readLine()) != NULL && strcmp(resp, ".") != 0) { + log_message(4, "CDDB: READ data: %s", resp); + + if (localRecordFd >= 0) { + // save to local CDDB record file + fullWrite(localRecordFd, resp, strlen(resp)); + fullWrite(localRecordFd, "\n", 1); + } + + convertEscapeSequences(resp, buf); + + // remove comments + //if ((p = strchr(buf, '#')) != NULL) + // *p = 0; + if (buf[0] == '#') + buf[0] = 0; // xxam! + + // remove leading blanks + for (line = buf; *line != 0 && isspace(*line); line++) ; + + if ((val = strchr(line, '=')) != NULL) { + *val = 0; + val++; + + if (strcmp(line, "DTITLE") == 0) { + if (*val != 0) { + if (cddbEntry_->diskArtist == NULL) { + cddbEntry_->diskArtist = strdupCC(val); + } + else { + s = strdup3CC(cddbEntry_->diskArtist, val, NULL); + delete[] cddbEntry_->diskArtist; + cddbEntry_->diskArtist = s; + } + } + } + else if (strcmp(line, "EXTD") == 0) { + if (*val != 0) { + if (cddbEntry_->diskExt == NULL) { + cddbEntry_->diskExt = strdupCC(val); + } + else { + s = strdup3CC(cddbEntry_->diskExt, val, NULL); + delete[] cddbEntry_->diskExt; + cddbEntry_->diskExt = s; + } + } + } + else if (strncmp(line, "TTITLE", 6) == 0) { + if (*val != 0) { + trackNr = atoi(line + 6); + if (trackNr >= 0 && trackNr < ntracks) { + if (cddbEntry_->trackTitles[trackNr] == NULL) { + cddbEntry_->trackTitles[trackNr] = strdupCC(val); + } + else { + s = strdup3CC(cddbEntry_->trackTitles[trackNr], val, NULL); + delete[] cddbEntry_->trackTitles[trackNr]; + cddbEntry_->trackTitles[trackNr] = s; + } + } + } + } + else if (strncmp(line, "EXTT", 4) == 0) { + if (*val != 0) { + trackNr = atoi(line + 4); + if (trackNr >= 0 && trackNr < ntracks) { + if (cddbEntry_->trackExt[trackNr] == NULL) { + cddbEntry_->trackExt[trackNr] = strdupCC(val); + } + else { + s = strdup3CC(cddbEntry_->trackExt[trackNr], val, NULL); + delete[] cddbEntry_->trackExt[trackNr]; + cddbEntry_->trackExt[trackNr] = s; + } + } + } + } + } + } + + if (resp == NULL) { + log_message(-2, "CDDB: EOF while reading database entry."); + goto fail; + } + + + if (cddbEntry_->diskArtist != NULL) { + if ((p = strchr(cddbEntry_->diskArtist, '/')) != NULL) { + *p = 0; + + // remove leading white space of disk title + for (s = p + 1; *s != 0 && isspace(*s); s++) ; + + cddbEntry_->diskTitle = strdupCC(s); + + // remove trailing white space of disk artist + for (p = p - 1; p >= cddbEntry_->diskArtist && isspace(*p); p--) + *p = 0; + } + else { + cddbEntry_->diskTitle = strdupCC(cddbEntry_->diskArtist); + } + } + + return 0; + + fail: + clearCddbEntry(); + + return 1; +} + + +int Cddb::createLocalCddbFile(const char *category, const char *diskId) +{ + char *categoryDir = NULL; + char *recordFile = NULL; + struct stat sbuf; + int ret; + int fd = -1; + + if (localCddbDirectory_ == NULL) + return -1; + + ret = stat(localCddbDirectory_, &sbuf); + + if (ret != 0 && errno == ENOENT) { + log_message(-1, "CDDB: Local CDDB directory \"%s\" does not exist.", + localCddbDirectory_); + return -1; + } + else if (ret == 0) { + if (!S_ISDIR(sbuf.st_mode)) { + log_message(-2, "CDDB: \"%s\" is not a directory.", localCddbDirectory_); + return -1; + } + } + else { + log_message(-2, "CDDB: stat of \"%s\" failed: %s", localCddbDirectory_, + strerror(errno)); + return -1; + } + + categoryDir = strdup3CC(localCddbDirectory_, "/", category); + + ret = stat(categoryDir, &sbuf); + + if (ret != 0 && errno == ENOENT) { + if (mkdir(categoryDir, 0777) != 0) { + log_message(-2, "CDDB: Cannot create directory \"%s\": %s", categoryDir, + strerror(errno)); + goto fail; + } + } + else if (ret == 0) { + if (!S_ISDIR(sbuf.st_mode)) { + log_message(-2, "CDDB: \"%s\" is not a directory.", categoryDir); + } + } + else { + log_message(-2, "CDDB: stat of \"%s\" failed: %s", categoryDir, + strerror(errno)); + goto fail; + } + + recordFile = strdup3CC(categoryDir, "/", diskId); + + ret = stat(recordFile, &sbuf); + + if (ret != 0 && errno == ENOENT) { + if ((fd = open(recordFile, O_WRONLY|O_CREAT, 0666)) < 0) { + log_message(-2, "CDDB: Cannot create CDDB record file \"%s\": %s", + recordFile, strerror(errno)); + fd = -1; + goto fail; + } + } + else if (ret == 0) { + fd = -2; + goto fail; + } + else { + log_message(-2, "CDDB: stat of \"%s\" failed: %s", categoryDir, + strerror(errno)); + goto fail; + } + + fail: + + delete[] categoryDir; + delete[] recordFile; + + return fd; +} diff --git a/trackdb/Cddb.h b/trackdb/Cddb.h new file mode 100644 index 0000000..66fb5b3 --- /dev/null +++ b/trackdb/Cddb.h @@ -0,0 +1,118 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/* + * Retrieve CDDB data for a 'Toc' + */ + +#ifndef __CDDB_H__ +#define __CDDB_H__ + +class Toc; + +class Cddb { +public: + struct QueryResults { + char *category; + char *diskId; + char *title; + int exactMatch; + struct QueryResults *next; + }; + + struct CddbEntry { + char *diskTitle; + char *diskArtist; + char *diskExt; + int ntracks; + char **trackTitles; + char **trackExt; + }; + + Cddb(const Toc *); + ~Cddb(); + + void localCddbDirectory(const char *); + void appendServer(const char *s); + + void timeout(int); + + int connectDb(const char *userName, const char *hostName, + const char *clientName, const char *version); + + int queryDb(QueryResults **); + + int readDb(const char *category, const char *diskId, CddbEntry **); + + int addAsCdText(Toc *toc); + + void printDbQuery(); + + // Print the found CDDB entry to stdout. Returns false if no entry + // available. + bool printDbEntry(); + +private: + struct ServerList { + char *server; + unsigned short port; + char *httpCgiBin; + char *httpProxyServer; + unsigned short httpProxyPort; + struct ServerList *next; + }; + + + const Toc *toc_; + ServerList *serverList_; // list of CDDB servers + ServerList *selectedServer_; + + char *localCddbDirectory_; + + int fd_; // file descriptor for connection to CDDB server + int connected_; // 1 if connection to CDDB server was established, else 0 + int timeout_; // timeout in seconds + + int httpMode_; + char *httpCmd_; + char *httpData_; + + QueryResults *queryResults_; + CddbEntry *cddbEntry_; + + int openConnection(); + void closeConnection(); + void setupHttpData(const char *userName, const char *hostName, + const char *clientName, const char *version); + + void appendQueryResult(const char *category, const char *diskId, + const char *title, int exactMatch); + void clearQueryResults(); + void clearCddbEntry(); + + const char *readLine(); + const char *getServerResponse(int code[3]); + int sendCommand(int nargs, const char *args[]); + const char *calcCddbId(); + int readDbEntry(int); + void shutdown(); + int createLocalCddbFile(const char *category, const char *diskId); +}; + +#endif diff --git a/trackdb/Cue2Toc.cc b/trackdb/Cue2Toc.cc new file mode 100644 index 0000000..398f0dc --- /dev/null +++ b/trackdb/Cue2Toc.cc @@ -0,0 +1,986 @@ +/* cue2toc.c - conversion routines + * Copyright (C) 2004 Matthias Czapla <dermatsch@gmx.de> + * + * This file is part of cue2toc. + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <unistd.h> +#include <errno.h> +#include <stdarg.h> + +#include "Cue2Toc.h" +#include "TrackData.h" + +#define TCBUFLEN 9 /* Buffer length for timecode strings (HH:MM:SS) */ +#define MAXCMDLEN 10 /* Longest command (currently SONGWRITER) */ + +long tc2fr(const char *); +int fr2tc(char *, long fr); + +/* + * Input is divied into tokens that are separated by whitespace, horizantal + * tabulator, line feed and carriage return. Tokens can be either commands + * from a fixed set or strings. If a string is to contain any of the token + * delimiting characters it must be enclosed in double quotes. + */ + +static const char token_delimiter[] = { ' ', '\t', '\n', '\r' }; + +/* Return true if c is one of token_delimiter */ +static int +isdelim(int c) +{ + int i; + int n = sizeof(token_delimiter); + + for (i = 0; i < n; i++) + if (c == token_delimiter[i]) + return 1; + return 0; +} + +/* Used as return type for get_command and index into cmds */ +enum command { REM, CATALOG, CDTEXTFILE, + FILECMD, PERFORMER, SONGWRITER, TITLE, TRACK, FLAGS, DCP, + FOURCH, PRE, SCMS, ISRC, PREGAP, INDEX, POSTGAP, BINARY, + MOTOROLA, AIFF, WAVE, MP3, OGG, UNKNOWN, END }; + +/* Except the last two these are the valid CUE commands */ +char cmds[][MAXCMDLEN + 1] = { "REM", "CATALOG", "CDTEXTFILE", + "FILE", "PERFORMER", "SONGWRITER", "TITLE", "TRACK", "FLAGS", "DCP", + "4CH", "PRE", "SCMS", "ISRC", "PREGAP", "INDEX", "POSTGAP", "BINARY", + "MOTOROLA", "AIFF", "WAVE", "MP3", "OGG", "UNKNOWN", "END" }; + +/* These are for error messages */ +static const char *fname = "stdin"; +static long line; /* current line number */ +static long tokenstart; /* line where last token started */ + +/* To generate meaningful error messages in check_once */ +enum scope { CUESHEET, GLOBAL, ONETRACK }; + +/* Fatal error while processing input file */ +static void +err_fail(const char *s) +{ + fprintf(stderr, "%s:%ld: %s\n", fname, tokenstart, s); + exit(EXIT_FAILURE); +} + +/* Fatal error */ +static void +err_fail2(const char *s) +{ + fprintf(stderr, "%s\n", s); + exit(EXIT_FAILURE); +} + +/* EOF while expecting more */ +static void +err_earlyend() +{ + fprintf(stderr, "%s:%ld: Premature end of file\n", fname, line); + exit(EXIT_FAILURE); +} + +/* Warning. Keep on going. */ +static void +err_warn(const char *s) +{ + fprintf(stderr, "%s:%ld: Warning, %s\n", fname, tokenstart, s); +} + +/* Get next command from file */ +static enum command +get_command(FILE *f) +{ + int c; + char buf[MAXCMDLEN + 1]; + int i = 0; + + /* eat whitespace */ + do { + c = getc(f); + if (c == '\n') + line++; + } while (isdelim(c)); + + if (c == EOF) + return END; + + tokenstart = line; + + /* get command, transform to upper case */ + do { + buf[i++] = toupper(c); + c = getc(f); + } while (!isdelim(c) && c!= EOF && i < MAXCMDLEN); + + if (!isdelim(c)) return UNKNOWN; /* command longer than MAXCMDLEN */ + if (c == EOF) return END; + if (c == '\n') line++; + + buf[i] = '\0'; + + if (strcmp(buf, cmds[REM]) == 0) return REM; + else if (strcmp(buf, cmds[CATALOG]) == 0) return CATALOG; + else if (strcmp(buf, cmds[CDTEXTFILE]) == 0) return CDTEXTFILE; + else if (strcmp(buf, cmds[FILECMD]) == 0) return FILECMD; + else if (strcmp(buf, cmds[PERFORMER]) == 0) return PERFORMER; + else if (strcmp(buf, cmds[SONGWRITER]) == 0) return SONGWRITER; + else if (strcmp(buf, cmds[TITLE]) == 0) return TITLE; + else if (strcmp(buf, cmds[TRACK]) == 0) return TRACK; + else if (strcmp(buf, cmds[FLAGS]) == 0) return FLAGS; + else if (strcmp(buf, cmds[DCP]) == 0) return DCP; + else if (strcmp(buf, cmds[FOURCH]) == 0) return FOURCH; + else if (strcmp(buf, cmds[PRE]) == 0) return PRE; + else if (strcmp(buf, cmds[SCMS]) == 0) return SCMS; + else if (strcmp(buf, cmds[ISRC]) == 0) return ISRC; + else if (strcmp(buf, cmds[PREGAP]) == 0) return PREGAP; + else if (strcmp(buf, cmds[INDEX]) == 0) return INDEX; + else if (strcmp(buf, cmds[POSTGAP]) == 0) return POSTGAP; + else if (strcmp(buf, cmds[BINARY]) == 0) return BINARY; + else if (strcmp(buf, cmds[MOTOROLA]) == 0) return MOTOROLA; + else if (strcmp(buf, cmds[AIFF]) == 0) return AIFF; + else if (strcmp(buf, cmds[WAVE]) == 0) return WAVE; + else if (strcmp(buf, cmds[MP3]) == 0) return MP3; + else if (strcmp(buf, cmds[OGG]) == 0) return OGG; + else return UNKNOWN; +} + +/* Skip leading token delimiters then read at most n chars from f into s. + * Put terminating Null at the end of s. This implies that s must be + * really n + 1. Return number of characters written to s. The only case to + * return zero is on EOF before any character was read. + * Exit the program indicating failure if string is longer than n. */ +static size_t +get_string(FILE *f, char *s, size_t n) +{ + int c; + size_t i = 0; + + /* eat whitespace */ + do { + c = getc(f); + if (c == '\n') + line++; + } while (isdelim(c)); + + if (c == EOF) + return 0; + + tokenstart = line; + + if (c == '\"') { + c = getc(f); + if (c == '\n') line++; + while (c != '\"' && c != EOF && i < n) { + s[i++] = c; + c = getc(f); + if (c == '\n') line++; + } + if (i == n && c != '\"' && c != EOF) + err_fail("String too long"); + } else { + while (!isdelim(c) && c != EOF && i < n) { + s[i++] = c; + c = getc(f); + } + if (i == n && !isdelim(c) && c != EOF) + err_fail("String too long"); + } + if (i == 0) err_fail("Empty string"); + if (c == '\n') line++; + s[i] = '\0'; + + return i; +} + +/* Return track mode */ +static TrackData::Mode get_track_mode(FILE *f) +{ + char buf[] = "MODE1/2048"; + char *pbuf = buf; + + if (get_string(f, buf, sizeof(buf) - 1) < 1) + err_fail("Illegal track mode"); + + /* transform to upper case */ + while (*pbuf) { + *pbuf = toupper(*pbuf); + pbuf++; + } + + if (strcmp(buf, "AUDIO") == 0) return TrackData::AUDIO; + if (strcmp(buf, "MODE1/2048") == 0) return TrackData::MODE1; + if (strcmp(buf, "MODE1/2352") == 0) return TrackData::MODE1_RAW; + if (strcmp(buf, "MODE2/2336") == 0) return TrackData::MODE2; + if (strcmp(buf, "MODE2/2352") == 0) return TrackData::MODE2_RAW; + + err_fail("Unsupported track mode"); + return TrackData::AUDIO; +} + +static void check_once(enum command cmd, char *s, enum scope sc); + +/* Read at most CDTEXTLEN chars into s */ +static void +get_cdtext(FILE *f, enum command cmd, char *s, enum scope sc) +{ + check_once(cmd, s, sc); + if (get_string(f, s, CDTEXTLEN) < 1) + err_earlyend(); +} + +/* All strings have their first character initialized to '\0' so if s[0] + is not Null the cmd has already been seen in input. In this case print + a message end exit program indicating failure. The only purpose of the + arguments cmd and sc is to print meaningful error messages. */ +static void +check_once(enum command cmd, char *s, enum scope sc) +{ + if (s[0] == '\0') + return; + fprintf(stderr, "%s:%ld: %s allowed only once", fname, line, cmds[cmd]); + switch (sc) { + case CUESHEET: fprintf(stderr, "\n"); break; + case GLOBAL: fprintf(stderr, " in global section\n"); break; + case ONETRACK: fprintf(stderr, " per track\n"); break; + } + exit(EXIT_FAILURE); +} + +/* Allocate, initialize and return new track */ +static struct trackspec* +new_track(void) +{ + struct trackspec *track; + int i; + + if ((track = (struct trackspec*) malloc(sizeof(struct trackspec))) + == NULL) + err_fail("Memory allocation error in new_track()"); + + track->copy = track->pre_emphasis = track->four_channel_audio + = track->pregap_data_from_file = 0; + track->isrc[0] = track->title[0] = track->performer[0] + = track->songwriter[0] = track->filename[0] = '\0'; + track->pregap = track->start = track->postgap = -1; + + for (i = 0; i < NUM_OF_INDEXES; i++) + track->indexes[i] = -1; + track->next = NULL; + + return track; +} + +/* Read the cuefile and return a pointer to the cuesheet */ +struct cuesheet* +read_cue(const char *cuefile, const char *wavefile) +{ + FILE *f; + enum command cmd; + struct cuesheet *cs = NULL; + struct trackspec *track = NULL; + size_t n; + int c; + char file[FILENAMELEN + 1]; + char timecode_buffer[TCBUFLEN]; + char devnull[FILENAMELEN + 1]; /* just for eating CDTEXTFILE arg */ + + if (NULL == cuefile) { + f = stdin; + } else if (NULL == (f = fopen(cuefile, "r"))) { + fprintf(stderr, "Could not open file \"%s\" for " + "reading: %s\n", cuefile, strerror(errno)); + exit(EXIT_FAILURE); + } + if (cuefile) + fname = cuefile; + + if ((cs = (struct cuesheet*) malloc(sizeof(struct cuesheet))) == NULL) + err_fail("Memory allocation error in read_cue()"); + + cs->catalog[0] = '\0'; + cs->type = (session_type)0; + cs->title[0] = '\0'; + cs->performer[0] = '\0'; + cs->songwriter[0] = '\0'; + cs->tracklist = NULL; + + file[0] = '\0'; + line = 1; + + /* global section */ + while ((cmd = get_command(f)) != TRACK) { + switch (cmd) { + case UNKNOWN: + err_fail("Unknown command"); + case END: + err_earlyend(); + case REM: + c = getc(f); + while (c != '\n' && c != EOF) + c = getc(f); + break; + case CDTEXTFILE: + err_warn("ignoring CDTEXTFILE..."); + if (get_string(f, devnull, FILENAMELEN) == 0) + err_warn("Syntactically incorrect " + "CDTEXTFILE command. But who " + "cares..."); + break; + case CATALOG: + check_once(CATALOG, cs->catalog, CUESHEET); + n = get_string(f, cs->catalog, 13); + if (n != 13) + err_fail("Catalog number must be 13 " + "characters long"); + break; + case TITLE: + get_cdtext(f, TITLE, cs->title, GLOBAL); + break; + case PERFORMER: + get_cdtext(f, PERFORMER, cs->performer, GLOBAL); + break; + case SONGWRITER: + get_cdtext(f, SONGWRITER, cs->songwriter, GLOBAL); + break; + case FILECMD: + check_once(FILECMD, file, GLOBAL); + if (get_string(f, file, FILENAMELEN) < 1) + err_earlyend(); + + switch (cmd = get_command(f)) { + case MOTOROLA: + err_warn("big endian binary file"); + case BINARY: + break; + case AIFF: + err_warn("AIFF not supported by cdrdao"); + case MP3: + case OGG: + case WAVE: + if (wavefile) { + strncpy(file, wavefile, FILENAMELEN); + file[FILENAMELEN] = '\0'; + } + break; + default: + err_fail("Unsupported file type"); + } + break; + default: + err_fail("Command not allowed in global section"); + break; + } + + } + + /* leaving global section, entering track specifications */ + if (file[0] == '\0') + err_fail("TRACK without previous FILE"); + + while (cmd != END) { + switch(cmd) { + case UNKNOWN: + err_fail("Unknown command"); + case REM: + c = getc(f); + while (c != '\n' && c != EOF) + c = getc(f); + break; + case TRACK: + if (track == NULL) /* first track */ + cs->tracklist = track = new_track(); + else { + track = track->next = new_track(); + } + + /* the CUE format is "TRACK nn MODE" but we are not + interested in the track number */ + while (isdelim(c = getc(f))) + if (c == '\n') line++; + while (!isdelim(c = getc(f))) ; + if (c == '\n') line++; + + track->mode = get_track_mode(f); + + /* audio tracks with binary files seem quite common */ + /* + if (track->mode == AUDIO && filetype == BINARY + || track->mode != AUDIO && filetype == WAVE) + err_fail("File and track type mismatch"); + */ + + strcpy(track->filename, file); + break; + case TITLE: + get_cdtext(f, TITLE, track->title, ONETRACK); + break; + case PERFORMER: + get_cdtext(f, PERFORMER, track->performer, ONETRACK); + break; + case SONGWRITER: + get_cdtext(f, SONGWRITER, track->songwriter, ONETRACK); + break; + case ISRC: + check_once(ISRC, track->isrc, ONETRACK); + if (get_string(f, track->isrc, 12) != 12) + err_fail("ISRC must be 12 characters long"); + break; + case FLAGS: + if (track->copy || track->pre_emphasis + || track->four_channel_audio) + err_fail("FLAGS allowed only once per track"); + + /* get the flags */ + cmd = get_command(f); + while (cmd == DCP || cmd == FOURCH || cmd == PRE + || cmd == SCMS) { + switch (cmd) { + case DCP: + track->copy = 1; break; + case FOURCH: + track->four_channel_audio = 1; break; + case PRE: + track->pre_emphasis = 1; break; + case SCMS: + err_warn("serial copy management " + "system flag not supported " + "by cdrdao"); break; + default: + err_fail("Should not get here"); + } + cmd = get_command(f); + } + /* current non-FLAG command is already in cmd, so + avoid get_command() call below */ + continue; break; + case PREGAP: + if (track->pregap != -1) + err_fail("PREGAP allowed only once per track"); + if (get_string(f, timecode_buffer, TCBUFLEN - 1) < 1) + err_earlyend(); + track->pregap = tc2fr(timecode_buffer); + if (track->pregap == -1) + err_fail("Timecode out of range"); + track->pregap_data_from_file = 0; + break; + case POSTGAP: + if (track->postgap != -1) + err_fail("POSTGAP allowed only once per track"); + if (get_string(f, timecode_buffer, TCBUFLEN - 1) < 1) + err_earlyend(); + track->postgap = tc2fr(timecode_buffer); + if (track->postgap == -1) + err_fail("Timecode out of range"); + break; + case INDEX: + if (get_string(f, timecode_buffer, 2) < 1) + err_earlyend(); + n = atoi(timecode_buffer); + if (n < 0 || n > 99) + err_fail("Index out of range"); + + /* Index 0 is track pregap and Index 1 is start + of track. Index 2 to 99 are the true subindexes + and only allowed if the preceding one was there + before */ + switch (n) { + case 0: + if (track->start != -1) + err_fail("Indexes must be sequential"); + if (track->pregap != -1) + err_fail("PREGAP allowed only once " + "per track"); + if (get_string(f, timecode_buffer, + TCBUFLEN - 1) < 1) + err_earlyend(); + /* This is only a temporary value until + index 01 is read */ + track->pregap = tc2fr(timecode_buffer); + if (track->pregap == -1) + err_fail("Timecode out of range"); + track->pregap_data_from_file = 1; + break; + case 1: + if (track->start != -1) + err_fail("Each index allowed only " + "once per track"); + if (get_string(f, timecode_buffer, + TCBUFLEN - 1) < 1) + err_fail("Missing timecode"); + track->start = tc2fr(timecode_buffer); + if (track->start == -1) + err_fail("Timecode out of range"); + /* Fix the pregap value */ + if (track->pregap_data_from_file) + track->pregap = track->start + - track->pregap; + break; + case 2: + if (track->start == -1) + err_fail("Indexes must be sequential"); + if (track->indexes[n - 2] != -1) + err_fail("Each index allowed only " + "once per track"); + if (get_string(f, timecode_buffer, + TCBUFLEN - 1) < 1) + err_fail("Missing timecode"); + track->indexes[n - 2] = tc2fr(timecode_buffer); + if (track->indexes[n - 2] == -1) + err_fail("Timecode out of range"); + break; + default: /* the other 97 indexes */ + /* check if previous index is there */ + if (track->indexes[n - 3] == -1) + err_fail("Indexes must be sequential"); + if (track->indexes[n - 2] != -1) + err_fail("Each index allowed only " + "once per track"); + if (get_string(f, timecode_buffer, + TCBUFLEN - 1) < 1) + err_fail("Missing timecode"); + track->indexes[n - 2] = tc2fr(timecode_buffer); + if (track->indexes[n - 2] == -1) + err_fail("Timecode out of range"); + break; + } + break; + case FILECMD: + if (get_string(f, file, FILENAMELEN) < 1) + err_earlyend(); + + switch (cmd = get_command(f)) { + case MOTOROLA: + err_warn("big endian binary file"); + case BINARY: + break; + case AIFF: + err_warn("AIFF and MP3 not supported by " + "cdrdao"); + case MP3: + case OGG: + case WAVE: + if (wavefile) { + strncpy(file, wavefile, FILENAMELEN); + file[FILENAMELEN] = '\0'; + } + break; + default: + err_fail("Unsupported file type"); + } + break; + default: + err_fail("Command not allowed in track spec"); + break; + } + + cmd = get_command(f); + } + + return cs; +} + +/* Deduce the disc session type from the track modes */ +static enum session_type +determine_session_type(struct trackspec *list) +{ + struct trackspec *track = list; + /* set to true if track of corresponding type is found */ + int audio = 0; + int mode1 = 0; + int mode2 = 0; + + while (track != NULL) { + switch (track->mode) { + case TrackData::AUDIO: + audio = 1; break; + case TrackData::MODE1: case TrackData::MODE1_RAW: + mode1 = 1; break; + case TrackData::MODE2: case TrackData::MODE2_RAW: + mode2 = 1; break; + default: /* should never get here */ + err_fail2("Dont know how this could happen, but here " + "is a track with an unknown mode :|"); + } + track = track->next; + } + + /* CD_DA only audio + * CD_ROM only mode1 with or without audio + * CD_ROM_XA only mode2 with or without audio + */ + if (audio && !mode1 && !mode2) + return CD_DA; + else if ((audio && mode1 && !mode2) || (!audio && mode1 && !mode2)) + return CD_ROM; + else if ((audio && !mode1 && mode2) || (!audio && !mode1 && mode2)) + return CD_ROM_XA; + else + return INVALID; +} + +/* Return true if cuesheet contains any CD-Text data */ +static int +contains_cdtext(struct cuesheet *cs) +{ + struct trackspec *track = cs->tracklist; + + if (cs->title[0] != '\0' || cs->performer[0] != '\0' + || cs->songwriter[0] != '\0') + return 1; + + while (track) { + if (track->title[0] != '\0' || track->performer[0] != '\0' + || track->songwriter[0] != '\0') + return 1; + track = track->next; + } + + return 0; +} + +/* fprintf() with indentation. The argument indent is the number of spaces + to print per level. E.g. with indent=4 and level=3 there are 12 spaces + printed. Every eight spaces are replaced by a single tabulator. The + return value is the return value of fprintf(). */ + +static int ifprintf(std::ostream& o, int indent, int level, + const char *format, ...) +{ + static char twolines[161]; + + va_list ap; + int fprintf_return = 0; + int tabs = indent * level / 8; + int spaces = indent * level % 8; + int i; + + for (i = 0; i < tabs; i++) + o << '\t'; + for (i = 0; i < spaces; i++) + o << ' '; + + va_start(ap, format); + fprintf_return = vsprintf(twolines, format, ap); + va_end(ap); + o << twolines; + + return fprintf_return; +} + +/* Write a track to the file f. The arguments i and l are the indentation + amount and level (see ifprintf above). Do not write CD-Text data if + cdtext is zero. */ +static void +write_track(struct trackspec *tr, std::ostream& f, int i, int l, int cdtext) +{ + char timecode_buffer[TCBUFLEN]; + long start = 0, len = 0; + int j = 0; + + f << std::endl; + ifprintf(f, i, l++, "TRACK "); + switch(tr->mode) { + case TrackData::AUDIO: f << "AUDIO\n"; break; + case TrackData::MODE1: f << "MODE1\n"; break; + case TrackData::MODE1_RAW: f << "MODE1_RAW\n"; break; + case TrackData::MODE2: f << "MODE2\n"; break; + case TrackData::MODE2_RAW: f << "MODE2_RAW\n"; break; + default: err_fail2("Unknown track mode"); /* cant get here */ + } + + /* Flags and ISRC */ + if (tr->copy) + ifprintf(f, i, l, "COPY\n"); + if (tr->pre_emphasis) + ifprintf(f, i, l, "PRE_EMPHASIS\n"); + if (tr->four_channel_audio) + ifprintf(f, i, l, "FOUR_CHANNEL_AUDIO\n"); + if (tr->isrc[0] != '\0') + ifprintf(f, i, l, "ISRC \"%s\"\n", tr->isrc); + + /* CD-Text data */ + if (cdtext && (tr->title[0] != '\0' || tr->performer[0] != '\0' + || tr->songwriter[0] != '\0')) { + ifprintf(f, i, l++, "CD_TEXT {\n"); + ifprintf(f, i, l++, "LANGUAGE 0 {\n"); + if (tr->title[0] != '\0') + ifprintf(f, i, l, "TITLE \"%s\"\n", tr->title); + if (tr->performer[0] != '\0') + ifprintf(f, i, l, "PERFORMER \"%s\"\n", tr->performer); + if (tr->songwriter[0] != '\0') + ifprintf(f, i, l, "SONGWRITER \"%s\"\n", + tr->songwriter); + ifprintf(f, i, --l, "}\n"); /* LANGUAGE 0 { */ + ifprintf(f, i, --l, "}\n"); /* CD_TEXT { */ + } + + /* Pregap with zero data */ + if (tr->pregap != -1 && !tr->pregap_data_from_file) { + if (fr2tc(timecode_buffer, tr->pregap) == -1) + err_fail2("Pregap out of range"); + ifprintf(f, i, l, "PREGAP %s\n", timecode_buffer); + } + + /* Specify the file */ + start = 0; + if (tr->mode == TrackData::AUDIO) { + ifprintf(f, i, l, "AUDIOFILE \"%s\" ", tr->filename); + if (tr->start != -1) { + if (tr->pregap_data_from_file) { + start = tr->start - tr->pregap; + } else + start = tr->start; + } + if (fr2tc(timecode_buffer, start) == -1) + err_fail2("Track start out of range"); + f << timecode_buffer; + } else { + if (tr->start) { + long datastart = (tr->pregap_data_from_file ? + tr->start - tr->pregap : tr->start); + ifprintf(f, i, l, "DATAFILE \"%s\" #%d", tr->filename, + datastart * AUDIO_BLOCK_LEN); + start = datastart; + } else { + ifprintf(f, i, l, "DATAFILE \"%s\"", tr->filename); + } + } + + /* If next track has the same filename and specified a start + value use the difference between start of this and start of + the next track as the length of the current track */ + if (tr->next + && strcmp(tr->filename, tr->next->filename) == 0 + && tr->next->start != -1) { + if (tr->next->pregap_data_from_file) + len = tr->next->start - tr->next->pregap - start; + else + len = tr->next->start - start; + if (fr2tc(timecode_buffer, len) == -1) + err_fail2("Track length out of range"); + f << ' ' << timecode_buffer << std::endl; + } else { + f << std::endl; + } + + /* Pregap with data from file */ + if (tr->pregap_data_from_file) { + if (fr2tc(timecode_buffer, tr->pregap) == -1) + err_fail2("Pregap out of range"); + ifprintf(f, i, l, "START %s\n", timecode_buffer); + } + + /* Postgap */ + if (tr->postgap != -1) { + if (fr2tc(timecode_buffer, tr->postgap) == -1) + err_fail2("Postgap out of range"); + if (tr->mode == TrackData::AUDIO) + ifprintf(f, i, l, "SILENCE %s\n", timecode_buffer); + else + ifprintf(f, i, l, "ZERO %s\n", timecode_buffer); + } + + /* Indexes */ + while (tr->indexes[j] != -1 && i < NUM_OF_INDEXES) { + if (fr2tc(timecode_buffer, tr->indexes[j++]) == -1) + err_fail2("Index out of range"); + ifprintf(f, i, l, "INDEX %s\n", timecode_buffer); + } + +} + +// Write the cuesheet cs to the output stream. Do not write CD-Text +// data if cdt is zero. + +void write_toc(std::ostream& f, struct cuesheet *cs, bool cdt) +{ + int i = 4; /* number of chars for indentation */ + int l = 0; /* current leven of indentation */ + bool cdtext = contains_cdtext(cs) && cdt; + struct trackspec *track = cs->tracklist; + + if ((cs->type = determine_session_type(cs->tracklist)) == INVALID) + err_fail2("Invalid combination of track modes"); + + ifprintf(f, i, l, "// Generated by cue2toc 0.2\n"); + ifprintf(f, i, l, "// Report bugs to <dermatsch@gmx.de>\n"); + + if (cs->catalog[0] != '\0') + ifprintf(f, i, l, "CATALOG \"%s\"\n", cs->catalog); + + switch (cs->type) { + case CD_DA: ifprintf(f, i, l, "CD_DA\n"); break; + case CD_ROM: ifprintf(f, i, l, "CD_ROM\n"); break; + case CD_ROM_XA: ifprintf(f, i, l, "CD_ROM_XA\n"); break; + default: err_fail2("Should never get here"); + } + + if (cdtext) { + ifprintf(f, i, l++, "CD_TEXT {\n"); + ifprintf(f, i, l++, "LANGUAGE_MAP {\n"); + ifprintf(f, i, l, "0 : EN\n"); + ifprintf(f, i, --l, "}\n"); + ifprintf(f, i, l++, "LANGUAGE 0 {\n"); + if (cs->title[0] != '\0') + ifprintf(f, i, l, "TITLE \"%s\"\n", cs->title); + if (cs->performer[0] != '\0') + ifprintf(f, i, l, "PERFORMER \"%s\"\n", cs->performer); + if (cs->songwriter[0] != '\0') + ifprintf(f, i, l, "SONGWRITER \"%s\"\n", + cs->songwriter); + ifprintf(f, i, --l, "}\n"); + ifprintf(f, i, --l, "}\n"); + } + + while (track) { + write_track(track, f, i, l, cdtext); + track = track->next; + } +} + +/* Interpret argument as timecode value ("MM:SS:FF") and return the total + number of frames. Tries to work in a way similar to atoi(), ignoring any + trailing non-timecode junk. Skips leading whitespace. + I want it to be as flexible as possible, recognizing simple values like + "0" (interpreted as "00:00:00"), "1:2" ("00:01:02") and so on. + Returns -1 on error (argument NULL or some value out of range) */ + +#define MAXDIGITS 2 +#define NUMOFNUMS 3 + +long +tc2fr(const char *tc) +{ + int minutes = 0; + int seconds = 0; + int frames = 0; + long totalframes = 0; + + char tmp[MAXDIGITS + 1]; + int nums[NUMOFNUMS]; + int n = 0; + int i = 0; + int last_was_colon = 0; + int stop = 0; + + if (tc == NULL) + return -1; + + for (i = 0; i <= MAXDIGITS; i++) + tmp[i] = '\0'; + + while (isspace(*tc)) + tc++; + + for (n = 0; n < NUMOFNUMS; n++) { + if (n > 0) { + if (tc[0] != ':') { + --n; + break; + } else + tc++; + } + + for (i = 0; i < MAXDIGITS; i++) { + + if (isdigit(tc[i])) { + tmp[i] = tc[i]; + last_was_colon = 0; + } else if (tc[i] == ':') { + if (i == 0) + stop = 1; + break; + } else { + stop = 1; + break; + } + } + + if (i != 0) { + tmp[i] = '\0'; + nums[n] = atoi(tmp); + tc = &tc[i]; + } else + --n; + + if (stop) + break; + } + + if (n == NUMOFNUMS) + --n; + + frames = seconds = minutes = 0; + + switch (n) { + case 0: + frames = nums[0]; + break; + case 1: + seconds = nums[0]; + frames = nums[1]; + break; + case 2: + minutes = nums[0]; + seconds = nums[1]; + frames = nums[2]; + break; + } + + totalframes = ((60 * minutes) + seconds) * 75 + frames; + + if (seconds > 59 || frames > 74) + return -1; + + return totalframes; +} + + +/* Writes formatted timecode string ("MM:SS:FF") into tc, calculated from + frame number fr. + Returns -1 on error (frames value out of range) */ + +int +fr2tc(char *tc, long fr) +{ + int m; + int s; + int f; + + if (fr > 449999 || fr < 0) { /* 99:59:74 */ + strcpy(tc, "00:00:00"); + return -1; + } + + f = fr % 75; + fr -= f; + s = (fr / 75) % 60; + fr -= s * 75; + m = fr / 75 / 60; + + sprintf(tc, "%02d:%02d:%02d", m, s, f); + return 0; +} diff --git a/trackdb/Cue2Toc.h b/trackdb/Cue2Toc.h new file mode 100644 index 0000000..1094759 --- /dev/null +++ b/trackdb/Cue2Toc.h @@ -0,0 +1,70 @@ +/* cue2toc.h - declarations for conversion routines + * Copyright (C) 2004 Matthias Czapla <dermatsch@gmx.de> + * + * This file is part of cue2toc. + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <iostream> + +#include "Track.h" + +/* Maximum length of the FILEname */ +#define FILENAMELEN 1024 +/* Number of characters allowed per CD-Text entry (w/o termin. Null) */ +#define CDTEXTLEN 80 + +/* Index can be 0 to 99, but 0 and 1 are pre-gap and track start + respectively, so 98 are left */ +#define NUM_OF_INDEXES 98 + +enum session_type { + CD_DA = 1, /* only audio tracks */ + CD_ROM, /* mode1 [and audio] */ + CD_ROM_XA, /* mode2 form1 or mode2 form2 [and audio] */ + INVALID /* invalid mixture of track modes */ +}; + +struct trackspec { + TrackData::Mode mode; + int copy; /* boolean */ + int pre_emphasis; /* boolean */ + int four_channel_audio; /* boolean */ + char isrc[13]; + char title[CDTEXTLEN + 1]; + char performer[CDTEXTLEN + 1]; + char songwriter[CDTEXTLEN + 1]; + char filename[FILENAMELEN + 1];; + long pregap; /* Pre-gap in frames */ + int pregap_data_from_file; /* boolean */ + long start; /* track start in frames */ + long postgap; /* Post-gap in frames */ + long indexes[NUM_OF_INDEXES]; /* indexes in frames */ + struct trackspec *next; +}; + +struct cuesheet { + char catalog[14]; + enum session_type type; + char title[CDTEXTLEN + 1]; + char performer[CDTEXTLEN + 1]; + char songwriter[CDTEXTLEN + 1]; + struct trackspec *tracklist; +}; + +struct cuesheet *read_cue(const char*, const char*); + +void write_toc(std::ostream&, struct cuesheet*, bool withCdText); diff --git a/trackdb/CueParser.cc b/trackdb/CueParser.cc new file mode 100644 index 0000000..b078f80 --- /dev/null +++ b/trackdb/CueParser.cc @@ -0,0 +1,40 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2005 Denis Leroy <denis@poolshark.org> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <iostream> +#include <sstream> +#include <stdio.h> + +#include "Cue2Toc.h" +#include "Toc.h" + +extern Toc *parseToc(const char* , const char *); + +Toc *parseCue(FILE *fp, const char *filename) +{ + struct cuesheet* cue = read_cue(filename, NULL); + + std::ostringstream oss(std::ostringstream::out); + write_toc(oss, cue, true); + + std::string ossstr = oss.str(); + const char* content = ossstr.c_str(); + + return parseToc(content, filename); +} diff --git a/trackdb/CueParser.h b/trackdb/CueParser.h new file mode 100644 index 0000000..42b32b4 --- /dev/null +++ b/trackdb/CueParser.h @@ -0,0 +1,25 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2005 Denis Leroy <denis@poolshark.org> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> +#include <stdio.h> + +#include "Toc.h" + +Toc* parseCue(FILE* fp, const char* filename); diff --git a/trackdb/FormatConverter.cc b/trackdb/FormatConverter.cc new file mode 100644 index 0000000..9fd190d --- /dev/null +++ b/trackdb/FormatConverter.cc @@ -0,0 +1,236 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2004 Denis Leroy <denis@poolshark.org> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stdlib.h> +#ifdef HAVE_AO +#include <ao/ao.h> +#endif +#include <fstream> +#include <cstring> + +#include "config.h" +#include "log.h" +#include "FormatConverter.h" +#include "TempFileManager.h" + +#ifdef HAVE_MP3_SUPPORT +#include "FormatMp3.h" +#endif +#ifdef HAVE_OGG_SUPPORT +#include "FormatOgg.h" +#endif + +FormatConverter::FormatConverter() +{ +#if defined(HAVE_MP3_SUPPORT) || defined(HAVE_OGG_SUPPORT) + ao_initialize(); +#endif +#ifdef HAVE_MP3_SUPPORT + managers_.push_front(new FormatMp3Manager); +#endif +#ifdef HAVE_OGG_SUPPORT + managers_.push_front(new FormatOggManager); +#endif +} + +FormatConverter::~FormatConverter() +{ + std::list<FormatSupportManager*>::iterator i = managers_.begin(); + while (i != managers_.end()) { + delete *i++; + } +#if defined(HAVE_MP3_SUPPORT) || defined(HAVE_OGG_SUPPORT) + ao_shutdown(); +#endif +} + +FormatSupport* FormatConverter::newConverter(const char* fn) +{ + const char* ext = strrchr(fn, '.'); + if (!ext) + return NULL; + ext++; + + FormatSupport* candidate = NULL; + std::list<FormatSupportManager*>::iterator i = managers_.begin(); + while (i != managers_.end()) { + FormatSupportManager* mgr = *i++; + + candidate = mgr->newConverter(ext); + if (candidate) + break; + } + + return candidate; +} + +FormatSupport* FormatConverter::newConverterStart(const char* src, + std::string& dst, + FormatSupport::Status* st) +{ + if (st) + *st = FormatSupport::FS_SUCCESS; + + FormatSupport* candidate = newConverter(src); + + if (candidate) { + const char* extension; + if (candidate->format() == TrackData::WAVE) + extension = "wav"; + else + extension = "raw"; + + bool exists = tempFileManager.getTempFile(dst, src, extension); + + if (exists) { + delete candidate; + return NULL; + } + + FormatSupport::Status ret = candidate->convertStart(src, dst.c_str()); + if (st) + *st = ret; + + if (ret == FormatSupport::FS_SUCCESS) + return candidate; + else + delete candidate; + } + + dst = ""; + return NULL; +} + +bool FormatConverter::canConvert(const char* fn) +{ + FormatSupport* c = newConverter(fn); + + if (!c) + return false; + + delete c; + return true; +} + +const char* FormatConverter::convert(const char* fn, + FormatSupport::Status* err) +{ + *err = FormatSupport::FS_SUCCESS; + + FormatSupport* c = newConverter(fn); + + if (!c) + return NULL; + + std::string* file = new std::string; + const char* extension; + if (c->format() == TrackData::WAVE) + extension = "wav"; + else + extension = "raw"; + + bool exists = tempFileManager.getTempFile(*file, fn, extension); + + if (!exists) { + log_message(2, "Decoding file \"%s\"", fn); + *err = c->convert(fn, file->c_str()); + + if (*err != FormatSupport::FS_SUCCESS) + return NULL; + + tempFiles_.push_front(file); + } + + return file->c_str(); +} + +int FormatConverter::supportedExtensions(std::list<std::string>& list) +{ + int num = 0; + + std::list<FormatSupportManager*>::iterator i = managers_.begin(); + for (;i != managers_.end(); i++) { + num += (*i)->supportedExtensions(list); + } + return num; +} + +FormatSupport::Status FormatConverter::convert(Toc* toc) +{ + FormatSupport::Status err; + + std::set<std::string> set; + + toc->collectFiles(set); + + std::set<std::string>::iterator i = set.begin(); + + for (; i != set.end(); i++) { + + const char* dst = convert((*i).c_str(), &err); + if (!dst && err != FormatSupport::FS_SUCCESS) + return FormatSupport::FS_OTHER_ERROR; + + if (dst) + toc->markFileConversion((*i).c_str(), dst); + } + + return FormatSupport::FS_SUCCESS; +} + +bool parseM3u(const char* m3ufile, std::list<std::string>& list) +{ + // You'd think STL would be smart enough to NOT have to use a stack + // buffer like this. STL is so poorly designed there's no any other + // way. + char buffer[1024]; + + std::string dir = m3ufile; + dir = dir.substr(0, dir.rfind("/")); + dir += "/"; + + std::ifstream file(m3ufile, std::ios::in); + + if (!file.is_open()) + return false; + + while (!file.eof()) { + file.getline(buffer, 1024); + + std::string e = buffer; + if (!e.empty() && (*(e.begin())) != '#') { + + if (e[0] != '/') + e = dir + e; + + int n; + while ((n = e.find('\r')) >= 0) + e.erase(n, 1); + while ((n = e.find('\n')) >= 0) + e.erase(n, 1); + + list.push_back(e); + } + } + + file.close(); + return true; +} + +FormatConverter formatConverter; diff --git a/trackdb/FormatConverter.h b/trackdb/FormatConverter.h new file mode 100644 index 0000000..c2fc77f --- /dev/null +++ b/trackdb/FormatConverter.h @@ -0,0 +1,127 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2004 Denis Leroy <denis@poolshark.org> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __FORMATCONVERTER_H__ +#define __FORMATCONVERTER_H__ + +#include <string> +#include <map> +#include <list> + +#include "TrackData.h" +#include "Toc.h" + +// Quick abstract class declarations. Format converters should derive +// their own FormatSupport and FormatSupportManager. + +class FormatSupport +{ + public: + virtual ~FormatSupport() {} + + typedef enum { + FS_SUCCESS, + FS_IN_PROGRESS, + FS_WRONG_FORMAT, + FS_INPUT_PROBLEM, + FS_OUTPUT_PROBLEM, + FS_DISK_FULL, + FS_DECODE_ERROR, + FS_OTHER_ERROR, + } Status; + + // Convert source file to destination WAV or RAW. This is a blocking + // call until conversion is finished. + // Return values: + // 0: success + // 1: problem with input file + // 2: problem with output file + // 3: problem with conversion + virtual Status convert(const char* from, const char* to) = 0; + + // Same as above, but asynchronous interface. Call start, then call + // continue in a busy loop until it no longer returns + // FS_IN_PROGRESS. + virtual Status convertStart(const char* from, const char* to) = 0; + virtual Status convertContinue() = 0; + virtual void convertAbort() = 0; + + // Specify what this object converts to. Should only returns either + // TrackData::WAVE or TrackData::RAW + virtual TrackData::FileType format() = 0; +}; + +class FormatSupportManager +{ + public: + virtual ~FormatSupportManager() {} + + // Acts as virtual constructor. Returns a new converter if this + // converter understands the given file extension. + virtual FormatSupport* newConverter(const char* extension) = 0; + + // Add supported file extensions to list. Returns number added. + virtual int supportedExtensions(std::list<std::string>&) = 0; +}; + + +// The global format conversion class. A single global instance of +// this class exists and manages all format conversions. + +class FormatConverter +{ + public: + FormatConverter(); + virtual ~FormatConverter(); + + // Returns true if the converter understands this format + bool canConvert(const char* fn); + + // Convert file, return tempory file with WAV or RAW data (based on + // temp file extension).Returns NULL if conversion failed. + const char* convert(const char* src, FormatSupport::Status* st = NULL); + + // Convert all files contained in a given Toc object, and update the + // Toc accordingly. This is a big time blocking call. + FormatSupport::Status convert(Toc* toc); + + // Dynamic allocator. + FormatSupport* newConverter(const char* src); + + // Do it yourself. Returns a converter and starts it. Sets dst to + // the converter file name (or clears it if no converter + // found). Returns NULL if file can't be converted. + FormatSupport* newConverterStart(const char* src, std::string& dst, + FormatSupport::Status* status = NULL); + + // Add all supported extensions to string list. Returns number added. + int supportedExtensions(std::list<std::string>&); + + private: + std::list<std::string*> tempFiles_; + std::list<FormatSupportManager*> managers_; +}; + +extern FormatConverter formatConverter; + +// Utility for parsing M3U files + +bool parseM3u(const char* m3ufile, std::list<std::string>& list); + +#endif diff --git a/trackdb/FormatMp3.cc b/trackdb/FormatMp3.cc new file mode 100644 index 0000000..e37894f --- /dev/null +++ b/trackdb/FormatMp3.cc @@ -0,0 +1,312 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2004 Denis Leroy <denis@poolshark.org> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +// A lot of this code is taken from mpg321 : +// mpg321 - a fully free clone of mpg123. +// Copyright (C) 2001 Joe Drew <drew@debian.org> + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <fcntl.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/mman.h> + +#include "log.h" +#include "FormatMp3.h" + + +FormatMp3::FormatMp3() +{ + memset(&dither_, 0, sizeof(dither_)); +} + +FormatSupport::Status FormatMp3::convert(const char* from, const char* to) +{ + src_file_ = from; + dst_file_ = to; + + Status err = madInit(); + if (err != FS_SUCCESS) + return err; + + while ((err = madDecodeFrame()) == FS_IN_PROGRESS); + + madExit(); + + return err; +} + +FormatSupport::Status FormatMp3::convertStart(const char* from, const char* to) +{ + src_file_ = from; + dst_file_ = to; + + return madInit(); +} + +FormatSupport::Status FormatMp3::convertContinue() +{ + Status err; + + for (int i = 0; i < 3; i++) { + err = madDecodeFrame(); + if (err != FS_IN_PROGRESS) + break; + } + + if (err != FS_IN_PROGRESS) + madExit(); + + return err; +} + +void FormatMp3::convertAbort() +{ + madExit(); +} + +FormatSupport::Status FormatMp3::madInit() +{ + struct stat st; + + if (stat(src_file_, &st) != 0) { + log_message(-2, "Could not stat input file \"%s\": %s", src_file_, + strerror(errno)); + return FS_INPUT_PROBLEM; + } + + mapped_fd_ = open(src_file_, O_RDONLY); + if (!mapped_fd_) { + log_message(-2, "Could not open input file \"%s\": %s", src_file_, + strerror(errno)); + return FS_INPUT_PROBLEM; + } + + length_ = st.st_size; + start_ = mmap(0, st.st_size, PROT_READ, MAP_SHARED, mapped_fd_, 0); + if (start_ == MAP_FAILED) { + log_message(-2, "Could not map file \"%s\" into memory: %s", src_file_, + strerror(errno)); + return FS_INPUT_PROBLEM; + } + + // Initialize libao for WAV output; + ao_sample_format out_format; + out_format.bits = 16; + out_format.rate = 44100; + out_format.channels = 2; + out_format.byte_format = AO_FMT_NATIVE; + + out_ = ao_open_file(ao_driver_id("wav"), dst_file_, 1, &out_format, NULL); + + if (!out_) { + log_message(-2, "Could not create output file \"%s\": %s", dst_file_, + strerror(errno)); + return FS_OUTPUT_PROBLEM; + } + + // Initialize libmad input stream. + mad_stream_init(&stream_); + mad_frame_init(&frame_); + mad_synth_init(&synth_); + mad_stream_options(&stream_, 0); + mad_stream_buffer(&stream_, (unsigned char*)start_, length_); + + return FS_SUCCESS; +} + +FormatSupport::Status FormatMp3::madDecodeFrame() +{ + if (mad_frame_decode(&frame_, &stream_) == -1) { + + if (stream_.error != MAD_ERROR_BUFLEN && + stream_.error != MAD_ERROR_LOSTSYNC) { + log_message(-1, "Decoding error 0x%04x (%s) at byte offset %u", + stream_.error, mad_stream_errorstr(&stream_), + stream_.this_frame - (unsigned char*)start_); + } + + if (stream_.error == MAD_ERROR_BUFLEN) + return FS_SUCCESS; + + if (!MAD_RECOVERABLE(stream_.error)) + return FS_DECODE_ERROR; + } + + mad_synth_frame(&synth_, &frame_); + madOutput(); + return FS_IN_PROGRESS; +} + +void FormatMp3::madExit() +{ + mad_synth_finish(&synth_); + mad_frame_finish(&frame_); + mad_stream_finish(&stream_); + + munmap(start_, length_); + close(mapped_fd_); + ao_close(out_); +} + +unsigned long FormatMp3::prng(unsigned long state) +{ + return (state * 0x0019660dL + 0x3c6ef35fL) & 0xffffffffL; +} + +signed long FormatMp3::audio_linear_dither(unsigned int bits, + mad_fixed_t sample, + struct audio_dither *dither) +{ + unsigned int scalebits; + mad_fixed_t output, mask, random; + + enum { + MIN = -MAD_F_ONE, + MAX = MAD_F_ONE - 1 + }; + + /* noise shape */ + sample += dither->error[0] - dither->error[1] + dither->error[2]; + + dither->error[2] = dither->error[1]; + dither->error[1] = dither->error[0] / 2; + + /* bias */ + output = sample + (1L << (MAD_F_FRACBITS + 1 - bits - 1)); + + scalebits = MAD_F_FRACBITS + 1 - bits; + mask = (1L << scalebits) - 1; + + /* dither */ + random = prng(dither->random); + output += (random & mask) - (dither->random & mask); + + dither->random = random; + + /* clip */ + if (output > MAX) { + output = MAX; + + if (sample > MAX) + sample = MAX; + } + else if (output < MIN) { + output = MIN; + + if (sample < MIN) + sample = MIN; + } + + /* quantize */ + output &= ~mask; + + /* error feedback */ + dither->error[0] = sample - output; + + /* scale */ + return output >> scalebits; +} + +FormatSupport::Status FormatMp3::madOutput() +{ + struct mad_pcm* pcm = &synth_.pcm; + register int nsamples = pcm->length; + mad_fixed_t const *left_ch = pcm->samples[0], *right_ch = pcm->samples[1]; + + register char* ptr = buffer_; + register signed int sample; + register mad_fixed_t tempsample; + + if (pcm->channels == 2) { + while (nsamples--) { + tempsample = (mad_fixed_t)(*left_ch++); + sample = (signed int)audio_linear_dither(16, tempsample,&dither_); + +#ifndef WORDS_BIGENDIAN + *ptr++ = (unsigned char)(sample >> 0); + *ptr++ = (unsigned char)(sample >> 8); +#else + *ptr++ = (unsigned char)(sample >> 8); + *ptr++ = (unsigned char)(sample >> 0); +#endif + + tempsample = (mad_fixed_t)(*right_ch++); + sample = (signed int)audio_linear_dither(16, tempsample, &dither_); +#ifndef WORDS_BIGENDIAN + *ptr++ = (unsigned char)(sample >> 0); + *ptr++ = (unsigned char)(sample >> 8); +#else + *ptr++ = (unsigned char)(sample >> 8); + *ptr++ = (unsigned char)(sample >> 0); +#endif + } + + if (ao_play(out_, buffer_, pcm->length * 4) == 0) + return FS_DISK_FULL; + + } else { + while (nsamples--) { + tempsample = (mad_fixed_t)((*left_ch++)/MAD_F_ONE); + sample = (signed int)audio_linear_dither(16, tempsample, &dither_); + + /* Just duplicate the sample across both channels. */ +#ifndef WORDS_BIGENDIAN + *ptr++ = (unsigned char)(sample >> 0); + *ptr++ = (unsigned char)(sample >> 8); + *ptr++ = (unsigned char)(sample >> 0); + *ptr++ = (unsigned char)(sample >> 8); +#else + *ptr++ = (unsigned char)(sample >> 8); + *ptr++ = (unsigned char)(sample >> 0); + *ptr++ = (unsigned char)(sample >> 8); + *ptr++ = (unsigned char)(sample >> 0); +#endif + } + + if (ao_play(out_, buffer_, pcm->length * 4) == 0) + return FS_DISK_FULL; + } + + return FS_SUCCESS; +} + +// ---------------------------------------------------------------- +// +// Manager class +// +// + +FormatSupport* FormatMp3Manager::newConverter(const char* extension) +{ + if (strcmp(extension, "mp3") == 0) + return new FormatMp3; + + return NULL; +} + +int FormatMp3Manager::supportedExtensions(std::list<std::string>& list) +{ + list.push_front("mp3"); + return 1; +} + diff --git a/trackdb/FormatMp3.h b/trackdb/FormatMp3.h new file mode 100644 index 0000000..e8dde14 --- /dev/null +++ b/trackdb/FormatMp3.h @@ -0,0 +1,83 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2004 Denis Leroy <denis@poolshark.org> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __FORMATMP3_H__ +#define __FORMATMP3_H__ + +#include <stdlib.h> +#include <ao/ao.h> +#include <mad.h> + +#include "FormatConverter.h" + + +class FormatMp3 : public FormatSupport +{ + public: + FormatMp3(); + + Status convert(const char* from, const char* to); + Status convertStart(const char* from, const char* to); + Status convertContinue(); + void convertAbort(); + + TrackData::FileType format() { return TrackData::WAVE; } + +protected: + struct audio_dither { + mad_fixed_t error[3]; + mad_fixed_t random; + }; + + static inline unsigned long prng(unsigned long state); + static inline signed long audio_linear_dither(unsigned int bits, + mad_fixed_t sample, + struct audio_dither* dither); + + Status madInit(); + Status madDecodeFrame(); + void madExit(); + + Status madOutput(); + + private: + const char* src_file_; + const char* dst_file_; + // 1152 because that's what mad has as a max; *4 because there are 4 + // distinct bytes per sample (in 2 channel case). + char buffer_[1152*4]; + ao_device* out_; + int mapped_fd_; + void* start_; + unsigned length_; + + struct audio_dither dither_; + struct mad_stream stream_; + struct mad_frame frame_; + struct mad_synth synth_; +}; + +class FormatMp3Manager : public FormatSupportManager +{ + public: + FormatSupport* newConverter(const char* extension); + int supportedExtensions(std::list<std::string>&); +}; + +#endif diff --git a/trackdb/FormatOgg.cc b/trackdb/FormatOgg.cc new file mode 100644 index 0000000..5ce7d9f --- /dev/null +++ b/trackdb/FormatOgg.cc @@ -0,0 +1,141 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2004 Denis Leroy <denis@poolshark.org> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stdio.h> +#include <cstring> + +#include "log.h" +#include "FormatOgg.h" + + +FormatSupport::Status FormatOgg::convert(const char* from, const char* to) +{ + src_file_ = from; + dst_file_ = to; + + Status err = oggInit(); + if (err != FS_SUCCESS) + return err; + + while ((err = oggDecodeFrame()) == FS_IN_PROGRESS); + + oggExit(); + + return err; +} + +FormatSupport::Status FormatOgg::convertStart(const char* from, const char* to) +{ + src_file_ = from; + dst_file_ = to; + + return oggInit(); +} + +FormatSupport::Status FormatOgg::convertContinue() +{ + Status err; + + for (int i = 0; i < 4; i++) { + err = oggDecodeFrame(); + if (err != FS_IN_PROGRESS) + break; + } + + if (err != FS_IN_PROGRESS) + oggExit(); + + return err; +} + +void FormatOgg::convertAbort() +{ + oggExit(); +} + +FormatSupport::Status FormatOgg::oggInit() +{ + fin_ = fopen(src_file_, "r"); + if (!fin_) { + log_message(-2, "Could not open input file \"%s\": %s", src_file_, + strerror(errno)); + return FS_INPUT_PROBLEM; + } + + int ovret = ov_open(fin_, &vorbisFile_, NULL, 0); + if (ovret != 0) { + log_message(-2, "Could not open Ogg Vorbis file \"%s\"", src_file_); + return FS_WRONG_FORMAT; + } + + outFormat_.bits = 16; + outFormat_.rate = 44100; + outFormat_.channels = 2; + outFormat_.byte_format = AO_FMT_NATIVE; + aoDev_ = ao_open_file(ao_driver_id("wav"), dst_file_, 1, &outFormat_, NULL); + if (!aoDev_) { + log_message(-2, "Could not create output file \"%s\": %s", dst_file_, + strerror(errno)); + return FS_OUTPUT_PROBLEM; + } + return FS_SUCCESS; +} + +FormatSupport::Status FormatOgg::oggDecodeFrame() +{ + int sec; + int size = ov_read(&vorbisFile_, buffer_, sizeof(buffer_), 0, 2, 1, &sec); + + if (!size) + return FS_SUCCESS; + + if (ao_play(aoDev_, buffer_, size) == 0) + return FS_DISK_FULL; + + return FS_IN_PROGRESS; +} + +FormatSupport::Status FormatOgg::oggExit() +{ + ov_clear(&vorbisFile_); + ao_close(aoDev_); + + return FS_SUCCESS; +} + +// ---------------------------------------------------------------- +// +// Manager class +// +// + +FormatSupport* FormatOggManager::newConverter(const char* extension) +{ + if (strcmp(extension, "ogg") == 0) + return new FormatOgg; + + return NULL; +} + +int FormatOggManager::supportedExtensions(std::list<std::string>& list) +{ + list.push_front("ogg"); + return 1; +} + diff --git a/trackdb/FormatOgg.h b/trackdb/FormatOgg.h new file mode 100644 index 0000000..d91d8e2 --- /dev/null +++ b/trackdb/FormatOgg.h @@ -0,0 +1,64 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2004 Denis Leroy <denis@poolshark.org> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __FORMATOGG_H__ +#define __FORMATOGG_H__ + +#include <stdlib.h> +#include <ao/ao.h> +#include <vorbis/vorbisfile.h> + +#include "FormatConverter.h" + + +class FormatOgg : public FormatSupport +{ + public: + FormatOgg() {}; + + Status convert(const char* from, const char* to); + Status convertStart(const char* from, const char* to); + Status convertContinue(); + void convertAbort(); + + TrackData::FileType format() { return TrackData::WAVE; } + + protected: + virtual Status oggInit(); + virtual Status oggDecodeFrame(); + virtual Status oggExit(); + + private: + const char* src_file_; + const char* dst_file_; + char buffer_[4096]; + FILE* fin_; + ao_device* aoDev_; + ao_sample_format outFormat_; + OggVorbis_File vorbisFile_; +}; + +class FormatOggManager : public FormatSupportManager +{ + public: + FormatSupport* newConverter(const char* extension); + int supportedExtensions(std::list<std::string>&); +}; + +#endif diff --git a/trackdb/Makefile.am b/trackdb/Makefile.am new file mode 100644 index 0000000..0541c21 --- /dev/null +++ b/trackdb/Makefile.am @@ -0,0 +1,72 @@ +noinst_LIBRARIES = libtrackdb.a + +libtrackdb_a_SOURCES = \ + Cddb.cc \ + lec.cc \ + Toc.cc \ + TrackDataList.cc \ + CdTextContainer.cc \ + Msf.cc \ + Track.cc \ + util.cc \ + CdTextItem.cc \ + SubTrack.cc \ + TrackData.cc \ + Cddb.h \ + CdTextContainer.h \ + CdTextItem.h \ + lec.h \ + Msf.h \ + Sample.h \ + SubTrack.h \ + Toc.h \ + TrackData.h \ + TrackDataList.h \ + Track.h \ + util.h \ + TocParser.g \ + TempFileManager.cc \ + FormatConverter.cc \ + TempFileManager.h \ + FormatConverter.h \ + Cue2Toc.cc \ + Cue2Toc.h \ + CueParser.h \ + CueParser.cc \ + log.h \ + log.cc + +PCCTS_GEN_FILES = \ + TocParser.cpp \ + TocParserGram.cpp \ + TocLexerBase.cpp \ + TocLexerBase.h \ + TocParserGram.h \ + TocParserTokens.h + + +nodist_libtrackdb_a_SOURCES = ${PCCTS_GEN_FILES} @pcctsinc@/AParser.cpp @pcctsinc@/DLexerBase.cpp @pcctsinc@/ATokenBuffer.cpp + +INCLUDES = -I@pcctsinc@ +ANTLR = @antlr_path@ +DLG = @dlg_path@ + +TocParser.cpp: $(srcdir)/TocParser.g + $(ANTLR) -k 3 -CC -w2 -fl TocLexer.dlg -ft TocParserTokens.h $(srcdir)/TocParser.g + $(DLG) -C2 -CC -cl TocLexerBase TocLexer.dlg + +TocParserGram.cpp TocLexerBase.cpp: TocParser.cpp + +AM_CXXFLAGS = @AO_CFLAGS@ + +if COND_MP3 +AM_CXXFLAGS += @MAD_CFLAGS@ +libtrackdb_a_SOURCES += FormatMp3.cc FormatMp3.h +endif + +if COND_OGG +AM_CXXFLAGS += @VORBISFILE_CFLAGS@ +libtrackdb_a_SOURCES += FormatOgg.cc FormatOgg.h +endif + +CLEANFILES = ${PCCTS_GEN_FILES} CueLexer.dlg TocLexer.dlg diff --git a/trackdb/Makefile.in b/trackdb/Makefile.in new file mode 100644 index 0000000..66b06ce --- /dev/null +++ b/trackdb/Makefile.in @@ -0,0 +1,574 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@COND_MP3_TRUE@am__append_1 = @MAD_CFLAGS@ +@COND_MP3_TRUE@am__append_2 = FormatMp3.cc FormatMp3.h +@COND_OGG_TRUE@am__append_3 = @VORBISFILE_CFLAGS@ +@COND_OGG_TRUE@am__append_4 = FormatOgg.cc FormatOgg.h +subdir = trackdb +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libtrackdb_a_AR = $(AR) $(ARFLAGS) +libtrackdb_a_LIBADD = +am__libtrackdb_a_SOURCES_DIST = Cddb.cc lec.cc Toc.cc TrackDataList.cc \ + CdTextContainer.cc Msf.cc Track.cc util.cc CdTextItem.cc \ + SubTrack.cc TrackData.cc Cddb.h CdTextContainer.h CdTextItem.h \ + lec.h Msf.h Sample.h SubTrack.h Toc.h TrackData.h \ + TrackDataList.h Track.h util.h TocParser.g TempFileManager.cc \ + FormatConverter.cc TempFileManager.h FormatConverter.h \ + Cue2Toc.cc Cue2Toc.h CueParser.h CueParser.cc log.h log.cc \ + FormatMp3.cc FormatMp3.h FormatOgg.cc FormatOgg.h +@COND_MP3_TRUE@am__objects_1 = FormatMp3.$(OBJEXT) +@COND_OGG_TRUE@am__objects_2 = FormatOgg.$(OBJEXT) +am_libtrackdb_a_OBJECTS = Cddb.$(OBJEXT) lec.$(OBJEXT) Toc.$(OBJEXT) \ + TrackDataList.$(OBJEXT) CdTextContainer.$(OBJEXT) \ + Msf.$(OBJEXT) Track.$(OBJEXT) util.$(OBJEXT) \ + CdTextItem.$(OBJEXT) SubTrack.$(OBJEXT) TrackData.$(OBJEXT) \ + TempFileManager.$(OBJEXT) FormatConverter.$(OBJEXT) \ + Cue2Toc.$(OBJEXT) CueParser.$(OBJEXT) log.$(OBJEXT) \ + $(am__objects_1) $(am__objects_2) +am__objects_3 = TocParser.$(OBJEXT) TocParserGram.$(OBJEXT) \ + TocLexerBase.$(OBJEXT) +nodist_libtrackdb_a_OBJECTS = $(am__objects_3) AParser.$(OBJEXT) \ + DLexerBase.$(OBJEXT) ATokenBuffer.$(OBJEXT) +libtrackdb_a_OBJECTS = $(am_libtrackdb_a_OBJECTS) \ + $(nodist_libtrackdb_a_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libtrackdb_a_SOURCES) $(nodist_libtrackdb_a_SOURCES) +DIST_SOURCES = $(am__libtrackdb_a_SOURCES_DIST) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AO_CFLAGS = @AO_CFLAGS@ +AO_LIBS = @AO_LIBS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COND_MP3_FALSE = @COND_MP3_FALSE@ +COND_MP3_TRUE = @COND_MP3_TRUE@ +COND_OGG_FALSE = @COND_OGG_FALSE@ +COND_OGG_TRUE = @COND_OGG_TRUE@ +COND_PCCTS_FALSE = @COND_PCCTS_FALSE@ +COND_PCCTS_TRUE = @COND_PCCTS_TRUE@ +COND_SCSILIB_FALSE = @COND_SCSILIB_FALSE@ +COND_SCSILIB_TRUE = @COND_SCSILIB_TRUE@ +COND_TOC2MP3_FALSE = @COND_TOC2MP3_FALSE@ +COND_TOC2MP3_TRUE = @COND_TOC2MP3_TRUE@ +COND_XDAO_FALSE = @COND_XDAO_FALSE@ +COND_XDAO_TRUE = @COND_XDAO_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ +GTKMM2_CFLAGS = @GTKMM2_CFLAGS@ +GTKMM2_LIBS = @GTKMM2_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LAME_CFLAGS = @LAME_CFLAGS@ +LAME_LIBS = @LAME_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBGUIMM2_CFLAGS = @LIBGUIMM2_CFLAGS@ +LIBGUIMM2_LIBS = @LIBGUIMM2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAD_CFLAGS = @MAD_CFLAGS@ +MAD_LIBS = @MAD_LIBS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIGCPP2_CFLAGS = @SIGCPP2_CFLAGS@ +SIGCPP2_LIBS = @SIGCPP2_LIBS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +VORBISFILE_CFLAGS = @VORBISFILE_CFLAGS@ +VORBISFILE_LIBS = @VORBISFILE_LIBS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +antlr_path = @antlr_path@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +dao_src = @dao_src@ +datadir = @datadir@ +dlg_path = @dlg_path@ +en_cdrdao = @en_cdrdao@ +en_cue2toc = @en_cue2toc@ +en_toc2cue = @en_toc2cue@ +en_toc2mp3 = @en_toc2mp3@ +en_xdao = @en_xdao@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydefs = @mydefs@ +oldincludedir = @oldincludedir@ +pcctsinc = @pcctsinc@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +scsilib_dir = @scsilib_dir@ +scsilib_incl = @scsilib_incl@ +scsilib_libs = @scsilib_libs@ +scsilib_objs = @scsilib_objs@ +sharedstatedir = @sharedstatedir@ +sound_if_obj = @sound_if_obj@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +thread_libs = @thread_libs@ +noinst_LIBRARIES = libtrackdb.a +libtrackdb_a_SOURCES = Cddb.cc lec.cc Toc.cc TrackDataList.cc \ + CdTextContainer.cc Msf.cc Track.cc util.cc CdTextItem.cc \ + SubTrack.cc TrackData.cc Cddb.h CdTextContainer.h CdTextItem.h \ + lec.h Msf.h Sample.h SubTrack.h Toc.h TrackData.h \ + TrackDataList.h Track.h util.h TocParser.g TempFileManager.cc \ + FormatConverter.cc TempFileManager.h FormatConverter.h \ + Cue2Toc.cc Cue2Toc.h CueParser.h CueParser.cc log.h log.cc \ + $(am__append_2) $(am__append_4) +PCCTS_GEN_FILES = \ + TocParser.cpp \ + TocParserGram.cpp \ + TocLexerBase.cpp \ + TocLexerBase.h \ + TocParserGram.h \ + TocParserTokens.h + +nodist_libtrackdb_a_SOURCES = ${PCCTS_GEN_FILES} @pcctsinc@/AParser.cpp @pcctsinc@/DLexerBase.cpp @pcctsinc@/ATokenBuffer.cpp +INCLUDES = -I@pcctsinc@ +ANTLR = @antlr_path@ +DLG = @dlg_path@ +AM_CXXFLAGS = @AO_CFLAGS@ $(am__append_1) $(am__append_3) +CLEANFILES = ${PCCTS_GEN_FILES} CueLexer.dlg TocLexer.dlg +all: all-am + +.SUFFIXES: +.SUFFIXES: .cc .cpp .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu trackdb/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu trackdb/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libtrackdb.a: $(libtrackdb_a_OBJECTS) $(libtrackdb_a_DEPENDENCIES) + -rm -f libtrackdb.a + $(libtrackdb_a_AR) libtrackdb.a $(libtrackdb_a_OBJECTS) $(libtrackdb_a_LIBADD) + $(RANLIB) libtrackdb.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AParser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ATokenBuffer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CdTextContainer.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CdTextItem.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Cddb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Cue2Toc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CueParser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DLexerBase.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FormatConverter.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FormatMp3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FormatOgg.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Msf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SubTrack.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TempFileManager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Toc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TocLexerBase.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TocParser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TocParserGram.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Track.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TrackData.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TrackDataList.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lec.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/log.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +AParser.o: @pcctsinc@/AParser.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT AParser.o -MD -MP -MF "$(DEPDIR)/AParser.Tpo" -c -o AParser.o `test -f '@pcctsinc@/AParser.cpp' || echo '$(srcdir)/'`@pcctsinc@/AParser.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/AParser.Tpo" "$(DEPDIR)/AParser.Po"; else rm -f "$(DEPDIR)/AParser.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='@pcctsinc@/AParser.cpp' object='AParser.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o AParser.o `test -f '@pcctsinc@/AParser.cpp' || echo '$(srcdir)/'`@pcctsinc@/AParser.cpp + +AParser.obj: @pcctsinc@/AParser.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT AParser.obj -MD -MP -MF "$(DEPDIR)/AParser.Tpo" -c -o AParser.obj `if test -f '@pcctsinc@/AParser.cpp'; then $(CYGPATH_W) '@pcctsinc@/AParser.cpp'; else $(CYGPATH_W) '$(srcdir)/@pcctsinc@/AParser.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/AParser.Tpo" "$(DEPDIR)/AParser.Po"; else rm -f "$(DEPDIR)/AParser.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='@pcctsinc@/AParser.cpp' object='AParser.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o AParser.obj `if test -f '@pcctsinc@/AParser.cpp'; then $(CYGPATH_W) '@pcctsinc@/AParser.cpp'; else $(CYGPATH_W) '$(srcdir)/@pcctsinc@/AParser.cpp'; fi` + +DLexerBase.o: @pcctsinc@/DLexerBase.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT DLexerBase.o -MD -MP -MF "$(DEPDIR)/DLexerBase.Tpo" -c -o DLexerBase.o `test -f '@pcctsinc@/DLexerBase.cpp' || echo '$(srcdir)/'`@pcctsinc@/DLexerBase.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/DLexerBase.Tpo" "$(DEPDIR)/DLexerBase.Po"; else rm -f "$(DEPDIR)/DLexerBase.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='@pcctsinc@/DLexerBase.cpp' object='DLexerBase.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o DLexerBase.o `test -f '@pcctsinc@/DLexerBase.cpp' || echo '$(srcdir)/'`@pcctsinc@/DLexerBase.cpp + +DLexerBase.obj: @pcctsinc@/DLexerBase.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT DLexerBase.obj -MD -MP -MF "$(DEPDIR)/DLexerBase.Tpo" -c -o DLexerBase.obj `if test -f '@pcctsinc@/DLexerBase.cpp'; then $(CYGPATH_W) '@pcctsinc@/DLexerBase.cpp'; else $(CYGPATH_W) '$(srcdir)/@pcctsinc@/DLexerBase.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/DLexerBase.Tpo" "$(DEPDIR)/DLexerBase.Po"; else rm -f "$(DEPDIR)/DLexerBase.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='@pcctsinc@/DLexerBase.cpp' object='DLexerBase.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o DLexerBase.obj `if test -f '@pcctsinc@/DLexerBase.cpp'; then $(CYGPATH_W) '@pcctsinc@/DLexerBase.cpp'; else $(CYGPATH_W) '$(srcdir)/@pcctsinc@/DLexerBase.cpp'; fi` + +ATokenBuffer.o: @pcctsinc@/ATokenBuffer.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ATokenBuffer.o -MD -MP -MF "$(DEPDIR)/ATokenBuffer.Tpo" -c -o ATokenBuffer.o `test -f '@pcctsinc@/ATokenBuffer.cpp' || echo '$(srcdir)/'`@pcctsinc@/ATokenBuffer.cpp; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/ATokenBuffer.Tpo" "$(DEPDIR)/ATokenBuffer.Po"; else rm -f "$(DEPDIR)/ATokenBuffer.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='@pcctsinc@/ATokenBuffer.cpp' object='ATokenBuffer.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ATokenBuffer.o `test -f '@pcctsinc@/ATokenBuffer.cpp' || echo '$(srcdir)/'`@pcctsinc@/ATokenBuffer.cpp + +ATokenBuffer.obj: @pcctsinc@/ATokenBuffer.cpp +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ATokenBuffer.obj -MD -MP -MF "$(DEPDIR)/ATokenBuffer.Tpo" -c -o ATokenBuffer.obj `if test -f '@pcctsinc@/ATokenBuffer.cpp'; then $(CYGPATH_W) '@pcctsinc@/ATokenBuffer.cpp'; else $(CYGPATH_W) '$(srcdir)/@pcctsinc@/ATokenBuffer.cpp'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/ATokenBuffer.Tpo" "$(DEPDIR)/ATokenBuffer.Po"; else rm -f "$(DEPDIR)/ATokenBuffer.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='@pcctsinc@/ATokenBuffer.cpp' object='ATokenBuffer.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ATokenBuffer.obj `if test -f '@pcctsinc@/ATokenBuffer.cpp'; then $(CYGPATH_W) '@pcctsinc@/ATokenBuffer.cpp'; else $(CYGPATH_W) '$(srcdir)/@pcctsinc@/ATokenBuffer.cpp'; fi` + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-noinstLIBRARIES ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-info-am + + +TocParser.cpp: $(srcdir)/TocParser.g + $(ANTLR) -k 3 -CC -w2 -fl TocLexer.dlg -ft TocParserTokens.h $(srcdir)/TocParser.g + $(DLG) -C2 -CC -cl TocLexerBase TocLexer.dlg + +TocParserGram.cpp TocLexerBase.cpp: TocParser.cpp +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/trackdb/Msf.cc b/trackdb/Msf.cc new file mode 100644 index 0000000..58255a9 --- /dev/null +++ b/trackdb/Msf.cc @@ -0,0 +1,86 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <stdio.h> +#include <assert.h> + +#include "Msf.h" + +Msf::Msf() +{ + min_ = sec_ = frac_ = 0; + lba_ = 0; +} + +Msf::Msf(int min, int sec, int frac) +{ + // assert(frac >= 0 && frac < 75); + // assert(sec >= 0 && sec < 60); + // assert(min >= 0); + + min_ = min; + sec_ = sec; + frac_ = frac; + + lba_ = min_ * 4500 + sec_ * 75 + frac_; +} + +Msf::Msf(long lba) +{ + if (lba < 0) + lba = 0; + + lba_ = lba; + lba2Msf(); +} + +void Msf::lba2Msf() +{ + long lba = lba_; + + min_ = lba / 4500; + lba %= 4500; + + sec_ = lba / 75; + lba %= 75; + + frac_ = lba; +} + +const char *Msf::str() const +{ + static char buf[20]; + + sprintf(buf, "%02d:%02d:%02d", min_, sec_, frac_); + + return buf; +} + +Msf operator+(const Msf &m1, const Msf &m2) +{ + return Msf(m1.lba() + m2.lba()); +} + +Msf operator-(const Msf &m1, const Msf &m2) +{ + return Msf(m1.lba() - m2.lba()); +} + diff --git a/trackdb/Msf.h b/trackdb/Msf.h new file mode 100644 index 0000000..82aea20 --- /dev/null +++ b/trackdb/Msf.h @@ -0,0 +1,64 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __MSF_H__ +#define __MSF_H__ + +#include "Sample.h" + +#ifdef min +/* I stupidly named a member function 'min' which clashes with the macro 'min' + * on some operating systems. The macro is simply undefined here since it is + * not used in this package anyway. + */ +#undef min +#endif + +class Msf { +private: + + int min_; // minutes + int sec_; // seconds + int frac_; // fractions (blocks) + + long lba_; // logical block address + + void lba2Msf(); + +public: + Msf(int min, int sec, int frac); + Msf(long lba); + Msf(); + + int min() const { return min_; } + int sec() const { return sec_; } + int frac() const { return frac_; } + + long lba() const { return lba_; } + + unsigned long samples() const { return lba_ * SAMPLES_PER_BLOCK; } + + const char *str() const; + +}; + +Msf operator+(const Msf &m1, const Msf &m2); +Msf operator-(const Msf &m1, const Msf &m2); + +#endif diff --git a/trackdb/Sample.h b/trackdb/Sample.h new file mode 100644 index 0000000..e21a9ce --- /dev/null +++ b/trackdb/Sample.h @@ -0,0 +1,63 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * $Log: Sample.h,v $ + * Revision 1.1.1.1 2000/02/05 01:32:25 llanero + * Uploaded cdrdao 1.1.3 with pre10 patch applied. + * + * Revision 1.2 1998/09/22 19:15:49 mueller + * Added setting of sample data. + * + */ + +#ifndef __SAMPLE_H__ +#define __SAMPLE_H__ + +#define SAMPLES_PER_BLOCK 588 + +// represents one audio sample +struct Sample { + unsigned char msbLeft; + unsigned char lsbLeft; + unsigned char msbRight; + unsigned char lsbRight; + + short left() const { return (msbLeft << 8) | lsbLeft; } + short right() const { return (msbRight << 8) | lsbRight; } + + void left(short d) { msbLeft = d >> 8; lsbLeft = d; } + void right(short d) { msbRight = d >> 8; lsbRight = d; } + + void swap(); +}; + +inline void Sample::swap() +{ + char tmp; + + tmp = msbLeft; + msbLeft = lsbLeft; + lsbLeft = tmp; + + tmp = msbRight; + msbRight = lsbRight; + lsbRight = tmp; +} + +#endif diff --git a/trackdb/SubTrack.cc b/trackdb/SubTrack.cc new file mode 100644 index 0000000..1efec10 --- /dev/null +++ b/trackdb/SubTrack.cc @@ -0,0 +1,52 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <stdio.h> + +#include "SubTrack.h" + +SubTrack::SubTrack(Type t, unsigned long start, const TrackData &data) + : TrackData(data) +{ + type_ = t; + start_ = start; + next_ = pred_ = NULL; +} + +SubTrack::SubTrack(Type t, const TrackData &data) + : TrackData(data) +{ + type_ = t; + start_ = 0; + next_ = pred_ = NULL; +} + +SubTrack::SubTrack(const SubTrack &obj) : TrackData(obj) +{ + type_ = obj.type_; + start_ = obj.start_; + next_ = pred_ = NULL; +} + +SubTrack::~SubTrack() +{ + next_ = pred_ = NULL; +} diff --git a/trackdb/SubTrack.h b/trackdb/SubTrack.h new file mode 100644 index 0000000..2f9ad7e --- /dev/null +++ b/trackdb/SubTrack.h @@ -0,0 +1,51 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __SUBTRACK_H__ +#define __SUBTRACK_H__ + +#include "TrackData.h" + +class SubTrack : public TrackData { +public: + enum Type { PAD, DATA }; + + SubTrack(Type, unsigned long start, const TrackData &); + SubTrack(Type, const TrackData &); + SubTrack(const SubTrack &); + ~SubTrack(); + + Type type() const { return type_; } + unsigned long start() const { return start_; } + void start(unsigned long s) { start_ = s; } + +private: + unsigned long start_; // start postion (samples) within containing track + Type type_; + + class SubTrack *next_; + class SubTrack *pred_; + + friend class Track; + friend class TrackReader; + friend class SubTrackIterator; +}; + + +#endif diff --git a/trackdb/TempFileManager.cc b/trackdb/TempFileManager.cc new file mode 100644 index 0000000..9853ccd --- /dev/null +++ b/trackdb/TempFileManager.cc @@ -0,0 +1,132 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2004 Denis Leroy <denis@poolshark.org> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "TempFileManager.h" +#include "log.h" + +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include <fcntl.h> +#include <cstring> + +#define DEFAULT_TEMP_PATH "/tmp/" + +TempFileManager::TempFileManager() +{ + path_ = DEFAULT_TEMP_PATH; + keepTemps_ = false; + prefix_ = "cdrdao."; +} + +TempFileManager::~TempFileManager() +{ + if (!keepTemps_) { + std::map<std::string, std::string>::const_iterator i = map_.begin(); + + for (;i != map_.end(); i++) { + std::string tmpFile = (*i).second; + log_message(3, "Removing temp file \"%s\"", tmpFile.c_str()); + unlink(tmpFile.c_str()); + } + } +} + +bool TempFileManager::setTempDirectory(const char* path) +{ + struct stat st; + + int ret = stat(path, &st); + + if (ret != 0) { + log_message(-2, "Could not find temporary directory %s.", + path); + return false; + } + + if (!S_ISDIR(st.st_mode) || access(path, W_OK) != 0) { + log_message(-2, "No permission for temp directory %s.", + path); + return false; + } + + path_ = path; + + if (path[path_.size() - 1] != '/') + path_ += '/'; + + return true; +} + +bool TempFileManager::getTempFile(std::string& tempname, const char* key, + const char* extension) +{ + if (!map_[key].empty()) { + tempname = map_[key]; + return true; + } + + const char* shortname = strrchr(key, '/'); + if (shortname) + shortname++; + else + shortname = key; + + std::string fname = path_; + fname += prefix_; + fname += shortname; + + int id = 1; + int fd; + do { + char tmpbuf[12]; + std::string uniqnm = fname; + sprintf(tmpbuf, ".%d", id); + uniqnm += tmpbuf; + if (extension) { + uniqnm += "."; + uniqnm += extension; + } + fd = open(uniqnm.c_str(), O_CREAT|O_EXCL, + S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); + if (fd > 0) { + fname = uniqnm; + break; + } + id++; + + if (id > 100) { + log_message(-2, "Unable to create temp file in directory %s.", + path_.c_str()); + tempname = ""; + return false; + } + } while(1); + + close(fd); + map_[key] = fname; + tempname = map_[key]; + + log_message(3, "Created temp file \"%s\" for file \"%s\"", fname.c_str(), key); + + return false; +} + +TempFileManager tempFileManager; diff --git a/trackdb/TempFileManager.h b/trackdb/TempFileManager.h new file mode 100644 index 0000000..6fc5d50 --- /dev/null +++ b/trackdb/TempFileManager.h @@ -0,0 +1,54 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2004 Denis Leroy <denis@poolshark.org> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __TEMPFILEMANAGER_H__ +#define __TEMPFILEMANAGER_H__ + +#include <string> +#include <map> + +class TempFileManager { + public: + TempFileManager(); + + // The destructor will delete all temp files (unless keepTemps is + // set) that have not expired yet. + virtual ~TempFileManager(); + + bool setTempDirectory(const char* path); + void setKeepTemps(bool b) { keepTemps_ = b; } + void setPrefix(const char* prefix) { prefix_ = prefix; } + + // Create a new temporary file, associated with given 'key'. The + // given name string is set to the temporaty file. Returns false + // is a new file was created, returns true if a temporary file + // already exists. + bool getTempFile(std::string& name, const char* key, + const char* extension = NULL); + + private: + std::string path_; + std::string prefix_; + std::map<std::string, std::string> map_; + bool keepTemps_; +}; + +extern TempFileManager tempFileManager; + +#endif diff --git a/trackdb/Toc.cc b/trackdb/Toc.cc new file mode 100644 index 0000000..7a7b6f8 --- /dev/null +++ b/trackdb/Toc.cc @@ -0,0 +1,1459 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <stdio.h> +#include <assert.h> +#include <errno.h> +#include <string.h> +#include <ctype.h> +#include <unistd.h> + +#include <fstream> +#include <iostream> +#include <sstream> + +#include "Toc.h" +#include "util.h" +#include "log.h" +#include "TrackDataList.h" +#include "CdTextItem.h" +#include "CueParser.h" +#include "FormatConverter.h" + +#ifdef UNIXWARE +extern "C" { + extern int strcasecmp(const char *, const char *); +} +#endif + +extern Toc *parseToc(FILE *fp, const char *filename); + +Toc::Toc() : length_(0) +{ + tocType_ = CD_DA; + nofTracks_ = 0; firstTrackNo_ = 0; + tracks_ = lastTrack_ = NULL; + + catalogValid_ = 0; +} + +// copy constructor +Toc::Toc(const Toc &obj) : length_(0), cdtext_(obj.cdtext_) +{ + tocType_ = obj.tocType_; + + if ((catalogValid_ = obj.catalogValid_)) + memcpy(catalog_, obj.catalog_, 13); + + nofTracks_ = 0; + firstTrackNo_ = obj.firstTrackNo_; + tracks_ = lastTrack_ = NULL; + + // copy all tracks + TrackIterator itr(&obj); + const Track *trun; + + for (trun = itr.first(); trun != NULL; trun = itr.next()) + append(trun); +} + + +Toc::~Toc() +{ + TrackEntry *run = tracks_; + TrackEntry *next; + + while (run != NULL) { + next = run->next; + delete run->track; + delete run; + run = next; + } +} + + +// appends track +// return: 0: OK +// 1: first track contains pregap +int Toc::append(const Track *t) +{ + if (tracks_ == NULL) { + tracks_ = lastTrack_ = new TrackEntry; + } + else { + lastTrack_->next = new TrackEntry; + lastTrack_->next->pred = lastTrack_; + lastTrack_ = lastTrack_->next; + } + + lastTrack_->track = new Track(*t); + nofTracks_ += 1; + + update(); + return 0; +} + +void Toc::update() +{ + TrackEntry *run; + long length = 0; // length of disc in blocks + long tlength; // length of single track in blocks + int tnum; + + for (run = tracks_, tnum = 1; run != NULL; run = run->next, tnum++) { + tlength = run->track->length().lba(); + + run->absStart = Msf(length); + run->start = Msf(length + run->track->start().lba()); + run->end = Msf(length + tlength); + run->trackNr = tnum; + + length += tlength; + } + + length_ = Msf(length); +} + + + +Toc *Toc::read(const char *filename) +{ + FILE *fp; + Toc *ret; + const char *p; + + if ((fp = fopen(filename, "r")) == NULL) { + log_message(-2, "Cannot open toc file '%s' for reading: %s", + filename, strerror(errno)); + return NULL; + } + + if ((p = strrchr(filename, '.')) != NULL && strcasecmp(p, ".cue") == 0) + ret = parseCue(fp, filename); + else + ret = parseToc(fp, filename); + + fclose(fp); + + return ret; +} + +bool Toc::resolveFilenames(const char* filename) +{ + // Resolve all relative filenames to absoluate paths wrt to the toc + // file current directory. + std::string path = filename; + path = path.substr(0, path.rfind('/')); + if (path.empty()) path = "."; + + for (TrackEntry* t = tracks_; t != NULL; t = t->next) + if (!t->track->resolveFilename(path.c_str())) + return false; + + return true; +} + +// Writes toc to file with given name. +// Return: 0: OK +// 1: error occured + +int Toc::write(const char *filename) const +{ + assert(filename != NULL); + assert(*filename != 0); + + std::ofstream out(filename); + + if (!out) { + log_message(-2, "Cannot open file \"%s\" for writing: %s", filename, + strerror(errno)); + return 1; + } + + print(out); + + return 0; +} + +bool Toc::write(int fd, bool conversions) const +{ + assert(fd); + + std::ostringstream oss(std::ostringstream::out); + print(oss, conversions); + + std::string ossstr = oss.str(); + const char* content = ossstr.c_str(); + int written = ::write(fd, content, strlen(content)); + + return (written >= 0); +} + +int Toc::check() const +{ + TrackEntry *t; + int trackNr; + int ret = 0; + + for (t = tracks_, trackNr = 1; t != NULL; t = t->next, trackNr++) { + ret |= t->track->check(trackNr); + } + + return ret; +} + +bool Toc::recomputeLength() +{ + for (TrackEntry* t = tracks_; t; t = t->next) { + if (!t->track->recomputeLength()) + return false; + } + + update(); + return true; +} + +// Sets catalog number. 's' must be a string of 13 digits. +// return: 0: OK +// 1: illegal catalog string +int Toc::catalog(const char *s) +{ + int i; + + if (s == NULL) { + catalogValid_ = 0; + return 0; + } + + if (strlen(s) != 13) { + return 1; + } + + for (i = 0; i < 13; i++) { + if (!isdigit(s[i])) + return 1; + } + + for (i = 0; i < 13; i++) + catalog_[i] = s[i] - '0'; + + catalogValid_ = 1; + + return 0; +} + + +const char *Toc::catalog() const +{ + static char buf[14]; + int i; + + if (!catalogValid_) + return NULL; + + for (i = 0; i < 13; i++) + buf[i] = catalog_[i] + '0'; + + buf[13] = 0; + + return buf; +} + +// writes contents in TOC file syntax +void Toc::print(std::ostream &out, bool conversions) const +{ + int i; + TrackEntry *t; + + out << tocType2String(tocType()) << "\n\n"; + + if (catalogValid()) { + out << "CATALOG \""; + for (i = 0; i < 13; i++) { + out << (char)(catalog(i) + '0'); + } + out << "\"" << std::endl; + } + + cdtext_.print(0, out); + + for (t = tracks_, i = 1; t != NULL; t = t->next, i++) { + out << "\n// Track " << i << "\n"; + t->track->print(out, conversions); + out << std::endl; + } +} + +bool Toc::convertFilesToWav() +{ + FormatSupport::Status status = formatConverter.convert(this); + + return (status == FormatSupport::FS_SUCCESS); +} + +void Toc::collectFiles(std::set<std::string>& set) +{ + for (TrackEntry* t = tracks_; t != NULL; t = t->next) + t->track->collectFiles(set); +} + +void Toc::markFileConversion(const char* src, const char* dst) +{ + for (TrackEntry* t = tracks_; t != NULL; t = t->next) + t->track->markFileConversion(src, dst); +} + +// find track entry that contains given sample number +// return: found track entry or 'NULL' if sample is out of range +Toc::TrackEntry *Toc::findTrack(unsigned long sample) const +{ + TrackEntry *run; + + for (run = tracks_; run != NULL; run = run->next) { + if (sample < run->end.samples()) + return run; + } + + return NULL; +} + +// find track with given number +// return: found track entry or 'NULL' if 'trackNr' is out of range +Toc::TrackEntry *Toc::findTrackByNumber(int trackNr) const +{ + TrackEntry *run; + + for (run = tracks_; run != NULL; run = run->next) { + if (run->trackNr == trackNr) + return run; + } + + return NULL; +} + +Track *Toc::getTrack(int trackNr) +{ + TrackEntry *ent = findTrackByNumber(trackNr); + + if (ent != NULL) + return ent->track; + else + return NULL; +} + +// Moves specified track/index position to given LBA if possible. +// return: 0: OK +// 1: Cannot move pre-gap of first track +// 2: specified track/index position not found in toc +// 3: 'lba' is an illegal position for track/index mark +// 4: resulting track length would be short than 4 seconds +// 5: cannot cross track/index boundaries +// 6: cannot modify data track +int Toc::moveTrackMarker(int trackNr, int indexNr, long lba) +{ + TrackEntry *act; + + if (trackNr == 1 && indexNr == 0) + return 1; + + if ((act = findTrackByNumber(trackNr)) == NULL) { + return 2; + } + + if (indexNr <= 1 && + (act->track->type() != TrackData::AUDIO || + act->track->subChannelType() != TrackData::SUBCHAN_NONE)) + return 6; + + if ((indexNr == 0 || (indexNr == 1 && act->track->start().lba() == 0)) && + act->pred != NULL && + (act->pred->track->type() != TrackData::AUDIO || + act->track->subChannelType() != TrackData::SUBCHAN_NONE)) + return 6; + + + if (indexNr == 0 && act->track->start().lba() == 0) + return 2; + + if (indexNr > 1 && indexNr - 2 >= act->track->nofIndices()) + return 2; + + if (lba < 0 || lba >= length().lba()) + return 3; + + if ((indexNr == 1 && (act->track->start().lba() > 0 || trackNr == 1)) || + indexNr > 1) { + // change track/index position within track + if (indexNr == 1) { + if (lba > act->end.lba() - 4 * 75) + return 4; + + if (lba <= act->absStart.lba() && trackNr > 1) + return 3; + } + else { + if (lba - act->absStart.lba() <= 0) + return 3; + } + + switch (act->track->moveIndex(indexNr, lba - act->absStart.lba())) { + case 1: + return 4; + case 2: + return 5; + } + } + else { + // move track start position, we need to shift audio data from + // on track to the other + + // 'act->pred' is always non NULL in this case because track 1 is + // exhaustively handled above + + TrackDataList *dataList; // audio data that is removed from one track + + if (lba < act->absStart.lba()) { + // move to the left + + if (lba < act->pred->start.lba() + 4 * 75) + return 4; + + dataList = + act->pred->track->removeToEnd(Msf(lba - act->pred->absStart.lba()).samples()); + act->track->prependTrackData(dataList); + delete dataList; + + // adjust start of track + act->track->start(Msf(act->start.lba() - lba)); + + if (indexNr == 1) + act->track->moveIndex(1, 0); // remove intermediate pre-gap + } + else if (lba > act->absStart.lba()) { + // move to the right + + if (indexNr == 1) { + // introduce an intermediate pre-gap that adjusts the index + // increments + switch (act->track->moveIndex(1, lba - act->absStart.lba())) { + case 1: + return 4; + case 2: + return 5; + } + + // remove intermediate pre-gap + act->track->start(Msf(0)); + } + else { + // adjust pre-gap + if (lba >= act->start.lba()) + return 5; + + act->track->start(Msf(act->start.lba() - lba)); + } + + dataList = + act->track->removeFromStart(Msf(lba - act->absStart.lba()).samples()); + act->pred->track->appendTrackData(dataList); + delete dataList; + + } + } + + update(); + checkConsistency(); + + return 0; +} + +void Toc::remove(TrackEntry *ent) +{ + if (ent->pred != NULL) + ent->pred->next = ent->next; + else + tracks_ = ent->next; + + if (ent->next != NULL) + ent->next->pred = ent->pred; + else + lastTrack_ = ent->pred; + + ent->pred = ent->next = NULL; + ent->track = NULL; + delete ent; +} + +// Removes specified track marker. +// return: 0: OK +// 1: cannot remove first track +// 2: specified track/index position not found in toc +// 3: cannot modify a data track +int Toc::removeTrackMarker(int trackNr, int indexNr) +{ + TrackEntry *act; + + if (trackNr == 1 && indexNr == 1) + return 1; + + if ((act = findTrackByNumber(trackNr)) == NULL) { + return 2; + } + + if ((act->track->type() != TrackData::AUDIO || + act->track->subChannelType() != TrackData::SUBCHAN_NONE) && + indexNr <= 1) + return 3; + + if (act->pred != NULL && + (act->pred->track->type() != TrackData::AUDIO || + act->track->subChannelType() != TrackData::SUBCHAN_NONE) && + indexNr <= 1) + return 3; + + if (trackNr == 1 && indexNr == 0) { + // pre-gap of first track + + if (act->start.lba() == 0) + return 2; // no pre-gap + + act->track->start(Msf(0)); + } + else if (indexNr > 1) { + // index increment + if (act->track->removeIndex(indexNr - 2) != 0) + return 2; + } + else if (indexNr == 0) { + // remove pre-gap, audio data of pre-gap is appended to previous track + unsigned long len = act->track->start().samples(); + + if (len == 0) + return 2; // track has no pre-gap + + act->track->start(Msf(0)); + TrackDataList *dataList = act->track->removeFromStart(len); + act->pred->track->appendTrackData(dataList); + delete dataList; + } + else { + // index == 1, remove track completely + + act->pred->track->appendTrackData(act->track); + + Track *store = act->track; + remove(act); + delete store; + + nofTracks_--; + } + + update(); + checkConsistency(); + + return 0; +} + +// Adds index increment at given LBA. +// return: 0: OK +// 1: LBA out of range +// 2: cannot add index at this position +// 3: more than 98 index increments +int Toc::addIndexMarker(long lba) +{ + TrackEntry *act = findTrack(Msf(lba).samples()); + + if (act == NULL) + return 1; + + if (lba <= act->start.lba()) + return 2; + + switch (act->track->addIndex(Msf(lba - act->start.lba()))) { + case 1: + return 3; + case 2: + return 2; + } + + return 0; +} + +// Adds a track marker at given LBA. +// return: 0: OK +// 1: LBA out of range +// 2: cannot add track at this position +// 3: resulting track would be shorter than 4 seconds +// 4: previous track would be short than 4 seconds +// 5: cannot modify a data track +int Toc::addTrackMarker(long lba) +{ + TrackEntry *act = findTrack(Msf(lba).samples()); + + if (act == NULL) + return 1; + + if (act->track->type() != TrackData::AUDIO) + return 5; + + if (act->track->subChannelType() != TrackData::SUBCHAN_NONE) + return 5; + + if (lba <= act->start.lba()) + return 2; + + if (lba - act->start.lba() < 4 * 75) + return 4; + + if (act->end.lba() - lba < 4 * 75) + return 3; + + + TrackDataList *dataList = + act->track->removeToEnd(Msf(lba - act->absStart.lba()).samples()); + + Track *t = new Track(act->track->type(), act->track->subChannelType()); + t->appendTrackData(dataList); + delete dataList; + + TrackEntry *ent = new TrackEntry; + ent->track = t; + + ent->next = act->next; + if (ent->next != NULL) + ent->next->pred = ent; + + ent->pred = act; + act->next = ent; + + if (act == lastTrack_) + lastTrack_ = ent; + + nofTracks_++; + + update(); + checkConsistency(); + + return 0; +} + + +// Adds pre-gap add given LBA. +// return: 0: OK +// 1: LBA out of range +// 2: cannot add pre-gap at this point +// 3: actual track would be shorter than 4 seconds +// 4: cannot modify a data track +int Toc::addPregap(long lba) +{ + TrackEntry *act = findTrack(Msf(lba).samples()); + + if (act == NULL) + return 1; + + if (act->track->type() != TrackData::AUDIO) + return 4; + + if (act->track->subChannelType() != TrackData::SUBCHAN_NONE) + return 4; + + if (act->next == NULL) + return 2; // no next track where we could add pre-gap + + if (act->next->track->type() != act->track->type() || + act->next->track->subChannelType() != act->track->subChannelType()) + return 4; + + if (lba <= act->start.lba()) + return 2; + + if (act->next->track->start().lba() != 0) + return 2; // track has already a pre-gap + + if (lba - act->start.lba() < 4 * 75) + return 3; + + TrackDataList *dataList = + act->track->removeToEnd(Msf(lba - act->absStart.lba()).samples()); + act->next->track->prependTrackData(dataList); + delete dataList; + + act->next->track->start(Msf(act->next->start.lba() - lba)); + + update(); + checkConsistency(); + + return 0; +} + +void Toc::fixLengths() +{ + TrackEntry* te; + int i; + + for (i = 0 , te = tracks_; te; te = te->next, i++) { + printf("%d : Track %d\n", i, te->trackNr); + } +} + +void Toc::checkConsistency() +{ + TrackEntry *run, *last = NULL; + long cnt = 0; + + for (run = tracks_; run != NULL; last = run, run = run->next) { + cnt++; + if (run->pred != last) + log_message(-3, "Toc::checkConsistency: wrong pred pointer."); + + run->track->checkConsistency(); + } + + if (last != lastTrack_) + log_message(-3, "Toc::checkConsistency: wrong last pointer."); + + if (cnt != nofTracks_) + log_message(-3, "Toc::checkConsistency: wrong sub track counter."); +} + + +// Appends a track with given audio data. 'start' is filled with +// first LBA of new track, 'end' is filled with last LBA + 1 of new track. +void Toc::appendTrack(const TrackDataList *list, long *start, long *end) +{ + Track t(TrackData::AUDIO, TrackData::SUBCHAN_NONE); + const TrackData *run; + + for (run = list->first(); run != NULL; run = list->next()) + t.append(SubTrack(SubTrack::DATA, *run)); + + // ensure that track lasts at least 4 seconds + unsigned long minTime = 4 * 75 * SAMPLES_PER_BLOCK; // 4 seconds + unsigned long len = list->length(); + + if (len < minTime) + t.append(SubTrack(SubTrack::DATA, TrackData(minTime - len))); + + *start = length().lba(); + + append(&t); + checkConsistency(); + + *end = length().lba(); +} + +// Appends given audio data to last track. If no track exists 'appendTrack' +// will be called. 'start' and 'end' is filled with position of modified +// region. +// Return: 0: OK +// 1: cannot modify a data track +int Toc::appendTrackData(const TrackDataList *list, long *start, long *end) +{ + const TrackData *run; + + if (lastTrack_ == NULL) { + appendTrack(list, start, end); + return 0; + } + + if (lastTrack_->track->type() != TrackData::AUDIO) + return 1; + + if (lastTrack_->track->subChannelType() != TrackData::SUBCHAN_NONE) + return 1; + + + *start = length().lba(); + + for (run = list->first(); run != NULL; run = list->next()) + lastTrack_->track->append(SubTrack(SubTrack::DATA, *run)); + + update(); + checkConsistency(); + + *end = length().lba(); + + return 0; +} + +// Removes specified range of samples from a single track. +// Return: 0: OK +// 1: samples range covers more than one track +// 2: cannot modify a data track +// 3: illegal 'start' position +int Toc::removeTrackData(unsigned long start, unsigned long end, + TrackDataList **list) +{ + TrackEntry *tent = findTrack(start); + + if (tent == NULL) + return 3; + + if (tent->track->type() != TrackData::AUDIO) + return 2; + + if (tent->track->subChannelType() != TrackData::SUBCHAN_NONE) + return 2; + + if (tent != findTrack(end)) + return 1; + + *list = tent->track->removeTrackData(start - tent->absStart.samples(), + end - tent->absStart.samples()); + + update(); + checkConsistency(); + + return 0; +} + +// Inserts given track data at specified postion. +// Return: 0: OK +// 1: cannot modify a data track + +int Toc::insertTrackData(unsigned long pos, const TrackDataList *list) +{ + TrackEntry *tent = findTrack(pos); + + if (tent != NULL && tent->track->type() != TrackData::AUDIO) + return 1; + + if (tent != NULL && tent->track->subChannelType() != TrackData::SUBCHAN_NONE) + return 1; + + + if (tent != NULL) { + tent->track->insertTrackData(pos - tent->absStart.samples(), list); + + update(); + checkConsistency(); + + return 0; + } + else { + long start, end; + + return appendTrackData(list, &start, &end); + } + +} + + +// Returns mode that should be used for lead-in. The mode of first track's +// first sub-track is used. +TrackData::Mode Toc::leadInMode() const +{ + const SubTrack *t; + + if (tracks_ == NULL || (t = tracks_->track->firstSubTrack()) == NULL) { + // no track or track data available - return AUDIO in this case + return TrackData::AUDIO; + } + + return t->mode(); +} + +// Returns mode that should be used for lead-out. The mode of last track's +// last sub-track is used +TrackData::Mode Toc::leadOutMode() const +{ + const SubTrack *t; + + if (lastTrack_ == NULL || (t = lastTrack_->track->lastSubTrack()) == NULL) { + // no track or track data available - return AUDIO in this case + return TrackData::AUDIO; + } + + return t->mode(); +} + +const char *Toc::tocType2String(TocType t) +{ + const char *ret = NULL; + switch (t) { + case CD_DA: + ret = "CD_DA"; + break; + case CD_ROM: + ret = "CD_ROM"; + break; + case CD_I: + ret = "CD_I"; + break; + case CD_ROM_XA: + ret = "CD_ROM_XA"; + break; + } + + return ret; +} + +void Toc::addCdTextItem(int trackNr, CdTextItem *item) +{ + assert(trackNr >= 0 && trackNr <= 99); + + if (trackNr == 0) { + cdtext_.add(item); + } + else { + TrackEntry *track = findTrackByNumber(trackNr); + + if (track == NULL) { + log_message(-3, "addCdTextItem: Track %d is not available.", trackNr); + return; + } + + track->track->addCdTextItem(item); + } +} + +void Toc::removeCdTextItem(int trackNr, CdTextItem::PackType type, int blockNr) +{ + assert(trackNr >= 0 && trackNr <= 99); + + if (trackNr == 0) { + cdtext_.remove(type, blockNr); + } + else { + TrackEntry *track = findTrackByNumber(trackNr); + + if (track == NULL) { + log_message(-3, "addCdTextItem: Track %d is not available.", trackNr); + return; + } + + track->track->removeCdTextItem(type, blockNr); + } +} + +int Toc::existCdTextBlock(int blockNr) const +{ + if (cdtext_.existBlock(blockNr)) + return 1; + + TrackEntry *run; + + for (run = tracks_; run != NULL; run = run->next) { + if (run->track->existCdTextBlock(blockNr)) + return 1; + } + + return 0; +} + +const CdTextItem *Toc::getCdTextItem(int trackNr, int blockNr, + CdTextItem::PackType type) const +{ + if (trackNr == 0) { + return cdtext_.getPack(blockNr, type); + } + + TrackEntry *track = findTrackByNumber(trackNr); + + if (track == NULL) + return NULL; + + return track->track->getCdTextItem(blockNr, type); +} + +void Toc::cdTextLanguage(int blockNr, int lang) +{ + cdtext_.language(blockNr, lang); + +} + + +int Toc::cdTextLanguage(int blockNr) const +{ + return cdtext_.language(blockNr); +} + +// Check the consistency of the CD-TEXT data. +// Return: 0: OK +// 1: at least one warning occured +// 2: at least one error occured +int Toc::checkCdTextData() const +{ + TrackEntry *trun; + int err = 0; + int l; + int last; + int titleCnt, performerCnt, songwriterCnt, composerCnt, arrangerCnt; + int messageCnt, isrcCnt, genreCnt; + int languageCnt = 0; + + genreCnt = 0; + + // Check if language numbers are continuously used starting at 0 + for (l = 0, last = -1; l <= 7; l++) { + if (cdTextLanguage(l) >= 0) { + languageCnt++; + + if (cdtext_.getPack(l, CdTextItem::CDTEXT_GENRE) != NULL) + genreCnt++; + + if (l - 1 != last) { + if (last == -1) + log_message(-2, "CD-TEXT: Language number %d: Language numbers must start at 0.", l); + else + log_message(-2, "CD-TEXT: Language number %d: Language numbers are not continuously used.", l); + + if (err < 2) + err = 2; + } + + last = l; + } + } + + if (genreCnt > 0 && genreCnt != languageCnt) { + log_message(-1, "CD-TEXT: %s field not defined for all languages.", + CdTextItem::packType2String(1, CdTextItem::CDTEXT_GENRE)); + if (err < 1) + err = 1; + } + + + for (l = 0, last = -1; l <= 7; l++) { + if (cdTextLanguage(l) < 0) + continue; + + titleCnt = (cdtext_.getPack(l, CdTextItem::CDTEXT_TITLE) != NULL) ? 1 : 0; + performerCnt = (cdtext_.getPack(l, CdTextItem::CDTEXT_PERFORMER) != NULL) ? 1 : 0; + songwriterCnt = (cdtext_.getPack(l, CdTextItem::CDTEXT_SONGWRITER) != NULL) ? 1 : 0; + composerCnt = (cdtext_.getPack(l, CdTextItem::CDTEXT_COMPOSER) != NULL) ? 1 : 0; + arrangerCnt = (cdtext_.getPack(l, CdTextItem::CDTEXT_ARRANGER) != NULL) ? 1 : 0; + messageCnt = (cdtext_.getPack(l, CdTextItem::CDTEXT_MESSAGE) != NULL) ? 1 : 0; + isrcCnt = 0; + + for (trun = tracks_; trun != NULL; trun = trun->next) { + if (trun->track->getCdTextItem(l, CdTextItem::CDTEXT_TITLE) != NULL) + titleCnt++; + + if (trun->track->getCdTextItem(l, CdTextItem::CDTEXT_PERFORMER) != NULL) + performerCnt++; + + if (trun->track->getCdTextItem(l, CdTextItem::CDTEXT_SONGWRITER) != NULL) + songwriterCnt++; + + if (trun->track->getCdTextItem(l, CdTextItem::CDTEXT_COMPOSER) != NULL) + composerCnt++; + + if (trun->track->getCdTextItem(l, CdTextItem::CDTEXT_ARRANGER) != NULL) + arrangerCnt++; + + if (trun->track->getCdTextItem(l, CdTextItem::CDTEXT_MESSAGE) != NULL) + messageCnt++; + + if (trun->track->getCdTextItem(l, CdTextItem::CDTEXT_UPCEAN_ISRC) != NULL) + isrcCnt++; + } + + if (titleCnt > 0 && titleCnt != nofTracks_ + 1) { + log_message(-2, "CD-TEXT: Language %d: %s field not defined for all tracks or disk.", + l, CdTextItem::packType2String(1, CdTextItem::CDTEXT_TITLE)); + if (err < 2) + err = 2; + } + else if (titleCnt == 0) { + log_message(-1, "CD-TEXT: Language %d: %s field is not defined.", + l, CdTextItem::packType2String(1, CdTextItem::CDTEXT_TITLE)); + if (err < 1) + err = 1; + } + + if (performerCnt > 0 && performerCnt != nofTracks_ + 1) { + log_message(-2, "CD-TEXT: Language %d: %s field not defined for all tracks or disk.", + l, CdTextItem::packType2String(1, CdTextItem::CDTEXT_PERFORMER)); + if (err < 2) + err = 2; + } + else if (performerCnt == 0) { + log_message(-1, "CD-TEXT: Language %d: %s field is not defined.", + l, CdTextItem::packType2String(1, CdTextItem::CDTEXT_PERFORMER)); + if (err < 1) + err = 1; + } + + if (songwriterCnt > 0 && songwriterCnt != nofTracks_ + 1) { + log_message(-2, "CD-TEXT: Language %d: %s field not defined for all tracks or disk.", + l, CdTextItem::packType2String(1, CdTextItem::CDTEXT_SONGWRITER)); + if (err < 2) + err = 2; + } + + if (composerCnt > 0 && composerCnt != nofTracks_ + 1) { + log_message(-2, "CD-TEXT: Language %d: %s field not defined for all tracks or disk.", + l, CdTextItem::packType2String(1, CdTextItem::CDTEXT_COMPOSER)); + if (err < 2) + err = 2; + } + + if (arrangerCnt > 0 && arrangerCnt != nofTracks_ + 1) { + log_message(-2, "CD-TEXT: Language %d: %s field not defined for all tracks or disk.", + l, CdTextItem::packType2String(1, CdTextItem::CDTEXT_ARRANGER)); + if (err < 2) + err = 2; + } + + if (messageCnt > 0 && messageCnt != nofTracks_ + 1) { + log_message(-2, "CD-TEXT: Language %d: %s field not defined for all tracks or disk.", + l, CdTextItem::packType2String(1, CdTextItem::CDTEXT_MESSAGE)); + if (err < 2) + err = 2; + } + + if ((isrcCnt > 0 && isrcCnt != nofTracks_) || + (isrcCnt == 0 && + cdtext_.getPack(l, CdTextItem::CDTEXT_UPCEAN_ISRC) != NULL)) { + log_message(-2, "CD-TEXT: Language %d: %s field not defined for all tracks.", + l, CdTextItem::packType2String(1, CdTextItem::CDTEXT_UPCEAN_ISRC)); + if (err < 2) + err = 2; + } + } + + return err; +} + + +void Toc::trackSummary(int *nofAudioTracks, int *nofMode1Tracks, + int *nofMode2Tracks) const +{ + TrackEntry *run; + + if (nofAudioTracks != NULL) + *nofAudioTracks = 0; + + if (nofMode1Tracks != NULL) + *nofMode1Tracks = 0; + + if (nofMode2Tracks != NULL) + *nofMode2Tracks = 0; + + for (run = tracks_; run != NULL; run = run->next) { + switch (run->track->type()) { + case TrackData::AUDIO: + if (nofAudioTracks != NULL) + *nofAudioTracks += 1; + break; + + case TrackData::MODE1: + case TrackData::MODE1_RAW: + if (nofMode1Tracks != NULL) + *nofMode1Tracks += 1; + break; + + case TrackData::MODE2: + case TrackData::MODE2_FORM1: + case TrackData::MODE2_FORM2: + case TrackData::MODE2_FORM_MIX: + case TrackData::MODE2_RAW: + if (nofMode2Tracks != NULL) + *nofMode2Tracks += 1; + break; + + case TrackData::MODE0: + break; + } + } +} + +// Class TrackIterator +TrackIterator::TrackIterator(const Toc *t) +{ + toc_ = t; + iterator_ = NULL; +} + +TrackIterator::~TrackIterator() +{ + toc_ = NULL; + iterator_ = NULL; +} + +const Track *TrackIterator::find(int trackNr, Msf &start, Msf &end) +{ + Track *t; + + iterator_ = toc_->findTrackByNumber(trackNr); + + if (iterator_ != NULL) { + start = iterator_->start; + end = iterator_->end; + t = iterator_->track; + iterator_ = iterator_->next; + return t; + } + + return NULL; +} + +const Track *TrackIterator::find(unsigned long sample, Msf &start, Msf &end, + int *trackNr) +{ + Track *t; + + iterator_ = toc_->findTrack(sample); + + if (iterator_ != NULL) { + start = iterator_->start; + end = iterator_->end; + *trackNr = iterator_->trackNr; + t = iterator_->track; + iterator_ = iterator_->next; + return t; + } + + return NULL; +} + +const Track *TrackIterator::first(Msf &start, Msf &end) +{ + iterator_ = toc_->tracks_; + + return next(start, end); +} + +const Track *TrackIterator::first() +{ + Msf start, end; + + return first(start, end); +} + +const Track *TrackIterator::next(Msf &start, Msf &end) +{ + Track *t; + + if (iterator_ != NULL) { + start = iterator_->start; + end = iterator_->end; + t = iterator_->track; + iterator_ = iterator_->next; + return t; + } + else { + return NULL; + } +} + +const Track *TrackIterator::next() +{ + Msf start, end; + + return next(start, end); +} + +// Class TocReader + +TocReader::TocReader(const Toc *t) : reader(NULL) +{ + toc_ = t; + + readTrack_ = NULL; + readPos_ = 0; + readPosSample_ = 0; + open_ = 0; +} + +TocReader::~TocReader () +{ + if (open_) { + closeData(); + } + + toc_ = NULL; + readTrack_ = NULL; +} + +void TocReader::init(const Toc *t) +{ + if (open_) { + closeData(); + } + + reader.init(NULL); + + toc_ = t; + readTrack_ = NULL; +} + +int TocReader::openData() +{ + int ret = 0; + + assert(open_ == 0); + assert(toc_ != NULL); + + readTrack_ = toc_->tracks_; + readPos_ = 0; + readPosSample_ = 0; + + reader.init(readTrack_->track); + + if (readTrack_ != NULL) { + ret = reader.openData(); + } + + open_ = 1; + + return ret; +} + +void TocReader::closeData() +{ + if (open_ != 0) { + reader.closeData(); + + readTrack_ = NULL; + readPos_ = 0; + open_ = 0; + readPosSample_ = 0; + } +} + +#if 0 +long TocReader::readData(long lba, char *buf, long len) +{ + long n; + long nread = 0; + + assert(open_ != 0); + + if (readPos_ + len > toc_->length_.lba()) { + if ((len = toc_->length_.lba() - readPos_) <= 0) { + return 0; + } + } + + do { + n = reader.readData(0, lba, buf + (nread * AUDIO_BLOCK_LEN), len); + + if (n < 0) { + return -1; + } + + lba += n; + + if (n != len) { + // skip to next track + readTrack_ = readTrack_->next; + + assert(readTrack_ != NULL); + + reader.init(readTrack_->track); + if (reader.openData() != 0) { + return -1; + } + } + + nread += n; + len -= n; + } while (len > 0); + + readPos_ += nread; + + return nread; +} +#endif + +// seeks to specified sample (absolute position) +// return: 0: OK +// 10: sample position out of range +// return codes from 'Track::openData()' +int TocReader::seekSample(unsigned long sample) +{ + int ret; + + assert(open_ != 0); + + // find track that contains 'sample' + Toc::TrackEntry *tr = toc_->findTrack(sample); + + if (tr == NULL) + return 10; + + // open track if necessary + if (tr != readTrack_) { + readTrack_ = tr; + reader.init(readTrack_->track); + + if ((ret = reader.openData() != 0)) + return ret; + } + + assert(sample >= readTrack_->absStart.samples()); + + unsigned long offset = sample - readTrack_->absStart.samples(); + + // seek in track + if ((ret = reader.seekSample(offset)) != 0) + return ret; + + readPosSample_ = sample; + + return 0; +} + +long TocReader::readSamples(Sample *buf, long len) +{ + long n; + long nread = 0; + + assert(open_ != 0); + + if (readPosSample_ + (unsigned long)len > toc_->length_.samples()) { + if ((len = toc_->length_.samples() - readPosSample_) <= 0) + return 0; + } + + do { + n = reader.readSamples(buf + nread , len); + + if (n < 0) + return -1; + + if (n != len) { + // skip to next track + readTrack_ = readTrack_->next; + reader.init(readTrack_->track); + + assert(readTrack_ != NULL); + + if (reader.openData() != 0) { + return -1; + } + } + + nread += n; + len -= n; + } while (len > 0); + + readPosSample_ += nread; + + return nread; +} + +const char* TocReader::curFilename() +{ + return reader.curFilename(); +} diff --git a/trackdb/Toc.h b/trackdb/Toc.h new file mode 100644 index 0000000..795b1f5 --- /dev/null +++ b/trackdb/Toc.h @@ -0,0 +1,220 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __TOC_H__ +#define __TOC_H__ + +#include <iostream> +#include <list> +#include <string> + +#include "Track.h" +#include "CdTextContainer.h" +#include "CdTextItem.h" + +class Toc { +public: + Toc(); + Toc(const Toc &); + ~Toc(); + + enum TocType { CD_DA, CD_ROM, CD_I, CD_ROM_XA }; + + // sets/returns toc type + void tocType(TocType); + TocType tocType() const; + + void firstTrackNo(int i) { firstTrackNo_ = i; } + int firstTrackNo() const { return firstTrackNo_; } + + int nofTracks() const { return nofTracks_; } + + Msf length() const { return length_; } + + // returns mode that should be used for lead-in and gap + TrackData::Mode leadInMode() const; + // returns mode that should be used for lead-out + TrackData::Mode leadOutMode() const; + + int append(const Track *); + void insert(int, const Track *); + void remove(int); + + Track *getTrack(int trackNr); + + int moveTrackMarker(int trackNr, int indexNr, long lba); + int removeTrackMarker(int trackNr, int indexNr); + int addIndexMarker(long lba); + int addTrackMarker(long lba); + int addPregap(long lba); + + void appendTrack(const TrackDataList *, long *start, long *end); + int appendTrackData(const TrackDataList *, long *start, long *end); + + int removeTrackData(unsigned long start, unsigned long end, + TrackDataList **); + int insertTrackData(unsigned long pos, const TrackDataList *list); + + static Toc *read(const char *); + int write(const char *) const; + bool write(int fd, bool conversions = false) const; + + int catalogValid() const { return catalogValid_; } + + int catalog(const char *); // sets catalog number + char catalog(int i) const { return catalog_[i]; } // BCD + const char *catalog() const; + + void addCdTextItem(int trackNr, CdTextItem *); + void removeCdTextItem(int trackNr, CdTextItem::PackType, int blockNr); + int existCdTextBlock(int blockNr) const; + const CdTextItem *getCdTextItem(int trackNr, int blockNr, + CdTextItem::PackType) const; + void cdTextLanguage(int blockNr, int lang); + int cdTextLanguage(int blockNr) const; + + void trackSummary(int *nofAudioTracks, int *nofMode1Tracks, + int *nofMode2Tracks) const; + + // Verification methods + bool resolveFilenames(const char* tocFilename); + int check() const; + int checkCdTextData() const; + + bool convertFilesToWav(); + bool recomputeLength(); + + // if conversions is true, the TOc is printed with the converted WAV + // or RAW filenames instead of the original ones. + void print(std::ostream &, bool conversions = false) const; + + void collectFiles(std::set<std::string>& list); + void markFileConversion(const char* src, const char* dst); + + static const char *tocType2String(TocType); + +private: + friend class TocImpl; + friend class TocParserGram; + friend class TocReader; + friend class TrackIterator; + + struct TrackEntry { + TrackEntry() : absStart(0), start(0), end(0) { + trackNr = 0; track = 0; next = 0; pred = 0; + } + + int trackNr; + Track *track; + Msf absStart; // absoulte track start (end of last track) + Msf start; // logical track start (after pre-gap) + Msf end; + + struct TrackEntry *next; + struct TrackEntry *pred; + }; + + void update(); + + TrackEntry *findTrack(unsigned long sample) const; + + TrackEntry *findTrackByNumber(int trackNr) const; + + void remove(TrackEntry *); + + void fixLengths(); + + void checkConsistency(); + + + TocType tocType_; // type of TOC + + int nofTracks_, firstTrackNo_; + TrackEntry *tracks_; + TrackEntry *lastTrack_; + + Msf length_; // total length of disc + + char catalog_[13]; + int catalogValid_; + + CdTextContainer cdtext_; +}; + + +class TocReader { +public: + TocReader(const Toc * = 0); + ~TocReader(); + + void init(const Toc *); + + int openData(); + //long readData(long lba, char *buf, long len); + int seekSample(unsigned long sample); + long readSamples(Sample *buf, long len); + void closeData(); + + const char* curFilename(); + +private: + const Toc *toc_; + + TrackReader reader; + + const Toc::TrackEntry *readTrack_; // actual read track + long readPos_; // actual read position (blocks) + long readPosSample_; // actual read position (samples) + int open_; // != 0 indicates that toc was opened for reading data +}; + + +class TrackIterator { +public: + TrackIterator(const Toc *); + ~TrackIterator(); + + const Track *find(int trackNr, Msf &start, Msf &end); + const Track *find(unsigned long sample, Msf &start, Msf &end, + int *trackNr); + const Track *first(Msf &start, Msf &end); + const Track *first(); + const Track *next(Msf &start, Msf &end); + const Track *next(); + +private: + const Toc *toc_; + Toc::TrackEntry *iterator_; +}; + + + +inline +void Toc::tocType(TocType t) +{ + tocType_ = t; +} + +inline +Toc::TocType Toc::tocType() const +{ + return tocType_; +} + +#endif diff --git a/trackdb/TocParser.g b/trackdb/TocParser.g new file mode 100644 index 0000000..17b68c6 --- /dev/null +++ b/trackdb/TocParser.g @@ -0,0 +1,963 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#header << +#include <config.h> +#include <stdlib.h> +#include "Toc.h" +#include "util.h" +#include "log.h" +#include "CdTextItem.h" +>> + +<< +#include "CdTextContainer.h" +#include "TocLexerBase.h" + +// Maximum length of binary data for CD-TEXT +#define MAX_CD_TEXT_DATA_LEN (256 * 12) + + +/* Use 'ANTLRCommonToken' as 'ANTLRToken' to be compatible with some bug + * fix releases of PCCTS-1.33. The drawback is that the token length is + * limited to 100 characters. This might be a problem for long file names. + * Define 'USE_ANTLRCommonToken' to 0 if you want to use the dynamic token + * which handles arbitrary token lengths (there'll be still a limitation in + * the lexer code but that's more than 100 characters). In this case it might + * be necessary to adjust the types of the member functions to the types in + * 'ANTLRAbstractToken' defined in PCCTSDIR/h/AToken.h'. + */ + +#define USE_ANTLRCommonToken 0 + +#if USE_ANTLRCommonToken + +typedef ANTLRCommonToken ANTLRToken; + +#else + +class ANTLRToken : public ANTLRRefCountToken { +private: + ANTLRTokenType type_; + int line_; + ANTLRChar *text_; + +public: + ANTLRToken(ANTLRTokenType t, ANTLRChar *s) + : ANTLRRefCountToken(t, s) + { + setType(t); + line_ = 0; + setText(s); + } + ANTLRToken() + { + setType((ANTLRTokenType)0); + line_ = 0; + setText(""); + } + virtual ~ANTLRToken() { delete[] text_; } + +#if 0 + // use this for basic PCCTS-1.33 release + ANTLRTokenType getType() { return type_; } + virtual int getLine() { return line_; } + ANTLRChar *getText() { return text_; } + void setText(ANTLRChar *s) { text_ = strdupCC(s); } +#else + // use this for PCCTS-1.33 bug fix releases + ANTLRTokenType getType() const { return type_; } + virtual int getLine() const { return line_; } + ANTLRChar *getText() const { return text_; } + void setText(const ANTLRChar *s) { text_ = strdupCC(s); } +#endif + + void setType(ANTLRTokenType t) { type_ = t; } + void setLine(int line) { line_ = line; } + + virtual ANTLRAbstractToken *makeToken(ANTLRTokenType tt, ANTLRChar *txt, + int line) + { + ANTLRAbstractToken *t = new ANTLRToken(tt,txt); + t->setLine(line); + return t; + } +}; +#endif + >> + +<< +class TocLexer : public TocLexerBase { +public: + TocLexer(DLGInputStream *in, unsigned bufsize=2000) + : TocLexerBase(in, bufsize) { parser_ = NULL; } + + virtual ANTLRTokenType erraction(); + + TocParserGram *parser_; +}; +>> + +#lexclass START +#token Eof "@" +#token "[\t\r\ ]+" << skip(); >> +#token Comment "//~[\n@]*" << skip(); >> +#token "\n" << newline(); skip(); >> +#token BeginString "\"" << mode(STRING); >> +#token Integer "[0-9]+" +#token TrackDef "TRACK" +#token FirstTrackNo "FIRST_TRACK_NO" +#token Audio "AUDIO" +#token Mode0 "MODE0" +#token Mode1 "MODE1" +#token Mode1Raw "MODE1_RAW" +#token Mode2 "MODE2" +#token Mode2Raw "MODE2_RAW" +#token Mode2Form1 "MODE2_FORM1" +#token Mode2Form2 "MODE2_FORM2" +#token Mode2FormMix "MODE2_FORM_MIX" +#token SubChanRw "RW" +#token SubChanRwRaw "RW_RAW" +#token Index "INDEX" +#token Catalog "CATALOG" +#token Isrc "ISRC" +#token No "NO" +#token Copy "COPY" +#token PreEmphasis "PRE_EMPHASIS" +#token TwoChannel "TWO_CHANNEL_AUDIO" +#token FourChannel "FOUR_CHANNEL_AUDIO" +#tokclass AudioFile { "AUDIOFILE" "FILE" } +#token DataFile "DATAFILE" +#token Fifo "FIFO" +#token Silence "SILENCE" +#token Zero "ZERO" +#token Pregap "PREGAP" +#token Start "START" +#token End "END" +#token TocTypeCdda "CD_DA" +#token TocTypeCdrom "CD_ROM" +#token TocTypeCdromXa "CD_ROM_XA" +#token TocTypeCdi "CD_I" +#token Swap "SWAP" + +#token CdText "CD_TEXT" +#token Language "LANGUAGE" +#token LanguageMap "LANGUAGE_MAP" +#token Title "TITLE" +#token Performer "PERFORMER" +#token Songwriter "SONGWRITER" +#token Composer "COMPOSER" +#token Arranger "ARRANGER" +#token Message "MESSAGE" +#token DiscId "DISC_ID" +#token Genre "GENRE" +#token TocInfo1 "TOC_INFO1" +#token TocInfo2 "TOC_INFO2" +#token Reserved1 "RESERVED1" +#token Reserved2 "RESERVED2" +#token Reserved3 "RESERVED3" +#token Reserved4 "RESERVED4" +#token UpcEan "UPC_EAN" +#token SizeInfo "SIZE_INFO" +#token LangEn "EN" + +#lexclass STRING +#token EndString "\"" << mode(START); >> +#token StringQuote "\\\"" +#token StringOctal "\\[0-9][0-9][0-9]" +#token String "\\" +#token String "[ ]+" +#token String "~[\\\n\"\t ]*" + +#lexclass START + + +class TocParserGram { +<< +public: + const char *filename_; + int error_; + +void syn(_ANTLRTokenPtr tok, ANTLRChar *egroup, SetWordType *eset, + ANTLRTokenType etok, int k); +>> + +toc > [ Toc *t ] + : << $t = new Toc; + Track *tr = NULL; + int lineNr = 0; + char *catalog = NULL; + Toc::TocType toctype; + int firsttrack, firstLine; + >> + ( Catalog string > [ catalog ] + << if (catalog != NULL) { + if ($t->catalog(catalog) != 0) { + log_message(-2, "%s:%d: Illegal catalog number: %s.\n", + filename_, $1->getLine(), catalog); + error_ = 1; + } + delete[] catalog; + catalog = NULL; + } + >> + | tocType > [ toctype ] + << $t->tocType(toctype); >> + )* + + { FirstTrackNo integer > [ firsttrack, firstLine ] + << if (firsttrack > 0 && firsttrack < 100) { + $t->firstTrackNo(firsttrack); + } else { + log_message(-2, "%s:%d: Illegal track number: %d\n", filename_, + firstLine, firsttrack); + error_ = 1; + } + >> + } + + { cdTextGlobal [ $t->cdtext_ ] } + + ( track > [ tr, lineNr ] + << if (tr != NULL) { + if ($t->append(tr) != 0) { + log_message(-2, "%s:%d: First track must not have a pregap.\n", + filename_, lineNr); + error_ = 1; + } + delete tr, tr = NULL; + } + >> + )+ + Eof + ; + // fail action + << delete $t, $t = NULL; + delete[] catalog; + >> + +track > [ Track *tr, int lineNr ] + : << $tr = NULL; + $lineNr = 0; + SubTrack *st = NULL; + char *isrcCode = NULL; + TrackData::Mode trackType; + TrackData::SubChannelMode subChanType = TrackData::SUBCHAN_NONE; + Msf length; + Msf indexIncrement; + Msf pos; + int posGiven = 0; + Msf startPos; // end of pre-gap + Msf endPos; // start if post-gap + int startPosLine = 0; + int endPosLine = 0; + int lineNr = 0; + int flag = 1; + >> + TrackDef << $lineNr = $1->getLine(); >> + trackMode > [ trackType ] + { subChannelMode > [ subChanType ] } + << $tr = new Track(trackType, subChanType); >> + + ( Isrc string > [ isrcCode ] + << if (isrcCode != NULL) { + if ($tr->isrc(isrcCode) != 0) { + log_message(-2, "%s:%d: Illegal ISRC code: %s.\n", + filename_, $1->getLine(), isrcCode); + error_ = 1; + } + delete[] isrcCode; + } + >> + | { No << flag = 0; >> } Copy + << $tr->copyPermitted(flag); flag = 1; >> + | { No << flag = 0; >> } PreEmphasis + << $tr->preEmphasis(flag); flag = 1; >> + | TwoChannel + << $tr->audioType(0); >> + | FourChannel + << $tr->audioType(1); >> + )* + + { cdTextTrack [ $tr->cdtext_ ] } + + { Pregap msf > [ length ] + << if (length.lba() == 0) { + log_message(-2, "%s:%d: Length of pregap is zero.\n", + filename_, $1->getLine()); + error_ = 1; + } + else { + if (trackType == TrackData::AUDIO) { + $tr->append(SubTrack(SubTrack::DATA, + TrackData(length.samples()))); + } + else { + $tr->append(SubTrack(SubTrack::DATA, + TrackData(trackType, subChanType, + length.lba() * TrackData::dataBlockSize(trackType, subChanType)))); + } + startPos = $tr->length(); + startPosLine = $1->getLine(); + } + >> + } + + ( subTrack [ trackType, subChanType ] > [ st, lineNr ] + << + if (st != NULL && $tr->append(*st) == 2) { + log_message(-2, + "%s:%d: Mixing of FILE/AUDIOFILE/SILENCE and DATAFILE/ZERO statements not allowed.", filename_, lineNr); + log_message(-2, + "%s:%d: PREGAP acts as SILENCE in audio tracks.", + filename_, lineNr); + error_ = 1; + } + + delete st, st = NULL; + >> + | Start << posGiven = 0; >> { msf > [ pos ] << posGiven = 1; >> } + << if (startPosLine != 0) { + log_message(-2, + "%s:%d: Track start (end of pre-gap) already defined.\n", + filename_, $1->getLine()); + error_ = 1; + } + else { + if (!posGiven) { + pos = $tr->length(); // retrieve current position + } + startPos = pos; + startPosLine = $1->getLine(); + } + pos = Msf(0); + >> + | End << posGiven = 0; >> { msf > [ pos ] << posGiven = 1; >> } + << if (endPosLine != 0) { + log_message(-2, + "%s:%d: Track end (start of post-gap) already defined.\n", + filename_, $1->getLine()); + error_ = 1; + } + else { + if (!posGiven) { + pos = $tr->length(); // retrieve current position + } + endPos = pos; + endPosLine = $1->getLine(); + } + pos = Msf(0); + >> + )+ + + // set track start (end of pre-gap) and check for minimal track length + << if (startPosLine != 0 && $tr->start(startPos) != 0) { + log_message(-2, + "%s:%d: START %s behind or at track end.\n", filename_, + startPosLine, startPos.str()); + error_ = 1; + } + >> + + ( Index msf > [ indexIncrement ] + << if ($tr != NULL) { + switch ($tr->appendIndex(indexIncrement)) { + case 1: + log_message(-2, "%s:%d: More than 98 index increments.\n", + filename_, $1->getLine()); + error_ = 1; + break; + + case 2: + log_message(-2, "%s:%d: Index beyond track end.\n", + filename_, $1->getLine()); + error_ = 1; + break; + + case 3: + log_message(-2, "%s:%d: Index at start of track.\n", + filename_, $1->getLine()); + error_ = 1; + break; + } + } + >> + )* + + // set track end (start of post-gap) + << if (endPosLine != 0) { + switch ($tr->end(endPos)) { + case 1: + log_message(-2, "%s:%d: END %s behind or at track end.\n", + filename_, endPosLine, endPos.str()); + error_ = 1; + break; + case 2: + log_message(-2, "%s:%d: END %s within pre-gap.\n", + filename_, endPosLine, endPos.str()); + error_ = 1; + break; + case 3: + log_message(-2, + "%s:%d: END %s: Cannot create index mark for post-gap.\n", + filename_, endPosLine, endPos.str()); + error_ = 1; + break; + } + } + >> + ; + // fail action + << delete $tr, $tr = NULL; + delete[] isrcCode; + >> + + +subTrack < [ TrackData::Mode trackType, TrackData::SubChannelMode subChanType ] > [ SubTrack *st, int lineNr ] + : << $st = NULL; + $lineNr = 0; + char *filename = NULL; + unsigned long start = 0; + unsigned long len = 0; + long offset = 0; + TrackData::Mode dMode; + int swapSamples = 0; + >> + ( AudioFile string > [ filename ] + { Swap << swapSamples = 1; >> } + { "#" sLong > [ offset ] } + samples > [start] { samples > [len] } + << $st = new SubTrack(SubTrack::DATA, + TrackData(filename, offset, start, len)); + $st->swapSamples(swapSamples); + + $lineNr = $1->getLine(); + + if (trackType != TrackData::AUDIO) { + log_message(-2, "%s:%d: FILE/AUDIOFILE statements are only allowed for audio tracks.", filename_, $1->getLine()); + error_ = 1; + } + + if (subChanType != TrackData::SUBCHAN_NONE) { + log_message(-2, "%s:%d: FILE/AUDIOFILE statements are only allowed for audio tracks without sub-channel mode.", filename_, $1->getLine()); + error_ = 1; + } + >> + | DataFile string > [ filename ] + << dMode = $trackType; >> + // { dataMode > [ dMode ] } + { "#" sLong > [ offset ] } + { dataLength [ dMode, $subChanType ] > [ len ] } + << $st = new SubTrack(SubTrack::DATA, TrackData(dMode, $subChanType, + filename, + offset, len)); + $lineNr = $1->getLine(); + >> + | Fifo string > [ filename ] + dataLength [$trackType, $subChanType ] > [ len ] + << $st = new SubTrack(SubTrack::DATA, TrackData($trackType, + $subChanType, + filename, len)); + >> + | Silence samples > [len] + << $st = new SubTrack(SubTrack::DATA, TrackData(len)); + $lineNr = $1->getLine(); + if (len == 0) { + log_message(-2, "%s:%d: Length of silence is 0.\n", + filename_, $lineNr); + error_ = 1; + } + + if (trackType != TrackData::AUDIO) { + log_message(-2, "%s:%d: SILENCE statements are only allowed for audio tracks.", filename_, $1->getLine()); + error_ = 1; + } + + if (subChanType != TrackData::SUBCHAN_NONE) { + log_message(-2, "%s:%d: SILENCE statements are only allowed for audio tracks without sub-channel mode.", filename_, $1->getLine()); + error_ = 1; + } + >> + | Zero + << dMode = $trackType; >> + { dataMode > [ dMode ] } + { subChannelMode > [ $subChanType ] } + dataLength [ dMode, $subChanType ] > [ len ] + << $st = new SubTrack(SubTrack::DATA, TrackData(dMode, $subChanType, + len)); + $lineNr = $1->getLine(); + if (len == 0) { + log_message(-2, "%s:%d: Length of zero data is 0.\n", + filename_, $lineNr); + error_ = 1; + } + >> + ) + << if ($st != NULL && $st->length() == 0) { + // try to determine length + if ($st->determineLength() != 0) { + log_message(-2, "%s:%d: Cannot determine length of track data specification.", + filename_, $lineNr); + error_ = 1; + } + } + >> + ; + // fail action + << delete $st, $st = NULL; + delete[] filename; + >> + +string > [ char *ret ] + : << $ret = strdupCC(""); + char *s; + char buf[2]; + >> + + << buf[1] = 0; >> + + BeginString + ( ( String << s = strdup3CC($ret, $1->getText(), NULL); >> + | StringQuote << s = strdup3CC($ret, "\"", NULL); >> + | StringOctal << buf[0] = strtol($1->getText() + 1, NULL, 8); + s = strdup3CC($ret, buf, NULL); + >> + ) + << delete[] $ret; + $ret = s; + >> + )+ + + EndString + ; + +stringEmpty > [ char *ret ] + : << $ret = strdupCC(""); + char *s; + char buf[2]; + >> + + << buf[1] = 0; >> + + BeginString + ( ( String << s = strdup3CC($ret, $1->getText(), NULL); >> + | StringQuote << s = strdup3CC($ret, "\"", NULL); >> + | StringOctal << buf[0] = strtol($1->getText() + 1, NULL, 8); + s = strdup3CC($ret, buf, NULL); + >> + ) + << delete[] $ret; + $ret = s; + >> + )* + + EndString + ; + + + +uLong > [ unsigned long l ] + : << $l = 0; >> + Integer << $l = strtoul($1->getText(), NULL, 10); >> + ; + +sLong > [ long l ] + : << $l = 0; >> + Integer << $l = strtol($1->getText(), NULL, 10); >> + ; + +integer > [ int i, int lineNr ] + : << $i = 0; >> + Integer << $i = atol($1->getText()); $lineNr = $1->getLine(); >> + ; + +msf > [ Msf m ] + : << int min = 0; + int sec = 0; + int frac = 0; + int err = 0; + int minLine; + int secLine; + int fracLine; + >> + integer > [min, minLine] ":" integer > [sec, secLine] + ":" integer > [frac, fracLine] + << if (min < 0) { + log_message(-2, "%s:%d: Illegal minute field: %d\n", filename_, + minLine, min); + err = error_ = 1; + } + if (sec < 0 || sec > 59) { + log_message(-2, "%s:%d: Illegal second field: %d\n", filename_, + secLine, sec); + err = error_ = 1; + } + if (frac < 0 || frac > 74) { + log_message(-2, "%s:%d: Illegal fraction field: %d\n", filename_, + fracLine, frac); + err = error_ = 1; + } + + if (err != 0) { + $m = Msf(0); + } + else { + $m = Msf(min, sec, frac); + } + >> + ; + + +samples > [ unsigned long s ] + : << Msf m; >> + ( msf > [ m ] << $s = m.samples(); >> + | uLong > [ $s ] + ) + ; + // fail action + << $s = 0; >> + +dataLength [ TrackData::Mode mode, TrackData::SubChannelMode sm] > [ unsigned long len ] + : << Msf m; + unsigned long blen; + + blen = TrackData::dataBlockSize(mode, sm); + >> + + ( msf > [ m] << $len = m.lba() * blen; >> + | uLong > [ $len ] + ) + ; + // fail action + << $len = 0; >> + +dataMode > [ TrackData::Mode m ] + : + ( Audio << $m = TrackData::AUDIO; >> + | Mode0 << $m = TrackData::MODE0; >> + | Mode1 << $m = TrackData::MODE1; >> + | Mode1Raw << $m = TrackData::MODE1_RAW; >> + | Mode2 << $m = TrackData::MODE2; >> + | Mode2Raw << $m = TrackData::MODE2_RAW; >> + | Mode2Form1 << $m = TrackData::MODE2_FORM1; >> + | Mode2Form2 << $m = TrackData::MODE2_FORM2; >> + | Mode2FormMix << $m = TrackData::MODE2_FORM_MIX; >> + ) + ; + +trackMode > [ TrackData::Mode m ] + : + ( Audio << $m = TrackData::AUDIO; >> + | Mode1 << $m = TrackData::MODE1; >> + | Mode1Raw << $m = TrackData::MODE1_RAW; >> + | Mode2 << $m = TrackData::MODE2; >> + | Mode2Raw << $m = TrackData::MODE2_RAW; >> + | Mode2Form1 << $m = TrackData::MODE2_FORM1; >> + | Mode2Form2 << $m = TrackData::MODE2_FORM2; >> + | Mode2FormMix << $m = TrackData::MODE2_FORM_MIX; >> + ) + ; + +subChannelMode > [ TrackData::SubChannelMode m ] + : + ( SubChanRw << $m = TrackData::SUBCHAN_RW; >> + | SubChanRwRaw << $m = TrackData::SUBCHAN_RW_RAW; >> + ) + ; + +tocType > [ Toc::TocType t ] + : ( TocTypeCdda << $t = Toc::CD_DA; >> + | TocTypeCdrom << $t = Toc::CD_ROM; >> + | TocTypeCdromXa << $t = Toc::CD_ROM_XA; >> + | TocTypeCdi << $t = Toc::CD_I; >> + ) + ; + +packType > [ CdTextItem::PackType t, int lineNr ] + : ( Title << $t = CdTextItem::CDTEXT_TITLE; $lineNr = $1->getLine(); >> + | Performer << $t = CdTextItem::CDTEXT_PERFORMER; $lineNr = $1->getLine(); >> + | Songwriter << $t = CdTextItem::CDTEXT_SONGWRITER; $lineNr = $1->getLine(); >> + | Composer << $t = CdTextItem::CDTEXT_COMPOSER; $lineNr = $1->getLine(); >> + | Arranger << $t = CdTextItem::CDTEXT_ARRANGER; $lineNr = $1->getLine(); >> + | Message << $t = CdTextItem::CDTEXT_MESSAGE; $lineNr = $1->getLine(); >> + | DiscId << $t = CdTextItem::CDTEXT_DISK_ID; $lineNr = $1->getLine(); >> + | Genre << $t = CdTextItem::CDTEXT_GENRE; $lineNr = $1->getLine(); >> + | TocInfo1 << $t = CdTextItem::CDTEXT_TOC_INFO1; $lineNr = $1->getLine(); >> + | TocInfo2 << $t = CdTextItem::CDTEXT_TOC_INFO2; $lineNr = $1->getLine(); >> + | Reserved1 << $t = CdTextItem::CDTEXT_RES1; $lineNr = $1->getLine(); >> + | Reserved2 << $t = CdTextItem::CDTEXT_RES2; $lineNr = $1->getLine(); >> + | Reserved3 << $t = CdTextItem::CDTEXT_RES3; $lineNr = $1->getLine(); >> + | Reserved4 << $t = CdTextItem::CDTEXT_RES4; $lineNr = $1->getLine(); >> + | UpcEan << $t = CdTextItem::CDTEXT_UPCEAN_ISRC; $lineNr = $1->getLine(); >> + | Isrc << $t = CdTextItem::CDTEXT_UPCEAN_ISRC; $lineNr = $1->getLine(); >> + | SizeInfo << $t = CdTextItem::CDTEXT_SIZE_INFO; $lineNr = $1->getLine(); >> + ) + ; + +binaryData > [ const unsigned char *data, long len ] + : << static unsigned char buf[MAX_CD_TEXT_DATA_LEN]; + $data = buf; + $len = 0; + int i; + int lineNr; + >> + "\{" + { integer > [ i, lineNr ] + << if (i < 0 || i > 255) { + log_message(-2, "%s:%d: Illegal binary data: %d", filename_, lineNr, i); + error_ = 1; + i = 0; + } + + buf[0] = i; + $len = 1; + >> + ( "," integer > [ i, lineNr ] + << if (i < 0 || i > 255) { + log_message(-2, "%s:%d: Illegal binary data: %d", + filename_, lineNr, i); + error_ = 1; + i = 0; + } + + if ($len >= MAX_CD_TEXT_DATA_LEN) { + log_message(-2, "%s:%d: Binary data exceeds maximum length (%d).", + filename_, lineNr, MAX_CD_TEXT_DATA_LEN); + error_ = 1; + } + else { + buf[$len] = i; + $len += 1; + } + >> + )* + } + "\}" + ; + // fail action + << $len = 0; >> + +cdTextItem [ int blockNr ] > [ CdTextItem *item, int lineNr ] + : << $item = NULL; + CdTextItem::PackType type; + const char *s; + const unsigned char *data; + long len; + >> + + packType > [ type, $lineNr ] + ( stringEmpty > [ s ] + << if (s != NULL) { + $item = new CdTextItem(type, blockNr, s); + delete[] s; + } + >> + | binaryData > [ data, len ] + << $item = new CdTextItem(type, blockNr, data, len); >> + ) + ; + // fail action + << delete $item; + $item = NULL; + >> + +cdTextBlock [ CdTextContainer &container, int isTrack ] + : << CdTextItem *item = NULL; + int blockNr; + int lineNr; + >> + + Language integer > [ blockNr, lineNr ] + "\{" + << if (blockNr < 0 || blockNr > 7) { + log_message(-2, "%s:%d: Invalid block number, allowed range: [0..7].", + filename_, lineNr); + error_ = 1; + blockNr = 0; + } + >> + ( cdTextItem [ blockNr ] > [ item, lineNr ] + << if (item != NULL) { + int type = item->packType(); + + if (isTrack && ((type > 0x86 && type <= 0x89) || type == 0x8f)) { + log_message(-2, "%s:%d: Invalid CD-TEXT item for a track.", + filename_, lineNr); + error_ = 1; + delete item; + item = NULL; + } + else { + container.add(item); + item = NULL; + } + } + >> + )* + "\}" + ; + // fail action + << delete item; >> + + +cdTextLanguageMap [ CdTextContainer &container ] + : << int blockNr; + int lang; + int blockNrLine; + int langLine = 0; + >> + + LanguageMap "\{" + ( integer > [ blockNr, blockNrLine] ":" + ( integer > [ lang, langLine ] + | LangEn << lang = 9; >> + ) + << if (blockNr >= 0 && blockNr <= 7) { + if (lang >= 0 && lang <= 255) { + container.language(blockNr, lang); + } + else { + log_message(-2, + "%s:%d: Invalid language code, allowed range: [0..255].", + filename_, langLine); + error_ = 1; + } + } + else { + log_message(-2, + "%s:%d: Invalid language number, allowed range: [0..7].", + filename_, blockNrLine); + error_ = 1; + } + >> + )+ + "\}" + ; + +cdTextTrack [ CdTextContainer &container ] + : + CdText "\{" + ( cdTextBlock [ container, 1 ] )* + "\}" + ; + +cdTextGlobal [ CdTextContainer &container ] + : + CdText "\{" + { cdTextLanguageMap [ container ] } + ( cdTextBlock [ container, 0 ] )* + "\}" + ; +} + + +<< +ANTLRTokenType TocLexer::erraction() +{ + log_message(-2, "%s:%d: Illegal token: %s", parser_->filename_, + _line, _lextext); + parser_->error_ = 1; + return Eof; +} +>> + +<< +void TocParserGram::syn(_ANTLRTokenPtr tok, ANTLRChar *egroup, + SetWordType *eset, ANTLRTokenType etok, int k) +{ + int line; + + error_ = 1; + line = LT(1)->getLine(); + + log_message(-2, "%s:%d: syntax error at \"%s\" ", filename_, line, + LT(1)->getType() == Eof ? "EOF" : LT(1)->getText()); + if ( !etok && !eset ) { + log_message(0, ""); + return; + } + if ( k==1 ) { + log_message(0, "missing "); + } + else { + log_message(0, "; \"%s\" not ", LT(1)->getText()); + if ( set_deg(eset)>1 ) log_message(-2, " in "); + } + if ( set_deg(eset)>0 ) + edecode(eset); + else log_message(0, "%s ", token_tbl[etok]); + + if ( strlen(egroup) > 0 ) + log_message(0, "in %s ", egroup); + + log_message(0, ""); +} + + +Toc *parseToc(const char* inp, const char *filename) +{ + DLGStringInput in(inp); + TocLexer scan(&in); + ANTLRTokenBuffer pipe(&scan); + ANTLRToken aToken; + scan.setToken(&aToken); + TocParserGram parser(&pipe); + + parser.filename_ = filename; + scan.parser_ = &parser; + + parser.init(); + parser.error_ = 0; + + Toc *t = parser.toc(); + + if (parser.error_ != 0) { + return NULL; + } + else { + return t; + } +} + +Toc *parseToc(FILE *fp, const char *filename) +{ + DLGFileInput in(fp); + TocLexer scan(&in); + ANTLRTokenBuffer pipe(&scan); + ANTLRToken aToken; + scan.setToken(&aToken); + TocParserGram parser(&pipe); + + parser.filename_ = filename; + scan.parser_ = &parser; + + parser.init(); + parser.error_ = 0; + + Toc *t = parser.toc(); + + if (parser.error_ != 0) { + return NULL; + } + else { + return t; + } +} +>> diff --git a/trackdb/Track.cc b/trackdb/Track.cc new file mode 100644 index 0000000..23847e9 --- /dev/null +++ b/trackdb/Track.cc @@ -0,0 +1,2001 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <stddef.h> +#include <assert.h> +#include <ctype.h> +#include <string.h> + +#include "Track.h" +#include "util.h" +#include "log.h" +#include "TrackDataList.h" +#include "CdTextItem.h" +#include "lec.h" + +Track::Track(TrackData::Mode t, TrackData::SubChannelMode st) + : length_(0), start_(0), end_(0) +{ + type_ = t; + subChannelType_ = st; + audioCutMode_ = -1; + + nofSubTracks_ = 0; + subTracks_ = lastSubTrack_ = NULL; + + nofIndices_ = 0; + index_ = new Msf[98]; + + isrcValid_ = 0; + + flags_.copy = 0; // digital copy not permitted + flags_.preEmphasis = 0; // no pre-emphasis + flags_.audioType = 0; // two channel audio +} + +Track::Track(const Track &obj) + : length_(obj.length_), start_(obj.start_), end_(obj.end_), + cdtext_(obj.cdtext_) +{ + int i; + SubTrack *run; + + type_ = obj.type_; + subChannelType_ = obj.subChannelType_; + audioCutMode_ = obj.audioCutMode_; + + nofSubTracks_ = obj.nofSubTracks_; + subTracks_ = lastSubTrack_ = NULL; + for (run = obj.subTracks_; run != NULL; run = run->next_) { + if (subTracks_ == NULL) { + subTracks_ = lastSubTrack_ = new SubTrack(*run); + } + else { + lastSubTrack_->next_ = new SubTrack(*run); + lastSubTrack_->next_->pred_ = lastSubTrack_; + lastSubTrack_ = lastSubTrack_->next_; + } + } + + nofIndices_ = obj.nofIndices_; + index_ = new Msf[98]; + for (i = 0; i < nofIndices_; i++) { + index_[i] = obj.index_[i]; + } + + isrcValid_ = obj.isrcValid_; + memcpy(isrcCountry_, obj.isrcCountry_, 2); + memcpy(isrcOwner_, obj.isrcOwner_, 3); + memcpy(isrcYear_, obj.isrcYear_, 2); + memcpy(isrcSerial_, obj.isrcSerial_, 5); + + flags_ = obj.flags_; +} + + +Track::~Track() +{ + SubTrack *run = subTracks_; + SubTrack *next = NULL; + + while (run != NULL) { + next = run->next_; + delete run; + run = next; + } + + delete[] index_; +} + +// Returns first sub-track or 'NULL' if no sub-tracks are defined +const SubTrack *Track::firstSubTrack() const +{ + return subTracks_ != NULL ? subTracks_ : NULL; +} + +// Returns last sub-track or 'NULL' if no sub-tracks are defined +const SubTrack *Track::lastSubTrack() const +{ + return lastSubTrack_ != NULL ? lastSubTrack_ : NULL; +} + + +// Appends given sub-track to list of sub-tracks. +// return: 0: OK +// 1: tried to append PAD sub-track +// 2: tried to append sub-track with different audioCutMode +int Track::append(const SubTrack &strack) +{ + if (strack.type() == SubTrack::PAD) + return 1; + + if (audioCutMode_ != -1 && audioCutMode_ != strack.audioCutMode()) + return 2; + + if (lastSubTrack_ != NULL && lastSubTrack_->type() == SubTrack::PAD && + lastSubTrack_->mode() == strack.mode() && + lastSubTrack_->subChannelMode() == strack.subChannelMode()) { + // remove padding sub track + delete removeSubTrack(lastSubTrack_); + } + + // append sub track + insertSubTrackAfter(lastSubTrack_, new SubTrack(strack)); + + update(); + + return 0; +} + + +// Traverses all sub-tracks to update summary data of track. +void Track::update() +{ + long lenLba = 0; // accumulates total length of track in blocks + unsigned long slength; // length of track in samples + unsigned long padLen; // padding length + unsigned long blen; // block length for current data mode + SubTrack *run, *next; + SubTrack *pad; + TrackData::Mode dataMode; + TrackData::SubChannelMode subChannelMode; + + // remove all padding sub-tracks + run = subTracks_; + while (run != NULL) { + next = run->next_; + + if (run->type() == SubTrack::PAD) { + delete removeSubTrack(run); + } + + run = next; + } + + audioCutMode_ = -1; + + if ((run = subTracks_) != NULL) { + do { + dataMode = run->mode(); + subChannelMode = run->subChannelMode(); + + if (audioCutMode_ == -1) + audioCutMode_ = run->audioCutMode(); + else if (audioCutMode_ != run->audioCutMode()) + log_message(-3, "Track::update: mixed audio cut mode."); + + if (audioCutMode_) + blen = SAMPLES_PER_BLOCK; + else + blen = TrackData::dataBlockSize(dataMode, subChannelMode); + + slength = 0; + + // find continues range of sub tracks with same data mode + do { + slength += run->length(); + run = run->next_; + } while (run != NULL && run->mode() == dataMode && + run->subChannelMode() == subChannelMode); + + if ((padLen = slength % blen) != 0) { + padLen = blen - padLen; + + if (audioCutMode_) + pad = new SubTrack(SubTrack::PAD, 0, TrackData(padLen)); + else + pad = new SubTrack(SubTrack::PAD, 0, + TrackData(dataMode, subChannelMode, padLen)); + + if (run != NULL) { + insertSubTrackAfter(run->pred_, pad); + } + else { + insertSubTrackAfter(lastSubTrack_, pad); + } + slength += padLen; + } + + // at this point 'slength' should be a multiple of 'blen' + assert(slength % blen == 0); + + lenLba += slength / blen; + + } while (run != NULL); + } + + length_ = Msf(lenLba); + + slength = 0; + for (run = subTracks_; run != NULL; run = run->next_) { + run->start(slength); // set start position of sub-track + slength += run->length(); + } + + + // reset 'start_' if necessary + if (start_.lba() >= length_.lba()) { + start_ = Msf(0); + } +} + +// Sets logical start of track, everthing before start (if != 0) is taken +// as pre-gap. FIXME: Already set index marks are not updated. +// return: 0: OK +// 1: given start behind track end +int Track::start(Msf s) +{ + // A length of zero gets a pass for this test. The track length is + // optional for the last track entry of the TOC file, because the + // actual length of the track filename is not necessarily known at + // this stage (mp3...). The actual length will be filled in later by + // recomputeLength(). + if (s.lba() >= length_.lba() && (length_.lba() != 0)) { + return 1; + } + + start_ = s; + + return 0; +} + +// Sets end of user area of track which is the start of the post-gap. +// An index entry is created at this point. The pre-gap length must be +// set with 'start()' before this function can be called. +// return: 0: OK +// 1: start of post-gap is behind or at track end +// 2: post-gap within pre-gap +// 3: cannot create index mark, 98 index marks are already defined +int Track::end(Msf e) +{ + if (e.lba() >= length_.lba()) { + return 1; + } + + if (e.lba() != 0 && e.lba() <= start_.lba()) { + return 2; + } + + if (e.lba() != 0) { + // add index mark for post-gap + if (addIndex(Msf(e.lba() - start_.lba())) == 1) { + // already 98 index increments defined + return 3; + } + } + + end_ = e; + + return 0; +} + + +// Appends given index to index increment list. +// return: 0: OK +// 1: > 98 index increments +// 2: index at or beyond track end +// 3: index at start +int Track::appendIndex(const Msf &index) +{ + if (nofIndices_ == 98) { + return 1; + } + + if (index.lba() >= (length_ - start_).lba()) { + return 2; + } + + if (index.lba() == 0) { + return 3; + } + + index_[nofIndices_] = index; + nofIndices_ += 1; + + return 0; +} + +// Adds index at given position +// return: 0: OK +// 1: > 98 index increments +// 2: cannot add index at specified position +int Track::addIndex(const Msf &index) +{ + int i; + if (nofIndices_ == 98) { + return 1; + } + + if (index.lba() >= (length_ - start_).lba()) { + return 2; + } + + if (index.lba() == 0) { + return 2; + } + + for (i = 0; i < nofIndices_; i++) { + if (index.lba() == index_[i].lba()) + return 2; + + if (index.lba() < index_[i].lba()) + break; + } + + if (i == nofIndices_) { + // append index + index_[nofIndices_] = index; + nofIndices_ += 1; + } + else { + int pos = i; + for (i = nofIndices_; i > pos; i--) + index_[i] = index_[i - 1]; + + index_[pos] = index; + nofIndices_ += 1; + } + + return 0; +} + +// Removes specified index. +// return 0: OK +// 1: index not found +int Track::removeIndex(int index) +{ + int i; + + if (index < 0 || index >= nofIndices_) + return 1; + + + for (i = index; i < nofIndices_ - 1; i++) + index_[i] = index_[i + 1]; + + nofIndices_ -= 1; + + return 0; +} + +// returns index increment +Msf Track::getIndex(int i) const +{ + if (i >= nofIndices_ || i < 0) { + return Msf(0); + } + else { + return index_[i]; + } +} + +int Track::check(int trackNr) const +{ + int ret = 0; + + if (length().lba() - start().lba() < Msf(0, 4, 0).lba()) { + log_message(-1, "Track %d: Length is shorter than 4 seconds.", trackNr); + ret = 1; + } + + for (SubTrack* st = subTracks_; st; st = st->next_) { + ret |= st->check(trackNr); + } + + return ret; +} + +bool Track::recomputeLength() +{ + for (SubTrack* st = subTracks_; st; st = st->next_) { + if (st->length() == 0) { + st->determineLength(); + } + } + + update(); + return true; +} + +// Sets ISRC code. Expected string: "CCOOOYYSSSSS" +// C: country code (ASCII) +// O: owner code (ASCII) +// Y: year ('0'-'9') +// S: serial number ('0'-'9') +// return: 0: OK +// 1: ilegal ISRC string +int Track::isrc(const char *isrc) +{ + int i; + + if (isrc == NULL) { + isrcValid_ = 0; + return 0; + } + + if (strlen(isrc) != 12) { + return 1; + } + + for (i=0; i < 5; i++) { + if (!(isdigit(isrc[i]) || isupper(isrc[i]))) { + return 1; + } + } + + for (i = 5; i < 12; i++) { + if (!isdigit(isrc[i])) { + return 1; + } + } + + isrcCountry_[0] = isrc[0]; + isrcCountry_[1] = isrc[1]; + + isrcOwner_[0] = isrc[2]; + isrcOwner_[1] = isrc[3]; + isrcOwner_[2] = isrc[4]; + + + // store BCD + isrcYear_[0] = isrc[5] - '0'; + isrcYear_[1] = isrc[6] - '0'; + + isrcSerial_[0] = isrc[7] - '0'; + isrcSerial_[1] = isrc[8] - '0'; + isrcSerial_[2] = isrc[9] - '0'; + isrcSerial_[3] = isrc[10] - '0'; + isrcSerial_[4] = isrc[11] - '0'; + + isrcValid_ = 1; + + return 0; +} + +const char *Track::isrc() const +{ + static char buf[13]; + + if (!isrcValid_) + return NULL; + + buf[0] = isrcCountry_[0]; + buf[1] = isrcCountry_[1]; + buf[2] = isrcOwner_[0]; + buf[3] = isrcOwner_[1]; + buf[4] = isrcOwner_[2]; + buf[5] = isrcYear_[0] + '0'; + buf[6] = isrcYear_[1] + '0'; + buf[7] = isrcSerial_[0] + '0'; + buf[8] = isrcSerial_[1] + '0'; + buf[9] = isrcSerial_[2] + '0'; + buf[10] = isrcSerial_[3] + '0'; + buf[11] = isrcSerial_[4] + '0'; + buf[12] = 0; + + return buf; +} + +int Track::isPadded() const +{ + SubTrack *run; + + for (run = subTracks_; run != NULL; run = run->next_) { + if (run->type() == SubTrack::PAD) + return 1; + } + + return 0; +} + +// writes out track data in TOC file syntax +void Track::print(std::ostream &out, bool conversions) const +{ + SubTrack *st; + const char *s; + int i; + + out << "TRACK " << TrackData::mode2String(type()); + + s = TrackData::subChannelMode2String(subChannelType()); + + if (*s != 0) + out << " " << s; + + out << std::endl; + + if (!copyPermitted()) + out << "NO "; + out << "COPY" << std::endl; + + if (type() == TrackData::AUDIO) { + if (!preEmphasis()) + out << "NO "; + out << "PRE_EMPHASIS" << std::endl; + + if (audioType() == 0) + out << "TWO_CHANNEL_AUDIO" << std::endl; + else + out << "FOUR_CHANNEL_AUDIO" << std::endl; + + if (isrcValid()) { + out << "ISRC \"" << isrcCountry(0) << isrcCountry(1) + << isrcOwner(0) << isrcOwner(1) << isrcOwner(2) + << (char)(isrcYear(0) + '0') << (char)(isrcYear(1) + '0') + << (char)(isrcSerial(0) + '0') << (char)(isrcSerial(1) + '0') + << (char)(isrcSerial(2) + '0') << (char)(isrcSerial(3) + '0') + << (char)(isrcSerial(4) + '0') << "\"" << std::endl; + } + + cdtext_.print(1, out); + } + + + for (st = subTracks_; st != NULL; st = st->next_) { + st->print(out, conversions); + } + + if (start_.lba() != 0) { + out << "START " << start_.str() << std::endl; + } + + for (i = 0; i < nofIndices_; i++) { + out << "INDEX " << index_[i].str() << std::endl; + } +} + +void Track::collectFiles(std::set<std::string>& set) +{ + SubTrack* st; + for (st = subTracks_; st != NULL; st = st->next_) { + const char* f = st->filename(); + if (f) + set.insert(f); + } +} + +void Track::markFileConversion(const char* src, const char* dst) +{ + SubTrack* st; + for (st = subTracks_; st != NULL; st = st->next_) { + const char* f = st->filename(); + if (f && strcmp(f, src) == 0) { + st->effectiveFilename(dst); + } + } +} + +bool Track::resolveFilename(const char* path) +{ + SubTrack* st; + for (st = subTracks_; st != NULL; st = st->next_) { + std::string rfilename; + const char* f = st->filename(); + + if (f) { + // STDIN is a special case (stdin input), don't process it. + if (strcmp(f, "STDIN") == 0) + continue; + + if (::resolveFilename(rfilename, f, path)) { + st->effectiveFilename(rfilename.c_str()); + } else { + log_message(-2, "Could not find input file \"%s\".", f); + return false; + } + } + } + + return true; +} + +// Locates 'SubTrack' that contains specified sample. +// return: found 'SubTrack' or 'NULL' if given sample is out of range +SubTrack *Track::findSubTrack(unsigned long sample) const +{ + SubTrack *run; + + if (audioCutMode()) { + if (sample >= length_.samples()) + return NULL; + } + else { + if (sample >= + length_.lba() * TrackData::dataBlockSize(type(), subChannelType())) + return NULL; + } + + for (run = subTracks_; + run != NULL && run->next_ != NULL; + run = run->next_) { + if (sample < run->next_->start()) + return run; + } + + return run; +} + + +void Track::countSubTracks() +{ + SubTrack *run; + + nofSubTracks_ = 0; + for (run = subTracks_; run != NULL; run = run->next_) + nofSubTracks_++; +} + +// move track start or index increment within track range +// return: 0: OK +// 1: track length would be shorter than 4 seconds +// 2: cannot cross index boundary +int Track::moveIndex(int index, long lba) +{ + int i; + long rangeMin; + long rangeMax; + + assert(index > 0 && index - 2 < nofIndices_); + assert(lba >= 0 && index < length_.lba()); + + if (index == 1) { + if (nofIndices_ > 0 && lba >= start_.lba() + getIndex(0).lba()) + return 2; + + if (lba > length_.lba() - 4 * 75) + return 1; + + // adjust index increments to new track start + for (i = 0; i < nofIndices_; i++) { + index_[i] = Msf(index_[i].lba() + start_.lba() - lba); + } + + start_ = Msf(lba); + + return 0; + } + + // adjust 'index' for index array access + index -= 2; + + if (lba <= start_.lba()) + return 2; + + lba -= start_.lba(); + + rangeMin = (index == 0 ? 0 : index_[index - 1].lba()); + rangeMax = + (index == nofIndices_ - 1 ? length_.lba() - start_.lba() : + index_[index + 1].lba()); + + if (lba > rangeMin && lba < rangeMax) { + index_[index] = Msf(lba); + return 0; + } + + return 2; +} + +TrackDataList *Track::removeToEnd(unsigned long sample) +{ + SubTrack *strun; + SubTrack *store; + int i; + + assert(sample > 0 && sample < length_.samples()); + + strun = findSubTrack(sample); + + assert(strun != NULL); + + TrackDataList *list = new TrackDataList; + + if (sample == strun->start()) { + // we don't have to split the TrackData object + list->append(new TrackData(*strun)); + + // cannot be the first SubTrack because 'sample' > 0 + strun->pred_->next_ = NULL; + lastSubTrack_ = strun->pred_; + + store = strun; + strun = strun->next_; + delete store; + } + else { + // split audio data object + TrackData *part1, *part2; + + strun->split(sample - strun->start(), &part1, &part2); + + list->append(part2); + + store = new SubTrack(strun->type(), *part1); + delete part1; + + if (strun->pred_ == NULL) { + subTracks_ = store; + } + else { + strun->pred_->next_ = store; + store->pred_ = strun->pred_; + } + lastSubTrack_ = store; + + store = strun; + strun = strun->next_; + delete store; + } + + + while (strun != NULL) { + list->append(new TrackData(*strun)); + + store = strun; + strun = strun->next_; + delete store; + } + + countSubTracks(); + update(); + + checkConsistency(); + + // adjust index increments + for (i = 0; i < nofIndices_; i++) { + if (index_[i].lba() + start_.lba() >= length_.lba()) { + nofIndices_ = i; + break; + } + } + + return list; +} + +TrackDataList *Track::removeFromStart(unsigned long sample) +{ + SubTrack *strun; + SubTrack *store, *start; + int i; + + assert(sample > 0 && sample < length_.samples()); + + TrackDataList *list = new TrackDataList; + + for (strun = subTracks_; + strun != NULL && strun->next_ != NULL; + strun = strun->next_) { + if (sample < strun->next_->start()) + break; + else + list->append(new TrackData(*strun)); + } + + assert(strun != NULL); + + start = subTracks_; + + if (sample == strun->start()) { + // we don't have to split the TrackData object + // cannot be the first SubTrack because 'sample' > 0 + + strun->pred_->next_ = NULL; + subTracks_ = strun; + subTracks_->pred_ = NULL; + } + else { + // split actual sub track + + TrackData *part1, *part2; + + strun->split(sample - strun->start(), &part1, &part2); + + list->append(part1); + + store = new SubTrack(strun->type(), *part2); + delete part2; + + store->next_ = strun->next_; + if (store->next_ != NULL) + store->next_->pred_ = store; + + strun->next_ = NULL; + subTracks_ = store; + + if (strun == lastSubTrack_) + lastSubTrack_ = store; + } + + // remove unlinked sub tracks + while (start != NULL) { + store = start; + start = start->next_; + + delete store; + } + + countSubTracks(); + update(); + + checkConsistency(); + + // adjust index increments + for (i = 0; i < nofIndices_; i++) { + if (index_[i].lba() + start_.lba() >= length_.lba()) { + nofIndices_ = i; + break; + } + } + + return list; +} + + +void Track::prependTrackData(const TrackDataList *list) +{ + SubTrack *start = NULL; + SubTrack *last = NULL; + SubTrack *ent; + const TrackData *run; + + if (list->count() == 0) + return; + + for (run = list->first(); run != NULL; run = list->next()) { + ent = new SubTrack(SubTrack::DATA, *run); + if (last == NULL) { + start = ent; + } + else { + last->next_ = ent; + ent->pred_ = last; + } + last = ent; + } + + if (subTracks_ == NULL) { + subTracks_ = start; + lastSubTrack_ = last; + } + else { + last->next_ = subTracks_; + subTracks_->pred_ = last; + subTracks_ = start; + } + + mergeSubTracks(); // this will also update the sub track counter + update(); + + checkConsistency(); +} + +void Track::appendTrackData(const TrackDataList *list) +{ + SubTrack *start = NULL; + SubTrack *last = NULL; + SubTrack *ent; + const TrackData *run; + + if (list->count() == 0) + return; + + for (run = list->first(); run != NULL; run = list->next()) { + ent = new SubTrack(SubTrack::DATA, *run); + if (last == NULL) { + start = ent; + } + else { + last->next_ = ent; + ent->pred_ = last; + } + last = ent; + } + + if (lastSubTrack_ != NULL) { + if (lastSubTrack_->type() == SubTrack::PAD) + lastSubTrack_->type_ = SubTrack::DATA; + + lastSubTrack_->next_ = start; + start->pred_ = lastSubTrack_; + lastSubTrack_ = last; + } + else { + subTracks_ = start; + lastSubTrack_ = last; + } + + mergeSubTracks(); // this will also update the sub track counter + update(); + + checkConsistency(); +} + +void Track::appendTrackData(const Track *track) +{ + SubTrack *run, *ent; + + for (run = track->subTracks_; run != NULL; run = run->next_) { + ent = new SubTrack(*run); + + if (lastSubTrack_ == NULL) { + subTracks_ = ent; + } + else { + lastSubTrack_->next_ = ent; + ent->pred_ = lastSubTrack_; + } + lastSubTrack_ = ent; + } + + mergeSubTracks(); // this will also update the sub track counter + update(); + + checkConsistency(); +} + +TrackDataList *Track::removeTrackData(unsigned long start, unsigned long end) +{ + SubTrack *run; + TrackData *part1, *part2, *part3; + unsigned long plen; + + if (start > end || end >= length_.samples()) + return NULL; + + SubTrack *startSt = findSubTrack(start); + SubTrack *endSt = findSubTrack(end); + + assert(startSt != NULL); + assert(endSt != NULL); + + TrackDataList *list = new TrackDataList; + + if (startSt == endSt) { + if (start == startSt->start() && + end == startSt->start() + startSt->length() - 1) { + // remove complete sub track + list->append(new TrackData(*startSt)); + } + else if (start == startSt->start()) { + // remove first part of sub track + startSt->split(end + 1 - startSt->start(), &part1, &part2); + list->append(part1); + insertSubTrackAfter(startSt, new SubTrack(startSt->type(), *part2)); + delete part2; + } + else if (end == startSt->start() + startSt->length() - 1) { + // remove last part of sub track + startSt->split(start - startSt->start(), &part1, &part2); + list->append(part2); + insertSubTrackAfter(startSt, new SubTrack(startSt->type(), *part1)); + delete part1; + } + else { + // remove middle part of sub track + startSt->split(start - startSt->start(), &part1, &part2); + + insertSubTrackAfter(startSt->pred_, + new SubTrack(startSt->type(), *part1)); + plen = part1->length(); + delete part1; + + part2->split(end + 1 - startSt->start() - plen, &part1, &part3); + list->append(part1); + + insertSubTrackAfter(startSt, new SubTrack(startSt->type(), *part3)); + delete part3; + delete part2; + } + + delete removeSubTrack(startSt); + } + else { + if (start == startSt->start()) { + // remove complete sub track + list->append(new TrackData(*startSt)); + } + else { + startSt->split(start - startSt->start(), &part1, &part2); + list->append(part2); + insertSubTrackAfter(startSt->pred_, + new SubTrack(startSt->type(), *part1)); + delete part1; + } + + for (run = startSt->next_; run != endSt; run = run->next_) + list->append(new TrackData(*(startSt->next_))); + + if (end == endSt->start() + endSt->length() - 1) { + // remove complete sub track + list->append(new TrackData(*endSt)); + } + else { + endSt->split(end + 1 - endSt->start(), &part1, &part2); + list->append(part1); + insertSubTrackAfter(endSt, new SubTrack(endSt->type(), *part2)); + delete part2; + } + + while (startSt->next_ != endSt) + delete removeSubTrack(startSt->next_); + + delete removeSubTrack(startSt); + delete removeSubTrack(endSt); + } + + + // adjust index marks + unsigned long len; + long preGapAdj = 0; + long slba = 0; + long elba = 0; + long indexMove = 0; + long indexAdj = 0; + int i; + + if (start < start_.samples()) { + if (end < start_.samples()) { + len = end - start + 1; + slba = -1; + elba = -1; + } + else { + len = start_.samples() - start; + elba = (end - start_.samples()) / SAMPLES_PER_BLOCK; + slba = 0; + indexMove = (end - start_.samples() + 1) / SAMPLES_PER_BLOCK; + if (((end - start_.samples() + 1) % SAMPLES_PER_BLOCK) != 0) + indexMove += 1; + } + + preGapAdj = len / SAMPLES_PER_BLOCK; + + if ((len % SAMPLES_PER_BLOCK) != 0) + indexAdj = 1; + } + else { + slba = (start - start_.samples()) / SAMPLES_PER_BLOCK; + if (((start - start_.samples()) % SAMPLES_PER_BLOCK) != 0) + slba += 1; + + elba = (end - start_.samples()) / SAMPLES_PER_BLOCK; + + indexMove = (end - start + 1) / SAMPLES_PER_BLOCK; + if (((end - start + 1) % SAMPLES_PER_BLOCK) != 0) + indexMove += 1; + } + + + i = 0; + + while (i < nofIndices_) { + if (index_[i].lba() >= slba && index_[i].lba() <= elba) { + removeIndex(i); + continue; + } + else if (index_[i].lba() > elba) { + if (index_[i].lba() - indexMove <= 0) { + removeIndex(i); + continue; + } + else { + index_[i] = Msf(index_[i].lba() - indexMove); + } + + if (i > 0 && index_[i - 1].lba() == index_[i].lba()) { + removeIndex(i); + continue; + } + } + + if (index_[i].lba() - indexAdj <= 0) { + removeIndex(i); + continue; + } + else { + index_[i] = Msf(index_[i].lba() - indexAdj); + } + + i++; + } + + // adjust pre-gap length + start_ = Msf(start_.lba() - preGapAdj); + + + mergeSubTracks(); // this will also update the sub track counter + update(); + + checkConsistency(); + + return list; +} + + +void Track::insertTrackData(unsigned long pos, const TrackDataList *list) +{ + const TrackData *run; + TrackData *part1, *part2; + SubTrack *st; + unsigned long len; + long blen; + int i; + + if (list == NULL || list->first() == NULL || list->length() == 0) + return; + + + if (pos >= length_.samples()) { + // append data + for (run = list->first(); run != NULL; run = list->next()) { + insertSubTrackAfter(lastSubTrack_, new SubTrack(SubTrack::DATA, *run)); + } + } + else { + st = findSubTrack(pos); + + assert(st != NULL); + + len = list->length(); + + if (pos == st->start()) { + for (run = list->first(); run != NULL; run = list->next()) { + insertSubTrackAfter(st->pred_, new SubTrack(SubTrack::DATA, *run)); + } + } + else { + st->split(pos - st->start(), &part1, &part2); + + insertSubTrackAfter(st->pred_, new SubTrack(SubTrack::DATA, *part1)); + insertSubTrackAfter(st, new SubTrack(st->type(), *part2)); + delete part1; + delete part2; + + for (run = list->first(); run != NULL; run = list->next()) { + insertSubTrackAfter(st->pred_, new SubTrack(SubTrack::DATA, *run)); + } + + delete removeSubTrack(st); + } + + blen = len / SAMPLES_PER_BLOCK; + + if (pos <= start_.samples()) { + start_ = Msf(start_.lba() + blen); + } + else { + for (i = 0; i < nofIndices_; i++) { + if (index_[i].samples() >= pos) + index_[i] = Msf(index_[i].lba() + blen); + } + } + } + + mergeSubTracks(); // this will also update the sub track counter + update(); + + checkConsistency(); + + return; +} + +void Track::mergeSubTracks() +{ + SubTrack *run = subTracks_; + SubTrack *newSubTrack; + TrackData *mergedData; + + + while (run != NULL && run->next_ != NULL) { + if (run->type() == run->next_->type() && + (mergedData = run->merge(run->next_)) != NULL) { + newSubTrack = new SubTrack(run->type(), *mergedData); + delete mergedData; + + newSubTrack->next_ = run->next_->next_; + if (newSubTrack->next_ != NULL) + newSubTrack->next_->pred_ = newSubTrack; + + if (run->pred_ == NULL) { + subTracks_ = newSubTrack; + } + else { + run->pred_->next_ = newSubTrack; + newSubTrack->pred_ = run->pred_; + } + + if (run->next_ == lastSubTrack_) + lastSubTrack_ = newSubTrack; + + delete run->next_; + delete run; + run = newSubTrack; + } + else { + run = run->next_; + } + } + + countSubTracks(); +} + + +void Track::checkConsistency() +{ + SubTrack *run, *last = NULL; + long cnt = 0; + + for (run = subTracks_; run != NULL; last = run, run = run->next_) { + cnt++; + if (run->pred_ != last) + log_message(-3, "Track::checkConsistency: wrong pred pointer."); + } + + if (last != lastSubTrack_) + log_message(-3, "Track::checkConsistency: wrong last pointer."); + + if (cnt != nofSubTracks_) + log_message(-3, "Track::checkConsistency: wrong sub track counter."); +} + +// Inserts 'newSubTrack' after existing sub track 'subTrack'. If 'subTrack' +// is NULL it will be prepended. +void Track::insertSubTrackAfter(SubTrack *subTrack, SubTrack *newSubTrack) +{ + if (subTrack == NULL) { + if (subTracks_ == NULL) { + subTracks_ = lastSubTrack_ = newSubTrack; + newSubTrack->next_ = newSubTrack->pred_ = NULL; + } + else { + newSubTrack->next_ = subTracks_; + subTracks_->pred_ = newSubTrack; + + newSubTrack->pred_ = NULL; + subTracks_ = newSubTrack; + } + } + else { + newSubTrack->next_ = subTrack->next_; + if (newSubTrack->next_ != NULL) { + newSubTrack->next_->pred_ = newSubTrack; + } + else { + lastSubTrack_ = newSubTrack; + } + + subTrack->next_ = newSubTrack; + newSubTrack->pred_ = subTrack; + } + + nofSubTracks_ += 1; + + checkConsistency(); +} + +// Removes given sub track from list. Returns the removed sub track. +SubTrack *Track::removeSubTrack(SubTrack *subTrack) +{ + if (subTrack->pred_ == NULL) { + assert(subTrack == subTracks_); + + subTracks_ = subTrack->next_; + + if (subTracks_ != NULL) { + subTracks_->pred_ = NULL; + } + else { + lastSubTrack_ = NULL; + } + } + else { + subTrack->pred_->next_ = subTrack->next_; + + if (subTrack->next_ != NULL) { + subTrack->next_->pred_ = subTrack->pred_; + } + else { + lastSubTrack_ = subTrack->pred_; + } + } + + nofSubTracks_ -= 1; + + subTrack->next_ = subTrack->pred_ = NULL; + + checkConsistency(); + + return subTrack; +} + + +// Fills provided buffer with an audio block that contains zero data +// encoded with given mode. +// encMode: encoding mode, see 'TrackReader::readBlock()' +// mode: sector mode +// smode: sub-channel mode +// lba : absolute address of sector +// buf : caller provided buffer that is filled with at most 2448 bytes + +void Track::encodeZeroData(int encMode, TrackData::Mode mode, + TrackData::SubChannelMode smode, + long lba, unsigned char *buf) +{ + long subChanLen = TrackData::subChannelSize(smode); + + // we won't have to calculate P and Q parity for zero R-W sub-channels + // because 0s have no impact on the parity + + if (encMode == 0) { + memset(buf, 0, AUDIO_BLOCK_LEN + subChanLen); + + switch (mode) { + case TrackData::AUDIO: + break; + case TrackData::MODE0: + lec_encode_mode0_sector(lba, buf); + lec_scramble(buf); + break; + case TrackData::MODE1: + case TrackData::MODE1_RAW: + lec_encode_mode1_sector(lba, (u_int8_t *)buf); + lec_scramble(buf); + break; + case TrackData::MODE2: + case TrackData::MODE2_RAW: + lec_encode_mode2_sector(lba, (u_int8_t *)buf); + lec_scramble(buf); + break; + case TrackData::MODE2_FORM1: + case TrackData::MODE2_FORM_MIX: // encode as form 1 + lec_encode_mode2_form1_sector(lba, (u_int8_t *)buf); + lec_scramble(buf); + break; + case TrackData::MODE2_FORM2: + // setup sub header + buf[16+2] = 0x20; + buf[16+6] = 0x20; + lec_encode_mode2_form2_sector(lba, (u_int8_t *)buf); + lec_scramble(buf); + break; + } + } + else if (encMode == 1) { + switch (mode) { + case TrackData::AUDIO: + memset(buf, 0, AUDIO_BLOCK_LEN + subChanLen); + break; + case TrackData::MODE0: + memset(buf, 0, MODE0_BLOCK_LEN + subChanLen); + break; + case TrackData::MODE1: + case TrackData::MODE1_RAW: + memset(buf, 0, MODE1_BLOCK_LEN + subChanLen); + break; + case TrackData::MODE2: + case TrackData::MODE2_RAW: + case TrackData::MODE2_FORM_MIX: + memset(buf, 0, MODE2_BLOCK_LEN + subChanLen); + break; + case TrackData::MODE2_FORM1: + memset(buf, 0, MODE2_BLOCK_LEN + subChanLen); + break; + case TrackData::MODE2_FORM2: + memset(buf, 0, MODE2_BLOCK_LEN + subChanLen); + // setup sub header + buf[2] = 0x20; + buf[6] = 0x20; + break; + } + } + else { + log_message(-3, "Illegal sector encoding mode in 'Track::encodeZeroData()'."); + } +} + +void Track::addCdTextItem(CdTextItem *item) +{ + assert(CdTextItem::isTrackPack(item->packType())); + + cdtext_.add(item); +} + +void Track::removeCdTextItem(CdTextItem::PackType type, int blockNr) +{ + cdtext_.remove(type, blockNr); +} + +TrackReader::TrackReader(const Track *t) : reader(NULL) +{ + track_ = t; + + readPos_ = 0; + readPosSample_ = 0; + readSubTrack_ = NULL; + open_ = 0; + + subChanDelayLineIndex_ = 0; +} + +TrackReader::~TrackReader() +{ + if (open_) { + closeData(); + } + + track_ = NULL; + readSubTrack_ = NULL; +} + +void TrackReader::init(const Track *t) +{ + if (open_) { + closeData(); + } + + track_ = t; + readSubTrack_ = NULL; +} + +// initiates reading track +// return: 0: OK +// 1: data file could not be opened +// 2: could not seek to start position +int TrackReader::openData() +{ + assert(open_ == 0); + assert(track_ != NULL); + + int ret = 0; + //int i; + + open_ = 1; + readPos_ = 0; + readPosSample_ = 0; + + readSubTrack_ = track_->subTracks_; + + reader.init(readSubTrack_); + + subChanDelayLineIndex_ = 0; + /* + for(i = 0; i < MAX_SUB_DEL; i++) + memset(subChanDelayLine_[i], 0, 24); + */ + + if (readSubTrack_ != NULL) { + ret = reader.openData(); + } + + return ret; +} + +void TrackReader::closeData() +{ + if (open_) { + open_ = 0; + readPos_ = 0; + readPosSample_ = 0; + readSubTrack_ = NULL; + + reader.closeData(); + } +} + + +long TrackReader::readData(int encodingMode, int subChanEncodingMode, + long lba, char *buf, long len) +{ + long err = 0; + long b; + long offset; + + assert(open_ != 0); + + if (readPos_ + len > track_->length_.lba()) { + if ((len = track_->length_.lba() - readPos_) <= 0) { + return 0; + } + } + + for (b = 0; b < len; b++) { + if ((offset = readBlock(encodingMode, subChanEncodingMode, lba, + (Sample*)buf)) == 0) { + err = 1; + break; + } + buf += offset; + lba++; + } + + readPos_ += b; + + return err == 0 ? b : -1; +} + +// Reads one block from sub-tracks and performs the data encoding for the +// block. +// encodingMode: conrols how the sector data is encoded +// 0: returned data is always an audio block (2352 bytes), +// data blocks are completely encoded +// 1: data is returned mostly unencoded, the block size +// depends on the actual sub-track mode, MODE2_FORM1 and +// MODE2_FORM2 blocks are extended by the sub header and +// filled with 0 bytes to match the MODE2 block size +// (2336 bytes). +// subChanEncodingMode: conrols how the R-W sub-channel data is encoded +// 0: plain R-W data +// 1: generate Q and P parity and interleave +// lba: Logical block address that must be encoded into header of data blocks +// Return: 0 if error occured, else length of block that has been filled +// +int TrackReader::readBlock(int encodingMode, int subChanEncodingMode, + long lba, Sample *buf) +{ + TrackData::Mode dataMode; // current data mode of sub-track + TrackData::SubChannelMode subChanMode; // current sub-channel mode of sub-track + long actLen; + long count; // amount of data the must be read from sub track + long blen; + long nread = 0; + long offset = 0; // block length of returned data + long subChannelDataLen; + char subChanData[MAX_SUBCHANNEL_LEN]; + + + while (reader.readLeft() == 0) { + // skip to next sub track with available data + readSubTrack_ = readSubTrack_->next_; + // next sub-track must exist since requested length matches available data + assert(readSubTrack_ != NULL); + + reader.init(readSubTrack_); + if (reader.openData() != 0) { + return 0; + } + } + + dataMode = readSubTrack_->mode(); // current data mode + subChanMode = readSubTrack_->subChannelMode(); // current sub-channel mode + + if (track_->audioCutMode()) { + count = SAMPLES_PER_BLOCK; + blen = AUDIO_BLOCK_LEN; + } + else { + count = TrackData::dataBlockSize(dataMode, subChanMode); + blen = count; + } + + subChannelDataLen = TrackData::subChannelSize(subChanMode); + + char *dataBuf = (char *)buf; + + if (encodingMode == 0) { + offset = AUDIO_BLOCK_LEN; + + switch (dataMode) { + case TrackData::AUDIO: + case TrackData::MODE1_RAW: + case TrackData::MODE2_RAW: + break; + case TrackData::MODE0: + case TrackData::MODE1: + case TrackData::MODE2: + case TrackData::MODE2_FORM_MIX: + dataBuf += 16; + break; + case TrackData::MODE2_FORM1: + memset(dataBuf + 16, 0, 8); // clear sub-header + dataBuf += 24; + break; + case TrackData::MODE2_FORM2: + memset(dataBuf + 16, 0, 8); // clear sub-header + dataBuf[16+2] = 0x20; + dataBuf[16+6] = 0x20; + dataBuf += 24; + break; + } + } + else if (encodingMode == 1) { + switch (dataMode) { + case TrackData::AUDIO: + offset = AUDIO_BLOCK_LEN; + break; + case TrackData::MODE0: + offset = MODE0_BLOCK_LEN; + break; + case TrackData::MODE1: + offset = MODE1_BLOCK_LEN; + break; + case TrackData::MODE1_RAW: + offset = MODE1_BLOCK_LEN; + break; + case TrackData::MODE2: + case TrackData::MODE2_FORM_MIX: + offset = MODE2_BLOCK_LEN; + break; + case TrackData::MODE2_FORM1: + case TrackData::MODE2_FORM2: + offset = MODE2_BLOCK_LEN; + memset(dataBuf, 0, MODE2_BLOCK_LEN); + dataBuf += 8; // reserve space for sub-header + break; + case TrackData::MODE2_RAW: + offset = MODE2_BLOCK_LEN; + break; + } + } + + // gather one block of data, block length depends on 'dataMode' + while (count > 0) { + if (track_->audioCutMode()) + actLen = reader.readData(buf + nread, count); + else + actLen = reader.readData((Sample *)(dataBuf + nread), count); + + if (actLen < 0) // indicates read error + return 0; + + if (actLen != count) { + // end of data in sub-track reached, skip to next sub-track + readSubTrack_ = readSubTrack_->next_; + + // next sub-track must exist since requested length match available data + assert(readSubTrack_ != NULL); + + // mode of next sub-track must match, this is ensured in 'update()'. + assert(readSubTrack_->mode() == dataMode); + assert(readSubTrack_->subChannelMode() == subChanMode); + + reader.init(readSubTrack_); + if (reader.openData() != 0) { + return 0; + } + } + + count -= actLen; + nread += actLen; + } + + if (subChannelDataLen > 0) { + char *subChannelSourceBuf = dataBuf + blen - subChannelDataLen; + + // save sub-channel data for later processing + memcpy(subChanData, subChannelSourceBuf, subChannelDataLen); + memset(subChannelSourceBuf, 0, subChannelDataLen); + } + + unsigned char *encBuf = (unsigned char *)buf; + + if (encodingMode == 0) { + // encode data block according to 'dataMode' + + switch (dataMode) { + case TrackData::AUDIO: + break; + case TrackData::MODE0: + lec_encode_mode0_sector(lba, encBuf); + lec_scramble(encBuf); + break; + case TrackData::MODE1: + lec_encode_mode1_sector(lba, encBuf); + lec_scramble(encBuf); + break; + case TrackData::MODE1_RAW: + { + Msf m(lba); + + if (int2bcd(m.min()) != encBuf[12] || + int2bcd(m.sec()) != encBuf[13] || + int2bcd(m.frac()) != encBuf[14]) { + // sector address mismatch -> rebuild L-EC since it covers the header + lec_encode_mode1_sector(lba, encBuf); + } + + lec_scramble(encBuf); + } + break; + case TrackData::MODE2: + lec_encode_mode2_sector(lba, encBuf); + lec_scramble(encBuf); + break; + case TrackData::MODE2_FORM1: + lec_encode_mode2_form1_sector(lba, encBuf); + lec_scramble(encBuf); + break; + case TrackData::MODE2_FORM2: + lec_encode_mode2_form2_sector(lba, encBuf); + lec_scramble(encBuf); + break; + case TrackData::MODE2_FORM_MIX: + if ((encBuf[16+2] & 0x20) != 0) + lec_encode_mode2_form2_sector(lba, encBuf); + else + lec_encode_mode2_form1_sector(lba, encBuf); + + lec_scramble(encBuf); + break; + case TrackData::MODE2_RAW: + { + Msf m(lba); + + // L-EC does not cover sector header so it is relocatable + // just update the sector address in the header + encBuf[12] = int2bcd(m.min()); + encBuf[13] = int2bcd(m.sec()); + encBuf[14] = int2bcd(m.frac()); + + lec_scramble(encBuf); + } + break; + } + } + else if (encodingMode == 1) { + switch (dataMode) { + case TrackData::MODE2_FORM2: + // add sub header for data form 2 sectors + encBuf[2] = 0x20; + encBuf[6] = 0x20; + break; + case TrackData::MODE1_RAW: + // strip off sync and header + memmove(encBuf, encBuf + 16, MODE1_BLOCK_LEN); + break; + case TrackData::MODE2_RAW: + // strip off sync and header + memmove(encBuf, encBuf + 16, MODE2_BLOCK_LEN); + break; + + default: + break; + } + } + + // encode R-W sub-channel data + switch (subChanMode) { + case TrackData::SUBCHAN_NONE: + break; + case TrackData::SUBCHAN_RW: + if (subChanEncodingMode == 1) { + /*do_encode_sub((unsigned char*)subChanData, 1, 1, + &subChanDelayLineIndex_, subChanDelayLine_); + */ + } + break; + + case TrackData::SUBCHAN_RW_RAW: + if (subChanEncodingMode == 0) { + // to be done + } + break; + } + + if (subChannelDataLen > 0) { + char *subChannelTargetBuf = (char *)buf + offset; + + memcpy(subChannelTargetBuf, subChanData, subChannelDataLen); + } + + return (offset + subChannelDataLen); +} + +long TrackReader::readTrackData(Sample *buf, long len) +{ + long actLen; + long count = len; + long nread = 0; + + while (count > 0) { + actLen = reader.readData(buf + nread, count); + + if (actLen < 0) { + return -1; + } + + if (actLen != count) { + // end of audio data in sub-track reached, skip to next sub-track + readSubTrack_ = readSubTrack_->next_; + + // next sub-track must exists since requested length match available data + assert(readSubTrack_ != NULL); + + reader.init(readSubTrack_); + if (reader.openData() != 0) { + return -1; + } + } + + count -= actLen; + + if (track_->audioCutMode()) + nread += actLen; + else + nread += actLen / SAMPLE_LEN; + } + + return len; +} + +// Seeks to specified sample. +// return: 0: OK +// 10: sample out of range +// return code of 'TrackData::openData()' +int TrackReader::seekSample(unsigned long sample) +{ + int ret; + unsigned long offset; + + assert(open_ != 0); + + if (track_->audioCutMode() == 0) { + // all lengths are in byte units -> convert requested sample to a byte + // offset + + // first determine the block which contains the requested sample + unsigned long block = sample / SAMPLES_PER_BLOCK; + + // byte offset into block + unsigned long boffset = (sample % SAMPLES_PER_BLOCK) * SAMPLE_LEN; + + + unsigned long blen = TrackData::dataBlockSize(track_->type(), + track_->subChannelType()); + + offset = block * blen + boffset; + } + else { + offset = sample; + } + + // find sub track containing 'sample' + SubTrack *st = track_->findSubTrack(offset); + + if (st == NULL) + return 10; + + // open sub track if necessary + if (readSubTrack_ != st) { + readSubTrack_ = st; + reader.init(readSubTrack_); + + if ((ret = reader.openData()) != 0) + return ret; + } + + assert(offset >= readSubTrack_->start()); + + unsigned long stOffset = offset - readSubTrack_->start(); + + // seek in sub track + if ((ret = reader.seekSample(stOffset)) != 0) + return ret; + + readPosSample_ = sample; + + return 0; +} + +long TrackReader::readSamples(Sample *buf, long len) +{ + long ret; + long i; + assert(open_ != 0); + + if (readPosSample_ + (unsigned long)len > track_->length_.samples()) { + if ((len = track_->length_.samples() - readPosSample_) <= 0) { + return 0; + } + } + + if (track_->type() == TrackData::AUDIO) { + if (track_->audioCutMode() == 1) { + if ((ret = readTrackData(buf, len)) > 0) { + readPosSample_ += ret; + } + } + else { + long subChanLen = TrackData::subChannelSize(track_->subChannelType()); + char subChanBuf[MAX_SUBCHANNEL_LEN]; + ret = 0; + + while (len > 0) { + long burst = + SAMPLES_PER_BLOCK - (readPosSample_ % SAMPLES_PER_BLOCK); + int fullBurst = 0; + + if (burst > len) + burst = len; + else + fullBurst = 1; + + if (readTrackData(buf, burst * SAMPLE_LEN) <= 0) + return -1; + + buf += burst; + + len -= burst; + readPosSample_ += burst; + ret += burst; + + if (subChanLen > 0 && fullBurst && + (unsigned long)readPosSample_ < track_->length_.samples()) { + if (readTrackData((Sample*)subChanBuf, subChanLen) < 0) + return -1; + } + } + } + } + else { + for (i = 0; i < len; i++) { + buf[i].left(16000); + buf[i].right(16000); + } + readPosSample_ += len; + ret = len; + } + + return ret; +} + +const char* TrackReader::curFilename() +{ + const TrackData* td = reader.trackData(); + + if (td) + return td->filename(); + else + return NULL; +} + +SubTrackIterator::SubTrackIterator(const Track *t) +{ + track_ = t; + iterator_ = NULL; +} + + +SubTrackIterator::~SubTrackIterator() +{ + track_ = NULL; + iterator_ = NULL; +} + +const SubTrack *SubTrackIterator::first() +{ + iterator_ = track_->subTracks_; + + return next(); +} + +const SubTrack *SubTrackIterator::next() +{ + if (iterator_ != NULL) { + SubTrack *s = iterator_; + + iterator_ = iterator_->next_; + return s; + } + else { + return NULL; + } +} + diff --git a/trackdb/Track.h b/trackdb/Track.h new file mode 100644 index 0000000..936e4fc --- /dev/null +++ b/trackdb/Track.h @@ -0,0 +1,224 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __TRACK_H__ +#define __TRACK_H__ + +#include <iostream> + +#include "SubTrack.h" +#include "Msf.h" +#include "CdTextContainer.h" +#include "CdTextItem.h" + +class TrackDataList; + +class Track { +public: + Track(TrackData::Mode, TrackData::SubChannelMode); + Track(const Track &); + ~Track(); + + TrackData::Mode type() const { return type_; } + TrackData::SubChannelMode subChannelType() const { return subChannelType_; } + + int audioCutMode() const { return audioCutMode_; } + + Msf length() const { return length_; } + + Msf start() const { return start_; } + int start(Msf); + + Msf end() const { return end_; } + int end(Msf); + + int isPadded() const; + + int nofSubTracks() const { return nofSubTracks_; } + + // return first/last sub-track + const SubTrack *firstSubTrack() const; + const SubTrack *lastSubTrack() const; + + int append(const SubTrack &); + + int nofIndices() const { return nofIndices_; } + + int appendIndex(const Msf &); + int addIndex(const Msf &index); + int removeIndex(int); + Msf getIndex(int) const; + + int moveIndex(int index, long lba); + TrackDataList *removeToEnd(unsigned long samplePos); + TrackDataList *removeFromStart(unsigned long sample); + + void prependTrackData(const TrackDataList *); + void appendTrackData(const TrackDataList *); + void appendTrackData(const Track *); + + TrackDataList *removeTrackData(unsigned long start, unsigned long end); + void insertTrackData(unsigned long pos, const TrackDataList *list); + + // fills provided buffer with an audio block that contains zero data + // encoded with given mode + static void encodeZeroData(int encMode, TrackData::Mode, + TrackData::SubChannelMode, long lba, + unsigned char *); + + int check(int trackNr) const; + + int isrcValid() const { return isrcValid_; } + + // set ISRC code from given string + int isrc(const char *); // sets ISRC code + const char *isrc() const; + + char isrcCountry(int i) const { return isrcCountry_[i]; } // ASCII + char isrcOwner(int i) const { return isrcOwner_[i]; } // ASCII + char isrcYear(int i) const { return isrcYear_[i]; } // BCD + char isrcSerial(int i) const { return isrcSerial_[i]; } // BCD + + // return/set COPY flag (1: copy permitted, 0: copy not permitted) + int copyPermitted() const { return flags_.copy; } + void copyPermitted(int c) { flags_.copy = c != 0 ? 1 : 0; } + + // return/set PRE-EMPHASIS flag (1: audio with pre-emphasis, + // 0: audio without pre-emphasis + int preEmphasis() const { return flags_.preEmphasis; } + void preEmphasis(int p) { flags_.preEmphasis = p != 0 ? 1 : 0; } + + // return/set audio type (0: two channel audio, 1: four channel audio) + int audioType() const { return flags_.audioType; } + void audioType(int t) { flags_.audioType = t != 0 ? 1 : 0; } + + void addCdTextItem(CdTextItem *); + void removeCdTextItem(CdTextItem::PackType, int blockNr); + int existCdTextBlock(int n) const { return cdtext_.existBlock(n); } + const CdTextItem *getCdTextItem(int blockNr, CdTextItem::PackType t) const { + return cdtext_.getPack(blockNr, t); + } + + void print(std::ostream &, bool conversions = false) const; + + void collectFiles(std::set<std::string>& set); + void markFileConversion(const char* src, const char* dst); + bool resolveFilename(const char* path); + bool recomputeLength(); + +private: + friend class TocParserGram; + friend class Toc; + friend class TrackReader; + friend class SubTrackIterator; + + TrackData::Mode type_; // track type + TrackData::SubChannelMode subChannelType_; // sub-channel mode + int audioCutMode_; /* -1: undefined + 1: lengths of all sub-tracks are in units of samples + 0: lengths of all sub-tracks are in byte units + */ + + Msf length_; // total length of track + Msf start_; // logical start of track data, end of pre-gap + // (where index switches from 0 to 1) + Msf end_; // end of track data, start of post-gap + + int nofSubTracks_; // number of sub tracks + SubTrack *subTracks_; // list of subtracks + SubTrack *lastSubTrack_; // points to last sub-track in list + + int nofIndices_; // number of index increments + Msf *index_; // index increment times + + + int isrcValid_; + char isrcCountry_[2]; + char isrcOwner_[3]; + char isrcYear_[2]; + char isrcSerial_[5]; + + struct { + unsigned int copy : 1; + unsigned int preEmphasis : 1; + unsigned int audioType : 1; + } flags_; + + CdTextContainer cdtext_; + + void update(); + + void insertSubTrackAfter(SubTrack *, SubTrack *newSubtrack); + SubTrack *removeSubTrack(SubTrack *); + + void countSubTracks(); + void mergeSubTracks(); + + SubTrack *findSubTrack(unsigned long sample) const; + void checkConsistency(); +}; + +class TrackReader { +public: + TrackReader(const Track * = 0); + ~TrackReader(); + + void init(const Track *); + + int openData(); + long readData(int raw, int subChanEncodingMode, long lba, char *buf, + long len); + int seekSample(unsigned long sample); + long readSamples(Sample *buf, long len); + void closeData(); + + const char* curFilename(); + +private: + const Track *track_; + + TrackDataReader reader; + + long readPos_; // current read position (blocks) + long readPosSample_; // current read position (samples) + const SubTrack *readSubTrack_; // actual read sub-track + int open_; // 1 indicates the 'openData()' was called + + unsigned long subChanDelayLineIndex_; + unsigned char subChanDelayLine_[8][24]; + + + long readTrackData(Sample *buf, long len); + int readBlock(int raw, int subChanEncodingMode, long lba, Sample *buf); +}; + +class SubTrackIterator { +public: + SubTrackIterator(const Track *); + ~SubTrackIterator(); + + const SubTrack *first(); + const SubTrack *next(); + +private: + const Track *track_; + SubTrack *iterator_; +}; + +#endif diff --git a/trackdb/TrackData.cc b/trackdb/TrackData.cc new file mode 100644 index 0000000..b3d1acd --- /dev/null +++ b/trackdb/TrackData.cc @@ -0,0 +1,1327 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <stdio.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <unistd.h> +#include <assert.h> +#include <string.h> +#include <errno.h> + +#include "TrackData.h" +#include "Msf.h" +#include "util.h" +#include "log.h" + +#ifdef UNIXWARE +extern "C" { + extern int strcasecmp(const char *, const char *); +} +#endif + +// creates an object representing a portion of an audio data file +TrackData::TrackData(const char *filename, long offset, + unsigned long start, unsigned long length) +{ + init(filename, offset, start, length); +} + +TrackData::TrackData(const char *filename, unsigned long start, + unsigned long length) +{ + init(filename, 0, start, length); +} + +void TrackData::init(const char *filename, long offset, + unsigned long start, unsigned long length) +{ + assert(offset >= 0); + + length_ = length; + + if (strcmp(filename, "-") == 0) { + type_ = STDIN; + fileType_ = RAW; // currently only raw data + filename_ = strdupCC("STDIN"); + } + else { + type_ = DATAFILE; + + filename_ = strdupCC(filename); + fileType_ = audioFileType(filename_); + } + + effFilename_ = NULL; + offset_ = offset; + startPos_ = start; + swapSamples_ = 0; + mode_ = AUDIO; + subChannelMode_ = SUBCHAN_NONE; + audioCutMode_ = 1; +} + +// creates an AUDIO mode object that contains constant zero data +TrackData::TrackData(unsigned long length) +{ + type_ = ZERODATA; + mode_ = AUDIO; + subChannelMode_ = SUBCHAN_NONE; + audioCutMode_ = 1; + + filename_ = NULL; + effFilename_ = NULL; + fileType_ = RAW; + startPos_ = 0; + offset_ = 0; + length_ = length; + swapSamples_ = 0; +} + +// creates an object that contains constant data with specified mode +TrackData::TrackData(Mode m, SubChannelMode sm, unsigned long length) +{ + type_ = ZERODATA; + mode_ = m; + subChannelMode_ = sm; + audioCutMode_ = 0; + + filename_ = NULL; + effFilename_ = NULL; + fileType_ = RAW; + startPos_ = 0; + offset_ = 0; + length_ = length; + swapSamples_ = 0; +} + +// creates a file object with given mode +TrackData::TrackData(Mode m, SubChannelMode sm, const char *filename, + long offset, unsigned long length) +{ + init(m, sm, filename, offset, length); +} + +void TrackData::init(Mode m, SubChannelMode sm, const char *filename, + long offset, unsigned long length) +{ + assert(offset >= 0); + + mode_ = m; + subChannelMode_ = sm; + audioCutMode_ = 0; + + if (strcmp(filename, "-") == 0) { + type_ = STDIN; + fileType_ = RAW; // currently only raw data + filename_ = strdupCC("STDIN"); + } + else { + type_ = DATAFILE; + filename_ = strdupCC(filename); + + if (mode_ == AUDIO) + fileType_ = audioFileType(filename_); + else + fileType_ = RAW; // data files are always raw + } + + offset_ = offset; + length_ = length; + effFilename_ = NULL; + startPos_ = 0; + swapSamples_ = 0; +} + +TrackData::TrackData(Mode m, SubChannelMode sm, const char *filename, + unsigned long length) +{ + assert(filename != NULL && *filename != 0); + + mode_ = m; + subChannelMode_ = sm; + audioCutMode_ = 0; + + type_ = FIFO; + fileType_ = RAW; + filename_ = strdupCC(filename); + effFilename_ = NULL; + offset_ = 0; + length_ = length; + + startPos_ = 0; + swapSamples_ = 0; +} + +// copy constructor +TrackData::TrackData(const TrackData &obj) +{ + type_ = obj.type_; + mode_ = obj.mode_; + subChannelMode_ = obj.subChannelMode_; + audioCutMode_ = obj.audioCutMode_; + + offset_ = obj.offset_; + + switch (type_) { + case DATAFILE: + case STDIN: + case FIFO: + filename_ = strdupCC(obj.filename_); + effFilename_ = (obj.effFilename_ ? strdupCC(obj.effFilename_) : NULL); + startPos_ = obj.startPos_; + fileType_ = obj.fileType_; + break; + + case ZERODATA: + filename_ = NULL; + effFilename_ = NULL; + startPos_ = 0; + fileType_ = RAW; + break; + } + + length_ = obj.length_; + + swapSamples_ = obj.swapSamples_; +} + +TrackData::~TrackData() +{ + if (filename_) { + delete[] filename_; + } + if (effFilename_) + delete[] effFilename_; +} + +unsigned long TrackData::length() const +{ + return length_; +} + +// Determines length of data by inspecting the data file. The available data +// from the specified start point up to the end of file is stored in 'length_'. +// Return: 0: OK +// 1: cannot open or access the file (see 'errno') +// 2: start pos or offset exceeds length of file +// 3: track needs conversion to WAV +// 4: format is not supported + +int TrackData::determineLength() +{ + unsigned long len; + + if (type_ == DATAFILE) { + if (mode_ == AUDIO) { + switch (audioDataLength(filename_, offset_, &len)) { + case 1: + log_message(-2, "Cannot open audio file \"%s\": %s", filename_, + strerror(errno)); + return 1; + break; + + case 2: + log_message(-2, "Cannot determine length of audio file \"%s\": %s", + filename_, strerror(errno)); + return 1; + break; + + case 3: + log_message(-2, "Header of audio file \"%s\" is corrupted.", + filename_); + return 1; + break; + + case 4: + log_message(-2, "Invalid offset %ld for audio file \"%s\".", offset_, + filename_); + return 2; + break; + case 5: +#ifndef HAVE_MP3_SUPPORT + if (audioFileType(filename_) == MP3) { + log_message (-2, "Can't read file \"%s\": cdrdao was compiled " + "without MP3 support.", filename_); + return 4; + } +#endif +#ifndef HAVE_OGG_SUPPORT + if (audioFileType(filename_) == OGG) { + log_message (-2, "Can't read file \"%s\": cdrdao was compiled " + "without Ogg/Vorbis support.", filename_); + return 4; + } +#endif + return 3; + } + + if (audioCutMode()) { + if (startPos_ < len) { + length_ = len - startPos_; + } + else { + log_message(-2, + "Start position %lu exceeds available data of file \"%s\".", + startPos_, filename_); + return 2; + } + } + else { + length_ = len * sizeof(Sample); + } + } + else { + switch (dataFileLength(filename_, offset_, &len)) { + case 1: + log_message(-2, "Cannot open data file \"%s\": %s", filename_, + strerror(errno)); + return 1; + break; + case 2: + log_message(-2, "Invalid offset %ld for audio file \"%s\".", offset_, + filename_); + return 2; + break; + } + + length_ = len; + } + } + + return 0; +} + + + +// checks the consistency of object +// return: 0: OK +// 1: warning occured +// 2: error occured +int TrackData::check(int trackNr) const +{ + switch (type_) { + case ZERODATA: + // always OK + break; + case STDIN: + // cannot do much here... + break; + case FIFO: + if (access(filename_, R_OK) != 0) { + log_message(-2, "Track %d: Cannot access FIFO \"%s\": %s", trackNr, + filename_, strerror(errno)); + return 2; + } + break; + case DATAFILE: + if (mode_ == AUDIO) { + unsigned long len = 0; + + if (fileType_ == WAVE && subChannelMode_ != SUBCHAN_NONE) { + log_message(-2, "Track %d: WAVE audio files cannot contain sub-channel " + "data.", trackNr); + return 2; + } + + switch (audioDataLength(filename_, offset_, &len)) { + case 1: + log_message(-2, "Track %d: Cannot open audio file \"%s\": %s", trackNr, + filename_, strerror(errno)); + return 2; + break; + case 2: + log_message(-2, "Track %d: Cannot access audio file \"%s\": %s", trackNr, + filename_, strerror(errno)); + return 2; + break; + case 3: + log_message(-2, "Track %d: %s: Unacceptable WAVE file.", trackNr, + filename_); + return 2; + break; + case 4: + log_message(-2, "Track %d: Invalid offset %ld for audio file \"%s\".", + trackNr, offset_, filename_); + return 2; + break; + } + + if (length() == 0) { + log_message(-2, "Track %d: Requested length for audio file \"%s\" is 0.", + trackNr, filename_); + return 2; + } + + if (audioCutMode()) { + if (startPos_ + length() > len) { + // requested part exceeds file size + log_message(-2, "Track %d: Requested length (%lu + %lu samples) exceeds " + "length of audio file \"%s\" (%lu samples at offset %ld).", + trackNr, startPos_, length(), filename_, len, offset_); + return 2; + } + } + else { + if (length() > len * sizeof(Sample)) { + log_message(-2, "Track %d: Requested length (%lu bytes) exceeds length of file \"%s\" (%lu bytes at offset %ld).", + trackNr, length(), filename_, len, offset_); + return 2; + } + } + } + else { + // data mode + unsigned long len; + + switch (dataFileLength(filename_, offset_, &len)) { + case 1: + log_message(-2, "Track %d: Cannot open data file \"%s\": %s", trackNr, + filename_, strerror(errno)); + return 2; + break; + case 2: + log_message(-2, "Track %d: Invalid offset %ld for data file \"%s\".", + trackNr, offset_, filename_); + return 2; + break; + } + + if (length() == 0) { + log_message(-2, "Track %d: Requested length for data file \"%s\" is 0.", + trackNr, filename_); + return 2; + } + + if (length() > len) { + log_message(-2, "Track %d: Requested length (%lu bytes) exceeds length of file \"%s\" (%lu bytes at offset %ld).", + trackNr, length(), filename_, len, offset_); + return 2; + } + } + break; + } + + return 0; +} + +void TrackData::effectiveFilename(const char* name) +{ + if (effFilename_) + delete effFilename_; + + effFilename_ = filename_; + filename_ = strdupCC(name); + fileType_ = audioFileType(filename_); +} + +// writes out contents of object in TOC file syntax +void TrackData::print(std::ostream &out, bool conversions) const +{ + unsigned long blen; + const char *s; + + if (audioCutMode()) { + // we're calculating in samples and not in bytes for audio data + blen = SAMPLES_PER_BLOCK; + } + else { + blen = dataBlockSize(mode(), subChannelMode()); + } + + switch (type()) { + case STDIN: + case DATAFILE: + if (audioCutMode()) { + if (type() == STDIN) + out << "FILE \"-\" "; + else if (effFilename_ && !conversions) + out << "FILE \"" << effFilename_ << "\" "; + else + out << "FILE \"" << filename_ << "\" "; + + if (swapSamples_) + out << "SWAP "; + + if (offset_ > 0) + out << "#" << offset_ << " "; + + if (startPos() != 0 && (startPos() % blen) == 0) + out << Msf(startPos() / blen).str(); + else + out << startPos(); + + out << " "; + } + else { + // data mode + if (type() == STDIN) + out << "DATAFILE \"-\" "; + else if (effFilename_ && !conversions) + out << "DATAFILE \"" << effFilename_ << "\" "; + else + out << "DATAFILE \"" << filename_ << "\" "; + + //out << mode2String(mode()) << " "; + + if (offset_ > 0) + out << "#" << offset_ << " "; + } + + + if ((length() % blen) == 0) + out << Msf(length() / blen).str(); + else + out << length(); + + if (!audioCutMode()) + out << " // length in bytes: " << length(); + + out << std::endl; + break; + + case FIFO: + out << "FIFO \"" << filename_ << "\" "; + + if ((length() % blen) == 0) { + out << Msf(length() / blen).str(); + out << " // length in bytes: " << length(); + } + else { + out << length(); + } + + out << std::endl; + break; + + case ZERODATA: + if (audioCutMode()) { + out << "SILENCE "; + } + else { + out << "ZERO " << mode2String(mode()) << " "; + } + + s = subChannelMode2String(subChannelMode()); + + if (*s != 0) + out << s << " "; + + if ((length() % blen) == 0) + out << Msf(length() / blen).str(); + else + out << length(); + + out << std::endl; + break; + } +} + +void TrackData::split(unsigned long pos, TrackData **part1, TrackData **part2) +{ + assert(mode_ == AUDIO); + assert(pos > 0 && pos < length_); + + *part1 = new TrackData(*this); + *part2 = new TrackData(*this); + + (*part1)->length_ = pos; + + (*part2)->length_ = length_ - pos; + + if (type_ == DATAFILE) + (*part2)->startPos_ = startPos_ + pos; +} + +TrackData *TrackData::merge(const TrackData *obj) const +{ + + if (mode_ != AUDIO || type_ != obj->type_ || mode_ != obj->mode_ || + subChannelMode_ != obj->subChannelMode_ || offset_ != obj->offset_ || + audioCutMode_ != obj->audioCutMode_) + return NULL; + + TrackData *data = NULL; + + switch (type_) { + case ZERODATA: + data = new TrackData(*this); + data->length_ += obj->length_; + break; + + case DATAFILE: + if (strcmp(filename_, obj->filename_) == 0 && + startPos_ + length_ == obj->startPos_) { + data = new TrackData(*this); + data->length_ += obj->length_; + } + break; + + case STDIN: + case FIFO: + // can't merge this type at all + break; + } + + return data; +} + +// Checks if given audio file is suitable for cdrdao. 'length' is filled +// with number of samples in audio file on success. +// return: 0: file is suitable +// 1: cannot open or access file +// 2: file has wrong format + +int TrackData::checkAudioFile(const char *fn, unsigned long *length) +{ + int fd; + int ret; + struct stat buf; + long headerLength = 0; + + enum FileType ft = audioFileType(fn); + if (ft != WAVE && ft != RAW) { + log_message(-2, "Checking audio file \"%s\": format not supported", fn); + return 1; + } + + if ((fd = open(fn, O_RDONLY)) < 0) + return 1; + + ret = fstat(fd, &buf); + + close(fd); + + if (ret != 0) + return 1; + + if (ft == WAVE) { + if (waveLength(fn, 0, &headerLength, length) != 0) + return 2; + } else { + if (buf.st_size % sizeof(Sample) != 0) { + log_message(-1, "%s: Length is not a multiple of sample size (4).", fn); + } + + *length = buf.st_size / sizeof(Sample); + } + + return 0; +} + + +// Determines length of header and audio data for WAVE files. 'hdrlen' is +// filled with length of WAVE header in bytes. 'datalen' is filled with +// length of audio data in samples (if != NULL). +// return: 0: OK +// 1: error occured +// 2: illegal WAVE file +int TrackData::waveLength(const char *filename, long offset, + long *hdrlen, unsigned long *datalen) +{ + FILE *fp; + char magic[4]; + long headerLen = 0; + long len; + short waveFormat; + short waveChannels; + long waveRate; + short waveBits; + struct stat sbuf; + +#ifdef __CYGWIN__ + if ((fp = fopen(filename, "rb")) == NULL) +#else + if ((fp = fopen(filename, "r")) == NULL) +#endif + { + log_message(-2, "Cannot open audio file \"%s\" for reading: %s", + filename, strerror(errno)); + return 1; + } + + if (offset != 0) { + if (fseek(fp, offset, SEEK_SET) != 0) { + log_message(-2, "Cannot seek to offset %ld in file \"%s\": %s", + offset, filename, strerror(errno)); + return 1; + } + } + + if (fread(magic, sizeof(char), 4, fp) != 4 || + strncmp("RIFF", magic, 4) != 0) { + log_message(-2, "%s: not a WAVE file.", filename); + fclose(fp); + return 2; + } + + readLong(fp); + + if (fread(magic, sizeof(char), 4, fp) != 4 || + strncmp("WAVE", magic, 4) != 0) { + log_message(-2, "%s: not a WAVE file.", filename); + fclose(fp); + return 2; + } + + // search for format chunk + for (;;) { + if (fread(magic, sizeof(char), 4, fp) != 4) { + log_message(-2, "%s: corrupted WAVE file.", filename); + fclose(fp); + return 1; + } + + len = readLong(fp); + len += len & 1; // round to multiple of 2 + + if (strncmp("fmt ", magic, 4) == 0) { + // format chunk found + break; + } + + // skip chunk data + if (fseek(fp, len, SEEK_CUR) != 0) { + log_message(-2, "%s: corrupted WAVE file.", filename); + fclose(fp); + return 1; + } + } + + if (len < 16) { + log_message(-2, "%s: corrupted WAVE file.", filename); + fclose(fp); + return 1; + } + + waveFormat = readShort(fp); + + if (waveFormat != 1) { + // not PCM format + log_message(-2, "%s: not in PCM format.", filename); + fclose(fp); + return 2; + } + + waveChannels = readShort(fp); + if (waveChannels != 2) { + log_message(-2, "%s: found %d channel(s), require 2 channels.", + filename, waveChannels); + fclose(fp); + return 2; + } + + waveRate = readLong(fp); + if (waveRate != 44100) { + log_message(-2, "%s: found sampling rate %ld, require 44100.", + filename, waveRate); + fclose(fp); + return 2; + } + + readLong(fp); // average bytes/second + readShort(fp); // block align + + waveBits = readShort(fp); + if (waveBits != 16) { + log_message(-2, "%s: found %d bits per sample, require 16.", + filename, waveBits); + fclose(fp); + return 2; + } + + len -= 16; + + // skip chunk data + if (fseek(fp, len, SEEK_CUR) != 0) { + log_message(-2, "%s: corrupted WAVE file.", filename); + fclose(fp); + return 1; + } + + // search wave data chunk + for (;;) { + if (fread(magic, sizeof(char), 4, fp) != 4) { + log_message(-2, "%s: corrupted WAVE file.", filename); + fclose(fp); + return 1; + } + + len = readLong(fp); + + if (strncmp("data", magic, 4) == 0) { + // found data chunk + break; + } + + len += len & 1; // round to multiple of 2 + + // skip chunk data + if (fseek(fp, len, SEEK_CUR) != 0) { + log_message(-2, "%s: corrupted WAVE file.", filename); + fclose(fp); + return 1; + } + } + + if ((headerLen = ftell(fp)) < 0) { + log_message(-2, "%s: cannot determine file position: %s", + filename, strerror(errno)); + fclose(fp); + return 1; + } + + headerLen -= offset; + + if (fstat(fileno(fp), &sbuf) != 0) { + log_message(-2, "Cannot fstat audio file \"%s\": %s", filename, + strerror(errno)); + fclose(fp); + return 1; + } + + fclose(fp); + + if (len + headerLen + offset > sbuf.st_size) { + log_message(-1, "%s: file length does not match length from WAVE header - using actual length.", filename); + len = sbuf.st_size - offset - headerLen; + } + + if (len % sizeof(Sample) != 0) { + log_message(-1, + "%s: length of data chunk is not a multiple of sample size (4).", + filename); + } + + *hdrlen = headerLen; + + if (datalen != NULL) { + *datalen = len / sizeof(Sample); + } + + return 0; +} + +// Returns length in samples for given audio file. +// return: 1: file cannot be opened +// 2: 'fstat' failed +// 3: file header corruption +// 4: invalid offset +// 5: file need conversion +// 0: OK +int TrackData::audioDataLength(const char *fname, long offset, + unsigned long *length) +{ + int fd; + struct stat buf; + long headerLength = 0; + int ret; + + *length = 0; + + if ((fd = open(fname, O_RDONLY)) < 0) + return 1; + + ret = fstat(fd, &buf); + close(fd); + + if (ret != 0) + return 2; + + if (offset > buf.st_size) + return 4; + + FileType ftype = audioFileType(fname); + if (ftype == WAVE) { + if (waveLength(fname, offset, &headerLength, length) != 0) + return 3; + } else if (ftype == MP3 || ftype == OGG) { + return 5; + } else { + if (((buf.st_size - offset) % sizeof(Sample)) != 0) { + log_message(-1, + "Length of file \"%s\" is not a multiple of sample size (4).", + fname); + } + + *length = (buf.st_size - offset) / sizeof(Sample); + } + + return 0; +} + + +// Sets 'length' to length of given data file. +// return: 0: OK +// 1: file cannot be opened or accessed +// 2: invalid offset +int TrackData::dataFileLength(const char *fname, long offset, + unsigned long *length) +{ + int fd; + struct stat buf; + int ret; + *length = 0; + + if ((fd = open(fname, O_RDONLY)) < 0) + return 1; + + ret = fstat(fd, &buf); + close(fd); + + if (ret != 0) + return 1; + + if (offset > buf.st_size) + return 2; + + *length = buf.st_size - offset; + + return 0; +} + +// determines type of audio file +// return: RAW: raw samples +// WAVE: wave file +TrackData::FileType TrackData::audioFileType(const char *filename) +{ + FileExtension p = fileExtension(filename); + + if (p == FE_WAV) + return WAVE; + if (p == FE_MP3) + return MP3; + if (p == FE_OGG) + return OGG; + + return RAW; +} + +unsigned long TrackData::subChannelSize(SubChannelMode sm) +{ + unsigned long b = 0; + + switch (sm) { + case SUBCHAN_NONE: + b = 0; + break; + + case SUBCHAN_RW: + case SUBCHAN_RW_RAW: + b = PW_SUBCHANNEL_LEN; + break; + } + + return b; +} + +unsigned long TrackData::dataBlockSize(Mode m, SubChannelMode sm) +{ + unsigned long b = 0; + + switch (m) { + case AUDIO: + case MODE1_RAW: + case MODE2_RAW: + b = AUDIO_BLOCK_LEN; + break; + + case MODE0: + b = MODE0_BLOCK_LEN; + break; + + case MODE1: + b = MODE1_BLOCK_LEN; + break; + + case MODE2: + case MODE2_FORM_MIX: + b = MODE2_BLOCK_LEN; + break; + + case MODE2_FORM1: + b = MODE2_FORM1_DATA_LEN; + break; + + case MODE2_FORM2: + b = MODE2_FORM2_DATA_LEN; + break; + } + + b += subChannelSize(sm); + + return b; +} + +const char *TrackData::mode2String(Mode m) +{ + const char *ret = NULL; + + switch (m) { + case AUDIO: + ret = "AUDIO"; + break; + + case MODE0: + ret = "MODE0"; + break; + + case MODE1: + ret = "MODE1"; + break; + + case MODE1_RAW: + ret = "MODE1_RAW"; + break; + + case MODE2: + ret = "MODE2"; + break; + + case MODE2_RAW: + ret = "MODE2_RAW"; + break; + + case MODE2_FORM1: + ret = "MODE2_FORM1"; + break; + + case MODE2_FORM2: + ret = "MODE2_FORM2"; + break; + + case MODE2_FORM_MIX: + ret = "MODE2_FORM_MIX"; + break; + } + + return ret; +} + +const char *TrackData::subChannelMode2String(SubChannelMode m) +{ + const char *ret = NULL; + + switch (m) { + case SUBCHAN_NONE: + ret = ""; + break; + + case SUBCHAN_RW: + ret = "RW"; + break; + + case SUBCHAN_RW_RAW: + ret = "RW_RAW"; + break; + } + + return ret; +} + +TrackDataReader::TrackDataReader(const TrackData *d) +{ + trackData_ = d; + + open_ = 0; + fd_ = -1; + readPos_ = 0; + headerLength_ = 0; + readUnderRunMsgGiven_ = 0; +} + +TrackDataReader::~TrackDataReader() +{ + if (open_) { + closeData(); + } + + trackData_ = NULL; +} + +void TrackDataReader::init(const TrackData *d) +{ + if (open_) { + closeData(); + } + + trackData_ = d; +} + +// initiates reading audio data, an audio data file is opened +// return: 0: OK +// 1: file could not be opened +// 2: could not seek to start position +int TrackDataReader::openData() +{ + assert(open_ == 0); + assert(trackData_ != NULL); + + if (trackData_->type_ == TrackData::DATAFILE) { + if (trackData_->mode_ == TrackData::AUDIO) { + long headerLength = 0; + + if (trackData_->fileType_ != TrackData::WAVE && + trackData_->fileType_ != TrackData::RAW) { + log_message(-2, "Cannot open audio file \"%s\": unsupported format", + trackData_->filename_); + return 1; + } + +#ifdef __CYGWIN__ + if ((fd_ = open(trackData_->filename_, O_RDONLY | O_BINARY)) < 0) +#else + if ((fd_ = open(trackData_->filename_, O_RDONLY)) < 0) +#endif + { + log_message(-2, "Cannot open audio file \"%s\": %s", trackData_->filename_, + strerror(errno)); + return 1; + } + + if (trackData_->fileType_ == TrackData::WAVE) { + if (TrackData::waveLength(trackData_->filename_, trackData_->offset_, + &headerLength) != 0) { + log_message(-2, "%s: Unacceptable WAVE file.", trackData_->filename_); + return 1; + } + } + + if (lseek(fd_, trackData_->offset_ + headerLength + (trackData_->startPos_ * sizeof(Sample)), SEEK_SET) < 0) { + log_message(-2, "Cannot seek in audio file \"%s\": %s", + trackData_->filename_, strerror(errno)); + return 2; + } + + headerLength_ = headerLength; + } + else { + // data mode + headerLength_ = 0; + +#ifdef __CYGWIN__ + if ((fd_ = open(trackData_->filename_, O_RDONLY | O_BINARY)) < 0) +#else + if ((fd_ = open(trackData_->filename_, O_RDONLY)) < 0) +#endif + { + log_message(-2, "Cannot open data file \"%s\": %s", trackData_->filename_, + strerror(errno)); + return 1; + } + + if (trackData_->offset_ > 0) { + if (lseek(fd_, trackData_->offset_ , SEEK_SET) < 0) { + log_message(-2, "Cannot seek to offset %ld in file \"%s\": %s", + trackData_->offset_, trackData_->filename_, strerror(errno)); + return 2; + } + } + } + } + else if (trackData_->type_ == TrackData::FIFO) { +#ifdef __CYGWIN__ + if ((fd_ = open(trackData_->filename_, O_RDONLY | O_BINARY)) < 0) +#else + if ((fd_ = open(trackData_->filename_, O_RDONLY)) < 0) +#endif + { + log_message(-2, "Cannot open FIFO \"%s\": %s", trackData_->filename_, + strerror(errno)); + return 1; + } + headerLength_ = 0; + } + else if (trackData_->type_ == TrackData::STDIN) { + headerLength_ = 0; + fd_ = fileno(stdin); + } + + readPos_ = 0; + open_ = 1; + readUnderRunMsgGiven_ = 0; + + return 0; +} + +// ends reading audio data, an audio data file is closed +void TrackDataReader::closeData() +{ + if (open_ != 0) { + if (trackData_->type_ == TrackData::DATAFILE || + trackData_->type_ == TrackData::FIFO) { + close(fd_); + } + + fd_ = -1; + open_ = 0; + readPos_ = 0; + } +} + +// fills 'buffer' with 'len' samples (in case of audio mode) or with 'len' +// bytes of data (for all other modes) +// return: number of samples written to buffer +long TrackDataReader::readData(Sample *buffer, long len) +{ + long readLen = 0; + + assert(open_ != 0); + + if (len == 0) { + return 0; + } + + if (readPos_ + len > trackData_->length()) { + if ((len = trackData_->length() - readPos_) <= 0) { + return 0; + } + } + + switch (trackData_->type_) { + case TrackData::ZERODATA: + if (trackData_->audioCutMode()) + memset(buffer, 0, len * sizeof(Sample)); + else + memset(buffer, 0, len); + + readLen = len; + break; + + case TrackData::STDIN: + case TrackData::DATAFILE: + case TrackData::FIFO: + if (trackData_->audioCutMode()) { + readLen = fullRead(fd_, buffer, len * sizeof(Sample)); + + if (readLen < 0) { + log_message(-2, "Read error while reading audio data from file \"%s\": %s", + trackData_->filename_, strerror(errno)); + } + else if (readLen != (long)(len * sizeof(Sample))) { + long pad = len * sizeof(Sample) - readLen; + + if (readUnderRunMsgGiven_ == 0) { + log_message(-1, "Could not read expected amount of audio data from file \"%s\".", trackData_->filename_); + log_message(-1, "Padding with zeros."); + + readUnderRunMsgGiven_ = 1; + } + + // Adding zeros to the 'buffer' + memset(buffer + readLen, 0, pad); + readLen = len; + } + else { + readLen = len; + } + } + else { + readLen = fullRead(fd_, buffer, len); + if (readLen < 0) { + log_message(-2, "Read error while reading data from file \"%s\": %s", + trackData_->filename_, strerror(errno)); + } + else if (readLen != len) { + log_message(-2, "Could not read expected amount of data from file \"%s\".", + trackData_->filename_); + readLen = -1; + } + } + break; + } + + if (readLen > 0) { + if (trackData_->mode_ == TrackData::AUDIO && + trackData_->subChannelMode_ == TrackData::SUBCHAN_NONE) { + int swap = 0; + + if (trackData_->fileType_ == TrackData::WAVE) { + // WAVE files contain little endian samples + swap = 1; + } + + if (trackData_->swapSamples_) + swap = !swap; + + if (swap) { + // swap samples + if (trackData_->audioCutMode()) + swapSamples(buffer, readLen); + else + swapSamples(buffer, readLen / sizeof(Sample)); + } + } + + readPos_ += readLen; + } + + return readLen; +} + +// Seeks to specified sample. +// return: 0: OK +// 10: sample out of range +int TrackDataReader::seekSample(unsigned long sample) +{ + assert(open_ != 0); + + if (sample >= trackData_->length()) + return 10; + + if (trackData_->type_ == TrackData::DATAFILE) { + if (trackData_->audioCutMode()) { + // 'sample' has samples as unit + if (lseek(fd_, + trackData_->offset_ + headerLength_ + + (sample * sizeof(Sample)) + + (trackData_->startPos_ * sizeof(Sample)), + SEEK_SET) < 0) { + log_message(-2, "Cannot seek in audio file \"%s\": %s", + trackData_->filename_, strerror(errno)); + return 10; + } + } + else { + // 'sample' has byte as unit + if (lseek(fd_, trackData_->offset_ + headerLength_ + sample, + SEEK_SET) < 0) { + log_message(-2, "Cannot seek in audio file \"%s\": %s", + trackData_->filename_, strerror(errno)); + return 10; + } + } + } + + readPos_ = sample; + + return 0; +} + +// Returns number of bytes that are still available for reading. +unsigned long TrackDataReader::readLeft() const +{ + assert(open_ != 0); + assert(trackData_ != NULL); + + return trackData_->length() - readPos_; +} diff --git a/trackdb/TrackData.h b/trackdb/TrackData.h new file mode 100644 index 0000000..9e0b7ed --- /dev/null +++ b/trackdb/TrackData.h @@ -0,0 +1,182 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef __TRACKDATA_H__ +#define __TRACKDATA_H__ + +#include <iostream> +#include <string> +#include <set> + +#include "Sample.h" + +#define AUDIO_BLOCK_LEN 2352 +#define MODE0_BLOCK_LEN 2336 +#define MODE1_BLOCK_LEN 2048 +#define MODE2_BLOCK_LEN 2336 + +#define MODE2_FORM1_DATA_LEN 2048 +#define MODE2_FORM2_DATA_LEN 2324 + +#define PQ_SUBCHANNEL_LEN 16 +#define PW_SUBCHANNEL_LEN 96 +#define MAX_SUBCHANNEL_LEN 96 + +#define SAMPLE_LEN 4 + +class TrackData { +public: + enum Mode { AUDIO, MODE0, MODE1, MODE2, MODE2_FORM1, MODE2_FORM2, + MODE2_FORM_MIX, MODE1_RAW, MODE2_RAW }; + + enum SubChannelMode { SUBCHAN_NONE, SUBCHAN_RW, SUBCHAN_RW_RAW }; + + enum Type { DATAFILE, ZERODATA, STDIN, FIFO }; + + enum FileType { RAW, WAVE, MP3, OGG }; + + // creates an audio mode file entry + TrackData(const char *filename, long offset, unsigned long start, + unsigned long length); + TrackData(const char *filename, unsigned long start, unsigned long length); + + // creates a zero audio entry + TrackData(unsigned long length); + + // creates a zero data entry with given mode + TrackData(Mode, SubChannelMode, unsigned long length); + + // creates a file entry with given mode + TrackData(Mode, SubChannelMode, const char *filename, long offset, + unsigned long length); + + // create a fifo entry with given mode + TrackData(Mode, SubChannelMode, const char *filename, unsigned long length); + + // copy constructor + TrackData(const TrackData &); + + ~TrackData(); + + Type type() const { return type_; } + Mode mode() const { return mode_; } + SubChannelMode subChannelMode() const { return subChannelMode_; } + int audioCutMode() const { return audioCutMode_; } + + const char *filename() const { return filename_; } + unsigned long startPos() const { return startPos_; } + unsigned long length() const; + + // sets/returns flag for swapping expected byte order of audio samples + void swapSamples(int f) { swapSamples_ = f != 0 ? 1 : 0; } + int swapSamples() const { return swapSamples_; } + + int determineLength(); + int check(int trackNr) const; + + void effectiveFilename(const char*); + + void split(unsigned long, TrackData **part1, TrackData **part2); + TrackData *merge(const TrackData *) const; + + void print(std::ostream &, bool conversions = false) const; + + static int checkAudioFile(const char *fn, unsigned long *length); + static int waveLength(const char *filename, long offset, long *hdrlen, + unsigned long *datalen = 0); + static int audioDataLength(const char *fname, long offset, + unsigned long *length); + static FileType audioFileType(const char *filename); + static int dataFileLength(const char *fname, long offset, + unsigned long *length); + + static unsigned long dataBlockSize(Mode, SubChannelMode); + static unsigned long subChannelSize(SubChannelMode); + + static const char *mode2String(Mode); + static const char *subChannelMode2String(SubChannelMode); + +private: + int audioCutMode_; /* defines if audio cut mode is requested, if yes + all lengths are in sample units and sub-channel + data is not allowed + */ + Type type_; // type of data (file, stdin, zero) + Mode mode_; // data mode for recording (audio, mode0, mode1, ...) + SubChannelMode subChannelMode_; // sub-channel mode + + FileType fileType_; // only for audio mode data, type of file (raw, wave) + + char *filename_; // used for object type 'FILE' + char *effFilename_; // effective filename (absolute path or converted file) + + long offset_; // byte offset into file + + unsigned long length_; // length of data in samples (for audio data) or bytes + + // only used for audio files: + unsigned long startPos_; // starting sample within file, + // used for object type 'FILE', mode 'AUDIO' + int swapSamples_; // 1 if expected byte order of audio samples should + // be swapped + + friend class TrackDataReader; + + void init(const char *filename, long offset, unsigned long start, + unsigned long length); + void init(Mode, SubChannelMode, const char *filename, long offset, + unsigned long length); + + +}; + +class TrackDataReader { +public: + TrackDataReader(const TrackData * = 0); + ~TrackDataReader(); + + void init(const TrackData *); + + int openData(); + void closeData(); + long readData(Sample *buffer, long len); + int seekSample(unsigned long sample); + + const TrackData* trackData() const { return trackData_; } + + // returns number of bytes/samples that are left for reading + unsigned long readLeft() const; + +private: + const TrackData *trackData_; + + int open_; // 1: data can be retrieved with 'readData()', 'fd_' is valid if + // object type is 'FILE' + + int fd_; // used for object type 'FILE' + unsigned long readPos_; // actual read position (samples or bytes) + // (0 .. length_-1) + + long headerLength_; // length of audio file header + + int readUnderRunMsgGiven_; +}; + +#endif diff --git a/trackdb/TrackDataList.cc b/trackdb/TrackDataList.cc new file mode 100644 index 0000000..a5c7fd2 --- /dev/null +++ b/trackdb/TrackDataList.cc @@ -0,0 +1,96 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include <config.h> + + +#include "TrackDataList.h" +#include "TrackData.h" + +TrackDataList::TrackDataList() +{ + list_ = last_ = NULL; + iterator_ = NULL; + count_ = 0; +} + + +void TrackDataList::append(TrackData *a) +{ + Entry *ent = new Entry; + + ent->data = a; + ent->next = NULL; + + if (list_ == NULL) + list_ = ent; + else + last_->next = ent; + + last_ = ent; + + count_++; +} + +unsigned long TrackDataList::length() const +{ + unsigned long len = 0; + Entry *run; + + for (run = list_; run != NULL; run = run->next) + len += run->data->length(); + + return len; +} + +void TrackDataList::clear() +{ + Entry *next; + + while (list_ != NULL) { + next = list_->next; + + delete list_->data; + delete list_; + + list_ = next; + } + + last_ = NULL; + iterator_ = NULL; + count_ = 0; +} + +const TrackData *TrackDataList::first() const +{ + if ((((TrackDataList *)this)->iterator_ = list_) != NULL) + return iterator_->data; + else + return NULL; +} + +const TrackData *TrackDataList::next() const +{ + if (iterator_ == NULL || + (((TrackDataList *)this)->iterator_ = iterator_->next) == NULL) + return NULL; + else + return iterator_->data; +} diff --git a/trackdb/TrackDataList.h b/trackdb/TrackDataList.h new file mode 100644 index 0000000..000e91c --- /dev/null +++ b/trackdb/TrackDataList.h @@ -0,0 +1,55 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef __TRACKDATALIST_H__ +#define __TRACKDATALIST_H__ + +class TrackData; + +class TrackDataList { +public: + TrackDataList(); + ~TrackDataList() { clear(); } + + void append(TrackData *); + void clear(); + + long count() const { return count_; } + + unsigned long length() const; + + const TrackData *first() const; + const TrackData *next() const; + +private: + struct Entry { + TrackData *data; + Entry *next; + }; + + Entry *list_; + Entry *last_; + Entry *iterator_; + + long count_; +}; + + +#endif diff --git a/trackdb/lec.cc b/trackdb/lec.cc new file mode 100644 index 0000000..118925d --- /dev/null +++ b/trackdb/lec.cc @@ -0,0 +1,689 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <assert.h> +#include <sys/types.h> + +#include "lec.h" + +#define GF8_PRIM_POLY 0x11d /* x^8 + x^4 + x^3 + x^2 + 1 */ + +#define EDC_POLY 0x8001801b /* (x^16 + x^15 + x^2 + 1) (x^16 + x^2 + x + 1) */ + +#define LEC_HEADER_OFFSET 12 +#define LEC_DATA_OFFSET 16 +#define LEC_MODE1_DATA_LEN 2048 +#define LEC_MODE1_EDC_OFFSET 2064 +#define LEC_MODE1_INTERMEDIATE_OFFSET 2068 +#define LEC_MODE1_P_PARITY_OFFSET 2076 +#define LEC_MODE1_Q_PARITY_OFFSET 2248 +#define LEC_MODE2_FORM1_DATA_LEN (2048+8) +#define LEC_MODE2_FORM1_EDC_OFFSET 2072 +#define LEC_MODE2_FORM2_DATA_LEN (2324+8) +#define LEC_MODE2_FORM2_EDC_OFFSET 2348 + + +typedef u_int8_t gf8_t; + +static u_int8_t GF8_LOG[256]; +static gf8_t GF8_ILOG[256]; + +static const class Gf8_Q_Coeffs_Results_01 { +private: + u_int16_t table[43][256]; +public: + Gf8_Q_Coeffs_Results_01(); + ~Gf8_Q_Coeffs_Results_01() {} + const u_int16_t *operator[] (int i) const { return &table[i][0]; } + operator const u_int16_t *() const { return &table[0][0]; } +} CF8_Q_COEFFS_RESULTS_01; + +static const class CrcTable { +private: + u_int32_t table[256]; +public: + CrcTable(); + ~CrcTable() {} + u_int32_t operator[](int i) const { return table[i]; } + operator const u_int32_t *() const { return table; } +} CRCTABLE; + +static const class ScrambleTable { +private: + u_int8_t table[2340]; +public: + ScrambleTable(); + ~ScrambleTable() {} + u_int8_t operator[](int i) const { return table[i]; } + operator const u_int8_t *() const { return table; } +} SCRAMBLE_TABLE; + +/* Creates the logarithm and inverse logarithm table that is required + * for performing multiplication in the GF(8) domain. + */ +static void gf8_create_log_tables() +{ + u_int8_t log; + u_int16_t b; + + for (b = 0; b <= 255; b++) { + GF8_LOG[b] = 0; + GF8_ILOG[b] = 0; + } + + b = 1; + + for (log = 0; log < 255; log++) { + GF8_LOG[(u_int8_t)b] = log; + GF8_ILOG[log] = (u_int8_t)b; + + b <<= 1; + + if ((b & 0x100) != 0) + b ^= GF8_PRIM_POLY; + } +} + +/* Addition in the GF(8) domain: just the XOR of the values. + */ +#define gf8_add(a, b) (a) ^ (b) + + +/* Multiplication in the GF(8) domain: add the logarithms (modulo 255) + * and return the inverse logarithm. Not used! + */ +#if 0 +static gf8_t gf8_mult(gf8_t a, gf8_t b) +{ + int16_t sum; + + if (a == 0 || b == 0) + return 0; + + sum = GF8_LOG[a] + GF8_LOG[b]; + + if (sum >= 255) + sum -= 255; + + return GF8_ILOG[sum]; +} +#endif + +/* Division in the GF(8) domain: Like multiplication but logarithms a + * subtracted. + */ +static gf8_t gf8_div(gf8_t a, gf8_t b) +{ + int16_t sum; + + assert(b != 0); + + if (a == 0) + return 0; + + sum = GF8_LOG[a] - GF8_LOG[b]; + + if (sum < 0) + sum += 255; + + return GF8_ILOG[sum]; +} + +Gf8_Q_Coeffs_Results_01::Gf8_Q_Coeffs_Results_01() +{ + int i, j; + u_int16_t c; + gf8_t GF8_COEFFS_HELP[2][45]; + u_int8_t GF8_Q_COEFFS[2][45]; + + + gf8_create_log_tables(); + + /* build matrix H: + * 1 1 ... 1 1 + * a^44 a^43 ... a^1 a^0 + * + * + */ + + for (j = 0; j < 45; j++) { + GF8_COEFFS_HELP[0][j] = 1; /* e0 */ + GF8_COEFFS_HELP[1][j] = GF8_ILOG[44-j]; /* e1 */ + } + + + /* resolve equation system for parity byte 0 and 1 */ + + /* e1' = e1 + e0 */ + for (j = 0; j < 45; j++) { + GF8_Q_COEFFS[1][j] = gf8_add(GF8_COEFFS_HELP[1][j], + GF8_COEFFS_HELP[0][j]); + } + + /* e1'' = e1' / (a^1 + 1) */ + for (j = 0; j < 45; j++) { + GF8_Q_COEFFS[1][j] = gf8_div(GF8_Q_COEFFS[1][j], GF8_Q_COEFFS[1][43]); + } + + /* e0' = e0 + e1 / a^1 */ + for (j = 0; j < 45; j++) { + GF8_Q_COEFFS[0][j] = gf8_add(GF8_COEFFS_HELP[0][j], + gf8_div(GF8_COEFFS_HELP[1][j], + GF8_ILOG[1])); + } + + /* e0'' = e0' / (1 + 1 / a^1) */ + for (j = 0; j < 45; j++) { + GF8_Q_COEFFS[0][j] = gf8_div(GF8_Q_COEFFS[0][j], GF8_Q_COEFFS[0][44]); + } + + /* + * Compute the products of 0..255 with all of the Q coefficients in + * advance. When building the scalar product between the data vectors + * and the P/Q vectors the individual products can be looked up in + * this table + * + * The P parity coefficients are just a subset of the Q coefficients so + * that we do not need to create a separate table for them. + */ + + for (j = 0; j < 43; j++) { + + table[j][0] = 0; + + for (i = 1; i < 256; i++) { + c = GF8_LOG[i] + GF8_LOG[GF8_Q_COEFFS[0][j]]; + if (c >= 255) c -= 255; + table[j][i] = GF8_ILOG[c]; + + c = GF8_LOG[i] + GF8_LOG[GF8_Q_COEFFS[1][j]]; + if (c >= 255) c -= 255; + table[j][i] |= GF8_ILOG[c]<<8; + } + } +} + +/* Reverses the bits in 'd'. 'bits' defines the bit width of 'd'. + */ +static u_int32_t mirror_bits(u_int32_t d, int bits) +{ + int i; + u_int32_t r = 0; + + for (i = 0; i < bits; i++) { + r <<= 1; + + if ((d & 0x1) != 0) + r |= 0x1; + + d >>= 1; + } + + return r; +} + +/* Build the CRC lookup table for EDC_POLY poly. The CRC is 32 bit wide + * and reversed (i.e. the bit stream is divided by the EDC_POLY with the + * LSB first order). + */ +CrcTable::CrcTable () +{ + u_int32_t i, j; + u_int32_t r; + + for (i = 0; i < 256; i++) { + r = mirror_bits(i, 8); + + r <<= 24; + + for (j = 0; j < 8; j++) { + if ((r & 0x80000000) != 0) { + r <<= 1; + r ^= EDC_POLY; + } + else { + r <<= 1; + } + } + + r = mirror_bits(r, 32); + + table[i] = r; + } +} + +/* Calculates the CRC of given data with given lengths based on the + * table lookup algorithm. + */ +static u_int32_t calc_edc(u_int8_t *data, int len) +{ + u_int32_t crc = 0; + + while (len--) { + crc = CRCTABLE[(int)(crc ^ *data++) & 0xff] ^ (crc >> 8); + } + + return crc; +} + +/* Build the scramble table as defined in the yellow book. The bytes + 12 to 2351 of a sector will be XORed with the data of this table. + */ +ScrambleTable::ScrambleTable() +{ + u_int16_t i, j; + u_int16_t reg = 1; + u_int8_t d; + + for (i = 0; i < 2340; i++) { + d = 0; + + for (j = 0; j < 8; j++) { + d >>= 1; + + if ((reg & 0x1) != 0) + d |= 0x80; + + if ((reg & 0x1) != ((reg >> 1) & 0x1)) { + reg >>= 1; + reg |= 0x4000; /* 15-bit register */ + } + else { + reg >>= 1; + } + } + + table[i] = d; + } +} + +/* Calc EDC for a MODE 1 sector + */ +static void calc_mode1_edc(u_int8_t *sector) +{ + u_int32_t crc = calc_edc(sector, LEC_MODE1_DATA_LEN + 16); + + sector[LEC_MODE1_EDC_OFFSET] = crc & 0xffL; + sector[LEC_MODE1_EDC_OFFSET + 1] = (crc >> 8) & 0xffL; + sector[LEC_MODE1_EDC_OFFSET + 2] = (crc >> 16) & 0xffL; + sector[LEC_MODE1_EDC_OFFSET + 3] = (crc >> 24) & 0xffL; +} + +/* Calc EDC for a XA form 1 sector + */ +static void calc_mode2_form1_edc(u_int8_t *sector) +{ + u_int32_t crc = calc_edc(sector + LEC_DATA_OFFSET, + LEC_MODE2_FORM1_DATA_LEN); + + sector[LEC_MODE2_FORM1_EDC_OFFSET] = crc & 0xffL; + sector[LEC_MODE2_FORM1_EDC_OFFSET + 1] = (crc >> 8) & 0xffL; + sector[LEC_MODE2_FORM1_EDC_OFFSET + 2] = (crc >> 16) & 0xffL; + sector[LEC_MODE2_FORM1_EDC_OFFSET + 3] = (crc >> 24) & 0xffL; +} + +/* Calc EDC for a XA form 2 sector + */ +static void calc_mode2_form2_edc(u_int8_t *sector) +{ + u_int32_t crc = calc_edc(sector + LEC_DATA_OFFSET, + LEC_MODE2_FORM2_DATA_LEN); + + sector[LEC_MODE2_FORM2_EDC_OFFSET] = crc & 0xffL; + sector[LEC_MODE2_FORM2_EDC_OFFSET + 1] = (crc >> 8) & 0xffL; + sector[LEC_MODE2_FORM2_EDC_OFFSET + 2] = (crc >> 16) & 0xffL; + sector[LEC_MODE2_FORM2_EDC_OFFSET + 3] = (crc >> 24) & 0xffL; +} + +/* Writes the sync pattern to the given sector. + */ +static void set_sync_pattern(u_int8_t *sector) +{ + sector[0] = 0; + + sector[1] = sector[2] = sector[3] = sector[4] = sector[5] = + sector[6] = sector[7] = sector[8] = sector[9] = sector[10] = 0xff; + + sector[11] = 0; +} + + +static u_int8_t bin2bcd(u_int8_t b) +{ + return (((b/10) << 4) & 0xf0) | ((b%10) & 0x0f); +} + +/* Builds the sector header. + */ +static void set_sector_header(u_int8_t mode, u_int32_t adr, u_int8_t *sector) +{ + sector[LEC_HEADER_OFFSET] = bin2bcd(adr / (60*75)); + sector[LEC_HEADER_OFFSET + 1] = bin2bcd((adr / 75) % 60); + sector[LEC_HEADER_OFFSET + 2] = bin2bcd(adr % 75); + sector[LEC_HEADER_OFFSET + 3] = mode; +} + +/* Calculate the P parities for the sector. + * The 43 P vectors of length 24 are combined with the GF8_P_COEFFS. + */ +static void calc_P_parity(u_int8_t *sector) +{ + int i, j; + u_int16_t p01_msb, p01_lsb; + u_int8_t *p_lsb_start; + u_int8_t *p_lsb; + u_int8_t *p0, *p1; + u_int8_t d0,d1; + + p_lsb_start = sector + LEC_HEADER_OFFSET; + + p1 = sector + LEC_MODE1_P_PARITY_OFFSET; + p0 = sector + LEC_MODE1_P_PARITY_OFFSET + 2 * 43; + + for (i = 0; i <= 42; i++) { + p_lsb = p_lsb_start; + + p01_lsb = p01_msb = 0; + + for (j = 19; j <= 42; j++) { + d0 = *p_lsb; + d1 = *(p_lsb+1); + + p01_lsb ^= CF8_Q_COEFFS_RESULTS_01[j][d0]; + p01_msb ^= CF8_Q_COEFFS_RESULTS_01[j][d1]; + + p_lsb += 2 * 43; + } + + *p0 = p01_lsb; + *(p0 + 1) = p01_msb; + + *p1 = p01_lsb>>8; + *(p1 + 1) = p01_msb>>8; + + p0 += 2; + p1 += 2; + + p_lsb_start += 2; + } +} + +/* Calculate the Q parities for the sector. + * The 26 Q vectors of length 43 are combined with the GF8_Q_COEFFS. + */ +static void calc_Q_parity(u_int8_t *sector) +{ + int i, j; + u_int16_t q01_lsb, q01_msb; + u_int8_t *q_lsb_start; + u_int8_t *q_lsb; + u_int8_t *q0, *q1, *q_start; + u_int8_t d0,d1; + + q_lsb_start = sector + LEC_HEADER_OFFSET; + + q_start = sector + LEC_MODE1_Q_PARITY_OFFSET; + q1 = sector + LEC_MODE1_Q_PARITY_OFFSET; + q0 = sector + LEC_MODE1_Q_PARITY_OFFSET + 2 * 26; + + for (i = 0; i <= 25; i++) { + q_lsb = q_lsb_start; + + q01_lsb = q01_msb = 0; + + for (j = 0; j <= 42; j++) { + d0 = *q_lsb; + d1 = *(q_lsb+1); + + q01_lsb ^= CF8_Q_COEFFS_RESULTS_01[j][d0]; + q01_msb ^= CF8_Q_COEFFS_RESULTS_01[j][d1]; + + q_lsb += 2 * 44; + + if (q_lsb >= q_start) { + q_lsb -= 2 * 1118; + } + } + + *q0 = q01_lsb; + *(q0 + 1) = q01_msb; + + *q1 = q01_lsb>>8; + *(q1 + 1) = q01_msb>>8; + + q0 += 2; + q1 += 2; + + q_lsb_start += 2 * 43; + } +} + +/* Encodes a MODE 0 sector. + * 'adr' is the current physical sector address + * 'sector' must be 2352 byte wide + */ +void lec_encode_mode0_sector(u_int32_t adr, u_int8_t *sector) +{ + u_int16_t i; + + set_sync_pattern(sector); + set_sector_header(0, adr, sector); + + sector += 16; + + for (i = 0; i < 2336; i++) + *sector++ = 0; +} + +/* Encodes a MODE 1 sector. + * 'adr' is the current physical sector address + * 'sector' must be 2352 byte wide containing 2048 bytes user data at + * offset 16 + */ +void lec_encode_mode1_sector(u_int32_t adr, u_int8_t *sector) +{ + set_sync_pattern(sector); + set_sector_header(1, adr, sector); + + calc_mode1_edc(sector); + + /* clear the intermediate field */ + sector[LEC_MODE1_INTERMEDIATE_OFFSET] = + sector[LEC_MODE1_INTERMEDIATE_OFFSET + 1] = + sector[LEC_MODE1_INTERMEDIATE_OFFSET + 2] = + sector[LEC_MODE1_INTERMEDIATE_OFFSET + 3] = + sector[LEC_MODE1_INTERMEDIATE_OFFSET + 4] = + sector[LEC_MODE1_INTERMEDIATE_OFFSET + 5] = + sector[LEC_MODE1_INTERMEDIATE_OFFSET + 6] = + sector[LEC_MODE1_INTERMEDIATE_OFFSET + 7] = 0; + + calc_P_parity(sector); + calc_Q_parity(sector); +} + +/* Encodes a MODE 2 sector. + * 'adr' is the current physical sector address + * 'sector' must be 2352 byte wide containing 2336 bytes user data at + * offset 16 + */ +void lec_encode_mode2_sector(u_int32_t adr, u_int8_t *sector) +{ + set_sync_pattern(sector); + set_sector_header(2, adr, sector); +} + +/* Encodes a XA form 1 sector. + * 'adr' is the current physical sector address + * 'sector' must be 2352 byte wide containing 2048+8 bytes user data at + * offset 16 + */ +void lec_encode_mode2_form1_sector(u_int32_t adr, u_int8_t *sector) +{ + set_sync_pattern(sector); + + calc_mode2_form1_edc(sector); + + /* P/Q partiy must not contain the sector header so clear it */ + sector[LEC_HEADER_OFFSET] = + sector[LEC_HEADER_OFFSET + 1] = + sector[LEC_HEADER_OFFSET + 2] = + sector[LEC_HEADER_OFFSET + 3] = 0; + + calc_P_parity(sector); + calc_Q_parity(sector); + + /* finally add the sector header */ + set_sector_header(2, adr, sector); +} + +/* Encodes a XA form 2 sector. + * 'adr' is the current physical sector address + * 'sector' must be 2352 byte wide containing 2324+8 bytes user data at + * offset 16 + */ +void lec_encode_mode2_form2_sector(u_int32_t adr, u_int8_t *sector) +{ + set_sync_pattern(sector); + + calc_mode2_form2_edc(sector); + + set_sector_header(2, adr, sector); +} + +/* Scrambles and byte swaps an encoded sector. + * 'sector' must be 2352 byte wide. + */ +void lec_scramble(u_int8_t *sector) +{ + u_int16_t i; + const u_int8_t *stable = SCRAMBLE_TABLE; + u_int8_t *p = sector; + u_int8_t tmp; + + + for (i = 0; i < 6; i++) { + /* just swap bytes of sector sync */ + tmp = *p; + *p = *(p + 1); + p++; + *p++ = tmp; + } + for (;i < (2352 / 2); i++) { + /* scramble and swap bytes */ + tmp = *p ^ *stable++; + *p = *(p + 1) ^ *stable++; + p++; + *p++ = tmp; + } +} + +#if 0 +#include <fcntl.h> +#include <unistd.h> +#include <string.h> +#include <stdio.h> + +int main(int argc, char **argv) +{ + char *infile; + char *outfile; + int fd_in, fd_out; + u_int8_t buffer1[2352]; + u_int8_t buffer2[2352]; + u_int32_t lba; + int i; + +#if 0 + for (i = 0; i < 2048; i++) + buffer1[i + 16] = 234; + + lba = 150; + + for (i = 0; i < 100000; i++) { + lec_encode_mode1_sector(lba, buffer1); + lec_scramble(buffer2); + lba++; + } + +#else + + if (argc != 3) + return 1; + + infile = argv[1]; + outfile = argv[2]; + + + if ((fd_in = open(infile, O_RDONLY)) < 0) { + perror("Cannot open input file"); + return 1; + } + + if ((fd_out = open(outfile, O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) { + perror("Cannot open output file"); + return 1; + } + + lba = 150; + + do { + if (read(fd_in, buffer1, 2352) != 2352) + break; + + switch (*(buffer1 + 12 + 3)) { + case 1: + memcpy(buffer2 + 16, buffer1 + 16, 2048); + + lec_encode_mode1_sector(lba, buffer2); + break; + + case 2: + if ((*(buffer1 + 12 + 4 + 2) & 0x20) != 0) { + /* form 2 sector */ + memcpy(buffer2 + 16, buffer1 + 16, 2324 + 8); + lec_encode_mode2_form2_sector(lba, buffer2); + } + else { + /* form 1 sector */ + memcpy(buffer2 + 16, buffer1 + 16, 2048 + 8); + lec_encode_mode2_form1_sector(lba, buffer2); + } + break; + } + + if (memcmp(buffer1, buffer2, 2352) != 0) { + printf("Verify error at lba %ld\n", lba); + } + + lec_scramble(buffer2); + write(fd_out, buffer2, 2352); + + lba++; + } while (1); + + close(fd_in); + close(fd_out); + +#endif + + return 0; +} +#endif diff --git a/trackdb/lec.h b/trackdb/lec.h new file mode 100644 index 0000000..043131d --- /dev/null +++ b/trackdb/lec.h @@ -0,0 +1,69 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __LEC_H__ +#define __LEC_H__ + +#include <sys/types.h> +#include "config.h" + +#ifndef TRUE +#define TRUE 1 +#endif + +/* Encodes a MODE 0 sector. + * 'adr' is the current physical sector address + * 'sector' must be 2352 byte wide + */ +void lec_encode_mode0_sector(u_int32_t adr, u_int8_t *sector); + +/* Encodes a MODE 1 sector. + * 'adr' is the current physical sector address + * 'sector' must be 2352 byte wide containing 2048 bytes user data at + * offset 16 + */ +void lec_encode_mode1_sector(u_int32_t adr, u_int8_t *sector); + +/* Encodes a MODE 2 sector. + * 'adr' is the current physical sector address + * 'sector' must be 2352 byte wide containing 2336 bytes user data at + * offset 16 + */ +void lec_encode_mode2_sector(u_int32_t adr, u_int8_t *sector); + +/* Encodes a XA form 1 sector. + * 'adr' is the current physical sector address + * 'sector' must be 2352 byte wide containing 2048+8 bytes user data at + * offset 16 + */ +void lec_encode_mode2_form1_sector(u_int32_t adr, u_int8_t *sector); + +/* Encodes a XA form 2 sector. + * 'adr' is the current physical sector address + * 'sector' must be 2352 byte wide containing 2324+8 bytes user data at + * offset 16 + */ +void lec_encode_mode2_form2_sector(u_int32_t adr, u_int8_t *sector); + +/* Scrambles and byte swaps an encoded sector. + * 'sector' must be 2352 byte wide. + */ +void lec_scramble(u_int8_t *sector); + +#endif diff --git a/trackdb/log.cc b/trackdb/log.cc new file mode 100644 index 0000000..d09060b --- /dev/null +++ b/trackdb/log.cc @@ -0,0 +1,83 @@ +/* cdrdao - logging/message code + * + * Copyright (C) 2007 Denis Leroy <denis@poolshark.org> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <stdarg.h> + +#include "log.h" + +static struct { + int level; +} self; + +void log_init() +{ + memset(&self, 0, sizeof(self)); +} + +// Set verbosity of the logging code. +void log_set_verbose(int level) +{ + self.level = level; +} + +// Log a message. +void log_message(int level, const char *fmt, ...) +{ + long len = strlen(fmt); + char last = len > 0 ? fmt[len - 1] : 0; + + va_list args; + va_start(args, fmt); + + if (level < 0) { + switch (level) { + case -1: + fprintf(stderr, "WARNING: "); + break; + case -2: + fprintf(stderr, "ERROR: "); + break; + case -3: + fprintf(stderr, "INTERNAL ERROR: "); + break; + default: + fprintf(stderr, "FATAL ERROR: "); + break; + } + vfprintf(stderr, fmt, args); + if (last != ' ' && last != '\r') + fprintf(stderr, "\n"); + + fflush(stderr); + if (level <= -10) + exit(1); + } else if (level <= self.level) { + vfprintf(stderr, fmt, args); + if (last != ' ' && last != '\r') + fprintf(stderr, "\n"); + + fflush(stderr); + } + + va_end(args); +} + diff --git a/trackdb/log.h b/trackdb/log.h new file mode 100644 index 0000000..bcad7f2 --- /dev/null +++ b/trackdb/log.h @@ -0,0 +1,42 @@ +/* cdrdao - logging/message code + * + * Copyright (C) 2007 Denis Leroy <denis@poolshark.org> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __LOG_H__ +#define __LOG_H__ + +// Initialize log code. Must be called first. +void log_init(); + +// Log given formatted message. +// +// Level definitions: +// -1 : warning +// -2 : error +// -3 : internal error +// -4 to -9 : fatal error +// -10 and less : fatal error, call will exit the calling thread. +// +// Levels >= 0 are controlled by the verbosity set below. +void log_message(int level, const char *fmt, ...); + +// Set logging verbosity. Only levels <= set level will be output. +void log_set_verbose(int level); + +#endif + diff --git a/trackdb/util.cc b/trackdb/util.cc new file mode 100644 index 0000000..b37a1fb --- /dev/null +++ b/trackdb/util.cc @@ -0,0 +1,323 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <stdio.h> +#include <unistd.h> +#include <limits.h> +#include <string.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <stdarg.h> + +#include "util.h" +#include "Sample.h" + +char *strdupCC(const char *s) +{ + char *ret; + long len; + + if (s == NULL) { + return NULL; + } + + len = strlen(s); + + ret = new char[len + 1]; + + strcpy(ret, s); + + return ret; +} + +char *strdup3CC(const char *s1, const char *s2, const char *s3) +{ + char *ret; + long len = 0; + + if (s1 == NULL && s2 == NULL && s3 == NULL) + return NULL; + + if (s1 != NULL) + len = strlen(s1); + + if (s2 != NULL) + len += strlen(s2); + + if (s3 != NULL) + len += strlen(s3); + + ret = new char[len + 1]; + + *ret = 0; + + if (s1 != NULL) + strcpy(ret, s1); + + if (s2 != NULL) + strcat(ret, s2); + + if (s3 != NULL) + strcat(ret, s3); + + return ret; +} + +char *strdupvCC(const char *s1, ...) +{ + const char *p; + char *ret; + long len; + va_list ap; + + if (s1 == NULL) + return NULL; + + len = strlen(s1); + + va_start(ap, s1); + + while ((p = va_arg(ap, const char *)) != NULL) + len += strlen(p); + + va_end(ap); + + ret = new char[len + 1]; + + strcpy(ret, s1); + + + va_start(ap, s1); + + while ((p = va_arg(ap, const char *)) != NULL) + strcat(ret, p); + + va_end(ap); + + return ret; +} + +long fullRead(int fd, void *buf, long count) +{ + long n = 0; + long nread = 0; + + do { + do { + n = read(fd, (char *)buf + nread, count); + } while (n < 0 && (errno == EAGAIN || errno == EINTR)); + + if (n < 0) { + return -1; + } + + if (n == 0) { + return nread; + } + + count -= n; + nread += n; + } while (count > 0); + + return nread; +} + +long fullWrite(int fd, const void *buf, long count) +{ + long n; + long nwritten = 0; + const char *p = (const char *)buf; + + do { + do { + n = write(fd, p, count); + } while (n < 0 && (errno == EAGAIN || errno == EINTR)); + + if (n < 0) + return -1; + + if (n == 0) + return nwritten; + + count -= n; + nwritten += n; + p += n; + } while (count > 0); + + return nwritten; +} + +long readLong(FILE *fp) +{ + unsigned char c1 = getc(fp); + unsigned char c2 = getc(fp); + unsigned char c3 = getc(fp); + unsigned char c4 = getc(fp); + + return ((long)c4 << 24) | ((long)c3 << 16) | ((long)c2 << 8) | (long)c1; +} + +short readShort(FILE *fp) +{ + unsigned char c1 = getc(fp); + unsigned char c2 = getc(fp); + + return ((short)c2 << 8) | (short)c1; +} + +void swapSamples(Sample *buf, unsigned long len) +{ + unsigned long i; + + for (i = 0; i < len; i++) { + buf[i].swap(); + } +} + +unsigned char int2bcd(int d) +{ + if (d >= 0 && d <= 99) + return ((d / 10) << 4) | (d % 10); + else + return d; +} + +int bcd2int(unsigned char d) +{ + unsigned char d1 = d & 0x0f; + unsigned char d2 = d >> 4; + + if (d1 <= 9 && d2 <= 9) { + return d2 * 10 + d1; + } + else { + return d; + } +} + +const char *stripCwd(const char *fname) +{ + static char *buf = NULL; + static long bufLen = 0; + + char cwd[PATH_MAX + 1]; + long len; + + if (fname == NULL) + return NULL; + + len = strlen(fname); + + if (buf == NULL || len >= bufLen) { + bufLen = len + 1; + delete[] buf; + buf = new char[bufLen]; + } + + if (getcwd(cwd, PATH_MAX + 1) == NULL) { + // if we cannot retrieve the current working directory return 'fname' + strcpy(buf, fname); + } + else { + len = strlen(cwd); + + if (strncmp(cwd, fname, len) == 0) { + if (*(fname + len) == '/') + strcpy(buf, fname + len + 1); + else + strcpy(buf, fname + len); + + if (buf[0] == 0) { + // resulting filename would be "" -> return 'fname' + strcpy(buf, fname); + } + } + else { + strcpy(buf, fname); + } + } + + return buf; +} + +FileExtension fileExtension(const char* fname) +{ + const char* e; + + if (fname && (e = strrchr(fname, '.'))) { + e++; + + if (strcasecmp(e, "toc") == 0) + return FE_TOC; + if (strcasecmp(e, "cue") == 0) + return FE_CUE; + if (strcasecmp(e, "wav") == 0) + return FE_WAV; + if (strcasecmp(e, "mp3") == 0) + return FE_MP3; + if (strcasecmp(e, "ogg") == 0) + return FE_OGG; + if (strcasecmp(e, "m3u") == 0) + return FE_M3U; + } + + return FE_UNKNOWN; +} + +bool resolveFilename(std::string& abs, const char* file, const char* path) +{ + struct stat st; + + // First checks if file is already absolute, in which case we do + // nothing. + if (file[0] == '/') { + abs = file; + return true; + } + + // Now checks if file is readable in current directory. Current + // directory has precedence over search path. + if (stat(file, &st) == 0 && (st.st_mode & S_IFREG)) { + char cwd[1024]; + if (getcwd(cwd, 1024)) { + abs = cwd; + abs += "/"; + } + abs += file; + return true; + } + + // Now check in search path. + std::string afile = path; + if (*(afile.end()) != '/') + afile += "/"; + afile += file; + if (stat(afile.c_str(), &st) == 0 && (st.st_mode & S_IFREG)) { + abs = afile; + return true; + } + + // File not found. + abs = ""; + return false; +} diff --git a/trackdb/util.h b/trackdb/util.h new file mode 100644 index 0000000..b2b0f78 --- /dev/null +++ b/trackdb/util.h @@ -0,0 +1,61 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __UTIL_H__ +#define __UTIL_H__ + +#include <stdio.h> +#include <stdlib.h> + +#include <string> + +class Sample; + +char *strdupCC(const char *s); +char *strdup3CC(const char *s1, const char *s2, const char *s3); +char *strdupvCC(const char *s1, ...); + +long fullRead(int fd, void *buf, long count); +long fullWrite(int fd, const void *buf, long count); +long readLong(FILE *fp); +short readShort(FILE *fp); + +void swapSamples(Sample *buf, unsigned long len); + +unsigned char int2bcd(int); +int bcd2int(unsigned char); + +const char *stripCwd(const char *fname); + +typedef enum { + FE_UNKNOWN = 0, + FE_TOC, + FE_CUE, + FE_WAV, + FE_MP3, + FE_OGG, + FE_M3U, +} FileExtension; + +FileExtension fileExtension(const char* fname); + +bool resolveFilename(std::string& dest, const char* file, const char* path); + +#endif + diff --git a/utils/Makefile.am b/utils/Makefile.am new file mode 100644 index 0000000..410279f --- /dev/null +++ b/utils/Makefile.am @@ -0,0 +1,39 @@ +if COND_TOC2MP3 +MAYBE_TOC2MP3 = toc2mp3 +else +MAYBE_TOC2MP3 = +endif + +bin_PROGRAMS = toc2cue cue2toc toc2cddb $(MAYBE_TOC2MP3) + +toc2cddb_SOURCES = toc2cddb.cc +toc2cue_SOURCES = toc2cue.cc +cue2toc_SOURCES = main.c cue2toc.c cue2toc.h timecode.c timecode.h +toc2mp3_SOURCES = toc2mp3.cc + +toc2cddb_LDADD = $(top_builddir)/trackdb/libtrackdb.a +toc2cue_LDADD = $(top_builddir)/trackdb/libtrackdb.a +toc2mp3_LDADD = $(top_builddir)/trackdb/libtrackdb.a @LAME_LIBS@ + +if COND_MP3 +toc2cddb_LDADD += @MAD_LIBS@ +toc2cue_LDADD += @MAD_LIBS@ +toc2mp3_LDADD += @MAD_LIBS@ +endif + +if COND_OGG +toc2cddb_LDADD += @VORBISFILE_LIBS@ +toc2cue_LDADD += @VORBISFILE_LIBS@ +toc2mp3_LDADD += @VORBISFILE_LIBS@ +endif + +toc2cddb_LDADD += @AO_LIBS@ +toc2cue_LDADD += @AO_LIBS@ +toc2mp3_LDADD += @AO_LIBS@ + +toc2mp3_CXXFLAGS = @LAME_CFLAGS@ + +INCLUDES = -I$(top_builddir)/trackdb + +man1_MANS = cue2toc.1 toc2cddb.1 toc2cue.1 +EXTRA_DIST = $(man1_MANS) diff --git a/utils/Makefile.in b/utils/Makefile.in new file mode 100644 index 0000000..3e23772 --- /dev/null +++ b/utils/Makefile.in @@ -0,0 +1,596 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = toc2cue$(EXEEXT) cue2toc$(EXEEXT) toc2cddb$(EXEEXT) \ + $(am__EXEEXT_1) +@COND_MP3_TRUE@am__append_1 = @MAD_LIBS@ +@COND_MP3_TRUE@am__append_2 = @MAD_LIBS@ +@COND_MP3_TRUE@am__append_3 = @MAD_LIBS@ +@COND_OGG_TRUE@am__append_4 = @VORBISFILE_LIBS@ +@COND_OGG_TRUE@am__append_5 = @VORBISFILE_LIBS@ +@COND_OGG_TRUE@am__append_6 = @VORBISFILE_LIBS@ +subdir = utils +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +@COND_TOC2MP3_TRUE@am__EXEEXT_1 = toc2mp3$(EXEEXT) +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_cue2toc_OBJECTS = main.$(OBJEXT) cue2toc.$(OBJEXT) \ + timecode.$(OBJEXT) +cue2toc_OBJECTS = $(am_cue2toc_OBJECTS) +cue2toc_LDADD = $(LDADD) +am_toc2cddb_OBJECTS = toc2cddb.$(OBJEXT) +toc2cddb_OBJECTS = $(am_toc2cddb_OBJECTS) +am__DEPENDENCIES_1 = +toc2cddb_DEPENDENCIES = $(top_builddir)/trackdb/libtrackdb.a \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_toc2cue_OBJECTS = toc2cue.$(OBJEXT) +toc2cue_OBJECTS = $(am_toc2cue_OBJECTS) +toc2cue_DEPENDENCIES = $(top_builddir)/trackdb/libtrackdb.a \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am_toc2mp3_OBJECTS = toc2mp3-toc2mp3.$(OBJEXT) +toc2mp3_OBJECTS = $(am_toc2mp3_OBJECTS) +toc2mp3_DEPENDENCIES = $(top_builddir)/trackdb/libtrackdb.a \ + $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +SOURCES = $(cue2toc_SOURCES) $(toc2cddb_SOURCES) $(toc2cue_SOURCES) \ + $(toc2mp3_SOURCES) +DIST_SOURCES = $(cue2toc_SOURCES) $(toc2cddb_SOURCES) \ + $(toc2cue_SOURCES) $(toc2mp3_SOURCES) +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man1_MANS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AO_CFLAGS = @AO_CFLAGS@ +AO_LIBS = @AO_LIBS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COND_MP3_FALSE = @COND_MP3_FALSE@ +COND_MP3_TRUE = @COND_MP3_TRUE@ +COND_OGG_FALSE = @COND_OGG_FALSE@ +COND_OGG_TRUE = @COND_OGG_TRUE@ +COND_PCCTS_FALSE = @COND_PCCTS_FALSE@ +COND_PCCTS_TRUE = @COND_PCCTS_TRUE@ +COND_SCSILIB_FALSE = @COND_SCSILIB_FALSE@ +COND_SCSILIB_TRUE = @COND_SCSILIB_TRUE@ +COND_TOC2MP3_FALSE = @COND_TOC2MP3_FALSE@ +COND_TOC2MP3_TRUE = @COND_TOC2MP3_TRUE@ +COND_XDAO_FALSE = @COND_XDAO_FALSE@ +COND_XDAO_TRUE = @COND_XDAO_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ +GTKMM2_CFLAGS = @GTKMM2_CFLAGS@ +GTKMM2_LIBS = @GTKMM2_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LAME_CFLAGS = @LAME_CFLAGS@ +LAME_LIBS = @LAME_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBGUIMM2_CFLAGS = @LIBGUIMM2_CFLAGS@ +LIBGUIMM2_LIBS = @LIBGUIMM2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAD_CFLAGS = @MAD_CFLAGS@ +MAD_LIBS = @MAD_LIBS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIGCPP2_CFLAGS = @SIGCPP2_CFLAGS@ +SIGCPP2_LIBS = @SIGCPP2_LIBS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +VORBISFILE_CFLAGS = @VORBISFILE_CFLAGS@ +VORBISFILE_LIBS = @VORBISFILE_LIBS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +antlr_path = @antlr_path@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +dao_src = @dao_src@ +datadir = @datadir@ +dlg_path = @dlg_path@ +en_cdrdao = @en_cdrdao@ +en_cue2toc = @en_cue2toc@ +en_toc2cue = @en_toc2cue@ +en_toc2mp3 = @en_toc2mp3@ +en_xdao = @en_xdao@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydefs = @mydefs@ +oldincludedir = @oldincludedir@ +pcctsinc = @pcctsinc@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +scsilib_dir = @scsilib_dir@ +scsilib_incl = @scsilib_incl@ +scsilib_libs = @scsilib_libs@ +scsilib_objs = @scsilib_objs@ +sharedstatedir = @sharedstatedir@ +sound_if_obj = @sound_if_obj@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +thread_libs = @thread_libs@ +@COND_TOC2MP3_FALSE@MAYBE_TOC2MP3 = +@COND_TOC2MP3_TRUE@MAYBE_TOC2MP3 = toc2mp3 +toc2cddb_SOURCES = toc2cddb.cc +toc2cue_SOURCES = toc2cue.cc +cue2toc_SOURCES = main.c cue2toc.c cue2toc.h timecode.c timecode.h +toc2mp3_SOURCES = toc2mp3.cc +toc2cddb_LDADD = $(top_builddir)/trackdb/libtrackdb.a $(am__append_1) \ + $(am__append_4) @AO_LIBS@ +toc2cue_LDADD = $(top_builddir)/trackdb/libtrackdb.a $(am__append_2) \ + $(am__append_5) @AO_LIBS@ +toc2mp3_LDADD = $(top_builddir)/trackdb/libtrackdb.a @LAME_LIBS@ \ + $(am__append_3) $(am__append_6) @AO_LIBS@ +toc2mp3_CXXFLAGS = @LAME_CFLAGS@ +INCLUDES = -I$(top_builddir)/trackdb +man1_MANS = cue2toc.1 toc2cddb.1 toc2cue.1 +EXTRA_DIST = $(man1_MANS) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .cc .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu utils/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu utils/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +cue2toc$(EXEEXT): $(cue2toc_OBJECTS) $(cue2toc_DEPENDENCIES) + @rm -f cue2toc$(EXEEXT) + $(LINK) $(cue2toc_LDFLAGS) $(cue2toc_OBJECTS) $(cue2toc_LDADD) $(LIBS) +toc2cddb$(EXEEXT): $(toc2cddb_OBJECTS) $(toc2cddb_DEPENDENCIES) + @rm -f toc2cddb$(EXEEXT) + $(CXXLINK) $(toc2cddb_LDFLAGS) $(toc2cddb_OBJECTS) $(toc2cddb_LDADD) $(LIBS) +toc2cue$(EXEEXT): $(toc2cue_OBJECTS) $(toc2cue_DEPENDENCIES) + @rm -f toc2cue$(EXEEXT) + $(CXXLINK) $(toc2cue_LDFLAGS) $(toc2cue_OBJECTS) $(toc2cue_LDADD) $(LIBS) +toc2mp3$(EXEEXT): $(toc2mp3_OBJECTS) $(toc2mp3_DEPENDENCIES) + @rm -f toc2mp3$(EXEEXT) + $(CXXLINK) $(toc2mp3_LDFLAGS) $(toc2mp3_OBJECTS) $(toc2mp3_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cue2toc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timecode.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/toc2cddb.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/toc2cue.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/toc2mp3-toc2mp3.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.cc.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +toc2mp3-toc2mp3.o: toc2mp3.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(toc2mp3_CXXFLAGS) $(CXXFLAGS) -MT toc2mp3-toc2mp3.o -MD -MP -MF "$(DEPDIR)/toc2mp3-toc2mp3.Tpo" -c -o toc2mp3-toc2mp3.o `test -f 'toc2mp3.cc' || echo '$(srcdir)/'`toc2mp3.cc; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/toc2mp3-toc2mp3.Tpo" "$(DEPDIR)/toc2mp3-toc2mp3.Po"; else rm -f "$(DEPDIR)/toc2mp3-toc2mp3.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='toc2mp3.cc' object='toc2mp3-toc2mp3.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(toc2mp3_CXXFLAGS) $(CXXFLAGS) -c -o toc2mp3-toc2mp3.o `test -f 'toc2mp3.cc' || echo '$(srcdir)/'`toc2mp3.cc + +toc2mp3-toc2mp3.obj: toc2mp3.cc +@am__fastdepCXX_TRUE@ if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(toc2mp3_CXXFLAGS) $(CXXFLAGS) -MT toc2mp3-toc2mp3.obj -MD -MP -MF "$(DEPDIR)/toc2mp3-toc2mp3.Tpo" -c -o toc2mp3-toc2mp3.obj `if test -f 'toc2mp3.cc'; then $(CYGPATH_W) 'toc2mp3.cc'; else $(CYGPATH_W) '$(srcdir)/toc2mp3.cc'; fi`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/toc2mp3-toc2mp3.Tpo" "$(DEPDIR)/toc2mp3-toc2mp3.Po"; else rm -f "$(DEPDIR)/toc2mp3-toc2mp3.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='toc2mp3.cc' object='toc2mp3-toc2mp3.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(toc2mp3_CXXFLAGS) $(CXXFLAGS) -c -o toc2mp3-toc2mp3.obj `if test -f 'toc2mp3.cc'; then $(CYGPATH_W) 'toc2mp3.cc'; else $(CYGPATH_W) '$(srcdir)/toc2mp3.cc'; fi` +uninstall-info-am: +install-man1: $(man1_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)" + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ + done +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(MANS) +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-man + +install-exec-am: install-binPROGRAMS + +install-info: install-info-am + +install-man: install-man1 + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-info-am uninstall-man + +uninstall-man: uninstall-man1 + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic ctags distclean distclean-compile \ + distclean-generic distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-binPROGRAMS \ + install-data install-data-am install-exec install-exec-am \ + install-info install-info-am install-man install-man1 \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-binPROGRAMS \ + uninstall-info-am uninstall-man uninstall-man1 + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/utils/cue2toc.1 b/utils/cue2toc.1 new file mode 100644 index 0000000..8ad74e8 --- /dev/null +++ b/utils/cue2toc.1 @@ -0,0 +1,483 @@ +.\" cue2toc.1 - manual page for cue2toc +.\" Copyright (C) 2004 Matthias Czapla <dermatsch@gmx.de> +.\" +.\" This file is part of cue2toc. +.\" +.\" This program 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. +.\" +.\" This program is distributed in the hope that it will be useful, +.\" but WITHOUT ANY WARRANTY; without even the implied warranty of +.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +.\" GNU General Public License for more details. +.\" +.\" You should have received a copy of the GNU General Public License +.\" along with this program; if not, write to the Free Software +.\" Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +.\" +.TH CUE2TOC 1 + +.SH NAME +cue2toc \- convert CUE to TOC format + +.SH SYNOPSIS +.BR "cue2toc" " [" "-hnqv" "] [" "-o" +.IR "tocfile" "]" +.RB "[" "-w" +.IR "wavefile" "] [" "cuefile" "]" + +.SH DESCRIPTION +.B Cue2toc +converts +.I cuefile +from CUE to TOC format and writes the result to +.IR "tocfile" "." +If either +.IR "cuefile" " or " "tocfile" +is omitted or a single dash "-" +.B cue2toc +reads from standard input and writes to standard ouput +respectively. + +CUE files are text files describing the layout of a CD-Rom and +typically carry the extension ".cue". + +Cdrdao is a CD-burning application which has its own native TOC +format to describe the disc layout. Although cdrdao has direct +support for reading CUE files, it is currently limited to data +tracks only. So +.BR "cue2toc" "'s" +main usefulness lies in converting +CUE files containing audio tracks. + +Output of CD-Text data can be disabled with the +.B -n +option. + +CUE files often come with MP3 files but since cdrdao doesnt +support decoding them on the fly they probably must be decoded by +other means prior to writing the CD (e.g. using +.BR "lame" ")." +For this reason you can specify a filename with the +.B -w +option to be used for all audio tracks instead of the one +in the CUE file. Of course this is only really useful if all +the tracks are based on the same file. This seems to be the case +quite often however. + +.B Cue2toc +normally displays warning messages for unsupported commands and +constructs. The +.B -q +option disables these warnings. + +.SH OPTIONS +.TP +.B -h +print a short help message + +.TP +.B -n +no CD-Text; disable output of CD-Text information + +.TP +.BI "-o " "tocfile" +write result to +.I tocfile +instead of standard ouput + +.TP +.B -q +quiet mode; do not print warnings + +.TP +.B -v +print version number + +.TP +.BI "-w " "wavefile" +use +.I wavefile +for all audio tracks + + +.SH CUE FORMAT +What follows is a description of the CUE format expected by +.BR "cue2toc" "." +For information about the TOC format please consult the +.BR "cdrdao" "(1)" +manual page. + +CUE files consist of commands and their arguments which must be +separated from each other by any number of whitespace characters. +Space, horizontal tabulator, newline and carriage return are +recognized as whitespace characters except inside strings surrounded +by double quotes, where they are part of the string. Commands are +not case sensitive. CD-Text data can be at most 80 characters per +item. + +Timecode values are accepted in the forms "X:X:X", "X:X" and +"X" where each "X" must consist of at most two digits and may be +zero padded to the left. They are interpreted as "M:S:F", "S:F" and +"F" respectively where "M" means "minutes" and must be in the range +0 <= M <= 99, "S" means "seconds" and must be in the range +0 <= S <= 59, and "F" means "frames" and must be in the range +0 <= F <= 74. + +CUE files are logically divided into a global section and +one to 99 track sections. Inside these sections the following +commands are allowed: + +.SS Global Section + +.B REM +.I anything_to_newline +.br +.B CATALOG +.I string +.br +.B CDTEXTFILE +.I string +.br +.B TITLE +.I string +.br +.B PERFORMER +.I string +.br +.B SONGWRITER +.I string +.br +.B FILE +.I string +.BR "BINARY" "|" "MOTOROLA" "|" "AIFF" "|" "WAVE" "|" "MP3" + + +.TP +.B REM +Optional. +Introduces a comment. Anything from there on up to and including the +next newline character is ignored. Comments can appear anywhere in +the file but not between a command and its arguments. + +.TP +.B CATALOG +Optional. +The Media Catalog Number of the disc. Must be exactly 13 characters. + +.TP +.B CDTEXTFILE +Optional. +Specifies an external file containing CD-Text data. Ignored. + +.TP +.B TITLE +Optional. +The CD-Text title of the disc. + +.TP +.B PERFORMER +Optional. +The CD-Text performer of the disc. + +.TP +.B SONGWRITER +Optional. +The CD-Text songwriter of the disc. + +.TP +.B FILE +Required. +The name and type of the file to be used for all following tracks. +The +.I string +contains the name of the file followed by one of +.BR "BINARY" ", " "MOTOROLA" ", " "AIFF" ", " "WAVE" " or " "MP3" "." +As far as +.B cue2toc +is concerned the type of the file is effectively ignored. +Nonetheless +.BR "MOTOROLA" ", " "AIFF" " and " "MP3" +cause printing of a warning message since these file types can +not be used directly with cdrdao. + +.LP +The first appearance of a +.B TRACK +command causes leaving of the global section and entering the +track section. + +.SS Track Section + +.B TRACK +.I number +.I mode +.br +.B REM +.I anything_to_newline +.br +.B FLAGS +.RB "[" "DCP" "]" +.RB "[" "4CH" "]" +.RB "[" "PRE" "]" +.RB "[" "SCMS" "]" +.br +.B ISRC +.I string +.br +.B TITLE +.I string +.br +.B PERFORMER +.I string +.br +.B SONGWRITER +.I string +.br +.B PREGAP +.I timecode +.br +.B INDEX +.I number +.I timecode +.br +.B POSTGAP +.I timecode +.br +.B FILE +.I string +.BR "BINARY" "|" "MOTOROLA" "|" "AIFF" "|" "WAVE" "|" "MP3" + + +.TP +.B TRACK +Required. +Starts a new track definition. The +.I number +is ignored. The +.I mode +must be one of +.BR "AUDIO" ", " "MODE1/2048" ", " "MODE1/2352" "," +.BR "MODE2/2336" " or " "MODE2/2352" "." + +.TP +.B FLAGS +Optional. +Defines the flags for this track. Must be followed by one +or more of the following commands: +.B DCP +(digital copy permitted), +.B 4CH +(four channel audio), +.B PRE +(pre-emphasis enabled) and +.B SCMS +(serial copy management system). +.B SCMS +is ignored because there is no corresponding option in +the TOC format. + +.TP +.B ISRC +Optional. +The International Standard Recording Code for this track. Must +be exactly 12 characters long. + +.TP +.B TITLE +Optional. +The CD-Text title of this track. + +.TP +.B PERFORMER +Optional. +The CD-Text performer of this track. + +.TP +.B SONWRITER +Optional. +The CD-Text songwriter of this track. + +.TP +.B PREGAP +Optional. +The length of the track pregap to be filled with zero data. +Mutually exclusive with +.BR "INDEX 0" "." + +.TP +.B POSTGAP +Optional. +The length of the track postgap to be filled with zero data. + +.TP +.B INDEX +Optional. +The +.I number +must be in the range 0 <= +.I number +<= 99. Index number 1 specifies the start of the track. Index +number 0 is the start of the track pregap filled with data +from the file, i.e. the difference between index 0 and index 1 +is the length of the pregap. Index 0 is mutually exclusive with +.BR "PREGAP" "." +Index numbers greater than 1 specify subindexes for this track +and must be sequential. + +.TP +.B FILE +Optional in track section. The syntax is the same as described +above and if it appears inside a track specification it takes +effect on the next +.B TRACK +command. + +.SH LIMITATIONS + +The command +.B CDTEXTFILE +and the flag +.B SCMS +have no equivalent in the TOC format and are ignored. + +CUE files containing data tracks which specify a starting time +greater than zero cannot be converted by +.B cue2toc +because the TOC format does not provide a way to specify a +starting time at all for data tracks. However if the CUE file +does not contain any audio tracks you can try to use the CUE file +directly with cdrdao. + + +.SH EXAMPLE + +Suppose we have the following CUE file "uwe.froehn.cue" describing +an audio CD with CD-Text data: + +.nf +.in +4m +REM Example CUE file with audio tracks +CATALOG 1234567890123 +TITLE "Der Berg ruft" +PERFORMER "Uwe Froehn" +FILE "uwe.froehn.mp3" MP3 + +TRACK 01 AUDIO + TITLE "Meine Mama ist die Beste" + PERFORMER "Uwe Froehn" + SONGWRITER "Hansi Klabuster" + REM two seconds pregap filled with audio data + INDEX 00 00:00:00 + INDEX 01 00:02:00 + REM subindexes + INDEX 02 00:35:17 + INDEX 03 01:12:44 + +TRACK 02 AUDIO + TITLE "Hoch oben im Tal" + SONGWRITER "Gabi Geil" + REM no pregap + INDEX 01 02:45:38 + +TRACK 03 AUDIO + REM pregap with zero data + PREGAP 00:4:47 + INDEX 01 07:58:74 + REM postgap with zero data + POSTGAP 00:35:00 +.in -4m +.fi + +Since cdrdao cannot decode the MP3 file on the fly this step must +be carried out by hand, e.g. using lame: + +.nf +.in +4m +lame --decode uwe.froehn.mp3 uwe.froehn.wav +.in -4m +.fi + +Although the filename appears only once in the example CUE +file it gets written for every track in the TOC file so you +would need to edit lots of occurences of the filename in the +TOC file by hand. For this reason you can specify a string +with the +.B -w +option to be used by +.B cue2toc +as the filename for all audio tracks. The command + +.nf +.in +4m +cue2toc -w uwe.froehn.wav -o uwe.froehn.toc uwe.froehn.cue +.in -4m +.fi + +should produce the file uwe.froehn.toc with the following content: + +.nf +.in +4m +CATALOG "1234567890123" +CD_DA +CD_TEXT { + LANGUAGE_MAP { + 0 : EN + } + LANGUAGE 0 { + TITLE "Der Berg ruft" + PERFORMER "Uwe Froehn" + } +} + +TRACK AUDIO + CD_TEXT { + LANGUAGE 0 { + TITLE "Meine Mama ist die Beste" + PERFORMER "Uwe Froehn" + SONGWRITER "Hansi Klabuster" + } + } + AUDIOFILE "uwe.froehn.wav" 00:00:00 02:45:38 + START 00:02:00 + INDEX 00:35:17 + INDEX 01:12:44 + +TRACK AUDIO + CD_TEXT { + LANGUAGE 0 { + TITLE "Hoch oben im Tal" + SONGWRITER "Gabi Geil" + } + } + AUDIOFILE "uwe.froehn.wav" 02:45:38 05:13:36 + +TRACK AUDIO + PREGAP 00:04:47 + AUDIOFILE "uwe.froehn.wav" 07:58:74 + SILENCE 00:35:00 +.in -4m +.fi + +.SH SEE ALSO +.BR cdrdao (1), +.BR lame (1) + +.SH BUGS + +Since +.BR "cue2toc" "'s" +definition of the CUE format is entirely based on a number +of different CUE files the author came across there is a very +high probability that it will not work correctly with all the +other CUE files you might encounter. If this is the case for +you please send the problematic CUE file along with the version +number of +.B cue2toc +to <dermatsch@gmx.de>. + + +.SH AUTHOR +Matthias Czapla <dermatsch@gmx.de> diff --git a/utils/cue2toc.c b/utils/cue2toc.c new file mode 100644 index 0000000..ce57d34 --- /dev/null +++ b/utils/cue2toc.c @@ -0,0 +1,880 @@ +/* cue2toc.c - conversion routines + * Copyright (C) 2004 Matthias Czapla <dermatsch@gmx.de> + * + * This file is part of cue2toc. + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <unistd.h> +#include <errno.h> +#include <stdarg.h> +#include "cue2toc.h" +#include "timecode.h" + +#define TCBUFLEN 9 /* Buffer length for timecode strings (HH:MM:SS) */ +#define MAXCMDLEN 10 /* Longest command (currently SONGWRITER) */ + +extern const char *progname; /* Set to argv[0] by main */ +extern int verbose; /* Set by main */ + +/* + * Input is divied into tokens that are separated by whitespace, horizantal + * tabulator, line feed and carriage return. Tokens can be either commands + * from a fixed set or strings. If a string is to contain any of the token + * delimiting characters it must be enclosed in double quotes. + */ + +static const char token_delimiter[] = { ' ', '\t', '\n', '\r' }; + +/* Return true if c is one of token_delimiter */ +static int +isdelim(int c) +{ + int i; + int n = sizeof(token_delimiter); + + for (i = 0; i < n; i++) + if (c == token_delimiter[i]) + return 1; + return 0; +} + +/* Used as return type for get_command and index into cmds */ +enum command { REM, CATALOG, CDTEXTFILE, + FILECMD, PERFORMER, SONGWRITER, TITLE, TRACK, FLAGS, DCP, + FOURCH, PRE, SCMS, ISRC, PREGAP, INDEX, POSTGAP, BINARY, + MOTOROLA, AIFF, WAVE, MP3, UNKNOWN, END }; + +/* Except the last two these are the valid CUE commands */ +char cmds[][MAXCMDLEN + 1] = { "REM", "CATALOG", "CDTEXTFILE", + "FILE", "PERFORMER", "SONGWRITER", "TITLE", "TRACK", "FLAGS", "DCP", + "4CH", "PRE", "SCMS", "ISRC", "PREGAP", "INDEX", "POSTGAP", "BINARY", + "MOTOROLA", "AIFF", "WAVE", "MP3", "UNKNOWN", "END" }; + +/* These are for error messages */ +static const char *fname = "stdin"; +static long line; /* current line number */ +static long tokenstart; /* line where last token started */ + +/* To generate meaningful error messages in check_once */ +enum scope { CUESHEET, GLOBAL, ONETRACK }; + +/* Fatal error while processing input file */ +static void +err_fail(const char *s) +{ + fprintf(stderr, "%s:%s:%ld: %s\n", progname, fname, tokenstart, s); + exit(EXIT_FAILURE); +} + +/* Fatal error */ +static void +err_fail2(const char *s) +{ + fprintf(stderr, "%s: %s\n", progname, s); + exit(EXIT_FAILURE); +} + +/* EOF while expecting more */ +static void +err_earlyend() +{ + fprintf(stderr, "%s:%s:%ld: Premature end of file\n", progname, + fname, line); + exit(EXIT_FAILURE); +} + +/* Warning. Keep on going. */ +static void +err_warn(const char *s) +{ + if (!verbose) + return; + fprintf(stderr, "%s:%s:%ld: Warning, %s\n", progname, fname, + tokenstart, s); +} + +/* Get next command from file */ +static enum command +get_command(FILE *f) +{ + int c; + char buf[MAXCMDLEN + 1]; + int i = 0; + + /* eat whitespace */ + do { + c = getc(f); + if (c == '\n') + line++; + } while (isdelim(c)); + + if (c == EOF) + return END; + + tokenstart = line; + + /* get command, transform to upper case */ + do { + buf[i++] = toupper(c); + c = getc(f); + } while (!isdelim(c) && c!= EOF && i < MAXCMDLEN); + + if (!isdelim(c)) return UNKNOWN; /* command longer than MAXCMDLEN */ + if (c == EOF) return END; + if (c == '\n') line++; + + buf[i] = '\0'; + + if (strcmp(buf, cmds[REM]) == 0) return REM; + else if (strcmp(buf, cmds[CATALOG]) == 0) return CATALOG; + else if (strcmp(buf, cmds[CDTEXTFILE]) == 0) return CDTEXTFILE; + else if (strcmp(buf, cmds[FILECMD]) == 0) return FILECMD; + else if (strcmp(buf, cmds[PERFORMER]) == 0) return PERFORMER; + else if (strcmp(buf, cmds[SONGWRITER]) == 0) return SONGWRITER; + else if (strcmp(buf, cmds[TITLE]) == 0) return TITLE; + else if (strcmp(buf, cmds[TRACK]) == 0) return TRACK; + else if (strcmp(buf, cmds[FLAGS]) == 0) return FLAGS; + else if (strcmp(buf, cmds[DCP]) == 0) return DCP; + else if (strcmp(buf, cmds[FOURCH]) == 0) return FOURCH; + else if (strcmp(buf, cmds[PRE]) == 0) return PRE; + else if (strcmp(buf, cmds[SCMS]) == 0) return SCMS; + else if (strcmp(buf, cmds[ISRC]) == 0) return ISRC; + else if (strcmp(buf, cmds[PREGAP]) == 0) return PREGAP; + else if (strcmp(buf, cmds[INDEX]) == 0) return INDEX; + else if (strcmp(buf, cmds[POSTGAP]) == 0) return POSTGAP; + else if (strcmp(buf, cmds[BINARY]) == 0) return BINARY; + else if (strcmp(buf, cmds[MOTOROLA]) == 0) return MOTOROLA; + else if (strcmp(buf, cmds[AIFF]) == 0) return AIFF; + else if (strcmp(buf, cmds[WAVE]) == 0) return WAVE; + else if (strcmp(buf, cmds[MP3]) == 0) return MP3; + else return UNKNOWN; +} + +/* Skip leading token delimiters then read at most n chars from f into s. + * Put terminating Null at the end of s. This implies that s must be + * really n + 1. Return number of characters written to s. The only case to + * return zero is on EOF before any character was read. + * Exit the program indicating failure if string is longer than n. */ +static size_t +get_string(FILE *f, char *s, size_t n) +{ + int c; + size_t i = 0; + + /* eat whitespace */ + do { + c = getc(f); + if (c == '\n') + line++; + } while (isdelim(c)); + + if (c == EOF) + return 0; + + tokenstart = line; + + if (c == '\"') { + c = getc(f); + if (c == '\n') line++; + while (c != '\"' && c != EOF && i < n) { + s[i++] = c; + c = getc(f); + if (c == '\n') line++; + } + if (i == n && c != '\"' && c != EOF) + err_fail("String too long"); + } else { + while (!isdelim(c) && c != EOF && i < n) { + s[i++] = c; + c = getc(f); + } + if (i == n && !isdelim(c) && c != EOF) + err_fail("String too long"); + } + if (i == 0) err_fail("Empty string"); + if (c == '\n') line++; + s[i] = '\0'; + + return i; +} + +/* Return track mode */ +static enum track_mode +get_track_mode(FILE *f) +{ + char buf[] = "MODE1/2048"; + char *pbuf = buf; + + if (get_string(f, buf, sizeof(buf) - 1) < 1) + err_fail("Illegal track mode"); + + /* transform to upper case */ + while (*pbuf) { + *pbuf = toupper(*pbuf); + pbuf++; + } + + if (strcmp(buf, "AUDIO") == 0) return AUDIO; + else if (strcmp(buf, "MODE1/2048") == 0) return MODE1; + else if (strcmp(buf, "MODE1/2352") == 0) return MODE1_RAW; + else if (strcmp(buf, "MODE2/2336") == 0) return MODE2; + else if (strcmp(buf, "MODE2/2352") == 0) return MODE2_RAW; + else err_fail("Unsupported track mode"); + + return AUDIO; +} + +static void check_once(enum command cmd, char *s, enum scope sc); + +/* Read at most CDTEXTLEN chars into s */ +static void +get_cdtext(FILE *f, enum command cmd, char *s, enum scope sc) +{ + check_once(cmd, s, sc); + if (get_string(f, s, CDTEXTLEN) < 1) + err_earlyend(); +} + +/* All strings have their first character initialized to '\0' so if s[0] + is not Null the cmd has already been seen in input. In this case print + a message end exit program indicating failure. The only purpose of the + arguments cmd and sc is to print meaningful error messages. */ +static void +check_once(enum command cmd, char *s, enum scope sc) +{ + if (s[0] == '\0') + return; + fprintf(stderr, "%s:%s:%ld: %s allowed only once", progname, fname, + line, cmds[cmd]); + switch (sc) { + case CUESHEET: fprintf(stderr, "\n"); break; + case GLOBAL: fprintf(stderr, " in global section\n"); break; + case ONETRACK: fprintf(stderr, " per track\n"); break; + } + exit(EXIT_FAILURE); +} + +/* If this is a data track and does not start at position zero exit the + program. The TOC format has no way to specify a data track using only a + portion past the first byte of a binary file. */ +static void +check_cutting_binary(struct trackspec *tr) +{ + if (tr->mode == AUDIO) + return; + if (tr->pregap_data_from_file) { + if (tr->pregap < tr->start) + err_fail("TOC format does not allow cutting binary " + "files. Try burning CUE file directly.\n"); + } else + if (tr->start > 0) + err_fail("TOC format does not allow cutting binary " + "files. Try burning CUE file directly.\n"); +} + +/* Allocate, initialize and return new track */ +static struct trackspec* +new_track(void) +{ + struct trackspec *track; + int i; + + if ((track = (struct trackspec*) malloc(sizeof(struct trackspec))) + == NULL) + err_fail("Memory allocation error in new_track()"); + + track->copy = track->pre_emphasis = track->four_channel_audio + = track->pregap_data_from_file = 0; + track->isrc[0] = track->title[0] = track->performer[0] + = track->songwriter[0] = track->filename[0] = '\0'; + track->pregap = track->start = track->postgap = -1; + + for (i = 0; i < NUM_OF_INDEXES; i++) + track->indexes[i] = -1; + track->next = NULL; + + return track; +} + +/* Read the cuefile and return a pointer to the cuesheet */ +struct cuesheet* +read_cue(const char *cuefile, const char *wavefile) +{ + FILE *f; + enum command cmd; + struct cuesheet *cs = NULL; + struct trackspec *track = NULL; + size_t n; + int c; + char file[FILENAMELEN + 1]; + enum command filetype = UNKNOWN; + char timecode_buffer[TCBUFLEN]; + char devnull[FILENAMELEN + 1]; /* just for eating CDTEXTFILE arg */ + + if (NULL == cuefile) { + f = stdin; + } else if (NULL == (f = fopen(cuefile, "r"))) { + fprintf(stderr, "%s: Could not open file \"%s\" for " + "reading: %s\n", progname, cuefile, strerror(errno)); + exit(EXIT_FAILURE); + } + if (cuefile) + fname = cuefile; + + if ((cs = (struct cuesheet*) malloc(sizeof(struct cuesheet))) == NULL) + err_fail("Memory allocation error in read_cue()"); + + cs->catalog[0] = '\0'; + cs->type = 0; + cs->title[0] = '\0'; + cs->performer[0] = '\0'; + cs->songwriter[0] = '\0'; + cs->tracklist = NULL; + + file[0] = '\0'; + line = 1; + + /* global section */ + while ((cmd = get_command(f)) != TRACK) { + switch (cmd) { + case UNKNOWN: + err_fail("Unknown command"); + case END: + err_earlyend(); + case REM: + c = getc(f); + while (c != '\n' && c != EOF) + c = getc(f); + break; + case CDTEXTFILE: + err_warn("ignoring CDTEXTFILE..."); + if (get_string(f, devnull, FILENAMELEN) == 0) + err_warn("Syntactically incorrect " + "CDTEXTFILE command. But who " + "cares..."); + break; + case CATALOG: + check_once(CATALOG, cs->catalog, CUESHEET); + n = get_string(f, cs->catalog, 13); + if (n != 13) + err_fail("Catalog number must be 13 " + "characters long"); + break; + case TITLE: + get_cdtext(f, TITLE, cs->title, GLOBAL); + break; + case PERFORMER: + get_cdtext(f, PERFORMER, cs->performer, GLOBAL); + break; + case SONGWRITER: + get_cdtext(f, SONGWRITER, cs->songwriter, GLOBAL); + break; + case FILECMD: + check_once(FILECMD, file, GLOBAL); + if (get_string(f, file, FILENAMELEN) < 1) + err_earlyend(); + + switch (cmd = get_command(f)) { + case MOTOROLA: + err_warn("big endian binary file"); + case BINARY: + filetype = BINARY; break; + case AIFF: case MP3: + err_warn("AIFF and MP3 not supported by " + "cdrdao"); + case WAVE: + if (wavefile) { + strncpy(file, wavefile, FILENAMELEN); + file[FILENAMELEN] = '\0'; + } + filetype = WAVE; break; + default: + err_fail("Unsupported file type"); + } + break; + default: + err_fail("Command not allowed in global section"); + break; + } + + } + + /* leaving global section, entering track specifications */ + if (file[0] == '\0') + err_fail("TRACK without previous FILE"); + + while (cmd != END) { + switch(cmd) { + case UNKNOWN: + err_fail("Unknown command"); + case REM: + c = getc(f); + while (c != '\n' && c != EOF) + c = getc(f); + break; + case TRACK: + if (track == NULL) /* first track */ + cs->tracklist = track = new_track(); + else { + check_cutting_binary(track); + track = track->next = new_track(); + } + + /* the CUE format is "TRACK nn MODE" but we are not + interested in the track number */ + while (isdelim(c = getc(f))) + if (c == '\n') line++; + while (!isdelim(c = getc(f))) ; + if (c == '\n') line++; + + track->mode = get_track_mode(f); + + /* audio tracks with binary files seem quite common */ + /* + if (track->mode == AUDIO && filetype == BINARY + || track->mode != AUDIO && filetype == WAVE) + err_fail("File and track type mismatch"); + */ + + strcpy(track->filename, file); + break; + case TITLE: + get_cdtext(f, TITLE, track->title, ONETRACK); + break; + case PERFORMER: + get_cdtext(f, PERFORMER, track->performer, ONETRACK); + break; + case SONGWRITER: + get_cdtext(f, SONGWRITER, track->songwriter, ONETRACK); + break; + case ISRC: + check_once(ISRC, track->isrc, ONETRACK); + if (get_string(f, track->isrc, 12) != 12) + err_fail("ISRC must be 12 characters long"); + break; + case FLAGS: + if (track->copy || track->pre_emphasis + || track->four_channel_audio) + err_fail("FLAGS allowed only once per track"); + + /* get the flags */ + cmd = get_command(f); + while (cmd == DCP || cmd == FOURCH || cmd == PRE + || cmd == SCMS) { + switch (cmd) { + case DCP: + track->copy = 1; break; + case FOURCH: + track->four_channel_audio = 1; break; + case PRE: + track->pre_emphasis = 1; break; + case SCMS: + err_warn("serial copy management " + "system flag not supported " + "by cdrdao"); break; + default: + err_fail("Should not get here"); + } + cmd = get_command(f); + } + /* current non-FLAG command is already in cmd, so + avoid get_command() call below */ + continue; break; + case PREGAP: + if (track->pregap != -1) + err_fail("PREGAP allowed only once per track"); + if (get_string(f, timecode_buffer, TCBUFLEN - 1) < 1) + err_earlyend(); + track->pregap = tc2fr(timecode_buffer); + if (track->pregap == -1) + err_fail("Timecode out of range"); + track->pregap_data_from_file = 0; + break; + case POSTGAP: + if (track->postgap != -1) + err_fail("POSTGAP allowed only once per track"); + if (get_string(f, timecode_buffer, TCBUFLEN - 1) < 1) + err_earlyend(); + track->postgap = tc2fr(timecode_buffer); + if (track->postgap == -1) + err_fail("Timecode out of range"); + break; + case INDEX: + if (get_string(f, timecode_buffer, 2) < 1) + err_earlyend(); + n = atoi(timecode_buffer); + if (n < 0 || n > 99) + err_fail("Index out of range"); + + /* Index 0 is track pregap and Index 1 is start + of track. Index 2 to 99 are the true subindexes + and only allowed if the preceding one was there + before */ + switch (n) { + case 0: + if (track->start != -1) + err_fail("Indexes must be sequential"); + if (track->pregap != -1) + err_fail("PREGAP allowed only once " + "per track"); + if (get_string(f, timecode_buffer, + TCBUFLEN - 1) < 1) + err_earlyend(); + /* This is only a temporary value until + index 01 is read */ + track->pregap = tc2fr(timecode_buffer); + if (track->pregap == -1) + err_fail("Timecode out of range"); + track->pregap_data_from_file = 1; + break; + case 1: + if (track->start != -1) + err_fail("Each index allowed only " + "once per track"); + if (get_string(f, timecode_buffer, + TCBUFLEN - 1) < 1) + err_fail("Missing timecode"); + track->start = tc2fr(timecode_buffer); + if (track->start == -1) + err_fail("Timecode out of range"); + /* Fix the pregap value */ + if (track->pregap_data_from_file) + track->pregap = track->start + - track->pregap; + break; + case 2: + if (track->start == -1) + err_fail("Indexes must be sequential"); + if (track->indexes[n - 2] != -1) + err_fail("Each index allowed only " + "once per track"); + if (get_string(f, timecode_buffer, + TCBUFLEN - 1) < 1) + err_fail("Missing timecode"); + track->indexes[n - 2] = tc2fr(timecode_buffer); + if (track->indexes[n - 2] == -1) + err_fail("Timecode out of range"); + break; + default: /* the other 97 indexes */ + /* check if previous index is there */ + if (track->indexes[n - 3] == -1) + err_fail("Indexes must be sequential"); + if (track->indexes[n - 2] != -1) + err_fail("Each index allowed only " + "once per track"); + if (get_string(f, timecode_buffer, + TCBUFLEN - 1) < 1) + err_fail("Missing timecode"); + track->indexes[n - 2] = tc2fr(timecode_buffer); + if (track->indexes[n - 2] == -1) + err_fail("Timecode out of range"); + break; + } + break; + case FILECMD: + if (get_string(f, file, FILENAMELEN) < 1) + err_earlyend(); + + switch (cmd = get_command(f)) { + case MOTOROLA: + err_warn("big endian binary file"); + case BINARY: + filetype = BINARY; break; + case AIFF: case MP3: + err_warn("AIFF and MP3 not supported by " + "cdrdao"); + case WAVE: + if (wavefile) { + strncpy(file, wavefile, FILENAMELEN); + file[FILENAMELEN] = '\0'; + } + filetype = WAVE; break; + default: + err_fail("Unsupported file type"); + } + break; + default: + err_fail("Command not allowed in track spec"); + break; + } + + cmd = get_command(f); + } + + check_cutting_binary(track); + + return cs; +} + +/* Deduce the disc session type from the track modes */ +static enum session_type +determine_session_type(struct trackspec *list) +{ + struct trackspec *track = list; + /* set to true if track of corresponding type is found */ + int audio = 0; + int mode1 = 0; + int mode2 = 0; + + while (track != NULL) { + switch (track->mode) { + case AUDIO: + audio = 1; break; + case MODE1: case MODE1_RAW: + mode1 = 1; break; + case MODE2: case MODE2_RAW: + mode2 = 1; break; + default: /* should never get here */ + err_fail2("Dont know how this could happen, but here " + "is a track with an unknown mode :|"); + } + track = track->next; + } + + /* CD_DA only audio + * CD_ROM only mode1 with or without audio + * CD_ROM_XA only mode2 with or without audio + */ + if (audio && !mode1 && !mode2) + return CD_DA; + else if ((audio && mode1 && !mode2) || (!audio && mode1 && !mode2)) + return CD_ROM; + else if ((audio && !mode1 && mode2) || (!audio && !mode1 && mode2)) + return CD_ROM_XA; + else + return INVALID; +} + +/* Return true if cuesheet contains any CD-Text data */ +static int +contains_cdtext(struct cuesheet *cs) +{ + struct trackspec *track = cs->tracklist; + + if (cs->title[0] != '\0' || cs->performer[0] != '\0' + || cs->songwriter[0] != '\0') + return 1; + + while (track) { + if (track->title[0] != '\0' || track->performer[0] != '\0' + || track->songwriter[0] != '\0') + return 1; + track = track->next; + } + + return 0; +} + +/* fprintf() with indentation. The argument indent is the number of spaces + to print per level. E.g. with indent=4 and level=3 there are 12 spaces + printed. Every eight spaces are replaced by a single tabulator. The + return value is the return value of fprintf(). */ +static int +ifprintf(FILE *f, int indent, int level, const char *format, ...) +{ + va_list ap; + int fprintf_return = 0; + int tabs = indent * level / 8; + int spaces = indent * level % 8; + int i; + + for (i = 0; i < tabs; i++) + fputc('\t', f); + for (i = 0; i < spaces; i++) + fputc(' ', f); + + va_start(ap, format); + fprintf_return = vfprintf(f, format, ap); + va_end(ap); + + return fprintf_return; +} + +/* Write a track to the file f. The arguments i and l are the indentation + amount and level (see ifprintf above). Do not write CD-Text data if + cdtext is zero. */ +static void +write_track(struct trackspec *tr, FILE *f, int i, int l, int cdtext) +{ + char timecode_buffer[TCBUFLEN]; + long start = 0, len = 0; + int j = 0; + + fprintf(f, "\n"); + ifprintf(f, i, l++, "TRACK "); + switch(tr->mode) { + case AUDIO: fprintf(f, "AUDIO\n"); break; + case MODE1: fprintf(f, "MODE1\n"); break; + case MODE1_RAW: fprintf(f, "MODE1_RAW\n"); break; + case MODE2: fprintf(f, "MODE2\n"); break; + case MODE2_RAW: fprintf(f, "MODE2_RAW\n"); break; + default: err_fail2("Unknown track mode"); /* cant get here */ + } + + /* Flags and ISRC */ + if (tr->copy) + ifprintf(f, i, l, "COPY\n"); + if (tr->pre_emphasis) + ifprintf(f, i, l, "PRE_EMPHASIS\n"); + if (tr->four_channel_audio) + ifprintf(f, i, l, "FOUR_CHANNEL_AUDIO\n"); + if (tr->isrc[0] != '\0') + ifprintf(f, i, l, "ISRC \"%s\"\n", tr->isrc); + + /* CD-Text data */ + if (cdtext && (tr->title[0] != '\0' || tr->performer[0] != '\0' + || tr->songwriter[0] != '\0')) { + ifprintf(f, i, l++, "CD_TEXT {\n"); + ifprintf(f, i, l++, "LANGUAGE 0 {\n"); + if (tr->title[0] != '\0') + ifprintf(f, i, l, "TITLE \"%s\"\n", tr->title); + if (tr->performer[0] != '\0') + ifprintf(f, i, l, "PERFORMER \"%s\"\n", tr->performer); + if (tr->songwriter[0] != '\0') + ifprintf(f, i, l, "SONGWRITER \"%s\"\n", + tr->songwriter); + ifprintf(f, i, --l, "}\n"); /* LANGUAGE 0 { */ + ifprintf(f, i, --l, "}\n"); /* CD_TEXT { */ + } + + /* Pregap with zero data */ + if (tr->pregap != -1 && !tr->pregap_data_from_file) { + if (fr2tc(timecode_buffer, tr->pregap) == -1) + err_fail2("Pregap out of range"); + ifprintf(f, i, l, "PREGAP %s\n", timecode_buffer); + } + + /* Specify the file */ + start = 0; + if (tr->mode == AUDIO) { + ifprintf(f, i, l, "AUDIOFILE \"%s\" ", tr->filename); + if (tr->start != -1) { + if (tr->pregap_data_from_file) { + start = tr->start - tr->pregap; + } else + start = tr->start; + } + if (fr2tc(timecode_buffer, start) == -1) + err_fail2("Track start out of range"); + fprintf(f, "%s", timecode_buffer); + } else + ifprintf(f, i, l, "DATAFILE \"%s\"", tr->filename); + + /* If next track has the same filename and specified a start + value use the difference between start of this and start of + the next track as the length of the current track */ + if (tr->next + && strcmp(tr->filename, tr->next->filename) == 0 + && tr->next->start != -1) { + if (tr->next->pregap_data_from_file) + len = tr->next->start - tr->next->pregap + - start; + else + len = tr->next->start - start; + if (fr2tc(timecode_buffer, len) == -1) + err_fail2("Track length out of range"); + fprintf(f, " %s\n", timecode_buffer); + } else + fprintf(f, "\n"); + + /* Pregap with data from file */ + if (tr->pregap_data_from_file) { + if (fr2tc(timecode_buffer, tr->pregap) == -1) + err_fail2("Pregap out of range"); + ifprintf(f, i, l, "START %s\n", timecode_buffer); + } + + /* Postgap */ + if (tr->postgap != -1) { + if (fr2tc(timecode_buffer, tr->postgap) == -1) + err_fail2("Postgap out of range"); + if (tr->mode == AUDIO) + ifprintf(f, i, l, "SILENCE %s\n", timecode_buffer); + else + ifprintf(f, i, l, "ZERO %s\n", timecode_buffer); + } + + /* Indexes */ + while (tr->indexes[j] != -1 && i < NUM_OF_INDEXES) { + if (fr2tc(timecode_buffer, tr->indexes[j++]) == -1) + err_fail2("Index out of range"); + ifprintf(f, i, l, "INDEX %s\n", timecode_buffer); + } + +} + +/* Write the cuesheet cs to the file named in tocfile. If tocfile is NULL + write to stdout. Do not write CD-Text data if cdt is zero. */ +void +write_toc(const char *tocfile, struct cuesheet *cs, int cdt) +{ + FILE *f = stdout; + int i = 4; /* number of chars for indentation */ + int l = 0; /* current leven of indentation */ + int cdtext = contains_cdtext(cs) && cdt; + struct trackspec *track = cs->tracklist; + + if (tocfile != NULL) + if ((f = fopen(tocfile, "w")) == NULL) { + fprintf(stderr, "%s: Could not open file \"%s\" for " + "writing: %s\n", progname, tocfile, strerror(errno)); + exit(EXIT_FAILURE); + } + + if ((cs->type = determine_session_type(cs->tracklist)) == INVALID) + err_fail2("Invalid combination of track modes"); + + ifprintf(f, i, l, "// Generated by cue2toc 0.2\n"); + ifprintf(f, i, l, "// Report bugs to <dermatsch@gmx.de>\n"); + + if (cs->catalog[0] != '\0') + ifprintf(f, i, l, "CATALOG \"%s\"\n", cs->catalog); + + switch (cs->type) { + case CD_DA: ifprintf(f, i, l, "CD_DA\n"); break; + case CD_ROM: ifprintf(f, i, l, "CD_ROM\n"); break; + case CD_ROM_XA: ifprintf(f, i, l, "CD_ROM_XA\n"); break; + default: err_fail2("Should never get here"); + } + + if (cdtext) { + ifprintf(f, i, l++, "CD_TEXT {\n"); + ifprintf(f, i, l++, "LANGUAGE_MAP {\n"); + ifprintf(f, i, l, "0 : EN\n"); + ifprintf(f, i, --l, "}\n"); + ifprintf(f, i, l++, "LANGUAGE 0 {\n"); + if (cs->title[0] != '\0') + ifprintf(f, i, l, "TITLE \"%s\"\n", cs->title); + if (cs->performer[0] != '\0') + ifprintf(f, i, l, "PERFORMER \"%s\"\n", cs->performer); + if (cs->songwriter[0] != '\0') + ifprintf(f, i, l, "SONGWRITER \"%s\"\n", + cs->songwriter); + ifprintf(f, i, --l, "}\n"); + ifprintf(f, i, --l, "}\n"); + } + + while (track) { + write_track(track, f, i, l, cdtext); + track = track->next; + } +} diff --git a/utils/cue2toc.h b/utils/cue2toc.h new file mode 100644 index 0000000..50a3617 --- /dev/null +++ b/utils/cue2toc.h @@ -0,0 +1,73 @@ +/* cue2toc.h - declarations for conversion routines + * Copyright (C) 2004 Matthias Czapla <dermatsch@gmx.de> + * + * This file is part of cue2toc. + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +/* Maximum length of the FILEname */ +#define FILENAMELEN 1024 +/* Number of characters allowed per CD-Text entry (w/o termin. Null) */ +#define CDTEXTLEN 80 + +/* Index can be 0 to 99, but 0 and 1 are pre-gap and track start + respectively, so 98 are left */ +#define NUM_OF_INDEXES 98 + +enum session_type { + CD_DA = 1, /* only audio tracks */ + CD_ROM, /* mode1 [and audio] */ + CD_ROM_XA, /* mode2 form1 or mode2 form2 [and audio] */ + INVALID /* invalid mixture of track modes */ +}; + +enum track_mode { /* corresponding TRACK types in CUE format: */ + AUDIO = 1, /* AUDIO (2352) */ + MODE1, /* MODE1/2048 */ + MODE1_RAW, /* MODE1/2352 */ + MODE2, /* MODE2/2336 */ + MODE2_RAW /* MODE2/2352 */ +}; + +struct trackspec { + enum track_mode mode; + int copy; /* boolean */ + int pre_emphasis; /* boolean */ + int four_channel_audio; /* boolean */ + char isrc[13]; + char title[CDTEXTLEN + 1]; + char performer[CDTEXTLEN + 1]; + char songwriter[CDTEXTLEN + 1]; + char filename[FILENAMELEN + 1];; + long pregap; /* Pre-gap in frames */ + int pregap_data_from_file; /* boolean */ + long start; /* track start in frames */ + long postgap; /* Post-gap in frames */ + long indexes[NUM_OF_INDEXES]; /* indexes in frames */ + struct trackspec *next; +}; + +struct cuesheet { + char catalog[14]; + enum session_type type; + char title[CDTEXTLEN + 1]; + char performer[CDTEXTLEN + 1]; + char songwriter[CDTEXTLEN + 1]; + struct trackspec *tracklist; +}; + +struct cuesheet *read_cue(const char*, const char*); +void write_toc(const char *, struct cuesheet*, int); diff --git a/utils/main.c b/utils/main.c new file mode 100644 index 0000000..0faa216 --- /dev/null +++ b/utils/main.c @@ -0,0 +1,116 @@ +/* main.c - handle command line arguments + * Copyright (C) 2004 Matthias Czapla <dermatsch@gmx.de> + * + * This file is part of cue2toc. + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <config.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include <string.h> +#include <errno.h> +#include "cue2toc.h" + +const char *progname = NULL; +int verbose; +void usage(void); + +int +main(int argc, char *argv[]) +{ + char *wavefile = NULL; + char *outfile = NULL; + char *infile = NULL; + int nocdtext = 0; + int c; + + struct cuesheet *cs; + + progname = argv[0]; + verbose = 1; + opterr = 0; /* we do error msgs ourselves */ + while ((c = getopt(argc, argv, ":hno:qvw:")) != -1) + switch (c) { + case 'h': + usage(); + exit(EXIT_SUCCESS); + break; + case 'n': + nocdtext = 1; + break; + case 'o': + if (strcmp(optarg, "-") == 0) + outfile = NULL; /* use stdout */ + else + outfile = optarg; + break; + case 'q': + verbose = 0; + break; + case 'v': + printf("cue2toc 0.2\n"); + printf("Report bugs to <dermatsch@gmx.de>\n"); + exit(EXIT_SUCCESS); + break; + case 'w': + wavefile = optarg; + break; + case ':': + fprintf(stderr, "%s: option requires an argument -- " + "%c\n", argv[0], optopt); + exit(EXIT_FAILURE); + case '?': + fprintf(stderr, "%s: illegal option -- %c\n", + argv[0], optopt); + exit(EXIT_FAILURE); + } + + switch(argc - optind) { + case 0: + infile = NULL; /* use stdin */ + break; + case 1: + if (strcmp(argv[optind], "-") == 0) + infile = NULL; /* use stdin */ + else + infile = argv[optind]; + break; + default: + fprintf(stderr, "%s: bad number of arguments\n", + progname); + exit(EXIT_FAILURE); + } + + cs = read_cue(infile, wavefile); + write_toc(outfile, cs, nocdtext ? 0 : 1); + + return EXIT_SUCCESS; +} + +void +usage(void) +{ + printf("Usage: %s [-hnqv] [-o tocfile] [-w wavefile] [cuefile]\n", + progname); + printf(" -h\t\tdisplay this help message\n"); + printf(" -n\t\tdo not write CD-Text information\n"); + printf(" -o tocfile\twrite output to tocfile\n"); + printf(" -q\t\tquiet mode\n"); + printf(" -v\t\tdisplay version information\n"); + printf(" -w wavefile\tname of WAVE file to be used in tocfile\n"); +} diff --git a/utils/timecode.c b/utils/timecode.c new file mode 100644 index 0000000..afde779 --- /dev/null +++ b/utils/timecode.c @@ -0,0 +1,149 @@ +/* timecode.c - timecode conversion routines + * Copyright (C) 2004 Matthias Czapla <dermatsch@gmx.de> + * + * This file is part of cue2toc. + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> + +#define MAXDIGITS 2 +#define NUMOFNUMS 3 + + +/* Interpret argument as timecode value ("MM:SS:FF") and return the total + number of frames. Tries to work in a way similar to atoi(), ignoring any + trailing non-timecode junk. Skips leading whitespace. + I want it to be as flexible as possible, recognizing simple values like + "0" (interpreted as "00:00:00"), "1:2" ("00:01:02") and so on. + Returns -1 on error (argument NULL or some value out of range) */ + +long +tc2fr(const char *tc) +{ + int minutes = 0; + int seconds = 0; + int frames = 0; + long totalframes = 0; + + char tmp[MAXDIGITS + 1]; + int nums[NUMOFNUMS]; + int n = 0; + int i = 0; + int last_was_colon = 0; + int stop = 0; + + if (tc == NULL) + return -1; + + for (i = 0; i <= MAXDIGITS; i++) + tmp[i] = '\0'; + + while (isspace(*tc)) + tc++; + + for (n = 0; n < NUMOFNUMS; n++) { + if (n > 0) { + if (tc[0] != ':') { + --n; + break; + } else + tc++; + } + + for (i = 0; i < MAXDIGITS; i++) { + + if (isdigit(tc[i])) { + tmp[i] = tc[i]; + last_was_colon = 0; + } else if (tc[i] == ':') { + if (i == 0) + stop = 1; + break; + } else { + stop = 1; + break; + } + } + + if (i != 0) { + tmp[i] = '\0'; + nums[n] = atoi(tmp); + tc = &tc[i]; + } else + --n; + + if (stop) + break; + } + + if (n == NUMOFNUMS) + --n; + + frames = seconds = minutes = 0; + + switch (n) { + case 0: + frames = nums[0]; + break; + case 1: + seconds = nums[0]; + frames = nums[1]; + break; + case 2: + minutes = nums[0]; + seconds = nums[1]; + frames = nums[2]; + break; + } + + totalframes = ((60 * minutes) + seconds) * 75 + frames; + + if (seconds > 59 || frames > 74) + return -1; + + return totalframes; +} + + +/* Writes formatted timecode string ("MM:SS:FF") into tc, calculated from + frame number fr. + Returns -1 on error (frames value out of range) */ + +int +fr2tc(char *tc, long fr) +{ + int m; + int s; + int f; + + if (fr > 449999 || fr < 0) { /* 99:59:74 */ + strcpy(tc, "00:00:00"); + return -1; + } + + f = fr % 75; + fr -= f; + s = (fr / 75) % 60; + fr -= s * 75; + m = fr / 75 / 60; + + sprintf(tc, "%02d:%02d:%02d", m, s, f); + return 0; +} diff --git a/utils/timecode.h b/utils/timecode.h new file mode 100644 index 0000000..84ab0c8 --- /dev/null +++ b/utils/timecode.h @@ -0,0 +1,22 @@ +/* timecode.h - declarations for timecode conversion routines + * Copyright (C) 2004 Matthias Czapla <dermatsch@gmx.de> + * + * This file is part of cue2toc. + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +long tc2fr(const char *); +int fr2tc(char *, long fr); diff --git a/utils/toc2cddb.1 b/utils/toc2cddb.1 new file mode 100644 index 0000000..40e7597 --- /dev/null +++ b/utils/toc2cddb.1 @@ -0,0 +1,38 @@ +.TH "TOC2CDDB" "1" "2006-11-17" "1.2.2" "CDRDAO" + +.SH "NAME" +toc2cddb \- translates a TOC file of +.I cdrdao(1) +into a cddb file and prints it to stdout + +.SH "SYNOPSIS" +.B toc2cddb +.I toc_file +.PP +.B toc2cddb +.BR [\| \-h \||\| \-V \|] + +.SH "DESCRIPTION" +.B toc2cddb +translates a TOC file of +.I cdrdao(1) +into a cddb file and prints it to stdout. + +.SH "OPTIONS" +.TP +.B \-h +Shows a short help message. +.TP +.B \-V +Prints the version of toc2cddb. + +.SH "SEE ALSO" +.I cdrdao(1) + +.SH "AUTHOR" +.B toc2cddb +was written by Giuseppe "Cowo" Corbelli <cowo@lugbs.linux.it> and is part of +.I cdrdao(1) +written by Andreas Mueller <andreas@daneb.de>. +.PP +This manual page was written by Francois Wendling <frwendling@free.fr> and revised by Daniel Baumann <daniel@debian.org>, for the Debian project (but may be used by others). diff --git a/utils/toc2cddb.cc b/utils/toc2cddb.cc new file mode 100644 index 0000000..d493b8f --- /dev/null +++ b/utils/toc2cddb.cc @@ -0,0 +1,245 @@ +/* toc2cddb - translates a TOC file into a cddb file + * I use it to print covers for self-made CD-TEXT audio CDs + * coupled with disc-cover (http://www.liacs.nl/~jvhemert/disc-cover) + * + * Cdrdao + * Copyright (C) 2002 Andreas Mueller <andreas@daneb.de> + * Toc2cddb + * Copyright (C) 2003 Giuseppe "Cowo" Corbelli <cowo@lugbs.linux.it> + * Parts by Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#include <config.h> +#include <stdio.h> +#include <string.h> +#include <unistd.h> +#include <stdlib.h> +#include <stdarg.h> +#ifdef HAVE_GETOPT_H +#include <getopt.h> +#endif +#include <string> +#include "util.h" +#include "Toc.h" + +#define FRAME_OFFSET 150 +#define FRAMES_PER_SECOND 75 + +using namespace std; + +static int VERBOSE = 1; + +static unsigned int cddbSum(unsigned int n); +const char *calcCddbId(const Toc *toc); +void message_args(int level, int addNewLine, const char *fmt, va_list args); +void message(int level, const char *fmt, ...); + +static void printVersion() { + message (1, "toc2cddb version %s - (C) Giuseppe \"Cowo\" Corbelli <cowo@lugbs.linux.it>", VERSION); + message (1, "Is a part of cdrdao - (C) Andreas Mueller <andreas@daneb.de>"); +} +static void printUsage() { + message (0, "toc2cddb converts a cdrdao TOC file into a cddb file and prints it to stdout."); + message (0, "Usage: toc2cddb {-V | -h | toc-file}"); +} + +int main (int argc, char *argv[]) { + const char *tocFile = NULL; + Toc *toc = NULL; + const Track *track = NULL; + int cdTextLanguage = 0; + int c = 0; + + while ((c = getopt(argc, argv, "Vh")) != EOF) { + switch (c) { + case 'V': + printVersion (); + exit (EXIT_SUCCESS); + case 'h': + printUsage (); + exit (EXIT_SUCCESS); + case '?': + message(-2, "Invalid option: %c", optopt); + exit (EXIT_FAILURE); + } + } + if (optind < argc) { + tocFile = strdupCC(argv[optind]); + optind++; + } else { + message(-2, "Missing toc-file name."); + printUsage (); + exit (EXIT_FAILURE); + } + if (optind != argc) { + message(-2, "More arguments than expected."); + printUsage (); + exit (EXIT_FAILURE); + } + + if ((toc = Toc::read(tocFile)) == NULL) + message(-10, "Failed to read toc-file '%s'.", tocFile); + + if (toc->tocType () != Toc::CD_DA) + message (-10, "Toc does not refer to a CDDA"); + + int ntracks = toc->nofTracks (); + if (ntracks < 1) + message (-10, "Wrong no. of tracks: %d. Expected >= 0.", ntracks); + + cout << "# xmcd\n#\n# Track frame offsets:\n#" << endl; + + { + TrackIterator titr (toc); + Msf start, end; + for (track=titr.first (start, end); track != NULL; track=titr.next (start,end)) + cout << "# " << start.lba()+FRAME_OFFSET << endl; + + int seconds = (end.min () * 60) + end.sec () + (FRAME_OFFSET/FRAMES_PER_SECOND); + cout << "#\n# Disc length: " << seconds << " seconds\n#" << endl; + } + + cout << "# Revision: 0\n# Submitted via: cdrdao-" << VERSION << endl; + cout << "DISCID=" << calcCddbId (toc) << endl; + + { + const CdTextItem *cdTextItem = NULL; + string album(""), albumPerformer(""), genre(""); + + if ((cdTextItem = toc->getCdTextItem(0, cdTextLanguage, CdTextItem::CDTEXT_TITLE)) != NULL) + album = (const char*)cdTextItem->data(); + + if ((cdTextItem = toc->getCdTextItem(0, cdTextLanguage, CdTextItem::CDTEXT_PERFORMER)) != NULL) + albumPerformer = (const char*)cdTextItem->data(); + + cout << "DTITLE=" << albumPerformer << " / " << album << endl; + cout << "DYEAR=" << endl; + + if ((cdTextItem = toc->getCdTextItem(0, cdTextLanguage, CdTextItem::CDTEXT_GENRE)) != NULL) + genre = (const char*)cdTextItem->data(); + + cout << "DGENRE=" << genre << endl; + + string title(""); + for (int i = 1; i <= ntracks; i++) { + if ((cdTextItem = toc->getCdTextItem(i, cdTextLanguage, CdTextItem::CDTEXT_TITLE)) != NULL) + title = (const char*)cdTextItem->data(); + cout << "TTITLE" << i-1 << "=" << title << endl; + } + } + + // Don't know what EXTD means, nor EXTT + cout << "EXTD=" << endl; + for (int i = 1; i <= ntracks; i++) + cout << "EXTT" << i-1 << "=" << endl; + + cout << "PLAYORDER=" << endl; + + delete[] tocFile; + exit (EXIT_SUCCESS); +} + +static unsigned int cddbSum(unsigned int n) +{ + unsigned int ret; + + ret = 0; + while (n > 0) { + ret += (n % 10); + n /= 10; + } + + return ret; +} + +const char *calcCddbId(const Toc *toc) +{ + const Track *t; + Msf start, end; + unsigned int n = 0; + unsigned int o = 0; + int tcount = 0; + static char buf[20]; + unsigned long id; + + TrackIterator itr(toc); + + for (t = itr.first(start, end); t != NULL; t = itr.next(start, end)) { + if (t->type() == TrackData::AUDIO) { + n += cddbSum(start.min() * 60 + start.sec() + 2/* gap offset */); + o = end.min() * 60 + end.sec(); + tcount++; + } + } + + id = (n % 0xff) << 24 | o << 8 | tcount; + sprintf(buf, "%08lx", id); + + return buf; +} + +void message_args(int level, int addNewLine, const char *fmt, va_list args) +{ + long len = strlen(fmt); + char last = len > 0 ? fmt[len - 1] : 0; + + if (level < 0) { + switch (level) { + case -1: + fprintf(stderr, "WARNING: "); + break; + case -2: + fprintf(stderr, "ERROR: "); + break; + case -3: + fprintf(stderr, "INTERNAL ERROR: "); + break; + default: + fprintf(stderr, "FATAL ERROR: "); + break; + } + vfprintf(stderr, fmt, args); + if (addNewLine) { + if (last != ' ' && last != '\r') + fprintf(stderr, "\n"); + } + + fflush(stderr); + if (level <= -10) + exit(1); + } + else if (level <= VERBOSE) { + vfprintf(stderr, fmt, args); + + if (addNewLine) { + if (last != ' ' && last != '\r') + fprintf(stderr, "\n"); + } + + fflush(stderr); + } +} + +void message(int level, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + + message_args(level, 1, fmt, args); + + va_end(args); +} diff --git a/utils/toc2cue.1 b/utils/toc2cue.1 new file mode 100644 index 0000000..7dd2926 --- /dev/null +++ b/utils/toc2cue.1 @@ -0,0 +1,45 @@ +.TH "TOC2CUE" "1" "2006-11-17" "1.2.2" "CDRDAO" + +.SH "NAME" +toc2cue \- converts a TOC files of +.I cdrdao(1) +into a .cue file + +.SH "SYNOPSIS" +.B toc2cue +.BR [\| \-v +.IB verbosity_level \|] +.I input_toc_file output_cue_file +.PP +.B toc2cue +.BR [\| \-V \|] + +.SH "DESCRIPTION" +.B toc2cue +converts a TOC file of +.I cdrdao(1) +into a .cue file. + +Please note that the resulting cue file is only valid if the toc-file was created with +.I cdrdao(1) +using the commands 'read-toc' or 'read-cd'. For manually created or edited toc-files the cue file may not be correct. This program just checks for the most obvious toc-file features that cannot be converted to a cue file. Furthermore, if the toc-file contains audio tracks the byte order of the image file will be wrong. This will result in static noise when the cue file is used for recording (even with +.I cdrdao(1) +itself). + +.SH "OPTIONS" +.TP +.BI "\-v " verbosity_level +Sets the verbosity level to use, can be a integer between 1 and 3. By default, only fatal errors are displayed. A verbosity level of 1 shows warnings, 2 warnings and errors, 3 warnings, errors and internal errors. +.TP +.B \-V +Prints the version of toc2cue. + +.SH "SEE ALSO" +.I cdrdao(1) + +.SH "AUTHOR" +.B toc2cue +was written by Andreas Mueller <andreas@daneb.de> and is part of +.I cdrdao(1). +.PP +This manual page was written by Francois Wendling <frwendling@free.fr> and revised by Daniel Baumann <daniel@debian.org>, for the Debian project (but may be used by others). diff --git a/utils/toc2cue.cc b/utils/toc2cue.cc new file mode 100644 index 0000000..81901cb --- /dev/null +++ b/utils/toc2cue.cc @@ -0,0 +1,373 @@ +/* toc2cue - converts cdrdao's toc-files to .cue files + * + * Copyright (C) 2001 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> +#include <stdarg.h> +#ifdef HAVE_GETOPT_H +#include <getopt.h> +#endif +#include <fstream> + +#include "util.h" +#include "Toc.h" + +static const char *PRGNAME = NULL; +static int VERBOSE = 1; + +void message(int level, const char *fmt, ...) +{ + long len = strlen(fmt); + char last = len > 0 ? fmt[len - 1] : 0; + + va_list args; + va_start(args, fmt); + + if (level < 0) { + switch (level) { + case -1: + fprintf(stderr, "WARNING: "); + break; + case -2: + fprintf(stderr, "ERROR: "); + break; + case -3: + fprintf(stderr, "INTERNAL ERROR: "); + break; + default: + fprintf(stderr, "FATAL ERROR: "); + break; + } + vfprintf(stderr, fmt, args); + if (last != ' ' && last != '\r') + fprintf(stderr, "\n"); + + fflush(stderr); + if (level <= -10) + exit(1); + } + else if (level <= VERBOSE) { + vfprintf(stderr, fmt, args); + if (last != ' ' && last != '\r') + fprintf(stderr, "\n"); + + fflush(stderr); + } + + va_end(args); +} + +static void printVersion() +{ + message(1, "toc2cue version %s - (C) Andreas Mueller <andreas@daneb.de>", + VERSION); + message(1, ""); +} + +static void printUsage() +{ + message(0, "\nUsage: %s [-v #] { -V | input-toc-file output-cue-file}", PRGNAME); +} + +static int parseCommandLine(int argc, char **argv, char **tocFile, + char **cueFile) +{ + int c; + int printVersion = 0; + extern char *optarg; + extern int optind, opterr, optopt; + + opterr = 0; + + while ((c = getopt(argc, argv, "Vv:")) != EOF) { + switch (c) { + case 'V': + printVersion = 1; + break; + + case 'v': + if (optarg != NULL) { + if ((VERBOSE = atoi(optarg)) < 0) { + message(-2, "Invalid verbose level: %s", optarg); + return 0; + } + } + else { + message(-2, "Missing verbose level after option '-v'."); + return 0; + } + break; + + case '?': + message(-2, "Invalid option: %c", optopt); + return 0; + break; + } + } + + if (printVersion) { + return 1; + } + + if (optind < argc) { + *tocFile = strdupCC(argv[optind]); + optind++; + } + else { + message(-2, "Missing toc-file name."); + return 0; + } + + if (optind < argc) { + *cueFile = strdupCC(argv[optind]); + optind++; + } + else { + message(-2, "Missing cue file name."); + return 0; + } + + if (optind != argc) { + message(-2, "Expecting exactly two arguments."); + return 0; + } + + return 2; +} + +int main(int argc, char **argv) +{ + char *tocFile, *cueFile; + Toc *toc; + + PRGNAME = *argv; + + switch (parseCommandLine(argc, argv, &tocFile, &cueFile)) { + case 0: + printUsage(); + return 1; + break; + + case 1: + printf("%s\n", VERSION); + return 0; + break; + } + + printVersion(); + + if ((toc = Toc::read(tocFile)) == NULL) { + message(-2, "Failed to read toc-file '%s'.", tocFile); + return 1; + } + + Msf start, end; + const Track *trun; + int trackNr; + TrackIterator titr(toc); + char *binFileName = NULL; + int err = 0; + + // first make some consistency checks, surely not complete to identify + // toc-files that can be correctly converted to cue files + for (trun = titr.first(start, end), trackNr = 1; + trun != NULL; + trun = titr.next(start, end), trackNr++) { + const SubTrack *strun; + int stcount; + TrackData::Type sttype1 = TrackData::DATAFILE, + sttype2 = TrackData::DATAFILE; + SubTrackIterator stitr(trun); + + switch (trun->type()) { + case TrackData::MODE0: + case TrackData::MODE2_FORM2: + message(-2, "Cannot convert: track %d has unsupported mode.", trackNr); + err = 1; + break; + default: + break; + } + + for (strun = stitr.first(), stcount = 0; + strun != NULL; + strun = stitr.next(), stcount++) { + + // store types of first two sub-tracks for later evaluation + switch (stcount) { + case 0: + sttype1 = strun->TrackData::type(); + break; + case 1: + sttype2 = strun->TrackData::type(); + break; + } + + // check if whole toc-file just references a single bin file + if (strun->TrackData::type() == TrackData::DATAFILE) { + if (binFileName == NULL) { + binFileName = strdupCC(strun->filename()); + } + else { + if (strcmp(binFileName, strun->filename()) != 0) { + message(-2, "Cannot convert: toc-file references multiple data files."); + err = 1; + } + } + } + } + + switch (stcount) { + case 0: + message(-2, "Cannot convert: track %d references no data file.", + trackNr); + err = 1; + break; + + case 1: + if (sttype1 != TrackData::DATAFILE) { + message(-2, "Cannot convert: track %d references no data file.", + trackNr); + err = 1; + } + break; + + case 2: + if (sttype1 != TrackData::ZERODATA || sttype2 != TrackData::DATAFILE) { + message(-2, "Cannot convert: track %d has unsupported layout.", + trackNr); + err = 1; + } + break; + + default: + message(-2, "Cannot convert: track %d has unsupported layout.", trackNr); + err = 1; + break; + } + } + + if (binFileName == NULL) { + message(-2, "Cannot convert: toc-file references no data file."); + err = 1; + } + + if (err) { + message(-2, "Cannot convert toc-file '%s' to a cue file.", tocFile); + return 1; + } + + std::ofstream out(cueFile); + + if (!out) { + message(-2, "Cannot open cue file \'%s\' for writing: %s", cueFile, + strerror(errno)); + return 1; + } + + out << "FILE \"" << binFileName << "\" BINARY" << "\n"; + + long offset = 0; + + for (trun = titr.first(start, end), trackNr = 1; + trun != NULL; + trun = titr.next(start, end), trackNr++) { + char buf[20]; + + sprintf(buf, "%02d ", trackNr); + out << " TRACK " << buf; + + switch (trun->type()) { + case TrackData::AUDIO: + out << "AUDIO"; + break; + case TrackData::MODE1: + case TrackData::MODE2_FORM1: + out << "MODE1/2048"; + break; + case TrackData::MODE2: + case TrackData::MODE2_FORM_MIX: + out << "MODE2/2336"; + break; + case TrackData::MODE1_RAW: + out << "MODE1/2352"; + break; + case TrackData::MODE2_RAW: + out << "MODE2/2352"; + break; + default: + break; + } + + out << "\n"; + + if ( trun->copyPermitted() ) { + out << " FLAGS DCP\n"; + } + + const SubTrack *strun; + SubTrackIterator stitr(trun); + int pregap = 0; + + for (strun = stitr.first(); strun != NULL; strun = stitr.next()) { + if (strun->TrackData::type() == TrackData::ZERODATA) { + out << " PREGAP " << trun->start().str() << "\n"; + pregap = 1; + } + else { + if (!pregap && trun->start().lba() != 0) { + out << " INDEX 00 " << Msf(offset).str() << "\n"; + out << " INDEX 01 " + << Msf(offset + trun->start().lba()).str() << "\n"; + } + else { + out << " INDEX 01 " << Msf(offset).str() << "\n"; + } + + offset += trun->length().lba(); + + if (pregap) + offset -= trun->start().lba(); + } + } + } + + out.close(); + + message(1, "Converted toc-file '%s' to cue file '%s'.", + tocFile, cueFile); + message(1, ""); + message(1, "Please note that the resulting cue file is only valid if the"); + message(1, "toc-file was created with cdrdao using the commands 'read-toc'"); + message(1, "or 'read-cd'. For manually created or edited toc-files the"); + message(1, "cue file may not be correct. This program just checks for"); + message(1, "the most obvious toc-file features that cannot be converted to"); + message(1, "a cue file."); + message(1, "Furthermore, if the toc-file contains audio tracks the byte"); + message(1, "order of the image file will be wrong which results in static"); + message(1, "noise when the resulting cue file is used for recording"); + message(1, "(even with cdrdao itself)."); + + return 0; +} diff --git a/utils/toc2mp3.cc b/utils/toc2mp3.cc new file mode 100644 index 0000000..1b22b79 --- /dev/null +++ b/utils/toc2mp3.cc @@ -0,0 +1,654 @@ +/* toc2mp3 - encodes a audio CD disk image to mp3 files for each track + * + * Copyright (C) 2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <config.h> + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> +#include <errno.h> +#include <stdarg.h> +#ifdef HAVE_GETOPT_H +#include <getopt.h> +#endif +#include <string> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + +#include <lame/lame.h> + +#include "util.h" +#include "Toc.h" +#include "CdTextItem.h" + +// set desired default bit rate for encoding here: +#define DEFAULT_ENCODER_BITRATE 192 + +static const char *PRGNAME = NULL; +static int VERBOSE = 1; +static int CREATE_ALBUM_DIRECTORY = 0; +static std::string TARGET_DIRECTORY; + + +void message_args(int level, int addNewLine, const char *fmt, va_list args) +{ + long len = strlen(fmt); + char last = len > 0 ? fmt[len - 1] : 0; + + if (level < 0) { + switch (level) { + case -1: + fprintf(stderr, "WARNING: "); + break; + case -2: + fprintf(stderr, "ERROR: "); + break; + case -3: + fprintf(stderr, "INTERNAL ERROR: "); + break; + default: + fprintf(stderr, "FATAL ERROR: "); + break; + } + vfprintf(stderr, fmt, args); + if (addNewLine) { + if (last != ' ' && last != '\r') + fprintf(stderr, "\n"); + } + + fflush(stderr); + if (level <= -10) + exit(1); + } + else if (level <= VERBOSE) { + vfprintf(stderr, fmt, args); + + if (addNewLine) { + if (last != ' ' && last != '\r') + fprintf(stderr, "\n"); + } + + fflush(stderr); + } +} + +void message(int level, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + + message_args(level, 1, fmt, args); + + va_end(args); +} + +void lame_message(const char *fmt, va_list args) +{ + message_args(1, 0, fmt, args); +} + +void lame_error_message(const char *fmt, va_list args) +{ + message_args(-2, 0, fmt, args); +} + + +static void printVersion() +{ + message(1, "toc2mp3 version %s - (C) Andreas Mueller <andreas@daneb.de>", + VERSION); + message(1, ""); +} + +static void printUsage() +{ + message(0, "Usage: %s [-v #] [-d target-dir ] [-c] { -V | toc-file }", PRGNAME); + message(0, "\nConverts an audio CD disk image (.toc file) to mp3 files."); + message(0, "Each track will be written to a separate mp3 file."); + message(0, "Special care is taken that the mp3 files can be played in sequence"); + message(0, "without having unwanted noise at the transition points."); + message(0, "CD-TEXT information (if available) is used to set ID3 (v2) tags and to"); + message(0, "construct the name of the mp3 files.\n"); + message(0, "Options:"); + message(0, " -h Shows this help."); + message(0, " -v <n> Sets verbose level to <n> (0..2)."); + message(0, " -d <target-dir> Specifies directory the mp3 files will be"); + message(0, " written to."); + message(0, " -c Adds a sub-directory composed out of CD title"); + message(0, " and author to <target-dir> specified with -d."); + message(0, " -b <bit rate> Sets bit rate used for encoding (default %d kbit/s).", + DEFAULT_ENCODER_BITRATE); + message(0, " See below for supported bit rates."); + + message(0, ""); + + message(0, "LAME encoder version: %s", get_lame_version()); + message(0, "Supported bit rates: "); + for (int i = 0; i < 16 && bitrate_table[1][i] >= 0; i++) { + message(0, "%d ", bitrate_table[1][i]); + } + message(0, ""); +} + +static int parseCommandLine(int argc, char **argv, char **tocFile, int *bitrate) +{ + int c; + int printVersion = 0; + extern char *optarg; + extern int optind, opterr, optopt; + + opterr = 0; + + while ((c = getopt(argc, argv, "Vhcv:d:b:")) != EOF) { + switch (c) { + case 'V': + printVersion = 1; + break; + + case 'v': + if (optarg != NULL) { + if ((VERBOSE = atoi(optarg)) < 0) { + message(-2, "Invalid verbose level: %s", optarg); + return 0; + } + } + else { + message(-2, "Missing verbose level after option '-v'."); + return 0; + } + break; + + case 'b': + if (optarg != NULL) { + *bitrate = atoi(optarg); + } + else { + message(-2, "Missing bit rate value after option '-b'."); + return 0; + } + break; + + case 'c': + CREATE_ALBUM_DIRECTORY = 1; + break; + + case 'h': + return 0; + break; + + case 'd': + if (optarg != NULL) { + TARGET_DIRECTORY = optarg; + } + else { + message(-2, "Missing target directory after option '-d'."); + return 0; + } + break; + + case '?': + message(-2, "Invalid option: %c", optopt); + return 0; + break; + } + } + + if (printVersion) { + return 1; + } + + if (optind < argc) { + *tocFile = strdupCC(argv[optind]); + optind++; + } + else { + message(-2, "Missing toc-file name."); + return 0; + } + + if (optind != argc) { + message(-2, "More arguments than expected."); + return 0; + } + + return 2; +} + +lame_global_flags *init_encoder(int bitrate) +{ + lame_global_flags *lf; + int bitrateOk = 0; + + for (int i = 0; bitrate_table[1][i] >= 0 && !bitrateOk; i++) { + if (bitrate == bitrate_table[1][i]) + bitrateOk = 1; + } + + if (!bitrateOk) { + message(-2, "Invalid bit rate: %d kbit/s", bitrate); + return NULL; + } + + if ((lf = lame_init()) == NULL) { + return NULL; + } + + lame_set_msgf(lf, lame_message); + lame_set_debugf(lf, lame_message); + lame_set_errorf(lf, lame_error_message); + + lame_set_in_samplerate(lf, 44100); + + lame_set_num_channels(lf, 2); + + lame_set_quality(lf, 2); + + lame_set_mode(lf, STEREO); + + lame_set_brate(lf, bitrate); + + //lame_set_VBR(lf, vbr_abr); + + //lame_set_VBR(lf, vbr_mtrh); + //lame_set_VBR_q(lf, 2); + + //lame_set_VBR_mean_bitrate_kbps(lf, bitrate); + //lame_set_VBR_min_bitrate_kbps(lf, 112); + //lame_set_VBR_hard_min(lf, 1); + + //lame_set_bWriteVbrTag(lf, 1); + + //lame_set_asm_optimizations(lf, AMD_3DNOW, 1); + + return lf; +} + +void set_id3_tags(lame_global_flags *lf, int tracknr, const std::string &title, + const std::string &artist, const std::string &album) +{ + char buf[100]; + + id3tag_init(lf); + + id3tag_add_v2(lf); + + if (!title.empty()) + id3tag_set_title(lf, title.c_str()); + + if (!artist.empty()) + id3tag_set_artist(lf, artist.c_str()); + + if (!album.empty()) + id3tag_set_album(lf, album.c_str()); + + if (tracknr > 0 && tracknr <= 255) { + sprintf(buf, "%d", tracknr); + id3tag_set_track(lf, buf); + } +} + +int encode_track(lame_global_flags *lf, const Toc *toc, + const std::string &fileName, long startLba, + long len) +{ + int fd; + int ret = 1; + TocReader reader(toc); + Sample audioData[SAMPLES_PER_BLOCK]; + short int leftSamples[SAMPLES_PER_BLOCK]; + short int rightSamples[SAMPLES_PER_BLOCK]; + unsigned char mp3buffer[LAME_MAXMP3BUFFER]; + + if (reader.openData() != 0) { + message(-2, "Cannot open audio data."); + return 0; + } + + if (reader.seekSample(Msf(startLba).samples()) != 0) { + message(-2, "Cannot seek to start sample of track."); + return 0; + } + + if ((fd = open(fileName.c_str(), O_WRONLY|O_CREAT|O_TRUNC, 0666)) < 0) { + message(-2, "Cannot open \"%s\" for writing: %s", fileName.c_str(), + strerror(errno)); + return 0; + } + + while (len > 0) { + if (reader.readSamples(audioData, SAMPLES_PER_BLOCK) != SAMPLES_PER_BLOCK) { + message(-2, "Cannot read audio data."); + ret = 0; + break; + } + + for (int i = 0; i < SAMPLES_PER_BLOCK; i++) { + leftSamples[i] = audioData[i].left(); + rightSamples[i] = audioData[i].right(); + } + + int count = lame_encode_buffer(lf, leftSamples, rightSamples, + SAMPLES_PER_BLOCK, mp3buffer, + sizeof(mp3buffer)); + + if (count < 0) { + message(-2, "Lame encoder failed: %d", count); + ret = 0; + break; + } + + if (count > 0) { + if (fullWrite(fd, mp3buffer, count) != count) { + message(-2, "Failed to write encoded data: %s", strerror(errno)); + ret = 0; + break; + } + } + + len--; + } + + if (ret != 0) { + int count = lame_encode_flush_nogap(lf, mp3buffer, sizeof(mp3buffer)); + + if (count > 0) { + if (fullWrite(fd, mp3buffer, count) != count) { + message(-2, "Failed to write encoded data: %s", strerror(errno)); + ret = 0; + } + } + } + + if (close(fd) != 0) { + message(-2, "Failed to close encoded data file: %s", strerror(errno)); + ret = 0; + } + + if (ret != 0) { + FILE *fp = fopen(fileName.c_str(), "a+"); + + if (fp != NULL) { + lame_mp3_tags_fid(lf, fp); + fclose(fp); + } + else { + message(-2, "Cannot reopen output file for adding headers: %s", + strerror(errno)); + ret = 0; + } + } + + return ret; +} + +std::string &clean_string(std::string &s) +{ + int i = 0; + int len = s.length(); + char c; + + while (i < len && (c = s[i]) != 0) { + if (c == '_') { + s[i] = ' '; + i++; + } + else if (isalnum(c) || c == ' ' || c == '.' || c== '-' || c == '(' || + c == ')' || c == ')' || c == ',' || c == ':' || c == ';' || + c == '"' || c == '!' || c == '?' || c == '\'' || c == '$') { + i++; + } + else { + s.erase(i, 1); + len = s.length(); + } + } + + len = s.length(); + + for (i = 0; i < len && s[i] != 0 && isspace(s[i]); i++) ; + + if (i >= len) { + // string just contains space + s = ""; + } + + return s; +} + +int main(int argc, char **argv) +{ + char *tocFile; + int bitrate = DEFAULT_ENCODER_BITRATE; + Toc *toc; + lame_global_flags *lf; + std::string album, albumPerformer, title, performer; + int cdTextLanguage = 0; + const CdTextItem *cdTextItem; + char *tocfileBaseName, *p; + char sbuf[100]; + int err = 0; + + PRGNAME = *argv; + + switch (parseCommandLine(argc, argv, &tocFile, &bitrate)) { + case 0: + printUsage(); + exit(1); + break; + + case 1: + printf("%s\n", VERSION); + exit(0); + break; + } + + printVersion(); + + if ((toc = Toc::read(tocFile)) == NULL) { + message(-10, "Failed to read toc-file '%s'.", tocFile); + } + + if ((lf = init_encoder(bitrate)) == NULL) { + message(-10, "Cannot initialize lame encoder"); + } + + + if ((p = strrchr(tocFile, '/')) != NULL) + tocfileBaseName = strdupCC(p + 1); + else + tocfileBaseName = strdupCC(tocFile); + + if ((p = strrchr(tocfileBaseName, '.')) != NULL && + (strcmp(p, ".toc") == 0 || strcmp(p, ".cue") == 0)) { + *p = 0; + } + + if (strlen(tocfileBaseName) == 0) { + delete[] tocfileBaseName; + tocfileBaseName = strdupCC("unknown"); + } + + if ((cdTextItem = toc->getCdTextItem(0, cdTextLanguage, + CdTextItem::CDTEXT_TITLE)) != NULL) { + album = (const char*)cdTextItem->data(); + clean_string(album); + if (album.empty()) + album = tocfileBaseName; + } + else { + album = tocfileBaseName; + } + + if ((cdTextItem = toc->getCdTextItem(0, cdTextLanguage, + CdTextItem::CDTEXT_PERFORMER)) != NULL) { + albumPerformer = (const char*)cdTextItem->data(); + clean_string(albumPerformer); + } + else { + albumPerformer = ""; + } + + + std::string mp3TargetDir; + + if (!TARGET_DIRECTORY.empty()) { + mp3TargetDir = TARGET_DIRECTORY; + + if (*(TARGET_DIRECTORY.end() - 1) != '/') + mp3TargetDir += "/"; + + if (CREATE_ALBUM_DIRECTORY) { + if (!album.empty() && !albumPerformer.empty()) { + mp3TargetDir += albumPerformer; + mp3TargetDir += "_"; + mp3TargetDir += album; + } + else { + mp3TargetDir += tocfileBaseName; + } + + if (mkdir(mp3TargetDir.c_str(), 0777) != 0) { + message(-10, "Cannot create album directory \"%s\": %s", + mp3TargetDir.c_str(), strerror(errno)); + } + + mp3TargetDir += "/"; + } + } + + + Msf astart, aend, nstart, nend; + const Track *actTrack, *nextTrack; + int trackNr; + TrackIterator titr(toc); + int firstEncodedTrack = 1; + + trackNr = 1; + actTrack = titr.first(astart, aend); + nextTrack = titr.next(nstart, nend); + + while (actTrack != NULL && err == 0) { + + if (actTrack->type() == TrackData::AUDIO) { + + // Retrieve CD-TEXT data for track title and performer + if ((cdTextItem = toc->getCdTextItem(trackNr, cdTextLanguage, + CdTextItem::CDTEXT_TITLE)) != NULL) { + title = (const char*)cdTextItem->data(); + clean_string(title); + } + else { + title = ""; + } + + if ((cdTextItem = toc->getCdTextItem(trackNr, cdTextLanguage, + CdTextItem::CDTEXT_PERFORMER)) != NULL) { + performer = (const char*)cdTextItem->data(); + clean_string(performer); + } + else { + performer = ""; + } + + // build mp3 file name + std::string mp3FileName; + + sprintf(sbuf, "%02d_", trackNr); + + mp3FileName += sbuf; + + if (!title.empty()) { + mp3FileName += title; + mp3FileName += "_"; + } + + mp3FileName += album; + + if (!albumPerformer.empty()) { + mp3FileName += "_"; + mp3FileName += albumPerformer; + } + + mp3FileName += ".mp3"; + + + long len = aend.lba() - astart.lba(); + + if (nextTrack != NULL && nextTrack->type() == TrackData::AUDIO) + len += nextTrack->start().lba(); + + if (len > 0) { + set_id3_tags(lf, trackNr, title, performer, album); + + if (firstEncodedTrack) { + if (lame_init_params(lf) < 0) { + message(-2, "Setting of lame parameters failed"); + err = 1; + break; + } + message(1, "Lame encoder settings:"); + lame_print_config(lf); + message(1, "Selected bit rate: %d kbit/s", bitrate); + + if (VERBOSE >= 2) + lame_print_internals(lf); + + message(1, ""); + + + message(1, "Starting encoding to target directory \"%s\"...", + mp3TargetDir.empty() ? "." : mp3TargetDir.c_str()); + + firstEncodedTrack = 0; + } + else { + if (lame_init_bitstream(lf) != 0) { + message(-2, "Cannot initialize bit stream."); + err = 1; + break; + } + } + + message(1, "Encoding track %d to \"%s\"...", trackNr, + mp3FileName.c_str()); + + if (!encode_track(lf, toc, mp3TargetDir + mp3FileName, astart.lba(), len)) { + message(-2, "Encoding of track %d failed.", trackNr); + err = 1; + break; + } + } + } + + actTrack = nextTrack; + astart = nstart; + aend = nend; + trackNr++; + + if (actTrack != NULL) + nextTrack = titr.next(nstart, nend); + } + + lame_close(lf); + + exit(err); +} diff --git a/xdao/AddFileDialog.cc b/xdao/AddFileDialog.cc new file mode 100644 index 0000000..2c5f31c --- /dev/null +++ b/xdao/AddFileDialog.cc @@ -0,0 +1,178 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#include <stdio.h> +#include <limits.h> +#include <math.h> +#include <assert.h> + +#include <gtkmm.h> +#include <gnome.h> + +#include "config.h" +#include "AddFileDialog.h" +#include "guiUpdate.h" +#include "TocEdit.h" +#include "Sample.h" +#include "util.h" +#include "AudioCDProject.h" +#include "xcdrdao.h" + +AddFileDialog::AddFileDialog(AudioCDProject *project) + : Gtk::FileChooserDialog("") +{ + active_ = false; + project_ = project; + + set_select_multiple(true); + set_transient_for(*project->getParentWindow ()); + mode(M_APPEND_TRACK); + + Gtk::FileFilter* filter_tocs = new Gtk::FileFilter; + manage(filter_tocs); + std::string fname = "Audio Files (wav"; +#ifdef HAVE_MP3_SUPPORT + fname = fname + ", mp3, m3u"; +#endif +#ifdef HAVE_OGG_SUPPORT + fname = fname + ", ogg"; +#endif + fname = fname + ")"; + filter_tocs->set_name(fname); + + filter_tocs->add_pattern("*.wav"); +#ifdef HAVE_OGG_SUPPORT + filter_tocs->add_pattern("*.ogg"); +#endif +#ifdef HAVE_MP3_SUPPORT + filter_tocs->add_pattern("*.mp3"); + filter_tocs->add_pattern("*.m3u"); +#endif + add_filter(*filter_tocs); + + Gtk::FileFilter* filter_all = new Gtk::FileFilter; + manage(filter_all); + filter_all->set_name("Any files"); + filter_all->add_pattern("*"); + add_filter(*filter_all); + + add_button(Gtk::Stock::CLOSE, Gtk::RESPONSE_CANCEL); + add_button(Gtk::Stock::ADD, Gtk::RESPONSE_OK); +} + +void AddFileDialog::mode(Mode m) +{ + mode_ = m; + + switch (mode_) { + case M_APPEND_TRACK: + set_title(_("Append Track")); + break; + case M_APPEND_FILE: + set_title(_("Append File")); + break; + case M_INSERT_FILE: + set_title(_("Insert File")); + break; + } +} + +void AddFileDialog::start() +{ + if (active_) { + get_window()->raise(); + return; + } + + active_ = true; + show(); + + bool contFlag = true; + + while (contFlag) { + + int result = run(); + + switch (result) { + case Gtk::RESPONSE_CANCEL: + contFlag = false; + break; + case Gtk::RESPONSE_OK: + contFlag = applyAction(); + break; + } + } + + stop(); +} + +void AddFileDialog::stop() +{ + if (active_) { + hide(); + active_ = false; + } +} + +bool AddFileDialog::on_delete_event(GdkEventAny*) +{ + stop(); + return 1; +} + +bool AddFileDialog::applyAction() +{ + std::list<Glib::ustring> sfiles = get_filenames(); + std::list<std::string> files; + + for (std::list<Glib::ustring>::const_iterator i = sfiles.begin(); + i != sfiles.end(); i++) { + + const char *s = stripCwd((*i).c_str()); + + if (s && *s != 0 && s[strlen(s) - 1] != '/') { + + if (fileExtension(s) == FE_M3U) + parseM3u(s, files); + else + files.push_back(s); + } + } + + if (files.size() > 0) { + switch (mode_) { + case M_APPEND_TRACK: + project_->appendTracks(files); + break; + + case M_APPEND_FILE: + project_->appendFiles(files); + break; + + case M_INSERT_FILE: + project_->insertFiles(files); + break; + } + if (files.size() > 1) + return false; + } + + return true; +} diff --git a/xdao/AddFileDialog.h b/xdao/AddFileDialog.h new file mode 100644 index 0000000..7a05262 --- /dev/null +++ b/xdao/AddFileDialog.h @@ -0,0 +1,51 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __ADD_FILE_DIALOG_H__ +#define __ADD_FILE_DIALOG_H__ + +#include <gtkmm.h> + +class AudioCDProject; + +class AddFileDialog : public Gtk::FileChooserDialog +{ +public: + enum Mode { M_APPEND_TRACK, M_APPEND_FILE, M_INSERT_FILE }; + + AddFileDialog(AudioCDProject *); + + void start(); + void stop(); + + void mode(Mode); + void update(unsigned long level) {} + + bool on_delete_event(GdkEventAny*); + +private: + AudioCDProject *project_; + bool active_; + Mode mode_; + + bool applyAction(); + +}; + +#endif diff --git a/xdao/AddSilenceDialog.cc b/xdao/AddSilenceDialog.cc new file mode 100644 index 0000000..b5e1a8d --- /dev/null +++ b/xdao/AddSilenceDialog.cc @@ -0,0 +1,244 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stdio.h> +#include <limits.h> +#include <math.h> +#include <assert.h> + +#include <gtkmm.h> +#include <gnome.h> + +#include "AddSilenceDialog.h" + +#include "TocEdit.h" +#include "TocEditView.h" +#include "guiUpdate.h" + +#include "Sample.h" + + +AddSilenceDialog::AddSilenceDialog() +{ + Gtk::Button *button; + Gtk::VBox *vbox; + Gtk::HBox *hbox; + + tocEditView_ = NULL; + active_ = false; + mode_ = M_APPEND; + + Gtk::Frame *frame = new Gtk::Frame(_(" Length of Silence ")); + + Gtk::Table *table = new Gtk::Table(4, 2, false); + table->set_row_spacings(5); + table->set_col_spacings(5); + hbox = new Gtk::HBox; + hbox->pack_start(*table, true, true, 5); + vbox = new Gtk::VBox; + vbox->pack_start(*hbox, false, false, 5); + frame->add(*vbox); + + Gtk::Label *label = new Gtk::Label(_("Minutes:")); + table->attach(*label, 0, 1, 0, 1, Gtk::SHRINK); + table->attach(minutes_, 1, 2, 0, 1); + + label = new Gtk::Label(_("Seconds:")); + table->attach(*label, 0, 1, 1, 2, Gtk::SHRINK); + table->attach(seconds_, 1, 2, 1, 2); + + label = new Gtk::Label(_("Frames:")); + table->attach(*label, 0, 1, 2, 3, Gtk::SHRINK); + table->attach(frames_, 1, 2, 2, 3); + + label = new Gtk::Label(_("Samples:")); + table->attach(*label, 0, 1, 3, 4, Gtk::SHRINK); + table->attach(samples_, 1, 2, 3, 4); + + hbox = new Gtk::HBox; + hbox->pack_start(*frame, true, true, 10); + + get_vbox()->pack_start(*hbox, false, false, 10); + + Gtk::HButtonBox *bbox = new Gtk::HButtonBox(Gtk::BUTTONBOX_SPREAD); + + applyButton_ = new Gtk::Button(Gtk::StockID(Gtk::Stock::APPLY)); + bbox->pack_start(*applyButton_); + applyButton_->signal_clicked().connect(mem_fun(*this, &AddSilenceDialog::applyAction)); + + button = new Gtk::Button(Gtk::StockID(Gtk::Stock::CLEAR)); + bbox->pack_start(*button); + button->signal_clicked().connect(mem_fun(*this, &AddSilenceDialog::clearAction)); + + button = new Gtk::Button(Gtk::StockID(Gtk::Stock::CLOSE)); + bbox->pack_start(*button); + button->signal_clicked().connect(mem_fun(*this, &AddSilenceDialog::closeAction)); + + get_action_area()->pack_start(*bbox); + show_all_children(); +} + +AddSilenceDialog::~AddSilenceDialog() +{ +} + +void AddSilenceDialog::mode(Mode m) +{ + mode_ = m; + + switch (mode_) { + case M_APPEND: + set_title(_("Append Silence")); + break; + case M_INSERT: + set_title(_("Insert Silence")); + break; + } +} + +void AddSilenceDialog::start(TocEditView *view) +{ + active_ = true; + update(UPD_ALL, view); + present(); + tocEditView_ = view; +} + +void AddSilenceDialog::stop() +{ + hide(); + active_ = false; +} + +void AddSilenceDialog::update(unsigned long level, TocEditView *view) +{ + if (!active_) + return; + + if (view == NULL) { + applyButton_->set_sensitive(false); + tocEditView_ = NULL; + return; + } + + std::string s(view->tocEdit()->filename()); + s += " - "; + s += APP_NAME; + if (view->tocEdit()->tocDirty()) + s += "(*)"; + set_title(s); + + if ((level & UPD_EDITABLE_STATE) || tocEditView_ == NULL) { + applyButton_->set_sensitive(view->tocEdit()->editable() ? true : false); + } + + tocEditView_ = view; +} + + +bool AddSilenceDialog::on_delete_event(GdkEventAny*) +{ + stop(); + return 1; +} + +void AddSilenceDialog::closeAction() +{ + stop(); +} + +void AddSilenceDialog::clearAction() +{ + minutes_.set_text(""); + seconds_.set_text(""); + frames_.set_text(""); + samples_.set_text(""); +} + +void AddSilenceDialog::applyAction() +{ + unsigned long length = 0; + char buf[20]; + long val; + TocEdit *tocEdit; + + if (tocEditView_ == NULL) + return; + + tocEdit = tocEditView_->tocEdit(); + + if (!tocEdit->editable()) + return; + + const char *s = minutes_.get_text().c_str(); + if (s != NULL && *s != 0) { + val = atol(s); + length += val * 60 * 75 * SAMPLES_PER_BLOCK; + sprintf(buf, "%ld", val); + minutes_.set_text(buf); + } + + s = seconds_.get_text().c_str(); + if (s != NULL && *s != 0) { + val = atol(s); + length += val * 75 * SAMPLES_PER_BLOCK; + sprintf(buf, "%ld", val); + seconds_.set_text(buf); + } + + s = frames_.get_text().c_str(); + if (s != NULL && *s != 0) { + val = atol(s); + length += val * SAMPLES_PER_BLOCK; + sprintf(buf, "%ld", val); + frames_.set_text(buf); + } + + s = samples_.get_text().c_str(); + if (s != NULL && *s != 0) { + val = atol(s); + length += val; + sprintf(buf, "%ld", val); + samples_.set_text(buf); + } + + if (length > 0) { + unsigned long pos; + + switch (mode_) { + case M_APPEND: + tocEdit->appendSilence(length); + update (UPD_TOC_DATA | UPD_TRACK_DATA | UPD_SAMPLE_SEL, tocEditView_); + signal_tocModified (UPD_TOC_DATA | UPD_TRACK_DATA | UPD_SAMPLE_SEL); + signal_fullView(); + signal_tocModified(UPD_SAMPLES); + break; + case M_INSERT: + if (tocEditView_->sampleMarker(&pos)) { + if (tocEdit->insertSilence(length, pos) == 0) { + tocEditView_->sampleSelect(pos, pos + length - 1); + update (UPD_TOC_DATA | UPD_TRACK_DATA, tocEditView_); + signal_tocModified (UPD_TOC_DATA | UPD_TRACK_DATA); + } + } + break; + } + guiUpdate(); + } +} diff --git a/xdao/AddSilenceDialog.h b/xdao/AddSilenceDialog.h new file mode 100644 index 0000000..0d518f2 --- /dev/null +++ b/xdao/AddSilenceDialog.h @@ -0,0 +1,63 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __ADD_SILENCE_DIALOG_H__ +#define __ADD_SILENCE_DIALOG_H__ + +#include <gtkmm.h> +#include <gtk/gtk.h> + +class TocEditView; + +class AddSilenceDialog : public Gtk::Dialog +{ +public: + enum Mode { M_APPEND, M_INSERT }; + + AddSilenceDialog(); + ~AddSilenceDialog(); + + void start(TocEditView *); + void stop(); + + void mode(Mode); + void update(unsigned long level, TocEditView *); + sigc::signal1<void, unsigned long> signal_tocModified; + sigc::signal0<void> signal_fullView; + + bool on_delete_event(GdkEventAny*); + +private: + TocEditView *tocEditView_; + bool active_; + Mode mode_; + + Gtk::Button *applyButton_; + + Gtk::Entry minutes_; + Gtk::Entry seconds_; + Gtk::Entry frames_; + Gtk::Entry samples_; + + void clearAction(); + void closeAction(); + void applyAction(); +}; + +#endif diff --git a/xdao/AudioCDProject.cc b/xdao/AudioCDProject.cc new file mode 100644 index 0000000..e4f4e0c --- /dev/null +++ b/xdao/AudioCDProject.cc @@ -0,0 +1,686 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <assert.h> +#include <gtkmm.h> +#include <libgnome/gnome-i18n.h> +#include <cstring> + +#include "Toc.h" +#include "SoundIF.h" +#include "AudioCDProject.h" +#include "AudioCDView.h" +#include "TocEdit.h" +#include "TocEditView.h" +#include "TocInfoDialog.h" +#include "CdTextDialog.h" +#include "guiUpdate.h" +#include "util.h" +#include "gcdmaster.h" +#include "xcdrdao.h" +#include "RecordTocDialog.h" +#include "Icons.h" +#include "MessageBox.h" + +AudioCDProject::AudioCDProject(int number, const char *name, TocEdit *tocEdit, + Gtk::Window *parent) : Project(parent) +{ + tocInfoDialog_ = NULL; + cdTextDialog_ = NULL; + soundInterface_ = NULL; + buttonPlay_ = NULL; + buttonStop_ = NULL; + buttonPause_ = NULL; + audioCDView_ = NULL; + + parent_ = parent; + pack_start(hbox_); + + projectNumber_ = number; + + playStatus_ = STOPPED; + playBurst_ = 588 * 10; + playBuffer_ = new Sample[playBurst_]; + + if (tocEdit == NULL) + tocEdit_ = new TocEdit(NULL, NULL); + else + tocEdit_ = tocEdit; + + // Connect TocEdit signals to us. + tocEdit_->signalStatusMessage. + connect(sigc::mem_fun(*this, &AudioCDProject::status)); + tocEdit_->signalProgressFraction. + connect(sigc::mem_fun(*this, &AudioCDProject::progress)); + tocEdit_->signalFullView. + connect(sigc::mem_fun(*this, &AudioCDProject::fullView)); + tocEdit_->signalSampleSelection. + connect(sigc::mem_fun(*this, &AudioCDProject::sampleSelect)); + tocEdit_->signalCancelEnable. + connect(sigc::mem_fun(*this, &AudioCDProject::cancelEnable)); + tocEdit_->signalError. + connect(sigc::mem_fun(*this, &AudioCDProject::errorDialog)); + + if (tocEdit_->isQueueActive()) + cancelEnable(true); + + if (!name || strlen(name) == 0) { + char buf[20]; + sprintf(buf, "unnamed-%i.toc", projectNumber_); + tocEdit_->filename(buf); + new_ = true; + } else { + new_ = false; // The project file already exists + } + + audioCDView_ = new AudioCDView(this); + hbox_.pack_start(*audioCDView_, TRUE, TRUE); + audioCDView_->tocEditView()->sampleViewFull(); + + updateWindowTitle(); + + guiUpdate(UPD_ALL); + show_all(); +} + +void AudioCDProject::add_menus(Glib::RefPtr<Gtk::UIManager> m_refUIManager) +{ + m_refActionGroup = Gtk::ActionGroup::create("AudioCDProject"); + + m_refActionGroup->add( Gtk::Action::create("Save", Gtk::Stock::SAVE), + sigc::mem_fun(*this, &Project::saveProject) ); + + m_refActionGroup->add( Gtk::Action::create("SaveAs", Gtk::Stock::SAVE_AS), + sigc::mem_fun(*this, &Project::saveAsProject) ); + + m_refActionGroup->add( Gtk::Action::create("ProjectInfo", Gtk::Stock::PROPERTIES, + _("Project Info..."), + _("Edit global project data")), + sigc::mem_fun(*this, &AudioCDProject::projectInfo) ); + + m_refActionGroup->add( Gtk::Action::create("CDTEXT", Gtk::Stock::PROPERTIES, + _("CD-TEXT..."), + _("Edit CD-TEXT data")), + sigc::mem_fun(*this, &AudioCDProject::cdTextDialog) ); + + m_refActionGroup->add( Gtk::Action::create("Record", Icons::RECORD, + _("_Record"), + _("Record")), + sigc::mem_fun(*this, &AudioCDProject::recordToc2CD) ); + + m_refActionGroup->add( Gtk::Action::create("Play", Icons::PLAY, + _("Play"), + _("Play")), + sigc::mem_fun(*this, &AudioCDProject::on_play_clicked) ); + + m_refActionGroup->add( Gtk::Action::create("Stop", Icons::STOP, + _("Stop"), + _("Stop")), + sigc::mem_fun(*this, &AudioCDProject::on_stop_clicked) ); + + m_refActionGroup->add( Gtk::Action::create("Pause", Icons::PAUSE, + _("Pause"), + _("Pause")), + sigc::mem_fun(*this, &AudioCDProject::on_pause_clicked) ); + + //Add Toggle Actions: + Gtk::RadioAction::Group group_colors; + m_refActionGroup->add( Gtk::RadioAction::create(group_colors, "Select", + Gtk::Stock::JUMP_TO, + _("Select"), + _("Select Mode")), + sigc::mem_fun(*this, &AudioCDProject::on_select_clicked)); + m_refActionGroup->add( Gtk::RadioAction::create(group_colors, "Zoom", + Gtk::Stock::ZOOM_FIT, + _("Zoom"), + _("Zoom Mode")), + sigc::mem_fun(*this, &AudioCDProject::on_zoom_clicked)); + + m_refActionGroup->add( Gtk::Action::create("ZoomIn", Gtk::Stock::ZOOM_IN, + _("Zoom In"), + _("Zoom In")), + sigc::mem_fun(*this, &AudioCDProject::on_zoom_in_clicked) ); + + m_refActionGroup->add( Gtk::Action::create("ZoomOut", Gtk::Stock::ZOOM_OUT, + _("Zoom Out"), + _("Zoom Out")), + sigc::mem_fun(*this, &AudioCDProject::on_zoom_out_clicked) ); + + m_refActionGroup->add( Gtk::Action::create("ZoomFit", Gtk::Stock::ZOOM_FIT, + _("Zoom Fit"), + _("Zoom Fit")), + sigc::mem_fun(*this, &AudioCDProject::on_zoom_fit_clicked) ); + + m_refUIManager->insert_action_group(m_refActionGroup); + + // Merge menuitems + try + { + Glib::ustring ui_info = + "<ui>" + " <menubar name='MenuBar'>" + " <menu action='FileMenu'>" + " <placeholder name='FileSaveHolder'>" + " <menuitem action='Save'/>" + " <menuitem action='SaveAs'/>" + " </placeholder>" + " </menu>" + " <menu action='EditMenu'>" + " <menuitem action='ProjectInfo'/>" + " <menuitem action='CDTEXT'/>" + " </menu>" + " <menu action='ActionsMenu'>" + " <placeholder name='ActionsRecordHolder'>" + " <menuitem action='Record'/>" + " </placeholder>" + " <menuitem action='Play'/>" + " <menuitem action='Stop'/>" + " <menuitem action='Pause'/>" + " <separator/>" + " <menuitem action='Select'/>" + " <menuitem action='Zoom'/>" + " <separator/>" + " <menuitem action='ZoomIn'/>" + " <menuitem action='ZoomOut'/>" + " <menuitem action='ZoomFit'/>" + " </menu>" + " </menubar>" + " <toolbar name='ToolBar'>" + " <toolitem action='Save'/>" + " <toolitem action='Record'/>" + " <separator/>" + " <toolitem action='Play'/>" + " <toolitem action='Stop'/>" + " <toolitem action='Pause'/>" + " <separator/>" + " <toolitem action='Select'/>" + " <toolitem action='Zoom'/>" + " <separator/>" + " <toolitem action='ZoomIn'/>" + " <toolitem action='ZoomOut'/>" + " <toolitem action='ZoomFit'/>" + " <separator/>" + " </toolbar>" + "</ui>"; + + m_refUIManager->add_ui_from_string(ui_info); + } + catch(const Glib::Error& ex) + { + std::cerr << "merging menus failed: " << ex.what(); + } + + Glib::RefPtr<Gtk::Action> action; + action = m_refActionGroup->get_action ("Play"); + action->set_sensitive(true); + action = m_refActionGroup->get_action ("Pause"); + action->set_sensitive(false); + action = m_refActionGroup->get_action ("Stop"); + action->set_sensitive(false); + + audioCDView_->add_menus (m_refUIManager); + audioCDView_->signal_tocModified. + connect(sigc::mem_fun(*this, &AudioCDProject::update)); +} + +void AudioCDProject::configureAppBar(Gnome::UI::AppBar *s, Gtk::ProgressBar* p, + Gtk::Button *b) +{ + statusbar_ = s; + progressbar_ = p; + progressButton_ = b; + + if (tocEdit_) { + tocEdit_->signalProgressPulse. + connect(sigc::mem_fun(*progressbar_, &Gtk::ProgressBar::pulse)); + signalCancelClicked.connect(sigc::mem_fun(*tocEdit_, + &TocEdit::queueAbort)); + if (tocEdit_->isQueueActive()) + progressButton_->set_sensitive(true); + } + + progressButton_->signal_clicked(). + connect(sigc::mem_fun(*this, &AudioCDProject::on_cancel_clicked)); + progressbar_->set_pulse_step(0.01); +}; + +void AudioCDProject::status(const char* msg) +{ + statusMessage(msg); +} + +void AudioCDProject::errorDialog(const char* msg) +{ + Gtk::MessageDialog md(*(getParentWindow()), msg, false, Gtk::MESSAGE_ERROR); + md.run(); +} + +void AudioCDProject::progress(double val) +{ + progressbar_->set_fraction(val); +} + +void AudioCDProject::fullView() +{ + if (audioCDView_) + audioCDView_->fullView(); +} + +void AudioCDProject::sampleSelect(unsigned long start, unsigned long len) +{ + audioCDView_->tocEditView()->sampleSelect(start, len); +} + +void AudioCDProject::cancelEnable(bool enable) +{ + if (progressButton_) + progressButton_->set_sensitive(enable); +} + +bool AudioCDProject::closeProject() +{ + if (tocEdit_->tocDirty()) { + + // Project window might be iconified and user might have forgotten + // about it (Quit can be called on another project window). + getParentWindow()->present(); + + Glib::ustring message = "Project "; + message += tocEdit_->filename(); + message += " not saved. Are you sure you want to close it ?"; + + Gtk::MessageDialog d(*getParentWindow(), message, false, + Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_OK_CANCEL, true); + + int ret = d.run(); + d.hide(); + + if (ret == Gtk::RESPONSE_CANCEL || ret == Gtk::RESPONSE_DELETE_EVENT) + return false; + } + + if (tocEdit_ && tocEdit_->isQueueActive()) { + tocEdit_->queueAbort(); + } + + if (playStatus_ == PLAYING || playStatus_ == PAUSED) { + playStop(); + } + + if (audioCDView_) { + delete audioCDView_; + audioCDView_ = NULL; + } + + if (tocInfoDialog_) delete tocInfoDialog_; + if (cdTextDialog_) delete cdTextDialog_; + if (recordTocDialog_) delete recordTocDialog_; + + return true; +} + +void AudioCDProject::recordToc2CD() +{ + if (recordTocDialog_ == NULL) + recordTocDialog_ = new RecordTocDialog(tocEdit_); + + recordTocDialog_->start (parent_); +} + +void AudioCDProject::projectInfo() +{ + if (!tocInfoDialog_) + tocInfoDialog_ = new TocInfoDialog(parent_); + + tocInfoDialog_->start(tocEdit_); +} + +void AudioCDProject::cdTextDialog() +{ + if (cdTextDialog_ == 0) + cdTextDialog_ = new CdTextDialog(); + + cdTextDialog_->start(tocEdit_); +} + +void AudioCDProject::update(unsigned long level) +{ + //FIXME: Here we should update the menus and the icons + // this is, enabled/disabled. + + level |= tocEdit_->updateLevel(); + + if (level & (UPD_TOC_DIRTY | UPD_TOC_DATA)) + updateWindowTitle(); + + audioCDView_->update(level); + + if (tocInfoDialog_) + tocInfoDialog_->update(level, tocEdit_); + + if (cdTextDialog_ != 0) + cdTextDialog_->update(level, tocEdit_); + if (recordTocDialog_ != 0) + recordTocDialog_->update(level); + + if (level & UPD_PLAY_STATUS) { + bool sensitivity[3][3] = { + //PLAY PAUSE STOP + { false, true, true }, // Playing + { true, true, true }, // Paused + { true, false, false } // Stopped + }; + + Glib::RefPtr<Gtk::Action> action; + action = m_refActionGroup->get_action ("Play"); + action->set_sensitive(sensitivity[playStatus_][0]); + action = m_refActionGroup->get_action ("Pause"); + action->set_sensitive(sensitivity[playStatus_][1]); + action = m_refActionGroup->get_action ("Stop"); + action->set_sensitive(sensitivity[playStatus_][2]); + } + + if (level & UPD_EDITABLE_STATE) { + bool editable = tocEdit_->editable(); + Glib::RefPtr<Gtk::Action> action; + action = m_refActionGroup->get_action ("Play"); + action->set_sensitive(editable); + } +} + +void AudioCDProject::playStart() +{ + unsigned long start, end; + + // If we're in paused mode, resume playing. + if (playStatus_ == PAUSED) { + playStatus_ = PLAYING; + Glib::signal_idle().connect(sigc::mem_fun(*this, + &AudioCDProject::playCallback)); + return; + } else if (playStatus_ == PLAYING) { + return; + } + + if (audioCDView_ && audioCDView_->tocEditView()) { + if (!audioCDView_->tocEditView()->sampleSelection(&start, &end)) + audioCDView_->tocEditView()->sampleView(&start, &end); + + playStart(start, end); + } +} + +void AudioCDProject::playStart(unsigned long start, unsigned long end) +{ + unsigned long level = 0; + + if (playStatus_ == PLAYING) + return; + + if (tocEdit_->lengthSample() == 0) { + guiUpdate(UPD_PLAY_STATUS); + return; + } + + if (soundInterface_ == NULL) { + soundInterface_ = new SoundIF; + if (soundInterface_->init() != 0) { + delete soundInterface_; + soundInterface_ = NULL; + guiUpdate(UPD_PLAY_STATUS); + statusMessage(_("WARNING: Cannot open \"/dev/dsp\"")); + return; + } + } + + if (soundInterface_->start() != 0) { + statusMessage(_("WARNING: Cannot open sound device")); + guiUpdate(UPD_PLAY_STATUS); + return; + } + + tocReader.init(tocEdit_->toc()); + if (tocReader.openData() != 0) { + tocReader.init(NULL); + soundInterface_->end(); + guiUpdate(UPD_PLAY_STATUS); + return; + } + + if (tocReader.seekSample(start) != 0) { + tocReader.init(NULL); + soundInterface_->end(); + guiUpdate(UPD_PLAY_STATUS); + return; + } + + playLength_ = end - start + 1; + playPosition_ = start; + playStatus_ = PLAYING; + playAbort_ = false; + + level |= UPD_PLAY_STATUS; + + //FIXME: Selection / Zooming does not depend + // on the Child, but the View. + // we should have different blocks! + tocEdit_->blockEdit(); + + guiUpdate(level); + + Glib::signal_idle().connect(sigc::mem_fun(*this, + &AudioCDProject::playCallback)); +} + +void AudioCDProject::playPause() +{ + if (playStatus_ == PAUSED) { + playStatus_ = PLAYING; + Glib::signal_idle().connect(sigc::mem_fun(*this, + &AudioCDProject::playCallback)); + } else if (playStatus_ == PLAYING) { + playStatus_ = PAUSED; + } +} + +void AudioCDProject::playStop() +{ + if (playStatus() == PAUSED) { + soundInterface_->end(); + tocReader.init(NULL); + playStatus_ = STOPPED; + tocEdit_->unblockEdit(); + playStatus_ = STOPPED; + guiUpdate(UPD_PLAY_STATUS|UPD_EDITABLE_STATE); + } else { + playAbort_ = true; + } +} + +bool AudioCDProject::playCallback() +{ + unsigned long level = 0; + + long len = playLength_ > playBurst_ ? playBurst_ : playLength_; + + if (playStatus_ == PAUSED) + { + level |= UPD_PLAY_STATUS; + guiUpdate(level); + return false; // remove idle handler + } + + if (tocReader.readSamples(playBuffer_, len) != len || + soundInterface_->play(playBuffer_, len) != 0) { + soundInterface_->end(); + tocReader.init(NULL); + playStatus_ = STOPPED; + level |= UPD_PLAY_STATUS; + tocEdit_->unblockEdit(); + guiUpdate(level); + return false; // remove idle handler + } + + playLength_ -= len; + playPosition_ += len; + + unsigned long delay = soundInterface_->getDelay(); + + if (delay <= playPosition_) + level |= UPD_PLAY_STATUS; + + if (len == 0 || playAbort_) { + soundInterface_->end(); + tocReader.init(NULL); + playStatus_ = STOPPED; + level |= UPD_PLAY_STATUS | UPD_EDITABLE_STATE; + tocEdit_->unblockEdit(); + guiUpdate(level); + return false; // remove idle handler + } + else { + guiUpdate(level); + return true; // keep idle handler + } +} + +unsigned long AudioCDProject::playPosition() +{ + return playPosition_; +} + +unsigned long AudioCDProject::getDelay() +{ + return soundInterface_->getDelay(); +} + +void AudioCDProject::on_play_clicked() +{ + playStart(); +} + +void AudioCDProject::on_stop_clicked() +{ + playStop(); +} + +void AudioCDProject::on_pause_clicked() +{ + playPause(); +} + +void AudioCDProject::on_zoom_in_clicked() +{ + if (audioCDView_) + audioCDView_->zoomx2(); +} + +void AudioCDProject::on_zoom_out_clicked() +{ + if (audioCDView_) + audioCDView_->zoomOut(); +} + +void AudioCDProject::on_zoom_fit_clicked() +{ + if (audioCDView_) + audioCDView_->fullView(); +} + +void AudioCDProject::on_zoom_clicked() +{ + if (audioCDView_) + audioCDView_->setMode(AudioCDView::ZOOM); +} + +void AudioCDProject::on_select_clicked() +{ + if (audioCDView_) + audioCDView_->setMode(AudioCDView::SELECT); +} + +void AudioCDProject::on_cancel_clicked() +{ + signalCancelClicked(); +} + +bool AudioCDProject::appendTrack(const char* file) +{ + FileExtension type = fileExtension(file); + + switch (type) { + + case FE_M3U: { + std::list<std::string> list; + if (parseM3u(file, list)) { + std::list<std::string>::iterator i = list.begin(); + for (; i != list.end(); i++) { + tocEdit()->queueAppendTrack((*i).c_str()); + } + } else { + std::string msg = "Could not read M3U file \""; + msg += file; + msg += "\""; + errorDialog(msg.c_str()); + return false; + } + break; + } + + default: + tocEdit()->queueAppendTrack(file); + } + + return true; +} + +bool AudioCDProject::appendTracks(std::list<std::string>& files) +{ + std::list<std::string>::iterator i = files.begin(); + for (; i != files.end(); i++) { + tocEdit()->queueAppendTrack((*i).c_str()); + } + return true; +} + +bool AudioCDProject::appendFiles(std::list<std::string>& files) +{ + std::list<std::string>::iterator i = files.begin(); + for (; i != files.end(); i++) { + tocEdit()->queueAppendFile((*i).c_str()); + } + return true; +} + +bool AudioCDProject::insertFiles(std::list<std::string>& files) +{ + unsigned long pos; + + TocEditView* view = audioCDView_->tocEditView(); + if (!view) return false; + if (!view->sampleMarker(&pos)) pos = 0; + + std::list<std::string>::iterator i = files.end(); + do { + i--; + tocEdit()->queueInsertFile((*i).c_str(), pos); + } while (i != files.begin()); + + return true; +} diff --git a/xdao/AudioCDProject.h b/xdao/AudioCDProject.h new file mode 100644 index 0000000..18b9089 --- /dev/null +++ b/xdao/AudioCDProject.h @@ -0,0 +1,118 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __AUDIOCDPROJECT_H__ +#define __AUDIOCDPROJECT_H__ + +#include <gtkmm.h> +#include <gtk/gtk.h> +#include <libgnomeuimm.h> + +class Toc; +class Track; +class Sample; +class SoundIF; +class AudioCDView; +class TocInfoDialog; +class CdTextDialog; +class TocEdit; +#include "Project.h" + +class AudioCDProject : public Project +{ +public: + enum PlayStatus {PLAYING, PAUSED, STOPPED}; + + AudioCDProject(int number, const char *name, TocEdit *tocEdit, + Gtk::Window *parent); + + void add_menus (Glib::RefPtr<Gtk::UIManager> m_refUIManager); + void configureAppBar (Gnome::UI::AppBar *s, Gtk::ProgressBar* p, + Gtk::Button *b); + + bool closeProject(); + + unsigned long playPosition(); + + unsigned long getDelay(); + + bool appendTrack(const char* file); + bool appendTracks(std::list<std::string>&); + bool appendFiles(std::list<std::string>&); + bool insertFiles(std::list<std::string>&); + + PlayStatus playStatus() { return playStatus_; } + + // Controls for app bar + void cancelEnable(bool); + sigc::signal0<void> signalCancelClicked; + + protected: + Gtk::Button* buttonPlay_; + Gtk::Button* buttonStop_; + Gtk::Button* buttonPause_; + + virtual void on_play_clicked(); + virtual void on_stop_clicked(); + virtual void on_pause_clicked(); + virtual void on_select_clicked(); + virtual void on_zoom_clicked(); + virtual void on_zoom_in_clicked(); + virtual void on_zoom_out_clicked(); + virtual void on_zoom_fit_clicked(); + virtual void on_cancel_clicked(); + + virtual void status(const char* msg); + virtual void errorDialog(const char* msg); + virtual void progress(double val); + virtual void fullView(); + virtual void sampleSelect(unsigned long, unsigned long); + + void playStart(); + void playStart(unsigned long start, unsigned long end); + void playPause(); + void playStop(); + +private: + TocReader tocReader; + + SoundIF *soundInterface_; + unsigned long playLength_; // remaining play length + unsigned long playBurst_; + unsigned long playPosition_; + Sample *playBuffer_; + bool playAbort_; + + bool playCallback(); + + Gtk::HBox hbox_; + AudioCDView* audioCDView_; + TocInfoDialog* tocInfoDialog_; + CdTextDialog* cdTextDialog_; + Glib::RefPtr<Gtk::ActionGroup> m_refActionGroup; + Glib::RefPtr<Gtk::ToggleAction> selectToggle_; + Glib::RefPtr<Gtk::ToggleAction> zoomToggle_; + void recordToc2CD(); + void projectInfo(); + void cdTextDialog(); + void update(unsigned long level); + + enum PlayStatus playStatus_; +}; +#endif diff --git a/xdao/AudioCDView.cc b/xdao/AudioCDView.cc new file mode 100644 index 0000000..7ba07b1 --- /dev/null +++ b/xdao/AudioCDView.cc @@ -0,0 +1,903 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gtkmm.h> +#include <gnome.h> +#include <glibmm/convert.h> +#include <iostream> + +#include "config.h" +#include "xcdrdao.h" +#include "guiUpdate.h" +#include "MessageBox.h" +#include "SampleDisplay.h" +#include "TocEdit.h" +#include "TocEditView.h" +#include "util.h" + +#include "AudioCDProject.h" +#include "AudioCDView.h" +#include "Project.h" +#include "TrackInfoDialog.h" +#include "AddFileDialog.h" +#include "AddSilenceDialog.h" + +AudioCDView::AudioCDView(AudioCDProject *project) + : addFileDialog_(project) +{ + project_ = project; + tocEditView_ = new TocEditView(project->tocEdit()); + +// These are not created until first needed, for faster startup +// and less memory usage. + trackInfoDialog_ = 0; + addSilenceDialog_ = 0; + + std::list<Gtk::TargetEntry> drop_types; + + drop_types.push_back(Gtk::TargetEntry("text/uri-list", Gtk::TargetFlags(0), + TARGET_URI_LIST)); + + drag_dest_set(drop_types); + signal_drag_data_received(). + connect(sigc::mem_fun(*this, &AudioCDView::drag_data_received_cb)); + + sampleDisplay_ = new SampleDisplay; + sampleDisplay_->setTocEdit(project->tocEdit()); + + sampleDisplay_->set_size_request(200,200); + + pack_start(*sampleDisplay_, TRUE, TRUE); + sampleDisplay_->modify_font(Pango::FontDescription("Monospace 8")); + sampleDisplay_->show(); + + Gtk::HScrollbar *scrollBar = + new Gtk::HScrollbar(*(sampleDisplay_->getAdjustment())); + pack_start(*scrollBar, FALSE, FALSE); + scrollBar->show(); + + Gtk::Label *label; + Gtk::HBox *selectionInfoBox = new Gtk::HBox; + +//FIXME: Calculate entry width for the current font. + gint entry_width = 90; + + markerPos_ = new Gtk::Entry; + markerPos_->set_editable(true); + markerPos_->set_size_request(entry_width, -1); + markerPos_->signal_activate(). + connect(sigc::mem_fun(*this, &AudioCDView::markerSet)); + + cursorPos_ = new Gtk::Label; + cursorPos_->set_size_request(entry_width, -1); + + selectionStartPos_ = new Gtk::Entry; + selectionStartPos_->set_editable(true); + selectionStartPos_->set_size_request(entry_width, -1); + selectionStartPos_->signal_activate(). + connect(sigc::mem_fun(*this, &AudioCDView::selectionSet)); + + selectionEndPos_ = new Gtk::Entry; + selectionEndPos_->set_editable(true); + selectionEndPos_->set_size_request(entry_width, -1); + selectionEndPos_->signal_activate(). + connect(sigc::mem_fun(*this, &AudioCDView::selectionSet)); + + label = new Gtk::Label(_("Cursor: ")); + selectionInfoBox->pack_start(*label, FALSE, FALSE); + selectionInfoBox->pack_start(*cursorPos_); + label->show(); + cursorPos_->show(); + + label = new Gtk::Label(_("Marker: ")); + selectionInfoBox->pack_start(*label, FALSE, FALSE); + selectionInfoBox->pack_start(*markerPos_); + label->show(); + markerPos_->show(); + + label = new Gtk::Label(_("Selection: ")); + selectionInfoBox->pack_start(*label, FALSE, FALSE); + selectionInfoBox->pack_start(*selectionStartPos_); + label->show(); + selectionStartPos_->show(); + + label = new Gtk::Label(" - "); + selectionInfoBox->pack_start(*label, FALSE, FALSE); + selectionInfoBox->pack_start(*selectionEndPos_); + label->show(); + selectionEndPos_->show(); + + selectionInfoBox->set_border_width(2); + pack_start(*selectionInfoBox, FALSE, FALSE); + selectionInfoBox->show(); + + setMode(SELECT); + + sampleDisplay_->markerSet.connect(sigc::mem_fun(*this, + &AudioCDView::markerSetCallback)); + sampleDisplay_->selectionSet.connect(sigc::mem_fun(*this, + &AudioCDView::selectionSetCallback)); + sampleDisplay_->selectionCleared.connect(sigc::mem_fun(*this, + &AudioCDView::selectionClearedCallback)); + sampleDisplay_->cursorMoved.connect(sigc::mem_fun(*this, + &AudioCDView::cursorMovedCallback)); + sampleDisplay_->trackMarkSelected.connect(sigc::mem_fun(*this, + &AudioCDView::trackMarkSelectedCallback)); + sampleDisplay_->trackMarkMoved.connect(sigc::mem_fun(*this, + &AudioCDView::trackMarkMovedCallback)); + sampleDisplay_->viewModified.connect(sigc::mem_fun(*this, + &AudioCDView::viewModifiedCallback)); + + tocEditView_->sampleViewFull(); +} + +AudioCDView::~AudioCDView() +{ + if (trackInfoDialog_) + delete trackInfoDialog_; + + if (addSilenceDialog_) + delete addSilenceDialog_; +} + +void AudioCDView::add_menus(Glib::RefPtr<Gtk::UIManager> m_refUIManager) +{ + m_refActionGroup = Gtk::ActionGroup::create("AudioCDView"); + + m_refActionGroup->add( Gtk::Action::create("TrackInfo", Gtk::Stock::PROPERTIES, + _("Track Info..."), + _("Edit track data")), + sigc::mem_fun(*this, &AudioCDView::trackInfo) ); + + m_refActionGroup->add( Gtk::Action::create("Cut", Gtk::Stock::CUT, + _("Cut"), + _("Cut out selected samples")), + Gtk::AccelKey("<control>x"), + sigc::mem_fun(*this, &AudioCDView::cutTrackData) ); + + m_refActionGroup->add( Gtk::Action::create("Paste", Gtk::Stock::PASTE, + _("Paste"), + _("Paste previously cut samples")), + Gtk::AccelKey("<control>v"), + sigc::mem_fun(*this, &AudioCDView::pasteTrackData) ); + + m_refActionGroup->add( Gtk::Action::create("SelectAll", + _("Select All"), + _("Select entire sample")), + Gtk::AccelKey("<control>a"), + sigc::mem_fun(*this, &AudioCDView::selectAll) ); + + m_refActionGroup->add( Gtk::Action::create("AddTrackMark", + _("Add Track Mark"), + _("Add track marker at current marker position")), + Gtk::AccelKey("<control>m"), + sigc::mem_fun(*this, &AudioCDView::addTrackMark) ); + + m_refActionGroup->add( Gtk::Action::create("AddIndexMark", + _("Add Index Mark"), + _("Add index marker at current marker position")), + sigc::mem_fun(*this, &AudioCDView::addIndexMark) ); + + m_refActionGroup->add( Gtk::Action::create("AddPreGap", + _("Add Pre-Gap"), + _("Add pre-gap at current marker position")), + sigc::mem_fun(*this, &AudioCDView::addPregap) ); + + m_refActionGroup->add( Gtk::Action::create("RemoveTrackMark", + _("Remove Track Mark"), + _("Remove selected track/index marker or pre-gap")), + Gtk::AccelKey("<control>D"), + sigc::mem_fun(*this, &AudioCDView::removeTrackMark) ); + + m_refActionGroup->add( Gtk::Action::create("AppendTrack", + _("Append Track"), + _("Append track with data from audio file")), + Gtk::AccelKey("<control>T"), + sigc::mem_fun(*this, &AudioCDView::appendTrack) ); + + m_refActionGroup->add( Gtk::Action::create("AppendFile", + _("Append File"), + _("Append data from audio file to last track")), + Gtk::AccelKey("<control>F"), + sigc::mem_fun(*this, &AudioCDView::appendFile) ); + + m_refActionGroup->add( Gtk::Action::create("InsertFile", + _("Insert File"), + _("Insert data from audio file at current marker position")), + Gtk::AccelKey("<control>I"), + sigc::mem_fun(*this, &AudioCDView::insertFile) ); + + m_refActionGroup->add( Gtk::Action::create("AppendSilence", + _("Append Silence"), + _("Append silence to last track")), + sigc::mem_fun(*this, &AudioCDView::appendSilence) ); + + m_refActionGroup->add( Gtk::Action::create("InsertSilence", + _("Insert Silence"), + _("Insert silence at current marker position")), + sigc::mem_fun(*this, &AudioCDView::insertSilence) ); + + m_refUIManager->insert_action_group(m_refActionGroup); + + // Merge menuitems + try + { + Glib::ustring ui_info = + "<ui>" + " <menubar name='MenuBar'>" + " <menu action='EditMenu'>" + " <menuitem action='TrackInfo'/>" + " <separator/>" + " <menuitem action='Cut'/>" + " <menuitem action='Paste'/>" + " <separator/>" + " <menuitem action='SelectAll'/>" + " <separator/>" + " <menuitem action='AddTrackMark'/>" + " <menuitem action='AddIndexMark'/>" + " <menuitem action='AddPreGap'/>" + " <menuitem action='RemoveTrackMark'/>" + " <separator/>" + " <menuitem action='AppendTrack'/>" + " <menuitem action='AppendFile'/>" + " <menuitem action='InsertFile'/>" + " <separator/>" + " <menuitem action='AppendSilence'/>" + " <menuitem action='InsertSilence'/>" + " </menu>" + " </menubar>" + "</ui>"; + + m_refUIManager->add_ui_from_string(ui_info); + } + catch(const Glib::Error& ex) + { + std::cerr << "merging menus failed: " << ex.what(); + } +} + +void AudioCDView::update(unsigned long level) +{ + if (level & (UPD_TOC_DIRTY | UPD_TOC_DATA)) { + cursorPos_->set_text(""); + } + + if (level & UPD_TRACK_MARK_SEL) { + int trackNr, indexNr; + + if (tocEditView_->trackSelection(&trackNr) && + tocEditView_->indexSelection(&indexNr)) { + sampleDisplay_->setSelectedTrackMarker(trackNr, indexNr); + } + else { + sampleDisplay_->setSelectedTrackMarker(0, 0); + } + } + + if (level & UPD_SAMPLES) { + unsigned long smin, smax; + + tocEditView_->sampleView(&smin, &smax); + sampleDisplay_->updateToc(smin, smax); + } + else if (level & (UPD_TRACK_DATA | UPD_TRACK_MARK_SEL)) { + sampleDisplay_->updateTrackMarks(); + } + + if (level & UPD_SAMPLE_MARKER) { + unsigned long marker; + + if (tocEditView_->sampleMarker(&marker)) { + markerPos_->set_text(sample2string(marker)); + sampleDisplay_->setMarker(marker); + } + else { + markerPos_->set_text(""); + sampleDisplay_->clearMarker(); + } + } + + if (level & UPD_SAMPLE_SEL) { + unsigned long start, end; + + if (tocEditView_->sampleSelection(&start, &end)) { + selectionStartPos_->set_text(sample2string(start)); + selectionEndPos_->set_text(sample2string(end)); + sampleDisplay_->setRegion(start, end); + } else { + selectionStartPos_->set_text(""); + selectionEndPos_->set_text(""); + sampleDisplay_->clearRegion(); + } + } + + if (level & UPD_PLAY_STATUS) { + switch (project_->playStatus()) { + case AudioCDProject::PLAYING: + sampleDisplay_->setCursor(1, project_->playPosition() - + project_->getDelay()); + // FIXME: What about using a separate cursor for playing? + cursorPos_->set_text(sample2string(project_->playPosition() - + project_->getDelay())); + break; + case AudioCDProject::PAUSED: + sampleDisplay_->setCursor(1, project_->playPosition() - + project_->getDelay()); + // FIXME: What about using a separate cursor for playing? + cursorPos_->set_text(sample2string(project_->playPosition() - + project_->getDelay())); + break; + case AudioCDProject::STOPPED: + sampleDisplay_->setCursor(0, 0); + break; + default: + std::cerr << "invalid play status" << std::endl; + } + } + + if (trackInfoDialog_ != 0) + trackInfoDialog_->update(level, tocEditView_); + + addFileDialog_.update(level); + + if (addSilenceDialog_ != 0) + addSilenceDialog_->update(level, tocEditView_); + +} + +void AudioCDView::zoomIn() +{ + unsigned long start, end; + + if (tocEditView_->sampleSelection(&start, &end)) { + if (tocEditView_->sampleView(start, end)) { + update(UPD_SAMPLES); + } + } +} + +void AudioCDView::zoomx2() +{ + unsigned long start, end, len, center; + + tocEditView_->sampleView(&start, &end); + + len = end - start + 1; + center = start + len / 2; + + start = center - len / 4; + end = center + len / 4; + + if (tocEditView_->sampleView(start, end)) { + update(UPD_SAMPLES); + } +} + +void AudioCDView::zoomOut() +{ + unsigned long start, end, len, center; + + tocEditView_->sampleView(&start, &end); + + len = end - start + 1; + center = start + len / 2; + + if (center > len) + start = center - len; + else + start = 0; + + end = center + len; + if (end >= tocEditView_->tocEdit()->toc()->length().samples()) + end = tocEditView_->tocEdit()->toc()->length().samples() - 1; + + if (tocEditView_->sampleView(start, end)) { + update(UPD_SAMPLES); + } +} + +void AudioCDView::fullView() +{ + tocEditView_->sampleViewFull(); + update(UPD_SAMPLES); +} + +int AudioCDView::getMarker(unsigned long *sample) +{ + if (tocEditView_->tocEdit()->lengthSample() == 0) + return 0; + + if (sampleDisplay_->getMarker(sample) == 0) { + project_->statusMessage(_("Please set marker.")); + return 0; + } + + return 1; +} + +void AudioCDView::trackMarkSelectedCallback(const Track *, int trackNr, + int indexNr) +{ + tocEditView_->trackSelection(trackNr); + tocEditView_->indexSelection(indexNr); + update(UPD_TRACK_MARK_SEL); +} + +// Called when the user clicks on the SampleDisplay +void AudioCDView::markerSetCallback(unsigned long sample) +{ + tocEditView_->sampleMarker(sample); + update(UPD_SAMPLE_MARKER); +} + +// Called when the user makes a selection on the SampleDisplay +void AudioCDView::selectionSetCallback(unsigned long start, + unsigned long end) +{ + if (mode_ == ZOOM ) { + if (tocEditView_->sampleView(start, end)) { + update(UPD_SAMPLES); + } + } + else { + tocEditView_->sampleSelect(start, end); + update(UPD_SAMPLE_SEL); + } +} + +void AudioCDView::selectAll() +{ + tocEditView_->sampleSelectAll(); + update(UPD_SAMPLE_SEL); +} + +void AudioCDView::selectionClearedCallback() +{ + if (mode_ != ZOOM) { + if (tocEditView_->sampleSelectionClear()) { + update(UPD_SAMPLE_SEL); + } + } +} + +void AudioCDView::cursorMovedCallback(unsigned long pos) +{ + cursorPos_->set_text(sample2string(pos)); +} + +void AudioCDView::viewModifiedCallback(unsigned long start, unsigned long end) +{ + if (tocEditView_->sampleView(start, end)) { + update(UPD_SAMPLES); + } +} + +void AudioCDView::setMode(Mode m) +{ + mode_ = m; +} + +// Called when the user enters a value in the marker entry +void AudioCDView::markerSet() +{ + unsigned long s = string2sample(markerPos_->get_text().c_str()); + + tocEditView_->sampleMarker(s); + update(UPD_SAMPLE_MARKER); +} + +// Called when the user enters a value in one of the two selection entries +void AudioCDView::selectionSet() +{ + unsigned long s1 = + string2sample(selectionStartPos_->get_text().c_str()); + unsigned long s2 = + string2sample(selectionEndPos_->get_text().c_str()); + + tocEditView_->sampleSelect(s1, s2); + update(UPD_SAMPLE_SEL); +} + +void +AudioCDView::drag_data_received_cb(const Glib::RefPtr<Gdk::DragContext>& + context, int x, int y, + const Gtk::SelectionData& selection_data, + guint info, guint time) +{ + switch (info) { + + case TARGET_URI_LIST: + + if (project_->playStatus() != AudioCDProject::STOPPED) + return; + + std::string list = selection_data.get_data_as_string(); + int idx = 0, n; + + while ((n = list.find("\r\n", idx)) >= 0) { + std::string sub = list.substr(idx, n - idx); + idx = n + 2; + + std::string fn; + try { + fn = Glib::filename_from_uri(sub); + } catch (std::exception& e) { + fn.clear(); + } + + if (fn.empty()) + continue; + + // Process m3u file. + FileExtension type = fileExtension(fn.c_str()); + + if (type == FE_WAV || type == FE_M3U +#ifdef HAVE_MP3_SUPPORT + || type == FE_MP3 +#endif +#ifdef HAVE_OGG_SUPPORT + || type == FE_OGG +#endif + ) { + project_->appendTrack(fn.c_str()); + } + } + break; + } +} +void AudioCDView::trackInfo() +{ + int track; + + if (tocEditView_->trackSelection(&track)) { + + if (trackInfoDialog_ == 0) + trackInfoDialog_ = new TrackInfoDialog(); + + trackInfoDialog_->start(tocEditView_); + + } else { + + Gtk::MessageDialog md(*project_->getParentWindow (), _("Please select a track first"), + Gtk::MESSAGE_INFO); + md.run(); + } +} + +void AudioCDView::cutTrackData() +{ + if (!project_->tocEdit()->editable()) { + project_->tocBlockedMsg("Cut"); + return; + } + + switch (project_->tocEdit()->removeTrackData(tocEditView_)) { + case 0: + project_->statusMessage(_("Removed selected samples.")); + signal_tocModified(UPD_TOC_DATA | UPD_TRACK_DATA | UPD_SAMPLE_SEL | UPD_SAMPLE_MARKER | UPD_SAMPLES); + break; + case 1: + project_->statusMessage(_("Please select samples.")); + break; + case 2: + project_->statusMessage(_("Selected sample range crosses track " + "boundaries.")); + break; + } +} + +void AudioCDView::pasteTrackData() +{ + if (!project_->tocEdit()->editable()) { + project_->tocBlockedMsg("Paste"); + return; + } + + switch (project_->tocEdit()->insertTrackData(tocEditView_)) { + case 0: + project_->statusMessage(_("Pasted samples.")); + signal_tocModified(UPD_TOC_DATA | UPD_TRACK_DATA | UPD_SAMPLE_SEL); + break; + case 1: + project_->statusMessage(_("No samples in scrap.")); + break; + } +} + +void AudioCDView::addTrackMark() +{ + unsigned long sample; + + if (!project_->tocEdit()->editable()) { + project_->tocBlockedMsg(_("Add Track Mark")); + return; + } + + if (getMarker(&sample)) { + long lba; + int snapped = snapSampleToBlock(sample, &lba); + + switch (project_->tocEdit()->addTrackMarker(lba)) { + case 0: + project_->statusMessage(_("Added track mark at %s%s."), Msf(lba).str(), + snapped ? _(" (snapped to next block)") : ""); + signal_tocModified(UPD_TOC_DATA | UPD_TRACK_DATA | UPD_SAMPLE_MARKER); + break; + + case 2: + project_->statusMessage(_("Cannot add track at this point.")); + break; + + case 3: + case 4: + project_->statusMessage(_("Resulting track would be shorter than " + "4 seconds.")); + break; + + case 5: + project_->statusMessage(_("Cannot modify a data track.")); + break; + + default: + project_->statusMessage(_("Internal error in addTrackMark(), please " + "report.")); + break; + } + } +} + +void AudioCDView::addIndexMark() +{ + unsigned long sample; + + if (!project_->tocEdit()->editable()) { + project_->tocBlockedMsg(_("Add Index Mark")); + return; + } + + if (getMarker(&sample)) { + long lba; + int snapped = snapSampleToBlock(sample, &lba); + + switch (project_->tocEdit()->addIndexMarker(lba)) { + case 0: + project_->statusMessage(_("Added index mark at %s%s."), Msf(lba).str(), + snapped ? _(" (snapped to next block)") : ""); + signal_tocModified(UPD_TRACK_DATA | UPD_SAMPLE_MARKER); + break; + + case 2: + project_->statusMessage(_("Cannot add index at this point.")); + break; + + case 3: + project_->statusMessage(_("Track has already 98 index marks.")); + break; + + default: + project_->statusMessage(_("Internal error in addIndexMark(), " + "please report.")); + break; + } + } +} + +void AudioCDView::addPregap() +{ + unsigned long sample; + + if (!project_->tocEdit()->editable()) { + project_->tocBlockedMsg(_("Add Pre-Gap")); + return; + } + + if (getMarker(&sample)) { + long lba; + int snapped = snapSampleToBlock(sample, &lba); + + switch (project_->tocEdit()->addPregap(lba)) { + case 0: + project_->statusMessage(_("Added pre-gap mark at %s%s."), Msf(lba).str(), + snapped ? _(" (snapped to next block)") : ""); + signal_tocModified(UPD_TRACK_DATA | UPD_SAMPLE_MARKER); + break; + + case 2: + project_->statusMessage(_("Cannot add pre-gap at this point.")); + break; + + case 3: + project_->statusMessage(_("Track would be shorter than 4 seconds.")); + break; + + case 4: + project_->statusMessage(_("Cannot modify a data track.")); + break; + + default: + project_->statusMessage(_("Internal error in addPregap(), " + "please report.")); + break; + } + } +} + +void AudioCDView::removeTrackMark() +{ + int trackNr; + int indexNr; + + if (!project_->tocEdit()->editable()) { + project_->tocBlockedMsg(_("Remove Track Mark")); + return; + } + + if (tocEditView_->trackSelection(&trackNr) && + tocEditView_->indexSelection(&indexNr)) { + switch (project_->tocEdit()->removeTrackMarker(trackNr, indexNr)) { + case 0: + project_->statusMessage(_("Removed track/index marker.")); + signal_tocModified(UPD_TOC_DATA | UPD_TRACK_DATA | UPD_SAMPLE_MARKER); + break; + case 1: + project_->statusMessage(_("Cannot remove first track.")); + break; + case 3: + project_->statusMessage(_("Cannot modify a data track.")); + break; + default: + project_->statusMessage(_("Internal error in removeTrackMark(), " + "please report.")); + break; + } + } + else { + project_->statusMessage(_("Please select a track/index mark.")); + } +} + +int AudioCDView::snapSampleToBlock(unsigned long sample, long *block) +{ + unsigned long rest = sample % SAMPLES_PER_BLOCK; + + *block = sample / SAMPLES_PER_BLOCK; + + if (rest == 0) + return 0; + + if (rest > SAMPLES_PER_BLOCK / 2) + *block += 1; + + return 1; +} + +void AudioCDView::trackMarkMovedCallback(const Track *, int trackNr, + int indexNr, unsigned long sample) +{ + if (!project_->tocEdit()->editable()) { + project_->tocBlockedMsg(_("Move Track Marker")); + return; + } + + long lba; + int snapped = snapSampleToBlock(sample, &lba); + + switch (project_->tocEdit()->moveTrackMarker(trackNr, indexNr, lba)) { + case 0: + project_->statusMessage(_("Moved track marker to %s%s."), Msf(lba).str(), + snapped ? _(" (snapped to next block)") : ""); + break; + + case 6: + project_->statusMessage(_("Cannot modify a data track.")); + break; + default: + project_->statusMessage(_("Illegal track marker position.")); + break; + } + + tocEditView_->trackSelection(trackNr); + tocEditView_->indexSelection(indexNr); + + update(UPD_TRACK_MARK_SEL); +} + +void AudioCDView::appendTrack() +{ + addFileDialog_.mode(AddFileDialog::M_APPEND_TRACK); + addFileDialog_.start(); +} + +void AudioCDView::appendFile() +{ + addFileDialog_.mode(AddFileDialog::M_APPEND_FILE); + addFileDialog_.start(); +} + +void AudioCDView::insertFile() +{ + addFileDialog_.mode(AddFileDialog::M_INSERT_FILE); + addFileDialog_.start(); +} + +void AudioCDView::appendSilence() +{ + if (addSilenceDialog_ == 0) { + addSilenceDialog_ = new AddSilenceDialog(); + addSilenceDialog_->set_transient_for(*project_->getParentWindow ()); + addSilenceDialog_->signal_tocModified. + connect(sigc::mem_fun(*this, &AudioCDView::update)); + addSilenceDialog_->signal_fullView. + connect(sigc::mem_fun(*this, &AudioCDView::fullView)); + } + + addSilenceDialog_->mode(AddSilenceDialog::M_APPEND); + addSilenceDialog_->start(tocEditView_); +} + +void AudioCDView::insertSilence() +{ + if (addSilenceDialog_ == 0) + addSilenceDialog_ = new AddSilenceDialog(); + + addSilenceDialog_->mode(AddSilenceDialog::M_INSERT); + addSilenceDialog_->start(tocEditView_); +} + +const char *AudioCDView::sample2string(unsigned long sample) +{ + static char buf[50]; + + unsigned long min = sample / (60 * 44100); + sample %= 60 * 44100; + + unsigned long sec = sample / 44100; + sample %= 44100; + + unsigned long frame = sample / 588; + sample %= 588; + + sprintf(buf, "%2lu:%02lu:%02lu.%03lu", min, sec, frame, sample); + + return buf; +} + +unsigned long AudioCDView::string2sample(const char *str) +{ + int m = 0; + int s = 0; + int f = 0; + int n = 0; + + sscanf(str, "%d:%d:%d.%d", &m, &s, &f, &n); + + if (m < 0) + m = 0; + + if (s < 0 || s > 59) + s = 0; + + if (f < 0 || f > 74) + f = 0; + + if (n < 0 || n > 587) + n = 0; + + return Msf(m, s, f).samples() + n; +} diff --git a/xdao/AudioCDView.h b/xdao/AudioCDView.h new file mode 100644 index 0000000..4872e66 --- /dev/null +++ b/xdao/AudioCDView.h @@ -0,0 +1,121 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __AUDIO_CD_VIEW_H__ +#define __AUDIO_CD_VIEW_H__ + +#include <gtkmm.h> +#include <gtk/gtk.h> +#include <libgnomeuimm.h> + +#include "AddFileDialog.h" +#include "GenericView.h" +#include <list> + +class SampleDisplay; +class Project; +class TrackInfoDialog; +class AddFileDialog; +class AddSilenceDialog; +class Track; + +enum { + TARGET_URI_LIST, +}; + +class AudioCDView : public GenericView +{ +public: + AudioCDView(AudioCDProject *project); + ~AudioCDView(); + void add_menus(Glib::RefPtr<Gtk::UIManager> m_refUIManager); + sigc::signal0<void> add_view; + + void update(unsigned long level = 0); + + enum Mode { ZOOM, SELECT }; + void setMode(Mode); + + void zoomIn(); + void zoomx2(); + void zoomOut(); + void fullView(); + + sigc::signal1<void, unsigned long> signal_tocModified; + + protected: + static const char* sample2string(unsigned long sample); + static unsigned long string2sample(const char* s); + +private: + AudioCDProject *project_; + + Glib::RefPtr<Gtk::ActionGroup> m_refActionGroup; + + TrackInfoDialog* trackInfoDialog_; + AddFileDialog addFileDialog_; + AddSilenceDialog* addSilenceDialog_; + + Mode mode_; + SampleDisplay *sampleDisplay_; + + Gtk::Entry* markerPos_; + Gtk::Label* cursorPos_; + Gtk::Entry* selectionStartPos_; + Gtk::Entry* selectionEndPos_; + + void markerSetCallback(unsigned long); + void cursorMovedCallback(unsigned long); + void selectionSetCallback(unsigned long, unsigned long); + void selectAll(); + void selectionClearedCallback(); + void trackMarkSelectedCallback(const Track *, int trackNr, int indexNr); + void trackMarkMovedCallback(const Track *, int trackNr, int indexNr, + unsigned long sample); + void viewModifiedCallback(unsigned long, unsigned long); + int snapSampleToBlock(unsigned long sample, long *block); + + void trackInfo(); + void cutTrackData(); + void pasteTrackData(); + + void addTrackMark(); + void addIndexMark(); + void addPregap(); + void removeTrackMark(); + + void appendSilence(); + void insertSilence(); + + void appendTrack(); + void appendFile(); + void insertFile(); + + int getMarker(unsigned long *sample); + void markerSet(); + + void selectionSet(); + + void drag_data_received_cb(const Glib::RefPtr<Gdk::DragContext>& context, + int x, int y, + const Gtk::SelectionData& selection_data, + guint info, guint time); +}; + +#endif diff --git a/xdao/BUGS b/xdao/BUGS new file mode 100644 index 0000000..908e1e4 --- /dev/null +++ b/xdao/BUGS @@ -0,0 +1,26 @@ +Status Who Description +====== ====== ============================================================== + +- - Infinite messages from cdrdao if you close xcdrdao while + extracting: xcdrdao should not exit!! and if xcdrdao crashes + cdrdao should get a SIGPIPE, continue recording and send + messages to stdout if appropiate, but don't try to send + messages to xcdrdao again. + +- - In the Extract process xcdrdao is getting: 31 32 33 32 33 34 !! + of trackProgress this makes the progressbar decrease and + increase. It looks ugly :) + +- - Using a big number with buffers when recording won't work! + 'new' throwing an exception? (try ... else ... ???) + +- - I can press the eject button on my cdrom and the CD will + eject, the problem is that I'm extracting! xcdrdao/cdrdao + should block the CD! until the operation is done. + +- - When writing (simulated!) I was not able to eject the CD, + good :), but if I try (in gmc) right click->eject device, + this command will block, and make cdrdao "hang" without + any error messages until you abort the recording, then + the CD will eject ;). The device should not receive any + other command when writing!!! diff --git a/xdao/BlankCDDialog.cc b/xdao/BlankCDDialog.cc new file mode 100644 index 0000000..b2a3fe6 --- /dev/null +++ b/xdao/BlankCDDialog.cc @@ -0,0 +1,365 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <libgnomeuimm.h> + +#include "guiUpdate.h" +#include "DeviceList.h" +#include "MessageBox.h" +#include "BlankCDDialog.h" +#include "Settings.h" +#include "Icons.h" + +#include <gtkmm.h> +#include <gnome.h> + +BlankCDDialog::BlankCDDialog() +{ + Gtk::VBox *vbox = new Gtk::VBox; + vbox->set_border_width(10); + vbox->set_spacing(10); + add(*vbox); + + active_ = false; + moreOptionsDialog_ = 0; + speed_ = 1; + + Devices = new DeviceList(CdDevice::CD_RW); + vbox->pack_start(*Devices, true, true); + + // device settings + Gtk::Frame *blankOptionsFrame = new Gtk::Frame(_(" Blank Options ")); + Gtk::VBox *frameBox = new Gtk::VBox; + frameBox->set_border_width(5); + frameBox->set_spacing(5); + blankOptionsFrame->add(*frameBox); + + fastBlank_rb = + new Gtk::RadioButton(_("Fast Blank - does not erase contents"), 0); + fullBlank_rb = + new Gtk::RadioButton(_("Full Blank - erases contents, slower"), 0); + + Gtk::RadioButton::Group rb_group = fastBlank_rb->get_group(); + fullBlank_rb->set_group(rb_group); + + frameBox->pack_start(*fastBlank_rb); + frameBox->pack_start(*fullBlank_rb); + + Gtk::Image *moreOptionsPixmap = + manage(new Gtk::Image(Gtk::StockID(Gtk::Stock::PROPERTIES), + Gtk::ICON_SIZE_SMALL_TOOLBAR)); + Gtk::Label *moreOptionsLabel = manage(new Gtk::Label(_("More Options"))); + Gtk::HBox *moreOptionsBox = manage(new Gtk::HBox); + moreOptionsBox->set_border_width(2); + Gtk::Button *moreOptionsButton = manage(new Gtk::Button()); + moreOptionsBox->pack_start(*moreOptionsPixmap, false, false, 3); + moreOptionsBox->pack_start(*moreOptionsLabel, false, false, 4); + moreOptionsButton->add(*moreOptionsBox); + moreOptionsButton->signal_clicked(). + connect(mem_fun(*this, &BlankCDDialog::moreOptions)); + moreOptionsBox = manage(new Gtk::HBox); + frameBox->pack_start(*moreOptionsBox); + moreOptionsBox->pack_end(*moreOptionsButton, false, false); + + vbox->pack_start(*blankOptionsFrame, false, false); + + Gtk::Image *pixmap = manage(new Gtk::Image(Icons::GCDMASTER, + Gtk::ICON_SIZE_DIALOG)); + Gtk::Label *startLabel = manage(new Gtk::Label(_("Start"))); + Gtk::VBox *startBox = manage(new Gtk::VBox); + Gtk::Button *button = manage(new Gtk::Button()); + startBox->pack_start(*pixmap, false, false); + startBox->pack_start(*startLabel, false, false); + + button->add(*startBox); + button->signal_clicked().connect(mem_fun(*this, &BlankCDDialog::startAction)); + + Gtk::HBox *hbox2 = manage(new Gtk::HBox); + hbox2->set_spacing(20); + hbox2->set_border_width(10); + hbox2->pack_start(*button); + + Gtk::Button* cancel_but = + manage(new Gtk::Button(Gtk::StockID(Gtk::Stock::CANCEL))); + cancel_but->signal_clicked().connect(mem_fun(*this, &BlankCDDialog::stop)); + hbox2->pack_start(*cancel_but); + vbox->pack_start(*hbox2, Gtk::PACK_SHRINK); + + show_all_children(); +} + +void BlankCDDialog::moreOptions() +{ + if (!moreOptionsDialog_) { + moreOptionsDialog_ = new Gtk::MessageDialog(*this, _("Blank options"), false, + Gtk::MESSAGE_QUESTION, + Gtk::BUTTONS_CLOSE, true); + + Gtk::VBox *vbox = moreOptionsDialog_->get_vbox(); + Gtk::Frame *frame = new Gtk::Frame(_(" More Blank Options ")); + vbox->pack_start(*frame); + vbox = new Gtk::VBox; + vbox->set_border_width(10); + vbox->set_spacing(5); + frame->add(*vbox); + + ejectButton_ = new Gtk::CheckButton(_("Eject the CD after blanking"), 0); + ejectButton_->set_active(false); + vbox->pack_start(*ejectButton_); + + reloadButton_ = + new Gtk::CheckButton(_("Reload the CD after writing, if necessary"), 0); + reloadButton_->set_active(false); + vbox->pack_start(*reloadButton_); + + Gtk::HBox *hbox = new Gtk::HBox; + Gtk::Label *label = new Gtk::Label(_("Speed: "), 0); + hbox->pack_start(*label, false, false); + + Gtk::Adjustment *adjustment = new Gtk::Adjustment(1, 1, 20); + speedSpinButton_ = new Gtk::SpinButton(*adjustment); + speedSpinButton_->set_digits(0); + speedSpinButton_->set_sensitive(false); + adjustment->signal_value_changed(). + connect(mem_fun(*this, &BlankCDDialog::speedChanged)); + hbox->pack_start(*speedSpinButton_, false, false, 10); + + speedButton_ = new Gtk::CheckButton(_("Use max."), 0); + speedButton_->set_active(true); + speedButton_->signal_toggled(). + connect(mem_fun(*this, &BlankCDDialog::speedButtonChanged)); + hbox->pack_start(*speedButton_, true, true); + vbox->pack_start(*hbox); + moreOptionsDialog_->show_all_children(); + } + + moreOptionsDialog_->show(); + moreOptionsDialog_->run(); + moreOptionsDialog_->hide(); +} + +void BlankCDDialog::start(Gtk::Window& parent) +{ + present(); + active_ = true; + parent_ = &parent; + update(UPD_CD_DEVICES); +} + +void BlankCDDialog::stop() +{ + hide(); + if (moreOptionsDialog_) + moreOptionsDialog_->hide(); + active_ = false; +} + +void BlankCDDialog::update(unsigned long level) +{ + if (!active_) + return; + + set_title(_("Blank CD Rewritable")); + + if (level & UPD_CD_DEVICES) + Devices->import(); + else if (level & UPD_CD_DEVICE_STATUS) + { + Devices->importStatus(); + Devices->selectOne(); + } +} + +bool BlankCDDialog::on_delete_event(GdkEventAny*) +{ + stop(); + return 1; +} + +void BlankCDDialog::startAction() +{ + if (Devices->selection().empty()) { + Gtk::MessageDialog d(*this, + _("Please select at least one recorder device"), + Gtk::MESSAGE_WARNING); + d.run(); + return; + } + + int fast; + if (fastBlank_rb->get_active()) + fast = 1; + else + fast = 0; + + int eject = checkEjectWarning(this); + int reload = checkReloadWarning(this); + int burnSpeed = getSpeed(); + + std::string targetData = Devices->selection(); + + CdDevice *writeDevice = CdDevice::find(targetData.c_str()); + + if (writeDevice) { + if (writeDevice->blank(parent_, fast, burnSpeed, eject, reload) != 0) { + Gtk::MessageDialog d(*this, _("Cannot start blanking"), + Gtk::MESSAGE_ERROR); + d.run(); + } else + guiUpdate(UPD_CD_DEVICE_STATUS); + } + + stop(); +} + +void BlankCDDialog::speedButtonChanged() +{ + if (speedButton_->get_active()) + { + speedSpinButton_->set_sensitive(false); + } + else + { + speedSpinButton_->set_sensitive(true); + } +} + +void BlankCDDialog::speedChanged() +{ +//FIXME: get max burn speed from selected burner(s) + int new_speed; + + new_speed = speedSpinButton_->get_value_as_int(); + + if ((new_speed % 2) == 1) + { + if (new_speed > 2) + { + if (new_speed > speed_) + { + new_speed = new_speed + 1; + } + else + { + new_speed = new_speed - 1; + } + } + speedSpinButton_->set_value(new_speed); + } + speed_ = new_speed; +} + +bool BlankCDDialog::getEject() +{ + if (moreOptionsDialog_) + return ejectButton_->get_active() ? 1 : 0; + else + return 0; +} + +int BlankCDDialog::checkEjectWarning(Gtk::Window *parent) +{ + // If ejecting the CD after recording is requested issue a warning message + // because buffer under runs may occur for other devices that are recording. + if (getEject()) + { + if (gnome_config_get_bool(SET_RECORD_EJECT_WARNING)) { + Ask3Box msg(parent, _("Request"), 1, 2, + _("Ejecting a CD may block the SCSI bus and"), + _("cause buffer under runs when other devices"), + _("are still recording."), "", + _("Keep the eject setting anyway?"), NULL); + + switch (msg.run()) { + case 1: // keep eject setting + if (msg.dontShowAgain()) + { + gnome_config_set_bool(SET_RECORD_EJECT_WARNING, FALSE); + gnome_config_sync(); + } + return 1; + break; + case 2: // don't keep eject setting + ejectButton_->set_active(false); + return 0; + break; + default: // cancel + return -1; + break; + } + } + return 1; + } + return 0; +} + +bool BlankCDDialog::getReload() +{ + if (moreOptionsDialog_) + return reloadButton_->get_active() ? 1 : 0; + else + return 0; +} + +int BlankCDDialog::checkReloadWarning(Gtk::Window *parent) +{ + // The same is true for reloading the disk. + if (getReload()) + { + if (gnome_config_get_bool(SET_RECORD_RELOAD_WARNING)) { + Ask3Box msg(parent, _("Request"), 1, 2, + _("Reloading a CD may block the SCSI bus and"), + _("cause buffer under runs when other devices"), + _("are still recording."), "", + _("Keep the reload setting anyway?"), NULL); + + switch (msg.run()) { + case 1: // keep reload setting + if (msg.dontShowAgain()) + { + gnome_config_set_bool(SET_RECORD_RELOAD_WARNING, FALSE); + gnome_config_sync(); + } + return 1; + break; + case 2: // don't keep reload setting + reloadButton_->set_active(false); + return 0; + break; + default: // cancel + return -1; + break; + } + } + return 1; + } + return 0; +} + +int BlankCDDialog::getSpeed() +{ + if (moreOptionsDialog_) + { + if (speedButton_->get_active()) + return 0; + else + return speed_; + } + return 0; +} diff --git a/xdao/BlankCDDialog.h b/xdao/BlankCDDialog.h new file mode 100644 index 0000000..e4e756c --- /dev/null +++ b/xdao/BlankCDDialog.h @@ -0,0 +1,66 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998, 1999 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __BLANK_CD_DIALOG_H +#define __BLANK_CD_DIALOG_H + +#include <libgnomeuimm.h> + +class Project; + +class DeviceList; + +class BlankCDDialog : public Gtk::Window { +public: + BlankCDDialog(); + + void start(Gtk::Window& parent); + void update(unsigned long level); + +private: + DeviceList *Devices; + Gtk::Window* parent_; + + bool active_; + int speed_; + + Gtk::RadioButton *fastBlank_rb; + Gtk::RadioButton *fullBlank_rb; + Gtk::MessageDialog *moreOptionsDialog_; + Gtk::CheckButton *ejectButton_; + Gtk::CheckButton *reloadButton_; + + Gtk::SpinButton *speedSpinButton_; + Gtk::CheckButton *speedButton_; + + void stop(); + void startAction(); + void moreOptions(); + void speedButtonChanged(); + void speedChanged(); + bool getEject(); + int checkEjectWarning(Gtk::Window *); + bool getReload(); + int checkReloadWarning(Gtk::Window *); + int getSpeed(); + + bool on_delete_event(GdkEventAny*); +}; + +#endif diff --git a/xdao/CdDevice.cc b/xdao/CdDevice.cc new file mode 100644 index 0000000..80b74b4 --- /dev/null +++ b/xdao/CdDevice.cc @@ -0,0 +1,1333 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <sys/time.h> +#include <sys/types.h> +#include <stddef.h> +#include <stdio.h> +#include <unistd.h> +#include <stdlib.h> +#include <errno.h> +#include <ctype.h> +#include <assert.h> + +#include <gtkmm.h> +#include <gnome.h> + +#include "TocEdit.h" +#include "CdDevice.h" +#include "ProcessMonitor.h" +#include "xcdrdao.h" +#include "guiUpdate.h" +#include "ProgressDialog.h" +#include "Settings.h" +#include "ConfigManager.h" + +#include "config.h" +#include "remote.h" +#include "ScsiIf.h" +#include "CdrDriver.h" +#include "util.h" +#include "log.h" +#include "Toc.h" + +#define DRIVER_IDS 13 +#define DRIVER_ID_DEFAULT 2 + +CdDevice *CdDevice::DEVICE_LIST_ = NULL; + +const char *CdDevice::DRIVER_NAMES_[DRIVER_IDS] = { + "Undefined", + "cdd2600", + "generic-mmc", + "generic-mmc-raw", + "plextor", + "plextor-scan", + "ricoh-mp6200", + "sony-cdu920", + "sony-cdu948", + "taiyo-yuden", + "teac-cdr55", + "toshiba", + "yamaha-cdr10x" +}; + + +CdDevice::CdDevice(const char* dev, const char *vendor, const char *product) +{ + dev_ = dev; + vendor_ = vendor; + product_ = product; + + driverId_ = 0; + driverOptions_ = 0; + + deviceType_ = CD_R; + + manuallyConfigured_ = false; + + status_ = DEV_UNKNOWN; + + exitStatus_ = 0; + + progressStatusChanged_ = 0; + progressStatus_ = 0; + progressTotalTracks_ = 0; + progressTrack_ = 0; + progressTotal_ = 0; + progressTrackRelative_ = 0; + progressBufferFill_ = 0; + progressWriterFill_ = 0; + + process_ = NULL; + + scsiIf_ = NULL; + scsiIfInitFailed_ = 0; + + next_ = NULL; + slaveDevice_ = NULL; + + autoSelectDriver(); +} + +CdDevice::~CdDevice() +{ + delete scsiIf_; + scsiIf_ = NULL; +} + +char *CdDevice::settingString() const +{ + char buf[100]; + std::string s; + + s = "'" + dev_ + "','"; + s += vendor_; + s += "','"; + s += product_; + s += "',"; + + switch (deviceType_) { + case CD_R: + s += "CD_R"; + break; + case CD_RW: + s += "CD_RW"; + break; + case CD_ROM: + s+= "CD_ROM"; + break; + } + + s += ","; + + s += driverName(driverId_); + + s += ","; + + sprintf(buf, "0x%lx", driverOptions_); + s += buf; + + return strdupCC(s.c_str()); +} + +void CdDevice::driverId(int id) +{ + if (id >= 0 && id < DRIVER_IDS) + driverId_ = id; +} + +void CdDevice::status(Status s) +{ + status_ = s; +} + +int CdDevice::exitStatus() const +{ + return exitStatus_; +} + +int CdDevice::autoSelectDriver() +{ + unsigned long options = 0; + const char *driverName; + + driverName = CdrDriver::selectDriver(1, vendor_.c_str(), product_.c_str(), + &options); + + if (driverName) { + driverId_ = driverName2Id(driverName); + driverOptions_ = options; + + } else { + bool r_cdr, w_cdr, r_cdrw, w_cdrw; + + ScsiIf* sif = new ScsiIf(dev_.c_str()); + + if (sif && sif->init() == 0 && + sif->checkMmc(&r_cdr, &w_cdr, &r_cdrw, &w_cdrw)) { + + driverId_ = driverName2Id("generic-mmc"); + if (r_cdr) deviceType_ = CD_ROM; + if (w_cdr) deviceType_ = CD_R; + if (w_cdrw) deviceType_ = CD_RW; + } else { + driverId_ = DRIVER_ID_DEFAULT; + driverOptions_ = 0; + } + if (sif) delete sif; + } + + return 1; +} + +int CdDevice::updateStatus() +{ + Status newStatus = status_; + + if (process_ != NULL) { + if (process_->exited()) { + newStatus = DEV_UNKNOWN; + exitStatus_ = process_->exitStatus(); + + progressStatusChanged_ = 1; + + PROCESS_MONITOR->remove(process_); + process_ = NULL; + + if (slaveDevice_ != NULL) { + slaveDevice_->status(DEV_UNKNOWN); + slaveDevice_ = NULL; + } + } + } + + if (status_ == DEV_READY || status_ == DEV_BUSY || status_ == DEV_NO_DISK || + status_ == DEV_UNKNOWN) { + if (scsiIf_ == NULL) + createScsiIf(); + + if (scsiIf_ != NULL) { + switch (scsiIf_->testUnitReady()) { + case 0: + newStatus = DEV_READY; + break; + case 1: + newStatus = DEV_BUSY; + break; + case 2: + newStatus = DEV_NO_DISK; + break; + case 3: + // Most likely a timeout error. + newStatus = DEV_BUSY; + break; + } + } + else { + newStatus = DEV_FAULT; + } + } + + if (newStatus != status_) { + status_ = newStatus; + return 1; + } + + return 0; +} + +bool CdDevice::updateProgress(Glib::IOCondition cond, int fd) +{ + static char msgSync[4] = { 0xff, 0x00, 0xff, 0x00 }; + fd_set fds; + int state = 0; + char buf[10]; + struct timeval timeout = { 0, 0 }; + + if (process_ == NULL) + return false; + + if (!(cond & Gdk::INPUT_READ)) + return false; + + FD_ZERO(&fds); + FD_SET(fd, &fds); + + while (select(fd + 1, &fds, NULL, NULL, &timeout) > 0 && + FD_ISSET(fd, &fds)) { + FD_ZERO(&fds); + FD_SET(fd, &fds); + + state = 0; + + while (state < 4) { + if (read(fd, buf, 1) != 1) { + //message(-2, "Reading of msg sync failed."); + return false; + } + + if (buf[0] == msgSync[state]) { + state++; + } + else { + state = 0; + + if (buf[0] == msgSync[state]) { + state++; + } + } + } + + ProgressMsg msg; + + int msgsize = read(fd, (char *)&msg, sizeof(msg)); + if (msgsize >= PSGMSG_MINSIZE) { + if (msg.status >= PGSMSG_MIN && msg.status <= PGSMSG_MAX && + msg.track >= 0 && + msg.totalProgress >= 0 && msg.totalProgress <= 1000 && + msg.bufferFillRate >= 0 && msg.bufferFillRate <= 100) { + progressStatus_ = msg.status; + progressTotalTracks_ = msg.totalTracks; + progressTrack_ = msg.track; + progressTrackRelative_ = msg.trackProgress; + progressTotal_ = msg.totalProgress; + progressBufferFill_ = msg.bufferFillRate; + if (msgsize == sizeof(msg)) + progressWriterFill_ = msg.writerFillRate; + else + progressWriterFill_ = 0; + + progressStatusChanged_ = 1; + } + } + else { + log_message(-1, _("Reading of progress message failed.")); + } + } + + if (progressStatusChanged_) + guiUpdate(UPD_PROGRESS_STATUS); + + return true; +} + +CdDevice::DeviceType CdDevice::deviceType() const +{ + return deviceType_; +} + +void CdDevice::deviceType(DeviceType t) +{ + deviceType_ = t; +} + +unsigned long CdDevice::driverOptions() const +{ + return driverOptions_; +} + +void CdDevice::driverOptions(unsigned long o) +{ + driverOptions_ = o; +} + +bool CdDevice::ejectCd(bool load) +{ + bool success = false; + + if (!scsiIf_) + createScsiIf(); + + if (scsiIf_) { + CdrDriver* driver = CdrDriver::createDriver(driverName(driverId_), + driverOptions_, + scsiIf_); + + int ret = driver->loadUnload((load ? 0 : 1)); + success = (ret == 0); + delete(driver); + } + + return success; +} + +// Starts a 'cdrdao' for recording given toc. Returns false if an +// error occured and the process was not successfully launched. +bool CdDevice::recordDao(Gtk::Window& parent, TocEdit *tocEdit, int simulate, + int multiSession, int speed, int eject, int reload, + int buffer, int overburn) +{ + char* tocFileName; + const char *args[30]; + int n = 0; + char devname[30]; + char drivername[50]; + char speedbuf[20]; + char *execName; + const char *s; + char bufferbuf[20]; + int remoteFdArgNum = 0; + + if ((status_ != DEV_READY && status_ != DEV_FAULT && status_ != DEV_UNKNOWN) + || process_ != NULL) + return false; + + // Create temporary toc file. Get temporary directory from + // ConfigManager, then append mkstemp template. + Glib::ustring tempdir = + configManager->client()->get_string("/apps/gcdmaster/temp_dir"); + int length = tempdir.length(); + tocFileName = (char*)alloca(length + 24); + + strcpy(tocFileName, tempdir.c_str()); + strcat(tocFileName, "/gcdm.toc.XXXXXX"); + + int fd = mkstemp(tocFileName); + if (!fd) { + log_message(-2, _("Cannot create temporary toc-file: %s"), strerror(errno)); + return false; + } + + // Write out temporary toc file containing all the converted wav + // files (don't want to rely on cdrdao doing the mp3->wav + // translation, besides it's already been done). + if (!tocEdit->toc()->write(fd, true)) { + close(fd); + log_message(-2, _("Cannot write temporary toc-file.")); + return false; + } + + close(fd); + if ((s = gnome_config_get_string(SET_CDRDAO_PATH)) != NULL) + execName = strdupCC(s); + else + execName = strdupCC("cdrdao"); + + + args[n++] = execName; + + if (simulate) + args[n++] = "simulate"; + else + args[n++] = "write"; + + args[n++] = "--remote"; + + remoteFdArgNum = n; + args[n++] = NULL; + + args[n++] = "-v0"; + + if (multiSession) + args[n++] = "--multi"; + + if (speed > 0) { + sprintf(speedbuf, "%d", speed); + args[n++] = "--speed"; + args[n++] = speedbuf; + } + + if (eject) + args[n++] = "--eject"; + + if (reload) + args[n++] = "--reload"; + + if (overburn) + args[n++] = "--overburn"; + + args[n++] = "--device"; + args[n++] = (char*)dev_.c_str(); + + if (driverId_ > 0) { + sprintf(drivername, "%s:0x%lx", driverName(driverId_), driverOptions_); + args[n++] = "--driver"; + args[n++] = drivername; + } + + if (buffer >= 10) { + sprintf(bufferbuf, "%i", buffer); + args[n++] = "--buffers"; + args[n++] = bufferbuf; + } + + args[n++] = tocFileName; + + args[n++] = NULL; + + assert(n <= 20); + + PROGRESS_POOL->start(parent, this, tocEdit->filename()); + + // Remove the SCSI interface of this device to avoid problems with double + // usage of device nodes. + delete scsiIf_; + scsiIf_ = NULL; + + process_ = PROCESS_MONITOR->start(execName, args, remoteFdArgNum); + + delete execName; + if (process_ != NULL) { + status_ = DEV_RECORDING; + action_ = A_RECORD; + + if (process_->commFd() >= 0) { + Glib::signal_io().connect(bind(mem_fun(*this, &CdDevice::updateProgress), + process_->commFd()), + process_->commFd(), + Glib::IO_IN | Glib::IO_HUP); + } + + return true; + } + else { + unlink(tocFileName); + return false; + } +} + +void CdDevice::abortDaoRecording() +{ + if (process_ != NULL && !process_->exited()) { + PROCESS_MONITOR->stop(process_); + } +} + +int CdDevice::progressStatusChanged() +{ + if (progressStatusChanged_) { + progressStatusChanged_ = 0; + return 1; + } + + return 0; +} + +void CdDevice::progress(int *status, int *totalTracks, int *track, + int *trackProgress, int *totalProgress, + int *bufferFill, int *writerFill) const +{ + *status = progressStatus_; + *totalTracks = progressTotalTracks_; + *track = progressTrack_; + *trackProgress = progressTrackRelative_; + *totalProgress = progressTotal_; + *bufferFill = progressBufferFill_; + *writerFill = progressWriterFill_; +} + +// Starts a 'cdrdao' for reading whole cd. +// Return: 0: OK, process succesfully launched +// 1: error occured +int CdDevice::extractDao(Gtk::Window& parent, const char *tocFileName, + int correction, int readSubChanMode) +{ + const char *args[30]; + int n = 0; + char devname[30]; + char drivername[50]; + char *execName; + const char *s; + char correctionbuf[20]; + int remoteFdArgNum = 0; + + if ((status_ != DEV_READY && status_ != DEV_FAULT && status_ != DEV_UNKNOWN) + || process_ != NULL) + return 1; + + if ((s = gnome_config_get_string(SET_CDRDAO_PATH)) != NULL) + execName = strdupCC(s); + else + execName = strdupCC("cdrdao"); + + + args[n++] = execName; + + args[n++] = "read-cd"; + + args[n++] = "--remote"; + + remoteFdArgNum = n; + args[n++] = NULL; + + args[n++] = "-v0"; + + args[n++] = "--read-raw"; + + switch (readSubChanMode) { + case 1: + args[n++] = "--read-subchan"; + args[n++] = "rw"; + break; + + case 2: + args[n++] = "--read-subchan"; + args[n++] = "rw_raw"; + break; + } + + args[n++] = "--device"; + args[n++] = (char*)dev_.c_str(); + + if (driverId_ > 0) { + sprintf(drivername, "%s:0x%lx", driverName(driverId_), driverOptions_); + args[n++] = "--driver"; + args[n++] = drivername; + } + + sprintf(correctionbuf, "%d", correction); + args[n++] = "--paranoia-mode"; + args[n++] = correctionbuf; + + args[n++] = "--datafile"; + args[n++] = g_strdup_printf("%s.bin", tocFileName); + + args[n++] = g_strdup_printf("%s.toc", tocFileName); + + args[n++] = NULL; + + assert(n <= 20); + + PROGRESS_POOL->start(parent, this, tocFileName, false, false); + + // Remove the SCSI interface of this device to avoid problems with double + // usage of device nodes. + delete scsiIf_; + scsiIf_ = NULL; + + process_ = PROCESS_MONITOR->start(execName, args, remoteFdArgNum); + + delete[] execName; + + if (process_ != NULL) { + status_ = DEV_READING; + action_ = A_READ; + + if (process_->commFd() >= 0) { + Glib::signal_io().connect(bind(mem_fun(*this, &CdDevice::updateProgress), + process_->commFd()), + process_->commFd(), + Glib::IO_IN | Glib::IO_PRI | + Glib::IO_ERR | Glib::IO_HUP); + } + return 0; + } + else { + return 1; + } +} + + +void CdDevice::abortDaoReading() +{ + if (process_ != NULL && !process_->exited()) { + PROCESS_MONITOR->stop(process_); + } +} + +// Starts a 'cdrdao' for duplicating a CD. +// Return: 0: OK, process succesfully launched +// 1: error occured +int CdDevice::duplicateDao(Gtk::Window& parent, int simulate, int multiSession, + int speed, int eject, int reload, int buffer, + int onthefly, int correction, int readSubChanMode, + CdDevice *readdev) +{ + const char *args[30]; + int n = 0; + char devname[30]; + char drivername[50]; + char r_drivername[50]; + char speedbuf[20]; + char correctionbuf[20]; + char *execName; + const char *s; + char bufferbuf[20]; + int remoteFdArgNum = 0; + + + int rdstat = readdev->status(); + if ((rdstat != DEV_READY && rdstat != DEV_UNKNOWN && rdstat != DEV_FAULT) || + readdev->process() != NULL) + return 1; + + if ((status_ != DEV_READY && status_ != DEV_FAULT && status_ != DEV_UNKNOWN) + || process_ != NULL) + return 1; + + if ((s = gnome_config_get_string(SET_CDRDAO_PATH)) != NULL) + execName = strdupCC(s); + else + execName = strdupCC("cdrdao"); + + args[n++] = execName; + + args[n++] = "copy"; + + if (simulate) + args[n++] = "--simulate"; + + args[n++] = "--remote"; + + remoteFdArgNum = n; + args[n++] = NULL; + + args[n++] = "-v0"; + + if (multiSession) + args[n++] = "--multi"; + + sprintf(correctionbuf, "%d", correction); + args[n++] = "--paranoia-mode"; + args[n++] = correctionbuf; + + if (speed > 0) { + sprintf(speedbuf, "%d", speed); + args[n++] = "--speed"; + args[n++] = speedbuf; + } + + if (eject) + args[n++] = "--eject"; + + if (reload) + args[n++] = "--reload"; + + if (onthefly) + args[n++] = "--on-the-fly"; + + switch (readSubChanMode) { + case 1: + args[n++] = "--read-subchan"; + args[n++] = "rw"; + break; + + case 2: + args[n++] = "--read-subchan"; + args[n++] = "rw_raw"; + break; + } + + args[n++] = "--device"; + args[n++] = (char*)dev_.c_str(); + + if (driverId_ > 0) { + sprintf(drivername, "%s:0x%lx", driverName(driverId_), driverOptions_); + args[n++] = "--driver"; + args[n++] = drivername; + } + + + if (readdev != this) { // reader and write the same, skip source device + + args[n++] = "--source-device"; + args[n++] = (char*)readdev->dev(); + + if (readdev->driverId() > 0) { + sprintf(r_drivername, "%s:0x%lx", driverName(readdev->driverId()), + readdev->driverOptions()); + args[n++] = "--source-driver"; + args[n++] = r_drivername; + } + } + if (buffer >= 10) { + sprintf(bufferbuf, "%i", buffer); + args[n++] = "--buffers"; + args[n++] = bufferbuf; + } + + + args[n++] = NULL; + + assert(n <= 25); + + PROGRESS_POOL->start(parent, this, _("CD to CD copy")); + + // Remove the SCSI interface of this device to avoid problems with double + // usage of device nodes. + delete scsiIf_; + scsiIf_ = NULL; + + process_ = PROCESS_MONITOR->start(execName, args, remoteFdArgNum); + + delete[] execName; + + if (process_ != NULL) { + slaveDevice_ = readdev; + slaveDevice_->status(DEV_READING); + status_ = DEV_RECORDING; + + action_ = A_DUPLICATE; + + if (process_->commFd() >= 0) { + Glib::signal_io().connect(bind(mem_fun(*this, &CdDevice::updateProgress), + process_->commFd()), + process_->commFd(), + Glib::IO_IN | Glib::IO_HUP); + } + + return 0; + } + else { + return 1; + } +} + +void CdDevice::abortDaoDuplication() +{ + if (process_ != NULL && !process_->exited()) { + PROCESS_MONITOR->stop(process_); + } +} + +// Starts a 'cdrdao' for blanking a CD. +// Return: 0: OK, process succesfully launched +// 1: error occured +int CdDevice::blank(Gtk::Window* parent, int fast, int speed, int eject, + int reload) +{ + const char *args[20]; + int n = 0; + char devname[30]; + char drivername[50]; + char speedbuf[20]; + char *execName; + const char *s; + int remoteFdArgNum = 0; + + if ((status_ != DEV_READY && status_ != DEV_FAULT && status_ != DEV_UNKNOWN) + || process_ != NULL) + return 1; + + if ((s = gnome_config_get_string(SET_CDRDAO_PATH)) != NULL) + execName = strdupCC(s); + else + execName = strdupCC("cdrdao"); + + args[n++] = execName; + + args[n++] = "blank"; + + args[n++] = "--remote"; + + remoteFdArgNum = n; + args[n++] = NULL; + + args[n++] = "-v0"; + + args[n++] = "--blank-mode"; + + if (fast) + args[n++] = "minimal"; + else + args[n++] = "full"; + + if (speed > 0) { + sprintf(speedbuf, "%d", speed); + args[n++] = "--speed"; + args[n++] = speedbuf; + } + + if (eject) + args[n++] = "--eject"; + + if (reload) + args[n++] = "--reload"; + + args[n++] = "--device"; + args[n++] = (char*)dev_.c_str(); + + if (driverId_ > 0) { + sprintf(drivername, "%s:0x%lx", driverName(driverId_), driverOptions_); + args[n++] = "--driver"; + args[n++] = drivername; + } + + args[n++] = NULL; + + assert(n <= 20); + + if (parent) + PROGRESS_POOL->start(*parent, this, _("Blanking CDRW"), false, false); + else + PROGRESS_POOL->start(this, _("Blanking CDRW"), false, false); + + // Remove the SCSI interface of this device to avoid problems with double + // usage of device nodes. + delete scsiIf_; + scsiIf_ = NULL; + + process_ = PROCESS_MONITOR->start(execName, args, remoteFdArgNum); + + delete[] execName; + + if (process_ != NULL) { + status_ = DEV_BLANKING; + action_ = A_BLANK; + + if (process_->commFd() >= 0) { + Glib::signal_io().connect(bind(mem_fun(*this, &CdDevice::updateProgress), + process_->commFd()), + process_->commFd(), + Glib::IO_IN | Glib::IO_HUP); + } + return 0; + } + else { + return 1; + } +} + +void CdDevice::abortBlank() +{ + if (process_ != NULL && !process_->exited()) { + PROCESS_MONITOR->stop(process_); + } +} + +void CdDevice::createScsiIf() +{ + char buf[100]; + + if (scsiIfInitFailed_) + return; + + delete scsiIf_; + scsiIf_ = new ScsiIf(dev_.c_str()); + + if (scsiIf_->init() != 0) { + delete scsiIf_; + scsiIf_ = NULL; + scsiIfInitFailed_ = 1; + } +} + +int CdDevice::driverName2Id(const char *driverName) +{ + int i; + + for (i = 1; i < DRIVER_IDS; i++) { + if (strcmp(DRIVER_NAMES_[i], driverName) == 0) + return i; + } + + return 0; +} + +int CdDevice::maxDriverId() +{ + return DRIVER_IDS - 1; +} + +const char *CdDevice::driverName(int id) +{ + if (id >= 0 && id < DRIVER_IDS) { + return DRIVER_NAMES_[id]; + } + else { + return "Undefined"; + } +} + +const char *CdDevice::status2string(Status s) +{ + const char *ret = NULL; + + switch (s) { + case DEV_READY: + ret = "Ready"; + break; + case DEV_RECORDING: + ret = "Recording"; + break; + case DEV_READING: + ret = "Reading"; + break; + case DEV_WAITING: + ret = "Waiting"; + break; + case DEV_BLANKING: + ret = "Blanking"; + break; + case DEV_BUSY: + ret = "Busy"; + break; + case DEV_NO_DISK: + ret = "No disk"; + break; + case DEV_FAULT: + ret = "Not available"; + break; + case DEV_UNKNOWN: + ret = "Unknown"; + break; + } + + return ret; +} + +const char *CdDevice::deviceType2string(DeviceType t) +{ + const char *ret = NULL; + + switch (t) { + case CD_R: + ret = "CD-R"; + break; + + case CD_RW: + ret = "CD-RW"; + break; + + case CD_ROM: + ret = "CD-ROM"; + break; + } + + return ret; +} + + +/* reads configured devices from gnome settings + */ +void CdDevice::importSettings() +{ + int i, n; + char *s; + char buf[20]; + CdDevice *dev; + + n = gnome_config_get_int(SET_DEVICES_NUM); + + if (n > 0) { + gnome_config_push_prefix(SET_SECTION_DEVICES); + + for (i = 0; i < n; i++) { + sprintf(buf, "%d", i); + s = gnome_config_get_string(buf); + + if (s != NULL) { + if ((dev = CdDevice::add(s)) != NULL) + dev->manuallyConfigured(true); + } + } + + gnome_config_pop_prefix(); + } +} + + +/* saves manually configured devices as gnome settings + */ +void CdDevice::exportSettings() +{ + static const char* pathBase = "/apps/gcdmaster/devices"; + char* key; + char* s; + CdDevice* drun; + int n; + + key = (char*)alloca(strlen(pathBase) + 12); + + for (drun = first(), n = 0; drun != NULL; drun = next(drun)) { + + if (drun->manuallyConfigured()) { + sprintf(key, "%s%d", pathBase, n); + s = drun->settingString(); + + try { + Gnome::Conf::Schema sch; + sch.set_type(Gnome::Conf::VALUE_STRING); + configManager->client()->set(key, sch); + configManager->client()->set(key, s); + } catch (const Glib::Error& e) { + std::cerr << e.what() << std::endl; + } + // CdDevice::settingString allocates the string. Must delete it + // here. + delete[] s; + n++; + } + } +} + +CdDevice *CdDevice::add(const char* dev, const char *vendor, + const char *product) +{ + CdDevice *run, *pred, *ent; + + for (pred = NULL, run = DEVICE_LIST_; run != NULL; + pred = run, run = run->next_) { + if (strcmp(run->dev(), dev) == 0) + return run; + } + + ent = new CdDevice(dev, vendor, product); + + if (pred != NULL) { + ent->next_ = pred->next_; + pred->next_ = ent; + } + else { + ent->next_ = DEVICE_LIST_; + DEVICE_LIST_ = ent; + } + + return ent; +} + + +static char *nextToken(char *&p) +{ + char *val = NULL; + + if (p == NULL || *p == 0) + return NULL; + + while (*p != 0 && isspace(*p)) + p++; + + if (*p == 0) + return NULL; + + if (*p == '\'') { + p++; + val = p; + + while (*p != 0 && *p != '\'') + p++; + + if (*p == 0) { + // error, no matching ' found + return NULL; + } + else { + *p++ = 0; + + // skip over , + while (*p != 0 && *p != ',') + p++; + + if (*p == ',') + p++; + } + } + else { + val = p; + + while (*p != 0 && *p != ',') + p++; + + if (*p == ',') + *p++ = 0; + } + + return val; +} + +static CdDevice *addImpl(char *s) +{ + char *p; + int driverId; + std::string dev; + std::string vendor; + std::string model; + std::string device; + unsigned long options; + char *val; + CdDevice::DeviceType type; + CdDevice *cddev; + + if (s[0] != '\'') + return NULL; + + p = s; + + if ((val = nextToken(p)) == NULL) + return NULL; + dev = val; + + if ((val = nextToken(p)) == NULL) + return NULL; + vendor = val; + + if ((val = nextToken(p)) == NULL) + return NULL; + model = val; + + if ((val = nextToken(p)) == NULL) + return NULL; + + if (strcasecmp(val, "CD_R") == 0) + type = CdDevice::CD_R; + else if (strcasecmp(val, "CD_RW") == 0) + type = CdDevice::CD_RW; + else if (strcasecmp(val, "CD_ROM") == 0) + type = CdDevice::CD_ROM; + else + type = CdDevice::CD_R; + + if ((val = nextToken(p)) == NULL) + return NULL; + driverId = CdDevice::driverName2Id(val); + + if ((val = nextToken(p)) == NULL) + return NULL; + options = strtoul(val, NULL, 0); + + cddev = CdDevice::add(dev.c_str(), vendor.c_str(), model.c_str()); + + cddev->driverId(driverId); + cddev->deviceType(type); + cddev->driverOptions(options); + + return cddev; +} + +CdDevice *CdDevice::add(const char *setting) +{ + char *s = strdupCC(setting); + + CdDevice *dev = addImpl(s); + + delete[] s; + + return dev; +} + + + +CdDevice *CdDevice::find(const char* dev) +{ + CdDevice *run; + + for (run = DEVICE_LIST_; run != NULL; run = run->next_) { + if (strcmp(run->dev(), dev) == 0) + return run; + } + + return NULL; +} + +void CdDevice::scan() +{ + int i, len; + ScsiIf::ScanData *sdata = ScsiIf::scan(&len); + + if (sdata) { + for (i = 0; i < len; i++) + CdDevice::add(sdata[i].dev.c_str(), sdata[i].vendor, sdata[i].product); + delete[] sdata; + } + +#ifdef SCSI_ATAPI + sdata = ScsiIf::scan(&len, "ATA"); + if (sdata) { + for (i = 0; i < len; i++) + CdDevice::add(sdata[i].dev.c_str(), sdata[i].vendor, sdata[i].product); + delete[] sdata; + } else { + // Only scan for ATAPI devices if we got nothing on the ATA + // interface, otherwise every device would show up twice on the + // list. + sdata = ScsiIf::scan(&len, "ATAPI"); + if (sdata) { + for (i = 0; i < len; i++) + CdDevice::add(sdata[i].dev.c_str(), sdata[i].vendor, sdata[i].product); + delete[] sdata; + } + } +#endif +} + +void CdDevice::remove(const char* dev) +{ + CdDevice *run, *pred; + + for (pred = NULL, run = DEVICE_LIST_; run != NULL; + pred = run, run = run->next_) { + if (strcmp(run->dev(), dev) == 0) { + if (run->status() == DEV_RECORDING || run->status() == DEV_BLANKING || + run->status() == DEV_READING || run->status() == DEV_WAITING) + return; + + if (pred != NULL) + pred->next_ = run->next_; + else + DEVICE_LIST_ = run->next_; + + delete run; + return; + } + } +} + +void CdDevice::clear() +{ + CdDevice *next; + + while (DEVICE_LIST_ != NULL) { + next = DEVICE_LIST_->next_; + delete DEVICE_LIST_; + DEVICE_LIST_ = next; + } +} + +CdDevice *CdDevice::first() +{ + return DEVICE_LIST_; +} + +CdDevice *CdDevice::next(const CdDevice *run) +{ + if (run != NULL) + return run->next_; + else + return NULL; +} + +int CdDevice::count() +{ + CdDevice *run; + int cnt = 0; + + for (run = DEVICE_LIST_; run != NULL; run = run->next_) + cnt++; + + return cnt; +} + +int CdDevice::updateDeviceStatus() +{ + int newStatus = 0; + + CdDevice *run; + + blockProcessMonitorSignals(); + + for (run = DEVICE_LIST_; run != NULL; run = run->next_) { + if (run->updateStatus()) + newStatus = 1; + } + + unblockProcessMonitorSignals(); + + return newStatus; +} diff --git a/xdao/CdDevice.h b/xdao/CdDevice.h new file mode 100644 index 0000000..799251a --- /dev/null +++ b/xdao/CdDevice.h @@ -0,0 +1,178 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __CD_DEVICE_H__ +#define __CD_DEVICE_H__ + +#include <sigc++/object.h> +#include <gdk/gdk.h> +#include <string> + +#include "Project.h" + +class TocEdit; +class Process; +class ScsiIf; + +class CdDevice : public sigc::trackable +{ + public: + enum Status { DEV_READY, DEV_RECORDING, DEV_READING, DEV_WAITING, DEV_BUSY, + DEV_NO_DISK, DEV_BLANKING, DEV_FAULT, DEV_UNKNOWN }; + enum DeviceType { CD_R, CD_RW, CD_ROM }; + + enum Action { A_RECORD, A_READ, A_DUPLICATE, A_BLANK, A_NONE }; + + CdDevice(const char* dev, const char *vendor, const char *product); + ~CdDevice(); + + char *settingString() const; + + const char *dev() const { return dev_.c_str(); } + const char *vendor() const { return vendor_.c_str(); } + const char *product() const { return product_.c_str(); } + + Status status() const { return status_; } + Process *process() const { return process_; } + + int exitStatus() const; + + void status(Status); + int updateStatus(); + + Action action() const { return action_; } + + bool updateProgress(Glib::IOCondition, int fd); + + int autoSelectDriver(); + + int driverId() const { return driverId_; } + void driverId(int); + + DeviceType deviceType() const; + void deviceType(DeviceType); + + unsigned long driverOptions() const; + void driverOptions(unsigned long); + + bool manuallyConfigured() const { return manuallyConfigured_; } + void manuallyConfigured(bool b) { manuallyConfigured_ = b; } + + bool ejectCd(bool load=false); + bool loadCd() { return ejectCd(true); } + + bool recordDao(Gtk::Window& parent, TocEdit *, int simulate, + int multiSession, int speed, int eject, int reload, + int buffer, int overburn); + void abortDaoRecording(); + + int extractDao(Gtk::Window& parent, const char *tocFileName, int correction, + int readSubChanMode); + void abortDaoReading(); + + int duplicateDao(Gtk::Window& parent, int simulate, int multiSession, + int speed, int eject, int reload, int buffer, int onthefly, + int correction, int readSubChanMode, CdDevice *readdev); + void abortDaoDuplication(); + + int blank(Gtk::Window* parent, int fast, int speed, int eject, int reload); + void abortBlank(); + + int progressStatusChanged(); + void progress(int *status, int *totalTracks, int *track, + int *trackProgress, int *totalProgress, + int *bufferFill, int *writerFill) const; + + static int maxDriverId(); + static const char *driverName(int id); + static int driverName2Id(const char *); + + static const char *status2string(Status); + static const char *deviceType2string(DeviceType); + + static void importSettings(); + static void exportSettings(); + + static CdDevice *add(const char* scsidev, const char *vendor, + const char *product); + + static CdDevice *add(const char *setting); + + static CdDevice *find(const char* dev); + + static void scan(); + + static void remove(const char* dev); + + static void clear(); + + static CdDevice *first(); + static CdDevice *next(const CdDevice *); + + static int updateDeviceStatus(); + + /* not used anymore since Gtk::Main::input signal will call + * CdDevice::updateProgress directly. + + static int updateDeviceProgress(); + */ + + static int count(); + + private: + std::string dev_; // SCSI device + std::string vendor_; + std::string product_; + + DeviceType deviceType_; + + int driverId_; + unsigned long driverOptions_; + + bool manuallyConfigured_; + + ScsiIf *scsiIf_; + int scsiIfInitFailed_; + Status status_; + + enum Action action_; + + int exitStatus_; + + int progressStatusChanged_; + int progressStatus_; + int progressTotalTracks_; + int progressTrack_; + int progressTotal_; + int progressTrackRelative_; + int progressBufferFill_; + int progressWriterFill_; + + Process *process_; + + CdDevice *next_; + CdDevice *slaveDevice_; // slave device (used when copying etc.) + + void createScsiIf(); + + static const char *DRIVER_NAMES_[]; + static CdDevice *DEVICE_LIST_; +}; + +#endif diff --git a/xdao/CdTextDialog.cc b/xdao/CdTextDialog.cc new file mode 100644 index 0000000..3cc5ddc --- /dev/null +++ b/xdao/CdTextDialog.cc @@ -0,0 +1,408 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "CdTextDialog.h" + +#include <gtkmm.h> +#include <gnome.h> +#include <libgnomeuimm.h> + +#include <stddef.h> +#include <string.h> + +#include "TocEdit.h" +#include "Toc.h" +#include "util.h" + +#include "guiUpdate.h" + +CdTextDialog::CdTextDialog() +{ + int i; + Gtk::VBox *contents = manage(new Gtk::VBox); + char buf[20]; + + active_ = false; + tocEdit_ = NULL; + trackEntries_ = 0; + + languages_ = manage(new Gtk::Notebook); + + for (i = 0; i < 8; i++) { + page_[i].table = new Gtk::Table(3, 3, false); + page_[i].table->set_row_spacings(5); + page_[i].table->set_col_spacings(5); + page_[i].performer = manage(new Gtk::Entry); + page_[i].title = manage(new Gtk::Entry); + page_[i].tabLabel = new Gtk::Label(""); + page_[i].performerButton = + new Gtk::CheckButton(_("Enable Perfomer Entries")); + page_[i].performerButton->set_active(false); + page_[i].performerButton->signal_toggled(). + connect(bind(mem_fun(*this, &CdTextDialog::activatePerformerAction), i)); + page_[i].tracks = NULL; + page_[i].table->attach(*(new Gtk::Label(_("Performer"))), 1, 2, 0, 1); + page_[i].table->attach(*(new Gtk::Label(_("Title"))), 2, 3, 0, 1); + + { + Gtk::HBox *hbox = manage(new Gtk::HBox); + hbox->pack_end(*(new Gtk::Label(_("Album")))); + + page_[i].table->attach(*hbox, 0, 1, 1, 2, Gtk::FILL); + page_[i].table->attach(*(page_[i].title), 2, 3, 1, 2); + page_[i].table->attach(*(page_[i].performer), 1, 2, 1, 2); + } + + { + Gtk::HBox *hbox = manage(new Gtk::HBox); + + hbox->pack_start(*(page_[i].performerButton)); + page_[i].table->attach(*hbox, 1, 2, 2, 3); + } + + { + Gtk::HBox *hbox1 = manage(new Gtk::HBox); + Gtk::VBox *vbox1 = manage(new Gtk::VBox); + + hbox1->pack_start(*(page_[i].table), true, true, 5); + vbox1->pack_start(*hbox1, false, false, 5); + + Gtk::ScrolledWindow *swin = manage(new Gtk::ScrolledWindow); + swin->set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + swin->show_all(); + swin->add(*vbox1); + + sprintf(buf, " %d ", i); + languages_->pages(). + push_back(Gtk::Notebook_Helpers::TabElem(*swin, + *(page_[i].tabLabel))); + } + } + + contents->pack_start(*languages_); + + { + Gtk::HBox *hbox = manage(new Gtk::HBox); + + hbox->pack_start(*contents, true, true, 10); + get_vbox()->pack_start(*hbox, true, true, 10); + } + + Gtk::HButtonBox *bbox = new Gtk::HButtonBox(Gtk::BUTTONBOX_SPREAD); + + applyButton_ = new Gtk::Button(Gtk::StockID(Gtk::Stock::APPLY)); + bbox->pack_start(*applyButton_); + applyButton_->signal_clicked().connect(mem_fun(*this, &CdTextDialog::applyAction)); + + Gtk::Button *fillButton = new Gtk::Button(_(" Fill Performer ")); + bbox->pack_start(*fillButton); + fillButton->signal_clicked().connect(mem_fun(*this, &CdTextDialog::fillPerformerAction)); + + Gtk::Button *cancelButton = new Gtk::Button(Gtk::StockID(Gtk::Stock::CLOSE)); + bbox->pack_start(*cancelButton); + cancelButton->signal_clicked().connect(mem_fun(*this, &CdTextDialog::stop)); + + get_action_area()->pack_start(*bbox); + + show_all_children(); + set_title(_("CD-TEXT Entry")); +} + +CdTextDialog::~CdTextDialog() +{ +} + +bool CdTextDialog::on_delete_event(GdkEventAny*) +{ + stop(); + return 1; +} + +void CdTextDialog::updateTabLabels() +{ + const Toc *toc = tocEdit_->toc(); + int l; + + for (l = 0; l < 8; l++) { + const char *s = CdTextContainer::languageName(toc->cdTextLanguage(l)); + + if (page_[l].tabLabel->get_label() != s) + page_[l].tabLabel->set_label(s); + } +} + +void CdTextDialog::adjustTableEntries(int n) +{ + int i, l; + char buf[20]; + + if (trackEntries_ == n) + return; + + for (l = 0; l < 8; l++) { + if (n < trackEntries_) { + page_[l].table->resize(3 + n, 3); + + for (i = n; i < trackEntries_; i++) { + delete page_[l].tracks[i].performer; + delete page_[l].tracks[i].title; + delete page_[l].tracks[i].hbox; + delete page_[l].tracks[i].label; + } + } + else { + int performerActive = page_[l].performerButton->get_active(); + + TableEntry *newTracks = new TableEntry[n]; + + for (i = 0; i < trackEntries_; i++) + newTracks[i] = page_[l].tracks[i]; + + delete[] page_[l].tracks; + page_[l].tracks = newTracks; + + page_[l].table->resize(3 + n, 3); + + for (i = trackEntries_; i < n; i++) { + sprintf(buf, _("Track %02d"), i + 1); + + page_[l].tracks[i].performer = manage(new Gtk::Entry); + page_[l].tracks[i].performer->set_sensitive(performerActive); + page_[l].tracks[i].title = manage(new Gtk::Entry); + page_[l].tracks[i].label = new Gtk::Label(buf); + page_[l].tracks[i].hbox = manage(new Gtk::HBox); + + page_[l].tracks[i].hbox->pack_end(*(page_[l].tracks[i].label), + Gtk::PACK_SHRINK); + + page_[l].table->attach(*(page_[l].tracks[i].hbox), + 0, 1, i + 3, i + 4, Gtk::FILL); + page_[l].table->attach(*(page_[l].tracks[i].title), + 2, 3, i + 3, i + 4); + page_[l].table->attach(*(page_[l].tracks[i].performer), + 1, 2, i + 3, i + 4); + } + + page_[l].table->show_all(); + } + } + + trackEntries_ = n; +} + +void CdTextDialog::update(unsigned long level, TocEdit *view) +{ + if (view != tocEdit_) { + tocEdit_ = view; + level = UPD_ALL; + } + + std::string s(view->filename()); + s += " - "; + s += APP_NAME; + if (view->tocDirty()) + s += "(*)"; + set_title(s); + + if (level & UPD_TOC_DATA) { + updateTabLabels(); + } + + if ((level & UPD_TOC_DATA) || + (level & UPD_TRACK_DATA)) { + importData(); + } + + if (level & UPD_EDITABLE_STATE) { + applyButton_->set_sensitive(tocEdit_->editable() ? true : false); + } +} + +void CdTextDialog::start(TocEdit *view) +{ + update(UPD_ALL, view); + present(); + active_ = true; +} + +void CdTextDialog::stop() +{ + hide(); + active_ = false; +} + +void CdTextDialog::applyAction() +{ + if (tocEdit_ == NULL || !tocEdit_->editable()) + return; + + exportData(); + + guiUpdate(); +} + +void CdTextDialog::fillPerformerAction() +{ + int l = languages_->get_current_page(); + + if (l >= 0 && l <= 7) { + int i; + const char *s = checkString(page_[l].performer->get_text()); + + if (s == NULL) + return; + + char *performer = strdupCC(s); + + for (i = 0; i < trackEntries_; i++) { + if (checkString(page_[l].tracks[i].performer->get_text()) == NULL) + page_[l].tracks[i].performer->set_text(performer); + } + + delete[] performer; + } +} + +void CdTextDialog::activatePerformerAction(int l) +{ + int i; + int val = page_[l].performerButton->get_active(); + + for (i = 0; i < trackEntries_; i++) { + page_[l].tracks[i].performer->set_sensitive(val); + } +} + +void CdTextDialog::importData() +{ + const CdTextItem *item; + const Toc *toc = tocEdit_->toc(); + int i, l; + int n = toc->nofTracks(); + + adjustTableEntries(n); + + for (l = 0; l < 8; l++) { + if ((item = toc->getCdTextItem(0, l, CdTextItem::CDTEXT_TITLE)) != NULL) + page_[l].title->set_text((const char*)item->data()); + else + page_[l].title->set_text(""); + + if ((item = toc->getCdTextItem(0, l, CdTextItem::CDTEXT_PERFORMER)) + != NULL) + page_[l].performer->set_text((const char*)item->data()); + else + page_[l].performer->set_text(""); + + for (i = 0; i < n; i++) { + if ((item = toc->getCdTextItem(i + 1, l, CdTextItem::CDTEXT_TITLE)) + != NULL) + page_[l].tracks[i].title->set_text((const char*)item->data()); + else + page_[l].tracks[i].title->set_text(""); + + if ((item = toc->getCdTextItem(i + 1, l, CdTextItem::CDTEXT_PERFORMER)) + != NULL) + page_[l].tracks[i].performer->set_text((const char*)item->data()); + else + page_[l].tracks[i].performer->set_text(""); + } + } +} + +void CdTextDialog::exportData() +{ + int i, l; + + for (l = 0; l < 8; l++) { + setCdTextItem(CdTextItem::CDTEXT_TITLE, 0, l, + checkString(page_[l].title->get_text())); + setCdTextItem(CdTextItem::CDTEXT_PERFORMER, 0, l, + checkString(page_[l].performer->get_text())); + + for (i = 0; i < trackEntries_; i++) { + setCdTextItem(CdTextItem::CDTEXT_TITLE, i + 1, l, + checkString(page_[l].tracks[i].title->get_text())); + setCdTextItem(CdTextItem::CDTEXT_PERFORMER, i + 1, l, + checkString(page_[l].tracks[i].performer->get_text())); + } + } +} + +void CdTextDialog::setCdTextItem(CdTextItem::PackType type, int trackNr, + int l, const char *s) +{ + const CdTextItem *item; + TocEdit *tocEdit = tocEdit_; + const Toc *toc = tocEdit->toc(); + CdTextItem *newItem; + + if (s != NULL) + newItem = new CdTextItem(type, l, s); + else + newItem = NULL; + + if ((item = toc->getCdTextItem(trackNr, l, type)) != NULL) { + if (newItem == NULL) + tocEdit->setCdTextItem(trackNr, type, l, NULL); + else if (*newItem != *item) + tocEdit->setCdTextItem(trackNr, type, l, s); + } + else if (newItem != NULL) { + tocEdit->setCdTextItem(trackNr, type, l, s); + } + + delete newItem; +} + +const char *CdTextDialog::checkString(const std::string &str) +{ + static char *buf = NULL; + static long bufLen = 0; + char *p, *s; + long len = strlen(str.c_str()); + + if (len == 0) + return NULL; + + if (buf == NULL || len + 1 > bufLen) { + delete[] buf; + bufLen = len + 1; + buf = new char[bufLen]; + } + + strcpy(buf, str.c_str()); + + s = buf; + p = buf + len - 1; + + while (*s != 0 && isspace(*s)) + s++; + + if (*s == 0) + return NULL; + + while (p > s && isspace(*p)) { + *p = 0; + p--; + } + + return s; +} + diff --git a/xdao/CdTextDialog.h b/xdao/CdTextDialog.h new file mode 100644 index 0000000..4fa3264 --- /dev/null +++ b/xdao/CdTextDialog.h @@ -0,0 +1,86 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __CD_TEXT_DIALOG_H__ +#define __CD_TEXT_DIALOG_H__ + +#include <gtkmm.h> +#include <gtk/gtk.h> + +//#include "Toc.h" +#include "CdTextItem.h" + +class TocEdit; + +class CdTextDialog : public Gtk::Dialog +{ +public: + CdTextDialog(); + ~CdTextDialog(); + + bool on_delete_event(GdkEventAny*); + + void update(unsigned long, TocEdit *); + + void start(TocEdit *); + void stop(); + +private: + bool active_; + + TocEdit *tocEdit_; + int trackEntries_; + + Gtk::Button *applyButton_; + Gtk::Notebook *languages_; + + struct TableEntry { + Gtk::Entry *performer; + Gtk::Entry *title; + Gtk::Label *label; + Gtk::HBox *hbox; + }; + + struct Language { + Gtk::Table *table; + Gtk::Entry *performer; + Gtk::Entry *title; + Gtk::Label *tabLabel; + + Gtk::CheckButton *performerButton; + + TableEntry *tracks; + }; + + Language page_[8]; + + void adjustTableEntries(int); + void updateTabLabels(); + void applyAction(); + void fillPerformerAction(); + void activatePerformerAction(int); + + void importData(); + void exportData(); + void setCdTextItem(CdTextItem::PackType, int trackNr, int l, const char *); + + const char *checkString(const std::string &); +}; + +#endif diff --git a/xdao/ConfigManager.cc b/xdao/ConfigManager.cc new file mode 100644 index 0000000..2defba2 --- /dev/null +++ b/xdao/ConfigManager.cc @@ -0,0 +1,26 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 2007 Denis Leroy + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "ConfigManager.h" + +ConfigManager::ConfigManager() +{ + client_ = Gnome::Conf::Client::get_default_client(); + client_->add_dir("/apps/gcdmaster"); +} diff --git a/xdao/ConfigManager.h b/xdao/ConfigManager.h new file mode 100644 index 0000000..3bb9093 --- /dev/null +++ b/xdao/ConfigManager.h @@ -0,0 +1,38 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 2007 Denis Leroy + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __CONFIG_MANAGER_H +#define __CONFIG_MANAGER_H + +#include <gconfmm.h> + +class ConfigManager +{ + public: + ConfigManager(); + virtual ~ConfigManager() {} + + Glib::RefPtr<Gnome::Conf::Client> client() { return client_; } + + protected: + Glib::RefPtr<Gnome::Conf::Client> client_; +}; + +#endif + diff --git a/xdao/DeviceConfDialog.cc b/xdao/DeviceConfDialog.cc new file mode 100644 index 0000000..32b7534 --- /dev/null +++ b/xdao/DeviceConfDialog.cc @@ -0,0 +1,560 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stdio.h> +#include <limits.h> +#include <math.h> +#include <assert.h> +#include <ctype.h> + +#include <gtkmm.h> +#include <gnome.h> + +#include "DeviceConfDialog.h" + +#include "CdDevice.h" +#include "guiUpdate.h" + +#include "util.h" + +#define MAX_DEVICE_TYPE_ID 2 + +static CdDevice::DeviceType ID2DEVICE_TYPE[MAX_DEVICE_TYPE_ID + 1] = { + CdDevice::CD_ROM, + CdDevice::CD_R, + CdDevice::CD_RW +}; + + +DeviceConfDialog::DeviceConfDialog() +{ + int i; + Gtk::Label *label; + Gtk::Table *table; + Gtk::HBox *hbox; + Gtk::VBox *vbox; + Gtk::Button *button; + + active_ = false; + + set_title(_("Configure Devices")); + + // TreeView initialization + listModel_ = Gtk::ListStore::create(listColumns_); + list_.set_model(listModel_); + list_.append_column(_("Dev"), listColumns_.dev); + list_.append_column(_("Vendor"), listColumns_.vendor); + list_.append_column(_("Model"), listColumns_.model); + list_.append_column(_("Status"), listColumns_.status); + + selectedRow_ = list_.get_selection()->get_selected(); + list_.get_selection()->signal_changed(). + connect(mem_fun(*this, &DeviceConfDialog::selectionChanged)); + + Gtk::Menu *dmenu = manage(new Gtk::Menu); + Gtk::MenuItem *mi; + + for (i = 0; i <= CdDevice::maxDriverId(); i++) { + mi = manage(new Gtk::MenuItem(CdDevice::driverName(i))); + mi->signal_activate().connect(bind(mem_fun(*this, + &DeviceConfDialog::setDriverId), + i)); + mi->show(); + dmenu->append(*mi); + } + + driverMenu_ = manage(new Gtk::OptionMenu); + driverMenu_->set_menu(*dmenu); + + Gtk::Menu *tmenu = manage(new Gtk::Menu); + + for (i = 0; i <= MAX_DEVICE_TYPE_ID; i++) { + mi = manage(new + Gtk::MenuItem(CdDevice::deviceType2string(ID2DEVICE_TYPE[i]))); + mi->signal_activate().connect(bind(mem_fun(*this, + &DeviceConfDialog::setDeviceType), + i)); + mi->show(); + tmenu->append(*mi); + } + + devtypeMenu_ = manage(new Gtk::OptionMenu); + devtypeMenu_->set_menu(*tmenu); + + devEntry_.set_max_length(32); + vendorEntry_.set_max_length(8); + productEntry_.set_max_length(16); + + Gtk::VBox *contents = manage(new Gtk::VBox); + contents->set_spacing(5); + contents->set_border_width(7); + + // ---------------------------- Device list + Gtk::VBox *listBox = manage(new Gtk::VBox); + listBox->set_spacing(5); + listBox->set_border_width(5); + + hbox = manage(new Gtk::HBox); + + hbox->pack_start(list_, Gtk::PACK_EXPAND_WIDGET); + + Gtk::Adjustment *adjust = manage(new Gtk::Adjustment(0.0, 0.0, 0.0)); + Gtk::VScrollbar *scrollBar = manage(new Gtk::VScrollbar(*adjust)); + hbox->pack_start(*scrollBar, Gtk::PACK_SHRINK); + + list_.set_vadjustment(*adjust); + + listBox->pack_start(*hbox, Gtk::PACK_EXPAND_WIDGET); + + Gtk::ButtonBox *bbox = manage(new Gtk::HButtonBox(Gtk::BUTTONBOX_SPREAD)); + + button = manage(new Gtk::Button(_("Rescan"))); + bbox->pack_start(*button); + button->signal_clicked(). + connect(sigc::mem_fun(*this,&DeviceConfDialog::rescanAction)); + + button = manage(new Gtk::Button(Gtk::StockID(Gtk::Stock::DELETE))); + bbox->pack_start(*button); + button->signal_clicked(). + connect(sigc::mem_fun(*this,&DeviceConfDialog::deleteDeviceAction)); + + listBox->pack_start(*bbox, Gtk::PACK_SHRINK); + + listFrame_.set_label(_(" Device List ")); + listFrame_.add(*listBox); + contents->pack_start(listFrame_, Gtk::PACK_EXPAND_WIDGET); + + // ---------------------------- Device settings + + settingFrame_.set_label(_(" Device Settings ")); + table = manage(new Gtk::Table(2, 4, FALSE)); + table->set_row_spacings(5); + table->set_col_spacings(5); + table->set_border_width(10); + settingFrame_.add(*table); + + label = manage(new Gtk::Label(_("Device Type:"))); + table->attach(*label, 0, 1, 0, 1); + table->attach(*devtypeMenu_, 1, 2, 0, 1); + + label = manage(new Gtk::Label(_("Driver:"))); + table->attach(*label, 0, 1, 1, 2); + table->attach(*driverMenu_, 1, 2, 1, 2); + + label = manage(new Gtk::Label(_("Driver Options:"))); + table->attach(*label, 0, 1, 2, 3); + table->attach(driverOptionsEntry_, 1, 2, 2, 3); + + contents->pack_start(settingFrame_, Gtk::PACK_SHRINK); + + // -------------- Add device + + addDeviceFrame_.set_label(_(" Add Device ")); + Gtk::VBox *addDeviceBox = manage(new Gtk::VBox); + addDeviceBox->set_spacing(5); + addDeviceBox->set_border_width(5); + + table = manage(new Gtk::Table(3, 2, FALSE)); + table->set_row_spacings(5); + table->set_col_spacings(5); + addDeviceBox->pack_start(*table, Gtk::PACK_EXPAND_WIDGET); + + label = manage(new Gtk::Label(_("Device:"))); + table->attach(*label, 0, 1, 0, 1); + table->attach(devEntry_, 1, 2, 0, 1); + + label = manage(new Gtk::Label(_("Vendor:"))); + table->attach(*label, 0, 1, 1, 2); + table->attach(vendorEntry_, 1, 2, 1, 2); + + label = manage(new Gtk::Label(_("Product:"))); + table->attach(*label, 0, 1, 2, 3); + table->attach(productEntry_, 1, 2, 2, 3); + + bbox = manage(new Gtk::HButtonBox(Gtk::BUTTONBOX_SPREAD)); + bbox->set_spacing(5); + Gtk::Button* addButton = + manage(new Gtk::Button(Gtk::StockID(Gtk::Stock::ADD))); + bbox->pack_start(*addButton); + addButton->signal_clicked(). + connect(mem_fun(*this, &DeviceConfDialog::addDeviceAction)); + addDeviceBox->pack_start(*bbox); + + addDeviceFrame_.add(*addDeviceBox); + contents->pack_start(addDeviceFrame_, Gtk::PACK_SHRINK); + + // 3 buttons at bottom of window. + + bbox = manage(new Gtk::HButtonBox(Gtk::BUTTONBOX_SPREAD)); + bbox->set_spacing(5); + hbox->set_border_width(10); + Gtk::Button* applyButton = + manage(new Gtk::Button(Gtk::StockID(Gtk::Stock::APPLY))); + bbox->pack_start(*applyButton); + applyButton->signal_clicked().connect(mem_fun(*this, + &DeviceConfDialog::applyAction)); + + Gtk::Button *resetButton = manage(new Gtk::Button(_("Reset"))); + bbox->pack_start(*resetButton); + resetButton->signal_clicked().connect(mem_fun(*this, + &DeviceConfDialog::resetAction)); + + Gtk::Button *cancelButton = + manage(new Gtk::Button(Gtk::StockID(Gtk::Stock::CLOSE))); + bbox->pack_start(*cancelButton); + cancelButton->signal_clicked().connect(mem_fun(*this, + &DeviceConfDialog::closeAction)); + + contents->pack_start(*bbox, Gtk::PACK_SHRINK); + + add(*contents); +} + +DeviceConfDialog::~DeviceConfDialog() +{ +} + + +void DeviceConfDialog::start() +{ + if (active_) { + present(); + return; + } + + active_ = true; + update(UPD_CD_DEVICES); + show_all(); +} + +void DeviceConfDialog::stop() +{ + hide(); + active_ = false; +} + +void DeviceConfDialog::update(unsigned long level) +{ + if (!active_) + return; + + if (level & UPD_CD_DEVICES) + import(); + else if (level & UPD_CD_DEVICE_STATUS) + importStatus(); +} + +void DeviceConfDialog::closeAction() +{ + stop(); +} + +void DeviceConfDialog::resetAction() +{ + import(); +} + + +void DeviceConfDialog::applyAction() +{ + if (selectedRow_) + exportConfiguration(selectedRow_); + exportData(); + guiUpdate(UPD_CD_DEVICES); +} + +void DeviceConfDialog::addDeviceAction() +{ + const char *s; + + std::string dev; + std::string vendor; + std::string product; + CdDevice *cddev; + + if ((s = checkString(devEntry_.get_text())) == NULL) + return; + dev = s; + + if ((s = checkString(vendorEntry_.get_text())) == NULL) + return; + vendor = s; + + if ((s = checkString(productEntry_.get_text())) == NULL) + return; + product = s; + + if (CdDevice::find(dev.c_str()) != NULL) + return; + + cddev = CdDevice::add(dev.c_str(), vendor.c_str(), product.c_str()); + + if (cddev) { + cddev->manuallyConfigured(true); + Gtk::TreeIter new_entry = appendTableEntry(cddev); + list_.get_selection()->select(new_entry); + } + + guiUpdate(UPD_CD_DEVICES); +} + +void DeviceConfDialog::deleteDeviceAction() +{ + DeviceData *data; + CdDevice *dev; + + if (selectedRow_) { + + data = (*selectedRow_)[listColumns_.data]; + + dev = CdDevice::find(data->dev.c_str()); + if (dev == NULL || dev->status() == CdDevice::DEV_RECORDING || + dev->status() == CdDevice::DEV_BLANKING) { + // don't remove device that is currently busy + return; + } + + CdDevice::remove(data->dev.c_str()); + listModel_->erase(selectedRow_); + list_.get_selection()->unselect_all(); + selectedRow_ = list_.get_selection()->get_selected(); + delete data; + + guiUpdate(UPD_CD_DEVICES); + } +} + +void DeviceConfDialog::rescanAction() +{ + CdDevice::scan(); + guiUpdate(UPD_CD_DEVICES); +} + +Gtk::TreeIter DeviceConfDialog::appendTableEntry(CdDevice *dev) +{ + DeviceData *data; + const gchar *rowStr[6]; + + data = new DeviceData; + data->dev = dev->dev(); + data->driverId = dev->driverId(); + data->options = dev->driverOptions(); + + switch (dev->deviceType()) { + case CdDevice::CD_ROM: + data->deviceType = 0; + break; + case CdDevice::CD_R: + data->deviceType = 1; + break; + case CdDevice::CD_RW: + data->deviceType = 2; + break; + } + + Gtk::TreeIter newiter = listModel_->append(); + Gtk::TreeModel::Row row = *newiter; + row[listColumns_.dev] = data->dev; + row[listColumns_.vendor] = dev->vendor(); + row[listColumns_.model] = dev->product(); + row[listColumns_.status] = CdDevice::status2string(dev->status()); + row[listColumns_.data] = data; + + return newiter; +} + +void DeviceConfDialog::import() +{ + CdDevice *drun; + DeviceData *data; + + list_.get_selection()->unselect_all(); + selectedRow_ = list_.get_selection()->get_selected(); + + listModel_->clear(); + + for (drun = CdDevice::first(); drun != NULL; drun = CdDevice::next(drun)) { + appendTableEntry(drun); + } + + if (listModel_->children().size() > 0) { + list_.columns_autosize(); + list_.get_selection()->select(Gtk::TreeModel::Path((unsigned)1)); + } +} + +void DeviceConfDialog::importConfiguration(Gtk::TreeIter row) +{ + char buf[50]; + DeviceData *data; + + if (selectedRow_) { + + data = (*selectedRow_)[listColumns_.data]; + driverMenu_->set_sensitive(true); + driverMenu_->set_history(data->driverId); + devtypeMenu_->set_sensitive(true); + devtypeMenu_->set_history(data->deviceType); + driverOptionsEntry_.set_sensitive(true); + sprintf(buf, "0x%lx", data->options); + driverOptionsEntry_.set_text(buf); + + } else { + + driverMenu_->set_history(0); + driverMenu_->set_sensitive(false); + devtypeMenu_->set_history(0); + devtypeMenu_->set_sensitive(false); + driverOptionsEntry_.set_text(""); + driverOptionsEntry_.set_sensitive(false); + } +} + +void DeviceConfDialog::importStatus() +{ + DeviceData *data; + CdDevice *dev; + + Gtk::TreeNodeChildren ch = listModel_->children(); + for (unsigned i = 0; i < ch.size(); i++) { + Gtk::TreeRow row = ch[i]; + data = row[listColumns_.data]; + if (data && (dev = CdDevice::find(data->dev.c_str()))) { + row[listColumns_.status] = CdDevice::status2string(dev->status()); + } + } + + list_.columns_autosize(); +} + +void DeviceConfDialog::exportConfiguration(Gtk::TreeIter row) +{ + DeviceData *data; + + if (row) { + data = (*row)[listColumns_.data]; + + if (data) { + data->options = strtoul(driverOptionsEntry_.get_text().c_str(), NULL, 0); + } + } +} + +void DeviceConfDialog::exportData() +{ + DeviceData *data; + CdDevice *dev; + std::string s; + + Gtk::TreeNodeChildren ch = listModel_->children(); + for (unsigned i = 0; i < ch.size(); i++) { + Gtk::TreeRow row = ch[i]; + data = row[listColumns_.data]; + if (data && (dev = CdDevice::find(data->dev.c_str()))) { + + if (dev->driverId() != data->driverId) { + dev->driverId(data->driverId); + dev->manuallyConfigured(true); + } + + if (dev->deviceType() != ID2DEVICE_TYPE[data->deviceType]) { + dev->deviceType(ID2DEVICE_TYPE[data->deviceType]); + dev->manuallyConfigured(true); + } + + if (dev->driverOptions() != data->options) { + dev->driverOptions(data->options); + dev->manuallyConfigured(true); + } + } + } +} + + + +void DeviceConfDialog::setDriverId(int id) +{ + DeviceData *data; + + if (selectedRow_ && id >= 0 && id <= CdDevice::maxDriverId()) { + data = (*selectedRow_)[listColumns_.data]; + if (data) + data->driverId = id; + } +} + +void DeviceConfDialog::setDeviceType(int id) +{ + DeviceData *data; + + if (selectedRow_ && id >= 0 && id <= CdDevice::maxDriverId()) { + data = (*selectedRow_)[listColumns_.data]; + if (data) + data->deviceType = id; + } +} + +void DeviceConfDialog::selectionChanged() +{ + Gtk::TreeIter new_sel = list_.get_selection()->get_selected(); + + if ((bool)selectedRow_ != (bool)new_sel || selectedRow_ != new_sel) { + + if (selectedRow_) + exportConfiguration(selectedRow_); + + selectedRow_ = new_sel; + importConfiguration(selectedRow_); + } +} + +const char *DeviceConfDialog::checkString(const std::string &str) +{ + static char *buf = NULL; + static long bufLen = 0; + char *p, *s; + long len = strlen(str.c_str()); + + if (len == 0) + return NULL; + + if (buf == NULL || len + 1 > bufLen) { + delete[] buf; + bufLen = len + 1; + buf = new char[bufLen]; + } + + strcpy(buf, str.c_str()); + + s = buf; + p = buf + len - 1; + + while (*s != 0 && isspace(*s)) + s++; + + if (*s == 0) + return NULL; + + while (p > s && isspace(*p)) { + *p = 0; + p--; + } + + return s; +} diff --git a/xdao/DeviceConfDialog.h b/xdao/DeviceConfDialog.h new file mode 100644 index 0000000..408eff8 --- /dev/null +++ b/xdao/DeviceConfDialog.h @@ -0,0 +1,104 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998, 1999 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __DEVICE_CONF_DIALOG_H +#define __DEVICE_CONF_DIALOG_H + +#include <gtkmm.h> + +class TocEdit; +class CdDevice; + +class DeviceConfDialog : public Gtk::Window +{ +public: + DeviceConfDialog(); + ~DeviceConfDialog(); + + void start(); + void stop(); + + void update(unsigned long level); + +private: + bool active_; + + Gtk::TreeIter selectedRow_; + + struct DeviceData { + std::string dev; + int driverId; + int deviceType; + unsigned long options; + }; + + // ------------------------------------- Device TreeView + + class ListColumns : public Gtk::TreeModel::ColumnRecord { + public: + ListColumns() { + add(dev); add(vendor); add(model); add(status); add(data); + }; + + Gtk::TreeModelColumn<std::string> dev; + Gtk::TreeModelColumn<std::string> vendor; + Gtk::TreeModelColumn<std::string> model; + Gtk::TreeModelColumn<std::string> status; + Gtk::TreeModelColumn<DeviceData*> data; + }; + Gtk::TreeView list_; + Glib::RefPtr<Gtk::ListStore> listModel_; + ListColumns listColumns_; + + Gtk::Frame listFrame_; + Gtk::Frame settingFrame_; + Gtk::Frame addDeviceFrame_; + + Gtk::OptionMenu *driverMenu_; + Gtk::OptionMenu *devtypeMenu_; + + Gtk::Entry devEntry_; + Gtk::Entry vendorEntry_; + Gtk::Entry productEntry_; + Gtk::Entry driverOptionsEntry_; + + const char *checkString(const std::string &str); + + void setDriverId(int); + void setDeviceType(int); + + void selectionChanged(); + + void closeAction(); + void resetAction(); + void applyAction(); + void addDeviceAction(); + void deleteDeviceAction(); + void rescanAction(); + + Gtk::TreeIter appendTableEntry(CdDevice *); + void import(); + void importConfiguration(Gtk::TreeIter); + void importStatus(); + + void exportData(); + void exportConfiguration(Gtk::TreeIter); +}; + +#endif diff --git a/xdao/DeviceList.cc b/xdao/DeviceList.cc new file mode 100644 index 0000000..64f1a4b --- /dev/null +++ b/xdao/DeviceList.cc @@ -0,0 +1,207 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stdio.h> +#include <limits.h> +#include <math.h> +#include <assert.h> +#include <string> + +#include <gtkmm.h> +#include <gnome.h> + +#include "DeviceList.h" +#include "MessageBox.h" +#include "xcdrdao.h" +#include "Settings.h" + +#include "CdDevice.h" +#include "guiUpdate.h" +#include "TocEdit.h" + +#include "util.h" + +DeviceList::DeviceList(CdDevice::DeviceType filterType) +{ + Gtk::HBox *hbox; + + filterType_ = filterType; + + listModel_ = Gtk::ListStore::create(listColumns_); + list_.set_model(listModel_); + list_.append_column(_("Vendor"), listColumns_.vendor); + list_.append_column(_("Model"), listColumns_.model); + list_.append_column(_("Status"), listColumns_.status); + + Gtk::VBox *contents = new Gtk::VBox; + contents->set_spacing(10); + + // available device list + Gtk::HBox *listHBox = new Gtk::HBox; + Gtk::VBox *listVBox = new Gtk::VBox; + + hbox = new Gtk::HBox; + hbox->pack_start(list_, TRUE, TRUE); + + Gtk::Adjustment *adjust = new Gtk::Adjustment(0.0, 0.0, 0.0); + + Gtk::VScrollbar *scrollBar = new Gtk::VScrollbar(*adjust); + hbox->pack_start(*scrollBar, FALSE, FALSE); + + list_.set_vadjustment(*adjust); + + listHBox->pack_start(*hbox, TRUE, TRUE, 5); + listVBox->pack_start(*listHBox, TRUE, TRUE, 5); + + switch (filterType_) { + case CdDevice::CD_ROM: + set_label(_(" Available Reader Devices ")); + break; + case CdDevice::CD_R: + set_label(_(" Available Recorder Devices ")); + break; + case CdDevice::CD_RW: + set_label(_(" Available Recorder (RW) Devices ")); + break; + } + + add(*listVBox); +} + +std::string DeviceList::selection() +{ + Gtk::TreeIter i = list_.get_selection()->get_selected(); + + if (i) { + return ((std::string)((*i)[listColumns_.dev])).c_str(); + } else + return std::string(); +} + +void DeviceList::appendTableEntry(CdDevice *dev) +{ + Gtk::TreeIter newiter = listModel_->append(); + Gtk::TreeModel::Row row = *newiter; + row[listColumns_.dev] = dev->dev(); + row[listColumns_.vendor] = dev->vendor(); + row[listColumns_.model] = dev->product(); + row[listColumns_.status] = CdDevice::status2string(dev->status()); + + if (dev->status() == CdDevice::DEV_READY) + list_.get_selection()->select(newiter); +} + +void DeviceList::import() +{ + CdDevice *drun; + unsigned int i; + + listModel_->clear(); + + for (drun = CdDevice::first(); drun != NULL; drun = CdDevice::next(drun)) { + switch (filterType_) { + case CdDevice::CD_ROM: + if (drun->driverId() > 0 && + (drun->deviceType() == CdDevice::CD_ROM || + drun->deviceType() == CdDevice::CD_R || + drun->deviceType() == CdDevice::CD_RW)) { + appendTableEntry(drun); + } + break; + case CdDevice::CD_R: + if (drun->driverId() > 0 && + (drun->deviceType() == CdDevice::CD_R || + drun->deviceType() == CdDevice::CD_RW)) { + appendTableEntry(drun); + } + break; + case CdDevice::CD_RW: + if (drun->driverId() > 0 && + (drun->deviceType() == CdDevice::CD_RW)) { + appendTableEntry(drun); + } + break; + } + } + + if (listModel_->children().size() > 0) { + list_.columns_autosize(); + list_.get_selection()->select(Gtk::TreeModel::Path((unsigned)1)); + } +} + +void DeviceList::importStatus() +{ + std::string data; + CdDevice *cddev; + + Gtk::TreeNodeChildren ch = listModel_->children(); + for (unsigned i = 0; i < ch.size(); i++) { + Gtk::TreeRow row = ch[i]; + data = row[listColumns_.dev]; + + if ((cddev = CdDevice::find(data.c_str()))) { + if (cddev->status() == CdDevice::DEV_READY) + list_.get_column(i)->set_clickable(true); + else + list_.get_column(i)->set_clickable(false); + + row[listColumns_.status] = CdDevice::status2string(cddev->status()); + } + } + + list_.columns_autosize(); +} + +void DeviceList::selectOne() +{ + if (list_.get_selection()->count_selected_rows() > 0) + return; + + for (unsigned i = 0; i < listModel_->children().size(); i++) { + list_.get_selection()->select(Gtk::TreePath(1, i)); + if (list_.get_selection()->count_selected_rows() > 0) + break; + } +} + +void DeviceList::selectOneBut(const char *targetData) +{ + if (!targetData) + return selectOne(); + + if (list_.get_selection()->count_selected_rows() == 0) { + + Gtk::TreeNodeChildren ch = listModel_->children(); + + for (unsigned i = 0; i < ch.size(); i++) { + + std::string sourceData = (ch[i])[listColumns_.dev]; + + if (sourceData != targetData) { + list_.get_selection()->select(ch[i]); + break; + } + } + + if (list_.get_selection()->count_selected_rows() == 0) { + selectOne(); + } + } +} diff --git a/xdao/DeviceList.h b/xdao/DeviceList.h new file mode 100644 index 0000000..7e75b18 --- /dev/null +++ b/xdao/DeviceList.h @@ -0,0 +1,66 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998, 1999 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __DEVICE_LIST_H +#define __DEVICE_LIST_H + +#include <gtkmm.h> +#include <gtk/gtk.h> +#include <string> + +class TocEdit; +#include "CdDevice.h" + +class DeviceList : public Gtk::Frame +{ + public: + DeviceList(CdDevice::DeviceType filterType); + ~DeviceList() {}; + + std::string selection(); + void selectOne(); + void selectOneBut(const char *targetData); + void appendTableEntry(CdDevice *); + void import(); + void importStatus(); + +private: + TocEdit* tocEdit_; + + int speed_; + CdDevice::DeviceType filterType_; + + class ListColumns : public Gtk::TreeModel::ColumnRecord { + public: + ListColumns() { + add(dev); add(vendor); add(model); add(status); + }; + + Gtk::TreeModelColumn<std::string> dev; + Gtk::TreeModelColumn<std::string> vendor; + Gtk::TreeModelColumn<std::string> model; + Gtk::TreeModelColumn<std::string> status; + }; + + Gtk::TreeView list_; + Glib::RefPtr<Gtk::ListStore> listModel_; + ListColumns listColumns_; +}; + +#endif diff --git a/xdao/DumpCDProject.cc b/xdao/DumpCDProject.cc new file mode 100644 index 0000000..f397a8a --- /dev/null +++ b/xdao/DumpCDProject.cc @@ -0,0 +1,213 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "guiUpdate.h" +#include "Project.h" +#include "DumpCDProject.h" +#include "RecordCDSource.h" +#include "RecordHDTarget.h" +#include "DeviceList.h" +#include "MessageBox.h" +#include "Settings.h" +#include "util.h" +#include "Icons.h" + +#include <gtkmm.h> +#include <gnome.h> + +DumpCDProject::DumpCDProject(Gtk::Window *parent) + : Project(parent) +{ + // Top vbox + Gtk::VBox* top_vbox = manage(new Gtk::VBox); + top_vbox->set_border_width(10); + top_vbox->set_spacing(10); + parent_ = parent; + + CDSource = manage(new RecordCDSource(parent_)); + CDSource->onTheFlyOption(false); + CDSource->start(); + top_vbox->pack_start(*CDSource); + + HDTarget = manage(new RecordHDTarget()); + HDTarget->start(); + top_vbox->pack_start(*HDTarget, Gtk::PACK_SHRINK); + + Gtk::HButtonBox* bbox = manage(new Gtk::HButtonBox); + bbox->set_spacing(10); + + Gtk::Image *pixmap = manage(new Gtk::Image(Icons::DUMPCD, + Gtk::ICON_SIZE_DIALOG)); + Gtk::Label *startLabel = manage(new Gtk::Label(_("Start"))); + Gtk::VBox *startBox = manage(new Gtk::VBox); + Gtk::Button *button = manage(new Gtk::Button()); + startBox->pack_start(*pixmap, false, false); + startBox->pack_start(*startLabel, false, false); + button->add(*startBox); + button->signal_clicked().connect(mem_fun(*this, &DumpCDProject::start)); + bbox->pack_start(*button, Gtk::PACK_EXPAND_PADDING); + top_vbox->pack_start(*bbox, Gtk::PACK_SHRINK); + + pack_start(*top_vbox); + guiUpdate(UPD_ALL); + show_all(); +} + +DumpCDProject::~DumpCDProject() +{ +} + +void DumpCDProject::start() +{ + DeviceList *sourceList = CDSource->getDeviceList(); + + if (sourceList->selection().empty()) { + Gtk::MessageDialog d(*parent_, _("Please select one reader device"), + Gtk::MESSAGE_INFO); + d.run(); + return; + } + + // Read options + int correction = CDSource->getCorrection(); + int subChanReadMode = CDSource->getSubChanReadMode(); + + std::string imageName = HDTarget->getFilename(); + + if (imageName == "") { + Gtk::MessageDialog d(*parent_, _("Please specify a name for the image"), + Gtk::MESSAGE_INFO); + d.run(); + return; + } + + char *tmp, *p; + tmp = strdupCC(imageName.c_str()); + + if ((p = strrchr(tmp, '.')) != NULL && strcmp(p, ".toc") == 0) + *p = 0; + + if (*tmp == 0 || strcmp(tmp, ".") == 0 || strcmp(tmp, "..") == 0) { + Gtk::MessageDialog d(*parent_, _("The specified image name is invalid"), + Gtk::MESSAGE_ERROR); + d.run(); + delete[] tmp; + return; + } + + imageName = tmp; + delete[] tmp; + + std::string imagePath; + std::string binPath; + std::string tocPath; + { + std::string path = HDTarget->getPath(); + const char *s = path.c_str(); + long len = strlen(s); + + if (len == 0) { + imagePath = imageName; + } + else { + imagePath = path; + + if (s[len - 1] != '/') + imagePath += "/"; + + imagePath += imageName; + } + } + + binPath = imagePath; + binPath += ".bin"; + + tocPath = imagePath; + tocPath += ".toc"; + + if (access(binPath.c_str(), R_OK) == 0) { + std::string s = _("The image file \""); + s += binPath; + s += _("\" already exists."); + + Ask2Box msg(parent_, _("Dump CD"), 0, 1, s.c_str(), + _("Do you want to overwrite it?"), "", NULL); + + if (msg.run() != 1) + return; + } + + if (access(tocPath.c_str(), R_OK) == 0) + { + std::string s = _("The toc-file \""); + s += tocPath; + s += _("\" already exists."); + + Ask2Box msg(parent_, _("Dump CD"), 0, 1, s.c_str(), + _("Do you want to overwrite it?"), "", NULL); + + switch (msg.run()) { + case 1: // remove the file an continue + if (unlink(tocPath.c_str()) != -0) + { + MessageBox msg(parent_, _("Dump CD"), 0, + _("Cannot delete toc-file"), tocPath.c_str(), NULL); + msg.run(); + return; + } + break; + default: // cancel + return; + break; + } + } + + std::string sourceData = sourceList->selection(); + + if (sourceData.empty()) + return; + + CdDevice *readDevice = CdDevice::find(sourceData.c_str()); + + if (readDevice == NULL) + return; + + if (readDevice->extractDao(*parent_, imagePath.c_str(), correction, + subChanReadMode) + != 0) { + Gtk::MessageDialog d(*parent_, _("Cannot start reading"), Gtk::MESSAGE_ERROR); + d.run(); + } else { + guiUpdate(UPD_CD_DEVICE_STATUS); + } +} + +bool DumpCDProject::closeProject() +{ + return true; // Close the project +} + +void DumpCDProject::update(unsigned long level) +{ + CDSource->update(level); + HDTarget->update(level); + + if (level & UPD_CD_DEVICE_STATUS) + CDSource->getDeviceList()->selectOne(); +} diff --git a/xdao/DumpCDProject.h b/xdao/DumpCDProject.h new file mode 100644 index 0000000..6066e5f --- /dev/null +++ b/xdao/DumpCDProject.h @@ -0,0 +1,45 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __DUMP_CD_PROJECT_H__ +#define __DUMP_CD_PROJECT_H__ + +class RecordCDSource; +class RecordHDTarget; + +class DumpCDProject : public Project +{ +public: + DumpCDProject(Gtk::Window *parent); + ~DumpCDProject(); + bool closeProject(); + + protected: + virtual void createToolbar() {}; + +private: + RecordCDSource *CDSource; + RecordHDTarget *HDTarget; + + void start(); + void recordToc2CD() {} + void projectInfo() {} + void update(unsigned long level); +}; +#endif diff --git a/xdao/DuplicateCDProject.cc b/xdao/DuplicateCDProject.cc new file mode 100644 index 0000000..ef5751b --- /dev/null +++ b/xdao/DuplicateCDProject.cc @@ -0,0 +1,224 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "guiUpdate.h" +#include "Project.h" +#include "DuplicateCDProject.h" +#include "RecordCDSource.h" +#include "RecordCDTarget.h" +#include "DeviceList.h" +#include "MessageBox.h" +#include "Settings.h" +#include "Icons.h" + +#include <gtkmm.h> +#include <gnome.h> + +DuplicateCDProject::DuplicateCDProject(Gtk::Window *parent) + : Project(parent) +{ + Gtk::VBox *vbox = new Gtk::VBox; + vbox->set_border_width(10); + vbox->set_spacing(10); + Gtk::HBox *hbox = manage(new Gtk::HBox); + hbox->set_spacing(10); + vbox->pack_start(*hbox); + pack_start(*vbox); + parent_ = parent; + + CDSource = new RecordCDSource(parent_); + CDSource->start(); + CDTarget = new RecordCDTarget(parent_); + CDTarget->start(); + + hbox->pack_start(*CDSource); + hbox->pack_start(*CDTarget); + + hbox = manage(new Gtk::HBox); + hbox->set_spacing(10); + + Gtk::VBox *frameBox = new Gtk::VBox; + simulate_rb = new Gtk::RadioButton(_("Simulate"), 0); + simulateBurn_rb = new Gtk::RadioButton(_("Simulate and Burn"), 0); + burn_rb = new Gtk::RadioButton(_("Burn"), 0); + + frameBox->pack_start(*simulate_rb); + frameBox->pack_start(*simulateBurn_rb); + Gtk::RadioButton::Group rb_group = simulate_rb->get_group(); + simulateBurn_rb->set_group(rb_group); + frameBox->pack_start(*burn_rb); + burn_rb->set_group(rb_group); + + hbox->pack_start(*frameBox, true, false); + + Gtk::Image *pixmap = manage(new Gtk::Image(Icons::GCDMASTER, + Gtk::ICON_SIZE_DIALOG)); + Gtk::Label *startLabel = manage(new Gtk::Label(_("Start"))); + Gtk::VBox *startBox = manage(new Gtk::VBox); + Gtk::Button *button = manage(new Gtk::Button()); + startBox->pack_start(*pixmap, false, false); + startBox->pack_start(*startLabel, false, false); + + button->add(*startBox); + button->signal_clicked().connect(mem_fun(*this, &DuplicateCDProject::start)); + + hbox->pack_start(*button, true, false); + + Gtk::HBox *hbox2 = new Gtk::HBox; + hbox2->pack_start(*hbox, true, false); + vbox->pack_start(*hbox2, Gtk::PACK_SHRINK); + + guiUpdate(UPD_ALL); + show_all(); +} + +DuplicateCDProject::~DuplicateCDProject() +{ + delete CDSource; + delete CDTarget; +} + +void DuplicateCDProject::start() +{ + DeviceList *sourceList = CDSource->getDeviceList(); + DeviceList *targetList = CDTarget->getDeviceList(); + + std::string sourceData = sourceList->selection(); + std::string targetData = targetList->selection(); + + if (sourceData.empty()) { + Gtk::MessageDialog d(*parent_, _("Please select one reader device"), + Gtk::MESSAGE_INFO); + d.run(); + return; + } + + if (targetData.empty()) { + Gtk::MessageDialog d(*parent_, + _("Please select at least one recorder device"), + Gtk::MESSAGE_INFO); + d.run(); + return; + } + + //Read options + int onTheFly = CDSource->getOnTheFly(); + if (onTheFly) { + // We can't make on the fly copy with the same device, check that + // We can only have one source device selected + + if (sourceData == targetData) { + + // If the user selects the same device for reading and writing + // we can't do on the fly copying. More complex situations with + // multiple target devices are not handled + if (gnome_config_get_bool(SET_DUPLICATE_ONTHEFLY_WARNING)) { + Ask2Box msg(parent_, "Request", 1, 2, + _("To duplicate a CD using the same device for reading " + "and writing"), + _("you need to copy the CD to disk before burning"), "", + _("Proceed and copy to disk before burning?"), NULL); + + switch (msg.run()) { + case 1: // proceed without on the fly + CDSource->setOnTheFly(false); + onTheFly = 0; + if (msg.dontShowAgain()) { + gnome_config_set_bool(SET_DUPLICATE_ONTHEFLY_WARNING, FALSE); + gnome_config_sync(); + } + break; + default: // do not proceed + return; + break; + } + } else { + CDSource->setOnTheFly(false); + onTheFly = 0; + } + } + } + + int correction = CDSource->getCorrection(); + int subChanReadMode = CDSource->getSubChanReadMode(); + + // Record options + int simulate; + if (simulate_rb->get_active()) + simulate = 1; + else if (simulateBurn_rb->get_active()) + simulate = 2; + else + simulate = 0; + + int multiSession = CDTarget->getMultisession(); + int burnSpeed = CDTarget->getSpeed(); + int eject = CDTarget->checkEjectWarning(parent_); + if (eject == -1) + return; + + int reload = CDTarget->checkReloadWarning(parent_); + if (reload == -1) + return; + + int buffer = CDTarget->getBuffer(); + + CdDevice *readDevice = CdDevice::find(sourceData.c_str()); + if (readDevice == NULL) + return; + + CdDevice *writeDevice = CdDevice::find(targetData.c_str()); + if (writeDevice == NULL) + return; + + if (writeDevice->duplicateDao(*parent_, simulate, multiSession, burnSpeed, + eject, reload, buffer, onTheFly, correction, + subChanReadMode, readDevice) != 0) { + Gtk::MessageDialog md(*parent_, _("Cannot start disk-at-once duplication"), + Gtk::MESSAGE_ERROR); + md.run(); + } else { + guiUpdate(UPD_CD_DEVICE_STATUS); + } +} + +bool DuplicateCDProject::closeProject() +{ + return true; // Close the project +} + +void DuplicateCDProject::update(unsigned long level) +{ + CDSource->update(level); + CDTarget->update(level); + + if (level & UPD_CD_DEVICE_STATUS) + { + DeviceList *sourceList = CDSource->getDeviceList(); + DeviceList *targetList = CDTarget->getDeviceList(); + + targetList->selectOne(); + + if (targetList->selection().empty()) { + sourceList->selectOne(); + } else { + sourceList->selectOneBut(targetList->selection().c_str()); + } + } +} diff --git a/xdao/DuplicateCDProject.h b/xdao/DuplicateCDProject.h new file mode 100644 index 0000000..57d2185 --- /dev/null +++ b/xdao/DuplicateCDProject.h @@ -0,0 +1,49 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __DUPLICATECDPROJECT_H__ +#define __DUPLICATECDPROJECT_H__ + +class RecordCDSource; +class RecordCDTarget; + +class DuplicateCDProject : public Project +{ +public: + DuplicateCDProject(Gtk::Window *parent); + ~DuplicateCDProject(); + bool closeProject(); + + protected: + virtual void createToolbar() {}; + +private: + RecordCDSource *CDSource; + RecordCDTarget *CDTarget; + + Gtk::RadioButton *simulate_rb; + Gtk::RadioButton *simulateBurn_rb; + Gtk::RadioButton *burn_rb; + + void start(); + void recordToc2CD() {} + void projectInfo() {} + void update(unsigned long level); +}; +#endif diff --git a/xdao/GenericView.cc b/xdao/GenericView.cc new file mode 100644 index 0000000..99abe94 --- /dev/null +++ b/xdao/GenericView.cc @@ -0,0 +1,36 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "GenericView.h" + + +GenericView::GenericView() +{ + tocEditView_ = (TocEditView*)0; +} + +GenericView::~GenericView() +{ + tocEditView_ = (TocEditView*)0; +} + +TocEditView *GenericView::tocEditView() const +{ + return tocEditView_; +} diff --git a/xdao/GenericView.h b/xdao/GenericView.h new file mode 100644 index 0000000..f920653 --- /dev/null +++ b/xdao/GenericView.h @@ -0,0 +1,42 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __GENERIC_VIEW_H__ +#define __GENERIC_VIEW_H__ + +#include <gtkmm.h> + +class TocEditView; + +class GenericView : public Gtk::VBox +{ +public: + GenericView(); + ~GenericView(); + + virtual TocEditView *tocEditView() const; + + virtual void update(unsigned long level) = 0; + +protected: + TocEditView *tocEditView_; + +}; + +#endif diff --git a/xdao/Icons.cc b/xdao/Icons.cc new file mode 100644 index 0000000..add6c1c --- /dev/null +++ b/xdao/Icons.cc @@ -0,0 +1,40 @@ +#include "Icons.h" +#include "stock/pixbufs.h" + +Gtk::StockID Icons::PLAY("gcdmaster-play"); +Gtk::StockID Icons::STOP("gcdmaster-stop"); +Gtk::StockID Icons::PAUSE("gcdmaster-pause"); +Gtk::StockID Icons::GCDMASTER("gcdmaster-gcdmaster"); +Gtk::StockID Icons::OPEN("gcdmaster-open"); +Gtk::StockID Icons::AUDIOCD("gcdmaster-audiocd"); +Gtk::StockID Icons::COPYCD("gcdmaster-copycd"); +Gtk::StockID Icons::DUMPCD("gcdmaster-dumpcd"); +Gtk::StockID Icons::RECORD("gcdmaster-record"); + +struct Icons::IconEntry Icons::iconList[] = { + { Icons::PLAY, play_pixbuf }, + { Icons::STOP, stop_pixbuf }, + { Icons::PAUSE, pause_pixbuf }, + { Icons::GCDMASTER, gcdmaster_pixbuf }, + { Icons::OPEN, open_pixbuf }, + { Icons::AUDIOCD, audiocd_pixbuf }, + { Icons::COPYCD, copycd_pixbuf}, + { Icons::DUMPCD, dumpcd_pixbuf}, + { Icons::RECORD, record_pixbuf} +}; + +void Icons::registerStockIcons() +{ + Glib::RefPtr<Gtk::IconFactory> factory = Gtk::IconFactory::create(); + factory->add_default(); + + for (unsigned i = 0; i < G_N_ELEMENTS(iconList); i++) { + Gtk::IconSource* source = new Gtk::IconSource; + Glib::RefPtr<Gdk::Pixbuf> pixbuf = + Gdk::Pixbuf::create_from_inline(-1, iconList[i].pixbuf); + source->set_pixbuf(pixbuf); + Gtk::IconSet* set = new Gtk::IconSet; + set->add_source(*source); + factory->add(iconList[i].name, *set); + } +} diff --git a/xdao/Icons.h b/xdao/Icons.h new file mode 100644 index 0000000..aa13465 --- /dev/null +++ b/xdao/Icons.h @@ -0,0 +1,29 @@ +#ifndef ICONS_H +#define ICONS_H + +#include <gtkmm.h> + +class Icons +{ + public: + static void registerStockIcons(); + + static Gtk::StockID PLAY; + static Gtk::StockID STOP; + static Gtk::StockID PAUSE; + static Gtk::StockID GCDMASTER; + static Gtk::StockID OPEN; + static Gtk::StockID AUDIOCD; + static Gtk::StockID COPYCD; + static Gtk::StockID DUMPCD; + static Gtk::StockID RECORD; + + private: + static struct IconEntry { + Gtk::StockID& name; + const guint8* pixbuf; + } iconList[]; +}; + + +#endif diff --git a/xdao/Makefile.am b/xdao/Makefile.am new file mode 100644 index 0000000..063e20e --- /dev/null +++ b/xdao/Makefile.am @@ -0,0 +1,158 @@ +SUBDIRS = stock + +bin_PROGRAMS = gcdmaster + +gcdmaster_SOURCES = \ + AddFileDialog.cc \ + AddSilenceDialog.cc \ + AudioCDProject.cc \ + AudioCDView.cc \ + BlankCDDialog.cc \ + CdDevice.cc \ + CdTextDialog.cc \ + ConfigManager.cc \ + DeviceConfDialog.cc \ + DeviceList.cc \ + DumpCDProject.cc \ + DuplicateCDProject.cc \ + gcdmaster.cc \ + GenericView.cc \ + guiUpdate.cc \ + Icons.cc \ + MessageBox.cc \ + PreferencesDialog.cc \ + ProcessMonitor.cc \ + ProgressDialog.cc \ + Project.cc \ + ProjectChooser.cc \ + RecordCDSource.cc \ + RecordCDTarget.cc \ + RecordHDTarget.cc \ + RecordTocDialog.cc \ + RecordTocSource.cc \ + SampleDisplay.cc \ + SampleManager.cc \ + Settings.cc \ + TextEdit.cc \ + TocEdit.cc \ + TocEditView.cc \ + TocInfoDialog.cc \ + TrackDataScrap.cc \ + TrackInfoDialog.cc \ + TrackManager.cc \ + xcdrdao.cc \ + AddFileDialog.h \ + DumpCDProject.h \ + ProjectChooser.h \ + SoundIF.h \ + AddSilenceDialog.h \ + DuplicateCDProject.h \ + Project.h \ + TextEdit.h \ + gcdmaster.h \ + RecordCDSource.h \ + TocEdit.h \ + AudioCDProject.h \ + RecordCDTarget.h \ + TocEditView.h \ + AudioCDView.h \ + GenericView.h \ + RecordHDTarget.h \ + TocInfoDialog.h \ + BlankCDDialog.h \ + guiUpdate.h \ + RecordTocDialog.h \ + TrackDataScrap.h \ + CdDevice.h \ + Icons.h \ + RecordTocSource.h \ + TrackInfoDialog.h \ + CdTextDialog.h \ + MessageBox.h \ + SampleDisplay.h \ + TrackManager.h \ + DeviceConfDialog.h \ + ProcessMonitor.h \ + SampleManager.h \ + xcdrdao.h \ + DeviceList.h \ + ProgressDialog.h \ + ConfigManager.h \ + PreferencesDialog.h \ + Settings.h + +EXTRA_gcdmaster_SOURCES = \ + SoundIF-ao.cc \ + SoundIF-linux.cc \ + SoundIF-none.cc \ + SoundIF-solaris.cc + +gladedir = $(datadir)/gcdmaster/glade +glade_DATA = \ + glade/Preferences.glade \ + glade/ProjectChooser.glade + +gcdmaster_LDADD = \ + @sound_if_obj@ \ + $(top_builddir)/dao/libdao.a \ + $(top_builddir)/paranoia/libcdda_paranoia.a \ + $(top_builddir)/trackdb/libtrackdb.a \ + @scsilib_libs@ \ + @LIBGUIMM2_LIBS@ @GTKMM2_LIBS@ + +AM_CXXFLAGS = @GTKMM2_CFLAGS@ @LIBGUIMM2_CFLAGS@ @AO_CFLAGS@ + +if COND_MP3 +gcdmaster_LDADD += @MAD_LIBS@ +AM_CXXFLAGS += @MAD_CFLAGS@ +endif + +if COND_OGG +gcdmaster_LDADD += @VORBISFILE_LIBS@ +AM_CXXFLAGS += @VORBISFILE_CFLAGS@ +endif + +gcdmaster_LDADD += @AO_LIBS@ + +gcdmaster_DEPENDENCIES = \ + $(top_builddir)/dao/libdao.a \ + $(top_builddir)/paranoia/libcdda_paranoia.a \ + $(top_builddir)/trackdb/libtrackdb.a \ + @sound_if_obj@ + +INCLUDES = \ + -I$(srcdir)/../trackdb \ + -I$(srcdir)/../paranoia \ + -I$(srcdir)/../dao \ + -DCDRDAO_GLADEDIR=\""$(gladedir)"\" + +man1_MANS = gcdmaster.man + +mimeinfodir = $(datadir)/mime-info +mimeinfo_DATA = gcdmaster.keys gcdmaster.mime + +freedesktopdir = $(datadir)/mime/packages +freedesktop_DATA = gcdmaster.xml + +desktopdir = $(datadir)/applications +desktop_DATA = gcdmaster.desktop + +appregdir = $(datadir)/application-registry +appreg_DATA = gcdmaster.applications + +icondir = $(datadir)/pixmaps +icon_DATA = gcdmaster.png gcdmaster-doc.png + +EXTRA_DIST = \ + $(man1_MANS) \ + $(glade_DATA) \ + $(mimeinfo_DATA)\ + $(desktop_DATA) \ + $(icon_DATA) \ + $(freedesktop_DATA) \ + $(appreg_DATA) \ + BUGS TASKS + +schemasdir = @GCONF_SCHEMA_FILE_DIR@ +schemas_in_files = gcdmaster.schemas.in +schemas_DATA = $(schemas_in_files:.schemas.in=.schemas) diff --git a/xdao/Makefile.in b/xdao/Makefile.in new file mode 100644 index 0000000..fb35834 --- /dev/null +++ b/xdao/Makefile.in @@ -0,0 +1,977 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = gcdmaster$(EXEEXT) +@COND_MP3_TRUE@am__append_1 = @MAD_LIBS@ +@COND_MP3_TRUE@am__append_2 = @MAD_CFLAGS@ +@COND_OGG_TRUE@am__append_3 = @VORBISFILE_LIBS@ +@COND_OGG_TRUE@am__append_4 = @VORBISFILE_CFLAGS@ +subdir = xdao +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/gcdmaster.schemas.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = gcdmaster.schemas +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \ + "$(DESTDIR)$(appregdir)" "$(DESTDIR)$(desktopdir)" \ + "$(DESTDIR)$(freedesktopdir)" "$(DESTDIR)$(gladedir)" \ + "$(DESTDIR)$(icondir)" "$(DESTDIR)$(mimeinfodir)" \ + "$(DESTDIR)$(schemasdir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_gcdmaster_OBJECTS = AddFileDialog.$(OBJEXT) \ + AddSilenceDialog.$(OBJEXT) AudioCDProject.$(OBJEXT) \ + AudioCDView.$(OBJEXT) BlankCDDialog.$(OBJEXT) \ + CdDevice.$(OBJEXT) CdTextDialog.$(OBJEXT) \ + ConfigManager.$(OBJEXT) DeviceConfDialog.$(OBJEXT) \ + DeviceList.$(OBJEXT) DumpCDProject.$(OBJEXT) \ + DuplicateCDProject.$(OBJEXT) gcdmaster.$(OBJEXT) \ + GenericView.$(OBJEXT) guiUpdate.$(OBJEXT) Icons.$(OBJEXT) \ + MessageBox.$(OBJEXT) PreferencesDialog.$(OBJEXT) \ + ProcessMonitor.$(OBJEXT) ProgressDialog.$(OBJEXT) \ + Project.$(OBJEXT) ProjectChooser.$(OBJEXT) \ + RecordCDSource.$(OBJEXT) RecordCDTarget.$(OBJEXT) \ + RecordHDTarget.$(OBJEXT) RecordTocDialog.$(OBJEXT) \ + RecordTocSource.$(OBJEXT) SampleDisplay.$(OBJEXT) \ + SampleManager.$(OBJEXT) Settings.$(OBJEXT) TextEdit.$(OBJEXT) \ + TocEdit.$(OBJEXT) TocEditView.$(OBJEXT) \ + TocInfoDialog.$(OBJEXT) TrackDataScrap.$(OBJEXT) \ + TrackInfoDialog.$(OBJEXT) TrackManager.$(OBJEXT) \ + xcdrdao.$(OBJEXT) +gcdmaster_OBJECTS = $(am_gcdmaster_OBJECTS) +am__DEPENDENCIES_1 = +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ + -o $@ +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(gcdmaster_SOURCES) $(EXTRA_gcdmaster_SOURCES) +DIST_SOURCES = $(gcdmaster_SOURCES) $(EXTRA_gcdmaster_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(man1_MANS) +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; +appregDATA_INSTALL = $(INSTALL_DATA) +desktopDATA_INSTALL = $(INSTALL_DATA) +freedesktopDATA_INSTALL = $(INSTALL_DATA) +gladeDATA_INSTALL = $(INSTALL_DATA) +iconDATA_INSTALL = $(INSTALL_DATA) +mimeinfoDATA_INSTALL = $(INSTALL_DATA) +schemasDATA_INSTALL = $(INSTALL_DATA) +DATA = $(appreg_DATA) $(desktop_DATA) $(freedesktop_DATA) \ + $(glade_DATA) $(icon_DATA) $(mimeinfo_DATA) $(schemas_DATA) +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AO_CFLAGS = @AO_CFLAGS@ +AO_LIBS = @AO_LIBS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COND_MP3_FALSE = @COND_MP3_FALSE@ +COND_MP3_TRUE = @COND_MP3_TRUE@ +COND_OGG_FALSE = @COND_OGG_FALSE@ +COND_OGG_TRUE = @COND_OGG_TRUE@ +COND_PCCTS_FALSE = @COND_PCCTS_FALSE@ +COND_PCCTS_TRUE = @COND_PCCTS_TRUE@ +COND_SCSILIB_FALSE = @COND_SCSILIB_FALSE@ +COND_SCSILIB_TRUE = @COND_SCSILIB_TRUE@ +COND_TOC2MP3_FALSE = @COND_TOC2MP3_FALSE@ +COND_TOC2MP3_TRUE = @COND_TOC2MP3_TRUE@ +COND_XDAO_FALSE = @COND_XDAO_FALSE@ +COND_XDAO_TRUE = @COND_XDAO_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ +GTKMM2_CFLAGS = @GTKMM2_CFLAGS@ +GTKMM2_LIBS = @GTKMM2_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LAME_CFLAGS = @LAME_CFLAGS@ +LAME_LIBS = @LAME_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBGUIMM2_CFLAGS = @LIBGUIMM2_CFLAGS@ +LIBGUIMM2_LIBS = @LIBGUIMM2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAD_CFLAGS = @MAD_CFLAGS@ +MAD_LIBS = @MAD_LIBS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIGCPP2_CFLAGS = @SIGCPP2_CFLAGS@ +SIGCPP2_LIBS = @SIGCPP2_LIBS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +VORBISFILE_CFLAGS = @VORBISFILE_CFLAGS@ +VORBISFILE_LIBS = @VORBISFILE_LIBS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +antlr_path = @antlr_path@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +dao_src = @dao_src@ +datadir = @datadir@ +dlg_path = @dlg_path@ +en_cdrdao = @en_cdrdao@ +en_cue2toc = @en_cue2toc@ +en_toc2cue = @en_toc2cue@ +en_toc2mp3 = @en_toc2mp3@ +en_xdao = @en_xdao@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydefs = @mydefs@ +oldincludedir = @oldincludedir@ +pcctsinc = @pcctsinc@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +scsilib_dir = @scsilib_dir@ +scsilib_incl = @scsilib_incl@ +scsilib_libs = @scsilib_libs@ +scsilib_objs = @scsilib_objs@ +sharedstatedir = @sharedstatedir@ +sound_if_obj = @sound_if_obj@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +thread_libs = @thread_libs@ +SUBDIRS = stock +gcdmaster_SOURCES = \ + AddFileDialog.cc \ + AddSilenceDialog.cc \ + AudioCDProject.cc \ + AudioCDView.cc \ + BlankCDDialog.cc \ + CdDevice.cc \ + CdTextDialog.cc \ + ConfigManager.cc \ + DeviceConfDialog.cc \ + DeviceList.cc \ + DumpCDProject.cc \ + DuplicateCDProject.cc \ + gcdmaster.cc \ + GenericView.cc \ + guiUpdate.cc \ + Icons.cc \ + MessageBox.cc \ + PreferencesDialog.cc \ + ProcessMonitor.cc \ + ProgressDialog.cc \ + Project.cc \ + ProjectChooser.cc \ + RecordCDSource.cc \ + RecordCDTarget.cc \ + RecordHDTarget.cc \ + RecordTocDialog.cc \ + RecordTocSource.cc \ + SampleDisplay.cc \ + SampleManager.cc \ + Settings.cc \ + TextEdit.cc \ + TocEdit.cc \ + TocEditView.cc \ + TocInfoDialog.cc \ + TrackDataScrap.cc \ + TrackInfoDialog.cc \ + TrackManager.cc \ + xcdrdao.cc \ + AddFileDialog.h \ + DumpCDProject.h \ + ProjectChooser.h \ + SoundIF.h \ + AddSilenceDialog.h \ + DuplicateCDProject.h \ + Project.h \ + TextEdit.h \ + gcdmaster.h \ + RecordCDSource.h \ + TocEdit.h \ + AudioCDProject.h \ + RecordCDTarget.h \ + TocEditView.h \ + AudioCDView.h \ + GenericView.h \ + RecordHDTarget.h \ + TocInfoDialog.h \ + BlankCDDialog.h \ + guiUpdate.h \ + RecordTocDialog.h \ + TrackDataScrap.h \ + CdDevice.h \ + Icons.h \ + RecordTocSource.h \ + TrackInfoDialog.h \ + CdTextDialog.h \ + MessageBox.h \ + SampleDisplay.h \ + TrackManager.h \ + DeviceConfDialog.h \ + ProcessMonitor.h \ + SampleManager.h \ + xcdrdao.h \ + DeviceList.h \ + ProgressDialog.h \ + ConfigManager.h \ + PreferencesDialog.h \ + Settings.h + +EXTRA_gcdmaster_SOURCES = \ + SoundIF-ao.cc \ + SoundIF-linux.cc \ + SoundIF-none.cc \ + SoundIF-solaris.cc + +gladedir = $(datadir)/gcdmaster/glade +glade_DATA = \ + glade/Preferences.glade \ + glade/ProjectChooser.glade + +gcdmaster_LDADD = @sound_if_obj@ $(top_builddir)/dao/libdao.a \ + $(top_builddir)/paranoia/libcdda_paranoia.a \ + $(top_builddir)/trackdb/libtrackdb.a @scsilib_libs@ \ + @LIBGUIMM2_LIBS@ @GTKMM2_LIBS@ $(am__append_1) $(am__append_3) \ + @AO_LIBS@ $(am__empty) +AM_CXXFLAGS = @GTKMM2_CFLAGS@ @LIBGUIMM2_CFLAGS@ @AO_CFLAGS@ \ + $(am__append_2) $(am__append_4) +gcdmaster_DEPENDENCIES = \ + $(top_builddir)/dao/libdao.a \ + $(top_builddir)/paranoia/libcdda_paranoia.a \ + $(top_builddir)/trackdb/libtrackdb.a \ + @sound_if_obj@ + +INCLUDES = \ + -I$(srcdir)/../trackdb \ + -I$(srcdir)/../paranoia \ + -I$(srcdir)/../dao \ + -DCDRDAO_GLADEDIR=\""$(gladedir)"\" + +man1_MANS = gcdmaster.man +mimeinfodir = $(datadir)/mime-info +mimeinfo_DATA = gcdmaster.keys gcdmaster.mime +freedesktopdir = $(datadir)/mime/packages +freedesktop_DATA = gcdmaster.xml +desktopdir = $(datadir)/applications +desktop_DATA = gcdmaster.desktop +appregdir = $(datadir)/application-registry +appreg_DATA = gcdmaster.applications +icondir = $(datadir)/pixmaps +icon_DATA = gcdmaster.png gcdmaster-doc.png +EXTRA_DIST = \ + $(man1_MANS) \ + $(glade_DATA) \ + $(mimeinfo_DATA)\ + $(desktop_DATA) \ + $(icon_DATA) \ + $(freedesktop_DATA) \ + $(appreg_DATA) \ + BUGS TASKS + +schemasdir = @GCONF_SCHEMA_FILE_DIR@ +schemas_in_files = gcdmaster.schemas.in +schemas_DATA = $(schemas_in_files:.schemas.in=.schemas) +all: all-recursive + +.SUFFIXES: +.SUFFIXES: .cc .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu xdao/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu xdao/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +gcdmaster.schemas: $(top_builddir)/config.status $(srcdir)/gcdmaster.schemas.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(mkdir_p) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done + +clean-binPROGRAMS: + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) +gcdmaster$(EXEEXT): $(gcdmaster_OBJECTS) $(gcdmaster_DEPENDENCIES) + @rm -f gcdmaster$(EXEEXT) + $(CXXLINK) $(gcdmaster_LDFLAGS) $(gcdmaster_OBJECTS) $(gcdmaster_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AddFileDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AddSilenceDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AudioCDProject.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/AudioCDView.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/BlankCDDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CdDevice.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/CdTextDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ConfigManager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DeviceConfDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DeviceList.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DumpCDProject.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DuplicateCDProject.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GenericView.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Icons.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MessageBox.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/PreferencesDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ProcessMonitor.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ProgressDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Project.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ProjectChooser.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RecordCDSource.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RecordCDTarget.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RecordHDTarget.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RecordTocDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RecordTocSource.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SampleDisplay.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SampleManager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Settings.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SoundIF-ao.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SoundIF-linux.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SoundIF-none.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SoundIF-solaris.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TextEdit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TocEdit.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TocEditView.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TocInfoDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TrackDataScrap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TrackInfoDialog.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TrackManager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gcdmaster.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/guiUpdate.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xcdrdao.Po@am__quote@ + +.cc.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cc.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +uninstall-info-am: +install-man1: $(man1_MANS) $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man1dir)" || $(mkdir_p) "$(DESTDIR)$(man1dir)" + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ + else file=$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ + done +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ + l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ + for i in $$l2; do \ + case "$$i" in \ + *.1*) list="$$list $$i" ;; \ + esac; \ + done; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ + done +install-appregDATA: $(appreg_DATA) + @$(NORMAL_INSTALL) + test -z "$(appregdir)" || $(mkdir_p) "$(DESTDIR)$(appregdir)" + @list='$(appreg_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(appregDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(appregdir)/$$f'"; \ + $(appregDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(appregdir)/$$f"; \ + done + +uninstall-appregDATA: + @$(NORMAL_UNINSTALL) + @list='$(appreg_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(appregdir)/$$f'"; \ + rm -f "$(DESTDIR)$(appregdir)/$$f"; \ + done +install-desktopDATA: $(desktop_DATA) + @$(NORMAL_INSTALL) + test -z "$(desktopdir)" || $(mkdir_p) "$(DESTDIR)$(desktopdir)" + @list='$(desktop_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(desktopDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(desktopdir)/$$f'"; \ + $(desktopDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(desktopdir)/$$f"; \ + done + +uninstall-desktopDATA: + @$(NORMAL_UNINSTALL) + @list='$(desktop_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(desktopdir)/$$f'"; \ + rm -f "$(DESTDIR)$(desktopdir)/$$f"; \ + done +install-freedesktopDATA: $(freedesktop_DATA) + @$(NORMAL_INSTALL) + test -z "$(freedesktopdir)" || $(mkdir_p) "$(DESTDIR)$(freedesktopdir)" + @list='$(freedesktop_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(freedesktopDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(freedesktopdir)/$$f'"; \ + $(freedesktopDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(freedesktopdir)/$$f"; \ + done + +uninstall-freedesktopDATA: + @$(NORMAL_UNINSTALL) + @list='$(freedesktop_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(freedesktopdir)/$$f'"; \ + rm -f "$(DESTDIR)$(freedesktopdir)/$$f"; \ + done +install-gladeDATA: $(glade_DATA) + @$(NORMAL_INSTALL) + test -z "$(gladedir)" || $(mkdir_p) "$(DESTDIR)$(gladedir)" + @list='$(glade_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(gladeDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(gladedir)/$$f'"; \ + $(gladeDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(gladedir)/$$f"; \ + done + +uninstall-gladeDATA: + @$(NORMAL_UNINSTALL) + @list='$(glade_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(gladedir)/$$f'"; \ + rm -f "$(DESTDIR)$(gladedir)/$$f"; \ + done +install-iconDATA: $(icon_DATA) + @$(NORMAL_INSTALL) + test -z "$(icondir)" || $(mkdir_p) "$(DESTDIR)$(icondir)" + @list='$(icon_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(iconDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(icondir)/$$f'"; \ + $(iconDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(icondir)/$$f"; \ + done + +uninstall-iconDATA: + @$(NORMAL_UNINSTALL) + @list='$(icon_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(icondir)/$$f'"; \ + rm -f "$(DESTDIR)$(icondir)/$$f"; \ + done +install-mimeinfoDATA: $(mimeinfo_DATA) + @$(NORMAL_INSTALL) + test -z "$(mimeinfodir)" || $(mkdir_p) "$(DESTDIR)$(mimeinfodir)" + @list='$(mimeinfo_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(mimeinfoDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(mimeinfodir)/$$f'"; \ + $(mimeinfoDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(mimeinfodir)/$$f"; \ + done + +uninstall-mimeinfoDATA: + @$(NORMAL_UNINSTALL) + @list='$(mimeinfo_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(mimeinfodir)/$$f'"; \ + rm -f "$(DESTDIR)$(mimeinfodir)/$$f"; \ + done +install-schemasDATA: $(schemas_DATA) + @$(NORMAL_INSTALL) + test -z "$(schemasdir)" || $(mkdir_p) "$(DESTDIR)$(schemasdir)" + @list='$(schemas_DATA)'; for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + f=$(am__strip_dir) \ + echo " $(schemasDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(schemasdir)/$$f'"; \ + $(schemasDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(schemasdir)/$$f"; \ + done + +uninstall-schemasDATA: + @$(NORMAL_UNINSTALL) + @list='$(schemas_DATA)'; for p in $$list; do \ + f=$(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(schemasdir)/$$f'"; \ + rm -f "$(DESTDIR)$(schemasdir)/$$f"; \ + done + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(mkdir_p) $(distdir)/glade + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(appregdir)" "$(DESTDIR)$(desktopdir)" "$(DESTDIR)$(freedesktopdir)" "$(DESTDIR)$(gladedir)" "$(DESTDIR)$(icondir)" "$(DESTDIR)$(mimeinfodir)" "$(DESTDIR)$(schemasdir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-binPROGRAMS clean-generic mostlyclean-am + +distclean: distclean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: install-appregDATA install-desktopDATA \ + install-freedesktopDATA install-gladeDATA install-iconDATA \ + install-man install-mimeinfoDATA install-schemasDATA + +install-exec-am: install-binPROGRAMS + +install-info: install-info-recursive + +install-man: install-man1 + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-appregDATA uninstall-binPROGRAMS \ + uninstall-desktopDATA uninstall-freedesktopDATA \ + uninstall-gladeDATA uninstall-iconDATA uninstall-info-am \ + uninstall-man uninstall-mimeinfoDATA uninstall-schemasDATA + +uninstall-info: uninstall-info-recursive + +uninstall-man: uninstall-man1 + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-binPROGRAMS clean-generic clean-recursive ctags \ + ctags-recursive distclean distclean-compile distclean-generic \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-appregDATA \ + install-binPROGRAMS install-data install-data-am \ + install-desktopDATA install-exec install-exec-am \ + install-freedesktopDATA install-gladeDATA install-iconDATA \ + install-info install-info-am install-man install-man1 \ + install-mimeinfoDATA install-schemasDATA install-strip \ + installcheck installcheck-am installdirs installdirs-am \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am \ + uninstall-appregDATA uninstall-binPROGRAMS \ + uninstall-desktopDATA uninstall-freedesktopDATA \ + uninstall-gladeDATA uninstall-iconDATA uninstall-info-am \ + uninstall-man uninstall-man1 uninstall-mimeinfoDATA \ + uninstall-schemasDATA + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/xdao/MessageBox.cc b/xdao/MessageBox.cc new file mode 100644 index 0000000..e19eefd --- /dev/null +++ b/xdao/MessageBox.cc @@ -0,0 +1,229 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stddef.h> +#include <stdarg.h> + +#include <gtkmm.h> +#include <gnome.h> + +#include "MessageBox.h" + +MessageBoxBase::MessageBoxBase(Gtk::Window * win) +{ + done_ = 0; + doneDefault_ = 0; + + dontShowAgain_ = NULL; + + if (win != NULL) { + set_transient_for(*win); + set_modal(true); + } + + set_position(Gtk::WIN_POS_CENTER); +} + +MessageBoxBase::~MessageBoxBase() +{ + delete dontShowAgain_; + dontShowAgain_ = NULL; +} + +Gtk::Button *MessageBoxBase::createButton(const Gtk::BuiltinStockID id) +{ + return new Gtk::Button(Gtk::StockID(id)); +} + +void MessageBoxBase::init(const char *type, const char *title, int askDontShow, + int nButtons, int defaultButton, + Gtk::BuiltinStockID buttons[], va_list args) +{ + int i; + const char *s; + + done_ = 0; + doneDefault_ = defaultButton; + + set_title(title); + + Gtk::HButtonBox* bbox = manage(new Gtk::HButtonBox(Gtk::BUTTONBOX_SPREAD)); + bbox->show(); + + Gtk::VBox* contents = manage(new Gtk::VBox); + contents->show(); + + for (i = 1; i <= nButtons; i++) { + Gtk::Button* button = manage(createButton(buttons[i - 1])); + button->show(); + button->signal_clicked().connect(bind(mem_fun(*this, + &MessageBoxBase::buttonAction), + i)); + bbox->add(*button); + } + + while ((s = va_arg(args, const char *)) != NULL) { + Gtk::HBox* lbox = manage(new Gtk::HBox); + lbox->show(); + Gtk::Label* label = manage(new Gtk::Label(s)); + label->show(); + lbox->pack_start(*label, Gtk::PACK_SHRINK); + contents->pack_start(*lbox, Gtk::PACK_SHRINK); + } + + if (askDontShow) { + dontShowAgain_ = new Gtk::CheckButton(_("Don't show this message again")); + dontShowAgain_->set_active(FALSE); + dontShowAgain_->show(); + + Gtk::HBox* box = manage(new Gtk::HBox); + Gtk::Label* label = manage(new Gtk::Label("")); + + label->show(); + box->show(); + box->pack_end(*dontShowAgain_, Gtk::PACK_SHRINK); + contents->pack_start(*label, Gtk::PACK_SHRINK); + contents->pack_start(*box, Gtk::PACK_SHRINK); + } + + + Gtk::HBox* hcontens = manage(new Gtk::HBox); + hcontens->show(); + + hcontens->pack_start(*contents, TRUE, TRUE, 10); + get_vbox()->pack_start(*hcontens, FALSE, FALSE, 10); + get_vbox()->show(); + + + get_action_area()->pack_start(*bbox); + get_action_area()->show(); + +} + +void MessageBoxBase::buttonAction(int act) +{ + done_ = act; +} + +bool MessageBoxBase::on_delete_event(GdkEventAny*) +{ + done_ = doneDefault_; + return 1; +} + +int MessageBoxBase::run() +{ + Gtk::Main *app = Gtk::Main::instance(); + + show(); + + do { + app->iteration(); + } while (done_ == 0); + + hide(); + return done_; +} + +int MessageBoxBase::dontShowAgain() const +{ + if (dontShowAgain_ != NULL) + return dontShowAgain_->get_active() ? 1 : 0; + else + return 0; +} + + +MessageBox::MessageBox(Gtk::Window *win, const char *title, + int askDontShow, ...) : MessageBoxBase(win) +{ + va_list args; + Gtk::BuiltinStockID buttons[1]; + + buttons[0] = Gtk::Stock::OK; + + va_start(args, askDontShow); + + init("info", title, askDontShow, 1, 1, buttons, args); + + va_end(args); +} + + +MessageBox::~MessageBox() +{ +} + +Ask2Box::Ask2Box(Gtk::Window *win, const char *title, int askDontShow, + int defaultButton, ...) + : MessageBoxBase(win) + +{ + va_list args; + Gtk::BuiltinStockID buttons[2]; + + buttons[0] = Gtk::Stock::YES; + buttons[1] = Gtk::Stock::NO; + + if (defaultButton < 0 || defaultButton > 2) + defaultButton = 0; + + va_start(args, defaultButton); + + init("question", title, askDontShow, 2, defaultButton, + buttons, args); + + va_end(args); + +} + +Ask2Box::~Ask2Box() +{ +} + +Ask3Box::Ask3Box(Gtk::Window *win, const char *title, int askDontShow, + int defaultButton, ...) + : MessageBoxBase(win) +{ + va_list args; + Gtk::BuiltinStockID buttons[3]; + + buttons[0] = Gtk::Stock::YES; + buttons[1] = Gtk::Stock::NO; + buttons[2] = Gtk::Stock::CANCEL; + + if (defaultButton < 0 || defaultButton > 3) + defaultButton = 0; + + va_start(args, defaultButton); + + init("question", title, askDontShow, 3, defaultButton, buttons, args); + + va_end(args); + +} + +Ask3Box::~Ask3Box() +{ +} + +ErrorBox::ErrorBox(const char* msg) + : MessageDialog(msg, false, Gtk::MESSAGE_ERROR) +{ +} diff --git a/xdao/MessageBox.h b/xdao/MessageBox.h new file mode 100644 index 0000000..bdfd4e3 --- /dev/null +++ b/xdao/MessageBox.h @@ -0,0 +1,81 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998, 1999 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + + +#ifndef __MESSAGE_BOX_H__ +#define __MESSAGE_BOX_H__ + +#include <gtkmm.h> +#include <gtk/gtk.h> +#include <stdarg.h> + +class MessageBoxBase : public Gtk::Dialog +{ +public: + MessageBoxBase(Gtk::Window *); + virtual ~MessageBoxBase(); + + void init(const char *type, const char *titel, int askDontShow, int nButtons, + int defaultButton, Gtk::BuiltinStockID buttons[], va_list); + + int run(); + + int dontShowAgain() const; + +protected: + int done_; + int doneDefault_; + + Gtk::CheckButton *dontShowAgain_; + + Gtk::Button *createButton(const Gtk::BuiltinStockID); + bool on_delete_event(GdkEventAny*); + void buttonAction(int); +}; + +class MessageBox : public MessageBoxBase +{ +public: + MessageBox(Gtk::Window *, const char *title, int askDontShow, ...); + ~MessageBox(); +}; + +class Ask2Box : public MessageBoxBase +{ +public: + Ask2Box(Gtk::Window *, const char *title, int askDontShow, + int defaultButton, ...); + ~Ask2Box(); +}; + +class Ask3Box : public MessageBoxBase +{ +public: + Ask3Box(Gtk::Window *, const char *title, int askDontShow, + int defaultButton, ...); + ~Ask3Box(); +}; + +class ErrorBox : public Gtk::MessageDialog +{ + public: + ErrorBox(const char* msg); +}; + +#endif diff --git a/xdao/PreferencesDialog.cc b/xdao/PreferencesDialog.cc new file mode 100644 index 0000000..cd14402 --- /dev/null +++ b/xdao/PreferencesDialog.cc @@ -0,0 +1,146 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 2007 Denis Leroy + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <iostream> +#include <gnome.h> + +#include "config.h" +#include "PreferencesDialog.h" +#include "MessageBox.h" +#include "trackdb/TempFileManager.h" + +PreferencesDialog::PreferencesDialog(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>& + refGlade) + : Gtk::Dialog(cobject), + m_refGlade(refGlade) +{ + m_refGlade->get_widget("ApplyButton", _applyButton); + m_refGlade->get_widget("OkButton", _okButton); + m_refGlade->get_widget("CancelButton", _cancelButton); + m_refGlade->get_widget("TempDirectory", _tempDirEntry); + m_refGlade->get_widget("TempDirDialog", _tempDirDialog); + m_refGlade->get_widget("TempDialogButton", _browseButton); + m_refGlade->get_widget("TempBrowseCancel", _browseCancel); + m_refGlade->get_widget("TempBrowseOpen", _browseOpen); + + if (!_applyButton || !_okButton || !_cancelButton || !_tempDirEntry || + !_tempDirDialog || !_browseButton || !_browseCancel || !_browseOpen) { + std::cerr << "Unable to create all GUI widgets from glade file\n"; + exit(1); + } + + m_refClient = Gnome::Conf::Client::get_default_client(); + m_refClient->add_dir("/apps/gcdmaster"); + + _applyButton->signal_clicked() + .connect(sigc::mem_fun(*this, + &PreferencesDialog::on_button_apply)); + _cancelButton->signal_clicked() + .connect(sigc::mem_fun(*this, + &PreferencesDialog::on_button_cancel)); + _okButton->signal_clicked() + .connect(sigc::mem_fun(*this, + &PreferencesDialog::on_button_ok)); + _browseButton->signal_clicked() + .connect(sigc::mem_fun(*this, + &PreferencesDialog::on_button_browse)); + _browseCancel->signal_clicked() + .connect(sigc::mem_fun(*this, + &PreferencesDialog::on_button_browse_cancel)); + _browseOpen->signal_clicked() + .connect(sigc::mem_fun(*this, + &PreferencesDialog::on_button_browse_open)); + + _tempDirDialog->hide(); + + readFromGConf(); + Gtk::Dialog::hide(); +} + +PreferencesDialog::~PreferencesDialog() +{ +} + +void PreferencesDialog::show() +{ + readFromGConf(); + Gtk::Dialog::show(); +} + +void PreferencesDialog::readFromGConf() +{ + const Glib::ustring text = + m_refClient->get_string("/apps/gcdmaster/temp_dir"); + _tempDirEntry->set_text(text); +} + +bool PreferencesDialog::saveToGConf() +{ + const Glib::ustring text = _tempDirEntry->get_text(); + + if (!tempFileManager.setTempDirectory(text.c_str())) { + + ErrorBox errBox(_("The directory you entered cannot be used as a " + "temporary files directory.")); + errBox.run(); + readFromGConf(); + return false; + } + + try { + m_refClient->set("/apps/gcdmaster/temp_dir", text); + } catch (const Glib::Error& error) { + std::cerr << error.what() << std::endl; + } + return true; +} + +void PreferencesDialog::on_button_apply() +{ + saveToGConf(); +} + +void PreferencesDialog::on_button_cancel() +{ + readFromGConf(); + hide(); +} + +void PreferencesDialog::on_button_ok() +{ + if (saveToGConf()) + hide(); +} + +void PreferencesDialog::on_button_browse() +{ + _tempDirDialog->show(); +} + +void PreferencesDialog::on_button_browse_cancel() +{ + _tempDirDialog->hide(); +} + +void PreferencesDialog::on_button_browse_open() +{ + _tempDirEntry->set_text(_tempDirDialog->get_filename()); + _tempDirDialog->hide(); +} diff --git a/xdao/PreferencesDialog.h b/xdao/PreferencesDialog.h new file mode 100644 index 0000000..505b134 --- /dev/null +++ b/xdao/PreferencesDialog.h @@ -0,0 +1,59 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 2007 Denis Leroy + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __PREFERENCES_DIALOG_H +#define __PREFERENCES_DIALOG_H + +#include <gtkmm.h> +#include <libglademm.h> +#include <gconfmm.h> + +class PreferencesDialog : public Gtk::Dialog +{ + public: + PreferencesDialog(BaseObjectType* cobject, + const Glib::RefPtr<Gnome::Glade::Xml>&); + virtual ~PreferencesDialog(); + + void show(); + + protected: + void readFromGConf(); + bool saveToGConf(); + void on_button_apply(); + void on_button_cancel(); + void on_button_ok(); + void on_button_browse(); + void on_button_browse_cancel(); + void on_button_browse_open(); + + Glib::RefPtr<Gnome::Glade::Xml> m_refGlade; + Glib::RefPtr<Gnome::Conf::Client> m_refClient; + + Gtk::Button* _applyButton; + Gtk::Button* _cancelButton; + Gtk::Button* _okButton; + Gtk::Entry* _tempDirEntry; + Gtk::FileChooserDialog* _tempDirDialog; + Gtk::Button* _browseButton; + Gtk::Button* _browseCancel; + Gtk::Button* _browseOpen; +}; + +#endif diff --git a/xdao/ProcessMonitor.cc b/xdao/ProcessMonitor.cc new file mode 100644 index 0000000..e3ba06a --- /dev/null +++ b/xdao/ProcessMonitor.cc @@ -0,0 +1,255 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <unistd.h> +#include <stddef.h> +#include <errno.h> +#include <string.h> +#include <signal.h> +#include <sys/types.h> +#include <sys/wait.h> + +#include "ProcessMonitor.h" +#include "xcdrdao.h" + +#include "util.h" +#include "log.h" + + +Process::Process(int pid, int commFd) +{ + pid_ = pid; + commFd_ = commFd; + + exited_ = 0; + exitStatus_ = 0; + + next_ = NULL; +} + +Process::~Process() +{ + if (commFd_ >= 0) + close(commFd_); + + next_ = NULL; +} + +int Process::pid() const +{ + return pid_; +} + +int Process::commFd() const +{ + return commFd_; +} + +int Process::exited() const +{ + return exited_; +} + +int Process::exitStatus() const +{ + return exitStatus_; +} + + +ProcessMonitor::ProcessMonitor() +{ + processes_ = NULL; + statusChanged_ = 0; +} + +ProcessMonitor::~ProcessMonitor() +{ + Process *next; + + blockProcessMonitorSignals(); + + while (processes_ != NULL) { + next = processes_->next_; + delete processes_; + processes_ = next; + } + + unblockProcessMonitorSignals(); +} + +int ProcessMonitor::statusChanged() +{ + int s = statusChanged_; + + statusChanged_ = 0; + return s; +} + +/* Starts a child process 'prg' with arguments 'args'. + * If 'pipeFdArgNum' is > 0 the file descriptor number will be written to + * 'args[pipeFdArgNum]'. + * Return: newly allocated 'Process' object or NULL on error + */ + +Process *ProcessMonitor::start(const char *prg, const char **args, + int pipeFdArgNum) +{ + int pid; + Process *p; + int pipeFds[2]; + char buf[20]; + + if (pipe(pipeFds) != 0) { + log_message(-2, "Cannot create pipe: %s", strerror(errno)); + return NULL; + } + + if (pipeFdArgNum > 0) { + sprintf(buf, "%d", pipeFds[1]); + args[pipeFdArgNum] = buf; + } + + log_message(0, "Starting: "); + for (int i = 0; args[i] != NULL; i++) + log_message(0, "%s ", args[i]); + log_message(0, ""); + + + blockProcessMonitorSignals(); + + pid = fork(); + + if (pid == 0) { + // we are the new process + + // detach from controlling terminal + setsid(); + + // close reading end of pipe + close(pipeFds[0]); + + execvp(prg, (char*const*)args); + + log_message(-2, "Cannot execute '%s': %s", prg, strerror(errno)); + _exit(255); + } + else if (pid < 0) { + log_message(-2, "Cannot fork: %s", strerror(errno)); + unblockProcessMonitorSignals(); + return NULL; + } + + + // close writing end of pipe + close(pipeFds[1]); + + p = new Process(pid, pipeFds[0]); + + p->next_ = processes_; + processes_ = p; + + unblockProcessMonitorSignals(); + + return p; +} + +Process *ProcessMonitor::find(Process *p, Process **pred) +{ + Process *run; + + for (*pred = NULL, run = processes_; run != NULL; + *pred = run, run = run->next_) { + if (p == run) { + return run; + } + } + + return NULL; +} + +Process *ProcessMonitor::find(int pid) +{ + Process *run; + + for (run = processes_; run != NULL; run = run->next_) { + if (run->pid() == pid) { + return run; + } + } + + return NULL; +} + +void ProcessMonitor::stop(Process *p) +{ + kill(p->pid(), SIGTERM); +} + +void ProcessMonitor::remove(Process *p) +{ + Process *act, *pred; + + blockProcessMonitorSignals(); + + if ((act = find(p, &pred)) != NULL) { + if (pred == NULL) + processes_ = act->next_; + else + pred->next_ = act->next_; + + delete act; + } + + unblockProcessMonitorSignals(); + +} + +void ProcessMonitor::handleSigChld() +{ + int pid; + Process *p; + int status; + + while ((pid = waitpid(-1, &status, WNOHANG)) > 0) { + if ((p = find(pid)) != NULL) { + p->exited_ = 1; + + if (WIFEXITED(status)) { + p->exitStatus_ = WEXITSTATUS(status); + } + else if (WIFSIGNALED(status)) { + p->exitStatus_ = 254; + } + else { + p->exitStatus_ = 253; + } + + statusChanged_ = 1; + } + else { + log_message(-3, "Unknown child with pid %d exited.", pid); + } + } + + /* + if (pid < 0) + log_message(-2, "waitpid failed: %s", strerror(errno)); + */ +} + diff --git a/xdao/ProcessMonitor.h b/xdao/ProcessMonitor.h new file mode 100644 index 0000000..92940c1 --- /dev/null +++ b/xdao/ProcessMonitor.h @@ -0,0 +1,91 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998, 1999 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * $Log: ProcessMonitor.h,v $ + * Revision 1.4 2009/02/21 13:49:17 poolshark + * Compile warning fixes + * + * Revision 1.3 2004/02/12 01:13:31 poolshark + * Merge from gnome2 branch + * + * Revision 1.2.6.1 2004/01/05 00:34:02 poolshark + * First checking of gnome2 port + * + * Revision 1.1.1.1 2003/12/09 05:32:28 denis + * Fooya + * + * Revision 1.2 2000/10/08 16:39:41 andreasm + * Remote progress message now always contain the track relative and total + * progress and the total number of processed tracks. + * + * Revision 1.1.1.1 2000/02/05 01:38:46 llanero + * Uploaded cdrdao 1.1.3 with pre10 patch applied. + * + */ + +#ifndef __PROCESS_MONITOR_H__ +#define __PROCESS_MONITOR_H__ + +class Process { +public: + Process(int pid, int commFd); + ~Process(); + + int pid() const; + int commFd() const; + + int exited() const; + int exitStatus() const; + +private: + friend class ProcessMonitor; + + int pid_; + int commFd_; + + int exited_; + int exitStatus_; + + Process *next_; +}; + +class ProcessMonitor { +public: + ProcessMonitor(); + ~ProcessMonitor(); + + int statusChanged(); + + Process *start(const char *, const char **args, int pipeFdArgNum); + void stop(Process *); + + void remove(Process *); + + void handleSigChld(); + +private: + int statusChanged_; + Process *processes_; + + Process *find(Process *, Process **pred); + Process *find(int pid); + +}; + +#endif diff --git a/xdao/ProgressDialog.cc b/xdao/ProgressDialog.cc new file mode 100644 index 0000000..7e2f108 --- /dev/null +++ b/xdao/ProgressDialog.cc @@ -0,0 +1,675 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stdio.h> +#include <stddef.h> +#include <ctype.h> + +#include <gtkmm.h> +#include <gnome.h> + +#include "ProgressDialog.h" +#include "MessageBox.h" +#include "TocEdit.h" +#include "guiUpdate.h" +#include "CdDevice.h" + +#include "remote.h" + +ProgressDialog::ProgressDialog(ProgressDialogPool *father) +{ + Gtk::Label *label; + Gtk::HBox *hbox; + Gtk::VBox *contents = manage(new Gtk::VBox); + Gtk::Table *table; + Gtk::Alignment *align; + + poolFather_ = father; + active_ = 0; + device_ = NULL; + poolNext_ = NULL; + + contents->set_spacing(5); + + statusMsg_ = manage(new Gtk::Label()); + trackProgress_ = manage(new Gtk::ProgressBar); + totalProgress_ = manage(new Gtk::ProgressBar); + bufferFillRate_ = manage(new Gtk::ProgressBar); + writerFillRate_ = manage(new Gtk::ProgressBar); + tocName_ = manage(new Gtk::Label); + + hbox = manage(new Gtk::HBox); + label = manage(new Gtk::Label(_("Project: "))); + hbox->pack_start(*label, Gtk::PACK_SHRINK); + hbox->pack_start(*tocName_, Gtk::PACK_SHRINK); + contents->pack_start(*hbox, Gtk::PACK_SHRINK); + + hbox = manage(new Gtk::HBox); + hbox->pack_start(*statusMsg_, Gtk::PACK_SHRINK); + contents->pack_start(*hbox, Gtk::PACK_SHRINK); + + hbox = manage(new Gtk::HBox(true, true)); + label = manage(new Gtk::Label(_("Elapsed Time: "), 1)); + hbox->pack_start(*label, Gtk::PACK_SHRINK); + currentTime_ = manage(new Gtk::Label()); + hbox->pack_start(*currentTime_, Gtk::PACK_SHRINK); + label = manage(new Gtk::Label(_("Remaining Time: "), 1)); + hbox->pack_start(*label, Gtk::PACK_SHRINK); + remainingTime_ = manage(new Gtk::Label("", 0)); + hbox->pack_start(*remainingTime_, Gtk::PACK_SHRINK); + contents->pack_start(*hbox, Gtk::PACK_SHRINK); + + table = manage(new Gtk::Table(4, 2, false)); + table->set_row_spacings(5); + table->set_col_spacings(5); + contents->pack_start(*table, Gtk::PACK_SHRINK); + + trackLabel_ = manage(new Gtk::Label(_("Track:"))); + align = manage(new Gtk::Alignment(1.0, 0.5, 0.0, 0.0)); + align->add(*trackLabel_); + table->attach(*align, 0, 1, 0, 1, Gtk::FILL); + + hbox = manage(new Gtk::HBox); + hbox->pack_start(*trackProgress_); + table->attach(*hbox, 1, 2, 0, 1); + + label = manage(new Gtk::Label(_("Total:"))); + align = manage(new Gtk::Alignment(1.0, 0.5, 0.0, 0.0)); + align->add(*label); + table->attach(*align, 0, 1, 1, 2, Gtk::FILL); + + hbox = manage(new Gtk::HBox); + hbox->pack_start(*totalProgress_); + table->attach(*hbox, 1, 2, 1, 2); + + bufferFillRateLabel_ = manage(new Gtk::Label(_("Input Buffer:"))); + align = manage(new Gtk::Alignment(1.0, 0.5, 0.0, 0.0)); + align->add(*bufferFillRateLabel_); + table->attach(*align, 0, 1, 2, 3, Gtk::FILL); + + hbox = manage(new Gtk::HBox); + hbox->pack_start(*bufferFillRate_); + table->attach(*hbox, 1, 2, 2, 3); + + writerFillRateLabel_ = manage(new Gtk::Label(_("Write Buffer:"))); + table->attach(*writerFillRateLabel_, 0, 1, 3, 4, Gtk::FILL); + table->attach(*writerFillRate_, 1, 2, 3, 4); + + hbox = manage(new Gtk::HBox); + hbox->pack_start(*contents, true, true, 10); + get_vbox()->pack_start(*hbox, false, false, 10); + + Gtk::HButtonBox *bbox = manage(new Gtk::HButtonBox(Gtk::BUTTONBOX_SPREAD, + 20)); + + cancelButton_ = manage(new Gtk::Button(Gtk::StockID(Gtk::Stock::CANCEL))); + bbox->pack_start(*cancelButton_); + + closeButton_ = manage(new Gtk::Button(Gtk::StockID(Gtk::Stock::CLOSE))); + bbox->pack_start(*closeButton_); + + ejectButton_ = manage(new Gtk::Button("Eject")); + bbox->pack_start(*ejectButton_); + + actCloseButtonLabel_ = 2; + + cancelButton_->signal_clicked(). + connect(sigc::mem_fun(*this, &ProgressDialog::closeAction)); + closeButton_->signal_clicked(). + connect(sigc::mem_fun(*this, &ProgressDialog::closeAction)); + ejectButton_->signal_clicked(). + connect(sigc::mem_fun(*this, &ProgressDialog::ejectAction)); + + get_action_area()->pack_start(*bbox, TRUE, TRUE, 10); + set_size_request(400, -1); + show_all_children(); +} + +ProgressDialog::~ProgressDialog() +{ +} + +void ProgressDialog::start(CdDevice *device, const char *tocFileName) +{ + std::string s; + + if (device == NULL) + return; + + if (active_) { + raise(); + return; + } + + active_ = true; + device_ = device; + + clear(); + + Glib::signal_timeout().connect(mem_fun(*this, &ProgressDialog::time), 1000); + + statusMsg_->set_text(_("Initializing...")); + tocName_->set_text(tocFileName); + + setCloseButtonLabel(1); + cancelButton_->set_sensitive(true); + ejectButton_->set_sensitive(false); + + s = device->vendor(); + s += " "; + s += device->product(); + + set_title(s); + set_modal(true); + show(); +} + +void ProgressDialog::stop() +{ + if (active_) { + hide(); + active_ = false; + device_ = NULL; + } +} + +bool ProgressDialog::on_delete_event(GdkEventAny*) +{ + if (finished_) { + poolFather_->stop(this); + } + return true; +} + +void ProgressDialog::ejectAction() +{ + if (device_) + if (device_->ejectCd()) { + ejectButton_->set_sensitive(false); + } +} + +void ProgressDialog::closeAction() +{ + if (finished_) { + poolFather_->stop(this); + return; + } + + switch (device_->action()) { + case CdDevice::A_RECORD: + { + Ask2Box msg(this, _("Abort Recording"), 0, 2, + _("Abort recording process?"), NULL); + + if (msg.run() == 1 && device_ != NULL) { + cancelButton_->set_sensitive(false); + ejectButton_->set_sensitive(true); + device_->abortDaoRecording(); + } + } + break; + + case CdDevice::A_READ: + { + Ask2Box msg(this, _("Abort Reading"), 0, 2, _("Abort reading process?"), + NULL); + + if (msg.run() == 1 && device_ != NULL) { + cancelButton_->set_sensitive(false); + ejectButton_->set_sensitive(true); + device_->abortDaoReading(); + } + } + break; + + case CdDevice::A_DUPLICATE: + { + Ask2Box msg(this, _("Abort Process"), 0, 2, + _("Abort duplicating process?"), NULL); + + if (msg.run() == 1 && device_ != NULL) { + cancelButton_->set_sensitive(false); + ejectButton_->set_sensitive(true); + device_->abortDaoDuplication(); + } + } + break; + + case CdDevice::A_BLANK: + { + Ask2Box msg(this, _("Abort Process"), 0, 2, _("Abort blanking process?"), + NULL); + + if (msg.run() == 1 && device_ != NULL) { + cancelButton_->set_sensitive(false); + ejectButton_->set_sensitive(true); + device_->abortBlank(); + } + } + break; + default: + break; + } +} + + +void ProgressDialog::clear() +{ + finished_ = 0; + actStatus_ = 0; + actTrack_ = 0; + actTrackProgress_ = 0; + actTotalProgress_ = 0; + actBufferFill_ = 0; + actWriterFill_ = 0; + + gettimeofday(&time_, NULL); + currentTime_->set_text("0:00:00"); + remainingTime_->set_text(""); + leadTimeFilled_ = false; + statusMsg_->set_text(""); + trackProgress_->set_fraction(0.0); + totalProgress_->set_fraction(0.0); + bufferFillRate_->set_fraction(0.0); + writerFillRate_->set_fraction(0.0); + + set_title(""); +} + +void ProgressDialog::update(unsigned long level) +{ + int status; + int totalTracks; + int track; + int trackProgress; + int totalProgress; + int bufferFill; + int writerFill; + char buf[40]; + std::string s; + + if (!active_ || device_ == NULL) + return; + + if (finished_) + return; + + + if ((level & UPD_PROGRESS_STATUS) && device_->progressStatusChanged()) { + device_->progress(&status, &totalTracks, &track, &trackProgress, + &totalProgress, &bufferFill, &writerFill); + + if (status != actStatus_ || track != actTrack_) { + actStatus_ = status; + actTrack_ = track; + + switch (status) { + case PGSMSG_RCD_ANALYZING: + actTrack_ = track; + + s = _("Analyzing track "); + sprintf(buf, "%d of %d", track, totalTracks); + s += buf; + + statusMsg_->set_text(s); + break; + + case PGSMSG_RCD_EXTRACTING: + actTrack_ = track; + + s = _("Extracting "); + sprintf(buf, "%d", totalTracks); + s += buf; + s += _(" tracks..."); + + statusMsg_->set_text(s); + break; + + case PGSMSG_WCD_LEADIN: + statusMsg_->set_text(_("Writing lead-in...")); + break; + + case PGSMSG_WCD_DATA: + actTrack_ = track; + + s = _("Writing track "); + sprintf(buf, "%d of %d", track, totalTracks); + s += buf; + + statusMsg_->set_text(s); + break; + + case PGSMSG_WCD_LEADOUT: + statusMsg_->set_text(_("Writing lead-out...")); + break; + + case PGSMSG_BLK: + statusMsg_->set_text(_("Blanking...")); + break; + + } + } + + if (trackProgress != actTrackProgress_) { + actTrackProgress_ = trackProgress; + if (trackProgress <= 1000) + trackProgress_->set_fraction(trackProgress / 1000.0); + } + + if (totalProgress != actTotalProgress_) { + if (actTotalProgress_ == 0) + gettimeofday(&time_, 0); + actTotalProgress_ = totalProgress; + if (totalProgress <= 1000) + totalProgress_->set_fraction(totalProgress / 1000.0); + } + + if (bufferFill != actBufferFill_) { + actBufferFill_ = bufferFill; + if (bufferFill <= 1000) + bufferFillRate_->set_fraction(bufferFill / 100.0); + } + + if (writerFill != actWriterFill_) { + actWriterFill_ = writerFill; + if (writerFill <= 1000) + writerFillRate_->set_fraction(writerFill / 100.0); + } + } + + switch (device_->action()) { + case CdDevice::A_RECORD: + if (device_->status() != CdDevice::DEV_RECORDING) { + switch (device_->exitStatus()) { + case 0: + statusMsg_->set_text(_("Recording finished successfully.")); + break; + + case 255: + statusMsg_->set_text(_("Cannot execute cdrdao. Please check " + "your PATH.")); + break; + + default: + statusMsg_->set_text(_("Recording aborted with error.")); + break; + } + + finished_ = 1; + + setCloseButtonLabel(2); + ejectButton_->set_sensitive(true); + } + break; + + case CdDevice::A_READ: + if (device_->status() != CdDevice::DEV_READING) { + switch (device_->exitStatus()) { + case 0: + statusMsg_->set_text(_("Reading finished successfully.")); + break; + + case 255: + statusMsg_->set_text(_("Cannot execute cdrdao. Please check " + "your PATH.")); + break; + + default: + statusMsg_->set_text(_("Reading aborted.")); + break; + } + + finished_ = 1; + + setCloseButtonLabel(2); + ejectButton_->set_sensitive(true); + } + + break; + + case CdDevice::A_DUPLICATE: + if (device_->status() != CdDevice::DEV_RECORDING) { + switch (device_->exitStatus()) { + case 0: + statusMsg_->set_text(_("CD copying finished successfully.")); + break; + + case 255: + statusMsg_->set_text(_("Cannot execute cdrdao. Please check " + "your PATH.")); + break; + + default: + statusMsg_->set_text(_("CD copying aborted with error.")); + break; + } + + finished_ = 1; + + setCloseButtonLabel(2); + ejectButton_->set_sensitive(true); + } + + break; + + case CdDevice::A_BLANK: + if (device_->status() != CdDevice::DEV_BLANKING) { + switch (device_->exitStatus()) { + case 0: + statusMsg_->set_text(_("Blanking finished successfully.")); + break; + + case 255: + statusMsg_->set_text(_("Cannot execute cdrdao. Please check " + "your PATH.")); + break; + + default: + statusMsg_->set_text(_("Blanking aborted with error.")); + break; + } + + finished_ = 1; + + setCloseButtonLabel(2); + ejectButton_->set_sensitive(true); + } + + break; + + default: + statusMsg_->set_text(_("Unknow device action!")); + break; + } +} + +// Sets label of close button. +// l: 1: 'abort' --> CANCEL gnome stock button (i18n) +// 2: 'dismiss' --> CLOSE gnome stock button (i18n) +void ProgressDialog::setCloseButtonLabel(int l) +{ + if (actCloseButtonLabel_ == l) + return; + + switch (l) { + case 1: + closeButton_->hide(); + cancelButton_->show(); + break; + case 2: + cancelButton_->hide(); + closeButton_->show(); + break; + } + + actCloseButtonLabel_ = l; +} + +bool ProgressDialog::time() +{ + char buf[50]; + struct timeval timenow; + long time, time_remain, hours, mins, secs; + + gettimeofday(&timenow, NULL); + + time = timenow.tv_sec - time_.tv_sec; + + hours = time / 3600; + mins = (time - (hours * 3600)) / 60; + secs = time - ((hours * 3600) + (mins * 60)); + + sprintf(buf, "%ld:%02ld:%02ld", hours, mins, secs); + currentTime_->set_text(buf); + + if (actTotalProgress_ > 10) + { +//Hack! +// Denis: no shit + gfloat aux1, aux2, aux3; + + if (!leadTimeFilled_) + { + leadTime_ = time; + leadTimeFilled_ = true; + } + + time_remain = (int) + (((double)time / ((double)actTotalProgress_ / 1000.0)) + 0.5); + time_remain -= time; + if (time_remain < 0) time_remain = 0; + + hours = time_remain / 3600; + mins = (time_remain - (hours * 3600)) / 60; + secs = time_remain - ((hours * 3600) + (mins * 60)); + + sprintf(buf, "%ld:%02ld:%02ld", hours, mins, secs); + remainingTime_->set_text(buf); + } + + if (finished_) + return false; + else + return true; +} + +void ProgressDialog::needBufferProgress(bool visible) +{ + if (visible) { + bufferFillRate_->show(); + bufferFillRateLabel_->show(); + writerFillRate_->show(); + writerFillRateLabel_->show(); + } else { + bufferFillRate_->hide(); + bufferFillRateLabel_->hide(); + writerFillRate_->hide(); + writerFillRateLabel_->hide(); + } +} + +void ProgressDialog::needTrackProgress(bool visible) +{ + if (visible) { + trackProgress_->show(); + trackLabel_->show(); + } else { + trackProgress_->hide(); + trackLabel_->hide(); + } +} + + +ProgressDialogPool::ProgressDialogPool() +{ + activeDialogs_ = NULL; + pool_ = NULL; +} + +ProgressDialogPool::~ProgressDialogPool() +{ +} + +void ProgressDialogPool::update(unsigned long status) +{ + ProgressDialog *run; + + for (run = activeDialogs_; run != NULL; run = run->poolNext_) + run->update(status); +} + +ProgressDialog *ProgressDialogPool::start(CdDevice *device, + const char *tocFileName, + bool showBuffer, bool showTrack) +{ + ProgressDialog *dialog; + + if (pool_ == NULL) { + dialog = new ProgressDialog(this); + } + else { + dialog = pool_; + pool_ = pool_->poolNext_; + } + + dialog->poolNext_ = activeDialogs_; + activeDialogs_ = dialog; + + dialog->needBufferProgress(showBuffer); + dialog->needTrackProgress(showTrack); + + dialog->start(device, tocFileName); + + return dialog; +} + +ProgressDialog *ProgressDialogPool::start(Gtk::Window& parent, + CdDevice *device, + const char *tocFileName, + bool showBuffer, bool showTrack) +{ + ProgressDialog* dialog = start(device, tocFileName, showBuffer, showTrack); + dialog->set_transient_for(parent); + return dialog; +} + +void ProgressDialogPool::stop(ProgressDialog *dialog) +{ + ProgressDialog *run, *pred; + + for (pred = NULL, run = activeDialogs_; run != NULL; + pred = run, run = run->poolNext_) { + if (run == dialog) + break; + } + + if (run == NULL) + return; + + dialog->stop(); + + if (pred == NULL) + activeDialogs_ = activeDialogs_->poolNext_; + else + pred->poolNext_ = run->poolNext_; + + dialog->poolNext_ = pool_; + pool_ = dialog; +} diff --git a/xdao/ProgressDialog.h b/xdao/ProgressDialog.h new file mode 100644 index 0000000..fb2e055 --- /dev/null +++ b/xdao/ProgressDialog.h @@ -0,0 +1,116 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __PROGRESS_DIALOG_H__ +#define __PROGRESS_DIALOG_H__ + +#include <sys/time.h> +#include <gtkmm.h> +#include <gtk/gtk.h> + +class TocEdit; +class CdDevice; + +class ProgressDialogPool; + +class ProgressDialog : public Gtk::Dialog +{ +public: + ProgressDialog(ProgressDialogPool *father); + ~ProgressDialog(); + + bool on_delete_event(GdkEventAny*); + +private: + friend class ProgressDialogPool; + + ProgressDialogPool *poolFather_; + + bool active_; + CdDevice *device_; + + int finished_; + int actStatus_; + int actTrack_; + int actTrackProgress_; + int actTotalProgress_; + int actBufferFill_; + int actWriterFill_; + + int actCloseButtonLabel_; + + Gtk::Label *currentTime_; + Gtk::Label *remainingTime_; + + long leadTime_; + bool leadTimeFilled_; + + struct timeval time_; + bool time(); + + Gtk::Button *cancelButton_; + Gtk::Button *closeButton_; + Gtk::Button *ejectButton_; + Gtk::Label *tocName_; + + Gtk::Label *statusMsg_;; + Gtk::ProgressBar *trackProgress_; + Gtk::Label *trackLabel_; + Gtk::ProgressBar *totalProgress_; + Gtk::ProgressBar *bufferFillRate_; + Gtk::ProgressBar *writerFillRate_; + Gtk::Label *bufferFillRateLabel_; + Gtk::Label *writerFillRateLabel_; + void needBufferProgress(bool visible); + void needTrackProgress(bool visible); + + ProgressDialog *poolNext_; + + void update(unsigned long); + void start(CdDevice *, const char *tocFileName); + void stop(); + void closeAction(); + void ejectAction(); + void clear(); + void setCloseButtonLabel(int l); + +}; + +class ProgressDialogPool +{ +public: + ProgressDialogPool(); + ~ProgressDialogPool(); + + void update(unsigned long); + + ProgressDialog* start(CdDevice*, const char* tocFileName, + bool showBuffer = true, bool showTrack = true); + ProgressDialog* start(Gtk::Window& parent_window, + CdDevice*, const char* tocFileName, + bool showBuffer = true, bool showTrack = true); + void stop(ProgressDialog*); + +private: + ProgressDialog* activeDialogs_; + ProgressDialog* pool_; +}; + + +#endif diff --git a/xdao/Project.cc b/xdao/Project.cc new file mode 100644 index 0000000..68a66e8 --- /dev/null +++ b/xdao/Project.cc @@ -0,0 +1,156 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <errno.h> +#include <gtkmm.h> +#include <gnome.h> + +#include "config.h" + +#include "Project.h" +#include "util.h" +#include "xcdrdao.h" +#include "guiUpdate.h" +#include "gcdmaster.h" +#include "MessageBox.h" +#include "AudioCDView.h" +#include "TocEdit.h" +#include "TocEditView.h" +#include "RecordTocDialog.h" + +Project::Project(Gtk::Window* parent) +{ + parent_ = parent; + new_ = true; + saveFileSelector_ = 0; + recordTocDialog_ = 0; + parent_ = NULL; + progressbar_ = NULL; + progressButton_ = NULL; + tocEdit_ = NULL; + saveFileSelector_ = NULL; +} + +void Project::updateWindowTitle() +{ + std::string s(tocEdit_->filename()); + s += " - "; + s += APP_NAME; + if (tocEdit_->tocDirty()) + s += " (*)"; + + if (parent_) + parent_->set_title(s); +} + +void Project::saveProject() +{ + if (new_) { + saveAsProject(); + return; + } + + if (tocEdit_->saveToc() == 0) { + statusMessage(_("Project saved to \"%s\"."), tocEdit_->filename()); + guiUpdate(UPD_TOC_DIRTY); + + } else { + std::string s(_("Cannot save toc to \"")); + s += tocEdit_->filename(); + s+= "\":"; + + MessageBox msg(parent_, _("Save Project"), 0, s.c_str(), strerror(errno), + NULL); + msg.run(); + } +} + +void Project::saveAsProject() +{ + if (!saveFileSelector_) { + saveFileSelector_ = + new Gtk::FileChooserDialog(_("Save Project"), + Gtk::FILE_CHOOSER_ACTION_SAVE); + saveFileSelector_->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + saveFileSelector_->add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK); + saveFileSelector_->set_transient_for(*parent_); + } + + saveFileSelector_->present(); + int result = saveFileSelector_->run(); + saveFileSelector_->hide(); + + if (result == Gtk::RESPONSE_OK) { + + char *s = g_strdup(saveFileSelector_->get_filename().c_str()); + + if (s != NULL && *s != 0 && s[strlen(s) - 1] != '/') { + + if (tocEdit_->saveAsToc(stripCwd(s)) == 0) { + statusMessage(_("Project saved to \"%s\"."), tocEdit_->filename()); + new_ = false; // The project is now saved + updateWindowTitle(); + guiUpdate(UPD_TOC_DIRTY); + + } else { + + std::string m(_("Cannot save toc to \"")); + m += tocEdit_->filename(); + m += "\":"; + MessageBox msg(saveFileSelector_, _("Save Project"), 0, m.c_str(), + strerror(errno), NULL); + msg.run(); + } + } + + if (s) g_free(s); + } +} + +int Project::projectNumber() +{ + return projectNumber_; +} + +TocEdit *Project::tocEdit() +{ + return tocEdit_; +} + +void Project::statusMessage(const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + + char *s = g_strdup_vprintf(fmt, args); + + statusbar_->push(s); + + free(s); + + va_end(args); +} + +void Project::tocBlockedMsg(const char *op) +{ + MessageBox msg(parent_, op, 0, + _("Cannot perform requested operation because " + "project is in read-only state."), NULL); + msg.run(); +} diff --git a/xdao/Project.h b/xdao/Project.h new file mode 100644 index 0000000..106608a --- /dev/null +++ b/xdao/Project.h @@ -0,0 +1,62 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __PROJECT_H__ +#define __PROJECT_H__ + +#include <libgnomeuimm.h> + +class RecordTocDialog; +class TocEdit; + +class Project : public Gtk::VBox +{ +public: + Project(Gtk::Window* parent); + + void readToc(char *name); + void statusMessage(const char *fmt, ...); + void tocBlockedMsg(const char *); + virtual bool closeProject() = 0; + virtual void saveProject(); + virtual void saveAsProject(); + virtual void recordToc2CD() = 0; + int projectNumber(); + TocEdit* tocEdit(); + + Gtk::Window* getParentWindow() { return parent_; }; + + virtual void update(unsigned long level) = 0; + +protected: + int projectNumber_; + bool new_; // If it is a new project (not saved) + + Gtk::Window* parent_; + TocEdit* tocEdit_; + RecordTocDialog* recordTocDialog_; + Gnome::UI::AppBar* statusbar_; + Gtk::ProgressBar* progressbar_; + Gtk::Button* progressButton_; + Gtk::FileChooserDialog* saveFileSelector_; + + void updateWindowTitle(); + virtual void projectInfo() = 0; +}; +#endif diff --git a/xdao/ProjectChooser.cc b/xdao/ProjectChooser.cc new file mode 100644 index 0000000..e0a29e4 --- /dev/null +++ b/xdao/ProjectChooser.cc @@ -0,0 +1,97 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gtkmm.h> +#include <gnome.h> + +#include "xcdrdao.h" +#include "gcdmaster.h" +#include "guiUpdate.h" +#include "ProjectChooser.h" +#include "Icons.h" + +#define ICON_PADDING 10 +#define LABEL_PADDING 10 +#define BUTTONS_RELIEF Gtk::RELIEF_NORMAL + + +ProjectChooser::ProjectChooser() +{ + Glib::RefPtr<Gnome::Glade::Xml> refXml; + try + { + refXml = Gnome::Glade::Xml::create(CDRDAO_GLADEDIR "/ProjectChooser.glade", "mainbox"); + } + catch(const Gnome::Glade::XmlError& ex) + { + try + { + refXml = Gnome::Glade::Xml::create("glade/ProjectChooser.glade", "mainbox"); + } + catch(const Gnome::Glade::XmlError& ex) + { + std::cerr << ex.what() << std::endl; + return; + } + } + + Gtk::HBox* pBox = 0; + refXml->get_widget("mainbox", pBox); + if(!pBox) + return; + + Gtk::Image* pImage = 0; + refXml->get_widget("AudioImage", pImage); + if (pImage) + { + pImage->set(Icons::AUDIOCD, Gtk::ICON_SIZE_DIALOG); + } + refXml->get_widget("CopyImage", pImage); + if (pImage) + { + pImage->set(Icons::COPYCD, Gtk::ICON_SIZE_DIALOG); + } + refXml->get_widget("DumpImage", pImage); + if (pImage) + { + pImage->set(Icons::DUMPCD, Gtk::ICON_SIZE_DIALOG); + } + + Gtk::Button* pButton = 0; + refXml->get_widget("AudioButton", pButton); + if (pButton) + { + pButton->signal_clicked(). + connect(ProjectChooser::newAudioCDProject); + } + refXml->get_widget("CopyButton", pButton); + if (pButton) + { + pButton->signal_clicked(). + connect(ProjectChooser::newDuplicateCDProject); + } + refXml->get_widget("DumpButton", pButton); + if (pButton) + { + pButton->signal_clicked(). + connect(ProjectChooser::newDumpCDProject); + } + + pack_start(*pBox); +} diff --git a/xdao/ProjectChooser.h b/xdao/ProjectChooser.h new file mode 100644 index 0000000..0cf2b97 --- /dev/null +++ b/xdao/ProjectChooser.h @@ -0,0 +1,35 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __PROJECT_CHOOSER_H__ +#define __PROJECT_CHOOSER_H__ + +#include <libglademm/xml.h> +#include <gtkmm.h> + +class ProjectChooser : public Gtk::VBox +{ + public: + ProjectChooser(); + + sigc::signal0<void> newAudioCDProject; + sigc::signal0<void> newDuplicateCDProject; + sigc::signal0<void> newDumpCDProject; +}; +#endif diff --git a/xdao/RecordCDSource.cc b/xdao/RecordCDSource.cc new file mode 100644 index 0000000..a63d692 --- /dev/null +++ b/xdao/RecordCDSource.cc @@ -0,0 +1,311 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stdio.h> +#include <limits.h> +#include <math.h> +#include <assert.h> +#include <unistd.h> + +#include <gtkmm.h> +#include <gnome.h> + +#include "RecordCDSource.h" +#include "xcdrdao.h" +#include "Settings.h" + +#include "CdDevice.h" +#include "guiUpdate.h" + +#include "util.h" + +#include "DeviceList.h" + +#define MAX_CORRECTION_ID 3 + +static RecordCDSource::CorrectionTable CORRECTION_TABLE[MAX_CORRECTION_ID + 1] = { + { 3, N_("Jitter + scratch (slow)") }, + { 2, N_("Jitter + checks") }, + { 1, N_("Jitter correction") }, + { 0, N_("No checking (fast)") } +}; + +#define MAX_SUBCHAN_READ_MODE_ID 2 + +static RecordCDSource::SubChanReadModeTable SUBCHAN_READ_MODE_TABLE[MAX_SUBCHAN_READ_MODE_ID + 1] = { + { 0, N_("none") }, + { 1, N_("R-W packed") }, + { 2, N_("R-W raw") } +}; + + +RecordCDSource::RecordCDSource(Gtk::Window *parent) +{ + parent_ = parent; + active_ = 0; +// onTheFly_ = 0; + correction_ = 0; + speed_ = 1; + subChanReadMode_ = 0; + moreOptionsDialog_ = 0; + + set_spacing(10); + + DEVICES = new DeviceList(CdDevice::CD_ROM); + pack_start(*DEVICES); + + // device settings + Gtk::Frame *extractOptionsFrame = new Gtk::Frame(_(" Read Options ")); + Gtk::VBox *vbox = new Gtk::VBox; + vbox->set_border_width(5); + vbox->set_spacing(5); + vbox->show(); + extractOptionsFrame->add(*vbox); + + onTheFlyButton_ = new Gtk::CheckButton(_("Copy to disk before burning"), 0); + onTheFlyButton_->set_active(true); + onTheFlyButton_->show(); + vbox->pack_start(*onTheFlyButton_); + + Gtk::HBox *hbox = new Gtk::HBox; +// hbox->show(); + Gtk::Label *label = new Gtk::Label(_("Speed: "), 0); + label->show(); + hbox->pack_start(*label, false, false); + + Gtk::Adjustment *adjustment = new Gtk::Adjustment(1, 1, 50); + speedSpinButton_ = new Gtk::SpinButton(*adjustment); + speedSpinButton_->set_digits(0); + speedSpinButton_->show(); + speedSpinButton_->set_sensitive(false); + adjustment->signal_value_changed().connect(sigc::mem_fun(*this, &RecordCDSource::speedChanged)); + hbox->pack_start(*speedSpinButton_, false, false, 10); + + speedButton_ = new Gtk::CheckButton(_("Use max."), 0); + speedButton_->set_active(true); + speedButton_->show(); + speedButton_->signal_toggled().connect(sigc::mem_fun(*this, &RecordCDSource::speedButtonChanged)); + hbox->pack_start(*speedButton_, true, true); + vbox->pack_start(*hbox); + + Gtk::Image* moreOptionsPixmap = + manage(new Gtk::Image(Gtk::StockID(Gtk::Stock::PROPERTIES), + Gtk::ICON_SIZE_SMALL_TOOLBAR)); + Gtk::Label *moreOptionsLabel = manage(new Gtk::Label(_("More Options"))); + Gtk::HBox *moreOptionsBox = manage(new Gtk::HBox); + moreOptionsBox->set_border_width(2); + Gtk::Button *moreOptionsButton = manage(new Gtk::Button()); + moreOptionsBox->pack_start(*moreOptionsPixmap, false, false, 3); + moreOptionsBox->pack_start(*moreOptionsLabel, false, false, 4); + moreOptionsButton->add(*moreOptionsBox); + moreOptionsButton->signal_clicked().connect(mem_fun(*this, &RecordCDSource::moreOptions)); + moreOptionsPixmap->show(); + moreOptionsLabel->show(); + moreOptionsBox->show(); + moreOptionsButton->show(); + moreOptionsBox = manage(new Gtk::HBox); + moreOptionsBox->show(); + vbox->pack_start(*moreOptionsBox); + moreOptionsBox->pack_end(*moreOptionsButton, false, false); + + pack_start(*extractOptionsFrame, Gtk::PACK_SHRINK); + extractOptionsFrame->show(); +} + +RecordCDSource::~RecordCDSource() +{ + if (moreOptionsDialog_) + delete moreOptionsDialog_; +} + +void RecordCDSource::start() +{ + if (active_) { + get_parent_window()->raise(); + return; + } + + active_ = 1; + + update(UPD_CD_DEVICES); + + show(); +} + +void RecordCDSource::stop() +{ + if (active_) { + hide(); + active_ = 0; + } +} + +void RecordCDSource::update(unsigned long level) +{ + if (!active_) + return; + + if (level & UPD_CD_DEVICES) + DEVICES->import(); + else if (level & UPD_CD_DEVICE_STATUS) + DEVICES->importStatus(); +} + +void RecordCDSource::moreOptions() +{ + if (!moreOptionsDialog_) + { + Gtk::Table *table; + Gtk::Label *label; + + table = new Gtk::Table(2, 4, false); + table->set_row_spacings(2); + table->set_col_spacings(10); + table->set_border_width(5); + + moreOptionsDialog_ = new Gtk::MessageDialog(*parent_, _("Source options"),false, + Gtk::MESSAGE_QUESTION, + Gtk::BUTTONS_CLOSE, true); + + Gtk::VBox *vbox = moreOptionsDialog_->get_vbox(); + Gtk::Frame *frame = new Gtk::Frame(_(" More Source Options ")); + vbox->pack_start(*frame); + vbox = new Gtk::VBox; + vbox->set_border_width(10); + vbox->set_spacing(5); + frame->add(*vbox); + + vbox->pack_start(*table); + + continueOnErrorButton_ = + new Gtk::CheckButton(_("Continue if errors found"), 0); + continueOnErrorButton_->set_active(false); + table->attach(*continueOnErrorButton_, 0, 1, 0, 1); + + ignoreIncorrectTOCButton_ = new Gtk::CheckButton(_("Ignore incorrect TOC"), + 0); + ignoreIncorrectTOCButton_->set_active(false); + table->attach(*ignoreIncorrectTOCButton_, 0, 1, 1, 2); + + Gtk::Menu *menu = manage(new Gtk::Menu); + Gtk::MenuItem *mitem; + + for (int i = 0; i <= MAX_CORRECTION_ID; i++) { + mitem = manage(new Gtk::MenuItem(CORRECTION_TABLE[i].name)); + mitem->signal_activate().connect(bind(mem_fun(*this, &RecordCDSource::setCorrection), i)); + menu->append(*mitem); + } + + correctionMenu_ = new Gtk::OptionMenu; + correctionMenu_->set_menu(*menu); + + correctionMenu_->set_history(correction_); + + Gtk::Alignment *align; + + label = new Gtk::Label(_("Audio Correction Method:")); + align = new Gtk::Alignment(0, 0.5, 0, 1); + align->add(*label); + table->attach(*align, 0, 1, 2, 3, Gtk::FILL); + table->attach(*correctionMenu_, 1, 2, 2, 3); + + menu = manage(new Gtk::Menu); + + for (int i = 0; i <= MAX_SUBCHAN_READ_MODE_ID; i++) { + mitem = manage(new Gtk::MenuItem(SUBCHAN_READ_MODE_TABLE[i].name)); + mitem->signal_activate(). + connect(bind(mem_fun(*this, &RecordCDSource::setSubChanReadMode), i)); + menu->append(*mitem); + } + + subChanReadModeMenu_ = new Gtk::OptionMenu; + subChanReadModeMenu_->set_menu(*menu); + subChanReadModeMenu_->set_history(subChanReadMode_); + + label = new Gtk::Label(_("Sub-Channel Reading Mode:")); + align = new Gtk::Alignment(0, 0.5, 0, 1); + align->add(*label); + table->attach(*align, 0, 1, 3, 4, Gtk::FILL); + table->attach(*subChanReadModeMenu_, 1, 2, 3, 4); + } + + moreOptionsDialog_->show_all(); + moreOptionsDialog_->run(); + moreOptionsDialog_->hide(); +} + +void RecordCDSource::setCorrection(int s) +{ + if (s >= 0 && s <= MAX_CORRECTION_ID) + correction_ = s; +} + +bool RecordCDSource::getOnTheFly() +{ + return onTheFlyButton_->get_active() ? 0 : 1; +} + + +void RecordCDSource::setOnTheFly(bool active) +{ + onTheFlyButton_->set_active(!active); +} + +int RecordCDSource::getCorrection() +{ + return CORRECTION_TABLE[correction_].correction; +} + +void RecordCDSource::setSubChanReadMode(int m) +{ + if (m >= 0 && m <= MAX_SUBCHAN_READ_MODE_ID) + subChanReadMode_ = m; +} + +int RecordCDSource::getSubChanReadMode() +{ + return SUBCHAN_READ_MODE_TABLE[subChanReadMode_].mode; +} + +void RecordCDSource::speedButtonChanged() +{ + if (speedButton_->get_active()) + { + speedSpinButton_->set_sensitive(false); + } + else + { + speedSpinButton_->set_sensitive(true); + } +} + +void RecordCDSource::speedChanged() +{ + //Do some validating here. speed_ <= MAX read speed of CD. + speed_ = speedSpinButton_->get_value_as_int(); +} + +void RecordCDSource::onTheFlyOption(bool visible) +{ + if (visible) + onTheFlyButton_->show(); + else + onTheFlyButton_->hide(); +} + diff --git a/xdao/RecordCDSource.h b/xdao/RecordCDSource.h new file mode 100644 index 0000000..d9598c6 --- /dev/null +++ b/xdao/RecordCDSource.h @@ -0,0 +1,86 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998, 1999 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __RECORD_CD_SOURCE_H +#define __RECORD_CD_SOURCE_H + +#include <libgnomeuimm.h> + +class CdDevice; +class DeviceList; + +class RecordCDSource : public Gtk::VBox { +public: + RecordCDSource(Gtk::Window *); + ~RecordCDSource(); + + void start(); + void stop(); + + void update(unsigned long level); + + bool getOnTheFly(); + void setOnTheFly(bool); + int getCorrection(); + int getSubChanReadMode(); + DeviceList *getDeviceList() { return DEVICES;} + void onTheFlyOption(bool); + + struct CorrectionTable { + int correction; + const char *name; + }; + + struct SubChanReadModeTable { + int mode; + const char *name; + }; + +private: + DeviceList *DEVICES; + + int active_; + int correction_; + int speed_; + int subChanReadMode_; + +// bool onTheFly_; + + Gtk::Window *parent_; + Gtk::MessageDialog *moreOptionsDialog_; + + Gtk::SpinButton *speedSpinButton_; + Gtk::CheckButton *speedButton_; + + Gtk::OptionMenu *correctionMenu_; + Gtk::OptionMenu *subChanReadModeMenu_; + Gtk::CheckButton *onTheFlyButton_; + Gtk::CheckButton *continueOnErrorButton_; + Gtk::CheckButton *ignoreIncorrectTOCButton_; + + void moreOptions(); + + void setSpeed(int); + void setCorrection(int); + void setSubChanReadMode(int); + void speedButtonChanged(); + void speedChanged(); +}; + +#endif diff --git a/xdao/RecordCDTarget.cc b/xdao/RecordCDTarget.cc new file mode 100644 index 0000000..908fd3b --- /dev/null +++ b/xdao/RecordCDTarget.cc @@ -0,0 +1,380 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stdio.h> +#include <limits.h> +#include <math.h> +#include <assert.h> + +#include <gtkmm.h> +#include <gnome.h> +#include <libgnomemm.h> +#include <libgnomeuimm.h> + +#include "RecordCDTarget.h" +#include "MessageBox.h" +#include "xcdrdao.h" +#include "Settings.h" + +#include "CdDevice.h" +#include "guiUpdate.h" +#include "TocEdit.h" +#include "DeviceList.h" + +#include "util.h" + +RecordCDTarget::RecordCDTarget(Gtk::Window *parent) +{ + active_ = 0; + speed_ = 1; + parent_ = parent; + moreOptionsDialog_ = 0; + set_spacing(10); + + DEVICES = new DeviceList(CdDevice::CD_R); + + pack_start(*DEVICES); + + // device settings + Gtk::Frame *recordOptionsFrame = new Gtk::Frame(" Record Options "); + + Gtk::VBox *vbox = new Gtk::VBox; + recordOptionsFrame->add(*vbox); + vbox->set_border_width(5); + vbox->set_spacing(5); + vbox->show(); + + Gtk::HBox *hbox = new Gtk::HBox; + hbox->show(); + Gtk::Label *label = new Gtk::Label("Speed: ", 0); + label->show(); + hbox->pack_start(*label, false, false); + + Gtk::Adjustment *adjustment = new Gtk::Adjustment(1, 1, 48); + speedSpinButton_ = new Gtk::SpinButton(*adjustment); + speedSpinButton_->set_digits(0); + speedSpinButton_->show(); + speedSpinButton_->set_sensitive(false); + adjustment->signal_value_changed().connect(sigc::mem_fun(*this, &RecordCDTarget::speedChanged)); + hbox->pack_start(*speedSpinButton_, false, false, 10); + + speedButton_ = new Gtk::CheckButton("Use max.", 0); + speedButton_->set_active(true); + speedButton_->show(); + speedButton_->signal_toggled().connect(sigc::mem_fun(*this, &RecordCDTarget::speedButtonChanged)); + hbox->pack_start(*speedButton_, true, true); + vbox->pack_start(*hbox); + + hbox = new Gtk::HBox; +// hbox->show(); + label = new Gtk::Label("Copies: ", 0); + label->show(); + hbox->pack_start(*label, false, false); + + adjustment = new Gtk::Adjustment(1, 1, 999); + copiesSpinButton_ = new Gtk::SpinButton(*adjustment); + copiesSpinButton_->set_digits(0); + copiesSpinButton_->show(); + hbox->pack_start(*copiesSpinButton_, false, false, 10); + vbox->pack_start(*hbox); + + Gtk::Image* moreOptionsPixmap = + manage(new Gtk::Image(Gtk::StockID(Gtk::Stock::PROPERTIES), + Gtk::ICON_SIZE_SMALL_TOOLBAR)); + Gtk::Label *moreOptionsLabel = manage(new Gtk::Label("More Options")); + Gtk::HBox *moreOptionsBox = manage(new Gtk::HBox); + moreOptionsBox->set_border_width(2); + Gtk::Button *moreOptionsButton = manage(new Gtk::Button()); + moreOptionsBox->pack_start(*moreOptionsPixmap, false, false, 3); + moreOptionsBox->pack_start(*moreOptionsLabel, false, false, 4); + moreOptionsButton->add(*moreOptionsBox); + moreOptionsButton->signal_clicked().connect(mem_fun(*this, &RecordCDTarget::moreOptions)); + moreOptionsPixmap->show(); + moreOptionsLabel->show(); + moreOptionsBox->show(); + moreOptionsButton->show(); + moreOptionsBox = manage(new Gtk::HBox); + moreOptionsBox->show(); + vbox->pack_start(*moreOptionsBox, false, false); + moreOptionsBox->pack_end(*moreOptionsButton, false, false); + + pack_start(*recordOptionsFrame, Gtk::PACK_SHRINK); + recordOptionsFrame->show(); +} + +RecordCDTarget::~RecordCDTarget() +{ + if (moreOptionsDialog_) + delete moreOptionsDialog_; +} + +void RecordCDTarget::start() +{ + active_ = 1; + + update(UPD_ALL); + + show(); +} + +void RecordCDTarget::stop() +{ + if (active_) { + hide(); + active_ = 0; + } +} + +void RecordCDTarget::moreOptions() +{ + if (!moreOptionsDialog_) + { + moreOptionsDialog_ = new Gtk::MessageDialog(*parent_, "Target options",false, + Gtk::MESSAGE_QUESTION, + Gtk::BUTTONS_CLOSE, true); + + Gtk::VBox *vbox = moreOptionsDialog_->get_vbox(); + Gtk::Frame *frame = new Gtk::Frame(" More Target Options "); + vbox->pack_start(*frame); + vbox = new Gtk::VBox; + vbox->set_border_width(10); + vbox->set_spacing(5); + frame->add(*vbox); + + overburnButton_ = new Gtk::CheckButton("Allow over-burning", 0); + overburnButton_->set_active(false); + vbox->pack_start(*overburnButton_); + + ejectButton_ = new Gtk::CheckButton("Eject the CD after writing", 0); + ejectButton_->set_active(false); + vbox->pack_start(*ejectButton_); + + reloadButton_ = + new Gtk::CheckButton("Reload the CD after writing, if necessary", 0); + reloadButton_->set_active(false); + vbox->pack_start(*reloadButton_); + + closeSessionButton_ = + new Gtk::CheckButton("Close disk - no further writing possible!", 0); + closeSessionButton_->set_active(true); + vbox->pack_start(*closeSessionButton_); + + Gtk::HBox *hbox = new Gtk::HBox; + Gtk::Label *label = new Gtk::Label("Buffer: ", 0); + hbox->pack_start(*label, false, false); + + Gtk::Adjustment *adjustment = new Gtk::Adjustment(10, 10, 1000); + bufferSpinButton_ = new Gtk::SpinButton(*adjustment); + hbox->pack_start(*bufferSpinButton_, false, false, 10); + + label = new Gtk::Label("audio seconds "); + hbox->pack_start(*label, false, false); + bufferRAMLabel_ = new Gtk::Label("= 1.72 Mb buffer.", 0); + hbox->pack_start(*bufferRAMLabel_, true, true); + adjustment->signal_value_changed(). + connect(sigc::mem_fun(*this, &RecordCDTarget::updateBufferRAMLabel)); + + vbox->pack_start(*hbox); + } + + moreOptionsDialog_->show_all(); + moreOptionsDialog_->run(); + moreOptionsDialog_->hide(); +} + +void RecordCDTarget::update(unsigned long level) +{ + if (!active_) + return; + + if (level & UPD_CD_DEVICES) + DEVICES->import(); + else if (level & UPD_CD_DEVICE_STATUS) + DEVICES->importStatus(); +} + +void RecordCDTarget::cancelAction() +{ + stop(); +} + +int RecordCDTarget::getMultisession() +{ + if (moreOptionsDialog_) + return closeSessionButton_->get_active() ? 0 : 1; + else + return 0; +} + +int RecordCDTarget::getCopies() +{ + return copiesSpinButton_->get_value_as_int(); +} + +int RecordCDTarget::getSpeed() +{ + if (speedButton_->get_active()) + return 0; + else + return speed_; +} + +int RecordCDTarget::getBuffer() +{ + if (moreOptionsDialog_) + return bufferSpinButton_->get_value_as_int(); + else + return 10; +} + +bool RecordCDTarget::getEject() +{ + if (moreOptionsDialog_) + return ejectButton_->get_active() ? 1 : 0; + else + return 0; +} + +bool RecordCDTarget::getOverburn() +{ + if (moreOptionsDialog_) + return overburnButton_->get_active() ? 1 : 0; + else + return 0; +} + +int RecordCDTarget::checkEjectWarning(Gtk::Window *parent) +{ + // If ejecting the CD after recording is requested issue a warning message + // because buffer under runs may occur for other devices that are recording. + if (getEject()) + { + if (gnome_config_get_bool(SET_RECORD_EJECT_WARNING)) { + Ask3Box msg(parent, "Request", 1, 2, + "Ejecting a CD may block the SCSI bus and", + "cause buffer under runs when other devices", + "are still recording.", "", + "Keep the eject setting anyway?", NULL); + + switch (msg.run()) { + case 1: // keep eject setting + if (msg.dontShowAgain()) + { + gnome_config_set_bool(SET_RECORD_EJECT_WARNING, FALSE); + gnome_config_sync(); + } + return 1; + break; + case 2: // don't keep eject setting + ejectButton_->set_active(false); + return 0; + break; + default: // cancel + return -1; + break; + } + } + return 1; + } + return 0; +} + +bool RecordCDTarget::getReload() +{ + if (moreOptionsDialog_) + return reloadButton_->get_active() ? 1 : 0; + else + return 0; +} + +int RecordCDTarget::checkReloadWarning(Gtk::Window *parent) +{ + // The same is true for reloading the disk. + if (getReload()) + { + if (gnome_config_get_bool(SET_RECORD_RELOAD_WARNING)) { + Ask3Box msg(parent, "Request", 1, 2, + "Reloading a CD may block the SCSI bus and", + "cause buffer under runs when other devices", + "are still recording.", "", + "Keep the reload setting anyway?", NULL); + + switch (msg.run()) { + case 1: // keep reload setting + if (msg.dontShowAgain()) + { + gnome_config_set_bool(SET_RECORD_RELOAD_WARNING, FALSE); + gnome_config_sync(); + } + return 1; + break; + case 2: // don't keep reload setting + reloadButton_->set_active(false); + return 0; + break; + default: // cancel + return -1; + break; + } + } + return 1; + } + return 0; +} + +void RecordCDTarget::updateBufferRAMLabel() +{ + char label[20]; + + sprintf(label, "= %0.2f Mb buffer.", bufferSpinButton_->get_value() * 0.171875); + bufferRAMLabel_->set_text(label); +} + +void RecordCDTarget::speedButtonChanged() +{ + if (speedButton_->get_active()) + { + speedSpinButton_->set_sensitive(false); + } + else + { + speedSpinButton_->set_sensitive(true); + } +} + +void RecordCDTarget::speedChanged() +{ + // TODO: get max burn speed from selected burner(s) + int new_speed; + + new_speed = speedSpinButton_->get_value_as_int(); + + if ((new_speed % 2) == 1) { + if (new_speed > 2) { + if (new_speed > speed_) + new_speed = new_speed + 1; + else + new_speed = new_speed - 1; + } + speedSpinButton_->set_value(new_speed); + } + + speed_ = new_speed; +} + diff --git a/xdao/RecordCDTarget.h b/xdao/RecordCDTarget.h new file mode 100644 index 0000000..91f1a65 --- /dev/null +++ b/xdao/RecordCDTarget.h @@ -0,0 +1,81 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998, 1999 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __RECORD_CD_TARGET_H +#define __RECORD_CD_TARGET_H + +#include <gtkmm.h> +#include <gtk/gtk.h> + +class TocEdit; +class CdDevice; +class DeviceList; + +class RecordCDTarget : public Gtk::VBox { +public: + RecordCDTarget(Gtk::Window *); + ~RecordCDTarget(); + + void start(); + void stop(); + + void update(unsigned long level); + + DeviceList *getDeviceList() { return DEVICES;} + int getMultisession(); + int getCopies(); + int getSpeed(); + bool getEject(); + bool getOverburn(); + int checkEjectWarning(Gtk::Window *); + bool getReload(); + int checkReloadWarning(Gtk::Window *); + int getBuffer(); + + void cancelAction(); +private: + int active_; + + DeviceList *DEVICES; + + int speed_; + + Gtk::Window *parent_; + Gtk::MessageDialog *moreOptionsDialog_; + + Gtk::CheckButton *closeSessionButton_; + Gtk::CheckButton *ejectButton_; + Gtk::CheckButton *reloadButton_; + Gtk::CheckButton *overburnButton_; + + Gtk::SpinButton *copiesSpinButton_; + Gtk::SpinButton *speedSpinButton_; + Gtk::CheckButton *speedButton_; + + Gtk::SpinButton *bufferSpinButton_; + Gtk::Label *bufferRAMLabel_; + + void updateBufferRAMLabel(); + + void moreOptions(); + + void speedButtonChanged(); + void speedChanged(); +}; +#endif diff --git a/xdao/RecordHDTarget.cc b/xdao/RecordHDTarget.cc new file mode 100644 index 0000000..376774f --- /dev/null +++ b/xdao/RecordHDTarget.cc @@ -0,0 +1,112 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998, 1999 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stdio.h> +#include <limits.h> +#include <math.h> +#include <assert.h> + +#include <gtkmm.h> +#include <gnome.h> + +#include "RecordHDTarget.h" +#include "MessageBox.h" +#include "xcdrdao.h" +#include "Settings.h" + +#include "CdDevice.h" +#include "guiUpdate.h" +#include "TocEdit.h" + +RecordHDTarget::RecordHDTarget() +{ + Gtk::Table *table; + Gtk::Label *label; + + active_ = false; + + set_spacing(10); + + // device settings + Gtk::Frame *recordOptionsFrame = + manage(new Gtk::Frame(_(" Record Options "))); + + table = manage(new Gtk::Table(2, 2, false)); + table->set_row_spacings(2); + table->set_col_spacings(10); + table->set_border_width(5); + + recordOptionsFrame->add(*table); + recordOptionsFrame->show_all(); + pack_start(*recordOptionsFrame, Gtk::PACK_SHRINK); + + label = manage(new Gtk::Label(_("Directory: "))); + table->attach(*label, 0, 1, 0, 1, Gtk::FILL); + + dirEntry_ = + manage(new Gnome::UI::FileEntry(_("record_hd_target_dir_entry"), + _("Select Directory for Image"))); + dirEntry_->set_directory_entry(true); + dirEntry_->set_property("use_filechooser", true); + + table->attach(*dirEntry_, 1, 2, 0, 1); + + label = manage(new Gtk::Label(_("Name: "))); + table->attach(*label, 0, 1, 1, 2, Gtk::FILL); + + fileNameEntry_ = manage(new Gtk::Entry); + table->attach(*fileNameEntry_, 1, 2, 1, 2); +} +void RecordHDTarget::start() +{ + active_ = true; + update(UPD_ALL); + show(); +} + +void RecordHDTarget::stop() +{ + if (active_) { + hide(); + active_ = false; + } +} + +void RecordHDTarget::update(unsigned long level) +{ + if (!active_) + return; +} + +void RecordHDTarget::cancelAction() +{ + stop(); +} + +std::string RecordHDTarget::getFilename() +{ + return fileNameEntry_->get_text(); +} + +std::string RecordHDTarget::getPath() +{ + Gtk::Entry *entry = static_cast<Gtk::Entry *>(dirEntry_->gtk_entry()); + return entry->get_text(); +} + diff --git a/xdao/RecordHDTarget.h b/xdao/RecordHDTarget.h new file mode 100644 index 0000000..6a2f7c9 --- /dev/null +++ b/xdao/RecordHDTarget.h @@ -0,0 +1,55 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998, 1999 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __RECORD_HD_TARGET_H +#define __RECORD_HD_TARGET_H + +#include <libgnomeuimm.h> + +class TocEdit; +class CdDevice; +class DeviceList; + +class RecordHDTarget : public Gtk::VBox +{ +public: + RecordHDTarget(); + + Gtk::Window *parent; // the dialog where the vbox is placed + + void start(); + void stop(); + + void update(unsigned long level); + void cancelAction(); + + std::string getFilename(); + std::string getPath(); + +private: + bool active_; + + int speed_; + + Gnome::UI::FileEntry *dirEntry_; + Gtk::Entry *fileNameEntry_; + +}; + +#endif diff --git a/xdao/RecordTocDialog.cc b/xdao/RecordTocDialog.cc new file mode 100644 index 0000000..485cd0b --- /dev/null +++ b/xdao/RecordTocDialog.cc @@ -0,0 +1,245 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gtkmm.h> +#include <gnome.h> + +#include "RecordTocDialog.h" +#include "RecordTocSource.h" +#include "RecordCDSource.h" +#include "RecordCDTarget.h" +#include "RecordHDTarget.h" +#include "guiUpdate.h" +#include "DeviceList.h" +#include "MessageBox.h" +#include "TocEdit.h" +#include "Icons.h" + +RecordTocDialog::RecordTocDialog(TocEdit *tocEdit) +{ + tocEdit_ = tocEdit; + + set_title(_("Record CD")); + + Gtk::VBox *vbox = manage(new Gtk::VBox); + vbox->set_border_width(10); + vbox->set_spacing(10); + Gtk::HBox *hbox = manage(new Gtk::HBox); + hbox->set_spacing(10); + vbox->pack_start(*hbox); + add(*vbox); + + active_ = 0; + + TocSource = new RecordTocSource(tocEdit_); + TocSource->start(); + CDTarget = new RecordCDTarget(this); + CDTarget->start(); + + hbox->pack_start(*TocSource, Gtk::PACK_SHRINK); + hbox->pack_start(*CDTarget); + + hbox = new Gtk::HBox; + hbox->set_spacing(10); + + Gtk::VBox *frameBox = new Gtk::VBox; + simulate_rb = new Gtk::RadioButton(_("Simulate"), 0); + simulateBurn_rb = new Gtk::RadioButton(_("Simulate and Burn"), 0); + burn_rb = new Gtk::RadioButton(_("Burn"), 0); + + frameBox->pack_start(*simulate_rb); + frameBox->pack_start(*simulateBurn_rb); + Gtk::RadioButton::Group rbgroup = simulate_rb->get_group(); + simulateBurn_rb->set_group(rbgroup); + frameBox->pack_start(*burn_rb); + burn_rb->set_group(rbgroup); + + hbox->pack_start(*frameBox, true, false); + + Gtk::Image *pixmap = manage(new Gtk::Image(Icons::GCDMASTER, + Gtk::ICON_SIZE_DIALOG)); + Gtk::Label *startLabel = manage(new Gtk::Label(_("Start"))); + Gtk::VBox *startBox = manage(new Gtk::VBox); + Gtk::Button *button = manage(new Gtk::Button()); + startBox->pack_start(*pixmap, false, false); + startBox->pack_start(*startLabel, false, false); + + button->add(*startBox); + button->signal_clicked().connect(mem_fun(*this, &RecordTocDialog::startAction)); + hbox->pack_start(*button); + + Gtk::Button* cancel_but = + manage(new Gtk::Button(Gtk::StockID(Gtk::Stock::CANCEL))); + cancel_but->signal_clicked().connect(mem_fun(*this, &Gtk::Widget::hide)); + hbox->pack_start(*cancel_but); + + vbox->pack_start(*hbox, Gtk::PACK_SHRINK); + show_all_children(); +} + +RecordTocDialog::~RecordTocDialog() +{ + delete TocSource; + delete CDTarget; +} + +void RecordTocDialog::start(Gtk::Window *parent) +{ + if (!active_) { + active_ = true; + TocSource->start(); + CDTarget->start(); + update(UPD_ALL); + set_transient_for(*parent); + } + present(); +} + +void RecordTocDialog::stop() +{ + hide(); + active_ = false; + + TocSource->stop(); + CDTarget->stop(); +} + +void RecordTocDialog::update(unsigned long level) +{ + if (!active_) + return; + + std::string title; + title += _("Record project "); + title += tocEdit_->filename(); + title += _(" to CD"); + set_title(title); + + TocSource->update(level); + CDTarget->update(level); + + if (level & UPD_CD_DEVICE_STATUS) + CDTarget->getDeviceList()->selectOne(); +} + +bool RecordTocDialog::on_delete_event(GdkEventAny*) +{ + stop(); + return 1; +} + +void RecordTocDialog::startAction() +{ + if (tocEdit_ == NULL) + return; + + DeviceList *targetList = CDTarget->getDeviceList(); + + if (targetList->selection().empty()) { + Gtk::MessageDialog md(*this, + _("Please select at least one recorder device"), + Gtk::MESSAGE_INFO); + md.run(); + return; + } + + Toc *toc = tocEdit_->toc(); + + if (toc->nofTracks() == 0 || toc->length().lba() < 300) { + Gtk::MessageDialog md(*this, _("Current toc contains no tracks or length " + "of at least one track is < 4 seconds"), + Gtk::MESSAGE_ERROR); + md.run(); + return; + } + + switch (toc->checkCdTextData()) { + case 0: // OK + break; + case 1: // warning + { + Ask2Box msg(this, _("CD-TEXT Inconsistency"), 0, 2, + _("Inconsistencies were detected in the defined CD-TEXT " + "data"), + _("which may produce undefined results. See the console"), + _("output for more details."), + "", + _("Do you want to proceed anyway?"), NULL); + + if (msg.run() != 1) + return; + } + break; + default: // error + { + MessageBox msg(this, _("CD-TEXT Error"), 0, + _("The defined CD-TEXT data is erroneous or " + "incomplete."), + _("See the console output for more details."), NULL); + msg.run(); + return; + } + break; + } + + int simulate; + if (simulate_rb->get_active()) + simulate = 1; + else if (simulateBurn_rb->get_active()) + simulate = 2; + else + simulate = 0; + + int multiSession = CDTarget->getMultisession(); + int burnSpeed = CDTarget->getSpeed(); + int overburn = CDTarget->getOverburn(); + + int eject = CDTarget->checkEjectWarning(this); + if (eject == -1) + return; + int reload = CDTarget->checkReloadWarning(this); + if (reload == -1) + return; + + int buffer = CDTarget->getBuffer(); + + DeviceList* target = CDTarget->getDeviceList(); + if (target->selection().empty()) { + Gtk::MessageDialog d(*this, _("Please select a writer device"), + Gtk::MESSAGE_INFO); + d.run(); + return; + } + + std::string targetData = target->selection(); + CdDevice *writeDevice = CdDevice::find(targetData.c_str()); + + if (writeDevice) { + if (!writeDevice->recordDao(*this, tocEdit_, simulate, multiSession, + burnSpeed, eject, reload, buffer, overburn)) { + Gtk::MessageDialog d(*this, _("Cannot start disk-at-once recording"), + Gtk::MESSAGE_ERROR); + d.run(); + } else { + guiUpdate(UPD_CD_DEVICE_STATUS); + } + } + stop(); +} + diff --git a/xdao/RecordTocDialog.h b/xdao/RecordTocDialog.h new file mode 100644 index 0000000..c648f61 --- /dev/null +++ b/xdao/RecordTocDialog.h @@ -0,0 +1,55 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998, 1999 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __RECORD_TOC_DIALOG_H +#define __RECORD_TOC_DIALOG_H + +#include <libgnomeuimm.h> + +class TocEdit; +class RecordTocSource; +class RecordCDTarget; + +class RecordTocDialog : public Gtk::Window +{ +public: + RecordTocDialog(TocEdit *); + ~RecordTocDialog(); + + void start(Gtk::Window *); + void update(unsigned long level); + +private: + RecordTocSource *TocSource; + RecordCDTarget *CDTarget; + + TocEdit *tocEdit_; + bool active_; + + Gtk::RadioButton* simulate_rb; + Gtk::RadioButton* simulateBurn_rb; + Gtk::RadioButton* burn_rb; + + void stop(); + void startAction(); + + bool on_delete_event(GdkEventAny*); +}; + +#endif diff --git a/xdao/RecordTocSource.cc b/xdao/RecordTocSource.cc new file mode 100644 index 0000000..03cef29 --- /dev/null +++ b/xdao/RecordTocSource.cc @@ -0,0 +1,131 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stdio.h> +#include <limits.h> +#include <math.h> +#include <assert.h> + +#include <gtkmm.h> +#include <gnome.h> + +#include "RecordTocSource.h" +#include "MessageBox.h" +#include "xcdrdao.h" +#include "Settings.h" + +#include "CdDevice.h" +#include "guiUpdate.h" +#include "TocEdit.h" + +#include "DeviceList.h" + +#include "util.h" + +RecordTocSource::RecordTocSource(TocEdit *tocEdit) +{ + Gtk::Table *table; + Gtk::Label *label; + + active_ = false; + tocEdit_ = tocEdit; + + // device settings + Gtk::Frame *infoFrame = manage(new Gtk::Frame(_(" Project Information "))); + + table = manage(new Gtk::Table(5, 2, FALSE)); + table->set_row_spacings(5); + table->set_col_spacings(5); + table->set_border_width(10); + + label = manage(new Gtk::Label(_("Project name: "), 1)); + table->attach(*label, 0, 1, 0, 1); + table->attach(projectLabel_, 1, 2, 0, 1); + + label = manage(new Gtk::Label(_("Toc Type: "), 1)); + table->attach(*label, 0, 1, 1, 2); + table->attach(tocTypeLabel_, 1, 2, 1, 2); + + label = manage(new Gtk::Label(_("Tracks: "), 1)); + table->attach(*label, 0, 1, 2, 3); + table->attach(nofTracksLabel_, 1, 2, 2, 3); + + label = manage(new Gtk::Label(_("Length: "), 1)); + table->attach(*label, 0, 1, 3, 4); + table->attach(tocLengthLabel_, 1, 2, 3, 4); + + infoFrame->add(*table); + pack_start(*infoFrame, Gtk::PACK_SHRINK); +} + +void RecordTocSource::start() +{ + active_ = true; + update(UPD_ALL); + show_all(); +} + +void RecordTocSource::stop() +{ + if (active_) { + hide(); + active_ = false; + } +} + +void RecordTocSource::update(unsigned long level) +{ + update(level, tocEdit_); +} + +void RecordTocSource::update(unsigned long level, TocEdit *tedit) +{ + if (!active_) + return; + + if (tocEdit_ != tedit) { + level = UPD_ALL; + tocEdit_ = tedit; + } + + if (tocEdit_ == NULL) { + projectLabel_.set_text(""); + tocTypeLabel_.set_text(""); + nofTracksLabel_.set_text(""); + tocLengthLabel_.set_text(""); + } + else { + if (level & UPD_TOC_DATA) { + char label[256]; + char buf[50]; + const Toc *toc = tocEdit_->toc(); + + projectLabel_.set_text(tocEdit_->filename()); + + tocTypeLabel_.set_text(toc->tocType2String(toc->tocType())); + + sprintf(label, "%d", toc->nofTracks()); + nofTracksLabel_.set_text(label); + + sprintf(buf, "%d:%02d:%02d", toc->length().min(), + toc->length().sec(), toc->length().frac()); + tocLengthLabel_.set_text(buf); + } + } +} diff --git a/xdao/RecordTocSource.h b/xdao/RecordTocSource.h new file mode 100644 index 0000000..3260ea2 --- /dev/null +++ b/xdao/RecordTocSource.h @@ -0,0 +1,49 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998, 1999 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __RECORD_TOC_SOURCE_H +#define __RECORD_TOC_SOURCE_H + +#include <gtkmm.h> +#include <gtk/gtk.h> + +class TocEdit; + +class RecordTocSource : public Gtk::VBox { +public: + RecordTocSource(TocEdit *); + + void start(); + void stop(); + + void update(unsigned long level); + void update(unsigned long level, TocEdit *); + +private: + TocEdit* tocEdit_; + bool active_; + + Gtk::Label projectLabel_; + Gtk::Label tocTypeLabel_; + Gtk::Label nofTracksLabel_; + Gtk::Label tocLengthLabel_; + +}; + +#endif diff --git a/xdao/SampleDisplay.cc b/xdao/SampleDisplay.cc new file mode 100644 index 0000000..60ffa82 --- /dev/null +++ b/xdao/SampleDisplay.cc @@ -0,0 +1,1319 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stdio.h> +#include <limits.h> +#include <math.h> +#include <assert.h> +#include <iostream> + +#include <gtkmm.h> +#include <gnome.h> + +#include "TocEdit.h" +#include "SampleDisplay.h" +#include "SampleManager.h" +#include "TrackManager.h" + +#include "Toc.h" +#include "util.h" +#include "log.h" + + +/* XPM data for track marker */ +#define TRACK_MARKER_XPM_WIDTH 9 +#define TRACK_MARKER_XPM_HEIGHT 12 +static const gchar *TRACK_MARKER_XPM_DATA[] = { + "9 12 3 1", + " c None", + "X c #000000000000", + ". c #FFFFFFFFFFFF", + " ", + " XXXXXXX ", + " XXXXXXX ", + " XXXXXXX ", + " XXXXXXX ", + " XXXXXXX ", + " XXXXXXX ", + " XXXXX ", + " XXX ", + " X ", + " X ", + " X "}; + +/* XPM data for index marker */ +static const gchar *INDEX_MARKER_XPM_DATA[] = { + "9 12 3 1", + " c None", + "X c #000000000000", + ". c #FFFFFFFFFFFF", + " ", + " XXXXXXX ", + " X.....X ", + " X.....X ", + " X.....X ", + " X.....X ", + " X.....X ", + " X...X ", + " X.X ", + " X ", + " X ", + " X "}; + +/* XPM data for extend track marker */ +static const gchar *TRACK_EXTEND_XPM_DATA[] = { + "9 12 3 1", + " c None", + "X c #000000000000", + ". c #FFFFFFFFFFFF", + "......XX.", + ".....XXX.", + "....XXXX.", + "...XXXXX.", + "..XXXXXX.", + ".XXXXXXX.", + "..XXXXXX.", + "...XXXXX.", + "....XXXX.", + ".....XXX.", + "......XX.", + "........."}; + +/* XPM data for extend track marker */ +static const gchar *INDEX_EXTEND_XPM_DATA[] = { + "9 12 3 1", + " c None", + "X c #000000000000", + ". c #FFFFFFFFFFFF", + "......XX.", + ".....X.X.", + "....X..X.", + "...X...X.", + "..X....X.", + ".X.....X.", + "..X....X.", + "...X...X.", + "....X..X.", + ".....X.X.", + "......XX.", + "........."}; + + +SampleDisplay::SampleDisplay(): + pixmap_(NULL), + trackMarkerPixmap_(NULL), + indexMarkerPixmap_(NULL), + trackMarkerSelectedPixmap_(NULL), + indexMarkerSelectedPixmap_(NULL), + trackExtendPixmap_(NULL), + indexExtendPixmap_(NULL), + drawGc_(NULL) + +{ + adjustment_ = new Gtk::Adjustment(0.0, 0.0, 1.0); + adjustment_->signal_value_changed().connect(mem_fun(*this, + &SampleDisplay::scrollTo)); + + trackManager_ = NULL; + + width_ = height_ = chanHeight_ = lcenter_ = rcenter_ = 0; + timeLineHeight_ = timeLineY_ = 0; + timeTickWidth_ = 0; + timeTickSep_ = 20; + sampleStartX_ = sampleEndX_ = sampleWidthX_ = 0; + minSample_ = maxSample_ = resolution_ = 0; + tocEdit_ = NULL; + + chanSep_ = 10; + + cursorControlExtern_ = false; + cursorDrawn_ = false; + cursorX_ = 0; + + markerSet_ = false; + selectionSet_ = false; + regionSet_ = false; + dragMode_ = DRAG_NONE; + + pickedTrackMarker_ = NULL; + selectedTrack_ = 0; + selectedIndex_ = 0; + + signal_expose_event().connect(mem_fun(*this, + &SampleDisplay::handleExposeEvent)); + signal_configure_event(). + connect(mem_fun(*this, &SampleDisplay::handleConfigureEvent)); + signal_motion_notify_event(). + connect(mem_fun(*this, &SampleDisplay::handleMotionNotifyEvent)); + signal_button_press_event(). + connect(mem_fun(*this, &SampleDisplay::handleButtonPressEvent)); + signal_button_release_event(). + connect(mem_fun(*this, &SampleDisplay::handleButtonReleaseEvent)); + signal_enter_notify_event(). + connect(mem_fun(*this, &SampleDisplay::handleEnterEvent)); + signal_leave_notify_event(). + connect(mem_fun(*this, &SampleDisplay::handleLeaveEvent)); + + set_events(Gdk::EXPOSURE_MASK + | Gdk::LEAVE_NOTIFY_MASK + | Gdk::ENTER_NOTIFY_MASK + | Gdk::BUTTON_PRESS_MASK + | Gdk::BUTTON_RELEASE_MASK + | Gdk::POINTER_MOTION_MASK + | Gdk::POINTER_MOTION_HINT_MASK); +} + +void SampleDisplay::setTocEdit(TocEdit *t) +{ + tocEdit_ = t; + + Toc *toc = tocEdit_->toc(); + + markerSet_ = false; + selectionSet_ = false; + regionSet_ = false; + + minSample_ = 0; + + if (toc->length().samples() > 0) { + maxSample_ = toc->length().samples() - 1; + } + else { + maxSample_ = 0; + } +} + +void SampleDisplay::updateToc(unsigned long smin, unsigned long smax) +{ + if (tocEdit_ == NULL) + return; + + Toc *toc = tocEdit_->toc(); + + if (smin <= smax) { + minSample_ = smin; + maxSample_ = smax; + } + + if (toc->length().samples() == 0) { + minSample_ = maxSample_ = 0; + } + else { + if (maxSample_ >= toc->length().samples()) { + // adjust 'maxSample_' to reduced length + unsigned long len = maxSample_ - minSample_; + + maxSample_ = toc->length().samples() - 1; + if (maxSample_ > len) { + minSample_ = maxSample_ - len; + } + else { + minSample_ = 0; + } + } + } + + setView(minSample_, maxSample_); +} + +void SampleDisplay::setView(unsigned long start, unsigned long end) +{ + if (tocEdit_ == NULL) + return; + + Toc *toc = tocEdit_->toc(); + + if (end < start) + end = start; + + unsigned long len = end - start + 1; + + if (len < 3 && toc != NULL) { + end = start + 2; + + if (end >= toc->length().samples()) { + if (toc->length().samples() != 0) + end = toc->length().samples() - 1; + else + end = 0; + + if (end <= 2) + start = 0; + else + start = end - 2; + } + + len = (end == 0 ? 0 : 3); + } + + minSample_ = start; + maxSample_ = end; + + updateSamples(); + redraw(0, 0, width_, height_, 0); + + GtkAdjustment *adjust = adjustment_->gobj(); + if (toc == NULL) { + adjust->lower = 0.0; + adjust->upper = 1.0; + adjust->value = 0.0; + adjust->page_size = 0.0; + } + else { + adjust->lower = 0.0; + adjust->upper = toc->length().samples(); + adjust->value = minSample_; + + adjust->step_increment = len / 4; + if (adjust->step_increment == 0.0) + adjust->step_increment = 1.0; + + adjust->page_increment = len / 1.1; + adjust->page_size = len; + } + adjustment_->changed(); + +} + +void SampleDisplay::getView(unsigned long *start, unsigned long *end) +{ + *start = minSample_; + *end = maxSample_; +} + +bool SampleDisplay::getSelection(unsigned long *start, unsigned long *end) +{ + if (selectionSet_) { + *start = selectionStartSample_; + *end = selectionEndSample_; + return true; + } + + return false; +} + +int SampleDisplay::getMarker(unsigned long *sample) +{ + if (markerSet_) { + *sample = markerSample_; + return 1; + } + + return 0; +} + +void SampleDisplay::setSelectedTrackMarker(int trackNr, int indexNr) +{ + selectedTrack_ = trackNr; + selectedIndex_ = indexNr; +} + +void SampleDisplay::setRegion(unsigned long start, unsigned long end) +{ + if (tocEdit_ == NULL) + return; + + Toc *toc = tocEdit_->toc(); + + if (end <= start || end >= toc->length().samples()) { + regionSet_ = false; + } + else { + regionStartSample_ = start; + regionEndSample_ = end; + regionSet_ = true; + } + + setView(minSample_, maxSample_); +} + +void SampleDisplay::clearRegion() +{ + bool wasSet = regionSet_; + regionSet_ = false; + if (wasSet) { + setView(minSample_, maxSample_); + } +} + +int SampleDisplay::getRegion(unsigned long *start, unsigned long *end) +{ + if (regionSet_) { + *start = regionStartSample_; + *end = regionEndSample_; + return 1; + } + + return 0; +} + +void SampleDisplay::setCursor(int ctrl, unsigned long sample) +{ + if (ctrl == 0) { + cursorControlExtern_ = false; + } + else { + cursorControlExtern_ = true; + + gint x = sample2pixel(sample); + if (x >= 0) + drawCursor(x); + else + undrawCursor(); + } +} + +void SampleDisplay::getColor(const char *colorName, Gdk::Color *color) +{ + if (!color->parse(colorName) || !get_colormap()->alloc_color(*color)) { + log_message(-1, _("Cannot allocate color \"%s\""), colorName); + *color = get_style()->get_black(); + } +} + +void SampleDisplay::scrollTo() +{ + unsigned long minSample, maxSample; + + if (tocEdit_ == NULL) + return; + + Toc *toc = tocEdit_->toc(); + GtkAdjustment *adjust = adjustment_->gobj(); + + if (adjust->page_size == 0.0) + return; + + minSample = (unsigned long)adjust->value; + maxSample = (unsigned long)(adjust->value + adjust->page_size) - 1; + + if (maxSample >= toc->length().samples()) { + maxSample = toc->length().samples() - 1; + if (maxSample <= (unsigned long)(adjust->page_size - 1)) + minSample = 0; + else + minSample = maxSample - (unsigned long)(adjust->page_size - 1); + } + + viewModified(minSample, maxSample); +} + +unsigned long SampleDisplay::pixel2sample(gint x) +{ + if (tocEdit_ == NULL) + return 0; + + Toc *toc = tocEdit_->toc(); + unsigned long sample; + + if (toc->length().lba() == 0) + return 0; + + assert(x >= sampleStartX_ && x <= sampleEndX_); + + x -= sampleStartX_; + + double res = maxSample_ - minSample_; + res /= sampleWidthX_ - 1; + + sample = (unsigned long)(minSample_ + res * x + 0.5); + + unsigned long round = 75 * 588; // 1 second + unsigned long rest; + + if (res >= 2 * round) { + if ((rest = sample % round) != 0) + sample += round - rest; + } + else { + round = 588; // 1 block + if (res >= 2 * round) { + if ((rest = sample % round) != 0) + sample += round - rest; + } + } + + if (sample > maxSample_) + sample = maxSample_; + + return sample; +} + +gint SampleDisplay::sample2pixel(unsigned long sample) +{ + if (sample < minSample_ || sample > maxSample_) + return -1; + + unsigned long len = maxSample_ - minSample_; + double val = sample - minSample_; + + val *= sampleWidthX_ - 1; + val /= len; + + return (gint)(sampleStartX_ + val + 0.5); +} + +bool SampleDisplay::handleConfigureEvent(GdkEventConfigure *event) +{ + Glib::RefPtr<Pango::Context> context = get_pango_context(); + Pango::FontMetrics metrics = context->get_metrics(get_style()->get_font()); + + if (!drawGc_) { + Glib::RefPtr<Gdk::Bitmap> mask; + // mask = Gdk::Bitmap::create(NULL, get_width(), get_height()); + Glib::RefPtr<const Gdk::Drawable> window(get_window()); + + drawGc_ = Gdk::GC::create(get_window()); + + getColor("darkslateblue", &sampleColor_); + getColor("red3", &middleLineColor_); + getColor("gold2", &cursorColor_); + getColor("red", &markerColor_); + getColor("#ffc0e0", &selectionBackgroundColor_); + + timeLineHeight_ = ((metrics.get_ascent() + metrics.get_descent()) + / Pango::SCALE); + trackLineHeight_ = ((metrics.get_ascent() + metrics.get_descent()) + / Pango::SCALE); + + trackMarkerPixmap_ = + Gdk::Pixmap::create_from_xpm(window, mask, + get_style()->get_white(), + TRACK_MARKER_XPM_DATA); + indexMarkerPixmap_ = + Gdk::Pixmap::create_from_xpm(window, mask, + get_style()->get_white(), + INDEX_MARKER_XPM_DATA); + trackMarkerSelectedPixmap_ = + Gdk::Pixmap::create_from_xpm(window, mask, + markerColor_, + TRACK_MARKER_XPM_DATA); + indexMarkerSelectedPixmap_ = + Gdk::Pixmap::create_from_xpm(window, mask, + markerColor_, + INDEX_MARKER_XPM_DATA); + trackExtendPixmap_ = + Gdk::Pixmap::create_from_xpm(window, mask, + get_style()->get_white(), + TRACK_EXTEND_XPM_DATA); + indexExtendPixmap_ = + Gdk::Pixmap::create_from_xpm(window, mask, + get_style()->get_white(), + INDEX_EXTEND_XPM_DATA); + + trackMarkerWidth_ = ((metrics.get_approximate_digit_width() / + Pango::SCALE) * 5) + TRACK_MARKER_XPM_WIDTH + 2; + trackManager_ = new TrackManager(TRACK_MARKER_XPM_WIDTH); + } + + width_ = get_width(); + height_ = get_height(); + + // Don't even try to do anything smart if we haven't received a + // reasonable window size yet. This will keep pixmap_ to NULL. This + // is important because during startup we don't control how the + // configure_event are timed wrt to gcdmaster bringup. + if (width_ <= 1 || height_ <= 1) + return true; + + chanHeight_ = (height_ - timeLineHeight_ - trackLineHeight_ - 2) / 2; + + lcenter_ = chanHeight_ / 2 + trackLineHeight_; + rcenter_ = lcenter_ + timeLineHeight_ + chanHeight_; + + trackLineY_ = trackLineHeight_ - 1; + + timeLineY_ = chanHeight_ + timeLineHeight_ + trackLineHeight_; + timeTickWidth_ = ((metrics.get_approximate_digit_width() / + Pango::SCALE) * 13) + 3; + + sampleStartX_ = 10; + sampleEndX_ = width_ - 10; + sampleWidthX_ = sampleEndX_ - sampleStartX_ + 1; + + pixmap_ = Gdk::Pixmap::create(get_window(), get_width(), get_height(), -1); + + if (width_ > 100 && height_ > 100) + updateSamples(); + + return true; +} + + +bool SampleDisplay::handleExposeEvent (GdkEventExpose *event) +{ + redraw(event->area.x, event->area.y, event->area.width, event->area.height, + 0); + + return false; +} + +bool SampleDisplay::handleButtonPressEvent(GdkEventButton *event) +{ + gint x = (gint)event->x; + gint y = (gint)event->y; + + dragMode_ = DRAG_NONE; + + // e.g. if audio is playing + if (cursorControlExtern_) + return true; + + if (event->button == 1 && x >= sampleStartX_ && x <= sampleEndX_) { + if (y > trackLineY_) { + dragMode_ = DRAG_SAMPLE_MARKER; + dragStart_ = dragEnd_ = x; + } + else { + if ((pickedTrackMarker_ = trackManager_->pick(x - sampleStartX_ + 4, + &dragStopMin_, + &dragStopMax_)) != NULL) { + dragMode_ = DRAG_TRACK_MARKER; + dragStart_ = dragEnd_ = x; + dragLastX_ = -1; + dragStopMin_ += sampleStartX_; + dragStopMax_ += sampleStartX_; + } + } + + } + + return true; +} + +bool SampleDisplay::handleButtonReleaseEvent(GdkEventButton *event) +{ + gint x = (gint)event->x; + + if (cursorControlExtern_) + return false; + + if (x < sampleStartX_) { + x = sampleStartX_; + } + else if (x > sampleEndX_) { + x = sampleEndX_; + } + + if (event->button == 1 && dragMode_ != DRAG_NONE) { + if (dragMode_ == DRAG_SAMPLE_MARKER) { + if (dragStart_ - x >= -5 && dragStart_ - x <= 5) { + selectionSet_ = false; + selectionCleared(); + markerSet(pixel2sample(dragStart_)); + } + else { + selectionSet_ = true; + if (x > dragStart_) { + selectionStartSample_ = pixel2sample(dragStart_); + selectionEndSample_ = pixel2sample(x); + selectionStart_ = dragStart_; + selectionEnd_ = x; + } + else { + selectionEndSample_ = pixel2sample(dragStart_); + selectionStartSample_ = pixel2sample(x); + selectionEnd_ = dragStart_; + selectionStart_ = x; + } + selectionSet(selectionStartSample_, selectionEndSample_); + } + } + else if (dragMode_ == DRAG_TRACK_MARKER) { + if (dragStart_ - x >= -5 && dragStart_ - x <= 5) { + trackManager_->select(pickedTrackMarker_); + selectedTrack_ = pickedTrackMarker_->trackNr; + selectedIndex_ = pickedTrackMarker_->indexNr; + drawTrackLine(); + trackMarkSelected(pickedTrackMarker_->track, selectedTrack_, + selectedIndex_); + } + else { + selectedTrack_ = pickedTrackMarker_->trackNr; + selectedIndex_ = pickedTrackMarker_->indexNr; + trackMarkMoved(pickedTrackMarker_->track, selectedTrack_, + selectedIndex_, pixel2sample(x)); + } + pickedTrackMarker_ = NULL; + } + + dragMode_ = DRAG_NONE; + drawCursor(x); + redraw(0, 0, width_, height_, 0); + } + + return true; +} + +bool SampleDisplay::handleMotionNotifyEvent (GdkEventMotion *event) +{ + gint x, y; + GdkModifierType state; + + if (cursorControlExtern_) + return TRUE; + + if (event->is_hint) + gdk_window_get_pointer (event->window, &x, &y, &state); + else { + x = (gint)event->x; + y = (gint)event->y; + state = (GdkModifierType) event->state; + } + + + if (dragMode_ == DRAG_SAMPLE_MARKER) { + gint dw = 0; + gint dx = 0; + + if (x < sampleStartX_) + x = sampleStartX_; + else if (x > sampleEndX_) + x = sampleEndX_; + + if (selectionEnd_ > dragStart_) { + if (x < selectionEnd_) { + redraw(x + 1, 0, selectionEnd_ - x, height_, 0x01); + if (x < dragStart_) { + dw = dragStart_ - x + 1; + dx = x; + } + } + else { + dw = x - selectionEnd_; + dx = selectionEnd_ + 1; + } + } + else if (selectionEnd_ < dragStart_) { + if (x > selectionEnd_) { + redraw(selectionEnd_, 0, x - selectionEnd_, height_, 0x01); + if (x > dragStart_) { + dw = x - dragStart_ + 1; + dx = dragStart_; + } + } + else { + dw = selectionEnd_ - x; + dx = x; + } + } + + if (dw != 0) { + drawGc_->set_foreground(cursorColor_); + drawGc_->set_function(Gdk::XOR); + get_window()->draw_rectangle(drawGc_, TRUE, dx, 0, dw, height_ - 1); + drawGc_->set_function(Gdk::COPY); + } + + selectionEnd_ = x; + } + else if (dragMode_ == DRAG_TRACK_MARKER) { + if (x < dragStopMin_) + x = dragStopMin_; + + if (x > dragStopMax_) + x = dragStopMax_; + + if (dragLastX_ > 0) { + drawTrackMarker(2, dragLastX_, 0, 0, 0, 0); + } + drawTrackMarker(1, x, pickedTrackMarker_->trackNr, + pickedTrackMarker_->indexNr, 0, 0); + dragLastX_ = x; + drawCursor(x); + } + else { + drawCursor(x); + } + + return TRUE; +} + +bool SampleDisplay::handleEnterEvent(GdkEventCrossing *event) +{ + if (cursorControlExtern_) + return true; + + drawCursor((gint)event->x); + return true; +} + +bool SampleDisplay::handleLeaveEvent(GdkEventCrossing *event) +{ + if (cursorControlExtern_) + return true; + + undrawCursor(); + return true; +} + +// drawMask: 0x01: do not draw cursor +// 0x02: do not draw marker +void SampleDisplay::redraw(gint x, gint y, gint width, gint height, + int drawMask) +{ + if (pixmap_ == 0) + return; + + get_window()->draw_drawable(drawGc_, pixmap_, x, y, x, y, width, height); + + if ((drawMask & 0x02) == 0) + drawMarker(); + + if ((drawMask & 0x01) == 0 && cursorDrawn_) { + cursorDrawn_ = false; + drawCursor(cursorX_); + } +} + +void SampleDisplay::drawMarker() +{ + if (markerSet_) { + drawGc_->set_foreground(markerColor_); + + markerX_ = sample2pixel(markerSample_); + if (markerX_ >= 0) + get_window()->draw_line(drawGc_, markerX_, trackLineY_, + markerX_, height_ - 1); + } +} + +void SampleDisplay::setMarker(unsigned long sample) +{ + if (markerSet_) + redraw(markerX_, 0, 1, height_, 0x02); + + markerSample_ = sample; + markerSet_ = true; + drawMarker(); +} + +void SampleDisplay::clearMarker() +{ + if (markerSet_) + redraw(markerX_, 0, 1, height_, 0x02); + + markerSet_ = false; +} + + +void SampleDisplay::updateSamples() +{ + if (tocEdit_ == NULL) + return; + + Toc *toc = tocEdit_->toc(); + + if (pixmap_ == 0) + return; + + gint halfHeight = chanHeight_ / 2; + + drawGc_->set_foreground(get_style()->get_white()); + pixmap_->draw_rectangle(drawGc_, TRUE, 0, 0, width_, height_); + + long res = (maxSample_ - minSample_ + 1)/sampleWidthX_; + long bres = res / tocEdit_->sampleManager()->blocking(); + gint i; + double pos; + long j; + unsigned long s; + short lnegsum, lpossum, rnegsum, rpossum; + gint regionStart = -1; + gint regionEnd = -1; + int regionActive = 0; + + if (regionSet_) { + if (regionStartSample_ <= maxSample_ && + regionEndSample_ >= minSample_) { + + if (regionStartSample_ > minSample_) + regionStart = sample2pixel(regionStartSample_); + else + regionStart = sampleStartX_; + + if (regionEndSample_ < maxSample_) + regionEnd = sample2pixel(regionEndSample_); + else + regionEnd = sampleEndX_; + } + + if (regionStart >= 0 && regionEnd >= regionStart) { + drawGc_->set_foreground(selectionBackgroundColor_); + pixmap_->draw_rectangle(drawGc_, TRUE, + regionStart, lcenter_ - halfHeight, + regionEnd - regionStart + 1, chanHeight_); + pixmap_->draw_rectangle(drawGc_, TRUE, + regionStart, rcenter_ - halfHeight, + regionEnd - regionStart + 1, chanHeight_); + } + } + + drawGc_->set_foreground(sampleColor_); + + if (bres > 0) { + for (s = minSample_, i = sampleStartX_; + s < maxSample_ && i <= sampleEndX_; + s += res, i++) { + lnegsum = lpossum = rnegsum = rpossum = 0; + + if (regionStart != -1 && i >= regionStart && regionActive == 0) { + regionActive = 1; + drawGc_->set_foreground(markerColor_); + } + else if (regionActive == 1 && i > regionEnd) { + regionActive = 2; + drawGc_->set_foreground(sampleColor_); + } + + tocEdit_->sampleManager()->getPeak(s, s + res, &lnegsum, &lpossum, + &rnegsum, &rpossum); + + pos = double(lnegsum) * halfHeight; + pos /= SHRT_MAX; + if (pos != 0) + pixmap_->draw_line(drawGc_, i, lcenter_, i, lcenter_ - (gint)pos); + + pos = double(lpossum) * halfHeight; + pos /= SHRT_MAX; + if (pos != 0) + pixmap_->draw_line(drawGc_, i, lcenter_, i, lcenter_ - (gint)pos); + + pos = double(rnegsum) * halfHeight; + pos /= SHRT_MAX; + if (pos != 0) + pixmap_->draw_line(drawGc_, i, rcenter_, i, rcenter_ - (gint)pos); + + pos = double(rpossum) * halfHeight; + pos /= SHRT_MAX; + if (pos != 0) + pixmap_->draw_line(drawGc_, i, rcenter_, i, rcenter_ - (gint)pos); + } + } + else if (maxSample_ > 0 && res >= 1) { + + TocReader reader(toc); + + if (reader.openData() == 0) { + Sample *sampleBuf = new Sample[tocEdit_->sampleManager()->blocking()]; + double dres = double(maxSample_ - minSample_ + 1)/double(sampleWidthX_); + double ds; + + for (ds = minSample_, i = sampleStartX_; + ds < maxSample_ && i <= sampleEndX_; + ds += dres, i++) { + + lnegsum = lpossum = rnegsum = rpossum = 0; + + if (reader.seekSample((long)ds) == 0 && + reader.readSamples(sampleBuf, res) == res) { + for (j = 0; j < res; j++) { + if (sampleBuf[j].left() < lnegsum) + lnegsum = sampleBuf[j].left(); + + if (sampleBuf[j].left() > lpossum) + lpossum = sampleBuf[j].left(); + + if (sampleBuf[j].right() < rnegsum) + rnegsum = sampleBuf[j].right(); + + if (sampleBuf[j].right() > rpossum) + rpossum = sampleBuf[j].right(); + } + } + + if (regionStart != -1 && i >= regionStart && regionActive == 0) { + regionActive = 1; + drawGc_->set_foreground(markerColor_); + } + else if (regionActive == 1 && i > regionEnd) { + regionActive = 2; + drawGc_->set_foreground(sampleColor_); + } + + pos = double(lnegsum) * halfHeight; + pos /= SHRT_MAX; + if (pos != 0) + pixmap_->draw_line(drawGc_, i, lcenter_, i, lcenter_ - (gint)pos); + + pos = double(lpossum) * halfHeight; + pos /= SHRT_MAX; + if (pos != 0) + pixmap_->draw_line(drawGc_, i, lcenter_, i, lcenter_ - (gint)pos); + + pos = double(rnegsum) * halfHeight; + pos /= SHRT_MAX; + if (pos != 0) + pixmap_->draw_line(drawGc_, i, rcenter_, i, rcenter_ - (gint)pos); + + pos = double(rpossum) * halfHeight; + pos /= SHRT_MAX; + if (pos != 0) + pixmap_->draw_line(drawGc_, i, rcenter_, i, rcenter_ - (gint)pos); + } + + delete[] sampleBuf; + reader.closeData(); + } + } + else if (toc != NULL && maxSample_ > minSample_ + 1) { + + TocReader reader(toc); + + if (reader.openData() == 0) { + long len = maxSample_ - minSample_ + 1; + Sample *sampleBuf = new Sample[len]; + + double pres = double(sampleWidthX_ - 1) / double(len - 1); + double di; + gint pos1; + gint lastPosLeft, lastPosRight; + + if (reader.seekSample(minSample_) == 0 && + reader.readSamples(sampleBuf, len) == len) { + + for (j = 1, di = sampleStartX_ + pres; + j < len && di < sampleEndX_ + 1; j++, di += pres) { + if (regionStart != -1 && regionActive == 0 && + minSample_ + j - 1 >= regionStartSample_ && + minSample_ + j <= regionEndSample_) { + regionActive = 1; + drawGc_->set_foreground(markerColor_); + } + else if (regionActive == 1 && minSample_ + j > regionEndSample_) { + regionActive = 2; + drawGc_->set_foreground(sampleColor_); + } + + pos = sampleBuf[j - 1].left() * halfHeight; + pos /= SHRT_MAX; + + pos1 = sampleBuf[j].left() * halfHeight; + pos1 /= SHRT_MAX; + lastPosLeft = pos1; + + if (pos != 0 || pos1 != 0) + pixmap_->draw_line(drawGc_, long(di - pres), lcenter_ - (gint)pos, + long(di), lcenter_ - pos1); + + pos = sampleBuf[j - 1].right() * halfHeight; + pos /= SHRT_MAX; + + pos1 = sampleBuf[j].right() * halfHeight; + pos1 /= SHRT_MAX; + lastPosRight = pos1; + + if (pos != 0 || pos1 != 0) + pixmap_->draw_line(drawGc_, long(di - pres), rcenter_ - (gint)pos, + long(di), rcenter_ - pos1); + + } + + if (&pixmap_ == 0) + std::cout << "null !!" << std::endl; + + if (0 && (gint)di < sampleEndX_) { + pos = sampleBuf[len -1].left() * halfHeight; + pos /= SHRT_MAX; + if (pos != 0 || lastPosLeft != 0) + pixmap_->draw_line(drawGc_, long(di), lcenter_ - lastPosLeft, + sampleEndX_, lcenter_ - (gint)pos); + + pos = sampleBuf[len - 1].right() * halfHeight; + pos /= SHRT_MAX; + if (pos != 0 || lastPosRight != 0) + pixmap_->draw_line(drawGc_, long(di), rcenter_ - lastPosRight, + sampleEndX_, rcenter_ - (gint)pos); + } + } + delete[] sampleBuf; + } + + } + + + drawGc_->set_foreground(middleLineColor_); + + pixmap_->draw_line(drawGc_, sampleStartX_, lcenter_, sampleEndX_, lcenter_); + pixmap_->draw_line(drawGc_, sampleStartX_, rcenter_, sampleEndX_, rcenter_); + + drawGc_->set_foreground(get_style()->get_black()); + + pixmap_->draw_line(drawGc_, sampleStartX_ - 1, lcenter_ - halfHeight, + sampleEndX_ + 1, lcenter_ - halfHeight); + pixmap_->draw_line(drawGc_, sampleStartX_ - 1, lcenter_ + halfHeight, + sampleEndX_ + 1, lcenter_ + halfHeight); + pixmap_->draw_line(drawGc_, sampleStartX_ - 1, lcenter_ - halfHeight, + sampleStartX_ - 1, lcenter_ + halfHeight); + pixmap_->draw_line(drawGc_, sampleEndX_ + 1, lcenter_ - halfHeight, + sampleEndX_ + 1, lcenter_ + halfHeight); + + pixmap_->draw_line(drawGc_, sampleStartX_ - 1, rcenter_ - halfHeight, + sampleEndX_ + 1, rcenter_ - halfHeight); + pixmap_->draw_line(drawGc_, sampleStartX_ - 1, rcenter_ + halfHeight, + sampleEndX_ + 1, rcenter_ + halfHeight); + pixmap_->draw_line(drawGc_, sampleStartX_ - 1, rcenter_ + halfHeight, + sampleStartX_ - 1, rcenter_ - halfHeight); + pixmap_->draw_line(drawGc_, sampleEndX_ + 1, rcenter_ + halfHeight, + sampleEndX_ + 1, rcenter_ - halfHeight); + + drawTimeLine(); + + trackManager_->update(toc, minSample_, maxSample_, sampleWidthX_); + if (selectedTrack_ > 0) { + trackManager_->select(selectedTrack_, selectedIndex_); + } + drawTrackLine(); +} + +void SampleDisplay::drawCursor(gint x) +{ + if (pixmap_ == 0) + return; + + if (x < sampleStartX_ || x > sampleEndX_) + return; + + if (cursorDrawn_ && cursorX_ != x) { + redraw(cursorX_, 0, 1, height_, 0x01); + } + + if (!cursorDrawn_ || cursorX_ != x) { + drawGc_->set_foreground(cursorColor_); + get_window()->draw_line(drawGc_, x, trackLineY_, x, height_ - 1); + } + + cursorDrawn_ = true; + cursorX_ = x; + + if (cursorControlExtern_ == false) + cursorMoved(pixel2sample(x)); +} + +void SampleDisplay::undrawCursor() +{ + if (cursorDrawn_) { + redraw(cursorX_, 0, 1, height_, 0x01); + cursorDrawn_ = false; + } +} + +void SampleDisplay::drawTimeTick(gint x, gint y, unsigned long sample) +{ + char buf[50]; + + if (pixmap_ == 0) + return; + + unsigned long min = sample / (60 * 44100); + sample %= 60 * 44100; + + unsigned long sec = sample / 44100; + sample %= 44100; + + unsigned long frame = sample / 588; + sample %= 588; + + sprintf(buf, "%lu:%02lu:%02lu.%03lu", min, sec, frame, sample); + + drawGc_->set_foreground(get_style()->get_black()); + + pixmap_->draw_line(drawGc_, x, y - timeLineHeight_, x, y); + + Glib::RefPtr<Pango::Layout> playout = + Pango::Layout::create(get_pango_context()); + playout->set_text(buf); + pixmap_->draw_layout(drawGc_, x + 3, y - timeLineHeight_ + 1, playout); +} + +void SampleDisplay::drawTimeLine() +{ + if (tocEdit_ == NULL) + return; + + Toc *toc = tocEdit_->toc(); + + if (toc->length().lba() == 0) + return; + + gint sep = timeTickWidth_ + timeTickSep_; + unsigned long maxNofTicks = (sampleWidthX_ + timeTickSep_) / sep; + gint x; + + unsigned long len = maxSample_ - minSample_ + 1; + unsigned long dt; + unsigned long dtx; + unsigned long startSample; + unsigned long s; + + if ((s = len / (60 * 44100)) > 1) { + dt = 60 * 44100; + } + else if ((s = len / 44100) > 1) { + dt = 44100; + } + else if ((s = len / 588) > 1) { + dt = 588; + } + else { + dt = 1; + s = len; + } + + if (s > maxNofTicks) { + dtx = s / maxNofTicks; + if (s % maxNofTicks != 0) + dtx++; + dtx *= dt; + } + else { + dtx = dt; + } + + if (dt > 1) { + if (minSample_ % dt == 0) { + startSample = minSample_; + } + else { + startSample = minSample_ / dt; + startSample = startSample * dt + dt; + } + } + else { + startSample = minSample_; + } + + for (s = startSample; s < maxSample_; s += dtx) { + x = sample2pixel(s); + + if (x + timeTickWidth_ <= sampleEndX_) + drawTimeTick(x, timeLineY_, s); + } +} + +// Draws track marker. +// mode: 0: draw on 'pixmap_' +// 1: draw on window +// 2: redraw region at given position +void SampleDisplay::drawTrackMarker(int mode, gint x, int trackNr, + int indexNr, int selected, int extend) +{ + if (mode < 2) { + char buf[20]; + + sprintf(buf, "%d.%d", trackNr, indexNr); + + Glib::RefPtr<Gdk::Pixmap> marker; + + if (extend) { + marker = (indexNr == 1 ? trackExtendPixmap_ : indexExtendPixmap_); + } + else { + if (selected) + marker = (indexNr == 1 ? trackMarkerSelectedPixmap_ : + indexMarkerSelectedPixmap_); + else + marker = (indexNr == 1 ? trackMarkerPixmap_ : indexMarkerPixmap_); + } + + Glib::RefPtr<Gdk::Window> win = get_window(); + Glib::RefPtr<Gdk::Drawable> dr = win; + + if (mode == 0) + dr = pixmap_; + + if (mode == 0) { + if (selected) + drawGc_->set_foreground(markerColor_); + else + drawGc_->set_foreground(get_style()->get_white()); + + dr->draw_rectangle(drawGc_, TRUE, x-4, trackLineY_ - trackLineHeight_, + trackMarkerWidth_, trackLineHeight_); + } + + drawGc_->set_foreground(get_style()->get_black()); + + dr->draw_drawable(drawGc_, marker, 0, 0, + x - 4, trackLineY_ - TRACK_MARKER_XPM_HEIGHT, + TRACK_MARKER_XPM_WIDTH, TRACK_MARKER_XPM_HEIGHT); + + Glib::RefPtr<Pango::Layout> playout = + Pango::Layout::create(get_pango_context()); + playout->set_text(buf); + dr->draw_layout(drawGc_, + x + TRACK_MARKER_XPM_WIDTH / 2 + 2, + trackLineY_ - trackLineHeight_ + 2, + playout); + } + else { + redraw(x - 4, trackLineY_ - trackLineHeight_, trackMarkerWidth_, + trackLineHeight_, 0x03); + } +} + +void SampleDisplay::drawTrackLine() +{ + const TrackManager::Entry *run; + const TrackManager::Entry *selected = NULL; + + for (run = trackManager_->first(); run != NULL; + run = trackManager_->next()) { + if (run->selected != 0 && run->extend == 0) { + selected = run; + } + else if (run->indexNr != 1 || run->extend != 0) { + drawTrackMarker(0, sampleStartX_ + run->xpos, run->trackNr, run->indexNr, + 0, run->extend); + } + } + + for (run = trackManager_->first(); run != NULL; + run = trackManager_->next()) { + if (run->indexNr == 1 && run->selected == 0 && run->extend == 0) { + drawTrackMarker(0, sampleStartX_ + run->xpos, run->trackNr, run->indexNr, + 0, run->extend); + } + } + + if (selected != NULL) + drawTrackMarker(0, sampleStartX_ + selected->xpos, selected->trackNr, + selected->indexNr, 1, 0); +} + +void SampleDisplay::updateTrackMarks() +{ + if (tocEdit_ == NULL) + return; + + Toc *toc = tocEdit_->toc(); + + drawGc_->set_foreground(get_style()->get_white()); + pixmap_->draw_rectangle(drawGc_, TRUE, + sampleStartX_ - 4, trackLineY_ - trackLineHeight_, + width_ - sampleStartX_, trackLineHeight_); + + trackManager_->update(toc, minSample_, maxSample_, sampleWidthX_); + if (selectedTrack_ > 0) { + trackManager_->select(selectedTrack_, selectedIndex_); + } + drawTrackLine(); + + redraw(0, 0, width_, height_, 0x03); +} diff --git a/xdao/SampleDisplay.h b/xdao/SampleDisplay.h new file mode 100644 index 0000000..cb2f9ed --- /dev/null +++ b/xdao/SampleDisplay.h @@ -0,0 +1,164 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __SAMPLE_DISPLAY_H +#define __SAMPLE_DISPLAY_H + +#include <gtkmm.h> +#include <gdkmm.h> +#include <pangomm.h> +#include <gtk/gtk.h> + +#include "TrackManager.h" + +class Toc; +class Sample; +class TocEdit; + +class SampleDisplay : public Gtk::DrawingArea +{ +public: + SampleDisplay(); + + void setTocEdit(TocEdit *); + bool getSelection(unsigned long* start, unsigned long* end); + void setSelectedTrackMarker(int trackNr, int indexNr); + void setMarker(unsigned long sample); + void clearMarker(); + int getMarker(unsigned long *); + void setView(unsigned long start, unsigned long end); + void getView(unsigned long *start, unsigned long *end); + void setRegion(unsigned long start, unsigned long end); + int getRegion(unsigned long *start, unsigned long *end); + void clearRegion(); + Gtk::Adjustment *getAdjustment() { return adjustment_; } + void updateTrackMarks(); + void setCursor(int, unsigned long); + + void updateToc(unsigned long, unsigned long); + + sigc::signal1<void, unsigned long> markerSet; + sigc::signal1<void, unsigned long> cursorMoved; + sigc::signal2<void, unsigned long, unsigned long> selectionSet; + sigc::signal0<void> selectionCleared; + sigc::signal3<void, const Track *, int, int> trackMarkSelected; + sigc::signal4<void, const Track *, int, int, unsigned long> trackMarkMoved; + sigc::signal2<void, unsigned long, unsigned long> viewModified; + +protected: + bool handleConfigureEvent(GdkEventConfigure *); + bool handleExposeEvent(GdkEventExpose *event); + bool handleMotionNotifyEvent(GdkEventMotion *event); + bool handleButtonPressEvent(GdkEventButton*); + bool handleButtonReleaseEvent(GdkEventButton*); + bool handleEnterEvent(GdkEventCrossing*); + bool handleLeaveEvent(GdkEventCrossing*); + +private: + enum DragMode { DRAG_NONE, DRAG_SAMPLE_MARKER, DRAG_TRACK_MARKER }; + + Gtk::Adjustment *adjustment_; + + Glib::RefPtr<Gdk::Pixmap> pixmap_; + Glib::RefPtr<Gdk::Pixmap> trackMarkerPixmap_; + Glib::RefPtr<Gdk::Pixmap> indexMarkerPixmap_; + Glib::RefPtr<Gdk::Pixmap> trackMarkerSelectedPixmap_; + Glib::RefPtr<Gdk::Pixmap> indexMarkerSelectedPixmap_; + Glib::RefPtr<Gdk::Pixmap> trackExtendPixmap_; + Glib::RefPtr<Gdk::Pixmap> indexExtendPixmap_; + + Glib::RefPtr<Gdk::GC> drawGc_; + Gdk::Color sampleColor_; + Gdk::Color middleLineColor_; + Gdk::Color cursorColor_; + Gdk::Color markerColor_; + Gdk::Color selectionBackgroundColor_; + + gint width_; + gint height_; + gint timeLineHeight_; + gint timeLineY_; + gint timeTickWidth_; + gint timeTickSep_; + gint sampleStartX_; + gint sampleEndX_; + gint sampleWidthX_; + + gint trackLineHeight_; + gint trackLineY_; + gint trackMarkerWidth_; + const TrackManager::Entry *pickedTrackMarker_; + + gint chanSep_; + gint chanHeight_; + gint lcenter_; + gint rcenter_; + + TrackManager *trackManager_; + + TocEdit *tocEdit_; + unsigned long minSample_; + unsigned long maxSample_; + unsigned long resolution_; + + bool cursorDrawn_; + gint cursorX_; + bool cursorControlExtern_; + + bool markerSet_; + gint markerX_; + unsigned long markerSample_; + + bool selectionSet_; + unsigned long selectionStartSample_; + unsigned long selectionEndSample_; + gint selectionStart_; + gint selectionEnd_; + + bool regionSet_; + unsigned long regionStartSample_; + unsigned long regionEndSample_; + + int selectedTrack_; + int selectedIndex_; + + DragMode dragMode_; + gint dragStart_, dragEnd_; + gint dragStopMin_, dragStopMax_; + gint dragLastX_; + + void scrollTo(); + void redraw(gint x, gint y, gint width, gint height, int); + void readSamples(long startBlock, long endBlock); + void updateSamples(); + void drawCursor(gint); + void undrawCursor(); + void getColor(const char *, Gdk::Color *); + unsigned long pixel2sample(gint x); + gint sample2pixel(unsigned long); + void drawMarker(); + void removeMarker(); + void drawTimeTick(gint x, gint y, unsigned long sample); + void drawTimeLine(); + void drawTrackMarker(int mode, gint x, int trackNr, int indexNr, + int selected, int extend); + void drawTrackLine(); +}; + +#endif diff --git a/xdao/SampleManager.cc b/xdao/SampleManager.cc new file mode 100644 index 0000000..d5d72f6 --- /dev/null +++ b/xdao/SampleManager.cc @@ -0,0 +1,465 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stdio.h> +#include <limits.h> +#include <math.h> +#include <assert.h> + +#include <gtkmm.h> +#include <gtk/gtk.h> + +#include "SampleManager.h" + +#include "TocEdit.h" +#include "guiUpdate.h" +#include "Toc.h" +#include "util.h" +#include "log.h" + +#include "TrackDataScrap.h" + +class SampleManagerImpl : public sigc::trackable { +public: + SampleManagerImpl(unsigned long); + ~SampleManagerImpl(); + + unsigned long blocking_; + TocEdit *tocEdit_; + TocReader tocReader_; + + short *leftNegSamples_; + short *leftPosSamples_; + short *rightNegSamples_; + short *rightPosSamples_; + long samplesSize_; + long blocks_; + unsigned long slength_; + long chunk_; + + Sample *block_; + long actBlock_; + long endBlock_; + long burstBlock_; + const char* curFilename_; + unsigned long length_; + gfloat percent_; + gfloat percentStep_; + + void getPeak(unsigned long start, unsigned long end, + short *leftNeg, short *leftPos, + short *rightNeg, short *rightPos); + int scanToc(unsigned long start, unsigned long end, bool blocking); + + int readSamples(); + void reallocSamples(unsigned long maxSample); + void removeSamples(unsigned long start, unsigned long end, TrackDataScrap *); + void insertSamples(unsigned long pos, unsigned long len, + const TrackDataScrap *); +}; + +SampleManager::SampleManager(unsigned long blocking) +{ + impl_ = new SampleManagerImpl(blocking); +} + +SampleManager::~SampleManager() +{ + delete impl_; + impl_ = NULL; +} + +unsigned long SampleManager::blocking() const +{ + return impl_->blocking_; +} + +void SampleManager::setTocEdit(TocEdit *t) +{ + impl_->tocEdit_ = t; + impl_->tocReader_.init(t->toc()); + + impl_->blocks_ = 0; +} + + +int SampleManager::scanToc(unsigned long start, unsigned long end, + bool blocking) +{ + return impl_->scanToc(start, end, blocking); +} + +int SampleManager::readSamples() +{ + return impl_->readSamples(); +} + +void SampleManager::getPeak(unsigned long start, unsigned long end, + short *leftNeg, short *leftPos, + short *rightNeg, short *rightPos) +{ + impl_->getPeak(start, end, leftNeg, leftPos, rightNeg, rightPos); +} + +void SampleManager::removeSamples(unsigned long start, unsigned long end, + TrackDataScrap *scrap) +{ + impl_->removeSamples(start, end, scrap); +} + +void SampleManager::insertSamples(unsigned long pos, unsigned long len, + const TrackDataScrap *scrap) +{ + impl_->insertSamples(pos, len, scrap); +} + +SampleManagerImpl::SampleManagerImpl(unsigned long blocking) : tocReader_(NULL) +{ + blocking_ = blocking; + tocEdit_ = NULL; + + leftNegSamples_ = leftPosSamples_ = NULL; + rightNegSamples_ = rightPosSamples_ = NULL; + samplesSize_ = 0; + blocks_ = 0; + slength_ = 0; + + block_ = new Sample[blocking_]; + actBlock_ = endBlock_ = burstBlock_ = 0; + length_ = 0; + + // allocate space in chunks of 40 minutes + chunk_ = 40 * 60 * 75 * 588 / blocking; +} + +SampleManagerImpl::~SampleManagerImpl() +{ + delete[] block_; + + delete[] leftNegSamples_; + delete[] leftPosSamples_; + delete[] rightNegSamples_; + delete[] rightPosSamples_; + + tocEdit_ = NULL; +} + +void SampleManagerImpl::getPeak(unsigned long start, unsigned long end, + short *leftNeg, short *leftPos, + short *rightNeg, short *rightPos) +{ + *leftNeg = *leftPos = 0; + *rightNeg = *rightPos = 0; + + long startBlock = start / blocking_; + long endBlock = end / blocking_; + long i; + + if (startBlock >= blocks_ || endBlock >= blocks_) + return; + + for (i = startBlock; i <= endBlock; i++) { + assert(leftNegSamples_[i] <= 0); + assert(rightNegSamples_[i] <= 0); + assert(leftPosSamples_[i] >= 0); + assert(rightPosSamples_[i] >= 0); + + if (leftNegSamples_[i] < *leftNeg) + *leftNeg = leftNegSamples_[i]; + + if (leftPosSamples_[i] > *leftPos) + *leftPos = leftPosSamples_[i]; + + if (rightNegSamples_[i] < *rightNeg) + *rightNeg = rightNegSamples_[i]; + + if (rightPosSamples_[i] > *rightPos) + *rightPos = rightPosSamples_[i]; + } +} + +// Return values: +// 0 : ok +// 1 : incorrect parameters +// 2 : unable to read from file + +int SampleManagerImpl::scanToc(unsigned long start, unsigned long end, + bool blocking) +{ + long i; + const Toc *toc; + + actBlock_ = start / blocking_; + endBlock_ = end / blocking_; + curFilename_ = NULL; + + if (tocEdit_ == NULL || endBlock_ < actBlock_) + return 1; + + toc = tocEdit_->toc(); + + length_ = toc->length().samples(); + + if (end >= length_) + return 1; + + length_ -= actBlock_ * blocking_; + + reallocSamples(end); + + for (i = actBlock_; i <= endBlock_; i++) { + leftNegSamples_[i] = rightNegSamples_[i] = -16000; + leftPosSamples_[i] = rightPosSamples_[i] = 16000; + } + + if (tocReader_.openData() != 0) + return 2; + + if (tocReader_.seekSample(actBlock_ * blocking_) != 0) { + tocReader_.closeData(); + return 2; + } + + long len = endBlock_ - actBlock_ + 1; + + if (len < 2000) { + burstBlock_ = len; + percentStep_ = 1.0; + // withGui_ = false; + } + else if (len < 10000) { + burstBlock_ = len / 100; + percentStep_ = 0.01; + // withGui_ = true; + } + else { + burstBlock_ = 75; + percentStep_ = gfloat(burstBlock_) / gfloat(len); + // withGui_ = true; + } + + if (burstBlock_ == 0) + burstBlock_ = 1; + + percent_ = 0; + + if (blocking) { + while (readSamples() == 0); + return 0; + } + + return 0; +} + +// Returns: +// 0 : in progress +// 1 : done +// -1 : read error + +int SampleManagerImpl::readSamples() +{ + int j; + long n; + short lpossum, rpossum, lnegsum, rnegsum; + int ret; + long burstEnd = actBlock_ + burstBlock_; + + const char* cf = tocReader_.curFilename(); + if (cf && cf != curFilename_) { + std::string msg = "Scanning audio data \""; + msg += cf; + msg += "\""; + tocEdit_->signalStatusMessage(msg.c_str()); + curFilename_ = cf; + guiUpdate(UPD_SAMPLES); + } + + for (; actBlock_ <= endBlock_ && actBlock_ < burstEnd && length_ > 0; + actBlock_++) { + n = length_ > blocking_ ? blocking_ : length_; + if ((ret = tocReader_.readSamples(block_, n)) == n) { + lpossum = lnegsum = rpossum = rnegsum = 0; + for (j = 0; j < n; j++) { + short d = block_[j].left(); + if (d > lpossum) + lpossum = d; + if (d < lnegsum) + lnegsum = d; + + d = block_[j].right(); + if (d > rpossum) + rpossum = d; + if (d < rnegsum) + rnegsum = d; + } + leftNegSamples_[actBlock_] = lnegsum; + leftPosSamples_[actBlock_] = lpossum; + rightNegSamples_[actBlock_] = rnegsum; + rightPosSamples_[actBlock_] = rpossum; + } + else { + log_message(-2, "Cannot read audio data: %ld - %ld.", n, ret); + tocReader_.closeData(); + tocEdit_->signalProgressFraction(0.0); + return -1; + } + length_ -= n; + } + + + if (actBlock_ >= endBlock_ && actBlock_ < burstEnd) { + tocReader_.closeData(); + tocEdit_->signalProgressFraction(0.0); + return 1; + } + + percent_ += percentStep_; + if (percent_ > 1.0) + percent_ = 1.0; + + tocEdit_->signalProgressFraction(percent_); + + return 0; +} + +void SampleManagerImpl::reallocSamples(unsigned long maxSample) +{ + long i; + long maxBlock = (maxSample / blocking_) + 1; + + if (maxSample >= slength_) + slength_ = maxSample + 1; + + if (maxBlock > blocks_) + blocks_ = maxBlock; + + if (blocks_ > samplesSize_) { + long newSize = samplesSize_ + chunk_; + while (newSize < blocks_) + newSize += chunk_; + + short *newLeftNeg = new short[newSize]; + short *newLeftPos = new short[newSize]; + short *newRightNeg = new short[newSize]; + short *newRightPos = new short[newSize]; + + for (i = 0; i < samplesSize_; i++) { + newLeftNeg[i] = leftNegSamples_[i]; + newLeftPos[i] = leftPosSamples_[i]; + newRightNeg[i] = rightNegSamples_[i]; + newRightPos[i] = rightPosSamples_[i]; + } + samplesSize_ = newSize; + + delete[] leftNegSamples_; + delete[] leftPosSamples_; + delete[] rightNegSamples_; + delete[] rightPosSamples_; + leftNegSamples_ = newLeftNeg; + leftPosSamples_ = newLeftPos; + rightNegSamples_ = newRightNeg; + rightPosSamples_ = newRightPos; + } +} + +void SampleManagerImpl::removeSamples(unsigned long start, unsigned long end, + TrackDataScrap *scrap) +{ + long i; + long bstart; + long oldBlocks = blocks_; + long blen; + unsigned long slen; + + if (start > end || end >= slength_) + return; + + slen = end - start + 1; + + slength_ -= slen; + + if (slength_ == 0) { + blocks_ = 0; + return; + } + + blocks_ = ((slength_ - 1) / blocking_) + 1; + + blen = oldBlocks - blocks_; + + bstart = start / blocking_; + + if (scrap != NULL) + scrap->setPeaks(blen, &(leftNegSamples_[bstart]), + &(leftPosSamples_[bstart]), &(rightNegSamples_[bstart]), + &(rightPosSamples_[bstart])); + + if (blen > 0) { + for (i = bstart; i < blocks_; i++) { + leftNegSamples_[i] = leftNegSamples_[i + blen]; + leftPosSamples_[i] = leftPosSamples_[i + blen]; + rightNegSamples_[i] = rightNegSamples_[i + blen]; + rightPosSamples_[i] = rightPosSamples_[i + blen] ; + } + } +} + +void SampleManagerImpl::insertSamples(unsigned long pos, unsigned long len, + const TrackDataScrap *scrap) +{ + long blen; + long bpos; + long oldBlocks; + long i; + + if (len == 0) + return; + + bpos = pos / blocking_; + + if (bpos > blocks_) + bpos = blocks_; + + oldBlocks = blocks_; + + reallocSamples(slength_ + (len - 1)); + + blen = blocks_ - oldBlocks; + + if (blen > 0) { + for (i = blocks_ - 1; i >= bpos + blen; i--) { + leftNegSamples_[i] = leftNegSamples_[i - blen]; + leftPosSamples_[i] = leftPosSamples_[i - blen]; + rightNegSamples_[i] = rightNegSamples_[i - blen]; + rightPosSamples_[i] = rightPosSamples_[i - blen] ; + } + + // initialize the new region + for (i = bpos; i < bpos + blen; i++) { + leftNegSamples_[i] = -16000; + leftPosSamples_[i] = 16000; + rightNegSamples_[i] = -16000; + rightPosSamples_[i] = 16000; + } + + if (scrap != NULL) + scrap->getPeaks(blen, &(leftNegSamples_[bpos]), &(leftPosSamples_[bpos]), + &(rightNegSamples_[bpos]), &(rightPosSamples_[bpos])); + } +} diff --git a/xdao/SampleManager.h b/xdao/SampleManager.h new file mode 100644 index 0000000..66506fc --- /dev/null +++ b/xdao/SampleManager.h @@ -0,0 +1,54 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __SAMPLE_MANAGER_H +#define __SAMPLE_MANAGER_H + +#include <gtkmm.h> + +class TocEdit; +class TrackDataScrap; + +class SampleManager +{ +public: + SampleManager(unsigned long blocking); + ~SampleManager(); + + void setTocEdit(TocEdit *); + + unsigned long blocking() const; + + int scanToc(unsigned long start, unsigned long end, bool blocking = false); + + void getPeak(unsigned long start, unsigned long end, + short *leftNeg, short *leftPos, + short *rightNeg, short *rightPos); + + void removeSamples(unsigned long start, unsigned long end, TrackDataScrap *); + void insertSamples(unsigned long pos, unsigned long len, + const TrackDataScrap *); + + int readSamples(); + +private: + class SampleManagerImpl *impl_; +}; + +#endif diff --git a/xdao/Settings.cc b/xdao/Settings.cc new file mode 100644 index 0000000..073ab26 --- /dev/null +++ b/xdao/Settings.cc @@ -0,0 +1,28 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "Settings.h" + +const char *SET_CDRDAO_PATH = "/GnomeCDMaster/cdrdao/path=cdrdao"; +const char *SET_RECORD_EJECT_WARNING = "/GnomeCDMaster/record/ejectWarning=true"; +const char *SET_RECORD_RELOAD_WARNING = "/GnomeCDMaster/record/reloadWarning=true"; +const char *SET_DUPLICATE_ONTHEFLY_WARNING = "/GnomeCDMaster/duplicate/ontheflyWarning=true"; + +const char *SET_SECTION_DEVICES = "/GnomeCDMaster/devices/"; +const char *SET_DEVICES_NUM = "/GnomeCDMaster/devices/count=0"; diff --git a/xdao/Settings.h b/xdao/Settings.h new file mode 100644 index 0000000..a36b042 --- /dev/null +++ b/xdao/Settings.h @@ -0,0 +1,53 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * $Log: Settings.h,v $ + * Revision 1.4 2004/02/12 01:13:32 poolshark + * Merge from gnome2 branch + * + * Revision 1.3.6.1 2004/01/05 00:34:03 poolshark + * First checking of gnome2 port + * + * Revision 1.1.1.1 2003/12/09 05:32:28 denis + * Fooya + * + * Revision 1.3 2001/08/18 19:15:43 llanero + * added SET_DUPLICATE_ONTHEFLY_WARNING + * + * Revision 1.2 2000/05/01 18:15:00 andreasm + * Switch to gnome-config settings. + * Adapted Message Box to Gnome look, unfortunately the Gnome::MessageBox is + * not implemented in gnome--, yet. + * + * Revision 1.1.1.1 2000/02/05 01:38:51 llanero + * Uploaded cdrdao 1.1.3 with pre10 patch applied. + * + */ + +#ifndef __SETTINGS_H__ +#define __SETTINGS_H__ + +extern const char *SET_CDRDAO_PATH; +extern const char *SET_RECORD_EJECT_WARNING; +extern const char *SET_RECORD_RELOAD_WARNING; +extern const char *SET_DUPLICATE_ONTHEFLY_WARNING; +extern const char *SET_SECTION_DEVICES; +extern const char *SET_DEVICES_NUM; + +#endif diff --git a/xdao/SoundIF-ao.cc b/xdao/SoundIF-ao.cc new file mode 100644 index 0000000..18973f6 --- /dev/null +++ b/xdao/SoundIF-ao.cc @@ -0,0 +1,107 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <ao/ao.h> + +#include "SoundIF.h" +#include "Sample.h" +#include "util.h" + +class SoundIFImpl +{ +public: + int driverId; + ao_device* device; + ao_sample_format format; +}; + +SoundIF::SoundIF() +{ + ao_initialize(); + + impl_ = new SoundIFImpl; + impl_->driverId = ao_default_driver_id(); + impl_->format.bits = 16; + impl_->format.rate = 44100; + impl_->format.channels = 2; + impl_->format.byte_format = AO_FMT_NATIVE; +} + +SoundIF::~SoundIF() +{ + if (impl_) delete impl_; + impl_ = NULL; + end(); + ao_shutdown(); +} + +// Initializes sound interface. +// return: 0: OK +// 1: sounde device not found +// 2: cannot setup sound device +int SoundIF::init() +{ + return 0; +} + +// Acquires sound device for playing. +// return 0: OK +// 1: error occured + +int SoundIF::start() +{ + impl_->device = ao_open_live(impl_->driverId, &(impl_->format), NULL); + + if (!impl_->device) + return 1; + + return 0; +} + +// Playes given sample buffer. +// return: 0: OK +// 1: error occured +int SoundIF::play(Sample *sbuf, long nofSamples) +{ + if (!impl_->device) + return 1; + + swapSamples(sbuf, nofSamples); + + int ret = ao_play(impl_->device, (char*)sbuf, nofSamples * sizeof(Sample)); + + if (ret == 0) + return 1; + + return 0; +} + +unsigned long SoundIF::getDelay() +{ + // Unfortunately, ao doesn't have a getDelay() API, so let's return + // a realistic audio buffering value. + return 10000; +} + +// Finishs playing, sound device is released. +void SoundIF::end() +{ + ao_close(impl_->device); + impl_->device = NULL; +} diff --git a/xdao/SoundIF-linux.cc b/xdao/SoundIF-linux.cc new file mode 100644 index 0000000..3fe5ff2 --- /dev/null +++ b/xdao/SoundIF-linux.cc @@ -0,0 +1,209 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +# if defined(__FreeBSD__) +#include <sys/soundcard.h> +# if !defined(SNDCTL_DSP_CHANNELS) +# define SNDCTL_DSP_CHANNELS SOUND_PCM_WRITE_CHANNELS +# endif +# else +#include <linux/soundcard.h> +# endif + +#include <stdio.h> +#include <gtkmm.h> +#include <gnome.h> +#include <sys/ioctl.h> +#include <sys/types.h> +#include <fcntl.h> + +#include "SoundIF.h" +#include "Sample.h" +#include "util.h" + +class SoundIFImpl { +public: + SoundIFImpl() { dspFd_ = -1; } + + int setupDevice(); + int openDevice(); + void closeDevice(); + + int dspFd_; // sound device +}; + +SoundIF::SoundIF() +{ + impl_ = new SoundIFImpl; +} + +SoundIF::~SoundIF() +{ + end(); + delete impl_; + impl_ = NULL; +} + +// Initializes sound interface. +// return: 0: OK +// 1: sounde device not found +// 2: cannot setup sound device +int SoundIF::init() +{ + if (impl_->openDevice() != 0) + return 1; + + if (impl_->setupDevice() != 0) { + impl_->closeDevice(); + return 2; + } + + impl_->closeDevice(); + return 0; +} + +// Acquires sound device for playing. +// return 0: OK +// 1: error occured +int SoundIF::start() +{ + if (impl_->dspFd_ >= 0) + return 0; // already opened + + if (impl_->openDevice() != 0) + return 1; + + if (impl_->setupDevice() != 0) { + impl_->closeDevice(); + return 1; + } + + return 0; +} + +// Playes given sample buffer. +// return: 0: OK +// 1: error occured +int SoundIF::play(Sample *sbuf, long nofSamples) +{ + if (impl_->dspFd_ < 0) + return 1; + + swapSamples(sbuf, nofSamples); + + long ret; + long len = nofSamples * sizeof(Sample); + long nwritten = 0; + char *buf = (char *)sbuf; + + while (len > 0) { + ret = write(impl_->dspFd_, buf + nwritten, len); + + if (ret <= 0) + return 1; + + nwritten += ret; + len -= ret; + } + + return 0; +} + +unsigned long SoundIF::getDelay() +{ + if (impl_->dspFd_ < 0) + return 1; + +#ifdef SNDCTL_DSP_GETODELAY + int delay; + + if (ioctl(impl_->dspFd_, SNDCTL_DSP_GETODELAY, &delay) == 0) { + return delay / 4; + } +#endif + + return 0; +} + +// Finishs playing, sound device is released. +void SoundIF::end() +{ + impl_->closeDevice(); +} + + +int SoundIFImpl::openDevice() +{ + int flags; + + if (dspFd_ >= 0) + return 0; // already open + + if ((dspFd_ = open("/dev/dsp", O_WRONLY | O_NONBLOCK)) < 0) { + log_message(-1, _("Cannot open \"/dev/dsp\": %s"), strerror(errno)); + return 1; + } + + if ((flags = fcntl(dspFd_, F_GETFL)) >= 0) { + flags &= ~O_NONBLOCK; + fcntl(dspFd_, F_SETFL, flags); + } + + return 0; +} + +void SoundIFImpl::closeDevice() +{ + if (dspFd_ >= 0) { + close(dspFd_); + dspFd_ = -1; + } +} + +int SoundIFImpl::setupDevice() +{ + if (dspFd_ < 0) + return 1; + + int val = 44100; + if (ioctl(dspFd_, SNDCTL_DSP_SPEED, &val) < 0) { + log_message(-1, _("Cannot set sample rate to 44100: %s"), strerror(errno)); + return 1; + } + + val = 2; + if (ioctl(dspFd_, SNDCTL_DSP_CHANNELS, &val) < 0) { + log_message(-1, _("Cannot setup 2 channels: %s"), strerror(errno)); + return 1; + } + + val = AFMT_S16_LE; + if (ioctl(dspFd_, SNDCTL_DSP_SETFMT, &val) < 0) { + log_message(-1, _("Cannot setup sound format: %s"), strerror(errno)); + return 1; + } + + if (val != AFMT_S16_LE) { + log_message(-1, _("Sound device does not support " + "little endian signed 16 bit samples.")); + return 1; + } + + return 0; +} diff --git a/xdao/SoundIF-none.cc b/xdao/SoundIF-none.cc new file mode 100644 index 0000000..093130f --- /dev/null +++ b/xdao/SoundIF-none.cc @@ -0,0 +1,163 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * $Log: SoundIF-none.cc,v $ + * Revision 1.2 2004/02/12 01:13:32 poolshark + * Merge from gnome2 branch + * + * Revision 1.1.1.1.6.1 2004/01/05 00:34:03 poolshark + * First checking of gnome2 port + * + * Revision 1.1.1.1 2003/12/09 05:32:28 denis + * Fooya + * + * Revision 1.1.1.1 2000/02/05 01:39:57 llanero + * Uploaded cdrdao 1.1.3 with pre10 patch applied. + * + * Revision 1.1 1999/05/24 18:07:11 mueller + * Initial revision + * + */ + +/* + * Dummy sound interface for platforms that are not supported, yet. + * May serve as template for new implementations. + */ + +#include "SoundIF.h" + +#include "Sample.h" +#include "util.h" + +class SoundIFImpl { +public: + SoundIFImpl() { dspFd_ = -1; } + + int setupDevice(); + int openDevice(); + void closeDevice(); + + int dspFd_; // sound device +}; + +SoundIF::SoundIF() +{ + impl_ = new SoundIFImpl; +} + +SoundIF::~SoundIF() +{ + delete impl_; + impl_ = NULL; +} + +// Initializes sound interface. +// return: 0: OK +// 1: sounde device not found +// 2: cannot setup sound device +int SoundIF::init() +{ + if (impl_->openDevice() != 0) + return 1; + + if (impl_->setupDevice() != 0) { + impl_->closeDevice(); + return 2; + } + + impl_->closeDevice(); + return 0; +} + +// Acquires sound device for playing. +// return 0: OK +// 1: error occured +int SoundIF::start() +{ + if (impl_->dspFd_ >= 0) + return 0; // already opened + + if (impl_->openDevice() != 0) + return 1; + + if (impl_->setupDevice() != 0) { + impl_->closeDevice(); + return 1; + } + + return 0; +} + +// Playes given sample buffer. +// return: 0: OK +// 1: error occured +int SoundIF::play(Sample *sbuf, long nofSamples) +{ + if (impl_->dspFd_ < 0) + return 1; + + // ... + + return 0; +} + +unsigned long SoundIF::getDelay() +{ + if (impl_->dspFd_ < 0) + return 1; + + // ... + + return 0; +} + +// Finishs playing, sound device is released. +void SoundIF::end() +{ + impl_->closeDevice(); +} + + +int SoundIFImpl::openDevice() +{ + if (dspFd_ >= 0) + return 0; // already open + + // ... + + return 1; +} + +void SoundIFImpl::closeDevice() +{ + if (dspFd_ >= 0) { + // ... + dspFd_ = -1; + } +} + +int SoundIFImpl::setupDevice() +{ + if (dspFd_ < 0) + return 1; + + // ... + + return 0; +} diff --git a/xdao/SoundIF-solaris.cc b/xdao/SoundIF-solaris.cc new file mode 100644 index 0000000..5a74c02 --- /dev/null +++ b/xdao/SoundIF-solaris.cc @@ -0,0 +1,208 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998, 1999 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * $Log: SoundIF-solaris.cc,v $ + * Revision 1.3 2007/12/29 12:31:54 poolshark + * Moved log code into own file, renamed message call + * + * Revision 1.2 2004/02/12 01:13:32 poolshark + * Merge from gnome2 branch + * + * Revision 1.1.1.1.6.2 2004/01/12 20:50:26 poolshark + * Added _( and N_( intl macros + * + * Revision 1.1.1.1.6.1 2004/01/05 00:34:03 poolshark + * First checking of gnome2 port + * + * Revision 1.1.1.1 2003/12/09 05:32:28 denis + * Fooya + * + * Revision 1.1.1.1 2000/02/05 01:40:00 llanero + * Uploaded cdrdao 1.1.3 with pre10 patch applied. + * + * Revision 1.1 1999/05/24 18:07:37 mueller + * Initial revision + * + */ + +/* + * Sound interface for Solaris. Thanks to Tobias Oetiker <oetiker@ee.ethz.ch>. + */ + +#include <sys/audioio.h> +#include <stdio.h> +#include <assert.h> +#include <string.h> +#include <errno.h> +#include <unistd.h> +#include <fcntl.h> +#include <sys/ioctl.h> +#include <sys/types.h> + +#include <gnome.h> + +#include "SoundIF.h" + +#include "Sample.h" +#include "util.h" + +class SoundIFImpl { +public: + SoundIFImpl() { dspFd_ = -1; } + + int setupDevice(); + int openDevice(); + void closeDevice(); + + int dspFd_; // sound device +}; + +SoundIF::SoundIF() +{ + impl_ = new SoundIFImpl; +} + +SoundIF::~SoundIF() +{ + delete impl_; + impl_ = NULL; +} + +// Initializes sound interface. +// return: 0: OK +// 1: sounde device not found +// 2: cannot setup sound device +int SoundIF::init() +{ + if (impl_->openDevice() != 0) + return 1; + + if (impl_->setupDevice() != 0) { + impl_->closeDevice(); + return 2; + } + + impl_->closeDevice(); + return 0; +} + +// Acquires sound device for playing. +// return 0: OK +// 1: error occured +int SoundIF::start() +{ + if (impl_->dspFd_ >= 0) + return 0; // already opened + + if (impl_->openDevice() != 0) + return 1; + + if (impl_->setupDevice() != 0) { + impl_->closeDevice(); + return 1; + } + + return 0; +} + +// Playes given sample buffer. +// return: 0: OK +// 1: error occured +int SoundIF::play(Sample *sbuf, long nofSamples) +{ + if (impl_->dspFd_ < 0) + return 1; + + long ret; + long len = nofSamples * sizeof(Sample); + long nwritten = 0; + char *buf = (char *)sbuf; + + while (len > 0) { + ret = write(impl_->dspFd_, buf + nwritten, len); + + if (ret <= 0) + return 1; + + nwritten += ret; + len -= ret; + } + + return 0; +} + +unsigned long SoundIF::getDelay() +{ + return 0; +} + +// Finishs playing, sound device is released. +void SoundIF::end() +{ + impl_->closeDevice(); +} + + +int SoundIFImpl::openDevice() +{ + if (dspFd_ >= 0) + return 0; // already open + + if ((dspFd_ = open("/dev/audio", O_WRONLY | O_NONBLOCK)) < 0) { + log_message(-1, _("Cannot open \"/dev/audio\": %s"), strerror(errno)); + return 1; + } + /* Clear the non-blocking flag */ + (void) fcntl(dspFd_, F_SETFL, + (fcntl(dspFd_, F_GETFL, 0) & ~(O_NDELAY | O_NONBLOCK))); + + return 0; +} + +void SoundIFImpl::closeDevice() +{ + if (dspFd_ >= 0) { + close(dspFd_); + dspFd_ = -1; + } +} + +int SoundIFImpl::setupDevice() +{ + struct audio_info auinf; + + if (dspFd_ < 0) + return 1; + + if (ioctl(dspFd_, AUDIO_GETINFO, &auinf) < 0) { + log_message(-1, _("Cannot get state of audio interface: %s"), strerror(errno)); + return 1; + } + auinf.play.sample_rate=44100; + auinf.play.channels=2; + auinf.play.precision=16; + auinf.play.encoding=AUDIO_ENCODING_LINEAR; + + if (ioctl(dspFd_, AUDIO_SETINFO, &auinf) < 0) { + log_message(-1, _("Cannot setup audio interface: %s"), strerror(errno)); + return 1; + } + + return 0; +} diff --git a/xdao/SoundIF.h b/xdao/SoundIF.h new file mode 100644 index 0000000..63a3a14 --- /dev/null +++ b/xdao/SoundIF.h @@ -0,0 +1,45 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __SOUND_IF_H__ +#define __SOUND_IF_H__ + +class Sample; + +class SoundIF +{ + public: + SoundIF(); + ~SoundIF(); + + int init(); + + int start(); + + int play(Sample *, long); + + unsigned long getDelay(); + + void end(); + +private: + class SoundIFImpl *impl_; +}; + +#endif diff --git a/xdao/TASKS b/xdao/TASKS new file mode 100644 index 0000000..4f37835 --- /dev/null +++ b/xdao/TASKS @@ -0,0 +1,47 @@ +Status Who Description +====== ====== ============================================================== + +- - Test for enough free disk space before some operations +- - Device Listing class needs "Load" and "Eject" buttons + +- - Detect CD Drive driver automagically. +- - Use Gnome::Dialog for dialogs. + +- Jonas? What we need to pass to cdrecord in fs=# to get the same + buffer size that in cdrdao? + +- - Add a projects dir to cd in by default and a "Current dir" + +- - Create a Project Class that will contain AudioCDChild, + IsoCDChild, ... as needed. + +DONE? Manuel Make RecordGenericDialog. + +- - CD player class that will be able to play from a .toc or + from a CD, including diferent wav files and mixed mode tocs. + So we can use it in a toolbar, in the AudioCDChild, ... + +- - Functions in the trackdb to be able to change the .bin file + on a .toc, to allow reading an image and give it a name later, + or don't give it a name if the user don't wants to save it. + +- Jonas? We should be able to translate it: add gettext support. + +- Andreas Are the .toc files compatibles with CdrWin? + +- - Add extraction to wav and MP3 files directly. For MP3 + encoding we can use LAME http://www.sulaco.org/mp3/ + +- - Write extensive documentation: what's the right way + to do this? docbook? how? + +- - Put a message in the record progress dialog telling: + "Don't panic if the progressbar doesn't update, + the lead in data/track (?) is being written". + +- - "Generate log" option in the record dialog, so we can + dump lots of messages to a file like "log.txt" for later + reviewing. + +- - Don't wait to buffer (on the fly) - option: it should began + to write when you have already 10 audio seconds * speed. diff --git a/xdao/TextEdit.cc b/xdao/TextEdit.cc new file mode 100644 index 0000000..8095683 --- /dev/null +++ b/xdao/TextEdit.cc @@ -0,0 +1,111 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "TextEdit.h" + +#include <stddef.h> +#include <ctype.h> +#include <cstring> + +TextEdit::TextEdit(const char *sample) : Gtk::Entry() +{ + upper_ = 1; + lower_ = 1; + digits_ = 1; + space_ = 1; + + if (sample != NULL && *sample != 0) + setSize(sample); +} + +TextEdit::~TextEdit() +{ +} + +void TextEdit::upperCase(int f) +{ + upper_ = (f != 0) ? 1 : 0; +} + +void TextEdit::lowerCase(int f) +{ + lower_ = (f != 0) ? 1 : 0; +} + +void TextEdit::digits(int f) +{ + digits_ = (f != 0) ? 1 : 0; +} + +void TextEdit::space(int f) +{ + space_ = (f != 0) ? 1 : 0; +} + +void TextEdit::insert_text_impl(const gchar *c, gint p2, gint *p3) +{ + char *s = new char[strlen(c) + 1]; + char *p = s; + + while (*c != 0) { + if (islower(*c)) { + if (!lower_) { + if (upper_) + *p++ = toupper(*c); + } + else + *p++ = *c; + } + else if (isupper(*c)) { + if (!upper_) { + if (lower_) + *p++ = tolower(*c); + } + else + *p++ = *c; + } + else if (isdigit(*c)) { + if (digits_) + *p++ = *c; + } + else if (isspace(*c)) { + if (space_) + *p++ = *c; + } + + c++; + } + + *p = 0; + + insert_text(s, p2, *p3); + + delete[] s; +} + +void TextEdit::setSize(const char *sample) +{ + Glib::RefPtr<Pango::Context> context = get_layout()->get_context(); + Pango::FontDescription fdesc = context->get_font_description(); + + int cw = context->get_metrics(fdesc).get_approximate_char_width() / 1000; + int ch = context->get_metrics(fdesc).get_ascent() / 1000; + + set_size_request((strlen(sample) * cw) + 8, -1); +} diff --git a/xdao/TextEdit.h b/xdao/TextEdit.h new file mode 100644 index 0000000..d93507e --- /dev/null +++ b/xdao/TextEdit.h @@ -0,0 +1,74 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998, 1999 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * $Log: TextEdit.h,v $ + * Revision 1.3 2004/02/12 01:13:32 poolshark + * Merge from gnome2 branch + * + * Revision 1.2.6.1 2004/01/05 00:34:03 poolshark + * First checking of gnome2 port + * + * Revision 1.2 2003/12/29 09:31:48 denis + * fixed all dialogs + * + * Revision 1.1.1.1 2003/12/09 05:32:28 denis + * Fooya + * + * Revision 1.2 2000/02/20 23:34:54 llanero + * fixed scsilib directory (files mising ?-() + * ported xdao to 1.1.8 / gnome (MDI) app + * + * Revision 1.1.1.1 2000/02/05 01:38:51 llanero + * Uploaded cdrdao 1.1.3 with pre10 patch applied. + * + * Revision 1.1 1999/08/19 20:28:12 mueller + * Initial revision + * + */ + +#ifndef __TEXT_EDIT_H__ +#define __TEXT_EDIT_H__ + +#include <gtkmm.h> +#include <gtk/gtk.h> + +class TextEdit : public Gtk::Entry +{ +public: + TextEdit(const char *sample); + ~TextEdit(); + + void upperCase(int); + void lowerCase(int); + void digits(int); + void space(int); + +protected: + virtual void insert_text_impl(const gchar *p1,gint p2,gint *p3); + +private: + unsigned int upper_ : 1; + unsigned int lower_ : 1; + unsigned int digits_ : 1; + unsigned int space_ : 1; + + void setSize(const char *sample); +}; + +#endif diff --git a/xdao/TocEdit.cc b/xdao/TocEdit.cc new file mode 100644 index 0000000..aea1e6a --- /dev/null +++ b/xdao/TocEdit.cc @@ -0,0 +1,1037 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "TocEdit.h" + +#include <stddef.h> +#include <gnome.h> +#include <iostream> +#include <sstream> +#include <set> + +#include "util.h" +#include "Toc.h" +#include "TocEditView.h" +#include "TrackData.h" +#include "TrackDataList.h" +#include "TrackDataScrap.h" + +#include "guiUpdate.h" +#include "SampleManager.h" + +TocEdit::TocEdit(Toc *t, const char *filename) +{ + toc_ = NULL; + sampleManager_ = NULL; + filename_ = NULL; + trackDataScrap_ = NULL; + threadActive_ = false; + curState_ = TE_IDLE; + curConv_ = NULL; + cur_ = NULL; + + updateLevel_ = 0; + editBlocked_ = false; + + if (filename == NULL) + toc(t, "unnamed.toc"); + else + toc(t, filename); +} + +TocEdit::~TocEdit() +{ + if (toc_) + delete toc_; + + if (sampleManager_) + delete sampleManager_; + + if (filename_) + delete[] filename_; + + if (trackDataScrap_) + delete trackDataScrap_; +} + +void TocEdit::toc(Toc *t, const char *filename) +{ + if (toc_) + delete toc_; + + if (t == NULL) + toc_ = new Toc; + else + toc_ = t; + + if (filename != NULL) { + delete[] filename_; + filename_ = strdupCC(filename); + } + + tocDirty_ = false; + editBlocked_ = false; + + if (sampleManager_) + delete sampleManager_; + sampleManager_ = new SampleManager(588); + + sampleManager_->setTocEdit(this); + + if (toc_->length().samples() > 0) { + + // First collect all filenames and queue their conversions to WAV + std::set<std::string> set; + toc_->collectFiles(set); + std::set<std::string>::iterator i = set.begin(); + for (; i != set.end(); i++) + queueConversion((*i).c_str()); + + // Second, queue for toc scan. + unsigned long maxSample = toc_->length().samples() - 1; + queueScan(0, -1); + } + + updateLevel_ = UPD_ALL; +} + +Toc *TocEdit::toc() const +{ + return toc_; +} + +SampleManager *TocEdit::sampleManager() +{ + return sampleManager_; +} + +void TocEdit::tocDirty(bool f) +{ + bool old = tocDirty_; + + tocDirty_ = f; + + if (old != tocDirty_) + updateLevel_ |= UPD_TOC_DIRTY; +} + +void TocEdit::blockEdit() +{ + if (editBlocked_ == 0) + updateLevel_ |= UPD_EDITABLE_STATE; + + editBlocked_ += 1; +} + +void TocEdit::unblockEdit() +{ + if (editBlocked_ > 0) { + editBlocked_ -= 1; + + if (editBlocked_ == 0) + updateLevel_ |= UPD_EDITABLE_STATE; + } +} + +unsigned long TocEdit::updateLevel() +{ + unsigned long level = updateLevel_; + + updateLevel_ = 0; + return level; +} + +unsigned long TocEdit::lengthSample() const +{ + return toc_->length().samples(); +} + +void TocEdit::filename(const char *fname) +{ + if (fname != NULL && *fname != 0) { + char *s = strdupCC(fname); + delete[] filename_; + filename_ = s; + + updateLevel_ |= UPD_TOC_DATA; + } +} + +const char *TocEdit::filename() const +{ + return filename_; +} + + +int TocEdit::readToc(const char *fname) +{ + if (!editable()) + return 0; + + if (fname == NULL || *fname == 0) + return 1; + + Toc *t = Toc::read(fname); + + if (t != NULL) { + + // Check and resolve input files paths + t->resolveFilenames(fname); + + // Sometimes length fields are ommited. Make sure we got everything. + t->recomputeLength(); + + toc(t, fname); + return 0; + } + + return 1; +} + +int TocEdit::saveToc() +{ + int ret = toc_->write(filename_); + + if (ret == 0) + tocDirty(0); + + return ret; +} + +int TocEdit::saveAsToc(const char *fname) +{ + int ret; + + if (fname != NULL && *fname != 0) { + ret = toc_->write(fname); + + if (ret == 0) { + filename(fname); + tocDirty(0); + updateLevel_ |= UPD_TOC_DATA; + } + + return ret; + } + + return 1; +} + + +int TocEdit::moveTrackMarker(int trackNr, int indexNr, long lba) +{ + if (!editable()) + return 0; + + int ret = toc_->moveTrackMarker(trackNr, indexNr, lba); + + if (ret == 0) { + tocDirty(1); + updateLevel_ |= UPD_TRACK_DATA; + } + + return ret; +} + +int TocEdit::addTrackMarker(long lba) +{ + if (!editable()) + return 0; + + int ret = toc_->addTrackMarker(lba); + + if (ret == 0) { + tocDirty(1); +//llanero: different views +// updateLevel_ |= UPD_TOC_DATA | UPD_TRACK_DATA; + } + + return ret; +} + +int TocEdit::addIndexMarker(long lba) +{ + if (!editable()) + return 0; + + int ret = toc_->addIndexMarker(lba); + + if (ret == 0) { + tocDirty(1); +//llanero: different views +// updateLevel_ |= UPD_TRACK_DATA; + } + + return ret; +} + +int TocEdit::addPregap(long lba) +{ + if (!editable()) + return 0; + + int ret = toc_->addPregap(lba); + + if (ret == 0) { + tocDirty(1); +//llanero: different views +// updateLevel_ |= UPD_TRACK_DATA; + } + + return ret; +} + +int TocEdit::removeTrackMarker(int trackNr, int indexNr) +{ + if (!editable()) + return 0; + + int ret = toc_->removeTrackMarker(trackNr, indexNr); + + if (ret == 0) { + tocDirty(1); +//llanero: different views +// updateLevel_ |= UPD_TOC_DATA | UPD_TRACK_DATA; + } + + return ret; +} + +bool TocEdit::curScan() +{ + // An end position of -1 means recompute the toc length and scan to + // the last sample position. + + if (cur_->end == -1) { + // (Denis Leroy) The reason for this code is somewhat + // complex. When importing a CUE file with MP3s, the length of the + // last track is not known until the MP3 is actually converted to + // a WAV (because, unlike TOC files, CUE files don't specify + // explicitely the length of each track). Unlike WAV, you can't + // guess the length of the track based on the mp3 file size + // without scanning the whole thing, which we don't want to do + // twice obviously. So the semantic of the "scan" job is changed + // to integrate a length recalculation when the end is not + // specified. It would be cleaner to create a specific job task to + // do this. + toc_->recomputeLength(); + cur_->end = toc_->length().samples() - 1; + updateLevel_ |= UPD_SAMPLES; + } + int ret = sampleManager_->scanToc(cur_->pos, cur_->end); + + if (ret == 0) + return true; + + if (ret == 2) { + signalError("Unable to open or read from input audio files"); + return false; + } + + return false; +} + +bool TocEdit::curAppendTrack() +{ + TrackData* data; + int ret = curCreateAudioData(&data); + if (ret != 0) + return false; + + TrackDataList list; + long start, end; + list.append(data); + toc_->appendTrack(&list, &start, &end); + tocDirty(1); + sampleManager_->scanToc(Msf(start).samples(), Msf(end).samples() - 1); + return true; +} + +bool TocEdit::curAppendFile() +{ + TrackData* data; + int ret = curCreateAudioData(&data); + if (ret != 0) + return false; + + TrackDataList list; + long start, end; + list.append(data); + if (toc_->appendTrackData(&list, &start, &end) != 0) { + delete data; + return false; + } + tocDirty(1); + sampleManager_->scanToc(Msf(start).samples(), Msf(end).samples() - 1); + return true; +} + +bool TocEdit::curInsertFile() +{ + TrackData* data; + int ret = curCreateAudioData(&data); + if (ret != 0) + return false; + + TrackDataList list; + list.append(data); + if (toc_->insertTrackData(cur_->pos, &list) != 0) { + signalError(_("Cannot insert file into a data track")); + delete data; + return false; + } + cur_->len = list.length(); + sampleManager_->insertSamples(cur_->pos, cur_->len, NULL); + sampleManager_->scanToc(cur_->pos, cur_->pos + cur_->len); + tocDirty(1); + return true; +} + +// Creates an audio data object for given filename. Errors are send to +// status line. +// data: filled with newly allocated TrackData object on success +// return: 0: OK +// 1: cannot open file +// 2: file has wrong format +int TocEdit::curCreateAudioData(TrackData **data) +{ + unsigned long len; + std::string msg; + + switch (TrackData::checkAudioFile(cur_->cfile.c_str(), &len)) { + case 1: + msg = _("Could not open file \""); + msg += cur_->cfile; + msg += "\""; + signalError(msg.c_str()); + return 1; // Cannot open file + + case 2: + msg = _("Could not open file \""); + msg += cur_->cfile; + msg += "\" : wrong file format"; + signalError(msg.c_str()); + return 2; // File format error + } + + *data = new TrackData(cur_->file.c_str(), 0, len); + (*data)->effectiveFilename(cur_->cfile.c_str()); + + return 0; +} + +void TocEdit::curSignalConversionError(FormatSupport::Status err) +{ + std::string msg = _("Unable to decode audio file \""); + msg += cur_->file; + msg += "\" : "; + switch (err) { + case FormatSupport::FS_DISK_FULL: + msg += _("disk is full"); + break; + case FormatSupport::FS_OUTPUT_PROBLEM: + msg += _("error creating output file"); + break; + default: + msg += _("read error or wrong file format"); + } + signalError(msg.c_str()); +} + +void TocEdit::queueConversion(const char* filename) +{ + QueueJob* job = new QueueJob("convert"); + job->file = filename; + queue_.push_back(job); + + if (!threadActive_) + activateQueue(); +} + +void TocEdit::queueAppendTrack(const char* filename) +{ + QueueJob* job = new QueueJob("aptrack"); + job->op = "aptrack"; + job->file = filename; + queue_.push_back(job); + + if (!threadActive_) + activateQueue(); +} + +void TocEdit::queueAppendFile(const char* filename) +{ + QueueJob* job = new QueueJob("apfile"); + job->file = filename; + queue_.push_back(job); + + if (!threadActive_) + activateQueue(); +} + +void TocEdit::queueInsertFile(const char* filename, unsigned long pos) +{ + QueueJob* job = new QueueJob("infile"); + job->file = filename; + job->pos = pos; + queue_.push_back(job); + + if (!threadActive_) + activateQueue(); +} + +void TocEdit::queueScan(long start, long end) +{ + QueueJob* job = new QueueJob("scan"); + job->pos = start; + job->end = end; + queue_.push_back(job); + + if (!threadActive_) + activateQueue(); +} + +void TocEdit::activateQueue() +{ + if (!threadActive_) { + threadActive_ = true; + blockEdit(); + signalCancelEnable(true); + Glib::signal_idle().connect(sigc::mem_fun(*this, + &TocEdit::queueThread)); + guiUpdate(); + } +} + +void TocEdit::queueAbort() +{ + if (threadActive_) { + queue_.clear(); + curState_ = TE_IDLE; + if (curConv_) { + curConv_->convertAbort(); + delete curConv_; + curConv_ = NULL; + signalStatusMessage(""); + } + } +} + +bool TocEdit::isQueueActive() +{ + return threadActive_; +} + +// The queueThread is run by the Gtk idle thread when asynchronous +// work has to be done, such as decoding an MP3 file or reading +// samples from a WAV file. +// +// Asynchronous work (i.e. CPU-intensive work that has do be done in +// the background without blocking the GUI) can be scheduled by adding +// a new QueueJob object in the queue_ (see queueXXX methods above). + +bool TocEdit::queueThread() +{ + static int pulse = 0; + + // If we're idle, pop next queue entry. + if (curState_ == TE_IDLE) { + + // Queue empty ? Stop queue thread. + if (queue_.empty()) { + threadActive_ = false; + unblockEdit(); + signalProgressFraction(0.0); + signalCancelEnable(false); + guiUpdate(); + return false; // false means disconnect idle thread + } + + if (cur_) + delete cur_; + cur_ = queue_.front(); + queue_.pop_front(); + + if (cur_->op == "scan") { + if (curScan()) { + curState_ = TE_READING; + signalStatusMessage("Scanning audio data"); + } else { + curState_ = TE_IDLE; + return true; + } + } else { + + if (curConv_) + delete curConv_; + + FormatSupport::Status err; + curConv_ = formatConverter.newConverterStart(cur_->file.c_str(), + cur_->cfile, &err); + if (curConv_) { + std::string msg = "Decoding audio file "; + msg += cur_->file; + curState_ = TE_CONVERTING; + signalStatusMessage(msg.c_str()); + + } else { + + if (err != FormatSupport::FS_SUCCESS) { + curSignalConversionError(err); + curState_ = TE_IDLE; + return true; + } + // File is already converted, or can't be converted (it's a WAV + // or RAW file already). + if (cur_->cfile.empty()) + cur_->cfile = cur_->file; + curState_ = TE_CONVERTED; + } + } + } + + // ------------------ TE_CONVERTING state: do file format conversion + + if (curState_ == TE_CONVERTING) { + // Perform incremental file conversion. + FormatSupport::Status status = curConv_->convertContinue(); + if (pulse++ > 5) { + signalProgressPulse(); + pulse = 0; + } + + // Still in progress, likely exit here. + if (status == FormatSupport::FS_IN_PROGRESS) + return true; + + // Conversion done. + delete curConv_; + curConv_ = NULL; + + if (status == FormatSupport::FS_SUCCESS) + curState_ = TE_CONVERTED; + else { + curSignalConversionError(status); + // Conversion failed, move on with next queue entry. + curState_ = TE_IDLE; + } + + return true; + } + + // ------------------- TE_CONVERTED state: conversion done, prepare reading + + if (curState_ == TE_CONVERTED) { + + // Sanity check: the cfile (converted filename) will be read as + // either a WAV file or a file containing raw samples. If the + // extension is still that of an encoded audio file, return an + // error. Otherwise it'll be read as a RAW samples file which is + // not was users expect. + + TrackData::FileType ctype = TrackData::audioFileType(cur_->cfile.c_str()); + if (ctype != TrackData::RAW && ctype != TrackData::WAVE) { + std::string msg = _("Cannot decode file"); + msg += " \""; + msg += cur_->cfile; + msg += "\" : "; + msg += _("unsupported audio format"); + signalError(msg.c_str()); + curState_ = TE_IDLE; + return true; + } + + // If all we wanted to do was format conversion, we're done. + if (cur_->op == "convert") { + toc_->markFileConversion(cur_->file.c_str(), cur_->cfile.c_str()); + curState_ = TE_IDLE; + return true; + } + + curState_ = TE_READING; + signalProgressFraction(0.0); + + if (cur_->op == "aptrack") { + if (!curAppendTrack()) { + curState_ = TE_IDLE; + return true; + } + } else if (cur_->op == "apfile") { + if (!curAppendFile()) { + curState_ = TE_IDLE; + return true; + } + + } else if (cur_->op == "infile") { + if (!curInsertFile()) { + curState_ = TE_IDLE; + return true; + } + } + + std::string msg = "Scanning audio file "; + msg += cur_->file; + signalStatusMessage(msg.c_str()); + } + + // ------------------- TE_READING state : read/scan WAV samples + + if (curState_ == TE_READING) { + + int result = sampleManager_->readSamples(); + + if (result != 0) { + + if (result < 0) + signalError(_("An error occured while reading audio data")); + + else { + // Post operating code here. + if (cur_->op == "aptrack") { + updateLevel_ |= UPD_TOC_DATA | UPD_TRACK_DATA; + signalFullView(); + std::string msg = "Appended track "; + msg += cur_->file; + signalStatusMessage(msg.c_str()); + guiUpdate(); + } else if (cur_->op == "apfile") { + updateLevel_ |= UPD_TOC_DATA | UPD_TRACK_DATA; + signalFullView(); + std::string msg = "Appended file "; + msg += cur_->file; + signalStatusMessage(msg.c_str()); + guiUpdate(); + } else if (cur_->op == "infile") { + updateLevel_ |= UPD_TOC_DATA | UPD_TRACK_DATA | UPD_SAMPLE_SEL; + signalFullView(); + std::string msg = "Inserted file "; + msg += cur_->file; + signalStatusMessage(msg.c_str()); + signalSampleSelection(cur_->pos, cur_->pos + cur_->len - 1); + guiUpdate(); + } else if (cur_->op == "scan") { + std::stringstream ss; + ss << "Scanned "; + ss << (cur_->end - cur_->pos + 1); + ss << " samples of data"; + std::string msg = ss.str(); + signalStatusMessage(msg.c_str()); + updateLevel_ |= UPD_SAMPLES; + } + } + curState_ = TE_IDLE; + } + return true; + } + return true; +} + +int TocEdit::appendSilence(unsigned long length) +{ + if (!editable()) + return 0; + + if (length > 0) { + long start, end; + + TrackData *data = new TrackData(length); + TrackDataList list; + list.append(data); + + if (toc_->appendTrackData(&list, &start, &end) == 0) { + + sampleManager_->scanToc(Msf(start).samples(), Msf(end).samples() - 1, + true); + + tocDirty(1); + updateLevel_ |= UPD_TOC_DATA | UPD_TRACK_DATA; + } + } + + return 0; +} + +// Return: 0: OK +// 1: No modify allowed +// 2: error? +int TocEdit::insertSilence(unsigned long length, unsigned long pos) +{ + if (!editable()) + return 1; + + if (length > 0) { + TrackData *data = new TrackData(length); + TrackDataList list; + + list.append(data); + + if (toc_->insertTrackData(pos, &list) == 0) { + sampleManager_->insertSamples(pos, length, NULL); + sampleManager_->scanToc(pos, pos + length, true); + + tocDirty(1); + updateLevel_ |= UPD_TOC_DATA | UPD_TRACK_DATA | UPD_SAMPLE_SEL; + return 0; + } + } + + return 2; +} + + +void TocEdit::setTrackCopyFlag(int trackNr, int flag) +{ + if (!editable()) + return; + + Track *t = toc_->getTrack(trackNr); + + if (t != NULL) { + t->copyPermitted(flag); + tocDirty(1); + updateLevel_ |= UPD_TRACK_DATA; + } +} + +void TocEdit::setTrackPreEmphasisFlag(int trackNr, int flag) +{ + if (!editable()) + return; + + Track *t = toc_->getTrack(trackNr); + + if (t != NULL) { + t->preEmphasis(flag); + tocDirty(1); + updateLevel_ |= UPD_TRACK_DATA; + } +} + +void TocEdit::setTrackAudioType(int trackNr, int flag) +{ + if (!editable()) + return; + + Track *t = toc_->getTrack(trackNr); + + if (t != NULL) { + t->audioType(flag); + tocDirty(1); + updateLevel_ |= UPD_TRACK_DATA; + } + +} + +void TocEdit::setTrackIsrcCode(int trackNr, const char *s) +{ + if (!editable()) + return; + + Track *t = toc_->getTrack(trackNr); + + if (t != NULL) { + if (t->isrc(s) == 0) { + tocDirty(1); + updateLevel_ |= UPD_TRACK_DATA; + } + } +} + +void TocEdit::setCdTextItem(int trackNr, CdTextItem::PackType type, + int blockNr, const char *s) +{ + if (!editable()) + return; + + if (s != NULL) { + CdTextItem *item = new CdTextItem(type, blockNr, s); + + toc_->addCdTextItem(trackNr, item); + } + else { + toc_->removeCdTextItem(trackNr, type, blockNr); + } + + tocDirty(1); + + updateLevel_ |= (trackNr == 0) ? UPD_TOC_DATA : UPD_TRACK_DATA; + +} + +void TocEdit::setCdTextGenreItem(int blockNr, int code1, int code2, + const char *description) +{ + if (code1 > 255 || code2 > 255) + return; + + if (!editable()) + return; + + if (code1 < 0 || code2 < 0) { + toc_->removeCdTextItem(0, CdTextItem::CDTEXT_GENRE, blockNr); + } + else { + CdTextItem *item = new CdTextItem(blockNr, (unsigned char)code1, + (unsigned char)code2, description); + + toc_->addCdTextItem(0, item); + } + + tocDirty(1); + + updateLevel_ |= UPD_TOC_DATA; +} + + +void TocEdit::setCdTextLanguage(int blockNr, int langCode) +{ + if (!editable()) + return; + + toc_->cdTextLanguage(blockNr, langCode); + tocDirty(1); + + updateLevel_ |= UPD_TOC_DATA; + +} + +void TocEdit::setCatalogNumber(const char *s) +{ + if (!editable()) + return; + + if (toc_->catalog(s) == 0) { + tocDirty(1); + updateLevel_ |= UPD_TOC_DATA; + } + +} + +void TocEdit::setTocType(Toc::TocType type) +{ + if (!editable()) + return; + + toc_->tocType(type); + tocDirty(1); + updateLevel_ |= UPD_TOC_DATA; +} + + +// Removes selected track data +// Return: 0: OK +// 1: no selection +// 2: selection crosses track boundaries +// 3: cannot modify data track +int TocEdit::removeTrackData(TocEditView *view) +{ + TrackDataList *list; + unsigned long selMin, selMax; + + if (!editable()) + return 0; + + if (!view->sampleSelection(&selMin, &selMax)) + return 1; + + switch (toc_->removeTrackData(selMin, selMax, &list)) { + case 0: + if (list != NULL) { + if (list->length() > 0) { + delete trackDataScrap_; + trackDataScrap_ = new TrackDataScrap(list); + } + else { + delete list; + } + + sampleManager_->removeSamples(selMin, selMax, trackDataScrap_); + + view->sampleSelectionClear(); + view->sampleMarker(selMin); + + tocDirty(1); + } + break; + + case 1: + return 2; + break; + + case 2: + return 3; + break; + } + return 0; +} + +// Inserts track data from scrap +// Return: 0: OK +// 1: no scrap data to paste +int TocEdit::insertTrackData(TocEditView *view) + +{ + if (!editable()) + return 0; + + if (trackDataScrap_ == NULL) + return 1; + + unsigned long len = trackDataScrap_->trackDataList()->length(); + unsigned long marker; + + if (view->sampleMarker(&marker) && marker < toc_->length().samples()) { + if (toc_->insertTrackData(marker, trackDataScrap_->trackDataList()) + == 0) { + + sampleManager_->insertSamples(marker, len, trackDataScrap_); + sampleManager_->scanToc(marker, marker, true); + sampleManager_->scanToc(marker + len - 1, marker + len - 1, true); + + view->sampleSelect(marker, marker + len - 1); + + tocDirty(1); +//llanero: different views +// updateLevel_ |= UPD_TOC_DATA | UPD_TRACK_DATA | UPD_SAMPLE_SEL; + } + } + else { + long start, end; + + if (toc_->appendTrackData(trackDataScrap_->trackDataList(), &start, &end) + == 0) { + + sampleManager_->insertSamples(Msf(start).samples(), + Msf(end - start).samples(), + trackDataScrap_); + + sampleManager_->scanToc(Msf(start).samples(), Msf(start).samples(), + true); + if (end > 0) + sampleManager_->scanToc(Msf(start).samples() + len, + Msf(end).samples() - 1, true); + + view->sampleSelect(Msf(start).samples(), Msf(end).samples() - 1); + + tocDirty(1); + updateLevel_ |= UPD_TOC_DATA | UPD_TRACK_DATA | UPD_SAMPLE_SEL; + } + } + return 0; +} diff --git a/xdao/TocEdit.h b/xdao/TocEdit.h new file mode 100644 index 0000000..26209fe --- /dev/null +++ b/xdao/TocEdit.h @@ -0,0 +1,157 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998, 1999 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __TOC_EDIT_H__ +#define __TOC_EDIT_H__ + +#include <string> +#include <list> +#include <sigc++/signal.h> + +#include "Toc.h" +#include "CdTextItem.h" +#include "FormatConverter.h" + +class Toc; +class TrackData; +class TrackDataScrap; +class SampleManager; +class TocEditView; + +class TocEdit { +public: + TocEdit(Toc *, const char *); + ~TocEdit(); + + void toc(Toc *, const char *); + Toc *toc() const; + + SampleManager *sampleManager(); + + unsigned long lengthSample() const; + + void tocDirty(bool); + bool tocDirty() const { return tocDirty_; } + + void blockEdit(); + void unblockEdit(); + bool editable() const { return (editBlocked_ == 0); } + + // returns and resets update level + unsigned long updateLevel(); + + void filename(const char *); + const char *filename() const; + + int readToc(const char *); + int saveToc(); + int saveAsToc(const char *); + + int moveTrackMarker(int trackNr, int indexNr, long lba); + int addTrackMarker(long lba); + int removeTrackMarker(int trackNr, int indexNr); + int addIndexMarker(long lba); + int addPregap(long lba); + + // Asynchronous interface. + void queueConversion(const char* filename); + void queueAppendTrack(const char* filename); + void queueAppendFile(const char* filename); + void queueInsertFile(const char* filename, unsigned long pos); + void queueScan(long start, long end); + + // Abort all queued work. + void queueAbort(); + + // Is queue active + bool isQueueActive(); + + int appendSilence(unsigned long); + int insertSilence(unsigned long length, unsigned long pos); + + int removeTrackData(TocEditView *); + int insertTrackData(TocEditView *); + + void setTrackCopyFlag(int trackNr, int flag); + void setTrackPreEmphasisFlag(int trackNr, int flag); + void setTrackAudioType(int trackNr, int flag); + void setTrackIsrcCode(int trackNr, const char *); + + void setCdTextItem(int trackNr, CdTextItem::PackType, int blockNr, + const char *); + void setCdTextGenreItem(int blockNr, int code1, int code2, + const char *description); + void setCdTextLanguage(int blockNr, int langCode); + + void setCatalogNumber(const char *); + void setTocType(Toc::TocType); + + // Signals + sigc::signal0<void> signalProgressPulse; + sigc::signal1<void, double> signalProgressFraction; + sigc::signal1<void, const char*> signalStatusMessage; + sigc::signal0<void> signalFullView; + sigc::signal2<void, unsigned long, unsigned long> signalSampleSelection; + sigc::signal1<void, bool> signalCancelEnable; + sigc::signal1<void, const char*> signalError; + +private: + Toc *toc_; + SampleManager *sampleManager_; + + char *filename_; + + TrackDataScrap *trackDataScrap_; + + bool tocDirty_; + int editBlocked_; + + unsigned long updateLevel_; + + class QueueJob { + public: + QueueJob(const char* o) { op = o; } + ~QueueJob() {} + std::string op; + std::string file; + std::string cfile; + long pos; + long end; + long len; + }; + + std::list<QueueJob*> queue_; + QueueJob* cur_; + bool threadActive_; + enum { TE_IDLE, TE_CONVERTING, TE_CONVERTED, TE_READING } curState_; + FormatSupport* curConv_; + + bool curScan(); + bool curAppendTrack(); + bool curAppendFile(); + bool curInsertFile(); + int curCreateAudioData(TrackData **); + void curSignalConversionError(FormatSupport::Status); + void activateQueue(); + bool queueThread(); + + friend class TocEditView; +}; + +#endif diff --git a/xdao/TocEditView.cc b/xdao/TocEditView.cc new file mode 100644 index 0000000..e7e25d1 --- /dev/null +++ b/xdao/TocEditView.cc @@ -0,0 +1,211 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "TocEditView.h" + +#include <stddef.h> + +#include "guiUpdate.h" +#include "TocEdit.h" + +TocEditView::TocEditView(TocEdit *t) +{ + tocEdit_ = t; + + sampleMarkerValid_ = false; + sampleSelectionValid_ = false; + sampleViewMin_ = sampleViewMax_ = 0; + trackSelectionValid_ = 0; + indexSelectionValid_ = 0; +} + +TocEditView::~TocEditView() +{ + tocEdit_ = 0; +} + +TocEdit *TocEditView::tocEdit() const +{ + return tocEdit_; +} + + +void TocEditView::sampleMarker(unsigned long sample) +{ + if (sample < tocEdit_->toc()->length().samples()) { + sampleMarker_ = sample; + sampleMarkerValid_ = true; + } + else { + sampleMarkerValid_ = false; + } +} + +bool TocEditView::sampleMarker(unsigned long *sample) const +{ + if (sampleMarkerValid_) + *sample = sampleMarker_; + + return sampleMarkerValid_; +} + +void TocEditView::sampleSelectAll() +{ + unsigned long slength = tocEdit_->toc()->length().samples(); + + if (slength) { + sampleSelectionMin_ = 0; + sampleSelectionMax_ = slength - 1; + sampleSelectionValid_ = true; + } +} + +void TocEditView::sampleSelect(unsigned long smin, unsigned long smax) +{ + unsigned long tmp; + + if (smin > smax) { + tmp = smin; + smin = smax; + smax = tmp; + } + + if (smax < tocEdit_->toc()->length().samples()) { + sampleSelectionMin_ = smin; + sampleSelectionMax_ = smax; + + sampleSelectionValid_ = true; + } + else { + sampleSelectionValid_ = false; + } +} + +bool TocEditView::sampleSelectionClear() +{ + if (sampleSelectionValid_) { + sampleSelectionValid_ = false; + return true; + } + return false; +} + +bool TocEditView::sampleSelection(unsigned long *smin, + unsigned long *smax) const +{ + if (sampleSelectionValid_) { + *smin = sampleSelectionMin_; + *smax = sampleSelectionMax_; + } + + return sampleSelectionValid_; +} + +bool TocEditView::sampleView(unsigned long smin, unsigned long smax) +{ + if (smin <= smax && smax < tocEdit_->lengthSample()) { + sampleViewMin_ = smin; + sampleViewMax_ = smax; + return true; + } + return false; +} + +void TocEditView::sampleView(unsigned long *smin, unsigned long *smax) const +{ + *smin = sampleViewMin_; + *smax = sampleViewMax_; +} + +void TocEditView::sampleViewFull() +{ + sampleViewMin_ = 0; + + if ((sampleViewMax_ = tocEdit_->lengthSample()) > 0) + sampleViewMax_ -= 1; +} + +void TocEditView::sampleViewUpdate() +{ + if (sampleViewMax_ >= tocEdit_->lengthSample()) { + unsigned long len = sampleViewMax_ - sampleViewMin_; + + if ((sampleViewMax_ = tocEdit_->lengthSample()) > 0) + sampleViewMax_ -= 1; + + + if (sampleViewMax_ >= len) + sampleViewMin_ = sampleViewMax_ - len; + else + sampleViewMin_ = 0; + + tocEdit_->updateLevel_ |= UPD_SAMPLES; + } +} + +void TocEditView::sampleViewInclude(unsigned long smin, unsigned long smax) +{ + if (smin < sampleViewMin_) { + sampleViewMin_ = smin; + tocEdit_->updateLevel_ |= UPD_SAMPLES; + } + + if (smax < tocEdit_->lengthSample() && smax > sampleViewMax_) { + sampleViewMax_ = smax; + tocEdit_->updateLevel_ |= UPD_SAMPLES; + } +} + +void TocEditView::trackSelection(int tnum) +{ + if (tnum > 0) { + trackSelection_ = tnum; + trackSelectionValid_ = 1; + } + else { + trackSelectionValid_ = 0; + } +} + +int TocEditView::trackSelection(int *tnum) const +{ + if (trackSelectionValid_) + *tnum = trackSelection_; + + return trackSelectionValid_; +} + +void TocEditView::indexSelection(int inum) +{ + if (inum >= 0) { + indexSelection_ = inum; + indexSelectionValid_ = 1; + } + else { + indexSelectionValid_ = 0; + } +} + +int TocEditView::indexSelection(int *inum) const +{ + if (indexSelectionValid_) + *inum = indexSelection_; + + return indexSelectionValid_; +} diff --git a/xdao/TocEditView.h b/xdao/TocEditView.h new file mode 100644 index 0000000..6b22c29 --- /dev/null +++ b/xdao/TocEditView.h @@ -0,0 +1,73 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __TOC_EDIT_VIEW_H__ +#define __TOC_EDIT_VIEW_H__ + +class TocEdit; + +class TocEditView { +public: + TocEditView(TocEdit *); + ~TocEditView(); + + TocEdit *tocEdit() const; + + void sampleMarker(unsigned long); + bool sampleMarker(unsigned long *) const; + + void sampleSelect(unsigned long, unsigned long); + void sampleSelectAll(); + bool sampleSelection(unsigned long *, unsigned long *) const; + bool sampleSelectionClear(); + + void sampleViewFull(); + void sampleViewUpdate(); + void sampleViewInclude(unsigned long, unsigned long); + void sampleView(unsigned long *, unsigned long *) const; + bool sampleView(unsigned long smin, unsigned long smax); + + void trackSelection(int); + int trackSelection(int *) const; + + void indexSelection(int); + int indexSelection(int *) const; + +private: + TocEdit *tocEdit_; + + bool sampleMarkerValid_; + unsigned long sampleMarker_; + + bool sampleSelectionValid_; + unsigned long sampleSelectionMin_; + unsigned long sampleSelectionMax_; + + unsigned long sampleViewMin_; + unsigned long sampleViewMax_; + + int trackSelectionValid_; + int trackSelection_; + + int indexSelectionValid_; + int indexSelection_; + +}; + +#endif diff --git a/xdao/TocInfoDialog.cc b/xdao/TocInfoDialog.cc new file mode 100644 index 0000000..8c90eb1 --- /dev/null +++ b/xdao/TocInfoDialog.cc @@ -0,0 +1,1036 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "TocInfoDialog.h" + +#include <gtkmm.h> +#include <gnome.h> + +#include <stdio.h> +#include <stddef.h> +#include <ctype.h> + +#include "TocEdit.h" +//#include "TocEditView.h" +#include "guiUpdate.h" +#include "Toc.h" +#include "CdTextItem.h" +#include "TextEdit.h" + +#define MAX_CD_TEXT_LANGUAGE_CODES 22 + +struct LanguageCode { + int code; + const char *name; +}; + +static LanguageCode CD_TEXT_LANGUAGE_CODES[MAX_CD_TEXT_LANGUAGE_CODES] = { + { -1, "Unknown" }, + { -1, "Undefined" }, + { 0x75, "Chinese" }, + { 0x06, "Czech" }, + { 0x07, "Danish" }, + { 0x1d, "Dutch" }, + { 0x09, "English" }, + { 0x27, "Finnish" }, + { 0x0f, "French" }, + { 0x08, "German" }, + { 0x70, "Greek" }, + { 0x1b, "Hungarian" }, + { 0x15, "Italian" }, + { 0x69, "Japanese" }, + { 0x65, "Korean" }, + { 0x1e, "Norwegian" }, + { 0x20, "Polish" }, + { 0x21, "Portuguese" }, + { 0x56, "Russian" }, + { 0x26, "Slovene" }, + { 0x0a, "Spanish" }, + { 0x28, "Swedish" } +}; + +#define MAX_CD_TEXT_GENRE_CODES 28 + +struct GenreCode { + int code1; + int code2; + const char *name; +}; + +static GenreCode CD_TEXT_GENRE_CODES[MAX_CD_TEXT_GENRE_CODES] = { + { -1, -1, "Unknown" }, + { -1, -1, "Not Used" }, + { 0x00, 0x01, "Not Defined" }, + { 0x00, 0x02, "Adult Contemporary" }, + { 0x00, 0x03, "Alternative Rock" }, + { 0x00, 0x04, "Children's Music" }, + { 0x00, 0x05, "Classical" }, + { 0x00, 0x07, "Country" }, + { 0x00, 0x08, "Dance" }, + { 0x00, 0x09, "Easy Listening" }, + { 0x00, 0x0a, "Erotic" }, + { 0x00, 0x0b, "Folk" }, + { 0x00, 0x0c, "Gospel" }, + { 0x00, 0x0d, "Hip Hop" }, + { 0x00, 0x0e, "Jazz" }, + { 0x00, 0x0f, "Latin" }, + { 0x00, 0x10, "Musical" }, + { 0x00, 0x11, "New Age" }, + { 0x00, 0x12, "Opera" }, + { 0x00, 0x13, "Operetta" }, + { 0x00, 0x14, "Pop Music" }, + { 0x00, 0x15, "RAP" }, + { 0x00, 0x16, "Reggae" }, + { 0x00, 0x17, "Rock Music" }, + { 0x00, 0x19, "Sound Effects" }, + { 0x00, 0x1a, "Sound Track" }, + { 0x00, 0x1b, "Spoken Word" }, + { 0x00, 0x1c, "World Music" } +}; + +TocInfoDialog::TocInfoDialog(Gtk::Window* parent) +{ + int i; + Gtk::Label *label; + Gtk::HBox *hbox; + Gtk::VBox *vbox, *vbox1; + Gtk::Frame *frame; + Gtk::Table *table; + Gtk::Button *button; + Gtk::VBox *contents = manage(new Gtk::VBox); + + tocEdit_ = NULL; + active_ = false; + selectedTocType_ = Toc::CD_DA; + + nofTracks_ = manage(new Gtk::Label("99")); + nofTracks_->set_alignment(Gtk::ALIGN_LEFT); + tocLength_ = manage(new Gtk::Label("100:00:00")); + tocLength_->set_alignment(Gtk::ALIGN_LEFT); + + catalog_ = manage(new TextEdit("1234567890123")); + catalog_->set_max_length(13); + catalog_->lowerCase(0); + catalog_->upperCase(0); + catalog_->space(0); + catalog_->digits(1); + + Gtk::Menu *menu = manage(new Gtk::Menu); + Gtk::MenuItem *mi; + + mi = manage(new Gtk::MenuItem("CD-DA")); + mi->signal_activate(). + connect(bind(mem_fun(*this, &TocInfoDialog::setSelectedTocType), Toc::CD_DA)); + menu->append(*mi); + + mi = manage(new Gtk::MenuItem("CD-ROM")); + mi->signal_activate(). + connect(bind(mem_fun(*this, &TocInfoDialog::setSelectedTocType),Toc::CD_ROM)); + menu->append(*mi); + + mi = manage(new Gtk::MenuItem("CD-ROM-XA")); + mi->signal_activate(). + connect(bind(mem_fun(*this, &TocInfoDialog::setSelectedTocType), + Toc::CD_ROM_XA)); + menu->append(*mi); + + mi = manage(new Gtk::MenuItem("CD-I")); + mi->signal_activate(). + connect(bind(mem_fun(*this, &TocInfoDialog::setSelectedTocType), Toc::CD_I)); + menu->append(*mi); + + tocType_ = manage(new Gtk::OptionMenu); + tocType_->set_menu(*menu); + + contents->set_spacing(10); + + // Summary frame (time & data) + frame = manage(new Gtk::Frame(_(" Summary "))); + table = manage(new Gtk::Table(2, 2, false)); + table->set_border_width(5); + table->set_row_spacings(5); + table->set_col_spacings(5); + label = manage(new Gtk::Label(_("Tracks:"))); + table->attach(*label, 0, 1, 0, 1, Gtk::SHRINK); + table->attach(*nofTracks_, 1, 2, 0, 1, Gtk::FILL | Gtk::SHRINK); + label = manage(new Gtk::Label(_("Length:"))); + table->attach(*label, 0, 1, 1, 2, Gtk::SHRINK); + table->attach(*tocLength_, 1, 2, 1, 2, Gtk::FILL | Gtk::SHRINK); + frame->add(*table); + contents->pack_start(*frame, false, false); + + // Sub-channel frame + frame = manage(new Gtk::Frame(_(" Sub-Channel "))); + table = manage(new Gtk::Table(2, 2, false)); + table->set_border_width(5); + table->set_row_spacings(5); + table->set_col_spacings(5); + label = manage(new Gtk::Label(_("Toc Type: "))); + table->attach(*label, 0, 1, 0, 1, Gtk::SHRINK); + table->attach(*tocType_, 1, 2, 0, 1); + label = manage(new Gtk::Label("UPC/EAN: ")); + table->attach(*label, 0, 1, 1, 2, Gtk::SHRINK); + table->attach(*catalog_, 1, 2, 1, 2); + frame->add(*table); + contents->pack_start(*frame, Gtk::PACK_SHRINK); + + // CD-TEXT data + frame = manage(new Gtk::Frame(" CD-TEXT ")); + + Gtk::Notebook *notebook = manage(new Gtk::Notebook); + + for (i = 0; i < 8; i++) { + vbox = createCdTextPage(i); + notebook->pages().push_back(Gtk::Notebook_Helpers::TabElem(*vbox, *(cdTextPages_[i].label))); + } + + vbox1 = manage(new Gtk::VBox); + vbox1->pack_start(*notebook, false, false, 5); + hbox = manage(new Gtk::HBox); + hbox->pack_start(*vbox1, true, true, 5); + frame->add(*hbox); + + contents->pack_start(*frame, Gtk::PACK_SHRINK); + + hbox = manage(new Gtk::HBox); + hbox->pack_start(*contents, true, true, 10); + get_vbox()->pack_start(*hbox, true, true, 10); + + Gtk::HButtonBox *bbox = manage(new Gtk::HButtonBox(Gtk::BUTTONBOX_SPREAD)); + + applyButton_ = manage(new Gtk::Button(Gtk::StockID(Gtk::Stock::APPLY))); + bbox->pack_start(*applyButton_); + applyButton_->signal_clicked().connect(sigc::mem_fun(*this,&TocInfoDialog::applyAction)); + + button = manage(new Gtk::Button(Gtk::StockID(Gtk::Stock::CLOSE))); + bbox->pack_start(*button); + button->signal_clicked().connect(sigc::mem_fun(*this,&TocInfoDialog::closeAction)); + + get_action_area()->pack_start(*bbox); + show_all_children(); + + set_title(_("Project Info")); + set_transient_for(*parent); +} + +TocInfoDialog::~TocInfoDialog() +{ +} + +void TocInfoDialog::start(TocEdit *view) +{ + present(); + active_ = true; + update(UPD_ALL, view); +} + +void TocInfoDialog::stop() +{ + hide(); + active_ = false; +} + +void TocInfoDialog::setSelectedTocType(Toc::TocType t) +{ + selectedTocType_ = t; +} + +void TocInfoDialog::setSelectedCDTextLanguage(BlockValue val) +{ + int i; + int found; + + if (val.block < 0 || val.block >= 8) + return; + + if (val.value == 0) { + // cannot set to 'unknown', restore old setting + if (cdTextPages_[val.block].selectedLanguage != 0) + cdTextPages_[val.block].language->set_history(cdTextPages_[val.block].selectedLanguage); + + return; + } + + if (val.value != 1) { + // check if same language is alread used + found = 0; + + for (i = 0; i < 8; i++) { + if (i != val.block && cdTextPages_[i].selectedLanguage == val.value) { + found = 1; + break; + } + } + + if (found || + (val.block > 0 && + cdTextPages_[val.block - 1].selectedLanguage == 1)) { + // reset to old value if the same language is already used or + // if the language of the previous block is undefined + cdTextPages_[val.block].language->set_history(cdTextPages_[val.block].selectedLanguage); + return; + } + } + + cdTextPages_[val.block].selectedLanguage = val.value; +} + +void TocInfoDialog::setSelectedCDTextGenre(BlockValue val) +{ + if (val.block < 0 || val.block >= 8) + return; + + if (val.value == 0) { + // cannot set to 'unknown', restore old setting + if (cdTextPages_[val.block].selectedGenre != 0) + cdTextPages_[val.block].genre->set_history(cdTextPages_[val.block].selectedGenre); + + return; + } + + cdTextPages_[val.block].selectedGenre = val.value; +} + +void TocInfoDialog::createCdTextLanguageMenu(int n) +{ + BlockValue bval; + int i; + + bval.block = n; + + Gtk::Menu *menu = manage(new Gtk::Menu); + Gtk::MenuItem *mi; + + for (i = 0; i < MAX_CD_TEXT_LANGUAGE_CODES; i++) { + bval.value = i; + + mi = manage(new Gtk::MenuItem(CD_TEXT_LANGUAGE_CODES[i].name)); + mi->signal_activate().connect(bind(mem_fun(*this, &TocInfoDialog::setSelectedCDTextLanguage), bval)); + mi->show(); + menu->append(*mi); + } + + cdTextPages_[n].language = manage(new Gtk::OptionMenu); + cdTextPages_[n].language->set_menu(*menu); +} + +void TocInfoDialog::createCdTextGenreMenu(int n) +{ + BlockValue bval; + int i; + + bval.block = n; + + Gtk::Menu *menu = manage(new Gtk::Menu); + Gtk::MenuItem *mi; + + for (i = 0; i < MAX_CD_TEXT_GENRE_CODES; i++) { + bval.value = i; + + mi = manage(new Gtk::MenuItem(CD_TEXT_GENRE_CODES[i].name)); + mi->signal_activate().connect(bind(mem_fun(*this, &TocInfoDialog::setSelectedCDTextGenre), bval)); + mi->show(); + menu->append(*mi); + } + + cdTextPages_[n].genre = manage(new Gtk::OptionMenu); + cdTextPages_[n].genre->set_menu(*menu); +} + + +Gtk::VBox *TocInfoDialog::createCdTextPage(int n) +{ + char buf[20]; + Gtk::Table *table = manage(new Gtk::Table(11, 2, false)); + Gtk::VBox *vbox1; + Gtk::HBox *hbox; + Gtk::Label *label; + + sprintf(buf, " %d ", n); + cdTextPages_[n].label = manage(new Gtk::Label(buf)); + cdTextPages_[n].label->show(); + + cdTextPages_[n].title = manage(new Gtk::Entry); + cdTextPages_[n].performer = manage(new Gtk::Entry); + cdTextPages_[n].songwriter = manage(new Gtk::Entry); + cdTextPages_[n].composer = manage(new Gtk::Entry); + cdTextPages_[n].arranger = manage(new Gtk::Entry); + cdTextPages_[n].message = manage(new Gtk::Entry); + cdTextPages_[n].catalog = manage(new Gtk::Entry); + cdTextPages_[n].upcEan = manage(new Gtk::Entry); + cdTextPages_[n].genreInfo = manage(new Gtk::Entry); + + createCdTextLanguageMenu(n); + createCdTextGenreMenu(n); + + table->set_row_spacings(5); + table->set_col_spacings(5); + table->show(); + + label = manage(new Gtk::Label(_("Language:"))); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, Gtk::PACK_SHRINK); + table->attach(*hbox, 0, 1, 0, 1, Gtk::FILL); + hbox->show(); + label->show(); + table->attach(*(cdTextPages_[n].language), 1, 2, 0, 1); + cdTextPages_[n].language->show(); + + label = manage(new Gtk::Label(_("Title:"))); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, Gtk::PACK_SHRINK); + table->attach(*hbox, 0, 1, 1, 2, Gtk::FILL); + hbox->show(); + label->show(); + table->attach(*(cdTextPages_[n].title), 1, 2, 1, 2); + cdTextPages_[n].title->show(); + + label = manage(new Gtk::Label(_("Performer:"))); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, Gtk::PACK_SHRINK); + table->attach(*hbox, 0, 1, 2, 3, Gtk::FILL); + hbox->show(); + label->show(); + table->attach(*(cdTextPages_[n].performer), 1, 2, 2, 3); + cdTextPages_[n].performer->show(); + + label = new Gtk::Label(_("Songwriter:")); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, Gtk::PACK_SHRINK); + table->attach(*hbox, 0, 1, 3, 4, Gtk::FILL); + hbox->show(); + label->show(); + table->attach(*(cdTextPages_[n].songwriter), 1, 2, 3, 4); + cdTextPages_[n].songwriter->show(); + + label = new Gtk::Label(_("Composer:")); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, Gtk::PACK_SHRINK); + table->attach(*hbox, 0, 1, 4, 5, Gtk::FILL); + hbox->show(); + label->show(); + table->attach(*(cdTextPages_[n].composer), 1, 2, 4, 5); + cdTextPages_[n].composer->show(); + + label = new Gtk::Label(_("Arranger:")); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, Gtk::PACK_SHRINK); + table->attach(*hbox, 0, 1, 5, 6, Gtk::FILL); + hbox->show(); + label->show(); + table->attach(*(cdTextPages_[n].arranger), 1, 2, 5, 6); + cdTextPages_[n].arranger->show(); + + label = new Gtk::Label(_("Message:")); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, Gtk::PACK_SHRINK); + table->attach(*hbox, 0, 1, 6, 7, Gtk::FILL); + hbox->show(); + label->show(); + table->attach(*(cdTextPages_[n].message), 1, 2, 6, 7); + cdTextPages_[n].message->show(); + + label = new Gtk::Label(_("Catalog:")); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, Gtk::PACK_SHRINK); + table->attach(*hbox, 0, 1, 7, 8, Gtk::FILL); + hbox->show(); + label->show(); + table->attach(*(cdTextPages_[n].catalog), 1, 2, 7, 8); + cdTextPages_[n].catalog->show(); + + label = new Gtk::Label("UPC/EAN:"); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, Gtk::PACK_SHRINK); + table->attach(*hbox, 0, 1, 8, 9, Gtk::FILL); + hbox->show(); + label->show(); + table->attach(*(cdTextPages_[n].upcEan), 1, 2, 8, 9); + cdTextPages_[n].upcEan->show(); + + label = new Gtk::Label(_("Genre:")); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, Gtk::PACK_SHRINK); + table->attach(*hbox, 0, 1, 9, 10, Gtk::FILL); + hbox->show(); + label->show(); + table->attach(*(cdTextPages_[n].genre), 1, 2, 9, 10); + cdTextPages_[n].genre->show(); + + label = new Gtk::Label(_("Genre Info:")); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, Gtk::PACK_SHRINK); + table->attach(*hbox, 0, 1, 10, 11, Gtk::FILL); + hbox->show(); + label->show(); + table->attach(*(cdTextPages_[n].genreInfo), 1, 2, 10, 11); + cdTextPages_[n].genreInfo->show(); + + hbox = manage(new Gtk::HBox); + hbox->pack_start(*table, true, true, 3); + table->show(); + + vbox1 = manage(new Gtk::VBox); + vbox1->pack_start(*hbox, true, true, 3); + hbox->show(); + + vbox1->show(); + + return vbox1; +} + +bool TocInfoDialog::on_delete_event(GdkEventAny*) +{ + stop(); + return 1; +} + +void TocInfoDialog::closeAction() +{ + stop(); +} + + +void TocInfoDialog::clear() +{ + nofTracks_->set_text(""); + tocLength_->set_text(""); + + tocType_->set_history(0); + selectedTocType_ = Toc::CD_DA; + + catalog_->set_text(""); + catalog_->set_editable(false); + + clearCdText(); +} + +void TocInfoDialog::update(unsigned long level, TocEdit *view) +{ + const Toc *toc; + + if (!active_) + return; + + tocEdit_ = view; + + if (view == NULL) { + clear(); + return; + } + + std::string s(view->filename()); + s += " - "; + s += APP_NAME; + if (view->tocDirty()) + s += "(*)"; + set_title(s); + + if (level & UPD_TOC_DATA) { + toc = tocEdit_->toc(); + importData(toc); + } + + if (level & UPD_EDITABLE_STATE) { + applyButton_->set_sensitive(tocEdit_->editable() ? true : false); + } +} + + +void TocInfoDialog::clearCdText() +{ + int l; + + for (l = 0; l < 8; l++) { + cdTextPages_[l].title->set_text(""); + cdTextPages_[l].title->set_editable(false); + + cdTextPages_[l].performer->set_text(""); + cdTextPages_[l].performer->set_editable(false); + + cdTextPages_[l].songwriter->set_text(""); + cdTextPages_[l].songwriter->set_editable(false); + + cdTextPages_[l].composer->set_text(""); + cdTextPages_[l].composer->set_editable(false); + + cdTextPages_[l].arranger->set_text(""); + cdTextPages_[l].arranger->set_editable(false); + + cdTextPages_[l].message->set_text(""); + cdTextPages_[l].message->set_editable(false); + + cdTextPages_[l].catalog->set_text(""); + cdTextPages_[l].catalog->set_editable(false); + + cdTextPages_[l].upcEan->set_text(""); + cdTextPages_[l].upcEan->set_editable(false); + + cdTextPages_[l].language->set_history(1); + cdTextPages_[l].selectedLanguage = 1; + + cdTextPages_[l].genre->set_history(1); + cdTextPages_[l].selectedGenre = 1; + } +} + + +void TocInfoDialog::applyAction() +{ + if (tocEdit_ == NULL || !tocEdit_->editable()) + return; + + exportData(tocEdit_); + + guiUpdate(UPD_TOC_DATA); +} + +const char *TocInfoDialog::checkString(const std::string &str) +{ + static char *buf = NULL; + static long bufLen = 0; + char *p, *s; + long len = strlen(str.c_str()); + + if (len == 0) + return NULL; + + if (buf == NULL || len + 1 > bufLen) { + delete[] buf; + bufLen = len + 1; + buf = new char[bufLen]; + } + + strcpy(buf, str.c_str()); + + s = buf; + p = buf + len - 1; + + while (*s != 0 && isspace(*s)) + s++; + + if (*s == 0) + return NULL; + + while (p > s && isspace(*p)) { + *p = 0; + p--; + } + + return s; +} + +int TocInfoDialog::getCdTextLanguageIndex(int code) +{ + int i; + + if (code < 0) + return 1; // undefined + + for (i = 2; i < MAX_CD_TEXT_LANGUAGE_CODES; i++) { + if (CD_TEXT_LANGUAGE_CODES[i].code == code) + return i; + } + + return 0; // unknown +} + +int TocInfoDialog::getCdTextGenreIndex(int code1, int code2) +{ + int i; + + for (i = 2; i < MAX_CD_TEXT_GENRE_CODES; i++) { + if (CD_TEXT_GENRE_CODES[i].code1 == code1 && + CD_TEXT_GENRE_CODES[i].code2 == code2) + return i; + } + + return 0; +} + +void TocInfoDialog::importCdText(const Toc *toc) +{ + int l; + const CdTextItem *item; + + for (l = 0; l < 8; l++) { + if ((item = toc->getCdTextItem(0, l, CdTextItem::CDTEXT_TITLE)) + != NULL) + cdTextPages_[l].title->set_text((const char*)(item->data())); + else + cdTextPages_[l].title->set_text(""); + cdTextPages_[l].title->set_editable(true); + + if ((item = toc->getCdTextItem(0, l, CdTextItem::CDTEXT_PERFORMER)) + != NULL) + cdTextPages_[l].performer->set_text((const char*)(item->data())); + else + cdTextPages_[l].performer->set_text(""); + cdTextPages_[l].performer->set_editable(true); + + if ((item = toc->getCdTextItem(0, l, CdTextItem::CDTEXT_SONGWRITER)) + != NULL) + cdTextPages_[l].songwriter->set_text((const char*)(item->data())); + else + cdTextPages_[l].songwriter->set_text(""); + cdTextPages_[l].songwriter->set_editable(true); + + if ((item = toc->getCdTextItem(0, l, CdTextItem::CDTEXT_COMPOSER)) + != NULL) + cdTextPages_[l].composer->set_text((const char*)(item->data())); + else + cdTextPages_[l].composer->set_text(""); + cdTextPages_[l].composer->set_editable(true); + + if ((item = toc->getCdTextItem(0, l, CdTextItem::CDTEXT_ARRANGER)) + != NULL) + cdTextPages_[l].arranger->set_text((const char*)(item->data())); + else + cdTextPages_[l].arranger->set_text(""); + cdTextPages_[l].arranger->set_editable(true); + + if ((item = toc->getCdTextItem(0, l, CdTextItem::CDTEXT_MESSAGE)) + != NULL) + cdTextPages_[l].message->set_text((const char*)(item->data())); + else + cdTextPages_[l].message->set_text(""); + cdTextPages_[l].message->set_editable(true); + + if ((item = toc->getCdTextItem(0, l, CdTextItem::CDTEXT_DISK_ID)) + != NULL) + cdTextPages_[l].catalog->set_text((const char*)(item->data())); + else + cdTextPages_[l].catalog->set_text(""); + cdTextPages_[l].catalog->set_editable(true); + + if ((item = toc->getCdTextItem(0, l, CdTextItem::CDTEXT_UPCEAN_ISRC)) + != NULL) + cdTextPages_[l].upcEan->set_text((const char*)(item->data())); + else + cdTextPages_[l].upcEan->set_text(""); + cdTextPages_[l].upcEan->set_editable(true); + + if ((item = toc->getCdTextItem(0, l, CdTextItem::CDTEXT_GENRE)) != NULL) { + if (item->dataLen() >= 2) { + cdTextPages_[l].selectedGenre = getCdTextGenreIndex(item->data()[0], + item->data()[1]); + } + else { + cdTextPages_[l].selectedGenre = 0; // Unknwon + } + + if (item->dataLen() > 2) { + // Copy the supplementary genre information from the CD-TEXT item. + // Carefully handle the case that the terminating 0 is missing. + int len = item->dataLen() - 2 + 1; + char *s = new char[len]; + memcpy(s, item->data() + 2, len - 1); + s[len - 1] = 0; + + cdTextPages_[l].genreInfo->set_text(s); + + delete[] s; + } + else { + cdTextPages_[l].genreInfo->set_text(""); + } + } + else { + cdTextPages_[l].selectedGenre = 1; // not used + cdTextPages_[l].genreInfo->set_text(""); + } + cdTextPages_[l].genre->set_history(cdTextPages_[l].selectedGenre); + + cdTextPages_[l].selectedLanguage = getCdTextLanguageIndex(toc->cdTextLanguage(l)); + cdTextPages_[l].language->set_history(cdTextPages_[l].selectedLanguage); + } +} + +void TocInfoDialog::importData(const Toc *toc) +{ + char buf[50]; + int i; + + sprintf(buf, "%3d:%02d:%02d", toc->length().min(), toc->length().sec(), + toc->length().frac()); + tocLength_->set_text(buf); + + sprintf(buf, "%3d", toc->nofTracks()); + nofTracks_->set_text(buf); + + if (toc->catalogValid()) { + for (i = 0; i < 13; i++) + buf[i] = toc->catalog(i) + '0'; + + buf[13] = 0; + + catalog_->set_text(buf); + } + else { + catalog_->set_text(""); + } + + catalog_->set_editable(true); + + switch (toc->tocType()) { + case Toc::CD_DA: + tocType_->set_history(0); + break; + case Toc::CD_ROM: + tocType_->set_history(1); + break; + case Toc::CD_ROM_XA: + tocType_->set_history(2); + break; + case Toc::CD_I: + tocType_->set_history(3); + break; + } + selectedTocType_ = toc->tocType(); + + importCdText(toc); +} + +void TocInfoDialog::exportData(TocEdit *tocEdit) +{ + const char *s, *s1; + Toc *toc = tocEdit->toc(); + + if (toc->tocType() != selectedTocType_) { + tocEdit->setTocType(selectedTocType_); + } + + s = checkString(catalog_->get_text()); + + if (s == NULL) { + if (toc->catalogValid()) + tocEdit->setCatalogNumber(NULL); + } + else if (strlen(s) == 13) { + if ((s1 = toc->catalog()) == NULL || strcmp(s1, s) != 0) + tocEdit->setCatalogNumber(s); + } + + exportCdText(tocEdit); +} + +void TocInfoDialog::exportCdText(TocEdit *tocEdit) +{ + int l; + const char *s; + const Toc *toc = tocEdit->toc(); + + const CdTextItem *item; + CdTextItem *newItem; + + for (l = 0; l < 8; l++) { + // Title + if ((s = checkString(cdTextPages_[l].title->get_text())) != NULL) + newItem = new CdTextItem(CdTextItem::CDTEXT_TITLE, l, s); + else + newItem = NULL; + + if ((item = toc->getCdTextItem(0, l, CdTextItem::CDTEXT_TITLE)) + != NULL) { + if (newItem == NULL) + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_TITLE, l, NULL); + else if (*newItem != *item) + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_TITLE, l, s); + } + else if (newItem != NULL) { + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_TITLE, l, s); + } + + delete newItem; + + + // Performer + if ((s = checkString(cdTextPages_[l].performer->get_text())) != NULL) + newItem = new CdTextItem(CdTextItem::CDTEXT_PERFORMER, l, s); + else + newItem = NULL; + + if ((item = toc->getCdTextItem(0, l, CdTextItem::CDTEXT_PERFORMER)) + != NULL) { + if (newItem == NULL) + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_PERFORMER, l, NULL); + else if (*newItem != *item) + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_PERFORMER, l, s); + } + else if (newItem != NULL) { + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_PERFORMER, l, s); + } + + delete newItem; + + + // Songwriter + if ((s = checkString(cdTextPages_[l].songwriter->get_text())) != NULL) + newItem = new CdTextItem(CdTextItem::CDTEXT_SONGWRITER, l, s); + else + newItem = NULL; + + if ((item = toc->getCdTextItem(0, l, CdTextItem::CDTEXT_SONGWRITER)) + != NULL) { + if (newItem == NULL) + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_SONGWRITER, l, + NULL); + else if (*newItem != *item) + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_SONGWRITER, l, s); + } + else if (newItem != NULL) { + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_SONGWRITER, l, s); + } + + delete newItem; + + + // Composer + if ((s = checkString(cdTextPages_[l].composer->get_text())) != NULL) + newItem = new CdTextItem(CdTextItem::CDTEXT_COMPOSER, l, s); + else + newItem = NULL; + + if ((item = toc->getCdTextItem(0, l, CdTextItem::CDTEXT_COMPOSER)) + != NULL) { + if (newItem == NULL) + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_COMPOSER, l, NULL); + else if (*newItem != *item) + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_COMPOSER, l, s); + } + else if (newItem != NULL) { + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_COMPOSER, l, s); + } + + delete newItem; + + + // Arranger + if ((s = checkString(cdTextPages_[l].arranger->get_text())) != NULL) + newItem = new CdTextItem(CdTextItem::CDTEXT_ARRANGER, l, s); + else + newItem = NULL; + + if ((item = toc->getCdTextItem(0, l, CdTextItem::CDTEXT_ARRANGER)) + != NULL) { + if (newItem == NULL) + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_ARRANGER, l, NULL); + else if (*newItem != *item) + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_ARRANGER, l, s); + } + else if (newItem != NULL) { + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_ARRANGER, l, s); + } + + delete newItem; + + + // Message + if ((s = checkString(cdTextPages_[l].message->get_text())) != NULL) + newItem = new CdTextItem(CdTextItem::CDTEXT_MESSAGE, l, s); + else + newItem = NULL; + + if ((item = toc->getCdTextItem(0, l, CdTextItem::CDTEXT_MESSAGE)) + != NULL) { + if (newItem == NULL) + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_MESSAGE, l, NULL); + else if (*newItem != *item) + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_MESSAGE, l, s); + } + else if (newItem != NULL) { + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_MESSAGE, l, s); + } + + delete newItem; + + // Catalog + if ((s = checkString(cdTextPages_[l].catalog->get_text())) != NULL) + newItem = new CdTextItem(CdTextItem::CDTEXT_DISK_ID, l, s); + else + newItem = NULL; + + if ((item = toc->getCdTextItem(0, l, CdTextItem::CDTEXT_DISK_ID)) + != NULL) { + if (newItem == NULL) + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_DISK_ID, l, + NULL); + else if (*newItem != *item) + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_DISK_ID, l, s); + } + else if (newItem != NULL) { + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_DISK_ID, l, s); + } + + delete newItem; + + // Upc/Ean + if ((s = checkString(cdTextPages_[l].upcEan->get_text())) != NULL) + newItem = new CdTextItem(CdTextItem::CDTEXT_UPCEAN_ISRC, l, s); + else + newItem = NULL; + + if ((item = toc->getCdTextItem(0, l, CdTextItem::CDTEXT_UPCEAN_ISRC)) + != NULL) { + if (newItem == NULL) + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_UPCEAN_ISRC, l, + NULL); + else if (*newItem != *item) + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_UPCEAN_ISRC, l, s); + } + else if (newItem != NULL) { + tocEdit->setCdTextItem(0, CdTextItem::CDTEXT_UPCEAN_ISRC, l, s); + } + + delete newItem; + + // Genre + if (cdTextPages_[l].selectedGenre != 0) { + int code1 = CD_TEXT_GENRE_CODES[cdTextPages_[l].selectedGenre].code1; + int code2 = CD_TEXT_GENRE_CODES[cdTextPages_[l].selectedGenre].code2; + s = checkString(cdTextPages_[l].genreInfo->get_text()); + + if (cdTextPages_[l].selectedGenre > 1) + newItem = new CdTextItem(l, code1, code2, s); + else + newItem = NULL; + + if ((item = toc->getCdTextItem(0, l, CdTextItem::CDTEXT_GENRE)) + != NULL) { + if (newItem == NULL) + tocEdit->setCdTextGenreItem(l, -1, -1, NULL); + else if (*newItem != *item) + tocEdit->setCdTextGenreItem(l, code1, code2, s); + } + else if (newItem != NULL) { + tocEdit->setCdTextGenreItem(l, code1, code2, s); + } + + delete newItem; + } + + // language + if (cdTextPages_[l].selectedLanguage != 0) { + int langCode = CD_TEXT_LANGUAGE_CODES[cdTextPages_[l].selectedLanguage].code; + + if (langCode != toc->cdTextLanguage(l)) + tocEdit->setCdTextLanguage(l, langCode); + } + } +} diff --git a/xdao/TocInfoDialog.h b/xdao/TocInfoDialog.h new file mode 100644 index 0000000..5866f57 --- /dev/null +++ b/xdao/TocInfoDialog.h @@ -0,0 +1,107 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __TOC_INFO_DIALOG_H__ +#define __TOC_INFO_DIALOG_H__ + +#include <gtkmm.h> +#include <gtk/gtk.h> + +#include "Toc.h" + +class TocEdit; +class TextEdit; + +class TocInfoDialog : public Gtk::Dialog +{ +public: + TocInfoDialog(Gtk::Window* parent); + ~TocInfoDialog(); + + bool on_delete_event(GdkEventAny*); + + void update(unsigned long, TocEdit *); + + void start(TocEdit *); + void stop(); + +private: + TocEdit *tocEdit_; + bool active_; + + Gtk::Button *applyButton_; + Gtk::Label *tocLength_; + Gtk::Label *nofTracks_; + + TextEdit *catalog_; + + Gtk::OptionMenu *tocType_; + Toc::TocType selectedTocType_; + + struct BlockValue { + int block; + int value; + }; + + struct CdTextPage { + Gtk::OptionMenu *language; + int selectedLanguage; + + Gtk::OptionMenu *genre; + int selectedGenre; + + Gtk::Label *label; + Gtk::Entry *title; + Gtk::Entry *performer; + Gtk::Entry *songwriter; + Gtk::Entry *composer; + Gtk::Entry *arranger; + Gtk::Entry *message; + Gtk::Entry *catalog; + Gtk::Entry *upcEan; + Gtk::Entry *genreInfo; + }; + + CdTextPage cdTextPages_[8]; + + void closeAction(); + void applyAction(); + + void createCdTextLanguageMenu(int); + void createCdTextGenreMenu(int n); + Gtk::VBox *createCdTextPage(int); + + void clear(); + void clearCdText(); + + const char *checkString(const std::string &); + int getCdTextLanguageIndex(int code); + int getCdTextGenreIndex(int code1, int code2); + + void importCdText(const Toc *); + void importData(const Toc *); + void exportCdText(TocEdit *); + void exportData(TocEdit *); + + void setSelectedTocType(Toc::TocType); + void setSelectedCDTextLanguage(BlockValue); + void setSelectedCDTextGenre(BlockValue); +}; + +#endif diff --git a/xdao/TrackDataScrap.cc b/xdao/TrackDataScrap.cc new file mode 100644 index 0000000..96b73d9 --- /dev/null +++ b/xdao/TrackDataScrap.cc @@ -0,0 +1,113 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2002 Andreas Mueller <andreas@daneb.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "TrackDataScrap.h" + +#include <stddef.h> + +#include "util.h" +#include "TrackData.h" +#include "TrackDataList.h" + +TrackDataScrap::TrackDataScrap(TrackDataList *l) +{ + list_ = l; + blocks_ = 0; + + leftNegSamples_ = NULL; + leftPosSamples_ = NULL; + rightNegSamples_ = NULL; + rightPosSamples_ = NULL; +} + +TrackDataScrap::~TrackDataScrap() +{ + delete list_; + list_ = NULL; + + delete[] leftNegSamples_; + leftNegSamples_ = NULL; + + delete[] leftPosSamples_; + leftPosSamples_ = NULL; + + delete[] rightNegSamples_; + rightNegSamples_ = NULL; + + delete[] rightPosSamples_; + rightPosSamples_ = NULL; +} + +const TrackDataList *TrackDataScrap::trackDataList() const +{ + return (const TrackDataList*)list_; +} + +void TrackDataScrap::setPeaks(long blocks, + short *leftNegSamples, short *leftPosSamples, + short *rightNegSamples, short *rightPosSamples) +{ + long i; + + blocks_ = blocks; + + delete[] leftNegSamples_; + delete[] leftPosSamples_; + delete[] rightNegSamples_; + delete[] rightPosSamples_; + + if (blocks > 0) { + leftNegSamples_ = new short[blocks]; + leftPosSamples_ = new short[blocks]; + rightNegSamples_ = new short[blocks]; + rightPosSamples_ = new short[blocks]; + + for (i = 0; i < blocks; i++) { + leftNegSamples_[i] = leftNegSamples[i]; + leftPosSamples_[i] = leftPosSamples[i]; + rightNegSamples_[i] = rightNegSamples[i]; + rightPosSamples_[i] = rightPosSamples[i]; + } + } + else { + leftNegSamples_ = NULL; + leftPosSamples_ = NULL; + rightNegSamples_ = NULL; + rightPosSamples_ = NULL; + } +} + +void TrackDataScrap::getPeaks(long blocks, short *leftNegSamples, + short *leftPosSamples, short *rightNegSamples, + short *rightPosSamples) const +{ + long n, i; + + if (leftNegSamples_ == NULL) + return; + + n = (blocks_ < blocks) ? blocks_ : blocks; + + for (i = 0; i < n; i++) { + leftNegSamples[i] = leftNegSamples_[i]; + leftPosSamples[i] = leftPosSamples_[i]; + rightNegSamples[i] = rightNegSamples_[i]; + rightPosSamples[i] = rightPosSamples_[i]; + } +} diff --git a/xdao/TrackDataScrap.h b/xdao/TrackDataScrap.h new file mode 100644 index 0000000..e547ea0 --- /dev/null +++ b/xdao/TrackDataScrap.h @@ -0,0 +1,67 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998, 1999 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * $Log: TrackDataScrap.h,v $ + * Revision 1.2 2004/02/12 01:13:32 poolshark + * Merge from gnome2 branch + * + * Revision 1.1.1.1.6.1 2004/01/05 00:34:03 poolshark + * First checking of gnome2 port + * + * Revision 1.1.1.1 2003/12/09 05:32:28 denis + * Fooya + * + * Revision 1.1.1.1 2000/02/05 01:38:55 llanero + * Uploaded cdrdao 1.1.3 with pre10 patch applied. + * + * Revision 1.1 1999/08/27 18:39:38 mueller + * Initial revision + * + */ + +#ifndef __TRACK_DATA_SCRAP_H__ +#define __TRACK_DATA_SCRAP_H__ + +class TrackDataList; + +class TrackDataScrap { +public: + TrackDataScrap(TrackDataList *); + ~TrackDataScrap(); + + const TrackDataList *trackDataList() const; + + void setPeaks(long blocks, + short *leftNegSamples, short *leftPosSamples, + short *rightNegSamples, short *rightPosSamples); + void getPeaks(long blocks, + short *leftNegSamples, short *leftPosSamples, + short *rightNegSamples, short *rightPosSamples) const; + +private: + TrackDataList *list_; + long blocks_; + + short *leftNegSamples_; + short *leftPosSamples_; + short *rightNegSamples_; + short *rightPosSamples_; +}; + +#endif diff --git a/xdao/TrackInfoDialog.cc b/xdao/TrackInfoDialog.cc new file mode 100644 index 0000000..39a9651 --- /dev/null +++ b/xdao/TrackInfoDialog.cc @@ -0,0 +1,821 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "TrackInfoDialog.h" + +#include <gnome.h> + +#include <stdio.h> +#include <stddef.h> +#include <string.h> +#include <ctype.h> + +#include "TocEdit.h" +#include "TocEditView.h" +#include "guiUpdate.h" +#include "Toc.h" +#include "Track.h" +#include "CdTextItem.h" +#include "TextEdit.h" + +TrackInfoDialog::TrackInfoDialog() +{ + int i; + Gtk::Label *label, *label1; + Gtk::HBox *hbox; + Gtk::VBox *vbox, *vbox1; + Gtk::Frame *frame; + Gtk::Table *table; + Gtk::Button *button; + Gtk::VBox *contents = manage(new Gtk::VBox); + Gtk::HBox *topBox = manage(new Gtk::HBox); + + tocEditView_ = NULL; + active_ = 0; + trackNr_ = 0; + + trackNr_ = new Gtk::Label("99"); + pregapLen_ = new Gtk::Label("100:00:00"); + trackStart_ = new Gtk::Label("100:00:00"); + trackEnd_ = new Gtk::Label("100:00:00"); + trackLen_ = new Gtk::Label("100:00:00"); + indexMarks_ = new Gtk::Label("99"); + + copyFlag_ = new Gtk::CheckButton(_("Copy")); + preEmphasisFlag_ = new Gtk::CheckButton(_("Pre Emphasis")); + + twoChannelAudio_ = new Gtk::RadioButton(_("Two Channel Audio")); + fourChannelAudio_ = new Gtk::RadioButton(_("Four Channel Audio")); + Gtk::RadioButton::Group rbgroup = twoChannelAudio_->get_group(); + fourChannelAudio_->set_group(rbgroup); + + isrcCodeCountry_ = manage(new TextEdit("XX")); + isrcCodeCountry_->set_max_length(2); + isrcCodeCountry_->lowerCase(0); + isrcCodeCountry_->space(0); + isrcCodeCountry_->digits(0); + + isrcCodeOwner_ = manage(new TextEdit("XXX")); + isrcCodeOwner_->set_max_length(3); + isrcCodeOwner_->lowerCase(0); + isrcCodeOwner_->space(0); + + isrcCodeYear_ = manage(new TextEdit("00")); + isrcCodeYear_->set_max_length(2); + isrcCodeYear_->lowerCase(0); + isrcCodeYear_->upperCase(0); + isrcCodeYear_->space(0); + + isrcCodeSerial_ = manage(new TextEdit("00000")); + isrcCodeSerial_->set_max_length(5); + isrcCodeSerial_->lowerCase(0); + isrcCodeSerial_->upperCase(0); + isrcCodeSerial_->space(0); + + topBox->set_spacing(5); + contents->set_spacing(10); + + hbox = manage(new Gtk::HBox); + + label = new Gtk::Label(_("Track: ")); + + hbox->pack_start(*label, FALSE, FALSE); + hbox->pack_start(*trackNr_, FALSE, FALSE); + + contents->pack_start(*hbox, FALSE, FALSE); + + // time data + frame = new Gtk::Frame(_(" Summary ")); + + table = new Gtk::Table(5, 2, FALSE); + table->set_row_spacings(5); + table->set_col_spacings(5); + hbox = manage(new Gtk::HBox); + hbox->pack_start(*table, FALSE, FALSE, 5); + vbox = manage(new Gtk::VBox); + vbox->pack_start(*hbox, TRUE, TRUE, 5); + frame->add(*vbox); + + label = new Gtk::Label(_("Pre-Gap:")); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, FALSE, FALSE); + table->attach(*hbox, 0, 1, 0, 1); + hbox = manage(new Gtk::HBox); + hbox->pack_start(*pregapLen_, FALSE, FALSE); + table->attach(*hbox, 1, 2, 0, 1); + + label = new Gtk::Label(_("Start:")); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, FALSE, FALSE); + table->attach(*hbox, 0, 1, 1, 2); + hbox = manage(new Gtk::HBox); + hbox->pack_start(*trackStart_, FALSE, FALSE); + table->attach(*hbox, 1, 2, 1, 2); + + label = new Gtk::Label(_("End:")); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, FALSE, FALSE); + table->attach(*hbox, 0, 1, 2, 3); + hbox = manage(new Gtk::HBox); + hbox->pack_start(*trackEnd_, FALSE, FALSE); + table->attach(*hbox, 1, 2, 2, 3); + + label = new Gtk::Label(_("Length:")); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, FALSE, FALSE); + table->attach(*hbox, 0, 1, 3, 4); + hbox = manage(new Gtk::HBox); + hbox->pack_start(*trackLen_, FALSE, FALSE); + table->attach(*hbox, 1, 2, 3, 4); + + label = new Gtk::Label(_("Index Marks:")); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, FALSE, FALSE); + table->attach(*hbox, 0, 1, 4, 5); + hbox = manage(new Gtk::HBox); + hbox->pack_start(*indexMarks_, FALSE, FALSE); + table->attach(*hbox, 1, 2, 4, 5); + + topBox->pack_start(*frame, FALSE, FALSE); + + // sub-channel data + frame = new Gtk::Frame(_(" Sub-Channel ")); + + vbox = manage(new Gtk::VBox); + vbox->set_spacing(0); + vbox->pack_start(*copyFlag_); + vbox->pack_start(*preEmphasisFlag_); + vbox->pack_start(*twoChannelAudio_); + twoChannelAudio_->set_active(TRUE); + vbox->pack_start(*fourChannelAudio_); + + hbox = manage(new Gtk::HBox); + label = new Gtk::Label("ISRC: "); + hbox->pack_start(*label, Gtk::PACK_SHRINK); + + hbox->pack_start(*isrcCodeCountry_, Gtk::PACK_SHRINK); + label1 = new Gtk::Label("-"); + hbox->pack_start(*label1, Gtk::PACK_SHRINK); + + hbox->pack_start(*isrcCodeOwner_, Gtk::PACK_SHRINK); + label1 = new Gtk::Label("-"); + hbox->pack_start(*label1, Gtk::PACK_SHRINK); + + hbox->pack_start(*isrcCodeYear_, Gtk::PACK_SHRINK); + label1 = new Gtk::Label("-"); + hbox->pack_start(*label1, Gtk::PACK_SHRINK); + + hbox->pack_start(*isrcCodeSerial_, Gtk::PACK_SHRINK); + + vbox->pack_start(*hbox); + + vbox1 = manage(new Gtk::VBox); + vbox1->pack_start(*vbox, TRUE, TRUE, 5); + hbox = manage(new Gtk::HBox); + hbox->pack_start(*vbox1, TRUE, TRUE, 5); + frame->add(*hbox); + + topBox->pack_start(*frame, Gtk::PACK_SHRINK); + + contents->pack_start(*topBox, Gtk::PACK_SHRINK); + + // CD-TEXT data + frame = new Gtk::Frame(" CD-TEXT "); + + Gtk::Notebook *notebook = new Gtk::Notebook; + + for (i = 0; i < 8; i++) { + vbox = createCdTextPage(i); + notebook->pages(). + push_back(Gtk::Notebook_Helpers::TabElem(*vbox, + *(cdTextPages_[i].label))); + } + + vbox1 = manage(new Gtk::VBox); + vbox1->pack_start(*notebook, TRUE, TRUE, 5); + hbox = manage(new Gtk::HBox); + hbox->pack_start(*vbox1, TRUE, TRUE, 5); + frame->add(*hbox); + + contents->pack_start(*frame); + + hbox = manage(new Gtk::HBox); + hbox->pack_start(*contents, TRUE, TRUE, 10); + get_vbox()->pack_start(*hbox, TRUE, TRUE, 10); + + Gtk::HButtonBox *bbox = new Gtk::HButtonBox(Gtk::BUTTONBOX_SPREAD); + + applyButton_ = new Gtk::Button(Gtk::StockID(Gtk::Stock::APPLY)); + bbox->pack_start(*applyButton_); + applyButton_->signal_clicked().connect(mem_fun(*this, &TrackInfoDialog::applyAction)); + + button = new Gtk::Button(Gtk::StockID(Gtk::Stock::CLOSE)); + bbox->pack_start(*button); + button->signal_clicked().connect(mem_fun(*this, &TrackInfoDialog::closeAction)); + + get_action_area()->pack_start(*bbox); + + show_all_children(); + set_title(_("Track Info")); +} + +TrackInfoDialog::~TrackInfoDialog() +{ +} + +void TrackInfoDialog::start(TocEditView *view) +{ + if (active_) { + raise(); + return; + } + + active_ = 1; + + update(UPD_ALL, view); + show(); +} + +void TrackInfoDialog::stop() +{ + if (active_) { + hide(); + active_ = 0; + } +} + + +Gtk::VBox *TrackInfoDialog::createCdTextPage(int n) +{ + char buf[20]; + Gtk::Table *table = new Gtk::Table(7, 2, FALSE); + Gtk::VBox *vbox = manage(new Gtk::VBox); + Gtk::HBox *hbox; + Gtk::Label *label; + + sprintf(buf, " %d ", n); + cdTextPages_[n].label = new Gtk::Label(buf); + + cdTextPages_[n].title = manage(new Gtk::Entry); + cdTextPages_[n].performer = manage(new Gtk::Entry); + cdTextPages_[n].songwriter = manage(new Gtk::Entry); + cdTextPages_[n].composer = manage(new Gtk::Entry); + cdTextPages_[n].arranger = manage(new Gtk::Entry); + cdTextPages_[n].message = manage(new Gtk::Entry); + cdTextPages_[n].isrc = manage(new Gtk::Entry); + + table->set_border_width(5); + table->set_row_spacings(5); + table->set_col_spacings(5); + + label = new Gtk::Label(_("Title:")); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, Gtk::PACK_SHRINK); + table->attach(*hbox, 0, 1, 0, 1, Gtk::FILL); + table->attach(*(cdTextPages_[n].title), 1, 2, 0, 1); + + label = new Gtk::Label(_("Performer:")); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, Gtk::PACK_SHRINK); + table->attach(*hbox, 0, 1, 1, 2, Gtk::FILL); + table->attach(*(cdTextPages_[n].performer), 1, 2, 1, 2); + + label = new Gtk::Label(_("Songwriter:")); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, Gtk::PACK_SHRINK); + table->attach(*hbox, 0, 1, 2, 3, Gtk::FILL); + table->attach(*(cdTextPages_[n].songwriter), 1, 2, 2, 3); + + label = new Gtk::Label(_("Composer:")); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, Gtk::PACK_SHRINK); + table->attach(*hbox, 0, 1, 3, 4, Gtk::FILL); + table->attach(*(cdTextPages_[n].composer), 1, 2, 3, 4); + + label = new Gtk::Label(_("Arranger:")); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, Gtk::PACK_SHRINK); + table->attach(*hbox, 0, 1, 4, 5, Gtk::FILL); + table->attach(*(cdTextPages_[n].arranger), 1, 2, 4, 5); + + label = new Gtk::Label(_("Message:")); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, Gtk::PACK_SHRINK); + table->attach(*hbox, 0, 1, 5, 6, Gtk::FILL); + table->attach(*(cdTextPages_[n].message), 1, 2, 5, 6); + + label = new Gtk::Label("ISRC:"); + hbox = manage(new Gtk::HBox); + hbox->pack_end(*label, Gtk::PACK_SHRINK); + table->attach(*hbox, 0, 1, 6, 7, Gtk::FILL); + table->attach(*(cdTextPages_[n].isrc), 1, 2, 6, 7); + + vbox->pack_start(*table); + + return vbox; +} + +bool TrackInfoDialog::on_delete_event(GdkEventAny*) +{ + stop(); + return 1; +} + +void TrackInfoDialog::closeAction() +{ + stop(); +} + + +void TrackInfoDialog::clear() +{ + trackNr_->set_text(""); + pregapLen_->set_text(""); + trackStart_->set_text(""); + trackEnd_->set_text(""); + trackLen_->set_text(""); + indexMarks_->set_text(""); + + isrcCodeCountry_->set_text(""); + isrcCodeCountry_->set_editable(false); + isrcCodeOwner_->set_text(""); + isrcCodeOwner_->set_editable(false); + isrcCodeYear_->set_text(""); + isrcCodeYear_->set_editable(false); + isrcCodeSerial_->set_text(""); + isrcCodeSerial_->set_editable(false); + + copyFlag_->set_sensitive(false); + preEmphasisFlag_->set_sensitive(false); + twoChannelAudio_->set_sensitive(false); + fourChannelAudio_->set_sensitive(false); + + clearCdText(); +} + +void TrackInfoDialog::update(unsigned long level, TocEditView *view) +{ + const Toc *toc; + + if (!active_) + return; + + tocEditView_ = view; + + if (view == NULL || !view->trackSelection(&selectedTrack_)) { + selectedTrack_ = 0; + applyButton_->set_sensitive(FALSE); + clear(); + return; + } + + std::string s(view->tocEdit()->filename()); + s += " - "; + s += APP_NAME; + if (view->tocEdit()->tocDirty()) + s += "(*)"; + set_title(s); + + if (level & (UPD_TRACK_DATA | UPD_TRACK_MARK_SEL)) { + toc = view->tocEdit()->toc(); + importData(toc, selectedTrack_); + applyButton_->set_sensitive(view->tocEdit()->editable() ? TRUE : FALSE); + } + else if (level & UPD_EDITABLE_STATE) { + applyButton_->set_sensitive(view->tocEdit()->editable() ? TRUE : FALSE); + } +} + + +void TrackInfoDialog::clearCdText() +{ + int l; + + for (l = 0; l < 8; l++) { + cdTextPages_[l].title->set_text(""); + cdTextPages_[l].title->set_editable(false); + + cdTextPages_[l].performer->set_text(""); + cdTextPages_[l].performer->set_editable(false); + + cdTextPages_[l].songwriter->set_text(""); + cdTextPages_[l].songwriter->set_editable(false); + + cdTextPages_[l].composer->set_text(""); + cdTextPages_[l].composer->set_editable(false); + + cdTextPages_[l].arranger->set_text(""); + cdTextPages_[l].arranger->set_editable(false); + + cdTextPages_[l].message->set_text(""); + cdTextPages_[l].message->set_editable(false); + + cdTextPages_[l].isrc->set_text(""); + cdTextPages_[l].isrc->set_editable(false); + } +} + + +void TrackInfoDialog::applyAction() +{ + if (tocEditView_ == NULL || !tocEditView_->tocEdit()->editable() || + selectedTrack_ == 0) + return; + + exportData(tocEditView_->tocEdit(), selectedTrack_); + + guiUpdate(UPD_TRACK_DATA); +} + +const char *TrackInfoDialog::checkString(const std::string &str) +{ + static char *buf = NULL; + static long bufLen = 0; + char *p, *s; + long len = strlen(str.c_str()); + + if (len == 0) + return NULL; + + if (buf == NULL || len + 1 > bufLen) { + delete[] buf; + bufLen = len + 1; + buf = new char[bufLen]; + } + + strcpy(buf, str.c_str()); + + s = buf; + p = buf + len - 1; + + while (*s != 0 && isspace(*s)) + s++; + + if (*s == 0) + return NULL; + + while (p > s && isspace(*p)) { + *p = 0; + p--; + } + + return s; +} + +void TrackInfoDialog::importCdText(const Toc *toc, int trackNr) +{ + int l; + const CdTextItem *item; + + for (l = 0; l < 8; l++) { + if ((item = toc->getCdTextItem(trackNr, l, CdTextItem::CDTEXT_TITLE)) + != NULL) + cdTextPages_[l].title->set_text((const char*)item->data()); + else + cdTextPages_[l].title->set_text(""); + cdTextPages_[l].title->set_editable(true); + + if ((item = toc->getCdTextItem(trackNr, l, CdTextItem::CDTEXT_PERFORMER)) + != NULL) + cdTextPages_[l].performer->set_text((const char*)item->data()); + else + cdTextPages_[l].performer->set_text(""); + cdTextPages_[l].performer->set_editable(true); + + if ((item = toc->getCdTextItem(trackNr, l, CdTextItem::CDTEXT_SONGWRITER)) + != NULL) + cdTextPages_[l].songwriter->set_text((const char*)item->data()); + else + cdTextPages_[l].songwriter->set_text(""); + cdTextPages_[l].songwriter->set_editable(true); + + if ((item = toc->getCdTextItem(trackNr, l, CdTextItem::CDTEXT_COMPOSER)) + != NULL) + cdTextPages_[l].composer->set_text((const char*)item->data()); + else + cdTextPages_[l].composer->set_text(""); + cdTextPages_[l].composer->set_editable(true); + + if ((item = toc->getCdTextItem(trackNr, l, CdTextItem::CDTEXT_ARRANGER)) + != NULL) + cdTextPages_[l].arranger->set_text((const char*)item->data()); + else + cdTextPages_[l].arranger->set_text(""); + cdTextPages_[l].arranger->set_editable(true); + + if ((item = toc->getCdTextItem(trackNr, l, CdTextItem::CDTEXT_MESSAGE)) + != NULL) + cdTextPages_[l].message->set_text((const char*)item->data()); + else + cdTextPages_[l].message->set_text(""); + cdTextPages_[l].message->set_editable(true); + + if ((item = toc->getCdTextItem(trackNr, l, CdTextItem::CDTEXT_UPCEAN_ISRC)) + != NULL) + cdTextPages_[l].isrc->set_text((const char*)item->data()); + else + cdTextPages_[l].isrc->set_text(""); + cdTextPages_[l].isrc->set_editable(true); + } +} + +void TrackInfoDialog::importData(const Toc *toc, int trackNr) +{ + char buf[50]; + TrackIterator itr(toc); + Msf start, end; + + const Track *track = itr.find(trackNr, start, end); + + if (track == NULL) { + clear(); + return; + } + + sprintf(buf, "%d", trackNr); + trackNr_->set_text(buf); + + sprintf(buf, "%3d:%02d:%02d", track->start().min(), track->start().sec(), + track->start().frac()); + pregapLen_->set_text(buf); + + sprintf(buf, "%3d:%02d:%02d", start.min(), start.sec(), start.frac()); + trackStart_->set_text(buf); + + sprintf(buf, "%3d:%02d:%02d", end.min(), end.sec(), end.frac()); + trackEnd_->set_text(buf); + + Msf len(track->length() - track->start()); + sprintf(buf, "%3d:%02d:%02d", len.min(), len.sec(), len.frac()); + trackLen_->set_text(buf); + + sprintf(buf, "%3d", track->nofIndices()); + indexMarks_->set_text(buf); + + copyFlag_->set_sensitive(true); + preEmphasisFlag_->set_sensitive(true); + twoChannelAudio_->set_sensitive(true); + fourChannelAudio_->set_sensitive(true); + + copyFlag_->set_active(track->copyPermitted()); + preEmphasisFlag_->set_active(track->preEmphasis()); + + if (track->audioType() == 0) + twoChannelAudio_->set_active(true); + else + fourChannelAudio_->set_active(true); + + if (track->isrcValid()) { + sprintf(buf, "%c%c", track->isrcCountry(0), track->isrcCountry(1)); + isrcCodeCountry_->set_text(buf); + + sprintf(buf, "%c%c%c", track->isrcOwner(0), track->isrcOwner(1), + track->isrcOwner(2)); + isrcCodeOwner_->set_text(buf); + + sprintf(buf, "%c%c", '0' + track->isrcYear(0), '0' + track->isrcYear(1)); + isrcCodeYear_->set_text(buf); + + sprintf(buf, "%c%c%c%c%c", '0' + track->isrcSerial(0), + '0' + track->isrcSerial(1), '0' + track->isrcSerial(2), + '0' + track->isrcSerial(3), '0' + track->isrcSerial(4)); + isrcCodeSerial_->set_text(buf); + } + else { + isrcCodeCountry_->set_text(""); + isrcCodeOwner_->set_text(""); + isrcCodeYear_->set_text(""); + isrcCodeSerial_->set_text(""); + } + + isrcCodeCountry_->set_editable(true); + isrcCodeOwner_->set_editable(true); + isrcCodeYear_->set_editable(true); + isrcCodeSerial_->set_editable(true); + + importCdText(toc, trackNr); +} + +void TrackInfoDialog::exportData(TocEdit *tocEdit, int trackNr) +{ + char buf[13]; + const char *s; + Toc *toc = tocEdit->toc(); + Track *t = toc->getTrack(trackNr); + int flag; + + if (t == NULL) + return; + + flag = copyFlag_->get_active() ? 1 : 0; + if (t->copyPermitted() != flag) + tocEdit->setTrackCopyFlag(trackNr, flag); + + if (t->type() == TrackData::AUDIO) { + flag = preEmphasisFlag_->get_active() ? 1 : 0; + if (t->preEmphasis() != flag) + tocEdit->setTrackPreEmphasisFlag(trackNr, flag); + + flag = twoChannelAudio_->get_active() ? 0 : 1; + if (t->audioType() != flag) + tocEdit->setTrackAudioType(trackNr, flag); + + buf[0] = 0; + if ((s = checkString(isrcCodeCountry_->get_text())) != NULL && + strlen(s) == 2) { + strcat(buf, s); + } + if ((s = checkString(isrcCodeOwner_->get_text())) != NULL && + strlen(s) == 3) { + strcat(buf, s); + } + if ((s = checkString(isrcCodeYear_->get_text())) != NULL && + strlen(s) == 2) { + strcat(buf, s); + } + if ((s = checkString(isrcCodeSerial_->get_text())) != NULL && + strlen(s) == 5) { + strcat(buf, s); + } + + if (strlen(buf) == 0) { + if (t->isrcValid()) + tocEdit->setTrackIsrcCode(trackNr, NULL); + } + else if (strlen(buf) == 12) { + if ((s = t->isrc()) == NULL || strcmp(s, buf) != 0) + tocEdit->setTrackIsrcCode(trackNr, buf); + } + } + + exportCdText(tocEdit, trackNr); +} + +void TrackInfoDialog::exportCdText(TocEdit *tocEdit, int trackNr) +{ + int l; + const char *s; + const Toc *toc = tocEdit->toc(); + + const CdTextItem *item; + CdTextItem *newItem; + + for (l = 0; l < 8; l++) { + // Title + if ((s = checkString(cdTextPages_[l].title->get_text())) != NULL) + newItem = new CdTextItem(CdTextItem::CDTEXT_TITLE, l, s); + else + newItem = NULL; + + if ((item = toc->getCdTextItem(trackNr, l, CdTextItem::CDTEXT_TITLE)) + != NULL) { + if (newItem == NULL) + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_TITLE, l, NULL); + else if (*newItem != *item) + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_TITLE, l, s); + } + else if (newItem != NULL) { + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_TITLE, l, s); + } + + delete newItem; + + + // Performer + if ((s = checkString(cdTextPages_[l].performer->get_text())) != NULL) + newItem = new CdTextItem(CdTextItem::CDTEXT_PERFORMER, l, s); + else + newItem = NULL; + + if ((item = toc->getCdTextItem(trackNr, l, CdTextItem::CDTEXT_PERFORMER)) + != NULL) { + if (newItem == NULL) + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_PERFORMER, l, NULL); + else if (*newItem != *item) + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_PERFORMER, l, s); + } + else if (newItem != NULL) { + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_PERFORMER, l, s); + } + + delete newItem; + + + // Songwriter + if ((s = checkString(cdTextPages_[l].songwriter->get_text())) != NULL) + newItem = new CdTextItem(CdTextItem::CDTEXT_SONGWRITER, l, s); + else + newItem = NULL; + + if ((item = toc->getCdTextItem(trackNr, l, CdTextItem::CDTEXT_SONGWRITER)) + != NULL) { + if (newItem == NULL) + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_SONGWRITER, l, + NULL); + else if (*newItem != *item) + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_SONGWRITER, l, s); + } + else if (newItem != NULL) { + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_SONGWRITER, l, s); + } + + delete newItem; + + + // Composer + if ((s = checkString(cdTextPages_[l].composer->get_text())) != NULL) + newItem = new CdTextItem(CdTextItem::CDTEXT_COMPOSER, l, s); + else + newItem = NULL; + + if ((item = toc->getCdTextItem(trackNr, l, CdTextItem::CDTEXT_COMPOSER)) + != NULL) { + if (newItem == NULL) + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_COMPOSER, l, NULL); + else if (*newItem != *item) + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_COMPOSER, l, s); + } + else if (newItem != NULL) { + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_COMPOSER, l, s); + } + + delete newItem; + + + // Arranger + if ((s = checkString(cdTextPages_[l].arranger->get_text())) != NULL) + newItem = new CdTextItem(CdTextItem::CDTEXT_ARRANGER, l, s); + else + newItem = NULL; + + if ((item = toc->getCdTextItem(trackNr, l, CdTextItem::CDTEXT_ARRANGER)) + != NULL) { + if (newItem == NULL) + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_ARRANGER, l, NULL); + else if (*newItem != *item) + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_ARRANGER, l, s); + } + else if (newItem != NULL) { + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_ARRANGER, l, s); + } + + delete newItem; + + + // Message + if ((s = checkString(cdTextPages_[l].message->get_text())) != NULL) + newItem = new CdTextItem(CdTextItem::CDTEXT_MESSAGE, l, s); + else + newItem = NULL; + + if ((item = toc->getCdTextItem(trackNr, l, CdTextItem::CDTEXT_MESSAGE)) + != NULL) { + if (newItem == NULL) + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_MESSAGE, l, NULL); + else if (*newItem != *item) + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_MESSAGE, l, s); + } + else if (newItem != NULL) { + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_MESSAGE, l, s); + } + + delete newItem; + + + // Isrc + if ((s = checkString(cdTextPages_[l].isrc->get_text())) != NULL) + newItem = new CdTextItem(CdTextItem::CDTEXT_UPCEAN_ISRC, l, s); + else + newItem = NULL; + + if ((item = toc->getCdTextItem(trackNr, l, CdTextItem::CDTEXT_UPCEAN_ISRC)) + != NULL) { + if (newItem == NULL) + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_UPCEAN_ISRC, l, + NULL); + else if (*newItem != *item) + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_UPCEAN_ISRC, l, s); + } + else if (newItem != NULL) { + tocEdit->setCdTextItem(trackNr, CdTextItem::CDTEXT_UPCEAN_ISRC, l, s); + } + + delete newItem; + } +} diff --git a/xdao/TrackInfoDialog.h b/xdao/TrackInfoDialog.h new file mode 100644 index 0000000..90ecc04 --- /dev/null +++ b/xdao/TrackInfoDialog.h @@ -0,0 +1,98 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __TRACK_INFO_DIALOG_H__ +#define __TRACK_INFO_DIALOG_H__ + +#include <gtkmm.h> +#include <gtk/gtk.h> +#include <string> + +class Toc; +class TocEdit; +class TocEditView; +class TextEdit; + +class TrackInfoDialog : public Gtk::Dialog { +public: + TrackInfoDialog(); + ~TrackInfoDialog(); + + bool on_delete_event(GdkEventAny*); + + void update(unsigned long, TocEditView *); + + void start(TocEditView *); + void stop(); + +private: + TocEditView *tocEditView_; + int active_; + + int selectedTrack_; + + Gtk::Button *applyButton_; + + Gtk::Label *trackNr_; + Gtk::Label *pregapLen_; + Gtk::Label *trackStart_; + Gtk::Label *trackEnd_; + Gtk::Label *trackLen_; + Gtk::Label *indexMarks_; + + Gtk::CheckButton *copyFlag_; + Gtk::CheckButton *preEmphasisFlag_; + + Gtk::RadioButton *twoChannelAudio_; + Gtk::RadioButton *fourChannelAudio_; + + TextEdit *isrcCodeCountry_; + TextEdit *isrcCodeOwner_; + TextEdit *isrcCodeYear_; + TextEdit *isrcCodeSerial_; + + struct CdTextPage { + Gtk::Label *label; + Gtk::Entry *title; + Gtk::Entry *performer; + Gtk::Entry *songwriter; + Gtk::Entry *composer; + Gtk::Entry *arranger; + Gtk::Entry *message; + Gtk::Entry *isrc; + }; + + CdTextPage cdTextPages_[8]; + + void closeAction(); + void applyAction(); + + Gtk::VBox *createCdTextPage(int); + + void clear(); + void clearCdText(); + + const char *checkString(const std::string &); + void importCdText(const Toc *, int); + void importData(const Toc *, int); + void exportCdText(TocEdit *, int); + void exportData(TocEdit *, int); +}; + +#endif diff --git a/xdao/TrackManager.cc b/xdao/TrackManager.cc new file mode 100644 index 0000000..d1bb44e --- /dev/null +++ b/xdao/TrackManager.cc @@ -0,0 +1,290 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * $Log: TrackManager.cc,v $ + * Revision 1.2 2004/02/12 01:13:32 poolshark + * Merge from gnome2 branch + * + * Revision 1.1.1.1.6.1 2004/01/05 00:34:03 poolshark + * First checking of gnome2 port + * + * Revision 1.1.1.1 2003/12/09 05:32:28 denis + * Fooya + * + * Revision 1.1.1.1 2000/02/05 01:40:19 llanero + * Uploaded cdrdao 1.1.3 with pre10 patch applied. + * + * Revision 1.2 1999/05/24 18:10:25 mueller + * Adapted to new reading interface of 'trackdb'. + * + * Revision 1.1 1998/11/20 18:56:46 mueller + * Initial revision + * + */ + +#include <stdio.h> +#include <assert.h> + +#include "TrackManager.h" + +#include "Toc.h" +#include "util.h" + +TrackManager::TrackManager(gint trackMarkerWidth) +{ + trackMarkerWidth_ = trackMarkerWidth; + width_ = 0; + entries_ = NULL; + lastEntry_ = NULL; + iterator_ = NULL; +} + +TrackManager::~TrackManager() +{ + clear(); +} + +void TrackManager::clear() +{ + EntryList *next; + + while (entries_ != NULL) { + next = entries_->next; + delete entries_->ent; + delete entries_; + entries_ = next; + } + + lastEntry_ = NULL; + iterator_ = NULL; +} + +void TrackManager::append(Entry *ent) +{ + EntryList *entry = new EntryList; + entry->ent = ent; + entry->next = NULL; + + if (entries_ == NULL) + entries_ = entry; + else + lastEntry_->next = entry; + + lastEntry_ = entry; +} + + +const TrackManager::Entry *TrackManager::first() +{ + if ((iterator_ = entries_) != NULL) + return iterator_->ent; + else + return NULL; +} + +const TrackManager::Entry *TrackManager::next() +{ + if (iterator_ == NULL || + (iterator_ = iterator_->next) == NULL) + return NULL; + else + return iterator_->ent; +} + + +void TrackManager::select(const Entry *ent) +{ + EntryList *run; + + for (run = entries_; run != NULL; run = run->next) { + if (run->ent == ent) + run->ent->selected = 1; + else + run->ent->selected = 0; + } +} + +void TrackManager::select(int trackNr, int indexNr) +{ + EntryList *run; + + for (run = entries_; run != NULL; run = run->next) { + if (run->ent->trackNr == trackNr && run->ent->indexNr == indexNr) + run->ent->selected = 1; + else + run->ent->selected = 0; + } +} + +const TrackManager::Entry *TrackManager::pick(gint x, gint *stopXMin, + gint *stopXMax) +{ + EntryList *run; + Entry *pred; + + for (run = entries_, pred = NULL; run != NULL; + pred = run->ent, run = run->next) { + if ((run->ent->indexNr == 1 || run->ent->selected)&& + run->ent->extend == 0 && + run->ent->drawn && + x >= run->ent->xpos && x < run->ent->xpos + trackMarkerWidth_) { + + if (stopXMin != NULL) + *stopXMin = pred != NULL ? pred->xpos + 1 : 0; + + if (stopXMax != NULL) + *stopXMax = run->next != NULL ? run->next->ent->xpos - 1 : width_ - 1; + + return run->ent; + } + } + + for (run = entries_, pred = NULL; run != NULL; + pred = run->ent, run = run->next) { + if (run->ent->indexNr != 1 && run->ent->extend == 0 && + run->ent->drawn && + x >= run->ent->xpos && x < run->ent->xpos + trackMarkerWidth_) { + + if (stopXMin != NULL) + *stopXMin = pred != NULL ? pred->xpos : 0; + + if (stopXMax != NULL) + *stopXMax = run->next != NULL ? run->next->ent->xpos : width_; + + return run->ent; + } + } + + return NULL; +} + + +void TrackManager::update(const Toc *toc, unsigned long start, + unsigned long end, gint width) +{ + Msf tstart, tend; + long startLba = start / SAMPLES_PER_BLOCK; + long startRest = start % SAMPLES_PER_BLOCK; + long endLba = end / SAMPLES_PER_BLOCK; + int trackNr; + const Track *t; + Entry *ent; + int nindex, index; + long markStart = -1; + int last = 0; + + clear(); + + width_ = width; + + TrackIterator itr(toc); + + if (toc == NULL || start == end || + (t = itr.find(start, tstart, tend, &trackNr)) == NULL) + return; + + double samp2pix = double(width - 1) / double(end - start); +#define lba2pixel(lba) \ +gint(double(((lba) * SAMPLES_PER_BLOCK) - start) * samp2pix + 0.5) + + + nindex = t->nofIndices(); + + if (startLba < tstart.lba()) { + // 'start' is in pre-gap of track + ent = new Entry(t, trackNr, 0, 0); + + markStart = tstart.lba() - t->start().lba(); + index = 0; + } + else { + if (nindex == 0 || startLba <= tstart.lba() + t->getIndex(0).lba()) { + markStart = tstart.lba(); + index = 1; + } + else { + for (index = 3; index - 2 < nindex; index++) { + if (startLba >= tstart.lba() + t->getIndex(index - 3).lba() && + startLba < tstart.lba() + t->getIndex(index - 2).lba()) { + markStart = tstart.lba() + t->getIndex(index - 3).lba(); + index--; + break; + } + } + if (markStart == -1) { + markStart = tstart.lba() + t->getIndex(nindex - 1).lba(); + index = nindex + 1; + } + } + } + + ent = new Entry(t, trackNr, index, 0); + if (startLba != markStart || startRest > 0) + ent->extend = 1; + append(ent); + + if (index == 0 && tstart.lba() <= endLba) + append(new Entry(t, trackNr, 1, lba2pixel(tstart.lba()))); + + if (index == 0) + index = 1; + + index++; + + for (; index - 2 < nindex; index++) { + if (tstart.lba() + t->getIndex(index - 2).lba() > endLba) + break; + + append(new Entry(t, trackNr, index, + lba2pixel(tstart.lba() + t->getIndex(index - 2).lba()))); + } + + while ((t = itr.next(tstart, tend)) != NULL) { + trackNr++; + + if (t->start().lba() != 0) { + if (tstart.lba() - t->start().lba() > endLba) + break; + + append(new Entry(t, trackNr, 0, + lba2pixel(tstart.lba() - t->start().lba()))); + } + + if (tstart.lba() > endLba) + break; + + append(new Entry(t, trackNr, 1, lba2pixel(tstart.lba()))); + + last = 0; + + nindex = t->nofIndices(); + + for (index = 0; index < nindex; index++) { + if (tstart.lba() + t->getIndex(index).lba() > endLba) { + last = 1; + break; + } + append(new Entry(t, trackNr, index + 2, + lba2pixel(tstart.lba() + t->getIndex(index).lba()))); + } + + if (last) + break; + } +} diff --git a/xdao/TrackManager.h b/xdao/TrackManager.h new file mode 100644 index 0000000..19ee664 --- /dev/null +++ b/xdao/TrackManager.h @@ -0,0 +1,97 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +/* + * $Log: TrackManager.h,v $ + * Revision 1.2 2004/02/12 01:13:32 poolshark + * Merge from gnome2 branch + * + * Revision 1.1.1.1.6.1 2004/01/05 00:34:03 poolshark + * First checking of gnome2 port + * + * Revision 1.1.1.1 2003/12/09 05:32:28 denis + * Fooya + * + * Revision 1.1.1.1 2000/02/05 01:38:55 llanero + * Uploaded cdrdao 1.1.3 with pre10 patch applied. + * + * Revision 1.1 1998/11/20 18:56:46 mueller + * Initial revision + * + */ + +#ifndef __TRACK_MANAGER_H +#define __TRACK_MANAGER_H + +#include <glib.h> + +class Toc; +class Track; + +class TrackManager { +public: + struct Entry { + Entry(const Track *t, int tn, int in, gint x) { + track = t; trackNr = tn; indexNr = in; xpos = x; + extend = 0; drawn = 1; selected = 0; + } + const Track *track; + int trackNr; + int indexNr; + gint xpos; + unsigned int extend : 1; + unsigned int drawn : 1; + unsigned int selected : 1; + }; + + TrackManager(gint trackMarkerWidth); + ~TrackManager(); + + void update(const Toc *, unsigned long start, unsigned long end, gint width); + + // returns entry that is picked at given x-postion + const Entry *pick(gint x, gint *stopXMin, gint *stopXMax); + + // selects given entry, use 'NULL' to unselect all + void select(const Entry *); + + // selected entry with specified track/index + void select(int trackNr, int indexNr); + + // iterates entries + const Entry *first(); + const Entry *next(); + + +private: + struct EntryList { + Entry *ent; + EntryList *next; + }; + + gint trackMarkerWidth_; + gint width_; + EntryList *entries_; + EntryList *lastEntry_; + EntryList *iterator_; + + void clear(); + void append(Entry *); +}; + +#endif diff --git a/xdao/gcdmaster-doc.png b/xdao/gcdmaster-doc.png new file mode 100644 index 0000000..1384b11 Binary files /dev/null and b/xdao/gcdmaster-doc.png differ diff --git a/xdao/gcdmaster.applications b/xdao/gcdmaster.applications new file mode 100644 index 0000000..625c388 --- /dev/null +++ b/xdao/gcdmaster.applications @@ -0,0 +1,7 @@ +gcdmaster + command=gcdmaster + name=Gnome Audio CD Master + can_open_multiple_files=true + expects_uris=false + requires_terminal=false + mime_types=application/x-toc,application/x-cue,audio/x-mpegurl diff --git a/xdao/gcdmaster.cc b/xdao/gcdmaster.cc new file mode 100644 index 0000000..d52c21e --- /dev/null +++ b/xdao/gcdmaster.cc @@ -0,0 +1,480 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <gtkmm.h> +#include <gnome.h> + +#include "config.h" + +#include "xcdrdao.h" +#include "guiUpdate.h" +#include "DeviceConfDialog.h" +#include "PreferencesDialog.h" +#include "ProjectChooser.h" +#include "gcdmaster.h" +#include "TocEdit.h" +#include "util.h" +#include "AudioCDProject.h" +#include "DuplicateCDProject.h" +#include "BlankCDDialog.h" +#include "DumpCDProject.h" +#include "Icons.h" + +// Static class members +std::list<GCDMaster *> GCDMaster::apps; + +GCDMaster::GCDMaster() : Gnome::UI::App("gcdmaster", APP_NAME) +{ + set_title(APP_NAME); + + project_number = 0; + about_ = 0; + project_ = 0; + chooser_ = 0; + + set_resizable(); + set_wmclass("gcdmaster", "GCDMaster"); + + readFileSelector_ = + new Gtk::FileChooserDialog(_("Please select a project"), + Gtk::FILE_CHOOSER_ACTION_OPEN); + readFileSelector_->set_transient_for(*this); + readFileSelector_->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + readFileSelector_->add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK); + + Gtk::FileFilter* filter_tocs = new Gtk::FileFilter; + manage(filter_tocs); +#ifdef HAVE_MP3_SUPPORT + filter_tocs->set_name("Content Files (*.toc, *.cue, *.m3u)"); +#else + filter_tocs->set_name("Content Files (*.toc, *.cue)"); +#endif + filter_tocs->add_pattern("*.toc"); + filter_tocs->add_pattern("*.cue"); +#ifdef HAVE_MP3_SUPPORT + filter_tocs->add_pattern("*.m3u"); +#endif + readFileSelector_->add_filter(*filter_tocs); + + Gtk::FileFilter* filter_all = new Gtk::FileFilter; + manage(filter_all); + filter_all->set_name("Any files"); + filter_all->add_pattern("*"); + readFileSelector_->add_filter(*filter_all); + + Icons::registerStockIcons(); + notebook_.set_show_border(false); + set_contents(notebook_); + + createMenus(); + createStatusbar(); + + apps.push_back(this); +} + +void GCDMaster::createMenus() +{ + //Define the actions: + m_refActionGroup = Gtk::ActionGroup::create("Actions"); + + // File + m_refActionGroup->add( Gtk::Action::create("FileMenu", _("_File")) ); + m_refActionGroup->add( Gtk::Action::create("New", Gtk::Stock::NEW), + sigc::mem_fun(*this, &GCDMaster::newChooserWindow) ); + + // File->New + m_refActionGroup->add( Gtk::Action::create("FileNewMenu", _("N_ew")) ); + m_refActionGroup->add( Gtk::Action::create("NewAudioCD", Gtk::Stock::NEW, + _("_Audio CD"), + _("New Audio CD")), + sigc::mem_fun(*this, &GCDMaster::newAudioCDProject2) ); + + m_refActionGroup->add( Gtk::Action::create("NewDuplicateCD", Gtk::Stock::NEW, + _("_Duplicate CD"), + _("Make a copy of a CD")), + sigc::mem_fun(*this, &GCDMaster::newDuplicateCDProject) ); + + m_refActionGroup->add( Gtk::Action::create("NewDumpCD", Gtk::Stock::NEW, + _("_Copy CD to disk"), + _("Dump CD to disk")), + sigc::mem_fun(*this, &GCDMaster::newDumpCDProject) ); + + m_refActionGroup->add( Gtk::Action::create("Open", Gtk::Stock::OPEN), + sigc::mem_fun(*this, &GCDMaster::openProject) ); + + m_refActionGroup->add( Gtk::Action::create("Close", Gtk::Stock::CLOSE), + sigc::hide_return(sigc::mem_fun(*this, &GCDMaster::closeProject))); + + m_refActionGroup->add( Gtk::Action::create("Quit", Gtk::Stock::QUIT), + &GCDMaster::appClose); + + // Edit + m_refActionGroup->add( Gtk::Action::create("EditMenu", _("_Edit")) ); + + + // Actions menu + m_refActionGroup->add( Gtk::Action::create("ActionsMenu", _("_Actions")) ); + m_refActionGroup->add( Gtk::Action::create("BlankCD", Gtk::Stock::CDROM, + _("Blank CD-RW"), + _("Erase a CD-RW")), + sigc::mem_fun(*this, &GCDMaster::blankCDRW) ); + + // Settings + m_refActionGroup->add( Gtk::Action::create("SettingsMenu", _("_Settings")) ); + m_refActionGroup->add( Gtk::Action::create("ConfigureDevices", Gtk::Stock::PREFERENCES, + _("Configure Devices..."), + _("Configure the read and recording devices")), + sigc::mem_fun(*this, &GCDMaster::configureDevices) ); + m_refActionGroup->add( Gtk::Action::create("Preferences", Gtk::Stock::PREFERENCES, + _("_Preferences..."), + _("Set various preferences and parameters")), + sigc::mem_fun(*this, &GCDMaster::configurePreferences)); + + // Help + m_refActionGroup->add( Gtk::Action::create("HelpMenu", _("_Help")) ); +//FIXME: llanero Gtk::Stock::ABOUT ??? + m_refActionGroup->add( Gtk::Action::create("About", _("About")), + sigc::mem_fun(*this, &GCDMaster::aboutDialog) ); + + m_refUIManager = Gtk::UIManager::create(); + m_refUIManager->insert_action_group(m_refActionGroup); + add_accel_group(m_refUIManager->get_accel_group()); + + //Layout the actions in a menubar and toolbar: + try + { + Glib::ustring ui_info = + "<ui>" + " <menubar name='MenuBar'>" + " <menu action='FileMenu'>" + " <menuitem action='New'/>" + " <menu action='FileNewMenu'>" + " <menuitem action='NewAudioCD'/>" + " <menuitem action='NewDuplicateCD'/>" + " <menuitem action='NewDumpCD'/>" + " </menu>" + " <menuitem action='Open'/>" + " <placeholder name='FileSaveHolder'/>" + " <separator/>" + " <menuitem action='Close'/>" + " <menuitem action='Quit'/>" + " </menu>" + " <menu action='EditMenu'/>" + " <menu action='ActionsMenu'>" + " <placeholder name='ActionsRecordHolder'/>" + " <menuitem action='BlankCD'/>" + " <separator/>" + " </menu>" + " <menu action='SettingsMenu'>" + " <menuitem action='ConfigureDevices'/>" + " <separator/>" + " <menuitem action='Preferences'/>" + " </menu>" + " <menu action='HelpMenu'>" + " <menuitem action='About'/>" + " </menu>" + " </menubar>" + " <toolbar name='ToolBar'>" + " <toolitem action='New'/>" + " <toolitem action='Open'/>" + " </toolbar>" + "</ui>"; + + m_refUIManager->add_ui_from_string(ui_info); + } + catch(const Glib::Error& ex) + { + std::cerr << "building menus failed: " << ex.what() << "\n"; + exit(1); + } + + Gtk::Widget* pMenuBar = m_refUIManager->get_widget("/MenuBar"); + set_menus(dynamic_cast<Gtk::MenuBar&>(*pMenuBar)); + Gtk::Widget* pToolbar = m_refUIManager->get_widget("/ToolBar"); + set_toolbar(dynamic_cast<Gtk::Toolbar&>(*pToolbar)); +} + +bool GCDMaster::openNewProject(const char* s) +{ + TocEdit* tocEdit; + + if (s == NULL || *s == 0 || s[strlen(s) - 1] == '/') + return false; + + FileExtension type = fileExtension(s); + switch (type) { + + case FE_M3U: + newAudioCDProject("", NULL, s); + break; + + case FE_TOC: + tocEdit = new TocEdit(NULL, NULL); + if (tocEdit->readToc(stripCwd(s)) == 0) + newAudioCDProject(stripCwd(s), tocEdit); + else + return false; + break; + + case FE_CUE: + tocEdit = new TocEdit(NULL, NULL); + if (tocEdit->readToc(stripCwd(s)) == 0) + newAudioCDProject("", tocEdit); + else + return false; + break; + + default: + printf("Could not open \"%s\": format not supported.\n", s); + return false; + break; + } + + return true; +} + +void GCDMaster::openProject() +{ + readFileSelector_->present(); + int result = readFileSelector_->run(); + readFileSelector_->hide(); + + if (result == Gtk::RESPONSE_OK) { + std::string s = readFileSelector_->get_filename(); + openNewProject(s.c_str()); + } +} + +bool GCDMaster::closeProject() +{ + if (chooser_) + closeChooser(); + + if (project_) { + if (project_->closeProject()) { + delete project_; + project_ = NULL; + } else { + return false; // User clicked on cancel + } + } + + if (readFileSelector_) + delete readFileSelector_; + + apps.remove(this); + delete this; + + if (apps.size() == 0) + Gnome::Main::quit(); // Quit if there are not remaining windows + + return true; +} + +void GCDMaster::closeChooser() +{ + delete chooser_; + chooser_ = NULL; +} + +bool GCDMaster::on_delete_event(GdkEventAny* e) +{ + closeProject(); + return true; +} + +// Application Close. Called when the user selects 'Quit' from the +// menu. Try to close all project windows and quit. + +void GCDMaster::appClose() +{ + // Can't just iterate, as closeProject will remove its object from + // the list. + while (apps.size() > 0) { + + if (!(*(GCDMaster::apps.begin()))->closeProject()) + return; + } + + return; +} + +void GCDMaster::newChooserWindow() +{ + if (project_ || chooser_) { + + GCDMaster *gcdmaster = new GCDMaster; + gcdmaster->newChooserWindow(); + gcdmaster->show(); + + } else { + + chooser_ = new ProjectChooser(); + chooser_->newAudioCDProject.connect(sigc::mem_fun(*this, + &GCDMaster::newAudioCDProject2)); + chooser_->newDuplicateCDProject.connect(sigc::mem_fun(*this, + &GCDMaster::newDuplicateCDProject)); + chooser_->newDumpCDProject.connect(sigc::mem_fun(*this, + &GCDMaster::newDumpCDProject)); + chooser_->show(); + notebook_.set_show_tabs(false); + notebook_.append_page(*chooser_); + } +} + +void GCDMaster::newAudioCDProject(const char *name, TocEdit *tocEdit, + const char* tracks) +{ + if (!project_) { + + AudioCDProject* p = new AudioCDProject(project_number++, name, tocEdit, + this); + p->add_menus(m_refUIManager); + p->configureAppBar(statusbar_, progressbar_, progressButton_); + + project_ = p; + project_->show(); + if (chooser_) + closeChooser(); + notebook_.remove_page(); + notebook_.set_show_tabs(false); + notebook_.append_page(*project_); + if (tracks) + p->appendTrack(tracks); + + } else { + + GCDMaster *gcdmaster = new GCDMaster; + gcdmaster->newAudioCDProject(name, tocEdit, tracks); + gcdmaster->show(); + } +} + +void GCDMaster::newAudioCDProject2() +{ + newAudioCDProject("", NULL); +} + +void GCDMaster::newDuplicateCDProject() +{ + if (!project_) { + + project_ = new DuplicateCDProject(this); + project_->show(); + if (chooser_) + closeChooser(); + notebook_.remove_page(); + notebook_.set_show_tabs(false); + notebook_.append_page(*project_); + set_title(_("Duplicate CD")); + + } else { + + GCDMaster *gcdmaster = new GCDMaster; + gcdmaster->newDuplicateCDProject(); + gcdmaster->show(); + } +} + +void GCDMaster::newDumpCDProject() +{ + if (!project_) { + + project_ = new DumpCDProject(this); + project_->show(); + if (chooser_) + closeChooser(); + notebook_.remove_page(); + notebook_.set_show_tabs(false); + notebook_.append_page(*project_); + set_title(_("Dump CD to disk")); + + } else { + + GCDMaster *gcdmaster = new GCDMaster; + gcdmaster->newDumpCDProject(); + gcdmaster->show(); + } +} + +void GCDMaster::update(unsigned long level) +{ + if (project_) + project_->update(level); + + blankCDDialog_.update(level); +} + +void GCDMaster::configureDevices() +{ + deviceConfDialog->start(); +} + +void GCDMaster::configurePreferences() +{ + preferencesDialog->show_all(); +} + +void GCDMaster::blankCDRW() +{ + blankCDDialog_.start(*this); +} + +void GCDMaster::createStatusbar() +{ + Gtk::HBox *container = new Gtk::HBox; + statusbar_ = new Gnome::UI::AppBar(false, true, + Gnome::UI::PREFERENCES_NEVER); + progressbar_ = new Gtk::ProgressBar; + progressButton_ = new Gtk::Button(_("Cancel")); + progressButton_->set_sensitive(false); + + progressbar_->set_size_request(150, -1); + container->pack_start(*statusbar_, true, true); + container->pack_start(*progressbar_, false, false); + container->pack_start(*progressButton_, false, false); + set_statusbar_custom(*container, *statusbar_); + container->set_spacing(2); + container->set_border_width(2); + container->show_all(); + install_menu_hints(); +} + +void GCDMaster::aboutDialog() +{ + if (about_) { + // "About" dialog hasn't been closed, so just raise it + about_->present(); + + } else { + + std::vector<std::string> authors; + authors.push_back("Andreas Mueller <mueller@daneb.ping.de>"); + authors.push_back("Manuel Clos <llanero@jazzfree.com>"); + authors.push_back("Denis Leroy <denis@poolshark.org>"); + std::vector<std::string> comments; + + about_ = new Gnome::UI::About("gcdmaster", VERSION, + "(C) Andreas Mueller", + authors, comments); + + about_->set_transient_for(*this); + about_->show(); + } +} diff --git a/xdao/gcdmaster.desktop b/xdao/gcdmaster.desktop new file mode 100644 index 0000000..7e46eb4 --- /dev/null +++ b/xdao/gcdmaster.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=Gnome CD Master +Comment=Gnome Audio CD editor and burner +Exec=gcdmaster %F +Icon=gcdmaster.png +Terminal=false +Type=Application +StartupNotify=true +Categories=GNOME;AudioVideo;Application;X-Fedora; diff --git a/xdao/gcdmaster.h b/xdao/gcdmaster.h new file mode 100644 index 0000000..f8307dc --- /dev/null +++ b/xdao/gcdmaster.h @@ -0,0 +1,89 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __GCDMASTER_H__ +#define __GCDMASTER_H__ + +#include <gtkmm.h> +#include <gtk/gtk.h> +#include <libgnomeuimm.h> +#include <libglademm/xml.h> + +#include <list> + +class ProjectChooser; +class BlankCDDialog; +#include "Project.h" +#include "BlankCDDialog.h" + +class GCDMaster : public Gnome::UI::App +{ +public: + GCDMaster(); + + bool closeProject(); + void closeChooser(); + bool on_delete_event(GdkEventAny* e); + bool openNewProject(const char*); + void openProject(); + void newChooserWindow(); + void newAudioCDProject2(); + void newAudioCDProject(const char *name, TocEdit *tocEdit, + const char* tracks = NULL); + void newDuplicateCDProject(); + void newDumpCDProject(); + + void update(unsigned long level); + + void configureDevices(); + void configurePreferences(); + void blankCDRW(); + + void registerStockIcons(); + + static void appClose(); + + static std::list<GCDMaster *> apps; + +private: + Project* project_; + ProjectChooser* chooser_; + gint project_number; + + BlankCDDialog blankCDDialog_; + + Gtk::Notebook notebook_; + + Glib::RefPtr<Gtk::UIManager> m_refUIManager; + Glib::RefPtr<Gtk::ActionGroup> m_refActionGroup; + + Gnome::UI::AppBar* statusbar_; + Gtk::ProgressBar* progressbar_; + Gtk::Button* progressButton_; + Gnome::UI::About* about_; + + Glib::RefPtr<Gnome::Glade::Xml> m_refPreferencesXml; + + Gtk::FileChooserDialog* readFileSelector_; + void createMenus(); + void createStatusbar(); + void aboutDialog(); +}; + +#endif diff --git a/xdao/gcdmaster.keys b/xdao/gcdmaster.keys new file mode 100644 index 0000000..3f8b65e --- /dev/null +++ b/xdao/gcdmaster.keys @@ -0,0 +1,29 @@ + +application/x-toc + description=Audio CD content + category=Audio + open=gcdmaster %f + view=gcdmaster %f + icon-filename=/usr/share/pixmaps/gcdmaster-doc.png + +application/x-cue + description=Audio CD content + category=Audio + open=gcdmaster %f + view=gcdmaster %f + icon-filename=/usr/share/pixmaps/gcdmaster-doc.png + +application/x-ogg + short_list_application_ids_for_novice_user_level=gcdmaster + short_list_application_ids_for_intermediate_user_level=gcdmaster + short_list_application_ids_for_advanced_user_level=gcdmaster + +application/ogg + short_list_application_ids_for_novice_user_level=gcdmaster + short_list_application_ids_for_intermediate_user_level=gcdmaster + short_list_application_ids_for_advanced_user_level=gcdmaster + +application/x-mp3 + short_list_application_ids_for_novice_user_level=gcdmaster + short_list_application_ids_for_intermediate_user_level=gcdmaster + short_list_application_ids_for_advanced_user_level=gcdmaster diff --git a/xdao/gcdmaster.man b/xdao/gcdmaster.man new file mode 100644 index 0000000..63dfd77 --- /dev/null +++ b/xdao/gcdmaster.man @@ -0,0 +1,564 @@ +.TH GCDMASTER 1 "Oct 10, 1999" +.SH NAME +gcdmaster \- Graphical front end to cdrdao for composing audio CDs +.SH SYNOPSIS +.B gcdmaster +.RI [ toc-file ] +.SH DESCRIPTION +.I gcdmaster +allows the creation of toc-files for cdrdao and can control the +recording process. Its main application is the composition of audio +CDs from one or more audio files. It supports PQ-channel editing, +entry of meta data like ISRC codes/CD-TEXT and non destructive cut of +the audio data. + +If a +.I toc-file +is specified it will be read and the referenced audio data will be displayed. +It is also possible to specify a ".cue" file. + +The GUI periodically polls all configured CD-ROM and CD-recorder +devices (see section DEVICE CONFIGURE DIALOG) to retrieve their status +(ready, busy, no disk). This is done by sending a TEST UNIT READY +command to the devices. Following problems may arise: +.TP +o +Some devices (e.g. the Philips CDD2600) block the SCSI bus when a TEST +UNIT READY is issued while it logs in a new medium. This will cause a +buffer under run for all currently recording devices that are +connected to the same bus. +.TP +o +The GUI cannot detect if a device is used by another program. It will +continue to poll the device which may disturb the operation of the +other program. +.PP +The GUI supports recording of the same or different projects on +multiple devices in parallel. However, there are some caveats and your +system must meat some prerequisites: +.TP +o +Under Linux a kernel version >= 2.2.6 should be used. The generic SCSI +device of older kernels does not support parallel access to multiple +devices. +.TP +o +The bandwidths of the disks that contain the source data and the involved +busses must be big enough to serve all recorder devices. +.TP +o +Some recorder devices may block the SCSI bus when the disk is ejected +by the software after the burning process (e.g. the Plextor PX-R412). +For this reason a warning message will be displayed if the "Eject" +button is checked in the "Record" dialog. Manually ejecting a disk +seems not to be a problem. +.TP +o +ATAPI devices supported by the 'generic-mmc' driver will block the IDE +bus while writing the lead-in and lead-out. Thus parallel writing with +such devices connected to the same IDE channel will not work. There is +a way to avoid this blocking with some ATAPI devices but it is not +implemented, yet. + +.SH CONCEPTS +The main idea of this GUI is to maintain a continuous stream of audio +data that can be composed of several audio files. It is possible to +use only portions of audio files in the audio stream which is the +basic idea for the non destructive cut capability. + +For example, if you cut out some samples in the middle of an audio +file the result will be a portion that starts at the beginning of the +audio file and ends at the beginning of the cut region and a second +portion that starts at the end of the cut region and reaches until the +end of the audio file. Of course, all of this is hidden by the GUI and +you will just see the result. + +Track and index marks are placed relatively to the continuous audio +stream. It is not necessary to have a separate audio file for each +track. Track/index marks can be set, moved and deleted without +influencing the audio data stream. + +.SS Sample Marker +A sample marker serves as an insertion position for audio data. It is +equivalent to the cursor of a text editor. All functions that insert +audio data require a defined marker. At most one sample marker may be +active at any time. + +.SS Sample Selection +A sample selection specifies a continuous range of audio samples. At +most one sample selection may be active at any time. + +.SS Track Mark +A track mark specifies a point in the audio stream where the track +number or the index number changes. Track marks are written as a pair +of two numbers like 5.1 for track 5, index 1. Track numbers may be in +the range 1..99, the valid range for index numbers is 0..99. Index 0 +represents the pre-gap of a track where the track relative time counts +backwards down to zero. Index 1 marks the real start of the +track. This position is stored in the central toc of the CD and is +used by CD players to directly jump to a track. All index numbers > 2 +may be used to subdivide a track but have no further effect. Some CD +players may jump to such index marks. + +Track marks may be selected to show data about a track or to perform +operations on the complete track. At most one track mark may be +selected at any time. + +.SS Times +The time is usually displayed as m:s:f.x where m represents minutes, s +represents seconds (0..59), f represents frames (0..74, 1/75 second) +and x stands for samples (0..587, 1/44100 second). + +.SH MAIN WINDOW + +The main window consists of a menu bar, a sample display, a +marker/selection line, a button line and a status line. + +The title of the main window shows the current toc-file name. A "(*)" +behind the name indicates that changes have not been saved. + +.SS Menu Bar +The functions that are accessible via the menu bar are described in +section MENU FUNCTIONS. + +.SS Sample Display +The sample display provides a visual representation of the audio +stream and the placed track/index markers. + +The samples are displayed as two separate graphs for the left and +right channel where the x-axis represents the time and the y-axis +denotes the amplitude (linearly scaled). If a pixel represents more +than 1 sample the maximum and minimum amplitude of all samples that +fall within this pixel is displayed. It is possible to zoom in and out +and change the displayed portion with the scroll bar. + +The track/index markers are shown on top of the two graphs. Track +marks with index 1 are represented by filled track symbol. All other +track marks use a hollow track symbol. The track/index number pair is +displayed on the right side of a track symbol. + +Track marks can be selected or moved by clicking or dragging with the +mouse pointer located over a track symbol. The track/index number +pairs are not sensitive. + +.SS Marker/Selection Line + +This line shows the actual cursor and active marker position and the +active sample selection. + +The cursor field is read-only and shows the time value of the actual mouse +pointer position within the audio stream if it is located inside the +sample display. During playback the cursor field shows the time value +of currently audible sound. + +The marker field shows the time value of the active marker. A time +value may be entered and hitting the return key sets the new marker +position if the time value is valid. + +The sample selection fields show the active selected sample +range. Time values may be entered and hitting the return key in one of +these fields sets the new sample selection if the time values are valid. + +.SS Button Line + +The zoom/select radio buttons specify the behavior when dragging with +the mouse in the sample display. If "zoom" is active the sample +display will zoom to selected sample range. If "select" is active the +active sample selection will be set to the selected sample range. + +The play button will playback the currently active sample selection +via the sound card. If no sample selection is active the currently +displayed sample range will be used. While playing the current project +is set to read-only state and all operations that would modify the +project are disabled. + +.SS Status Line + +The status line shows more information about the last executed action +or an error message if an action could not be executed. + +.SH MENU FUNCTIONS +.SS File->New +Starts a new project. If the current work is not saved a confirmation +box will be opened. + +.SS File->Open +Opens a file selector box to select a toc-file or a .cue file that +should be read. If the current work is not saved a confirmation box +will pop up. + +.SS File->Save +Saves current work as a toc-file with the current file name. + +.SS File->Save As +Opens a file sector box to select a toc-file to which the current work +is saved. + +.SS File->Quit +Quits gcdmaster. If the current work is not saved a confirmation box +will pop up. + +.SS View->Zoom To Selection +Zooms the sample display to the currently active sample selection. If +no sample selection is active nothing will happen. + +.SS View->Zoom out +Doubles the range of displayed samples. + +.SS View->Fullview +Shows all samples of the audio stream in the sample display. + +.SS Edit->Cut +Removes the active selected sample range from the audio stream. The +audio file on the disk will not be touched by this operation. The +sample marker will be set so that a following "Paste" operation will +revert the effect of this operation. + +If no sample selection is active nothing will happen. + +.SS Edit->Paste +Pastes the samples that were previously removed with "Cut" at the +current sample marker position. The sample selection is +set to the pasted samples so that a following "Cut" operation will +revert the effect of this operation. + +If no sample marker is set nothing will happen. + +.SS Edit->Add Track Mark +Adds a track mark with index 1 at the active sample marker +position. The position will be rounded to the next frame boundary. If the +previous or the new track would be shorter than 4 seconds no track mask is +created. + +If no sample marker is active nothing will happen. + +.SS Edit->Add Index Mark +Adds a track mark with index > 1 at the active sample marker +position. The position will be rounded to the next frame +boundary. Index marks cannot be created in the pre-gap area of a +track. + +If no sample marker is active nothing will happen. + +.SS Edit->Add Pre-Gap +Adds a track mark with index 0 (pre-gap) at the active sample marker +position. Index 0 can only be added right before a track mark with +index 1. If the length of the previous track would be shorter than 4 +seconds after inserting the pre-gap this operation is not performed. + +If no sample marker is active nothing will happen. + +.SS Edit->Remove Track Mark +Removes selected track mark with any index. If a track mark with index +1 is removed all track marks of this track will be removed. + +If no track marker is selected nothing will happen. + +.SS Tools->Disk Info +Opens the non modal "Disk Info" dialog box. See section DISK INFO +DIALOG for more details. + +.SS Tools->Track Info +Opens the non modal "Track Info" dialog box. See section TRACK INFO +DIALOG for more details. + +.SS Tools->Append Track +Opens a non modal file selector dialog box to select an audio file +that will be completely appended to the audio stream. A track mark +with index 1 is added at the beginning of the appended audio data. + +The non modal file selector box is shared for "Tools->Append Track", +"Tools->Append File" and "Tools->Insert File". + +.SS Tools->Append File +Opens a non modal file selector dialog box to select an audio file +that will be completely appended to the audio stream. + +The non modal file selector box is shared for "Tools->Append Track", +"Tools->Append File" and "Tools->Insert File". + +.SS Tools->Insert File +Opens a non modal file selector dialog box to select an audio file +that will be completely inserted in the audio stream at the active +marker position. If no sample marker is active nothing will happen. + +The non modal file selector box is shared for "Tools->Append Track", +"Tools->Append File" and "Tools->Insert File". + +.SS Tools->Append Silence +Opens a non modal dialog box that can be used to append silence to the +audio stream. + +The non model dialog box is shared for "Tools->Append Silence" and +"Tools->Insert Silence". + +.SS Tools->Insert Silence +Opens a non modal dialog box that can be used to insert silence in the +audio stream at the active marker position. If no sample marker is +active nothing will happen. + +The non model dialog box is shared for "Tools->Append Silence" and +"Tools->Insert Silence". + +.SS Settings->Devices +Opens the non modal "Configure Devices" dialog box. See section DEVICE +CONFIGURE DIALOG for more details. + +.SS Actions->Record +Opens the non modal "Record" dialog box. See section RECORD DIALOG for +more details. + +.SH DISK INFO DIALOG (Tools->Disk Info) +This non modal dialog shows summary information about the whole +project and allows editing of meta data that is valid for the complete +disk. + +The "Apply" button must be used to make changes permanent. If the +summary information changes before the "Apply" button was hit, +e.g. by adding a new track, all changes will be lost. + +The "Cancel" button withdraws all changes and closes the dialog box. + +.SS Summary Frame +Shows the total number of tracks, i.e. number of track marks with +index 1, and the total length of the audio stream. + +.SS Sub-Channel Frame +Allows entry and editing of data that is written to the sub-channels +of a disk. The scope of this data covers the whole disk. + +The "Toc Type" option menu can be used to select the type of the table +of contents that will be written to the disk. Currently, for projects +that are solely created with this GUI only the type "CD-DA" or +"CD-ROM-XA" makes sense. If you read a toc-file that contains data +track specifications another type may be displayed. + +The "UPC/EAN" edit field sets the catalog number of the disk. Exactly +13 digits must be entered to set the catalog number. To clear the +catalog number the edit field must be completely cleared. + +.SS CD-TEXT Frame + +CD-TEXT data can be specified for up to 8 different languages. Each language +is reference by a language number 0..7. The first language should have +language number 0. Language numbers should be used continuously. + +The actual language for a language number is specified with the +"Language" option menu: The option "Unknown" is shown for an unknown +language code (e.g. if the toc-file was edited manually). It is not +possible to select this option. Option "Undefined" means that no +language was assigned for this language number. It is possible to +enter CD-TEXT data and the entered data will be saved to the toc-file +but it will not be recorded to a CD-R/CD-RW. The remaining options +select the desired language. Each language can be assigned only to one +language number. + +The remaining CD-TEXT fields contain ASCII data. It is not necessary +to use them all but at least "Title" and "Performer" should be filled. + +.SH TRACK INFO DIALOG (Tools->Track Info) +This non modal dialog shows information about a selected track and +allows editing of track specific meta data. If no track mark is +selected all fields will be cleared and set insensitive. + +The "Apply" button must be used to make changes permanent. If the +track information changes, e.g. by adding a index mark, or another +track mark is selected before the "Apply" button was hit all changes +will be lost. + +The "Cancel" button withdraws all changes and closes the dialog box. + +.SS Summary Frame +Shows the length of the pre-gap (0 if no pre-gap is defined), the +absolute start and end time, the track length excluding the pre-gap +length and the number of index marks > 1. + +.SS Sub-Channel Frame +Allows editing of all data that is written to the Q sub-channels of +the track: + +.TP +Copy: +Digital copy permitted when selected. + +.TP +Pre Emphasis: +Audio data of track has pre emphasis when selected. + +.TP +Two/Four Channel Audio: +Select "Four Channel Audio" if the audio data encodes more than two +channels. Of course, only two real channels will be recorded on a +CD-R/CD-RW in any case. + +.TP +ISRC: +Allows to edit the ISRC code of the track. The first fields +holds the country code; it will only accept capital letters. The +second field holds the owner code, capital letters and digits are +allowed. The remaining fields holds the year and a serial number and +will only accept digits. All fields must be filled to set the ISRC +code and all fields must be cleared to remove it. + +.SS CD-TEXT Frame +Allows to enter and edit the CD-TEXT data of each language number for +this track. All fields are optional but at least "Title" and +"Performer" should be filled. + +.SH DEVICE CONFIGURE DIALOG (Settings->Devices) +This non modal dialog shows the settings of all attached SCSI or ATAPI +devices that identify themselves as CD-ROM or WORM device. + +All device settings that differ from the default settings will be +permanently stored in the +.I $HOME/.gnome/GnomeCDMaster +configuration file. + +The "Apply" button must be used to make all changes permanent. The +"Reset" button reverts all changes since the last apply or the dialog +box was opened. The "Cancel" button withdraws all changes and closes +the dialog box. + +.SS Devices Frame +The browser shows the SCSI address (bus,id,lun) and the vendor/model +string of all available devices. If devices are not automatically +detected it is possible to add devices manually to the browser (see +"Add Device" Frame). + +The "Status" column shows the actual device status: + +.TP +Ready: +Device has a disk loaded and is ready for an action. +.TP +Busy: +Device is active with an unspecified action. +.TP +Recording: +Device is recording. +.TP +No disk: +Device has no disk loaded. +.TP +Not available: +Device cannot be accessed. +.PP +The "Rescan" button can be used to start the automatic drive +detection process. All changes will be lost and the newly detected +devices take immediate effect without hitting "Apply". + +The "Delete" button removes the selected device. The change takes +immediate effect and all other changes will be lost. + +.SS Device Settings Frame +This frame allows to edit the settings of the currently selected +device. + +.TP +Device Type: +This option menu defines the device type which is used +to control which actions can be performed with this device: CD-ROM: +read only device, CD-R: CD-R recorder device, CD-RW: CD-RW/CD-R +recorder device. + +.TP +Driver: +Option menu to select the driver that is used to access the +device. If the device is known by the internal device database the +correct driver is selected automatically. Otherwise "Undefined" will +be shown and a suitable driver must be selected before any action can +be performed with this device. + +.TP +Driver Options: +Enter special driver options here. The available +options are described in the README (the documentation will be +moved to this place soon). If the device is known by the internal +device database the correct option flags are selected automatically. + +.TP +Device Node: +This field is only required for operating systems that +cannot access a SCSI device by the bus,id,lun triple. In this case the +device node that must be used to access the device should be entered +here. + +.SS Add Device Frame +This frame can be used to manually add a device. The bus,id,lun triple +of the device and the vendor/product string must be specified before +the "Add" button has an effect. It is not possible to overwrite an +existing device with the same bus,id,lun triple. Use the "Delete" +button of the "Devices" frame first in this case. + +.SH RECORD DIALOG (Actions->Record) +This non modal dialog can be used to record the actual project on a +CD-R/CD-RW. It is possible to record the actual project on multiple +recorders simultaneously. + +The "Start" button will start recording processes on all devices that +are selected in the "Available Recorder Devices" browser. For this +purpose the +.I cdrdao +executable will be called and should be available in your PATH. +For each selected device a non modal progress dialog will be opened. + +After the recording is started on all selected devices it is possible +to load another toc-file or continue editing the existing project. It +is also safely possible to quit the GUI. The recording will continue +in background but you will have no feedback about the progress. + +The "Cancel" button will close the dialog box. + +.SS Available Recorder Devices Frame +The browser shows all devices with device type CD-R or CD-RW. Only +devices with "Ready" status are selectable. + +.SS Record Options Frame +.TP +Simulate/Write: +Selects between simulated or real writing process. + +.TP +Close Disk: +If selected disk will not be appendable. Otherwise the +recorded session is kept open. + +Note: The drivers 'generic-mmc-raw', + 'sony-cdu920' and 'yamaha-cdr10x' cannot keep the recorded session open. + +.TP +Eject: +If selected the disk will be ejected after a successful +writing process. + +Warning: This may cause buffer under runs with certain device +combinations if multiple devices are recording. + +.TP +Recording Speed: +May be used to set an upper limit for the used +recording speed. If a recorder device does not support the speed the +next lower possible speed is used. + +.TP +Reload: +If selected the disk will be automatically reloaded if it +appears to be not empty or not appendable. This is required after a +simulation run for some devices (e.g. the Philips CDD2x00 recorder +familiy). + +Warning: This may cause buffer under runs with +certain device combinations if multiple devices are recording. + +.SH FILES +.TP +cdrdao: +executed for recording +.TP +$HOME/.gnome/GnomeCDMaster: +stores settings permanently + +.SH AUTHOR +Andreas Mueller mueller@daneb.ping.de +.SH SEE ALSO +.BR cdrdao "(1), "cdda2wav "(1), "cdparanoia "(1)" diff --git a/xdao/gcdmaster.mime b/xdao/gcdmaster.mime new file mode 100644 index 0000000..6ac3efe --- /dev/null +++ b/xdao/gcdmaster.mime @@ -0,0 +1,7 @@ +# mime types for gcdmaster + +application/x-toc + ext: toc TOC + +application/x-cue + ext: cue CUE diff --git a/xdao/gcdmaster.png b/xdao/gcdmaster.png new file mode 100644 index 0000000..6af09b5 Binary files /dev/null and b/xdao/gcdmaster.png differ diff --git a/xdao/gcdmaster.schemas.in b/xdao/gcdmaster.schemas.in new file mode 100644 index 0000000..166f378 --- /dev/null +++ b/xdao/gcdmaster.schemas.in @@ -0,0 +1,31 @@ +<gconfschemafile> + <schemalist> + <schema> + <key>/schemas/apps/gcdmaster/temp_dir</key> + <applyto>/apps/gcdmaster/temp_dir</applyto> + <owner>gcdmaster</owner> + <type>string</type> + <default>/tmp</default> + <locale name="C"> + <short>Temporary files directory</short> + <long> + Directory in which temporary decoded audio files are stored + </long> + </locale> + </schema> + <schema> + <key>/schemas/apps/gcdmaster/manual_devices</key> + <applyto>/apps/gcdmaster/manual_devices</applyto> + <owner>gcdmaster</owner> + <type>list</type> + <list_type>string</list_type> + <default>[]</default> + <locale name="C"> + <short>Manually configured devices</short> + <long> + List of manually configured devices + </long> + </locale> + </schema> + </schemalist> +</gconfschemafile> diff --git a/xdao/gcdmaster.xml b/xdao/gcdmaster.xml new file mode 100644 index 0000000..b997908 --- /dev/null +++ b/xdao/gcdmaster.xml @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mime-info [ + <!ELEMENT mime-info (mime-type)+> + <!ATTLIST mime-info xmlns CDATA #FIXED "http://www.freedesktop.org/standards/shared-mime-info"> + + <!ELEMENT mime-type (comment|glob|magic|root-XML|alias|sub-class-of)*> + <!ATTLIST mime-type type CDATA #REQUIRED> + + <!ELEMENT comment (#PCDATA)> + <!ATTLIST comment xml:lang CDATA #IMPLIED> + + <!ELEMENT glob EMPTY> + <!ATTLIST glob pattern CDATA #REQUIRED> + + <!ELEMENT magic (match)+> + <!ATTLIST magic priority CDATA #IMPLIED> + + <!ELEMENT match (match)*> + <!ATTLIST match offset CDATA #REQUIRED> + <!ATTLIST match type (string|big16|big32|little16|little32|host16|host32|byte) #REQUIRED> + <!ATTLIST match value CDATA #REQUIRED> + <!ATTLIST match mask CDATA #IMPLIED> + + <!ELEMENT root-XML EMPTY> + <!ATTLIST root-XML + namespaceURI CDATA #REQUIRED + localName CDATA #REQUIRED> + + <!ELEMENT alias EMPTY> + <!ATTLIST alias + type CDATA #REQUIRED> + + <!ELEMENT sub-class-of EMPTY> + <!ATTLIST sub-class-of + type CDATA #REQUIRED> +]> +<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> + <mime-type type="application/x-toc"> + <comment>Audio CD Table Of Content</comment> + <magic priority="50"> + <match offset="0" type="string" value="CD_DA" /> + </magic> + <glob pattern="*.toc" /> + </mime-type> + <mime-type type="application/x-cue"> + <comment>Audio CD Table Of Content</comment> + <glob pattern="*.cue" /> + </mime-type> +</mime-info> diff --git a/xdao/glade/Preferences.glade b/xdao/glade/Preferences.glade new file mode 100644 index 0000000..16dc5ba --- /dev/null +++ b/xdao/glade/Preferences.glade @@ -0,0 +1,373 @@ +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> +<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> + +<glade-interface> + +<widget class="GtkDialog" id="PrefDialog"> + <property name="border_width">5</property> + <property name="visible">True</property> + <property name="title" translatable="yes">Preferences</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_CENTER</property> + <property name="modal">False</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">False</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="focus_on_map">True</property> + <property name="urgency_hint">False</property> + <property name="has_separator">True</property> + + <child internal-child="vbox"> + <widget class="GtkVBox" id="dialog-vbox1"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">2</property> + + <child internal-child="action_area"> + <widget class="GtkHButtonBox" id="dialog-action_area1"> + <property name="visible">True</property> + <property name="layout_style">GTK_BUTTONBOX_END</property> + + <child> + <widget class="GtkButton" id="ApplyButton"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-apply</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="response_id">-10</property> + </widget> + </child> + + <child> + <widget class="GtkButton" id="CancelButton"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-cancel</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="response_id">-6</property> + </widget> + </child> + + <child> + <widget class="GtkButton" id="OkButton"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-ok</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="response_id">-5</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + + <child> + <widget class="GtkNotebook" id="notebook1"> + <property name="border_width">2</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="show_tabs">True</property> + <property name="show_border">True</property> + <property name="tab_pos">GTK_POS_TOP</property> + <property name="scrollable">False</property> + <property name="enable_popup">False</property> + + <child> + <widget class="GtkVBox" id="vbox1"> + <property name="border_width">12</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="label" translatable="yes">Temporary files directory:</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkHBox" id="hbox1"> + <property name="border_width">5</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">10</property> + + <child> + <widget class="GtkEntry" id="TempDirectory"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char">•</property> + <property name="activates_default">False</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="TempDialogButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + + <child> + <widget class="GtkAlignment" id="alignment1"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">0</property> + <property name="yscale">0</property> + <property name="top_padding">0</property> + <property name="bottom_padding">0</property> + <property name="left_padding">0</property> + <property name="right_padding">0</property> + + <child> + <widget class="GtkHBox" id="hbox2"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">2</property> + + <child> + <widget class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="stock">gtk-open</property> + <property name="icon_size">4</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="label" translatable="yes">Browse...</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label10"> + <property name="visible">True</property> + <property name="label" translatable="yes"><small><i>Make sure selected directory has sufficient available disk space</i></small></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="tab_expand">False</property> + <property name="tab_fill">False</property> + <property name="menu_label" translatable="yes"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="label" translatable="yes">Files</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">True</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="type">tab</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> +</widget> + +<widget class="GtkFileChooserDialog" id="TempDirDialog"> + <property name="visible">True</property> + <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property> + <property name="local_only">False</property> + <property name="select_multiple">False</property> + <property name="show_hidden">False</property> + <property name="do_overwrite_confirmation">False</property> + <property name="title" translatable="yes">Select directory to use for temporary audio data. +</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">False</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">False</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="focus_on_map">True</property> + <property name="urgency_hint">False</property> + + <child internal-child="vbox"> + <widget class="GtkVBox" id="dialog-vbox2"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">24</property> + + <child internal-child="action_area"> + <widget class="GtkHButtonBox" id="dialog-action_area2"> + <property name="visible">True</property> + <property name="layout_style">GTK_BUTTONBOX_END</property> + + <child> + <widget class="GtkButton" id="TempBrowseCancel"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-cancel</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="response_id">-6</property> + <signal name="clicked" handler="gtk_widget_hide" object="TempDirDialog" last_modification_time="Thu, 09 Aug 2007 15:19:18 GMT"/> + </widget> + </child> + + <child> + <widget class="GtkButton" id="TempBrowseOpen"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-open</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="focus_on_click">True</property> + <property name="response_id">-5</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + </widget> + </child> +</widget> + +</glade-interface> diff --git a/xdao/glade/ProjectChooser.glade b/xdao/glade/ProjectChooser.glade new file mode 100644 index 0000000..63dc25e --- /dev/null +++ b/xdao/glade/ProjectChooser.glade @@ -0,0 +1,817 @@ +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> +<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> + +<glade-interface> +<requires lib="gnome"/> +<requires lib="bonobo"/> + +<widget class="GnomeApp" id="app1"> + <property name="visible">True</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">False</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">False</property> + <property name="decorated">True</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> + <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> + <property name="enable_layout_config">True</property> + + <child internal-child="dock"> + <widget class="BonoboDock" id="bonobodock1"> + <property name="visible">True</property> + <property name="allow_floating">True</property> + + <child> + <widget class="BonoboDockItem" id="bonobodockitem1"> + <property name="visible">True</property> + <property name="shadow_type">GTK_SHADOW_NONE</property> + + <child> + <widget class="GtkMenuBar" id="menubar1"> + <property name="visible">True</property> + + <child> + <widget class="GtkImageMenuItem" id="file1"> + <property name="visible">True</property> + <property name="stock_item">GNOMEUIINFO_MENU_FILE_TREE</property> + + <child> + <widget class="GtkMenu" id="file1_menu"> + + <child> + <widget class="GtkImageMenuItem" id="new1"> + <property name="visible">True</property> + <property name="stock_item">GNOMEUIINFO_MENU_NEW_ITEM</property> + <property name="label" translatable="yes">_Nuevo</property> + <property name="use_underline">True</property> + <signal name="activate" handler="on_new1_activate" last_modification_time="Mon, 14 Jun 2004 15:31:47 GMT"/> + </widget> + </child> + + <child> + <widget class="GtkImageMenuItem" id="open1"> + <property name="visible">True</property> + <property name="stock_item">GNOMEUIINFO_MENU_OPEN_ITEM</property> + <signal name="activate" handler="on_open1_activate" last_modification_time="Mon, 14 Jun 2004 15:31:47 GMT"/> + </widget> + </child> + + <child> + <widget class="GtkImageMenuItem" id="save1"> + <property name="visible">True</property> + <property name="stock_item">GNOMEUIINFO_MENU_SAVE_ITEM</property> + <signal name="activate" handler="on_save1_activate" last_modification_time="Mon, 14 Jun 2004 15:31:47 GMT"/> + </widget> + </child> + + <child> + <widget class="GtkImageMenuItem" id="save_as1"> + <property name="visible">True</property> + <property name="stock_item">GNOMEUIINFO_MENU_SAVE_AS_ITEM</property> + <signal name="activate" handler="on_save_as1_activate" last_modification_time="Mon, 14 Jun 2004 15:31:47 GMT"/> + </widget> + </child> + + <child> + <widget class="GtkSeparatorMenuItem" id="separator1"> + <property name="visible">True</property> + </widget> + </child> + + <child> + <widget class="GtkImageMenuItem" id="quit1"> + <property name="visible">True</property> + <property name="stock_item">GNOMEUIINFO_MENU_EXIT_ITEM</property> + <signal name="activate" handler="on_quit1_activate" last_modification_time="Mon, 14 Jun 2004 15:31:47 GMT"/> + </widget> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkImageMenuItem" id="edit1"> + <property name="visible">True</property> + <property name="stock_item">GNOMEUIINFO_MENU_EDIT_TREE</property> + + <child> + <widget class="GtkMenu" id="edit1_menu"> + + <child> + <widget class="GtkImageMenuItem" id="cut1"> + <property name="visible">True</property> + <property name="stock_item">GNOMEUIINFO_MENU_CUT_ITEM</property> + <signal name="activate" handler="on_cut1_activate" last_modification_time="Mon, 14 Jun 2004 15:31:47 GMT"/> + </widget> + </child> + + <child> + <widget class="GtkImageMenuItem" id="copy1"> + <property name="visible">True</property> + <property name="stock_item">GNOMEUIINFO_MENU_COPY_ITEM</property> + <signal name="activate" handler="on_copy1_activate" last_modification_time="Mon, 14 Jun 2004 15:31:47 GMT"/> + </widget> + </child> + + <child> + <widget class="GtkImageMenuItem" id="paste1"> + <property name="visible">True</property> + <property name="stock_item">GNOMEUIINFO_MENU_PASTE_ITEM</property> + <signal name="activate" handler="on_paste1_activate" last_modification_time="Mon, 14 Jun 2004 15:31:47 GMT"/> + </widget> + </child> + + <child> + <widget class="GtkImageMenuItem" id="clear1"> + <property name="visible">True</property> + <property name="stock_item">GNOMEUIINFO_MENU_CLEAR_ITEM</property> + <signal name="activate" handler="on_clear1_activate" last_modification_time="Mon, 14 Jun 2004 15:31:47 GMT"/> + </widget> + </child> + + <child> + <widget class="GtkSeparatorMenuItem" id="separator2"> + <property name="visible">True</property> + </widget> + </child> + + <child> + <widget class="GtkImageMenuItem" id="properties1"> + <property name="visible">True</property> + <property name="stock_item">GNOMEUIINFO_MENU_PROPERTIES_ITEM</property> + <signal name="activate" handler="on_properties1_activate" last_modification_time="Mon, 14 Jun 2004 15:31:47 GMT"/> + </widget> + </child> + + <child> + <widget class="GtkSeparatorMenuItem" id="separator3"> + <property name="visible">True</property> + </widget> + </child> + + <child> + <widget class="GtkImageMenuItem" id="preferences1"> + <property name="visible">True</property> + <property name="stock_item">GNOMEUIINFO_MENU_PREFERENCES_ITEM</property> + <signal name="activate" handler="on_preferences1_activate" last_modification_time="Mon, 14 Jun 2004 15:31:47 GMT"/> + </widget> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkImageMenuItem" id="view1"> + <property name="visible">True</property> + <property name="stock_item">GNOMEUIINFO_MENU_VIEW_TREE</property> + + <child> + <widget class="GtkMenu" id="view1_menu"> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GtkImageMenuItem" id="help1"> + <property name="visible">True</property> + <property name="stock_item">GNOMEUIINFO_MENU_HELP_TREE</property> + + <child> + <widget class="GtkMenu" id="help1_menu"> + + <child> + <widget class="GtkImageMenuItem" id="about1"> + <property name="visible">True</property> + <property name="stock_item">GNOMEUIINFO_MENU_ABOUT_ITEM</property> + <signal name="activate" handler="on_about1_activate" last_modification_time="Mon, 14 Jun 2004 15:31:47 GMT"/> + </widget> + </child> + </widget> + </child> + </widget> + </child> + </widget> + </child> + </widget> + <packing> + <property name="placement">BONOBO_DOCK_TOP</property> + <property name="band">0</property> + <property name="position">0</property> + <property name="offset">0</property> + <property name="behavior">BONOBO_DOCK_ITEM_BEH_EXCLUSIVE|BONOBO_DOCK_ITEM_BEH_NEVER_VERTICAL|BONOBO_DOCK_ITEM_BEH_LOCKED</property> + </packing> + </child> + + <child> + <widget class="BonoboDockItem" id="bonobodockitem2"> + <property name="visible">True</property> + <property name="shadow_type">GTK_SHADOW_OUT</property> + + <child> + <widget class="GtkToolbar" id="toolbar1"> + <property name="visible">True</property> + <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property> + <property name="toolbar_style">GTK_TOOLBAR_ICONS</property> + <property name="tooltips">True</property> + <property name="show_arrow">True</property> + + <child> + <widget class="GtkToolButton" id="toolbutton1"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Archivo nuevo</property> + <property name="stock_id">gtk-new</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + <property name="is_important">False</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + + <child> + <widget class="GtkToolButton" id="toolbutton2"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Abrir un archivo</property> + <property name="stock_id">gtk-open</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + <property name="is_important">False</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + + <child> + <widget class="GtkToolButton" id="toolbutton3"> + <property name="visible">True</property> + <property name="tooltip" translatable="yes">Guardar archivo</property> + <property name="stock_id">gtk-save</property> + <property name="visible_horizontal">True</property> + <property name="visible_vertical">True</property> + <property name="is_important">False</property> + </widget> + <packing> + <property name="expand">False</property> + <property name="homogeneous">True</property> + </packing> + </child> + </widget> + </child> + </widget> + <packing> + <property name="placement">BONOBO_DOCK_TOP</property> + <property name="band">1</property> + <property name="position">0</property> + <property name="offset">0</property> + <property name="behavior">BONOBO_DOCK_ITEM_BEH_EXCLUSIVE|BONOBO_DOCK_ITEM_BEH_LOCKED</property> + </packing> + </child> + + <child> + <widget class="GtkHBox" id="mainbox"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">10</property> + + <child> + <widget class="GtkImage" id="image1"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="vbox3"> + <property name="border_width">10</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">10</property> + + <child> + <widget class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>New Project</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="DataButton"> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NONE</property> + <property name="focus_on_click">True</property> + + <child> + <widget class="GtkHBox" id="hbox4"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">10</property> + + <child> + <widget class="GtkImage" id="DataImage"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="vbox4"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Data</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label5"> + <property name="visible">True</property> + <property name="label" translatable="yes">Store files in a CD</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="AudioButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NONE</property> + <property name="focus_on_click">True</property> + + <child> + <widget class="GtkHBox" id="hbox5"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">10</property> + + <child> + <widget class="GtkImage" id="AudioImage"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="vbox5"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkLabel" id="label6"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Audio</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label7"> + <property name="visible">True</property> + <property name="label" translatable="yes">Create an audio CD from audio files</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="VideoButton"> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NONE</property> + <property name="focus_on_click">True</property> + + <child> + <widget class="GtkHBox" id="hbox7"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">10</property> + + <child> + <widget class="GtkImage" id="VideoImage"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="vbox7"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkLabel" id="label10"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Video</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label11"> + <property name="visible">True</property> + <property name="label" translatable="yes">Create a Video CD from mpeg files</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="CopyButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NONE</property> + <property name="focus_on_click">True</property> + + <child> + <widget class="GtkHBox" id="hbox6"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">10</property> + + <child> + <widget class="GtkImage" id="CopyImage"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="vbox6"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkLabel" id="label8"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Copy</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label9"> + <property name="visible">True</property> + <property name="label" translatable="yes">Make an exact copy of a CD</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkButton" id="DumpButton"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="relief">GTK_RELIEF_NONE</property> + <property name="focus_on_click">True</property> + + <child> + <widget class="GtkHBox" id="hbox8"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">10</property> + + <child> + <widget class="GtkImage" id="DumpImage"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="yalign">0</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="vbox8"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkLabel" id="label12"> + <property name="visible">True</property> + <property name="label" translatable="yes"><b>Image</b></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label13"> + <property name="visible">True</property> + <property name="label" translatable="yes">Create a file image from a CD</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child internal-child="appbar"> + <widget class="GnomeAppBar" id="appbar1"> + <property name="visible">True</property> + <property name="has_progress">True</property> + <property name="has_status">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> +</widget> + +</glade-interface> diff --git a/xdao/guiUpdate.cc b/xdao/guiUpdate.cc new file mode 100644 index 0000000..2740130 --- /dev/null +++ b/xdao/guiUpdate.cc @@ -0,0 +1,52 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2001 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include "guiUpdate.h" + +#include "xcdrdao.h" +#include "gcdmaster.h" +#include "DeviceConfDialog.h" +#include "ProgressDialog.h" +#include "ProcessMonitor.h" +#include "CdDevice.h" +#include "TocEdit.h" + +#include "util.h" + +void guiUpdate(unsigned long level) +{ + std::list<GCDMaster*>::iterator i = GCDMaster::apps.begin(); + for (; i != GCDMaster::apps.end(); i++) { + (*i)->update(level); + } + + if (deviceConfDialog != NULL) + deviceConfDialog->update(level); + + if (PROGRESS_POOL != NULL) + PROGRESS_POOL->update(level); +} + +bool guiUpdatePeriodic() +{ + if (CdDevice::updateDeviceStatus()) + guiUpdate(UPD_CD_DEVICE_STATUS); + + return true; +} diff --git a/xdao/guiUpdate.h b/xdao/guiUpdate.h new file mode 100644 index 0000000..91f081a --- /dev/null +++ b/xdao/guiUpdate.h @@ -0,0 +1,42 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998, 1999 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __GUIUPDATE_H__ +#define __GUIUPDATE_H__ + +#define APP_NAME "Gnome CD Master" + +#define UPD_ALL 0xffffffff +#define UPD_TOC_DATA 0x00000001 +#define UPD_TRACK_DATA 0x00000002 +#define UPD_SAMPLES 0x00000004 +#define UPD_TRACK_MARK_SEL 0x00000008 +#define UPD_SAMPLE_SEL 0x00000010 +#define UPD_SAMPLE_MARKER 0x00000020 +#define UPD_EDITABLE_STATE 0x00000040 +#define UPD_TOC_DIRTY 0x00000080 +#define UPD_CD_DEVICES 0x00000100 +#define UPD_CD_DEVICE_STATUS 0x00000200 +#define UPD_PROGRESS_STATUS 0x00000400 +#define UPD_PLAY_STATUS 0x00000800 + +extern void guiUpdate(unsigned long level = 0); +extern bool guiUpdatePeriodic(); + +#endif diff --git a/xdao/stock/Makefile.am b/xdao/stock/Makefile.am new file mode 100644 index 0000000..4c9492b --- /dev/null +++ b/xdao/stock/Makefile.am @@ -0,0 +1,26 @@ +IMAGES = \ + play.png \ + pause.png \ + stop.png \ + gcdmaster.png \ + open.png \ + audiocd.png \ + copycd.png \ + dumpcd.png \ + record.png + +noinst_DATA = pixbufs.h +CLEANFILES = $(noinst_DATA) + +pixbufs.h: $(IMAGES) + gdk-pixbuf-csource --raw --name play_pixbuf $(srcdir)/play.png > $(srcdir)/pixbufs.h + gdk-pixbuf-csource --raw --name pause_pixbuf $(srcdir)/pause.png >> $(srcdir)/pixbufs.h + gdk-pixbuf-csource --raw --name stop_pixbuf $(srcdir)/stop.png >> $(srcdir)/pixbufs.h + gdk-pixbuf-csource --raw --name gcdmaster_pixbuf $(srcdir)/gcdmaster.png >> $(srcdir)/pixbufs.h + gdk-pixbuf-csource --raw --name open_pixbuf $(srcdir)/open.png >> $(srcdir)/pixbufs.h + gdk-pixbuf-csource --raw --name audiocd_pixbuf $(srcdir)/audiocd.png >> $(srcdir)/pixbufs.h + gdk-pixbuf-csource --raw --name copycd_pixbuf $(srcdir)/copycd.png >> $(srcdir)/pixbufs.h + gdk-pixbuf-csource --raw --name dumpcd_pixbuf $(srcdir)/dumpcd.png >> $(srcdir)/pixbufs.h + gdk-pixbuf-csource --raw --name record_pixbuf $(srcdir)/record.png >> $(srcdir)/pixbufs.h + +EXTRA_DIST = $(IMAGES) pixbufs.h diff --git a/xdao/stock/Makefile.in b/xdao/stock/Makefile.in new file mode 100644 index 0000000..a77b4c9 --- /dev/null +++ b/xdao/stock/Makefile.in @@ -0,0 +1,370 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = xdao/stock +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DATA = $(noinst_DATA) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AO_CFLAGS = @AO_CFLAGS@ +AO_LIBS = @AO_LIBS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +COND_MP3_FALSE = @COND_MP3_FALSE@ +COND_MP3_TRUE = @COND_MP3_TRUE@ +COND_OGG_FALSE = @COND_OGG_FALSE@ +COND_OGG_TRUE = @COND_OGG_TRUE@ +COND_PCCTS_FALSE = @COND_PCCTS_FALSE@ +COND_PCCTS_TRUE = @COND_PCCTS_TRUE@ +COND_SCSILIB_FALSE = @COND_SCSILIB_FALSE@ +COND_SCSILIB_TRUE = @COND_SCSILIB_TRUE@ +COND_TOC2MP3_FALSE = @COND_TOC2MP3_FALSE@ +COND_TOC2MP3_TRUE = @COND_TOC2MP3_TRUE@ +COND_XDAO_FALSE = @COND_XDAO_FALSE@ +COND_XDAO_TRUE = @COND_XDAO_TRUE@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +GCONF_SCHEMAS_INSTALL_FALSE = @GCONF_SCHEMAS_INSTALL_FALSE@ +GCONF_SCHEMAS_INSTALL_TRUE = @GCONF_SCHEMAS_INSTALL_TRUE@ +GCONF_SCHEMA_CONFIG_SOURCE = @GCONF_SCHEMA_CONFIG_SOURCE@ +GCONF_SCHEMA_FILE_DIR = @GCONF_SCHEMA_FILE_DIR@ +GTKMM2_CFLAGS = @GTKMM2_CFLAGS@ +GTKMM2_LIBS = @GTKMM2_LIBS@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LAME_CFLAGS = @LAME_CFLAGS@ +LAME_LIBS = @LAME_LIBS@ +LDFLAGS = @LDFLAGS@ +LIBGUIMM2_CFLAGS = @LIBGUIMM2_CFLAGS@ +LIBGUIMM2_LIBS = @LIBGUIMM2_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LTLIBOBJS = @LTLIBOBJS@ +MAD_CFLAGS = @MAD_CFLAGS@ +MAD_LIBS = @MAD_LIBS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SIGCPP2_CFLAGS = @SIGCPP2_CFLAGS@ +SIGCPP2_LIBS = @SIGCPP2_LIBS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +VORBISFILE_CFLAGS = @VORBISFILE_CFLAGS@ +VORBISFILE_LIBS = @VORBISFILE_LIBS@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +antlr_path = @antlr_path@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +dao_src = @dao_src@ +datadir = @datadir@ +dlg_path = @dlg_path@ +en_cdrdao = @en_cdrdao@ +en_cue2toc = @en_cue2toc@ +en_toc2cue = @en_toc2cue@ +en_toc2mp3 = @en_toc2mp3@ +en_xdao = @en_xdao@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +mydefs = @mydefs@ +oldincludedir = @oldincludedir@ +pcctsinc = @pcctsinc@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +scsilib_dir = @scsilib_dir@ +scsilib_incl = @scsilib_incl@ +scsilib_libs = @scsilib_libs@ +scsilib_objs = @scsilib_objs@ +sharedstatedir = @sharedstatedir@ +sound_if_obj = @sound_if_obj@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +thread_libs = @thread_libs@ +IMAGES = \ + play.png \ + pause.png \ + stop.png \ + gcdmaster.png \ + open.png \ + audiocd.png \ + copycd.png \ + dumpcd.png \ + record.png + +noinst_DATA = pixbufs.h +CLEANFILES = $(noinst_DATA) +EXTRA_DIST = $(IMAGES) pixbufs.h +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu xdao/stock/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu xdao/stock/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +uninstall-info-am: +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(DATA) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: all all-am check check-am clean clean-generic distclean \ + distclean-generic distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ + uninstall-info-am + + +pixbufs.h: $(IMAGES) + gdk-pixbuf-csource --raw --name play_pixbuf $(srcdir)/play.png > $(srcdir)/pixbufs.h + gdk-pixbuf-csource --raw --name pause_pixbuf $(srcdir)/pause.png >> $(srcdir)/pixbufs.h + gdk-pixbuf-csource --raw --name stop_pixbuf $(srcdir)/stop.png >> $(srcdir)/pixbufs.h + gdk-pixbuf-csource --raw --name gcdmaster_pixbuf $(srcdir)/gcdmaster.png >> $(srcdir)/pixbufs.h + gdk-pixbuf-csource --raw --name open_pixbuf $(srcdir)/open.png >> $(srcdir)/pixbufs.h + gdk-pixbuf-csource --raw --name audiocd_pixbuf $(srcdir)/audiocd.png >> $(srcdir)/pixbufs.h + gdk-pixbuf-csource --raw --name copycd_pixbuf $(srcdir)/copycd.png >> $(srcdir)/pixbufs.h + gdk-pixbuf-csource --raw --name dumpcd_pixbuf $(srcdir)/dumpcd.png >> $(srcdir)/pixbufs.h + gdk-pixbuf-csource --raw --name record_pixbuf $(srcdir)/record.png >> $(srcdir)/pixbufs.h +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/xdao/stock/audiocd.png b/xdao/stock/audiocd.png new file mode 100644 index 0000000..3a18808 Binary files /dev/null and b/xdao/stock/audiocd.png differ diff --git a/xdao/stock/copycd.png b/xdao/stock/copycd.png new file mode 100644 index 0000000..0dde7b4 Binary files /dev/null and b/xdao/stock/copycd.png differ diff --git a/xdao/stock/dumpcd.png b/xdao/stock/dumpcd.png new file mode 100644 index 0000000..4ba28b4 Binary files /dev/null and b/xdao/stock/dumpcd.png differ diff --git a/xdao/stock/gcdmaster.png b/xdao/stock/gcdmaster.png new file mode 100644 index 0000000..6af09b5 Binary files /dev/null and b/xdao/stock/gcdmaster.png differ diff --git a/xdao/stock/open.png b/xdao/stock/open.png new file mode 100644 index 0000000..22eb2c5 Binary files /dev/null and b/xdao/stock/open.png differ diff --git a/xdao/stock/pause.png b/xdao/stock/pause.png new file mode 100644 index 0000000..1e03ef1 Binary files /dev/null and b/xdao/stock/pause.png differ diff --git a/xdao/stock/pixbufs.h b/xdao/stock/pixbufs.h new file mode 100644 index 0000000..a841d3c --- /dev/null +++ b/xdao/stock/pixbufs.h @@ -0,0 +1,2349 @@ +/* GdkPixbuf RGBA C-Source image dump */ + +#ifdef __SUNPRO_C +#pragma align 4 (play_pixbuf) +#endif +#ifdef __GNUC__ +static const guint8 play_pixbuf[] __attribute__ ((__aligned__ (4))) = +#else +static const guint8 play_pixbuf[] = +#endif +{ "" + /* Pixbuf magic (0x47646b50) */ + "GdkP" + /* length: header (24) + pixel_data (2304) */ + "\0\0\11\30" + /* pixdata_type (0x1010002) */ + "\1\1\0\2" + /* rowstride (96) */ + "\0\0\0`" + /* width (24) */ + "\0\0\0\30" + /* height (24) */ + "\0\0\0\30" + /* pixel_data: */ + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0O\0\0\0""3\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0g\0\0\0\377\0\0\0""3\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0g\0\0\0\377\0\0\0\377\0\0\0""3\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0g\0\0\0\377rqp\377\0\0\0\377\0\0\0""3\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0g\0\0\0" + "\377{{z\377lkj\377\0\0\0\377\0\0\0""3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0g\0\0\0\377\177~}\377" + "\231\231\226\377}|{\377\0\0\0\377\0\0\0""3\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0g\0\0\0\377\202\201\200" + "\377\235\234\232\377\260\257\254\377\220\217\215\377\0\0\0\377\0\0\0" + "3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0g\0" + "\0\0\377\206\205\203\377\241\240\236\377\264\263\261\377\266\264\262" + "\377\245\244\241\377\0\0\0\377\0\0\0""3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0g\0\0\0\377\211\210\206\377\245\244\241\377" + "\271\267\264\377\272\271\266\377\274\272\267\377\303\302\277\377\0\0" + "\0\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0g\0\0\0\377\214\213\211\377\251\250\245\377\275\274\271\377\305\303" + "\300\377\320\316\314\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0g\0\0\0\377\217\216\214\377\265" + "\263\261\377\307\306\303\377\322\321\316\377\0\0\0\377\377\377\377\377" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0g\0" + "\0\0\377\235\234\232\377\271\266\264\377\330\327\325\377\0\0\0\377\377" + "\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0g\0\0\0\377\241\237\235\377\307\306\304\377\0\0\0\377" + "\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0g\0\0\0\377\247\246\243\377\0\0\0\377\377" + "\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0g\0\0\0\377\0\0\0\377\377\377\377\377" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0r\0\0\0\377\377\377\377\377\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0""3\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}; + + +/* GdkPixbuf RGBA C-Source image dump */ + +#ifdef __SUNPRO_C +#pragma align 4 (pause_pixbuf) +#endif +#ifdef __GNUC__ +static const guint8 pause_pixbuf[] __attribute__ ((__aligned__ (4))) = +#else +static const guint8 pause_pixbuf[] = +#endif +{ "" + /* Pixbuf magic (0x47646b50) */ + "GdkP" + /* length: header (24) + pixel_data (2304) */ + "\0\0\11\30" + /* pixdata_type (0x1010002) */ + "\1\1\0\2" + /* rowstride (96) */ + "\0\0\0`" + /* width (24) */ + "\0\0\0\30" + /* height (24) */ + "\0\0\0\30" + /* pixel_data: */ + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0!\0" + "\0\0""0\0\0\0""0\0\0\0""5\0\0\0=\0\0\0!\0\0\0!\0\0\0""0\0\0\0""0\0\0" + "\0""5\0\0\0=\0\0\0!\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""2\0\0\0\377" + "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\0\0\0\377\0" + "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0""4\0\0\0\377ssr\377\204\204\203\377\210\210\207\377\0\0" + "\0\377\377\377\377\377\0\0\0\377ssr\377\204\204\203\377\210\210\207\377" + "\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""4\0\0\0\377~~}" + "\377\250\247\246\377\244\244\243\377\0\0\0\377\377\377\377\377\0\0\0" + "\377~~}\377\250\247\246\377\244\244\243\377\0\0\0\377\377\377\377\377" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0""4\0\0\0\377~~}\377\246\245\244\377\265\264" + "\263\377\0\0\0\377\377\377\377\377\0\0\0\377~~}\377\246\245\244\377\265" + "\264\263\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""2\0" + "\0\0\377\205\204\203\377\252\251\247\377\300\277\276\377\0\0\0\377\377" + "\377\377\377\0\0\0\377\205\204\203\377\252\251\247\377\300\277\276\377" + "\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""2\0\0\0\377\221" + "\220\216\377\257\256\254\377\312\312\310\377\0\0\0\377\377\377\377\377" + "\0\0\0\377\221\220\216\377\257\256\254\377\312\312\310\377\0\0\0\377" + "\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""2\0\0\0\377\221\220\216\377" + "\257\256\254\377\312\312\310\377\0\0\0\377\377\377\377\377\0\0\0\377" + "\221\220\216\377\257\256\254\377\312\312\310\377\0\0\0\377\377\377\377" + "\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""2\0\0\0\377\221\220\216\377\257\256\254" + "\377\312\312\310\377\0\0\0\377\377\377\377\377\0\0\0\377\221\220\216" + "\377\257\256\254\377\312\312\310\377\0\0\0\377\377\377\377\377\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0""0\0\0\0\377\246\245\242\377\273\272\267\377\324" + "\323\322\377\0\0\0\377\377\377\377\377\0\0\0\377\246\245\242\377\273" + "\272\267\377\324\323\322\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0""0\0\0\0\377\246\245\242\377\273\272\267\377\324\323\322" + "\377\0\0\0\377\377\377\377\377\0\0\0\377\246\245\242\377\273\272\267" + "\377\324\323\322\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0""0\0\0\0\377\256\255\251\377\277\275\272\377\327\325\323\377\0\0" + "\0\377\377\377\377\377\0\0\0\377\256\255\251\377\277\275\272\377\327" + "\325\323\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0,\0\0" + "\0\377\262\260\255\377\303\301\276\377\331\330\326\377\0\0\0\377\377" + "\377\377\377\0\0\0\377\262\260\255\377\303\301\276\377\331\330\326\377" + "\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0-\0\0\0\377\265\263" + "\260\377\321\317\314\377\336\335\333\377\0\0\0\377\377\377\377\377\0" + "\0\0\377\265\263\260\377\321\317\314\377\336\335\333\377\0\0\0\377\377" + "\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0-\0\0\0\377\0\0\0\377\0\0\0\377" + "\0\0\0\377\0\0\0\377\377\377\377\377\0\0\0\377\0\0\0\377\0\0\0\377\0" + "\0\0\377\0\0\0\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\21\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\363\363\363\237\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\230\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}; + + +/* GdkPixbuf RGBA C-Source image dump */ + +#ifdef __SUNPRO_C +#pragma align 4 (stop_pixbuf) +#endif +#ifdef __GNUC__ +static const guint8 stop_pixbuf[] __attribute__ ((__aligned__ (4))) = +#else +static const guint8 stop_pixbuf[] = +#endif +{ "" + /* Pixbuf magic (0x47646b50) */ + "GdkP" + /* length: header (24) + pixel_data (2304) */ + "\0\0\11\30" + /* pixdata_type (0x1010002) */ + "\1\1\0\2" + /* rowstride (96) */ + "\0\0\0`" + /* width (24) */ + "\0\0\0\30" + /* height (24) */ + "\0\0\0\30" + /* pixel_data: */ + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0!\0\0\0""0" + "\0\0\0""0\0\0\0""5\0\0\0""0\0\0\0:\0\0\0""9\0\0\0:\0\0\0""9\0\0\0""9" + "\0\0\0""9\0\0\0""9\0\0\0=\0\0\0!\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""2\0\0\0\377\0\0\0" + "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0" + "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377" + "\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0""4\0\0\0\377ssr\377\204\204\203\377\210\210\207\377\210\210" + "\207\377\210\210\207\377\210\210\207\377\210\210\207\377\210\210\207" + "\377\210\210\207\377\210\210\207\377\210\210\207\377\0\0\0\377\377\377" + "\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0""4\0\0\0\377~~}\377\250\247\246\377\244\244" + "\243\377\244\244\243\377\244\244\243\377\244\244\243\377\244\244\243" + "\377\244\244\243\377\244\244\243\377\244\244\243\377\244\244\243\377" + "\0\0\0\377\377\377\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""4\0\0\0\377~~}\377\246\245" + "\244\377\265\264\263\377\265\264\263\377\265\264\263\377\265\264\263" + "\377\265\264\263\377\265\264\263\377\265\264\263\377\265\264\263\377" + "\265\264\263\377\0\0\0\377\377\377\377\377\377\377\377\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""2\0\0\0\377" + "\205\204\203\377\252\251\247\377\300\277\276\377\300\277\276\377\300" + "\277\276\377\300\277\276\377\300\277\276\377\300\277\276\377\300\277" + "\276\377\300\277\276\377\300\277\276\377\0\0\0\377\377\377\377\377\377" + "\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0""2\0\0\0\377\221\220\216\377\257\256\254\377\312\312\310" + "\377\312\312\310\377\312\312\310\377\312\312\310\377\312\312\310\377" + "\312\312\310\377\312\312\310\377\312\312\310\377\312\312\310\377\0\0" + "\0\377\377\377\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""2\0\0\0\377\221\220\216\377\257" + "\256\254\377\312\312\310\377\312\312\310\377\312\312\310\377\312\312" + "\310\377\312\312\310\377\312\312\310\377\312\312\310\377\312\312\310" + "\377\312\312\310\377\0\0\0\377\377\377\377\377\377\377\377\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""0\0\0" + "\0\377\246\245\242\377\273\272\267\377\324\323\322\377\324\323\322\377" + "\324\323\322\377\324\323\322\377\324\323\322\377\324\323\322\377\324" + "\323\322\377\324\323\322\377\324\323\322\377\0\0\0\377\377\377\377\377" + "\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0""0\0\0\0\377\246\245\242\377\273\272\267\377\324\323" + "\322\377\324\323\322\377\324\323\322\377\324\323\322\377\324\323\322" + "\377\324\323\322\377\324\323\322\377\324\323\322\377\324\323\322\377" + "\0\0\0\377\377\377\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""0\0\0\0\377\256\255\251\377" + "\277\275\272\377\327\325\323\377\327\325\323\377\327\325\323\377\327" + "\325\323\377\327\325\323\377\327\325\323\377\327\325\323\377\327\325" + "\323\377\327\325\323\377\0\0\0\377\377\377\377\377\377\377\377\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0,\0" + "\0\0\377\262\260\255\377\303\301\276\377\331\330\326\377\331\330\326" + "\377\331\330\326\377\331\330\326\377\331\330\326\377\331\330\326\377" + "\331\330\326\377\331\330\326\377\331\330\326\377\0\0\0\377\377\377\377" + "\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0-\0\0\0\377\265\263\260\377\321\317\314\377\336\335" + "\333\377\336\335\333\377\336\335\333\377\336\335\333\377\336\335\333" + "\377\336\335\333\377\336\335\333\377\336\335\333\377\336\335\333\377" + "\0\0\0\377\377\377\377\377\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0-\0\0\0\377\0\0\0\377\0\0\0" + "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0" + "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\377\377\377\377\377\377\377\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\21\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\230\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377\377\0\377\377\377\0" + "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377" + "\0\377\377\377\0\377\377\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0"}; + + +/* GdkPixbuf RGBA C-Source image dump */ + +#ifdef __SUNPRO_C +#pragma align 4 (gcdmaster_pixbuf) +#endif +#ifdef __GNUC__ +static const guint8 gcdmaster_pixbuf[] __attribute__ ((__aligned__ (4))) = +#else +static const guint8 gcdmaster_pixbuf[] = +#endif +{ "" + /* Pixbuf magic (0x47646b50) */ + "GdkP" + /* length: header (24) + pixel_data (9216) */ + "\0\0$\30" + /* pixdata_type (0x1010002) */ + "\1\1\0\2" + /* rowstride (192) */ + "\0\0\0\300" + /* width (48) */ + "\0\0\0""0" + /* height (48) */ + "\0\0\0""0" + /* pixel_data: */ + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""4\0\0\1""4" + "\0\0\7""4\0\0\12""3\0\0\7""3\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""6\0\0\2\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""4\0\0\1""4\0\0\6""4\0\0\11""4" + "\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0""5\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0""5\0\0\1""5\0\0\3""5\0\0\4""5\0\0\1\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0\0\0}\0\0" + "\0\305\0\0\0\352\0\0\0\371\0\0\0\376\0\0\0\377\0\0\0\377\0\0\0\371\0" + "\0\0\345\0\0\0\300\0\0\0\214\0\0\0N\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0""4\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0""6\0\0\1""6\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0m\0\0\0\334\0\0\0\377\0\0\0\377\212" + "r\203\377\250\215\246\377\257\222\255\377\257\214\242\377\247\214\250" + "\377\235\207\260\377\235\211\262\377\242\216\260\377\233\206\244\377" + "\177m\200\377\0\0\0\377\0\0\0\367\0\0\0\246\1\0\0B\252\0\0\10\255\0\0" + "\17\257\0\0\22\260\0\0\16\261\0\0\6\260\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0""3\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0e\0\0\0\352\0\0\0\377\213lm\377\315\256\254\377" + "\321\264\271\377\300\242\270\377\272\236\271\377\270\233\270\377\262" + "\220\247\377\250\215\250\377\235\207\261\377\235\212\264\377\246\223" + "\272\377\260\237\276\377\301\262\307\377\301\261\301\377\255\221\236" + "\377j[b\377\14\0\0\377/\0\0\306x\0\0|\260\0\0a\262\0\0U\262\0\0""3\261" + "\0\0\21\256\0\0\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""4\0\0\1\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\307\0\0\0\377z_b\377" + "\315\247\234\377\330\262\247\377\330\265\261\377\331\275\273\377\306" + "\252\270\377\275\237\272\377\272\234\271\377\263\221\252\377\247\214" + "\247\377\234\207\260\377\237\213\265\377\250\226\273\377\265\244\301" + "\377\304\265\310\377\274\246\270\377\253\226\247\377\236\200\221\377" + "\232_j\377\212'(\377\200\0\0\377\232\0\0\345\263\0\0\273\262\0\0\205" + "\260\0\0<\255\0\0\13\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0!\0\0\0\354\0\0\0\377\262\201\204\377" + "\321\240\220\377\326\254\232\377\331\263\240\377\330\264\252\377\331" + "\271\264\377\322\266\272\377\276\240\270\377\271\234\271\377\264\224" + "\256\377\251\215\250\377\234\207\261\377\237\214\265\377\252\231\274" + "\377\277\257\306\377\276\255\276\377\261\226\246\377\240z\212\377\235" + "Yf\377\242/5\377\253\20\21\377\261\2\2\377\265\0\0\377\264\0\0\376\260" + "\0\0\326\257\0\0x\254\0\0$\252\0\0\3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0&\0\0\0\366\37\30\33\377\274{y\377" + "\312\211z\377\313\223\204\377\321\237\217\377\326\254\231\377\331\264" + "\240\377\330\265\252\377\332\273\266\377\305\247\270\377\273\236\271" + "\377\267\227\263\377\252\216\251\377\235\210\263\377\241\216\266\377" + "\261\237\277\377\303\263\305\377\271\233\251\377\244{\213\377\235Vb\377" + "\244,1\377\253\17\21\377\261\3\3\377\267\0\0\377\271\0\0\377\270\0\0" + "\377\250\0\0\374\247\0\0\257\254\0\0L\251\0\0\20\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\360(!\"\377\307\210\211" + "\377\313\213\214\377\311\205\212\377\310\202y\377\312\217\202\377\320" + "\235\215\377\326\254\230\377\331\264\240\377\331\267\254\377\322\266" + "\270\377\275\240\270\377\272\233\267\377\254\221\252\377\235\211\263" + "\377\244\222\270\377\273\253\303\377\272\242\263\377\250\177\215\377" + "\236Xc\377\244-1\377\252\22\23\377\263\4\4\377\271\0\0\377\276\0\0\377" + "\277\0\0\377\275\0\0\377\261\1\1\377\212\0\0\360\255\0\0l\251\0\0!\244" + "\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0""4\0\0\2""4\0\0\2""4\0\0\1\0\0\0\0\0\0\0\320\0\0\0" + "\377\310\217\205\377\321\227\217\377\320\224\217\377\315\217\215\377" + "\313\211\216\377\311\202\211\377\310\204|\377\317\232\214\377\327\252" + "\227\377\333\270\242\377\333\272\256\377\303\245\267\377\272\234\267" + "\377\256\224\254\377\237\214\265\377\251\227\273\377\274\252\276\377" + "\257\207\226\377\240\\g\377\24137\377\247\25\27\377\261\6\6\377\273\1" + "\1\377\302\0\0\377\305\0\0\377\305\0\0\377\302\0\0\377\270\4\4\377\215" + "\0\0\377l\0\0\311\250\0\0""0\242\0\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""3\0\0\1""3\0\0\3""3\0\0\4" + "4\0\0\2\0\0\0q\0\0\0\377\274\212x\377\330\245\225\377\326\242\224\377" + "\325\235\221\377\321\227\220\377\320\223\217\377\316\217\221\377\312" + "\210\220\377\306|\210\377\315\220\206\377\326\250\227\377\334\271\237" + "\377\322\264\262\377\274\236\270\377\261\227\255\377\240\215\266\377" + "\266\245\301\377\262\220\242\377\244hs\377\235>C\377\243\32\35\377\257" + "\6\7\377\272\1\1\377\303\0\0\377\311\0\0\377\314\0\0\377\314\0\0\377" + "\306\0\0\377\275\4\4\377\257\30\31\377c\0\0\377a\0\0r\242\0\0\14\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "3\0\0\1""3\0\0\4""3\0\0\4""3\0\0\2\0\0\0\353}cW\377\332\254\243\377\331" + "\252\237\377\330\251\234\377\331\250\233\377\330\246\227\377\325\240" + "\225\377\323\231\224\377\317\223\222\377\316\217\223\377\311\205\220" + "\377\310\177\216\377\331\257\236\377\350\322\271\377\332\310\323\377" + "\330\313\324\377\316\304\331\377\316\300\317\377\275\221\226\377\234" + "U\\\377\236&*\377\254\12\13\377\270\1\1\377\303\0\0\377\313\0\0\377\321" + "\0\0\377\323\0\0\377\322\0\0\377\313\0\0\377\300\3\3\377\263\17\20\377" + "\231#%\377D\0\0\320\243\0\0\25\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""3\0\0\1""3\0\0\2""3\0\0\1\0\0\0W" + "\0\0\0\377\316\242\236\377\334\264\261\377\334\261\255\377\333\260\253" + "\377\333\257\250\377\332\255\245\377\332\253\241\377\331\252\235\377" + "\327\244\232\377\323\233\226\377\316\224\224\377\327\250\257\377\342" + "\275\306\377\276\243\246\377a[V\377!\37\40\377!\36\40\377ZGI\377\240" + "mq\377\260LO\377\253\30\32\377\265\4\4\377\301\0\0\377\313\0\0\377\323" + "\0\0\377\330\0\0\377\333\0\0\377\330\0\0\377\321\1\1\377\305\2\2\377" + "\267\12\12\377\255*,\377A\0\0\377B\0\0H\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""6\0\0\1""4\0\0\1\0\0\0\0" + "\0\0\0\300iRR\377\337\273\276\377\337\272\275\377\337\272\274\377\336" + "\272\273\377\337\272\272\377\336\270\267\377\336\267\265\377\334\264" + "\261\377\333\262\255\377\332\256\251\377\341\275\270\377\351\317\316" + "\377wik\377\0\0\0\377\0\0\0\322\4\0\0o\34\0\0z/\0\0\335X\0\0\377\235" + "\26\27\377\266\15\15\377\275\1\1\377\311\0\0\377\322\0\0\377\333\0\0" + "\377\340\0\0\377\342\0\0\377\337\0\0\377\327\1\1\377\313\1\2\377\274" + "\7\7\377\261%'\377}/2\377'\0\0\221\237\0\0\2\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""6\0\0\1""6\0\0\2""6\0\0\2""6\0\0\1" + "\0\0\0\356\275\220\240\377\340\275\313\377\340\276\313\377\340\275\311" + "\377\340\275\310\377\340\275\310\377\337\314\300\377\336\315\300\377" + "\337\315\301\377\336\315\277\377\335\315\276\377\351\337\330\377\217" + "\210\205\377\0\0\0\377\0\0\0\211P\0\0\4\217\0\0\21\240\0\0""9\246\0\0" + "|\221\0\0\340\243\0\0\377\273\2\2\377\306\0\0\377\320\0\0\377\332\0\0" + "\377\342\0\0\377\347\0\0\377\351\1\0\377\346\0\0\377\336\1\1\377\320" + "\0\0\377\300\6\6\377\266\"#\377\250LN\377$\0\0\311\237\0\0\6\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""4\0\0\1""4\0\0\4""5\0\0\6""5" + "\0\0\4""6\0\0\1\0\0\0\375\322\270\265\377\336\312\306\377\336\311\306" + "\377\336\311\307\377\336\310\305\377\336\307\306\377\336\306\306\377" + "\335\305\306\377\336\303\306\377\334\300\304\377\333\274\303\377\354" + "\333\341\377&#%\377\0\0\0\246\0\0\0\2s\0\0\7\233\0\0#\246\0\0b\253\0" + "\0\262\263\0\0\345\271\0\0\375\304\0\0\377\317\0\0\377\330\0\0\377\342" + "\0\0\377\352\2\0\377\357\3\0\377\361\3\0\377\355\2\0\377\344\2\1\377" + "\326\0\0\377\304\4\4\377\270\33\33\377\263HK\377)\0\0\353\240\0\0\13" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""3\0\0\2""4\0\0\5""4" + "\0\0\5""5\0\0\3x\0\0\2\0\0\0\377\333\302\302\377\337\307\307\377\337" + "\305\306\377\336\304\306\377\336\303\306\377\336\302\306\377\335\276" + "\305\377\334\273\304\377\333\272\305\377\332\270\306\377\333\267\310" + "\377\351\323\340\377\216\203\213\377\0\0\0\377\0\0\0\207\212\0\0\15\241" + "\0\0""9\251\0\0\207\261\0\0\323\267\0\0\373\303\0\0\377\317\0\0\377\327" + "\0\0\377\341\0\0\377\353\3\0\377\362\6\0\377\366\11\0\377\366\11\0\377" + "\363\7\0\377\352\3\0\377\334\1\0\377\312\2\2\377\273\23\24\377\270\77" + "@\3761\0\0\364\242\0\0\17\242\0\0\1\242\0\0\2\242\0\0\2\0\0\0\0\0\0\0" + "\0""4\0\0\1""3\0\0\3""3\0\0\5""3\0\0\4M\0\0\2\243\0\0\11\0\0\0\377\332" + "\274\301\377\336\300\305\377\336\301\305\377\334\276\305\377\334\272" + "\304\377\334\273\306\377\336\274\311\377\335\273\312\377\335\271\313" + "\377\334\270\314\377\334\266\316\377\337\301\322\377\345\322\337\377" + "qnr\377\0\0\0\377\22\0\0\326\\\0\0\234\216\0\0\314\247\0\0\373\277\0" + "\0\377\315\0\0\377\327\0\0\377\340\0\0\377\352\3\0\377\362\7\0\377\370" + "\16\0\377\373\22\0\377\373\22\0\377\370\16\0\377\361\10\0\377\342\2\0" + "\377\317\0\0\377\277\16\16\377\27157\375;\0\0\353\244\0\0\24\243\0\0" + "\5\244\0\0\5\245\0\0\2\0\0\0\0\0\0\0\0""5\0\0\1""5\0\0\3""4\0\0\3""4" + "\0\0\2\224\0\0\4\250\0\0\33\4\0\0\375\322\257\270\377\336\275\306\377" + "\336\275\310\377\336\274\310\377\335\274\312\377\335\272\312\377\335" + "\271\313\377\334\270\314\377\331\261\313\377\330\254\311\377\325\254" + "\305\377\311\257\270\377\314\273\310\377\323\312\327\377\257\235\251" + "\377hEJ\377d\20\21\377\222\6\7\377\270\3\4\377\311\0\0\377\325\0\0\377" + "\337\0\0\377\351\2\0\377\361\7\0\377\370\17\0\377\373\27\0\377\375\36" + "\1\377\375\36\1\377\373\30\0\377\366\17\0\377\350\6\0\377\326\1\0\377" + "\303\11\11\377\272*+\370L\0\0\316\244\0\0\33\244\0\0\13\247\0\0\4\250" + "\0\0\1\0\0\0\0\0\0\0\0""6\0\0\2""6\0\0\4""6\0\0\3j\0\0\4\247\0\0\17\254" + "\0\0<\30\0\0\367\302\232\251\377\337\275\312\377\336\275\313\377\336" + "\275\314\377\334\271\314\377\334\266\313\377\332\261\312\377\327\254" + "\310\377\325\254\303\377\317\263\271\377\310\256\270\377\276\244\267" + "\377\247\230\263\377\263\236\272\377\301\250\302\377\305\213\227\377" + "\277MQ\377\274\26\30\377\305\2\2\377\322\0\0\377\336\0\0\377\350\2\0" + "\377\361\7\0\377\367\16\0\377\373\27\0\377\375\"\1\377\375(\2\377\375" + ")\1\377\376#\0\377\372\30\0\377\357\14\0\377\334\3\0\377\307\6\6\377" + "\267\35\36\364g\0\0\265\244\0\0)\246\0\0\16\251\0\0\2\255\0\0\0\0\0\0" + "\0\0\0\0\0""6\0\0\2""6\0\0\4""6\0\0\3\226\0\0\10\253\0\0)\260\0\0lE\0" + "\0\355u\\g\377\335\271\313\377\334\270\313\377\332\263\311\377\331\260" + "\311\377\327\254\307\377\325\255\303\377\324\266\277\377\315\257\270" + "\377\306\251\267\377\273\236\264\377\245\224\263\377\253\227\265\377" + "\243\227\305\377\260\213\247\377\265kw\377\266,1\377\276\7\10\377\316" + "\0\0\377\333\0\0\377\346\2\0\377\360\7\0\377\370\16\0\377\373\27\0\377" + "\375#\1\377\375-\3\377\3763\1\377\3773\0\377\376.\0\377\374!\0\377\363" + "\22\0\377\341\6\0\377\313\4\3\377\257\12\12\362\214\0\0\243\245\0\0""9" + "\250\0\0\20\256\0\0\2\263\0\0\0\0\0\0\0""6\0\0\1""6\0\0\3""6\0\0\4o\0" + "\0\4\246\0\0\30\257\0\0P\266\0\0\237\221\0\0\350\0\0\0\377\322\250\277" + "\377\331\260\310\377\327\255\310\377\326\252\307\377\325\270\276\377" + "\322\261\270\377\314\256\270\377\305\247\265\377\272\233\262\377\251" + "\222\262\377\250\226\266\377\254\225\266\377\255\233\302\377\266\212" + "\237\377\267Zc\377\272\37#\377\306\3\3\377\327\0\0\377\344\2\0\377\357" + "\6\0\377\367\15\0\377\374\27\0\377\375\"\0\377\375-\2\377\3768\2\377" + "\376>\1\377\377>\0\377\3779\0\377\375+\0\377\366\31\0\377\346\12\0\377" + "\317\2\0\377\260\0\0\361\246\0\0\244\250\0\0I\254\0\0\21\263\0\0\1\274" + "\0\0\0\0\0\0\0""6\0\0\1""6\0\0\3=\0\0\4\226\0\0\13\255\0\0/\264\0\0z" + "\275\0\0\307\307\0\0\3629\0\0\377\224k\202\377\327\252\306\377\325\254" + "\303\377\324\265\275\377\320\260\271\377\312\254\270\377\303\243\264" + "\377\267\226\257\377\255\222\261\377\247\230\270\377\252\225\267\377" + "\245\234\311\377\262\233\272\377\271~\217\377\270FM\377\300\24\26\377" + "\316\1\1\377\340\1\0\377\354\6\0\377\366\15\0\377\373\26\0\377\376!\0" + "\377\375.\2\377\3758\2\377\376A\1\377\376H\0\377\377J\0\377\377E\0\377" + "\3766\0\377\370!\0\377\352\16\0\377\325\3\0\377\274\0\0\360\261\0\0\260" + "\254\0\0V\260\0\0\22\272\0\0\1\305\0\0\0\0\0\0\0""6\0\0\1""6\0\0\2r\0" + "\0\3\246\0\0\27\261\0\0M\272\0\0\242\305\0\0\340\321\0\0\373\243\0\0" + "\377\0\0\0\377\306\251\256\377\322\262\270\377\317\260\271\377\311\251" + "\266\377\301\240\263\377\270\227\260\377\261\222\260\377\244\223\265" + "\377\250\224\266\377\237\227\307\377\254\237\310\377\267\230\262\377" + "\272r\200\377\27349\377\306\14\15\377\327\1\0\377\351\4\0\377\364\14" + "\0\377\372\26\0\377\375!\0\377\375,\0\377\3769\2\377\376D\2\377\376M" + "\0\377\377T\0\377\377V\0\377\377P\0\377\376@\0\377\372*\0\377\356\23" + "\0\377\332\5\0\377\303\0\0\362\265\0\0\270\257\0\0[\265\0\0\24\300\0" + "\0\1\315\0\0\0\0\0\0\0""3\0\0\1""4\0\0\1\234\0\0\7\257\0\0(\270\0\0p" + "\302\0\0\302\317\0\0\361\334\1\0\376\347\2\0\377d\1\0\377\0\0\0\377\310" + "\247\256\377\307\246\264\377\277\235\260\377\271\227\260\377\264\224" + "\261\377\246\214\256\377\247\215\257\377\252\221\264\377\247\232\311" + "\377\265\245\306\377\273\224\250\377\273do\377\277&*\377\316\7\7\377" + "\341\4\0\377\361\12\0\377\371\24\0\377\375\40\0\377\376,\0\377\3768\1" + "\377\376D\2\377\376O\0\377\376Y\0\377\376a\0\377\377b\0\377\377\\\0\377" + "\377K\0\377\3732\0\377\361\31\0\377\337\10\0\377\311\1\0\365\271\0\0" + "\302\264\0\0d\272\0\0\26\310\0\0\1\326\0\0\0""3\0\0\1""3\0\0\2T\0\0\4" + "\243\0\0\22\265\0\0C\277\0\0\226\314\0\0\333\333\2\0\372\351\5\0\377" + "\361\7\0\377\366\12\0\377;\2\0\377.*)\377\272\226\251\377\271\227\261" + "\377\265\225\263\377\250\216\260\377\247\213\254\377\247\207\246\377" + "\241\225\301\377\256\244\313\377\271\244\301\377\274\211\232\377\274" + "PX\377\303\32\34\377\326\4\3\377\352\10\0\377\367\22\0\377\374\37\0\377" + "\376+\0\377\3776\0\377\376B\0\377\376O\1\377\376[\0\377\377e\0\377\377" + "m\0\377\377o\0\377\377g\0\377\377V\0\377\375<\0\377\364\37\0\377\342" + "\12\0\377\315\1\0\365\275\0\0\304\271\0\0g\301\0\0\27\317\0\0\2\337\1" + "\0\0""3\0\0\1""3\0\0\3n\0\0\10\251\0\0\"\271\0\0c\306\0\0\267\326\2\0" + "\355\347\6\0\376\363\14\0\377\371\22\0\377\374\25\0\377\347\21\0\377" + "/\2\0\377&\40!\377\256\213\250\377\252\220\263\377\245\222\263\377\250" + "\205\244\377\236\203\257\377\246\225\301\377\266\252\315\377\275\245" + "\275\377\275\177\216\377\275\77E\377\312\21\22\377\336\6\1\377\361\17" + "\0\377\372\35\0\377\376+\0\377\3776\0\377\376A\0\377\376M\1\377\376Z" + "\0\377\377f\0\377\377q\0\377\377y\0\377\377{\0\377\377s\0\377\377a\0" + "\377\375E\0\377\366&\0\377\347\17\0\377\322\3\0\367\301\0\0\304\275\0" + "\0h\306\0\0\31\326\1\0\2\347\4\0\0""3\0\0\1""7\0\0\2\224\0\0\13\261\0" + "\0""4\276\0\0\202\315\1\0\320\337\5\0\370\360\16\0\377\372\30\0\377\375" + "\37\0\377\376!\0\377\375\36\0\377\352\24\0\377B\3\0\377\0\0\0\377\223" + "{\235\377\246\217\260\377\253\177\236\377\242\202\253\377\256\234\301" + "\377\272\255\314\377\276\245\273\377\277|\212\377\3017<\377\320\16\15" + "\377\346\12\0\377\366\30\0\377\375(\0\377\3766\0\377\377B\0\377\376L" + "\0\377\376W\0\377\376d\0\377\377q\0\377\377}\0\377\377\205\0\377\377" + "\207\0\377\377\177\0\377\377l\0\377\376N\0\377\370-\0\377\352\23\0\377" + "\325\4\0\370\305\0\0\305\301\0\0k\314\0\0\31\334\3\0\2\355\11\0\0\0\0" + "\0\0z\0\0\1\253\0\0\17\271\0\0D\305\0\0\231\326\3\0\340\350\12\0\376" + "\367\27\0\377\375$\0\377\376,\0\377\377-\0\377\376*\0\377\375\40\0\377" + "\367\24\0\377n\4\0\377\0\0\0\377hI[\377\233o\224\377\251}\242\377\265" + "\235\277\377\275\260\312\377\301\243\267\377\277u\202\377\30526\377\325" + "\16\13\377\353\17\0\377\371\40\0\377\3763\0\377\377B\0\377\376N\0\377" + "\376W\1\377\376b\0\377\376n\0\377\377|\0\377\377\210\0\377\377\221\0" + "\377\377\223\0\377\377\212\0\377\377u\0\377\376V\0\377\3713\0\377\354" + "\25\0\377\330\5\0\370\310\0\0\312\305\0\0i\320\1\0\32\342\6\0\1\362\20" + "\0\0\0\0\0\0\247\0\0\2\261\0\0\33\275\0\0Z\314\1\0\257\336\6\0\353\360" + "\22\0\377\373\"\0\377\3760\0\377\3778\0\377\3779\0\377\3775\0\377\376" + "+\0\377\372\34\0\377\357\15\0\377\253\2\0\377B\0\0\375+\0\0\377\177D" + "V\377\253\211\247\377\276\254\306\377\301\235\257\377\277gr\377\310)" + ",\377\333\16\10\377\357\25\0\377\373)\0\377\376>\0\377\377M\0\377\376" + "Y\0\377\376b\0\377\376l\0\377\377y\0\377\377\207\0\377\377\224\0\377" + "\377\235\0\377\377\236\0\377\377\224\0\377\377~\0\377\377]\0\377\372" + "7\0\377\355\30\0\377\332\6\0\367\312\0\0\305\310\0\0l\324\2\0\31\347" + "\12\0\2\366\27\0\0\0\0\0\0\255\0\0\4\265\0\0(\302\0\0s\322\3\0\304\345" + "\14\0\366\366\33\0\377\375.\0\377\376<\0\377\377D\0\377\377E\0\377\377" + "@\0\377\3775\0\377\373$\0\377\363\22\0\377\342\6\0\377\315\0\0\367\217" + "\0\0\333R\0\0\324\33\0\0\370\14\0\0\377\215]p\377\262GQ\377\311\34\36" + "\377\340\16\4\377\363\35\0\377\3744\0\377\377J\0\377\376X\0\377\376c" + "\0\377\376l\0\377\376u\0\377\377\204\0\377\377\222\0\377\377\237\0\377" + "\377\250\0\377\377\250\0\377\377\236\0\377\377\206\0\377\377d\0\377\372" + "<\0\377\356\32\0\377\333\7\0\365\314\0\0\307\313\0\0m\330\3\0\32\352" + "\16\0\2\367\37\0\0\0\0\0\0\265\0\0\5\276\0\0""0\313\1\0\201\332\7\0\320" + "\353\23\0\373\371(\0\377\376<\0\377\377I\0\377\377P\0\377\377Q\0\377" + "\377K\0\377\377\77\0\377\375-\0\377\365\31\0\377\346\11\0\377\321\1\0" + "\374\276\0\0\325\262\0\0\207\244\0\0""70\0\0\\N\0\0\251\211\0\0\346\276" + "\2\0\373\343\17\0\377\366&\0\377\375@\0\377\376U\0\377\376c\0\377\376" + "m\0\377\376u\0\377\377\201\0\377\377\215\0\377\377\234\0\377\377\251" + "\0\377\377\262\0\377\377\262\0\377\377\246\0\377\377\216\0\377\377j\0" + "\377\372A\0\377\357\35\0\377\334\7\0\367\315\0\0\310\314\0\0l\333\5\0" + "\31\355\23\0\2\371(\0\0\0\0\0\0\265\0\0\11\304\0\0""8\322\3\0\214\342" + "\14\0\330\361\34\0\375\3744\0\377\376J\0\377\377W\0\377\377]\0\377\377" + "]\0\377\377V\0\377\377H\0\377\3755\0\377\370\40\0\377\353\15\0\377\326" + "\3\0\376\302\0\0\335\265\0\0\224\255\0\0A\250\0\0(\261\0\0]\277\0\0\266" + "\324\6\0\355\352\25\0\377\3700\0\377\376L\0\377\377c\0\377\377p\0\377" + "\377y\0\377\377\201\0\377\377\212\0\377\377\227\0\377\377\246\0\377\377" + "\263\0\377\377\273\0\377\377\272\0\377\377\256\0\377\377\224\0\377\377" + "o\0\377\373D\0\377\357\40\0\377\334\11\0\370\316\0\0\310\316\1\0j\336" + "\7\0\31\357\30\0\2\3730\0\0\0\0\0\0\261\0\0\22\305\1\0J\326\6\0\236\347" + "\22\0\341\365'\0\376\375B\0\377\377W\0\377\377d\0\377\377j\0\377\377" + "i\0\377\377a\0\377\377R\0\377\376>\0\377\373'\0\377\357\22\0\377\333" + "\5\0\377\307\1\0\346\270\0\0\246\256\0\0Y\250\0\0B\262\0\0x\302\0\0\311" + "\330\11\0\364\356\34\0\377\372:\0\377\377Y\0\377\377p\0\377\377|\0\377" + "\377\205\0\377\377\213\0\377\377\224\0\377\377\241\0\377\377\257\0\377" + "\377\274\0\377\377\303\0\377\377\302\0\377\377\264\0\377\377\231\0\377" + "\377r\0\377\373G\0\377\360!\0\377\335\11\0\367\316\0\0\303\320\1\0i\341" + "\11\0\30\362\35\0\1\3739\0\0\0\0\0\0\262\0\0\35\305\2\0b\327\11\0\266" + "\352\31\0\355\3714\0\376\376P\0\377\377e\0\377\377r\0\377\377v\0\377" + "\377u\0\377\377m\0\377\377\\\0\377\377G\0\377\374/\0\377\364\30\0\377" + "\341\7\0\377\313\1\0\362\272\0\0\276\256\0\0x\251\0\0`\263\0\0\224\305" + "\1\0\332\335\14\0\373\361$\0\377\374F\0\377\377f\0\377\377~\0\377\377" + "\211\0\377\377\221\0\377\377\227\0\377\377\237\0\377\377\253\0\377\377" + "\270\0\377\377\305\0\377\377\313\0\377\377\310\0\377\377\271\0\377\377" + "\234\0\377\377t\0\377\373H\0\377\360\"\0\377\336\12\0\364\317\0\0\303" + "\321\2\0b\342\14\0\25\363#\0\2\374B\0\0\0\0\0\0\270\0\0$\312\3\0p\333" + "\15\0\305\355!\0\365\372@\0\377\376^\0\377\377s\0\377\377~\0\377\377" + "\203\0\377\377\200\0\377\377w\0\377\377g\0\377\377P\0\377\3757\0\377" + "\366\35\0\377\346\12\0\377\317\2\0\371\274\0\0\323\256\0\0\226\252\0" + "\0{\265\0\0\250\311\3\0\343\340\21\0\376\365.\0\377\375S\0\377\377t\0" + "\377\377\214\0\377\377\227\0\377\377\235\0\377\377\242\0\377\377\251" + "\0\377\377\265\0\377\377\303\0\377\377\316\0\377\377\323\0\377\377\315" + "\0\377\377\275\0\377\377\236\0\377\377u\0\377\373H\0\377\360!\0\377\335" + "\11\0\365\317\0\0\276\322\2\0[\344\20\0\21\365+\0\1\375M\0\0\0\0\0\0" + "\301\1\0&\322\6\0t\342\23\0\311\361+\0\367\375M\0\377\377k\0\377\377" + "\200\0\377\377\214\0\377\377\220\0\377\377\215\0\377\377\203\0\377\377" + "q\0\377\377Z\0\377\376\77\0\377\371#\0\377\352\16\0\377\323\3\0\375\276" + "\0\0\343\257\0\0\263\253\0\0\230\267\0\0\270\315\5\0\346\344\26\0\377" + "\3677\0\377\375`\0\377\377\204\0\377\377\234\0\377\377\245\0\377\377" + "\251\0\377\377\254\0\377\377\263\0\377\377\277\0\377\377\314\0\377\377" + "\327\0\377\377\331\0\377\377\321\0\377\377\277\0\377\377\237\0\377\377" + "v\0\377\372H\0\377\357!\0\377\334\10\0\361\317\0\0\264\323\3\0P\346\23" + "\0\16\3662\0\1\375X\0\0\0\0\0\0\314\2\0$\333\13\0p\351\34\0\310\3656" + "\0\367\375[\0\377\377y\0\377\377\216\0\377\377\230\0\377\377\234\0\377" + "\377\231\0\377\377\217\0\377\377}\0\377\377d\0\377\376G\0\377\372*\0" + "\377\356\22\0\377\331\5\0\376\302\0\0\360\261\0\0\321\254\0\0\273\271" + "\0\0\316\320\7\0\354\347\34\0\377\370B\0\377\376n\0\377\377\223\0\377" + "\377\253\0\377\377\263\0\377\377\265\0\377\377\265\0\377\377\273\0\377" + "\377\307\0\377\377\325\0\377\377\336\0\377\377\337\0\377\377\325\0\377" + "\377\277\0\377\377\236\0\377\377t\0\377\372F\0\377\356\37\0\377\332\10" + "\0\352\316\0\0\245\323\4\0C\347\26\0\12\3679\0\0\376b\0\0\237\0\0\1\324" + "\4\0\36\342\21\0h\356%\0\303\370C\0\367\376j\0\377\377\210\0\377\377" + "\233\0\377\377\246\0\377\377\252\0\377\377\246\0\377\377\233\0\377\377" + "\211\0\377\377p\0\377\376R\0\377\3733\0\377\362\27\0\377\336\7\0\377" + "\307\1\0\371\265\0\0\352\257\0\0\336\272\1\0\346\322\11\0\365\352\"\0" + "\377\372L\0\377\377|\0\377\377\242\0\377\377\272\0\377\377\300\0\377" + "\377\277\0\377\377\276\0\377\377\303\0\377\377\316\0\377\377\334\0\377" + "\377\345\0\377\377\343\0\377\377\326\0\377\377\276\0\377\377\233\0\377" + "\377p\0\377\372C\0\377\355\36\0\373\331\7\0\341\314\0\0\220\323\5\0""3" + "\347\31\0\6\367@\0\0\376m\0\0\243\0\0\1\322\5\0\26\343\25\0W\360-\0\265" + "\371P\0\361\377y\0\376\377\227\0\377\377\251\0\377\377\262\0\377\377" + "\266\0\377\377\264\0\377\377\251\0\377\377\225\0\377\377{\0\377\376\\" + "\0\377\375<\0\377\366\36\0\377\344\12\0\377\314\2\0\375\271\0\0\371\261" + "\0\0\365\274\1\0\367\325\13\0\373\355(\0\377\373V\0\377\377\211\0\377" + "\377\261\0\377\377\311\0\377\377\315\0\377\377\311\0\377\377\306\0\377" + "\377\312\0\377\377\326\0\377\377\343\1\377\377\353\2\377\377\346\0\377" + "\377\325\0\377\377\271\0\377\377\223\0\377\377h\0\377\371>\0\377\353" + "\33\0\370\326\7\0\322\311\0\0|\321\5\0$\346\34\0\3\367F\0\0\376w\0\0" + "\250\0\0\0\315\5\0\11\340\27\0""9\3605\0\227\372]\0\335\377\210\0\371" + "\377\244\0\377\377\265\0\377\377\276\0\377\377\302\0\377\377\277\0\377" + "\377\264\0\377\377\241\0\377\377\206\0\377\377g\0\377\376F\0\377\370" + "'\0\377\351\17\0\377\322\4\0\377\275\0\0\376\265\0\0\375\277\2\0\375" + "\327\16\0\376\357/\0\377\373b\0\377\377\227\0\377\377\301\0\377\377\330" + "\1\377\377\331\0\377\377\323\0\377\377\316\0\377\377\322\0\377\377\336" + "\1\377\377\353\4\377\377\360\5\377\377\350\3\377\377\322\1\377\377\260" + "\0\377\377\210\0\377\376^\0\377\3706\0\376\351\27\0\361\324\6\0\277\307" + "\0\0f\317\6\0\31\345\36\0\1\367L\0\0\376\202\0\0\256\0\0\0\314\7\0\1" + "\336\33\0\22\360=\0X\373j\0\261\377\227\0\342\377\262\0\367\377\302\0" + "\376\377\311\0\377\377\315\0\377\377\312\0\377\377\277\0\377\377\254" + "\0\377\377\221\0\377\377q\0\377\376P\0\377\372/\0\377\355\26\0\377\326" + "\6\0\377\301\1\0\377\267\0\0\377\301\2\0\377\331\21\0\377\3606\0\377" + "\374l\0\377\377\245\1\377\377\317\3\377\377\345\5\377\377\346\4\377\377" + "\335\1\377\377\326\0\377\377\331\0\377\377\345\3\377\377\361\10\377\377" + "\364\11\377\377\350\5\377\377\314\1\377\377\245\0\377\377y\0\377\376" + "Q\0\377\370-\0\375\347\23\0\345\321\5\0\257\304\0\0R\315\6\0\17\344\40" + "\0\1\367R\0\0\376\215\0\0\266\0\0\0\321\13\0\0\341\"\0\2\361G\0\30\374" + "y\0]\377\246\0\243\377\277\0\311\377\315\0\336\377\324\0\355\377\327" + "\0\362\377\325\0\372\377\313\0\373\377\270\0\377\377\234\0\377\377|\0" + "\377\377Z\0\377\3748\0\377\360\35\0\377\332\11\0\377\304\1\0\377\271" + "\0\0\377\303\3\0\377\332\23\0\377\361<\0\377\374w\0\377\377\261\3\377" + "\377\334\11\377\377\360\16\377\377\357\12\377\377\345\4\377\377\334\0" + "\377\377\337\2\377\377\353\7\377\377\367\15\377\377\367\16\377\377\347" + "\10\377\377\305\2\376\377\226\0\375\376g\0\374\376A\0\367\367$\0\357" + "\346\17\0\317\316\4\0\226\301\0\0=\313\7\0\12\344#\0\0\366Z\0\0\376\232" + "\0\0\0\0\0\0\327\20\0\0\345*\0\0\364S\0\2\375\207\0\24\377\264\0\77\377" + "\314\0o\377\330\0\215\377\336\0\253\377\341\1\274\377\341\1\316\377\327" + "\0\331\377\304\0\342\377\250\0\347\377\207\0\353\377d\0\361\375C\0\362" + "\362$\0\370\336\15\0\370\307\2\0\371\273\0\0\374\304\3\0\373\333\26\0" + "\373\362C\0\372\374\201\1\373\377\275\7\374\377\346\22\373\377\370\32" + "\372\377\365\24\373\377\352\11\373\377\342\2\374\377\344\4\372\377\360" + "\14\371\377\372\24\370\377\370\24\365\377\344\13\363\377\272\3\360\376" + "\204\0\353\376R\0\342\3740\0\330\365\31\0\304\344\13\0\240\315\2\0h\277" + "\0\0)\312\7\0\6\343'\0\0\366b\0\0\376\247\3\0\0\0\0\0\0\0\0\0\3523\0" + "\0\366a\0\0\375\227\0\1\377\304\0\11\377\332\1\31\377\343\1.\377\350" + "\2F\377\354\4\\\377\354\4u\377\344\3\210\377\322\1\230\377\265\0\250" + "\377\222\0\266\377o\0\274\376N\0\311\365.\0\317\342\22\0\323\312\4\0" + "\327\275\0\0\332\306\4\0\337\334\32\0\337\362K\0\337\374\214\3\335\377" + "\310\16\340\377\356\40\335\377\374*\337\377\371!\337\377\357\20\340\377" + "\347\6\335\377\351\10\334\377\364\24\330\377\374\36\323\377\370\34\316" + "\377\341\21\303\376\257\6\273\374p\0\257\372;\0\237\370\36\0\216\362" + "\20\0w\342\10\0V\314\2\0""4\275\0\0\23\311\10\0\3\343,\0\0\366l\2\0\376" + "\264\11\0\0\0\0\0\0\0\0\0\356<\0\0\370n\0\0\376\247\1\0\377\323\2\0\377" + "\345\2\1\377\354\3\4\377\361\6\11\377\365\11\22\377\366\13\37\377\357" + "\10*\377\336\4""6\377\300\1E\377\233\0R\377w\0`\376W\0m\3667\0x\344\30" + "\0\202\314\6\0\210\276\0\0\212\306\5\0\226\335\34\0\231\362Q\1\235\374" + "\226\6\240\377\321\26\234\377\362.\237\377\376<\236\377\372-\235\377" + "\360\26\240\377\350\10\231\377\353\13\224\377\365\34\216\377\375'\202" + "\377\371%x\376\335\26n\375\243\10_\366Z\1U\357%\0E\353\20\0""6\353\11" + "\0*\340\5\0\33\314\2\0\14\274\0\0\4\312\12\0\1\3451\1\0\367u\6\0\376" + "\275\24\0\0\0\0\0\0\0\0\0\0\0\0\0\371y\1\0\376\263\4\0\377\335\6\0\377" + "\354\6\0\377\361\7\0\377\364\12\0\377\370\17\1\377\372\21\2\377\365\16" + "\3\377\345\10\6\377\307\3\12\377\241\1\20\377}\0\27\376^\0\35\367\77" + "\0\"\346\36\0(\316\11\0-\277\1\0""1\307\6\0""5\335\37\0<\362V\1@\374" + "\234\11A\377\326\37@\377\365<B\377\376KA\377\3727A\377\357\32\77\377" + "\346\13=\377\351\17""8\377\365\"3\377\3751*\377\370/#\376\330\35\34\371" + "\227\13\26\355K\1\21\340\26\0\14\334\10\0\11\341\7\0\6\335\5\0\3\315" + "\2\0\1\276\0\0\0\315\13\0\0\3507\2\0\367z\14\0\376\301!\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\360\23\0\377\363\22\0\377\365" + "\27\0\377\371\35\0\377\373\40\0\377\367\35\0\377\352\24\0\377\316\13" + "\0\377\251\4\1\377\206\0\1\377j\0\2\370K\0\3\347&\0\4\320\13\0\5\300" + "\1\0\6\306\7\0\7\335%\0\11\361_\2\13\374\245\20\13\377\334/\13\377\367" + "T\13\377\376c\13\377\371G\13\377\356#\13\377\344\21\12\377\347\31\11" + "\377\3642\7\377\375E\5\377\367B\4\376\324-\2\367\221\24\1\347E\5\1\325" + "\20\0\1\325\12\0\1\337\16\0\1\336\13\0\0\322\5\0\0\303\0\0\0\323\16\0" + "\0\352=\6\0\367\200\31\0\0\0\0\0"}; + + +/* GdkPixbuf RGBA C-Source image dump */ + +#ifdef __SUNPRO_C +#pragma align 4 (open_pixbuf) +#endif +#ifdef __GNUC__ +static const guint8 open_pixbuf[] __attribute__ ((__aligned__ (4))) = +#else +static const guint8 open_pixbuf[] = +#endif +{ "" + /* Pixbuf magic (0x47646b50) */ + "GdkP" + /* length: header (24) + pixel_data (9216) */ + "\0\0$\30" + /* pixdata_type (0x1010002) */ + "\1\1\0\2" + /* rowstride (192) */ + "\0\0\0\300" + /* width (48) */ + "\0\0\0""0" + /* height (48) */ + "\0\0\0""0" + /* pixel_data: */ + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\377\205\261\257\377q\230\226\377/AA\377\0\0\0\377\0\0\0\377" + "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\377Jmm\377g\227\226\377b\221\222\377^\214" + "\214\377&;;\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\0" + "\0\0\377\0\0\0\377\0\0\0\0\0\0\0\377t\216\215\377\230\313\311\377\216" + "\275\274\377\214\273\271\377\211\270\266\377\203\262\261\377}\253\253" + "\377v\244\243\377c\212\211\377Spp\377'44\377\0\0\0\377\0\0\0\377\0\0" + "\0\377\0\0\0\377\0\0\0\3778SR\377g\223\223\377_\213\212\377\\\210\207" + "\377Z\205\206\377X\205\205\377V\203\203\377U\202\202\377Q\177\177\377" + "Lyy\377$<<\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\377RRR\377...\377\36\36\36\377\6\6\6\377\11\11\11\377\25\33\33" + "\377,<;\377C[[\377`\204\202\377v\242\241\377~\255\254\377\177\255\254" + "\377~\254\253\377}\253\251\377{\252\251\377z\250\247\377t\242\241\377" + "g\223\222\377\\\206\206\377Qzz\377^\211\210\377e\222\222\377^\212\212" + "\377\\\210\210\377Y\205\205\377V\202\202\377S\177\177\377P{|\377Nyy\377" + "Kvw\377Hst\377Fsu\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0" + "\0\0\377\0\0\0\377\243\241\241\377\351\350\350\377\377\377\377\377\363" + "\363\363\377\334\334\334\377\307\307\307\377\234\233\233\377aaa\3774" + "66\377\26\30\30\377\3\4\4\377\11\14\14\377\27\40\40\377&66\377;SR\377" + "Twv\377k\226\226\377m\234\234\377l\232\231\377i\227\226\377g\224\224" + "\377c\217\217\377_\212\212\377\\\210\207\377Y\205\204\377V\201\201\377" + "S\177~\377P|{\377Myy\377Jvv\377Grt\377Epp\377Bmn\377=ii\377\0\0\0\377" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\211\232\231" + "\377\276\334\332\377\274\325\324\377\263\310\310\377\232\256\256\377" + "\204\231\230\377}\212\212\377fml\377aff\377}~~\377\252\251\251\377\267" + "\266\266\377\306\304\305\377\352\350\350\377\377\377\377\377\377\377" + "\377\377\366\364\364\377\300\277\277\377\213\213\213\377aaa\377133\377" + "\23\26\26\377\3\4\3\377\12\15\15\377\25\35\35\377!21\3771II\377Fhh\377" + "V\202\202\377[\212\211\377W\205\205\377T\200\200\377P{{\377Lxx\377Ju" + "v\377Grr\377Doq\377Alm\377\77jj\377<ii\377/MM\377\0\0\0\377\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\266\323\323\377\232\304\303" + "\377\225\302\300\377\234\310\306\377\245\315\314\377\252\320\316\377" + "\262\320\316\377\266\320\316\377\257\311\311\377\243\270\267\377\211" + "\231\231\377i{z\377boo\377sww\377jll\377vyy\377\256\255\255\377\320\316" + "\316\377\345\344\344\377\365\363\363\377\377\377\377\377\377\377\377" + "\377\374\372\372\377\274\273\273\377}}}\377TUU\377/22\377\21\24\24\377" + "\2\3\3\377\7\13\13\377\21\33\33\377\33--\377&@@\3775XY\377Blm\377Drr" + "\377Cop\377>ii\377<fg\3779de\3778eg\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\377\204\236\235\377\267\327\326\377\220\276" + "\273\377\217\274\273\377\216\273\271\377\213\271\270\377\213\270\266" + "\377\212\267\266\377\211\266\265\377\226\277\275\377\243\310\306\377" + "\250\313\312\377\255\311\310\377\251\301\300\377\242\271\270\377\211" + "\242\241\377s\204\203\377[hh\377S^^\377pss\377\204\204\204\377\213\213" + "\213\377\256\255\255\377\344\343\343\377\365\364\364\377\377\377\377" + "\377\377\377\377\377\371\367\367\377\354\352\352\377\274\272\272\377" + "rrr\377DGG\377)--\377\20\23\23\377\2\3\3\377\5\11\11\377\33""22\377<" + "fg\3779ce\3776ab\3773`a\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\377\272\327\326\377\223\277\276\377\215\272\270" + "\377\215\271\270\377\213\267\266\377\211\265\264\377\207\264\262\377" + "\205\261\261\377\202\257\255\377\200\255\254\377~\253\252\377~\253\251" + "\377\177\253\253\377\200\254\252\377\210\261\260\377\227\272\272\377" + "\244\303\302\377\241\277\276\377\233\263\262\377\216\243\242\377s\212" + "\212\377]oo\377W``\377S[[\377imm\377\226\226\226\377kkk\377QQQ\377\225" + "\225\225\377\304\303\303\377\353\352\352\377\377\377\377\377\370\366" + "\366\377\327\324\324\377\243\242\242\377\23\25\25\377\30-.\3776bc\377" + "3]_\377\26,,\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\377\217\257\256\377\243\312\310\377\213\271\266\377\212" + "\267\266\377\211\266\264\377\207\263\262\377\205\262\260\377\203\260" + "\256\377\201\256\254\377\177\254\252\377}\252\250\377{\247\245\377x\245" + "\244\377v\243\242\377t\240\237\377q\235\234\377m\232\231\377l\231\230" + "\377p\234\233\377{\244\243\377\205\252\252\377\216\257\256\377\232\265" + "\265\377\225\261\261\377\210\240\240\377x\213\213\377P^^\377\32&&\377" + ")**\377,++\377\10\10\10\377\20\20\20\377000\377\254\254\254\377\377\377" + "\377\377\206\206\206\377\5\7\7\377)MN\3771]_\377\0\0\0\377\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\262" + "\324\322\377\212\266\265\377\210\265\264\377\206\263\261\377\204\261" + "\260\377\202\257\256\377\201\255\254\377~\253\251\377}\251\250\377{\247" + "\246\377x\245\244\377w\243\241\377t\240\237\377q\236\235\377o\232\232" + "\377m\231\227\377j\226\225\377g\223\223\377d\220\220\377b\216\215\377" + "`\214\213\377]\211\211\377[\207\207\377`\213\213\377s\231\231\377\177" + "\243\243\377p\225\225\377)BB\377\301\301\301\377\377\377\377\377\330" + "\330\330\377\263\263\263\377\7\7\7\377\356\356\356\377\330\327\327\377" + "nnn\377\30*+\377.\\^\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\251\307\307\377\215\270\267" + "\377\206\263\261\377\204\261\257\377\202\257\255\377\200\254\253\377" + "~\252\251\377|\250\247\377z\246\245\377w\244\242\377u\241\241\377s\237" + "\236\377q\235\234\377n\232\232\377l\230\227\377i\225\225\377g\223\222" + "\377e\220\220\377b\216\215\377_\213\213\377]\211\211\377[\206\206\377" + "X\203\203\377U\200\201\377R}~\377N{{\377Nzz\3775\\\\\377Y``\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\0\0\0\377\366\366\366\377\337" + "\337\337\377TTT\377\27&'\377\20()\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377m\205\204\377\241" + "\307\306\377\203\260\256\377\202\257\254\377\200\254\253\377}\252\251" + "\377|\250\247\377z\245\244\377x\244\242\377u\241\240\377r\237\236\377" + "p\235\233\377n\232\231\377k\227\226\377i\225\225\377f\222\222\377d\220" + "\220\377a\215\215\377_\213\213\377\\\210\210\377Z\206\205\377X\203\203" + "\377U\201\200\377S~~\377P||\377Myy\377Lww\377>hg\3778GH\377\347\345\345" + "\377\377\377\377\377\350\350\350\377\20\20\20\377\366\366\366\377\341" + "\340\340\377\37\40\40\377\32""78\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377" + "\255\315\313\377\201\256\254\377\200\254\252\377}\251\250\377{\250\246" + "\377y\245\244\377v\243\242\377u\241\241\377r\237\236\377p\234\233\377" + "n\231\231\377k\230\227\377h\224\225\377f\222\222\377d\220\217\377a\215" + "\215\377^\212\212\377\\\210\207\377Y\206\205\377X\202\203\377U\200\200" + "\377R~}\377P{{\377Mxy\377Kvv\377Itt\377Frr\377\32""55\377\267\267\267" + "\377\377\377\377\377\342\342\342\377\30\30\30\377\346\346\346\377\353" + "\351\351\377\3\3\4\377\35HI\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\245\304" + "\303\377\202\256\254\377}\251\250\377{\247\245\377y\245\244\377v\242" + "\241\377t\240\237\377r\236\235\377o\234\232\377m\231\230\377k\227\226" + "\377h\225\224\377e\221\221\377c\217\217\377a\215\215\377^\211\211\377" + "[\207\207\377Y\205\205\377V\202\202\377T\200\177\377Q|}\377Ozz\377Lw" + "x\377Jvu\377Hss\377Epp\377Dop\377!AA\377\213\215\215\377\377\377\377" + "\377\301\301\301\377***\377\341\341\341\377\254\252\252\377\11\13\13" + "\377\16$%\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377z\226\225\377\225\273\272" + "\377z\246\245\377x\244\243\377v\242\241\377t\237\237\377q\235\234\377" + "o\234\232\377l\230\230\377j\226\226\377h\224\223\377e\221\221\377c\217" + "\216\377a\214\214\377^\211\211\377[\206\207\377Y\204\204\377W\201\202" + "\377S\177\177\377Q}}\377Nzz\377Lww\377Juu\377Gss\377Epp\377Bmn\377Al" + "m\377/VW\377CNN\377\377\377\377\377\257\257\257\377444\377\351\351\351" + "\377qpp\377\12\24\25\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\377\252\312\312\377w\243\242\377u\241\240\377s\237\236\377q\235\234" + "\377n\232\232\377l\230\227\377i\225\225\377g\223\222\377d\221\220\377" + "b\216\216\377`\213\213\377]\211\211\377[\206\206\377X\203\204\377V\201" + "\201\377S~~\377P||\377Nyy\377Kvw\377Htt\377Fqr\377Dop\377Bmm\377\77j" + "k\377=ii\3773]^\377*:9\377\357\356\356\377\250\250\250\377AAA\377\345" + "\344\344\377<<<\377\16\"$\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\377\250\306\305\377v\242\241\377r\237\236\377p\234\233\377n\232" + "\231\377l\227\227\377i\225\224\377g\222\222\377d\220\217\377b\216\215" + "\377_\213\213\377\\\210\210\377Z\206\206\377W\203\203\377U\200\200\377" + "R~~\377P{{\377Mxy\377Kvv\377Hst\377Fqq\377Dno\377Alm\377>jk\377<gh\377" + ":ff\3772[\\\377!34\377\314\313\313\377\234\234\234\377PPP\377\334\332" + "\332\377\22\24\24\377\23""13\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\377\221\256\255\377~\247\246\377o\233\233\377m\232\230\377j" + "\226\227\377i\225\224\377f\222\222\377d\217\217\377a\215\215\377_\213" + "\212\377]\207\210\377Y\205\204\377W\203\202\377T\177\200\377Q~}\377O" + "{{\377Mxx\377Jvv\377Hss\377Eqq\377Bnn\377All\377\77ij\377<fg\3779ee\377" + "8cd\3771Z[\377\34""34\377\262\261\261\377\227\227\227\377OOO\377\325" + "\323\323\377\2\3\3\377\31""23\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\377y\227\227\377\207\256\255\377l\231\230\377j\226\226\377h" + "\224\223\377e\222\221\377c\217\216\377`\214\214\377^\212\211\377[\207" + "\207\377Y\205\205\377V\202\202\377T\177\200\377R}}\377Ozz\377Lwx\377" + "Juv\377Grs\377Epp\377Cmn\377@kl\377>hi\377;fg\3779de\3776ac\3775_`\377" + "1\\]\377\27""56\377\234\235\235\377\207\207\207\377fff\377\215\213\213" + "\377\11\15\16\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\377\222\264\264\377i\225\224\377h\223\223\377e\221\220\377c" + "\217\216\377`\214\214\377^\212\211\377[\207\206\377Y\204\204\377V\202" + "\202\377S\177\177\377Q}}\377Nzz\377Lww\377Itu\377Grr\377Dop\377Bmm\377" + "\77jk\377=hi\377;fg\3778cd\3776ab\3774^`\3772]^\3770\\]\377\21""34\377" + "\203\205\205\377|||\377ppp\377JKK\377\7\23\24\377\0\0\0\377\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\230\267\266\377c\214\214" + "\377b\215\214\377`\213\212\377^\211\211\377\\\210\210\377Z\206\205\377" + "X\203\203\377U\202\201\377S~\177\377Q||\377Ozz\377Kww\377Htt\377Fqr\377" + "Doo\377Alm\377\77ij\377=gh\377;ef\3777bd\3776aa\3773__\3771[\\\377/Z" + "[\377-XZ\377\24""78\377kpp\377mll\377{{{\377&'(\377\17\32\33\377\0\0" + "\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\221\255" + "\254\377[\203\202\377[\204\203\377Y\202\202\377X\201\201\377V\200\200" + "\377U\177~\377R}}\377Q|{\377Oyy\377Mxw\377Kuu\377Hst\377Fqq\377Cno\377" + "Alm\377\77jj\377<gh\377:ef\3778bc\3776`a\3773^_\3770\\\\\377/YZ\377," + "WY\377*VX\377\30;<\377@EE\377SSS\377vtt\377\15\16\17\377\0\0\0\377\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377v\215\215" + "\377Syx\377Qvv\377Pvv\377Puu\377Ovv\377Ntt\377Mtt\377Jss\377Hrr\377G" + "pp\377Eoo\377Cmn\377Akl\377@jj\377>hi\377<fg\3779de\3777bc\3775_a\377" + "3]^\3771\\\\\377.YZ\377-VX\377*UV\377)TV\377\27""9;\377044\377NMM\377" + "vuu\377\0\0\0\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\377]kk\377Pmm\377Bab\377Cdd\377Cff\377Cgg\377Cgg\377" + "Chh\377Bhh\377Ahh\377Agg\377\77ff\377=ef\377;cd\377:bc\3779ab\3777`a" + "\3774^_\3773\\]\3771Z\\\377/YZ\377-XY\377+VW\377*TV\377(RT\377&QR\377" + "\25""89\377\77FF\377;;;\377XXX\377\0\0\0\377\0\1\0\377\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377Mab\3771II\377" + "2LK\3774PO\3776RR\3776TT\3776UU\3777XX\3777XX\3777YY\3777Z[\3776Z[\377" + "5YZ\3773YZ\3773XY\3771XY\377/WX\377.VW\377,TU\377*ST\377)RS\377(PQ\377" + "%OP\377%OP\377#NO\377\23""56\377CKK\377544\377,..\377\0\0\0\377\210\207" + "\207\377\267\270\270\377\272\273\276\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\377(99\377$88\377&::\377'<<\377'=>\377" + "(@@\377*CC\377*DE\377+GG\377+IJ\377,KK\377,LM\377+LM\377+MN\377*MN\377" + ")NO\377(MN\377(MN\377&LL\377%LM\377$KL\377\"JK\377!IJ\377\40HJ\377\21" + "34\377>EF\377###\377\23\26\26\377\0\0\2\377\202\202\201\377\205\206\206" + "\377\226\226\227\377\263\262\263\377\276\272\275\377\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\377\0\0\0\377\34))\377\40" + "12\377\33..\377\33..\377\33--\377\36""33\377\37""56\377\37""78\377!9" + ":\377!;<\377\"<>\377!>\77\377!\77\77\377!AB\377!AB\377\40BB\377\40CD" + "\377\36BC\377\35BD\377\35BD\377\34BD\377\17""01\377=FF\377\25\25\25\377" + "\0\0\0\377\2\1\1\377YWW\377ihj\377xwy\377\212\211\210\377\244\244\243" + "\377\266\270\266\377\270\273\272\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\3\3\3\377" + "\2\3\3\377\13\16\16\377\16\25\25\377\17\32\32\377\22\"#\377\26*+\377" + "\27..\377\30""00\377\31""12\377\31""34\377\31""45\377\30""57\377\30""7" + "8\377\31""89\377\30""8:\377\30""9;\377\15++\3778AA\377\14\14\14\377\0" + "\0\0\377UUV\377XYW\377_a`\377klm\377}|z\377\216\217\217\377\234\234\234" + "\377\265\263\266\377\311\311\311\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\377\0\0" + "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\6\10\11\377\14\21\21\377" + "\17\27\27\377\17\34\34\377\17\40!\377\22')\377\22)*\377\22++\377\22," + "-\377\22-.\377\12%&\3777@A\377\0\0\0\377\0\0\0\377WWW\377_``\377hij\377" + "nno\377y{{\377\212\213\211\377\232\231\230\377\262\261\261\377\310\310" + "\311\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\377" + "\0\0\0\377\0\0\0\377\6\11\11\377\11\14\14\377\13\16\16\377\5\6\6\377" + "\1\1\1\377\7\13\13\377\11\20\20\377\13\27\27\377\20#$\377\17##\377\35" + ")*\377\22\22\22\377\1\1\2\377VUV\377`a]\377ikk\377rrr\377~~\177\377\222" + "\221\223\377\262\261\260\377\273\273\275\377\320\321\321\377\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\7\12\12\377\14\20\20\377" + "\13\17\17\377\25\32\33\377\23\27\27\377\24\33\34\377\0\0\0\377UUU\377" + "VVW\377dgf\377\177\177\177\377\212\215\216\377\244\246\250\377\271\271" + "\272\377\275\276\276\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0" + "\0\0\377\210\210\210\377\210\210\210\377\210\211\210\377\215\215\215" + "\377\301\300\276\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}; + + +/* GdkPixbuf RGBA C-Source image dump */ + +#ifdef __SUNPRO_C +#pragma align 4 (audiocd_pixbuf) +#endif +#ifdef __GNUC__ +static const guint8 audiocd_pixbuf[] __attribute__ ((__aligned__ (4))) = +#else +static const guint8 audiocd_pixbuf[] = +#endif +{ "" + /* Pixbuf magic (0x47646b50) */ + "GdkP" + /* length: header (24) + pixel_data (9216) */ + "\0\0$\30" + /* pixdata_type (0x1010002) */ + "\1\1\0\2" + /* rowstride (192) */ + "\0\0\0\300" + /* width (48) */ + "\0\0\0""0" + /* height (48) */ + "\0\0\0""0" + /* pixel_data: */ + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\377\0\0\0\377\0" + "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" + "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" + "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0" + "\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0" + "\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0" + "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\0\0" + "\0\377\0\0\0\0\0\0\0\2\0\0\0I\0\0\0\205\0\0\0\265\0\0\0\331\0\0\0\361" + "\0\0\0\375\0\0\0\375\0\0\0\361\0\0\0\331\0\0\0\265\0\0\0\205\0\0\0I\0" + "\0\0\2\0\0\0\0\0\0\0\0\0\0\0\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\0\0" + "\0\377\0\0\0\240\0\0\0\366\0\0\0\377\212r\203\377\250\215\246\377\257" + "\222\255\377\257\214\242\377\247\214\250\377\235\207\260\377\235\211" + "\262\377\242\216\260\377\233\206\244\377\177m\200\377\0\0\0\377\0\0\0" + "\366\0\0\0\240\0\0\0>\0\0\0\377\0\0\0\377\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""9\0\0\0\377\0\0\0" + "\377\213lm\377\315\256\254\377\321\264\271\377\300\242\270\377\272\236" + "\271\377\270\233\270\377\262\220\247\377\250\215\250\377\235\207\261" + "\377\235\212\264\377\246\223\272\377\260\237\276\377\301\262\307\377" + "\301\261\301\377\255\221\236\377j]d\377\0\0\0\377\0\0\0\377\0\0\0\377" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\207\0\0\0\377\0\0\0\377\0\0\0\377\330\262\247\377\330\265\261\377" + "\331\275\273\377\306\252\270\377\275\237\272\377\272\234\271\377\263" + "\221\252\377\247\214\247\377\234\207\260\377\237\213\265\377\250\226" + "\273\377\265\244\301\377\304\265\310\377\274\246\270\377\254\231\252" + "\377\236\217\242\377\226\212\231\377\0\0\0\377\0\0\0\377\0\0\0\207\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\21\0\0\0\272\0\0\0\377\262" + "\201\204\377\0\0\0\377\0\0\0\377\331\263\240\377\330\264\252\377\331" + "\271\264\377\322\266\272\377\276\240\270\377\271\234\271\377\264\224" + "\256\377\251\215\250\377\234\207\261\377\237\214\265\377\252\231\274" + "\377\277\257\306\377\277\256\277\377\262\235\255\377\240\217\242\377" + "\227\213\237\377\225\203\224\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0" + "\272\0\0\0\21\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\24\0\0\0\316\37\30\33\377\274{y\377" + "\312\211z\377\0\0\0\377\0\0\0\377\326\254\231\377\331\264\240\377\330" + "\265\252\377\332\273\266\377\305\247\270\377\273\236\271\377\267\227" + "\263\377\252\216\251\377\235\210\263\377\241\216\266\377\261\237\277" + "\377\304\265\307\377\273\242\261\377\244\223\245\377\230\212\235\377" + "\227\202\221\377\223}\210\377\0\0\0\377\0\0\0\377\214\216\227\377\37" + "\37\40\377\0\0\0\316\0\0\0\24\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\301(!\"\377\307\210\211\377" + "\313\213\214\377\311\205\212\377\0\0\0\377\0\0\0\377\320\235\215\377" + "\326\254\230\377\331\264\240\377\331\267\254\377\322\266\270\377\275" + "\240\270\377\272\233\267\377\254\221\252\377\235\211\263\377\244\222" + "\270\377\274\254\304\377\274\251\273\377\252\227\247\377\232\212\234" + "\377\232~\211\377\216\201\214\377\205\203\220\377\0\0\0\377\0\0\0\377" + "|\206\224\377\202\213\227\377$%'\377\0\0\0\301\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\222\0\0\0\377\310" + "\217\205\377\321\227\217\377\320\224\217\377\315\217\215\377\0\0\0\377" + "\0\0\0\377\310\204|\377\317\232\214\377\327\252\227\377\333\270\242\377" + "\333\272\256\377\303\245\267\377\272\234\267\377\256\224\254\377\237" + "\214\265\377\251\227\273\377\275\255\302\377\261\232\253\377\236\212" + "\233\377\227\200\212\377\211\203\217\377\201\203\221\377~\206\224\377" + "\0\0\0\377\0\0\0\377|\210\226\377\177\212\230\377\211\221\234\377\0\0" + "\0\377\0\0\0\222\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0A\0\0\0\377\274\212x\377\330\245\225\377\326\242\224\377\325\235" + "\221\377\321\227\220\377\0\0\0\377\0\0\0\377\312\210\220\377\306|\210" + "\377\315\220\206\377\326\250\227\377\334\271\237\377\322\264\262\377" + "\274\236\270\377\261\227\255\377\240\215\266\377\267\246\302\377\263" + "\232\255\377\244\212\230\377\221\205\220\377\202\204\221\377}\205\223" + "\377{\207\225\377{\207\225\377\0\0\0\377\0\0\0\377\206\220\235\377\212" + "\223\237\377\217\226\242\377\222\226\236\377\0\0\0\377\0\0\0A\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\270}cW\377\332\254\243\377" + "\331\252\237\377\330\251\234\377\331\250\233\377\330\246\227\377\0\0" + "\0\377\0\0\0\377\317\223\222\377\316\217\223\377\311\205\220\377\310" + "\177\216\377\331\257\236\377\350\322\271\377\332\310\323\377\330\313" + "\324\377\316\304\331\377\320\305\324\377\302\254\262\377\225\223\236" + "\377~\206\224\377w\203\221\377z\207\225\377}\212\230\377\204\217\233" + "\377\0\0\0\377\0\0\0\377\223\232\245\377\227\234\246\377\232\235\247" + "\377\234\236\250\377nmr\377\0\0\0\270\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0""0\0\0\0\377\316\242\236\377\334\264\261\377\334\261\255\377" + "\333\260\253\377\333\257\250\377\332\255\245\377\0\0\0\377\0\0\0\377" + "\327\244\232\377\323\233\226\377\316\224\224\377\327\250\257\377\342" + "\275\306\377\276\243\246\377a[V\377!\37\40\377\40\37!\377TOR\377\236" + "\240\245\377\273\301\310\377\225\240\253\377\201\215\232\377\213\224" + "\240\377\220\230\242\377\227\234\246\377\0\0\0\377\0\0\0\377\241\241" + "\252\377\243\241\251\377\243\241\251\377\245\241\251\377\245\236\245" + "\377\0\0\0\377\0\0\0""0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\200iRR\377\337" + "\273\276\377\337\272\275\377\337\272\274\377\336\272\273\377\0\0\0\377" + "\336\270\267\377\0\0\0\377\0\0\0\377\333\262\255\377\332\256\251\377" + "\341\275\270\377\351\317\316\377wik\377\0\0\0\377\0\0\0\322\0\0\0l\0" + "\0\0l\0\0\0\322\0\0\0\377ehk\377\312\314\321\377\261\263\272\377\245" + "\244\254\377\251\247\256\377\253\246\255\377\0\0\0\377\0\0\0\377\257" + "\247\254\377\257\246\254\377\257\245\253\377\257\245\252\377\257\244" + "\252\377[TX\377\0\0\0\200\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\275\275\220" + "\240\377\340\275\313\377\340\276\313\377\0\0\0\377\0\0\0\377\0\0\0\377" + "\0\0\0\377\0\0\0\377\0\0\0\377\336\315\277\377\335\315\276\377\351\337" + "\330\377\217\210\205\377\0\0\0\377\0\0\0\206\0\0\0\2\0\0\0\2\0\0\0\2" + "\0\0\0\2\0\0\0\206\0\0\0\377\206\202\203\377\327\317\321\377\0\0\0\377" + "\0\0\0\377\272\253\257\377\0\0\0\377\0\0\0\377\271\252\256\377\271\252" + "\256\377\271\252\256\377\272\252\257\377\272\252\257\377\245\224\231" + "\377\0\0\0\275\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\347\322\270\265\377" + "\336\312\306\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0" + "\0\0\377\0\0\0\377\334\300\304\377\333\274\303\377\354\333\341\377&#" + "%\377\0\0\0\234\0\0\0\2\0\0\0\2\0\0\0\2\0\0\0\2\0\0\0\2\0\0\0\2\0\0\0" + "\234%#$\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" + "\305\257\263\377\304\256\263\377\303\256\262\377\303\256\263\377\302" + "\256\262\377\274\245\254\377\0\0\0\347\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\374\333\302\302\377\337\307\307\377\0\0\0\377\0\0\0\377\0\0\0\377" + "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\332\270\306\377\333\267\310" + "\377\351\323\340\377\216\203\213\377\0\0\0\377\0\0\0\206\0\0\0\2\0\0" + "\0\2\0\0\0\2\0\0\0\2\0\0\0\206\0\0\0\377\220\210\211\377\0\0\0\377\0" + "\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\317\266\273\377\316" + "\265\272\377\315\264\271\377\314\263\270\377\314\263\267\377\310\257" + "\264\377\0\0\0\374\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\332\274\301" + "\377\336\300\305\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" + "\0\0\0\377\0\0\0\377\334\270\314\377\334\266\316\377\337\301\322\377" + "\345\322\337\377qnr\377\0\0\0\377\0\0\0\322\0\0\0l\0\0\0l\0\0\0\322\0" + "\0\0\377vqp\377\353\336\336\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377" + "\0\0\0\377\0\0\0\377\327\277\303\377\325\273\301\377\324\273\300\377" + "\322\270\276\377\321\267\275\377\317\264\272\377\0\0\0\374\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\347\322\257\270\377\336\275\306\377\336\275" + "\310\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\331\261\313" + "\377\330\254\311\377\325\254\305\377\311\257\270\377\314\273\310\377" + "\323\312\327\377\260\245\261\377XW^\377\40\40\"\377\36\37!\377XZ`\377" + "\254\261\262\377\331\330\324\377\324\310\304\377\0\0\0\377\0\0\0\377" + "\0\0\0\377\0\0\0\377\0\0\0\377\0\0\0\377\333\304\307\377\333\303\306" + "\377\332\301\306\377\330\277\304\377\327\277\302\377\316\261\266\377" + "\0\0\0\347\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\275\302\232\251\377\337" + "\275\312\377\336\275\313\377\336\275\314\377\0\0\0\377\0\0\0\377\0\0" + "\0\377\327\254\310\377\325\254\303\377\317\263\271\377\310\256\270\377" + "\276\244\267\377\247\230\263\377\264\237\273\377\304\273\330\377\322" + "\321\343\377\332\334\350\377\317\321\340\377\312\320\343\377\301\311" + "\331\377\264\273\275\377\266\262\257\377\310\274\265\377\0\0\0\377\0" + "\0\0\377\0\0\0\377\0\0\0\377\331\303\303\377\332\303\305\377\332\304" + "\306\377\332\303\307\377\332\303\306\377\332\303\306\377\277\240\246" + "\377\0\0\0\275\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\200u\\g\377\335\271" + "\313\377\334\270\313\377\332\263\311\377\331\260\311\377\327\254\307" + "\377\325\255\303\377\324\266\277\377\315\257\270\377\306\251\267\377" + "\273\236\264\377\245\224\263\377\253\227\265\377\244\231\310\377\262" + "\246\307\377\275\302\330\377\275\300\326\377\247\253\307\377\242\251" + "\311\377\242\256\315\377\240\256\273\377\260\265\271\377\270\263\263" + "\377\305\273\264\377\320\277\274\377\327\302\300\377\332\301\301\377" + "\332\304\303\377\331\304\304\377\332\305\305\377\331\304\305\377\331" + "\303\304\377\331\304\306\377q[_\377\0\0\0\200\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0""0\0\0\0\377\322\250\277\377\331\260\310\377\327\255\310\377" + "\326\252\307\377\325\270\276\377\322\261\270\377\314\256\270\377\306" + "\250\266\377\272\233\262\377\251\222\262\377\250\226\266\377\254\225" + "\266\377\256\241\312\377\272\262\315\377\301\306\332\377\276\302\325" + "\377\250\254\311\377\240\246\304\377\241\253\312\377\243\257\311\377" + "\251\266\267\377\262\264\270\377\271\264\266\377\301\267\264\377\315" + "\300\273\377\325\303\301\377\330\303\301\377\331\303\301\377\331\304" + "\304\377\331\304\303\377\331\304\305\377\317\270\267\377\0\0\0\377\0" + "\0\0""0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\270\224k\202\377\327" + "\252\306\377\325\254\303\377\324\265\275\377\320\260\271\377\312\254" + "\270\377\303\243\264\377\270\227\260\377\256\223\262\377\247\230\270" + "\377\252\225\267\377\245\234\311\377\264\250\312\377\277\270\321\377" + "\301\305\331\377\300\304\327\377\251\256\311\377\236\243\303\377\242" + "\252\310\377\237\253\313\377\235\253\275\377\255\265\272\377\261\262" + "\270\377\270\263\266\377\300\265\264\377\314\277\271\377\323\302\300" + "\377\330\304\301\377\331\303\302\377\331\303\302\377\330\305\303\377" + "\216ts\377\0\0\0\270\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0A\0\0\0\377\306\251\256\377\322\262\270\377\317\260\271\377\311\251" + "\266\377\301\240\263\377\270\227\260\377\262\224\263\377\244\226\270" + "\377\251\226\270\377\237\227\307\377\255\240\311\377\272\256\313\377" + "\301\277\326\377\302\306\331\377\277\302\326\377\253\257\312\377\237" + "\243\302\377\240\247\305\377\235\250\310\377\236\253\305\377\244\261" + "\271\377\260\266\273\377\262\262\270\377\267\262\267\377\300\266\267" + "\377\311\274\271\377\321\302\277\377\326\304\303\377\331\304\302\377" + "\304\255\251\377\0\0\0\377\0\0\0A\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\222\0\0\0\377\310\247\256\377\307\246\264\377" + "\277\235\260\377\271\227\260\377\264\225\263\377\246\222\265\377\250" + "\225\270\377\253\225\270\377\247\232\311\377\266\251\313\377\277\265" + "\316\377\303\305\332\377\301\305\331\377\276\302\326\377\256\261\314" + "\377\237\244\301\377\240\246\304\377\237\247\306\377\236\251\311\377" + "\235\252\276\377\252\266\271\377\261\265\274\377\262\261\267\377\270" + "\262\267\377\300\267\271\377\306\272\270\377\316\301\275\377\314\274" + "\271\377\0\0\0\377\0\0\0\222\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\301.*)\377\272\226\251\377\271\227" + "\261\377\265\225\263\377\250\220\263\377\247\226\271\377\250\225\267" + "\377\241\233\311\377\256\244\313\377\273\256\315\377\302\273\323\377" + "\305\310\334\377\302\306\331\377\276\301\325\377\257\262\314\377\242" + "\245\303\377\237\244\302\377\240\247\306\377\234\250\307\377\234\250" + "\303\377\242\260\273\377\255\265\273\377\261\263\273\377\262\257\266" + "\377\270\261\270\377\300\267\272\377\277\265\264\377...\377\0\0\0\301" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\24\0\0\0\316&\40!\377\256\213\250\377\252\220\263\377" + "\245\227\271\377\247\225\270\377\235\225\307\377\247\235\313\377\266" + "\252\315\377\277\264\316\377\304\276\325\377\305\311\334\377\302\306" + "\331\377\276\301\325\377\261\264\315\377\241\245\303\377\237\244\302" + "\377\240\246\304\377\235\246\305\377\233\247\306\377\235\252\300\377" + "\250\263\272\377\257\266\274\377\261\262\272\377\263\257\266\377\261" + "\253\262\377'()\377\0\0\0\316\0\0\0\24\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\21\0\0\0" + "\272\0\0\0\377\223{\235\377\246\225\270\377\252\225\271\377\241\232\312" + "\377\257\245\314\377\272\255\314\377\301\267\320\377\306\302\330\377" + "\304\310\333\377\303\306\331\377\276\301\325\377\262\265\315\377\242" + "\246\304\377\235\242\300\377\240\246\303\377\236\246\304\377\234\247" + "\306\377\232\247\303\377\241\256\276\377\254\266\273\377\260\264\273" + "\377\240\241\254\377\0\0\0\377\0\0\0\272\0\0\0\21\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\207\0\0\0\377aOb\377\226\212\270\377\251\235" + "\313\377\267\252\316\377\276\263\316\377\304\273\322\377\304\304\332" + "\377\305\310\333\377\301\305\330\377\276\301\325\377\263\267\316\377" + "\244\251\305\377\236\243\300\377\237\245\302\377\237\246\304\377\234" + "\247\305\377\233\246\305\377\234\252\300\377\237\253\267\377hnx\377\0" + "\0\0\377\0\0\0\207\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0""9\0\0\0\266\0\0\0\377n]v\377\254\233\274\377\300" + "\264\317\377\306\277\325\377\305\307\334\377\306\311\334\377\301\305" + "\330\377\276\301\325\377\264\270\317\377\245\252\306\377\237\243\301" + "\377\235\242\301\377\241\247\304\377\234\245\303\377\224\235\275\377" + "cl\201\377\0\0\0\377\0\0\0\266\0\0\0""9\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0>\0\0" + "\0\240\0\0\0\366\0\0\0\377\203{\225\377\250\254\303\377\271\274\321\377" + "\274\300\323\377\275\300\324\377\264\270\316\377\245\251\304\377\235" + "\237\273\377\224\226\260\377wz\217\377\0\0\0\377\0\0\0\366\0\0\0\240" + "\0\0\0>\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\0" + "\0\0I\0\0\0\205\0\0\0\265\0\0\0\331\0\0\0\361\0\0\0\375\0\0\0\375\0\0" + "\0\361\0\0\0\331\0\0\0\265\0\0\0\205\0\0\0I\0\0\0\2\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}; + + +/* GdkPixbuf RGBA C-Source image dump */ + +#ifdef __SUNPRO_C +#pragma align 4 (copycd_pixbuf) +#endif +#ifdef __GNUC__ +static const guint8 copycd_pixbuf[] __attribute__ ((__aligned__ (4))) = +#else +static const guint8 copycd_pixbuf[] = +#endif +{ "" + /* Pixbuf magic (0x47646b50) */ + "GdkP" + /* length: header (24) + pixel_data (9216) */ + "\0\0$\30" + /* pixdata_type (0x1010002) */ + "\1\1\0\2" + /* rowstride (192) */ + "\0\0\0\300" + /* width (48) */ + "\0\0\0""0" + /* height (48) */ + "\0\0\0""0" + /* pixel_data: */ + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\2\0\0\0I\0\0\0\205\0\0\0\265\0\0\0\331\0\0\0\361" + "\0\0\0\375\0\0\0\375\0\0\0\361\0\0\0\344\0\0\0\334\0\0\0\334\0\0\0\344" + "\0\0\0\361\0\0\0\375\0\0\0\375\0\0\0\361\0\0\0\331\0\0\0\265\0\0\0\205" + "\0\0\0I\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0>\0\0\0\240\0\0\0\366\0\0\0\377\212r\203\377\250\215\246\377" + "\257\222\255\377\257\214\242\377\247\214\250\377\235\207\260\377\235" + "\211\262\377\242\216\260\377\233\206\244\377\177m\200\377\0\0\0\377\6" + "\4\5\377>4>\377vf\205\377\235\211\262\377\242\216\260\377\233\206\244" + "\377\177m\200\377\0\0\0\377\0\0\0\366\0\0\0\240\0\0\0>\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0""9\0\0\0\266\0\0\0\377\213lm\377\315\256\254\377\321" + "\264\271\377\300\242\270\377\272\236\271\377\270\233\270\377\262\220" + "\247\377\250\215\250\377\235\207\261\377\235\212\264\377\246\223\272" + "\377\260\237\276\377\301\262\307\377\301\261\301\377\255\221\236\377" + "j]d\377\0\0\0\377,'3\377\200r\220\377\260\237\276\377\301\262\307\377" + "\301\261\301\377\255\221\236\377j]d\377\0\0\0\377\0\0\0\266\0\0\0""9" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\207\0\0\0\377z_b\377\315\247\234\377\330\262\247\377\330\265\261" + "\377\331\275\273\377\306\252\270\377\275\237\272\377\272\234\271\377" + "\263\221\252\377\247\214\247\377\234\207\260\377\237\213\265\377\250" + "\226\273\377\265\244\301\377\304\265\310\377\274\246\270\377\254\231" + "\252\377\236\217\242\377\226\212\231\377_Y]\377\0\0\0\377UMZ\377\304" + "\265\310\377\274\246\270\377\254\231\252\377\236\217\242\377\226\212" + "\231\377_Y]\377\0\0\0\377\0\0\0\207\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\21\0\0\0\272\0\0\0\377\262\201\204\377\321\240\220\377" + "\326\254\232\377\331\263\240\377\330\264\252\377\331\271\264\377\322" + "\266\272\377\276\240\270\377\271\234\271\377\264\224\256\377\251\215" + "\250\377\234\207\261\377\237\214\265\377\252\231\274\377\277\257\306" + "\377\277\256\277\377\262\235\255\377\240\217\242\377\227\213\237\377" + "\225\203\224\377\231|\205\377\215\202\211\377\0\0\0\3773/3\377\246\222" + "\241\377\240\217\242\377\227\213\237\377\225\203\224\377\231|\205\377" + "\215\202\211\377\0\0\0\377\0\0\0\272\0\0\0\21\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\24\0\0\0\316\37\30\33\377\274{y\377\312\211z\377\313\223\204\377\321" + "\237\217\377\326\254\231\377\331\264\240\377\330\265\252\377\332\273" + "\266\377\305\247\270\377\273\236\271\377\267\227\263\377\252\216\251" + "\377\235\210\263\377\241\216\266\377\261\237\277\377\304\265\307\377" + "\273\242\261\377\244\223\245\377\230\212\235\377\227\202\221\377\223" + "}\210\377\212\202\216\377\205\204\220\377\214\216\227\377\37\37\40\377" + "\37\34\37\377\214\177\220\377\227\202\221\377\223}\210\377\212\202\216" + "\377\205\204\220\377\214\216\227\377\37\37\40\377\0\0\0\316\0\0\0\24" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\301(!\"\377\307\210\211\377\313\213\214\377\311\205" + "\212\377\310\202y\377\312\217\202\377\320\235\215\377\326\254\230\377" + "\331\264\240\377\331\267\254\377\322\266\270\377\275\240\270\377\272" + "\233\267\377\254\221\252\377\235\211\263\377\244\222\270\377\274\254" + "\304\377\274\251\273\377\252\227\247\377\232\212\234\377\232~\211\377" + "\216\201\214\377\205\203\220\377\201\204\222\377\177\206\225\377|\206" + "\224\377\202\213\227\377$%'\377%\36!\377\216\201\214\377\205\203\220" + "\377\201\204\222\377\177\206\225\377|\206\224\377\202\213\227\377$%'" + "\377\0\0\0\301\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\222\0\0\0\377\310\217\205\377\321\227\217\377" + "\320\224\217\377\315\217\215\377\313\211\216\377\311\202\211\377\310" + "\204|\377\317\232\214\377\327\252\227\377\333\270\242\377\333\272\256" + "\377\303\245\267\377\272\234\267\377\256\224\254\377\237\214\265\377" + "\251\227\273\377\275\255\302\377\261\232\253\377\236\212\233\377\227" + "\200\212\377\211\203\217\377\201\203\221\377~\206\224\377|\206\224\377" + "z\206\224\377|\210\226\377\177\212\230\377\211\221\234\377\0\0\0\377" + "77=\377~\206\224\377|\206\224\377z\206\224\377|\210\226\377\177\212\230" + "\377\211\221\234\377\0\0\0\377\0\0\0\222\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0A\0\0\0\377\274\212x\377\330\245\225" + "\377\326\242\224\377\325\235\221\377\321\227\220\377\320\223\217\377" + "\316\217\221\377\312\210\220\377\306|\210\377\315\220\206\377\326\250" + "\227\377\334\271\237\377\322\264\262\377\274\236\270\377\261\227\255" + "\377\240\215\266\377\267\246\302\377\263\232\255\377\244\212\230\377" + "\221\205\220\377\202\204\221\377}\205\223\377{\207\225\377{\207\225\377" + "}\211\227\377\200\214\231\377\206\220\235\377\212\223\237\377\217\226" + "\242\377\222\226\236\377\0\0\0\377[do\377}\211\227\377\200\214\231\377" + "\206\220\235\377\212\223\237\377\217\226\242\377\222\226\236\377\0\0" + "\0\377\0\0\0A\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\270" + "}cW\377\332\254\243\377\331\252\237\377\330\251\234\377\331\250\233\377" + "\330\246\227\377\325\240\225\377\323\231\224\377\317\223\222\377\316" + "\217\223\377\311\205\220\377\310\177\216\377\331\257\236\377\350\322" + "\271\377\332\310\323\377\330\313\324\377\316\304\331\377\320\305\324" + "\377\302\254\262\377\225\223\236\377~\206\224\377w\203\221\377z\207\225" + "\377}\212\230\377\204\217\233\377\213\224\240\377\217\227\242\377\223" + "\232\245\377\227\234\246\377\232\235\247\377\234\236\250\377nmr\377$" + "'+\377\213\224\240\377\217\227\242\377\223\232\245\377\227\234\246\377" + "\232\235\247\377\234\236\250\377nmr\377\0\0\0\270\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0""0\0\0\0\377\316\242\236\377\334\264\261\377" + "\334\261\255\377\333\260\253\377\333\257\250\377\332\255\245\377\332" + "\253\241\377\331\252\235\377\327\244\232\377\323\233\226\377\316\224" + "\224\377\327\250\257\377\342\275\306\377\276\243\246\377a[V\377!\37\40" + "\377\40\37!\377TOR\377\236\240\245\377\273\301\310\377\225\240\253\377" + "\201\215\232\377\213\224\240\377\220\230\242\377\227\234\246\377\233" + "\236\247\377\237\240\251\377\241\241\252\377\243\241\251\377\243\241" + "\251\377\245\241\251\377\245\236\245\377\0\0\0\377}\200\207\377\237\240" + "\251\377\241\241\252\377\243\241\251\377\243\241\251\377\245\241\251" + "\377\245\236\245\377\0\0\0\377\0\0\0""0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\200iRR\377\337\273\276\377\337\272\275\377\337\272\274\377\336" + "\272\273\377\337\272\272\377\336\270\267\377\336\267\265\377\334\264" + "\261\377\333\262\255\377\332\256\251\377\341\275\270\377\351\317\316" + "\377wik\377\0\0\0\377'\40\37\377~gf\377~fc\377&\36\35\377\0\0\0\377e" + "hk\377\312\314\321\377\261\263\272\377\245\244\254\377\251\247\256\377" + "\253\246\255\377\254\246\254\377\254\246\254\377\257\247\254\377\257" + "\246\254\377\257\245\253\377\257\245\252\377\257\244\252\377[TX\377U" + "RU\377\254\246\254\377\257\247\254\377\257\246\254\377\257\245\253\377" + "\257\245\252\377\257\244\252\377[TX\377\0\0\0\200\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\275\275\220\240\377\340\275\313\377\340\276\313\377" + "\340\275\311\377\340\275\310\377\340\275\310\377\337\314\300\377\336" + "\315\300\377\337\315\301\377\336\315\277\377\335\315\276\377\351\337" + "\330\377\217\210\205\377\0\0\0\377i`[\377\334\313\276\377\335\313\277" + "\377\334\313\275\377\333\313\274\377nif\377\0\0\0\377\206\202\203\377" + "\327\317\321\377\274\255\261\377\273\255\261\377\272\253\257\377\271" + "\252\256\377\270\251\255\377\271\252\256\377\271\252\256\377\271\252" + "\256\377\272\252\257\377\272\252\257\377\245\224\231\377/,-\377\270\251" + "\255\377\271\252\256\377\271\252\256\377\271\252\256\377\272\252\257" + "\377\272\252\257\377\245\224\231\377\0\0\0\275\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\347\322\270\265\377\336\312\306\377\336\311\306\377" + "\336\311\307\377\336\310\305\377\336\307\306\377\336\306\306\377\335" + "\305\306\377\336\303\306\377\334\300\304\377\333\274\303\377\354\333" + "\341\377&#%\377VML\377\334\304\304\377\333\303\304\377\334\301\304\377" + "\332\276\302\377\331\272\301\377\352\331\337\377\16\15\16\377%#$\377" + "\345\330\333\377\313\263\270\377\312\262\267\377\311\262\267\377\306" + "\260\265\377\306\260\265\377\305\257\263\377\304\256\263\377\303\256" + "\262\377\303\256\263\377\302\256\262\377\274\245\254\377\22\20\21\377" + "\306\260\265\377\305\257\263\377\304\256\263\377\303\256\262\377\303" + "\256\263\377\302\256\262\377\274\245\254\377\0\0\0\347\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\374\333\302\302\377\337\307\307\377\337\305" + "\306\377\336\304\306\377\336\303\306\377\336\302\306\377\335\276\305" + "\377\334\273\304\377\333\272\305\377\332\270\306\377\333\267\310\377" + "\351\323\340\377\216\203\213\377\0\0\0\377hZ]\377\332\271\302\377\331" + "\270\303\377\330\266\304\377\331\265\306\377ndj\377\0\0\0\377\220\210" + "\211\377\350\333\336\377\330\301\305\377\326\276\303\377\323\273\300" + "\377\321\271\276\377\320\266\274\377\317\266\273\377\316\265\272\377" + "\315\264\271\377\314\263\270\377\314\263\267\377\310\257\264\377\2\2" + "\2\377\320\266\274\377\317\266\273\377\316\265\272\377\315\264\271\377" + "\314\263\270\377\314\263\267\377\310\257\264\377\0\0\0\374\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\332\274\301\377\336\300\305\377\336" + "\301\305\377\334\276\305\377\334\272\304\377\334\273\306\377\336\274" + "\311\377\335\273\312\377\335\271\313\377\334\270\314\377\334\266\316" + "\377\337\301\322\377\345\322\337\377qnr\377\0\0\0\377'!#\377\177ju\377" + "~ju\377&\40$\377\0\0\0\377vqp\377\353\336\336\377\343\314\317\377\333" + "\302\305\377\333\303\307\377\334\304\310\377\332\302\306\377\330\300" + "\304\377\327\277\303\377\325\273\301\377\324\273\300\377\322\270\276" + "\377\321\267\275\377\317\264\272\377\2\2\2\377\330\300\304\377\327\277" + "\303\377\325\273\301\377\324\273\300\377\322\270\276\377\321\267\275" + "\377\317\264\272\377\0\0\0\374\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\347\322\257\270\377\336\275\306\377\336\275\310\377\336\274\310\377" + "\335\274\312\377\335\272\312\377\335\271\313\377\334\270\314\377\331" + "\261\313\377\330\254\311\377\325\254\305\377\311\257\270\377\314\273" + "\310\377\323\312\327\377\260\245\261\377XW^\377\40\40\"\377\36\37!\377" + "XZ`\377\254\261\262\377\331\330\324\377\324\310\304\377\326\300\277\377" + "\333\300\300\377\332\302\303\377\332\302\304\377\332\302\305\377\333" + "\304\307\377\333\304\307\377\333\303\306\377\332\301\306\377\330\277" + "\304\377\327\277\302\377\316\261\266\377\24\22\22\377\333\304\307\377" + "\333\304\307\377\333\303\306\377\332\301\306\377\330\277\304\377\327" + "\277\302\377\316\261\266\377\0\0\0\347\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\275\302\232\251\377\337\275\312\377\336\275\313\377\336\275" + "\314\377\334\271\314\377\334\266\313\377\332\261\312\377\327\254\310" + "\377\325\254\303\377\317\263\271\377\310\256\270\377\276\244\267\377" + "\247\230\263\377\264\237\273\377\304\273\330\377\322\321\343\377\332" + "\334\350\377\317\321\340\377\312\320\343\377\301\311\331\377\264\273" + "\275\377\266\262\257\377\310\274\265\377\322\277\275\377\331\301\300" + "\377\333\302\302\377\332\303\303\377\331\303\303\377\332\303\305\377" + "\332\304\306\377\332\303\307\377\332\303\306\377\332\303\306\377\277" + "\240\246\377822\377\331\303\303\377\332\303\305\377\332\304\306\377\332" + "\303\307\377\332\303\306\377\332\303\306\377\277\240\246\377\0\0\0\275" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\200u\\g\377\335\271\313\377\334" + "\270\313\377\332\263\311\377\331\260\311\377\327\254\307\377\325\255" + "\303\377\324\266\277\377\315\257\270\377\306\251\267\377\273\236\264" + "\377\245\224\263\377\253\227\265\377\244\231\310\377\262\246\307\377" + "\275\302\330\377\275\300\326\377\247\253\307\377\242\251\311\377\242" + "\256\315\377\240\256\273\377\260\265\271\377\270\263\263\377\305\273" + "\264\377\320\277\274\377\327\302\300\377\332\301\301\377\332\304\303" + "\377\331\304\304\377\332\305\305\377\331\304\305\377\331\303\304\377" + "\331\304\306\377q[_\377l``\377\332\304\303\377\331\304\304\377\332\305" + "\305\377\331\304\305\377\331\303\304\377\331\304\306\377q[_\377\0\0\0" + "\200\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""0\0\0\0\377\322\250\277\377" + "\331\260\310\377\327\255\310\377\326\252\307\377\325\270\276\377\322" + "\261\270\377\314\256\270\377\306\250\266\377\272\233\262\377\251\222" + "\262\377\250\226\266\377\254\225\266\377\256\241\312\377\272\262\315" + "\377\301\306\332\377\276\302\325\377\250\254\311\377\240\246\304\377" + "\241\253\312\377\243\257\311\377\251\266\267\377\262\264\270\377\271" + "\264\266\377\301\267\264\377\315\300\273\377\325\303\301\377\330\303" + "\301\377\331\303\301\377\331\304\304\377\331\304\303\377\331\304\305" + "\377\317\270\267\377\0\0\0\377\254\236\234\377\330\303\301\377\331\303" + "\301\377\331\304\304\377\331\304\303\377\331\304\305\377\317\270\267" + "\377\0\0\0\377\0\0\0""0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\270\224k\202\377\327\252\306\377\325\254\303\377\324\265\275\377\320" + "\260\271\377\312\254\270\377\303\243\264\377\270\227\260\377\256\223" + "\262\377\247\230\270\377\252\225\267\377\245\234\311\377\264\250\312" + "\377\277\270\321\377\301\305\331\377\300\304\327\377\251\256\311\377" + "\236\243\303\377\242\252\310\377\237\253\313\377\235\253\275\377\255" + "\265\272\377\261\262\270\377\270\263\266\377\300\265\264\377\314\277" + "\271\377\323\302\300\377\330\304\301\377\331\303\302\377\331\303\302" + "\377\330\305\303\377\216ts\377522\377\314\277\271\377\323\302\300\377" + "\330\304\301\377\331\303\302\377\331\303\302\377\330\305\303\377\216" + "ts\377\0\0\0\270\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0A\0\0\0\377\306\251\256\377\322\262\270\377\317\260\271\377\311\251" + "\266\377\301\240\263\377\270\227\260\377\262\224\263\377\244\226\270" + "\377\251\226\270\377\237\227\307\377\255\240\311\377\272\256\313\377" + "\301\277\326\377\302\306\331\377\277\302\326\377\253\257\312\377\237" + "\243\302\377\240\247\305\377\235\250\310\377\236\253\305\377\244\261" + "\271\377\260\266\273\377\262\262\270\377\267\262\267\377\300\266\267" + "\377\311\274\271\377\321\302\277\377\326\304\303\377\331\304\302\377" + "\304\255\251\377\0\0\0\377\210\204\210\377\300\266\267\377\311\274\271" + "\377\321\302\277\377\326\304\303\377\331\304\302\377\304\255\251\377" + "\0\0\0\377\0\0\0A\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\222\0\0\0\377\310\247\256\377\307\246\264\377\277\235\260" + "\377\271\227\260\377\264\225\263\377\246\222\265\377\250\225\270\377" + "\253\225\270\377\247\232\311\377\266\251\313\377\277\265\316\377\303" + "\305\332\377\301\305\331\377\276\302\326\377\256\261\314\377\237\244" + "\301\377\240\246\304\377\237\247\306\377\236\251\311\377\235\252\276" + "\377\252\266\271\377\261\265\274\377\262\261\267\377\270\262\267\377" + "\300\267\271\377\306\272\270\377\316\301\275\377\314\274\271\377\0\0" + "\0\377KMP\377\262\261\267\377\270\262\267\377\300\267\271\377\306\272" + "\270\377\316\301\275\377\314\274\271\377\0\0\0\377\0\0\0\222\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\301.*)\377\272\226\251\377\271\227\261\377\265\225\263\377\250\220" + "\263\377\247\226\271\377\250\225\267\377\241\233\311\377\256\244\313" + "\377\273\256\315\377\302\273\323\377\305\310\334\377\302\306\331\377" + "\276\301\325\377\257\262\314\377\242\245\303\377\237\244\302\377\240" + "\247\306\377\234\250\307\377\234\250\303\377\242\260\273\377\255\265" + "\273\377\261\263\273\377\262\257\266\377\270\261\270\377\300\267\272" + "\377\277\265\264\377...\377'*-\377\255\265\273\377\261\263\273\377\262" + "\257\266\377\270\261\270\377\300\267\272\377\277\265\264\377...\377\0" + "\0\0\301\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\24\0\0\0\316&\40!\377\256\213\250\377\252" + "\220\263\377\245\227\271\377\247\225\270\377\235\225\307\377\247\235" + "\313\377\266\252\315\377\277\264\316\377\304\276\325\377\305\311\334" + "\377\302\306\331\377\276\301\325\377\261\264\315\377\241\245\303\377" + "\237\244\302\377\240\246\304\377\235\246\305\377\233\247\306\377\235" + "\252\300\377\250\263\272\377\257\266\274\377\261\262\272\377\263\257" + "\266\377\261\253\262\377'()\377\35\40&\377\220\234\260\377\250\263\272" + "\377\257\266\274\377\261\262\272\377\263\257\266\377\261\253\262\377" + "'()\377\0\0\0\316\0\0\0\24\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\21\0\0\0\272\0\0" + "\0\377\223{\235\377\246\225\270\377\252\225\271\377\241\232\312\377\257" + "\245\314\377\272\255\314\377\301\267\320\377\306\302\330\377\304\310" + "\333\377\303\306\331\377\276\301\325\377\262\265\315\377\242\246\304" + "\377\235\242\300\377\240\246\303\377\236\246\304\377\234\247\306\377" + "\232\247\303\377\241\256\276\377\254\266\273\377\260\264\273\377\240" + "\241\254\377\0\0\0\377*,5\377\221\233\270\377\232\247\303\377\241\256" + "\276\377\254\266\273\377\260\264\273\377\240\241\254\377\0\0\0\377\0" + "\0\0\272\0\0\0\21\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\207" + "\0\0\0\377aOb\377\226\212\270\377\251\235\313\377\267\252\316\377\276" + "\263\316\377\304\273\322\377\304\304\332\377\305\310\333\377\301\305" + "\330\377\276\301\325\377\263\267\316\377\244\251\305\377\236\243\300" + "\377\237\245\302\377\237\246\304\377\234\247\305\377\233\246\305\377" + "\234\252\300\377\237\253\267\377hnx\377\0\0\0\377JM[\377\237\246\304" + "\377\234\247\305\377\233\246\305\377\234\252\300\377\237\253\267\377" + "hnx\377\0\0\0\377\0\0\0\207\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0""9\0\0\0\266\0\0\0\377n]v\377\254\233" + "\274\377\300\264\317\377\306\277\325\377\305\307\334\377\306\311\334" + "\377\301\305\330\377\276\301\325\377\264\270\317\377\245\252\306\377" + "\237\243\301\377\235\242\301\377\241\247\304\377\234\245\303\377\224" + "\235\275\377cl\201\377\0\0\0\377/08\377{~\225\377\235\242\301\377\241" + "\247\304\377\234\245\303\377\224\235\275\377cl\201\377\0\0\0\377\0\0" + "\0\266\0\0\0""9\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0>\0\0\0\240\0\0\0\366\0\0" + "\0\377\203{\225\377\250\254\303\377\271\274\321\377\274\300\323\377\275" + "\300\324\377\264\270\316\377\245\251\304\377\235\237\273\377\224\226" + "\260\377wz\217\377\0\0\0\377\6\6\7\377FGN\377\210\213\233\377\245\251" + "\304\377\235\237\273\377\224\226\260\377wz\217\377\0\0\0\377\0\0\0\366" + "\0\0\0\240\0\0\0>\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\2\0\0\0I\0\0\0\205\0\0\0\265\0\0\0\331\0\0\0\361\0\0\0\375" + "\0\0\0\375\0\0\0\361\0\0\0\344\0\0\0\334\0\0\0\334\0\0\0\344\0\0\0\361" + "\0\0\0\375\0\0\0\375\0\0\0\361\0\0\0\331\0\0\0\265\0\0\0\205\0\0\0I\0" + "\0\0\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}; + + +/* GdkPixbuf RGBA C-Source image dump */ + +#ifdef __SUNPRO_C +#pragma align 4 (dumpcd_pixbuf) +#endif +#ifdef __GNUC__ +static const guint8 dumpcd_pixbuf[] __attribute__ ((__aligned__ (4))) = +#else +static const guint8 dumpcd_pixbuf[] = +#endif +{ "" + /* Pixbuf magic (0x47646b50) */ + "GdkP" + /* length: header (24) + pixel_data (9216) */ + "\0\0$\30" + /* pixdata_type (0x1010002) */ + "\1\1\0\2" + /* rowstride (192) */ + "\0\0\0\300" + /* width (48) */ + "\0\0\0""0" + /* height (48) */ + "\0\0\0""0" + /* pixel_data: */ + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\0\0" + "\0I\0\0\0\205\0\0\0\265\0\0\0\331\0\0\0\361\0\0\0\375\0\0\0\375\0\0\0" + "\361\0\0\0\331\0\0\0\265\0\0\0\205\0\0\0I\0\0\0\2\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0>\0\0\0\240\0\0\0\366\0\0\0\377" + "\212r\203\377\250\215\246\377\257\222\255\377\257\214\242\377\247\214" + "\250\377\235\207\260\377\235\211\262\377\242\216\260\377\233\206\244" + "\377\177m\200\377\0\0\0\377\0\0\0\366\0\0\0\240\0\0\0>\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0""9\0\0\0\266\0\0\0\377\213lm\377\315\256\254\377\321\264" + "\271\377\300\242\270\377\272\236\271\377\270\233\270\377\262\220\247" + "\377\250\215\250\377\235\207\261\377\235\212\264\377\246\223\272\377" + "\260\237\276\377\301\262\307\377\301\261\301\377\255\221\236\377j]d\377" + "\0\0\0\377\0\0\0\266\0\0\0""9\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\207\0\0\0\377z_b\377\315\247\234\377\330" + "\262\247\377\330\265\261\377\331\275\273\377\306\252\270\377\275\237" + "\272\377\272\234\271\377\263\221\252\377\247\214\247\377\234\207\260" + "\377\237\213\265\377\250\226\273\377\265\244\301\377\304\265\310\377" + "\274\246\270\377\254\231\252\377\236\217\242\377\226\212\231\377_Y]\377" + "\0\0\0\377\0\0\0\207\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\21" + "\0\0\0\272\0\0\0\377\262\201\204\377\321\240\220\377\326\254\232\377" + "\331\263\240\377\330\264\252\377\331\271\264\377\322\266\272\377\276" + "\240\270\377\271\234\271\377\264\224\256\377\251\215\250\377\234\207" + "\261\377\237\214\265\377\252\231\274\377\277\257\306\377\277\256\277" + "\377\262\235\255\377\240\217\242\377\227\213\237\377\225\203\224\377" + "\231|\205\377\215\202\211\377\0\0\0\377\0\0\0\272\0\0\0\21\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\24\0\0\0\316\37\30\33\377\274{y\377\312\211z\377\313\223" + "\204\377\321\237\217\377\326\254\231\377\331\264\240\377\330\265\252" + "\377\332\273\266\377\305\247\270\377\273\236\271\377\267\227\263\377" + "\252\216\251\377\235\210\263\377\241\216\266\377\261\237\277\377\304" + "\265\307\377\273\242\261\377\244\223\245\377\230\212\235\377\227\202" + "\221\377\223}\210\377\212\202\216\377\205\204\220\377\214\216\227\377" + "\37\37\40\377\0\0\0\316\0\0\0\24\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\301(!\"\377\307\210\211" + "\377\313\213\214\377\311\205\212\377\310\202y\377\312\217\202\377\320" + "\235\215\377\326\254\230\377\331\264\240\377\331\267\254\377\322\266" + "\270\377\275\240\270\377\272\233\267\377\254\221\252\377\235\211\263" + "\377\244\222\270\377\274\254\304\377\274\251\273\377\235\213\232\377" + "\212{\214\377\230|\207\377\216\201\214\377\205\203\220\377\201\204\222" + "\377\177\206\225\377|\206\224\377\202\213\227\377$%'\377\0\0\0\301\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\222\0\0\0\377\310\217\205\377\321\227\217\377\320\224\217\377\315" + "\217\215\377\313\211\216\377\311\202\211\377\310\204|\377\317\232\214" + "\377\327\252\227\377\333\270\242\377\333\272\256\377\303\245\267\377" + "\272\234\267\377\256\224\254\377\237\214\265\377\251\227\273\377\275" + "\255\302\377\235\213\232\377SZa\3775DF\3777@D\377[^`\377PRV\377cku\377" + "ku\201\377r|\211\377{\206\224\377\211\221\234\377\0\0\0\377\0\0\0\222" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0A\0\0\0\377" + "\274\212x\377\330\245\225\377\326\242\224\377\325\235\221\377\321\227" + "\220\377\320\223\217\377\316\217\221\377\312\210\220\377\306|\210\377" + "\315\220\206\377\326\250\227\377\334\271\237\377\322\264\262\377\274" + "\236\270\377\261\227\255\377\240\215\266\377\267\246\302\377\261\230" + "\253\377\200t~\377Oil\377`\210\213\377p\216\217\377\250\252\243\377\201" + "\201~\377VVS\377HHG\377STW\377imt\377ty\201\377\177\202\210\377\6\6\6" + "\377\0\0\0B\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\270}cW\377" + "\332\254\243\377\331\252\237\377\330\251\234\377\331\250\233\377\330" + "\246\227\377\325\240\225\377\323\231\224\377\317\223\222\377\316\217" + "\223\377\311\205\220\377\310\177\216\377\331\257\236\377\350\322\271" + "\377\332\310\323\377\330\313\324\377\316\304\331\377\320\305\324\377" + "\270\244\252\377Zgm\377Svy\377`\210\213\377\232\251\246\377\277\277\267" + "\377\300\300\270\377\273\273\263\377\250\250\242\377\231\231\225\377" + "\207\207\203\377lll\377ijk\377UTV\377\36\36\36\332ABB\\999\33\0\0\0\1" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0""0\0\0\0\377\316\242\236\377\334\264\261\377\334\261" + "\255\377\333\260\253\377\333\257\250\377\332\255\245\377\332\253\241" + "\377\331\252\235\377\327\244\232\377\323\233\226\377\316\224\224\377" + "\327\250\257\377\342\275\306\377\276\243\246\377a[V\377!\37\40\377\40" + "\37!\377TOR\377\215\221\226\377Jad\377\\\203\207\377{\234\237\377\316" + "\325\323\377\334\334\327\377\324\324\317\377\305\305\276\377\300\300" + "\270\377\300\300\270\377\300\300\270\377\263\263\256\377\246\246\241" + "\377\225\225\220\377\201\201~\377[[[\354///\271445\243OQQ\207MMM+\0\0" + "\0\5\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\200" + "iRR\377\337\273\276\377\337\272\275\377\337\272\274\377\336\272\273\377" + "\337\272\272\377\336\270\267\377\336\267\265\377\334\264\261\377\333" + "\262\255\377\332\256\251\377\341\275\270\377\351\317\316\377wik\377\0" + "\0\0\377\0\0\0\322\0\0\0l\0\0\0l\0\0\0\322\22\31\33\377Hhk\377]\205\211" + "\377\255\301\303\377\366\370\370\377\373\373\373\377\371\371\370\377" + "\363\363\362\377\351\351\346\377\332\332\325\377\316\316\307\377\301" + "\301\271\377\300\300\270\377\300\300\270\377\274\274\265\377\257\257" + "\251\377\244\244\235\377\216\216\215\376___\366BEE\325\34&'\250\30!!" + "f\36))\24\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\275\275\220\240" + "\377\340\275\313\377\340\276\313\377\340\275\311\377\340\275\310\377" + "\340\275\310\377\337\314\300\377\336\315\300\377\337\315\301\377\336" + "\315\277\377\335\315\276\377\351\337\330\377\217\210\205\377\0\0\0\377" + "\0\0\0\206\0\0\0\2\0\0\0\2\0\0\0\2\0\0\0\2*<>\362X~\203\377t\226\232" + "\377\316\331\332\377\360\360\356\377\350\350\345\377\367\367\366\377" + "\377\377\377\377\377\377\377\377\376\376\376\377\376\376\375\377\372" + "\372\370\377\334\334\327\377\304\304\275\377\300\300\271\377\300\300" + "\270\377\300\300\270\377\277\277\267\377\273\274\265\377\204\236\236" + "\377f\210\213\375dvx\367>DE\264$&'\30\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\347\322\270\265\377\336\312\306\377\336\311\306\377\336\311\307" + "\377\336\310\305\377\336\307\306\377\336\306\306\377\335\305\306\377" + "\336\303\306\377\334\300\304\377\333\274\303\377\354\333\341\377&#%\377" + "\0\0\0\234\0\0\0\2\0\0\0\2\0\0\0\2\0\0\0\2""9RV55MO\377\\\203\211\377" + "\231\262\265\377\361\364\365\377\376\376\376\377\361\361\360\377\352" + "\352\347\377\351\351\347\377\360\360\356\377\374\374\374\377\374\374" + "\374\377\377\377\377\377\377\377\377\377\374\374\373\377\352\352\347" + "\377\324\324\317\377\310\310\301\377\303\303\273\377\262\272\265\377" + "h\215\217\377}\234\237\377\263\305\311\377z\202\204\351;>\77""2\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374\333\302\302\377\337\307\307\377" + "\337\305\306\377\336\304\306\377\336\303\306\377\336\302\306\377\335" + "\276\305\377\334\273\304\377\333\272\305\377\332\270\306\377\333\267" + "\310\377\351\323\340\377\216\203\213\377\0\0\0\377\0\0\0\206\0\0\0\2" + "\0\0\0\2\0\0\0\3):=\300Ijo\377k\216\223\377\303\321\323\377\372\372\371" + "\377\370\370\367\377\377\377\376\377\377\377\377\377\373\373\372\377" + "\356\356\354\377\356\356\354\377\351\351\346\377\366\366\365\377\370" + "\370\367\377\375\375\375\377\377\377\377\377\377\377\377\377\370\370" + "\367\377\343\343\337\377\211\243\243\377j\220\222\377\223\255\261\377" + "\275\311\316\373ipr\276033\32\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\374" + "\332\274\301\377\336\300\305\377\336\301\305\377\334\276\305\377\334" + "\272\304\377\334\273\306\377\336\274\311\377\335\273\312\377\335\271" + "\313\377\334\270\314\377\334\266\316\377\337\301\322\377\345\322\337" + "\377qnr\377\0\0\0\377\0\0\0\322\0\0\0l\22\32\33\215'8:\375Z\200\206\377" + "\207\243\250\377\354\360\360\377\365\365\364\377\354\354\352\377\364" + "\364\362\377\365\365\364\377\374\374\374\377\377\377\377\377\377\377" + "\377\377\365\365\364\377\362\362\360\377\356\356\354\377\360\360\357" + "\377\365\365\364\377\374\374\373\377\377\377\377\377\344\353\353\377" + "n\222\225\377q\224\227\377\253\276\302\377\234\246\251\355DIJv\0\0\0" + "\13\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\347\322\257\270\377\336\275" + "\306\377\336\275\310\377\336\274\310\377\335\274\312\377\335\272\312" + "\377\335\271\313\377\334\270\314\377\331\261\313\377\330\254\311\377" + "\325\254\305\377\311\257\270\377\314\273\310\377\323\312\327\377\260" + "\245\261\377XW^\377\37\37!\377!,/\377Ffk\377a\206\214\377\266\307\311" + "\377\376\376\376\377\377\377\377\377\372\372\371\377\366\366\365\377" + "\353\353\351\377\356\356\354\377\364\364\363\377\375\375\374\377\377" + "\377\377\377\377\377\377\377\373\373\373\377\364\364\363\377\356\356" + "\354\377\365\365\364\377\377\377\377\377\236\266\270\377e\213\216\377" + "\177\236\241\377\265\303\310\377rz}\327\36\40\40A\0\0\0\2\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\275\302\232\251\377\337\275\312\377\336\275" + "\313\377\336\275\314\377\334\271\314\377\334\266\313\377\332\261\312" + "\377\327\254\310\377\325\254\303\377\317\263\271\377\310\256\270\377" + "\276\244\267\377\247\230\263\377\264\237\273\377\304\273\330\377\322" + "\321\343\377\254\260\272\377G\\a\377T|\202\377k\217\224\377\363\366\366" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\373\373\373\377\366\366\365\377\354\354\351\377\354\354\351\377\354" + "\354\352\377\375\375\375\377\377\377\377\377\377\377\376\377\372\372" + "\372\377\373\373\373\377\353\360\361\377x\231\234\377e\214\217\377\242" + "\267\273\377\233\247\253\370INP\223\10\11\11\24\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\200u\\g\377\335\271\313\377\334\270\313\377" + "\332\263\311\377\331\260\311\377\327\254\307\377\325\255\303\377\324" + "\266\277\377\315\257\270\377\306\251\267\377\273\236\264\377\245\224" + "\263\377\253\227\265\377\244\231\310\377\262\246\307\377\272\277\325" + "\377elw\377Iip\377V\177\205\377\251\276\301\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\376\376\376\377\375\375\375\377\355\355\353\377" + "\350\350\346\377\351\351\347\377\370\370\370\377\375\375\375\377\375" + "\375\375\377\254\300\302\377g\215\221\377n\221\224\377\266\304\311\377" + "\206\221\224\343\35\37\40V\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0""0\0\0\0\377\322\250\277\377\331\260\310\377\327\255\310" + "\377\326\252\307\377\325\270\276\377\322\261\270\377\314\256\270\377" + "\306\250\266\377\272\233\262\377\251\222\262\377\250\226\266\377\254" + "\225\266\377\256\241\312\377\272\262\315\377\234\241\261\377Pdk\377P" + "w}\377U}\204\377\245\273\276\377\361\364\365\377\371\373\373\377\376" + "\376\376\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\360\360\356\377\361\361\360\377\372\372\371\377\361\365\365\377" + "\210\245\250\377b\212\215\377\223\253\261\376\246\263\270\373MTV\261" + "\0\0\0#\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\270\224k\202\377\327\252\306\377\325\254\303\377\324\265\275\377\320" + "\260\271\377\312\254\270\377\303\243\264\377\270\227\260\377\256\223" + "\262\377\247\230\270\377\252\225\267\377\245\234\311\377\264\250\312" + "\377\272\263\314\377v}\211\377Gdj\377T}\203\377U~\204\377U}\204\377f" + "\213\220\377\247\274\277\377\321\334\336\377\353\360\361\377\376\376" + "\376\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\376\376\376\377" + "\373\373\373\377\302\321\323\377p\224\227\377i\216\222\377\255\300\304" + "\373\221\234\241\361#'(v\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0A\0\0\0\377\306\251\256\377\322\262\270\377" + "\317\260\271\377\311\251\266\377\301\240\263\377\270\227\260\377\262" + "\224\263\377\244\226\270\377\251\226\270\377\237\227\307\377\255\240" + "\311\377\272\256\313\377\246\245\271\377Yhq\377Mqw\377T|\203\377U}\204" + "\377U~\204\377U~\204\377V\177\205\377]\204\212\377\214\247\254\377\267" + "\310\313\377\342\351\352\377\371\373\373\377\377\377\377\377\377\377" + "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\356\362\362\377\225\260\262\377`\210\213\377\210\244\251\375\257" + "\277\305\376X`b\320\24\26\27""4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\222\0\0\0\377\310\247\256\377" + "\307\246\264\377\277\235\260\377\271\227\260\377\264\225\263\377\246" + "\222\265\377\250\225\270\377\253\225\270\377\247\232\311\377\266\251" + "\313\377\274\262\312\377\213\220\237\377D^d\377Ry\201\377S|\202\377P" + "qw\377\202\227\233\377f\207\214\377U~\204\377V\177\205\377V\177\205\377" + "X\200\206\377\202\237\244\377\231\261\265\377\276\316\320\377\366\370" + "\370\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" + "\377\323\336\337\377t\226\231\377f\214\220\377\237\265\272\375\241\261" + "\267\375\37\"#\234\0\0\0\6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\301.*)\377\272\226\251\377" + "\271\227\261\377\265\225\263\377\250\220\263\377\247\226\271\377\250" + "\225\267\377\241\233\311\377\256\244\313\377\273\256\315\377\264\256" + "\305\377bnx\377Gkq\377Rz\202\377Pv}\377Tdh\377\303\304\305\377\261\270" + "\273\377\234\252\255\377x\223\230\377Z\201\207\377V\177\205\377X\200" + "\206\377Y\200\206\377g\213\221\377\201\236\243\377\243\271\274\377\367" + "\371\371\377\377\377\377\377\366\370\370\377\251\277\300\377a\210\213" + "\377y\230\235\370\247\273\300\376oz~\341\12\13\14Q\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\24\0\0\0\316&\40!\377\256\213\250\377\252\220\263\377\245\227" + "\271\377\247\225\270\377\235\225\307\377\247\235\313\377\266\252\315" + "\377\277\264\316\377\256\252\277\377DW^\377Nv\177\377Qz\201\377Jov\377" + "\211\212\212\377\320\315\315\377\313\312\314\377\276\276\301\377\310" + "\312\313\377\314\322\323\377\221\246\251\377a\205\212\377X\200\206\377" + "Y\200\206\377Z\201\207\377^\204\212\377i\215\222\377p\223\227\377\261" + "\304\306\377v\230\233\377a\210\214\377\223\253\261\376\246\266\275\377" + "&*,\311\0\0\0\13\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\21\0\0\0\272\0\0\0" + "\377\223{\235\377\246\225\270\377\252\225\271\377\241\232\312\377\257" + "\245\314\377\272\255\314\377\301\267\320\377\216\220\240\377@^d\377O" + "x\200\377Mu}\377J`d\377\304\303\303\377\315\313\313\377\317\315\315\377" + "\306\306\311\377\315\315\316\377\340\340\340\377\342\344\344\377\340" + "\342\342\377\266\301\302\377x\224\230\377_\204\212\377\\\202\210\377" + "Z\201\207\377Z\202\207\377[\203\210\377[\203\210\377o\221\226\377\233" + "\261\267\377t\177\204\355\0\0\0[\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\207\0\0\0\377aOb\377\226\212\270\377\251\235\313" + "\377\267\252\316\377\276\263\316\377\302\271\320\377FV^\377Ipw\377Ox" + "\200\377Gkr\377lxy\377\302\301\301\377\313\311\311\377\317\315\315\377" + "\314\312\314\377\277\277\302\377\302\307\311\377Pqu\377Nbe\377\254\263" + "\264\377\334\336\335\377\302\312\312\377\216\241\244\377^\203\211\377" + "Z\201\207\377Z\202\207\377\\\204\211\377\202\237\244\371\235\257\265" + "\37449;\320\0\0\0\13\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0""9\0\0\0\266\0\0\0\377n]v\377\254\233\274\377\300" + "\264\317\377\300\271\317\377IX`\377=]b\377Fks\377Gej\377\241\247\245" + "\377\274\274\275\377\310\306\307\377\315\313\313\377\316\314\315\377" + "\307\306\311\377\226\250\253\377W~\204\377Kot\377\\or\377\325\325\325" + "\377\352\352\351\377\270\301\301\377`\205\212\377Z\201\207\377Z\201\207" + "\377f\212\220\375\220\251\257\375x\206\213\371&)+x\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0>\0\0\0\240\0\0\0\366\0\0\0\377\203{\225\377\207\216\240\377ep{\377" + "=SY\377Rbc\377\252\260\253\377\272\273\271\377\302\301\302\377\312\310" + "\311\377\317\314\314\377\307\307\312\377t\221\226\377T{\201\377Mpv\377" + "u\177\200\377\354\354\354\377\345\346\345\377\207\240\243\377Z\201\207" + "\377Y\200\206\377Z\201\207\377t\224\232\375\231\255\263\374OX\\\327\33" + "\37\40&\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\2\0\0\0I\0\0\0\205\0\0\0" + "\265\2\4\4\333\7\13\14\364%//\376[fd\377\243\252\247\377\274\274\275" + "\377\307\306\306\377\315\312\312\377\264\272\275\377e\207\215\377Ry\200" + "\377Ifl\377\243\245\246\377\356\356\356\377\303\314\315\377j\214\221" + "\377V\177\205\377X\200\206\377_\205\213\373\206\242\250\364\202\222\230" + "\370:BE\216\13\14\15\15\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\237\241\235\1:NQ\17AXZ8<NQ\274Zde\377\257" + "\262\263\377\312\310\310\377\226\247\252\377Y\177\206\377Mry\377J^b\377" + "\336\336\336\377\346\347\347\377\222\252\255\377W\177\205\377V\177\205" + "\377X\177\205\377d\211\217\373\225\254\264\364cqu\343#')I\0\0\0\2\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\245\247\242\1\264\270\260\2\273\300\270\2.CFB/\77B\327pxz\373" + "\254\263\264\377\223\245\251\377Mms\377\240\247\252\377\337\337\337\377" + "\311\317\321\377t\222\227\377U~\204\377U}\204\377X\200\206\376}\232\242" + "\362\214\237\246\376MX\\\300\16\20\21)\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\273\301\270\2\273\277\270\2Fbg\22/GKq9HK\320\205\215\217\366\261" + "\262\265\377\300\301\305\377\314\315\315\377\243\263\266\377X~\205\377" + "U~\204\377Y\201\207\377a\206\215\375\216\246\256\353n~\204\353!&'j\0" + "\0\0\7\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\272\275\271" + "\1\275\276\275\2@]c*-DG\207DVY\317\177\211\214\373\216\226\231\377p\213" + "\220\377_\204\213\377i\213\222\377s\221\230\377v\215\224\376t\207\215" + "\346Taf\264\20\23\24""8\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\302\301\302\1\312\310\311\2A_e<.CF\213" + "<MQ\326\77TX\360]ry\362]nt\365\\kq\333IVZ\23018;\\\35\"#/\0\0\0\5\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\316\313\314\1Vu{\17(;\77""9\31\40\"[,58r*25].69" + "=\0\0\0\23\0\0\0\2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\1\2\2\4\2\3\3\12\27$&\5""6QV\1\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0"}; + + +/* GdkPixbuf RGBA C-Source image dump */ + +#ifdef __SUNPRO_C +#pragma align 4 (record_pixbuf) +#endif +#ifdef __GNUC__ +static const guint8 record_pixbuf[] __attribute__ ((__aligned__ (4))) = +#else +static const guint8 record_pixbuf[] = +#endif +{ "" + /* Pixbuf magic (0x47646b50) */ + "GdkP" + /* length: header (24) + pixel_data (2304) */ + "\0\0\11\30" + /* pixdata_type (0x1010002) */ + "\1\1\0\2" + /* rowstride (96) */ + "\0\0\0`" + /* width (24) */ + "\0\0\0\30" + /* height (24) */ + "\0\0\0\30" + /* pixel_data: */ + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\11\0\0\0\27\0\0\0!\0\0\0&\0\0" + "\0&\0\0\0!\0\0\0\27\0\0\0\11\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\27\0\0\0'\0\0\0\\\0\0\0\263\0\0\0\346\0\0\0\374\0" + "\0\0\374\0\0\0\346\0\0\0\263\0\0\0R\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\34\0\0\0'\0\0\0\261\7\2\1\377^$\26\377\2220\32\377\2451\26\377" + "\2440\26\377\221/\31\377Z\37\22\377\7\2\0\377\35\35\35\274\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\27\0\0\0'\0\0\0\3124\16\6\377\236-\24\377\305sa\377" + "\334\243\227\377\345\267\255\377\345\267\255\377\333\242\226\377\303" + "q`\377\233)\24\3773\15\6\377---\345\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\11\0\0\0'\0\0\0\2563\16" + "\6\377\240+\23\377\317\207z\377\341\253\241\377\343\255\242\377\345\255" + "\242\377\345\254\242\377\343\253\241\377\337\252\241\377\314\206x\377" + "\233&\21\3771\14\5\377SSS\343\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\27\0\0\0Z\7\1\0\377\230'\22\377\300gV" + "\377\333\235\221\377\340\235\221\377\342\236\221\377\344\236\221\377" + "\343\235\221\377\342\235\221\377\337\234\220\377\331\233\220\377\273" + "bU\377\222\"\17\377\7\1\0\377\254\254\254\256\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0!\0\0\0\257U\33\20\377\237&\21" + "\377\315~p\377\330\213}\377\335\213}\377\336\213}\377\337\213}\377\336" + "\213}\377\335\212}\377\332\211}\377\326\207|\377\312{o\377\230\37\16" + "\377V\34\23\377hhh\377\377\377\3778\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0&\0\0\0\345\205%\24\377\242#\20\377\315ug\377\324" + "wh\377\326wh\377\327wh\377\327vh\377\327uh\377\326tg\377\325tg\377\317" + "sf\377\311qf\377\233\34\15\377\203#\25\377&&&\377\377\377\377\227\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0&\0\0\0\374\222\37" + "\16\377\243\40\16\377\303WH\377\314`Q\377\316`P\377\316`P\377\316_P\377" + "\316^P\377\316]P\377\314]P\377\311[P\377\276QF\377\233\31\13\377\212" + "\27\12\377\5\5\5\377\377\377\377\331\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0!\0\0\0\374\216\33\14\377\237\34\14\377\2620\40" + "\377\300D7\377\303E7\377\304D7\377\304D7\377\303D7\377\301B6\377\277" + "B5\377\275A5\377\254)\36\377\227\25\11\377\206\24\12\377\5\5\5\377\377" + "\377\377\372\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\27" + "\0\0\0\345|\35\21\377\226\27\12\377\243\31\13\377\260\"\25\377\267)\33" + "\377\267(\32\377\270'\32\377\267&\32\377\266&\31\377\263%\31\377\252" + "\36\23\377\235\22\10\377\216\20\7\377{\34\24\377&&&\377\377\377\377\372" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\11\0\0\0\263N" + "\25\15\377\212\22\10\377\230\23\10\377\243\24\11\377\252\27\13\377\256" + "\32\16\377\256\32\17\377\256\31\17\377\254\30\15\377\246\23\11\377\235" + "\17\6\377\221\15\5\377\203\14\5\377O\26\20\377hhh\377\377\377\377\331" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0S\6\1\0" + "\377~\16\6\377\212\16\6\377\225\16\6\377\235\17\6\377\242\17\6\377\243" + "\16\6\377\242\15\5\377\237\15\5\377\231\13\5\377\220\12\4\377\204\10" + "\4\377y\12\4\377\6\0\0\377\307\307\307\377\377\377\377\227\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\32\32\32\276*" + "\4\1\377}\11\4\377\205\11\4\377\215\12\4\377\223\11\4\377\227\11\3\377" + "\226\10\3\377\220\10\3\377\211\6\2\377\201\5\2\377w\4\2\377(\3\1\377" + "hhh\377\377\377\377\377\377\377\3778\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0,,,\346)\3\1\377v\7\3\377|\5" + "\2\377\201\4\1\377\206\4\1\377\205\3\1\377\200\3\0\377y\2\0\377r\3\2" + "\377'\2\0\377GGG\377\377\377\377\377\377\377\377\227\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0SSS\343\6\0\0\377K\22\17\377n\17\14\377s\2\2\377s\2\2\377p\22\17" + "\377K\22\17\377\5\0\0\377hhh\377\377\377\377\377\377\377\377\270\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\254\254\254\256hhh\377&&&\377\5\5\5" + "\377\5\5\5\377&&&\377hhh\377\307\307\307\377\377\377\377\377\377\377" + "\377\227\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\377\377" + "\3778\377\377\377\227\377\377\377\331\377\377\377\372\377\377\377\372" + "\377\377\377\331\377\377\377\227\377\377\3778\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" + "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"}; + + diff --git a/xdao/stock/play.png b/xdao/stock/play.png new file mode 100644 index 0000000..d252e2d Binary files /dev/null and b/xdao/stock/play.png differ diff --git a/xdao/stock/record.png b/xdao/stock/record.png new file mode 100644 index 0000000..a95830d Binary files /dev/null and b/xdao/stock/record.png differ diff --git a/xdao/stock/stop.png b/xdao/stock/stop.png new file mode 100644 index 0000000..e7c84a2 Binary files /dev/null and b/xdao/stock/stop.png differ diff --git a/xdao/xcdrdao.cc b/xdao/xcdrdao.cc new file mode 100644 index 0000000..a95ff75 --- /dev/null +++ b/xdao/xcdrdao.cc @@ -0,0 +1,158 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998-2000 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#include <stdio.h> +#include <stdarg.h> +#include <signal.h> +#include <stdlib.h> + +#include <gtkmm.h> +#include <gnome.h> +#include <gconfmm.h> + +#include <gtk/gtk.h> + +#include <libgnomeuimm.h> + +#include "config.h" + +#include "xcdrdao.h" +#include "TocEdit.h" +#include "TrackInfoDialog.h" +#include "AddSilenceDialog.h" +#include "AddFileDialog.h" +#include "DeviceConfDialog.h" +#include "PreferencesDialog.h" +#include "ProgressDialog.h" +#include "guiUpdate.h" +#include "CdDevice.h" +#include "ProcessMonitor.h" +#include "ProjectChooser.h" +#include "ConfigManager.h" + +#include "gcdmaster.h" + +#include "port.h" + +DeviceConfDialog* deviceConfDialog = NULL; +ProcessMonitor* PROCESS_MONITOR = NULL; +ProgressDialogPool* PROGRESS_POOL = NULL; +PreferencesDialog* preferencesDialog = NULL; +ConfigManager* configManager = NULL; + +static int VERBOSE = 0; +static int PROCESS_MONITOR_SIGNAL_BLOCKED = 0; + +void blockProcessMonitorSignals() +{ + if (PROCESS_MONITOR_SIGNAL_BLOCKED == 0) + blockSignal(SIGCHLD); + + PROCESS_MONITOR_SIGNAL_BLOCKED++; +} + +void unblockProcessMonitorSignals() +{ + if (PROCESS_MONITOR_SIGNAL_BLOCKED > 0) { + PROCESS_MONITOR_SIGNAL_BLOCKED--; + + if (PROCESS_MONITOR_SIGNAL_BLOCKED == 0) + unblockSignal(SIGCHLD); + } +} + +static RETSIGTYPE signalHandler(int sig) +{ + if (sig == SIGCHLD) + PROCESS_MONITOR->handleSigChld(); +} + + +int main(int argc, char* argv[]) +{ + Gnome::Main application("GnomeCDMaster", VERSION, + Gnome::UI::module_info_get(), argc, argv); + + Gnome::Conf::init(); + + // settings + CdDevice::importSettings(); + + // create GConf configuration manager + configManager = new ConfigManager(); + + // setup process monitor + PROCESS_MONITOR = new ProcessMonitor; + installSignalHandler(SIGCHLD, signalHandler); + + // setup periodic GUI updates + Glib::signal_timeout().connect(sigc::ptr_fun(&guiUpdatePeriodic), 2000); + + installSignalHandler(SIGPIPE, SIG_IGN); + + // scan for SCSI devices + CdDevice::scan(); + + // this forces a CdDevice::updateDeviceStatus() so + // when gcdmaster is first show we already have the device status + guiUpdatePeriodic(); + + deviceConfDialog = new DeviceConfDialog; + PROGRESS_POOL = new ProgressDialogPool; + + // Create Preferences dialog from Glade file. + Glib::RefPtr<Gnome::Glade::Xml> refXml; + try { + refXml = Gnome::Glade::Xml::create(CDRDAO_GLADEDIR "/Preferences.glade"); + } catch(const Gnome::Glade::XmlError& ex) { + std::cerr << ex.what() << std::endl; + exit(1); + } + refXml->get_widget_derived("PrefDialog", preferencesDialog); + if (!preferencesDialog) { + std::cerr << "Unable to create Preferences dialog from glade file\n" + CDRDAO_GLADEDIR "/Preferences.glade" << std::endl; + exit(1); + } + + GCDMaster* gcdmaster = new GCDMaster; + gcdmaster->show(); + + bool openChooser = true; + + while (argc > 1) { + + if (gcdmaster->openNewProject(argv[1])) + openChooser = false; + + argv++; + argc--; + } + + if (openChooser) + gcdmaster->newChooserWindow(); + + application.run(); + + // save settings + CdDevice::exportSettings(); + gnome_config_sync(); + + return 0; +} diff --git a/xdao/xcdrdao.h b/xdao/xcdrdao.h new file mode 100644 index 0000000..d2bed0c --- /dev/null +++ b/xdao/xcdrdao.h @@ -0,0 +1,39 @@ +/* cdrdao - write audio CD-Rs in disc-at-once mode + * + * Copyright (C) 1998 Andreas Mueller <mueller@daneb.ping.de> + * + * This program 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef __XCDRDAO_H__ +#define __XCDRDAO_H__ + +// +// GLOBAL objects. +// +// Warning: those may be shared by multiple open project windows. +// + +extern class DeviceConfDialog* deviceConfDialog; +extern class ProcessMonitor* PROCESS_MONITOR; +extern class ProgressDialogPool* PROGRESS_POOL; +extern class PreferencesDialog* preferencesDialog; +extern class ConfigManager* configManager; + +void blockProcessMonitorSignals(); +void unblockProcessMonitorSignals(); + +#endif +