# HG changeset patch # User Sam Lantinga # Date 988303543 0 # Node ID 74212992fb0868a6929180cd74dd67e38507340a Initial revision diff -r 000000000000 -r 74212992fb08 .cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/.cvsignore Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,10 @@ +Makefile.in +configure +aclocal.m4 +config.log +config.cache +libtool +config.status +Makefile +sdl-config +SDL.spec diff -r 000000000000 -r 74212992fb08 BUGS --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BUGS Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,199 @@ + +All: + Audio rate conversion is only implemented by multiplying or dividing + by a power of two. This is a side-effect of the requirement that the + raw audio buffer size be a power of two, and can hopefully be fixed. + This means 8 KHz audio converted to 22 KHz ends up being 16 KHz. :-/ + + When the implementation is writing directly to video memory the mouse + cursor doesn't work properly. Applications which do this should use + their own mouse cursor and call SDL_ShowCursor(0) to hide the system + cursor. + +Linux: + Wide UNICODE character input (Kanji, etc.) is not yet supported. + It requires handling of keyboard mapping events and using the XIM + input translation extension. I will implement it as requested. + Latin-1 keyboard input works fine. + + The AAlib, GGI, and SVGAlib video drivers are not heavily tested. + +Win32: + The MCI driver can't tell if the CD-ROM drive is paused or stopped. + + The SDL_INIT_EVENTTHREAD flag is not supported on Win32 + (Idea: create a separate DirectInput polling thread) + The main purpose of this flag is for smooth cursor motion in + fullscreen environments. + + Wide UNICODE character input (Kanji, etc.) is not yet supported. + This requires the ToUnicode() API which is only implemented on + Windows NT/2000, not on Windows 95/98. + Latin-1 keyboard input works fine. + + Joysticks are only supported under the Win32 MultiMedia API, + DirectInput support is not yet implemented. + +BeOS: + BePPC is not supported, apparently not even by Be Inc. + + SDL_WM_GrabInput() is not implemented. + Does anyone know how to do this? SDL_WM_GrabInput() is designed + to prevent the user from switching input and mouse focus away from + the SDL application. + + Continuous relative mouse motion is not implemented. + + The CD driver doesn't detect SCSI CD-ROMs yet. + + Wide UNICODE character input (Kanji, etc.) has not been tested. + Latin-1 keyboard input works fine. + +MacOS: + Palette handling isn't implemented in windowed mode yet. + + Audio hasn't been extensively tested, in particular the locking + isn't implemented and mixer routines may not call malloc() or free() + because they are called at interrupt time. + + SDL_WM_GrabInput() is not implemented. + Does anyone know how to do this? SDL_WM_GrabInput() is designed + to prevent the user from switching input and mouse focus away from + the SDL application. + + Continuous relative mouse motion is not implemented. + + SDL_AddTimer() and SDL_RemoveTimer() haven't been implemented yet. + + Not all of the keys are properly recognized on the keyboard. + +MacOS X: + Fullscreen mode doesn't work - it requires the QuickTime framework + and that the new SDL window gets raised to the top of the Z order. + + Palette handling isn't implemented in windowed mode yet. + + Native sound and video routines are not finished, though Carbon + seems to work fairly well. + + Joysticks and CD-ROM functions are not implemented yet. + + SDL_WM_GrabInput() is not implemented. + Does anyone know how to do this? SDL_WM_GrabInput() is designed + to prevent the user from switching input and mouse focus away from + the SDL application. + + Continuous relative mouse motion is not implemented. + + Not all of the keys are properly recognized on the keyboard. + + MacOS X seems to have a broken pthread_cancel() implementation. + +FreeBSD: + pthread_cancel() isn't supported by FreeBSD 3.X, so threads don't + work on versions of FreeBSD earlier than 4.0. + + The CD-ROM handling doesn't work completely. + + Wide UNICODE character input (Kanji, etc.) is not yet supported. + It requires handling of keyboard mapping events and using the XIM + input translation extension. I will implement it as requested. + Latin-1 keyboard input works fine. + +Solaris: + The joystick functions are not implemented yet. + + Wide UNICODE character input (Kanji, etc.) is not yet supported. + It requires handling of keyboard mapping events and using the XIM + input translation extension. I will implement it as requested. + Latin-1 keyboard input works fine. + +IRIX: + The CD-ROM handling doesn't work completely. + + The joystick functions are not implemented yet. + + Wide UNICODE character input (Kanji, etc.) is not yet supported. + It requires handling of keyboard mapping events and using the XIM + input translation extension. I will implement it as requested. + Latin-1 keyboard input works fine. + +OpenBSD: -= NOT YET SUPPORTED =- + This is reported to work, but I haven't verified this. + + Wide UNICODE character input (Kanji, etc.) is not yet supported. + It requires handling of keyboard mapping events and using the XIM + input translation extension. I will implement it as requested. + Latin-1 keyboard input works fine. + +OSF/Tru64: -= NOT YET SUPPORTED =- + The audio functions are not implemented yet. + + Joysticks and CD-ROM functions are not implemented yet. + + Wide UNICODE character input (Kanji, etc.) is not yet supported. + It requires handling of keyboard mapping events and using the XIM + input translation extension. I will implement it as requested. + Latin-1 keyboard input works fine. + +AIX: -= NOT YET SUPPORTED =- + This port has only been tested with AIX 4.3.3 + + The OpenGL support doesn't work yet. + + The joystick subsystem isn't implemented yet. + + Endian detection doesn't work yet - needs a unique CPP symbol. + + Wide UNICODE character input (Kanji, etc.) is not yet supported. + It requires handling of keyboard mapping events and using the XIM + input translation extension. I will implement it as requested. + Latin-1 keyboard input works fine. + + The AIX port was done by Carsten.Griwodz@KOM.tu-darmstadt.de + More information on this port is available at: + http://www.kom.e-technik.tu-darmstadt.de/~griff/SDL/ + +QNX: -= NOT YET SUPPORTED =- + Configuration doesn't work right, Makefiles still need to be + tweaked (need to add libraries to any apps that use sdl_config + to figure out what libs they need). + + Only static libraries are being made, no shared ones. + + The only hardware surface is the primary view surface. + + Mouse events don't seem to be working right. + + Fullscreen doesn't display correctly. + + The software surfaces could use some speed up. + + Many of the test apps segment violate on exit, and I'm not sure + they're all working either + + It doesn't look like the OpenGL stuff is there. (did a grep for + PdCreateOpenGLContext, nothing found). + + The mouse cursor doesn't look right. + +AmigaOS: -= NOT YET SUPPORTED =- + The OpenGL support isn't implemented yet. + + SDL_WM_GrabInput() is not implemented. + Does anyone know how to do this? SDL_WM_GrabInput() is designed + to prevent the user from switching input and mouse focus away from + the SDL application. + + Continuous relative mouse motion is not implemented. + + Audio can work, but isn't completely integrated in the CVS + version of SDL. + + The joystick subsystem isn't implemented yet. + + There's some confusion about the multi-threaded synchronization + primitives on AmigaOS, so mutexes and semaphores aren't correctly + implemented yet. + + The AmigaOS port was done by Gabriele.Greco@galactica.it diff -r 000000000000 -r 74212992fb08 COPYING --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/COPYING Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,437 @@ + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 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. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, 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 library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, 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 companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, 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 library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete 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 distribute a copy of this License along with the +Library. + + 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 Library or any portion +of it, thus forming a work based on the Library, 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) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +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 Library, 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 Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you 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. + + If distribution of 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 satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. 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. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library 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. + + 9. 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 Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +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. + + 11. 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 Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library 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 Library. + +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. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library 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. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library 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 Library +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 Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +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 + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "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 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. 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 LIBRARY 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 +LIBRARY (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 LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS diff -r 000000000000 -r 74212992fb08 CREDITS --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CREDITS Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,51 @@ + +Simple DirectMedia Layer CREDITS +Thanks to everyone who made this possible, including: + +* Cliff Matthews, for giving me a reason to start this project. :) + -- Executor rocks! *grin* + +* Scott Call, for making a home for SDL on the 'Net, Thanks! :) + +* Michael Samuel and Loki Entertainment Software, for the SDL mailing list + +* Patrick Trainor and Jim Boucher, for the QNX Neutrino port + +* Gabriele Greco, for the Amiga port + +* Stan Shebs, for the initial MacOS X port + +* Carsten Griwodz for the AIX port + +* Mattias Engdegerd, for help with the Solaris port and lots of other code + +* Kent B Mein, for a place to do the IRIX port + +* Ash, for a place to do the OSF/1 Alpha port + +* David Sowsy, for help with the BeOS port + +* Max Watson, Matt Slot, and Kyle for help with the MacOS port + +* Jon Taylor for the GGI front-end + +* Paulus Esterhazy, for the Visual C++ testing and libraries + +* Brenda Tantzen, for Metrowerks CodeWarrior on MacOS + +* Chris Nentwich, for the Hermes assembly blitters + +* Michael Vance and Jim Kutter for the X11 OpenGL support + +* Peter Wiklund, for the 1998 winning SDL logo, + and Arto Hamara, Steven Wong, and Kent Mein for other logo entries. + +* Stephane Peter, for the AAlib front-end and multi-threaded timer idea. + + And a big hand to everyone else who gave me appreciation, advice, + and suggestions, especially the good folks on the SDL mailing list. + +THANKS! :) + + -- Sam Lantinga + diff -r 000000000000 -r 74212992fb08 CWprojects.sea.bin Binary file CWprojects.sea.bin has changed diff -r 000000000000 -r 74212992fb08 INSTALL --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/INSTALL Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,22 @@ + +To compile and install SDL: + + 1. Run './configure; make; make install' + + If you are cross-compiling from Linux to Win32, you should read + the file README.Win32 + + If you are compiling using Visual C++ on Win32, you should read + the file VisualC.html + + 2. Look at the example programs in ./test, and check out the HTML + documentation in ./docs to see how to use the SDL library. + + 3. Join the SDL developer mailing list by sending E-mail to + majordomo@lokigames.com + and including the line "subscribe sdl" in the body. + + + +That's it! +Sam Lantinga diff -r 000000000000 -r 74212992fb08 MPWmake.sea.bin Binary file MPWmake.sea.bin has changed diff -r 000000000000 -r 74212992fb08 Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Makefile.am Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,85 @@ +# The top-level input Makefile for SDL + +# require automake 1.4 +AUTOMAKE_OPTIONS = 1.4 + +## Any directories that you want built and installed should go here. +SUBDIRS = src include docs + +## Any directories you want a part of the distribution should be listed +## here, as well as have a Makefile generated at the end of configure.in +## +## This only works for subdirectories one level deep. +DIST_SUBDIRS = $(SUBDIRS) docs + +# SDL runtime configuration script +bin_SCRIPTS = sdl-config + +# All the rest of the distributed files +EXTRA_DIST = \ + BUGS \ + TODO \ + COPYING \ + CREDITS \ + INSTALL \ + README \ + README-SDL.txt \ + README.Win32 \ + README.WinCE \ + README.MacOS \ + README.MacOSX \ + VisualC.html \ + VisualC.zip \ + MPWmake.sea.bin \ + CWprojects.sea.bin \ + WhatsNew \ + docs.html \ + sdl.m4 \ + autogen.sh \ + strip_fPIC.sh + +# M4 macro file for inclusion with autoconf +m4datadir = $(datadir)/aclocal +m4data_DATA = sdl.m4 + +# Rule to build tar-gzipped distribution package +$(PACKAGE)-$(VERSION).tar.gz: dist + +# Rule to build RPM distribution package +rpm: $(PACKAGE)-$(VERSION).tar.gz + cp $(PACKAGE)-$(VERSION).tar.gz /usr/src/redhat/SOURCES + rpm -ba SDL.spec + +# Rule to rebuild the export lists for BeOS, MacOS and Win32. +exports: + (cd src/main/beos/exports; $(MAKE)) + (cd src/main/macos/exports; $(MAKE)) + (cd src/main/win32/exports; $(MAKE)) + +# Rule to force automake to rebuild the library +changed: + @echo "This build target is no longer necessary" + +# Rule to install the libraries only - prevent rebuilding apps +install-lib: + cd src && $(MAKE) install-libLTLIBRARIES + +# Run ldconfig after installing the library: +install-hook: + -ldconfig + +# Grab the test programs for the distribution: +dist-hook: + if test -f test/Makefile; then (cd test; make distclean); fi + cp -rp test $(distdir) + rm -rf `find $(distdir) -type d -name CVS -print` + +# Create a CVS snapshot that people can run update -d on +CVSROOT = :pserver:guest@cvs.lokigames.com:/cvs +snapshot: + cvs -d $(CVSROOT) login + cvs -d $(CVSROOT) checkout -r devel_1_1_0 SDL + (cd SDL && ./autogen.sh) + mv SDL SDL-1.2 + tar zcvf $(HOME)/SDL-1.2.tar.gz SDL-1.2 + rm -rf SDL-1.2 diff -r 000000000000 -r 74212992fb08 README --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,44 @@ + + Simple DirectMedia Layer + + (SDL) + + Version 1.2 + +--- +http://www.libsdl.org/ + +This is the Simple DirectMedia Layer, a generic API that provides low +level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, +and 2D framebuffer across multiple platforms. + +SDL is written in C, but works with C++ natively, and has bindings to +several other languages, including Ada, Eiffel, ML, Perl, and Python. + +The current version supports Linux, Windows, BeOS, MacOS, MacOS X, +FreeBSD, Solaris, and IRIX. The code contains support for Windows CE, +OpenBSD, NetBSD, AIX, OSF/Tru64, and QNX, but these are not yet +officially supported. + +This library is distributed under GNU LGPL version 2, which can be +found in the file "COPYING". This license allows you to use SDL +freely in commercial programs as long as you link with the dynamic +library. + +The best way to learn how to use SDL is to check out the header files in +the "include" subdirectory and the programs in the "test" subdirectory. +The header files and test programs are well commented and always up to date. +More documentation is available in HTML format in "./docs/index.html" + +The test programs in the "test" subdirectory are in the public domain. + +Frequently asked questions are answered online: + http://www.libsdl.org/faqs.html + +If you need help with the library, or just want to discuss SDL related +issues, you can join the developers mailing list: + http://www.libsdl.org/mailing-list.html + +Enjoy! + Sam Lantinga (slouken@libsdl.org) + diff -r 000000000000 -r 74212992fb08 README-SDL.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README-SDL.txt Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,13 @@ + +Please distribute this file with the SDL runtime environment: + +The Simple DirectMedia Layer (SDL for short) is a cross-platfrom library +designed to make it easy to write multi-media software, such as games and +emulators. + +The Simple DirectMedia Layer library source code is available from: +http://www.libsdl.org/ + +This library is distributed under the terms of the GNU LGPL license: +http://www.gnu.org/copyleft/lesser.html + diff -r 000000000000 -r 74212992fb08 README.CVS --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.CVS Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,13 @@ + +The latest development version of SDL is available via CVS: + +cvs -d :pserver:guest@cvs.lokigames.com:/cvs login +# use the password "guest" +cvs -d :pserver:guest@cvs.lokigames.com:/cvs checkout SDL + +When you check a fresh copy of SDL out of CVS, you need to generate +the files used by make by running the "autogen.sh" script, which will +run aclocal, automake, autoconf and then run configure. + +There is a web interface to cvs at http://cvs.lokigames.com/ + diff -r 000000000000 -r 74212992fb08 README.MacOS --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.MacOS Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,60 @@ + +============================================================================== +Using the Simple DirectMedia Layer with MacOS 7,8,9 on PPC +============================================================================== + +These instructions are for people using the Apple MPW environment: +http://developer.apple.com/tools/mpw-tools/ + +CodeWarrior projects are available in the CWprojects directory. + +============================================================================== +I. Building the Simple DirectMedia Layer libraries: + (This step isn't necessary if you have the SDL binary distribution) + + First, unpack the MPWmake.sea.hqx archive and move SDL.make into the + SDL directory. + + Start MPW + + Set the current directory within MPW to the SDL toplevel directory. + + Build "SDL" (Type Command-B and enter "SDL" in the dialog) + + If everything compiles successfully, you now have the PPC libraries + "SDL" and "SDLmain.o" in the 'lib' subdirectory. + +============================================================================== +II. Building the Simple DirectMedia Layer test programs: + + First, unpack the MPWmake.sea.hqx archive, move the new rsrc directory to + the main SDL directory, and move the makefiles in the new test subdirectory + to the SDL 'test' subdirectory. + + Start MPW + + Set the current directory within MPW to the SDL 'test' subdirectory. + + Build the programs that have an associated MPW makefile (file ending + with .make), including "testwin", "testalpha", and "graywin". + + Copy the SDL library file into the test directory, and run! + +============================================================================== +III. Building the Simple DirectMedia Layer demo programs: + + Copy one of the test program Makefiles to the demo directory + and modify it to match the sources in the demo. + +============================================================================== +IV. Enjoy! :) + + If you have a project you'd like me to know about, or want to ask questions, + go ahead and join the SDL developer's mailing list by sending e-mail to: + + majordomo@lokigames.com + + and put the line "subscribe sdl" in the body of the message. + +============================================================================== + diff -r 000000000000 -r 74212992fb08 README.MacOSX --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.MacOSX Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,44 @@ +============================================================================== +Using the Simple DirectMedia Layer with Mac OS X +============================================================================== + +These instructions are for people using Apple's Mac OS X (pronounced +"ten"). + +From the developer's point of view, OS X is a sort of hybrid Mac and +Unix system, and you have the option of using either traditional +command line tools or Apple's IDE ProjectBuilder (PB). + +To build using the command line, use the standard configure and make +process: + + ./configure + make + make install + +(You may need to create the subdirs of /usr/local manually.) + +For some reason, libtool doesn't run ranlib properly, so do this +manually: + + ranlib /usr/local/lib/libSDL.a + +To use the library once it's built, you need to use the "Carbon +framework", which is the port of the old Mac Toolbox to OS X. +To do this, use the -F and -framework arguments for compiling +and linking, respectively: + + cc -c myprog.c -I/usr/local/include/SDL -F/System/Library/Frameworks/Carbon.framework + cc myprog.o -L/usr/local/lib -lSDL -framework Carbon + +sdl-config knows about the linking path and -framework, so it's +recommended to use it to fill in your Makefile variables. + +[Add instructions for how to build using PB] + +As of this writing (Sep 2000), OS X is in public beta. This means +that while most of the APIs are frozen, things are still subject to +change, and many of the known problems will be resolved before the +final release comes out. + +Known bugs are listed in the file "BUGS" diff -r 000000000000 -r 74212992fb08 README.Win32 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.Win32 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,53 @@ + +============================================================================== +Using the Simple DirectMedia Layer with Windows 95,NT +============================================================================== + +These instructions are for people using the GNU free compilers. +If you want to use Microsoft VC++ with SDL, read "VisualC.html" + +============================================================================== +I. Building the Simple DirectMedia Layer libraries: + (This step isn't necessary if you have the SDL binary distribution) + + First, get gcc compiler for Win32, which can be found at: + http://www.libsdl.org/Xmingw32/index.html + + Grab the cross configure and make scripts, and then run: + sh cross-configure.sh + sh cross-make.sh install + If you have already built SDL natively, you must do "make distclean" + before you build for Win32. + + If everything compiles successfully, you now have SDL.dll and gcc archive + libraries libSDLmain.a and libSDL.a installed in /usr/local/cross-tools/ + +============================================================================== +II. Building the Simple DirectMedia Layer test programs: + + This is easy once you have built the libraries: + + cd test; sh ../cross-configure.sh; sh ../cross-make.sh + +============================================================================== +III. Building the Simple DirectMedia Layer demo programs: + + Go to the directory containing the demo you want to build and type: + + sh cross-configure.sh; sh cross-make.sh + + Be sure to rename the demo to use the .exe extension, or Windows will + not be able to execute it. + +============================================================================== +IV. Enjoy! :) + + If you have a project you'd like me to know about, or want to ask questions, + go ahead and join the SDL developer's mailing list by sending e-mail to: + + majordomo@lokigames.com + + and put the line "subscribe sdl" in the body of the message. + +============================================================================== + diff -r 000000000000 -r 74212992fb08 README.WinCE --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.WinCE Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,37 @@ + +NOTE: +SDL is NOT SUPPORTED on the WinCE platform! This is for experimental +purposes only. + +There are several SDL features not available in the WinCE port of SDL. + +- DirectX is not yet available +- Semaphores are not available +- Joystick support is not available +- CD-ROM control is not available + +In addition, there are several features that run in "degraded" mode: + +Preprocessor Symbol Effect +=================== ================================= + +SDL_systimer.c: +USE_GETTICKCOUNT Less accurate values for SDL time functions +USE_SETTIMER Use only a single marginally accurate timer + +SDL_syswm.c: +DISABLE_ICON_SUPPORT Can't set the runtime window icon + +SDL_sysmouse.c: +USE_STATIC_CURSOR Only the arrow cursor is available + +SDL_sysevents.c: +NO_GETKEYBOARDSTATE Can't get modifier state on keyboard focus + +SDL_dibevents.c: +NO_GETKEYBOARDSTATE Very limited keycode translation + +SDL_dibvideo.c: +NO_GETDIBITS Can't distinguish between 15 bpp and 16 bpp +NO_CHANGEDISPLAYSETTINGS No fullscreen support +NO_GAMMA_SUPPORT Gamma correction not available diff -r 000000000000 -r 74212992fb08 SDL.spec.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SDL.spec.in Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,90 @@ +%define name @PACKAGE@ +%define version @VERSION@ +%define release 1 + +Summary: Simple DirectMedia Layer +Name: %{name} +Version: %{version} +Release: %{release} +Source0: %{name}-%{version}.tar.gz +URL: http://www.libsdl.org/ +Copyright: LGPL +Group: System Environment/Libraries +BuildRoot: /var/tmp/%{name}-buildroot +Prefix: %{_prefix} + +%description +This is the Simple DirectMedia Layer, a generic API that provides low +level access to audio, keyboard, mouse, and display framebuffer across +multiple platforms. + +%package devel +Summary: Libraries, includes and more to develop SDL applications. +Group: Development/Libraries +Requires: %{name} + +%description devel +This is the Simple DirectMedia Layer, a generic API that provides low +level access to audio, keyboard, mouse, and display framebuffer across +multiple platforms. + +This is the libraries, include files and other resources you can use +to develop SDL applications. + + +%prep +rm -rf ${RPM_BUILD_ROOT} + +%setup -q + +%build +CFLAGS="$RPM_OPT_FLAGS" ./configure --prefix=%{prefix} --disable-video-svga --disable-video-ggi --disable-video-aalib --disable-debug --enable-xfree86-glidehack +make + +%install +rm -rf $RPM_BUILD_ROOT +make install prefix=$RPM_BUILD_ROOT/%{prefix} + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root) +%doc README-SDL.txt COPYING CREDITS BUGS +%{prefix}/lib/lib*.so.* + +%files devel +%defattr(-,root,root) +%doc README README-SDL.txt COPYING CREDITS BUGS WhatsNew docs.html +%doc docs/index.html docs/html +%{prefix}/bin/*-config +%{prefix}/lib/lib*.a +%{prefix}/lib/lib*.so +%{prefix}/include/SDL/ +%{prefix}/man/man3/* +%{prefix}/share/aclocal/* + +%changelog +* Wed Jan 19 2000 Sam Lantinga +- Re-integrated spec file into SDL distribution +- 'name' and 'version' come from configure +- Some of the documentation is devel specific +- Removed SMP support from %build - it doesn't work with libtool anyway + +* Tue Jan 18 2000 Hakan Tandogan +- Hacked Mandrake sdl spec to build 1.1 + +* Sun Dec 19 1999 John Buswell +- Build Release + +* Sat Dec 18 1999 John Buswell +- Add symlink for libSDL-1.0.so.0 required by sdlbomber +- Added docs + +* Thu Dec 09 1999 Lenny Cartier +- v 1.0.0 + +* Mon Nov 1 1999 Chmouel Boudjnah +- First spec file for Mandrake distribution. + +# end of file diff -r 000000000000 -r 74212992fb08 TODO --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TODO Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,23 @@ + +TODO list for the 1.2 release: + + * Use /etc/fb.modes, if available, like GGI does + +Wish list for the 1.3 development branch: + + * Add mousewheel events (new unified event architecture?) + * DirectInput joystick support needs to be implemented + * Be able to enumerate and select available audio and video drivers + * Fullscreen video mode support for MacOS X + * Explicit vertical retrace wait (maybe separate from SDL_Flip?) + * Shaped windows, windows without borders + * Multiple windows, multiple display support + * SDL_INIT_EVENTTHREAD on Windows and MacOS? + * Add a timestamp to events + * Use RDTSC for timer resolution on x86 hardware + * Add audio input API + +In the jump from 1.2 to 1.3, we should change the SDL_Rect members to +int and evaluate all the rest of the datatypes. This is the only place +we should do it though, since the 1.2 series should not break binary +compatibility in this way. diff -r 000000000000 -r 74212992fb08 VisualC.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/VisualC.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,235 @@ + + + + + + + + + Using SDL with Microsoft Visual C++ 5 and 6 + + + + + + + + + + + +

Using SDL with Microsoft Visual C++ 5 and 6

+ +

+ by Lion Kimbro +

+ + + +

+ You can either use the precompiled libraries from + + the SDL Download web site , + or you can build SDL yourself. +

+ + +

Building SDL

+ +

+ Unzip the VisualC.zip file into the directory + that contains this file (VisualC.html). +

+ +

+ Be certain that you unzip VisualC.zip + into this directory and not any other + directory. If you are using WinZip, be careful to + make sure that it extracts to this + folder, because it's convenient feature of + unzipping to a folder with the name of the + file currently being unzipped will get you in + trouble if you use it right now. And that's all + I have to say about that. +

+ +

+ Now that it's unzipped, go into the VisualC directory + that is created, and double-click on the VC++ + workspace file "SDL.dsw". + This should open up VisualC. +

+ +

+ You may be prompted at this point to upgrade the + workspace, should you be using a more recent version + of Visual C++. If so, allow the workspace to be + upgraded. +

+ + +

+ Build the .dll and .lib files. +

+ +

+ This is done by right clicking on each project in turn + (Projects are listed in the Workspace panel in the + FileView tab), and selecting "Build". +

+ +

+ You may get a few warnings, but you should not get + any errors. You do have to have at least the DirectX + 5 SDK installed, however. (I believe...) The latest + version of DirectX can be downloaded or purchased + on a cheap CD (my recommendation) from + Microsoft . +

+ +

+ Later, we will refer to the following .lib and .dll + files that have just been generated: +

+ + +
  • SDL.dll +
  • SDL.lib +
  • SDLmain.lib + + +

    + Search for these using the Windows Find (Windows-F) + utility, if you don't already know where they should be. + For those of you with a clue, look inside the Debug + or Release directories of the subdirectories of the + VisualC folder. (It might be easier to just use + Windows Find if this sounds confusing. And don't worry + about needing a clue; we all need visits from the + clue fairy frequently.) +

    + + + +

    Creating a Project with SDL

    + +

    + Create a project as a Win32 Application. +

    + +

    + Create a C++ file for your project. +

    + +

    + Set the C runtime to "Multi-threaded DLL" in the menu: + Project|Settings|C/C++ tab|Code Generation|Runtime Library . +

    + +

    + Add the SDL include directory to your list + of includes in the menu: + Project|Settings|C/C++ tab|Preprocessor|Additional include directories . +

    + +

    + The "include directory" I am referring to is the + include folder within the main SDL + directory (the one that this HTML file located + within. +

    + +

    + Now we're going to use the files that we had created + earlier in the Build SDL step. +

    + +

    + Copy the following files into your Project directory: +

    + + +
  • SDL.dll
  • +
    + +

    + Copy the following files into your Project directory, + and add them to your Project as well: +

    + + +
  • SDL.lib
  • +
  • SDLmain.lib
  • +
    + +

    + (To add them to your project, right click on your + project, and select "Add files to project") +

    + +

    + (I believe that it's not necessary to actually + copy the .lib files into your directory; you only + have to be certain that you add them to your Project. + If someone is so inclined, correct this document, or + + e-mail me , + and I'll fix this document.) +

    + + + +

    SDL 101, First Day of Class

    + +

    + Now create the basic body of your project. + The body of your program should take the following form: + + +

    +#include "SDL.h"
    +
    +int main( int argc, char* argv[] )
    +{
    +  // Body of the program goes here.
    +  return 0;
    +}
    +
    + +

    + +

    That's it!

    + +

    + I hope that this document has helped you get + through the most difficult part of using the + SDL: installing it. Suggestions for improvements + to this document should be sent to the writers + of this document. +

    + +

    + Thanks to Paulus Esterhazy (pesterhazy@gmx.net), for the work on VC++ port. +

    + +

    + This document was originally called "VisualC.txt", + and was written by + Sam Lantinga. +

    + +

    + Later, it was converted to HTML and expanded into + the document that you see today by + Lion Kimbro. +

    + + + + + + + + + + diff -r 000000000000 -r 74212992fb08 VisualC.zip Binary file VisualC.zip has changed diff -r 000000000000 -r 74212992fb08 WhatsNew --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/WhatsNew Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,664 @@ + +This is a list of API changes in SDL's version history. + +Version 1.0: + +1.2.0: + Added SDL_VIDEOEXPOSE event to signal that the screen needs to + be redrawn. This is currently only delivered to OpenGL windows + on X11, though it may be delivered in the future when the video + memory is lost under DirectX. + +1.1.8: + You can pass SDL_NOFRAME to SDL_VideoMode() to create a window + that has no title bar or frame decoration. Fullscreen video + modes automatically have this flag set. + + Added a function to query the clipping rectangle for a surface: + void SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect) + + Added a function to query the current event filter: + SDL_EventFilter SDL_GetEventFilter(void) + + If you pass -1 to SDL_ShowCursor(), it won't change the current + cursor visibility state, but will still return it. + + SDL_LockSurface() and SDL_UnlockSurface() are recursive, meaning + you can nest them as deep as you want, as long as each lock call + has a matching unlock call. The surface remains locked until the + last matching unlock call. + + Note that you may not blit to or from a locked surface. + +1.1.7: + The SDL_SetGammaRamp() and SDL_GetGammaRamp() functions now take + arrays of Uint16 values instead of Uint8 values. For the most part, + you can just take your old values and shift them up 8 bits to get + new correct values for your gamma ramps. + + You can pass SDL_RLEACCEL in flags passed to SDL_ConvertSurface() + and SDL will try to RLE accelerate colorkey and alpha blits in the + resulting surface. + +1.1.6: + Added a function to return the thread ID of a specific thread: + Uint32 SDL_GetThreadID(SDL_Thread *thread) + If 'thread' is NULL, this function returns the id for this thread. + +1.1.5: + The YUV overlay structure has been changed to use an array of + pitches and pixels representing the planes of a YUV image, to + better enable hardware acceleration. The YV12 and IYUV formats + each have three planes, corresponding to the Y, U, and V portions + of the image, while packed pixel YUV formats just have one plane. + + For palettized mode (8bpp), the screen colormap is now split in + a physical and a logical palette. The physical palette determines + what colours the screen pixels will get when displayed, and the + logical palette controls the mapping from blits to/from the screen. + A new function, SDL_SetPalette() has been added to change + logical and physical palettes separately. SDL_SetColors() works + just as before, and is equivalent to calling SDL_SetPalette() with + a flag argument of (SDL_LOGPAL|SDL_PHYSPAL). + + SDL_BlitSurface() no longer modifies the source rectangle, only the + destination rectangle. The width/height members of the destination + rectangle are ignored, only the position is used. + + The old source clipping function SDL_SetClipping() has been replaced + with a more useful function to set the destination clipping rectangle: + SDL_bool SDL_SetClipRect(SDL_Surface *surface, SDL_Rect *rect) + + Added a function to see what subsystems have been initialized: + Uint32 SDL_WasInit(Uint32 flags) + + The Big Alpha Flip: SDL now treats alpha as opacity like everybody + else, and not as transparency: + + A new cpp symbol: SDL_ALPHA_OPAQUE is defined as 255 + A new cpp symbol: SDL_ALPHA_TRANSPARENT is defined as 0 + Values between 0 and 255 vary from fully transparent to fully opaque. + + New functions: + SDL_DisplayFormatAlpha() + Returns a surface converted to a format with alpha-channel + that can be blit efficiently to the screen. (In other words, + like SDL_DisplayFormat() but the resulting surface has + an alpha channel.) This is useful for surfaces with alpha. + SDL_MapRGBA() + Works as SDL_MapRGB() but takes an additional alpha parameter. + SDL_GetRGBA() + Works as SDL_GetRGB() but also returns the alpha value + (SDL_ALPHA_OPAQUE for formats without an alpha channel) + + Both SDL_GetRGB() and SDL_GetRGBA() now always return values in + the [0..255] interval. Previously, SDL_GetRGB() would return + (0xf8, 0xfc, 0xf8) for a completely white pixel in RGB565 format. + (N.B.: This is broken for bit fields < 3 bits.) + + SDL_MapRGB() returns pixels in which the alpha channel is set opaque. + + SDL_SetAlpha() can now be used for both setting the per-surface + alpha, using the new way of thinking of alpha, and also to enable + and disable per-pixel alpha blending for surfaces with an alpha + channel: + To disable alpha blending: + SDL_SetAlpha(surface, 0, 0); + To re-enable alpha blending: + SDL_SetAlpha(surface, SDL_SRCALPHA, 0); + Surfaces with an alpha channel have blending enabled by default. + + SDL_SetAlpha() now accepts SDL_RLEACCEL as a flag, which requests + RLE acceleration of blits, just as like with SDL_SetColorKey(). + This flag can be set for both surfaces with an alpha channel + and surfaces with an alpha value set by SDL_SetAlpha(). + As always, RLE surfaces must be locked before pixel access is + allowed, and unlocked before any other SDL operations are done + on it. + + The blit semantics for surfaces with and without alpha and colorkey + have now been defined: + + RGBA->RGB: + SDL_SRCALPHA set: + alpha-blend (using alpha-channel). + SDL_SRCCOLORKEY ignored. + SDL_SRCALPHA not set: + copy RGB. + if SDL_SRCCOLORKEY set, only copy the pixels matching the + RGB values of the source colour key, ignoring alpha in the + comparison. + + RGB->RGBA: + SDL_SRCALPHA set: + alpha-blend (using the source per-surface alpha value); + set destination alpha to opaque. + SDL_SRCALPHA not set: + copy RGB, set destination alpha to opaque. + both: + if SDL_SRCCOLORKEY set, only copy the pixels matching the + source colour key. + + RGBA->RGBA: + SDL_SRCALPHA set: + alpha-blend (using the source alpha channel) the RGB values; + leave destination alpha untouched. [Note: is this correct?] + SDL_SRCCOLORKEY ignored. + SDL_SRCALPHA not set: + copy all of RGBA to the destination. + if SDL_SRCCOLORKEY set, only copy the pixels matching the + RGB values of the source colour key, ignoring alpha in the + comparison. + + RGB->RGB: + SDL_SRCALPHA set: + alpha-blend (using the source per-surface alpha value). + SDL_SRCALPHA not set: + copy RGB. + both: + if SDL_SRCCOLORKEY set, only copy the pixels matching the + source colour key. + + As a special case, blits from surfaces with per-surface alpha + value of 128 (50% transparency) are optimised and much faster + than other alpha values. This does not apply to surfaces with + alpha channels (per-pixel alpha). + + New functions for manipulating the gamma of the display have + been added: + int SDL_SetGamma(float red, float green, float blue); + int SDL_SetGammaRamp(Uint8 *red, Uint8 *green, Uint8 *blue); + int SDL_GetGammaRamp(Uint8 *red, Uint8 *green, Uint8 *blue); + Gamma ramps are tables with 256 entries which map the screen color + components into actually displayed colors. For an example of + implementing gamma correction and gamma fades, see test/testgamma.c + Gamma control is not supported on all hardware. + +1.1.4: + The size of the SDL_CDtrack structure changed from 8 to 12 bytes + as the size of the length member was extended to 32 bits. + + You can now use SDL for 2D blitting with a GL mode by passing the + SDL_OPENGLBLIT flag to SDL_SetVideoMode(). You can specify 16 or + 32 bpp, and the data in the framebuffer is put into the GL scene + when you call SDL_UpdateRects(), and the scene will be visible + when you call SDL_GL_SwapBuffers(). + + Run the "testgl" test program with the -logo command line option + to see an example of this blending of 2D and 3D in SDL. + +1.1.3: + Added SDL_FreeRW() to the API, to complement SDL_AllocRW() + + Added resizable window support - just add SDL_RESIZABLE to the + SDL_SetVideoMode() flags, and then wait for SDL_VIDEORESIZE events. + See SDL_events.h for details on the new SDL_ResizeEvent structure. + + Added condition variable support, based on mutexes and semaphores. + SDL_CreateCond() + SDL_DestroyCond() + SDL_CondSignal() + SDL_CondBroadcast() + SDL_CondWait() + SDL_CondTimedWait() + The new function prototypes are in SDL_mutex.h + + Added counting semaphore support, based on the mutex primitive. + SDL_CreateSemaphore() + SDL_DestroySemaphore() + SDL_SemWait() + SDL_SemTryWait() + SDL_SemWaitTimeout() + SDL_SemPost() + SDL_SemValue() + The new function prototypes are in SDL_mutex.h + + Added support for asynchronous blitting. To take advantage of this, + you must set the SDL_ASYNCBLIT flag when setting the video mode and + creating surfaces that you want accelerated in this way. You must + lock surfaces that have this flag set, and the lock will block until + any queued blits have completed. + + Added YUV video overlay support. + The supported YUV formats are: YV12, IYUV, YUY2, UYVY, and YVYU. + This function creates an overlay surface: + SDL_CreateYUVOverlay() + You must lock and unlock the overlay to get access to the data: + SDL_LockYUVOverlay() SDL_UnlockYUVOverlay() + You can then display the overlay: + SDL_DisplayYUVOverlay() + You must free the overlay when you are done using it: + SDL_FreeYUVOverlay() + See SDL_video.h for the full function prototypes. + + The joystick hat position constants have been changed: + Old constant New constant + ------------ ------------ + 0 SDL_HAT_CENTERED + 1 SDL_HAT_UP + 2 SDL_HAT_RIGHTUP + 3 SDL_HAT_RIGHT + 4 SDL_HAT_RIGHTDOWN + 5 SDL_HAT_DOWN + 6 SDL_HAT_LEFTDOWN + 7 SDL_HAT_LEFT + 8 SDL_HAT_LEFTUP + The new constants are bitmasks, so you can check for the + individual axes like this: + if ( hat_position & SDL_HAT_UP ) { + } + and you'll catch left-up, up, and right-up. + +1.1.2: + Added multiple timer support: + SDL_AddTimer() and SDL_RemoveTimer() + + SDL_WM_SetIcon() now respects the icon colorkey if mask is NULL. + +1.1.0: + Added initial OpenGL support. + First set GL attributes (such as RGB depth, alpha depth, etc.) + SDL_GL_SetAttribute() + Then call SDL_SetVideoMode() with the SDL_OPENGL flag. + Perform all of your normal GL drawing. + Finally swap the buffers with the new SDL function: + SDL_GL_SwapBuffers() + See the new 'testgl' test program for an example of using GL with SDL. + + You can load GL extension functions by using the function: + SDL_GL_LoadProcAddress() + + Added functions to initialize and cleanup specific SDL subsystems: + SDL_InitSubSystem() and SDL_QuitSubSystem() + + Added user-defined event type: + typedef struct { + Uint8 type; + int code; + void *data1; + void *data2; + } SDL_UserEvent; + This structure is in the "user" member of an SDL_Event. + + Added a function to push events into the event queue: + SDL_PushEvent() + + Example of using the new SDL user-defined events: + { + SDL_Event event; + + event.type = SDL_USEREVENT; + event.user.code = my_event_code; + event.user.data1 = significant_data; + event.user.data2 = 0; + SDL_PushEvent(&event); + } + + Added a function to get mouse deltas since last query: + SDL_GetRelativeMouseState() + + Added a boolean datatype to SDL_types.h: + SDL_bool = { SDL_TRUE, SDL_FALSE } + + Added a function to get the current audio status: + SDL_GetAudioState(); + It returns one of: + SDL_AUDIO_STOPPED, + SDL_AUDIO_PLAYING, + SDL_AUDIO_PAUSED + + Added an AAlib driver (ASCII Art) - by Stephane Peter. + +1.0.6: + The input grab state is reset after each call to SDL_SetVideoMode(). + The input is grabbed by default in fullscreen mode, and ungrabbed in + windowed mode. If you want to set input grab to a particular value, + you should set it after each call to SDL_SetVideoMode(). + +1.0.5: + Exposed SDL_AudioInit(), SDL_VideoInit() + Added SDL_AudioDriverName() and SDL_VideoDriverName() + + Added new window manager function: + SDL_WM_ToggleFullScreen() + This is currently implemented only on Linux + + The ALT-ENTER code has been removed - it's not appropriate for a + lib to bind keys when they aren't even emergency escape sequences. + + ALT-ENTER functionality can be implemented with the following code: + + int Handle_AltEnter(const SDL_Event *event) + { + if ( event->type == SDL_KEYDOWN ) { + if ( (event->key.keysym.sym == SDLK_RETURN) && + (event->key.keysym.mod & KMOD_ALT) ) { + SDL_WM_ToggleFullScreen(SDL_GetVideoSurface()); + return(0); + } + } + return(1); + } + SDL_SetEventFilter(Handle_AltEnter); + +1.0.3: + Under X11, if you grab the input and hide the mouse cursor, + the mouse will go into a "relative motion" mode where you + will always get relative motion events no matter how far in + each direction you move the mouse - relative motion is not + bounded by the edges of the window (though the absolute values + of the mouse positions are clamped by the size of the window). + The SVGAlib, framebuffer console, and DirectInput drivers all + have this behavior naturally, and the GDI and BWindow drivers + never go into "relative motion" mode. + +1.0.2: + Added a function to enable keyboard repeat: + SDL_EnableKeyRepeat() + + Added a function to grab the mouse and keyboard input + SDL_WM_GrabInput() + + Added a function to iconify the window. + SDL_WM_IconifyWindow() + If this function succeeds, the application will receive an event + signaling SDL_APPACTIVE event + +1.0.1: + Added constants to SDL_audio.h for 16-bit native byte ordering: + AUDIO_U16SYS, AUDIO_S16SYS + +1.0.0: + New public release + +Version 0.11: + +0.11.5: + A new function SDL_GetVideoSurface() has been added, and returns + a pointer to the current display surface. + + SDL_AllocSurface() has been renamed SDL_CreateRGBSurface(), and + a new function SDL_CreateRGBSurfaceFrom() has been added to allow + creating an SDL surface from an existing pixel data buffer. + + Added SDL_GetRGB() to the headers and documentation. + +0.11.4: + SDL_SetLibraryPath() is no longer meaningful, and has been removed. + +0.11.3: + A new flag for SDL_Init(), SDL_INIT_NOPARACHUTE, prevents SDL from + installing fatal signal handlers on operating systems that support + them. + +Version 0.9: + +0.9.15: + SDL_CreateColorCursor() has been removed. Color cursors should + be implemented as sprites, blitted by the application when the + cursor moves. To get smooth color cursor updates when the app + is busy, pass the SDL_INIT_EVENTTHREAD flag to SDL_Init(). This + allows you to handle the mouse motion in another thread from an + event filter function, but is currently only supported by Linux + and BeOS. Note that you'll have to protect the display surface + from multi-threaded access by using mutexes if you do this. + + Thread-safe surface support has been removed from SDL. + This makes blitting somewhat faster, by removing SDL_MiddleBlit(). + Code that used SDL_MiddleBlit() should use SDL_LowerBlit() instead. + You can make your surfaces thread-safe by allocating your own + mutex and making lock/unlock calls around accesses to your surface. + +0.9.14: + SDL_GetMouseState() now takes pointers to int rather than Uint16. + + If you set the SDL_WINDOWID environment variable under UNIX X11, + SDL will use that as the main window instead of creating it's own. + This is an unsupported extension to SDL, and not portable at all. + +0.9.13: + Added a function SDL_SetLibraryPath() which can be used to specify + the directory containing the SDL dynamic libraries. This is useful + for commercial applications which ship with particular versions + of the libraries, and for security on multi-user systems. + If this function is not used, the default system directories are + searched using the native dynamic object loading mechanism. + + In order to support C linkage under Visual C++, you must declare + main() without any return type: + main(int argc, char *argv[]) { + /* Do the program... */ + return(0); + } + C++ programs should also return a value if compiled under VC++. + + The blit_endian member of the SDL_VideoInfo struct has been removed. + + SDL_SymToASCII() has been replaced with SDL_GetKeyName(), so there + is now no longer any function to translate a keysym to a character. + + The SDL_keysym structure has been extended with a 'scancode' and + 'unicode' member. The 'scancode' is a hardware specific scancode + for the key that was pressed, and may be 0. The 'unicode' member + is a 16-bit UNICODE translation of the key that was pressed along + with any modifiers or compose keys that have been pressed. + If no UNICODE translation exists for the key, 'unicode' will be 0. + + Added a function SDL_EnableUNICODE() to enable/disable UNICODE + translation of character keypresses. Translation defaults off. + + To convert existing code to use the new API, change code which + uses SDL_SymToASCII() to get the keyname to use SDL_GetKeyName(), + and change code which uses it to get the ASCII value of a sym to + use the 'unicode' member of the event keysym. + +0.9.12: + There is partial support for 64-bit datatypes. I don't recommend + you use this if you have a choice, because 64-bit datatypes are not + supported on many platforms. On platforms for which it is supported, + the SDL_HAS_64BIT_TYPE C preprocessor define will be enabled, and + you can use the Uint64 and Sint64 datatypes. + + Added functions to SDL_endian.h to support 64-bit datatypes: + SDL_SwapLE64(), SDL_SwapBE64(), + SDL_ReadLE64(), SDL_ReadBE64(), SDL_WriteLE64(), SDL_WriteBE64() + + A new member "len_ratio" has been added to the SDL_AudioCVT structure, + and allows you to determine either the original buffer length or the + converted buffer length, given the other. + + A new function SDL_FreeWAV() has been added to the API to free data + allocated by SDL_LoadWAV_RW(). This is necessary under Win32 since + the gcc compiled DLL uses a different heap than VC++ compiled apps. + + SDL now has initial support for international keyboards using the + Latin character set. + If a particular mapping is desired, you can set the DEFAULT_KEYBOARD + compile-time variable, or you can set the environment variable + "SDL_KEYBOARD" to a string identifying the keyboard mapping you desire. + The valid values for these variables can be found in SDL_keyboard.c + + Full support for German and French keyboards under X11 is implemented. + +0.9.11: + The THREADED_EVENTS compile-time define has been replaced with the + SDL_INIT_EVENTTHREAD flag. If this flag is passed to SDL_Init(), + SDL will create a separate thread to perform input event handling. + If this flag is passed to SDL_Init(), and the OS doesn't support + event handling in a separate thread, SDL_Init() will fail. + Be sure to add calls to SDL_Delay() in your main thread to allow + the OS to schedule your event thread, or it may starve, leading + to slow event delivery and/or dropped events. + Currently MacOS and Win32 do not support this flag, while BeOS + and Linux do support it. I recommend that your application only + use this flag if absolutely necessary. + + The SDL thread function passed to SDL_CreateThread() now returns a + status. This status can be retrieved by passing a non-NULL pointer + as the 'status' argument to SDL_WaitThread(). + + The volume parameter to SDL_MixAudio() has been increased in range + from (0-8) to (0-128) + + SDL now has a data source abstraction which can encompass a file, + an area of memory, or any custom object you can envision. It uses + these abstractions, SDL_RWops, in the endian read/write functions, + and the built-in WAV and BMP file loaders. This means you can load + WAV chunks from memory mapped files, compressed archives, network + pipes, or anything else that has a data read abstraction. + + There are three built-in data source abstractions: + SDL_RWFromFile(), SDL_RWFromFP(), SDL_RWFromMem() + along with a generic data source allocation function: + SDL_AllocRW() + These data sources can be used like stdio file pointers with the + following convenience functions: + SDL_RWseek(), SDL_RWread(), SDL_RWwrite(), SDL_RWclose() + These functions are defined in the new header file "SDL_rwops.h" + + The endian swapping functions have been turned into macros for speed + and SDL_CalculateEndian() has been removed. SDL_endian.h now defines + SDL_BYTEORDER as either SDL_BIG_ENDIAN or SDL_LIL_ENDIAN depending on + the endianness of the host system. + + The endian read/write functions now take an SDL_RWops pointer + instead of a stdio FILE pointer, to support the new data source + abstraction. + + The SDL_*LoadWAV() functions have been replaced with a single + SDL_LoadWAV_RW() function that takes a SDL_RWops pointer as it's + first parameter, and a flag whether or not to automatically + free it as the second parameter. SDL_LoadWAV() is a macro for + backward compatibility and convenience: + SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); + + The SDL_*LoadBMP()/SDL_*SaveBMP() functions have each been replaced + with a single function that takes a SDL_RWops pointer as it's + first parameter, and a flag whether or not to automatically + free it as the second parameter. SDL_LoadBMP() and SDL_SaveBMP() + are macros for backward compatibility and convenience: + SDL_LoadBMP_RW(SDL_RWFromFile("sample.bmp", "rb"), 1, ...); + SDL_SaveBMP_RW(SDL_RWFromFile("sample.bmp", "wb"), 1, ...); + Note that these functions use SDL_RWseek() extensively, and should + not be used on pipes or other non-seekable data sources. + +0.9.10: + The Linux SDL_SysWMInfo and SDL_SysWMMsg structures have been + extended to support multiple types of display drivers, as well as + safe access to the X11 display when THREADED_EVENTS is enabled. + The new structures are documented in the SDL_syswm.h header file. + + Thanks to John Elliott , the UK keyboard + should now work properly, as well as the "Windows" keys on US + keyboards. + + The Linux CD-ROM code now reads the CD-ROM devices from /etc/fstab + instead of trying to open each block device on the system. + The CD must be listed in /etc/fstab as using the iso9660 filesystem. + + On Linux, if you define THREADED_EVENTS at compile time, a separate + thread will be spawned to gather X events asynchronously from the + graphics updates. This hasn't been extensively tested, but it does + provide a means of handling keyboard and mouse input in a separate + thread from the graphics thread. (This is now enabled by default.) + + A special access function SDL_PeepEvents() allows you to manipulate + the event queue in a thread-safe manner, including peeking at events, + removing events of a specified type, and adding new events of arbitrary + type to the queue (use the new 'user' member of the SDL_Event type). + + If you use SDL_PeepEvents() to gather events, then the main graphics + thread needs to call SDL_PumpEvents() periodically to drive the event + loop and generate input events. This is not necessary if SDL has been + compiled with THREADED_EVENTS defined, but doesn't hurt. + + A new function SDL_ThreadID() returns the identifier associated with + the current thread. + +0.9.9: + The AUDIO_STEREO format flag has been replaced with a new 'channels' + member of the SDL_AudioSpec structure. The channels are 1 for mono + audio, and 2 for stereo audio. In the future more channels may be + supported for 3D surround sound. + + The SDL_MixAudio() function now takes an additional volume parameter, + which should be set to SDL_MIX_MAXVOLUME for compatibility with the + original function. + + The CD-ROM functions which take a 'cdrom' parameter can now be + passed NULL, and will act on the last successfully opened CD-ROM. + +0.9.8: + No changes, bugfixes only. + +0.9.7: + No changes, bugfixes only. + +0.9.6: + Added a fast rectangle fill function: SDL_FillRect() + + Addition of a useful function for getting info on the video hardware: + const SDL_VideoInfo *SDL_GetVideoInfo(void) + This function replaces SDL_GetDisplayFormat(). + + Initial support for double-buffering: + Use the SDL_DOUBLEBUF flag in SDL_SetVideoMode() + Update the screen with a new function: SDL_Flip() + + SDL_AllocSurface() takes two new flags: + SDL_SRCCOLORKEY means that the surface will be used for colorkey blits + and if the hardware supports hardware acceleration of colorkey blits + between two surfaces in video memory, to place the surface in video + memory if possible, otherwise it will be placed in system memory. + SDL_SRCALPHA means that the surface will be used for alpha blits and + if the hardware supports hardware acceleration of alpha blits between + two surfaces in video memory, to place the surface in video memory + if possible, otherwise it will be placed in system memory. + SDL_HWSURFACE now means that the surface will be created with the + same format as the display surface, since having surfaces in video + memory is only useful for fast blitting to the screen, and you can't + blit surfaces with different surface formats in video memory. + +0.9.5: + You can now pass a NULL mask to SDL_WM_SetIcon(), and it will assume + that the icon consists of the entire image. + + SDL_LowerBlit() is back -- but don't use it on the display surface. + It is exactly the same as SDL_MiddleBlit(), but doesn't check for + thread safety. + + Added SDL_FPLoadBMP(), SDL_FPSaveBMP(), SDL_FPLoadWAV(), which take + a FILE pointer instead of a file name. + + Added CD-ROM audio control API: + SDL_CDNumDrives() + SDL_CDName() + SDL_CDOpen() + SDL_CDStatus() + SDL_CDPlayTracks() + SDL_CDPlay() + SDL_CDPause() + SDL_CDResume() + SDL_CDStop() + SDL_CDEject() + SDL_CDClose() + +0.9.4: + No changes, bugfixes only. + +0.9.3: + Mouse motion event now includes relative motion information: + Sint16 event->motion.xrel, Sint16 event->motion.yrel + + X11 keyrepeat handling can be disabled by defining IGNORE_X_KEYREPEAT + (Add -DIGNORE_X_KEYREPEAT to CFLAGS line in obj/x11Makefile) + +0.9.2: + No changes, bugfixes only. + +0.9.1: + Removed SDL_MapSurface() and SDL_UnmapSurface() -- surfaces are now + automatically mapped on blit. + +0.8.0: + SDL stable release diff -r 000000000000 -r 74212992fb08 acinclude.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/acinclude.m4 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,619 @@ +# Local macros for the SDL configure.in script + +dnl Function to link an architecture specific file +dnl LINK_ARCH_SRC(source_dir, arch, source_file) +AC_DEFUN(COPY_ARCH_SRC, +[ + echo "Copying $1/$2/$3 -> $1/$3" + old="$srcdir/$1/$2/$3" + new="$srcdir/$1/$3" + cat >$new <<__EOF__ +/* WARNING: This file was automatically generated! + * Original: $old + */ +__EOF__ + cat >>$new <$old +]) + +# +# --- esd.m4 --- +# +# Configure paths for ESD +# Manish Singh 98-9-30 +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_ESD([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for ESD, and define ESD_CFLAGS and ESD_LIBS +dnl +AC_DEFUN(AM_PATH_ESD, +[dnl +dnl Get the cflags and libraries from the esd-config script +dnl +AC_ARG_WITH(esd-prefix,[ --with-esd-prefix=PFX Prefix where ESD is installed (optional)], + esd_prefix="$withval", esd_prefix="") +AC_ARG_WITH(esd-exec-prefix,[ --with-esd-exec-prefix=PFX Exec prefix where ESD is installed (optional)], + esd_exec_prefix="$withval", esd_exec_prefix="") +AC_ARG_ENABLE(esdtest, [ --disable-esdtest Do not try to compile and run a test ESD program], + , enable_esdtest=yes) + + if test x$esd_exec_prefix != x ; then + esd_args="$esd_args --exec-prefix=$esd_exec_prefix" + if test x${ESD_CONFIG+set} != xset ; then + ESD_CONFIG=$esd_exec_prefix/bin/esd-config + fi + fi + if test x$esd_prefix != x ; then + esd_args="$esd_args --prefix=$esd_prefix" + if test x${ESD_CONFIG+set} != xset ; then + ESD_CONFIG=$esd_prefix/bin/esd-config + fi + fi + + AC_PATH_PROG(ESD_CONFIG, esd-config, no) + min_esd_version=ifelse([$1], ,0.2.7,$1) + AC_MSG_CHECKING(for ESD - version >= $min_esd_version) + no_esd="" + if test "$ESD_CONFIG" = "no" ; then + no_esd=yes + else + ESD_CFLAGS=`$ESD_CONFIG $esdconf_args --cflags` + ESD_LIBS=`$ESD_CONFIG $esdconf_args --libs` + + esd_major_version=`$ESD_CONFIG $esd_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + esd_minor_version=`$ESD_CONFIG $esd_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + esd_micro_version=`$ESD_CONFIG $esd_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_esdtest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $ESD_CFLAGS" + LIBS="$LIBS $ESD_LIBS" +dnl +dnl Now check if the installed ESD is sufficiently new. (Also sanity +dnl checks the results of esd-config to some extent +dnl + rm -f conf.esdtest + AC_TRY_RUN([ +#include +#include +#include +#include + +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main () +{ + int major, minor, micro; + char *tmp_version; + + system ("touch conf.esdtest"); + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_esd_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_esd_version"); + exit(1); + } + + if (($esd_major_version > major) || + (($esd_major_version == major) && ($esd_minor_version > minor)) || + (($esd_major_version == major) && ($esd_minor_version == minor) && ($esd_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'esd-config --version' returned %d.%d.%d, but the minimum version\n", $esd_major_version, $esd_minor_version, $esd_micro_version); + printf("*** of ESD required is %d.%d.%d. If esd-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If esd-config was wrong, set the environment variable ESD_CONFIG\n"); + printf("*** to point to the correct copy of esd-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + +],, no_esd=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_esd" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$ESD_CONFIG" = "no" ; then + echo "*** The esd-config script installed by ESD could not be found" + echo "*** If ESD was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the ESD_CONFIG environment variable to the" + echo "*** full path to esd-config." + else + if test -f conf.esdtest ; then + : + else + echo "*** Could not run ESD test program, checking why..." + CFLAGS="$CFLAGS $ESD_CFLAGS" + LIBS="$LIBS $ESD_LIBS" + AC_TRY_LINK([ +#include +#include +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding ESD or finding the wrong" + echo "*** version of ESD. If it is not finding ESD, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means ESD was incorrectly installed" + echo "*** or that you have moved ESD since it was installed. In the latter case, you" + echo "*** may want to edit the esd-config script: $ESD_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + ESD_CFLAGS="" + ESD_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(ESD_CFLAGS) + AC_SUBST(ESD_LIBS) + rm -f conf.esdtest +]) + +## libtool.m4 - Configure libtool for the target system. -*-Shell-script-*- +## Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc. +## Originally by Gordon Matzigkeit , 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 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. + +# serial 40 AC_PROG_LIBTOOL +AC_DEFUN(AC_PROG_LIBTOOL, +[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl + +# Save cache, so that ltconfig can load it +AC_CACHE_SAVE + +# Actually configure libtool. ac_aux_dir is where install-sh is found. +CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \ +LD="$LD" LDFLAGS="$LDFLAGS" LIBS="$LIBS" \ +LN_S="$LN_S" NM="$NM" RANLIB="$RANLIB" \ +DLLTOOL="$DLLTOOL" AS="$AS" OBJDUMP="$OBJDUMP" \ +${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \ +$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \ +|| AC_MSG_ERROR([libtool configure failed]) + +# Reload cache, that may have been modified by ltconfig +AC_CACHE_LOAD + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ac_aux_dir/ltconfig $ac_aux_dir/ltmain.sh" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +# Redirect the config.log output again, so that the ltconfig log is not +# clobbered by the next message. +exec 5>>./config.log +]) + +AC_DEFUN(AC_LIBTOOL_SETUP, +[AC_PREREQ(2.13)dnl +AC_REQUIRE([AC_ENABLE_SHARED])dnl +AC_REQUIRE([AC_ENABLE_STATIC])dnl +AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([AC_PROG_RANLIB])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_LD])dnl +AC_REQUIRE([AC_PROG_NM])dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +dnl + +case "$target" in +NONE) lt_target="$host" ;; +*) lt_target="$target" ;; +esac + +# Check for any special flags to pass to ltconfig. +libtool_flags="--cache-file=$cache_file" +test "$enable_shared" = no && libtool_flags="$libtool_flags --disable-shared" +test "$enable_static" = no && libtool_flags="$libtool_flags --disable-static" +test "$enable_fast_install" = no && libtool_flags="$libtool_flags --disable-fast-install" +test "$ac_cv_prog_gcc" = yes && libtool_flags="$libtool_flags --with-gcc" +test "$ac_cv_prog_gnu_ld" = yes && libtool_flags="$libtool_flags --with-gnu-ld" +ifdef([AC_PROVIDE_AC_LIBTOOL_DLOPEN], +[libtool_flags="$libtool_flags --enable-dlopen"]) +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[libtool_flags="$libtool_flags --enable-win32-dll"]) +AC_ARG_ENABLE(libtool-lock, + [ --disable-libtool-lock avoid locking (might break parallel builds)]) +test "x$enable_libtool_lock" = xno && libtool_flags="$libtool_flags --disable-lock" +test x"$silent" = xyes && libtool_flags="$libtool_flags --silent" + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case "$lt_target" in +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line __oline__ "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case "`/usr/bin/file conftest.o`" in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; + +ifdef([AC_PROVIDE_AC_LIBTOOL_WIN32_DLL], +[*-*-cygwin* | *-*-mingw*) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +]) +esac +]) + +# AC_LIBTOOL_DLOPEN - enable checks for dlopen support +AC_DEFUN(AC_LIBTOOL_DLOPEN, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])]) + +# AC_LIBTOOL_WIN32_DLL - declare package support for building win32 dll's +AC_DEFUN(AC_LIBTOOL_WIN32_DLL, [AC_BEFORE([$0], [AC_LIBTOOL_SETUP])]) + +# AC_ENABLE_SHARED - implement the --enable-shared flag +# Usage: AC_ENABLE_SHARED[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AC_ENABLE_SHARED, [dnl +define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(shared, +changequote(<<, >>)dnl +<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_shared=yes ;; +no) enable_shared=no ;; +*) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl +]) + +# AC_DISABLE_SHARED - set the default shared flag to --disable-shared +AC_DEFUN(AC_DISABLE_SHARED, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_SHARED(no)]) + +# AC_ENABLE_STATIC - implement the --enable-static flag +# Usage: AC_ENABLE_STATIC[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AC_ENABLE_STATIC, [dnl +define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(static, +changequote(<<, >>)dnl +<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_static=yes ;; +no) enable_static=no ;; +*) + enable_static=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_static=AC_ENABLE_STATIC_DEFAULT)dnl +]) + +# AC_DISABLE_STATIC - set the default static flag to --disable-static +AC_DEFUN(AC_DISABLE_STATIC, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_STATIC(no)]) + + +# AC_ENABLE_FAST_INSTALL - implement the --enable-fast-install flag +# Usage: AC_ENABLE_FAST_INSTALL[(DEFAULT)] +# Where DEFAULT is either `yes' or `no'. If omitted, it defaults to +# `yes'. +AC_DEFUN(AC_ENABLE_FAST_INSTALL, [dnl +define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl +AC_ARG_ENABLE(fast-install, +changequote(<<, >>)dnl +<< --enable-fast-install[=PKGS] optimize for fast installation [default=>>AC_ENABLE_FAST_INSTALL_DEFAULT], +changequote([, ])dnl +[p=${PACKAGE-default} +case "$enableval" in +yes) enable_fast_install=yes ;; +no) enable_fast_install=no ;; +*) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:," + for pkg in $enableval; do + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$ac_save_ifs" + ;; +esac], +enable_fast_install=AC_ENABLE_FAST_INSTALL_DEFAULT)dnl +]) + +# AC_ENABLE_FAST_INSTALL - set the default to --disable-fast-install +AC_DEFUN(AC_DISABLE_FAST_INSTALL, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl +AC_ENABLE_FAST_INSTALL(no)]) + +# AC_PROG_LD - find the path to the GNU or non-GNU linker +AC_DEFUN(AC_PROG_LD, +[AC_ARG_WITH(gnu-ld, +[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]], +test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no) +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +ac_prog=ld +if test "$ac_cv_prog_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + ac_prog=`($CC -print-prog-name=ld | tr -d '\r') 2>&5` + case "$ac_prog" in + # Accept absolute paths. +changequote(,)dnl + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' +changequote([,])dnl + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(ac_cv_path_LD, +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + ac_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$ac_cv_path_LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" +else + ac_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$ac_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT($LD) +else + AC_MSG_RESULT(no) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_PROG_LD_GNU +]) + +AC_DEFUN(AC_PROG_LD_GNU, +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], ac_cv_prog_gnu_ld, +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + ac_cv_prog_gnu_ld=yes +else + ac_cv_prog_gnu_ld=no +fi]) +]) + +# AC_PROG_NM - find the path to a BSD-compatible name lister +AC_DEFUN(AC_PROG_NM, +[AC_MSG_CHECKING([for BSD-compatible nm]) +AC_CACHE_VAL(ac_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + ac_cv_path_NM="$NM" +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH /usr/ccs/bin /usr/ucb /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -B" + break + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + ac_cv_path_NM="$ac_dir/nm -p" + break + else + ac_cv_path_NM=${ac_cv_path_NM="$ac_dir/nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm +fi]) +NM="$ac_cv_path_NM" +AC_MSG_RESULT([$NM]) +]) + +# AC_CHECK_LIBM - check for math library +AC_DEFUN(AC_CHECK_LIBM, +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case "$lt_target" in +*-*-beos* | *-*-cygwin*) + # These system don't have libm + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, main, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, main, LIBM="-lm") + ;; +esac +]) + +# AC_LIBLTDL_CONVENIENCE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl convenience library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-convenience to the +# configure arguments. Note that LIBLTDL and INCLTDL are not +# AC_SUBSTed, nor is AC_CONFIG_SUBDIRS called. If DIR is not +# provided, it is assumed to be `libltdl'. LIBLTDL will be prefixed +# with '${top_builddir}/' and INCLTDL will be prefixed with +# '${top_srcdir}/' (note the single quotes!). If your package is not +# flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +AC_DEFUN(AC_LIBLTDL_CONVENIENCE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + case "$enable_ltdl_convenience" in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; + esac + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) +]) + +# AC_LIBLTDL_INSTALLABLE[(dir)] - sets LIBLTDL to the link flags for +# the libltdl installable library and INCLTDL to the include flags for +# the libltdl header and adds --enable-ltdl-install to the configure +# arguments. Note that LIBLTDL and INCLTDL are not AC_SUBSTed, nor is +# AC_CONFIG_SUBDIRS called. If DIR is not provided and an installed +# libltdl is not found, it is assumed to be `libltdl'. LIBLTDL will +# be prefixed with '${top_builddir}/' and INCLTDL will be prefixed +# with '${top_srcdir}/' (note the single quotes!). If your package is +# not flat and you're not using automake, define top_builddir and +# top_srcdir appropriately in the Makefiles. +# In the future, this macro may have to be called after AC_PROG_LIBTOOL. +AC_DEFUN(AC_LIBLTDL_INSTALLABLE, [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl + AC_CHECK_LIB(ltdl, main, + [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no], + [if test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + else + enable_ltdl_install=yes + fi + ]) + if test x"$enable_ltdl_install" = x"yes"; then + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la + INCLTDL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl']) + else + ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + INCLTDL= + fi +]) + +dnl old names +AC_DEFUN(AM_PROG_LIBTOOL, [indir([AC_PROG_LIBTOOL])])dnl +AC_DEFUN(AM_ENABLE_SHARED, [indir([AC_ENABLE_SHARED], $@)])dnl +AC_DEFUN(AM_ENABLE_STATIC, [indir([AC_ENABLE_STATIC], $@)])dnl +AC_DEFUN(AM_DISABLE_SHARED, [indir([AC_DISABLE_SHARED], $@)])dnl +AC_DEFUN(AM_DISABLE_STATIC, [indir([AC_DISABLE_STATIC], $@)])dnl +AC_DEFUN(AM_PROG_LD, [indir([AC_PROG_LD])])dnl +AC_DEFUN(AM_PROG_NM, [indir([AC_PROG_NM])])dnl + +dnl This is just to silence aclocal about the macro not being used +ifelse([AC_DISABLE_FAST_INSTALL])dnl diff -r 000000000000 -r 74212992fb08 autogen.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/autogen.sh Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,18 @@ +#!/bin/sh +# +echo "Generating build information using aclocal, automake and autoconf" +echo "This may take a while ..." + +# Touch the timestamps on all the files since CVS messes them up +directory=`dirname $0` +touch $directory/configure.in + +# Regenerate configuration files +aclocal +automake --foreign --include-deps +autoconf +(cd test; aclocal; automake --foreign --include-deps; autoconf) + +# Run configure for this platform +#./configure $* +echo "Now you are ready to run ./configure" diff -r 000000000000 -r 74212992fb08 config.guess --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config.guess Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,1368 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-03-16' + +# 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 . +# Please send patches to . +# +# 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, 93, 94, 95, 96, 97, 98, 99, 2000 +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 + + +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c + for c in cc gcc c89 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break + fi + done + rm -f $dummy.c $dummy.o $dummy.rel + 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 + +# 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 + +# 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. + # Determine the machine/vendor (is the vendor relevant). + case "${UNAME_MACHINE}" in + amiga) machine=m68k-unknown ;; + arm32) machine=arm-unknown ;; + atari*) machine=m68k-atari ;; + sun3*) machine=m68k-sun ;; + mac68k) machine=m68k-apple ;; + macppc) machine=powerpc-apple ;; + hp3[0-9][05]) machine=m68k-hp ;; + ibmrt|romp-ibm) machine=romp-ibm ;; + *) machine=${UNAME_MACHINE}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE}" in + i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + 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 ;; + 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 <$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" + ;; + esac + fi + rm -f $dummy.s $dummy + 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;; + 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 ;; + *: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 ;; + 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*:OpenBSD:*:*) + echo m68k-unknown-openbsd${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 ;; + sun3*:OpenBSD:*:*) + echo m68k-unknown-openbsd${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 ;; + 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) + 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 && 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 ] || [ $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 + 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 && 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:*:[45]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | 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]) + case "${HPUX_REV}" in + 11.[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" ;; + esac ;; + esac + fi ;; + esac + if [ "${HP_ARCH}" = "" ]; then + 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 + 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:*:*) + 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 && 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 ;; + *9??*: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 ;; + hppa*:OpenBSD:*:*) + echo hppa-unknown-openbsd + 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} | 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 ;; + CRAY-2:*:*:*) + echo cray2-cray-unicos + 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 ;; + hp300:OpenBSD:*:*) + echo m68k-unknown-openbsd${UNAME_RELEASE} + 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:*:*) + echo ${UNAME_MACHINE}-unknown-freebsd`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 ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + 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 + exit 0 ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; + mips:Linux:*:*) + cat >$dummy.c < /* for printf() prototype */ +int main (int argc, char *argv[]) { +#else +int main (argc, argv) int argc; char *argv[]; { +#endif +#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_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + ;; + ppc:Linux:*:*) + # Determine Lib Version + cat >$dummy.c < +#if defined(__GLIBC__) +extern char __libc_version[]; +extern char __libc_release[]; +#endif +main(argc, argv) + int argc; + char *argv[]; +{ +#if defined(__GLIBC__) + printf("%s %s\n", __libc_version, __libc_release); +#else + printf("unknown\n"); +#endif + return 0; +} +EOF + LIBC="" + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null + if test "$?" = 0 ; then + ./$dummy | grep 1\.99 > /dev/null + if test "$?" = 0 ; then LIBC="libc1" ; fi + fi + rm -f $dummy.c $dummy + echo powerpc-unknown-linux-gnu${LIBC} + exit 0 ;; + alpha:Linux:*:*) + 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 + LIBC="" + $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" ;; + 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 ;; + 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. + ld_supported_emulations=`cd /; ld --help 2>&1 \ + | 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 + ;; + elf_i?86) + TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" + ;; + i?86coff) + echo "${UNAME_MACHINE}-pc-linux-gnucoff" + exit 0 + ;; + esac + # 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. + test -z "$ld_supported_emulations" && 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 < +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif +#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_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + ;; +# 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.*:*) + 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:7*) + # Fixed at (any) Pentium or better + UNAME_MACHINE=i586 + if [ ${UNAME_SYSTEM} = "UnixWare" ] ; 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' /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 + (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|egrep '^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 ;; + 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 | 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.*:* | i?86:LynxOS:3.[01]*:*) + 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]*:*) + 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:CPunix: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 ;; + 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 ;; + 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]*:*) + if test "${UNAME_MACHINE}" = "x86pc"; then + UNAME_MACHINE=pc + fi + echo `uname -p`-${UNAME_MACHINE}-nto-qnx + exit 0 ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit 0 ;; + NSR-[KW]: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 ;; +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 < +# 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 && 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 + +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 -r 000000000000 -r 74212992fb08 config.sub --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config.sub Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,1357 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Free Software Foundation, Inc. + +timestamp='2001-03-19' + +# 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 . +# +# 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* | storm-chaos* | os2-emx*) + 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 + ;; + -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. + tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ + | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ + | pyramid | mn10200 | mn10300 | tron | a29k \ + | 580 | i960 | h8300 \ + | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ + | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ + | hppa64 \ + | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ + | alphaev6[78] \ + | we32k | ns16k | clipper | i370 | sh | sh[34] \ + | powerpc | powerpcle \ + | 1750a | dsp16xx | pdp10 | pdp11 \ + | mips16 | mips64 | mipsel | mips64el \ + | mips64orion | mips64orionel | mipstx39 | mipstx39el \ + | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ + | mips64vr5000 | miprs64vr5000el | mcore | s390 | s390x \ + | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ + | thumb | d10v | d30v | fr30 | avr | openrisc | tic80 \ + | pj | pjl | h8500) + 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 | z8k | v70 | w65) + ;; + + # 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[234567]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. + # FIXME: clean up the formatting here. + vax-* | tahoe-* | i[234567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ + | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ + | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ + | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ + | xmp-* | ymp-* \ + | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ + | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ + | hppa2.0n-* | hppa64-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ + | alphaev6[78]-* \ + | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ + | clipper-* | orion-* \ + | sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ + | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ + | mips64el-* | mips64orion-* | mips64orionel-* \ + | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ + | mipstx39-* | mipstx39el-* | mcore-* \ + | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \ + | [cjt]90-* \ + | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ + | thumb-* | v850-* | d30v-* | tic30-* | tic80-* | c30-* | fr30-* \ + | bs2000-* | tic54x-* | c54x-* | x86_64-* | pj-* | pjl-*) + ;; + # 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 + ;; + 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 + ;; + [cjt]90) + basic_machine=${basic_machine}-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 + ;; + 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[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 + ;; + 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 + ;; + 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 + ;; + mmix*) + basic_machine=mmix-knuth + os=-mmixware + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + 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 + ;; + 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) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon) + basic_machine=i686-pc + ;; + pentiumii | pentium2) + basic_machine=i686-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-*) + 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/^[^-]*-//'` + ;; + 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 + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sparclite-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 + ;; + t3e) + basic_machine=t3e-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + 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 + ;; + 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 + ;; + xmp) + basic_machine=xmp-cray + os=-unicos + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + 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 + ;; + 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 + ;; + 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) + basic_machine=sh-unknown + ;; + sparc | sparcv9) + 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 + ;; + c4x*) + basic_machine=c4x-none + os=-coff + ;; + *) + 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* \ + | -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*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i[34567]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 + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -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 + ;; + 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 + ;; + *-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*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + 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 -r 000000000000 -r 74212992fb08 configure.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/configure.in Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,1891 @@ +dnl Process this file with autoconf to produce a configure script. +AC_INIT(README) + +dnl Set various version strings - taken gratefully from the GTk sources +# +# Making releases: +# Edit include/SDL/SDL_version.h and change the version, then: +# SDL_MICRO_VERSION += 1; +# SDL_INTERFACE_AGE += 1; +# SDL_BINARY_AGE += 1; +# if any functions have been added, set SDL_INTERFACE_AGE to 0. +# if backwards compatibility has been broken, +# set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0. +# +SDL_MAJOR_VERSION=1 +SDL_MINOR_VERSION=2 +SDL_MICRO_VERSION=0 +SDL_INTERFACE_AGE=0 +SDL_BINARY_AGE=0 +SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION + +AC_SUBST(SDL_MAJOR_VERSION) +AC_SUBST(SDL_MINOR_VERSION) +AC_SUBST(SDL_MICRO_VERSION) +AC_SUBST(SDL_INTERFACE_AGE) +AC_SUBST(SDL_BINARY_AGE) +AC_SUBST(SDL_VERSION) + +# libtool versioning +LT_RELEASE=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION +LT_CURRENT=`expr $SDL_MICRO_VERSION - $SDL_INTERFACE_AGE` +LT_REVISION=$SDL_INTERFACE_AGE +LT_AGE=`expr $SDL_BINARY_AGE - $SDL_INTERFACE_AGE` + +AC_SUBST(LT_RELEASE) +AC_SUBST(LT_CURRENT) +AC_SUBST(LT_REVISION) +AC_SUBST(LT_AGE) + +dnl Setup for automake +AM_INIT_AUTOMAKE(SDL, $SDL_VERSION) + +dnl Detect the canonical host and target build environment +AC_CANONICAL_HOST +AC_CANONICAL_TARGET + +dnl Check for tools + +AC_LIBTOOL_WIN32_DLL +AM_PROG_LIBTOOL +AC_PROG_MAKE_SET +AC_PROG_CC +AC_C_INLINE +AC_C_CONST +case "$target" in + *-*-beos*) + AC_PROG_CXX + ;; + *-*-aix*) + AC_PROG_CXX + ;; + # This is stupid, but necessary on some versions of Linux (joysticks) + *-*-linux*) + AC_PROG_CXX + ;; +esac +AC_PROG_INSTALL +AC_FUNC_ALLOCA + +dnl The alpha architecture needs special flags for binary portability +case "$target" in + alpha*-*-linux*) + if test x$ac_cv_prog_gcc = xyes; then + CFLAGS="$CFLAGS -mcpu=ev4 -Wa,-mall" + fi + ;; +esac + +dnl Add compiler-specific optimization flags + +dnl See if the user wants aggressive optimizations of the code +AC_ARG_ENABLE(debug, +[ --enable-debug Disable aggressive optimizations [default=yes]], + , enable_debug=yes) +if test x$enable_debug != xyes; then + if test x$ac_cv_prog_gcc = xyes; then + CFLAGS="$CFLAGS -fexpensive-optimizations" + # Ack! This breaks the MMX YV12 conversion on gcc 2.95.2 + # CFLAGS="$CFLAGS -fomit-frame-pointer" + fi + case "$target" in + i486-*-*) + if test x$ac_cv_prog_gcc = xyes; then + CFLAGS="$CFLAGS -march=486" + fi + ;; + i?86-*-*) + if test x$ac_cv_prog_gcc = xyes; then + CFLAGS="$CFLAGS -march=pentium -mcpu=pentiumpro" + fi + ;; + *-*-osf*) + if test x$ac_cv_prog_gcc != xyes; then + CFLAGS="-g3 -fast -arch host" + fi + ;; + esac +fi + +dnl Add verbose warnings by default, and allow ANSI compliance checking +AC_ARG_ENABLE(strict-ansi, +[ --enable-strict-ansi Enable strict ANSI compliance build [default=no]], + , enable_strict_ansi=no) +if test x$ac_cv_prog_gcc = xyes; then + CFLAGS="$CFLAGS -Wall" + if test x$enable_strict_ansi = xyes; then + CFLAGS="$CFLAGS -ansi -pedantic -D_XOPEN_SOURCE" + fi +fi + +dnl Initialize the compiler and linker flags for SDL applications + +SDL_CFLAGS="" +SDL_LIBS="-lSDL" + +dnl Add the math library for the new gamma correction support + +case "$target" in + *-*-cygwin* | *-*-mingw32*) + MATHLIB="" + ;; + *-*-beos*) + MATHLIB="" + ;; + *-*-darwin*) + MATHLIB="" + ;; + *) + MATHLIB="-lm" + ;; +esac +SYSTEM_LIBS="$SYSTEM_LIBS $MATHLIB" + +dnl Enable/disable various subsystems of the SDL library + +AC_ARG_ENABLE(audio, +[ --enable-audio Enable the audio subsystem [default=yes]], + , enable_audio=yes) +if test x$enable_audio = xyes; then + SDL_EXTRADIRS="$SDL_EXTRADIRS audio" + SDL_EXTRALIBS="$SDL_EXTRALIBS audio/libaudio.la" +else + CFLAGS="$CFLAGS -DDISABLE_AUDIO" +fi +AC_ARG_ENABLE(video, +[ --enable-video Enable the video subsystem [default=yes]], + , enable_video=yes) +if test x$enable_video = xyes; then + SDL_EXTRADIRS="$SDL_EXTRADIRS video" + SDL_EXTRALIBS="$SDL_EXTRALIBS video/libvideo.la" +else + CFLAGS="$CFLAGS -DDISABLE_VIDEO" +fi +AC_ARG_ENABLE(events, +[ --enable-events Enable the events subsystem [default=yes]], + , enable_events=yes) +if test x$enable_video = xyes -a x$enable_events = xyes; then + SDL_EXTRADIRS="$SDL_EXTRADIRS events" + SDL_EXTRALIBS="$SDL_EXTRALIBS events/libevents.la" +else + CFLAGS="$CFLAGS -DDISABLE_EVENTS" +fi +AC_ARG_ENABLE(joystick, +[ --enable-joystick Enable the joystick subsystem [default=yes]], + , enable_joystick=yes) +if test x$enable_joystick = xyes; then + SDL_EXTRADIRS="$SDL_EXTRADIRS joystick" + SDL_EXTRALIBS="$SDL_EXTRALIBS joystick/libjoystick.la" +else + CFLAGS="$CFLAGS -DDISABLE_JOYSTICK" +fi +AC_ARG_ENABLE(cdrom, +[ --enable-cdrom Enable the cdrom subsystem [default=yes]], + , enable_cdrom=yes) +if test x$enable_cdrom = xyes; then + SDL_EXTRADIRS="$SDL_EXTRADIRS cdrom" + SDL_EXTRALIBS="$SDL_EXTRALIBS cdrom/libcdrom.la" +else + CFLAGS="$CFLAGS -DDISABLE_CDROM" +fi +AC_ARG_ENABLE(threads, +[ --enable-threads Enable the threading subsystem [default=yes]], + , enable_threads=yes) +SDL_EXTRADIRS="$SDL_EXTRADIRS thread" +SDL_EXTRALIBS="$SDL_EXTRALIBS thread/libthread.la" +if test x$enable_threads != xyes; then + CFLAGS="$CFLAGS -DDISABLE_THREADS" + COPY_ARCH_SRC(src/thread, generic, SDL_systhread.c) + COPY_ARCH_SRC(src/thread, generic, SDL_systhread_c.h) + COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c) + COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h) + COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h) +fi +AC_ARG_ENABLE(timers, +[ --enable-timers Enable the timer subsystem [default=yes]], + , enable_timers=yes) +if test x$enable_timers = xyes; then + SDL_EXTRADIRS="$SDL_EXTRADIRS timer" + SDL_EXTRALIBS="$SDL_EXTRALIBS timer/libtimer.la" +else + CFLAGS="$CFLAGS -DDISABLE_TIMERS" +fi +AC_ARG_ENABLE(endian, +[ --enable-endian Enable the endian subsystem [default=yes]], + , enable_endian=yes) +if test x$enable_endian = xyes; then + SDL_EXTRADIRS="$SDL_EXTRADIRS endian" + SDL_EXTRALIBS="$SDL_EXTRALIBS endian/libendian.la" +else + CFLAGS="$CFLAGS -DDISABLE_ENDIAN" +fi +AC_ARG_ENABLE(file, +[ --enable-file Enable the file subsystem [default=yes]], + , enable_file=yes) +if test x$enable_file = xyes; then + SDL_EXTRADIRS="$SDL_EXTRADIRS file" + SDL_EXTRALIBS="$SDL_EXTRALIBS file/libfile.la" +else + CFLAGS="$CFLAGS -DDISABLE_FILE" +fi + +dnl See if the OSS audio interface is supported +CheckOSS() +{ + AC_ARG_ENABLE(oss, +[ --enable-oss support the OSS audio API [default=yes]], + , enable_oss=yes) + if test x$enable_audio = xyes -a x$enable_oss = xyes; then + AC_MSG_CHECKING(for OSS audio support) + have_oss=no + AC_TRY_COMPILE([ + #ifdef linux + #include + #endif + #ifdef __FreeBSD__ + #include + #endif + #ifdef __bsdi__ + #include + #endif + #ifdef __USLC__ + #include + #endif + ],[ + int arg = SNDCTL_DSP_SETFRAGMENT; + ],[ + have_oss=yes + ]) + AC_MSG_RESULT($have_oss) + if test x$have_oss = xyes; then + CFLAGS="$CFLAGS -DOSS_SUPPORT" + AUDIO_SUBDIRS="$AUDIO_SUBDIRS dsp" + AUDIO_DRIVERS="$AUDIO_DRIVERS dsp/libaudio_dsp.la" + AUDIO_SUBDIRS="$AUDIO_SUBDIRS dma" + AUDIO_DRIVERS="$AUDIO_DRIVERS dma/libaudio_dma.la" + fi + fi +} + +dnl See if the ALSA audio interface is supported +CheckALSA() +{ + AC_ARG_ENABLE(alsa, +[ --enable-alsa support the ALSA audio API [default=yes]], + , enable_alsa=yes) + if test x$enable_audio = xyes -a x$enable_alsa = xyes; then + have_alsa=no + AC_CHECK_HEADER(sys/asoundlib.h, have_alsa_hdr=yes) + AC_CHECK_LIB(asound, snd_pcm_open, have_alsa_lib=yes) + if test x$have_alsa_hdr = xyes -a x$have_alsa_lib = xyes; then + CFLAGS="$CFLAGS -DALSA_SUPPORT" + SYSTEM_LIBS="$SYSTEM_LIBS -lasound" + AUDIO_SUBDIRS="$AUDIO_SUBDIRS alsa" + AUDIO_DRIVERS="$AUDIO_DRIVERS alsa/libaudio_alsa.la" + fi + fi +} + +dnl Find the ESD includes and libraries +CheckESD() +{ + AC_ARG_ENABLE(esd, +[ --enable-esd support the Enlightened Sound Daemon [default=yes]], + , enable_esd=yes) + if test x$enable_audio = xyes -a x$enable_esd = xyes; then + AM_PATH_ESD(0.2.8, [ + CFLAGS="$CFLAGS -DESD_SUPPORT $ESD_CFLAGS" + SYSTEM_LIBS="$SYSTEM_LIBS $ESD_LIBS" + AUDIO_SUBDIRS="$AUDIO_SUBDIRS esd" + AUDIO_DRIVERS="$AUDIO_DRIVERS esd/libaudio_esd.la" + ]) + fi +} + +CheckARTSC() +{ + AC_ARG_ENABLE(arts, +[ --enable-arts support the Analog Real Time Synthesizer [default=yes]], + , enable_arts=yes) + if test x$enable_audio = xyes -a x$enable_arts = xyes; then + AC_PATH_PROG(ARTSCCONFIG, artsc-config) + if test x$ARTSCCONFIG = x -o x$ARTSCCONFIG = x'"$ARTSCCONFIG"'; then + : # arts isn't installed + else + ARTSC_CFLAGS=`$ARTSCCONFIG --cflags` + ARTSC_LIBS=`$ARTSCCONFIG --libs` + AC_MSG_CHECKING(for aRts development environment) + audio_arts=no + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $ARTSC_CFLAGS" + AC_TRY_COMPILE([ + #include + ],[ + arts_stream_t stream; + ],[ + audio_arts=yes + ]) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT($audio_arts) + if test x$audio_arts = xyes; then + CFLAGS="$CFLAGS -DARTSC_SUPPORT $ARTSC_CFLAGS" + SYSTEM_LIBS="$SYSTEM_LIBS $ARTSC_LIBS" + AUDIO_SUBDIRS="$AUDIO_SUBDIRS arts" + AUDIO_DRIVERS="$AUDIO_DRIVERS arts/libaudio_arts.la" + fi + fi + fi +} + +dnl See if the NAS audio interface is supported +CheckNAS() +{ + AC_ARG_ENABLE(nas, +[ --enable-nas support the NAS audio API [default=yes]], + , enable_nas=yes) + if test x$enable_audio = xyes -a x$enable_nas = xyes; then + AC_MSG_CHECKING(for NAS audio support) + have_nas=no + if test -r /usr/X11R6/include/audio/audiolib.h ; then + have_nas=yes + fi + AC_MSG_RESULT($have_nas) + if test x$have_nas = xyes; then + CFLAGS="$CFLAGS -DNAS_SUPPORT" + SYSTEM_LIBS="$SYSTEM_LIBS -laudio -lXt" + AUDIO_SUBDIRS="$AUDIO_SUBDIRS nas" + AUDIO_DRIVERS="$AUDIO_DRIVERS nas/libaudio_nas.la" + fi + fi +} + +dnl See if we can use x86 assembly blitters +CheckNASM() +{ + dnl Make sure we are running on an x86 platform + case $target in + i?86*) + ;; + *) + # Nope, bail early. + return + ;; + esac + dnl Check for NASM (for assembly blit routines) + AC_ARG_ENABLE(nasm, +[ --enable-nasm use nasm assembly blitters on x86 [default=yes]], + , enable_nasm=yes) + if test x$enable_video = xyes -a x$enable_nasm = xyes; then + AC_PATH_PROG(NASM, nasm) + if test x$NASM = x -o x$NASM = x'"$NASM"'; then + : # nasm isn't installed + else + CFLAGS="$CFLAGS -DUSE_ASMBLIT -I$srcdir/hermes" + case $ARCH in + win32) + NASMFLAGS="-f win32" + ;; + *) + NASMFLAGS="-f elf" + ;; + esac + AC_SUBST(NASMFLAGS) + CFLAGS="$CFLAGS -I\$(top_srcdir)/src/hermes" + SDL_EXTRADIRS="$SDL_EXTRADIRS hermes" + SDL_EXTRALIBS="$SDL_EXTRALIBS hermes/libhermes.la" + fi + fi +} + +dnl Find the X11 include and library directories +CheckX11() +{ + AC_ARG_ENABLE(video-x11, +[ --enable-video-x11 use X11 video driver [default=yes]], + , enable_video_x11=yes) + if test x$enable_video = xyes -a x$enable_video_x11 = xyes; then + AC_PATH_X + AC_PATH_XTRA + if test x$have_x = xyes; then + CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_X11" + if test x$ac_cv_func_shmat != xyes; then + CFLAGS="$CFLAGS -DNO_SHARED_MEMORY" + fi + SYSTEM_LIBS="$SYSTEM_LIBS $X_LIBS -lX11 -lXext" + VIDEO_SUBDIRS="$VIDEO_SUBDIRS x11" + VIDEO_DRIVERS="$VIDEO_DRIVERS x11/libvideo_x11.la" + + AC_ARG_ENABLE(video-x11-vm, +[ --enable-video-x11-vm use X11 VM extension for fullscreen [default=yes]], + , enable_video_x11_vm=yes) + if test x$enable_video_x11_vm = xyes; then + AC_MSG_CHECKING(for XFree86 VidMode 1.0 support) + video_x11_vm=no + AC_TRY_COMPILE([ + #include + #include + ],[ + ],[ + video_x11_vm=yes + ]) + AC_MSG_RESULT($video_x11_vm) + if test x$video_x11_vm = xyes; then + CFLAGS="$CFLAGS -DXFREE86_VM" + # Check for nasty XFree86 4.0/Glide hack + AC_ARG_ENABLE(xfree86_glidehack, +[ --enable-xfree86-glidehack Alternate vidmode lib for old Glide [default=no]], + , enable_xfreeglidehack=no) + if test x$enable_xfree86_glidehack = xyes; then + ac_save_libs="$LIBS" + LIBS="$LIBS $X_LIBS -lX11 -lXext" + if test x$xfree86_glidehack = x; then + AC_CHECK_LIB(Xxf86vm, XF40VidModeQueryExtension, xfree86_glidehack=Xxf86vm) + fi + if test x$xfree86_glidehack = x; then + AC_CHECK_LIB(Xxf86vm40, XF40VidModeQueryExtension, xfree86_glidehack=Xxf86vm40) + fi + LIBS="$ac_save_libs" + fi + if test x$xfree86_glidehack != x; then + CFLAGS="$CFLAGS -DXFREE86_VM_DYNAMIC_HACK" + SYSTEM_LIBS="$SYSTEM_LIBS -l$xfree86_glidehack" + else + SYSTEM_LIBS="$SYSTEM_LIBS -lXxf86vm" + fi + AC_MSG_CHECKING(for XFree86 VidMode gamma support) + video_x11_vmgamma=no + AC_TRY_COMPILE([ + #include + #include + ],[ + XF86VidModeGamma gamma; + ],[ + video_x11_vmgamma=yes + ]) + AC_MSG_RESULT($video_x11_vmgamma) + if test x$video_x11_vmgamma = xyes; then + CFLAGS="$CFLAGS -DXFREE86_VMGAMMA" + fi + fi + fi + AC_ARG_ENABLE(video-x11-dgamouse, +[ --enable-video-x11-dgamouse use X11 DGA for mouse events [default=yes]], + , enable_video_x11_dgamouse=yes) + AC_MSG_CHECKING(for XFree86 DGA 1.0 support) + video_x11_dga=no + AC_TRY_COMPILE([ + #include + #include + ],[ + ],[ + video_x11_dga=yes + ]) + AC_MSG_RESULT($video_x11_dga) + if test x$video_x11_dga = xyes; then + CFLAGS="$CFLAGS -DXFREE86_DGAMOUSE" + if test x$enable_video_x11_dgamouse = xyes; then + CFLAGS="$CFLAGS -DDEFAULT_DGAMOUSE" + fi + SYSTEM_LIBS="$SYSTEM_LIBS -lXxf86dga" + fi + AC_ARG_ENABLE(video-x11-xv, +[ --enable-video-x11-xv use X11 XvImage extension for video [default=yes]], + , enable_video_x11_xv=yes) + if test x$enable_video_x11_xv = xyes; then + AC_MSG_CHECKING(for XFree86 XvImage support) + video_x11_xv=no + AC_TRY_COMPILE([ + #include + #include + #include + #include + #include + ],[ + XvImage *image; + ],[ + video_x11_xv=yes + ]) + AC_MSG_RESULT($video_x11_xv) + if test x$video_x11_xv = xyes; then + CFLAGS="$CFLAGS -DXFREE86_XV" + SYSTEM_LIBS="$SYSTEM_LIBS -lXv" + fi + fi + fi + fi +} +CheckPHOTON() +{ + AC_ARG_ENABLE(video-photon, +[ --enable-video-photon use QNX Photonvideo driver [default=yes]], + , enable_video_photon=yes) + if test x$enable_video = xyes -a x$enable_video_photon = xyes; then + AC_MSG_CHECKING(for QNX Photon support) + video_photon=no + AC_TRY_COMPILE([ + #include + #include + #include + #include + ],[ + PgDisplaySettings_t *visual; + ],[ + video_photon=yes + ]) + AC_MSG_RESULT($video_photon) + if test x$video_photon = xyes; then + SYSTEM_LIBS="$SYSTEM_LIBS -lph" + VIDEO_SUBDIRS="$VIDEO_SUBDIRS photon" + VIDEO_DRIVERS="$VIDEO_DRIVERS photon/libvideo_photon.la" + fi + fi +} + +dnl Find the X11 DGA 2.0 include and library directories +CheckDGA() +{ + AC_ARG_ENABLE(video-dga, +[ --enable-video-dga use DGA 2.0 video driver [default=yes]], + , enable_video_dga=yes) + if test x$video_x11_dga = xyes -a x$enable_video_dga = xyes; then + AC_MSG_CHECKING(for XFree86 DGA 2.0 support) + video_x11_dga2=no + AC_TRY_COMPILE([ + #include + #include + ],[ + XDGAEvent xevent; + ],[ + video_x11_dga2=yes + ]) + AC_MSG_RESULT($video_x11_dga2) + if test x$video_x11_dga2 = xyes; then + CFLAGS="$CFLAGS -DENABLE_DGA" + VIDEO_SUBDIRS="$VIDEO_SUBDIRS dga" + VIDEO_DRIVERS="$VIDEO_DRIVERS dga/libvideo_dga.la" + fi + fi +} + +dnl Find the framebuffer console includes +CheckFBCON() +{ + AC_ARG_ENABLE(video-fbcon, +[ --enable-video-fbcon use framebuffer console video driver [default=yes]], + , enable_video_fbcon=yes) + if test x$enable_video = xyes -a x$enable_video_fbcon = xyes; then + AC_MSG_CHECKING(for framebuffer console support) + video_fbcon=no + AC_TRY_COMPILE([ + #include + #include + #include + ],[ + ],[ + video_fbcon=yes + ]) + AC_MSG_RESULT($video_fbcon) + if test x$video_fbcon = xyes; then + CFLAGS="$CFLAGS -DENABLE_FBCON" + VIDEO_SUBDIRS="$VIDEO_SUBDIRS fbcon" + VIDEO_DRIVERS="$VIDEO_DRIVERS fbcon/libvideo_fbcon.la" + fi + fi +} + +dnl Find the GGI includes +CheckGGI() +{ + AC_ARG_ENABLE(video-ggi, +[ --enable-video-ggi use GGI video driver [default=no]], + , enable_video_ggi=no) + if test x$enable_video = xyes -a x$enable_video_ggi = xyes; then + AC_MSG_CHECKING(for GGI support) + video_ggi=no + AC_TRY_COMPILE([ + #include + #include + ],[ + ],[ + video_ggi=yes + ]) + AC_MSG_RESULT($video_ggi) + if test x$video_ggi = xyes; then + CFLAGS="$CFLAGS $X_CFLAGS -DENABLE_GGI" + SYSTEM_LIBS="$SYSTEM_LIBS -lggi -lgii -lgg" + + VIDEO_SUBDIRS="$VIDEO_SUBDIRS ggi" + VIDEO_DRIVERS="$VIDEO_DRIVERS ggi/libvideo_ggi.la" + fi + fi +} + +dnl Find the SVGAlib includes and libraries +CheckSVGA() +{ + AC_ARG_ENABLE(video-svga, +[ --enable-video-svga use SVGAlib video driver [default=no]], + , enable_video_svga=no) + if test x$enable_video = xyes -a x$enable_video_svga = xyes; then + AC_MSG_CHECKING(for SVGAlib (1.4.0+) support) + video_svga=no + AC_TRY_COMPILE([ + #include + #include + #include + ],[ + if ( SCANCODE_RIGHTWIN && SCANCODE_LEFTWIN ) { + exit(0); + } + ],[ + video_svga=yes + ]) + AC_MSG_RESULT($video_svga) + if test x$video_svga = xyes; then + CFLAGS="$CFLAGS -DENABLE_SVGALIB" + SYSTEM_LIBS="$SYSTEM_LIBS -lvga" + + VIDEO_SUBDIRS="$VIDEO_SUBDIRS svga" + VIDEO_DRIVERS="$VIDEO_DRIVERS svga/libvideo_svga.la" + fi + fi +} + +dnl Find the AAlib includes +CheckAAlib() +{ + AC_ARG_ENABLE(video-aalib, +[ --enable-video-aalib use AAlib video driver [default=no]], + , enable_video_aalib=no) + if test x$enable_video = xyes -a x$enable_video_aalib = xyes; then + AC_MSG_CHECKING(for AAlib support) + video_aalib=no + AC_TRY_COMPILE([ + #include + ],[ + ],[ + video_aalib=yes + ]) + AC_MSG_RESULT($video_aalib) + if test x$video_aalib = xyes; then + CFLAGS="$CFLAGS -DENABLE_AALIB" + SYSTEM_LIBS="$SYSTEM_LIBS -laa" + + VIDEO_SUBDIRS="$VIDEO_SUBDIRS aalib" + VIDEO_DRIVERS="$VIDEO_DRIVERS aalib/libvideo_aa.la" + fi + fi +} + +dnl Check to see if OpenGL support is desired +AC_ARG_ENABLE(video-opengl, +[ --enable-video-opengl include OpenGL context creation [default=yes]], + , enable_video_opengl=yes) + +dnl Find OpenGL +CheckOpenGL() +{ + if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then + AC_MSG_CHECKING(for OpenGL (GLX) support) + video_opengl=no + AC_TRY_COMPILE([ + #include + #include + #include /* For loading extensions */ + ],[ + ],[ + video_opengl=yes + ]) + AC_MSG_RESULT($video_opengl) + if test x$video_opengl = xyes; then + CFLAGS="$CFLAGS -DHAVE_OPENGL" + AC_CHECK_LIB(dl, dlopen, SYSTEM_LIBS="$SYSTEM_LIBS -ldl") + fi + fi +} + +dnl Check for BeOS OpenGL +CheckBeGL() +{ + if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then + CFLAGS="$CFLAGS -DHAVE_OPENGL" + SYSTEM_LIBS="$SYSTEM_LIBS -lGL" + fi +} + +dnl Check for MacOS OpenGL +CheckMacGL() +{ + if test x$enable_video = xyes -a x$enable_video_opengl = xyes; then + CFLAGS="$CFLAGS -DHAVE_OPENGL" + case "$target" in + *-*-darwin*) + SDL_LIBS="$SDL_LIBS -framework OpenGL -framework AGL" + esac + fi +} + +dnl See if we can use the new unified event interface in Linux 2.4 +CheckInputEvents() +{ + dnl Check for Linux 2.4 unified input event interface support + AC_ARG_ENABLE(input-events, +[ --enable-input-events use Linux 2.4 unified input interface [default=yes]], + , enable_input_events=yes) + if test x$enable_input_events = xyes; then + AC_MSG_CHECKING(for Linux 2.4 unified input interface) + use_input_events=no + AC_TRY_COMPILE([ + #include + ],[ + #ifndef EVIOCGNAME + #error EVIOCGNAME() ioctl not available + #endif + ],[ + use_input_events=yes + ]) + AC_MSG_RESULT($use_input_events) + if test x$use_input_events = xyes; then + CFLAGS="$CFLAGS -DUSE_INPUT_EVENTS" + fi + fi +} + +dnl See what type of thread model to use on Linux and Solaris +CheckPTHREAD() +{ + dnl Check for pthread support + AC_ARG_ENABLE(pthreads, +[ --enable-pthreads use POSIX threads for multi-threading [default=yes]], + , enable_pthreads=yes) + dnl This is used on Linux for glibc binary compatibility (Doh!) + AC_ARG_ENABLE(pthread-sem, +[ --enable-pthread-sem use pthread semaphores [default=yes]], + , enable_pthread_sem=yes) + ac_save_libs="$LIBS" + case "$target" in + *-*-bsdi*) + pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" + pthread_lib="" + ;; + *-*-darwin*) + pthread_cflags="-D_THREAD_SAFE" +# causes Carbon.p complaints? +# pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" + ;; + *-*-freebsd*) + pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" + pthread_lib="-pthread" + ;; + *-*-openbsd*) + pthread_cflags="-D_REENTRANT" + pthread_lib="-pthread" + ;; + *-*-solaris*) + pthread_cflags="-D_REENTRANT" + pthread_lib="-lpthread -lposix4" + ;; + *-*-sysv5*) + pthread_cflags="-D_REENTRANT -Kthread" + pthread_lib="" + ;; + *-*-irix*) + pthread_cflags="-D_SGI_MP_SOURCE" + pthread_lib="-lpthread" + ;; + *-*-aix*) + pthread_cflags="-D_REENTRANT -mthreads" + pthread_lib="-lpthread" + ;; + *-*-qnx*) + pthread_cflags="" + pthread_lib="" + ;; + *) + pthread_cflags="-D_REENTRANT" + pthread_lib="-lpthread" + ;; + esac + LIBS="$LIBS $pthread_lib" + if test x$enable_threads = xyes -a x$enable_pthreads = xyes; then + AC_MSG_CHECKING(for pthreads) + use_pthreads=no + AC_TRY_LINK([ + #include + ],[ + pthread_attr_t type; + pthread_attr_init(&type); + ],[ + use_pthreads=yes + ]) + AC_MSG_RESULT($use_pthreads) + if test x$use_pthreads = xyes; then + CFLAGS="$CFLAGS $pthread_cflags -DSDL_USE_PTHREADS" + SDL_CFLAGS="$SDL_CFLAGS $pthread_cflags" + SDL_LIBS="$SDL_LIBS $pthread_lib" + + # Check to see if recursive mutexes are available + AC_MSG_CHECKING(for recursive mutexes) + has_recursive_mutexes=no + AC_TRY_LINK([ + #include + ],[ + pthread_mutexattr_t attr; + #ifdef linux + pthread_mutexattr_setkind_np(&attr, PTHREAD_MUTEX_RECURSIVE_NP); + #else + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + #endif + ],[ + has_recursive_mutexes=yes + ]) + # Some systems have broken recursive mutex implementations + case "$target" in + *-*-solaris*) + has_recursive_mutexes=no + ;; + esac + AC_MSG_RESULT($has_recursive_mutexes) + if test x$has_recursive_mutexes != xyes; then + CFLAGS="$CFLAGS -DPTHREAD_NO_RECURSIVE_MUTEX" + fi + + # Check to see if this is broken glibc 2.0 pthreads + case "$target" in + *-*-linux*) + AC_MSG_CHECKING(for broken glibc 2.0 pthreads) + glibc20_pthreads=no + AC_TRY_COMPILE([ + #include + #if (__GLIBC__ == 2) && (__GLIBC_MINOR__ == 0) + #warning Working around a bug in glibc 2.0 pthreads + #else + #error pthread implementation okay + #endif /* glibc 2.0 */ + ],[ + ],[ + glibc20_pthreads=yes + ]) + AC_MSG_RESULT($glibc20_pthreads) + esac + fi + fi + LIBS="$ac_save_libs" + + AC_MSG_CHECKING(whether semun is defined in /usr/include/sys/sem.h) + have_semun=no + AC_TRY_COMPILE([ + #include + #include + ],[ + union semun t; + ],[ + have_semun=yes + ]) + AC_MSG_RESULT($have_semun) + if test x$have_semun = xyes; then + CFLAGS="$CFLAGS -DHAVE_SEMUN" + fi + + # See if we can use clone() on Linux directly + use_clone=no + if test x$enable_threads = xyes -a x$use_pthreads != xyes; then + case "$target" in + *-*-linux*) + use_clone=yes + ;; + *) + CFLAGS="$CFLAGS -DFORK_HACK" + ;; + esac + fi + AM_CONDITIONAL(USE_CLONE, test x$use_clone = xyes) +} + +dnl Determine whether the compiler can produce Win32 executables +CheckWIN32() +{ + AC_MSG_CHECKING(Win32 compiler) + have_win32_gcc=no + AC_TRY_COMPILE([ + #include + ],[ + ],[ + have_win32_gcc=yes + ]) + AC_MSG_RESULT($have_win32_gcc) + if test x$have_win32_gcc != xyes; then + AC_MSG_ERROR([ +*** Your compiler ($CC) does not produce Win32 executables! + ]) + fi + + dnl See if the user wants to redirect standard output to files + AC_ARG_ENABLE(stdio-redirect, +[ --enable-stdio-redirect Redirect STDIO to files on Win32 [default=yes]], + , enable_stdio_redirect=yes) + if test x$enable_stdio_redirect != xyes; then + CFLAGS="$CFLAGS -DNO_STDIO_REDIRECT" + fi +} + +dnl Find the DirectX includes and libraries +CheckDIRECTX() +{ + AC_ARG_ENABLE(directx, +[ --enable-directx use DirectX for Win32 audio/video [default=yes]], + , enable_directx=yes) + if test x$enable_directx = xyes; then + AC_MSG_CHECKING(for DirectX headers and libraries) + use_directx=no + AC_TRY_COMPILE([ + #include "src/video/windx5/directx.h" + ],[ + ],[ + use_directx=yes + ]) + AC_MSG_RESULT($use_directx) + fi + AM_CONDITIONAL(USE_DIRECTX, test x$use_directx = xyes) + + CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video/wincommon" + SYSTEM_LIBS="$SYSTEM_LIBS -luser32 -lgdi32 -lwinmm" + VIDEO_SUBDIRS="$VIDEO_SUBDIRS wincommon" + VIDEO_DRIVERS="$VIDEO_DRIVERS wincommon/libvideo_wincommon.la" + # Enable the DIB driver + CFLAGS="$CFLAGS -DENABLE_WINDIB" + VIDEO_SUBDIRS="$VIDEO_SUBDIRS windib" + VIDEO_DRIVERS="$VIDEO_DRIVERS windib/libvideo_windib.la" + # See if we should enable the DirectX driver + if test x$use_directx = xyes; then + CFLAGS="$CFLAGS -DENABLE_DIRECTX" + SYSTEM_LIBS="$SYSTEM_LIBS -ldxguid" + VIDEO_SUBDIRS="$VIDEO_SUBDIRS windx5" + VIDEO_DRIVERS="$VIDEO_DRIVERS windx5/libvideo_windx5.la" + fi +} + +dnl Set up the BWindow video driver on BeOS +CheckBWINDOW() +{ + CFLAGS="$CFLAGS -DENABLE_BWINDOW" + VIDEO_SUBDIRS="$VIDEO_SUBDIRS bwindow" + VIDEO_DRIVERS="$VIDEO_DRIVERS bwindow/libvideo_bwindow.la" +} + +dnl Set up the Mac toolbox video driver for Mac OS 7-9 +CheckTOOLBOX() +{ + VIDEO_SUBDIRS="$VIDEO_SUBDIRS maccommon" + VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la" + VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom" + VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la" +} + +dnl Set up the Mac toolbox video driver for Mac OS X +CheckCARBON() +{ + # "MACOSX" is not an official definition, but it's commonly + # accepted as a way to differentiate between what runs on X + # and what runs on older Macs - while in theory "Carbon" defns + # are consistent between the two, in practice Carbon is still + # changing. -sts Aug 2000 + mac_autoconf_target_workaround="MAC" + CFLAGS="$CFLAGS -I/System/Library/Frameworks/Carbon.framework/Headers \ + -fpascal-strings -DENABLE_TOOLBOX -DMACOSX -DTARGET_API_${mac_autoconf_target_workaround}_CARBON=1 -I\$(top_srcdir)/src/video/maccommon -I\$(top_srcdir)/src/video/macrom -I\$(top_srcdir)/src/video/macdsp" + VIDEO_SUBDIRS="$VIDEO_SUBDIRS maccommon" + VIDEO_DRIVERS="$VIDEO_DRIVERS maccommon/libvideo_maccommon.la" + VIDEO_SUBDIRS="$VIDEO_SUBDIRS macrom" + VIDEO_DRIVERS="$VIDEO_DRIVERS macrom/libvideo_macrom.la" +} + +dnl Set up the kernel statistics library for Solaris +CheckKSTAT() +{ + CFLAGS="$CFLAGS -DHAVE_KSTAT" + SYSTEM_LIBS="$SYSTEM_LIBS -lkstat" +} + +case "$target" in + *-*-linux*) + ARCH=linux + CheckNASM + CheckOSS + CheckALSA + CheckARTSC + CheckESD + CheckNAS + CheckX11 + CheckDGA + CheckFBCON + CheckGGI + CheckSVGA + CheckAAlib + CheckOpenGL + CheckInputEvents + CheckPTHREAD + # Set up files for the main() stub + COPY_ARCH_SRC(src/main, linux, SDL_main.c) + # Set up files for the audio library + # We use the OSS and ALSA API's, not the Sun audio API + #if test x$enable_audio = xyes; then + # AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun" + # AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la" + #fi + # Set up files for the joystick library + if test x$enable_joystick = xyes; then + JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS linux" + JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS linux/libjoystick_linux.la" + fi + # Set up files for the cdrom library + if test x$enable_cdrom = xyes; then + COPY_ARCH_SRC(src/cdrom, linux, SDL_syscdrom.c) + fi + # Set up files for the thread library + if test x$enable_threads = xyes; then + if test x$use_pthreads != xyes; then + COPY_ARCH_SRC(src/thread, linux, clone.S) + fi + COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c) + COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h) + if test x$use_pthreads = xyes -a x$enable_pthread_sem != xyes; then + COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c) + else + COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c) + fi + COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h) + if test x$glibc20_pthreads = xyes; then + COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c) + COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h) + else + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h) + fi + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c) + fi + ;; + *-*-bsdi*) + ARCH=bsdi + CheckNASM + CheckOSS + CheckNAS + CheckX11 + CheckDGA + CheckSVGA + CheckAAlib + CheckOpenGL + CheckPTHREAD + # Set up files for the main() stub + COPY_ARCH_SRC(src/main, linux, SDL_main.c) + # Set up files for the joystick library + # (No joystick support yet) + if test x$enable_joystick = xyes; then + JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy" + JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la" + fi + # Set up files for the cdrom library + # (No cdrom support yet) + if test x$enable_cdrom = xyes; then + COPY_ARCH_SRC(src/cdrom, dummy, SDL_syscdrom.c) + fi + # Set up files for the thread library + if test x$enable_threads = xyes; then + COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c) + COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h) + COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h) + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c) + fi + ;; + *-*-freebsd*) + ARCH=freebsd + CheckNASM + CheckOSS + CheckARTSC + CheckESD + CheckNAS + CheckX11 + CheckDGA + CheckSVGA + CheckAAlib + CheckOpenGL + CheckPTHREAD + # Set up files for the main() stub + COPY_ARCH_SRC(src/main, linux, SDL_main.c) + # Set up files for the audio library + # We use the OSS and ALSA API's, not the Sun audio API + #if test x$enable_audio = xyes; then + # AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun" + # AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la" + #fi + # Set up files for the joystick library + # (No joystick support yet) + if test x$enable_joystick = xyes; then + JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy" + JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la" + fi + # Set up files for the cdrom library + if test x$enable_cdrom = xyes; then + COPY_ARCH_SRC(src/cdrom, freebsd, SDL_syscdrom.c) + fi + # Set up files for the thread library + if test x$enable_threads = xyes; then + COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c) + COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h) + if test x$use_pthreads = xyes -a x$enable_pthread_sem != xyes; then + COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c) + else + COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c) + fi + COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h) + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c) + fi + ;; + *-*-netbsd*) + ARCH=netbsd + CheckNASM + CheckOSS + CheckARTSC + CheckESD + CheckNAS + CheckX11 + CheckAAlib + CheckOpenGL + CheckPTHREAD + # Set up files for the main() stub + COPY_ARCH_SRC(src/main, linux, SDL_main.c) + # Set up files for the audio library + if test x$enable_audio = xyes; then + AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun" + AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la" + fi + # Set up files for the joystick library + # (No joystick support yet) + if test x$enable_joystick = xyes; then + JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy" + JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la" + fi + # Set up files for the cdrom library + if test x$enable_cdrom = xyes; then + COPY_ARCH_SRC(src/cdrom, openbsd, SDL_syscdrom.c) + fi + # Set up files for the thread library + if test x$enable_threads = xyes; then + COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c) + COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h) + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c) + fi + # NetBSD does not define "unix" + CFLAGS="$CFLAGS -Dunix" + ;; + *-*-openbsd*) + ARCH=openbsd + CheckNASM + CheckOSS + CheckARTSC + CheckESD + CheckNAS + CheckX11 + CheckAAlib + CheckOpenGL + CheckPTHREAD + # Set up files for the main() stub + COPY_ARCH_SRC(src/main, linux, SDL_main.c) + # Set up files for the audio library + if test x$enable_audio = xyes; then + AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun" + AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la" + fi + # Set up files for the joystick library + # (No joystick support yet) + if test x$enable_joystick = xyes; then + JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy" + JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la" + fi + # Set up files for the cdrom library + if test x$enable_cdrom = xyes; then + COPY_ARCH_SRC(src/cdrom, openbsd, SDL_syscdrom.c) + fi + # Set up files for the thread library + if test x$enable_threads = xyes; then + COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c) + COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h) + if test x$use_pthreads = xyes -a x$enable_pthread_sem != xyes; then + COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c) + else + COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c) + fi + COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h) + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c) + fi + ;; + *-*-sysv5*) + ARCH=sysv5 + CheckNASM + CheckOSS + CheckARTSC + CheckESD + CheckNAS + CheckX11 + CheckAAlib + CheckOpenGL + CheckPTHREAD + CheckKSTAT + # Set up files for the main() stub + COPY_ARCH_SRC(src/main, linux, SDL_main.c) + # Set up files for the audio library + if test x$enable_audio = xyes; then + AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun" + AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la" + fi + # Set up files for the joystick library + # (No joystick support yet) + if test x$enable_joystick = xyes; then + JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy" + JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la" + fi + # Set up files for the cdrom library + if test x$enable_cdrom = xyes; then + COPY_ARCH_SRC(src/cdrom, dummy, SDL_syscdrom.c) + fi + # Set up files for the thread library + if test x$enable_threads = xyes; then + COPY_ARCH_SRC(src/thread, generic, SDL_systhread.c) + COPY_ARCH_SRC(src/thread, generic, SDL_systhread_c.h) + COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c) + COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h) + COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h) + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c) + fi + ;; + *-*-solaris*) + ARCH=solaris + CheckNASM + CheckARTSC + CheckESD + CheckNAS + CheckX11 + CheckAAlib + CheckOpenGL + CheckPTHREAD + CheckKSTAT + # Set up files for the main() stub + COPY_ARCH_SRC(src/main, linux, SDL_main.c) + # Set up files for the audio library + if test x$enable_audio = xyes; then + AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun" + AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la" + fi + # Set up files for the joystick library + # (No joystick support yet) + if test x$enable_joystick = xyes; then + JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy" + JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la" + fi + # Set up files for the cdrom library + if test x$enable_cdrom = xyes; then + COPY_ARCH_SRC(src/cdrom, linux, SDL_syscdrom.c) + fi + # Set up files for the thread library + if test x$enable_threads = xyes; then + COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c) + COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h) + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c) + fi + ;; + *-*-irix*) + ARCH=irix + CheckNAS + CheckX11 + CheckAAlib + CheckOpenGL + CheckPTHREAD + # Set up files for the main() stub + COPY_ARCH_SRC(src/main, linux, SDL_main.c) + # Set up files for the audio library + if test x$enable_audio = xyes; then + AUDIO_SUBDIRS="$AUDIO_SUBDIRS dmedia" + AUDIO_DRIVERS="$AUDIO_DRIVERS dmedia/libaudio_dmedia.la" + LIBS="$LIBS -laudio" + fi + # Set up files for the joystick library + # (No joystick support yet) + if test x$enable_joystick = xyes; then + JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy" + JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la" + fi + # Set up files for the cdrom library + # (No CD-ROM support yet) + if test x$enable_cdrom = xyes; then + COPY_ARCH_SRC(src/cdrom, dummy, SDL_syscdrom.c) + fi + # Set up files for the thread library + if test x$enable_threads = xyes; then + if test x$use_pthreads = xyes; then + COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c) + COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h) + if test x$enable_pthread_sem != xyes; then + COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c) + else + COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c) + fi + COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h) + else + COPY_ARCH_SRC(src/thread, irix, SDL_systhread.c) + COPY_ARCH_SRC(src/thread, irix, SDL_systhread_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h) + fi + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c) + fi + ;; + *-*-hpux*) + ARCH=hpux + CheckNAS + CheckX11 + CheckGGI + CheckAAlib + CheckOpenGL + CheckPTHREAD + # Set up files for the main() stub + COPY_ARCH_SRC(src/main, linux, SDL_main.c) + # Set up files for the audio library + if test x$enable_audio = xyes; then + AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun" + AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la" + fi + # Set up files for the joystick library + # (No joystick support yet) + if test x$enable_joystick = xyes; then + JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy" + JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la" + fi + # Set up files for the cdrom library + # (No CD-ROM support yet) + if test x$enable_cdrom = xyes; then + COPY_ARCH_SRC(src/cdrom, dummy, SDL_syscdrom.c) + fi + # Set up files for the thread library + if test x$enable_threads = xyes; then + COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c) + COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h) + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c) + fi + ;; + *-*-aix*) + ARCH=aix + CheckNAS + CheckX11 + CheckGGI + CheckAAlib + CheckOpenGL + CheckPTHREAD + # Set up files for the main() stub + COPY_ARCH_SRC(src/main, linux, SDL_main.c) + # Set up files for the audio library + if test x$enable_audio = xyes; then + AUDIO_SUBDIRS="$AUDIO_SUBDIRS paudio" + AUDIO_DRIVERS="$AUDIO_DRIVERS paudio/libaudio_paudio.la" + fi + # Set up files for the joystick library + # (No joystick support yet) + if test x$enable_joystick = xyes; then + JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy" + JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la" + fi + # Set up files for the cdrom library + if test x$enable_cdrom = xyes; then + COPY_ARCH_SRC(src/cdrom, aix, SDL_syscdrom.c) + fi + # Set up files for the thread library + if test x$enable_threads = xyes; then + COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c) + COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h) + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c) + fi + ;; + *-*-osf*) + ARCH=osf + CheckNAS + CheckX11 + CheckGGI + CheckAAlib + CheckOpenGL + CheckPTHREAD + # Set up files for the main() stub + COPY_ARCH_SRC(src/main, linux, SDL_main.c) + # Set up files for the audio library + if test x$enable_audio = xyes; then + AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun" + AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la" + fi + # Set up files for the joystick library + # (No joystick support yet) + if test x$enable_joystick = xyes; then + JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy" + JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la" + fi + # Set up files for the cdrom library + # (No cdrom support yet) + if test x$enable_cdrom = xyes; then + COPY_ARCH_SRC(src/cdrom, dummy, SDL_syscdrom.c) + fi + # Set up files for the thread library + if test x$enable_threads = xyes; then + COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c) + COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h) + COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h) + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c) + fi + ;; + *-*-qnx*) + ARCH=qnx + CheckNAS + CheckPHOTON + CheckX11 + CheckOpenGL + CheckPTHREAD + # Set up files for the main() stub + COPY_ARCH_SRC(src/main, linux, SDL_main.c) + # Set up files for the audio library + if test x$enable_audio = xyes; then + CFLAGS="$CFLAGS -DALSA_SUPPORT" + SYSTEM_LIBS="$SYSTEM_LIBS -lasound" + AUDIO_SUBDIRS="$AUDIO_SUBDIRS nto" + AUDIO_DRIVERS="$AUDIO_DRIVERS nto/libaudio_nto.la" + AUDIO_SUBDIRS="$AUDIO_SUBDIRS sun" + AUDIO_DRIVERS="$AUDIO_DRIVERS sun/libaudio_sun.la" + fi + # Set up files for the joystick library + if test x$enable_joystick = xyes; then + # (No joystick support yet) + JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy" + JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la" + fi + # Set up files for the cdrom library + if test x$enable_cdrom = xyes; then + COPY_ARCH_SRC(src/cdrom, qnx, SDL_syscdrom.c) + fi + # Set up files for the thread library + if test x$enable_threads = xyes; then + COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c) + COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_syscond.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h) + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c) + fi + ;; + *-*-cygwin* | *-*-mingw32*) + ARCH=win32 + if test "$build" != "$target"; then # cross-compiling + # Default cross-compile location + ac_default_prefix=/usr/local/cross-tools/i386-mingw32msvc + else + # Look for the location of the tools and install there + ac_default_prefix=$BUILD_PREFIX + fi + CheckWIN32 + CheckDIRECTX + CheckNASM + # Set up files for the main() stub + COPY_ARCH_SRC(src/main, win32, SDL_main.c) + # Set up files for the audio library + if test x$enable_audio = xyes; then + AUDIO_SUBDIRS="$AUDIO_SUBDIRS windib" + AUDIO_DRIVERS="$AUDIO_DRIVERS windib/libaudio_windib.la" + if test x$use_directx = xyes; then + AUDIO_SUBDIRS="$AUDIO_SUBDIRS windx5" + AUDIO_DRIVERS="$AUDIO_DRIVERS windx5/libaudio_windx5.la" + fi + fi + # Set up files for the joystick library + if test x$enable_joystick = xyes; then + JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS win32" + JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS win32/libjoystick_winmm.la" + fi + # Set up files for the cdrom library + if test x$enable_cdrom = xyes; then + COPY_ARCH_SRC(src/cdrom, win32, SDL_syscdrom.c) + fi + # Set up files for the thread library + if test x$enable_threads = xyes; then + COPY_ARCH_SRC(src/thread, win32, SDL_systhread.c) + COPY_ARCH_SRC(src/thread, win32, SDL_systhread_c.h) + COPY_ARCH_SRC(src/thread, win32, SDL_sysmutex.c) + COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h) + COPY_ARCH_SRC(src/thread, win32, SDL_syssem.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h) + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + COPY_ARCH_SRC(src/timer, win32, SDL_systimer.c) + fi + # The Win32 platform requires special setup + SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main" + SDL_LIBS="-lmingw32 -lSDLmain $SDL_LIBS -mwindows" + ;; + *-*-beos*) + ARCH=beos + ac_default_prefix=/boot/develop/tools/gnupro + CheckNASM + CheckBWINDOW + CheckBeGL + # Set up files for the main() stub + COPY_ARCH_SRC(src/main, linux, SDL_main.c) + COPY_ARCH_SRC(src/main, beos, SDL_BeApp.cc) + COPY_ARCH_SRC(src/main, beos, SDL_BeApp.h) + # Set up files for the audio library + if test x$enable_audio = xyes; then + AUDIO_SUBDIRS="$AUDIO_SUBDIRS baudio" + AUDIO_DRIVERS="$AUDIO_DRIVERS baudio/libaudio_baudio.la" + fi + # Set up files for the joystick library + if test x$enable_joystick = xyes; then + JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS beos" + JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS beos/libjoystick_beos.la" + fi + # Set up files for the cdrom library + if test x$enable_cdrom = xyes; then + COPY_ARCH_SRC(src/cdrom, beos, SDL_syscdrom.c) + fi + # Set up files for the thread library + if test x$enable_threads = xyes; then + COPY_ARCH_SRC(src/thread, beos, SDL_systhread.c) + COPY_ARCH_SRC(src/thread, beos, SDL_systhread_c.h) + COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c) + COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h) + COPY_ARCH_SRC(src/thread, beos, SDL_syssem.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h) + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + COPY_ARCH_SRC(src/timer, beos, SDL_systimer.c) + fi + # The BeOS platform requires special libraries + SYSTEM_LIBS="$SYSTEM_LIBS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding" + ;; + *-*-macos*) + # This would be used if cross-compiling to MacOS 9. No way to + # use it at present, but Apple is working on a X-to-9 compiler + # for which this case would be handy. + ARCH=macos + CheckTOOLBOX + CheckMacGL + # Set up files for the main() stub + COPY_ARCH_SRC(src/main, macos, SDL_main.c) + # Set up files for the audio library + if test x$enable_audio = xyes; then + AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom" + AUDIO_DRIVERS="$AUDIO_DRIVERS macrom/libaudio_macrom.la" + fi + # Set up files for the joystick library + if test x$enable_joystick = xyes; then + JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS macos" + JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS macos/libjoystick_macos.la" + fi + # Set up files for the cdrom library + if test x$enable_cdrom = xyes; then + COPY_ARCH_SRC(src/cdrom, macos, SDL_syscdrom.c) + fi + # Set up files for the thread library + if test x$enable_threads = xyes; then + COPY_ARCH_SRC(src/thread, macos, SDL_systhread.c) + COPY_ARCH_SRC(src/thread, macos, SDL_systhread_c.h) + COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex.c) + COPY_ARCH_SRC(src/thread, generic, SDL_sysmutex_c.h) + COPY_ARCH_SRC(src/thread, macos, SDL_syssem.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h) + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + COPY_ARCH_SRC(src/timer, macos, SDL_systimer.c) + fi + # The MacOS platform requires special setup + SDL_CFLAGS="$SDL_CFLAGS -Dmain=SDL_main" + SDL_LIBS="-lSDLmain $SDL_LIBS" + ;; + *-*-darwin* ) + # Strictly speaking, we want "Mac OS X", not "Darwin", which is + # just the OS X kernel sans upper layers like Carbon. But + # config.guess comes back with "darwin", so go with the flow. + ARCH=macos + CheckCARBON + CheckMacGL + CheckPTHREAD + # Set up files for the main() stub + # COPY_ARCH_SRC(src/main, macos, SDL_main.c) + COPY_ARCH_SRC(src/main, linux, SDL_main.c) + # Set up files for the audio library + if test x$enable_audio = xyes; then + AUDIO_SUBDIRS="$AUDIO_SUBDIRS macrom" + AUDIO_DRIVERS="$AUDIO_DRIVERS macrom/libaudio_macrom.la" + fi + # Set up files for the joystick library + if test x$enable_joystick = xyes; then + JOYSTICK_SUBDIRS="$JOYSTICK_SUBDIRS dummy" + JOYSTICK_DRIVERS="$JOYSTICK_DRIVERS dummy/libjoystick_dummy.la" + fi + # Set up files for the cdrom library + if test x$enable_cdrom = xyes; then + COPY_ARCH_SRC(src/cdrom, dummy, SDL_syscdrom.c) + fi + # Set up files for the thread library + if test x$enable_threads = xyes; then + COPY_ARCH_SRC(src/thread, linux, SDL_systhread.c) + COPY_ARCH_SRC(src/thread, linux, SDL_systhread_c.h) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex.c) + COPY_ARCH_SRC(src/thread, linux, SDL_sysmutex_c.h) + if test x$use_pthreads = xyes -a x$enable_pthread_sem != xyes; then + COPY_ARCH_SRC(src/thread, generic, SDL_syssem.c) + else + COPY_ARCH_SRC(src/thread, linux, SDL_syssem.c) + fi + COPY_ARCH_SRC(src/thread, generic, SDL_syssem_c.h) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond.c) + COPY_ARCH_SRC(src/thread, generic, SDL_syscond_c.h) + fi + # Set up files for the timer library + if test x$enable_timers = xyes; then + COPY_ARCH_SRC(src/timer, linux, SDL_systimer.c) + fi + # The MacOS X platform requires special setup + SDL_CFLAGS="$SDL_CFLAGS -F/System/Library/Frameworks/Carbon.framework" + SDL_LIBS="$SDL_LIBS -framework Carbon" + ;; + *) + AC_MSG_ERROR(Unsupported target: Please add to configure.in) + ;; +esac +AC_SUBST(ARCH) + +# Set the conditional variables for this target +AM_CONDITIONAL(TARGET_LINUX, test $ARCH = linux) +AM_CONDITIONAL(TARGET_SOLARIS, test $ARCH = solaris) +AM_CONDITIONAL(TARGET_IRIX, test $ARCH = irix) +AM_CONDITIONAL(TARGET_BSDI, test $ARCH = bsdi) +AM_CONDITIONAL(TARGET_FREEBSD, test $ARCH = freebsd) +AM_CONDITIONAL(TARGET_OPENBSD, test $ARCH = openbsd) +AM_CONDITIONAL(TARGET_AIX, test $ARCH = aix) +AM_CONDITIONAL(TARGET_WIN32, test $ARCH = win32) +AM_CONDITIONAL(TARGET_BEOS, test $ARCH = beos) +AM_CONDITIONAL(TARGET_MACOS, test $ARCH = macos) + +# Set conditional variables for shared and static library selection. +# These are not used in any Makefile.am but in sdl-config.in. +AM_CONDITIONAL([ENABLE_SHARED], [test "$enable_shared" = yes]) +AM_CONDITIONAL([ENABLE_STATIC], [test "$enable_static" = yes]) + +# Set runtime shared library paths as needed + +if test $ARCH = linux -o $ARCH = freebsd -o $ARCH = bsdi; then + SDL_RLD_FLAGS="-Wl,-rpath,\${exec_prefix}/lib" +fi + +if test $ARCH = solaris; then + SDL_RLD_FLAGS="-R\${exec_prefix}/lib" +fi + +dnl Output the video drivers we use +if test x$enable_video = xtrue; then + if test "$VIDEO_SUBDIRS" = ""; then + AC_MSG_ERROR(*** No video drivers are enabled!) + fi +fi +AC_SUBST(AUDIO_SUBDIRS) +AC_SUBST(AUDIO_DRIVERS) +AC_SUBST(VIDEO_SUBDIRS) +AC_SUBST(VIDEO_DRIVERS) +AC_SUBST(JOYSTICK_SUBDIRS) +AC_SUBST(JOYSTICK_DRIVERS) +AC_SUBST(SDL_EXTRADIRS) +AC_SUBST(SDL_EXTRALIBS) +AC_SUBST(SYSTEM_LIBS) + +dnl Expand the cflags and libraries needed by apps using SDL +AC_SUBST(SDL_CFLAGS) +AC_SUBST(SDL_LIBS) +AC_SUBST(SDL_RLD_FLAGS) + +dnl Expand the libraries needed for static linking +AC_SUBST(SYSTEM_LIBS) +dnl Expand the include directories for building SDL +CFLAGS="$CFLAGS -I\$(top_srcdir)/include" +CFLAGS="$CFLAGS -I\$(top_srcdir)/include/SDL" +CFLAGS="$CFLAGS -I\$(top_srcdir)/src -I\$(top_srcdir)/src/$ARCH" +CFLAGS="$CFLAGS -I\$(top_srcdir)/src/main" +CFLAGS="$CFLAGS -I\$(top_srcdir)/src/audio" +CFLAGS="$CFLAGS -I\$(top_srcdir)/src/video" +CFLAGS="$CFLAGS -I\$(top_srcdir)/src/events" +CFLAGS="$CFLAGS -I\$(top_srcdir)/src/joystick" +CFLAGS="$CFLAGS -I\$(top_srcdir)/src/cdrom" +CFLAGS="$CFLAGS -I\$(top_srcdir)/src/thread" +CFLAGS="$CFLAGS -I\$(top_srcdir)/src/timer" +CFLAGS="$CFLAGS -I\$(top_srcdir)/src/endian" +CFLAGS="$CFLAGS -I\$(top_srcdir)/src/file" +CXXFLAGS="$CFLAGS" + +# Finally create all the generated files +dnl Important: Any directory that you want to be in the distcheck should +dnl have a file listed here, so that configure generates the +dnl subdirectories on the build target. +AC_OUTPUT([ +Makefile +docs/Makefile +docs/html/Makefile +docs/man3/Makefile +include/Makefile +src/Makefile +src/main/Makefile +src/audio/Makefile +src/audio/alsa/Makefile +src/audio/arts/Makefile +src/audio/baudio/Makefile +src/audio/dma/Makefile +src/audio/dmedia/Makefile +src/audio/dsp/Makefile +src/audio/esd/Makefile +src/audio/macrom/Makefile +src/audio/nas/Makefile +src/audio/nto/Makefile +src/audio/paudio/Makefile +src/audio/sun/Makefile +src/audio/ums/Makefile +src/audio/windib/Makefile +src/audio/windx5/Makefile +src/video/Makefile +src/video/cybergfx/Makefile +src/video/x11/Makefile +src/video/dga/Makefile +src/video/fbcon/Makefile +src/video/ggi/Makefile +src/video/maccommon/Makefile +src/video/macdsp/Makefile +src/video/macrom/Makefile +src/video/svga/Makefile +src/video/aalib/Makefile +src/video/wincommon/Makefile +src/video/windib/Makefile +src/video/windx5/Makefile +src/video/bwindow/Makefile +src/video/photon/Makefile +src/events/Makefile +src/joystick/Makefile +src/joystick/beos/Makefile +src/joystick/dummy/Makefile +src/joystick/linux/Makefile +src/joystick/macos/Makefile +src/joystick/win32/Makefile +src/cdrom/Makefile +src/thread/Makefile +src/timer/Makefile +src/endian/Makefile +src/file/Makefile +src/hermes/Makefile +sdl-config +SDL.spec +], [chmod +x sdl-config]) diff -r 000000000000 -r 74212992fb08 docs.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,498 @@ + +SDL Stable Release + + +[separator] +

    +This source is in development. It may contain API changes, and may not be +fully tested on all supported platforms. The current stable release may +be found at the main SDL page. +

    + +

    API Documentation

    +

    + +

    +Major changes since SDL 1.0.0: +

    +
      +
    • 1.2.0: Added initial support for HP-UX (thanks Stephanie) +
    • 1.2.0: Added initial support for BSDI (thanks Kurt) +
    • 1.2.0: Fixed blitting 32-bit ARGB images to SDL_OPENGLBLIT screens +
    • 1.2.0: Fixed automake build dependencies (thanks Markus!) +
    • 1.2.0: Added 24 bpp support to software YUV display functions +
    • 1.2.0: Don't bomb trying to get DGA mouse on XFree86 4.0 +
    • 1.2.0: Added initial support for OSF/Tru64 (thanks Anders) +
    • 1.1.8: Fixed joystick hat motion on MacOS +
    • 1.1.8: Don't detect mouse and keyboard as joystick on MacOS +
    • 1.1.8: Check for OpenGL 1.2 before using 16-bit SDL_OPENGLBLIT +
    • 1.1.8: Added support for /dev/sound/* in Linux 2.4 +
    • 1.1.8: Fixed crash when blitting to RLE encoded surfaces +
    • 1.1.8: Fixed 8-bit audio on MacOS X +
    • 1.1.8: Fixed keyboard handling on MacOS X and MacOS classic +
    • 1.1.8: Fixed mouse cursor visibility when switching apps on MacOS +
    • 1.1.8: Implemented semaphore support on MacOS X +
    • 1.1.8: Worked around broken sem_getvalue() on MacOS X +
    • 1.1.8: Fixed 16-bit big-endian audio on MacOS X and MacOS classic +
    • 1.1.8: Fixed mutex locking on Linux glibc 2.0 +
    • 1.1.8: SDL_Quit() removes the parachute signal handlers +
    • 1.1.8: Added NAS audio server support (thanks Erik!) +
    • 1.1.8: Added SDL_NOFRAME for frameless windows (thanks Andreas) +
    • 1.1.8: Added support for resizable windows on MacOS +
    • 1.1.8: Added a function to query the surface clip rectangle +
    • 1.1.8: Added a function to query the current event filter +
    • 1.1.8: The X11 XVideo adapter is now locked (thanks Jeffrey) +
    • 1.1.8: Improved the speed of fullscreen OpenGL on Windows +
    • 1.1.8: Added ELO touchscreen support for fbcon (thanks Alex) +
    • 1.1.8: Added accelerated MacOS X OpenGL support +
    • 1.1.8: Surface lock and unlock operations can now be nested +
    • 1.1.8: Optimized fillrect for PPC video memory (thanks Mattias) +
    • 1.1.8: Work around "blackout" problem with XVideo acceleration +
    • 1.1.8: Obtain correct key state on X11 focus (thanks Mattias) +
    • 1.1.8: Fixed keyboard handling on the framebuffer console +
    • 1.1.8: Added basic support for VGA16 framebuffer console +
    • 1.1.8: Open a new virtual terminal if possible on fbcon +
    • 1.1.8: Fixed default audio driver on FreeBSD (thanks Maxim) +
    • 1.1.8: Fixed joystick crash on Windows (thanks Pete) +
    • 1.1.7: Expanded documentation from the SDL Documentation Project +
    • 1.1.7: Report X11 client message events if SYSWMEVENTS enabled +
    • 1.1.7: Added support for a single hat on Windows joysticks +
    • 1.1.7: The gamma ramp routines now take arrays of Uint16 values +
    • 1.1.7: Added initial support for QNX RTP (thanks Patrick) +
    • 1.1.7: Added ALSA sound driver (thanks Patrick Trainor) +
    • 1.1.7: Added aRts UNIX sound driver (thanks Neil Stevens) +
    • 1.1.7: Get keyboard modifier state on input focus on Win32 +
    • 1.1.7: SDL_ConvertSurface() now accepts SDL_RLEACCEL as a flag +
    • 1.1.7: Added initial UnixWare 7 support (thanks rr) +
    • 1.1.7: Added working YUY -> RGB conversion code (thanks Eugene) +
    • 1.1.7: Fixed video initialization crash on IRIX +
    • 1.1.7: Fixed MacOS fullscreen palette code (thanks Darrell) +
    • 1.1.7: Fixed background brush flicker on Win32 (thanks Gautier) +
    • 1.1.7: Fixed incorrect pitch when switching to window on Win32 +
    • 1.1.7: Fixed memory leak when switching video modes on Win32 +
    • 1.1.7: Init of fbcon shouldn't automatically set graphics mode +
    • 1.1.6: Allow SDL_VIDEO_INIT when built without thread support +
    • 1.1.6: Fixed palette problems with non-X11 fullscreen displays +
    • 1.1.6: Fixed Win32 crash with SDL_OPENGLBLIT and GL functions +
    • 1.1.6: Improved default MacOS millisecond time resolution +
    • 1.1.6: Fixed X11 overlapping endian blit bug (thanks Mattias) +
    • 1.1.6: Fixed starting directory on BeOS (thanks Samuel) +
    • 1.1.6: Integrated FreeBSD SVGAlib support (thanks folks) +
    • 1.1.6: Fixed middle-button handling on DirectInput +
    • 1.1.6: Added SDL_GetThreadID() to get a specific thread's ID +
    • 1.1.6: Worked around a crash in pthreads on RedHat 7 +
    • 1.1.6: Fixed a brown-bag crash in clipping code +
    • 1.1.5: Convert from '/' to ':' opening files on MacOS +
    • 1.1.5: Clean up empty output files on Win32 and MacOS +
    • 1.1.5: Run command dialog if command key on startup on MacOS +
    • 1.1.5: Initial NetBSD support (thanks Krister Walfridsson) +
    • 1.1.5: Expanded the YUV overlay to handle odd (ATI) hardware +
    • 1.1.5: Fixed MacOS GL attribute selection (thanks Darrell) +
    • 1.1.5: Implemented gamma correction on 8-bit hardware displays +
    • 1.1.5: Performed logical/physical palette split (thanks Mattias) +
    • 1.1.5: Added initial MacOS X support (thanks Stan) +
    • 1.1.5: SDL_WarpMouse() now works on BeOS (thanks Christian) +
    • 1.1.5: Windows GDI driver now supports 565 modes (thanks Ben) +
    • 1.1.5: Correctly load OpenGL extensions on Win32 (thanks Beosil) +
    • 1.1.5: Fixed crash with some threaded audio drivers +
    • 1.1.5: Audio is now closed in SDL_Quit(), if necessary +
    • 1.1.5: Win32 version now uses MSVC multi-threaded DLL runtime +
    • 1.1.5: Replaced useless SDL_SetClipping() with SDL_SetClipRect() +
    • 1.1.5: Added a flag to YUV overlays to show hardware support +
    • 1.1.5: Added SDL_WasInit() to see what is currently initialized +
    • 1.1.5: YUV overlays can now be accelerated with DirectX +
    • 1.1.5: YUV overlays now have working pitch (thanks Vivien) +
    • 1.1.5: Prompt the user if MacOS mode change may damage hardware +
    • 1.1.5: Fixed DrawSprocket video mode lists and mode changes +
    • 1.1.5: Added DrawSprocket acceleration of colorkey blits +
    • 1.1.5: MacOS event handling is much more responsive by default +
    • 1.1.5: MacOS modifier keys now generate key events +
    • 1.1.5: Mattias Engdegård did the "Great Alpha Flip" +
    • 1.1.5: Added SDL_DisplayFormatAlpha() for fast alpha blits +
    • 1.1.5: Added SDL_MapRGBA() and SDL_GetRGBA() to handle alpha +
    • 1.1.5: SDL_SetAlpha() now accepts the SDL_RLEACCEL flag +
    • 1.1.5: Blit semantics involving alpha are now well defined +
    • 1.1.5: Added support for X11 DirectColor visuals for gamma API +
    • 1.1.5: Added initial AmigaOS support (thanks Gabriele Greco) +
    • 1.1.5: Added an initial gamma correction API (thanks Daniel) +
    • 1.1.5: Disable DGA mouse while X11 application is iconified +
    • 1.1.5: Allow 16-bit audio on Solaris (thanks Mattias) +
    • 1.1.5: Added RLE acceleration of alpha blits (thanks Mattias) +
    • 1.1.5: New documentation from the SDL Documentation Project +
    • 1.1.4: Work around window resize bug in KDE 1.2 +
    • 1.1.4: Command-click is interpreted as right click on MacOS +
    • 1.1.4: Removed ESounD detection on Solaris +
    • 1.1.4: Updated to libtool 1.3.5 and latest config.guess +
    • 1.1.4: testgl now works on 8-bit displays under X11 +
    • 1.1.4: SDL_WINDOWID hack now works with OpenGL on Linux +
    • 1.1.4: Builds correctly on UNIX without X11 installed +
    • 1.1.4: Fixed default GL driver loading on Win32 +
    • 1.1.4: Implemented fullscreen toggle on BeOS (thanks David) +
    • 1.1.4: No longer use DirectDraw with OpenGL modes on Win32 +
    • 1.1.4: Added support for 320x200x8 in SVGAlib (thanks Michele) +
    • 1.1.4: Implemented resizable windows on BeOS (thanks David) +
    • 1.1.4: RLE colorkey encoding reduces memory use (thanks Mattias) +
    • 1.1.4: The CD track length variable is now 32-bits (thanks Martin) +
    • 1.1.4: Fixed crashing bug in Win32 semaphores (thanks Markus) +
    • 1.1.4: Disabled aggresive gcc optimizations on X86 +
    • 1.1.4: Added support for blitting with GL (thanks Daniel Vogel) +
    • 1.1.4: Improved the speed of the 16-bit colorkey copy blit +
    • 1.1.4: Fixed pthread condition variable timeout +
    • 1.1.3: Use timeGetTime() instead of GetTickCount() on Win32 +
    • 1.1.3: Release mouse when popped out of fullscreen on X11 +
    • 1.1.3: IRIX 6.5 and FreeBSD 4.0 are now officially supported +
    • 1.1.3: Added optimization flags when compiling on x86 with gcc +
    • 1.1.3: On BeOS, change to app directory when launched by Tracker +
    • 1.1.3: Hold the option key on launch to get dialog on MacOS +
    • 1.1.3: Added DrawSprockets on MacOS (thanks Darrell Walisser) +
    • 1.1.3: Added support for Linux 2.4 input interface (HID) +
    • 1.1.3: Fixed 24-bpp blits on big-endian systems (thanks Mattias) +
    • 1.1.3: Don't try to use DGA mouse support on XFree86 4.00 +
    • 1.1.3: Don't create an X11 shared memory buffer for GL displays +
    • 1.1.3: Framebuffer console acceleration disabled (broken) on G200 +
    • 1.1.3: Allow maximize on resizable Win32 surfaces (thanks Randi) +
    • 1.1.3: Much faster RLE colorkey blit (thanks Xark and Mattias) +
    • 1.1.3: Fixed some problems with iconification and focus in X11 +
    • 1.1.3: Added IMPS/2 protocol support for framebuffer console +
    • 1.1.3: Added user-resizable video mode support +
    • 1.1.3: Added arbitrary scaling of YUV overlay surfaces +
    • 1.1.3: Added support for semaphores and condition variables +
    • 1.1.3: Added SDL_ASYNCBLIT flag for asynchronous video updates +
    • 1.1.3: Don't let the WM place window in X11 fullscreen mode +
    • 1.1.3: Unload GL library after X11 display has closed +
    • 1.1.3: Fixed X11 error when a clipped rectangle is updated +
    • 1.1.3: Fixed crash when surface memory can't be allocated +
    • 1.1.3: Added a check for DirectX 5 audio (thanks Markus) +
    • 1.1.3: Added inline MMX assembly for YUV -> RGB conversion +
    • 1.1.3: Fixed startup crash in X11_RefreshDisplay() +
    • 1.1.3: SDL_Init(SDL_INIT_AUDIO) no longer fails with no soundcard +
    • 1.1.3: Initial YUV video overlay support (supports XvImages) +
    • 1.1.3: Fixed BadMatch X11 error with GLX 1.3 +
    • 1.1.3: Worked around incompatibilities with XFree86 4.0 vidmode +
    • 1.1.3: The audio Makefile no longer takes forever to create +
    • 1.1.3: The joystick hat positions changed to constants +
    • 1.1.3: Fixed overlapping copy blit with odd widths +
    • 1.1.3: Fix for SDL_WINDOWID crash contributed by Mattias +
    • 1.1.3: Speeded up 32-bit alpha channel blits by nearly 100% +
    • 1.1.3: Added experimental DGA 2.0 support (set SDL_VIDEODRIVER) +
    • 1.1.2: Fixed crash running on NT with a read-only filesystem +
    • 1.1.2: Re-use thread creation mutex on glibc-2.0 systems +
    • 1.1.2: SDL_WM_SetIcon() now uses icon colorkey if mask is NULL +
    • 1.1.2: Win32 relative mouse mode fixes (thanks Randi Relander) +
    • 1.1.2: Not being able to set audio frags is no longer fatal +
    • 1.1.2: Added support for multiple timers (thanks Stephane Peter) +
    • 1.1.2: Copy blits optimized using inline assembly on x86 Linux +
    • 1.1.2: Copy blit can now handle overlapping blits +
    • 1.1.2: Fixed GL direct rendering on Utah GLX (thanks John Fulmer) +
    • 1.1.2: Added unofficial support for AIX (thanks Carsten Griwodz) +
    • 1.1.2: Enabled X11 VidMode extension on remote displays +
    • 1.1.2: Load libGL.so.1 under X11 if an app isn't linked with GL +
    • 1.1.2: Don't restack windows in the X11 environment +
    • 1.1.2: Multiple X11 visual support (thanks Mattias Engdegård) +
    • 1.1.0: Internal event state is updated before filter is called +
    • 1.1.0: Worked around DGA mouse cursor bug in Voodoo X server +
    • 1.1.0: Added SDL OpenGL documentation (thanks Nicholas Vining) +
    • 1.1.0: Added AAlib video driver support (thanks Stephane Peter) +
    • 1.1.0: Added fullscreen support for Win32 GDI video driver +
    • 1.1.0: Added SDL_GetAudioState() to get current audio status +
    • 1.1.0: Added SDL_GetRelativeMouseState() to get relative motion +
    • 1.1.0: Added 32-bit PII MMX optimized blitters from Hermes +
    • 1.1.0: Added SDL_bool datatype for functions returning true/false +
    • 1.1.0: Improved alpha blend speed (thanks Alexandre Courbot) +
    • 1.1.0: Added function to queue events: SDL_PushEvent() +
    • 1.1.0: Added user-defined event type to SDL_Event structure +
    • 1.1.0: Added SDL_InitSubSystem() and SDL_QuitSubSystem() +
    • 1.1.0: Added BDirectWindow fullscreen support on BeOS +
    • 1.1.0: Added initial joystick support (Linux, Win32, BeOS, MacOS) +
    • 1.1.0: The timer now runs in a separate thread if possible +
    • 1.1.0: Added initial OpenGL support (Linux, Win32, BeOS, MacOS) +
    • 1.0.9: Avoid potential crash in Win32 mouse handling (thanks Cliff) +
    • 1.0.9: Fixed bug where /dev/dsp was incorrectly marked available +
    • 1.0.9: Fixed DirectX crash if video height is larger than width +
    • 1.0.9: Fixed win32 timer error message typo (thanks Martin Dvorak) +
    • 1.0.8: Fixed deadlock if SDL_LockAudio() called from audio thread +
    • 1.0.8: Fixed a race condition in thread creation +
    • 1.0.7: Added detection for Linux supermount CD-ROM drives +
    • 1.0.6: Added --static-libs option to sdl-config +
    • 1.0.6: Fixed a clipping bug in the RLE colorkey blitting +
    • 1.0.6: Mouse window manager routines implemented on MacOS +
    • 1.0.6: Fixed SDL_HWPALETTE in fullscreen X11 video driver +
    • 1.0.6: Improved relative mouse warping in X11 video driver +
    • 1.0.6: DGA mouse mode is now enabled by SDL_VIDEO_X11_DGAMOUSE +
    • 1.0.6: Grab input by default in fullscreen mode +
    • 1.0.6: Detect hanging (incorrectly configured) Linux soundcard +
    • 1.0.6: If ESPEAKER env variable is set, use ESD audio driver +
    • 1.0.5: Fixed audio structure alignment for packing compilers +
    • 1.0.5: Exposed SDL_AudioInit() and SDL_VideoInit() +
    • 1.0.5: Added SDL_WM_ToggleFullScreen(), implemented for X11 +
    • 1.0.5: Removed ALT-Enter functionality - should be in apps +
    • 1.0.5: The DSP audio driver is used by default on Linux +
    • 1.0.4: Added optional DMA support for the Linux audio driver +
    • 1.0.4: Fixed CD-ROM opening on the iBook under MacOS +
    • 1.0.4: Fixed a crash in 8-bit mode when using X11 video +
    • 1.0.4: Initial audio support on MacOS (thanks Darrell Walisser) +
    • 1.0.4: The audio thread runs at high priority on Win32 +
    • 1.0.4: ESD audio support is now a separate selectable driver +
    • 1.0.4: Initial OpenBSD support (thanks Federico Schwindt) +
    • 1.0.4: Fixed hang when closing audio on Windows 2000 +
    • 1.0.4: Warn about monochrome X displays (thanks Christian Bauer) +
    • 1.0.4: Fixed spurious X11 mouse focus events at ALT-ENTER +
    • 1.0.4: Perform input ungrab at video quit, just in case +
    • 1.0.4: Corrected X11 depth reporting in SDL_VideoModeOK() +
    • 1.0.3: Disable mouse threshold when X11 mouse is in warp mode +
    • 1.0.3: Fixed black-screen on exit in fbcon video driver +
    • 1.0.3: Much improved console switching in fbcon video driver +
    • 1.0.3: Fixed X11 UNICODE translation bug (thanks Andreas Arens) +
    • 1.0.3: Fixed WaveOut mutex logic bug (thanks Markus Oberhum) +
    • 1.0.3: Use X11 mouse warping when cursor hidden and input grabbed +
    • 1.0.3: Doesn't try to use TrackMouseEvent() on Win95 +
    • 1.0.3: DirectColor support in fbcon driver (thanks Adam Meyerowitz) +
    • 1.0.3: Fixed ALT-ENTER key state problem on X11 +
    • 1.0.2: Fixed Win32 code to run on VMWare with DIB video driver +
    • 1.0.2: Added window manager function: SDL_WM_GrabInput() +
    • 1.0.2: Added window manager function: SDL_WM_IconifyWindow() +
    • 1.0.2: Added ALT-ENTER fullscreen toggle for X11 video driver +
    • 1.0.2: X11 fullscreen mode uses DGA mouse if cursor is hidden +
    • 1.0.2: New X11 fullscreen code doesn't require root +
    • 1.0.2: Mouse focus and position is now updated at video mode set +
    • 1.0.2: Mouse focus loss is now detected under Win32 +
    • 1.0.2: Menubar hiding is more robust on MacOS (thanks Matt Slott) +
    • 1.0.2: Added CD-ROM support on MacOS (thanks Matt Slott) +
    • 1.0.2: Added non-root fullscreen modes under X11 (thanks Stephane) +
    • 1.0.2: Added docs for time functions (thanks Christian Biesinger) +
    • 1.0.2: Squeezed a little more speed out of blitters (Duff's device) +
    • 1.0.2: Added hardware acceleration for 3Dfx to fbcon driver. +
    • 1.0.2: Added hardware acceleration for Matrox to fbcon driver. +
    • 1.0.2: Windows mouse driver now recognizes the middle button. +
    • 1.0.2: X11 driver now recognizes the "unix:0" display as local. +
    • 1.0.2: Fixed a bug in DGA support which crashed some X servers. +
    • 1.0.2: Added GPM repeater support (gpm -R) to fbcon driver +
    • 1.0.2: Added support for hardware surfaces to fbcon driver +
    • 1.0.2: Implemented console switching in fbcon driver +
    • 1.0.2: Implemented graphics mode detection in fbcon driver +
    • 1.0.2: Added SDL_EnableKeyRepeat() (thanks Jim Kutter) +
    • 1.0.2: Enabled DirectSound on Windows 2000 +
    • 1.0.1: Fixed the frame buffer video driver on LinuxPPC +
    • 1.0.1: Stopped using DirectSound on Windows NT. +
    • 1.0.1: Stopped using DirectX when DINPUT.DLL is not installed. +
    • 1.0.1: Added pthread detection to configure.in for FreeBSD. +
    • 1.0.1: Updated the Solaris audio code for the 1.0 API +
    • 1.0.1: Updated the MacOS code for the 1.0 internal API +
    + +

    +Major changes since SDL 0.10.0: +

    +
      +
    • 0.11.5: Fixed mouse warping in fullscreen mode +
    • 0.11.5: Added a new function SDL_GetVideoSurface() +
    • 0.11.5: Renamed SDL_AllocSurface() SDL_CreateRGBSurface() +
    • 0.11.5: Added a new function SDL_CreateRGBSurfaceFrom() +
    • 0.11.4: Added support for multiple compiled-in video drivers +
    • 0.11.3: Fixed 16 --> 32 bpp blitting - using C instead of Hermes. +
    • 0.11.3: Fixed double-buffering bug in the DirectX driver +
    • 0.11.3: Added GGI video driver (thanks Jon Taylor) +
    • 0.11.2: Added automake/aclocal/autoconf support +
    • 0.11.1: Added an initial (buggy) MacOS CD-ROM driver +
    • 0.11.1: Improved Linux CD-ROM detection +
    • 0.11.1: Added a workaround for DGA mouse bug on Voodoo 3 +
    • 0.11.1: Fixed 24bpp --> 8bpp blit crash +
    • 0.11.1: Fixed a bug in blit mapping when palette changed +
    • 0.11.1: Added a Linux SBLive beta driver workaround +
    • 0.11.1: Fixed Win32 cross-compile problem with mingw32 +
    • 0.11.1: Loss of keyboard focus now causes keys to be reset +
    • 0.11.1: DGA DirectMouse is conditionally compiled (default off) +
    + +

    +Major changes since SDL 0.8.0: +

    +
      +
    • 0.9.16: Made SDL error messages thread-safe +
    • 0.9.15: If you have r/w access to /dev/mem, DGA works on Linux +
    • 0.9.15: Added support for Linux on the ARM (Netwinder) +
    • 0.9.14: Removed color cursor support, fixed b/w cursors +
    • 0.9.14: Fixed long-standing X11 DGA colormap problem +
    • 0.9.13: Added dynamic load function: SDL_SetLibraryPath() +
    • 0.9.13: Added unofficial support for MacOS +
    • 0.9.13: Added unofficial support for FreeBSD +
    • 0.9.13: Added unofficial support for IRIX +
    • 0.9.13: Updated support for BeOS from R3 to R4.5 +
    • 0.9.13: Added SDL_SetLibraryPath() function (thanks Karsten Laux) +
    • 0.9.13: Fixed 8-bit audio conversion when using SDL_MixAudio() +
    • 0.9.13: Fixed audio thread lingering when app dies on Linux +
    • 0.9.13: Fixed color problem in X display to other-endian systems +
    • 0.9.13: Finally able to detect X11 key repeat (thanks GII team!) +
    • 0.9.13: Added support for Visual C++ 5.0 development environment +
    • 0.9.13: Added support for Linux on the Alpha +
    • 0.9.13: Added support for international keyboards (see WhatsNew) +
    • 0.9.12: Added support for loading IMA ADPCM compressed WAV files +
    • 0.9.12: Fixed bug when mixing 8-bit audio in SDL_MixAudio() +
    • 0.9.12: Added Enlightenment Sound Daemon audio support on Linux +
    • 0.9.12: Added MTRR support for Linux/X11 (thanks David Barth) +
    • 0.9.12: Added support for LinuxPPC 5.0 +
    • 0.9.12: Fixed place where some audio conversions aren't detected +
    • 0.9.12: Fixed serious bug in installation script +
    • 0.9.12: Added SDL_FreeWAV() function for freeing DLL memory +
    • 0.9.12: Fixed potential memory leak in SDL_LoadWAV_RW() +
    • 0.9.11: Freeing video surface has no longer crashes SDL_Quit() +
    • 0.9.11: Included new asm blitters from Hermes library 1.2.4 +
    • 0.9.11: SDL_WaitThread() now gets the thread's return status +
    • 0.9.11: SDL_MixAudio() takes a larger volume range (0-128) +
    • 0.9.11: SDL no longer changes the X11 keyboard repeat +
    • 0.9.11: Added a data source abstraction for loading/saving data +
    • 0.9.11: Added three built in data abstractions:
      + SDL_RWFromFile(), SDL_RWFromFP(), SDL_RWFromMem() +
    • 0.9.11: Added stdio-like functions for using data sources:
      + SDL_RWseek(), SDL_RWread(), SDL_RWwrite(), SDL_RWclose() +
    • 0.9.11: Replaced SDL_CalculateEndian() with SDL_BYTEORDER macro +
    • 0.9.11: Endian swapping functions are now macros, for speed. +
    • 0.9.11: Endian read/write functions now use data sources +
    • 0.9.11: Added function SDL_LoadWAV_RW() for data sources +
    • 0.9.11: Added function SDL_LoadBMP_RW() for data sources +
    • 0.9.11: Added function SDL_SaveBMP_RW() for data sources +
    • 0.9.10: Mixer no longer fails if timidity isn't installed +
    • 0.9.10: Mixer restarts MOD files on play (thanks Bill Kendrick) +
    • 0.9.10: Fixed occasional crashing of the mixer library +
    • 0.9.10: Fixed icon display on Afterstep under Linux +
    • 0.9.10: Fixed occasional crash in mixer example +
    • 0.9.10: Linux cdrom list now comes from /etc/fstab +
    • 0.9.10: Fixed support for UK keyboard (thanks John Elliott) +
    • 0.9.10: The event queue is now thread-safe +
    • 0.9.10: Added event queue pump function: SDL_PumpEvents() +
    • 0.9.10: Added low level event function: SDL_PeepEvents() +
    • 0.9.10: Added a new thread function: SDL_ThreadID() +
    • 0.9.10: Fixed an audio rate conversion memory overrun +
    • 0.9.10: Fixed crash with RLE acceleration on big surfaces +
    • 0.9.10: Improved MacOS display driver - added fullscreen +
    • 0.9.10: Removed spurious warnings from Linux X11 driver +
    • 0.9.10: Fixed memory leak in SDL_InvalidateMap() +
    • 0.9.10: Fixed right button of 2-button mice on Win32 +
    • 0.9.10: Enabled XFree86 mode changes on older servers +
    • 0.9.9: SDL_LoadBMP() handles BMP files created with GIMP +
    • 0.9.9: SDL_LoadWAV() handles WAV files with "LIST" chunks +
    • 0.9.9: Fixed problem with audio underflow on Solaris +
    • 0.9.9: Initial support for 4-speaker audio output devices +
    • 0.9.8: Fixed corrupt VC++ 5.0 desktop file +
    • 0.9.8: Now detects fixed version of Metro-X X11 server +
    • 0.9.8: Fixed XFree86 DGA banked mode update +
    • 0.9.8: Fixed mouse press viewport shift on XFree86 DGA +
    • 0.9.7: Fixed problem with displaying remotely via X11 +
    • 0.9.7: Win32 uses software cursor when fullscreen +
    • 0.9.7: Win32 mouse uses DirectInput when fullscreen +
    • 0.9.7: Added OpenGL software rendering via Mesa (demos archive) +
    • 0.9.7: Fixed memory leak in ADPCM WAV decoding +
    • 0.9.6: Added CD-ROM audio API documentation +
    • 0.9.6: Fixed potential BeOS audio-related crash +
    • 0.9.6: Fixed crash when resetting the video mode in DirectX +
    • 0.9.6: Fixed errors compiling with the SparcWorks compiler +
    • 0.9.6: Replaced SDL_GetDisplayFormat() with SDL_GetVideoInfo() +
    • 0.9.6: Added a new fast fill function: SDL_FillRect() +
    • 0.9.6: Added blit acceleration flags to SDL_AllocSurface() +
    • 0.9.6: Added new double-buffering function: SDL_Flip() +
    • 0.9.6: Fixed problem with buggy Metro-X X11 server +
    • 0.9.6: Fixed 8-bit audio on Solaris with dbri hardware +
    • 0.9.6: Fixed alarm clock problem with Solaris pthreads +
    • 0.9.6: Fixed BeOS compilation problem +
    • 0.9.5: Added tools to create Win32 icons in directx/icon/ +
    • 0.9.5: You can now pass a NULL mask to SDL_WM_SetIcon() +
    • 0.9.5: Added support files for compiling with VC++ 5.0 +
    • 0.9.5: Fixed icon color bug under Win32 +
    • 0.9.5: Re-added SDL_LowerBlit() - not safe for use on display +
    • 0.9.5: Fixed 0.9.x cursor blit deadlock +
    • 0.9.5: Added SDL_FPLoadWAV(), SDL_FPLoadBMP(), SDL_FPSaveBMP() +
    • 0.9.5: Added Linux, Win32, and BeOS CD audio support +
    • 0.9.5: MMX accelerated blit disabled -- temporarily broken +
    • 0.9.4: Fixed endianness issue with BeOS x86 blitting +
    • 0.9.4: Fixed quit interrupt delivery on BeOS +
    • 0.9.4: Fixed dynamic loading on BeOS +
    • 0.9.4: Fixed DirectX audio on Win98 +
    • 0.9.4: Fixed possible sound-related crash on Linux PPC +
    • 0.9.3: Mouse motion arrives as absolute and relative coordinates +
    • 0.9.3: Fixed Visual C++ structure packing +
    • 0.9.3: Fixed UNIX dynamic link library installation +
    • 0.9.2: DirectX audio no longer hangs when app loses focus +
    • 0.9.2: Fixed DirectX HiColor crash (palette bug) +
    • 0.9.1: Fixed DirectX <ALT> key handling +
    • 0.9.1: Fixed DirectX windowed palette problems +
    • 0.9.1: Removed SDL_MapSurface() and SDL_UnmapSurface() +
    • 0.9.0: Initial port to IRIX 6.x +
    • 0.9.0: Initial port to OSF/1 3.2 (no sound yet) +
    • 0.9.0: MacOS port in progress +
    + +

    +Major changes since SDL 0.7: +

    +
      +
    • Separated the demos and examples into a separate archive +
    • Added support for loading Microsoft compressed WAV files +
    • Added "soft" application crash recovery (signal handlers) +
    • Fixed POSIX signal handling interaction with threads +
    • Fixed audio output on MKLinux +
    • Added dynamic library version checking +
    • Updated for DirectX 6.0 +
    • Cleaned up dynamic linking and added static linking +
    • Added automatic audio format and rate conversion +
    • Optimized some blitter cases (8 --> 16/32 and 32 --> 16/8) +
    • Removed precalculated alpha blending acceleration +
    • Key and mouse button events are split into up/down events +
    • It is now much easier to set an optimal video mode +
    + +

    +Major changes since SDL 0.5: +

    +
      +
    • Ported to Solaris 2.6 +
    • Added XFree86 Direct Graphic Access support +
    • Supports LinuxPPC without threads +
    • Completely rewritten video/surface API -- see SDL_video.h +
    • Completely rewritten event API +
    • Optimized black-white cursor creation +
    • Added support for run-length-encoded colorkeying +
    • Added support for hardware accelerated blits +
    • Added support for blitting from 1-bit surfaces (bitmaps) +
    • Added a function to simplify setting video modes +
    • Added support for loading WAV files +
    • Added endian swapping functions for memory values +
    • Added alpha blending using alpha value or channel +
    • Added precalculated alpha blending acceleration +
    • Added function to return current time in milliseconds +
    • New event type SDL_ACTIVEEVENT, to detect iconification +
    • New event type SDL_SYSWMEVENT, for custom window hooks +
    • Added a platform dependent function to get window handle +
    • Added a function to check the run-time version of SDL +
    • Added periodic timer support at 10 ms resolution +
    • Added support for the SDL_DEBUG environment variable +
    • Miscellaneous internal cleanups +
    + +

    +Major changes since SDL 0.4: +

    +
      +
    • SDL library code is now dynamically loaded +
    • Added support for pthreads (Linux glibc2) +
    • Removed SDL_mutexN() and SDL_mutexIncr() +
    + +

    +Major changes since SDL 0.3: +

    +
      +
    • Added support for DirectX 5.0 +
    • Added support for surfaces in video memory +
    • Added support for source color-key blitting +
    • Added support for single-rectangle clipping +
    • Added support for warping (moving) the cursor +
    • Added support for color cursors +
    • Greatly simplified internal event queue +
    • Minor bug-fixes +
    + +

    +[separator] + + + diff -r 000000000000 -r 74212992fb08 docs/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/.cvsignore Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,2 @@ +Makefile.in +Makefile diff -r 000000000000 -r 74212992fb08 docs/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/Makefile.am Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,4 @@ + +SUBDIRS = html man3 + +EXTRA_DIST = index.html diff -r 000000000000 -r 74212992fb08 docs/html/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/.cvsignore Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,2 @@ +Makefile.in +Makefile diff -r 000000000000 -r 74212992fb08 docs/html/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/Makefile.am Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,199 @@ +EXTRA_DIST = \ + audio.html \ + cdrom.html \ + event.html \ + eventfunctions.html \ + eventstructures.html \ + general.html \ + guide.html \ + guideaboutsdldoc.html \ + guideaudioexamples.html \ + guidebasicsinit.html \ + guidecdromexamples.html \ + guidecredits.html \ + guideeventexamples.html \ + guideexamples.html \ + guideinput.html \ + guideinputkeyboard.html \ + guidepreface.html \ + guidethebasics.html \ + guidetimeexamples.html \ + guidevideo.html \ + guidevideoexamples.html \ + index.html \ + joystick.html \ + reference.html \ + sdlactiveevent.html \ + sdladdtimer.html \ + sdlaudiocvt.html \ + sdlaudiospec.html \ + sdlblitsurface.html \ + sdlbuildaudiocvt.html \ + sdlcd.html \ + sdlcdclose.html \ + sdlcdeject.html \ + sdlcdname.html \ + sdlcdnumdrives.html \ + sdlcdopen.html \ + sdlcdpause.html \ + sdlcdplay.html \ + sdlcdplaytracks.html \ + sdlcdresume.html \ + sdlcdstatus.html \ + sdlcdstop.html \ + sdlcdtrack.html \ + sdlcloseaudio.html \ + sdlcolor.html \ + sdlcondbroadcast.html \ + sdlcondsignal.html \ + sdlcondwait.html \ + sdlcondwaittimeout.html \ + sdlconvertaudio.html \ + sdlconvertsurface.html \ + sdlcreatecond.html \ + sdlcreatecursor.html \ + sdlcreatemutex.html \ + sdlcreatergbsurface.html \ + sdlcreatergbsurfacefrom.html \ + sdlcreatesemaphore.html \ + sdlcreatethread.html \ + sdlcreateyuvoverlay.html \ + sdldelay.html \ + sdldestroycond.html \ + sdldestroymutex.html \ + sdldestroysemaphore.html \ + sdldisplayformat.html \ + sdldisplayformatalpha.html \ + sdldisplayyuvoverlay.html \ + sdlenablekeyrepeat.html \ + sdlenableunicode.html \ + sdlevent.html \ + sdleventstate.html \ + sdlfillrect.html \ + sdlflip.html \ + sdlfreecursor.html \ + sdlfreesurface.html \ + sdlfreewav.html \ + sdlfreeyuvoverlay.html \ + sdlgetappstate.html \ + sdlgetaudiostatus.html \ + sdlgetcliprect.html \ + sdlgetcursor.html \ + sdlgeteventfilter.html \ + sdlgetgammaramp.html \ + sdlgetkeyname.html \ + sdlgetkeystate.html \ + sdlgetmodstate.html \ + sdlgetmousestate.html \ + sdlgetrelativemousestate.html \ + sdlgetrgb.html \ + sdlgetrgba.html \ + sdlgetthreadid.html \ + sdlgetticks.html \ + sdlgetvideoinfo.html \ + sdlgetvideosurface.html \ + sdlglattr.html \ + sdlglgetattribute.html \ + sdlglgetprocaddress.html \ + sdlglloadlibrary.html \ + sdlglsetattribute.html \ + sdlglswapbuffers.html \ + sdlinit.html \ + sdlinitsubsystem.html \ + sdljoyaxisevent.html \ + sdljoyballevent.html \ + sdljoybuttonevent.html \ + sdljoyhatevent.html \ + sdljoystickclose.html \ + sdljoystickeventstate.html \ + sdljoystickgetaxis.html \ + sdljoystickgetball.html \ + sdljoystickgetbutton.html \ + sdljoystickgethat.html \ + sdljoystickindex.html \ + sdljoystickname.html \ + sdljoysticknumaxes.html \ + sdljoysticknumballs.html \ + sdljoysticknumbuttons.html \ + sdljoysticknumhats.html \ + sdljoystickopen.html \ + sdljoystickopened.html \ + sdljoystickupdate.html \ + sdlkey.html \ + sdlkeyboardevent.html \ + sdlkeysym.html \ + sdlkillthread.html \ + sdllistmodes.html \ + sdlloadbmp.html \ + sdlloadwav.html \ + sdllockaudio.html \ + sdllocksurface.html \ + sdllockyuvoverlay.html \ + sdlmaprgb.html \ + sdlmaprgba.html \ + sdlmixaudio.html \ + sdlmousebuttonevent.html \ + sdlmousemotionevent.html \ + sdlmutexp.html \ + sdlmutexv.html \ + sdlnumjoysticks.html \ + sdlopenaudio.html \ + sdloverlay.html \ + sdlpalette.html \ + sdlpauseaudio.html \ + sdlpeepevents.html \ + sdlpixelformat.html \ + sdlpollevent.html \ + sdlpumpevents.html \ + sdlpushevent.html \ + sdlquit.html \ + sdlquitevent.html \ + sdlquitsubsystem.html \ + sdlrect.html \ + sdlremovetimer.html \ + sdlresizeevent.html \ + sdlsavebmp.html \ + sdlsempost.html \ + sdlsemtrywait.html \ + sdlsemvalue.html \ + sdlsemwait.html \ + sdlsemwaittimeout.html \ + sdlsetalpha.html \ + sdlsetcliprect.html \ + sdlsetcolorkey.html \ + sdlsetcolors.html \ + sdlsetcursor.html \ + sdlseteventfilter.html \ + sdlsetgamma.html \ + sdlsetgammaramp.html \ + sdlsetmodstate.html \ + sdlsetpalette.html \ + sdlsettimer.html \ + sdlsetvideomode.html \ + sdlshowcursor.html \ + sdlsurface.html \ + sdlsyswmevent.html \ + sdlthreadid.html \ + sdlunlockaudio.html \ + sdlunlocksurface.html \ + sdlunlockyuvoverlay.html \ + sdlupdaterect.html \ + sdlupdaterects.html \ + sdluserevent.html \ + sdlvideodrivername.html \ + sdlvideoinfo.html \ + sdlvideomodeok.html \ + sdlwaitevent.html \ + sdlwaitthread.html \ + sdlwarpmouse.html \ + sdlwasinit.html \ + sdlwmgetcaption.html \ + sdlwmgrabinput.html \ + sdlwmiconifywindow.html \ + sdlwmsetcaption.html \ + sdlwmseticon.html \ + sdlwmtogglefullscreen.html \ + thread.html \ + time.html \ + video.html \ + wm.html diff -r 000000000000 -r 74212992fb08 docs/html/audio.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/audio.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,234 @@ +Audio

    SDL Library Documentation
    PrevNext

    Chapter 10. Audio

    Table of Contents
    SDL_AudioSpec — Audio Specification Structure
    SDL_OpenAudio — Opens the audio device with the desired parameters.
    SDL_PauseAudio — Pauses and unpauses the audio callback processing
    SDL_GetAudioStatus — Get the current audio state
    SDL_LoadWAV — Load a WAVE file
    SDL_FreeWAV — Frees previously opened WAV data
    SDL_AudioCVT — Audio Conversion Structure
    SDL_BuildAudioCVT — Initializes a SDL_AudioCVT structure for conversion
    SDL_ConvertAudio — Convert audio data to a desired audio format.
    SDL_MixAudio — Mix audio data
    SDL_LockAudio — Lock out the callback function
    SDL_UnlockAudio — Unlock the callback function
    SDL_CloseAudio — Shuts down audio processing and closes the audio device.

    Sound on the computer is translated from waves that you hear into a series of +values, or samples, each representing the amplitude of the wave. When these +samples are sent in a stream to a sound card, an approximation of the original +wave can be recreated. The more bits used to represent the amplitude, and the +greater frequency these samples are gathered, the closer the approximated +sound is to the original, and the better the quality of sound.

    This library supports both 8 and 16 bit signed and unsigned sound samples, +at frequencies ranging from 11025 Hz to 44100 Hz, depending on the +underlying hardware. If the hardware doesn't support the desired audio +format or frequency, it can be emulated if desired (See +SDL_OpenAudio())

    A commonly supported audio format is 16 bits per sample at 22050 Hz.


    PrevHomeNext
    SDL_JoystickCloseUpSDL_AudioSpec
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/cdrom.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/cdrom.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,252 @@ +CD-ROM
    SDL Library Documentation
    PrevNext

    Chapter 11. CD-ROM

    Table of Contents
    SDL_CDNumDrives — Returns the number of CD-ROM drives on the system.
    SDL_CDName — Returns a human-readable, system-dependent identifier for the CD-ROM.
    SDL_CDOpen — Opens a CD-ROM drive for access.
    SDL_CDStatus — Returns the current status of the given drive.
    SDL_CDPlay — Play a CD
    SDL_CDPlayTracks — Play the given CD track(s)
    SDL_CDPause — Pauses a CDROM
    SDL_CDResume — Resumes a CDROM
    SDL_CDStop — Stops a CDROM
    SDL_CDEject — Ejects a CDROM
    SDL_CDClose — Closes a SDL_CD handle
    SDL_CD — CDROM Drive Information
    SDL_CDtrack — CD Track Information Structure

    SDL supports audio control of up to 32 local CD-ROM drives at once.

    You use this API to perform all the basic functions of a CD player, +including listing the tracks, playing, stopping, and ejecting the CD-ROM. +(Currently, multi-changer CD drives are not supported.)

    Before you call any of the SDL CD-ROM functions, you must first call +"SDL_Init(SDL_INIT_CDROM)", which scans the system for +CD-ROM drives, and sets the program up for audio control. Check the +return code, which should be 0, to see if there +were any errors in starting up.

    After you have initialized the library, you can find out how many drives +are available using the SDL_CDNumDrives() function. +The first drive listed is the system default CD-ROM drive. After you have +chosen a drive, and have opened it with SDL_CDOpen(), +you can check the status and start playing if there's a CD in the drive.

    A CD-ROM is organized into one or more tracks, each consisting of a certain +number of "frames". Each frame is ~2K in size, and at normal playing speed, +a CD plays 75 frames per second. SDL works with the number of frames on a +CD, but this can easily be converted to the more familiar minutes/seconds +format by using the FRAMES_TO_MSF() macro.


    PrevHomeNext
    SDL_CloseAudioUpSDL_CDNumDrives
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/event.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/event.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,208 @@ +Events
    SDL Library Documentation
    PrevNext

    Chapter 8. Events

    Introduction

    Event handling allows your application to receive input from the user. Event handling is initalised (along with video) with a call to: +

    SDL_Init(SDL_INIT_VIDEO);
    +Interally, SDL stores all the events waiting to be handled in an event queue. Using functions like SDL_PollEvent and SDL_PeepEvents you can observe and handle waiting input events.

    The key to event handling in SDL is the SDL_Event union. The event queue itself is composed of a series of SDL_Event unions, one for each waiting event. SDL_Event unions are read from the queue with the SDL_PollEvent function and it is then up to the application to process the information stored with them.


    PrevHomeNext
    SDL_WM_GrabInputUpSDL Event Structures.
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/eventfunctions.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/eventfunctions.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,236 @@ +Event Functions.
    SDL Library Documentation
    PrevChapter 8. EventsNext

    Event Functions.

    Table of Contents
    SDL_PumpEvents — Pumps the event loop, gathering events from the input devices.
    SDL_PeepEvents — Checks the event queue for messages and optionally returns them.
    SDL_PollEvent — Polls for currently pending events.
    SDL_WaitEvent — Waits indefinitely for the next available event.
    SDL_PushEvent — Pushes an event onto the event queue
    SDL_SetEventFilter — Sets up a filter to process all events before they are posted +to the event queue.
    SDL_GetEventFilter — Retrieves a pointer to he event filter
    SDL_EventState — This function allows you to set the state of processing certain events.
    SDL_GetKeyState — Get a snapshot of the current keyboard state
    SDL_GetModState — Get the state of modifier keys.
    SDL_SetModState — Set the current key modifier state
    SDL_GetKeyName — Get the name of an SDL virtual keysym
    SDL_EnableUNICODE — Enable UNICODE translation
    SDL_EnableKeyRepeat — Set keyboard repeat rate.
    SDL_GetMouseState — Retrieve the current state of the mouse
    SDL_GetRelativeMouseState — Retrieve the current state of the mouse
    SDL_GetAppState — Get the state of the application
    SDL_JoystickEventState — Enable/disable joystick event polling

    PrevHomeNext
    SDLKeyUpSDL_PumpEvents
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/eventstructures.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/eventstructures.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,220 @@ +SDL Event Structures.
    SDL Library Documentation
    PrevChapter 8. EventsNext

    SDL Event Structures.

    Table of Contents
    SDL_Event — General event structure
    SDL_ActiveEvent — Application visibility event structure
    SDL_KeyboardEvent — Keyboard event structure
    SDL_MouseMotionEvent — Mouse motion event structure
    SDL_MouseButtonEvent — Mouse button event structure
    SDL_JoyAxisEvent — Joystick axis motion event structure
    SDL_JoyButtonEvent — Joystick button event structure
    SDL_JoyHatEvent — Joystick hat position change event structure
    SDL_JoyBallEvent — Joystick trackball motion event structure
    SDL_ResizeEvent — Window resize event structure
    SDL_SysWMEvent — Platform-dependent window manager event.
    SDL_UserEvent — A user-defined event type
    SDL_QuitEvent — Quit requested event
    SDL_keysym — Keysym structure
    SDLKey — Keysym definitions.

    PrevHomeNext
    EventsUpSDL_Event
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/general.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/general.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,207 @@ +General
    SDL Library Documentation
    PrevNext

    Chapter 5. General

    Table of Contents
    SDL_Init — Initializes SDL
    SDL_InitSubSystem — Initialize subsystems
    SDL_QuitSubSystem — Shut down a subsystem
    SDL_Quit — Shut down SDL
    SDL_WasInit — Check which subsystems are initialized

    Before SDL can be used in a program it must be initialized with SDL_Init. SDL_Init initializes all the subsystems that the user requests (video, audio, joystick, timers and/or cdrom). Once SDL is initialized with SDL_Init subsystems can be shut down and initialized as needed using SDL_InitSubSystem and SDL_QuitSubSystem.

    SDL must also be shut down before the program exits to make sure it cleans up correctly. Calling SDL_Quit shuts down all subsystems and frees any resources allocated to SDL.


    PrevHomeNext
    SDL ReferenceUpSDL_Init
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/guide.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/guide.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,167 @@ +SDL Guide
    SDL Library Documentation
    PrevNext

    I. SDL Guide


    PrevHomeNext
    SDL Library Documentation Preface
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/guideaboutsdldoc.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/guideaboutsdldoc.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,140 @@ +About SDLdoc
    SDL Library Documentation
    PrevPrefaceNext

    About SDLdoc

    SDLdoc (The SDL Documentation Project) was formed to completely rewrite the SDL documentation and to keep it continually up to date. The team consists completely of volunteers ranging from proplr working with SDL in their spare time to people who use SDL in their everyday working lives.

    The latest version of this documentation can always be found at the project homepage: http://sdldoc.sourceforge.net.


    PrevHomeNext
    PrefaceUpCredits
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/guideaudioexamples.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/guideaudioexamples.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,220 @@ +Audio Examples
    SDL Library Documentation
    PrevChapter 4. ExamplesNext

    Audio Examples

    Opening the audio device

        SDL_AudioSpec wanted;
    +    extern void fill_audio(void *udata, Uint8 *stream, int len);
    +
    +    /* Set the audio format */
    +    wanted.freq = 22050;
    +    wanted.format = AUDIO_S16;
    +    wanted.channels = 2;    /* 1 = mono, 2 = stereo */
    +    wanted.samples = 1024;  /* Good low-latency value for callback */
    +    wanted.callback = fill_audio;
    +    wanted.userdata = NULL;
    +
    +    /* Open the audio device, forcing the desired format */
    +    if ( SDL_OpenAudio(&wanted, NULL) < 0 ) {
    +        fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
    +        return(-1);
    +    }
    +    return(0);

    Playing audio

        static Uint8 *audio_chunk;
    +    static Uint32 audio_len;
    +    static Uint8 *audio_pos;
    +
    +    /* The audio function callback takes the following parameters:
    +       stream:  A pointer to the audio buffer to be filled
    +       len:     The length (in bytes) of the audio buffer
    +    */
    +    void fill_audio(void *udata, Uint8 *stream, int len)
    +    {
    +        /* Only play if we have data left */
    +        if ( audio_len == 0 )
    +            return;
    +
    +        /* Mix as much data as possible */
    +        len = ( len > audio_len ? audio_len : len );
    +        SDL_MixAudio(stream, audio_pos, len, SDL_MIX_MAXVOLUME)
    +        audio_pos += len;
    +        audio_len -= len;
    +    }
    +
    +    /* Load the audio data ... */
    +
    +    ;;;;;
    +
    +    audio_pos = audio_chunk;
    +
    +    /* Let the callback function play the audio chunk */
    +    SDL_PauseAudio(0);
    +
    +    /* Do some processing */
    +
    +    ;;;;;
    +
    +    /* Wait for sound to complete */
    +    while ( audio_len > 0 ) {
    +        SDL_Delay(100);         /* Sleep 1/10 second */
    +    }
    +    SDL_CloseAudio();


    PrevHomeNext
    Event ExamplesUpCDROM Examples
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/guidebasicsinit.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/guidebasicsinit.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,224 @@ +Initializing SDL
    SDL Library Documentation
    PrevChapter 1. The BasicsNext

    Initializing SDL

    SDL is composed of eight subsystems - Audio, CDROM, Event Handling, File I/O, Joystick Handling, Threading, Timers and Video. Before you can use any of these subsystems they must be initialized by calling SDL_Init (or SDL_InitSubSystem. SDL_Init must be called before any other SDL function. It automatically initializes the Event Handling, File I/O and Threading subsystems and it takes a parameter specifying which other subsystems to initialize. So, to initialize the default subsystems and the Video subsystems you would call: +

        SDL_Init ( SDL_INIT_VIDEO );
    +To initialize the default subsystems, the Video subsystem and the Timers subsystem you would call: +
        SDL_Init ( SDL_INIT_VIDEO | SDL_INIT_TIMER );

    SDL_Init is complemented by SDL_Quit (and SDL_QuitSubSystem). SDL_Quit shuts down all subsystems, including the default ones. It should always be called before a SDL application exits.

    With SDL_Init and SDL_Quit firmly embedded in your programmers toolkit you can write your first and most basic SDL application. However, we must be prepare to handle errors. Many SDL functions return a value and indicates whether the function has succeeded or failed, SDL_Init, for instance, returns -1 if it could not initialize a subsystem. SDL provides a useful facility that allows you to determine exactly what the problem was, every time an error occurs within SDL an error message is stored which can be retrieved using SDL_GetError. Use this often, you can never know too much about an error.

    #include "SDL.h"   /* All SDL App's need this */
    +#include <stdio.h>
    +
    +int main() {
    +    
    +    printf("Initializing SDL.\n");
    +    
    +    /* Initialize defaults, Video and Audio */
    +    if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1)) { 
    +        printf("Could not initialize SDL: %s.\n", SDL_GetError());
    +        exit(-1);
    +    }
    +
    +    printf("SDL initialized.\n");
    +
    +    printf("Quiting SDL.\n");
    +    
    +    /* Shutdown all subsystems */
    +    SDL_Quit();
    +    
    +    printf("Quiting....\n");
    +
    +    exit(0);
    +}


    PrevHomeNext
    The BasicsUpGraphics and Video
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/guidecdromexamples.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/guidecdromexamples.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,267 @@ +CDROM Examples
    SDL Library Documentation
    PrevChapter 4. ExamplesNext

    CDROM Examples

    Listing CD-ROM drives

        #include "SDL.h"
    +
    +    /* Initialize SDL first */
    +    if ( SDL_Init(SDL_INIT_CDROM) < 0 ) {
    +        fprintf(stderr, "Couldn't initialize SDL: %s\n",SDL_GetError());
    +        exit(1);
    +    }
    +    atexit(SDL_Quit);
    +
    +    /* Find out how many CD-ROM drives are connected to the system */
    +    printf("Drives available: %d\n", SDL_CDNumDrives());
    +    for ( i=0; i<SDL_CDNumDrives(); ++i ) {
    +        printf("Drive %d:  \"%s\"\n", i, SDL_CDName(i));
    +    }

    Opening the default drive

        SDL_CD *cdrom;
    +    CDstatus status;
    +    char *status_str;
    +
    +    cdrom = SDL_CDOpen(0);
    +    if ( cdrom == NULL ) {
    +        fprintf(stderr, "Couldn't open default CD-ROM drive: %s\n",
    +                        SDL_GetError());
    +        exit(2);
    +    }
    +
    +    status = SDL_CDStatus(cdrom);
    +    switch (status) {
    +        case CD_TRAYEMPTY:
    +            status_str = "tray empty";
    +            break;
    +        case CD_STOPPED:
    +            status_str = "stopped";
    +            break;
    +        case CD_PLAYING:
    +            status_str = "playing";
    +            break;
    +        case CD_PAUSED:
    +            status_str = "paused";
    +            break;
    +        case CD_ERROR:
    +            status_str = "error state";
    +            break;
    +    }
    +    printf("Drive status: %s\n", status_str);
    +    if ( status >= CD_PLAYING ) {
    +        int m, s, f;
    +        FRAMES_TO_MSF(cdrom->cur_frame, &m, &s, &f);
    +        printf("Currently playing track %d, %d:%2.2d\n",
    +        cdrom->track[cdrom->cur_track].id, m, s);
    +    }

    Listing the tracks on a CD

        SDL_CD *cdrom;          /* Assuming this has already been set.. */
    +    int i;
    +    int m, s, f;
    +
    +    SDL_CDStatus(cdrom);
    +    printf("Drive tracks: %d\n", cdrom->numtracks);
    +    for ( i=0; i<cdrom->numtracks; ++i ) {
    +        FRAMES_TO_MSF(cdrom->track[i].length, &m, &s, &f);
    +        if ( f > 0 )
    +            ++s;
    +        printf("\tTrack (index %d) %d: %d:%2.2d\n", i,
    +        cdrom->track[i].id, m, s);
    +    }

    Play an entire CD

        SDL_CD *cdrom;          /* Assuming this has already been set.. */
    +
    +    // Play entire CD:
    +    if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
    +        SDL_CDPlayTracks(cdrom, 0, 0, 0, 0);
    +
    +        // Play last track:
    +        if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
    +            SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0);
    +        }
    +
    +        // Play first and second track and 10 seconds of third track:
    +        if ( CD_INDRIVE(SDL_CDStatus(cdrom)) )
    +            SDL_CDPlayTracks(cdrom, 0, 0, 2, 10);


    PrevHomeNext
    Audio ExamplesUpTime Examples
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/guidecredits.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/guidecredits.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,179 @@ +Credits
    SDL Library Documentation
    PrevPrefaceNext

    Credits

    Martin Donlon, akawaka@skynet.ie
    Julian Peterson
    Ken Jordan
    Maxim Sobolev
    Wesley Poole
    Michael Vance
    Andreas Umbach
    Andreas Hofmeister


    PrevHomeNext
    About SDLdocUpThe Basics
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/guideeventexamples.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/guideeventexamples.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,239 @@ +Event Examples
    SDL Library Documentation
    PrevChapter 4. ExamplesNext

    Event Examples

    Filtering and Handling Events

    #include <stdio.h>
    +#include <stdlib.h>
    +
    +#include "SDL.h"
    +
    +/* This function may run in a separate event thread */
    +int FilterEvents(const SDL_Event *event) {
    +    static int boycott = 1;
    +
    +    /* This quit event signals the closing of the window */
    +    if ( (event->type == SDL_QUIT) && boycott ) {
    +        printf("Quit event filtered out -- try again.\n");
    +        boycott = 0;
    +        return(0);
    +    }
    +    if ( event->type == SDL_MOUSEMOTION ) {
    +        printf("Mouse moved to (%d,%d)\n",
    +                event->motion.x, event->motion.y);
    +        return(0);    /* Drop it, we've handled it */
    +    }
    +    return(1);
    +}
    +
    +int main(int argc, char *argv[])
    +{
    +    SDL_Event event;
    +
    +    /* Initialize the SDL library (starts the event loop) */
    +    if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
    +        fprintf(stderr,
    +                "Couldn't initialize SDL: %s\n", SDL_GetError());
    +        exit(1);
    +    }
    +
    +    /* Clean up on exit, exit on window close and interrupt */
    +    atexit(SDL_Quit);
    +
    +    /* Ignore key events */
    +    SDL_EventState(SDL_KEYDOWN, SDL_IGNORE);
    +    SDL_EventState(SDL_KEYUP, SDL_IGNORE);
    +
    +    /* Filter quit and mouse motion events */
    +    SDL_SetEventFilter(FilterEvents);
    +
    +    /* The mouse isn't much use unless we have a display for reference */
    +    if ( SDL_SetVideoMode(640, 480, 8, 0) == NULL ) {
    +        fprintf(stderr, "Couldn't set 640x480x8 video mode: %s\n",
    +                        SDL_GetError());
    +        exit(1);
    +    }
    +
    +    /* Loop waiting for ESC+Mouse_Button */
    +    while ( SDL_WaitEvent(&event) >= 0 ) {
    +        switch (event.type) {
    +            case SDL_ACTIVEEVENT: {
    +                if ( event.active.state & SDL_APPACTIVE ) {
    +                    if ( event.active.gain ) {
    +                        printf("App activated\n");
    +                    } else {
    +                        printf("App iconified\n");
    +                    }
    +                }
    +            }
    +            break;
    +                    
    +            case SDL_MOUSEBUTTONDOWN: {
    +                Uint8 *keys;
    +
    +                keys = SDL_GetKeyState(NULL);
    +                if ( keys[SDLK_ESCAPE] == SDL_PRESSED ) {
    +                    printf("Bye bye...\n");
    +                    exit(0);
    +                }
    +                printf("Mouse button pressed\n");
    +            }
    +            break;
    +
    +            case SDL_QUIT: {
    +                printf("Quit requested, quitting.\n");
    +                exit(0);
    +            }
    +            break;
    +        }
    +    }
    +    /* This should never happen */
    +    printf("SDL_WaitEvent error: %s\n", SDL_GetError());
    +    exit(1);
    +}


    PrevHomeNext
    Video ExamplesUpAudio Examples
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/guideexamples.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/guideexamples.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,185 @@ +Examples
    SDL Library Documentation
    PrevNext

    Chapter 4. Examples

    Introduction

    For the moment these examples are taken directly from the old SDL documentation.


    PrevHomeNext
    Handling the KeyboardUpVideo Examples
    diff -r 000000000000 -r 74212992fb08 docs/html/guideinput.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/guideinput.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,647 @@ +Input handling
    SDL Library Documentation
    PrevNext

    Chapter 3. Input handling

    Handling Joysticks

    Initialization

    The first step in using a joystick in a SDL program is to initialize the Joystick subsystems of SDL. This done by passing the SDL_INIT_JOYSTICK flag to SDL_Init. The joystick flag will usually be used in conjunction with other flags (like the video flag) because the joystick is usually used to control something. +

        if ( ! SDL_Init( SDL_INIT_VIDEO | SDL_INIT_JOYSTICK ) )
    +    {
    +        fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError());
    +        exit(1);
    +    }
    +This will attempt to start SDL with both the video and the joystick subsystems activated.

    Querying

    If we have reached this point then we can safely assume that the SDL library has been initialized and that the Joystick subsystem is active. We can now call some video and/or sound functions to get things going before we need the joystick. Eventually we have to make sure that there is actually a joystick to work with. It's wise to always check even if you know a joystick will be present on the system because it can also help detect when the joystick is unplugged. The function used to check for joysticks is SDL_NumJoysticks.

    This function simply returns the number of joysticks available on the system. If it is at least one then we are in good shape. The next step is to determine which joystick the user wants to use. If the number of joysticks available is only one then it is safe to assume that one joystick is the one the user wants to use. SDL has a function to get the name of the joysticks as assigned by the operations system and that function is SDL_JoystickName. The joystick is specified by an index where 0 is the first joystick and the last joystick is the number returned by SDL_NumJoysticks - 1. In the demonstration a list of all available joysticks is printed to stdout. +

        printf("%i joysticks were found.\n\n", SDL_NumJoysticks() );
    +    printf("The names of the joysticks are:\n");
    +		
    +    for( i=0; i < SDL_NumJoysticks(); i++ ) 
    +    {
    +        printf("    %s\n", SDL_JoystickName(i));
    +    }

    Opening a Joystick and Receiving Joystick Events

    SDL's event driven architecture makes working with joysticks a snap. Joysticks can trigger 4 different types of events: +

    SDL_JoyAxisEventOccurs when an axis changes
    SDL_JoyBallEventOccurs when a joystick trackball's position changes
    SDL_JoyHatEventOccurs when a hat's position changes
    SDL_JoyButtonEventOccurs when a button is pressed or released

    Events are received from all joysticks opened. The first thing that needs to be done in order to receive joystick events is to call SDL_JoystickEventState with the SDL_ENABLE flag. Next you must open the joysticks that you want to receive envents from. This is done with the SDL_JoystickOpen function. For the example we are only interested in events from the first joystick on the system, regardless of what it may be. To receive events from it we would do this: +

        SDL_Joystick *joystick;
    +
    +    SDL_JoystickEventState(SDL_ENABLE);
    +    joystick = SDL_JoystickOpen(0);
    +If we wanted to receive events for other joysticks we would open them with calls to SDL_JoystickOpen just like we opened joystick 0, except we would store the SDL_Joystick structure they return in a different pointer. We only need the joystick pointer when we are querying the joysticks or when we are closing the joystick.

    Up to this point all the code we have is used just to initialize the joysticks in order to read values at run time. All we need now is an event loop, which is something that all SDL programs should have anyway to receive the systems quit events. We must now add code to check the event loop for at least some of the above mentioned events. Let's assume our event loop looks like this: +

        SDL_Event *event;
    +    /* Other initializtion code goes here */   
    +
    +    /* Start main game loop here */
    +
    +    while(SDL_PollEvent(&event))
    +    {  
    +        switch(event.type)
    +        {  
    +            case SDL_KEYDOWN:
    +            /* handle keyboard stuff here */				
    +            break;
    +
    +            case SDL_QUIT:
    +            /* Set whatever flags are necessary to */
    +            /* end the main game loop here */
    +            break;
    +        }
    +    }
    +
    +    /* End loop here */
    +To handle Joystick events we merely add cases for them, first we'll add axis handling code. Axis checks can get kinda of tricky because alot of the joystick events received are junk. Joystick axis have a tendency to vary just a little between polling due to the way they are designed. To compensate for this you have to set a threshold for changes and ignore the events that have'nt exceeded the threshold. 10% is usually a good threshold value. This sounds a lot more complicated than it is. Here is the Axis event handler: +
        case SDL_JOYAXISMOTION:  /* Handle Joystick Motion */
    +    if ( ( event.jaxis.value < -3200 ) || (event.jaxis.value > 3200 ) ) 
    +    {
    +      /* code goes here */
    +    }
    +    break;
    +Another trick with axis events is that up-down and left-right movement are two different sets of axes. The most important axis is axis 0 (left-right) and axis 1 (up-down). To handle them seperatly in the code we do the following: +
        case SDL_JOYAXISMOTION:  /* Handle Joystick Motion */
    +    if ( ( event.jaxis.value < -3200 ) || (event.jaxis.value > 3200 ) ) 
    +    {
    +        if( event.jaxis.axis == 0) 
    +        {
    +            /* Left-right movement code goes here */
    +        }
    +
    +        if( event.jaxis.axis == 1) 
    +        {
    +            /* Up-Down movement code goes here */
    +        }
    +    }
    +    break;
    +Ideally the code here should use event.jaxis.value to scale something. For example lets assume you are using the joystick to control the movement of a spaceship. If the user is using an analog joystick and they push the stick a little bit they expect to move less than if they pushed it a lot. Designing your code for this situation is preferred because it makes the experience for users of analog controls better and remains the same for users of digital controls.

    If your joystick has any additional axis then they may be used for other sticks or throttle controls and those axis return values too just with different event.jaxis.axis values.

    Button handling is simple compared to the axis checking. +

        case SDL_JOYBUTTONDOWN:  /* Handle Joystick Button Presses */
    +    if ( event.jbutton.button == 0 ) 
    +    {
    +        /* code goes here */
    +    }
    +    break;
    + +Button checks are simpler than axis checks because a button can only be pressed or not pressed. The SDL_JOYBUTTONDOWN event is triggered when a button is pressed and the SDL_JOYBUTTONUP event is fired when a button is released. We do have to know what button was pressed though, that is done by reading the event.jbutton.button field.

    Lastly when we are through using our joysticks we should close them with a call to SDL_JoystickClose. To close our opened joystick 0 we would do this at the end of our program: +

        SDL_JoystickClose(joystick);

    Advanced Joystick Functions

    That takes care of the controls that you can count on being on every joystick under the sun, but there are a few extra things that SDL can support. Joyballs are next on our list, they are alot like axis we a few minor differences. Joyballs store relative changes unlike the the absolute postion stored in a axis event. Also one trackball event contains both the change in x and they change in y. Our case for it is as follows: +

        case SDL_JOYBALLMOTION:  /* Handle Joyball Motion */
    +    if( event.jball.ball == 0 )
    +    {
    +      /* ball handling */
    +    }
    +    break;
    +The above checks the first joyball on the joystick. The change in position will be stored in event.jball.xrel and event.jball.yrel.

    Finally we have the hat event. Hats report only the direction they are pushed in. We check hat's position with the bitmasks: + +

    SDL_HAT_CENTERED
    SDL_HAT_UP
    SDL_HAT_RIGHT
    SDL_HAT_DOWN
    SDL_HAT_LEFT

    + +Also there are some predefined combinations of the above: +

    SDL_HAT_RIGHTUP
    SDL_HAT_RIGHTDOWN
    SDL_HAT_LEFTUP
    SDL_HAT_LEFTDOWN

    + +Our case for the hat may resemble the following: + +
        case SDL_JOYHATMOTION:  /* Handle Hat Motion */
    +    if ( event.jhat.hat | SDL_HAT_UP )
    +    {
    +        /* Do up stuff here */
    +    }
    +
    +    if ( event.jhat.hat | SDL_HAT_LEFT )
    +    {
    +        /* Do left stuff here */
    +    }
    +
    +    if ( event.jhat.hat | SDL_HAT_RIGHTDOWN )
    +    {
    +        /* Do right and down together stuff here */
    +    }
    +    break;

    In addition to the queries for number of joysticks on the system and their names there are additional functions to query the capabilities of attached joysticks: +

    SDL_JoystickNumAxesReturns the number of joysitck axes
    SDL_JoystickNumButtonsReturns the number of joysitck buttons
    SDL_JoystickNumBallsReturns the number of joysitck balls
    SDL_JoystickNumHatsReturns the number of joysitck hats

    + +To use these functions we just have to pass in the joystick structure we got when we opened the joystick. For Example: + +
        int number_of_buttons;
    +    SDL_Joystick *joystick;
    +
    +    joystick = SDL_JoystickOpen(0);
    +    number_of_buttons = SDL_JoystickNumButtons(joystick);
    + +This block of code would get the number of buttons on the first joystick in the system.


    PrevHomeNext
    Graphics and VideoUpHandling the Keyboard
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/guideinputkeyboard.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/guideinputkeyboard.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,715 @@ +Handling the Keyboard
    SDL Library Documentation
    PrevChapter 3. Input handlingNext

    Handling the Keyboard

    Keyboard Related Structures

    It should make it a lot easier to understand this tutorial is you are familiar with the data types involved in keyboard access, so I'll explain them first.

    SDLKey

    SDLKey is an enumerated type defined in SDL/include/SDL_keysym.h and detailed here. Each SDLKey symbol represents a key, SDLK_a corresponds to the 'a' key on a keyboard, SDLK_SPACE corresponds to the space bar, and so on.

    SDLMod

    SDLMod is an enumerated type, similar to SDLKey, however it enumerates keyboard modifiers (Control, Alt, Shift). The full list of modifier symbols is here. SDLMod values can be AND'd together to represent several modifiers.

    SDL_keysym

    typedef struct{
    +  Uint8 scancode;
    +  SDLKey sym;
    +  SDLMod mod;
    +  Uint16 unicode;
    +} SDL_keysym;

    The SDL_keysym structure describes a key press or a key release. The scancode field is hardware specific and should be ignored unless you know what your doing. The sym field is the SDLKey value of the key being pressed or released. The mod field describes the state of the keyboard modifiers at the time the key press or release occurred. So a value of KMOD_NUM | KMOD_CAPS | KMOD_LSHIFT would mean that Numlock, Capslock and the left shift key were all press (or enabled in the case of the lock keys). Finally, the unicode field stores the 16-bit unicode value of the key.

    Note: It should be noted and understood that this field is only valid when the SDL_keysym is describing a key press, not a key release. Unicode values only make sense on a key press because the unicode value describes an international character and only key presses produce characters. More information on Unicode can be found at www.unicode.org

    Note: Unicode translation must be enabled using the SDL_EnableUNICODE function.

    SDL_KeyboardEvent

    typedef struct{
    +  Uint8 type;
    +  Uint8 state;
    +  SDL_keysym keysym;
    +} SDL_KeyboardEvent;

    The SDL_KeyboardEvent describes a keyboard event (obviously). The key member of the SDL_Event union is a SDL_KeyboardEvent structure. The type field specifies whether the event is a key release (SDL_KEYUP) or a key press (SDL_KEYDOWN) event. The state is largely redundant, it reports the same information as the type field but uses different values (SDL_RELEASED and SDL_PRESSED). The keysym contains information of the key press or release that this event represents (see above).

    Reading Keyboard Events

    Reading keybaord events from the event queue is quite simple (the event queue and using it is described here). We read events using SDL_PollEvent in a while() loop and check for SDL_KEYUP and SDL_KEYDOWN events using a switch statement, like so: +

      SDL_Event event;
    +  .
    +  .
    +  /* Poll for events. SDL_PollEvent() returns 0 when there are no  */
    +  /* more events on the event queue, our while loop will exit when */
    +  /* that occurs.                                                  */
    +  while( SDL_PollEvent( &event ) ){
    +    /* We are only worried about SDL_KEYDOWN and SDL_KEYUP events */
    +    switch( event.type ){
    +      case SDL_KEYDOWN:
    +        printf( "Key press detected\n" );
    +        break;
    +
    +      case SDL_KEYUP:
    +        printf( "Key release detected\n" );
    +        break;
    +
    +      default:
    +        break;
    +    }
    +  }
    +  .
    +  .
    +This is a very basic example. No information about the key press or release is interpreted. We will explore the other extreme out our first full example below - reporting all available information about a keyboard event.

    A More Detailed Look

    Before we can read events SDL must be initialised with SDL_Init and a video mode must be set using SDL_SetVideoMode. There are, however, two other functions we must use to obtain all the information required. We must enable unicode translation by calling SDL_EnableUNICODE(1) and we must convert SDLKey values into something printable, using SDL_GetKeyName

    Note: It is useful to note that unicode values < 0x80 translate directly a characters ASCII value. THis is used in the example below

    Example 3-1. keys.c - Key event information

    
    #include "SDL.h"
    +
    +    /* Function Prototypes */
    +    void PrintKeyInfo( SDL_KeyboardEvent *key );
    +    void PrintModifiers( SDLMod mod );
    +
    +    /* main */
    +    int main( int argc, char *argv[] ){
    +        
    +        SDL_Event event;
    +        int quit = 0;
    +        
    +        /* Initialise SDL */
    +        if( SDL_Init( SDL_INIT_VIDEO ) ){
    +            fprintf( stderr, "Could not initialise SDL: %s\n", SDL_GetError() );
    +            exit( -1 );
    +        }
    +
    +        /* Set a video mode */
    +        if( !SDL_SetVideoMode( 320, 200, 0, 0 ) ){
    +            fprintf( stderr, "Could not set video mode: %s\n", SDL_GetError() );
    +            SDL_Quit();
    +            exit( -1 );
    +        }
    +
    +        /* Enable Unicode translation */
    +        SDL_EnableUNICODE( 1 );
    +
    +        /* Loop until an SDL_QUIT event is found */
    +        while( !quit ){
    +
    +            /* Poll for events */
    +            while( SDL_PollEvent( &event ) ){
    +                
    +                switch( event.type ){
    +                    /* Keyboard event */
    +                    /* Pass the event data onto PrintKeyInfo() */
    +                    case SDL_KEYDOWN:
    +                    case SDL_KEYUP:
    +                        PrintKeyInfo( &event.key );
    +                        break;
    +
    +                    /* SDL_QUIT event (window close) */
    +                    case SDL_QUIT:
    +                        quit = 1;
    +                        break;
    +
    +                    default:
    +                        break;
    +                }
    +
    +            }
    +
    +        }
    +
    +        /* Clean up */
    +        SDL_Quit();
    +        exit( 0 );
    +    }
    +
    +    /* Print all information about a key event */
    +    void PrintKeyInfo( SDL_KeyboardEvent *key ){
    +        /* Is it a release or a press? */
    +        if( key->type == SDL_KEYUP )
    +            printf( "Release:- " );
    +        else
    +            printf( "Press:- " );
    +
    +        /* Print the hardware scancode first */
    +        printf( "Scancode: 0x%02X", key->keysym.scancode );
    +        /* Print the name of the key */
    +        printf( ", Name: %s", SDL_GetKeyName( key->keysym.sym ) );
    +        /* We want to print the unicode info, but we need to make */
    +        /* sure its a press event first (remember, release events */
    +        /* don't have unicode info                                */
    +        if( key->type == SDL_KEYDOWN ){
    +            /* If the Unicode value is less than 0x80 then the    */
    +            /* unicode value can be used to get a printable       */
    +            /* representation of the key, using (char)unicode.    */
    +            printf(", Unicode: " );
    +            if( key->keysym.unicode < 0x80 && key->keysym.unicode > 0 ){
    +                printf( "%c (0x%04X)", (char)key->keysym.unicode,
    +                        key->keysym.unicode );
    +            }
    +            else{
    +                printf( "? (0x%04X)", key->keysym.unicode );
    +            }
    +        }
    +        printf( "\n" );
    +        /* Print modifier info */
    +        PrintModifiers( key->keysym.mod );
    +    }
    +
    +    /* Print modifier info */
    +    void PrintModifiers( SDLMod mod ){
    +        printf( "Modifers: " );
    +
    +        /* If there are none then say so and return */
    +        if( mod == KMOD_NONE ){
    +            printf( "None\n" );
    +            return;
    +        }
    +
    +        /* Check for the presence of each SDLMod value */
    +        /* This looks messy, but there really isn't    */
    +        /* a clearer way.                              */
    +        if( mod & KMOD_NUM ) printf( "NUMLOCK " );
    +        if( mod & KMOD_CAPS ) printf( "CAPSLOCK " );
    +        if( mod & KMOD_LCTRL ) printf( "LCTRL " );
    +        if( mod & KMOD_RCTRL ) printf( "RCTRL " );
    +        if( mod & KMOD_RSHIFT ) printf( "RSHIFT " );
    +        if( mod & KMOD_LSHIFT ) printf( "LSHIFT " );
    +        if( mod & KMOD_RALT ) printf( "RALT " );
    +        if( mod & KMOD_LALT ) printf( "LALT " );
    +        if( mod & KMOD_CTRL ) printf( "CTRL " );
    +        if( mod & KMOD_SHIFT ) printf( "SHIFT " );
    +        if( mod & KMOD_ALT ) printf( "ALT " );
    +        printf( "\n" );
    +    }

    Game-type Input

    I have found that people using keyboard events for games and other interactive applications don't always understand one fundemental point.

    Keyboard events only take place when a keys state changes from being unpressed to pressed, and vice versa.

    Imagine you have an image of an alien that you wish to move around using the cursor keys - when you pressed the left arrow key you want him to slide over to the left, when you press the down key you want him to slide down the screen. Examine the following code, it highlights and error that many people have made. +

        /* Alien screen coordinates */
    +    int alien_x=0, alien_y=0;
    +    .
    +    .
    +    /* Initialise SDL and video modes and all that */
    +    .
    +    /* Main game loop */
    +    /* Check for events */
    +    while( SDL_PollEvent( &event ) ){
    +        switch( event.type ){
    +            /* Look for a keypress */
    +            case SDL_KEYDOWN:
    +                /* Check the SDLKey values and move change the coords */
    +                switch( event.key.keysym.sym ){
    +                    case SDLK_LEFT:
    +                        alien_x -= 1;
    +                        break;
    +                    case SDLK_RIGHT:
    +                        alien_x += 1;
    +                        break;
    +                    case SDLK_UP:
    +                        alien_y -= 1;
    +                        break;
    +                    case SDLK_DOWN:
    +                        alien_y += 1;
    +                        break;
    +                    default:
    +                        break;
    +                }
    +            }
    +        }
    +    }
    +    .
    +    .
    +At first glance you may think this is a perfectly reasonable piece of code for the task, but it isn't. Like I said keyboard events only occur when a key changes state, so the user would have to press and release the left cursor key 100 times to move the alien 100 pixels to the left.

    To get around this problem we must not use the events to change the position of the alien, we use the events to set flags which are then used in a seperate section of code to move the alien. Something like this: +

        /* Alien screen coordinates */
    +    int alien_x=0, alien_y=0;
    +    int alien_xvel=0, alien_yvel=0;
    +    .
    +    .
    +    /* Initialise SDL and video modes and all that */
    +    .
    +    /* Main game loop */
    +    /* Check for events */
    +    while( SDL_PollEvent( &event ) ){
    +        switch( event.type ){
    +            /* Look for a keypress */
    +            case SDL_KEYDOWN:
    +                /* Check the SDLKey values and move change the coords */
    +                switch( event.key.keysym.sym ){
    +                    case SDLK_LEFT:
    +                        alien_xvel = -1;
    +                        break;
    +                    case SDLK_RIGHT:
    +                        alien_xvel =  1;
    +                        break;
    +                    case SDLK_UP:
    +                        alien_yvel = -1;
    +                        break;
    +                    case SDLK_DOWN:
    +                        alien_yvel =  1;
    +                        break;
    +                    default:
    +                        break;
    +                }
    +                break;
    +            /* We must also use the SDL_KEYUP events to zero the x */
    +            /* and y velocity variables. But we must also be       */
    +            /* careful not to zero the velocities when we shouldn't*/
    +            case SDL_KEYUP:
    +                switch( event.key.keysym.sym ){
    +                    case SDLK_LEFT:
    +                        /* We check to make sure the alien is moving */
    +                        /* to the left. If it is then we zero the    */
    +                        /* velocity. If the alien is moving to the   */
    +                        /* right then the right key is still press   */
    +                        /* so we don't tocuh the velocity            */
    +                        if( alien_xvel < 0 )
    +                            alien_xvel = 0;
    +                        break;
    +                    case SDLK_RIGHT:
    +                        if( alien_xvel > 0 )
    +                            alien_xvel = 0;
    +                        break;
    +                    case SDLK_UP:
    +                        if( alien_yvel < 0 )
    +                            alien_yvel = 0;
    +                        break;
    +                    case SDLK_DOWN:
    +                        if( alien_yvel > 0 )
    +                            alien_yvel = 0;
    +                        break;
    +                    default:
    +                        break;
    +                }
    +                break;
    +            
    +            default:
    +                break;
    +        }
    +    }
    +    .
    +    .
    +    /* Update the alien position */
    +    alien_x += alien_xvel;
    +    alien_y += alien_yvel;
    +As can be seen, we use two extra variables, alien_xvel and alien_yvel, which represent the motion of the ship, it is these variables that we update when we detect keypresses and releases.


    PrevHomeNext
    Input handlingUpExamples
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/guidepreface.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/guidepreface.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,170 @@ +Preface
    SDL Library Documentation
    PrevNext

    Preface

    About SDL

    The SDL library is designed to make it easy to write games that run on Linux, *BSD, MacOS, Win32 and BeOS using the various native high-performance media interfaces, (for video, audio, etc) and presenting a single source-code level API to your application. SDL is a fairly low level API, but using it, completely portable applications can be written with a great deal of flexibility.


    PrevHomeNext
    SDL GuideUpAbout SDLdoc
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/guidethebasics.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/guidethebasics.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,165 @@ +The Basics
    SDL Library Documentation
    PrevNext

    Chapter 1. The Basics

    Introduction

    The SDL Guide section is pretty incomplete. If you feel you have anything to add mail akawaka@skynet.ie or visit http://akawaka.csn.ul.ie/tne/.


    PrevHomeNext
    CreditsUpInitializing SDL
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/guidetimeexamples.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/guidetimeexamples.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,173 @@ +Time Examples
    SDL Library Documentation
    PrevChapter 4. ExamplesNext

    Time Examples

    Time based game loop

    #define TICK_INTERVAL    30
    +
    +Uint32 TimeLeft(void)
    +{
    +    static Uint32 next_time = 0;
    +    Uint32 now;
    +
    +    now = SDL_GetTicks();
    +    if ( next_time <= now ) {
    +        next_time = now+TICK_INTERVAL;
    +        return(0);
    +    }
    +    return(next_time-now);
    +}
    +
    +
    +/* main game loop
    +
    +    while ( game_running ) {
    +        UpdateGameState();
    +        SDL_Delay(TimeLeft());
    +    }


    PrevHomeNext
    CDROM ExamplesUpSDL Reference
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/guidevideo.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/guidevideo.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,705 @@ +Graphics and Video
    SDL Library Documentation
    PrevNext

    Chapter 2. Graphics and Video

    Using OpenGL With SDL

    SDL has the ability to create and use OpenGL contexts on several platforms(Linux/X11, Win32, BeOS, MacOS Classic/Toolbox, MacOS X, FreeBSD/X11 and Solaris/X11). This allows you to use SDL's audio, event handling, threads and times in your OpenGL applications (a function often performed by GLUT).

    Initialisation

    Initialising SDL to use OpenGL is not very different to initialising SDL normally. There are three differences; you must pass SDL_OPENGL to SDL_SetVideoMode, you must specify several GL attributes (depth buffer size, framebuffer sizes) using SDL_GL_SetAttribute and finally, if you wish to use double buffering you must specify it as a GL attribute, not by passing the SDL_DOUBLEBUF flag to SDL_SetVideoMode. +

        /* Information about the current video settings. */
    +    const SDL_VideoInfo* info = NULL;
    +    /* Dimensions of our window. */
    +    int width = 0;
    +    int height = 0;
    +    /* Color depth in bits of our window. */
    +    int bpp = 0;
    +    /* Flags we will pass into SDL_SetVideoMode. */
    +    int flags = 0;
    +
    +    /* First, initialize SDL's video subsystem. */
    +    if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) {
    +        /* Failed, exit. */
    +        fprintf( stderr, "Video initialization failed: %s\n",
    +             SDL_GetError( ) );
    +        quit_tutorial( 1 );
    +    }
    +
    +    /* Let's get some video information. */
    +    info = SDL_GetVideoInfo( );
    +
    +    if( !info ) {
    +        /* This should probably never happen. */
    +        fprintf( stderr, "Video query failed: %s\n",
    +             SDL_GetError( ) );
    +        quit_tutorial( 1 );
    +    }
    +
    +    /*
    +     * Set our width/height to 640/480 (you would
    +     * of course let the user decide this in a normal
    +     * app). We get the bpp we will request from
    +     * the display. On X11, VidMode can't change
    +     * resolution, so this is probably being overly
    +     * safe. Under Win32, ChangeDisplaySettings
    +     * can change the bpp.
    +     */
    +    width = 640;
    +    height = 480;
    +    bpp = info->vfmt->BitsPerPixel;
    +
    +    /*
    +     * Now, we want to setup our requested
    +     * window attributes for our OpenGL window.
    +     * We want *at least* 5 bits of red, green
    +     * and blue. We also want at least a 16-bit
    +     * depth buffer.
    +     *
    +     * The last thing we do is request a double
    +     * buffered window. '1' turns on double
    +     * buffering, '0' turns it off.
    +     *
    +     * Note that we do not use SDL_DOUBLEBUF in
    +     * the flags to SDL_SetVideoMode. That does
    +     * not affect the GL attribute state, only
    +     * the standard 2D blitting setup.
    +     */
    +    SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
    +    SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
    +    SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
    +    SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
    +    SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
    +
    +    /*
    +     * We want to request that SDL provide us
    +     * with an OpenGL window, in a fullscreen
    +     * video mode.
    +     *
    +     * EXERCISE:
    +     * Make starting windowed an option, and
    +     * handle the resize events properly with
    +     * glViewport.
    +     */
    +    flags = SDL_OPENGL | SDL_FULLSCREEN;
    +
    +    /*
    +     * Set the video mode
    +     */
    +    if( SDL_SetVideoMode( width, height, bpp, flags ) == 0 ) {
    +        /* 
    +         * This could happen for a variety of reasons,
    +         * including DISPLAY not being set, the specified
    +         * resolution not being available, etc.
    +         */
    +        fprintf( stderr, "Video mode set failed: %s\n",
    +             SDL_GetError( ) );
    +        quit_tutorial( 1 );
    +    }

    Drawing

    Apart from initialisation, using OpenGL within SDL is the same as using. However if you have request a double buffered display (using SDL_GL_SetAttribute) and one (which can be checked by using SDL_GL_GetAttribute), then you must use SDL_GL_SwapBuffers() to swap the buffers and update the display.

    A full example code listing is now presented below.

    Example 2-1. gl.c - SDL OpenGL Example

    /*
    + * SDL OpenGL Tutorial.
    + * (c) Michael Vance, 2000
    + * briareos@lokigames.com
    + *
    + * Distributed under terms of the LGPL. 
    + */
    +
    +#include <SDL/SDL.h>
    +#include <GL/gl.h>
    +#include <GL/glu.h>
    +
    +#include <stdio.h>
    +#include <stdlib.h>
    +
    +static GLboolean should_rotate = GL_TRUE;
    +
    +static void quit_tutorial( int code )
    +{
    +    /*
    +     * Quit SDL so we can release the fullscreen
    +     * mode and restore the previous video settings,
    +     * etc.
    +     */
    +    SDL_Quit( );
    +
    +    /* Exit program. */
    +    exit( code );
    +}
    +
    +static void handle_key_down( SDL_keysym* keysym )
    +{
    +
    +    /* 
    +     * We're only interested if 'Esc' has
    +     * been presssed.
    +     *
    +     * EXERCISE: 
    +     * Handle the arrow keys and have that change the
    +     * viewing position/angle.
    +     */
    +    switch( keysym->sym ) {
    +    case SDLK_ESCAPE:
    +        quit_tutorial( 0 );
    +        break;
    +    case SDLK_SPACE:
    +        should_rotate = !should_rotate;
    +        break;
    +    default:
    +        break;
    +    }
    +
    +}
    +
    +static void process_events( void )
    +{
    +    /* Our SDL event placeholder. */
    +    SDL_Event event;
    +
    +    /* Grab all the events off the queue. */
    +    while( SDL_PollEvent( &event ) ) {
    +
    +        switch( event.type ) {
    +        case SDL_KEYDOWN:
    +            /* Handle key presses. */
    +            handle_key_down( &event.key.keysym );
    +            break;
    +        case SDL_QUIT:
    +            /* Handle quit requests (like Ctrl-c). */
    +            quit_tutorial( 0 );
    +            break;
    +        }
    +
    +    }
    +
    +}
    +
    +static void draw_screen( void )
    +{
    +    /* Our angle of rotation. */
    +    static float angle = 0.0f;
    +
    +    /*
    +     * EXERCISE:
    +     * Replace this awful mess with vertex
    +     * arrays and a call to glDrawElements.
    +     *
    +     * EXERCISE:
    +     * After completing the above, change
    +     * it to use compiled vertex arrays.
    +     *
    +     * EXERCISE:
    +     * Verify my windings are correct here ;).
    +     */
    +    static GLfloat v0[] = { -1.0f, -1.0f,  1.0f };
    +    static GLfloat v1[] = {  1.0f, -1.0f,  1.0f };
    +    static GLfloat v2[] = {  1.0f,  1.0f,  1.0f };
    +    static GLfloat v3[] = { -1.0f,  1.0f,  1.0f };
    +    static GLfloat v4[] = { -1.0f, -1.0f, -1.0f };
    +    static GLfloat v5[] = {  1.0f, -1.0f, -1.0f };
    +    static GLfloat v6[] = {  1.0f,  1.0f, -1.0f };
    +    static GLfloat v7[] = { -1.0f,  1.0f, -1.0f };
    +    static GLubyte red[]    = { 255,   0,   0, 255 };
    +    static GLubyte green[]  = {   0, 255,   0, 255 };
    +    static GLubyte blue[]   = {   0,   0, 255, 255 };
    +    static GLubyte white[]  = { 255, 255, 255, 255 };
    +    static GLubyte yellow[] = {   0, 255, 255, 255 };
    +    static GLubyte black[]  = {   0,   0,   0, 255 };
    +    static GLubyte orange[] = { 255, 255,   0, 255 };
    +    static GLubyte purple[] = { 255,   0, 255,   0 };
    +
    +    /* Clear the color and depth buffers. */
    +    glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
    +
    +    /* We don't want to modify the projection matrix. */
    +    glMatrixMode( GL_MODELVIEW );
    +    glLoadIdentity( );
    +
    +    /* Move down the z-axis. */
    +    glTranslatef( 0.0, 0.0, -5.0 );
    +
    +    /* Rotate. */
    +    glRotatef( angle, 0.0, 1.0, 0.0 );
    +
    +    if( should_rotate ) {
    +
    +        if( ++angle > 360.0f ) {
    +            angle = 0.0f;
    +        }
    +
    +    }
    +
    +    /* Send our triangle data to the pipeline. */
    +    glBegin( GL_TRIANGLES );
    +
    +    glColor4ubv( red );
    +    glVertex3fv( v0 );
    +    glColor4ubv( green );
    +    glVertex3fv( v1 );
    +    glColor4ubv( blue );
    +    glVertex3fv( v2 );
    +
    +    glColor4ubv( red );
    +    glVertex3fv( v0 );
    +    glColor4ubv( blue );
    +    glVertex3fv( v2 );
    +    glColor4ubv( white );
    +    glVertex3fv( v3 );
    +
    +    glColor4ubv( green );
    +    glVertex3fv( v1 );
    +    glColor4ubv( black );
    +    glVertex3fv( v5 );
    +    glColor4ubv( orange );
    +    glVertex3fv( v6 );
    +
    +    glColor4ubv( green );
    +    glVertex3fv( v1 );
    +    glColor4ubv( orange );
    +    glVertex3fv( v6 );
    +    glColor4ubv( blue );
    +    glVertex3fv( v2 );
    +
    +    glColor4ubv( black );
    +    glVertex3fv( v5 );
    +    glColor4ubv( yellow );
    +    glVertex3fv( v4 );
    +    glColor4ubv( purple );
    +    glVertex3fv( v7 );
    +
    +    glColor4ubv( black );
    +    glVertex3fv( v5 );
    +    glColor4ubv( purple );
    +    glVertex3fv( v7 );
    +    glColor4ubv( orange );
    +    glVertex3fv( v6 );
    +
    +    glColor4ubv( yellow );
    +    glVertex3fv( v4 );
    +    glColor4ubv( red );
    +    glVertex3fv( v0 );
    +    glColor4ubv( white );
    +    glVertex3fv( v3 );
    +
    +    glColor4ubv( yellow );
    +    glVertex3fv( v4 );
    +    glColor4ubv( white );
    +    glVertex3fv( v3 );
    +    glColor4ubv( purple );
    +    glVertex3fv( v7 );
    +
    +    glColor4ubv( white );
    +    glVertex3fv( v3 );
    +    glColor4ubv( blue );
    +    glVertex3fv( v2 );
    +    glColor4ubv( orange );
    +    glVertex3fv( v6 );
    +
    +    glColor4ubv( white );
    +    glVertex3fv( v3 );
    +    glColor4ubv( orange );
    +    glVertex3fv( v6 );
    +    glColor4ubv( purple );
    +    glVertex3fv( v7 );
    +
    +    glColor4ubv( green );
    +    glVertex3fv( v1 );
    +    glColor4ubv( red );
    +    glVertex3fv( v0 );
    +    glColor4ubv( yellow );
    +    glVertex3fv( v4 );
    +
    +    glColor4ubv( green );
    +    glVertex3fv( v1 );
    +    glColor4ubv( yellow );
    +    glVertex3fv( v4 );
    +    glColor4ubv( black );
    +    glVertex3fv( v5 );
    +
    +    glEnd( );
    +
    +    /*
    +     * EXERCISE:
    +     * Draw text telling the user that 'Spc'
    +     * pauses the rotation and 'Esc' quits.
    +     * Do it using vetors and textured quads.
    +     */
    +
    +    /*
    +     * Swap the buffers. This this tells the driver to
    +     * render the next frame from the contents of the
    +     * back-buffer, and to set all rendering operations
    +     * to occur on what was the front-buffer.
    +     *
    +     * Double buffering prevents nasty visual tearing
    +     * from the application drawing on areas of the
    +     * screen that are being updated at the same time.
    +     */
    +    SDL_GL_SwapBuffers( );
    +}
    +
    +static void setup_opengl( int width, int height )
    +{
    +    float ratio = (float) width / (float) height;
    +
    +    /* Our shading model--Gouraud (smooth). */
    +    glShadeModel( GL_SMOOTH );
    +
    +    /* Culling. */
    +    glCullFace( GL_BACK );
    +    glFrontFace( GL_CCW );
    +    glEnable( GL_CULL_FACE );
    +
    +    /* Set the clear color. */
    +    glClearColor( 0, 0, 0, 0 );
    +
    +    /* Setup our viewport. */
    +    glViewport( 0, 0, width, height );
    +
    +    /*
    +     * Change to the projection matrix and set
    +     * our viewing volume.
    +     */
    +    glMatrixMode( GL_PROJECTION );
    +    glLoadIdentity( );
    +    /*
    +     * EXERCISE:
    +     * Replace this with a call to glFrustum.
    +     */
    +    gluPerspective( 60.0, ratio, 1.0, 1024.0 );
    +}
    +
    +int main( int argc, char* argv[] )
    +{
    +    /* Information about the current video settings. */
    +    const SDL_VideoInfo* info = NULL;
    +    /* Dimensions of our window. */
    +    int width = 0;
    +    int height = 0;
    +    /* Color depth in bits of our window. */
    +    int bpp = 0;
    +    /* Flags we will pass into SDL_SetVideoMode. */
    +    int flags = 0;
    +
    +    /* First, initialize SDL's video subsystem. */
    +    if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) {
    +        /* Failed, exit. */
    +        fprintf( stderr, "Video initialization failed: %s\n",
    +             SDL_GetError( ) );
    +        quit_tutorial( 1 );
    +    }
    +
    +    /* Let's get some video information. */
    +    info = SDL_GetVideoInfo( );
    +
    +    if( !info ) {
    +        /* This should probably never happen. */
    +        fprintf( stderr, "Video query failed: %s\n",
    +             SDL_GetError( ) );
    +        quit_tutorial( 1 );
    +    }
    +
    +    /*
    +     * Set our width/height to 640/480 (you would
    +     * of course let the user decide this in a normal
    +     * app). We get the bpp we will request from
    +     * the display. On X11, VidMode can't change
    +     * resolution, so this is probably being overly
    +     * safe. Under Win32, ChangeDisplaySettings
    +     * can change the bpp.
    +     */
    +    width = 640;
    +    height = 480;
    +    bpp = info->vfmt->BitsPerPixel;
    +
    +    /*
    +     * Now, we want to setup our requested
    +     * window attributes for our OpenGL window.
    +     * We want *at least* 5 bits of red, green
    +     * and blue. We also want at least a 16-bit
    +     * depth buffer.
    +     *
    +     * The last thing we do is request a double
    +     * buffered window. '1' turns on double
    +     * buffering, '0' turns it off.
    +     *
    +     * Note that we do not use SDL_DOUBLEBUF in
    +     * the flags to SDL_SetVideoMode. That does
    +     * not affect the GL attribute state, only
    +     * the standard 2D blitting setup.
    +     */
    +    SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
    +    SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
    +    SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
    +    SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
    +    SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
    +
    +    /*
    +     * We want to request that SDL provide us
    +     * with an OpenGL window, in a fullscreen
    +     * video mode.
    +     *
    +     * EXERCISE:
    +     * Make starting windowed an option, and
    +     * handle the resize events properly with
    +     * glViewport.
    +     */
    +    flags = SDL_OPENGL | SDL_FULLSCREEN;
    +
    +    /*
    +     * Set the video mode
    +     */
    +    if( SDL_SetVideoMode( width, height, bpp, flags ) == 0 ) {
    +        /* 
    +         * This could happen for a variety of reasons,
    +         * including DISPLAY not being set, the specified
    +         * resolution not being available, etc.
    +         */
    +        fprintf( stderr, "Video mode set failed: %s\n",
    +             SDL_GetError( ) );
    +        quit_tutorial( 1 );
    +    }
    +
    +    /*
    +     * At this point, we should have a properly setup
    +     * double-buffered window for use with OpenGL.
    +     */
    +    setup_opengl( width, height );
    +
    +    /*
    +     * Now we want to begin our normal app process--
    +     * an event loop with a lot of redrawing.
    +     */
    +    while( 1 ) {
    +        /* Process incoming events. */
    +        process_events( );
    +        /* Draw the screen. */
    +        draw_screen( );
    +    }
    +
    +    /*
    +     * EXERCISE:
    +     * Record timings using SDL_GetTicks() and
    +     * and print out frames per second at program
    +     * end.
    +     */
    +
    +    /* Never reached. */
    +    return 0;
    +}

    PrevHomeNext
    Initializing SDLUpInput handling
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/guidevideoexamples.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/guidevideoexamples.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,473 @@ +Video Examples
    SDL Library Documentation
    PrevChapter 4. ExamplesNext

    Video Examples

    Initializing the video display

        SDL_Surface *screen;
    +
    +    /* Initialize the SDL library */
    +    if( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
    +        fprintf(stderr,
    +                "Couldn't initialize SDL: %s\n", SDL_GetError());
    +        exit(1);
    +    }
    +
    +    /* Clean up on exit */
    +    atexit(SDL_Quit);
    +
    +    /* Initialize the display in a 640x480 8-bit palettized mode */
    +    screen = SDL_SetVideoMode(640, 480, 8, SDL_SWSURFACE);
    +    if ( screen == NULL ) {
    +        fprintf(stderr, "Couldn't set 640x480x8 video mode: %s\n",
    +                        SDL_GetError());
    +        exit(1);
    +    }

    Initializing the best video mode

        /* Have a preference for 8-bit, but accept any depth */
    +    screen = SDL_SetVideoMode(640, 480, 8, SDL_SWSURFACE|SDL_ANYFORMAT);
    +    if ( screen == NULL ) {
    +        fprintf(stderr, "Couldn't set 640x480x8 video mode: %s\n",
    +                        SDL_GetError());
    +        exit(1);
    +    }
    +    printf("Set 640x480 at %d bits-per-pixel mode\n",
    +           screen->format->BitsPerPixel);

    Loading and displaying a BMP file

        SDL_Surface *image;
    +    SDL_Rect dest;
    +    int ncolors, i;
    +    SDL_Color *colors;
    +
    +    /* Load the BMP file into a surface */
    +    image = SDL_LoadBMP("sample.bmp");
    +    if ( image == NULL ) {
    +        fprintf(stderr, "Couldn't load sample.bmp: %s\n",
    +                        SDL_GetError());
    +        return;
    +    }
    +
    +    /* Set the display colors -- SDL_SetColors() only does something on
    +       palettized displays, but it doesn't hurt anything on HiColor or
    +       TrueColor displays.
    +       If the display colors have already been set, this step can be
    +       skipped, and the library will automatically map the image to
    +       the current display colors.
    +    */
    +    if ( image->format->palette ) {
    +        ncolors = image->format->palette->ncolors;
    +        colors  = (SDL_Color *)malloc(ncolors*sizeof(SDL_Color));
    +        memcpy(colors, image->format->palette->colors, ncolors);
    +    } 
    +    else {
    +        int r, g, b;
    +
    +        /* Allocate 256 color palette */
    +        ncolors = 256;
    +        colors  = (SDL_Color *)malloc(ncolors*sizeof(SDL_Color));
    +
    +        /* Set a 3,3,2 color cube */
    +        for ( r=0; r<8; ++r ) {
    +            for ( g=0; g<8; ++g ) {
    +                for ( b=0; b<4; ++b ) {
    +                    i = ((r<<5)|(g<<2)|b);
    +                    colors[i].r = r<<5;
    +                    colors[i].g = g<<5;
    +                    colors[i].b = b<<6;
    +                }
    +            }
    +        }
    +        /* Note: A better way of allocating the palette might be
    +           to calculate the frequency of colors in the image
    +           and create a palette based on that information.
    +        */
    +    }
    +    /* Set colormap, try for all the colors, but don't worry about it */
    +    SDL_SetColors(screen, colors, 0, ncolors);
    +    free(colors);
    +
    +    /* Blit onto the screen surface */
    +    dest.x = 0;
    +    dest.y = 0;
    +    dest.w = image->w;
    +    dest.h = image->h;
    +    SDL_BlitSurface(image, NULL, screen, &dest);
    +
    +    SDL_UpdateRects(screen, 1, &dest);
    +
    +    /* Free the allocated BMP surface */
    +    SDL_FreeSurface(image);
    +    return;

    Drawing directly to the display

        /* Code to set a yellow pixel at the center of the screen */
    +
    +    Sint32   X, Y;
    +    Uint32   pixel;
    +    Uint8   *bits, bpp;
    +
    +    /* Map the color yellow to this display (R=0xFF, G=0xFF, B=0x00)
    +       Note:  If the display is palettized, you must set the palette first.
    +    */
    +    pixel = SDL_MapRGB(screen->format, 0xFF, 0xFF, 0x00);
    +
    +    /* Calculate the framebuffer offset of the center of the screen */
    +    if ( SDL_MUSTLOCK(screen) ) {
    +        if ( SDL_LockSurface(screen) < 0 )
    +            return;
    +    }
    +    bpp = screen->format->BytesPerPixel;
    +    X = screen->w/2;
    +    Y = screen->h/2;
    +    bits = ((Uint8 *)screen->pixels)+Y*screen->pitch+X*bpp;
    +
    +    /* Set the pixel */
    +    switch(bpp) {
    +        case 1:
    +            *((Uint8 *)(bits)) = (Uint8)pixel;
    +            break;
    +        case 2:
    +            *((Uint16 *)(bits)) = (Uint16)pixel;
    +            break;
    +        case 3: { /* Format/endian independent */
    +            Uint8 r, g, b;
    +
    +            r = (pixel>>screen->format->Rshift)&0xFF;
    +            g = (pixel>>screen->format->Gshift)&0xFF;
    +            b = (pixel>>screen->format->Bshift)&0xFF;
    +            *((bits)+screen->format->Rshift/8) = r; 
    +            *((bits)+screen->format->Gshift/8) = g;
    +            *((bits)+screen->format->Bshift/8) = b;
    +            }
    +            break;
    +        case 4:
    +            *((Uint32 *)(bits)) = (Uint32)pixel;
    +            break;
    +    }
    +
    +    /* Update the display */
    +    if ( SDL_MUSTLOCK(screen) ) {
    +        SDL_UnlockSurface(screen);
    +    }
    +    SDL_UpdateRect(screen, X, Y, 1, 1);
    +
    +    return;

    Fastest possible surface blit

    There are three different ways you can draw an image to the screen: +

    1.Create a surface and use SDL_BlitSurface to blit it to the screen
    2.Create the video surface in system memory and call SDL_UpdateRect
    3.Create the video surface in video memory and call SDL_LockSurface

    +The best way to do this is to combine methods: +
    #include <stdio.h>
    +#include <stdlib.h>
    +#include "SDL.h"
    +#include "SDL_timer.h"
    +
    +void ComplainAndExit(void)
    +{
    +    fprintf(stderr, "Problem: %s\n", SDL_GetError());
    +    exit(1);
    +}
    +
    +int main(int argc, char *argv[])
    +{
    +    SDL_PixelFormat fmt;
    +    SDL_Surface *screen, *locked;
    +    SDL_Surface *imagebmp, *image;
    +    SDL_Rect dstrect;
    +    int i;
    +    Uint8 *buffer;
    +
    +    /* Initialize SDL */
    +    if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) {
    +        ComplainAndExit();
    +    }
    +    atexit(SDL_Quit);
    +
    +    /* Load a BMP image into a surface */
    +    imagebmp = SDL_LoadBMP("image.bmp");
    +    if ( imagebmp == NULL ) {
    +        ComplainAndExit();
    +    }
    +
    +    /* Set the video mode (640x480 at native depth) */
    +    screen = SDL_SetVideoMode(640, 480, 0, SDL_HWSURFACE|SDL_FULLSCREEN);
    +    if ( screen == NULL ) {
    +        ComplainAndExit();
    +    }
    +
    +    /* Set the video colormap */
    +    if ( imagebmp->format->palette != NULL ) {
    +        SDL_SetColors(screen,
    +                      imagebmp->format->palette->colors, 0,
    +                      imagebmp->format->palette->ncolors);
    +    }
    +
    +    /* Convert the image to the video format (maps colors) */
    +    image = SDL_DisplayFormat(imagebmp);
    +    SDL_FreeSurface(imagebmp);
    +    if ( image == NULL ) {
    +        ComplainAndExit();
    +    }
    +
    +    /* Draw bands of color on the raw surface */
    +    if ( SDL_MUSTLOCK(screen) ) {
    +        if ( SDL_LockSurface(screen) < 0 )
    +            ComplainAndExit();
    +    }
    +    buffer=(Uint8 *)screen->pixels;
    +    for ( i=0; i<screen->h; ++i ) {
    +        memset(buffer,(i*255)/screen->h,
    +               screen->w*screen->format->BytesPerPixel);
    +               buffer += screen->pitch;
    +    }
    +    if ( SDL_MUSTLOCK(screen) ) {
    +        SDL_UnlockSurface(screen);
    +    }
    +
    +    /* Blit the image to the center of the screen */
    +    dstrect.x = (screen->w-image->w)/2;
    +    dstrect.y = (screen->h-image->h)/2;
    +    dstrect.w = image->w;
    +    dstrect.h = image->h;
    +    if ( SDL_BlitSurface(image, NULL, screen, &dstrect) < 0 ) {
    +        SDL_FreeSurface(image);
    +        ComplainAndExit();
    +    }
    +    SDL_FreeSurface(image);
    +
    +    /* Update the screen */
    +    SDL_UpdateRects(screen, 1, &dstrect);
    +
    +    SDL_Delay(5000);        /* Wait 5 seconds */
    +    exit(0);
    +}


    PrevHomeNext
    ExamplesUpEvent Examples
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/index.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,1049 @@ +
    Table of Contents
    I. SDL Guide
    Preface
    About SDL
    About SDLdoc
    Credits
    1. The Basics
    Introduction
    Initializing SDL
    2. Graphics and Video
    Using OpenGL With SDL
    3. Input handling
    Handling Joysticks
    Handling the Keyboard
    4. Examples
    Introduction
    Video Examples
    Event Examples
    Audio Examples
    CDROM Examples
    Time Examples
    II. SDL Reference
    5. General
    SDL_Init — Initializes SDL
    SDL_InitSubSystem — Initialize subsystems
    SDL_QuitSubSystem — Shut down a subsystem
    SDL_Quit — Shut down SDL
    SDL_WasInit — Check which subsystems are initialized
    6. Video
    SDL_GetVideoSurface — returns a pointer to the current display surface
    SDL_GetVideoInfo — returns a pointer to information about the video hardware
    SDL_VideoDriverName — Obtain the name of the video driver
    SDL_ListModes — Returns a pointer to an array of available screen dimensions for +the given format and video flags
    SDL_VideoModeOK — Check to see if a particular video mode is supported.
    SDL_SetVideoMode — Set up a video mode with the specified width, height and bits-per-pixel.
    SDL_UpdateRect — Makes sure the given area is updated on the given screen.
    SDL_UpdateRects — Makes sure the given list of rectangles is updated on the given screen.
    SDL_Flip — Swaps screen buffers
    SDL_SetColors — Sets a portion of the colormap for the given 8-bit surface.
    SDL_SetPalette — Sets the colors in the palette of an 8-bit surface.
    SDL_SetGamma — Sets the color gamma function for the display
    SDL_GetGammaRamp — Gets the color gamma lookup tables for the display
    SDL_SetGammaRamp — Sets the color gamma lookup tables for the display
    SDL_MapRGB — Map a RGB color value to a pixel format.
    SDL_MapRGBA — Map a RGBA color value to a pixel format.
    SDL_GetRGB — Get RGB values from a pixel in the specified pixel format.
    SDL_GetRGBA — Get RGBA values from a pixel in the specified pixel format.
    SDL_CreateRGBSurface — Create an empty SDL_Surface
    SDL_CreateRGBSurfaceFrom — Create an SDL_Surface from pixel data
    SDL_FreeSurface — Frees (deletes) and SDL_Surface
    SDL_LockSurface — Lock a surface for directly access.
    SDL_UnlockSurface — Unlocks a previously locked surface.
    SDL_LoadBMP — Load a Windows BMP file into an SDL_Surface.
    SDL_SaveBMP — Save an SDL_Surface as a Windows BMP file.
    SDL_SetColorKey — Sets the color key (transparent pixel) in a blittable surface and +RLE acceleration.
    SDL_SetAlpha — Adjust the alpha properties of a surface
    SDL_SetClipRect — Sets the clipping rectangle for a surface.
    SDL_GetClipRect — Gets the clipping rectangle for a surface.
    SDL_ConvertSurface — Converts a surface to the same format as another surface.
    SDL_BlitSurface — This performs a fast blit from the source surface to the destination surface.
    SDL_FillRect — This function performs a fast fill of the given rectangle with some color
    SDL_DisplayFormat — Convert a surface to the display format
    SDL_DisplayFormatAlpha — Convert a surface to the display format
    SDL_WarpMouse — Set the position of the mouse cursor.
    SDL_CreateCursor — Creates a new mouse cursor.
    SDL_FreeCursor — Frees a cursor created with SDL_CreateCursor.
    SDL_SetCursor — Set the currently active mouse cursor.
    SDL_GetCursor — Get the currently active mouse cursor.
    SDL_ShowCursor — Toggle whether or not the cursor is shown on the screen.
    SDL_GL_LoadLibrary — Specify an OpenGL library
    SDL_GL_GetProcAddress — Get the address of a GL function
    SDL_GL_GetAttribute — Get the value of a special SDL/OpenGL attribute
    SDL_GL_SetAttribute — Set a special SDL/OpenGL attribute
    SDL_GL_SwapBuffers — Swap OpenGL framebuffers/Update Display
    SDL_CreateYUVOverlay — Create a YUV video overlay
    SDL_LockYUVOverlay — Lock an overlay
    SDL_UnlockYUVOverlay — Unlock an overlay
    SDL_DisplayYUVOverlay — Blit the overlay to the display
    SDL_FreeYUVOverlay — Free a YUV video overlay
    SDL_GLattr — SDL GL Attributes
    SDL_Rect — Defines a rectangular area
    SDL_Color — Format independent color description
    SDL_Palette — Color palette for 8-bit pixel formats
    SDL_PixelFormat — Stores surface format information
    SDL_Surface — Graphical Surface Structure
    SDL_VideoInfo — Video Target information
    SDL_Overlay — YUV video overlay
    7. Window Management
    SDL_WM_SetCaption — Sets the window tile and icon name.
    SDL_WM_GetCaption — Gets the window title and icon name.
    SDL_WM_SetIcon — Sets the icon for the display window.
    SDL_WM_IconifyWindow — Iconify/Minimise the window
    SDL_WM_ToggleFullScreen — Toggles fullscreen mode
    SDL_WM_GrabInput — Grabs mouse and keyboard input.
    8. Events
    Introduction
    SDL Event Structures.
    Event Functions.
    9. Joystick
    SDL_NumJoysticks — Count available joysticks.
    SDL_JoystickName — Get joystick name.
    SDL_JoystickOpen — Opens a joystick for use.
    SDL_JoystickOpened — Determine if a joystick has been opened
    SDL_JoystickIndex — Get the index of an SDL_Joystick.
    SDL_JoystickNumAxes — Get the number of joystick axes
    SDL_JoystickNumBalls — Get the number of joystick trackballs
    SDL_JoystickNumHats — Get the number of joystick hats
    SDL_JoystickNumButtons — Get the number of joysitck buttons
    SDL_JoystickUpdate — Updates the state of all joysticks
    SDL_JoystickGetAxis — Get the current state of an axis
    SDL_JoystickGetHat — Get the current state of a joystick hat
    SDL_JoystickGetButton — Get the current state of a given button on a given joystick
    SDL_JoystickGetBall — Get relative trackball motion
    SDL_JoystickClose — Closes a previously opened joystick
    10. Audio
    SDL_AudioSpec — Audio Specification Structure
    SDL_OpenAudio — Opens the audio device with the desired parameters.
    SDL_PauseAudio — Pauses and unpauses the audio callback processing
    SDL_GetAudioStatus — Get the current audio state
    SDL_LoadWAV — Load a WAVE file
    SDL_FreeWAV — Frees previously opened WAV data
    SDL_AudioCVT — Audio Conversion Structure
    SDL_BuildAudioCVT — Initializes a SDL_AudioCVT structure for conversion
    SDL_ConvertAudio — Convert audio data to a desired audio format.
    SDL_MixAudio — Mix audio data
    SDL_LockAudio — Lock out the callback function
    SDL_UnlockAudio — Unlock the callback function
    SDL_CloseAudio — Shuts down audio processing and closes the audio device.
    11. CD-ROM
    SDL_CDNumDrives — Returns the number of CD-ROM drives on the system.
    SDL_CDName — Returns a human-readable, system-dependent identifier for the CD-ROM.
    SDL_CDOpen — Opens a CD-ROM drive for access.
    SDL_CDStatus — Returns the current status of the given drive.
    SDL_CDPlay — Play a CD
    SDL_CDPlayTracks — Play the given CD track(s)
    SDL_CDPause — Pauses a CDROM
    SDL_CDResume — Resumes a CDROM
    SDL_CDStop — Stops a CDROM
    SDL_CDEject — Ejects a CDROM
    SDL_CDClose — Closes a SDL_CD handle
    SDL_CD — CDROM Drive Information
    SDL_CDtrack — CD Track Information Structure
    12. Multi-threaded Programming
    SDL_CreateThread — Creates a new thread of execution that shares its parent's properties.
    SDL_ThreadID — Get the 32-bit thread identifier for the current thread.
    SDL_GetThreadID — Get the SDL thread ID of a SDL_Thread
    SDL_WaitThread — Wait for a thread to finish.
    SDL_KillThread — Gracelessly terminates the thread.
    SDL_CreateMutex — Create a mutex
    SDL_DestroyMutex — Destroy a mutex
    SDL_mutexP — Lock a mutex
    SDL_mutexV — Unlock a mutex
    SDL_CreateSemaphore — Creates a new semaphore and assigns an initial value to it.
    SDL_DestroySemaphore — Destroys a semaphore that was created by SDL_CreateSemaphore.
    SDL_SemWait — Lock a semaphore and suspend the thread if the semaphore value is zero.
    SDL_SemTryWait — Attempt to lock a semaphore but don't suspend the thread.
    SDL_SemWaitTimeout — Lock a semaphore, but only wait up to a specified maximum time.
    SDL_SemPost — Unlock a semaphore.
    SDL_SemValue — Return the current value of a semaphore.
    SDL_CreateCond — Create a condition variable
    SDL_DestroyCond — Destroy a condition variable
    SDL_CondSignal — Restart a thread wait on a condition variable
    SDL_CondBroadcast — Restart all threads waiting on a condition variable
    SDL_CondWait — Wait on a condition variable
    SDL_CondWaitTimeout — Wait on a condition variable, with timeout
    13. Time
    SDL_GetTicks — Get the number of milliseconds since the SDL library initialization.
    SDL_Delay — Wait a specified number of milliseconds before returning.
    SDL_AddTimer — Add a timer which will call a callback after the specified number of milliseconds has +elapsed.
    SDL_RemoveTimer — Remove a timer which was added with +SDL_AddTimer.
    SDL_SetTimer — Set a callback to run after the specified number of milliseconds has +elapsed.

      Next
      SDL Guide
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/joystick.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/joystick.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,285 @@ +Joystick
    SDL Library Documentation
    PrevNext

    Chapter 9. Joystick

    Table of Contents
    SDL_NumJoysticks — Count available joysticks.
    SDL_JoystickName — Get joystick name.
    SDL_JoystickOpen — Opens a joystick for use.
    SDL_JoystickOpened — Determine if a joystick has been opened
    SDL_JoystickIndex — Get the index of an SDL_Joystick.
    SDL_JoystickNumAxes — Get the number of joystick axes
    SDL_JoystickNumBalls — Get the number of joystick trackballs
    SDL_JoystickNumHats — Get the number of joystick hats
    SDL_JoystickNumButtons — Get the number of joysitck buttons
    SDL_JoystickUpdate — Updates the state of all joysticks
    SDL_JoystickGetAxis — Get the current state of an axis
    SDL_JoystickGetHat — Get the current state of a joystick hat
    SDL_JoystickGetButton — Get the current state of a given button on a given joystick
    SDL_JoystickGetBall — Get relative trackball motion
    SDL_JoystickClose — Closes a previously opened joystick

    Joysticks, and other similar input devices, have a very strong role in game playing and SDL provides comprehensive support for them. Axes, Buttons, POV Hats and trackballs are all supported.

    Joystick support is initialized by passed the SDL_INIT_JOYSTICK flag to SDL_Init. Once initilized joysticks must be opened using SDL_JoystickOpen.

    While using the functions describe in this secton may seem like the best way to access and read from joysticks, in most cases they aren't. Ideally joysticks should be read using the event system. To enable this, you must set the joystick event processing state with SDL_JoystickEventState. Joysticks must be opened before they can be used of course.

    Note: If you are not handling the joystick via the event queue then you must explicitly request a joystick update by calling SDL_JoystickUpdate.

    Note: Force Feedback is not yet support. Sam (slouken@libsdl.org) is soliciting suggestions from people with force-feedback experience on the best wat to desgin the API.


    PrevHomeNext
    SDL_JoystickEventStateUpSDL_NumJoysticks
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/reference.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/reference.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,187 @@ +SDL Reference
    SDL Library Documentation
    PrevNext

    II. SDL Reference


    PrevHomeNext
    Time Examples General
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlactiveevent.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlactiveevent.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,327 @@ +SDL_ActiveEvent
    SDL Library Documentation
    PrevNext

    SDL_ActiveEvent

    Name

    SDL_ActiveEvent -- Application visibility event structure

    Structure Definition

    typedef struct{
    +  Uint8 type;
    +  Uint8 gain;
    +  Uint8 state;
    +} SDL_ActiveEvent;

    Structure Data

    typeSDL_ACTIVEEVENT.
    gain0 if the event is a loss or 1 if it is a gain.
    stateSDL_APPMOUSEFOCUS if mouse focus was gained or lost, SDL_APPINPUTFOCUS if input focus was gained or lost, or SDL_APPACTIVE if the application was iconified (gain=0) or restored(gain=1).

    Description

    SDL_ActiveEvent is a member of the SDL_Event union and is used when an event of type SDL_ACTIVEEVENT is reported.

    When the mouse leaves or enters the window area a SDL_APPMOUSEFOCUS type activation event occurs, if the mouse entered the window then gain will be 1, otherwise gain will be 0. A SDL_APPINPUTFOCUS type activation event occurs when the application loses or gains keyboard focus. This usually occurs when another application is made active. Finally, a SDL_APPACTIVE type event occurs when the application is either minimised/iconified (gain=0) or restored.

    Note: This event does not occur when an application window is first created.


    PrevHomeNext
    SDL_EventUpSDL_KeyboardEvent
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdladdtimer.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdladdtimer.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,275 @@ +SDL_AddTimer
    SDL Library Documentation
    PrevNext

    SDL_AddTimer

    Name

    SDL_AddTimer -- Add a timer which will call a callback after the specified number of milliseconds has +elapsed.

    Synopsis

    #include "SDL.h"

    SDL_TimerID SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param);

    Callback

    /* type definition for the "new" timer callback function */
    +typedef Uint32 (*SDL_NewTimerCallback)(Uint32 interval, void *param);

    Description

    Adds a callback function to be run after the specified number of +milliseconds has elapsed. The callback function is passed the current +timer interval and the user supplied parameter from the +SDL_AddTimer call and returns the next timer +interval. If the returned value from the callback is the same as the one +passed in, the periodic alarm continues, otherwise a new alarm is +scheduled.

    To cancel a currently running timer call +SDL_RemoveTimer with the +timer ID returned from +SDL_AddTimer.

    The timer callback function may run in a different thread than your +main program, and so shouldn't call any functions from within itself.

    The maximum resolution of this timer is 10 ms, which means that if +you request a 16 ms timer, your callback will run approximately 20 ms +later on an unloaded system. If you wanted to set a flag signaling +a frame update at 30 frames per second (every 33 ms), you might set a +timer for 30 ms (see example below). + +If you use this function, you need to pass SDL_INIT_TIMER +to SDL_Init.

    Return Value

    Returns an ID value for the added timer or +NULL if there was an error.

    Examples

    my_timer_id = SDL_AddTimer((33/10)*10, my_callbackfunc, my_callback_param);


    PrevHomeNext
    SDL_DelayUpSDL_RemoveTimer
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlaudiocvt.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlaudiocvt.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,548 @@ +SDL_AudioCVT
    SDL Library Documentation
    PrevNext

    SDL_AudioCVT

    Name

    SDL_AudioCVT -- Audio Conversion Structure

    Structure Definition

    typedef struct{
    +  int needed;
    +  Uint16 src_format;
    +  Uint16 dest_format;
    +  double rate_incr;
    +  Uint8 *buf;
    +  int len;
    +  int len_cvt;
    +  int len_mult;
    +  double len_ratio;
    +  void (*filters[10])(struct SDL_AudioCVT *cvt, Uint16 format);
    +  int filter_index;
    +} SDL_AudioCVT;

    Structure Data

    neededSet to one if the conversion is possible
    src_formatAudio format of the source
    dest_formatAudio format of the destination
    rate_incrRate conversion increment
    bufAudio buffer
    lenLength of the original audio buffer in bytes
    len_cvtLength of converted audio buffer in bytes (calculated)
    len_multbuf must be len*len_mult bytes in size(calculated)
    len_ratioFinal audio size is len*len_ratio
    filters[10](..)Pointers to functions needed for this conversion
    filter_indexCurrent conversion function

    Description

    The SDL_AudioCVT is used to convert audio data between different formats. A SDL_AudioCVT structure is created with the SDL_BuildAudioCVT function, while the actual conversion is done by the SDL_ConvertAudio function.

    Many of the fields in the SDL_AudioCVT structure should be considered private and their function will not be discussed here.

    Uint8 *buf

    This points to the audio data that will be used in the conversion. It is both the source and the destination, which means the converted audio data overwrites the original data. It also means that the converted data may be larger than the original data (if you were converting from 8-bit to 16-bit, for instance), so you must ensure buf is large enough. See below.

    int len

    This is the length of the original audio data in bytes.

    int len_mult

    As explained above, the audio buffer needs to be big enough to store the converted data, which may be bigger than the original audio data. The length of buf should be len*len_mult.

    double len_ratio

    When you have finished converting your audio data, you need to know how much of your audio buffer is valid. len*len_ratio is the size of the converted audio data in bytes. This is very similar to len_mult, however when the convert audio data is shorter than the original len_mult would be 1. len_ratio, on the other hand, would be a fractional number between 0 and 1.


    PrevHomeNext
    SDL_FreeWAVUpSDL_BuildAudioCVT
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlaudiospec.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlaudiospec.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,581 @@ +SDL_AudioSpec
    SDL Library Documentation
    PrevNext

    SDL_AudioSpec

    Name

    SDL_AudioSpec -- Audio Specification Structure

    Structure Definition

    typedef struct{
    +  int freq;
    +  Uint16 format;
    +  Uint8 channels;
    +  Uint8 silence;
    +  Uint16 samples;
    +  Uint32 size;
    +  void (*callback)(void *userdata, Uint8 *stream, int len);
    +  void *userdata;
    +} SDL_AudioSpec;

    Structure Data

    freqAudio frequency in samples per second
    formatAudio data format
    channelsNumber of channels: 1 mono, 2 stereo
    silenceAudio buffer silence value (calculated)
    samplesAudio buffer size in samples
    sizeAudio buffer size in bytes (calculated)
    callback(..)Callback function for filling the audio buffer
    userdataPointer the user data which is passed to the callback function

    Description

    The SDL_AudioSpec structure is used to describe the format of some audio data. This structure is used by SDL_OpenAudio and SDL_LoadWAV. While all fields are used by SDL_OpenAudio only freq, format, samples and channels are used by SDL_LoadWAV. We will detail these common members here.

    freq

    The number of samples sent to the sound device every second. Common values are 11025, 22050 and 44100. The higher the better.

    format

    Specifies the size and type of each sample element +

    AUDIO_U8

    Unsigned 8-bit samples

    AUDIO_S8

    Signed 8-bit samples

    AUDIO_U16 or AUDIO_U16LSB

    Unsigned 16-bit little-endian samples

    AUDIO_S16 or AUDIO_S16LSB

    Signed 16-bit little-endian samples

    AUDIO_U16MSB

    Unsigned 16-bit big-endian samples

    AUDIO_S16MSB

    Signed 16-bit big-endian samples

    AUDIO_U16SYS

    Either AUDIO_U16LSB or AUDIO_U16MSB depending on you systems endianness

    AUDIO_S16SYS

    Either AUDIO_S16LSB or AUDIO_S16MSB depending on you systems endianness

    channelsThe number of seperate sound channels. 1 is mono (single channel), 2 is stereo (dual channel).
    samplesWhen used with SDL_OpenAudio this refers to the size of the audio buffer in samples. A sample a chunk of audio data of the size specified in format mulitplied by the number of channels. When the SDL_AudioSpec is used with SDL_LoadWAV samples is set to 4096.


    PrevHomeNext
    AudioUpSDL_OpenAudio
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlblitsurface.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlblitsurface.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,322 @@ +SDL_BlitSurface
    SDL Library Documentation
    PrevNext

    SDL_BlitSurface

    Name

    SDL_BlitSurface -- This performs a fast blit from the source surface to the destination surface.

    Synopsis

    #include "SDL.h"

    int SDL_BlitSurface(SDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect);

    Description

    This performs a fast blit from the source surface to the destination surface.

    Only the position is used in the dstrect (the +width and height are ignored).

    If either srcrect or +dstrect are NULL, the entire +surface (src or dst) is +copied.

    The final blit rectangle is saved in +dstrect after all clipping is performed +(srcrect is not modified).

    The blit function should not be called on a locked surface.

    Note: The results of blitting operations vary greatly depending on whether SDL_SRCAPLHA is set or not. See SDL_SetAlpha.

    Return Value

    If the blit is successful, it returns 0, +otherwise it returns -1.

    If either of the surfaces were in video memory, and the blit returns +-2, the video memory was lost, so it should be +reloaded with artwork and re-blitted: +

            while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) {
    +                while ( SDL_LockSurface(image)) < 0 )
    +                        Sleep(10);
    +                -- Write image pixels to image->pixels --
    +                SDL_UnlockSurface(image);
    +        }
    +This happens under DirectX 5.0 when the system switches away from your +fullscreen application. Locking the surface will also fail until you +have access to the video memory again.


    PrevHomeNext
    SDL_ConvertSurfaceUpSDL_FillRect
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlbuildaudiocvt.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlbuildaudiocvt.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,283 @@ +SDL_BuildAudioCVT
    SDL Library Documentation
    PrevNext

    SDL_BuildAudioCVT

    Name

    SDL_BuildAudioCVT -- Initializes a SDL_AudioCVT structure for conversion

    Synopsis

    #include "SDL.h"

    int SDL_BuildAudioCVT(SDL_AudioCVT *cvt, Uint16 src_format, Uint8 src_channels, int src_rate, Uint16 dst_format, Uint8 dst_channels, int dst_rate);

    Description

    Before an SDL_AudioCVT structure can be used to convert audio data it must be initialized with source and destination information.

    src_format and dst_format are the source and destination format of the conversion. (For information on audio formats see SDL_AudioSpec). src_channels and dst_channels are the number of channels in the source and destination formats. Finally, src_rate and dst_rate are the frequency or samples-per-second of the source and destination formats. Once again, see SDL_AudioSpec.

    Return Values

    Returns -1 if the filter could not be built or 1 if it could.

    Examples

    See SDL_ConvertAudio.


    PrevHomeNext
    SDL_AudioCVTUpSDL_ConvertAudio
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcd.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcd.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,351 @@ +SDL_CD
    SDL Library Documentation
    PrevNext

    SDL_CD

    Name

    SDL_CD -- CDROM Drive Information

    Structure Definition

    typedef struct{
    +  int id;
    +  CDstatus status;
    +  int numtracks;
    +  int cur_track;
    +  int cur_frame;
    +  SDL_CDtrack track[SDL_MAX_TRACKS+1];
    +} SDL_CD;

    Structure Data

    idPrivate drive identifier
    statusDrive status
    numtracksNumber of tracks on the CD
    cur_trackCurrent track
    cur_frameCurrent frame offset within the track
    track[SDL_MAX_TRACKS+1]Array of track descriptions. (see SDL_CDtrack)

    Description

    An SDL_CD structure is returned by SDL_CDOpen. It represents an opened CDROM device and stores information on the layout of the tracks on the disc.

    A frame is the base data unit of a CD. CD_FPS frames is equal to 1 second of music. SDL provides two macros for converting between time and frames: FRAMES_TO_MSF(f, M,S,F) and MSF_TO_FRAMES.

    Examples

    int min, sec, frame;
    +int frame_offset;
    +
    +FRAMES_TO_MSF(cdrom->cur_frame, &min, &sec, &frame);
    +printf("Current Position: %d minutes, %d seconds, %d frames\n", min, sec, frame);
    +
    +frame_offset=MSF_TO_FRAMES(min, sec, frame);

    PrevHomeNext
    SDL_CDCloseUpSDL_CDtrack
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcdclose.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcdclose.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,209 @@ +SDL_CDClose
    SDL Library Documentation
    PrevNext

    SDL_CDClose

    Name

    SDL_CDClose -- Closes a SDL_CD handle

    Synopsis

    #include "SDL.h"

    void SDL_CDClose(SDL_CD *cdrom);

    Description

    Closes the given cdrom handle.

    See Also

    SDL_CDOpen, +SDL_CD


    PrevHomeNext
    SDL_CDEjectUpSDL_CD
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcdeject.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcdeject.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,218 @@ +SDL_CDEject
    SDL Library Documentation
    PrevNext

    SDL_CDEject

    Name

    SDL_CDEject -- Ejects a CDROM

    Synopsis

    #include "SDL.h"

    int SDL_CDEject(SDL_CD *cdrom);

    Description

    Ejects the given cdrom.

    Return Value

    Returns 0 on success, or -1 on an error.

    See Also

    SDL_CD


    PrevHomeNext
    SDL_CDStopUpSDL_CDClose
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcdname.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcdname.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,231 @@ +SDL_CDName
    SDL Library Documentation
    PrevNext

    SDL_CDName

    Name

    SDL_CDName -- Returns a human-readable, system-dependent identifier for the CD-ROM.

    Synopsis

    #include "SDL.h"

    const char *SDL_CDName(int drive);

    Description

    Returns a human-readable, system-dependent identifier for the CD-ROM. drive is the index of the drive. Drive indices start to 0 and end at SDL_CDNumDrives()-1.

    Examples

    • "/dev/cdrom"

    • "E:"

    • "/dev/disk/ide/1/master"


    PrevHomeNext
    SDL_CDNumDrivesUpSDL_CDOpen
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcdnumdrives.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcdnumdrives.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,197 @@ +SDL_CDNumDrives
    SDL Library Documentation
    PrevNext

    SDL_CDNumDrives

    Name

    SDL_CDNumDrives -- Returns the number of CD-ROM drives on the system.

    Synopsis

    #include "SDL.h"

    int SDL_CDNumDrives(void);

    Description

    Returns the number of CD-ROM drives on the system.

    See Also

    SDL_CDOpen


    PrevHomeNext
    CD-ROMUpSDL_CDName
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcdopen.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcdopen.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,267 @@ +SDL_CDOpen
    SDL Library Documentation
    PrevNext

    SDL_CDOpen

    Name

    SDL_CDOpen -- Opens a CD-ROM drive for access.

    Synopsis

    #include "SDL.h"

    SDL_CD *SDL_CDOpen(int drive);

    Description

    Opens a CD-ROM drive for access. It returns a SDL_CD structure on success, or NULL if the drive was invalid or busy. This newly opened CD-ROM becomes the default CD used when other CD functions are passed a NULL CD-ROM handle.

    Drives are numbered starting with 0. +Drive 0 is the system default CD-ROM.

    Examples

    SDL_CD *cdrom;
    +int cur_track;
    +int min, sec, frame;
    +SDL_Init(SDL_INIT_CDROM);
    +atexit(SDL_Quit);
    +
    +/* Check for CD drives */
    +if(!SDL_CDNumDrives()){
    +  /* None found */
    +  fprintf(stderr, "No CDROM devices available\n");
    +  exit(-1);
    +}
    +
    +/* Open the default drive */
    +cdrom=SDL_CDOpen(0);
    +
    +/* Did if open? Check if cdrom is NULL */
    +if(!cdrom){
    +  fprintf(stderr, "Couldn't open drive: %s\n", SDL_GetError());
    +  exit(-1);
    +}
    +
    +/* Print Volume info */
    +printf("Name: %s\n", SDL_CDName(0));
    +printf("Tracks: %d\n", cdrom->numtracks);
    +for(cur_track=0;cur_track < cdrom->numtracks; cur_track++){
    +  FRAMES_TO_MSF(cdrom->track[cur_track].length, &min, &sec, &frame);
    +  printf("\tTrack %d: Length %d:%d\n", cur_track, min, sec);
    +}
    +
    +SDL_CDClose(cdrom);

    PrevHomeNext
    SDL_CDNameUpSDL_CDStatus
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcdpause.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcdpause.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,225 @@ +SDL_CDPause
    SDL Library Documentation
    PrevNext

    SDL_CDPause

    Name

    SDL_CDPause -- Pauses a CDROM

    Synopsis

    #include "SDL.h"

    int SDL_CDPause(SDL_CD *cdrom);

    Description

    Pauses play on the given cdrom.

    Return Value

    Returns 0 on success, or -1 on an error.


    PrevHomeNext
    SDL_CDPlayTracksUpSDL_CDResume
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcdplay.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcdplay.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,235 @@ +SDL_CDPlay
    SDL Library Documentation
    PrevNext

    SDL_CDPlay

    Name

    SDL_CDPlay -- Play a CD

    Synopsis

    #include "SDL.h"

    int SDL_CDPlay(SDL_CD *cdrom, int start, int length);

    Description

    Plays the given cdrom, starting a frame start for length frames.

    Return Values

    Returns 0 on success, or -1 on an error.


    PrevHomeNext
    SDL_CDStatusUpSDL_CDPlayTracks
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcdplaytracks.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcdplaytracks.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,317 @@ +SDL_CDPlayTracks
    SDL Library Documentation
    PrevNext

    SDL_CDPlayTracks

    Name

    SDL_CDPlayTracks -- Play the given CD track(s)

    Synopsis

    #include "SDL.h"

    int SDL_CDPlayTracks(SDL_CD *cdrom, int start_track, int start_frame, int ntracks, int nframes));

    Description

    SDL_CDPlayTracks plays the given CD starting at track +start_track, for ntracks tracks.

    start_frame is the frame offset, from the beginning of the start_track, at which to start. nframes is the frame offset, from the beginning of the last track (start_track+ntracks), at which to end playing.

    SDL_CDPlayTracks should only be called after calling +SDL_CDStatus +to get track information about the CD.

    Note: Data tracks are ignored.

    Return Value

    Returns 0, or -1 +if there was an error.

    Examples

    /* assuming cdrom is a previously opened device */
    +/* Play the entire CD */
    +if(CD_INDRIVE(SDL_CDStatus(cdrom)))
    +  SDL_CDPlayTracks(cdrom, 0, 0, 0, 0);
    +
    +/* Play the first track */
    +if(CD_INDRIVE(SDL_CDStatus(cdrom)))
    +  SDL_CDPlayTracks(cdrom, 0, 0, 1, 0);
    +
    +/* Play first 15 seconds of the 2nd track */
    +if(CD_INDRIVE(SDL_CDStatus(cdrom)))
    +  SDL_CDPlayTracks(cdrom, 1, 0, 0, CD_FPS*15);
    +


    PrevHomeNext
    SDL_CDPlayUpSDL_CDPause
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcdresume.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcdresume.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,225 @@ +SDL_CDResume
    SDL Library Documentation
    PrevNext

    SDL_CDResume

    Name

    SDL_CDResume -- Resumes a CDROM

    Synopsis

    #include "SDL.h"

    int SDL_CDResume(SDL_CD *cdrom);

    Description

    Resumes play on the given cdrom.

    Return Value

    Returns 0 on success, or -1 on an error.


    PrevHomeNext
    SDL_CDPauseUpSDL_CDStop
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcdstatus.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcdstatus.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,265 @@ +SDL_CDStatus
    SDL Library Documentation
    PrevNext

    SDL_CDStatus

    Name

    SDL_CDStatus -- Returns the current status of the given drive.

    Synopsis

    #include "SDL.h"

    CDstatus SDL_CDStatus(SDL_CD *cdrom);

    /* Given a status, returns true if there's a disk in the drive */
    +#define CD_INDRIVE(status)      ((int)status > 0)

    Description

    This function returns the current status of the given drive. Status is described like so: +

    typedef enum {
    +  CD_TRAYEMPTY,
    +  CD_STOPPED,
    +  CD_PLAYING,
    +  CD_PAUSED,
    +  CD_ERROR = -1
    +} CDstatus;

    If the drive has a CD in it, the table of contents of the CD and current +play position of the CD will be stored in the SDL_CD structure.

    The macro CD_INDRIVE is provided for convenience, +and given a status returns true if there's a disk in the drive.

    Note: SDL_CDStatus also updates the SDL_CD structure passed to it.

    Example

    int playTrack(int track)
    +{
    +  int playing = 0;
    +
    +  if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) {
    +  /* clamp to the actual number of tracks on the CD */
    +    if (track >= cdrom->numtracks) {
    +      track = cdrom->numtracks-1;
    +    }
    +
    +    if ( SDL_CDPlayTracks(cdrom, track, 0, 1, 0) == 0 ) {
    +      playing = 1;
    +    }
    +  }
    +  return playing;
    +}

    See Also

    SDL_CD


    PrevHomeNext
    SDL_CDOpenUpSDL_CDPlay
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcdstop.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcdstop.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,218 @@ +SDL_CDStop
    SDL Library Documentation
    PrevNext

    SDL_CDStop

    Name

    SDL_CDStop -- Stops a CDROM

    Synopsis

    #include "SDL.h"

    int SDL_CDStop(SDL_CD *cdrom);

    Description

    Stops play on the given cdrom.

    Return Value

    Returns 0 on success, or -1 on an error.

    See Also

    SDL_CDPlay,


    PrevHomeNext
    SDL_CDResumeUpSDL_CDEject
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcdtrack.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcdtrack.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,305 @@ +SDL_CDtrack
    SDL Library Documentation
    PrevNext

    SDL_CDtrack

    Name

    SDL_CDtrack -- CD Track Information Structure

    Structure Definition

    typedef struct{
    +  Uint8 id;
    +  Uint8 type;
    +  Uint32 length;
    +  Uint32 offset;
    +} SDL_CDtrack;

    Structure Data

    idTrack number (0-99)
    typeSDL_AUDIO_TRACK or SDL_DATA_TRACK
    lengthLength, in frames, of this track
    offsetFrame offset to the beginning of this track

    Description

    SDL_CDtrack stores data on each track on a CD, its fields should be pretty self explainatory. It is a member a the SDL_CD structure.

    Note: Frames can be converted to standard timings. There are CD_FPS frames per second, so SDL_CDtrack.length/CD_FPS=length_in_seconds.

    See Also

    SDL_CD


    PrevHomeNext
    SDL_CDUpMulti-threaded Programming
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcloseaudio.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcloseaudio.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,197 @@ +SDL_CloseAudio
    SDL Library Documentation
    PrevNext

    SDL_CloseAudio

    Name

    SDL_CloseAudio -- Shuts down audio processing and closes the audio device.

    Synopsis

    #include "SDL.h"

    void SDL_CloseAudio(void);

    Description

    This function shuts down audio processing and closes the audio device.

    See Also

    SDL_OpenAudio


    PrevHomeNext
    SDL_UnlockAudioUpCD-ROM
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcolor.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcolor.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,292 @@ +SDL_Color
    SDL Library Documentation
    PrevNext

    SDL_Color

    Name

    SDL_Color -- Format independent color description

    Structure Definition

    typedef struct{
    +  Uint8 r;
    +  Uint8 g;
    +  Uint8 b;
    +  Uint8 unused;
    +} SDL_Color;

    Structure Data

    rRed intensity
    gGreen intensity
    bBlue intensity
    unusedUnused

    Description

    SDL_Color describes a color in a format independent way. You can convert a SDL_Color to a pixel value for a certain pixel format using SDL_MapRGB.


    PrevHomeNext
    SDL_RectUpSDL_Palette
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcondbroadcast.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcondbroadcast.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,216 @@ +SDL_CondBroadcast
    SDL Library Documentation
    PrevNext

    SDL_CondBroadcast

    Name

    SDL_CondBroadcast -- Restart all threads waiting on a condition variable

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    int SDL_CondBroadcast(SDL_cond *cond);

    Description

    Restarts all threads that are waiting on the condition variable, cond. Returns 0 on success, or -1 on an error.


    PrevHomeNext
    SDL_CondSignalUpSDL_CondWait
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcondsignal.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcondsignal.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,216 @@ +SDL_CondSignal
    SDL Library Documentation
    PrevNext

    SDL_CondSignal

    Name

    SDL_CondSignal -- Restart a thread wait on a condition variable

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    int SDL_CondSignal(SDL_cond *cond);

    Description

    Restart one of the threads that are waiting on the condition variable, cond. Returns 0 on success of -1 on an error.


    PrevHomeNext
    SDL_DestroyCondUpSDL_CondBroadcast
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcondwait.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcondwait.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,223 @@ +SDL_CondWait
    SDL Library Documentation
    PrevNext

    SDL_CondWait

    Name

    SDL_CondWait -- Wait on a condition variable

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    int SDL_CondWait(SDL_cond *cond, SDL_mutex *mut);

    Description

    Wait on the condition variable cond and unlock the provided mutex. The mutex must the locked before entering this function. Returns 0 when it is signalled, or -1 on an error.


    PrevHomeNext
    SDL_CondBroadcastUpSDL_CondWaitTimeout
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcondwaittimeout.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcondwaittimeout.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,222 @@ +SDL_CondWaitTimeout
    SDL Library Documentation
    PrevNext

    SDL_CondWaitTimeout

    Name

    SDL_CondWaitTimeout -- Wait on a condition variable, with timeout

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    int SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms);

    Description

    Wait on the condition variable cond for, at most, ms milliseconds. mut is unlocked so it must be locked when the function is called. Returns SDL_MUTEX_TIMEDOUT if the condition is not signalled in the allotted time, 0 if it was signalled or -1 on an error.

    See Also

    SDL_CondWait


    PrevHomeNext
    SDL_CondWaitUpTime
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlconvertaudio.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlconvertaudio.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,399 @@ +SDL_ConvertAudio
    SDL Library Documentation
    PrevNext

    SDL_ConvertAudio

    Name

    SDL_ConvertAudio -- Convert audio data to a desired audio format.

    Synopsis

    #include "SDL.h"

    int SDL_ConvertAudio(SDL_AudioCVT *cvt);

    Description

    SDL_ConvertAudio takes one parameter, cvt, which was previously initilized. Initilizing a SDL_AudioCVT is a two step process. First of all, the structure must be passed to SDL_BuildAudioCVT along with source and destination format parameters. Secondly, the cvt->buf and cvt->len fields must be setup. cvt->buf should point to the audio data and cvt->len should be set to the length of the audio data in bytes. Remember, the length of the buffer pointed to by buf show be len*len_mult bytes in length.

    Once the SDL_AudioCVTstructure is initilized then we can pass it to SDL_ConvertAudio, which will convert the audio data pointer to by cvt->buf. If SDL_ConvertAudio returned 0 then the conversion was completed successfully, otherwise -1 is returned.

    If the conversion completed successfully then the converted audio data can be read from cvt->buf. The amount of valid, converted, audio data in the buffer is equal to cvt->len*cvt->len_ratio.

    Examples

    /* Converting some WAV data to hardware format */
    +void my_audio_callback(void *userdata, Uint8 *stream, int len);
    +
    +SDL_AudioSpec *desired, *obtained;
    +SDL_AudioSpec wav_spec;
    +SDL_AudioCVT  wav_cvt;
    +Uint32 wav_len;
    +Uint8 *wav_buf;
    +int ret;
    +
    +/* Allocated audio specs */
    +desired=(SDL_AudioSpec *)malloc(sizeof(SDL_AudioSpec));
    +obtained=(SDL_AudioSpec *)malloc(sizeof(SDL_AudioSpec));
    +
    +/* Set desired format */
    +desired->freq=22050;
    +desired->format=AUDIO_S16LSB;
    +desired->samples=8192;
    +desired->callback=my_audio_callback;
    +desired->userdata=NULL;
    +
    +/* Open the audio device */
    +if ( SDL_OpenAudio(desired, obtained) < 0 ){
    +  fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
    +  exit(-1);
    +}
    +        
    +free(desired);
    +
    +/* Load the test.wav */
    +if( SDL_LoadWAV("test.wav", &wav_spec, &wav_buf, &wav_len) == NULL ){
    +  fprintf(stderr, "Could not open test.wav: %s\n", SDL_GetError());
    +  SDL_CloseAudio();
    +  free(obtained);
    +  exit(-1);
    +}
    +                                            
    +/* Build AudioCVT */
    +ret = SDL_BuildAudioCVT(&wav_cvt,
    +                        wav_spec.format, wav_spec.channels, wav_spec.freq,
    +                        obtained->format, obtained->channels, obtained->freq);
    +
    +/* Check that the convert was built */
    +if(ret==-1){
    +  fprintf(stderr, "Couldn't build converter!\n");
    +  SDL_CloseAudio();
    +  free(obtained);
    +  SDL_FreeWAV(wav_buf);
    +}
    +
    +/* Setup for conversion */
    +wav_cvt.buf=(Uint8 *)malloc(wav_len*wav_cvt.len_mult);
    +wav_cvt.len=wav_len;
    +memcpy(wav_cvt.buf, wav_buf, wav_len);
    +
    +/* We can delete to original WAV data now */
    +SDL_FreeWAV(wav_buf);
    +
    +/* And now we're ready to convert */
    +SDL_ConvertAudio(&wav_cvt);
    +
    +/* do whatever */
    +.
    +.
    +.
    +.
    +

    PrevHomeNext
    SDL_BuildAudioCVTUpSDL_MixAudio
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlconvertsurface.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlconvertsurface.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,261 @@ +SDL_ConvertSurface
    SDL Library Documentation
    PrevNext

    SDL_ConvertSurface

    Name

    SDL_ConvertSurface -- Converts a surface to the same format as another surface.

    Synopsis

    #include "SDL.h"

    SDL_Surface *SDL_ConvertSurface(SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags);

    Description

    Creates a new surface of the specified format, and then copies and maps +the given surface to it. If this function fails, it returns +NULL.

    The flags parameter is passed to +SDL_CreateRGBSurface +and has those semantics.

    This function is used internally by +SDL_DisplayFormat.

    Return Value

    Returns either a pointer to the new surface, or +NULL on error.


    PrevHomeNext
    SDL_GetClipRectUpSDL_BlitSurface
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcreatecond.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcreatecond.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,232 @@ +SDL_CreateCond
    SDL Library Documentation
    PrevNext

    SDL_CreateCond

    Name

    SDL_CreateCond -- Create a condition variable

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    SDL_cond *SDL_CreateCond(void);

    Description

    Creates a condition variable.

    Examples

    SDL_cond *cond;
    +
    +cond=SDL_CreateCond();
    +.
    +.
    +/* Do stuff */
    +
    +.
    +.
    +SDL_DestroyCond(cond);

    PrevHomeNext
    SDL_SemValueUpSDL_DestroyCond
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcreatecursor.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcreatecursor.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,390 @@ +SDL_CreateCursor
    SDL Library Documentation
    PrevNext

    SDL_CreateCursor

    Name

    SDL_CreateCursor -- Creates a new mouse cursor.

    Synopsis

    #include "SDL.h"

    SDL_Cursor *SDL_CreateCursor(Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);

    Description

    Create a cursor using the specified data and mask (in MSB format). +The cursor width must be a multiple of 8 bits.

    The cursor is created in black and white according to the following: +

    Data / MaskResulting pixel on screen
    0 / 1White
    1 / 1Black
    0 / 0Transparent
    1 / 0Inverted color if possible, black if not.

    Cursors created with this function must be freed with +SDL_FreeCursor.

    Example

    /* Stolen from the mailing list */
    +/* Creates a new mouse cursor from an XPM */
    +
    +
    +/* XPM */
    +static const char *arrow[] = {
    +  /* width height num_colors chars_per_pixel */
    +  "    32    32        3            1",
    +  /* colors */
    +  "X c #000000",
    +  ". c #ffffff",
    +  "  c None",
    +  /* pixels */
    +  "X                               ",
    +  "XX                              ",
    +  "X.X                             ",
    +  "X..X                            ",
    +  "X...X                           ",
    +  "X....X                          ",
    +  "X.....X                         ",
    +  "X......X                        ",
    +  "X.......X                       ",
    +  "X........X                      ",
    +  "X.....XXXXX                     ",
    +  "X..X..X                         ",
    +  "X.X X..X                        ",
    +  "XX  X..X                        ",
    +  "X    X..X                       ",
    +  "     X..X                       ",
    +  "      X..X                      ",
    +  "      X..X                      ",
    +  "       XX                       ",
    +  "                                ",
    +  "                                ",
    +  "                                ",
    +  "                                ",
    +  "                                ",
    +  "                                ",
    +  "                                ",
    +  "                                ",
    +  "                                ",
    +  "                                ",
    +  "                                ",
    +  "                                ",
    +  "                                ",
    +  "0,0"
    +};
    +
    +static SDL_Cursor *init_system_cursor(const char *image[])
    +{
    +  int i, row, col;
    +  Uint8 data[4*32];
    +  Uint8 mask[4*32];
    +  int hot_x, hot_y;
    +
    +  i = -1;
    +  for ( row=0; row<32; ++row ) {
    +    for ( col=0; col<32; ++col ) {
    +      if ( col % 8 ) {
    +        data[i] <<= 1;
    +        mask[i] <<= 1;
    +      } else {
    +        ++i;
    +        data[i] = mask[i] = 0;
    +      }
    +      switch (image[4+row][col]) {
    +        case 'X':
    +          data[i] |= 0x01;
    +          k[i] |= 0x01;
    +          break;
    +        case '.':
    +          mask[i] |= 0x01;
    +          break;
    +        case ' ':
    +          break;
    +      }
    +    }
    +  }
    +  sscanf(image[4+row], "%d,%d", &hot_x, &hot_y);
    +  return SDL_CreateCursor(data, mask, 32, 32, hot_x, hot_y);
    +}

    PrevHomeNext
    SDL_WarpMouseUpSDL_FreeCursor
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcreatemutex.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcreatemutex.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,241 @@ +SDL_CreateMutex
    SDL Library Documentation
    PrevNext

    SDL_CreateMutex

    Name

    SDL_CreateMutex -- Create a mutex

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    SDL_mutex *SDL_CreateMutex(void);

    Description

    Create a new, unlocked mutex.

    Examples

    SDL_mutex *mut;
    +
    +mut=SDL_CreateMutex();
    +.
    +.
    +if(SDL_mutexP(mut)==-1){
    +  fprintf(stderr, "Couldn't lock mutex\n");
    +  exit(-1);
    +}
    +.
    +/* Do stuff while mutex is locked */
    +.
    +.
    +if(SDL_mutexV(mut)==-1){
    +  fprintf(stderr, "Couldn't unlock mutex\n");
    +  exit(-1);
    +}
    +
    +SDL_DestroyMutex(mut);

    PrevHomeNext
    SDL_KillThreadUpSDL_DestroyMutex
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcreatergbsurface.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcreatergbsurface.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,332 @@ +SDL_CreateRGBSurface
    SDL Library Documentation
    PrevNext

    SDL_CreateRGBSurface

    Name

    SDL_CreateRGBSurface -- Create an empty SDL_Surface

    Synopsis

    #include "SDL.h"

    SDL_Surface *SDL_CreateRGBSurface(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);

    Description

    Allocate an empty surface (must be called after SDL_SetVideoMode)

    If depth is 8 bits an empty palette is allocated for the surface, otherwise a 'packed-pixel' SDL_PixelFormat is created using the [RGBA]mask's provided (see SDL_PixelFormat). The flags specifies the type of surface that should be created, it is an OR'd combination of the following possible values.

    SDL_SWSURFACESDL will create the surface in system memory. This improves the performance of pixel level access, however you may not be able to take advantage of some types of hardware blitting.
    SDL_HWSURFACESDL will attempt to create the surface in video memory. This will allow SDL to take advantage of Video->Video blits (which are often accelerated).
    SDL_SRCCOLORKEYWith this flag SDL will attempt to find the best location for this surface, either in system memory or video memory, to obtain hardware colorkey blitting support.
    SDL_SRCALPHAWith this flag SDL will attempt to find the best location for this surface, either in system memory or video memory, to obtain hardware alpha support


    PrevHomeNext
    SDL_GetRGBAUpSDL_CreateRGBSurfaceFrom
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcreatergbsurfacefrom.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcreatergbsurfacefrom.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,235 @@ +SDL_CreateRGBSurfaceFrom
    SDL Library Documentation
    PrevNext

    SDL_CreateRGBSurfaceFrom

    Name

    SDL_CreateRGBSurfaceFrom -- Create an SDL_Surface from pixel data

    Synopsis

    #include "SDL.h"

    SDL_Surface *SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);

    Description

    Creates an SDL_Surface from the provided pixel data.

    The data stored in pixels is assumed to be of the depth specified in the parameter list. The pixel data is not copied into the SDL_Surface structure so it should no be freed until the surface has been freed with a called to SDL_FreeSurface. pitch is the length of each scanline in bytes.

    See SDL_CreateRGBSurface for a more detailed description of the other parameters.


    PrevHomeNext
    SDL_CreateRGBSurfaceUpSDL_FreeSurface
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcreatesemaphore.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcreatesemaphore.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,295 @@ +SDL_CreateSemaphore
    SDL Library Documentation
    PrevNext

    SDL_CreateSemaphore

    Name

    SDL_CreateSemaphore -- Creates a new semaphore and assigns an initial value to it.

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    SDL_sem *SDL_CreateSemaphore(Uint32 initial_value);

    Description

    SDL_CreateSemaphore() creates a new semaphore and +initializes it with the value initial_value. +Each locking operation on the semaphore by +SDL_SemWait, +SDL_SemTryWait or +SDL_SemWaitTimeout +will atomically decrement the semaphore value. The locking operation will be blocked +if the semaphore value is not positive (greater than zero). Each unlock operation by +SDL_SemPost +will atomically increment the semaphore value.

    Return Value

    Returns a pointer to an initialized semaphore or +NULL if there was an error.

    Examples

    SDL_sem *my_sem;
    +
    +my_sem = SDL_CreateSemaphore(INITIAL_SEM_VALUE);
    +
    +if (my_sem == NULL) {
    +        return CREATE_SEM_FAILED;
    +}


    PrevHomeNext
    SDL_mutexVUpSDL_DestroySemaphore
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcreatethread.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcreatethread.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,215 @@ +SDL_CreateThread
    SDL Library Documentation
    PrevNext

    SDL_CreateThread

    Name

    SDL_CreateThread -- Creates a new thread of execution that shares its parent's properties.

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    SDL_Thread *SDL_CreateThread(int (*fn)(void *), void *data);

    Description

    SDL_CreateThread creates a new thread of execution +that shares all of its parent's global memory, signal handlers, +file descriptors, etc, and runs the function fn +passed the void pointer data +The thread quits when this function returns.


    PrevHomeNext
    Multi-threaded ProgrammingUpSDL_ThreadID
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlcreateyuvoverlay.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlcreateyuvoverlay.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,248 @@ +SDL_CreateYUVOverlay
    SDL Library Documentation
    PrevNext

    SDL_CreateYUVOverlay

    Name

    SDL_CreateYUVOverlay -- Create a YUV video overlay

    Synopsis

    #include "SDL.h"

    SDL_Overlay *SDL_CreateYUVOverlay(int width, int height, Uint32 format, SDL_Surface *display);

    Description

    SDL_CreateYUVOverlay creates a YUV overlay of the specified width, height and format (see SDL_Overlay for a list of available formats), for the provided display. A SDL_Overlay structure is returned.

    The term 'overlay' is a misnomer since, unless the overlay is created in hardware, the contents for the display surface underneath the area where the overlay is shown will be overwritten when the overlay is displayed.


    PrevHomeNext
    SDL_GL_SwapBuffersUpSDL_LockYUVOverlay
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdldelay.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdldelay.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,203 @@ +SDL_Delay
    SDL Library Documentation
    PrevNext

    SDL_Delay

    Name

    SDL_Delay -- Wait a specified number of milliseconds before returning.

    Synopsis

    #include "SDL.h"

    void SDL_Delay(Uint32 ms);

    Description

    Wait a specified number of milliseconds before returning. SDL_Delay will wait at least the specified time, but possible longer due to OS scheduling.

    See Also

    SDL_AddTimer


    PrevHomeNext
    SDL_GetTicksUpSDL_AddTimer
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdldestroycond.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdldestroycond.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,198 @@ +SDL_DestroyCond
    SDL Library Documentation
    PrevNext

    SDL_DestroyCond

    Name

    SDL_DestroyCond -- Destroy a condition variable

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    void SDL_DestroyCond(SDL_cond *cond);

    Description

    Destroys a condition variable.


    PrevHomeNext
    SDL_CreateCondUpSDL_CondSignal
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdldestroymutex.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdldestroymutex.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,201 @@ +SDL_DestroyMutex
    SDL Library Documentation
    PrevNext

    SDL_DestroyMutex

    Name

    SDL_DestroyMutex -- Destroy a mutex

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    void SDL_DestroyMutex(SDL_mutex *mutex);

    Description

    Destroy a previously created mutex.


    PrevHomeNext
    SDL_CreateMutexUpSDL_mutexP
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdldestroysemaphore.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdldestroysemaphore.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,270 @@ +SDL_DestroySemaphore
    SDL Library Documentation
    PrevNext

    SDL_DestroySemaphore

    Name

    SDL_DestroySemaphore -- Destroys a semaphore that was created by SDL_CreateSemaphore.

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    void SDL_DestroySemaphore(SDL_sem *sem);

    Description

    SDL_DestroySemaphore destroys the semaphore pointed to +by sem that was created by +SDL_CreateSemaphore. +It is not safe to destroy a semaphore if there are threads currently blocked +waiting on it.

    Examples

    if (my_sem != NULL) {
    +        SDL_DestroySemaphore(my_sem);
    +        my_sem = NULL;
    +}


    PrevHomeNext
    SDL_CreateSemaphoreUpSDL_SemWait
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdldisplayformat.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdldisplayformat.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,254 @@ +SDL_DisplayFormat
    SDL Library Documentation
    PrevNext

    SDL_DisplayFormat

    Name

    SDL_DisplayFormat -- Convert a surface to the display format

    Synopsis

    #include "SDL.h"

    SDL_Surface *SDL_DisplayFormat(SDL_Surface *surface);

    Description

    This function takes a surface and copies it to a new surface of the +pixel format and colors of the video framebuffer, suitable for fast +blitting onto the display surface. It calls +SDL_ConvertSurface

    If you want to take advantage of hardware colorkey or alpha blit +acceleration, you should set the colorkey and alpha value before +calling this function.

    If you want an alpha channel, see SDL_DisplayFormatAlpha.

    Return Value

    If the conversion fails or runs out of memory, it returns +NULL


    PrevHomeNext
    SDL_FillRectUpSDL_DisplayFormatAlpha
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdldisplayformatalpha.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdldisplayformatalpha.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,234 @@ +SDL_DisplayFormatAlpha
    SDL Library Documentation
    PrevNext

    SDL_DisplayFormatAlpha

    Name

    SDL_DisplayFormatAlpha -- Convert a surface to the display format

    Synopsis

    #include "SDL.h"

    SDL_Surface *SDL_DisplayFormatAlpha(SDL_Surface *surface);

    Description

    This function takes a surface and copies it to a new surface of the +pixel format and colors of the video framebuffer plus an alpha channel, +suitable for fast blitting onto the display surface. It calls +SDL_ConvertSurface

    If you want to take advantage of hardware colorkey or alpha blit +acceleration, you should set the colorkey and alpha value before +calling this function.

    Return Value

    If the conversion fails or runs out of memory, it returns +NULL


    PrevHomeNext
    SDL_DisplayFormatUpSDL_WarpMouse
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdldisplayyuvoverlay.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdldisplayyuvoverlay.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,228 @@ +SDL_DisplayYUVOverlay
    SDL Library Documentation
    PrevNext

    SDL_DisplayYUVOverlay

    Name

    SDL_DisplayYUVOverlay -- Blit the overlay to the display

    Synopsis

    #include "SDL.h"

    int SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect);

    Description

    Blit the overlay to the surface specified when it was created. The SDL_Rect structure, dstrect, specifies the position and size of the destination. If the dstrect is a larger or smaller than the overlay then the overlay will be scaled, this is optimized for 2x scaling.


    PrevHomeNext
    SDL_UnlockYUVOverlayUpSDL_FreeYUVOverlay
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlenablekeyrepeat.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlenablekeyrepeat.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,230 @@ +SDL_EnableKeyRepeat
    SDL Library Documentation
    PrevNext

    SDL_EnableKeyRepeat

    Name

    SDL_EnableKeyRepeat -- Set keyboard repeat rate.

    Synopsis

    #include "SDL.h"

    int SDL_EnableKeyRepeat(int delay, int interval);

    Description

    Enables or disables the keyboard repeat rate. delay specifies how long the key must be pressed before it begins repeating, it then repeats at the speed specified by interval. Both delay and interval are expressed in milliseconds.

    Setting delay to 0 disables key repeating completely. Good default values are SDL_DEFAULT_REPEAT_DELAY and SDL_DEFAULT_REPEAT_INTERVAL.

    Return Value

    Returns 0 on success and -1 on failure.


    PrevHomeNext
    SDL_EnableUNICODEUpSDL_GetMouseState
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlenableunicode.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlenableunicode.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,228 @@ +SDL_EnableUNICODE
    SDL Library Documentation
    PrevNext

    SDL_EnableUNICODE

    Name

    SDL_EnableUNICODE -- Enable UNICODE translation

    Synopsis

    #include "SDL.h"

    int SDL_EnableUNICODE(int enable);

    Description

    Enables/Disables UNICODE keyboard translation.

    If you wish to translate a keysym to it's printable representation, you need to enable UNICODE translation +using this function (enable=0) and then look in the unicode member +of the SDL_keysym structure. This value will be zero for keysyms +that do not have a printable representation. UNICODE translation is disabled by default as the conversion can cause a slight overhead.

    Return Value

    Returns the previous translation mode.

    See Also

    SDL_keysym


    PrevHomeNext
    SDL_GetKeyNameUpSDL_EnableKeyRepeat
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlevent.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlevent.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,942 @@ +SDL_Event
    SDL Library Documentation
    PrevNext

    SDL_Event

    Name

    SDL_Event -- General event structure

    Structure Definition

    typedef union{
    +  Uint8 type;
    +  SDL_ActiveEvent active;
    +  SDL_KeyboardEvent key;
    +  SDL_MouseMotionEvent motion;
    +  SDL_MouseButtonEvent button;
    +  SDL_JoyAxisEvent jaxis;
    +  SDL_JoyBallEvent jball;
    +  SDL_JoyHatEvent jhat;
    +  SDL_JoyButtonEvent jbutton;
    +  SDL_ResizeEvent resize;
    +  SDL_QuitEvent quit;
    +  SDL_UserEvent user;
    +  SDL_SywWMEvent syswm;
    +} SDL_Event;

    Description

    The SDL_Event union is the core to all event handling is SDL, its probably the most important structure after SDL_Surface. SDL_Event is a union of all event structures used in SDL, using it is a simple matter of knowing which union member relates to which event type.

    Event typeEvent Structure
    SDL_ACTIVEEVENTSDL_ActiveEvent
    SDL_KEYDOWN/UPSDL_KeyboardEvent
    SDL_MOUSEMOTIONSDL_MouseMotionEvent
    SDL_MOUSEBUTTONDOWN/UPSDL_MouseButtonEvent
    SDL_JOYAXISMOTIONSDL_JoyAxisEvent
    SDL_JOYBALLMOTIONSDL_JoyBallEvent
    SDL_JOYHATMOTIONSDL_JoyHatEvent
    SDL_JOYBUTTONDOWN/UPSDL_JoyButtonEvent
    SDL_QUITSDL_QuitEvent
    SDL_SYSWMEVENTSDL_SysWMEvent
    SDL_VIDEORESIZESDL_ResizeEvent
    SDL_USEREVENTSDL_UserEvent

    Use

    The SDL_Event structure has two uses

    • Reading events on the event queue

    • Placing events on the event queue

    Reading events from the event queue is done with either SDL_PollEvent or SDL_PeepEvents. We'll use SDL_PollEvent and step through an example.

    First off, we create an empty SDL_Event structure. +

    SDL_Event test_event;
    +SDL_PollEvent removes the next event from the event queue, if there are no events on the queue it returns 0 otherwise it returns 1. We use a while loop to process each event in turn. +
    while(SDL_PollEvent(&test_event)) {
    +The SDL_PollEvent function take a pointer to an SDL_Event structure that is to be filled with event information. We know that if SDL_PollEvent removes an event from the queue then the event information will be placed in our test_event structure, but we also know that the type of event will be placed in the type member of test_event. So to handle each event type seperately we use a switch statement. +
      switch(test_event.type) {
    +We need to know what kind of events we're looking for and the event type's of those events. So lets assume we want to detect where the user is moving the mouse pointer within our application. We look through our event types and notice that SDL_MOUSEMOTION is, more than likely, the event we're looking for. A little more research tells use that SDL_MOUSEMOTION events are handled within the SDL_MouseMotionEvent structure which is the motion member of SDL_Event. We can check for the SDL_MOUSEMOTION event type within our switch statement like so: +
        case SDL_MOUSEMOTION:
    +All we need do now is read the information out of the motion member of test_event. +
          printf("We got a motion event.\n");
    +      printf("Current mouse position is: (%d, %d)\n", test_event.motion.x, test_event.motion.y);
    +      break;
    +    default:
    +      printf("Unhandled Event!\n");
    +      break;
    +  }
    +}
    +printf("Event queue empty.\n");

    It is also possible to push events onto the event queue and so use it as a two-way communication path. Both SDL_PushEvent and SDL_PeepEvents allow you to place events onto the event queue. This is usually used to place a SDL_USEREVENT on the event queue, however you could use it to post fake input events if you wished. Creating your own events is a simple matter of choosing the event type you want, setting the type member and filling the appropriate member structure with information. +

    SDL_Event user_event;
    +
    +user_event.type=SDL_USEREVENT;
    +user_event.user.code=2;
    +user_event.user.data1=NULL;
    +user_event.user.data2=NULL;
    +SDL_PushEvent(&user_event);


    PrevHomeNext
    SDL Event Structures.UpSDL_ActiveEvent
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdleventstate.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdleventstate.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,268 @@ +SDL_EventState
    SDL Library Documentation
    PrevNext

    SDL_EventState

    Name

    SDL_EventState -- This function allows you to set the state of processing certain events.

    Synopsis

    #include "SDL.h"

    Uint8 SDL_EventState(Uint8 type, int state);

    Description

    This function allows you to set the state of processing certain event type's.

    If state is set to SDL_IGNORE, +that event type will be automatically dropped from the event queue and will +not be filtered.

    If state is set to SDL_ENABLE, +that event type will be processed normally.

    If state is set to SDL_QUERY, +SDL_EventState will return the current processing +state of the specified event type.

    A list of event type's can be found in the SDL_Event section.

    See Also

    SDL_Event


    PrevHomeNext
    SDL_GetEventFilterUpSDL_GetKeyState
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlfillrect.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlfillrect.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,270 @@ +SDL_FillRect
    SDL Library Documentation
    PrevNext

    SDL_FillRect

    Name

    SDL_FillRect -- This function performs a fast fill of the given rectangle with some color

    Synopsis

    #include "SDL.h"

    int SDL_FillRect(SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color);

    Description

    This function performs a fast fill of the given rectangle with +color. If dstrect +is NULL, the whole surface will be filled with +color.

    The color should be a pixel of the format used by the surface, and +can be generated by the +SDL_MapRGB +function.

    If there is a clip rectangle set on the destination (set via +SDL_SetClipRect) then this +function will clip based on the intersection of the clip rectangle and +the dstrect rectangle.

    Return Value

    This function returns 0 on success, or +-1 on error.


    PrevHomeNext
    SDL_BlitSurfaceUpSDL_DisplayFormat
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlflip.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlflip.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,251 @@ +SDL_Flip
    SDL Library Documentation
    PrevNext

    SDL_Flip

    Name

    SDL_Flip -- Swaps screen buffers

    Synopsis

    #include "SDL.h"

    int SDL_Flip(SDL_Surface *screen);

    Description

    On hardware that supports double-buffering, this function sets up a flip +and returns. The hardware will wait for vertical retrace, and then swap +video buffers before the next video surface blit or lock will return. +On hardware that doesn't support double-buffering, this is equivalent +to calling SDL_UpdateRect(screen, 0, 0, 0, 0)

    The SDL_DOUBLEBUF flag must have been passed to +SDL_SetVideoMode, + when +setting the video mode for this function to perform hardware flipping.

    Return Value

    This function returns 0 if successful, or +-1 if there was an error.


    PrevHomeNext
    SDL_UpdateRectsUpSDL_SetColors
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlfreecursor.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlfreecursor.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,201 @@ +SDL_FreeCursor
    SDL Library Documentation
    PrevNext

    SDL_FreeCursor

    Name

    SDL_FreeCursor -- Frees a cursor created with SDL_CreateCursor.

    Synopsis

    #include "SDL.h"

    void SDL_FreeCursor(SDL_Cursor *cursor);

    Description

    Frees a SDL_Cursor that was created using +SDL_CreateCursor.


    PrevHomeNext
    SDL_CreateCursorUpSDL_SetCursor
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlfreesurface.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlfreesurface.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,211 @@ +SDL_FreeSurface
    SDL Library Documentation
    PrevNext

    SDL_FreeSurface

    Name

    SDL_FreeSurface -- Frees (deletes) and SDL_Surface

    Synopsis

    #include "SDL.h"

    void SDL_FreeSurface(SDL_Surface *surface);

    Description

    Frees the resources used by a previously created SDL_Surface. If the surface was created using +SDL_CreateRGBSurfaceFrom then the pixel data is not freed.


    PrevHomeNext
    SDL_CreateRGBSurfaceFromUpSDL_LockSurface
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlfreewav.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlfreewav.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,214 @@ +SDL_FreeWAV
    SDL Library Documentation
    PrevNext

    SDL_FreeWAV

    Name

    SDL_FreeWAV -- Frees previously opened WAV data

    Synopsis

    #include "SDL.h"

    void SDL_FreeWAV(Uint8 *audio_buf);

    Description

    After a WAVE file has been opened with SDL_LoadWAV its data can eventually be freed with SDL_FreeWAV. audio_buf is a pointer to the buffer created by SDL_LoadWAV.

    See Also

    SDL_LoadWAV


    PrevHomeNext
    SDL_LoadWAVUpSDL_AudioCVT
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlfreeyuvoverlay.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlfreeyuvoverlay.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,225 @@ +SDL_FreeYUVOverlay
    SDL Library Documentation
    PrevNext

    SDL_FreeYUVOverlay

    Name

    SDL_FreeYUVOverlay -- Free a YUV video overlay

    Synopsis

    #include "SDL.h"

    void SDL_FreeYUVOverlay(SDL_Overlay *overlay);

    Description

    Frees and overlay created by SDL_CreateYUVOverlay.


    PrevHomeNext
    SDL_DisplayYUVOverlayUpSDL_GLattr
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlgetappstate.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlgetappstate.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,255 @@ +SDL_GetAppState
    SDL Library Documentation
    PrevNext

    SDL_GetAppState

    Name

    SDL_GetAppState -- Get the state of the application

    Synopsis

    #include "SDL.h"

    Uint8 SDL_GetAppState(void);

    Description

    This function returns the current state of the application. The value returned is a bitwise combination of:

    SDL_APPMOUSEFOCUSThe application has mouse focus.
    SDL_APPINPUTFOCUSThe application has keyboard focus
    SDL_APPACTIVEThe application is visible


    PrevHomeNext
    SDL_GetRelativeMouseStateUpSDL_JoystickEventState
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlgetaudiostatus.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlgetaudiostatus.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,213 @@ +SDL_GetAudioStatus
    SDL Library Documentation
    PrevNext

    SDL_GetAudioStatus

    Name

    SDL_GetAudioStatus -- Get the current audio state

    Synopsis

    #include "SDL.h"

    SDL_audiostatusSDL_GetAudioStatus(void);

    Description

    typedef enum{
    +  SDL_AUDIO_STOPPED,
    +  SDL_AUDIO_PAUSED,
    +  SDL_AUDIO_PLAYING
    +} SDL_audiostatus;

    Returns either SDL_AUDIO_STOPPED, SDL_AUDIO_PAUSED or SDL_AUDIO_PLAYING depending on the current audio state.


    PrevHomeNext
    SDL_PauseAudioUpSDL_LoadWAV
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlgetcliprect.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlgetcliprect.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,221 @@ +SDL_GetClipRect
    SDL Library Documentation
    PrevNext

    SDL_GetClipRect

    Name

    SDL_GetClipRect -- Gets the clipping rectangle for a surface.

    Synopsis

    #include "SDL.h"

    void SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect);

    Description

    Gets the clipping rectangle for a surface. When this surface is the +destination of a blit, only the area within the clip rectangle is +drawn into.

    The rectangle pointed to by rect will be +filled with the clipping rectangle of the surface.


    PrevHomeNext
    SDL_SetClipRectUpSDL_ConvertSurface
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlgetcursor.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlgetcursor.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,211 @@ +SDL_GetCursor
    SDL Library Documentation
    PrevNext

    SDL_GetCursor

    Name

    SDL_GetCursor -- Get the currently active mouse cursor.

    Synopsis

    #include "SDL.h"

    SDL_Cursor *SDL_GetCursor(void);

    Description

    Returns the currently active mouse cursor.


    PrevHomeNext
    SDL_SetCursorUpSDL_ShowCursor
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlgeteventfilter.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlgeteventfilter.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,227 @@ +SDL_GetEventFilter
    SDL Library Documentation
    PrevNext

    SDL_GetEventFilter

    Name

    SDL_GetEventFilter -- Retrieves a pointer to he event filter

    Synopsis

    #include "SDL.h"

    SDL_EventFilter SDL_GetEventFilter(void);

    Description

    This function retrieces a pointer to the event filter that was previously set using SDL_SetEventFilter. An SDL_EventFilter function is defined as: +

    typedef int (*SDL_EventFilter)(const SDL_Event *event);

    Return Value

    Returns a pointer to the event filter or NULL if no filter has been set.


    PrevHomeNext
    SDL_SetEventFilterUpSDL_EventState
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlgetgammaramp.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlgetgammaramp.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,211 @@ +SDL_GetGammaRamp
    SDL Library Documentation
    PrevNext

    SDL_GetGammaRamp

    Name

    SDL_GetGammaRamp -- Gets the color gamma lookup tables for the display

    Synopsis

    #include "SDL.h"

    int SDL_GetGammaRamp(Uint16 *redtable, Uint16 *greentable, Uint16 *bluetable);

    Description

    Gets the gamma translation lookup tables currently used by the display. +Each table is an array of 256 Uint16 values.

    Not all display hardware is able to change gamma.

    Return Value

    Returns -1 on error.


    PrevHomeNext
    SDL_SetGammaUpSDL_SetGammaRamp
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlgetkeyname.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlgetkeyname.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,208 @@ +SDL_GetKeyName
    SDL Library Documentation
    PrevNext

    SDL_GetKeyName

    Name

    SDL_GetKeyName -- Get the name of an SDL virtual keysym

    Synopsis

    #include "SDL.h"

    char *SDL_GetKeyName(SDLKey key);

    Description

    Returns the SDL-defined name of the SDLKey key.

    See Also

    SDLKey


    PrevHomeNext
    SDL_SetModStateUpSDL_EnableUNICODE
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlgetkeystate.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlgetkeystate.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,245 @@ +SDL_GetKeyState
    SDL Library Documentation
    PrevNext

    SDL_GetKeyState

    Name

    SDL_GetKeyState -- Get a snapshot of the current keyboard state

    Synopsis

    #include "SDL.h"

    Uint8 *SDL_GetKeyState(int *numkeys);

    Description

    Gets a snapshot of the current keyboard state. The current state is return as a pointer to an array, the size of this array is stored in numkeys. The array is indexed by the SDLK_* symbols. A value of 1 means the key is pressed and a value of 0 means its not.

    Note: Use SDL_PumpEvents to update the state array.

    Example

    Uint8 *keystate = SDL_GetKeyState(NULL);
    +if ( keystate[SDLK_RETURN] ) printf("Return Key Pressed.\n");


    PrevHomeNext
    SDL_EventStateUpSDL_GetModState
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlgetmodstate.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlgetmodstate.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,249 @@ +SDL_GetModState
    SDL Library Documentation
    PrevNext

    SDL_GetModState

    Name

    SDL_GetModState -- Get the state of modifier keys.

    Synopsis

    #include "SDL.h"

    SDLMod SDL_GetModState(void);

    Description

    Returns the current of the modifier keys (CTRL, ALT, etc.).

    Return Value

    The return value can be an OR'd combination of the SDLMod enum.

    SDLMod

    typedef enum {
    +  KMOD_NONE  = 0x0000,
    +  KMOD_LSHIFT= 0x0001,
    +  KMOD_RSHIFT= 0x0002,
    +  KMOD_LCTRL = 0x0040,
    +  KMOD_RCTRL = 0x0080,
    +  KMOD_LALT  = 0x0100,
    +  KMOD_RALT  = 0x0200,
    +  KMOD_LMETA = 0x0400,
    +  KMOD_RMETA = 0x0800,
    +  KMOD_NUM   = 0x1000,
    +  KMOD_CAPS  = 0x2000,
    +  KMOD_MODE  = 0x4000,
    +} SDLMod;
    +SDL also defines the following symbols for convenience: +
    #define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL)
    +#define KMOD_SHIFT  (KMOD_LSHIFT|KMOD_RSHIFT)
    +#define KMOD_ALT  (KMOD_LALT|KMOD_RALT)
    +#define KMOD_META (KMOD_LMETA|KMOD_RMETA)


    PrevHomeNext
    SDL_GetKeyStateUpSDL_SetModState
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlgetmousestate.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlgetmousestate.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,245 @@ +SDL_GetMouseState
    SDL Library Documentation
    PrevNext

    SDL_GetMouseState

    Name

    SDL_GetMouseState -- Retrieve the current state of the mouse

    Synopsis

    #include "SDL.h"

    Uint8 SDL_GetMouseState(int *x, int *y);

    Description

    The current button state is returned as a button bitmask, which can +be tested using the SDL_BUTTON(X) macros, and x and y are set to the +current mouse cursor position. You can pass NULL for either x or y.

    Example

    SDL_PumpEvents();
    +if(SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1))
    +  printf("Mouse Button 1(left) is pressed.\n");

    PrevHomeNext
    SDL_EnableKeyRepeatUpSDL_GetRelativeMouseState
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlgetrelativemousestate.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlgetrelativemousestate.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,227 @@ +SDL_GetRelativeMouseState
    SDL Library Documentation
    PrevNext

    SDL_GetRelativeMouseState

    Name

    SDL_GetRelativeMouseState -- Retrieve the current state of the mouse

    Synopsis

    #include "SDL.h"

    Uint8 SDL_GetRelativeMouseState(int *x, int *y);

    Description

    The current button state is returned as a button bitmask, which can +be tested using the SDL_BUTTON(X) macros, and x and y are set to the change in the mouse position since the last call to SDL_GetRelativeMouseState or since event initialization. You can pass NULL for either x or y.


    PrevHomeNext
    SDL_GetMouseStateUpSDL_GetAppState
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlgetrgb.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlgetrgb.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,223 @@ +SDL_GetRGB
    SDL Library Documentation
    PrevNext

    SDL_GetRGB

    Name

    SDL_GetRGB -- Get RGB values from a pixel in the specified pixel format.

    Synopsis

    #include "SDL.h"

    void SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt, Uint8 *r, Uint8 *g, Uint8 *b);

    Description

    Get RGB component values from a pixel stored in the specified pixel format.

    This function uses the entire 8-bit [0..255] range when converting color +components from pixel formats with less than 8-bits per RGB component +(e.g., a completely white pixel in 16-bit RGB565 format would return +[0xff, 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).


    PrevHomeNext
    SDL_MapRGBAUpSDL_GetRGBA
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlgetrgba.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlgetrgba.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,214 @@ +SDL_GetRGBA
    SDL Library Documentation
    PrevNext

    SDL_GetRGBA

    Name

    SDL_GetRGBA -- Get RGBA values from a pixel in the specified pixel format.

    Synopsis

    #include "SDL.h"

    void SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);

    Description

    Get RGBA component values from a pixel stored in the specified pixel format.

    This function uses the entire 8-bit [0..255] range when converting color +components from pixel formats with less than 8-bits per RGB component +(e.g., a completely white pixel in 16-bit RGB565 format would return +[0xff, 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).

    If the surface has no alpha component, the alpha will be returned as 0xff +(100% opaque).


    PrevHomeNext
    SDL_GetRGBUpSDL_CreateRGBSurface
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlgetthreadid.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlgetthreadid.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,201 @@ +SDL_GetThreadID
    SDL Library Documentation
    PrevNext

    SDL_GetThreadID

    Name

    SDL_GetThreadID -- Get the SDL thread ID of a SDL_Thread

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    Uint32 SDL_GetThreadID(SDL_Thread *thread);

    Description

    Returns the ID of a SDL_Thread created by SDL_CreateThread.


    PrevHomeNext
    SDL_ThreadIDUpSDL_WaitThread
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlgetticks.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlgetticks.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,198 @@ +SDL_GetTicks
    SDL Library Documentation
    PrevNext

    SDL_GetTicks

    Name

    SDL_GetTicks -- Get the number of milliseconds since the SDL library initialization.

    Synopsis

    #include "SDL.h"

    Uint32 SDL_GetTicks(void);

    Description

    Get the number of milliseconds since the SDL library initialization. +Note that this value wraps if the program runs for more than ~49 days.

    See Also

    SDL_Delay


    PrevHomeNext
    TimeUpSDL_Delay
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlgetvideoinfo.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlgetvideoinfo.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,218 @@ +SDL_GetVideoInfo
    SDL Library Documentation
    PrevNext

    SDL_GetVideoInfo

    Name

    SDL_GetVideoInfo -- returns a pointer to information about the video hardware

    Synopsis

    #include "SDL.h"

    SDL_VideoInfo *SDL_GetVideoInfo(void);

    Description

    This function returns a read-only pointer to information about the video +hardware. If this is called before SDL_SetVideoMode, the +vfmt member of the returned structure will contain the +pixel format of the "best" video mode.


    PrevHomeNext
    SDL_GetVideoSurfaceUpSDL_VideoDriverName
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlgetvideosurface.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlgetvideosurface.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,200 @@ +SDL_GetVideoSurface
    SDL Library Documentation
    PrevNext

    SDL_GetVideoSurface

    Name

    SDL_GetVideoSurface -- returns a pointer to the current display surface

    Synopsis

    #include "SDL.h"

    SDL_Surface *SDL_GetVideoSurface(void);

    Description

    This function returns a pointer to the current display surface. +If SDL is doing format conversion on the display surface, this +function returns the publicly visible surface, not the real video +surface.

    See Also

    SDL_Surface


    PrevHomeNext
    VideoUpSDL_GetVideoInfo
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlglattr.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlglattr.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,368 @@ +SDL_GLattr
    SDL Library Documentation
    PrevNext

    SDL_GLattr

    Name

    SDL_GLattr -- SDL GL Attributes

    Attributes

    SDL_GL_RED_SIZESize of the framebuffer red component, in bits
    SDL_GL_GREEN_SIZESize of the framebuffer green component, in bits
    SDL_GL_BLUE_SIZESize of the framebuffer blue component, in bits
    SDL_GL_ALPHA_SIZESize of the framebuffer alpha component, in bits
    SDL_GL_DOUBLEBUFFER0 or 1, enable or disable double buffering
    SDL_GL_BUFFER_SIZESize of the framebuffer, in bits
    SDL_GL_DEPTH_SIZESize of the depth buffer, in bits
    SDL_GL_STENCIL_SIZESize of the stencil buffer, in bits
    SDL_GL_ACCUM_RED_SIZESize of the accumulation buffer red component, in bits
    SDL_GL_ACCUM_GREEN_SIZESize of the accumulation buffer green component, in bits
    SDL_GL_ACCUM_BLUE_SIZESize of the accumulation buffer blue component, in bits
    SDL_GL_ACCUM_ALPHA_SIZESize of the accumulation buffer alpha component, in bits

    Description

    While you can set most OpenGL attributes normally, the attributes list above must be known before SDL sets the video mode. These attributes a set and read with SDL_GL_SetAttribute and SDL_GL_GetAttribute.


    PrevHomeNext
    SDL_FreeYUVOverlayUpSDL_Rect
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlglgetattribute.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlglgetattribute.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,239 @@ +SDL_GL_GetAttribute
    SDL Library Documentation
    PrevNext

    SDL_GL_GetAttribute

    Name

    SDL_GL_GetAttribute -- Get the value of a special SDL/OpenGL attribute

    Synopsis

    #include "SDL.h"

    int SDL_GL_GetAttribute(SDLGLattr attr, int *value);

    Description

    Places the value of the SDL/OpenGL attribute attr into value. This is useful after a call to SDL_SetVideoMode to check whether your attributes have been set as you expected.

    Return Value

    Returns 0 on success, or -1 on an error.


    PrevHomeNext
    SDL_GL_GetProcAddressUpSDL_GL_SetAttribute
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlglgetprocaddress.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlglgetprocaddress.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,251 @@ +SDL_GL_GetProcAddress
    SDL Library Documentation
    PrevNext

    SDL_GL_GetProcAddress

    Name

    SDL_GL_GetProcAddress -- Get the address of a GL function

    Synopsis

    #include "SDL.h"

    void *SDL_GL_GetProcAddress(const char* proc);

    Description

    Returns the address of the GL function proc, or NULL if the function is not found. If the GL library is loaded at runtime, with SDL_GL_LoadLibrary, then all GL functions must be retrieved this way. Usually this is used to retrieve function pointers to OpenGL extensions.

    Example

    typedef void (*GL_ActiveTextureARB_Func)(unsigned int);
    +GL_ActiveTextureARB_Func glActiveTextureARB_ptr = 0;
    +int has_multitexture=1;
    +.
    +.
    +.
    +/* Get function pointer */
    +glActiveTextureARB_ptr=(GL_ActiveTextureARB_Func) SDL_GL_GetProcAddress("glActiveTextureARB");
    +
    +/* Check for a valid function ptr */
    +if(!glActiveTextureARB_ptr){
    +  fprintf(stderr, "Multitexture Extensions not present.\n");
    +  has_multitexture=0;
    +}
    +.
    +.
    +.
    +.
    +if(has_multitexture){
    +  glActiveTextureARB_ptr(GL_TEXTURE0_ARB);
    +  .
    +  .
    +}
    +else{
    +  .
    +  .
    +}

    PrevHomeNext
    SDL_GL_LoadLibraryUpSDL_GL_GetAttribute
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlglloadlibrary.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlglloadlibrary.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,223 @@ +SDL_GL_LoadLibrary
    SDL Library Documentation
    PrevNext

    SDL_GL_LoadLibrary

    Name

    SDL_GL_LoadLibrary -- Specify an OpenGL library

    Synopsis

    #include "SDL.h"

    int SDL_GL_LoadLibrary(const char *path);

    Description

    If you wish, you may load the OpenGL library at runtime, this must be done before SDL_SetVideoMode is called. The path of the GL library is passed to SDL_GL_LoadLibrary and it returns 0 on success, or -1 on an error. You must then use SDL_GL_GetProcAddress to retrieve function pointers to GL functions.


    PrevHomeNext
    SDL_ShowCursorUpSDL_GL_GetProcAddress
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlglsetattribute.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlglsetattribute.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,278 @@ +SDL_GL_SetAttribute
    SDL Library Documentation
    PrevNext

    SDL_GL_SetAttribute

    Name

    SDL_GL_SetAttribute -- Set a special SDL/OpenGL attribute

    Synopsis

    #include "SDL.h"

    int SDL_GL_SetAttribute(SDL_GLattr attr, int value);

    Description

    Sets the OpenGL attribute attr to value. The attributes you set don't take effect until after a call to SDL_SetVideoMode. You should use SDL_GL_GetAttribute to check the values after a SDL_SetVideoMode call.

    Return Value

    Returns 0 on success, or -1 on error.

    Example

    SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 );
    +SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 );
    +SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 );
    +SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 );
    +SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
    +if ( (screen=SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL )) == NULL ) {
    +  fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError());
    +  SDL_Quit();
    +  return;
    +}

    Note: The SDL_DOUBLEBUF flag is not required to enable double buffering when setting an OpenGL video mode. Double buffering is enabled or disabled using the SDL_GL_DOUBLEBUFFER attribute.


    PrevHomeNext
    SDL_GL_GetAttributeUpSDL_GL_SwapBuffers
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlglswapbuffers.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlglswapbuffers.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,204 @@ +SDL_GL_SwapBuffers
    SDL Library Documentation
    PrevNext

    SDL_GL_SwapBuffers

    Name

    SDL_GL_SwapBuffers -- Swap OpenGL framebuffers/Update Display

    Synopsis

    #include "SDL.h"

    void SDL_GL_SwapBuffers(void );

    Description

    Swap the OpenGL buffers, if double-buffering is supported.


    PrevHomeNext
    SDL_GL_SetAttributeUpSDL_CreateYUVOverlay
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlinit.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlinit.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,360 @@ +SDL_Init
    SDL Library Documentation
    PrevNext

    SDL_Init

    Name

    SDL_Init -- Initializes SDL

    Synopsis

    #include "SDL.h"

    int SDL_Init(Uint32 flags);

    Description

    Initializes SDL. This should be called before all other SDL functions. The flags parameter specifies what part(s) of SDL to initialize.

    SDL_INIT_TIMERInitializes the timer subsystem.
    SDL_INIT_AUDIOInitializes the audio subsystem.
    SDL_INIT_VIDEOInitializes the video subsystem.
    SDL_INIT_CDROMInitializes the cdrom subsystem.
    SDL_INIT_JOYSTICKInitializes the joystick subsystem.
    SDL_INIT_EVERYTHINGInitialize all of the above.
    SDL_INIT_NOPARACHUTEPrevents SDL from catching fatal signals.
    SDL_INIT_EVENTTHREAD 

    Return Value

    Returns -1 on an error or 0 on success.


    PrevHomeNext
    GeneralUpSDL_InitSubSystem
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlinitsubsystem.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlinitsubsystem.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,275 @@ +SDL_InitSubSystem
    SDL Library Documentation
    PrevNext

    SDL_InitSubSystem

    Name

    SDL_InitSubSystem -- Initialize subsystems

    Synopsis

    #include "SDL.h"

    int SDL_InitSubSystem(Uint32 flags);

    Description

    After SDL has been initialized with SDL_Init you may initialize uninitialized subsystems with SDL_InitSubSystem. The flags parameter is the same as that used in SDL_Init.

    Examples

    /* Seperating Joystick and Video initialization. */
    +SDL_Init(SDL_INIT_VIDEO);
    +.
    +.
    +SDL_SetVideoMode(640, 480, 16, SDL_DOUBLEBUF|SDL_FULLSCREEN);
    +.
    +/* Do Some Video stuff */
    +.
    +.
    +/* Initialize the joystick subsystem */
    +SDL_InitSubSystem(SDL_INIT_JOYSTICK);
    +
    +/* Do some stuff with video and joystick */
    +.
    +.
    +.
    +/* Shut them both down */
    +SDL_Quit();

    Return Value

    Returns -1 on an error or 0 on success.


    PrevHomeNext
    SDL_InitUpSDL_QuitSubSystem
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdljoyaxisevent.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdljoyaxisevent.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,322 @@ +SDL_JoyAxisEvent
    SDL Library Documentation
    PrevNext

    SDL_JoyAxisEvent

    Name

    SDL_JoyAxisEvent -- Joystick axis motion event structure

    Structure Definition

    typedef struct{
    +  Uint8 type;
    +  Uint8 which;
    +  Uint8 axis;
    +  Sint16 value;
    +} SDL_JoyAxisEvent;

    Structure Data

    typeSDL_JOYAXISMOTION
    whichJoystick device index
    axisJoystick axis index
    valueAxis value (range: -32768 to 32767)

    Description

    SDL_JoyAxisEvent is a member of the SDL_Event union and is used when an event of type SDL_JOYAXISMOTION is reported.

    A SDL_JOYAXISMOTION event occurs when ever a user moves an axis on the joystick. The field which is the index of the joystick that reported the event and axis is the index of the axis (for a more detailed explaination see the Joystick section). value is the current position of the axis.


    PrevHomeNext
    SDL_MouseButtonEventUpSDL_JoyButtonEvent
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdljoyballevent.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdljoyballevent.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,332 @@ +SDL_JoyBallEvent
    SDL Library Documentation
    PrevNext

    SDL_JoyBallEvent

    Name

    SDL_JoyBallEvent -- Joystick trackball motion event structure

    Structure Definition

    typedef struct{
    +  Uint8 type;
    +  Uint8 which;
    +  Uint8 ball;
    +  Sint16 xrel, yrel;
    +} SDL_JoyBallEvent;

    Structure Data

    typeSDL_JOYBALLMOTION
    whichJoystick device index
    ballJoystick trackball index
    xrel, yrelThe relative motion in the X/Y direction

    Description

    SDL_JoyBallEvent is a member of the SDL_Event union and is used when an event of type SDL_JOYBALLMOTION is reported.

    A SDL_JOYBALLMOTION event occurs when a user moves a trackball on the joystick. The field which is the index of the joystick that reported the event and ball is the index of the trackball (for a more detailed explaination see the Joystick section). Trackballs only return relative motion, this is the change in position on the ball since it was last polled (last cycle of the event loop) and it is stored in xrel and yrel.


    PrevHomeNext
    SDL_JoyHatEventUpSDL_ResizeEvent
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdljoybuttonevent.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdljoybuttonevent.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,343 @@ +SDL_JoyButtonEvent
    SDL Library Documentation
    PrevNext

    SDL_JoyButtonEvent

    Name

    SDL_JoyButtonEvent -- Joystick button event structure

    Structure Definition

    typedef struct{
    +  Uint8 type;
    +  Uint8 which;
    +  Uint8 button;
    +  Uint8 state;
    +} SDL_JoyButtonEvent;

    Structure Data

    typeSDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP
    whichJoystick device index
    buttonJoystick button index
    stateSDL_PRESSED or SDL_RELEASED

    Description

    SDL_JoyButtonEvent is a member of the SDL_Event union and is used when an event of type SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP is reported.

    A SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP event occurs when ever a user presses or releases a button on a joystick. The field which is the index of the joystick that reported the event and button is the index of the button (for a more detailed explaination see the Joystick section). state is the current state or the button which is either SDL_PRESSED or SDL_RELEASED.


    PrevHomeNext
    SDL_JoyAxisEventUpSDL_JoyHatEvent
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdljoyhatevent.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdljoyhatevent.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,405 @@ +SDL_JoyHatEvent
    SDL Library Documentation
    PrevNext

    SDL_JoyHatEvent

    Name

    SDL_JoyHatEvent -- Joystick hat position change event structure

    Structure Definition

    typedef struct{
    +  Uint8 type;
    +  Uint8 which;
    +  Uint8 hat;
    +  Uint8 value;
    +} SDL_JoyHatEvent;

    Structure Data

    typeSDL_JOY
    whichJoystick device index
    hatJoystick hat index
    valueHat position

    Description

    SDL_JoyHatEvent is a member of the SDL_Event union and is used when an event of type SDL_JOYHATMOTION is reported.

    A SDL_JOYHATMOTION event occurs when ever a user moves a hat on the joystick. The field which is the index of the joystick that reported the event and hat is the index of the hat (for a more detailed exlaination see the Joystick section). value is the current position of the hat. It is a logically OR'd combination of the following values (whose meanings should be pretty obvious:) :

    SDL_HAT_CENTERED
    SDL_HAT_UP
    SDL_HAT_RIGHT
    SDL_HAT_DOWN
    SDL_HAT_LEFT

    The following defines are also provided:

    SDL_HAT_RIGHTUP
    SDL_HAT_RIGHTDOWN
    SDL_HAT_LEFTUP
    SDL_HAT_LEFTDOWN


    PrevHomeNext
    SDL_JoyButtonEventUpSDL_JoyBallEvent
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdljoystickclose.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdljoystickclose.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,215 @@ +SDL_JoystickClose
    SDL Library Documentation
    PrevNext

    SDL_JoystickClose

    Name

    SDL_JoystickClose -- Closes a previously opened joystick

    Synopsis

    #include "SDL.h"

    void SDL_JoystickClose(SDL_Joystick *joystick);

    Description

    Close a joystick that was previously opened with SDL_JoystickOpen.


    PrevHomeNext
    SDL_JoystickGetBallUpAudio
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdljoystickeventstate.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdljoystickeventstate.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,282 @@ +SDL_JoystickEventState
    SDL Library Documentation
    PrevNext

    SDL_JoystickEventState

    Name

    SDL_JoystickEventState -- Enable/disable joystick event polling

    Synopsis

    #include "SDL.h"

    int SDL_JoystickEventState(int state);

    Description

    This function is used to enable or disable joystick event processing. With joystick event processing disabled you will have to update joystick states with SDL_JoystickUpdate and read the joystick information manually. state is either SDL_QUERY, SDL_ENABLE or SDL_IGNORE.

    Note: Joystick event handling is prefered

    Return Value

    If state is SDL_QUERY then the current state is returned, otherwise the new processing state is returned.


    PrevHomeNext
    SDL_GetAppStateUpJoystick
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdljoystickgetaxis.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdljoystickgetaxis.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,263 @@ +SDL_JoystickGetAxis
    SDL Library Documentation
    PrevNext

    SDL_JoystickGetAxis

    Name

    SDL_JoystickGetAxis -- Get the current state of an axis

    Synopsis

    #include "SDL.h"

    Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis);

    Description

    SDL_JoystickGetAxis returns the current state of the given axis on the given joystick.

    On most modern joysticks the X axis is usually represented by axis 0 and the Y axis by axis 1. The value returned by SDL_JoystickGetAxis is a signed integer (-32768 to 32768) representing the current position of the axis, it maybe necessary to impose certain tolerances on these values to account for jitter. It is worth noting that some joysticks use axes 2 and 3 for extra buttons.

    Return Value

    Returns a 16-bit signed integer representing the current position of the axis.

    Examples

    Sint16 x_move, y_move;
    +SDL_Joystick *joy1;
    +.
    +.
    +x_move=SDL_JoystickGetAxis(joy1, 0);
    +y_move=SDL_JoystickGetAxis(joy1, 1);


    PrevHomeNext
    SDL_JoystickUpdateUpSDL_JoystickGetHat
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdljoystickgetball.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdljoystickgetball.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,254 @@ +SDL_JoystickGetBall
    SDL Library Documentation
    PrevNext

    SDL_JoystickGetBall

    Name

    SDL_JoystickGetBall -- Get relative trackball motion

    Synopsis

    #include "SDL.h"

    int SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy);

    Description

    Get the ball axis change.

    Trackballs can only return relative motion since the last call to SDL_JoystickGetBall, these motion deltas a placed into dx and dy.

    Return Value

    Returns 0 on success or -1 on failure

    Examples

    int delta_x, delta_y;
    +SDL_Joystick *joy;
    +.
    +.
    +.
    +SDL_JoystickUpdate();
    +if(SDL_JoystickGetBall(joy, 0, &delta_x, &delta_y)==-1)
    +  printf("TrackBall Read Error!\n");
    +printf("Trackball Delta- X:%d, Y:%d\n", delta_x, delta_y);


    PrevHomeNext
    SDL_JoystickGetButtonUpSDL_JoystickClose
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdljoystickgetbutton.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdljoystickgetbutton.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,223 @@ +SDL_JoystickGetButton
    SDL Library Documentation
    PrevNext

    SDL_JoystickGetButton

    Name

    SDL_JoystickGetButton -- Get the current state of a given button on a given joystick

    Synopsis

    #include "SDL.h"

    Uint8 SDL_JoystickGetButton(SDL_Joystick *joystick, int button);

    Description

    SDL_JoystickGetButton returns the current state of the given button on the given joystick.

    Return Value

    1 if the button is pressed. Otherwise, 0.


    PrevHomeNext
    SDL_JoystickGetHatUpSDL_JoystickGetBall
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdljoystickgethat.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdljoystickgethat.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,289 @@ +SDL_JoystickGetHat
    SDL Library Documentation
    PrevNext

    SDL_JoystickGetHat

    Name

    SDL_JoystickGetHat -- Get the current state of a joystick hat

    Synopsis

    #include "SDL.h"

    Uint8 SDL_JoystickGetHat(SDL_Joystick *joystick, int hat);

    Description

    SDL_JoystickGetHat returns the current state of the given hat on the given joystick.

    Return Value

    The current state is returned as a Uint8 which is defined as an OR'd combination of one or more of the following

    SDL_HAT_CENTERED
    SDL_HAT_UP
    SDL_HAT_RIGHT
    SDL_HAT_DOWN
    SDL_HAT_LEFT
    SDL_HAT_RIGHTUP
    SDL_HAT_RIGHTDOWN
    SDL_HAT_LEFTUP
    SDL_HAT_LEFTDOWN


    PrevHomeNext
    SDL_JoystickGetAxisUpSDL_JoystickGetButton
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdljoystickindex.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdljoystickindex.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,210 @@ +SDL_JoystickIndex
    SDL Library Documentation
    PrevNext

    SDL_JoystickIndex

    Name

    SDL_JoystickIndex -- Get the index of an SDL_Joystick.

    Synopsis

    #include "SDL.h"

    int SDL_JoystickIndex(SDL_Joystick *joystick);

    Description

    Returns the index of a given SDL_Joystick structure.

    Return Value

    Index number of the joystick.


    PrevHomeNext
    SDL_JoystickOpenedUpSDL_JoystickNumAxes
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdljoystickname.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdljoystickname.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,230 @@ +SDL_JoystickName
    SDL Library Documentation
    PrevNext

    SDL_JoystickName

    Name

    SDL_JoystickName -- Get joystick name.

    Synopsis

    #include "SDL.h"

    const char *SDL_JoystickName(int index);

    Description

    Get the implementation dependent name of joystick. The index parameter refers to the N'th joystick on the system.

    Return Value

    Returns a char pointer to the joystick name.

    Examples

    /* Print the names of all attached joysticks */
    +int num_joy, i;
    +num_joy=SDL_NumJoysticks();
    +printf("%d joysticks found\n", num_joy);
    +for(i=0;i<num_joy;i++)
    +  printf("%s\n", SDL_JoystickName(i);


    PrevHomeNext
    SDL_NumJoysticksUpSDL_JoystickOpen
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdljoysticknumaxes.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdljoysticknumaxes.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,217 @@ +SDL_JoystickNumAxes
    SDL Library Documentation
    PrevNext

    SDL_JoystickNumAxes

    Name

    SDL_JoystickNumAxes -- Get the number of joystick axes

    Synopsis

    #include "SDL.h"

    int SDL_JoystickNumAxes(SDL_Joystick *joystick);

    Description

    Return the number of axes available from a previously opened SDL_Joystick.

    Return Value

    Number of axes.


    PrevHomeNext
    SDL_JoystickIndexUpSDL_JoystickNumBalls
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdljoysticknumballs.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdljoysticknumballs.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,217 @@ +SDL_JoystickNumBalls
    SDL Library Documentation
    PrevNext

    SDL_JoystickNumBalls

    Name

    SDL_JoystickNumBalls -- Get the number of joystick trackballs

    Synopsis

    #include "SDL.h"

    int SDL_JoystickNumBalls(SDL_Joystick *joystick);

    Description

    Return the number of trackballs available from a previously opened SDL_Joystick.

    Return Value

    Number of trackballs.


    PrevHomeNext
    SDL_JoystickNumAxesUpSDL_JoystickNumHats
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdljoysticknumbuttons.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdljoysticknumbuttons.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,217 @@ +SDL_JoystickNumButtons
    SDL Library Documentation
    PrevNext

    SDL_JoystickNumButtons

    Name

    SDL_JoystickNumButtons -- Get the number of joysitck buttons

    Synopsis

    #include "SDL.h"

    int SDL_JoystickNumButtons(SDL_Joystick *joystick);

    Description

    Return the number of buttons available from a previously opened SDL_Joystick.

    Return Value

    Number of buttons.


    PrevHomeNext
    SDL_JoystickNumHatsUpSDL_JoystickUpdate
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdljoysticknumhats.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdljoysticknumhats.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,217 @@ +SDL_JoystickNumHats
    SDL Library Documentation
    PrevNext

    SDL_JoystickNumHats

    Name

    SDL_JoystickNumHats -- Get the number of joystick hats

    Synopsis

    #include "SDL.h"

    int SDL_JoystickNumHats(SDL_Joystick *joystick);

    Description

    Return the number of hats available from a previously opened SDL_Joystick.

    Return Value

    Number of hats.


    PrevHomeNext
    SDL_JoystickNumBallsUpSDL_JoystickNumButtons
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdljoystickopen.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdljoystickopen.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,251 @@ +SDL_JoystickOpen
    SDL Library Documentation
    PrevNext

    SDL_JoystickOpen

    Name

    SDL_JoystickOpen -- Opens a joystick for use.

    Synopsis

    #include "SDL.h"

    SDL_Joystick *SDL_JoystickOpen(int index);

    Description

    Opens a joystick for use within SDL. The index refers to the N'th joystick in the system. A joystick must be opened before it game be used.

    Return Value

    Returns a SDL_Joystick structure on success. NULL on failure.

    Examples

    SDL_Joystick *joy;
    +// Check for joystick
    +if(SDL_NumJoysticks()>0){
    +  // Open joystick
    +  joy=SDL_JoystickOpen(0);
    +  
    +  if(joy)
    +  {
    +    printf("Opened Joystick 0\n");
    +    printf("Name: %s\n", SDL_JoystickName(0));
    +    printf("Number of Axes: %s\n", SDL_JoystickNumAxes(joy));
    +    printf("Number of Buttons: %s\n", SDL_JoystickNumButtons(joy));
    +    printf("Number of Balls: %s\n", SDL_JoystickNumBalls(joy));
    +  }
    +  else
    +    printf("Couldn't open Joystick 0\n");
    +  
    +  // Close if opened
    +  if(SDL_JoystickOpened(0))
    +    SDL_JoystickClose(joy);
    +}


    PrevHomeNext
    SDL_JoystickNameUpSDL_JoystickOpened
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdljoystickopened.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdljoystickopened.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,225 @@ +SDL_JoystickOpened
    SDL Library Documentation
    PrevNext

    SDL_JoystickOpened

    Name

    SDL_JoystickOpened -- Determine if a joystick has been opened

    Synopsis

    #include "SDL.h"

    int SDL_JoystickOpened(int index);

    Description

    Determines whether a joystick has already been opened within the application. index refers to the N'th joystick on the system.

    Return Value

    Returns 1 if the joystick has been opened, or 0 if it has not.


    PrevHomeNext
    SDL_JoystickOpenUpSDL_JoystickIndex
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdljoystickupdate.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdljoystickupdate.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,203 @@ +SDL_JoystickUpdate
    SDL Library Documentation
    PrevNext

    SDL_JoystickUpdate

    Name

    SDL_JoystickUpdate -- Updates the state of all joysticks

    Synopsis

    #include "SDL.h"

    void SDL_JoystickUpdate(void);

    Description

    Updates the state(position, buttons, etc.) of all open joysticks. If joystick events have been enabled with SDL_JoystickEventState then this is called automatically in the event loop.


    PrevHomeNext
    SDL_JoystickNumButtonsUpSDL_JoystickGetAxis
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlkey.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlkey.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,2622 @@ +SDLKey
    SDL Library Documentation
    PrevNext

    SDLKey

    Name

    SDLKey -- Keysym definitions.

    Description

    Table 8-1. SDL Keysym definitions

    SDLKeyASCII valueCommon name
    SDLK_BACKSPACE'\b'backspace
    SDLK_TAB'\t'tab
    SDLK_CLEAR clear
    SDLK_RETURN'\r'return
    SDLK_PAUSE pause
    SDLK_ESCAPE'^['escape
    SDLK_SPACE' 'space
    SDLK_EXCLAIM'!'exclaim
    SDLK_QUOTEDBL'"'quotedbl
    SDLK_HASH'#'hash
    SDLK_DOLLAR'$'dollar
    SDLK_AMPERSAND'&'ampersand
    SDLK_QUOTE'''quote
    SDLK_LEFTPAREN'('left parenthesis
    SDLK_RIGHTPAREN')'right parenthesis
    SDLK_ASTERISK'*'asterisk
    SDLK_PLUS'+'plus sign
    SDLK_COMMA','comma
    SDLK_MINUS'-'minus sign
    SDLK_PERIOD'.'period
    SDLK_SLASH'/'forward slash
    SDLK_0'0'0
    SDLK_1'1'1
    SDLK_2'2'2
    SDLK_3'3'3
    SDLK_4'4'4
    SDLK_5'5'5
    SDLK_6'6'6
    SDLK_7'7'7
    SDLK_8'8'8
    SDLK_9'9'9
    SDLK_COLON':'colon
    SDLK_SEMICOLON';'semicolon
    SDLK_LESS'<'less-than sign
    SDLK_EQUALS'='equals sign
    SDLK_GREATER'>'greater-than sign
    SDLK_QUESTION'?'question mark
    SDLK_AT'@'at
    SDLK_LEFTBRACKET'['left bracket
    SDLK_BACKSLASH'\'backslash
    SDLK_RIGHTBRACKET']'right bracket
    SDLK_CARET'^'caret
    SDLK_UNDERSCORE'_'underscore
    SDLK_BACKQUOTE'`'grave
    SDLK_a'a'a
    SDLK_b'b'b
    SDLK_c'c'c
    SDLK_d'd'd
    SDLK_e'e'e
    SDLK_f'f'f
    SDLK_g'g'g
    SDLK_h'h'h
    SDLK_i'i'i
    SDLK_j'j'j
    SDLK_k'k'k
    SDLK_l'l'l
    SDLK_m'm'm
    SDLK_n'n'n
    SDLK_o'o'o
    SDLK_p'p'p
    SDLK_q'q'q
    SDLK_r'r'r
    SDLK_s's's
    SDLK_t't't
    SDLK_u'u'u
    SDLK_v'v'v
    SDLK_w'w'w
    SDLK_x'x'x
    SDLK_y'y'y
    SDLK_z'z'z
    SDLK_DELETE'^?'delete
    SDLK_KP0 keypad 0
    SDLK_KP1 keypad 1
    SDLK_KP2 keypad 2
    SDLK_KP3 keypad 3
    SDLK_KP4 keypad 4
    SDLK_KP5 keypad 5
    SDLK_KP6 keypad 6
    SDLK_KP7 keypad 7
    SDLK_KP8 keypad 8
    SDLK_KP9 keypad 9
    SDLK_KP_PERIOD'.'keypad period
    SDLK_KP_DIVIDE'/'keypad divide
    SDLK_KP_MULTIPLY'*'keypad multiply
    SDLK_KP_MINUS'-'keypad minus
    SDLK_KP_PLUS'+'keypad plus
    SDLK_KP_ENTER'\r'keypad enter
    SDLK_KP_EQUALS'='keypad equals
    SDLK_UP up arrow
    SDLK_DOWN down arrow
    SDLK_RIGHT right arrow
    SDLK_LEFT left arrow
    SDLK_INSERT insert
    SDLK_HOME home
    SDLK_END end
    SDLK_PAGEUP page up
    SDLK_PAGEDOWN page down
    SDLK_F1 F1
    SDLK_F2 F2
    SDLK_F3 F3
    SDLK_F4 F4
    SDLK_F5 F5
    SDLK_F6 F6
    SDLK_F7 F7
    SDLK_F8 F8
    SDLK_F9 F9
    SDLK_F10 F10
    SDLK_F11 F11
    SDLK_F12 F12
    SDLK_F13 F13
    SDLK_F14 F14
    SDLK_F15 F15
    SDLK_NUMLOCK numlock
    SDLK_CAPSLOCK capslock
    SDLK_SCROLLOCK scrollock
    SDLK_RSHIFT right shift
    SDLK_LSHIFT left shift
    SDLK_RCTRL right ctrl
    SDLK_LCTRL left ctrl
    SDLK_RALT right alt
    SDLK_LALT left alt
    SDLK_RMETA right meta
    SDLK_LMETA left meta
    SDLK_LSUPER left windows key
    SDLK_RSUPER right windows key
    SDLK_MODE mode shift
    SDLK_HELP help
    SDLK_PRINT print-screen
    SDLK_SYSREQ SysRq
    SDLK_BREAK break
    SDLK_MENU menu
    SDLK_POWER power
    SDLK_EURO euro
    + +

    Table 8-2. SDL modifier definitions

    SDL ModifierMeaning
    KMOD_NONENo modifiers applicable
    KMOD_NUMNumlock is down
    KMOD_CAPSCapslock is down
    KMOD_LCTRLLeft Control is down
    KMOD_RCTRLRight Control is down
    KMOD_RSHIFTRight Shift is down
    KMOD_LSHIFTLeft Shift is down
    KMOD_RALTRight Alt is down
    KMOD_LALTLeft Alt is down
    KMOD_CTRLA Control key is down
    KMOD_SHIFTA Shift key is down
    KMOD_ALTAn Alt key is down


    PrevHomeNext
    SDL_keysymUpEvent Functions.
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlkeyboardevent.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlkeyboardevent.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,367 @@ +SDL_KeyboardEvent
    SDL Library Documentation
    PrevNext

    SDL_KeyboardEvent

    Name

    SDL_KeyboardEvent -- Keyboard event structure

    Structure Definition

    typedef struct{
    +  Uint8 type;
    +  Uint8 state;
    +  SDL_keysym keysym;
    +} SDL_KeyboardEvent;

    Structure Data

    typeSDL_KEYDOWN or SDL_KEYUP
    stateSDL_PRESSED or SDL_RELEASED
    keysymContains key press information

    Description

    SDL_KeyboardEvent is a member of the SDL_Event union and is used when an event of type SDL_KEYDOWN or SDL_KEYUP is reported.

    The type and state actually report the same information, they just use different values to do it! A keyboard event occurs when a key is released (type=SDK_KEYUP or state=SDL_RELEASED) and when a key is pressed (type=SDL_KEYDOWN or state=SDL_PRESSED). The information on what key was pressed or released is in the keysym structure.

    Note: Repeating SDL_KEYDOWN events will occur if key repeat is enabled (see SDL_EnableKeyRepeat).


    PrevHomeNext
    SDL_ActiveEventUpSDL_MouseMotionEvent
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlkeysym.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlkeysym.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,347 @@ +SDL_keysym
    SDL Library Documentation
    PrevNext

    SDL_keysym

    Name

    SDL_keysym -- Keysym structure

    Structure Definition

    typedef struct{
    +  Uint8 scancode;
    +  SDLKey sym;
    +  SDLMod mod;
    +  Uint16 unicode;
    +} SDL_keysym;

    Structure Data

    scancodeHardware specific scancode
    symSDL virtual keysym
    modCurrent key modifiers
    unicodeTranslated character

    Description

    The SDL_keysym structure is used by reporting key presses and releases since it is a part of the SDL_KeyboardEvent.

    The scancode field should generally be left alone, it is the hardware dependent scancode returned by the keyboard. The sym field is extremely useful. It is the SDL-defined value of the key (see SDL Key Syms. This field is very useful when you are checking for certain key presses, like so: +

    .
    +.
    +while(SDL_PollEvent(&event)){
    +  switch(event.type){
    +    case SDL_KEYDOWN:
    +      if(event.key.keysym.sym==SDLK_LEFT)
    +        move_left();
    +      break;
    +    .
    +    .
    +    .
    +  }
    +}
    +.
    +.
    +mod stores the current state of the keyboard modifiers as explained in SDL_GetModState. The unicode is only used when UNICODE translation is enabled with SDL_EnableUNICODE. If unicode is non-zero then this a the UNICODE character corresponding to the keypress. If the high 9 bits of the character are 0, then this maps to the equivalent ASCII character: +
    char ch;
    +if ( (keysym.unicode & 0xFF80) == 0 ) {
    +  ch = keysym.unicode & 0x7F;
    +}
    +else {
    +  printf("An International Character.\n");
    +}
    +UNICODE translation does have a slight overhead so don't enable it unless its needed.

    See Also

    SDLKey


    PrevHomeNext
    SDL_QuitEventUpSDLKey
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlkillthread.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlkillthread.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,215 @@ +SDL_KillThread
    SDL Library Documentation
    PrevNext

    SDL_KillThread

    Name

    SDL_KillThread -- Gracelessly terminates the thread.

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    void SDL_KillThread(SDL_Thread *thread);

    Description

    SDL_KillThread gracelessly terminates the thread +associated with thread. If possible, you should +use some other form of IPC to signal the thread to quit.


    PrevHomeNext
    SDL_WaitThreadUpSDL_CreateMutex
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdllistmodes.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdllistmodes.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,302 @@ +SDL_ListModes
    SDL Library Documentation
    PrevNext

    SDL_ListModes

    Name

    SDL_ListModes -- Returns a pointer to an array of available screen dimensions for +the given format and video flags

    Synopsis

    #include "SDL.h"

    SDL_Rect **SDL_ListModes(SDL_PixelFormat *format, Uint32 flags);

    Description

    Return a pointer to an array of available screen dimensions for the given +format and video flags, sorted largest to smallest. Returns +NULL if there are no dimensions available for a particular +format, or -1 if any dimension is okay for +the given format.

    If format is NULL, the mode list +will be for the format returned by SDL_GetVideoInfo()->vfmt. The flag parameter is an OR'd combination of surface flags. The flags are the same as those used SDL_SetVideoMode and they play a strong role in deciding what modes are valid. For instance, if you pass SDL_HWSURFACE as a flag only modes that support hardware video surfaces will be returned.

    Example

    SDL_Rect **modes;
    +int i;
    +.
    +.
    +.
    +
    +/* Get available fullscreen/hardware modes */
    +modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE);
    +
    +/* Check is there are any modes available */
    +if(modes == (SDL_Rect **)0){
    +  printf("No modes available!\n");
    +  exit(-1);
    +}
    +
    +/* Check if or resolution is restricted */
    +if(modes == (SDL_Rect **)-1){
    +  printf("All resolutions available.\n");
    +}
    +else{
    +  /* Print valid modes */
    +  printf("Available Modes\n");
    +  for(i=0;modes[i];++i)
    +    printf("  %d x %d\n", modes[i]->w, modes[i]->h);
    +}
    +.
    +.

    PrevHomeNext
    SDL_VideoDriverNameUpSDL_VideoModeOK
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlloadbmp.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlloadbmp.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,211 @@ +SDL_LoadBMP
    SDL Library Documentation
    PrevNext

    SDL_LoadBMP

    Name

    SDL_LoadBMP -- Load a Windows BMP file into an SDL_Surface.

    Synopsis

    #include "SDL.h"

    SDL_Surface *SDL_LoadBMP(const char *file);

    Description

    Loads a surface from a named Windows BMP file.

    Return Value

    Returns the new surface, or NULL +if there was an error.

    See Also

    SDL_SaveBMP


    PrevHomeNext
    SDL_UnlockSurfaceUpSDL_SaveBMP
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlloadwav.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlloadwav.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,288 @@ +SDL_LoadWAV
    SDL Library Documentation
    PrevNext

    SDL_LoadWAV

    Name

    SDL_LoadWAV -- Load a WAVE file

    Synopsis

    #include "SDL.h"

    SDL_AudioSpec *SDL_LoadWAV(const char *file, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len);

    Description

    SDL_LoadWAV +This function loads a WAVE file into memory.

    If this function succeeds, it returns the given +SDL_AudioSpec, +filled with the audio data format of the wave data, and sets +audio_buf to a malloc'd +buffer containing the audio data, and sets audio_len +to the length of that audio buffer, in bytes. You need to free the audio +buffer with SDL_FreeWAV when you are +done with it.

    This function returns NULL and sets the SDL +error message if the wave file cannot be opened, uses an unknown data format, +or is corrupt. Currently raw, MS-ADPCM and IMA-ADPCM WAVE files are supported.

    Example

    SDL_AudioSpec wav_spec;
    +Uint32 wav_length;
    +Uint8 *wav_buffer;
    +
    +/* Load the WAV */
    +if( SDL_LoadWAV("test.wav", &wav_spec, &wav_buffer, &wav_length) == NULL ){
    +  fprintf(stderr, "Could not open test.wav: %s\n", SDL_GetError());
    +  exit(-1);
    +}
    +.
    +.
    +.
    +/* Do stuff with the WAV */
    +.
    +.
    +/* Free It */
    +SDL_FreeWAV(wav_buffer);

    PrevHomeNext
    SDL_GetAudioStatusUpSDL_FreeWAV
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdllockaudio.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdllockaudio.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,200 @@ +SDL_LockAudio
    SDL Library Documentation
    PrevNext

    SDL_LockAudio

    Name

    SDL_LockAudio -- Lock out the callback function

    Synopsis

    #include "SDL.h"

    void SDL_LockAudio(void);

    Description

    The lock manipulated by these functions protects the callback function. +During a LockAudio period, you can be guaranteed that the +callback function is not running. Do not call these from the callback +function or you will cause deadlock.


    PrevHomeNext
    SDL_MixAudioUpSDL_UnlockAudio
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdllocksurface.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdllocksurface.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,299 @@ +SDL_LockSurface
    SDL Library Documentation
    PrevNext

    SDL_LockSurface

    Name

    SDL_LockSurface -- Lock a surface for directly access.

    Synopsis

    #include "SDL.h"

    int SDL_LockSurface(SDL_Surface *surface);

    Description

    SDL_LockSurface sets up a surface for directly +accessing the pixels. Between calls to SDL_LockSurface +and SDL_UnlockSurface, you can write to and read from +surface->pixels, using the pixel format stored in +surface->format. Once you are done accessing the +surface, you should use SDL_UnlockSurface to release it.

    Not all surfaces require locking. +If SDL_MUSTLOCK(surface) +evaluates to 0, then you can read and write to the +surface at any time, and the pixel format of the surface will not change.

    No operating system or library calls should be made between lock/unlock +pairs, as critical system locks may be held during this time.

    It should be noted, that since SDL 1.1.8 surface locks are recursive. This means that you can lock a surface multiple times, but each lock must have a match unlock. +

        .
    +    .
    +    SDL_LockSurface( surface );
    +    .
    +    /* Surface is locked */
    +    /* Direct pixel access on surface here */
    +    .
    +    SDL_LockSurface( surface );
    +    .
    +    /* More direct pixel access on surface */
    +    .
    +    SDL_UnlockSurface( surface );
    +    /* Surface is still locked */
    +    /* Note: Is versions < 1.1.8, the surface would have been */
    +    /* no longer locked at this stage                         */
    +    .
    +    SDL_UnlockSurface( surface );
    +    /* Surface is now unlocked */
    +    .
    +    .
    +

    Return Value

    SDL_LockSurface returns 0, +or -1 if the surface couldn't be locked.


    PrevHomeNext
    SDL_FreeSurfaceUpSDL_UnlockSurface
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdllockyuvoverlay.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdllockyuvoverlay.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,244 @@ +SDL_LockYUVOverlay
    SDL Library Documentation
    PrevNext

    SDL_LockYUVOverlay

    Name

    SDL_LockYUVOverlay -- Lock an overlay

    Synopsis

    #include "SDL.h"

    int SDL_LockYUVOverlay(SDL_Overlay *overlay);

    Description

    Much the same as SDL_LockSurface, SDL_LockYUVOverlay locks the overlay for direct access to pixel data.

    Return Value

    Returns 0 on success, or -1 on an error.


    PrevHomeNext
    SDL_CreateYUVOverlayUpSDL_UnlockYUVOverlay
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlmaprgb.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlmaprgb.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,246 @@ +SDL_MapRGB
    SDL Library Documentation
    PrevNext

    SDL_MapRGB

    Name

    SDL_MapRGB -- Map a RGB color value to a pixel format.

    Synopsis

    #include "SDL.h"

    Uint32 SDL_MapRGB(SDL_PixelFormat *fmt, Uint8 r, Uint8 g, Uint8 b);

    Description

    Maps the RGB color value to the specified pixel format and returns the +pixel value as a 32-bit int.

    If the format has a palette (8-bit) the index of the closest matching +color in the palette will be returned.

    If the specified pixel format has an alpha component it will be returned +as all 1 bits (fully opaque).

    Return Value

    A pixel value best approximating the given RGB color value for a given +pixel format. If the pixel format bpp (color depth) is less than 32-bpp +then the unused upper bits of the return value can safely be ignored +(e.g., with a 16-bpp format the return value can be assigned to a +Uint16, and similarly a Uint8 for an 8-bpp +format).


    PrevHomeNext
    SDL_SetGammaRampUpSDL_MapRGBA
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlmaprgba.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlmaprgba.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,234 @@ +SDL_MapRGBA
    SDL Library Documentation
    PrevNext

    SDL_MapRGBA

    Name

    SDL_MapRGBA -- Map a RGBA color value to a pixel format.

    Synopsis

    #include "SDL.h"

    Uint32 SDL_MapRGBA(SDL_PixelFormat *fmt, Uint8 r, Uint8 g, Uint8 b, Uint8 a);

    Description

    Maps the RGBA color value to the specified pixel format and returns the +pixel value as a 32-bit int.

    If the format has a palette (8-bit) the index of the closest matching +color in the palette will be returned.

    If the specified pixel format has no alpha component the alpha value +will be ignored (as it will be in formats with a palette).

    Return Value

    A pixel value best approximating the given RGBA color value for a given +pixel format. If the pixel format bpp (color depth) is less than 32-bpp +then the unused upper bits of the return value can safely be ignored +(e.g., with a 16-bpp format the return value can be assigned to a +Uint16, and similarly a Uint8 for an 8-bpp +format).


    PrevHomeNext
    SDL_MapRGBUpSDL_GetRGB
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlmixaudio.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlmixaudio.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,210 @@ +SDL_MixAudio
    SDL Library Documentation
    PrevNext

    SDL_MixAudio

    Name

    SDL_MixAudio -- Mix audio data

    Synopsis

    #include "SDL.h"

    void SDL_MixAudio(Uint8 *dst, Uint8 *src, Uint32 len, int volume);

    Description

    This takes two audio buffers of the playing audio format and mixes +them, performing addition, volume adjustment, and overflow clipping. +The volume ranges from 0 - 128, +and should be set to SDL_MIX_MAXVOLUME +for full audio volume. Note this does not change hardware volume. +This is provided for convenience -- you can mix your own audio data.


    PrevHomeNext
    SDL_ConvertAudioUpSDL_LockAudio
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlmousebuttonevent.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlmousebuttonevent.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,338 @@ +SDL_MouseButtonEvent
    SDL Library Documentation
    PrevNext

    SDL_MouseButtonEvent

    Name

    SDL_MouseButtonEvent -- Mouse button event structure

    Structure Definition

    typedef struct{
    +  Uint8 type;
    +  Uint8 button;
    +  Uint8 state;
    +  Uint16 x, y;
    +} SDL_MouseButtonEvent;

    Structure Data

    typeSDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP
    buttonThe mouse button index (SDL_BUTTON_LEFT, SDL_BUTTON_MIDDLE, SDL_BUTTON_RIGHT)
    stateSDL_PRESSED or SDL_RELEASED
    x, yThe X/Y coordinates of the mouse at press/release time

    Description

    SDL_MouseButtonEvent is a member of the SDL_Event union and is used when an event of type SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP is reported.

    When a mouse button press or release is detected then number of the button pressed (from 1 to 255, with 1 usually being the left button and 2 the right) is placed into button, the position of the mouse when this event occured is stored in the x and the y fields. Like SDL_KeyboardEvent, information on whether the event was a press or a release event is stored in both the type and state fields, but this should be obvious.


    PrevHomeNext
    SDL_MouseMotionEventUpSDL_JoyAxisEvent
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlmousemotionevent.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlmousemotionevent.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,357 @@ +SDL_MouseMotionEvent
    SDL Library Documentation
    PrevNext

    SDL_MouseMotionEvent

    Name

    SDL_MouseMotionEvent -- Mouse motion event structure

    Structure Definition

    typedef struct{
    +  Uint8 type;
    +  Uint8 state;
    +  Uint16 x, y;
    +  Sint16 xrel, yrel;
    +} SDL_MouseMotionEvent;

    Structure Data

    typeSDL_MOUSEMOTION
    stateThe current button state
    x, yThe X/Y coordinates of the mouse
    xrel, yrelRelative motion in the X/Y direction

    Description

    SDL_MouseMotionEvent is a member of the SDL_Event union and is used when an event of type SDL_MOUSEMOTION is reported.

    Simply put, a SDL_MOUSEMOTION type event occurs when a user moves the mouse within the application window or when SDL_WarpMouse is called. Both the absolute (x and y) and relative (xrel and yrel) coordinates are reported along with the current button states (state). The button state can be interpreted using the SDL_BUTTON macro (see SDL_GetMouseState).

    If the cursor is hidden (SDL_ShowCursor(0)) and the input is grabbed (SDL_WM_GrabInput(SDL_GRAB_ON)), then the mouse will give relative motion events even when the cursor reaches the edge fo the screen. This is currently only implemented on Windows and Linux/Unix-a-likes.


    PrevHomeNext
    SDL_KeyboardEventUpSDL_MouseButtonEvent
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlmutexp.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlmutexp.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,233 @@ +SDL_mutexP
    SDL Library Documentation
    PrevNext

    SDL_mutexP

    Name

    SDL_mutexP -- Lock a mutex

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    int SDL_mutexP(SDL_mutex *mutex);

    Description

    Locks the mutex, which was previously created with SDL_CreateMutex. If the mutex is already locked then SDL_mutexP will not return until it is unlocked. Returns 0 on success, or -1 on an error.

    SDL also defines a macro #define SDL_LockMutex(m) SDL_mutexP(m).


    PrevHomeNext
    SDL_DestroyMutexUpSDL_mutexV
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlmutexv.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlmutexv.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,227 @@ +SDL_mutexV
    SDL Library Documentation
    PrevNext

    SDL_mutexV

    Name

    SDL_mutexV -- Unlock a mutex

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    int SDL_mutexV(SDL_mutex *mutex);

    Description

    Unlocks the mutex, which was previously created with SDL_CreateMutex. Returns 0 on success, or -1 on an error.

    SDL also defines a macro #define SDL_UnlockMutex(m) SDL_mutexV(m).


    PrevHomeNext
    SDL_mutexPUpSDL_CreateSemaphore
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlnumjoysticks.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlnumjoysticks.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,214 @@ +SDL_NumJoysticks
    SDL Library Documentation
    PrevNext

    SDL_NumJoysticks

    Name

    SDL_NumJoysticks -- Count available joysticks.

    Synopsis

    #include "SDL.h"

    int SDL_NumJoysticks(void);

    Description

    Counts the number of joysticks attached to the system.

    Return Value

    Returns the number of attached joysticks


    PrevHomeNext
    JoystickUpSDL_JoystickName
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlopenaudio.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlopenaudio.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,567 @@ +SDL_OpenAudio
    SDL Library Documentation
    PrevNext

    SDL_OpenAudio

    Name

    SDL_OpenAudio -- Opens the audio device with the desired parameters.

    Synopsis

    #include "SDL.h"

    int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained);

    Description

    This function opens the audio device with the desired parameters, and +returns 0 if successful, placing the actual hardware parameters in the +structure pointed to by obtained. If obtained is NULL, the audio +data passed to the callback function will be guaranteed to be in the +requested format, and will be automatically converted to the hardware +audio format if necessary. This function returns -1 if it failed +to open the audio device, or couldn't set up the audio thread.

    To open the audio device a desired SDL_AudioSpec must be created. +

    SDL_AudioSpec *desired;
    +.
    +.
    +desired=(SDL_AudioSpec *)malloc(sizeof(SDL_AudioSpec));
    +You must then fill this structure with your desired audio specifications.

    desired->freq

    The desired audio frequency in samples-per-second.

    desired->format

    The desired audio format (see SDL_AudioSpec)

    desired->samples

    The desired size of the audio buffer in samples. This number should be a power of two, and may be adjusted by the audio driver to a value more suitable for the hardware. Good values seem to range between 512 and 8192 inclusive, depending on the application and CPU speed. Smaller values yield faster response time, but can lead to underflow if the application is doing heavy processing and cannot fill the audio buffer in time. A stereo sample consists of both right and left channels in LR ordering. Note that the number of samples is directly related to time by the following formula: ms = (samples*1000)/freq

    desired->callback

    This should be set to a function that will be called when the audio device is ready for more data. It is passed a pointer to the audio buffer, and the length in bytes of the audio buffer. This function usually runs in a separate thread, and so you should protect data structures that it accesses by calling SDL_LockAudio and SDL_UnlockAudio in your code. The callback prototype is: +

    void callback(void *userdata, Uint8 *stream, int len);
    +userdata is the pointer stored in userdata field of the SDL_AudioSpec. stream is a pointer to the audio buffer you want to fill with information and len is the length of the audio buffer in bytes.

    desired->userdata

    This pointer is passed as the first parameter to the callback function.

    SDL_OpenAudio reads these fields from the desired SDL_AudioSpec structure pass to the function and attempts to find an audio configuration matching your desired. As mentioned above, if the obtained parameter is NULL then SDL with convert from your desired audio settings to the hardware settings as it plays.

    If obtained is NULL then the desired SDL_AudioSpec is your working specification, otherwise the obtained SDL_AudioSpec becomes the working specification and the desirec specification can be deleted. The data in the working specification is used when building SDL_AudioCVT's for converting loaded data to the hardware format.

    SDL_OpenAudio calculates the size and silence fields for both the desired and obtained specifications. The size field stores the total size of the audio buffer in bytes, while the silence stores the value used to represent silence in the audio buffer

    The audio device starts out playing silence when it's opened, and should be enabled for playing by calling SDL_PauseAudio(0) when you are ready for your audio callback function to be called. Since the audio driver may modify the requested size of the audio buffer, you should allocate any local mixing buffers after you open the audio device.

    Examples

    /* Prototype of our callback function */
    +void my_audio_callback(void *userdata, Uint8 *stream, int len);
    +
    +/* Open the audio device */
    +SDL_AudioSpec *desired, *obtained;
    +SDL_AudioSpec *hardware_spec;
    +
    +/* Allocate a desired SDL_AudioSpec */
    +desired=(SDL_AudioSpec *)malloc(sizeof(SDL_AudioSpec));
    +
    +/* Allocate space for the obtained SDL_AudioSpec */
    +obtained=(SDL_AudioSpec *)malloc(sizeof(SDL_AudioSpec));
    +
    +/* 22050Hz - FM Radio quality */
    +desired->freq=22050;
    +
    +/* 16-bit signed audio */
    +desired->format=AUDIO_S16LSB;
    +
    +/* Large audio buffer reduces risk of dropouts but increases response time */
    +desired->samples=8192;
    +
    +/* Our callback function */
    +desired->callback=my_audio_callback;
    +
    +desired->userdata=NULL;
    +
    +/* Open the audio device */
    +if ( SDL_OpenAudio(desired, obtained) < 0 ){
    +  fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError());
    +  exit(-1);
    +}
    +/* desired spec is no longer needed */
    +free(desired);
    +hardware_spec=obtained;
    +.
    +.
    +/* Prepare callback for playing */
    +.
    +.
    +.
    +/* Start playing */
    +SDL_PauseAudio(0);

    PrevHomeNext
    SDL_AudioSpecUpSDL_PauseAudio
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdloverlay.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdloverlay.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,354 @@ +SDL_Overlay
    SDL Library Documentation
    PrevNext

    SDL_Overlay

    Name

    SDL_Overlay -- YUV video overlay

    Structure Definition

    typedef struct{
    +  Uint32 format;
    +  int w, h;
    +  int planes;
    +  Uint16 *pitches;
    +  Uint8 **pixels;
    +  Uint32 hw_overlay:1;
    +} SDL_Overlay;

    Structure Data

    formatOverlay format (see below)
    w, hWidth and height of overlay
    planesNumber of planes in the overlay. Usually either 1 or 3
    pitchesAn array of pitches, one for each plane. Pitch is the length of a row in bytes.
    pixelsAn array of pointers to teh data of each plane. The overlay should be locked before these pointers are used.
    hw_overlayThis will be set to 1 if the overlay is hardware accelerated.

    Description

    A SDL_Overlay is similar to a SDL_Surface except it stores a YUV overlay. All the fields are read only, except for pixels which should be locked before use. The format field stores the format of the overlay which is one of the following: +

    #define SDL_YV12_OVERLAY  0x32315659  /* Planar mode: Y + V + U */
    +#define SDL_IYUV_OVERLAY  0x56555949  /* Planar mode: Y + U + V */
    +#define SDL_YUY2_OVERLAY  0x32595559  /* Packed mode: Y0+U0+Y1+V0 */
    +#define SDL_UYVY_OVERLAY  0x59565955  /* Packed mode: U0+Y0+V0+Y1 */
    +#define SDL_YVYU_OVERLAY  0x55595659  /* Packed mode: Y0+V0+Y1+U0 */
    +More information on YUV formats can be found at http://www.webartz.com/fourcc/indexyuv.htm.


    PrevHomeNext
    SDL_VideoInfoUpWindow Management
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlpalette.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlpalette.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,293 @@ +SDL_Palette
    SDL Library Documentation
    PrevNext

    SDL_Palette

    Name

    SDL_Palette -- Color palette for 8-bit pixel formats

    Structure Definition

    typedef struct{
    +  int ncolors;
    +  SDL_Color *colors;
    +} SDL_Palette;

    Structure Data

    ncolorsNumber of colors used in this palette
    colorsPointer to SDL_Color structures that make up the palette.

    Description

    Each pixel in an 8-bit surface is an index into the colors field of the SDL_Palette structure store in SDL_PixelFormat. A SDL_Palette should never need to be created manually. It is automatically created when SDL allocates a SDL_PixelFormat for a surface. The colors values of a SDL_Surfaces palette can be set with the SDL_SetColors.


    PrevHomeNext
    SDL_ColorUpSDL_PixelFormat
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlpauseaudio.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlpauseaudio.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,213 @@ +SDL_PauseAudio
    SDL Library Documentation
    PrevNext

    SDL_PauseAudio

    Name

    SDL_PauseAudio -- Pauses and unpauses the audio callback processing

    Synopsis

    #include "SDL.h"

    void SDL_PauseAudio(int pause_on);

    Description

    This function pauses and unpauses the audio callback processing. +It should be called with pause_on=0 after opening the audio +device to start playing sound. This is so you can safely initialize +data for your callback function after opening the audio device. +Silence will be written to the audio device during the pause.


    PrevHomeNext
    SDL_OpenAudioUpSDL_GetAudioStatus
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlpeepevents.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlpeepevents.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,296 @@ +SDL_PeepEvents
    SDL Library Documentation
    PrevNext

    SDL_PeepEvents

    Name

    SDL_PeepEvents -- Checks the event queue for messages and optionally returns them.

    Synopsis

    #include "SDL.h"

    int SDL_PeepEvents(SDL_Event *events, int numevents, SDL_eventaction action, Uint32 mask);

    Description

    Checks the event queue for messages and optionally returns them.

    If action is SDL_ADDEVENT, up to +numevents events will be added to the back of the event + queue.

    If action is SDL_PEEKEVENT, up to +numevents events at the front of the event queue, +matching mask, +will be returned and will not be removed from the queue.

    If action is SDL_GETEVENT, up to +numevents events at the front of the event queue, +matching mask, +will be returned and will be removed from the queue.

    This function is thread-safe.

    Return Value

    This function returns the number of events actually stored, or +-1 if there was an error.


    PrevHomeNext
    SDL_PumpEventsUpSDL_PollEvent
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlpixelformat.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlpixelformat.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,514 @@ +SDL_PixelFormat
    SDL Library Documentation
    PrevNext

    SDL_PixelFormat

    Name

    SDL_PixelFormat -- Stores surface format information

    Structure Definition

    typedef struct{
    +  SDL_Palette *palette;
    +  Uint8  BitsPerPixel;
    +  Uint8  BytesPerPixel;
    +  Uint32 Rmask, Gmask, Bmask, Amask;
    +  Uint8  Rshift, Gshift, Bshift, Ashift;
    +  Uint8  Rloss, Gloss, Bloss, Aloss;
    +  Uint32 colorkey;
    +  Uint8  alpha;
    +} SDL_PixelFormat;

    Structure Data

    palettePointer to the palette, or NULL if the BitsPerPixel>8
    BitsPerPixelThe number of bits used to represent each pixel in a surface. Usually 8, 16, 24 or 32.
    BytesPerPixelThe number of bytes used to represent each pixel in a surface. Usually one to four.
    [RGBA]maskBinary mask used to retrieve individual color values
    [RGBA]lossPrecision loss of each color component (2[RGBA]loss)
    [RGBA]shiftBinary left shift of each color component in the pixel value
    colorkeyPixel value of transparent pixels
    alphaOverall surface alpha value

    Description

    A SDL_PixelFormat describes the format of the pixel data stored at the pixels field of a SDL_Surface. Every surface stores a SDL_PixelFormat in the format field.

    If you wish to do pixel level modifications on a surface, then understanding how SDL stores its color information is essential.

    8-bit pixel formats are the easiest to understand. Since its an 8-bit format, we have 8 BitsPerPixel and 1 BytesPerPixel. Since BytesPerPixel is 1, all pixels are represented by a Uint8 which contains an index into palette->colors. So, to determine the color of a pixel in a 8-bit surface: we read the color index from surface->pixels and we use that index to read the SDL_Color structure from surface->format->palette->colors. Like so: +

    SDL_Surface *surface;
    +SDL_PixelFormat *fmt;
    +SDL_Color *color;
    +Uint8 index;
    +
    +.
    +.
    +
    +/* Create surface */
    +.
    +.
    +fmt=surface->format;
    +
    +/* Check the bitdepth of the surface */
    +if(fmt->BitsPerPixel!=8){
    +  fprintf(stderr, "Not an 8-bit surface.\n");
    +  return(-1);
    +}
    +
    +/* Lock the surface */
    +SDL_LockSurface(surface);
    +
    +/* Get the topleft pixel */
    +index=*(Uint8 *)surface->pixels;
    +color=fmt->palette->colors[index];
    +
    +/* Unlock the surface */
    +SDL_UnlockSurface(surface);
    +printf("Pixel Color-> Red: %d, Green: %d, Blue: %d. Index: %d\n",
    +          color->r, color->g, color->b, index);
    +.
    +.

    Pixel formats above 8-bit are an entirely different experience. They are considered to be "TrueColor" formats and the color information is stored in the pixels themselves, not in a palette (packed-pixel). The mask, shift and loss fields tell us how the color information is encoded. The mask fields allow us to isolate each color component, the shift fields tell us how far left we have to shift the masked value and the loss fields tell us for far right we have to shift the final value to convert it to a full 8-bit color component. +

    /* Extracting color components from a 32-bit color value */
    +SDL_PixelFormat *fmt;
    +SDL_Surface *surface;
    +Uint32 temp, pixel;
    +Uint8 red, green, blue, alpha;
    +.
    +.
    +.
    +fmt=surface->format;
    +SDL_LockSurface(surface);
    +pixel=(Uint32*)surface->pixels;
    +SDL_UnlockSurface(surface);
    +
    +/* Get Red component */
    +temp=pixel&fmt->Rmask; /* Isolate red component */
    +temp=temp>>fmt->Rshift;/* Shift it down to 8-bit */
    +temp=temp<<fmt->Rloss; /* Expand to a full 8-bit number */
    +red=(Uint8)temp;
    +
    +/* Get Green component */
    +temp=pixel&fmt->Gmask; /* Isolate green component */
    +temp=temp>>fmt->Gshift;/* Shift it down to 8-bit */
    +temp=temp<<fmt->Gloss; /* Expand to a full 8-bit number */
    +green=(Uint8)temp;
    +
    +/* Get Blue component */
    +temp=pixel&fmt->Bmask; /* Isolate blue component */
    +temp=temp>>fmt->Bshift;/* Shift it down to 8-bit */
    +temp=temp<<fmt->Bloss; /* Expand to a full 8-bit number */
    +blue=(Uint8)temp;
    +
    +/* Get Alpha component */
    +temp=pixel&fmt->Amask; /* Isolate alpha component */
    +temp=temp>>fmt->Ashift;/* Shift it down to 8-bit */
    +temp=temp<<fmt->Aloss; /* Expand to a full 8-bit number */
    +alpha=(Uint8)temp;
    +
    +printf("Pixel Color -> R: %d,  G: %d,  B: %d,  A: %d\n", red, green, blue, alpha);
    +.
    +.
    +.


    PrevHomeNext
    SDL_PaletteUpSDL_Surface
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlpollevent.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlpollevent.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,261 @@ +SDL_PollEvent
    SDL Library Documentation
    PrevNext

    SDL_PollEvent

    Name

    SDL_PollEvent -- Polls for currently pending events.

    Synopsis

    #include "SDL.h"

    int SDL_PollEvent(SDL_Event *event);

    Description

    Polls for currently pending events, and returns 1 +if there are any pending events, or 0 if there +are none available.

    If event is not NULL, the next +event is removed from the queue and stored in that area.

    Examples

    SDL_Event event; /* Event structure */
    +
    +.
    +.
    +.
    +/* Check for events */
    +while(SDL_PollEvent(&event)){  /* Loop until there are no events left on the queue */
    +  switch(event.type){  /* Process the appropiate event type */
    +    case SDL_KEYDOWN:  /* Handle a KEYDOWN event */         
    +      printf("Oh! Key press\n");
    +      break;
    +    case SDL_MOUSEMOTION:
    +      .
    +      .
    +      .
    +    default: /* Report an unhandled event */
    +      printf("I don't know what this event is!\n");
    +  }
    +}


    PrevHomeNext
    SDL_PeepEventsUpSDL_WaitEvent
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlpumpevents.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlpumpevents.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,236 @@ +SDL_PumpEvents
    SDL Library Documentation
    PrevNext

    SDL_PumpEvents

    Name

    SDL_PumpEvents -- Pumps the event loop, gathering events from the input devices.

    Synopsis

    #include "SDL.h"

    void SDL_PumpEvents(void);

    Description

    Pumps the event loop, gathering events from the input devices.

    SDL_PumpEvents gathers all the pending input information from devices and places it on the event queue. Without calls to SDL_PumpEvents no events would ever be placed on the queue. Often calls the need for SDL_PumpEvents is hidden from the user since SDL_PollEvent and SDL_WaitEvent implicitly call SDL_PumpEvents. However, if you are not polling or waiting for events (e.g. your filtering them), then you must call SDL_PumpEvents to force an event queue update.

    Note: You can only call this function in the thread that set the video mode.


    PrevHomeNext
    Event Functions.UpSDL_PeepEvents
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlpushevent.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlpushevent.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,258 @@ +SDL_PushEvent
    SDL Library Documentation
    PrevNext

    SDL_PushEvent

    Name

    SDL_PushEvent -- Pushes an event onto the event queue

    Synopsis

    #include "SDL.h"

    int SDL_PushEvent(SDL_Event *event);

    Description

    The event queue can actually be used as a two way communication channel. Not only can events be read from the queue, but the user can also push their own events onto it. event is a pointer to the event structure you wish to push onto the queue.

    Note: Pushing device input events onto the queue doesn't modify the state of the device within SDL.

    Return Value

    Returns 0 on success or -1 if the event couldn't be pushed.

    Examples

    See SDL_Event.


    PrevHomeNext
    SDL_WaitEventUpSDL_SetEventFilter
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlquit.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlquit.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,236 @@ +SDL_Quit
    SDL Library Documentation
    PrevNext

    SDL_Quit

    Name

    SDL_Quit -- Shut down SDL

    Synopsis

    #include "SDL.h"

    void SDL_Quit(void);

    Description

    SDL_Quit shuts down all SDL subsystems and frees the resources allocated to them. This should always be called before you exit. For the sake of simplicity you can set SDL_Quit as your atexit call, like: +

    SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO);
    +atexit(SDL_Quit);
    +.
    +.

    Note: While using atexit maybe be fine for small programs, more advanced users should shut down SDL in their own cleanup code. Plus, using atexit in a library is a sure way to crash dynamically loaded code


    PrevHomeNext
    SDL_QuitSubSystemUpSDL_WasInit
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlquitevent.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlquitevent.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,255 @@ +SDL_QuitEvent
    SDL Library Documentation
    PrevNext

    SDL_QuitEvent

    Name

    SDL_QuitEvent -- Quit requested event

    Structure Definition

    typedef struct{
    +  Uint8 type
    +} SDL_QuitEvent;

    Structure Data

    typeSDL_QUIT

    Description

    SDL_QuitEvent is a member of the SDL_Event union and is used whan an event of type SDL_QUIT is reported.

    As can be seen, the SDL_QuitEvent structure serves no useful purpose. The event itself, on the other hand, is very important. If you filter out or ignore a quit event then it is impossible for the user to close the window. On the other hand, if you do accept a quit event then the application window will be closed, and screen updates will still report success event though the application will no longer be visible.

    Note: The macro SDL_QuitRequested will return non-zero if a quit event is pending


    PrevHomeNext
    SDL_UserEventUpSDL_keysym
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlquitsubsystem.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlquitsubsystem.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,240 @@ +SDL_QuitSubSystem
    SDL Library Documentation
    PrevNext

    SDL_QuitSubSystem

    Name

    SDL_QuitSubSystem -- Shut down a subsystem

    Synopsis

    #include "SDL.h"

    void SDL_QuitSubSystem(Uint32 flags);

    Description

    SDL_QuitSubSystem allows you to shut down a subsystem that has been previously initialized by SDL_Init or SDL_InitSubSystem. The flags tells SDL_QuitSubSystem which subsystems to shut down, it uses the same values that are passed to SDL_Init.


    PrevHomeNext
    SDL_InitSubSystemUpSDL_Quit
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlrect.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlrect.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,250 @@ +SDL_Rect
    SDL Library Documentation
    PrevNext

    SDL_Rect

    Name

    SDL_Rect -- Defines a rectangular area

    Structure Definition

    typedef struct{
    +  Sint16 x, y;
    +  Uint16 w, h;
    +} SDL_Rect;

    Structure Data

    x, yPosition of the upper-left corner of the rectangle
    w, hThe width and height of the rectangle

    Description

    A SDL_Rect defines a rectangular area of pixels. It is used by SDL_BlitSurface to define blitting regions and by several other video functions.


    PrevHomeNext
    SDL_GLattrUpSDL_Color
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlremovetimer.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlremovetimer.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,228 @@ +SDL_RemoveTimer
    SDL Library Documentation
    PrevNext

    SDL_RemoveTimer

    Name

    SDL_RemoveTimer -- Remove a timer which was added with +SDL_AddTimer.

    Synopsis

    #include "SDL.h"

    SDL_bool SDL_RemoveTimer(SDL_TimerID id);

    Description

    Removes a timer callback previously added with +SDL_AddTimer.

    Return Value

    Returns a boolean value indicating success.

    Examples

    SDL_RemoveTimer(my_timer_id);

    See Also

    SDL_AddTimer


    PrevHomeNext
    SDL_AddTimerUpSDL_SetTimer
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlresizeevent.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlresizeevent.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,299 @@ +SDL_ResizeEvent
    SDL Library Documentation
    PrevNext

    SDL_ResizeEvent

    Name

    SDL_ResizeEvent -- Window resize event structure

    Structure Definition

    typedef struct{
    +  Uint8 type;
    +  int w, h;
    +} SDL_ResizeEvent;

    Structure Data

    typeSDL_VIDEORESIZE
    w, hNew width and height of the window

    Description

    SDL_ResizeEvent is a member of the SDL_Event union and is used when an event of type SDL_VIDEORESIZE is reported.

    When SDL_RESIZABLE is passed as a flag to SDL_SetVideoMode the user is allowed to resize the applications window. When the window is resized an SDL_VIDEORESIZE is report, with the new window width and height values stored in w and h, respectively. When an SDL_VIDEORESIZE is recieved the window should be resized to the new dimensions using SDL_SetVideoMode.


    PrevHomeNext
    SDL_JoyBallEventUpSDL_SysWMEvent
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlsavebmp.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlsavebmp.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,228 @@ +SDL_SaveBMP
    SDL Library Documentation
    PrevNext

    SDL_SaveBMP

    Name

    SDL_SaveBMP -- Save an SDL_Surface as a Windows BMP file.

    Synopsis

    #include "SDL.h"

    int SDL_SaveBMP(SDL_Surface *surface, const char *file);

    Description

    Saves the SDL_Surface surface as a Windows BMP file named file.

    Return Value

    Returns 0 if successful or +-1 +if there was an error.

    See Also

    SDL_LoadBMP


    PrevHomeNext
    SDL_LoadBMPUpSDL_SetColorKey
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlsempost.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlsempost.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,291 @@ +SDL_SemPost
    SDL Library Documentation
    PrevNext

    SDL_SemPost

    Name

    SDL_SemPost -- Unlock a semaphore.

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    int SDL_SemPost(SDL_sem *sem);

    Description

    SDL_SemPost unlocks the semaphore pointed to by +sem and atomically increments the semaphores value. +Threads that were blocking on the semaphore may be scheduled after this call +succeeds.

    SDL_SemPost should be called after a semaphore is locked by a successful call to +SDL_SemWait, +SDL_SemTryWait or +SDL_SemWaitTimeout.

    Return Value

    Returns 0 if successful or +-1 if there was an error (leaving the semaphore unchanged).

    Examples

    SDL_SemPost(my_sem);


    PrevHomeNext
    SDL_SemWaitTimeoutUpSDL_SemValue
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlsemtrywait.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlsemtrywait.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,311 @@ +SDL_SemTryWait
    SDL Library Documentation
    PrevNext

    SDL_SemTryWait

    Name

    SDL_SemTryWait -- Attempt to lock a semaphore but don't suspend the thread.

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    int SDL_SemTryWait(SDL_sem *sem);

    Description

    SDL_SemTryWait is a non-blocking varient of +SDL_SemWait. If the value of the semaphore +pointed to by sem is positive it will atomically +decrement the semaphore value and return 0, otherwise it will return +SDL_MUTEX_TIMEOUT instead of suspending the thread.

    After SDL_SemTryWait is successful, the semaphore +can be released and its count atomically incremented by a successful call to +SDL_SemPost.

    Return Value

    Returns 0 if the semaphore was successfully locked or +either SDL_MUTEX_TIMEOUT or -1 +if the thread would have suspended or there was an error, respectivly.

    If the semaphore was not successfully locked, the semaphore will be unchanged.

    Examples

    res = SDL_SemTryWait(my_sem);
    +
    +if (res == SDL_MUTEX_TIMEOUT) {
    +        return TRY_AGAIN;
    +}
    +if (res == -1) {
    +        return WAIT_ERROR;
    +}
    +
    +...
    +
    +SDL_SemPost(my_sem);


    PrevHomeNext
    SDL_SemWaitUpSDL_SemWaitTimeout
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlsemvalue.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlsemvalue.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,265 @@ +SDL_SemValue
    SDL Library Documentation
    PrevNext

    SDL_SemValue

    Name

    SDL_SemValue -- Return the current value of a semaphore.

    Synopsis

    #include "SDL.h"
    +#include "SDL/SDL_thread.h"

    Uint32 SDL_SemValue(SDL_sem *sem);

    Description

    SDL_SemValue() returns the current semaphore value from +the semaphore pointed to by sem.

    Return Value

    Returns current value of the semaphore.

    Examples

      sem_value = SDL_SemValue(my_sem);


    PrevHomeNext
    SDL_SemPostUpSDL_CreateCond
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlsemwait.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlsemwait.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,290 @@ +SDL_SemWait
    SDL Library Documentation
    PrevNext

    SDL_SemWait

    Name

    SDL_SemWait -- Lock a semaphore and suspend the thread if the semaphore value is zero.

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    int SDL_SemWait(SDL_sem *sem);

    Description

    SDL_SemWait() suspends the calling thread until either +the semaphore pointed to by sem has a positive value, +the call is interrupted by a signal or error. If the call is successful it +will atomically decrement the semaphore value.

    After SDL_SemWait() is successful, the semaphore +can be released and its count atomically incremented by a successful call to +SDL_SemPost.

    Return Value

    Returns 0 if successful or +-1 if there was an error (leaving the semaphore unchanged).

    Examples

    if (SDL_SemWait(my_sem) == -1) {
    +        return WAIT_FAILED;
    +}
    +
    +...
    +
    +SDL_SemPost(my_sem);


    PrevHomeNext
    SDL_DestroySemaphoreUpSDL_SemTryWait
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlsemwaittimeout.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlsemwaittimeout.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,314 @@ +SDL_SemWaitTimeout
    SDL Library Documentation
    PrevNext

    SDL_SemWaitTimeout

    Name

    SDL_SemWaitTimeout -- Lock a semaphore, but only wait up to a specified maximum time.

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout);

    Description

    SDL_SemWaitTimeout() is a varient of +SDL_SemWait +with a maximum timeout value. +If the value of the semaphore pointed to by sem is +positive (greater than zero) it will atomically decrement the semaphore value +and return 0, otherwise it will wait up to timeout +milliseconds trying to lock the semaphore. This function is to be avoided if +possible since on some platforms it is implemented by polling the semaphore +every millisecond in a busy loop.

    After SDL_SemWaitTimeout() is successful, the semaphore +can be released and its count atomically incremented by a successful call to +SDL_SemPost.

    Return Value

    Returns 0 if the semaphore was successfully locked or +either SDL_MUTEX_TIMEOUT or -1 +if the timeout period was exceeded or there was an error, respectivly.

    If the semaphore was not successfully locked, the semaphore will be unchanged.

    Examples

    res = SDL_SemWaitTimeout(my_sem, WAIT_TIMEOUT_MILLISEC);
    +
    +if (res == SDL_MUTEX_TIMEOUT) {
    +        return TRY_AGAIN;
    +}
    +if (res == -1) {
    +        return WAIT_ERROR;
    +}
    +
    +...
    +
    +SDL_SemPost(my_sem);


    PrevHomeNext
    SDL_SemTryWaitUpSDL_SemPost
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlsetalpha.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlsetalpha.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,440 @@ +SDL_SetAlpha
    SDL Library Documentation
    PrevNext

    SDL_SetAlpha

    Name

    SDL_SetAlpha -- Adjust the alpha properties of a surface

    Synopsis

    #include "SDL.h"

    int SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha);

    Description

    Note: This function and the semantics of SDL alpha blending have changed since version 1.1.4. Up until version 1.1.5, an alpha value of 0 was considered opaque and a value of 255 was considered transparent. This has now been inverted: 0 (SDL_ALPHA_TRANSPARENT) is now considered transparent and 255 (SDL_ALPHA_OPAQUE) is now considered opaque.

    SDL_SetAlpha is used for setting the per-surface alpha and/or enabling and disabling per-pixel alpha blending.

    The surface parameter specifies which surface whose alpha attributes you wish to adjust. flags is used to specify whether alpha blending should be used (SDL_SRCALPHA) and whether the surface should use RLE acceleration for blitting (SDL_RLEACCEL). flags can be an OR'd combination of these two options, one of these options or 0. If SDL_SRCALPHA is not passed as a flag then all alpha information is ignored when blitting the surface. The alpha parameter is the per-surface alpha value, a surface need not have an alpha channel to use per-surface alpha and blitting can still be accelerated with SDL_RLEACCEL. Setting the per-surface alpha value to 0 disables per-surface alpha blending.

    Note: The per-surface alpha value of 128 is considered a special case and is optimised, so it's much faster than other per-surface values.

    Alpha effects surface blitting in the following ways:

    RGBA->RGB with SDL_SRCALPHA

    The source is alpha-blended with the destination, using the alpha channel. SDL_SRCCOLORKEY and the per-surface alpha are ignored.

    RGBA->RGB without SDL_SRCALPHA

    The RGB data is copied from the source. The source alpha channel and the per-surface alpha value are ignored.

    RGB->RGBA with SDL_SRCALPHA

    The source is alpha-blended with the destination using the per-surface alpha value. If SDL_SRCCOLORKEYliteral> is set, only the pixels not matching the colorkey value are copied.

    RGB->RGBA without SDL_SRCALPHA

    The RGB data is copied from the source and the destination alpha is zero to opaque. If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.

    RGBA->RGBA with SDL_SRCALPHA

    The source is alpha-blended with the destination using the source alpha channel. The alpha channel in the destination surface is left untouched. SDL_SRCCOLORKEY is ignored.

    RGBA->RGBA without SDL_SRCALPHA

    The RGBA data is copied to the destination surface. If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.

    RGB->RGB with SDL_SRCALPHA

    The source is alpha-blended with the destination using the per-surface alpha value. If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.

    RGB->RGB without SDL_SRCALPHA

    The RGB data is copied from the source. If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.


    PrevHomeNext
    SDL_SetColorKeyUpSDL_SetClipRect
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlsetcliprect.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlsetcliprect.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,233 @@ +SDL_SetClipRect
    SDL Library Documentation
    PrevNext

    SDL_SetClipRect

    Name

    SDL_SetClipRect -- Sets the clipping rectangle for a surface.

    Synopsis

    #include "SDL.h"

    void SDL_SetClipRect(SDL_Surface *surface, SDL_Rect *rect);

    Description

    Sets the clipping rectangle for a surface. When this surface is the +destination of a blit, only the area within the clip rectangle will be +drawn into.

    The rectangle pointed to by rect will be +clipped to the edges of the surface so that the clip rectangle for a +surface can never fall outside the edges of the surface.

    If rect is NULL the clipping +rectangle will be set to the full size of the surface.


    PrevHomeNext
    SDL_SetAlphaUpSDL_GetClipRect
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlsetcolorkey.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlsetcolorkey.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,313 @@ +SDL_SetColorKey
    SDL Library Documentation
    PrevNext

    SDL_SetColorKey

    Name

    SDL_SetColorKey -- Sets the color key (transparent pixel) in a blittable surface and +RLE acceleration.

    Synopsis

    #include "SDL.h"

    int SDL_SetColorKey(SDL_Surface *surface, Uint32 flag, Uint32 key);

    Description

    Sets the color key (transparent pixel) in a blittable surface and enables or + disables RLE blit acceleration.

    RLE acceleration can substantially speed up blitting of images with large +horizontal runs of transparent pixels (i.e., pixels that match the +key value). The key must be of the same pixel format as the surface, SDL_MapRGB is often useful for obtaining an acceptable value.

    If flag is SDL_SRCCOLORKEY then +key is the transparent pixel value in the source image of a +blit.

    If flag is OR'd with +SDL_RLEACCEL then the surface will be draw using RLE +acceleration when drawn with +SDL_BlitSurface. The surface will +actually be encoded for RLE acceleration the first time +SDL_BlitSurface or +SDL_DisplayFormat is called on the +surface.

    If flag is 0, this function clears +any current color key.

    Return Value

    This function returns 0, or +-1 if there was an error.


    PrevHomeNext
    SDL_SaveBMPUpSDL_SetAlpha
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlsetcolors.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlsetcolors.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,350 @@ +SDL_SetColors
    SDL Library Documentation
    PrevNext

    SDL_SetColors

    Name

    SDL_SetColors -- Sets a portion of the colormap for the given 8-bit surface.

    Synopsis

    #include "SDL.h"

    int SDL_SetColors(SDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors);

    Description

    Sets a portion of the colormap for the given 8-bit surface.

    When surface is the surface associated with the current +display, the display colormap will be updated with the requested colors. If +SDL_HWPALETTE was set in SDL_SetVideoMode flags, +SDL_SetColors will always return 1, +and the palette is guaranteed to be set the way you desire, even if the window +colormap has to be warped or run under emulation.

    The color components of a +SDL_Color +structure are 8-bits in size, giving you a total of 2563 +=16777216 colors.

    Palettized (8-bit) screen surfaces with the SDL_HWPALETTE +flag have two palettes, a logical palette that is used for mapping blits +to/from the surface and a physical palette (that determines how the +hardware will map the colors to the display). SDL_SetColors +modifies both palettes (if present), and is equivalent to calling +SDL_SetPalette with the +flags set to +(SDL_LOGPAL | SDL_PHYSPAL).

    Return Value

    If surface is not a palettized surface, this function +does nothing, returning 0. If all of the colors were set +as passed to SDL_SetColors, it will return +1. If not all the color entries were set exactly as +given, it will return 0, and you should look at the +surface palette to determine the actual color palette.

    Example

    /* Create a display surface with a grayscale palette */
    +SDL_Surface *screen;
    +SDL_Color colors[256];
    +int i;
    +.
    +.
    +.
    +/* Fill colors with color information */
    +for(i=0;i<256;i++){
    +  colors[i].r=i;
    +  colors[i].g=i;
    +  colors[i].b=i;
    +}
    +
    +/* Create display */
    +screen=SDL_SetVideoMode(640, 480, 8, SDL_HWPALETTE);
    +if(!screen){
    +  printf("Couldn't set video mode: %s\n", SDL_GetError());
    +  exit(-1);
    +}
    +
    +/* Set palette */
    +SDL_SetColors(screen, colors, 0, 256);
    +.
    +.
    +.
    +.

    PrevHomeNext
    SDL_FlipUpSDL_SetPalette
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlsetcursor.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlsetcursor.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,214 @@ +SDL_SetCursor
    SDL Library Documentation
    PrevNext

    SDL_SetCursor

    Name

    SDL_SetCursor -- Set the currently active mouse cursor.

    Synopsis

    #include "SDL.h"

    void *SDL_SetCursor(SDL_Cursor *cursor);

    Description

    Sets the currently active cursor to +the specified one. +If the cursor is currently visible, the change will be immediately +represented on the display.


    PrevHomeNext
    SDL_FreeCursorUpSDL_GetCursor
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlseteventfilter.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlseteventfilter.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,273 @@ +SDL_SetEventFilter
    SDL Library Documentation
    PrevNext

    SDL_SetEventFilter

    Name

    SDL_SetEventFilter -- Sets up a filter to process all events before they are posted +to the event queue.

    Synopsis

    #include "SDL.h"

    void SDL_SetEventFilter(SDL_EventFilter filter);

    Description

    This function sets up a filter to process all events before they are posted +to the event queue. This is a very powerful and flexible feature. The filter +is prototyped as: +

    typedef int (*SDL_EventFilter)(const SDL_Event *event);
    +If the filter returns 1, then the event will be +added to the internal queue. If it returns 0, +then the event will be dropped from the queue. This allows selective +filtering of dynamically.

    There is one caveat when dealing with the SDL_QUITEVENT event type. The +event filter is only called when the window manager desires to close the +application window. If the event filter returns 1, then the window will +be closed, otherwise the window will remain open if possible. +If the quit event is generated by an interrupt signal, it will bypass the +internal queue and be delivered to the application at the next event poll.

    Note: Events pushed onto the queue with SDL_PushEvent or SDL_PeepEvents do not get passed through the event filter.

    Note: Be Careful! The event filter function may run in a different thread so be careful what you do within it.


    PrevHomeNext
    SDL_PushEventUpSDL_GetEventFilter
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlsetgamma.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlsetgamma.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,223 @@ +SDL_SetGamma
    SDL Library Documentation
    PrevNext

    SDL_SetGamma

    Name

    SDL_SetGamma -- Sets the color gamma function for the display

    Synopsis

    #include "SDL.h"

    int SDL_SetGamma(float redgamma, float greengamma, float bluegamma);

    Description

    Sets the "gamma function" for the display of each color component. Gamma +controls the brightness/contrast of colors displayed on the screen. +A gamma value of 1.0 is identity (i.e., no adjustment +is made).

    This function adjusts the gamma based on the "gamma function" parameter, +you can directly specify lookup tables for gamma adjustment with +SDL_SetGammaRamp.

    Not all display hardware is able to change gamma.

    Return Value

    Returns -1 on error (or if gamma adjustment is not supported).


    PrevHomeNext
    SDL_SetPaletteUpSDL_GetGammaRamp
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlsetgammaramp.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlsetgammaramp.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,222 @@ +SDL_SetGammaRamp
    SDL Library Documentation
    PrevNext

    SDL_SetGammaRamp

    Name

    SDL_SetGammaRamp -- Sets the color gamma lookup tables for the display

    Synopsis

    #include "SDL.h"

    int SDL_SetGammaRamp(Uint16 *redtable, Uint16 *greentable, Uint16 *bluetable);

    Description

    Sets the gamma lookup tables for the display for each color component. +Each table is an array of 256 Uint16 values, representing a mapping +between the input and output for that channel. The input is the index +into the array, and the output is the 16-bit gamma value at that index, +scaled to the output color precision. You may pass NULL to any of the +channels to leave them unchanged.

    This function adjusts the gamma based on lookup tables, you can also +have the gamma calculated based on a "gamma function" parameter with +SDL_SetGamma.

    Not all display hardware is able to change gamma.

    Return Value

    Returns -1 on error (or if gamma adjustment is not supported).


    PrevHomeNext
    SDL_GetGammaRampUpSDL_MapRGB
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlsetmodstate.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlsetmodstate.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,229 @@ +SDL_SetModState
    SDL Library Documentation
    PrevNext

    SDL_SetModState

    Name

    SDL_SetModState -- Set the current key modifier state

    Synopsis

    #include "SDL.h"

    void SDL_SetModState(SDLMod modstate);

    Description

    The inverse of SDL_GetModState, SDL_SetModState allows you to impose modifier key states on your application.

    Simply pass your desired modifier states into modstate. This value my be a logical OR'd combination of the following:

    typedef enum {
    +  KMOD_NONE  = 0x0000,
    +  KMOD_LSHIFT= 0x0001,
    +  KMOD_RSHIFT= 0x0002,
    +  KMOD_LCTRL = 0x0040,
    +  KMOD_RCTRL = 0x0080,
    +  KMOD_LALT  = 0x0100,
    +  KMOD_RALT  = 0x0200,
    +  KMOD_LMETA = 0x0400,
    +  KMOD_RMETA = 0x0800,
    +  KMOD_NUM   = 0x1000,
    +  KMOD_CAPS  = 0x2000,
    +  KMOD_MODE  = 0x4000,
    +} SDLMod;

    PrevHomeNext
    SDL_GetModStateUpSDL_GetKeyName
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlsetpalette.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlsetpalette.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,344 @@ +SDL_SetPalette
    SDL Library Documentation
    PrevNext

    SDL_SetPalette

    Name

    SDL_SetPalette -- Sets the colors in the palette of an 8-bit surface.

    Synopsis

    #include "SDL.h"

    int SDL_SetPalette(SDL_Surface *surface, int flags, int SDL_Color *colors, int firstcolor, int ncolors);

    Description

    Sets a portion of the palette for the given 8-bit surface.

    Palettized (8-bit) screen surfaces with the +SDL_HWPALETTE flag have two palettes, a logical +palette that is used for mapping blits to/from the surface and a +physical palette (that determines how the hardware will map the colors +to the display). SDL_BlitSurface +always uses the logical palette when blitting surfaces (if it has to +convert between surface pixel formats). Because of this, it is often +useful to modify only one or the other palette to achieve various +special color effects (e.g., screen fading, color flashes, screen dimming).

    This function can modify either the logical or physical palette by +specifing SDL_LOGPAL or +SDL_PHYSPALthe in the flags +parameter.

    When surface is the surface associated with the current +display, the display colormap will be updated with the requested colors. If +SDL_HWPALETTE was set in SDL_SetVideoMode flags, +SDL_SetPalette will always return 1, +and the palette is guaranteed to be set the way you desire, even if the window +colormap has to be warped or run under emulation.

    The color components of a +SDL_Color structure +are 8-bits in size, giving you a total of +2563=16777216 colors.

    Return Value

    If surface is not a palettized surface, this function +does nothing, returning 0. If all of the colors were set +as passed to SDL_SetPalette, it will return +1. If not all the color entries were set exactly as +given, it will return 0, and you should look at the +surface palette to determine the actual color palette.

    Example

            /* Create a display surface with a grayscale palette */
    +        SDL_Surface *screen;
    +        SDL_Color colors[256];
    +        int i;
    +        .
    +        .
    +        .
    +        /* Fill colors with color information */
    +        for(i=0;i<256;i++){
    +          colors[i].r=i;
    +          colors[i].g=i;
    +          colors[i].b=i;
    +        }
    +
    +        /* Create display */
    +        screen=SDL_SetVideoMode(640, 480, 8, SDL_HWPALETTE);
    +        if(!screen){
    +          printf("Couldn't set video mode: %s\n", SDL_GetError());
    +          exit(-1);
    +        }
    +
    +        /* Set palette */
    +        SDL_SetPalette(screen, SDL_LOGPAL|SDL_PHYSPAL, colors, 0, 256);
    +        .
    +        .
    +        .
    +        .

    PrevHomeNext
    SDL_SetColorsUpSDL_SetGamma
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlsettimer.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlsettimer.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,261 @@ +SDL_SetTimer
    SDL Library Documentation
    Prev 

    SDL_SetTimer

    Name

    SDL_SetTimer -- Set a callback to run after the specified number of milliseconds has +elapsed.

    Synopsis

    #include "SDL.h"

    int SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback);

    Callback

    /* Function prototype for the timer callback function */ +typedef Uint32 (*SDL_TimerCallback)(Uint32 interval);

    Description

    Set a callback to run after the specified number of milliseconds has +elapsed. The callback function is passed the current timer interval +and returns the next timer interval. If the returned value is the +same as the one passed in, the periodic alarm continues, otherwise a +new alarm is scheduled.

    To cancel a currently running timer, call +SDL_SetTimer(0, NULL);

    The timer callback function may run in a different thread than your +main constant, and so shouldn't call any functions from within itself.

    The maximum resolution of this timer is 10 ms, which means that if +you request a 16 ms timer, your callback will run approximately 20 ms +later on an unloaded system. If you wanted to set a flag signaling +a frame update at 30 frames per second (every 33 ms), you might set a +timer for 30 ms (see example below).

    If you use this function, you need to pass SDL_INIT_TIMER +to SDL_Init().

    Note: This function is kept for compatibility but has been superceeded +by the new timer functions +SDL_AddTimer and +SDL_RemoveTimer which support +multiple timers.

    Examples

    SDL_SetTimer((33/10)*10, my_callback);

    See Also

    SDL_AddTimer


    PrevHome 
    SDL_RemoveTimerUp 
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlsetvideomode.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlsetvideomode.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,486 @@ +SDL_SetVideoMode
    SDL Library Documentation
    PrevNext

    SDL_SetVideoMode

    Name

    SDL_SetVideoMode -- Set up a video mode with the specified width, height and bits-per-pixel.

    Synopsis

    #include "SDL.h"

    SDL_Surface *SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags);

    Description

    Set up a video mode with the specified width, height and bits-per-pixel.

    If bpp is 0, it is treated as the +current display bits per pixel.

    The flags parameter is the same as the flags field of the SDL_Surface structure. OR'd combinations of the following values are valid.

    SDL_SWSURFACECreate the video surface in system memory
    SDL_HWSURFACECreate the video surface in video memory
    SDL_ASYNCBLITEnables the use of asynchronous to the display surface. This will usually slow down blitting on single CPU machines, but may provide a speed increase on SMP systems.
    SDL_ANYFORMATNormally, if a video surface of the requested depth (bpp) is not available, SDL will emulate one with a shadow surface. Passing SDL_ANYFORMAT prevents this and causes SDL to use the video surface, regardless of its depth.
    SDL_HWPALETTEGive SDL exclusive palette access. Without this flag you may not always get the the colors you request with SDL_SetColors.
    SDL_DOUBLEBUFEnable double buffering. Calling SDL_Flip will flip the buffers and update the screen. If double buffering could not be enabled then SDL_Flip will just perform a SDL_UpdateRect on the entire screen.
    SDL_FULLSCREENSDL will attempt to use a fullscreen mode
    SDL_OPENGLCreate an OpenGL rendering context. You should have previously set OpenGL video attributes with SDL_GL_SetAttribute.
    SDL_OPENGLBLITCreate an OpenGL rendering context, like above, but allow normal blitting operations.
    SDL_RESIZABLECreate a resizable window. When the window is resized by the user a SDL_VIDEORESIZE event is generated and SDL_SetVideoMode can be called again with the new size.
    SDL_NOFRAMEIf possible, SDL_NOFRAME causes SDL to create a window with no title bar or frame decoration. Fullscreen modes automatically have this flag set.

    Note: Whatever flags SDL_SetVideoMode could satisfy are set in the flags member of the returned surface.

    Return Value

    The framebuffer surface, or NULL if it fails.


    PrevHomeNext
    SDL_VideoModeOKUpSDL_UpdateRect
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlshowcursor.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlshowcursor.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,231 @@ +SDL_ShowCursor
    SDL Library Documentation
    PrevNext

    SDL_ShowCursor

    Name

    SDL_ShowCursor -- Toggle whether or not the cursor is shown on the screen.

    Synopsis

    #include "SDL.h"

    int SDL_ShowCursor(int toggle);

    Description

    Toggle whether or not the cursor is shown on the screen. Passing SDL_ENABLE displays the cursor and passing SDL_DISABLE hides it. The current state of the mouse cursor can be queried by passing SDL_QUERY, either SDL_DISABLE or SDL_ENABLE will be returned.

    The cursor starts off displayed, but can be turned off.

    Return Value

    Returns the current state of the cursor.


    PrevHomeNext
    SDL_GetCursorUpSDL_GL_LoadLibrary
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlsurface.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlsurface.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,614 @@ +SDL_Surface
    SDL Library Documentation
    PrevNext

    SDL_Surface

    Name

    SDL_Surface -- Graphical Surface Structure

    Structure Definition

    typedef struct SDL_Surface {
    +        Uint32 flags;                           /* Read-only */
    +        SDL_PixelFormat *format;                /* Read-only */
    +        int w, h;                               /* Read-only */
    +        Uint16 pitch;                           /* Read-only */
    +        void *pixels;                           /* Read-write */
    +        int offset;                             /* Private */
    +
    +        /* Hardware-specific surface info */
    +        struct private_hwdata *hwdata;
    +
    +        /* clipping information */
    +        SDL_Rect clip_rect;                     /* Read-only */
    +        Uint32 unused1;                         /* for binary compatibility */
    +        Uint32 unused2;                         /* for binary compatibility */
    +
    +        /* info for fast blit mapping to other surfaces */
    +        struct SDL_BlitMap *map;                /* Private */
    +
    +        /* format version, bumped at every change to invalidate blit maps */
    +        unsigned int format_version;            /* Private */
    +
    +        /* Reference count -- used when freeing surface */
    +        int refcount;                           /* Read-mostly */
    +} SDL_Surface;

    Structure Data

    flagsSurface flags
    formatPixel format
    w, hWidth and height of the surface
    pitchLength of a surface scanline in bytes
    pixelsPointer to the actual pixel data
    clip_minx, clip_maxxX clip coords
    clip_rectsurface clip rectangle

    Description

    SDL_Surface's represent areas of "graphical" +memory, memory that can be drawn to. The video framebuffer is returned +as a SDL_Surface by +SDL_SetVideoMode +and SDL_GetVideoSurface. +Most of the fields should be pretty obvious. +w and h are the +width and height of the surface in pixels. +pixels is a pointer to the actual pixel data, +the surface should be locked +before accessing this field. The clip_rect field +is the clipping rectangle as set by +SDL_SetClipRect.

    The following are supported in the +flags field.

    SDL_SWSURFACESurface is stored in system memory
    SDL_HWSURFACESurface is stored in video memory
    SDL_ASYNCBLITSurface uses asynchronous blits if possible
    SDL_ANYFORMATAllows any pixel-format (Display surface)
    SDL_HWPALETTESurface has exclusive palette
    SDL_DOUBLEBUFSurface is double buffered (Display surface)
    SDL_FULLSCREENSurface is full screen (Display Surface)
    SDL_OPENGLSurface has an OpenGL context (Display Surface)
    SDL_OPENGLBLITSurface supports OpenGL blitting (Display Surface)
    SDL_RESIZABLESurface is resizable (Display Surface)
    SDL_HWACCELSurface blit uses hardware acceleration
    SDL_SRCOLORKEYSurface use colorkey blitting
    SDL_RLEACCELColorkey blitting is accelerated with RLE
    SDL_SRCALPHASurface blit uses alpha blending
    SDL_PREALLOCSurface uses preallocated memory


    PrevHomeNext
    SDL_PixelFormatUpSDL_VideoInfo
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlsyswmevent.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlsyswmevent.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,224 @@ +SDL_SysWMEvent
    SDL Library Documentation
    PrevNext

    SDL_SysWMEvent

    Name

    SDL_SysWMEvent -- Platform-dependent window manager event.

    Description

    The system window manager event contains a pointer to system-specific +information about unknown window manager events. If you enable this event +using +SDL_EventState(), +it will be generated whenever unhandled events are received from the window +manager. This can be used, for example, to implement cut-and-paste in your +application. + +

    typedef struct {
    +         Uint8 type;   /* Always SDL_SysWM */
    + } SDL_SysWMEvent;
    + +If you want to obtain system-specific information about the window manager, +you can fill the version member of a SDL_SysWMinfo +structure (details can be found in SDL_syswm.h, which must be included) using the SDL_VERSION() macro found in +SDL_version.h, and pass it to the +function: +

    int SDL_GetWMInfo(SDL_SysWMinfo *info);


    PrevHomeNext
    SDL_ResizeEventUpSDL_UserEvent
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlthreadid.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlthreadid.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,182 @@ +SDL_ThreadID
    SDL Library Documentation
    PrevNext

    SDL_ThreadID

    Name

    SDL_ThreadID -- Get the 32-bit thread identifier for the current thread.

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    Uint32 SDL_ThreadID(void);

    Description

    Get the 32-bit thread identifier for the current thread.


    PrevHomeNext
    SDL_CreateThreadUpSDL_GetThreadID
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlunlockaudio.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlunlockaudio.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,203 @@ +SDL_UnlockAudio
    SDL Library Documentation
    PrevNext

    SDL_UnlockAudio

    Name

    SDL_UnlockAudio -- Unlock the callback function

    Synopsis

    #include "SDL.h"

    void SDL_UnlockAudio(void);

    Description

    Unlocks a previous SDL_LockAudio call.


    PrevHomeNext
    SDL_LockAudioUpSDL_CloseAudio
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlunlocksurface.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlunlocksurface.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,211 @@ +SDL_UnlockSurface
    SDL Library Documentation
    PrevNext

    SDL_UnlockSurface

    Name

    SDL_UnlockSurface -- Unlocks a previously locked surface.

    Synopsis

    #include "SDL.h"

    void SDL_UnlockSurface(SDL_Surface *surface);

    Description

    Surfaces that were previously locked using SDL_LockSurface must be unlocked with SDL_UnlockSurface. Surfaces should be unlocked as soon as possible.

    It should be noted that since 1.1.8, surface locks are recursive. See SDL_LockSurface.


    PrevHomeNext
    SDL_LockSurfaceUpSDL_LoadBMP
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlunlockyuvoverlay.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlunlockyuvoverlay.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,217 @@ +SDL_UnlockYUVOverlay
    SDL Library Documentation
    PrevNext

    SDL_UnlockYUVOverlay

    Name

    SDL_UnlockYUVOverlay -- Unlock an overlay

    Synopsis

    #include "SDL.h"

    void SDL_UnlockYUVOverlay(SDL_Overlay *overlay);

    Description

    The opposite to SDL_LockYUVOverlay. Unlocks a previously locked overlay. An overlay must be unlocked before it can be displayed.


    PrevHomeNext
    SDL_LockYUVOverlayUpSDL_DisplayYUVOverlay
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlupdaterect.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlupdaterect.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,257 @@ +SDL_UpdateRect
    SDL Library Documentation
    PrevNext

    SDL_UpdateRect

    Name

    SDL_UpdateRect -- Makes sure the given area is updated on the given screen.

    Synopsis

    #include "SDL.h"

    void SDL_UpdateRect(SDL_Surface *screen, Sint32 x, Sint32 y, Sint32 w, Sint32 h);

    Description

    Makes sure the given area is updated on the given screen.

    If 'x', 'y', 'w' +and 'h' are all 0, +SDL_UpdateRect will update the +entire screen.

    This function should not be called while 'screen' is +locked.


    PrevHomeNext
    SDL_SetVideoModeUpSDL_UpdateRects
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlupdaterects.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlupdaterects.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,229 @@ +SDL_UpdateRects
    SDL Library Documentation
    PrevNext

    SDL_UpdateRects

    Name

    SDL_UpdateRects -- Makes sure the given list of rectangles is updated on the given screen.

    Synopsis

    #include "SDL.h"

    void SDL_UpdateRects(SDL_Surface *screen, int numrects, SDL_Rect *rects);

    Description

    Makes sure the given list of rectangles is updated on the given screen.

    This function should not be called while screen is +locked.


    PrevHomeNext
    SDL_UpdateRectUpSDL_Flip
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdluserevent.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdluserevent.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,329 @@ +SDL_UserEvent
    SDL Library Documentation
    PrevNext

    SDL_UserEvent

    Name

    SDL_UserEvent -- A user-defined event type

    Structure Definition

    typedef struct{
    +  Uint8 type;
    +  int code;
    +  void *data1;
    +  void *data2;
    +} SDL_UserEvent;

    Structure Data

    typeSDL_USEREVENT through to SDL_NUMEVENTS-1
    codeUser defined event code
    data1User defined data pointer
    data2User defined data pointer

    Description

    SDL_UserEvent is in the user member of the structure SDL_Event. This event is unique, it is never created by SDL but only by the user. The event can be pushed onto the event queue using SDL_PushEvent. The contents of the structure members or completely up to the programmer, the only requirement is that type is a value from SDL_USEREVENT to SDL_NUMEVENTS-1 (inclusive).

    Examples

    SDL_Event event;
    +
    +event.type = SDL_USEREVENT;
    +event.user.code = my_event_code;
    +event.user.data1 = significant_data;
    +event.user.data2 = 0;
    +SDL_PushEvent(&event);


    PrevHomeNext
    SDL_SysWMEventUpSDL_QuitEvent
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlvideodrivername.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlvideodrivername.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,235 @@ +SDL_VideoDriverName
    SDL Library Documentation
    PrevNext

    SDL_VideoDriverName

    Name

    SDL_VideoDriverName -- Obtain the name of the video driver

    Synopsis

    #include "SDL.h"

    char *SDL_VideoDriverName(char *namebuf, int maxlen);

    Description

    The buffer pointed to by namebuf is filled up to a maximum of maxlen characters (include the NULL terminator) with the name of the initialised video driver. The driver name is a simple one word identifier like "x11" or "windib".

    Return Value

    Returns NULL if video has not been initialised with SDL_Init or a pointer to namebuf otherwise.


    PrevHomeNext
    SDL_GetVideoInfoUpSDL_ListModes
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlvideoinfo.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlvideoinfo.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,400 @@ +SDL_VideoInfo
    SDL Library Documentation
    PrevNext

    SDL_VideoInfo

    Name

    SDL_VideoInfo -- Video Target information

    Structure Definition

    typedef struct{
    +  Uint32 hw_available:1;
    +  Uint32 wm_available:1;
    +  Uint32 blit_hw:1;
    +  Uint32 blit_hw_CC:1;
    +  Uint32 blit_hw_A:1;
    +  Uint32 blit_sw:1;
    +  Uint32 blit_sw_CC:1;
    +  Uint32 blit_sw_A:1;
    +  Uint32 blit_fill;
    +  Uint32 video_mem;
    +  SDL_PixelFormat *vfmt;
    +} SDL_VideoInfo;

    Structure Data

    hw_availableIs it possible to create hardware surfaces?
    wm_availableIs there a window manager available
    blit_hwAre hardware to hardware blits accelerated?
    blit_hw_CCAre hardware to hardware colorkey blits accelerated?
    blit_hw_AAre hardware to hardware alpha blits accelerated?
    blit_swAre software to hardware blits accelerated?
    blit_sw_CCAre software to hardware colorkey blits accelerated?
    blit_sw_AAre software to hardware alpha blits accelerated?
    blit_fillAre color fills accelerated?
    video_memTotal amount of video memory in Kilobytes
    vfmtPixel format of the video device

    Description

    This (read-only) structure is returned by SDL_GetVideoInfo. It contains information on either the 'best' available mode (if called before SDL_SetVideoMode) or the current video mode.


    PrevHomeNext
    SDL_SurfaceUpSDL_Overlay
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlvideomodeok.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlvideomodeok.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,262 @@ +SDL_VideoModeOK
    SDL Library Documentation
    PrevNext

    SDL_VideoModeOK

    Name

    SDL_VideoModeOK -- Check to see if a particular video mode is supported.

    Synopsis

    #include "SDL.h"

    int SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags);

    Description

    SDL_VideoModeOK returns 0 +if the requested mode is not supported under any bit depth, or returns the +bits-per-pixel of the closest available mode with the given width, height and requested surface flags (see SDL_SetVideoMode).

    The bits-per-pixel value returned is only a suggested mode. You can usually request and bpp you want when setting the video mode and SDL will emulate that color depth with a shadow video surface.

    The arguments to SDL_VideoModeOK are the same ones you +would pass to SDL_SetVideoMode

    Example

    SDL_Surface *screen;
    +Uint32 bpp;
    +.
    +.
    +.
    +printf("Checking mode 640x480@16bpp.\n");
    +bpp=SDL_VideoModeOK(640, 480, 16, SDL_HWSURFACE);
    +
    +if(!bpp){
    +  printf("Mode not available.\n");
    +  exit(-1);
    +}
    +
    +printf("SDL Recommends 640x480@%dbpp.\n", bpp);
    +screen=SDL_SetVideoMode(640, 480, bpp, SDL_HWSURFACE);
    +.
    +.

    PrevHomeNext
    SDL_ListModesUpSDL_SetVideoMode
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlwaitevent.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlwaitevent.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,223 @@ +SDL_WaitEvent
    SDL Library Documentation
    PrevNext

    SDL_WaitEvent

    Name

    SDL_WaitEvent -- Waits indefinitely for the next available event.

    Synopsis

    #include "SDL.h"

    int SDL_WaitEvent(SDL_Event *event);

    Description

    Waits indefinitely for the next available event, returning +1, or 0 if there was +an error while waiting for events.

    If event is not NULL, the next +event is removed from the queue and stored in that area.


    PrevHomeNext
    SDL_PollEventUpSDL_PushEvent
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlwaitthread.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlwaitthread.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,223 @@ +SDL_WaitThread
    SDL Library Documentation
    PrevNext

    SDL_WaitThread

    Name

    SDL_WaitThread -- Wait for a thread to finish.

    Synopsis

    #include "SDL.h"
    +#include "SDL_thread.h"

    void SDL_WaitThread(SDL_Thread *thread, int *status);

    Description

    Wait for a thread to finish (timeouts are not supported).

    Return Value

    The return code for the thread function is placed in the area pointed to by +status, if status is not +NULL.


    PrevHomeNext
    SDL_GetThreadIDUpSDL_KillThread
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlwarpmouse.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlwarpmouse.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,197 @@ +SDL_WarpMouse
    SDL Library Documentation
    PrevNext

    SDL_WarpMouse

    Name

    SDL_WarpMouse -- Set the position of the mouse cursor.

    Synopsis

    #include "SDL.h"

    void SDL_WarpMouse(Uint16 x, Uint16 y);

    Description

    Set the position of the mouse cursor (generates a mouse motion event).


    PrevHomeNext
    SDL_DisplayFormatAlphaUpSDL_CreateCursor
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlwasinit.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlwasinit.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,276 @@ +SDL_WasInit
    SDL Library Documentation
    PrevNext

    SDL_WasInit

    Name

    SDL_WasInit -- Check which subsystems are initialized

    Synopsis

    #include "SDL.h"

    Uint32 SDL_WasInit(Uint32 flags);

    Description

    SDL_WasInit allows you to see which SDL subsytems have been initialized. flags is a bitwise OR'd combination of the subsystems you wish to check (see SDL_Init for a list of subsystem flags).

    Return Value

    SDL_WasInit returns a bitwised OR'd combination of the initialized subsystems.

    Examples

    
/* Here are several ways you can use SDL_WasInit() */
    +
    +/* Get init data on all the subsystems */
    +Uint32 subsystem_init;
    +
    +subsystem_init=SDL_WasInit(SDL_INIT_EVERYTHING);
    +
    +if(subsystem_init&SDL_INIT_VIDEO)
    +  printf("Video is initialized.\n");
    +else
    +  printf("Video is not initialized.\n");
    +
    +
    +
    +/* Just check for one specfic subsystem */
    +
    +if(SDL_WasInit(SDL_INIT_VIDEO)!=0)
    +  printf("Video is initialized.\n");
    +else
    +  printf("Video is not initialized.\n");
    +
    +
    +
    +
    +/* Check for two subsystems */
    +
    +Uint32 subsystem_mask=SDL_INIT_VIDEO|SDL_INIT_AUDIO;
    +
    +if(SDL_WasInit(subsystem_mask)==subsystem_mask)
    +  printf("Video and Audio initialized.\n");
    +else
    +  printf("Video and Audio not initialized.\n");

    PrevHomeNext
    SDL_QuitUpVideo
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlwmgetcaption.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlwmgetcaption.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,214 @@ +SDL_WM_GetCaption
    SDL Library Documentation
    PrevNext

    SDL_WM_GetCaption

    Name

    SDL_WM_GetCaption -- Gets the window title and icon name.

    Synopsis

    #include "SDL.h"

    void SDL_WM_GetCaption(char **title, char **icon);

    Description

    Set pointers to the window title and icon name.


    PrevHomeNext
    SDL_WM_SetCaptionUpSDL_WM_SetIcon
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlwmgrabinput.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlwmgrabinput.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,216 @@ +SDL_WM_GrabInput
    SDL Library Documentation
    PrevNext

    SDL_WM_GrabInput

    Name

    SDL_WM_GrabInput -- Grabs mouse and keyboard input.

    Synopsis

    #include "SDL.h"

    SDL_GrabMode SDL_WM_GrabInput(SDL_GrabMode mode);

    Description

    Grabbing means that the mouse is confined to the application window, +and nearly all keyboard input is passed directly to the application, +and not interpreted by a window manager, if any.

    When mode is SDL_GRAB_QUERY the grab mode is not changed, but the current grab mode is returned.

    typedef enum {
    +  SDL_GRAB_QUERY,
    +  SDL_GRAB_OFF,
    +  SDL_GRAB_ON
    +} SDL_GrabMode;
    +

    Return Value

    The current/new SDL_GrabMode.


    PrevHomeNext
    SDL_WM_ToggleFullScreenUpEvents
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlwmiconifywindow.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlwmiconifywindow.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,203 @@ +SDL_WM_IconifyWindow
    SDL Library Documentation
    PrevNext

    SDL_WM_IconifyWindow

    Name

    SDL_WM_IconifyWindow -- Iconify/Minimise the window

    Synopsis

    #include "SDL.h"

    int SDL_WM_IconifyWindow(void);

    Description

    If the application is running in a window managed environment SDL attempts to iconify/minimise it. If SDL_WM_IconifyWindow is successful, the application will receive a SDL_APPACTIVE loss event.

    Return Value

    Returns non-zero on success or 0 if iconification is not support or was refused by the window manager.


    PrevHomeNext
    SDL_WM_SetIconUpSDL_WM_ToggleFullScreen
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlwmsetcaption.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlwmsetcaption.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,204 @@ +SDL_WM_SetCaption
    SDL Library Documentation
    PrevNext

    SDL_WM_SetCaption

    Name

    SDL_WM_SetCaption -- Sets the window tile and icon name.

    Synopsis

    #include "SDL.h"

    void SDL_WM_SetCaption(const char *title, const char *icon);

    Description

    Sets the title-bar and icon name of the display window.


    PrevHomeNext
    Window ManagementUpSDL_WM_GetCaption
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlwmseticon.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlwmseticon.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,244 @@ +SDL_WM_SetIcon
    SDL Library Documentation
    PrevNext

    SDL_WM_SetIcon

    Name

    SDL_WM_SetIcon -- Sets the icon for the display window.

    Synopsis

    #include "SDL.h"

    void SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask);

    Description

    Sets the icon for the display window.

    This function must be called before the first call to +SDL_SetVideoMode.

    It takes an icon surface, and a mask in MSB format.

    If mask is NULL, the entire +icon surface will be used as the icon.

    Example

    SDL_WM_SetIcon(SDL_LoadBMP("icon.bmp"), NULL);

    PrevHomeNext
    SDL_WM_GetCaptionUpSDL_WM_IconifyWindow
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/sdlwmtogglefullscreen.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/sdlwmtogglefullscreen.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,197 @@ +SDL_WM_ToggleFullScreen
    SDL Library Documentation
    PrevNext

    SDL_WM_ToggleFullScreen

    Name

    SDL_WM_ToggleFullScreen -- Toggles fullscreen mode

    Synopsis

    #include "SDL.h"

    int SDL_WM_ToggleFullScreen(SDL_Surface *surface);

    Description

    Toggles the application between windowed and fullscreen mode, if supported. (X11 is the only target currently supported, BeOS support is experimental).

    Return Value

    Returns 0 on failure or 1 on success.


    PrevHomeNext
    SDL_WM_IconifyWindowUpSDL_WM_GrabInput
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/thread.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/thread.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,305 @@ +Multi-threaded Programming
    SDL Library Documentation
    PrevNext

    Chapter 12. Multi-threaded Programming

    Table of Contents
    SDL_CreateThread — Creates a new thread of execution that shares its parent's properties.
    SDL_ThreadID — Get the 32-bit thread identifier for the current thread.
    SDL_GetThreadID — Get the SDL thread ID of a SDL_Thread
    SDL_WaitThread — Wait for a thread to finish.
    SDL_KillThread — Gracelessly terminates the thread.
    SDL_CreateMutex — Create a mutex
    SDL_DestroyMutex — Destroy a mutex
    SDL_mutexP — Lock a mutex
    SDL_mutexV — Unlock a mutex
    SDL_CreateSemaphore — Creates a new semaphore and assigns an initial value to it.
    SDL_DestroySemaphore — Destroys a semaphore that was created by SDL_CreateSemaphore.
    SDL_SemWait — Lock a semaphore and suspend the thread if the semaphore value is zero.
    SDL_SemTryWait — Attempt to lock a semaphore but don't suspend the thread.
    SDL_SemWaitTimeout — Lock a semaphore, but only wait up to a specified maximum time.
    SDL_SemPost — Unlock a semaphore.
    SDL_SemValue — Return the current value of a semaphore.
    SDL_CreateCond — Create a condition variable
    SDL_DestroyCond — Destroy a condition variable
    SDL_CondSignal — Restart a thread wait on a condition variable
    SDL_CondBroadcast — Restart all threads waiting on a condition variable
    SDL_CondWait — Wait on a condition variable
    SDL_CondWaitTimeout — Wait on a condition variable, with timeout

    SDL provides functions for creating threads, mutexes, semphores and condition variables.

    In general, you must be very aware of concurrency and data integrity issues +when writing multi-threaded programs. Some good guidelines include: +

    • Don't call SDL video/event functions from separate threads

    • Don't use any library functions in separate threads

    • Don't perform any memory management in separate threads

    • Lock global variables which may be accessed by multiple threads

    • Never terminate threads, always set a flag and wait for them to quit

    • Think very carefully about all possible ways your code may interact

    Note: SDL's threading is not implemented on MacOS, due to that lack of preemptive thread support (eck!)


    PrevHomeNext
    SDL_CDtrackUpSDL_CreateThread
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/time.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/time.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,198 @@ +Time
    SDL Library Documentation
    PrevNext

    Chapter 13. Time

    Table of Contents
    SDL_GetTicks — Get the number of milliseconds since the SDL library initialization.
    SDL_Delay — Wait a specified number of milliseconds before returning.
    SDL_AddTimer — Add a timer which will call a callback after the specified number of milliseconds has +elapsed.
    SDL_RemoveTimer — Remove a timer which was added with +SDL_AddTimer.
    SDL_SetTimer — Set a callback to run after the specified number of milliseconds has +elapsed.

    SDL provides several cross-platform functions for dealing with time. +It provides a way to get the current time, a way to wait a little while, +and a simple timer mechanism. These functions give you two ways of moving an +object every x milliseconds: + +

    • Use a timer callback function. This may have the bad effect that it runs in a seperate thread or uses alarm signals, but it's easier to implement.

    • Or you can get the number of milliseconds passed, and move the object if, for example, 30 ms passed.


    PrevHomeNext
    SDL_CondWaitTimeoutUpSDL_GetTicks
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/video.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/video.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,499 @@ +Video
    SDL Library Documentation
    PrevNext

    Chapter 6. Video

    Table of Contents
    SDL_GetVideoSurface — returns a pointer to the current display surface
    SDL_GetVideoInfo — returns a pointer to information about the video hardware
    SDL_VideoDriverName — Obtain the name of the video driver
    SDL_ListModes — Returns a pointer to an array of available screen dimensions for +the given format and video flags
    SDL_VideoModeOK — Check to see if a particular video mode is supported.
    SDL_SetVideoMode — Set up a video mode with the specified width, height and bits-per-pixel.
    SDL_UpdateRect — Makes sure the given area is updated on the given screen.
    SDL_UpdateRects — Makes sure the given list of rectangles is updated on the given screen.
    SDL_Flip — Swaps screen buffers
    SDL_SetColors — Sets a portion of the colormap for the given 8-bit surface.
    SDL_SetPalette — Sets the colors in the palette of an 8-bit surface.
    SDL_SetGamma — Sets the color gamma function for the display
    SDL_GetGammaRamp — Gets the color gamma lookup tables for the display
    SDL_SetGammaRamp — Sets the color gamma lookup tables for the display
    SDL_MapRGB — Map a RGB color value to a pixel format.
    SDL_MapRGBA — Map a RGBA color value to a pixel format.
    SDL_GetRGB — Get RGB values from a pixel in the specified pixel format.
    SDL_GetRGBA — Get RGBA values from a pixel in the specified pixel format.
    SDL_CreateRGBSurface — Create an empty SDL_Surface
    SDL_CreateRGBSurfaceFrom — Create an SDL_Surface from pixel data
    SDL_FreeSurface — Frees (deletes) and SDL_Surface
    SDL_LockSurface — Lock a surface for directly access.
    SDL_UnlockSurface — Unlocks a previously locked surface.
    SDL_LoadBMP — Load a Windows BMP file into an SDL_Surface.
    SDL_SaveBMP — Save an SDL_Surface as a Windows BMP file.
    SDL_SetColorKey — Sets the color key (transparent pixel) in a blittable surface and +RLE acceleration.
    SDL_SetAlpha — Adjust the alpha properties of a surface
    SDL_SetClipRect — Sets the clipping rectangle for a surface.
    SDL_GetClipRect — Gets the clipping rectangle for a surface.
    SDL_ConvertSurface — Converts a surface to the same format as another surface.
    SDL_BlitSurface — This performs a fast blit from the source surface to the destination surface.
    SDL_FillRect — This function performs a fast fill of the given rectangle with some color
    SDL_DisplayFormat — Convert a surface to the display format
    SDL_DisplayFormatAlpha — Convert a surface to the display format
    SDL_WarpMouse — Set the position of the mouse cursor.
    SDL_CreateCursor — Creates a new mouse cursor.
    SDL_FreeCursor — Frees a cursor created with SDL_CreateCursor.
    SDL_SetCursor — Set the currently active mouse cursor.
    SDL_GetCursor — Get the currently active mouse cursor.
    SDL_ShowCursor — Toggle whether or not the cursor is shown on the screen.
    SDL_GL_LoadLibrary — Specify an OpenGL library
    SDL_GL_GetProcAddress — Get the address of a GL function
    SDL_GL_GetAttribute — Get the value of a special SDL/OpenGL attribute
    SDL_GL_SetAttribute — Set a special SDL/OpenGL attribute
    SDL_GL_SwapBuffers — Swap OpenGL framebuffers/Update Display
    SDL_CreateYUVOverlay — Create a YUV video overlay
    SDL_LockYUVOverlay — Lock an overlay
    SDL_UnlockYUVOverlay — Unlock an overlay
    SDL_DisplayYUVOverlay — Blit the overlay to the display
    SDL_FreeYUVOverlay — Free a YUV video overlay
    SDL_GLattr — SDL GL Attributes
    SDL_Rect — Defines a rectangular area
    SDL_Color — Format independent color description
    SDL_Palette — Color palette for 8-bit pixel formats
    SDL_PixelFormat — Stores surface format information
    SDL_Surface — Graphical Surface Structure
    SDL_VideoInfo — Video Target information
    SDL_Overlay — YUV video overlay

    SDL presents a very simple interface to the display framebuffer. The +framebuffer is represented as an offscreen surface to which you can write +directly. If you want the screen to show what you have written, call the update function which will +guarantee that the desired portion of the screen is updated.

    Before you call any of the SDL video functions, you must first call +SDL_Init(SDL_INIT_VIDEO), which initializes the video +and events in the SDL library. Check the return code, which should be +0, to see if there were any errors in starting up.

    If you use both sound and video in your application, you need to call +SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO) before opening the +sound device, otherwise under Win32 DirectX, you won't be able to set +full-screen display modes.

    After you have initialized the library, you can start up the video display in a +number of ways. The easiest way is to pick a common screen resolution and +depth and just initialize the video, checking for errors. You will probably +get what you want, but SDL may be emulating your requested mode and converting +the display on update. The best way is to +query, for the best +video mode closest to the desired one, and then +convert +your images to that pixel format.

    SDL currently supports any bit depth >= 8 bits per pixel. 8 bpp formats are +considered 8-bit palettized modes, while 12, 15, 16, 24, and 32 bits per pixel +are considered "packed pixel" modes, meaning each pixel contains the RGB color +components packed in the bits of the pixel.

    After you have initialized your video mode, you can take the surface that was +returned, and write to it like any other framebuffer, calling the update +routine as you go.

    When you have finished your video access and are ready to quit your +application, you should call "SDL_Quit()" to shutdown the +video and events.


    PrevHomeNext
    SDL_WasInitUpSDL_GetVideoSurface
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/html/wm.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/html/wm.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,180 @@ +Window Management
    SDL Library Documentation
    PrevNext

    Chapter 7. Window Management

    Table of Contents
    SDL_WM_SetCaption — Sets the window tile and icon name.
    SDL_WM_GetCaption — Gets the window title and icon name.
    SDL_WM_SetIcon — Sets the icon for the display window.
    SDL_WM_IconifyWindow — Iconify/Minimise the window
    SDL_WM_ToggleFullScreen — Toggles fullscreen mode
    SDL_WM_GrabInput — Grabs mouse and keyboard input.

    SDL provides a small set of window management functions which allow applications to change their title and toggle from windowed mode to fullscreen (if available)


    PrevHomeNext
    SDL_OverlayUpSDL_WM_SetCaption
    \ No newline at end of file diff -r 000000000000 -r 74212992fb08 docs/images/rainbow.gif Binary file docs/images/rainbow.gif has changed diff -r 000000000000 -r 74212992fb08 docs/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/index.html Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,121 @@ + +Introduction +
    +

    Introduction

    This library is designed to make it easy to write games that run on Linux, +Win32 and BeOS using the various native high-performance media interfaces, +(for video, audio, etc) and presenting a single source-code level API to +your application. This is a fairly low level API, but using this, completely +portable applications can be written with a great deal of flexibility.

    The library is loaded as a dynamically linked library on its native +platform, and is currently compiled natively for Linux, compiled for +Win32 using a Linux hosted GCC +cross-compilation +environment, and compiled using the EGCS C++ compiler under BeOS.

    An introduction to SDL can be found online at: +http://www.libsdl.org/intro/

    There are code examples on each of the main library pages, and there are +fully fleshed example C++ classes and programs in the examples archive, +available on the +SDL download page.

    For an introduction to basic multi-media programming concepts, you might try +some of the following links: +

    Enjoy!

        Sam Lantinga +<slouken@libsdl.org>

    +

    +


    +

    Table of Contents

    + +
    diff -r 000000000000 -r 74212992fb08 docs/man3/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/.cvsignore Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,2 @@ +Makefile.in +Makefile diff -r 000000000000 -r 74212992fb08 docs/man3/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/Makefile.am Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,174 @@ +man_MANS = \ + SDLKey.3 \ + SDL_ActiveEvent.3 \ + SDL_AddTimer.3 \ + SDL_AudioCVT.3 \ + SDL_AudioSpec.3 \ + SDL_BlitSurface.3 \ + SDL_BuildAudioCVT.3 \ + SDL_CD.3 \ + SDL_CDClose.3 \ + SDL_CDEject.3 \ + SDL_CDName.3 \ + SDL_CDNumDrives.3 \ + SDL_CDOpen.3 \ + SDL_CDPause.3 \ + SDL_CDPlay.3 \ + SDL_CDPlayTracks.3 \ + SDL_CDResume.3 \ + SDL_CDStatus.3 \ + SDL_CDStop.3 \ + SDL_CDtrack.3 \ + SDL_CloseAudio.3 \ + SDL_Color.3 \ + SDL_CondBroadcast.3 \ + SDL_CondSignal.3 \ + SDL_CondWait.3 \ + SDL_CondWaitTimeout.3 \ + SDL_ConvertAudio.3 \ + SDL_ConvertSurface.3 \ + SDL_CreateCond.3 \ + SDL_CreateCursor.3 \ + SDL_CreateMutex.3 \ + SDL_CreateRGBSurface.3 \ + SDL_CreateRGBSurfaceFrom.3 \ + SDL_CreateSemaphore.3 \ + SDL_CreateThread.3 \ + SDL_CreateYUVOverlay.3 \ + SDL_Delay.3 \ + SDL_DestroyCond.3 \ + SDL_DestroyMutex.3 \ + SDL_DestroySemaphore.3 \ + SDL_DisplayFormat.3 \ + SDL_DisplayFormatAlpha.3 \ + SDL_DisplayYUVOverlay.3 \ + SDL_EnableKeyRepeat.3 \ + SDL_EnableUNICODE.3 \ + SDL_Event.3 \ + SDL_EventState.3 \ + SDL_FillRect.3 \ + SDL_Flip.3 \ + SDL_FreeCursor.3 \ + SDL_FreeSurface.3 \ + SDL_FreeWAV.3 \ + SDL_FreeYUVOverlay.3 \ + SDL_GL_GetAttribute.3 \ + SDL_GL_GetProcAddress.3 \ + SDL_GL_LoadLibrary.3 \ + SDL_GL_SetAttribute.3 \ + SDL_GL_SwapBuffers.3 \ + SDL_GLattr.3 \ + SDL_GetAppState.3 \ + SDL_GetAudioStatus.3 \ + SDL_GetClipRect.3 \ + SDL_GetCursor.3 \ + SDL_GetEventFilter.3 \ + SDL_GetGamma.3 \ + SDL_GetGammaRamp.3 \ + SDL_GetKeyName.3 \ + SDL_GetKeyState.3 \ + SDL_GetModState.3 \ + SDL_GetMouseState.3 \ + SDL_GetRGB.3 \ + SDL_GetRGBA.3 \ + SDL_GetRelativeMouseState.3 \ + SDL_GetThreadID.3 \ + SDL_GetTicks.3 \ + SDL_GetVideoInfo.3 \ + SDL_GetVideoSurface.3 \ + SDL_Init.3 \ + SDL_InitSubSystem.3 \ + SDL_JoyAxisEvent.3 \ + SDL_JoyBallEvent.3 \ + SDL_JoyButtonEvent.3 \ + SDL_JoyHatEvent.3 \ + SDL_JoystickClose.3 \ + SDL_JoystickEventState.3 \ + SDL_JoystickGetAxis.3 \ + SDL_JoystickGetBall.3 \ + SDL_JoystickGetButton.3 \ + SDL_JoystickGetHat.3 \ + SDL_JoystickIndex.3 \ + SDL_JoystickName.3 \ + SDL_JoystickNumAxes.3 \ + SDL_JoystickNumBalls.3 \ + SDL_JoystickNumButtons.3 \ + SDL_JoystickNumHats.3 \ + SDL_JoystickOpen.3 \ + SDL_JoystickOpened.3 \ + SDL_JoystickUpdate.3 \ + SDL_KeyboardEvent.3 \ + SDL_KillThread.3 \ + SDL_ListModes.3 \ + SDL_LoadBMP.3 \ + SDL_LoadWAV.3 \ + SDL_LockAudio.3 \ + SDL_LockSurface.3 \ + SDL_LockYUVOverlay.3 \ + SDL_MapRGB.3 \ + SDL_MapRGBA.3 \ + SDL_MixAudio.3 \ + SDL_MouseButtonEvent.3 \ + SDL_MouseMotionEvent.3 \ + SDL_NumJoysticks.3 \ + SDL_OpenAudio.3 \ + SDL_Overlay.3 \ + SDL_Palette.3 \ + SDL_PauseAudio.3 \ + SDL_PeepEvents.3 \ + SDL_PixelFormat.3 \ + SDL_PollEvent.3 \ + SDL_PumpEvents.3 \ + SDL_PushEvent.3 \ + SDL_Quit.3 \ + SDL_QuitEvent.3 \ + SDL_QuitSubSystem.3 \ + SDL_RWFromFile.3 \ + SDL_Rect.3 \ + SDL_RemoveTimer.3 \ + SDL_ResizeEvent.3 \ + SDL_SaveBMP.3 \ + SDL_SemPost.3 \ + SDL_SemTryWait.3 \ + SDL_SemValue.3 \ + SDL_SemWait.3 \ + SDL_SemWaitTimeout.3 \ + SDL_SetAlpha.3 \ + SDL_SetClipRect.3 \ + SDL_SetColorKey.3 \ + SDL_SetColors.3 \ + SDL_SetCursor.3 \ + SDL_SetEventFilter.3 \ + SDL_SetGamma.3 \ + SDL_SetGammaRamp.3 \ + SDL_SetModState.3 \ + SDL_SetPalette.3 \ + SDL_SetTimer.3 \ + SDL_SetVideoMode.3 \ + SDL_ShowCursor.3 \ + SDL_Surface.3 \ + SDL_SysWMEvent.3 \ + SDL_ThreadID.3 \ + SDL_UnlockAudio.3 \ + SDL_UnlockSurface.3 \ + SDL_UnlockYUVOverlay.3 \ + SDL_UpdateRect.3 \ + SDL_UpdateRects.3 \ + SDL_UserEvent.3 \ + SDL_VideoDriverName.3 \ + SDL_VideoInfo.3 \ + SDL_VideoModeOK.3 \ + SDL_WM_GetCaption.3 \ + SDL_WM_GrabInput.3 \ + SDL_WM_IconifyWindow.3 \ + SDL_WM_SetCaption.3 \ + SDL_WM_SetIcon.3 \ + SDL_WM_ToggleFullScreen.3 \ + SDL_WaitEvent.3 \ + SDL_WaitThread.3 \ + SDL_WarpMouse.3 \ + SDL_WasInit.3 \ + SDL_keysym.3 \ + SDL_mutexP.3 \ + SDL_mutexV.3 +EXTRA_DIST = $(man_MANS) diff -r 000000000000 -r 74212992fb08 docs/man3/SDLKey.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDLKey.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,161 @@ +.TH "SDLKey" "3" "Wed 11 Oct 2000, 22:28" "SDL" "SDL API Reference" +.SH "NAME" +SDLKey\- SDL Keysym Definitions +.SH "SDL Keysym definitions" +.PP +\fBSDLKey ASCII value Common Name\fR +.nf +\f(CWSDLK_BACKSPACE '\\b' backspace +SDLK_TAB '\\t' tab +SDLK_CLEAR clear +SDLK_RETURN '\\r' return +SDLK_PAUSE pause +SDLK_ESCAPE '^[' escape +SDLK_SPACE ' ' space +SDLK_EXCLAIM '!' exclaim +SDLK_QUOTEDBL '"' quotedbl +SDLK_HASH '#' hash +SDLK_DOLLAR '$' dollar +SDLK_AMPERSAND '&' ampersand +SDLK_QUOTE ''' quote +SDLK_LEFTPAREN '(' left parenthesis +SDLK_RIGHTPAREN ')' right parenthesis +SDLK_ASTERISK '*' asterisk +SDLK_PLUS '+' plus sign +SDLK_COMMA ',' comma +SDLK_MINUS '-' minus sign +SDLK_PERIOD '.' period +SDLK_SLASH '/' forward slash +SDLK_0 '0' 0 +SDLK_1 '1' 1 +SDLK_2 '2' 2 +SDLK_3 '3' 3 +SDLK_4 '4' 4 +SDLK_5 '5' 5 +SDLK_6 '6' 6 +SDLK_7 '7' 7 +SDLK_8 '8' 8 +SDLK_9 '9' 9 +SDLK_COLON ':' colon +SDLK_SEMICOLON ';' semicolon +SDLK_LESS '<' less-than sign +SDLK_EQUALS '=' equals sign +SDLK_GREATER '>' greater-than sign +SDLK_QUESTION '?' question mark +SDLK_AT '@' at +SDLK_LEFTBRACKET '[' left bracket +SDLK_BACKSLASH '\\' backslash +SDLK_RIGHTBRACKET ']' right bracket +SDLK_CARET '^' caret +SDLK_UNDERSCORE '_' underscore +SDLK_BACKQUOTE '`' grave +SDLK_a 'a' a +SDLK_b 'b' b +SDLK_c 'c' c +SDLK_d 'd' d +SDLK_e 'e' e +SDLK_f 'f' f +SDLK_g 'g' g +SDLK_h 'h' h +SDLK_i 'i' i +SDLK_j 'j' j +SDLK_k 'k' k +SDLK_l 'l' l +SDLK_m 'm' m +SDLK_n 'n' n +SDLK_o 'o' o +SDLK_p 'p' p +SDLK_q 'q' q +SDLK_r 'r' r +SDLK_s 's' s +SDLK_t 't' t +SDLK_u 'u' u +SDLK_v 'v' v +SDLK_w 'w' w +SDLK_x 'x' x +SDLK_y 'y' y +SDLK_z 'z' z +SDLK_DELETE '^?' delete +SDLK_KP0 keypad 0 +SDLK_KP1 keypad 1 +SDLK_KP2 keypad 2 +SDLK_KP3 keypad 3 +SDLK_KP4 keypad 4 +SDLK_KP5 keypad 5 +SDLK_KP6 keypad 6 +SDLK_KP7 keypad 7 +SDLK_KP8 keypad 8 +SDLK_KP9 keypad 9 +SDLK_KP_PERIOD '.' keypad period +SDLK_KP_DIVIDE '/' keypad divide +SDLK_KP_MULTIPLY '*' keypad multiply +SDLK_KP_MINUS '-' keypad minus +SDLK_KP_PLUS '+' keypad plus +SDLK_KP_ENTER '\\r' keypad enter +SDLK_KP_EQUALS '=' keypad equals +SDLK_UP up arrow +SDLK_DOWN down arrow +SDLK_RIGHT right arrow +SDLK_LEFT left arrow +SDLK_INSERT insert +SDLK_HOME home +SDLK_END end +SDLK_PAGEUP page up +SDLK_PAGEDOWN page down +SDLK_F1 F1 +SDLK_F2 F2 +SDLK_F3 F3 +SDLK_F4 F4 +SDLK_F5 F5 +SDLK_F6 F6 +SDLK_F7 F7 +SDLK_F8 F8 +SDLK_F9 F9 +SDLK_F10 F10 +SDLK_F11 F11 +SDLK_F12 F12 +SDLK_F13 F13 +SDLK_F14 F14 +SDLK_F15 F15 +SDLK_NUMLOCK numlock +SDLK_CAPSLOCK capslock +SDLK_SCROLLOCK scrollock +SDLK_RSHIFT right shift +SDLK_LSHIFT left shift +SDLK_RCTRL right ctrl +SDLK_LCTRL left ctrl +SDLK_RALT right alt +SDLK_LALT left alt +SDLK_RMETA right meta +SDLK_LMETA left meta +SDLK_LSUPER left windows key +SDLK_RSUPER right windows key +SDLK_MODE mode shift +SDLK_HELP help +SDLK_PRINT print-screen +SDLK_SYSREQ SysRq +SDLK_BREAK break +SDLK_MENU menu +SDLK_POWER power +SDLK_EURO euro\fR +.fi + + +.SH "SDL modifier definitions" +.PP +\fBSDL Modifier Meaning\fR +.nf +\f(CWKMOD_NONE No modifiers applicable +KMOD_NUM Numlock is down +KMOD_CAPS Capslock is down +KMOD_LCTRL Left Control is down +KMOD_RCTRL Right Control is down +KMOD_RSHIFT Right Shift is down +KMOD_LSHIFT Left Shift is down +KMOD_RALT Right Alt is down +KMOD_LALT Left Alt is down +KMOD_CTRL A Control key is down +KMOD_SHIFT A Shift key is down +KMOD_ALT An Alt key is down\fR +.fi + diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_ActiveEvent.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_ActiveEvent.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,38 @@ +.TH "SDL_ActiveEvent" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_ActiveEvent\- Application visibility event structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type; + Uint8 gain; + Uint8 state; +} SDL_ActiveEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_ACTIVEEVENT\&.\fP +.TP 20 +\fBgain\fR +0 if the event is a loss or 1 if it is a gain\&. +.TP 20 +\fBstate\fR +\fBSDL_APPMOUSEFOCUS\fP if mouse focus was gained or lost, \fBSDL_APPINPUTFOCUS\fP if input focus was gained or lost, or \fBSDL_APPACTIVE\fP if the application was iconified (\fBgain\fR=0) or restored(\fBgain\fR=1)\&. +.SH "DESCRIPTION" +.PP +\fBSDL_ActiveEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used when an event of type \fBSDL_ACTIVEEVENT\fP is reported\&. +.PP +When the mouse leaves or enters the window area a \fBSDL_APPMOUSEFOCUS\fP type activation event occurs, if the mouse entered the window then \fBgain\fR will be 1, otherwise \fBgain\fR will be 0\&. A \fBSDL_APPINPUTFOCUS\fP type activation event occurs when the application loses or gains keyboard focus\&. This usually occurs when another application is made active\&. Finally, a \fBSDL_APPACTIVE\fP type event occurs when the application is either minimised/iconified (\fBgain\fR=0) or restored\&. +.PP +.RS +\fBNote: +.PP +This event does not occur when an application window is first created\&. +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_GetAppState\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_AddTimer.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_AddTimer.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,38 @@ +.TH "SDL_AddTimer" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_AddTimer\- Add a timer which will call a callback after the specified number of milliseconds has elapsed\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_TimerID \fBSDL_AddTimer\fP\fR(\fBUint32 interval, SDL_NewTimerCallback callback, void *param\fR); +.SH "CALLBACK" +.PP +.nf +\f(CW/* type definition for the "new" timer callback function */ +typedef Uint32 (*SDL_NewTimerCallback)(Uint32 interval, void *param);\fR +.fi +.PP +.SH "DESCRIPTION" +.PP +Adds a callback function to be run after the specified number of milliseconds has elapsed\&. The callback function is passed the current timer interval and the user supplied parameter from the \fBSDL_AddTimer\fP call and returns the next timer interval\&. If the returned value from the callback is the same as the one passed in, the periodic alarm continues, otherwise a new alarm is scheduled\&. +.PP +To cancel a currently running timer call \fISDL_RemoveTimer\fR with the timer ID returned from \fBSDL_AddTimer\fP\&. +.PP +The timer callback function may run in a different thread than your main program, and so shouldn\&'t call any functions from within itself\&. +.PP +The maximum resolution of this timer is 10 ms, which means that if you request a 16 ms timer, your callback will run approximately 20 ms later on an unloaded system\&. If you wanted to set a flag signaling a frame update at 30 frames per second (every 33 ms), you might set a timer for 30 ms (see example below)\&. If you use this function, you need to pass \fBSDL_INIT_TIMER\fP to \fISDL_Init\fR\&. +.SH "RETURN VALUE" +.PP +Returns an ID value for the added timer or \fBNULL\fR if there was an error\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWmy_timer_id = SDL_AddTimer((33/10)*10, my_callbackfunc, my_callback_param);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_RemoveTimer\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_AudioCVT.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_AudioCVT.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,68 @@ +.TH "SDL_AudioCVT" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_AudioCVT\- Audio Conversion Structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + int needed; + Uint16 src_format; + Uint16 dest_format; + double rate_incr; + Uint8 *buf; + int len; + int len_cvt; + int len_mult; + double len_ratio; + void (*filters[10])(struct SDL_AudioCVT *cvt, Uint16 format); + int filter_index; +} SDL_AudioCVT;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBneeded\fR +Set to one if the conversion is possible +.TP 20 +\fBsrc_format\fR +Audio format of the source +.TP 20 +\fBdest_format\fR +Audio format of the destination +.TP 20 +\fBrate_incr\fR +Rate conversion increment +.TP 20 +\fBbuf\fR +Audio buffer +.TP 20 +\fBlen\fR +Length of the original audio buffer in bytes +.TP 20 +\fBlen_cvt\fR +Length of converted audio buffer in bytes (calculated) +.TP 20 +\fBlen_mult\fR +\fBbuf\fR must be \fBlen\fR*\fBlen_mult\fR bytes in size(calculated) +.TP 20 +\fBlen_ratio\fR +Final audio size is \fBlen\fR*\fBlen_ratio\fR +.TP 20 +\fBfilters[10](\&.\&.)\fR +Pointers to functions needed for this conversion +.TP 20 +\fBfilter_index\fR +Current conversion function +.SH "DESCRIPTION" +.PP +The \fBSDL_AudioCVT\fR is used to convert audio data between different formats\&. A \fBSDL_AudioCVT\fR structure is created with the \fI\fBSDL_BuildAudioCVT\fP\fR function, while the actual conversion is done by the \fI\fBSDL_ConvertAudio\fP\fR function\&. +.PP +Many of the fields in the \fBSDL_AudioCVT\fR structure should be considered private and their function will not be discussed here\&. +.IP "\fBUint8 *\fP\fBbuf\fR" 10This points to the audio data that will be used in the conversion\&. It is both the source and the destination, which means the converted audio data overwrites the original data\&. It also means that the converted data may be larger than the original data (if you were converting from 8-bit to 16-bit, for instance), so you must ensure \fBbuf\fR is large enough\&. See below\&. +.IP "\fBint\fP \fBlen\fR" 10This is the length of the original audio data in bytes\&. +.IP "\fBint\fP \fBlen_mult\fR" 10As explained above, the audio buffer needs to be big enough to store the converted data, which may be bigger than the original audio data\&. The length of \fBbuf\fR should be \fBlen\fR*\fBlen_mult\fR\&. +.IP "\fBdouble\fP \fBlen_ratio\fR" 10When you have finished converting your audio data, you need to know how much of your audio buffer is valid\&. \fBlen\fR*\fBlen_ratio\fR is the size of the converted audio data in bytes\&. This is very similar to \fBlen_mult\fR, however when the convert audio data is shorter than the original \fBlen_mult\fR would be 1\&. \fBlen_ratio\fR, on the other hand, would be a fractional number between 0 and 1\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_BuildAudioCVT\fP\fR, \fI\fBSDL_ConvertAudio\fP\fR, \fI\fBSDL_AudioSpec\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_AudioSpec.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_AudioSpec.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,70 @@ +.TH "SDL_AudioSpec" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_AudioSpec\- Audio Specification Structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + int freq; + Uint16 format; + Uint8 channels; + Uint8 silence; + Uint16 samples; + Uint32 size; + void (*callback)(void *userdata, Uint8 *stream, int len); + void *userdata; +} SDL_AudioSpec;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBfreq\fR +Audio frequency in samples per second +.TP 20 +\fBformat\fR +Audio data format +.TP 20 +\fBchannels\fR +Number of channels: 1 mono, 2 stereo +.TP 20 +\fBsilence\fR +Audio buffer silence value (calculated) +.TP 20 +\fBsamples\fR +Audio buffer size in samples +.TP 20 +\fBsize\fR +Audio buffer size in bytes (calculated) +.TP 20 +\fBcallback(\&.\&.)\fR +Callback function for filling the audio buffer +.TP 20 +\fBuserdata\fR +Pointer the user data which is passed to the callback function +.SH "DESCRIPTION" +.PP +The \fBSDL_AudioSpec\fR structure is used to describe the format of some audio data\&. This structure is used by \fI\fBSDL_OpenAudio\fP\fR and \fI\fBSDL_LoadWAV\fP\fR\&. While all fields are used by \fBSDL_OpenAudio\fP only \fBfreq\fR, \fBformat\fR, \fBsamples\fR and \fBchannels\fR are used by \fBSDL_LoadWAV\fP\&. We will detail these common members here\&. +.TP 20 +\fBfreq\fR +The number of samples sent to the sound device every second\&. Common values are 11025, 22050 and 44100\&. The higher the better\&. +.TP 20 +\fBformat\fR +Specifies the size and type of each sample element +.IP "\fBAUDIO_U8\fP" 10Unsigned 8-bit samples +.IP "\fBAUDIO_S8\fP" 10Signed 8-bit samples +.IP "\fBAUDIO_U16\fP or \fBAUDIO_U16LSB\fP" 10Unsigned 16-bit little-endian samples +.IP "\fBAUDIO_S16\fP or \fBAUDIO_S16LSB\fP" 10Signed 16-bit little-endian samples +.IP "\fBAUDIO_U16MSB\fP" 10Unsigned 16-bit big-endian samples +.IP "\fBAUDIO_S16MSB\fP" 10Signed 16-bit big-endian samples +.IP "\fBAUDIO_U16SYS\fP" 10Either \fBAUDIO_U16LSB\fP or \fBAUDIO_U16MSB\fP depending on you systems endianness +.IP "\fBAUDIO_S16SYS\fP" 10Either \fBAUDIO_S16LSB\fP or \fBAUDIO_S16MSB\fP depending on you systems endianness +.TP 20 +\fBchannels\fR +The number of seperate sound channels\&. 1 is mono (single channel), 2 is stereo (dual channel)\&. +.TP 20 +\fBsamples\fR +When used with \fI\fBSDL_OpenAudio\fP\fR this refers to the size of the audio buffer in samples\&. A sample a chunk of audio data of the size specified in \fBformat\fR mulitplied by the number of channels\&. When the \fBSDL_AudioSpec\fR is used with \fI\fBSDL_LoadWAV\fP\fR \fBsamples\fR is set to 4096\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_OpenAudio\fP\fR, \fI\fBSDL_LoadWAV\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_BlitSurface.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_BlitSurface.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,45 @@ +.TH "SDL_BlitSurface" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_BlitSurface\- This performs a fast blit from the source surface to the destination surface\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_BlitSurface\fP\fR(\fBSDL_Surface *src, SDL_Rect *srcrect, SDL_Surface *dst, SDL_Rect *dstrect\fR); +.SH "DESCRIPTION" +.PP +This performs a fast blit from the source surface to the destination surface\&. +.PP +Only the position is used in the \fBdstrect\fR (the width and height are ignored)\&. +.PP +If either \fBsrcrect\fR or \fBdstrect\fR are \fBNULL\fP, the entire surface (\fBsrc\fR or \fBdst\fR) is copied\&. +.PP +The final blit rectangle is saved in \fBdstrect\fR after all clipping is performed (\fBsrcrect\fR is not modified)\&. +.PP +The blit function should not be called on a locked surface\&. +.PP +.RS +\fBNote: +.PP +The results of blitting operations vary greatly depending on whether \fBSDL_SRCAPLHA\fP is set or not\&. See \fISDL_SetAlpha\fR\&. +.RE +.SH "RETURN VALUE" +.PP +If the blit is successful, it returns \fB0\fR, otherwise it returns \fB-1\fR\&. +.PP +If either of the surfaces were in video memory, and the blit returns \fB-2\fR, the video memory was lost, so it should be reloaded with artwork and re-blitted: +.PP +.nf +\f(CW while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) { + while ( SDL_LockSurface(image)) < 0 ) + Sleep(10); + -- Write image pixels to image->pixels -- + SDL_UnlockSurface(image); + }\fR +.fi +.PP + This happens under DirectX 5\&.0 when the system switches away from your fullscreen application\&. Locking the surface will also fail until you have access to the video memory again\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_LockSurface\fP\fR, \fI\fBSDL_FillRect\fP\fR, \fI\fBSDL_Surface\fR\fR, \fI\fBSDL_Rect\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_BuildAudioCVT.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_BuildAudioCVT.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,23 @@ +.TH "SDL_BuildAudioCVT" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_BuildAudioCVT\- Initializes a SDL_AudioCVT structure for conversion +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_BuildAudioCVT\fP\fR(\fBSDL_AudioCVT *cvt, Uint16 src_format, Uint8 src_channels, int src_rate, Uint16 dst_format, Uint8 dst_channels, int dst_rate\fR); +.SH "DESCRIPTION" +.PP +Before an \fI\fBSDL_AudioCVT\fR\fR structure can be used to convert audio data it must be initialized with source and destination information\&. +.PP +\fBsrc_format\fR and \fBdst_format\fR are the source and destination format of the conversion\&. (For information on audio formats see \fI\fB SDL_AudioSpec\fR\fR)\&. \fBsrc_channels\fR and \fBdst_channels\fR are the number of channels in the source and destination formats\&. Finally, \fBsrc_rate\fR and \fBdst_rate\fR are the frequency or samples-per-second of the source and destination formats\&. Once again, see \fI\fBSDL_AudioSpec\fR\fR\&. +.SH "RETURN VALUES" +.PP +Returns \fB-1\fR if the filter could not be built or 1 if it could\&. +.SH "EXAMPLES" +.PP +See \fI\fBSDL_ConvertAudio\fP\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_ConvertAudio\fP\fR, \fI\fBSDL_AudioCVT\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CD.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CD.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,57 @@ +.TH "SDL_CD" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CD\- CDROM Drive Information +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + int id; + CDstatus status; + int numtracks; + int cur_track; + int cur_frame; + SDL_CDtrack track[SDL_MAX_TRACKS+1]; +} SDL_CD;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBid\fR +Private drive identifier +.TP 20 +\fBstatus\fR +Drive \fIstatus\fR +.TP 20 +\fBnumtracks\fR +Number of tracks on the CD +.TP 20 +\fBcur_track\fR +Current track +.TP 20 +\fBcur_frame\fR +Current frame offset within the track +.TP 20 +\fBtrack\fR[SDL_MAX_TRACKS+1] +Array of track descriptions\&. (see \fI\fBSDL_CDtrack\fR\fR) +.SH "DESCRIPTION" +.PP +An \fBSDL_CD\fR structure is returned by \fI\fBSDL_CDOpen\fP\fR\&. It represents an opened CDROM device and stores information on the layout of the tracks on the disc\&. +.PP +A frame is the base data unit of a CD\&. \fBCD_FPS\fP frames is equal to 1 second of music\&. SDL provides two macros for converting between time and frames: \fBFRAMES_TO_MSF(f, M,S,F)\fP and \fBMSF_TO_FRAMES\fP\&. +.SH "EXAMPLES" +.PP +.nf +\f(CWint min, sec, frame; +int frame_offset; + +FRAMES_TO_MSF(cdrom->cur_frame, &min, &sec, &frame); +printf("Current Position: %d minutes, %d seconds, %d frames +", min, sec, frame); + +frame_offset=MSF_TO_FRAMES(min, sec, frame);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_CDOpen\fP\fR, \fI\fBSDL_CDtrack\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CDClose.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CDClose.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_CDClose" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDClose\- Closes a SDL_CD handle +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_CDClose\fP\fR(\fBSDL_CD *cdrom\fR); +.SH "DESCRIPTION" +.PP +Closes the given \fBcdrom\fR handle\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CDOpen\fP\fR, \fI\fBSDL_CD\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CDEject.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CDEject.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,18 @@ +.TH "SDL_CDEject" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDEject\- Ejects a CDROM +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_CDEject\fP\fR(\fBSDL_CD *cdrom\fR); +.SH "DESCRIPTION" +.PP +Ejects the given \fBcdrom\fR\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on success, or \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CD\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CDName.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CDName.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,23 @@ +.TH "SDL_CDName" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDName\- Returns a human-readable, system-dependent identifier for the CD-ROM\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBconst char *\fBSDL_CDName\fP\fR(\fBint drive\fR); +.SH "DESCRIPTION" +.PP +Returns a human-readable, system-dependent identifier for the CD-ROM\&. \fBdrive\fR is the index of the drive\&. Drive indices start to 0 and end at \fBSDL_CDNumDrives()\fP-1\&. +.SH "EXAMPLES" +.PP +.IP " \(bu" 6 +"/dev/cdrom" +.IP " \(bu" 6 +"E:" +.IP " \(bu" 6 +"/dev/disk/ide/1/master" +.SH "SEE ALSO" +.PP +\fI\fBSDL_CDNumDrives\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CDNumDrives.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CDNumDrives.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_CDNumDrives" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDNumDrives\- Returns the number of CD-ROM drives on the system\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_CDNumDrives\fP\fR(\fBvoid\fR) +.SH "DESCRIPTION" +.PP +Returns the number of CD-ROM drives on the system\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CDOpen\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CDOpen.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CDOpen.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,58 @@ +.TH "SDL_CDOpen" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDOpen\- Opens a CD-ROM drive for access\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_CD *\fBSDL_CDOpen\fP\fR(\fBint drive\fR); +.SH "DESCRIPTION" +.PP +Opens a CD-ROM drive for access\&. It returns a \fI\fBSDL_CD\fR\fR structure on success, or \fBNULL\fP if the drive was invalid or busy\&. This newly opened CD-ROM becomes the default CD used when other CD functions are passed a \fBNULL\fP CD-ROM handle\&. +.PP +Drives are numbered starting with 0\&. Drive 0 is the system default CD-ROM\&. +.SH "EXAMPLES" +.PP +.nf +\f(CWSDL_CD *cdrom; +int cur_track; +int min, sec, frame; +SDL_Init(SDL_INIT_CDROM); +atexit(SDL_Quit); + +/* Check for CD drives */ +if(!SDL_CDNumDrives()){ + /* None found */ + fprintf(stderr, "No CDROM devices available +"); + exit(-1); +} + +/* Open the default drive */ +cdrom=SDL_CDOpen(0); + +/* Did if open? Check if cdrom is NULL */ +if(!cdrom){ + fprintf(stderr, "Couldn\&'t open drive: %s +", SDL_GetError()); + exit(-1); +} + +/* Print Volume info */ +printf("Name: %s +", SDL_CDName(0)); +printf("Tracks: %d +", cdrom->numtracks); +for(cur_track=0;cur_track < cdrom->numtracks; cur_track++){ + FRAMES_TO_MSF(cdrom->track[cur_track]\&.length, &min, &sec, &frame); + printf(" Track %d: Length %d:%d +", cur_track, min, sec); +} + +SDL_CDClose(cdrom);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_CD\fR\fR, \fI\fBSDL_CDtrack\fR\fR, \fI\fBSDL_CDClose\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CDPause.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CDPause.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,18 @@ +.TH "SDL_CDPause" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDPause\- Pauses a CDROM +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_CDPause\fP\fR(\fBSDL_CD *cdrom\fR); +.SH "DESCRIPTION" +.PP +Pauses play on the given \fBcdrom\fR\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on success, or \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CDPlay\fP\fR, \fI\fBSDL_CDResume\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CDPlay.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CDPlay.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,18 @@ +.TH "SDL_CDPlay" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDPlay\- Play a CD +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_CDPlay\fP\fR(\fBSDL_CD *cdrom, int start, int length\fR); +.SH "DESCRIPTION" +.PP +Plays the given \fBcdrom\fR, starting a frame \fBstart\fR for \fBlength\fR frames\&. +.SH "RETURN VALUES" +.PP +Returns \fB0\fR on success, or \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CDPlayTracks\fP\fR, \fI\fBSDL_CDStop\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CDPlayTracks.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CDPlayTracks.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,47 @@ +.TH "SDL_CDPlayTracks" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDPlayTracks\- Play the given CD track(s) +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_CDPlayTracks\fP\fR(\fBSDL_CD *cdrom, int start_track, int start_frame, int ntracks, int nframes)\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_CDPlayTracks\fP plays the given CD starting at track \fBstart_track\fR, for \fBntracks\fR tracks\&. +.PP +\fBstart_frame\fR is the frame offset, from the beginning of the \fBstart_track\fR, at which to start\&. \fBnframes\fR is the frame offset, from the beginning of the last track (\fBstart_track\fR+\fBntracks\fR), at which to end playing\&. +.PP +\fBSDL_CDPlayTracks\fP should only be called after calling \fI\fBSDL_CDStatus\fP\fR to get track information about the CD\&. +.PP +.RS +\fBNote: +.PP +Data tracks are ignored\&. +.RE +.SH "RETURN VALUE" +.PP +Returns \fB0\fR, or \fB-1\fR if there was an error\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CW/* assuming cdrom is a previously opened device */ +/* Play the entire CD */ +if(CD_INDRIVE(SDL_CDStatus(cdrom))) + SDL_CDPlayTracks(cdrom, 0, 0, 0, 0); + +/* Play the first track */ +if(CD_INDRIVE(SDL_CDStatus(cdrom))) + SDL_CDPlayTracks(cdrom, 0, 0, 1, 0); + +/* Play first 15 seconds of the 2nd track */ +if(CD_INDRIVE(SDL_CDStatus(cdrom))) + SDL_CDPlayTracks(cdrom, 1, 0, 0, CD_FPS*15);\fR +.fi +.PP + +.SH "SEE ALSO" +.PP +\fI\fBSDL_CDPlay\fP\fR, \fI\fBSDL_CDStatus\fP\fR, \fI\fBSDL_CD\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CDResume.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CDResume.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,18 @@ +.TH "SDL_CDResume" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDResume\- Resumes a CDROM +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_CDResume\fP\fR(\fBSDL_CD *cdrom\fR); +.SH "DESCRIPTION" +.PP +Resumes play on the given \fBcdrom\fR\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on success, or \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CDPlay\fP\fR, \fI\fBSDL_CDPause\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CDStatus.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CDStatus.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,59 @@ +.TH "SDL_CDStatus" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDStatus\- Returns the current status of the given drive\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBCDstatus \fBSDL_CDStatus\fP\fR(\fBSDL_CD *cdrom\fR); +\fB/* Given a status, returns true if there\&'s a disk in the drive */ +#define CD_INDRIVE(status) ((int)status > 0) +.SH "DESCRIPTION" +.PP +This function returns the current status of the given drive\&. Status is described like so: +.PP +.nf +\f(CWtypedef enum { + CD_TRAYEMPTY, + CD_STOPPED, + CD_PLAYING, + CD_PAUSED, + CD_ERROR = -1 +} CDstatus;\fR +.fi +.PP +.PP +If the drive has a CD in it, the table of contents of the CD and current play position of the CD will be stored in the SDL_CD structure\&. +.PP +The macro \fBCD_INDRIVE\fP is provided for convenience, and given a status returns true if there\&'s a disk in the drive\&. +.PP +.RS +\fBNote: +.PP +\fBSDL_CDStatus\fP also updates the \fI\fBSDL_CD\fR\fR structure passed to it\&. +.RE +.SH "EXAMPLE" +.PP +.nf +\f(CWint playTrack(int track) +{ + int playing = 0; + + if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) { + /* clamp to the actual number of tracks on the CD */ + if (track >= cdrom->numtracks) { + track = cdrom->numtracks-1; + } + + if ( SDL_CDPlayTracks(cdrom, track, 0, 1, 0) == 0 ) { + playing = 1; + } + } + return playing; +}\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_CD\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CDStop.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CDStop.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,18 @@ +.TH "SDL_CDStop" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDStop\- Stops a CDROM +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_CDStop\fP\fR(\fBSDL_CD *cdrom\fR); +.SH "DESCRIPTION" +.PP +Stops play on the given \fBcdrom\fR\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on success, or \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CDPlay\fP\fR, +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CDtrack.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CDtrack.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,40 @@ +.TH "SDL_CDtrack" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CDtrack\- CD Track Information Structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 id; + Uint8 type; + Uint32 length; + Uint32 offset; +} SDL_CDtrack;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBid\fR +Track number (0-99) +.TP 20 +\fBtype\fR +\fBSDL_AUDIO_TRACK\fP or \fBSDL_DATA_TRACK\fP +.TP 20 +\fBlength\fR +Length, in frames, of this track +.TP 20 +\fBoffset\fR +Frame offset to the beginning of this track +.SH "DESCRIPTION" +.PP +\fBSDL_CDtrack\fR stores data on each track on a CD, its fields should be pretty self explainatory\&. It is a member a the \fI\fBSDL_CD\fR\fR structure\&. +.PP +.RS +\fBNote: +.PP +Frames can be converted to standard timings\&. There are \fBCD_FPS\fP frames per second, so \fBSDL_CDtrack\fR\&.\fBlength\fR/\fBCD_FPS\fP=length_in_seconds\&. +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_CD\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CloseAudio.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CloseAudio.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_CloseAudio" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CloseAudio\- Shuts down audio processing and closes the audio device\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_CloseAudio\fP\fR(\fBvoid\fR) +.SH "DESCRIPTION" +.PP +This function shuts down audio processing and closes the audio device\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_OpenAudio\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_Color.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_Color.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,34 @@ +.TH "SDL_Color" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_Color\- Format independent color description +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 r; + Uint8 g; + Uint8 b; + Uint8 unused; +} SDL_Color;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBr\fR +Red intensity +.TP 20 +\fBg\fR +Green intensity +.TP 20 +\fBb\fR +Blue intensity +.TP 20 +\fBunused\fR +Unused +.SH "DESCRIPTION" +.PP +\fBSDL_Color\fR describes a color in a format independent way\&. You can convert a \fBSDL_Color\fR to a pixel value for a certain pixel format using \fI\fBSDL_MapRGB\fP\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_PixelFormat\fR\fR, \fI\fBSDL_SetColors\fP\fR, \fI\fBSDL_Palette\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CondBroadcast.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CondBroadcast.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,16 @@ +.TH "SDL_CondBroadcast" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CondBroadcast\- Restart all threads waiting on a condition variable +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBint \fBSDL_CondBroadcast\fP\fR(\fBSDL_cond *cond\fR); +.SH "DESCRIPTION" +.PP +Restarts all threads that are waiting on the condition variable, \fBcond\fR\&. Returns \fB0\fR on success, or \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CondSignal\fP\fR, \fI\fBSDL_CondWait\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CondSignal.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CondSignal.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,16 @@ +.TH "SDL_CondSignal" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CondSignal\- Restart a thread wait on a condition variable +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBint \fBSDL_CondSignal\fP\fR(\fBSDL_cond *cond\fR); +.SH "DESCRIPTION" +.PP +Restart one of the threads that are waiting on the condition variable, \fBcond\fR\&. Returns \fB0\fR on success of \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CondWait\fP\fR, \fI\fBSDL_CondBroadcast\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CondWait.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CondWait.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,16 @@ +.TH "SDL_CondWait" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CondWait\- Wait on a condition variable +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBint \fBSDL_CondWait\fP\fR(\fBSDL_cond *cond, SDL_mutex *mut\fR); +.SH "DESCRIPTION" +.PP +Wait on the condition variable \fBcond\fR and unlock the provided mutex\&. The mutex must the locked before entering this function\&. Returns \fB0\fR when it is signalled, or \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CondWaitTimeout\fP\fR, \fI\fBSDL_CondSignal\fP\fR, \fI\fBSDL_mutexP\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CondWaitTimeout.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CondWaitTimeout.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,16 @@ +.TH "SDL_CondWaitTimeout" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CondWaitTimeout\- Wait on a condition variable, with timeout +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBint \fBSDL_CondWaitTimeout\fP\fR(\fBSDL_cond *cond, SDL_mutex *mutex, Uint32 ms\fR); +.SH "DESCRIPTION" +.PP +Wait on the condition variable \fBcond\fR for, at most, \fBms\fR milliseconds\&. \fBmut\fR is unlocked so it must be locked when the function is called\&. Returns \fBSDL_MUTEX_TIMEDOUT\fP if the condition is not signalled in the allotted time, \fB0\fR if it was signalled or \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CondWait\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_ConvertAudio.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_ConvertAudio.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,95 @@ +.TH "SDL_ConvertAudio" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_ConvertAudio\- Convert audio data to a desired audio format\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_ConvertAudio\fP\fR(\fBSDL_AudioCVT *cvt\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_ConvertAudio\fP takes one parameter, \fBcvt\fR, which was previously initilized\&. Initilizing a \fI\fBSDL_AudioCVT\fR\fR is a two step process\&. First of all, the structure must be passed to \fI\fBSDL_BuildAudioCVT\fP\fR along with source and destination format parameters\&. Secondly, the \fBcvt\fR->\fBbuf\fR and \fBcvt\fR->\fBlen\fR fields must be setup\&. \fBcvt\fR->\fBbuf\fR should point to the audio data and \fBcvt\fR->\fBlen\fR should be set to the length of the audio data in bytes\&. Remember, the length of the buffer pointed to by \fBbuf\fR show be \fBlen\fR*\fBlen_mult\fR bytes in length\&. +.PP +Once the \fBSDL_AudioCVT\fRstructure is initilized then we can pass it to \fBSDL_ConvertAudio\fP, which will convert the audio data pointer to by \fBcvt\fR->\fBbuf\fR\&. If \fBSDL_ConvertAudio\fP returned \fB0\fR then the conversion was completed successfully, otherwise \fB-1\fR is returned\&. +.PP +If the conversion completed successfully then the converted audio data can be read from \fBcvt\fR->\fBbuf\fR\&. The amount of valid, converted, audio data in the buffer is equal to \fBcvt\fR->\fBlen\fR*\fBcvt\fR->\fBlen_ratio\fR\&. +.SH "EXAMPLES" +.PP +.nf +\f(CW/* Converting some WAV data to hardware format */ +void my_audio_callback(void *userdata, Uint8 *stream, int len); + +SDL_AudioSpec *desired, *obtained; +SDL_AudioSpec wav_spec; +SDL_AudioCVT wav_cvt; +Uint32 wav_len; +Uint8 *wav_buf; +int ret; + +/* Allocated audio specs */ +desired=(SDL_AudioSpec *)malloc(sizeof(SDL_AudioSpec)); +obtained=(SDL_AudioSpec *)malloc(sizeof(SDL_AudioSpec)); + +/* Set desired format */ +desired->freq=22050; +desired->format=AUDIO_S16LSB; +desired->samples=8192; +desired->callback=my_audio_callback; +desired->userdata=NULL; + +/* Open the audio device */ +if ( SDL_OpenAudio(desired, obtained) < 0 ){ + fprintf(stderr, "Couldn\&'t open audio: %s +", SDL_GetError()); + exit(-1); +} + +free(desired); + +/* Load the test\&.wav */ +if( SDL_LoadWAV("test\&.wav", &wav_spec, &wav_buf, &wav_len) == NULL ){ + fprintf(stderr, "Could not open test\&.wav: %s +", SDL_GetError()); + SDL_CloseAudio(); + free(obtained); + exit(-1); +} + +/* Build AudioCVT */ +ret = SDL_BuildAudioCVT(&wav_cvt, + wav_spec\&.format, wav_spec\&.channels, wav_spec\&.freq, + obtained->format, obtained->channels, obtained->freq); + +/* Check that the convert was built */ +if(ret==-1){ + fprintf(stderr, "Couldn\&'t build converter! +"); + SDL_CloseAudio(); + free(obtained); + SDL_FreeWAV(wav_buf); +} + +/* Setup for conversion */ +wav_cvt\&.buf=(Uint8 *)malloc(wav_len*wav_cvt\&.len_mult); +wav_cvt\&.len=wav_len; +memcpy(wav_cvt\&.buf, wav_buf, wav_len); + +/* We can delete to original WAV data now */ +SDL_FreeWAV(wav_buf); + +/* And now we\&'re ready to convert */ +SDL_ConvertAudio(&wav_cvt); + +/* do whatever */ +\&. +\&. +\&. +\&. + +\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_BuildAudioCVT\fP\fR, \fI\fBSDL_AudioCVT\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_ConvertSurface.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_ConvertSurface.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,22 @@ +.TH "SDL_ConvertSurface" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_ConvertSurface\- Converts a surface to the same format as another surface\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Surface *\fBSDL_ConvertSurface\fP\fR(\fBSDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags\fR); +.SH "DESCRIPTION" +.PP +Creates a new surface of the specified format, and then copies and maps the given surface to it\&. If this function fails, it returns \fBNULL\fP\&. +.PP +The \fBflags\fR parameter is passed to \fI\fBSDL_CreateRGBSurface\fP\fR and has those semantics\&. +.PP +This function is used internally by \fI\fBSDL_DisplayFormat\fP\fR\&. +.SH "RETURN VALUE" +.PP +Returns either a pointer to the new surface, or \fBNULL\fP on error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateRGBSurface\fP\fR, \fI\fBSDL_DisplayFormat\fP\fR, \fI\fBSDL_PixelFormat\fR\fR, \fI\fBSDL_Surface\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CreateCond.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CreateCond.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,31 @@ +.TH "SDL_CreateCond" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CreateCond\- Create a condition variable +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBSDL_cond *\fBSDL_CreateCond\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +Creates a condition variable\&. +.SH "EXAMPLES" +.PP +.nf +\f(CWSDL_cond *cond; + +cond=SDL_CreateCond(); +\&. +\&. +/* Do stuff */ + +\&. +\&. +SDL_DestroyCond(cond);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_DestroyCond\fP\fR, \fI\fBSDL_CondWait\fP\fR, \fI\fBSDL_CondSignal\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CreateCursor.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CreateCursor.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,120 @@ +.TH "SDL_CreateCursor" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CreateCursor\- Creates a new mouse cursor\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Cursor *\fBSDL_CreateCursor\fP\fR(\fBUint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y\fR); +.SH "DESCRIPTION" +.PP +Create a cursor using the specified \fBdata\fR and \fBmask\fR (in MSB format)\&. The cursor width must be a multiple of 8 bits\&. +.PP +The cursor is created in black and white according to the following: +.TP 20 +\fBData / Mask\fR +\fBResulting pixel on screen\fR +.TP 20 +0 / 1 +White +.TP 20 +1 / 1 +Black +.TP 20 +0 / 0 +Transparent +.TP 20 +1 / 0 +Inverted color if possible, black if not\&. +.PP +Cursors created with this function must be freed with \fISDL_FreeCursor\fR\&. +.SH "EXAMPLE" +.PP +.nf +\f(CW/* Stolen from the mailing list */ +/* Creates a new mouse cursor from an XPM */ + + +/* XPM */ +static const char *arrow[] = { + /* width height num_colors chars_per_pixel */ + " 32 32 3 1", + /* colors */ + "X c #000000", + "\&. c #ffffff", + " c None", + /* pixels */ + "X ", + "XX ", + "X\&.X ", + "X\&.\&.X ", + "X\&.\&.\&.X ", + "X\&.\&.\&.\&.X ", + "X\&.\&.\&.\&.\&.X ", + "X\&.\&.\&.\&.\&.\&.X ", + "X\&.\&.\&.\&.\&.\&.\&.X ", + "X\&.\&.\&.\&.\&.\&.\&.\&.X ", + "X\&.\&.\&.\&.\&.XXXXX ", + "X\&.\&.X\&.\&.X ", + "X\&.X X\&.\&.X ", + "XX X\&.\&.X ", + "X X\&.\&.X ", + " X\&.\&.X ", + " X\&.\&.X ", + " X\&.\&.X ", + " XX ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + " ", + "0,0" +}; + +static SDL_Cursor *init_system_cursor(const char *image[]) +{ + int i, row, col; + Uint8 data[4*32]; + Uint8 mask[4*32]; + int hot_x, hot_y; + + i = -1; + for ( row=0; row<32; ++row ) { + for ( col=0; col<32; ++col ) { + if ( col % 8 ) { + data[i] <<= 1; + mask[i] <<= 1; + } else { + ++i; + data[i] = mask[i] = 0; + } + switch (image[4+row][col]) { + case \&'X\&': + data[i] |= 0x01; + k[i] |= 0x01; + break; + case \&'\&.\&': + mask[i] |= 0x01; + break; + case \&' \&': + break; + } + } + } + sscanf(image[4+row], "%d,%d", &hot_x, &hot_y); + return SDL_CreateCursor(data, mask, 32, 32, hot_x, hot_y); +}\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_FreeCursor\fP\fR, \fI\fBSDL_SetCursor\fP\fR, \fI\fBSDL_ShowCursor\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CreateMutex.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CreateMutex.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,43 @@ +.TH "SDL_CreateMutex" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CreateMutex\- Create a mutex +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBSDL_mutex *\fBSDL_CreateMutex\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +Create a new, unlocked mutex\&. +.SH "EXAMPLES" +.PP +.nf +\f(CWSDL_mutex *mut; + +mut=SDL_CreateMutex(); +\&. +\&. +if(SDL_mutexP(mut)==-1){ + fprintf(stderr, "Couldn\&'t lock mutex +"); + exit(-1); +} +\&. +/* Do stuff while mutex is locked */ +\&. +\&. +if(SDL_mutexV(mut)==-1){ + fprintf(stderr, "Couldn\&'t unlock mutex +"); + exit(-1); +} + +SDL_DestroyMutex(mut); +\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_mutexP\fP\fR, \fI\fBSDL_mutexV\fP\fR, \fI\fBSDL_DestroyMutex\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CreateRGBSurface.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CreateRGBSurface.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,29 @@ +.TH "SDL_CreateRGBSurface" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CreateRGBSurface\- Create an empty SDL_Surface +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Surface *\fBSDL_CreateRGBSurface\fP\fR(\fBUint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask\fR); +.SH "DESCRIPTION" +.PP +Allocate an empty surface (must be called after \fISDL_SetVideoMode\fR) +.PP +If \fBdepth\fR is 8 bits an empty palette is allocated for the surface, otherwise a \&'packed-pixel\&' \fI\fBSDL_PixelFormat\fR\fR is created using the \fB[RGBA]mask\fR\&'s provided (see \fI\fBSDL_PixelFormat\fR\fR)\&. The \fBflags\fR specifies the type of surface that should be created, it is an OR\&'d combination of the following possible values\&. +.TP 20 +\fBSDL_SWSURFACE\fP +SDL will create the surface in system memory\&. This improves the performance of pixel level access, however you may not be able to take advantage of some types of hardware blitting\&. +.TP 20 +\fBSDL_HWSURFACE\fP +SDL will attempt to create the surface in video memory\&. This will allow SDL to take advantage of Video->Video blits (which are often accelerated)\&. +.TP 20 +\fBSDL_SRCCOLORKEY\fP +With this flag SDL will attempt to find the best location for this surface, either in system memory or video memory, to obtain hardware colorkey blitting support\&. +.TP 20 +\fBSDL_SRCALPHA\fP +With this flag SDL will attempt to find the best location for this surface, either in system memory or video memory, to obtain hardware alpha support +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateRGBSurfaceFrom\fP\fR, \fI\fBSDL_FreeSurface\fP\fR, \fI\fBSDL_SetVideoMode\fP\fR, \fI\fBSDL_LockSurface\fP\fR, \fI\fBSDL_PixelFormat\fR\fR, \fI\fBSDL_Surface\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CreateRGBSurfaceFrom.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CreateRGBSurfaceFrom.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,19 @@ +.TH "SDL_CreateRGBSurfaceFrom" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CreateRGBSurfaceFrom\- Create an SDL_Surface from pixel data +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Surface *\fBSDL_CreateRGBSurfaceFrom\fP\fR(\fBvoid *pixels, int width, int height, int depth, int pitch, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask\fR); +.SH "DESCRIPTION" +.PP +Creates an SDL_Surface from the provided pixel data\&. +.PP +The data stored in \fBpixels\fR is assumed to be of the \fBdepth\fR specified in the parameter list\&. The pixel data is not copied into the \fBSDL_Surface\fR structure so it should no be freed until the surface has been freed with a called to \fISDL_FreeSurface\fR\&. \fBpitch\fR is the length of each scanline in bytes\&. +.PP +See \fI\fBSDL_CreateRGBSurface\fP\fR for a more detailed description of the other parameters\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateRGBSurface\fP\fR, \fI\fBSDL_FreeSurface\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CreateSemaphore.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CreateSemaphore.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,32 @@ +.TH "SDL_CreateSemaphore" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CreateSemaphore\- Creates a new semaphore and assigns an initial value to it\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBSDL_sem *\fBSDL_CreateSemaphore\fP\fR(\fBUint32 initial_value\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_CreateSemaphore()\fP creates a new semaphore and initializes it with the value \fBinitial_value\fR\&. Each locking operation on the semaphore by \fISDL_SemWait\fR, \fISDL_SemTryWait\fR or \fISDL_SemWaitTimeout\fR will atomically decrement the semaphore value\&. The locking operation will be blocked if the semaphore value is not positive (greater than zero)\&. Each unlock operation by \fISDL_SemPost\fR will atomically increment the semaphore value\&. +.SH "RETURN VALUE" +.PP +Returns a pointer to an initialized semaphore or \fBNULL\fR if there was an error\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWSDL_sem *my_sem; + +my_sem = SDL_CreateSemaphore(INITIAL_SEM_VALUE); + +if (my_sem == NULL) { + return CREATE_SEM_FAILED; +}\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_DestroySemaphore\fP\fR, \fI\fBSDL_SemWait\fP\fR, \fI\fBSDL_SemTryWait\fP\fR, \fI\fBSDL_SemWaitTimeout\fP\fR, \fI\fBSDL_SemPost\fP\fR, \fI\fBSDL_SemValue\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CreateThread.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CreateThread.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,16 @@ +.TH "SDL_CreateThread" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CreateThread\- Creates a new thread of execution that shares its parent\&'s properties\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBSDL_Thread *\fBSDL_CreateThread\fP\fR(\fBint (*fn)(void *), void *data\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_CreateThread\fP creates a new thread of execution that shares all of its parent\&'s global memory, signal handlers, file descriptors, etc, and runs the function \fBfn\fR passed the void pointer \fBdata\fR The thread quits when this function returns\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_KillThread\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_CreateYUVOverlay.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_CreateYUVOverlay.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,17 @@ +.TH "SDL_CreateYUVOverlay" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_CreateYUVOverlay\- Create a YUV video overlay +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Overlay *\fBSDL_CreateYUVOverlay\fP\fR(\fBint width, int height, Uint32 format, SDL_Surface *display\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_CreateYUVOverlay\fP creates a YUV overlay of the specified \fBwidth\fR, \fBheight\fR and \fBformat\fR (see \fI\fBSDL_Overlay\fR\fR for a list of available formats), for the provided \fBdisplay\fR\&. A \fI\fBSDL_Overlay\fR\fR structure is returned\&. +.PP +The term \&'overlay\&' is a misnomer since, unless the overlay is created in hardware, the contents for the display surface underneath the area where the overlay is shown will be overwritten when the overlay is displayed\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Overlay\fR\fR, \fI\fBSDL_DisplayYUVOverlay\fP\fR, \fI\fBSDL_FreeYUVOverlay\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_Delay.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_Delay.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_Delay" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_Delay\- Wait a specified number of milliseconds before returning\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_Delay\fP\fR(\fBUint32 ms\fR); +.SH "DESCRIPTION" +.PP +Wait a specified number of milliseconds before returning\&. \fBSDL_Delay\fP will wait at \fIleast\fP the specified time, but possible longer due to OS scheduling\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_AddTimer\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_DestroyCond.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_DestroyCond.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,16 @@ +.TH "SDL_DestroyCond" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_DestroyCond\- Destroy a condition variable +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBvoid \fBSDL_DestroyCond\fP\fR(\fBSDL_cond *cond\fR); +.SH "DESCRIPTION" +.PP +Destroys a condition variable\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateCond\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_DestroyMutex.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_DestroyMutex.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,16 @@ +.TH "SDL_DestroyMutex" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_DestroyMutex\- Destroy a mutex +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBvoid \fBSDL_DestroyMutex\fP\fR(\fBSDL_mutex *mutex\fR); +.SH "DESCRIPTION" +.PP +Destroy a previously \fIcreated\fR mutex\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateMutex\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_DestroySemaphore.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_DestroySemaphore.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,26 @@ +.TH "SDL_DestroySemaphore" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_DestroySemaphore\- Destroys a semaphore that was created by \fISDL_CreateSemaphore\fR\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBvoid \fBSDL_DestroySemaphore\fP\fR(\fBSDL_sem *sem\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_DestroySemaphore\fP destroys the semaphore pointed to by \fBsem\fR that was created by \fI\fBSDL_CreateSemaphore\fP\fR\&. It is not safe to destroy a semaphore if there are threads currently blocked waiting on it\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWif (my_sem != NULL) { + SDL_DestroySemaphore(my_sem); + my_sem = NULL; +}\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateSemaphore\fP\fR, \fI\fBSDL_SemWait\fP\fR, \fI\fBSDL_SemTryWait\fP\fR, \fI\fBSDL_SemWaitTimeout\fP\fR, \fI\fBSDL_SemPost\fP\fR, \fI\fBSDL_SemValue\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_DisplayFormat.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_DisplayFormat.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,22 @@ +.TH "SDL_DisplayFormat" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_DisplayFormat\- Convert a surface to the display format +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Surface *\fBSDL_DisplayFormat\fP\fR(\fBSDL_Surface *surface\fR); +.SH "DESCRIPTION" +.PP +This function takes a surface and copies it to a new surface of the pixel format and colors of the video framebuffer, suitable for fast blitting onto the display surface\&. It calls \fISDL_ConvertSurface\fR +.PP +If you want to take advantage of hardware colorkey or alpha blit acceleration, you should set the colorkey and alpha value before calling this function\&. +.PP +If you want an alpha channel, see \fISDL_DisplayFormatAlpha\fR\&. +.SH "RETURN VALUE" +.PP +If the conversion fails or runs out of memory, it returns \fBNULL\fR +.SH "SEE ALSO" +.PP +\fI\fBSDL_ConvertSurface\fP\fR, \fI\fBSDL_DisplayFormatAlpha\fP\fR \fI\fBSDL_SetAlpha\fP\fR, \fI\fBSDL_SetColorKey\fP\fR, \fI\fBSDL_Surface\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_DisplayFormatAlpha.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_DisplayFormatAlpha.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,20 @@ +.TH "SDL_DisplayFormatAlpha" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_DisplayFormatAlpha\- Convert a surface to the display format +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Surface *\fBSDL_DisplayFormatAlpha\fP\fR(\fBSDL_Surface *surface\fR); +.SH "DESCRIPTION" +.PP +This function takes a surface and copies it to a new surface of the pixel format and colors of the video framebuffer plus an alpha channel, suitable for fast blitting onto the display surface\&. It calls \fISDL_ConvertSurface\fR +.PP +If you want to take advantage of hardware colorkey or alpha blit acceleration, you should set the colorkey and alpha value before calling this function\&. +.SH "RETURN VALUE" +.PP +If the conversion fails or runs out of memory, it returns \fBNULL\fR +.SH "SEE ALSO" +.PP +\fISDL_ConvertSurface\fR, \fISDL_SetAlpha\fR, \fISDL_SetColorKey\fR, \fISDL_DisplayFormat\fR, \fISDL_Surface\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_DisplayYUVOverlay.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_DisplayYUVOverlay.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_DisplayYUVOverlay" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_DisplayYUVOverlay\- Blit the overlay to the display +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_DisplayYUVOverlay\fP\fR(\fBSDL_Overlay *overlay, SDL_Rect *dstrect\fR); +.SH "DESCRIPTION" +.PP +Blit the \fBoverlay\fR to the surface specified when it was \fIcreated\fR\&. The \fI\fBSDL_Rect\fR\fR structure, \fBdstrect\fR, specifies the position and size of the destination\&. If the \fBdstrect\fR is a larger or smaller than the overlay then the overlay will be scaled, this is optimized for 2x scaling\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Overlay\fR\fR, \fI\fBSDL_CreateYUVOverlay\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_EnableKeyRepeat.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_EnableKeyRepeat.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,17 @@ +.TH "SDL_EnableKeyRepeat" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_EnableKeyRepeat\- Set keyboard repeat rate\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_EnableKeyRepeat\fP\fR(\fBint delay, int interval\fR); +.SH "DESCRIPTION" +.PP +Enables or disables the keyboard repeat rate\&. \fBdelay\fR specifies how long the key must be pressed before it begins repeating, it then repeats at the speed specified by \fBinterval\fR\&. Both \fBdelay\fR and \fBinterval\fR are expressed in milliseconds\&. +.PP +Setting \fBdelay\fR to 0 disables key repeating completely\&. Good default values are \fBSDL_DEFAULT_REPEAT_DELAY\fP and \fISDL_DEFAULT_REPEAT_INTERVAL\fP\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on success and \fB-1\fR on failure\&. +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_EnableUNICODE.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_EnableUNICODE.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,20 @@ +.TH "SDL_EnableUNICODE" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_EnableUNICODE\- Enable UNICODE translation +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_EnableUNICODE\fP\fR(\fBint enable\fR); +.SH "DESCRIPTION" +.PP +Enables/Disables UNICODE keyboard translation\&. +.PP +If you wish to translate a keysym to it\&'s printable representation, you need to enable UNICODE translation using this function (\fBenable\fR=0) and then look in the \fBunicode\fR member of the \fI\fBSDL_keysym\fR\fR structure\&. This value will be zero for keysyms that do not have a printable representation\&. UNICODE translation is disabled by default as the conversion can cause a slight overhead\&. +.SH "RETURN VALUE" +.PP +Returns the previous translation mode\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_keysym\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_Event.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_Event.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,175 @@ +.TH "SDL_Event" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_Event\- General event structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef union{ + Uint8 type; + SDL_ActiveEvent active; + SDL_KeyboardEvent key; + SDL_MouseMotionEvent motion; + SDL_MouseButtonEvent button; + SDL_JoyAxisEvent jaxis; + SDL_JoyBallEvent jball; + SDL_JoyHatEvent jhat; + SDL_JoyButtonEvent jbutton; + SDL_ResizeEvent resize; + SDL_QuitEvent quit; + SDL_UserEvent user; + SDL_SywWMEvent syswm; +} SDL_Event;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +The type of event +.TP 20 +\fBactive\fR +\fIActivation event\fR +.TP 20 +\fBkey\fR +\fIKeyboard event\fR +.TP 20 +\fBmotion\fR +\fIMouse motion event\fR +.TP 20 +\fBbutton\fR +\fIMouse button event\fR +.TP 20 +\fBjaxis\fR +\fIJoystick axis motion event\fR +.TP 20 +\fBjball\fR +\fIJoystick trackball motion event\fR +.TP 20 +\fBjhat\fR +\fIJoystick hat motion event\fR +.TP 20 +\fBjbutton\fR +\fIJoystick button event\fR +.TP 20 +\fBresize\fR +\fIApplication window resize event\fR +.TP 20 +\fBquit\fR +\fIApplication quit request event\fR +.TP 20 +\fBuser\fR +\fIUser defined event\fR +.TP 20 +\fBsyswm\fR +\fIUndefined window manager event\fR +.SH "DESCRIPTION" +.PP +The \fBSDL_Event\fR union is the core to all event handling is SDL, its probably the most important structure after \fBSDL_Surface\fR\&. \fBSDL_Event\fR is a union of all event structures used in SDL, using it is a simple matter of knowing which union member relates to which event \fBtype\fR\&. +.PP +.TP 20 +\fBEvent \fBtype\fR\fR +\fBEvent Structure\fR +.TP 20 +\fBSDL_ACTIVEEVENT\fP +\fI\fBSDL_ActiveEvent\fR\fR +.TP 20 +\fBSDL_KEYDOWN/UP\fP +\fI\fBSDL_KeyboardEvent\fR\fR +.TP 20 +\fBSDL_MOUSEMOTION\fP +\fI\fBSDL_MouseMotionEvent\fR\fR +.TP 20 +\fBSDL_MOUSEBUTTONDOWN/UP\fP +\fI\fBSDL_MouseButtonEvent\fR\fR +.TP 20 +\fBSDL_JOYAXISMOTION\fP +\fI\fBSDL_JoyAxisEvent\fR\fR +.TP 20 +\fBSDL_JOYBALLMOTION\fP +\fI\fBSDL_JoyBallEvent\fR\fR +.TP 20 +\fBSDL_JOYHATMOTION\fP +\fI\fBSDL_JoyHatEvent\fR\fR +.TP 20 +\fBSDL_JOYBUTTONDOWN/UP\fP +\fI\fBSDL_JoyButtonEvent\fR\fR +.TP 20 +\fBSDL_QUIT\fP +\fI\fBSDL_QuitEvent\fR\fR +.TP 20 +\fBSDL_SYSWMEVENT\fP +\fI\fBSDL_SysWMEvent\fR\fR +.TP 20 +\fBSDL_VIDEORESIZE\fP +\fI\fBSDL_ResizeEvent\fR\fR +.TP 20 +\fBSDL_USEREVENT\fP +\fI\fBSDL_UserEvent\fR\fR +.SH "USE" +.PP +The \fBSDL_Event\fR structure has two uses +.IP " \(bu" 6 +Reading events on the event queue +.IP " \(bu" 6 +Placing events on the event queue +.PP +Reading events from the event queue is done with either \fI\fBSDL_PollEvent\fP\fR or \fI\fBSDL_PeepEvents\fP\fR\&. We\&'ll use \fBSDL_PollEvent\fP and step through an example\&. +.PP +First off, we create an empty \fBSDL_Event\fR structure\&. +.PP +.nf +\f(CWSDL_Event test_event;\fR +.fi +.PP + \fBSDL_PollEvent\fP removes the next event from the event queue, if there are no events on the queue it returns \fB0\fR otherwise it returns \fB1\fR\&. We use a \fBwhile\fP loop to process each event in turn\&. +.PP +.nf +\f(CWwhile(SDL_PollEvent(&test_event)) {\fR +.fi +.PP + The \fBSDL_PollEvent\fP function take a pointer to an \fBSDL_Event\fR structure that is to be filled with event information\&. We know that if \fBSDL_PollEvent\fP removes an event from the queue then the event information will be placed in our \fBtest_event\fR structure, but we also know that the \fItype\fP of event will be placed in the \fBtype\fR member of \fBtest_event\fR\&. So to handle each event \fBtype\fR seperately we use a \fBswitch\fP statement\&. +.PP +.nf +\f(CW switch(test_event\&.type) {\fR +.fi +.PP + We need to know what kind of events we\&'re looking for \fIand\fP the event \fBtype\fR\&'s of those events\&. So lets assume we want to detect where the user is moving the mouse pointer within our application\&. We look through our event types and notice that \fBSDL_MOUSEMOTION\fP is, more than likely, the event we\&'re looking for\&. A little \fImore\fR research tells use that \fBSDL_MOUSEMOTION\fP events are handled within the \fI\fBSDL_MouseMotionEvent\fR\fR structure which is the \fBmotion\fR member of \fBSDL_Event\fR\&. We can check for the \fBSDL_MOUSEMOTION\fP event \fBtype\fR within our \fBswitch\fP statement like so: +.PP +.nf +\f(CW case SDL_MOUSEMOTION:\fR +.fi +.PP + All we need do now is read the information out of the \fBmotion\fR member of \fBtest_event\fR\&. +.PP +.nf +\f(CW printf("We got a motion event\&. +"); + printf("Current mouse position is: (%d, %d) +", test_event\&.motion\&.x, test_event\&.motion\&.y); + break; + default: + printf("Unhandled Event! +"); + break; + } +} +printf("Event queue empty\&. +");\fR +.fi +.PP +.PP +It is also possible to push events onto the event queue and so use it as a two-way communication path\&. Both \fI\fBSDL_PushEvent\fP\fR and \fI\fBSDL_PeepEvents\fP\fR allow you to place events onto the event queue\&. This is usually used to place a \fBSDL_USEREVENT\fP on the event queue, however you could use it to post fake input events if you wished\&. Creating your own events is a simple matter of choosing the event type you want, setting the \fBtype\fR member and filling the appropriate member structure with information\&. +.PP +.nf +\f(CWSDL_Event user_event; + +user_event\&.type=SDL_USEREVENT; +user_event\&.user\&.code=2; +user_event\&.user\&.data1=NULL; +user_event\&.user\&.data2=NULL; +SDL_PushEvent(&user_event);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_PollEvent\fP\fR, \fI\fBSDL_PushEvent\fP\fR, \fI\fBSDL_PeepEvents\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_EventState.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_EventState.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,23 @@ +.TH "SDL_EventState" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_EventState\- This function allows you to set the state of processing certain events\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint8 \fBSDL_EventState\fP\fR(\fBUint8 type, int state\fR); +.SH "DESCRIPTION" +.PP +This function allows you to set the state of processing certain event \fBtype\fR\&'s\&. +.PP +If \fBstate\fR is set to \fBSDL_IGNORE\fP, that event \fBtype\fR will be automatically dropped from the event queue and will not be filtered\&. +.PP +If \fBstate\fR is set to \fBSDL_ENABLE\fP, that event \fBtype\fR will be processed normally\&. +.PP +If \fBstate\fR is set to \fBSDL_QUERY\fP, \fBSDL_EventState\fP will return the current processing state of the specified event \fBtype\fR\&. +.PP +A list of event \fBtype\fR\&'s can be found in the \fI\fBSDL_Event\fR\fR section\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_FillRect.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_FillRect.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,22 @@ +.TH "SDL_FillRect" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_FillRect\- This function performs a fast fill of the given rectangle with some color +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_FillRect\fP\fR(\fBSDL_Surface *dst, SDL_Rect *dstrect, Uint32 color\fR); +.SH "DESCRIPTION" +.PP +This function performs a fast fill of the given rectangle with \fBcolor\fR\&. If \fBdstrect\fR is \fBNULL\fP, the whole surface will be filled with \fBcolor\fR\&. +.PP +The color should be a pixel of the format used by the surface, and can be generated by the \fISDL_MapRGB\fR function\&. +.PP +If there is a clip rectangle set on the destination (set via \fISDL_SetClipRect\fR) then this function will clip based on the intersection of the clip rectangle and the \fBdstrect\fR rectangle\&. +.SH "RETURN VALUE" +.PP +This function returns \fB0\fR on success, or \fB-1\fR on error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_MapRGB\fP\fR, \fI\fBSDL_BlitSurface\fP\fR, \fI\fBSDL_Rect\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_Flip.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_Flip.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,20 @@ +.TH "SDL_Flip" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_Flip\- Swaps screen buffers +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_Flip\fP\fR(\fBSDL_Surface *screen\fR); +.SH "DESCRIPTION" +.PP +On hardware that supports double-buffering, this function sets up a flip and returns\&. The hardware will wait for vertical retrace, and then swap video buffers before the next video surface blit or lock will return\&. On hardware that doesn\&'t support double-buffering, this is equivalent to calling \fISDL_UpdateRect\fR\fB(screen, 0, 0, 0, 0)\fR +.PP +The \fBSDL_DOUBLEBUF\fP flag must have been passed to \fISDL_SetVideoMode\fR, when setting the video mode for this function to perform hardware flipping\&. +.SH "RETURN VALUE" +.PP +This function returns \fB0\fR if successful, or \fB-1\fR if there was an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_SetVideoMode\fP\fR, \fI\fBSDL_UpdateRect\fP\fR, \fI\fBSDL_Surface\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_FreeCursor.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_FreeCursor.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_FreeCursor" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_FreeCursor\- Frees a cursor created with SDL_CreateCursor\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_FreeCursor\fP\fR(\fBSDL_Cursor *cursor\fR); +.SH "DESCRIPTION" +.PP +Frees a \fBSDL_Cursor\fR that was created using \fISDL_CreateCursor\fR\&. +.SH "SEE ALSO" +.PP +\fISDL_CreateCursor\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_FreeSurface.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_FreeSurface.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_FreeSurface" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_FreeSurface\- Frees (deletes) and SDL_Surface +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_FreeSurface\fP\fR(\fBSDL_Surface *surface\fR); +.SH "DESCRIPTION" +.PP +Frees the resources used by a previously created \fBSDL_Surface\fR\&. If the surface was created using \fISDL_CreateRGBSurfaceFrom\fR then the pixel data is not freed\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateRGBSurface\fP\fR \fI\fBSDL_CreateRGBSurfaceFrom\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_FreeWAV.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_FreeWAV.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_FreeWAV" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_FreeWAV\- Frees previously opened WAV data +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_FreeWAV\fP\fR(\fBUint8 *audio_buf\fR); +.SH "DESCRIPTION" +.PP +After a WAVE file has been opened with \fI\fBSDL_LoadWAV\fP\fR its data can eventually be freed with \fBSDL_FreeWAV\fP\&. \fBaudio_buf\fR is a pointer to the buffer created by \fBSDL_LoadWAV\fP\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_LoadWAV\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_FreeYUVOverlay.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_FreeYUVOverlay.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_FreeYUVOverlay" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_FreeYUVOverlay\- Free a YUV video overlay +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_FreeYUVOverlay\fP\fR(\fBSDL_Overlay *overlay\fR); +.SH "DESCRIPTION" +.PP +Frees and \fI\fBoverlay\fR\fR created by \fI\fBSDL_CreateYUVOverlay\fP\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Overlay\fR\fR, \fI\fBSDL_DisplayYUVOverlay\fP\fR, \fI\fBSDL_FreeYUVOverlay\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GL_GetAttribute.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GL_GetAttribute.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,18 @@ +.TH "SDL_GL_GetAttribute" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GL_GetAttribute\- Get the value of a special SDL/OpenGL attribute +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_GL_GetAttribute\fP\fR(\fBSDLGLattr attr, int *value\fR); +.SH "DESCRIPTION" +.PP +Places the value of the SDL/OpenGL \fIattribute\fR \fBattr\fR into \fBvalue\fR\&. This is useful after a call to \fI\fBSDL_SetVideoMode\fP\fR to check whether your attributes have been \fIset\fR as you expected\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on success, or \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_GL_SetAttribute\fP\fR, \fIGL Attributes\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GL_GetProcAddress.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GL_GetProcAddress.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,48 @@ +.TH "SDL_GL_GetProcAddress" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GL_GetProcAddress\- Get the address of a GL function +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid *\fBSDL_GL_GetProcAddress\fP\fR(\fBconst char* proc\fR); +.SH "DESCRIPTION" +.PP +Returns the address of the GL function \fBproc\fR, or \fBNULL\fR if the function is not found\&. If the GL library is loaded at runtime, with \fI\fBSDL_GL_LoadLibrary\fP\fR, then \fIall\fP GL functions must be retrieved this way\&. Usually this is used to retrieve function pointers to OpenGL extensions\&. +.SH "EXAMPLE" +.PP +.nf +\f(CWtypedef void (*GL_ActiveTextureARB_Func)(unsigned int); +GL_ActiveTextureARB_Func glActiveTextureARB_ptr = 0; +int has_multitexture=1; +\&. +\&. +\&. +/* Get function pointer */ +glActiveTextureARB_ptr=(GL_ActiveTextureARB_Func) SDL_GL_GetProcAddress("glActiveTextureARB"); + +/* Check for a valid function ptr */ +if(!glActiveTextureARB_ptr){ + fprintf(stderr, "Multitexture Extensions not present\&. +"); + has_multitexture=0; +} +\&. +\&. +\&. +\&. +if(has_multitexture){ + glActiveTextureARB_ptr(GL_TEXTURE0_ARB); + \&. + \&. +} +else{ + \&. + \&. +}\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_GL_LoadLibrary\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GL_LoadLibrary.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GL_LoadLibrary.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_GL_LoadLibrary" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GL_LoadLibrary\- Specify an OpenGL library +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_GL_LoadLibrary\fP\fR(\fBconst char *path\fR); +.SH "DESCRIPTION" +.PP +If you wish, you may load the OpenGL library at runtime, this must be done before \fI\fBSDL_SetVideoMode\fP\fR is called\&. The \fBpath\fR of the GL library is passed to \fBSDL_GL_LoadLibrary\fP and it returns \fB0\fR on success, or \fB-1\fR on an error\&. You must then use \fI\fBSDL_GL_GetProcAddress\fP\fR to retrieve function pointers to GL functions\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_GL_GetProcAddress\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GL_SetAttribute.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GL_SetAttribute.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,40 @@ +.TH "SDL_GL_SetAttribute" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GL_SetAttribute\- Set a special SDL/OpenGL attribute +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_GL_SetAttribute\fP\fR(\fBSDL_GLattr attr, int value\fR); +.SH "DESCRIPTION" +.PP +Sets the OpenGL \fIattribute\fR \fBattr\fR to \fBvalue\fR\&. The attributes you set don\&'t take effect until after a call to \fI\fBSDL_SetVideoMode\fP\fR\&. You should use \fI\fBSDL_GL_GetAttribute\fP\fR to check the values after a \fBSDL_SetVideoMode\fP call\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on success, or \fB-1\fR on error\&. +.SH "EXAMPLE" +.PP +.nf +\f(CWSDL_GL_SetAttribute( SDL_GL_RED_SIZE, 5 ); +SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 5 ); +SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 5 ); +SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); +SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); +if ( (screen=SDL_SetVideoMode( 640, 480, 16, SDL_OPENGL )) == NULL ) { + fprintf(stderr, "Couldn\&'t set GL mode: %s +", SDL_GetError()); + SDL_Quit(); + return; +}\fR +.fi +.PP +.PP +.RS +\fBNote: +.PP +The \fBSDL_DOUBLEBUF\fP flag is not required to enable double buffering when setting an OpenGL video mode\&. Double buffering is enabled or disabled using the SDL_GL_DOUBLEBUFFER attribute\&. +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_GL_GetAttribute\fP\fR, \fIGL Attributes\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GL_SwapBuffers.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GL_SwapBuffers.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_GL_SwapBuffers" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GL_SwapBuffers\- Swap OpenGL framebuffers/Update Display +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_GL_SwapBuffers\fP\fR(\fBvoid \fR); +.SH "DESCRIPTION" +.PP +Swap the OpenGL buffers, if double-buffering is supported\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_SetVideoMode\fP\fR, \fI\fBSDL_GL_SetAttribute\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GLattr.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GLattr.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,47 @@ +.TH "SDL_GLattr" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GLattr\- SDL GL Attributes +.SH "ATTRIBUTES" +.TP 20 +\fBSDL_GL_RED_SIZE\fP +Size of the framebuffer red component, in bits +.TP 20 +\fBSDL_GL_GREEN_SIZE\fP +Size of the framebuffer green component, in bits +.TP 20 +\fBSDL_GL_BLUE_SIZE\fP +Size of the framebuffer blue component, in bits +.TP 20 +\fBSDL_GL_ALPHA_SIZE\fP +Size of the framebuffer alpha component, in bits +.TP 20 +\fBSDL_GL_DOUBLEBUFFER\fP +0 or 1, enable or disable double buffering +.TP 20 +\fBSDL_GL_BUFFER_SIZE\fP +Size of the framebuffer, in bits +.TP 20 +\fBSDL_GL_DEPTH_SIZE\fP +Size of the depth buffer, in bits +.TP 20 +\fBSDL_GL_STENCIL_SIZE\fP +Size of the stencil buffer, in bits +.TP 20 +\fBSDL_GL_ACCUM_RED_SIZE\fP +Size of the accumulation buffer red component, in bits +.TP 20 +\fBSDL_GL_ACCUM_GREEN_SIZE\fP +Size of the accumulation buffer green component, in bits +.TP 20 +\fBSDL_GL_ACCUM_BLUE_SIZE\fP +Size of the accumulation buffer blue component, in bits +.TP 20 +\fBSDL_GL_ACCUM_ALPHA_SIZE\fP +Size of the accumulation buffer alpha component, in bits +.SH "DESCRIPTION" +.PP +While you can set most OpenGL attributes normally, the attributes list above must be known \fIbefore\fP SDL sets the video mode\&. These attributes a set and read with \fI\fBSDL_GL_SetAttribute\fP\fR and \fI\fBSDL_GL_GetAttribute\fP\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_GL_SetAttribute\fP\fR, \fI\fBSDL_GL_GetAttribute\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GetAppState.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GetAppState.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,24 @@ +.TH "SDL_GetAppState" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +\fBSDL_GetAppState\fP\- Get the state of the application +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint8 \fBSDL_GetAppState\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +This function returns the current state of the application\&. The value returned is a bitwise combination of: +.TP 20 +\fBSDL_APPMOUSEFOCUS\fP +The application has mouse focus\&. +.TP 20 +\fBSDL_APPINPUTFOCUS\fP +The application has keyboard focus +.TP 20 +\fBSDL_APPACTIVE\fP +The application is visible +.SH "SEE ALSO" +.PP +\fI\fBSDL_ActiveEvent\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GetAudioStatus.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GetAudioStatus.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,24 @@ +.TH "SDL_GetAudioStatus" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetAudioStatus\- Get the current audio state +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_audiostatus\fBSDL_GetAudioStatus\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +.nf +\f(CWtypedef enum{ + SDL_AUDIO_STOPPED, + SDL_AUDIO_PAUSED, + SDL_AUDIO_PLAYING +} SDL_audiostatus;\fR +.fi +.PP +.PP +Returns either \fBSDL_AUDIO_STOPPED\fP, \fBSDL_AUDIO_PAUSED\fP or \fBSDL_AUDIO_PLAYING\fP depending on the current audio state\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_PauseAudio\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GetClipRect.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GetClipRect.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,17 @@ +.TH "SDL_GetClipRect" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetClipRect\- Gets the clipping rectangle for a surface\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_GetClipRect\fP\fR(\fBSDL_Surface *surface, SDL_Rect *rect\fR); +.SH "DESCRIPTION" +.PP +Gets the clipping rectangle for a surface\&. When this surface is the destination of a blit, only the area within the clip rectangle is drawn into\&. +.PP +The rectangle pointed to by \fBrect\fR will be filled with the clipping rectangle of the surface\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_SetClipRect\fP\fR, \fI\fBSDL_BlitSurface\fP\fR, \fI\fBSDL_Surface\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GetCursor.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GetCursor.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_GetCursor" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetCursor\- Get the currently active mouse cursor\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Cursor *\fBSDL_GetCursor\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +Returns the currently active mouse cursor\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_SetCursor\fP\fR, \fI\fBSDL_CreateCursor\fP\fR, \fI\fBSDL_ShowCursor\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GetEventFilter.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GetEventFilter.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,23 @@ +.TH "SDL_GetEventFilter" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetEventFilter\- Retrieves a pointer to he event filter +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_EventFilter \fBSDL_GetEventFilter\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +This function retrieces a pointer to the event filter that was previously set using \fI\fBSDL_SetEventFilter\fP\fR\&. An SDL_EventFilter function is defined as: +.PP +.nf +\f(CWtypedef int (*SDL_EventFilter)(const SDL_Event *event);\fR +.fi +.PP +.SH "RETURN VALUE" +.PP +Returns a pointer to the event filter or \fBNULL\fP if no filter has been set\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_SetEventFilter\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GetGamma.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GetGamma.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,21 @@ +.TH "SDL_GetGamma" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetGamma\- Gets the gamma of the display +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_GetGamma\fP\fR(\fBfloat *red, float *green, float *blue\fR); +.SH "DESCRIPTION" +.PP +Gets the color gamma of the display\&. The gamma value for each color component will be place in the parameters \fBred\fR, \fBgreen\fR and \fBblue\fR\&. The values can range from 0\&.1 to 10\&. +.PP +.RS +\fBNote: +.PP +This function currently only works on XFreee 4\&.0 and up\&. +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_SetGamma\fP\fR, \fI\fBSDL_SetVideoMode\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GetGammaRamp.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GetGammaRamp.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,20 @@ +.TH "SDL_GetGammaRamp" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetGammaRamp\- Gets the color gamma lookup tables for the display +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_GetGammaRamp\fP\fR(\fBUint16 *redtable, Uint16 *greentable, Uint16 *bluetable\fR); +.SH "DESCRIPTION" +.PP +Gets the gamma translation lookup tables currently used by the display\&. Each table is an array of 256 Uint16 values\&. +.PP +Not all display hardware is able to change gamma\&. +.SH "RETURN VALUE" +.PP +Returns -1 on error\&. +.SH "SEE ALSO" +.PP +\fISDL_SetGamma\fR \fISDL_SetGammaRamp\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GetKeyName.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GetKeyName.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_GetKeyName" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetKeyName\- Get the name of an SDL virtual keysym +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBchar *\fBSDL_GetKeyName\fP\fR(\fBSDLKey key\fR); +.SH "DESCRIPTION" +.PP +Returns the SDL-defined name of the \fI\fBSDLKey\fR\fR \fBkey\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDLKey\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GetKeyState.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GetKeyState.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,30 @@ +.TH "SDL_GetKeyState" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetKeyState\- Get a snapshot of the current keyboard state +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint8 *\fBSDL_GetKeyState\fP\fR(\fBint *numkeys\fR); +.SH "DESCRIPTION" +.PP +Gets a snapshot of the current keyboard state\&. The current state is return as a pointer to an array, the size of this array is stored in \fBnumkeys\fR\&. The array is indexed by the \fI\fBSDLK_*\fP\fR symbols\&. A value of 1 means the key is pressed and a value of 0 means its not\&. +.PP +.RS +\fBNote: +.PP +Use \fI\fBSDL_PumpEvents\fP\fR to update the state array\&. +.RE +.SH "EXAMPLE" +.PP +.PP +.nf +\f(CWUint8 *keystate = SDL_GetKeyState(NULL); +if ( keystate[SDLK_RETURN] ) printf("Return Key Pressed\&. +");\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL Key Symbols\fP\fR, \fI\fBSDL_PumpEvents\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GetModState.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GetModState.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,54 @@ +.TH "SDL_GetModState" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetModState\- Get the state of modifier keys\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDLMod \fBSDL_GetModState\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +Returns the current of the modifier keys (CTRL, ALT, etc\&.)\&. +.SH "RETURN VALUE" +.PP +The return value can be an OR\&'d combination of the SDLMod enum\&. +.PP +.PP +.RS +\fBSDLMod\fR +.PP +.PP +.nf +\f(CWtypedef enum { + KMOD_NONE = 0x0000, + KMOD_LSHIFT= 0x0001, + KMOD_RSHIFT= 0x0002, + KMOD_LCTRL = 0x0040, + KMOD_RCTRL = 0x0080, + KMOD_LALT = 0x0100, + KMOD_RALT = 0x0200, + KMOD_LMETA = 0x0400, + KMOD_RMETA = 0x0800, + KMOD_NUM = 0x1000, + KMOD_CAPS = 0x2000, + KMOD_MODE = 0x4000, +} SDLMod;\fR +.fi +.PP +.RE + SDL also defines the following symbols for convenience: +.PP +.RS +.PP +.nf +\f(CW#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL) +#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT) +#define KMOD_ALT (KMOD_LALT|KMOD_RALT) +#define KMOD_META (KMOD_LMETA|KMOD_RMETA)\fR +.fi +.PP +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_GetKeyState\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GetMouseState.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GetMouseState.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,24 @@ +.TH "SDL_GetMouseState" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetMouseState\- Retrieve the current state of the mouse +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint8 \fBSDL_GetMouseState\fP\fR(\fBint *x, int *y\fR); +.SH "DESCRIPTION" +.PP +The current button state is returned as a button bitmask, which can be tested using the \fBSDL_BUTTON(X)\fP macros, and \fBx\fR and \fBy\fR are set to the current mouse cursor position\&. You can pass \fBNULL\fP for either \fBx\fR or \fBy\fR\&. +.SH "EXAMPLE" +.PP +.nf +\f(CWSDL_PumpEvents(); +if(SDL_GetMouseState(NULL, NULL)&SDL_BUTTON(1)) + printf("Mouse Button 1(left) is pressed\&. +");\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_GetRelativeMouseState\fP\fR, \fI\fBSDL_PumpEvents\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GetRGB.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GetRGB.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,17 @@ +.TH "SDL_GetRGB" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetRGB\- Get RGB values from a pixel in the specified pixel format\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_GetRGB\fP\fR(\fBUint32 pixel, SDL_PixelFormat *fmt, Uint8 *r, Uint8 *g, Uint8 *b\fR); +.SH "DESCRIPTION" +.PP +Get RGB component values from a pixel stored in the specified pixel format\&. +.PP +This function uses the entire 8-bit [0\&.\&.255] range when converting color components from pixel formats with less than 8-bits per RGB component (e\&.g\&., a completely white pixel in 16-bit RGB565 format would return [0xff, 0xff, 0xff] not [0xf8, 0xfc, 0xf8])\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_GetRGBA\fP\fR, \fI\fBSDL_MapRGB\fP\fR, \fI\fBSDL_MapRGBA\fP\fR, \fI\fBSDL_PixelFormat\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GetRGBA.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GetRGBA.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,19 @@ +.TH "SDL_GetRGBA" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetRGBA\- Get RGBA values from a pixel in the specified pixel format\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_GetRGBA\fP\fR(\fBUint32 pixel, SDL_PixelFormat *fmt, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a\fR); +.SH "DESCRIPTION" +.PP +Get RGBA component values from a pixel stored in the specified pixel format\&. +.PP +This function uses the entire 8-bit [0\&.\&.255] range when converting color components from pixel formats with less than 8-bits per RGB component (e\&.g\&., a completely white pixel in 16-bit RGB565 format would return [0xff, 0xff, 0xff] not [0xf8, 0xfc, 0xf8])\&. +.PP +If the surface has no alpha component, the alpha will be returned as 0xff (100% opaque)\&. +.SH "SEE ALSO" +.PP +\fISDL_GetRGB\fR, \fISDL_MapRGB\fR, \fISDL_MapRGBA\fR, \fISDL_PixelFormat\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GetRelativeMouseState.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GetRelativeMouseState.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_GetRelativeMouseState" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetRelativeMouseState\- Retrieve the current state of the mouse +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint8 \fBSDL_GetRelativeMouseState\fP\fR(\fBint *x, int *y\fR); +.SH "DESCRIPTION" +.PP +The current button state is returned as a button bitmask, which can be tested using the \fBSDL_BUTTON(X)\fP macros, and \fBx\fR and \fBy\fR are set to the change in the mouse position since the last call to \fBSDL_GetRelativeMouseState\fP or since event initialization\&. You can pass \fBNULL\fP for either \fBx\fR or \fBy\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_GetMouseState\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GetThreadID.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GetThreadID.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,16 @@ +.TH "SDL_GetThreadID" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetThreadID\- Get the SDL thread ID of a SDL_Thread +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBUint32 \fBSDL_GetThreadID\fP\fR(\fBSDL_Thread *thread\fR); +.SH "DESCRIPTION" +.PP +Returns the ID of a \fBSDL_Thread\fR created by \fISDL_CreateThread\fR\&. +.SH "SEE ALSO" +.PP +\fISDL_CreateThread\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GetTicks.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GetTicks.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_GetTicks" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetTicks\- Get the number of milliseconds since the SDL library initialization\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint32 \fBSDL_GetTicks\fP\fR(\fBvoid\fR) +.SH "DESCRIPTION" +.PP +Get the number of milliseconds since the SDL library initialization\&. Note that this value wraps if the program runs for more than ~49 days\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Delay\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GetVideoInfo.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GetVideoInfo.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_GetVideoInfo" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetVideoInfo\- returns a pointer to information about the video hardware +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_VideoInfo *\fBSDL_GetVideoInfo\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +This function returns a read-only pointer to \fIinformation\fR about the video hardware\&. If this is called before \fISDL_SetVideoMode\fR, the \fBvfmt\fR member of the returned structure will contain the pixel format of the "best" video mode\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_SetVideoMode\fP\fR, \fI\fBSDL_VideoInfo\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_GetVideoSurface.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_GetVideoSurface.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_GetVideoSurface" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_GetVideoSurface\- returns a pointer to the current display surface +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Surface *\fBSDL_GetVideoSurface\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +This function returns a pointer to the current display surface\&. If SDL is doing format conversion on the display surface, this function returns the publicly visible surface, not the real video surface\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Surface\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_Init.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_Init.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,41 @@ +.TH "SDL_Init" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_Init\- Initializes SDL +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_Init\fP\fR(\fBUint32 flags\fR); +.SH "DESCRIPTION" +.PP +Initializes SDL\&. This should be called before all other SDL functions\&. The \fBflags\fR parameter specifies what part(s) of SDL to initialize\&. +.TP 20 +\fBSDL_INIT_TIMER\fP +Initializes the \fItimer\fR subsystem\&. +.TP 20 +\fBSDL_INIT_AUDIO\fP +Initializes the \fIaudio\fR subsystem\&. +.TP 20 +\fBSDL_INIT_VIDEO\fP +Initializes the \fIvideo\fR subsystem\&. +.TP 20 +\fBSDL_INIT_CDROM\fP +Initializes the \fIcdrom\fR subsystem\&. +.TP 20 +\fBSDL_INIT_JOYSTICK\fP +Initializes the \fIjoystick\fR subsystem\&. +.TP 20 +\fBSDL_INIT_EVERYTHING\fP +Initialize all of the above\&. +.TP 20 +\fBSDL_INIT_NOPARACHUTE\fP +Prevents SDL from catching fatal signals\&. +.TP 20 +\fBSDL_INIT_EVENTTHREAD\fP +.SH "RETURN VALUE" +.PP +Returns \fB-1\fR on an error or \fB0\fR on success\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Quit\fP\fR, \fI\fBSDL_InitSubSystem\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_InitSubSystem.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_InitSubSystem.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,41 @@ +.TH "SDL_InitSubSystem" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_InitSubSystem\- Initialize subsystems +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_InitSubSystem\fP\fR(\fBUint32 flags\fR); +.SH "DESCRIPTION" +.PP +After SDL has been initialized with \fI\fBSDL_Init\fP\fR you may initialize uninitialized subsystems with \fBSDL_InitSubSystem\fP\&. The \fBflags\fR parameter is the same as that used in \fI\fBSDL_Init\fP\fR\&. +.SH "EXAMPLES" +.PP +.nf +\f(CW/* Seperating Joystick and Video initialization\&. */ +SDL_Init(SDL_INIT_VIDEO); +\&. +\&. +SDL_SetVideoMode(640, 480, 16, SDL_DOUBLEBUF|SDL_FULLSCREEN); +\&. +/* Do Some Video stuff */ +\&. +\&. +/* Initialize the joystick subsystem */ +SDL_InitSubSystem(SDL_INIT_JOYSTICK); + +/* Do some stuff with video and joystick */ +\&. +\&. +\&. +/* Shut them both down */ +SDL_Quit();\fR +.fi +.PP +.SH "RETURN VALUE" +.PP +Returns \fB-1\fR on an error or \fB0\fR on success\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Init\fP\fR, \fI\fBSDL_Quit\fP\fR, \fI\fBSDL_QuitSubSystem\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_JoyAxisEvent.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_JoyAxisEvent.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,36 @@ +.TH "SDL_JoyAxisEvent" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoyAxisEvent\- Joystick axis motion event structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type; + Uint8 which; + Uint8 axis; + Sint16 value; +} SDL_JoyAxisEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_JOYAXISMOTION\fP +.TP 20 +\fBwhich\fR +Joystick device index +.TP 20 +\fBaxis\fR +Joystick axis index +.TP 20 +\fBvalue\fR +Axis value (range: -32768 to 32767) +.SH "DESCRIPTION" +.PP +\fBSDL_JoyAxisEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used when an event of type \fBSDL_JOYAXISMOTION\fP is reported\&. +.PP +A \fBSDL_JOYAXISMOTION\fP event occurs when ever a user moves an axis on the joystick\&. The field \fBwhich\fR is the index of the joystick that reported the event and \fBaxis\fR is the index of the axis (for a more detailed explaination see the \fIJoystick section\fR)\&. \fBvalue\fR is the current position of the axis\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fIJoystick Functions\fR, \fI\fBSDL_JoystickEventState\fP\fR, \fI\fBSDL_JoystickGetAxis\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_JoyBallEvent.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_JoyBallEvent.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,36 @@ +.TH "SDL_JoyBallEvent" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoyBallEvent\- Joystick trackball motion event structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type; + Uint8 which; + Uint8 ball; + Sint16 xrel, yrel; +} SDL_JoyBallEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_JOYBALLMOTION\fP +.TP 20 +\fBwhich\fR +Joystick device index +.TP 20 +\fBball\fR +Joystick trackball index +.TP 20 +\fBxrel\fR, \fByrel\fR +The relative motion in the X/Y direction +.SH "DESCRIPTION" +.PP +\fBSDL_JoyBallEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used when an event of type \fBSDL_JOYBALLMOTION\fP is reported\&. +.PP +A \fBSDL_JOYBALLMOTION\fP event occurs when a user moves a trackball on the joystick\&. The field \fBwhich\fR is the index of the joystick that reported the event and \fBball\fR is the index of the trackball (for a more detailed explaination see the \fIJoystick section\fR)\&. Trackballs only return relative motion, this is the change in position on the ball since it was last polled (last cycle of the event loop) and it is stored in \fBxrel\fR and \fByrel\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fIJoystick Functions\fR, \fI\fBSDL_JoystickEventState\fP\fR, \fI\fBSDL_JoystickGetBall\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_JoyButtonEvent.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_JoyButtonEvent.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,36 @@ +.TH "SDL_JoyButtonEvent" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoyButtonEvent\- Joystick button event structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type; + Uint8 which; + Uint8 button; + Uint8 state; +} SDL_JoyButtonEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_JOYBUTTONDOWN\fP or \fBSDL_JOYBUTTONUP\fP +.TP 20 +\fBwhich\fR +Joystick device index +.TP 20 +\fBbutton\fR +Joystick button index +.TP 20 +\fBstate\fR +\fBSDL_PRESSED\fP or \fBSDL_RELEASED\fP +.SH "DESCRIPTION" +.PP +\fBSDL_JoyButtonEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used when an event of type \fBSDL_JOYBUTTONDOWN\fP or \fBSDL_JOYBUTTONUP\fP is reported\&. +.PP +A \fBSDL_JOYBUTTONDOWN\fP or \fBSDL_JOYBUTTONUP\fP event occurs when ever a user presses or releases a button on a joystick\&. The field \fBwhich\fR is the index of the joystick that reported the event and \fBbutton\fR is the index of the button (for a more detailed explaination see the \fIJoystick section\fR)\&. \fBstate\fR is the current state or the button which is either \fBSDL_PRESSED\fP or \fBSDL_RELEASED\fP\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fIJoystick Functions\fR, \fI\fBSDL_JoystickEventState\fP\fR, \fI\fBSDL_JoystickGetButton\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_JoyHatEvent.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_JoyHatEvent.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,56 @@ +.TH "SDL_JoyHatEvent" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoyHatEvent\- Joystick hat position change event structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type; + Uint8 which; + Uint8 hat; + Uint8 value; +} SDL_JoyHatEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_JOY\fP +.TP 20 +\fBwhich\fR +Joystick device index +.TP 20 +\fBhat\fR +Joystick hat index +.TP 20 +\fBvalue\fR +Hat position +.SH "DESCRIPTION" +.PP +\fBSDL_JoyHatEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used when an event of type \fBSDL_JOYHATMOTION\fP is reported\&. +.PP +A \fBSDL_JOYHATMOTION\fP event occurs when ever a user moves a hat on the joystick\&. The field \fBwhich\fR is the index of the joystick that reported the event and \fBhat\fR is the index of the hat (for a more detailed exlaination see the \fIJoystick section\fR)\&. \fBvalue\fR is the current position of the hat\&. It is a logically OR\&'d combination of the following values (whose meanings should be pretty obvious:) : +.IP "" 10 +\fBSDL_HAT_CENTERED\fP +.IP "" 10 +\fBSDL_HAT_UP\fP +.IP "" 10 +\fBSDL_HAT_RIGHT\fP +.IP "" 10 +\fBSDL_HAT_DOWN\fP +.IP "" 10 +\fBSDL_HAT_LEFT\fP +.PP +The following defines are also provided: +.IP "" 10 +\fBSDL_HAT_RIGHTUP\fP +.IP "" 10 +\fBSDL_HAT_RIGHTDOWN\fP +.IP "" 10 +\fBSDL_HAT_LEFTUP\fP +.IP "" 10 +\fBSDL_HAT_LEFTDOWN\fP +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fIJoystick Functions\fR, \fI\fBSDL_JoystickEventState\fP\fR, \fI\fBSDL_JoystickGetHat\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_JoystickClose.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_JoystickClose.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_JoystickClose" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoystickClose\- Closes a previously opened joystick +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_JoystickClose\fP\fR(\fBSDL_Joystick *joystick\fR); +.SH "DESCRIPTION" +.PP +Close a \fBjoystick\fR that was previously opened with \fI\fBSDL_JoystickOpen\fP\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_JoystickOpen\fP\fR, \fI\fBSDL_JoystickOpened\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_JoystickEventState.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_JoystickEventState.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,24 @@ +.TH "SDL_JoystickEventState" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoystickEventState\- Enable/disable joystick event polling +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_JoystickEventState\fP\fR(\fBint state\fR); +.SH "DESCRIPTION" +.PP +This function is used to enable or disable joystick event processing\&. With joystick event processing disabled you will have to update joystick states with \fI\fBSDL_JoystickUpdate\fP\fR and read the joystick information manually\&. \fBstate\fR is either \fBSDL_QUERY\fP, \fBSDL_ENABLE\fP or \fBSDL_IGNORE\fP\&. +.PP +.RS +\fBNote: +.PP +Joystick event handling is prefered +.RE +.SH "RETURN VALUE" +.PP +If \fBstate\fR is \fBSDL_QUERY\fP then the current state is returned, otherwise the new processing \fBstate\fR is returned\&. +.SH "SEE ALSO" +.PP +\fISDL Joystick Functions\fR, \fI\fBSDL_JoystickUpdate\fP\fR, \fI\fBSDL_JoyAxisEvent\fR\fR, \fI\fBSDL_JoyBallEvent\fR\fR, \fI\fBSDL_JoyButtonEvent\fR\fR, \fI\fBSDL_JoyHatEvent\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_JoystickGetAxis.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_JoystickGetAxis.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,32 @@ +.TH "SDL_JoystickGetAxis" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoystickGetAxis\- Get the current state of an axis +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSint16 \fBSDL_JoystickGetAxis\fP\fR(\fBSDL_Joystick *joystick, int axis\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_JoystickGetAxis\fP returns the current state of the given \fBaxis\fR on the given \fBjoystick\fR\&. +.PP +On most modern joysticks the X axis is usually represented by \fBaxis\fR 0 and the Y axis by \fBaxis\fR 1\&. The value returned by \fBSDL_JoystickGetAxis\fP is a signed integer (-32768 to 32768) representing the current position of the \fBaxis\fR, it maybe necessary to impose certain tolerances on these values to account for jitter\&. It is worth noting that some joysticks use axes 2 and 3 for extra buttons\&. +.SH "RETURN VALUE" +.PP +Returns a 16-bit signed integer representing the current position of the \fBaxis\fR\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWSint16 x_move, y_move; +SDL_Joystick *joy1; +\&. +\&. +x_move=SDL_JoystickGetAxis(joy1, 0); +y_move=SDL_JoystickGetAxis(joy1, 1);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_JoystickNumAxes\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_JoystickGetBall.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_JoystickGetBall.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,37 @@ +.TH "SDL_JoystickGetBall" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoystickGetBall\- Get relative trackball motion +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_JoystickGetBall\fP\fR(\fBSDL_Joystick *joystick, int ball, int *dx, int *dy\fR); +.SH "DESCRIPTION" +.PP +Get the \fBball\fR axis change\&. +.PP +Trackballs can only return relative motion since the last call to \fBSDL_JoystickGetBall\fP, these motion deltas a placed into \fBdx\fR and \fBdy\fR\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on success or \fB-1\fR on failure +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWint delta_x, delta_y; +SDL_Joystick *joy; +\&. +\&. +\&. +SDL_JoystickUpdate(); +if(SDL_JoystickGetBall(joy, 0, &delta_x, &delta_y)==-1) + printf("TrackBall Read Error! +"); +printf("Trackball Delta- X:%d, Y:%d +", delta_x, delta_y);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_JoystickNumBalls\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_JoystickGetButton.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_JoystickGetButton.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,18 @@ +.TH "SDL_JoystickGetButton" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoystickGetButton\- Get the current state of a given button on a given joystick +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint8 \fBSDL_JoystickGetButton\fP\fR(\fBSDL_Joystick *joystick, int button\fR); +.SH "DESCRIPTION" +.PP +SDL_JoystickGetButton returns the current state of the given \fBbutton\fR on the given \fBjoystick\fR\&. +.SH "RETURN VALUE" +.PP +\fB1\fR if the button is pressed\&. Otherwise, \fB0\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_JoystickNumButtons\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_JoystickGetHat.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_JoystickGetHat.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,36 @@ +.TH "SDL_JoystickGetHat" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoystickGetHat\- Get the current state of a joystick hat +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint8 \fBSDL_JoystickGetHat\fP\fR(\fBSDL_Joystick *joystick, int hat\fR); +.SH "DESCRIPTION" +.PP +SDL_JoystickGetHat returns the current state of the given \fBhat\fR on the given \fBjoystick\fR\&. +.SH "RETURN VALUE" +.PP +The current state is returned as a Uint8 which is defined as an OR\&'d combination of one or more of the following +.IP "" 10 +\fBSDL_HAT_CENTERED\fP +.IP "" 10 +\fBSDL_HAT_UP\fP +.IP "" 10 +\fBSDL_HAT_RIGHT\fP +.IP "" 10 +\fBSDL_HAT_DOWN\fP +.IP "" 10 +\fBSDL_HAT_LEFT\fP +.IP "" 10 +\fBSDL_HAT_RIGHTUP\fP +.IP "" 10 +\fBSDL_HAT_RIGHTDOWN\fP +.IP "" 10 +\fBSDL_HAT_LEFTUP\fP +.IP "" 10 +\fBSDL_HAT_LEFTDOWN\fP +.SH "SEE ALSO" +.PP +\fI\fBSDL_JoystickNumHats\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_JoystickIndex.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_JoystickIndex.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,18 @@ +.TH "SDL_JoystickIndex" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoystickIndex\- Get the index of an SDL_Joystick\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_JoystickIndex\fP\fR(\fBSDL_Joystick *joystick\fR); +.SH "DESCRIPTION" +.PP +Returns the index of a given \fBSDL_Joystick\fR structure\&. +.SH "RETURN VALUE" +.PP +Index number of the joystick\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_JoystickOpen\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_JoystickName.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_JoystickName.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,32 @@ +.TH "SDL_JoystickName" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoystickName\- Get joystick name\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBconst char *\fBSDL_JoystickName\fP\fR(\fBint index\fR); +.SH "DESCRIPTION" +.PP +Get the implementation dependent name of joystick\&. The \fBindex\fR parameter refers to the N\&'th joystick on the system\&. +.SH "RETURN VALUE" +.PP +Returns a char pointer to the joystick name\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CW/* Print the names of all attached joysticks */ +int num_joy, i; +num_joy=SDL_NumJoysticks(); +printf("%d joysticks found +", num_joy); +for(i=0;i0){ + // Open joystick + joy=SDL_JoystickOpen(0); + + if(joy) + { + printf("Opened Joystick 0 +"); + printf("Name: %s +", SDL_JoystickName(0)); + printf("Number of Axes: %s +", SDL_JoystickNumAxes(joy)); + printf("Number of Buttons: %s +", SDL_JoystickNumButtons(joy)); + printf("Number of Balls: %s +", SDL_JoystickNumBalls(joy)); + } + else + printf("Couldn\&'t open Joystick 0 +"); + + // Close if opened + if(SDL_JoystickOpened(0)) + SDL_JoystickClose(joy); +}\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_JoystickClose\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_JoystickOpened.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_JoystickOpened.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,18 @@ +.TH "SDL_JoystickOpened" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoystickOpened\- Determine if a joystick has been opened +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_JoystickOpened\fP\fR(\fBint index\fR); +.SH "DESCRIPTION" +.PP +Determines whether a joystick has already been opened within the application\&. \fBindex\fR refers to the N\&'th joystick on the system\&. +.SH "RETURN VALUE" +.PP +Returns \fB1\fR if the joystick has been opened, or \fB0\fR if it has not\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_JoystickOpen\fP\fR, \fI\fBSDL_JoystickClose\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_JoystickUpdate.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_JoystickUpdate.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_JoystickUpdate" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_JoystickUpdate\- Updates the state of all joysticks +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_JoystickUpdate\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +Updates the state(position, buttons, etc\&.) of all open joysticks\&. If joystick events have been enabled with \fI\fBSDL_JoystickEventState\fP\fR then this is called automatically in the event loop\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_JoystickEventState\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_KeyboardEvent.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_KeyboardEvent.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,38 @@ +.TH "SDL_KeyboardEvent" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_KeyboardEvent\- Keyboard event structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type; + Uint8 state; + SDL_keysym keysym; +} SDL_KeyboardEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_KEYDOWN\fP or \fBSDL_KEYUP\fP +.TP 20 +\fBstate\fR +\fBSDL_PRESSED\fP or \fBSDL_RELEASED\fP +.TP 20 +\fBkeysym\fR +Contains key press information +.SH "DESCRIPTION" +.PP +\fBSDL_KeyboardEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used when an event of type \fBSDL_KEYDOWN\fP or \fBSDL_KEYUP\fP is reported\&. +.PP +The \fBtype\fR and \fBstate\fR actually report the same information, they just use different values to do it! A keyboard event occurs when a key is released (\fBtype\fR=\fBSDK_KEYUP\fP or \fBstate\fR=\fBSDL_RELEASED\fP) and when a key is pressed (\fBtype\fR=\fBSDL_KEYDOWN\fP or \fBstate\fR=\fBSDL_PRESSED\fP)\&. The information on what key was pressed or released is in the \fI\fBkeysym\fR\fR structure\&. +.PP +.RS +\fBNote: +.PP +Repeating \fBSDL_KEYDOWN\fP events will occur if key repeat is enabled (see \fI\fBSDL_EnableKeyRepeat\fP\fR)\&. +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_keysym\fR\fR, \fI\fBSDL_EnableKeyRepeat\fP\fR, \fI\fBSDL_EnableUNICODE\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_KillThread.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_KillThread.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,16 @@ +.TH "SDL_KillThread" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_KillThread\- Gracelessly terminates the thread\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBvoid \fBSDL_KillThread\fP\fR(\fBSDL_Thread *thread\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_KillThread\fP gracelessly terminates the thread associated with \fBthread\fR\&. If possible, you should use some other form of IPC to signal the thread to quit\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateThread\fP\fR, \fI\fBSDL_WaitThread\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_ListModes.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_ListModes.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,53 @@ +.TH "SDL_ListModes" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_ListModes\- Returns a pointer to an array of available screen dimensions for the given format and video flags +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Rect **\fBSDL_ListModes\fP\fR(\fBSDL_PixelFormat *format, Uint32 flags\fR); +.SH "DESCRIPTION" +.PP +Return a pointer to an array of available screen dimensions for the given format and video flags, sorted largest to smallest\&. Returns \fBNULL\fP if there are no dimensions available for a particular format, or \fB-1\fR if any dimension is okay for the given format\&. +.PP +If \fBformat\fR is \fBNULL\fP, the mode list will be for the format returned by \fISDL_GetVideoInfo()\fR->\fBvfmt\fR\&. The \fBflag\fR parameter is an OR\&'d combination of \fIsurface\fR flags\&. The flags are the same as those used \fI\fBSDL_SetVideoMode\fP\fR and they play a strong role in deciding what modes are valid\&. For instance, if you pass \fBSDL_HWSURFACE\fP as a flag only modes that support hardware video surfaces will be returned\&. +.SH "EXAMPLE" +.PP +.nf +\f(CWSDL_Rect **modes; +int i; +\&. +\&. +\&. + +/* Get available fullscreen/hardware modes */ +modes=SDL_ListModes(NULL, SDL_FULLSCREEN|SDL_HWSURFACE); + +/* Check is there are any modes available */ +if(modes == (SDL_Rect **)0){ + printf("No modes available! +"); + exit(-1); +} + +/* Check if or resolution is restricted */ +if(modes == (SDL_Rect **)-1){ + printf("All resolutions available\&. +"); +} +else{ + /* Print valid modes */ + printf("Available Modes +"); + for(i=0;modes[i];++i) + printf(" %d x %d +", modes[i]->w, modes[i]->h); +} +\&. +\&.\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_SetVideoMode\fP\fR, \fI\fBSDL_GetVideoInfo\fP\fR, \fI\fBSDL_Rect\fR\fR, \fI\fBSDL_PixelFormat\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_LoadBMP.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_LoadBMP.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,18 @@ +.TH "SDL_LoadBMP" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_LoadBMP\- Load a Windows BMP file into an SDL_Surface\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Surface *\fBSDL_LoadBMP\fP\fR(\fBconst char *file\fR); +.SH "DESCRIPTION" +.PP +Loads a surface from a named Windows BMP file\&. +.SH "RETURN VALUE" +.PP +Returns the new surface, or \fBNULL\fP if there was an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_SaveBMP\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_LoadWAV.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_LoadWAV.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,42 @@ +.TH "SDL_LoadWAV" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_LoadWAV\- Load a WAVE file +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_AudioSpec *\fBSDL_LoadWAV\fP\fR(\fBconst char *file, SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_LoadWAV\fP This function loads a WAVE \fBfile\fR into memory\&. +.PP +If this function succeeds, it returns the given \fI\fBSDL_AudioSpec\fP\fR, filled with the audio data format of the wave data, and sets \fBaudio_buf\fR to a \fBmalloc\fP\&'d buffer containing the audio data, and sets \fBaudio_len\fR to the length of that audio buffer, in bytes\&. You need to free the audio buffer with \fI\fBSDL_FreeWAV\fP\fR when you are done with it\&. +.PP +This function returns \fBNULL\fP and sets the SDL error message if the wave file cannot be opened, uses an unknown data format, or is corrupt\&. Currently raw, MS-ADPCM and IMA-ADPCM WAVE files are supported\&. +.SH "EXAMPLE" +.PP +.nf +\f(CWSDL_AudioSpec wav_spec; +Uint32 wav_length; +Uint8 *wav_buffer; + +/* Load the WAV */ +if( SDL_LoadWAV("test\&.wav", &wav_spec, &wav_buffer, &wav_length) == NULL ){ + fprintf(stderr, "Could not open test\&.wav: %s +", SDL_GetError()); + exit(-1); +} +\&. +\&. +\&. +/* Do stuff with the WAV */ +\&. +\&. +/* Free It */ +SDL_FreeWAV(wav_buffer);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_AudioSpec\fR\fR, \fI\fBSDL_OpenAudio\fP\fR, \fI\fBSDL_FreeWAV\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_LockAudio.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_LockAudio.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_LockAudio" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_LockAudio\- Lock out the callback function +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_LockAudio\fP\fR(\fBvoid\fR) +.SH "DESCRIPTION" +.PP +The lock manipulated by these functions protects the callback function\&. During a LockAudio period, you can be guaranteed that the callback function is not running\&. Do not call these from the callback function or you will cause deadlock\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_OpenAudio\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_LockSurface.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_LockSurface.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,49 @@ +.TH "SDL_LockSurface" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_LockSurface\- Lock a surface for directly access\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_LockSurface\fP\fR(\fBSDL_Surface *surface\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_LockSurface\fP sets up a surface for directly accessing the pixels\&. Between calls to \fBSDL_LockSurface\fP and \fBSDL_UnlockSurface\fP, you can write to and read from \fBsurface->\fBpixels\fR\fR, using the pixel format stored in \fBsurface->\fBformat\fR\fR\&. Once you are done accessing the surface, you should use \fBSDL_UnlockSurface\fP to release it\&. +.PP +Not all surfaces require locking\&. If \fBSDL_MUSTLOCK\fP(\fBsurface\fR) evaluates to \fB0\fR, then you can read and write to the surface at any time, and the pixel format of the surface will not change\&. +.PP +No operating system or library calls should be made between lock/unlock pairs, as critical system locks may be held during this time\&. +.PP +It should be noted, that since SDL 1\&.1\&.8 surface locks are recursive\&. This means that you can lock a surface multiple times, but each lock must have a match unlock\&. +.PP +.nf +\f(CW \&. + \&. + SDL_LockSurface( surface ); + \&. + /* Surface is locked */ + /* Direct pixel access on surface here */ + \&. + SDL_LockSurface( surface ); + \&. + /* More direct pixel access on surface */ + \&. + SDL_UnlockSurface( surface ); + /* Surface is still locked */ + /* Note: Is versions < 1\&.1\&.8, the surface would have been */ + /* no longer locked at this stage */ + \&. + SDL_UnlockSurface( surface ); + /* Surface is now unlocked */ + \&. + \&.\fR +.fi +.PP + +.SH "RETURN VALUE" +.PP +\fBSDL_LockSurface\fP returns \fB0\fR, or \fB-1\fR if the surface couldn\&'t be locked\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_UnlockSurface\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_LockYUVOverlay.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_LockYUVOverlay.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,18 @@ +.TH "SDL_LockYUVOverlay" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_LockYUVOverlay\- Lock an overlay +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_LockYUVOverlay\fP\fR(\fBSDL_Overlay *overlay\fR); +.SH "DESCRIPTION" +.PP +Much the same as \fI\fBSDL_LockSurface\fP\fR, \fBSDL_LockYUVOverlay\fP locks the \fI\fBoverlay\fR\fR for direct access to pixel data\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on success, or \fB-1\fR on an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_UnlockYUVOverlay\fP\fR, \fI\fBSDL_CreateYUVOverlay\fP\fR, \fI\fBSDL_Overlay\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_MapRGB.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_MapRGB.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,22 @@ +.TH "SDL_MapRGB" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_MapRGB\- Map a RGB color value to a pixel format\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint32 \fBSDL_MapRGB\fP\fR(\fBSDL_PixelFormat *fmt, Uint8 r, Uint8 g, Uint8 b\fR); +.SH "DESCRIPTION" +.PP +Maps the RGB color value to the specified pixel format and returns the pixel value as a 32-bit int\&. +.PP +If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned\&. +.PP +If the specified pixel format has an alpha component it will be returned as all 1 bits (fully opaque)\&. +.SH "RETURN VALUE" +.PP +A pixel value best approximating the given RGB color value for a given pixel format\&. If the pixel format bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e\&.g\&., with a 16-bpp format the return value can be assigned to a \fBUint16\fP, and similarly a \fBUint8\fP for an 8-bpp format)\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_GetRGB\fP\fR, \fI\fBSDL_GetRGBA\fP\fR, \fI\fBSDL_MapRGBA\fP\fR, \fI\fBSDL_PixelFormat\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_MapRGBA.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_MapRGBA.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,22 @@ +.TH "SDL_MapRGBA" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_MapRGBA\- Map a RGBA color value to a pixel format\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint32 \fBSDL_MapRGBA\fP\fR(\fBSDL_PixelFormat *fmt, Uint8 r, Uint8 g, Uint8 b, Uint8 a\fR); +.SH "DESCRIPTION" +.PP +Maps the RGBA color value to the specified pixel format and returns the pixel value as a 32-bit int\&. +.PP +If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned\&. +.PP +If the specified pixel format has no alpha component the alpha value will be ignored (as it will be in formats with a palette)\&. +.SH "RETURN VALUE" +.PP +A pixel value best approximating the given RGBA color value for a given pixel format\&. If the pixel format bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e\&.g\&., with a 16-bpp format the return value can be assigned to a \fBUint16\fP, and similarly a \fBUint8\fP for an 8-bpp format)\&. +.SH "SEE ALSO" +.PP +\fISDL_GetRGB\fR, \fISDL_GetRGBA\fR, \fISDL_MapRGB\fR, \fISDL_PixelFormat\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_MixAudio.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_MixAudio.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_MixAudio" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_MixAudio\- Mix audio data +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_MixAudio\fP\fR(\fBUint8 *dst, Uint8 *src, Uint32 len, int volume\fR); +.SH "DESCRIPTION" +.PP +This takes two audio buffers of the playing audio format and mixes them, performing addition, volume adjustment, and overflow clipping\&. The \fBvolume\fR ranges from 0 - 128, and should be set to \fBSDL_MIX_MAXVOLUME\fP for full audio volume\&. Note this does not change hardware volume\&. This is provided for convenience -- you can mix your own audio data\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_OpenAudio\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_MouseButtonEvent.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_MouseButtonEvent.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,36 @@ +.TH "SDL_MouseButtonEvent" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_MouseButtonEvent\- Mouse button event structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type; + Uint8 button; + Uint8 state; + Uint16 x, y; +} SDL_MouseButtonEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_MOUSEBUTTONDOWN\fP or \fBSDL_MOUSEBUTTONUP\fP +.TP 20 +\fBbutton\fR +The mouse button index (SDL_BUTTON_LEFT, SDL_BUTTON_MIDDLE, SDL_BUTTON_RIGHT) +.TP 20 +\fBstate\fR +\fBSDL_PRESSED\fP or \fBSDL_RELEASED\fP +.TP 20 +\fBx\fR, \fBy\fR +The X/Y coordinates of the mouse at press/release time +.SH "DESCRIPTION" +.PP +\fBSDL_MouseButtonEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used when an event of type \fBSDL_MOUSEBUTTONDOWN\fP or \fBSDL_MOUSEBUTTONUP\fP is reported\&. +.PP +When a mouse button press or release is detected then number of the button pressed (from 1 to 255, with 1 usually being the left button and 2 the right) is placed into \fBbutton\fR, the position of the mouse when this event occured is stored in the \fBx\fR and the \fBy\fR fields\&. Like \fI\fBSDL_KeyboardEvent\fR\fR, information on whether the event was a press or a release event is stored in both the \fBtype\fR and \fBstate\fR fields, but this should be obvious\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_MouseMotionEvent\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_MouseMotionEvent.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_MouseMotionEvent.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,38 @@ +.TH "SDL_MouseMotionEvent" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_MouseMotionEvent\- Mouse motion event structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type; + Uint8 state; + Uint16 x, y; + Sint16 xrel, yrel; +} SDL_MouseMotionEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_MOUSEMOTION\fP +.TP 20 +\fBstate\fR +The current button state +.TP 20 +\fBx\fR, \fBy\fR +The X/Y coordinates of the mouse +.TP 20 +\fBxrel\fR, \fByrel\fR +Relative motion in the X/Y direction +.SH "DESCRIPTION" +.PP +\fBSDL_MouseMotionEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used when an event of type \fBSDL_MOUSEMOTION\fP is reported\&. +.PP +Simply put, a \fBSDL_MOUSEMOTION\fP type event occurs when a user moves the mouse within the application window or when \fI\fBSDL_WarpMouse\fP\fR is called\&. Both the absolute (\fBx\fR and \fBy\fR) and relative (\fBxrel\fR and \fByrel\fR) coordinates are reported along with the current button states (\fBstate\fR)\&. The button state can be interpreted using the \fBSDL_BUTTON\fP macro (see \fI\fBSDL_GetMouseState\fP\fR)\&. +.PP +If the cursor is hidden (\fI\fBSDL_ShowCursor\fP(0)\fR) and the input is grabbed (\fI\fBSDL_WM_GrabInput\fP(SDL_GRAB_ON)\fR), then the mouse will give relative motion events even when the cursor reaches the edge fo the screen\&. This is currently only implemented on Windows and Linux/Unix-a-likes\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_MouseButtonEvent\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_NumJoysticks.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_NumJoysticks.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,18 @@ +.TH "SDL_NumJoysticks" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_NumJoysticks\- Count available joysticks\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_NumJoysticks\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +Counts the number of joysticks attached to the system\&. +.SH "RETURN VALUE" +.PP +Returns the number of attached joysticks +.SH "SEE ALSO" +.PP +\fI\fBSDL_JoystickName\fP\fR, \fI\fBSDL_JoystickOpen\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_OpenAudio.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_OpenAudio.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,94 @@ +.TH "SDL_OpenAudio" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_OpenAudio\- Opens the audio device with the desired parameters\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_OpenAudio\fP\fR(\fBSDL_AudioSpec *desired, SDL_AudioSpec *obtained\fR); +.SH "DESCRIPTION" +.PP +This function opens the audio device with the \fBdesired\fR parameters, and returns 0 if successful, placing the actual hardware parameters in the structure pointed to by \fBobtained\fR\&. If \fBobtained\fR is NULL, the audio data passed to the callback function will be guaranteed to be in the requested format, and will be automatically converted to the hardware audio format if necessary\&. This function returns -1 if it failed to open the audio device, or couldn\&'t set up the audio thread\&. +.PP +To open the audio device a \fBdesired\fR \fI\fBSDL_AudioSpec\fR\fR must be created\&. +.PP +.nf +\f(CWSDL_AudioSpec *desired; +\&. +\&. +desired=(SDL_AudioSpec *)malloc(sizeof(SDL_AudioSpec));\fR +.fi +.PP + You must then fill this structure with your desired audio specifications\&. +.IP "\fBdesired\fR->\fBfreq\fR" 10The desired audio frequency in samples-per-second\&. +.IP "\fBdesired\fR->\fBformat\fR" 10The desired audio format (see \fI\fBSDL_AudioSpec\fR\fR) +.IP "\fBdesired\fR->\fBsamples\fR" 10The desired size of the audio buffer in samples\&. This number should be a power of two, and may be adjusted by the audio driver to a value more suitable for the hardware\&. Good values seem to range between 512 and 8192 inclusive, depending on the application and CPU speed\&. Smaller values yield faster response time, but can lead to underflow if the application is doing heavy processing and cannot fill the audio buffer in time\&. A stereo sample consists of both right and left channels in LR ordering\&. Note that the number of samples is directly related to time by the following formula: ms = (samples*1000)/freq +.IP "\fBdesired\fR->\fBcallback\fR" 10This should be set to a function that will be called when the audio device is ready for more data\&. It is passed a pointer to the audio buffer, and the length in bytes of the audio buffer\&. This function usually runs in a separate thread, and so you should protect data structures that it accesses by calling \fI\fBSDL_LockAudio\fP\fR and \fI\fBSDL_UnlockAudio\fP\fR in your code\&. The callback prototype is: +.PP +.nf +\f(CWvoid callback(void *userdata, Uint8 *stream, int len);\fR +.fi +.PP + \fBuserdata\fR is the pointer stored in \fBuserdata\fR field of the \fBSDL_AudioSpec\fR\&. \fBstream\fR is a pointer to the audio buffer you want to fill with information and \fBlen\fR is the length of the audio buffer in bytes\&. +.IP "\fBdesired\fR->\fBuserdata\fR" 10This pointer is passed as the first parameter to the \fBcallback\fP function\&. +.PP +\fBSDL_OpenAudio\fP reads these fields from the \fBdesired\fR \fBSDL_AudioSpec\fR structure pass to the function and attempts to find an audio configuration matching your \fBdesired\fR\&. As mentioned above, if the \fBobtained\fR parameter is \fBNULL\fP then SDL with convert from your \fBdesired\fR audio settings to the hardware settings as it plays\&. +.PP +If \fBobtained\fR is \fBNULL\fP then the \fBdesired\fR \fBSDL_AudioSpec\fR is your working specification, otherwise the \fBobtained\fR \fBSDL_AudioSpec\fR becomes the working specification and the \fBdesirec\fR specification can be deleted\&. The data in the working specification is used when building \fBSDL_AudioCVT\fR\&'s for converting loaded data to the hardware format\&. +.PP +\fBSDL_OpenAudio\fP calculates the \fBsize\fR and \fBsilence\fR fields for both the \fBdesired\fR and \fBobtained\fR specifications\&. The \fBsize\fR field stores the total size of the audio buffer in bytes, while the \fBsilence\fR stores the value used to represent silence in the audio buffer +.PP +The audio device starts out playing \fBsilence\fR when it\&'s opened, and should be enabled for playing by calling \fI\fBSDL_PauseAudio\fP(\fB0\fR)\fR when you are ready for your audio \fBcallback\fR function to be called\&. Since the audio driver may modify the requested \fBsize\fR of the audio buffer, you should allocate any local mixing buffers after you open the audio device\&. +.SH "EXAMPLES" +.PP +.nf +\f(CW/* Prototype of our callback function */ +void my_audio_callback(void *userdata, Uint8 *stream, int len); + +/* Open the audio device */ +SDL_AudioSpec *desired, *obtained; +SDL_AudioSpec *hardware_spec; + +/* Allocate a desired SDL_AudioSpec */ +desired=(SDL_AudioSpec *)malloc(sizeof(SDL_AudioSpec)); + +/* Allocate space for the obtained SDL_AudioSpec */ +obtained=(SDL_AudioSpec *)malloc(sizeof(SDL_AudioSpec)); + +/* 22050Hz - FM Radio quality */ +desired->freq=22050; + +/* 16-bit signed audio */ +desired->format=AUDIO_S16LSB; + +/* Large audio buffer reduces risk of dropouts but increases response time */ +desired->samples=8192; + +/* Our callback function */ +desired->callback=my_audio_callback; + +desired->userdata=NULL; + +/* Open the audio device */ +if ( SDL_OpenAudio(desired, obtained) < 0 ){ + fprintf(stderr, "Couldn\&'t open audio: %s +", SDL_GetError()); + exit(-1); +} +/* desired spec is no longer needed */ +free(desired); +hardware_spec=obtained; +\&. +\&. +/* Prepare callback for playing */ +\&. +\&. +\&. +/* Start playing */ +SDL_PauseAudio(0);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_AudioSpec\fP\fR, \fI\fBSDL_LockAudio\fP\fR, \fI\fBSDL_UnlockAudio\fP\fR, \fI\fBSDL_PauseAudio\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_Overlay.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_Overlay.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,52 @@ +.TH "SDL_Overlay" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_Overlay\- YUV video overlay +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint32 format; + int w, h; + int planes; + Uint16 *pitches; + Uint8 **pixels; + Uint32 hw_overlay:1; +} SDL_Overlay;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBformat\fR +Overlay format (see below) +.TP 20 +\fBw, h\fR +Width and height of overlay +.TP 20 +\fBplanes\fR +Number of planes in the overlay\&. Usually either 1 or 3 +.TP 20 +\fBpitches\fR +An array of pitches, one for each plane\&. Pitch is the length of a row in bytes\&. +.TP 20 +\fBpixels\fR +An array of pointers to teh data of each plane\&. The overlay should be locked before these pointers are used\&. +.TP 20 +\fBhw_overlay\fR +This will be set to 1 if the overlay is hardware accelerated\&. +.SH "DESCRIPTION" +.PP +A \fBSDL_Overlay\fR is similar to a \fI\fBSDL_Surface\fR\fR except it stores a YUV overlay\&. All the fields are read only, except for \fBpixels\fR which should be \fIlocked\fR before use\&. The \fBformat\fR field stores the format of the overlay which is one of the following: +.PP +.nf +\f(CW#define SDL_YV12_OVERLAY 0x32315659 /* Planar mode: Y + V + U */ +#define SDL_IYUV_OVERLAY 0x56555949 /* Planar mode: Y + U + V */ +#define SDL_YUY2_OVERLAY 0x32595559 /* Packed mode: Y0+U0+Y1+V0 */ +#define SDL_UYVY_OVERLAY 0x59565955 /* Packed mode: U0+Y0+V0+Y1 */ +#define SDL_YVYU_OVERLAY 0x55595659 /* Packed mode: Y0+V0+Y1+U0 */\fR +.fi +.PP + More information on YUV formats can be found at \fIhttp://www\&.webartz\&.com/fourcc/indexyuv\&.htm (link to URL http://www.webartz.com/fourcc/indexyuv.htm) \fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateYUVOverlay\fP\fR, \fI\fBSDL_LockYUVOverlay\fP\fR, \fI\fBSDL_UnlockYUVOverlay\fP\fR, \fI\fBSDL_FreeYUVOverlay\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_Palette.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_Palette.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,26 @@ +.TH "SDL_Palette" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_Palette\- Color palette for 8-bit pixel formats +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + int ncolors; + SDL_Color *colors; +} SDL_Palette;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBncolors\fR +Number of colors used in this palette +.TP 20 +\fBcolors\fR +Pointer to \fI\fBSDL_Color\fR\fR structures that make up the palette\&. +.SH "DESCRIPTION" +.PP +Each pixel in an 8-bit surface is an index into the \fBcolors\fR field of the \fBSDL_Palette\fR structure store in \fI\fBSDL_PixelFormat\fR\fR\&. A \fBSDL_Palette\fR should never need to be created manually\&. It is automatically created when SDL allocates a \fBSDL_PixelFormat\fR for a surface\&. The colors values of a \fI\fBSDL_Surface\fR\fRs palette can be set with the \fI\fBSDL_SetColors\fP\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Color\fR\fR, \fI\fBSDL_Surface\fR\fR, \fI\fBSDL_SetColors\fP\fR \fI\fBSDL_SetPalette\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_PauseAudio.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_PauseAudio.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_PauseAudio" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_PauseAudio\- Pauses and unpauses the audio callback processing +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_PauseAudio\fP\fR(\fBint pause_on\fR); +.SH "DESCRIPTION" +.PP +This function pauses and unpauses the audio callback processing\&. It should be called with \fBpause_on\fR=0 after opening the audio device to start playing sound\&. This is so you can safely initialize data for your callback function after opening the audio device\&. Silence will be written to the audio device during the pause\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_GetAudioStatus\fP\fR, \fI\fBSDL_OpenAudio\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_PeepEvents.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_PeepEvents.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,26 @@ +.TH "SDL_PeepEvents" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_PeepEvents\- Checks the event queue for messages and optionally returns them\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_PeepEvents\fP\fR(\fBSDL_Event *events, int numevents, SDL_eventaction action, Uint32 mask\fR); +.SH "DESCRIPTION" +.PP +Checks the event queue for messages and optionally returns them\&. +.PP +If \fBaction\fR is \fBSDL_ADDEVENT\fP, up to \fBnumevents\fR events will be added to the back of the event queue\&. +.PP +If \fBaction\fR is \fBSDL_PEEKEVENT\fP, up to \fBnumevents\fR events at the front of the event queue, matching \fI\fBmask\fR\fR, will be returned and will not be removed from the queue\&. +.PP +If \fBaction\fR is \fBSDL_GETEVENT\fP, up to \fBnumevents\fR events at the front of the event queue, matching \fI\fBmask\fR\fR, will be returned and will be removed from the queue\&. +.PP +This function is thread-safe\&. +.SH "RETURN VALUE" +.PP +This function returns the number of events actually stored, or \fB-1\fR if there was an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_PollEvent\fP\fR, \fI\fBSDL_PushEvent\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_PixelFormat.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_PixelFormat.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,140 @@ +.TH "SDL_PixelFormat" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_PixelFormat\- Stores surface format information +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + SDL_Palette *palette; + Uint8 BitsPerPixel; + Uint8 BytesPerPixel; + Uint32 Rmask, Gmask, Bmask, Amask; + Uint8 Rshift, Gshift, Bshift, Ashift; + Uint8 Rloss, Gloss, Bloss, Aloss; + Uint32 colorkey; + Uint8 alpha; +} SDL_PixelFormat;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBpalette\fR +Pointer to the \fIpalette\fR, or \fBNULL\fP if the \fBBitsPerPixel\fR>8 +.TP 20 +\fBBitsPerPixel\fR +The number of bits used to represent each pixel in a surface\&. Usually 8, 16, 24 or 32\&. +.TP 20 +\fBBytesPerPixel\fR +The number of bytes used to represent each pixel in a surface\&. Usually one to four\&. +.TP 20 +\fB[RGBA]mask\fR +Binary mask used to retrieve individual color values +.TP 20 +\fB[RGBA]loss\fR +Precision loss of each color component (2^[RGBA]loss) +.TP 20 +\fB[RGBA]shift\fR +Binary left shift of each color component in the pixel value +.TP 20 +\fBcolorkey\fR +Pixel value of transparent pixels +.TP 20 +\fBalpha\fR +Overall surface alpha value +.SH "DESCRIPTION" +.PP +A \fBSDL_PixelFormat\fR describes the format of the pixel data stored at the \fBpixels\fR field of a \fI\fBSDL_Surface\fR\fR\&. Every surface stores a \fBSDL_PixelFormat\fR in the \fBformat\fR field\&. +.PP +If you wish to do pixel level modifications on a surface, then understanding how SDL stores its color information is essential\&. +.PP +8-bit pixel formats are the easiest to understand\&. Since its an 8-bit format, we have 8 \fBBitsPerPixel\fR and 1 \fBBytesPerPixel\fR\&. Since \fBBytesPerPixel\fR is 1, all pixels are represented by a Uint8 which contains an index into \fBpalette\fR->\fBcolors\fR\&. So, to determine the color of a pixel in a 8-bit surface: we read the color index from \fBsurface\fR->\fBpixels\fR and we use that index to read the \fI\fBSDL_Color\fR\fR structure from \fBsurface\fR->\fBformat\fR->\fBpalette\fR->\fBcolors\fR\&. Like so: +.PP +.nf +\f(CWSDL_Surface *surface; +SDL_PixelFormat *fmt; +SDL_Color *color; +Uint8 index; + +\&. +\&. + +/* Create surface */ +\&. +\&. +fmt=surface->format; + +/* Check the bitdepth of the surface */ +if(fmt->BitsPerPixel!=8){ + fprintf(stderr, "Not an 8-bit surface\&. +"); + return(-1); +} + +/* Lock the surface */ +SDL_LockSurface(surface); + +/* Get the topleft pixel */ +index=*(Uint8 *)surface->pixels; +color=fmt->palette->colors[index]; + +/* Unlock the surface */ +SDL_UnlockSurface(surface); +printf("Pixel Color-> Red: %d, Green: %d, Blue: %d\&. Index: %d +", + color->r, color->g, color->b, index); +\&. +\&.\fR +.fi +.PP +.PP +Pixel formats above 8-bit are an entirely different experience\&. They are considered to be "TrueColor" formats and the color information is stored in the pixels themselves, not in a palette (packed-pixel)\&. The mask, shift and loss fields tell us how the color information is encoded\&. The mask fields allow us to isolate each color component, the shift fields tell us how far left we have to shift the masked value and the loss fields tell us for far right we have to shift the final value to convert it to a full 8-bit color component\&. +.PP +.nf +\f(CW/* Extracting color components from a 32-bit color value */ +SDL_PixelFormat *fmt; +SDL_Surface *surface; +Uint32 temp, pixel; +Uint8 red, green, blue, alpha; +\&. +\&. +\&. +fmt=surface->format; +SDL_LockSurface(surface); +pixel=(Uint32*)surface->pixels; +SDL_UnlockSurface(surface); + +/* Get Red component */ +temp=pixel&fmt->Rmask; /* Isolate red component */ +temp=temp>>fmt->Rshift;/* Shift it down to 8-bit */ +temp=temp<Rloss; /* Expand to a full 8-bit number */ +red=(Uint8)temp; + +/* Get Green component */ +temp=pixel&fmt->Gmask; /* Isolate green component */ +temp=temp>>fmt->Gshift;/* Shift it down to 8-bit */ +temp=temp<Gloss; /* Expand to a full 8-bit number */ +green=(Uint8)temp; + +/* Get Blue component */ +temp=pixel&fmt->Bmask; /* Isolate blue component */ +temp=temp>>fmt->Bshift;/* Shift it down to 8-bit */ +temp=temp<Bloss; /* Expand to a full 8-bit number */ +blue=(Uint8)temp; + +/* Get Alpha component */ +temp=pixel&fmt->Amask; /* Isolate alpha component */ +temp=temp>>fmt->Ashift;/* Shift it down to 8-bit */ +temp=temp<Aloss; /* Expand to a full 8-bit number */ +alpha=(Uint8)temp; + +printf("Pixel Color -> R: %d, G: %d, B: %d, A: %d +", red, green, blue, alpha); +\&. +\&. +\&.\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_Surface\fR\fR, \fI\fBSDL_MapRGB\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_PollEvent.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_PollEvent.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,44 @@ +.TH "SDL_PollEvent" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_PollEvent\- Polls for currently pending events\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_PollEvent\fP\fR(\fBSDL_Event *event\fR); +.SH "DESCRIPTION" +.PP +Polls for currently pending events, and returns \fB1\fR if there are any pending events, or \fB0\fR if there are none available\&. +.PP +If \fBevent\fR is not \fBNULL\fP, the next event is removed from the queue and stored in that area\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWSDL_Event event; /* Event structure */ + +\&. +\&. +\&. +/* Check for events */ +while(SDL_PollEvent(&event)){ /* Loop until there are no events left on the queue */ + switch(event\&.type){ /* Process the appropiate event type */ + case SDL_KEYDOWN: /* Handle a KEYDOWN event */ + printf("Oh! Key press +"); + break; + case SDL_MOUSEMOTION: + \&. + \&. + \&. + default: /* Report an unhandled event */ + printf("I don\&'t know what this event is! +"); + } +}\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_WaitEvent\fP\fR, \fI\fBSDL_PeepEvents\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_PumpEvents.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_PumpEvents.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,23 @@ +.TH "SDL_PumpEvents" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_PumpEvents\- Pumps the event loop, gathering events from the input devices\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_PumpEvents\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +Pumps the event loop, gathering events from the input devices\&. +.PP +\fBSDL_PumpEvents\fP gathers all the pending input information from devices and places it on the event queue\&. Without calls to \fBSDL_PumpEvents\fP no events would ever be placed on the queue\&. Often calls the need for \fBSDL_PumpEvents\fP is hidden from the user since \fI\fBSDL_PollEvent\fP\fR and \fI\fBSDL_WaitEvent\fP\fR implicitly call \fBSDL_PumpEvents\fP\&. However, if you are not polling or waiting for events (e\&.g\&. your filtering them), then you must call \fBSDL_PumpEvents\fP to force an event queue update\&. +.PP +.RS +\fBNote: +.PP +You can only call this function in the thread that set the video mode\&. +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_PollEvent\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_PushEvent.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_PushEvent.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,27 @@ +.TH "SDL_PushEvent" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_PushEvent\- Pushes an event onto the event queue +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_PushEvent\fP\fR(\fBSDL_Event *event\fR); +.SH "DESCRIPTION" +.PP +The event queue can actually be used as a two way communication channel\&. Not only can events be read from the queue, but the user can also push their own events onto it\&. \fBevent\fR is a pointer to the event structure you wish to push onto the queue\&. +.PP +.RS +\fBNote: +.PP +Pushing device input events onto the queue doesn\&'t modify the state of the device within SDL\&. +.RE +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on success or \fB-1\fR if the event couldn\&'t be pushed\&. +.SH "EXAMPLES" +.PP +See \fI\fBSDL_Event\fR\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_PollEvent\fP\fR, \fI\fBSDL_PeepEvents\fP\fR, \fI\fBSDL_Event\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_Quit.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_Quit.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,29 @@ +.TH "SDL_Quit" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_Quit\- Shut down SDL +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_Quit\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_Quit\fP shuts down all SDL subsystems and frees the resources allocated to them\&. This should always be called before you exit\&. For the sake of simplicity you can set \fBSDL_Quit\fP as your \fBatexit\fP call, like: +.PP +.nf +\f(CWSDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO); +atexit(SDL_Quit); +\&. +\&.\fR +.fi +.PP +.PP +.RS +\fBNote: +.PP +While using \fBatexit\fP maybe be fine for small programs, more advanced users should shut down SDL in their own cleanup code\&. Plus, using \fBatexit\fP in a library is a sure way to crash dynamically loaded code +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_QuitSubsystem\fP\fR, \fI\fBSDL_Init\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_QuitEvent.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_QuitEvent.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,30 @@ +.TH "SDL_QuitEvent" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_QuitEvent\- Quit requested event +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type +} SDL_QuitEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_QUIT\fP +.SH "DESCRIPTION" +.PP +\fBSDL_QuitEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used whan an event of type \fBSDL_QUIT\fP is reported\&. +.PP +As can be seen, the SDL_QuitEvent structure serves no useful purpose\&. The event itself, on the other hand, is very important\&. If you filter out or ignore a quit event then it is impossible for the user to close the window\&. On the other hand, if you do accept a quit event then the application window will be closed, and screen updates will still report success event though the application will no longer be visible\&. +.PP +.RS +\fBNote: +.PP +The macro \fBSDL_QuitRequested\fP will return non-zero if a quit event is pending +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_SetEventFilter\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_QuitSubSystem.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_QuitSubSystem.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_QuitSubSystem" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_QuitSubSystem\- Shut down a subsystem +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_QuitSubSystem\fP\fR(\fBUint32 flags\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_QuitSubSystem\fP allows you to shut down a subsystem that has been previously initialized by \fI\fBSDL_Init\fP\fR or \fI\fBSDL_InitSubSystem\fP\fR\&. The \fBflags\fR tells \fBSDL_QuitSubSystem\fP which subsystems to shut down, it uses the same values that are passed to \fI\fBSDL_Init\fP\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Quit\fP\fR, \fI\fBSDL_Init\fP\fR, \fI\fBSDL_InitSubSystem\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_RWFromFile.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_RWFromFile.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,18 @@ +.TH "SDL_FunctionName" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_FunctionName\- Short description of function +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBreturn type\fBSDL_FunctionName\fP\fR(\fBparameter\fR); +.SH "DESCRIPTION" +.PP +Full description +.SH "EXAMPLES" +.PP +examples here +.SH "SEE ALSO" +.PP +\fISDL_AnotherFunction\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_Rect.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_Rect.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,26 @@ +.TH "SDL_Rect" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_Rect\- Defines a rectangular area +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Sint16 x, y; + Uint16 w, h; +} SDL_Rect;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBx, y\fR +Position of the upper-left corner of the rectangle +.TP 20 +\fBw, h\fR +The width and height of the rectangle +.SH "DESCRIPTION" +.PP +A \fBSDL_Rect\fR defines a rectangular area of pixels\&. It is used by \fI\fBSDL_BlitSurface\fP\fR to define blitting regions and by several other video functions\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_BlitSurface\fP\fR, \fI\fBSDL_UpdateRect\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_RemoveTimer.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_RemoveTimer.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,25 @@ +.TH "SDL_RemoveTimer" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_RemoveTimer\- Remove a timer which was added with \fISDL_AddTimer\fR\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_bool \fBSDL_RemoveTimer\fP\fR(\fBSDL_TimerID id\fR); +.SH "DESCRIPTION" +.PP +Removes a timer callback previously added with \fISDL_AddTimer\fR\&. +.SH "RETURN VALUE" +.PP +Returns a boolean value indicating success\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWSDL_RemoveTimer(my_timer_id);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_AddTimer\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_ResizeEvent.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_ResizeEvent.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,28 @@ +.TH "SDL_ResizeEvent" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_ResizeEvent\- Window resize event structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type; + int w, h; +} SDL_ResizeEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_VIDEORESIZE\fP +.TP 20 +\fBw\fR, \fBh\fR +New width and height of the window +.SH "DESCRIPTION" +.PP +\fBSDL_ResizeEvent\fR is a member of the \fI\fBSDL_Event\fR\fR union and is used when an event of type \fBSDL_VIDEORESIZE\fP is reported\&. +.PP +When \fBSDL_RESIZABLE\fP is passed as a \fBflag\fR to \fI\fBSDL_SetVideoMode\fP\fR the user is allowed to resize the applications window\&. When the window is resized an \fBSDL_VIDEORESIZE\fP is report, with the new window width and height values stored in \fBw\fR and \fBh\fR, respectively\&. When an \fBSDL_VIDEORESIZE\fP is recieved the window should be resized to the new dimensions using \fI\fBSDL_SetVideoMode\fP\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_SetVideoMode\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_SaveBMP.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_SaveBMP.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,18 @@ +.TH "SDL_SaveBMP" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SaveBMP\- Save an SDL_Surface as a Windows BMP file\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_SaveBMP\fP\fR(\fBSDL_Surface *surface, const char *file\fR); +.SH "DESCRIPTION" +.PP +Saves the \fBSDL_Surface\fR \fBsurface\fR as a Windows BMP file named \fBfile\fR\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR if successful or \fB-1\fR if there was an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_LoadBMP\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_SemPost.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_SemPost.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,28 @@ +.TH "SDL_SemPost" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SemPost\- Unlock a semaphore\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBint \fBSDL_SemPost\fP\fR(\fBSDL_sem *sem\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_SemPost\fP unlocks the semaphore pointed to by \fBsem\fR and atomically increments the semaphores value\&. Threads that were blocking on the semaphore may be scheduled after this call succeeds\&. +.PP +\fBSDL_SemPost\fP should be called after a semaphore is locked by a successful call to \fISDL_SemWait\fR, \fISDL_SemTryWait\fR or \fISDL_SemWaitTimeout\fR\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR if successful or \fB-1\fR if there was an error (leaving the semaphore unchanged)\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWSDL_SemPost(my_sem);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateSemaphore\fP\fR, \fI\fBSDL_DestroySemaphore\fP\fR, \fI\fBSDL_SemWait\fP\fR, \fI\fBSDL_SemTryWait\fP\fR, \fI\fBSDL_SemWaitTimeout\fP\fR, \fI\fBSDL_SemValue\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_SemTryWait.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_SemTryWait.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,41 @@ +.TH "SDL_SemTryWait" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SemTryWait\- Attempt to lock a semaphore but don\&'t suspend the thread\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBint \fBSDL_SemTryWait\fP\fR(\fBSDL_sem *sem\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_SemTryWait\fP is a non-blocking varient of \fI\fBSDL_SemWait\fP\fR\&. If the value of the semaphore pointed to by \fBsem\fR is positive it will atomically decrement the semaphore value and return 0, otherwise it will return \fBSDL_MUTEX_TIMEOUT\fR instead of suspending the thread\&. +.PP +After \fBSDL_SemTryWait\fP is successful, the semaphore can be released and its count atomically incremented by a successful call to \fISDL_SemPost\fR\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR if the semaphore was successfully locked or either \fBSDL_MUTEX_TIMEOUT\fR or \fB-1\fR if the thread would have suspended or there was an error, respectivly\&. +.PP +If the semaphore was not successfully locked, the semaphore will be unchanged\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWres = SDL_SemTryWait(my_sem); + +if (res == SDL_MUTEX_TIMEOUT) { + return TRY_AGAIN; +} +if (res == -1) { + return WAIT_ERROR; +} + +\&.\&.\&. + +SDL_SemPost(my_sem);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateSemaphore\fP\fR, \fI\fBSDL_DestroySemaphore\fP\fR, \fI\fBSDL_SemWait\fP\fR, \fI\fBSDL_SemWaitTimeout\fP\fR, \fI\fBSDL_SemPost\fP\fR, \fI\fBSDL_SemValue\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_SemValue.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_SemValue.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,26 @@ +.TH "SDL_SemValue" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SemValue\- Return the current value of a semaphore\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL/SDL_thread\&.h" +.sp +\fBUint32 \fBSDL_SemValue\fP\fR(\fBSDL_sem *sem\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_SemValue()\fP returns the current semaphore value from the semaphore pointed to by \fBsem\fR\&. +.SH "RETURN VALUE" +.PP +Returns current value of the semaphore\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CW sem_value = SDL_SemValue(my_sem);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateSemaphore\fP\fR, \fI\fBSDL_DestroySemaphore\fP\fR, \fI\fBSDL_SemWait\fP\fR, \fI\fBSDL_SemTryWait\fP\fR, \fI\fBSDL_SemWaitTimeout\fP\fR, \fI\fBSDL_SemPost\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_SemWait.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_SemWait.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,34 @@ +.TH "SDL_SemWait" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SemWait\- Lock a semaphore and suspend the thread if the semaphore value is zero\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBint \fBSDL_SemWait\fP\fR(\fBSDL_sem *sem\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_SemWait()\fP suspends the calling thread until either the semaphore pointed to by \fBsem\fR has a positive value, the call is interrupted by a signal or error\&. If the call is successful it will atomically decrement the semaphore value\&. +.PP +After \fBSDL_SemWait()\fP is successful, the semaphore can be released and its count atomically incremented by a successful call to \fISDL_SemPost\fR\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR if successful or \fB-1\fR if there was an error (leaving the semaphore unchanged)\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWif (SDL_SemWait(my_sem) == -1) { + return WAIT_FAILED; +} + +\&.\&.\&. + +SDL_SemPost(my_sem);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateSemaphore\fP\fR, \fI\fBSDL_DestroySemaphore\fP\fR, \fI\fBSDL_SemTryWait\fP\fR, \fI\fBSDL_SemWaitTimeout\fP\fR, \fI\fBSDL_SemPost\fP\fR, \fI\fBSDL_SemValue\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_SemWaitTimeout.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_SemWaitTimeout.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,41 @@ +.TH "SDL_SemWaitTimeout" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SemWaitTimeout\- Lock a semaphore, but only wait up to a specified maximum time\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBint \fBSDL_SemWaitTimeout\fP\fR(\fBSDL_sem *sem, Uint32 timeout\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_SemWaitTimeout()\fP is a varient of \fISDL_SemWait\fR with a maximum timeout value\&. If the value of the semaphore pointed to by \fBsem\fR is positive (greater than zero) it will atomically decrement the semaphore value and return 0, otherwise it will wait up to \fBtimeout\fR milliseconds trying to lock the semaphore\&. This function is to be avoided if possible since on some platforms it is implemented by polling the semaphore every millisecond in a busy loop\&. +.PP +After \fBSDL_SemWaitTimeout()\fP is successful, the semaphore can be released and its count atomically incremented by a successful call to \fISDL_SemPost\fR\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR if the semaphore was successfully locked or either \fBSDL_MUTEX_TIMEOUT\fR or \fB-1\fR if the timeout period was exceeded or there was an error, respectivly\&. +.PP +If the semaphore was not successfully locked, the semaphore will be unchanged\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWres = SDL_SemWaitTimeout(my_sem, WAIT_TIMEOUT_MILLISEC); + +if (res == SDL_MUTEX_TIMEOUT) { + return TRY_AGAIN; +} +if (res == -1) { + return WAIT_ERROR; +} + +\&.\&.\&. + +SDL_SemPost(my_sem);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateSemaphore\fP\fR, \fI\fBSDL_DestroySemaphore\fP\fR, \fI\fBSDL_SemWait\fP\fR, \fI\fBSDL_SemTryWait\fP\fR, \fI\fBSDL_SemPost\fP\fR, \fI\fBSDL_SemValue\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_SetAlpha.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_SetAlpha.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,55 @@ +.TH "SDL_SetAlpha" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetAlpha\- Adjust the alpha properties of a surface +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_SetAlpha\fP\fR(\fBSDL_Surface *surface, Uint32 flag, Uint8 alpha\fR); +.SH "DESCRIPTION" +.PP +.RS +\fBNote: +.PP +This function and the semantics of SDL alpha blending have changed since version 1\&.1\&.4\&. Up until version 1\&.1\&.5, an alpha value of 0 was considered opaque and a value of 255 was considered transparent\&. This has now been inverted: 0 (\fBSDL_ALPHA_TRANSPARENT\fP) is now considered transparent and 255 (\fBSDL_ALPHA_OPAQUE\fP) is now considered opaque\&. +.RE +.PP +\fBSDL_SetAlpha\fP is used for setting the per-surface alpha and/or enabling and disabling per-pixel alpha blending\&. +.PP +The \fBsurface\fR parameter specifies which surface whose alpha attributes you wish to adjust\&. \fBflags\fR is used to specify whether alpha blending should be used (\fBSDL_SRCALPHA\fP) and whether the surface should use RLE acceleration for blitting (\fBSDL_RLEACCEL\fP)\&. \fBflags\fR can be an OR\&'d combination of these two options, one of these options or 0\&. If \fBSDL_SRCALPHA\fP is not passed as a flag then all alpha information is ignored when blitting the surface\&. The \fBalpha\fR parameter is the per-surface alpha value, a surface need not have an alpha channel to use per-surface alpha and blitting can still be accelerated with \fBSDL_RLEACCEL\fP\&. Setting the per-surface alpha value to 0 disables per-surface alpha blending\&. +.PP +.RS +\fBNote: +.PP +The per-surface alpha value of 128 is considered a special case and is optimised, so it\&'s much faster than other per-surface values\&. +.RE +.PP +Alpha effects surface blitting in the following ways: +.TP 20 +RGBA->RGB with \fBSDL_SRCALPHA\fP +The source is alpha-blended with the destination, using the alpha channel\&. \fBSDL_SRCCOLORKEY\fP and the per-surface alpha are ignored\&. +.TP 20 +RGBA->RGB without \fBSDL_SRCALPHA\fP +The RGB data is copied from the source\&. The source alpha channel and the per-surface alpha value are ignored\&. +.TP 20 +RGB->RGBA with \fBSDL_SRCALPHA\fP +The source is alpha-blended with the destination using the per-surface alpha value\&. If \fBSDL_SRCCOLORKEY\fPliteral> is set, only the pixels not matching the colorkey value are copied\&. +.TP 20 +RGB->RGBA without \fBSDL_SRCALPHA\fP +The RGB data is copied from the source and the destination alpha is zero to opaque\&. If \fBSDL_SRCCOLORKEY\fP is set, only the pixels not matching the colorkey value are copied\&. +.TP 20 +RGBA->RGBA with \fBSDL_SRCALPHA\fP +The source is alpha-blended with the destination using the source alpha channel\&. The alpha channel in the destination surface is left untouched\&. \fBSDL_SRCCOLORKEY\fP is ignored\&. +.TP 20 +RGBA->RGBA without \fBSDL_SRCALPHA\fP +The RGBA data is copied to the destination surface\&. If \fBSDL_SRCCOLORKEY\fP is set, only the pixels not matching the colorkey value are copied\&. +.TP 20 +RGB->RGB with \fBSDL_SRCALPHA\fP +The source is alpha-blended with the destination using the per-surface alpha value\&. If \fBSDL_SRCCOLORKEY\fP is set, only the pixels not matching the colorkey value are copied\&. +.TP 20 +RGB->RGB without \fBSDL_SRCALPHA\fP +The RGB data is copied from the source\&. If \fBSDL_SRCCOLORKEY\fP is set, only the pixels not matching the colorkey value are copied\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_MapRGBA\fP\fR, \fI\fBSDL_GetRGBA\fP\fR, \fI\fBSDL_DisplayFormatAlpha\fP\fR, \fI\fBSDL_BlitSurface\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_SetClipRect.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_SetClipRect.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,19 @@ +.TH "SDL_SetClipRect" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetClipRect\- Sets the clipping rectangle for a surface\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_SetClipRect\fP\fR(\fBSDL_Surface *surface, SDL_Rect *rect\fR); +.SH "DESCRIPTION" +.PP +Sets the clipping rectangle for a surface\&. When this surface is the destination of a blit, only the area within the clip rectangle will be drawn into\&. +.PP +The rectangle pointed to by \fBrect\fR will be clipped to the edges of the surface so that the clip rectangle for a surface can never fall outside the edges of the surface\&. +.PP +If \fBrect\fR is \fBNULL\fP the clipping rectangle will be set to the full size of the surface\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_GetClipRect\fP\fR, \fI\fBSDL_BlitSurface\fP\fR, \fI\fBSDL_Surface\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_SetColorKey.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_SetColorKey.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,26 @@ +.TH "SDL_SetColorKey" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetColorKey\- Sets the color key (transparent pixel) in a blittable surface and RLE acceleration\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_SetColorKey\fP\fR(\fBSDL_Surface *surface, Uint32 flag, Uint32 key\fR); +.SH "DESCRIPTION" +.PP + Sets the color key (transparent pixel) in a blittable surface and enables or disables RLE blit acceleration\&. +.PP +RLE acceleration can substantially speed up blitting of images with large horizontal runs of transparent pixels (i\&.e\&., pixels that match the \fBkey\fR value)\&. The \fBkey\fR must be of the same pixel format as the \fBsurface\fR, \fI\fBSDL_MapRGB\fP\fR is often useful for obtaining an acceptable value\&. +.PP +If \fBflag\fR is \fBSDL_SRCCOLORKEY\fP then \fBkey\fR is the transparent pixel value in the source image of a blit\&. +.PP +If \fBflag\fR is OR\&'d with \fBSDL_RLEACCEL\fP then the surface will be draw using RLE acceleration when drawn with \fISDL_BlitSurface\fR\&. The surface will actually be encoded for RLE acceleration the first time \fISDL_BlitSurface\fR or \fISDL_DisplayFormat\fR is called on the surface\&. +.PP +If \fBflag\fR is 0, this function clears any current color key\&. +.SH "RETURN VALUE" +.PP +This function returns \fB0\fR, or \fB-1\fR if there was an error\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_BlitSurface\fP\fR, \fI\fBSDL_DisplayFormat\fP\fR, \fI\fBSDL_MapRGB\fP\fR, \fI\fBSDL_SetAlpha\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_SetColors.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_SetColors.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,57 @@ +.TH "SDL_SetColors" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetColors\- Sets a portion of the colormap for the given 8-bit surface\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_SetColors\fP\fR(\fBSDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors\fR); +.SH "DESCRIPTION" +.PP +Sets a portion of the colormap for the given 8-bit surface\&. +.PP +When \fBsurface\fR is the surface associated with the current display, the display colormap will be updated with the requested colors\&. If \fBSDL_HWPALETTE\fP was set in \fISDL_SetVideoMode\fR flags, \fBSDL_SetColors\fP will always return \fB1\fR, and the palette is guaranteed to be set the way you desire, even if the window colormap has to be warped or run under emulation\&. +.PP +The color components of a \fI\fBSDL_Color\fR\fR structure are 8-bits in size, giving you a total of 256^3 =16777216 colors\&. +.PP +Palettized (8-bit) screen surfaces with the \fBSDL_HWPALETTE\fP flag have two palettes, a logical palette that is used for mapping blits to/from the surface and a physical palette (that determines how the hardware will map the colors to the display)\&. \fBSDL_SetColors\fP modifies both palettes (if present), and is equivalent to calling \fISDL_SetPalette\fR with the \fBflags\fR set to \fB(SDL_LOGPAL | SDL_PHYSPAL)\fP\&. +.SH "RETURN VALUE" +.PP +If \fBsurface\fR is not a palettized surface, this function does nothing, returning \fB0\fR\&. If all of the colors were set as passed to \fBSDL_SetColors\fP, it will return \fB1\fR\&. If not all the color entries were set exactly as given, it will return \fB0\fR, and you should look at the surface palette to determine the actual color palette\&. +.SH "EXAMPLE" +.PP +.nf +\f(CW/* Create a display surface with a grayscale palette */ +SDL_Surface *screen; +SDL_Color colors[256]; +int i; +\&. +\&. +\&. +/* Fill colors with color information */ +for(i=0;i<256;i++){ + colors[i]\&.r=i; + colors[i]\&.g=i; + colors[i]\&.b=i; +} + +/* Create display */ +screen=SDL_SetVideoMode(640, 480, 8, SDL_HWPALETTE); +if(!screen){ + printf("Couldn\&'t set video mode: %s +", SDL_GetError()); + exit(-1); +} + +/* Set palette */ +SDL_SetColors(screen, colors, 0, 256); +\&. +\&. +\&. +\&.\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_Color\fR\fR \fI\fBSDL_Surface\fR\fR, \fI\fBSDL_SetPalette\fP\fR, \fI\fBSDL_SetVideoMode\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_SetCursor.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_SetCursor.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_SetCursor" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetCursor\- Set the currently active mouse cursor\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid *\fBSDL_SetCursor\fP\fR(\fBSDL_Cursor *cursor\fR); +.SH "DESCRIPTION" +.PP +Sets the currently active cursor to the specified one\&. If the cursor is currently visible, the change will be immediately represented on the display\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_GetCursor\fP\fR, \fI\fBSDL_CreateCursor\fP\fR, \fI\fBSDL_ShowCursor\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_SetEventFilter.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_SetEventFilter.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,35 @@ +.TH "SDL_SetEventFilter" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetEventFilter\- Sets up a filter to process all events before they are posted to the event queue\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_SetEventFilter\fP\fR(\fBSDL_EventFilter filter\fR); +.SH "DESCRIPTION" +.PP +This function sets up a filter to process all events before they are posted to the event queue\&. This is a very powerful and flexible feature\&. The filter is prototyped as: +.PP +.nf +\f(CWtypedef int (*SDL_EventFilter)(const SDL_Event *event);\fR +.fi +.PP + If the filter returns \fB1\fR, then the event will be added to the internal queue\&. If it returns \fB0\fR, then the event will be dropped from the queue\&. This allows selective filtering of dynamically\&. +.PP +There is one caveat when dealing with the \fBSDL_QUITEVENT\fP event type\&. The event filter is only called when the window manager desires to close the application window\&. If the event filter returns 1, then the window will be closed, otherwise the window will remain open if possible\&. If the quit event is generated by an interrupt signal, it will bypass the internal queue and be delivered to the application at the next event poll\&. +.PP +.RS +\fBNote: +.PP +Events pushed onto the queue with \fI\fBSDL_PushEvent\fP\fR or \fI\fBSDL_PeepEvents\fP\fR do not get passed through the event filter\&. +.RE +.PP +.RS +\fBNote: +.PP +\fIBe Careful!\fP The event filter function may run in a different thread so be careful what you do within it\&. +.RE +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_GetEventFilter\fP\fR, \fI\fBSDL_PushEvent\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_SetGamma.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_SetGamma.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,22 @@ +.TH "SDL_SetGamma" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetGamma\- Sets the color gamma function for the display +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_SetGamma\fP\fR(\fBfloat redgamma, float greengamma, float bluegamma\fR); +.SH "DESCRIPTION" +.PP +Sets the "gamma function" for the display of each color component\&. Gamma controls the brightness/contrast of colors displayed on the screen\&. A gamma value of 1\&.0 is identity (i\&.e\&., no adjustment is made)\&. +.PP +This function adjusts the gamma based on the "gamma function" parameter, you can directly specify lookup tables for gamma adjustment with \fISDL_SetGammaRamp\fR\&. +.PP +Not all display hardware is able to change gamma\&. +.SH "RETURN VALUE" +.PP +Returns -1 on error (or if gamma adjustment is not supported)\&. +.SH "SEE ALSO" +.PP +\fISDL_GetGammaRamp\fR \fISDL_SetGammaRamp\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_SetGammaRamp.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_SetGammaRamp.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,22 @@ +.TH "SDL_SetGammaRamp" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetGammaRamp\- Sets the color gamma lookup tables for the display +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_SetGammaRamp\fP\fR(\fBUint16 *redtable, Uint16 *greentable, Uint16 *bluetable\fR); +.SH "DESCRIPTION" +.PP +Sets the gamma lookup tables for the display for each color component\&. Each table is an array of 256 Uint16 values, representing a mapping between the input and output for that channel\&. The input is the index into the array, and the output is the 16-bit gamma value at that index, scaled to the output color precision\&. You may pass NULL to any of the channels to leave them unchanged\&. +.PP +This function adjusts the gamma based on lookup tables, you can also have the gamma calculated based on a "gamma function" parameter with \fISDL_SetGamma\fR\&. +.PP +Not all display hardware is able to change gamma\&. +.SH "RETURN VALUE" +.PP +Returns -1 on error (or if gamma adjustment is not supported)\&. +.SH "SEE ALSO" +.PP +\fISDL_SetGamma\fR \fISDL_GetGammaRamp\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_SetModState.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_SetModState.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,35 @@ +.TH "SDL_SetModState" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetModState\- Set the current key modifier state +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_SetModState\fP\fR(\fBSDLMod modstate\fR); +.SH "DESCRIPTION" +.PP +The inverse of \fI\fBSDL_GetModState\fP\fR, \fBSDL_SetModState\fP allows you to impose modifier key states on your application\&. +.PP +Simply pass your desired modifier states into \fBmodstate\fR\&. This value my be a logical OR\&'d combination of the following: +.PP +.nf +\f(CWtypedef enum { + KMOD_NONE = 0x0000, + KMOD_LSHIFT= 0x0001, + KMOD_RSHIFT= 0x0002, + KMOD_LCTRL = 0x0040, + KMOD_RCTRL = 0x0080, + KMOD_LALT = 0x0100, + KMOD_RALT = 0x0200, + KMOD_LMETA = 0x0400, + KMOD_RMETA = 0x0800, + KMOD_NUM = 0x1000, + KMOD_CAPS = 0x2000, + KMOD_MODE = 0x4000, +} SDLMod;\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_GetModState\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_SetPalette.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_SetPalette.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,59 @@ +.TH "SDL_SetPalette" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetPalette\- Sets the colors in the palette of an 8-bit surface\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_SetPalette\fP\fR(\fBSDL_Surface *surface, int flags, int SDL_Color *colors, int firstcolor, int ncolors\fR); +.SH "DESCRIPTION" +.PP +Sets a portion of the palette for the given 8-bit surface\&. +.PP +Palettized (8-bit) screen surfaces with the \fBSDL_HWPALETTE\fP flag have two palettes, a logical palette that is used for mapping blits to/from the surface and a physical palette (that determines how the hardware will map the colors to the display)\&. \fISDL_BlitSurface\fR always uses the logical palette when blitting surfaces (if it has to convert between surface pixel formats)\&. Because of this, it is often useful to modify only one or the other palette to achieve various special color effects (e\&.g\&., screen fading, color flashes, screen dimming)\&. +.PP +This function can modify either the logical or physical palette by specifing \fBSDL_LOGPAL\fP or \fBSDL_PHYSPAL\fPthe in the \fBflags\fR parameter\&. +.PP +When \fBsurface\fR is the surface associated with the current display, the display colormap will be updated with the requested colors\&. If \fBSDL_HWPALETTE\fP was set in \fISDL_SetVideoMode\fR flags, \fBSDL_SetPalette\fP will always return \fB1\fR, and the palette is guaranteed to be set the way you desire, even if the window colormap has to be warped or run under emulation\&. +.PP +The color components of a \fI\fBSDL_Color\fR\fR structure are 8-bits in size, giving you a total of 256^3=16777216 colors\&. +.SH "RETURN VALUE" +.PP +If \fBsurface\fR is not a palettized surface, this function does nothing, returning \fB0\fR\&. If all of the colors were set as passed to \fBSDL_SetPalette\fP, it will return \fB1\fR\&. If not all the color entries were set exactly as given, it will return \fB0\fR, and you should look at the surface palette to determine the actual color palette\&. +.SH "EXAMPLE" +.PP +.nf +\f(CW /* Create a display surface with a grayscale palette */ + SDL_Surface *screen; + SDL_Color colors[256]; + int i; + \&. + \&. + \&. + /* Fill colors with color information */ + for(i=0;i<256;i++){ + colors[i]\&.r=i; + colors[i]\&.g=i; + colors[i]\&.b=i; + } + + /* Create display */ + screen=SDL_SetVideoMode(640, 480, 8, SDL_HWPALETTE); + if(!screen){ + printf("Couldn\&'t set video mode: %s +", SDL_GetError()); + exit(-1); + } + + /* Set palette */ + SDL_SetPalette(screen, SDL_LOGPAL|SDL_PHYSPAL, colors, 0, 256); + \&. + \&. + \&. + \&.\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fISDL_SetColors\fR, \fISDL_SetVideoMode\fR, \fISDL_Surface\fR, \fISDL_Color\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_SetTimer.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_SetTimer.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,39 @@ +.TH "SDL_SetTimer" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetTimer\- Set a callback to run after the specified number of milliseconds has elapsed\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_SetTimer\fP\fR(\fBUint32 interval, SDL_TimerCallback callback\fR); +.SH "CALLBACK" +.PP +/* Function prototype for the timer callback function */ typedef Uint32 (*SDL_TimerCallback)(Uint32 interval); +.SH "DESCRIPTION" +.PP +Set a callback to run after the specified number of milliseconds has elapsed\&. The callback function is passed the current timer interval and returns the next timer interval\&. If the returned value is the same as the one passed in, the periodic alarm continues, otherwise a new alarm is scheduled\&. +.PP +To cancel a currently running timer, call \fBSDL_SetTimer(0, NULL);\fP +.PP +The timer callback function may run in a different thread than your main constant, and so shouldn\&'t call any functions from within itself\&. +.PP +The maximum resolution of this timer is 10 ms, which means that if you request a 16 ms timer, your callback will run approximately 20 ms later on an unloaded system\&. If you wanted to set a flag signaling a frame update at 30 frames per second (every 33 ms), you might set a timer for 30 ms (see example below)\&. +.PP +If you use this function, you need to pass \fBSDL_INIT_TIMER\fP to \fBSDL_Init()\fP\&. +.PP +.RS +\fBNote: +.PP +This function is kept for compatibility but has been superceeded by the new timer functions \fISDL_AddTimer\fR and \fISDL_RemoveTimer\fR which support multiple timers\&. +.RE +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWSDL_SetTimer((33/10)*10, my_callback);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_AddTimer\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_SetVideoMode.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_SetVideoMode.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,61 @@ +.TH "SDL_SetVideoMode" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SetVideoMode\- Set up a video mode with the specified width, height and bits-per-pixel\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_Surface *\fBSDL_SetVideoMode\fP\fR(\fBint width, int height, int bpp, Uint32 flags\fR); +.SH "DESCRIPTION" +.PP +Set up a video mode with the specified width, height and bits-per-pixel\&. +.PP +If \fBbpp\fR is 0, it is treated as the current display bits per pixel\&. +.PP +The \fBflags\fR parameter is the same as the \fBflags\fR field of the \fI\fBSDL_Surface\fR\fR structure\&. OR\&'d combinations of the following values are valid\&. +.TP 20 +\fBSDL_SWSURFACE\fP +Create the video surface in system memory +.TP 20 +\fBSDL_HWSURFACE\fP +Create the video surface in video memory +.TP 20 +\fBSDL_ASYNCBLIT\fP +Enables the use of asynchronous to the display surface\&. This will usually slow down blitting on single CPU machines, but may provide a speed increase on SMP systems\&. +.TP 20 +\fBSDL_ANYFORMAT\fP +Normally, if a video surface of the requested depth (\fBbpp\fR) is not available, SDL will emulate one with a shadow surface\&. Passing \fBSDL_ANYFORMAT\fP prevents this and causes SDL to use the video surface, regardless of its depth\&. +.TP 20 +\fBSDL_HWPALETTE\fP +Give SDL exclusive palette access\&. Without this flag you may not always get the the colors you request with \fI\fBSDL_SetColors\fP\fR\&. +.TP 20 +\fBSDL_DOUBLEBUF\fP +Enable double buffering\&. Calling \fI\fBSDL_Flip\fP\fR will flip the buffers and update the screen\&. If double buffering could not be enabled then \fBSDL_Flip\fP will just perform a \fI\fBSDL_UpdateRect\fP\fR on the entire screen\&. +.TP 20 +\fBSDL_FULLSCREEN\fP +SDL will attempt to use a fullscreen mode +.TP 20 +\fBSDL_OPENGL\fP +Create an OpenGL rendering context\&. You should have previously set OpenGL video attributes with \fI\fBSDL_GL_SetAttribute\fP\fR\&. +.TP 20 +\fBSDL_OPENGLBLIT\fP +Create an OpenGL rendering context, like above, but allow normal blitting operations\&. +.TP 20 +\fBSDL_RESIZABLE\fP +Create a resizable window\&. When the window is resized by the user a \fI\fBSDL_VIDEORESIZE\fP\fR event is generated and \fBSDL_SetVideoMode\fP can be called again with the new size\&. +.TP 20 +\fBSDL_NOFRAME\fP +If possible, \fBSDL_NOFRAME\fP causes SDL to create a window with no title bar or frame decoration\&. Fullscreen modes automatically have this flag set\&. +.PP +.RS +\fBNote: +.PP +Whatever \fBflags\fR \fBSDL_SetVideoMode\fP could satisfy are set in the \fBflags\fR member of the returned surface\&. +.RE +.SH "RETURN VALUE" +.PP +The framebuffer surface, or \fBNULL\fR if it fails\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_LockSurface\fP\fR, \fI\fBSDL_SetColors\fP\fR, \fI\fBSDL_Flip\fP\fR, \fI\fBSDL_Surface\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_ShowCursor.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_ShowCursor.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,20 @@ +.TH "SDL_ShowCursor" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_ShowCursor\- Toggle whether or not the cursor is shown on the screen\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_ShowCursor\fP\fR(\fBint toggle\fR); +.SH "DESCRIPTION" +.PP +Toggle whether or not the cursor is shown on the screen\&. Passing \fBSDL_ENABLE\fP displays the cursor and passing \fBSDL_DISABLE\fP hides it\&. The current state of the mouse cursor can be queried by passing \fBSDL_QUERY\fP, either \fBSDL_DISABLE\fP or \fBSDL_ENABLE\fP will be returned\&. +.PP +The cursor starts off displayed, but can be turned off\&. +.SH "RETURN VALUE" +.PP +Returns the current state of the cursor\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateCursor\fP\fR, \fI\fBSDL_SetCursor\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_Surface.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_Surface.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,109 @@ +.TH "SDL_Surface" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_Surface\- Graphical Surface Structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct SDL_Surface { + Uint32 flags; /* Read-only */ + SDL_PixelFormat *format; /* Read-only */ + int w, h; /* Read-only */ + Uint16 pitch; /* Read-only */ + void *pixels; /* Read-write */ + int offset; /* Private */ + + /* Hardware-specific surface info */ + struct private_hwdata *hwdata; + + /* clipping information */ + SDL_Rect clip_rect; /* Read-only */ + Uint32 unused1; /* for binary compatibility */ + Uint32 unused2; /* for binary compatibility */ + + /* info for fast blit mapping to other surfaces */ + struct SDL_BlitMap *map; /* Private */ + + /* format version, bumped at every change to invalidate blit maps */ + unsigned int format_version; /* Private */ + + /* Reference count -- used when freeing surface */ + int refcount; /* Read-mostly */ +} SDL_Surface;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBflags\fR +Surface flags +.TP 20 +\fBformat\fR +Pixel \fIformat\fR +.TP 20 +\fBw, h\fR +Width and height of the surface +.TP 20 +\fBpitch\fR +Length of a surface scanline in bytes +.TP 20 +\fBpixels\fR +Pointer to the actual pixel data +.TP 20 +\fBclip_minx, clip_maxx\fR +X clip coords +.TP 20 +\fBclip_rect\fR +surface clip \fIrectangle\fR +.SH "DESCRIPTION" +.PP +\fBSDL_Surface\fR\&'s represent areas of "graphical" memory, memory that can be drawn to\&. The video framebuffer is returned as a \fBSDL_Surface\fR by \fI\fBSDL_SetVideoMode\fP\fR and \fI\fBSDL_GetVideoSurface\fP\fR\&. Most of the fields should be pretty obvious\&. \fBw\fR and \fBh\fR are the width and height of the surface in pixels\&. \fBpixels\fR is a pointer to the actual pixel data, the surface should be \fIlocked\fR before accessing this field\&. The \fBclip_rect\fR field is the clipping rectangle as set by \fI\fBSDL_SetClipRect\fP\fR\&. +.PP +The following are supported in the \fBflags\fR field\&. +.TP 20 +\fBSDL_SWSURFACE\fP +Surface is stored in system memory +.TP 20 +\fBSDL_HWSURFACE\fP +Surface is stored in video memory +.TP 20 +\fBSDL_ASYNCBLIT\fP +Surface uses asynchronous blits if possible +.TP 20 +\fBSDL_ANYFORMAT\fP +Allows any pixel-format (Display surface) +.TP 20 +\fBSDL_HWPALETTE\fP +Surface has exclusive palette +.TP 20 +\fBSDL_DOUBLEBUF\fP +Surface is double buffered (Display surface) +.TP 20 +\fBSDL_FULLSCREEN\fP +Surface is full screen (Display Surface) +.TP 20 +\fBSDL_OPENGL\fP +Surface has an OpenGL context (Display Surface) +.TP 20 +\fBSDL_OPENGLBLIT\fP +Surface supports OpenGL blitting (Display Surface) +.TP 20 +\fBSDL_RESIZABLE\fP +Surface is resizable (Display Surface) +.TP 20 +\fBSDL_HWACCEL\fP +Surface blit uses hardware acceleration +.TP 20 +\fBSDL_SRCOLORKEY\fP +Surface use colorkey blitting +.TP 20 +\fBSDL_RLEACCEL\fP +Colorkey blitting is accelerated with RLE +.TP 20 +\fBSDL_SRCALPHA\fP +Surface blit uses alpha blending +.TP 20 +\fBSDL_PREALLOC\fP +Surface uses preallocated memory +.SH "SEE ALSO" +.PP +\fI\fBSDL_PixelFormat\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_SysWMEvent.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_SysWMEvent.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,21 @@ +.TH "SDL_SysWMEvent" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_SysWMEvent\- Platform-dependent window manager event\&. +.SH "DESCRIPTION" +.PP +The system window manager event contains a pointer to system-specific information about unknown window manager events\&. If you enable this event using \fI\fBSDL_EventState()\fP\fR, it will be generated whenever unhandled events are received from the window manager\&. This can be used, for example, to implement cut-and-paste in your application\&. +.PP +.nf +\f(CWtypedef struct { + Uint8 type; /* Always SDL_SysWM */ + } SDL_SysWMEvent;\fR +.fi +.PP + If you want to obtain system-specific information about the window manager, you can fill the version member of a \fBSDL_SysWMinfo\fR structure (details can be found in \fBSDL_syswm\&.h\fP, which must be included) using the \fBSDL_VERSION()\fP macro found in \fBSDL_version\&.h\fP, and pass it to the function: +.PP +.sp +\fBint \fBSDL_GetWMInfo\fP\fR(\fBSDL_SysWMinfo *info\fR); +.SH "SEE ALSO" +.PP +\fI\fBSDL_EventState\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_ThreadID.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_ThreadID.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,13 @@ +.TH "SDL_ThreadID" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_ThreadID\- Get the 32-bit thread identifier for the current thread\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBUint32 \fBSDL_ThreadID\fP\fR(\fBvoid\fR) +.SH "DESCRIPTION" +.PP +Get the 32-bit thread identifier for the current thread\&. +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_UnlockAudio.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_UnlockAudio.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_UnlockAudio" "3" "Mon 12 Mar 2001, 01:02" "SDL" "SDL API Reference" +.SH "NAME" +SDL_UnlockAudio\- Unlock the callback function +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_UnlockAudio\fP\fR(\fBvoid\fR) +.SH "DESCRIPTION" +.PP +Unlocks a previous \fI\fBSDL_LockAudio\fP\fR call\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_OpenAudio\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:02 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_UnlockSurface.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_UnlockSurface.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,17 @@ +.TH "SDL_UnlockSurface" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_UnlockSurface\- Unlocks a previously locked surface\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_UnlockSurface\fP\fR(\fBSDL_Surface *surface\fR); +.SH "DESCRIPTION" +.PP +Surfaces that were previously locked using \fBSDL_LockSurface\fP must be unlocked with \fBSDL_UnlockSurface\fP\&. Surfaces should be unlocked as soon as possible\&. +.PP +It should be noted that since 1\&.1\&.8, surface locks are recursive\&. See \fI\fBSDL_LockSurface\fP\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_LockSurface\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_UnlockYUVOverlay.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_UnlockYUVOverlay.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_UnlockYUVOverlay" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_UnlockYUVOverlay\- Unlock an overlay +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_UnlockYUVOverlay\fP\fR(\fBSDL_Overlay *overlay\fR); +.SH "DESCRIPTION" +.PP +The opposite to \fI\fBSDL_LockYUVOverlay\fP\fR\&. Unlocks a previously locked overlay\&. An overlay must be unlocked before it can be displayed\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_UnlockYUVOverlay\fP\fR, \fI\fBSDL_CreateYUVOverlay\fP\fR, \fI\fBSDL_Overlay\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_UpdateRect.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_UpdateRect.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,19 @@ +.TH "SDL_UpdateRect" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_UpdateRect\- Makes sure the given area is updated on the given screen\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_UpdateRect\fP\fR(\fBSDL_Surface *screen, Sint32 x, Sint32 y, Sint32 w, Sint32 h\fR); +.SH "DESCRIPTION" +.PP +Makes sure the given area is updated on the given screen\&. +.PP +If \&'\fBx\fR\&', \&'\fBy\fR\&', \&'\fBw\fR\&' and \&'\fBh\fR\&' are all 0, \fBSDL_UpdateRect\fP will update the entire screen\&. +.PP +This function should not be called while \&'\fBscreen\fR\&' is \fIlocked\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_UpdateRects\fP\fR, \fI\fBSDL_Rect\fR\fR, \fI\fBSDL_Surface\fR\fR, \fI\fBSDL_LockSurface\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_UpdateRects.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_UpdateRects.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,17 @@ +.TH "SDL_UpdateRects" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_UpdateRects\- Makes sure the given list of rectangles is updated on the given screen\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_UpdateRects\fP\fR(\fBSDL_Surface *screen, int numrects, SDL_Rect *rects\fR); +.SH "DESCRIPTION" +.PP +Makes sure the given list of rectangles is updated on the given screen\&. +.PP +This function should not be called while \fBscreen\fR is \fIlocked\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_UpdateRect\fP\fR, \fI\fBSDL_Rect\fR\fR, \fI\fBSDL_Surface\fR\fR, \fI\fBSDL_LockSurface\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_UserEvent.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_UserEvent.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,47 @@ +.TH "SDL_UserEvent" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_UserEvent\- A user-defined event type +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 type; + int code; + void *data1; + void *data2; +} SDL_UserEvent;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBtype\fR +\fBSDL_USEREVENT\fP through to \fBSDL_NUMEVENTS-1\fP +.TP 20 +\fBcode\fR +User defined event code +.TP 20 +\fBdata1\fR +User defined data pointer +.TP 20 +\fBdata2\fR +User defined data pointer +.SH "DESCRIPTION" +.PP +\fBSDL_UserEvent\fR is in the \fBuser\fR member of the structure \fI\fBSDL_Event\fR\fR\&. This event is unique, it is never created by SDL but only by the user\&. The event can be pushed onto the event queue using \fI\fBSDL_PushEvent\fP\fR\&. The contents of the structure members or completely up to the programmer, the only requirement is that \fBtype\fR is a value from \fBSDL_USEREVENT\fP to \fBSDL_NUMEVENTS-1\fP (inclusive)\&. +.SH "EXAMPLES" +.PP +.PP +.nf +\f(CWSDL_Event event; + +event\&.type = SDL_USEREVENT; +event\&.user\&.code = my_event_code; +event\&.user\&.data1 = significant_data; +event\&.user\&.data2 = 0; +SDL_PushEvent(&event);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_PushEvent\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_VideoDriverName.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_VideoDriverName.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,18 @@ +.TH "SDL_VideoDriverName" "3" "Mon 12 Mar 2001, 01:05" "SDL" "SDL API Reference" +.SH "NAME" +SDL_VideoDriverName\- Obtain the name of the video driver +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBchar *\fBSDL_VideoDriverName\fP\fR(\fBchar *namebuf, int maxlen\fR); +.SH "DESCRIPTION" +.PP +The buffer pointed to by \fBnamebuf\fR is filled up to a maximum of \fBmaxlen\fR characters (include the NULL terminator) with the name of the initialised video driver\&. The driver name is a simple one word identifier like "x11" or "windib"\&. +.SH "RETURN VALUE" +.PP +Returns \fBNULL\fP if video has not been initialised with \fBSDL_Init\fP or a pointer to \fBnamebuf\fR otherwise\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Init\fP\fR \fI\fBSDL_InitSubSystem\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:05 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_VideoInfo.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_VideoInfo.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,62 @@ +.TH "SDL_VideoInfo" "3" "Mon 12 Mar 2001, 01:05" "SDL" "SDL API Reference" +.SH "NAME" +SDL_VideoInfo\- Video Target information +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint32 hw_available:1; + Uint32 wm_available:1; + Uint32 blit_hw:1; + Uint32 blit_hw_CC:1; + Uint32 blit_hw_A:1; + Uint32 blit_sw:1; + Uint32 blit_sw_CC:1; + Uint32 blit_sw_A:1; + Uint32 blit_fill; + Uint32 video_mem; + SDL_PixelFormat *vfmt; +} SDL_VideoInfo;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBhw_available\fR +Is it possible to create hardware surfaces? +.TP 20 +\fBwm_available\fR +Is there a window manager available +.TP 20 +\fBblit_hw\fR +Are hardware to hardware blits accelerated? +.TP 20 +\fBblit_hw_CC\fR +Are hardware to hardware colorkey blits accelerated? +.TP 20 +\fBblit_hw_A\fR +Are hardware to hardware alpha blits accelerated? +.TP 20 +\fBblit_sw\fR +Are software to hardware blits accelerated? +.TP 20 +\fBblit_sw_CC\fR +Are software to hardware colorkey blits accelerated? +.TP 20 +\fBblit_sw_A\fR +Are software to hardware alpha blits accelerated? +.TP 20 +\fBblit_fill\fR +Are color fills accelerated? +.TP 20 +\fBvideo_mem\fR +Total amount of video memory in Kilobytes +.TP 20 +\fBvfmt\fR +\fIPixel format\fR of the video device +.SH "DESCRIPTION" +.PP +This (read-only) structure is returned by \fI\fBSDL_GetVideoInfo\fP\fR\&. It contains information on either the \&'best\&' available mode (if called before \fI\fBSDL_SetVideoMode\fP\fR) or the current video mode\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_PixelFormat\fR\fR, \fI\fBSDL_GetVideoInfo\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:05 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_VideoModeOK.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_VideoModeOK.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,44 @@ +.TH "SDL_VideoModeOK" "3" "Mon 12 Mar 2001, 01:05" "SDL" "SDL API Reference" +.SH "NAME" +SDL_VideoModeOK\- Check to see if a particular video mode is supported\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_VideoModeOK\fP\fR(\fBint width, int height, int bpp, Uint32 flags\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_VideoModeOK\fP returns \fB0\fR if the requested mode is not supported under any bit depth, or returns the bits-per-pixel of the closest available mode with the given width, height and requested \fIsurface\fR flags (see \fI\fBSDL_SetVideoMode\fP\fR)\&. +.PP +The bits-per-pixel value returned is only a suggested mode\&. You can usually request and bpp you want when \fIsetting\fR the video mode and SDL will emulate that color depth with a shadow video surface\&. +.PP +The arguments to \fBSDL_VideoModeOK\fP are the same ones you would pass to \fISDL_SetVideoMode\fR +.SH "EXAMPLE" +.PP +.nf +\f(CWSDL_Surface *screen; +Uint32 bpp; +\&. +\&. +\&. +printf("Checking mode 640x480@16bpp\&. +"); +bpp=SDL_VideoModeOK(640, 480, 16, SDL_HWSURFACE); + +if(!bpp){ + printf("Mode not available\&. +"); + exit(-1); +} + +printf("SDL Recommends 640x480@%dbpp\&. +", bpp); +screen=SDL_SetVideoMode(640, 480, bpp, SDL_HWSURFACE); +\&. +\&.\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_SetVideoMode\fP\fR, \fI\fBSDL_GetVideoInfo\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:05 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_WM_GetCaption.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_WM_GetCaption.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_WM_GetCaption" "3" "Mon 12 Mar 2001, 01:05" "SDL" "SDL API Reference" +.SH "NAME" +SDL_WM_GetCaption\- Gets the window title and icon name\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_WM_GetCaption\fP\fR(\fBchar **title, char **icon\fR); +.SH "DESCRIPTION" +.PP +Set pointers to the window \fBtitle\fR and \fBicon\fR name\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_WM_SetCaption\fP\fR, \fI\fBSDL_WM_SetIcon\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:05 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_WM_GrabInput.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_WM_GrabInput.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,28 @@ +.TH "SDL_WM_GrabInput" "3" "Mon 12 Mar 2001, 01:05" "SDL" "SDL API Reference" +.SH "NAME" +SDL_WM_GrabInput\- Grabs mouse and keyboard input\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBSDL_GrabMode \fBSDL_WM_GrabInput\fP\fR(\fBSDL_GrabMode mode\fR); +.SH "DESCRIPTION" +.PP +Grabbing means that the mouse is confined to the application window, and nearly all keyboard input is passed directly to the application, and not interpreted by a window manager, if any\&. +.PP +When \fBmode\fR is \fBSDL_GRAB_QUERY\fP the grab mode is not changed, but the current grab mode is returned\&. +.PP +.PP +.nf +\f(CWtypedef enum { + SDL_GRAB_QUERY, + SDL_GRAB_OFF, + SDL_GRAB_ON +} SDL_GrabMode;\fR +.fi +.PP + +.SH "RETURN VALUE" +.PP +The current/new \fBSDL_GrabMode\fR\&. +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:05 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_WM_IconifyWindow.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_WM_IconifyWindow.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_WM_IconifyWindow" "3" "Mon 12 Mar 2001, 01:05" "SDL" "SDL API Reference" +.SH "NAME" +SDL_WM_IconifyWindow\- Iconify/Minimise the window +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_WM_IconifyWindow\fP\fR(\fBvoid\fR); +.SH "DESCRIPTION" +.PP +If the application is running in a window managed environment SDL attempts to iconify/minimise it\&. If \fBSDL_WM_IconifyWindow\fP is successful, the application will receive a \fI\fBSDL_APPACTIVE\fP\fR loss event\&. +.SH "RETURN VALUE" +.PP +Returns non-zero on success or \fB0\fR if iconification is not support or was refused by the window manager\&. +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:05 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_WM_SetCaption.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_WM_SetCaption.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_WM_SetCaption" "3" "Mon 12 Mar 2001, 01:05" "SDL" "SDL API Reference" +.SH "NAME" +SDL_WM_SetCaption\- Sets the window tile and icon name\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_WM_SetCaption\fP\fR(\fBconst char *title, const char *icon\fR); +.SH "DESCRIPTION" +.PP +Sets the title-bar and icon name of the display window\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_WM_GetCaption\fP\fR, \fI\fBSDL_WM_SetIcon\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:05 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_WM_SetIcon.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_WM_SetIcon.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,27 @@ +.TH "SDL_WM_SetIcon" "3" "Mon 12 Mar 2001, 01:05" "SDL" "SDL API Reference" +.SH "NAME" +SDL_WM_SetIcon\- Sets the icon for the display window\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_WM_SetIcon\fP\fR(\fBSDL_Surface *icon, Uint8 *mask\fR); +.SH "DESCRIPTION" +.PP +Sets the icon for the display window\&. +.PP +This function must be called before the first call to \fISDL_SetVideoMode\fR\&. +.PP +It takes an \fBicon\fR surface, and a \fBmask\fR in MSB format\&. +.PP +If \fBmask\fR is \fBNULL\fP, the entire icon surface will be used as the icon\&. +.SH "EXAMPLE" +.PP +.nf +\f(CWSDL_WM_SetIcon(SDL_LoadBMP("icon\&.bmp"), NULL);\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_SetVideoMode\fP\fR, \fI\fBSDL_WM_SetCaption\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:05 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_WM_ToggleFullScreen.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_WM_ToggleFullScreen.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_WM_ToggleFullScreen" "3" "Mon 12 Mar 2001, 01:05" "SDL" "SDL API Reference" +.SH "NAME" +SDL_WM_ToggleFullScreen\- Toggles fullscreen mode +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_WM_ToggleFullScreen\fP\fR(\fBSDL_Surface *surface\fR); +.SH "DESCRIPTION" +.PP +Toggles the application between windowed and fullscreen mode, if supported\&. (X11 is the only target currently supported, BeOS support is experimental)\&. +.SH "RETURN VALUE" +.PP +Returns \fB0\fR on failure or \fB1\fR on success\&. +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:05 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_WaitEvent.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_WaitEvent.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,17 @@ +.TH "SDL_WaitEvent" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_WaitEvent\- Waits indefinitely for the next available event\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBint \fBSDL_WaitEvent\fP\fR(\fBSDL_Event *event\fR); +.SH "DESCRIPTION" +.PP +Waits indefinitely for the next available event, returning \fB1\fR, or \fB0\fR if there was an error while waiting for events\&. +.PP +If \fBevent\fR is not \fBNULL\fP, the next event is removed from the queue and stored in that area\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_Event\fR\fR, \fI\fBSDL_PollEvent\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_WaitThread.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_WaitThread.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,19 @@ +.TH "SDL_WaitThread" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_WaitThread\- Wait for a thread to finish\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBvoid \fBSDL_WaitThread\fP\fR(\fBSDL_Thread *thread, int *status\fR); +.SH "DESCRIPTION" +.PP +Wait for a thread to finish (timeouts are not supported)\&. +.SH "RETURN VALUE" +.PP +The return code for the thread function is placed in the area pointed to by \fBstatus\fR, if \fBstatus\fR is not \fBNULL\fR\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateThread\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_WarpMouse.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_WarpMouse.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,15 @@ +.TH "SDL_WarpMouse" "3" "Mon 12 Mar 2001, 01:05" "SDL" "SDL API Reference" +.SH "NAME" +SDL_WarpMouse\- Set the position of the mouse cursor\&. +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBvoid \fBSDL_WarpMouse\fP\fR(\fBUint16 x, Uint16 y\fR); +.SH "DESCRIPTION" +.PP +Set the position of the mouse cursor (generates a mouse motion event)\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_MouseMotionEvent\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:05 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_WasInit.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_WasInit.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,63 @@ +.TH "SDL_WasInit" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_WasInit\- Check which subsystems are initialized +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +.sp +\fBUint32 \fBSDL_WasInit\fP\fR(\fBUint32 flags\fR); +.SH "DESCRIPTION" +.PP +\fBSDL_WasInit\fP allows you to see which SDL subsytems have been \fIinitialized\fR\&. \fBflags\fR is a bitwise OR\&'d combination of the subsystems you wish to check (see \fI\fBSDL_Init\fP\fR for a list of subsystem flags)\&. +.SH "RETURN VALUE" +.PP +\fBSDL_WasInit\fP returns a bitwised OR\&'d combination of the initialized subsystems\&. +.SH "EXAMPLES" +.PP +.nf +\f(CW +/* Here are several ways you can use SDL_WasInit() */ + +/* Get init data on all the subsystems */ +Uint32 subsystem_init; + +subsystem_init=SDL_WasInit(SDL_INIT_EVERYTHING); + +if(subsystem_init&SDL_INIT_VIDEO) + printf("Video is initialized\&. +"); +else + printf("Video is not initialized\&. +"); + + + +/* Just check for one specfic subsystem */ + +if(SDL_WasInit(SDL_INIT_VIDEO)!=0) + printf("Video is initialized\&. +"); +else + printf("Video is not initialized\&. +"); + + + + +/* Check for two subsystems */ + +Uint32 subsystem_mask=SDL_INIT_VIDEO|SDL_INIT_AUDIO; + +if(SDL_WasInit(subsystem_mask)==subsystem_mask) + printf("Video and Audio initialized\&. +"); +else + printf("Video and Audio not initialized\&. +"); +\fR +.fi +.PP +.SH "SEE ALSO" +.PP +\fI\fBSDL_Init\fP\fR, \fI\fBSDL_Subsystem\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_keysym.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_keysym.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,69 @@ +.TH "SDL_keysym" "3" "Mon 12 Mar 2001, 01:03" "SDL" "SDL API Reference" +.SH "NAME" +SDL_keysym\- Keysym structure +.SH "STRUCTURE DEFINITION" +.PP +.nf +\f(CWtypedef struct{ + Uint8 scancode; + SDLKey sym; + SDLMod mod; + Uint16 unicode; +} SDL_keysym;\fR +.fi +.PP +.SH "STRUCTURE DATA" +.TP 20 +\fBscancode\fR +Hardware specific scancode +.TP 20 +\fBsym\fR +SDL virtual keysym +.TP 20 +\fBmod\fR +Current key modifiers +.TP 20 +\fBunicode\fR +Translated character +.SH "DESCRIPTION" +.PP +The \fBSDL_keysym\fR structure is used by reporting key presses and releases since it is a part of the \fI\fBSDL_KeyboardEvent\fR\fR\&. +.PP +The \fBscancode\fR field should generally be left alone, it is the hardware dependent scancode returned by the keyboard\&. The \fBsym\fR field is extremely useful\&. It is the SDL-defined value of the key (see \fISDL Key Syms\fR\&. This field is very useful when you are checking for certain key presses, like so: +.PP +.nf +\f(CW\&. +\&. +while(SDL_PollEvent(&event)){ + switch(event\&.type){ + case SDL_KEYDOWN: + if(event\&.key\&.keysym\&.sym==SDLK_LEFT) + move_left(); + break; + \&. + \&. + \&. + } +} +\&. +\&.\fR +.fi +.PP + \fBmod\fR stores the current state of the keyboard modifiers as explained in \fI\fBSDL_GetModState\fP\fR\&. The \fBunicode\fR is only used when UNICODE translation is enabled with \fI\fBSDL_EnableUNICODE\fP\fR\&. If \fBunicode\fR is non-zero then this a the UNICODE character corresponding to the keypress\&. If the high 9 bits of the character are 0, then this maps to the equivalent ASCII character: +.PP +.nf +\f(CWchar ch; +if ( (keysym\&.unicode & 0xFF80) == 0 ) { + ch = keysym\&.unicode & 0x7F; +} +else { + printf("An International Character\&. +"); +}\fR +.fi +.PP + UNICODE translation does have a slight overhead so don\&'t enable it unless its needed\&. +.SH "SEE ALSO" +.PP +\fI\fBSDLKey\fR\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:03 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_mutexP.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_mutexP.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,18 @@ +.TH "SDL_mutexP" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_mutexP\- Lock a mutex +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBint \fBSDL_mutexP\fP\fR(\fBSDL_mutex *mutex\fR); +.SH "DESCRIPTION" +.PP +Locks the \fBmutex\fR, which was previously created with \fI\fBSDL_CreateMutex\fP\fR\&. If the mutex is already locked then \fBSDL_mutexP\fP will not return until it is \fIunlocked\fR\&. Returns \fB0\fR on success, or \fB-1\fR on an error\&. +.PP +SDL also defines a macro \fB#define SDL_LockMutex(m) SDL_mutexP(m)\fP\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateMutex\fP\fR, \fI\fBSDL_mutexV\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 docs/man3/SDL_mutexV.3 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/docs/man3/SDL_mutexV.3 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,18 @@ +.TH "SDL_mutexV" "3" "Mon 12 Mar 2001, 01:04" "SDL" "SDL API Reference" +.SH "NAME" +SDL_mutexV\- Unlock a mutex +.SH "SYNOPSIS" +.PP +\fB#include "SDL\&.h" +#include "SDL_thread\&.h" +.sp +\fBint \fBSDL_mutexV\fP\fR(\fBSDL_mutex *mutex\fR); +.SH "DESCRIPTION" +.PP +Unlocks the \fBmutex\fR, which was previously created with \fI\fBSDL_CreateMutex\fP\fR\&. Returns \fB0\fR on success, or \fB-1\fR on an error\&. +.PP +SDL also defines a macro \fB#define SDL_UnlockMutex(m) SDL_mutexV(m)\fP\&. +.SH "SEE ALSO" +.PP +\fI\fBSDL_CreateMutex\fP\fR, \fI\fBSDL_mutexP\fP\fR +...\" created by instant / docbook-to-man, Mon 12 Mar 2001, 01:04 diff -r 000000000000 -r 74212992fb08 include/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/.cvsignore Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,2 @@ +Makefile.in +Makefile diff -r 000000000000 -r 74212992fb08 include/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/Makefile.am Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,33 @@ +# The input Makefile for SDL header files + +# The directory where the include files will be installed +libSDLincludedir = $(includedir)/SDL + +# Which header files to install +libSDLinclude_HEADERS = \ + SDL.h \ + SDL_active.h \ + SDL_audio.h \ + SDL_byteorder.h \ + SDL_cdrom.h \ + SDL_copying.h \ + SDL_endian.h \ + SDL_error.h \ + SDL_events.h \ + SDL_getenv.h \ + SDL_joystick.h \ + SDL_keyboard.h \ + SDL_keysym.h \ + SDL_main.h \ + SDL_mouse.h \ + SDL_mutex.h \ + SDL_quit.h \ + SDL_rwops.h \ + SDL_syswm.h \ + SDL_thread.h \ + SDL_timer.h \ + SDL_types.h \ + SDL_version.h \ + SDL_video.h \ + begin_code.h \ + close_code.h diff -r 000000000000 -r 74212992fb08 include/SDL.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,97 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Main include header for the SDL library */ + +#ifndef _SDL_H +#define _SDL_H + +#include "SDL_main.h" +#include "SDL_types.h" +#include "SDL_getenv.h" +#include "SDL_error.h" +#include "SDL_rwops.h" +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "SDL_cdrom.h" +#include "SDL_joystick.h" +#include "SDL_events.h" +#include "SDL_video.h" +#include "SDL_byteorder.h" +#include "SDL_version.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* As of version 0.5, SDL is loaded dynamically into the application */ + +/* These are the flags which may be passed to SDL_Init() -- you should + specify the subsystems which you will be using in your application. +*/ +#define SDL_INIT_TIMER 0x00000001 +#define SDL_INIT_AUDIO 0x00000010 +#define SDL_INIT_VIDEO 0x00000020 +#define SDL_INIT_CDROM 0x00000100 +#define SDL_INIT_JOYSTICK 0x00000200 +#define SDL_INIT_NOPARACHUTE 0x00100000 /* Don't catch fatal signals */ +#define SDL_INIT_EVENTTHREAD 0x01000000 /* Not supported on all OS's */ +#define SDL_INIT_EVERYTHING 0x0000FFFF + +/* This function loads the SDL dynamically linked library and initializes + * the subsystems specified by 'flags' (and those satisfying dependencies) + * Unless the SDL_INIT_NOPARACHUTE flag is set, it will install cleanup + * signal handlers for some commonly ignored fatal signals (like SIGSEGV) + */ +extern DECLSPEC int SDL_Init(Uint32 flags); + +/* This function initializes specific SDL subsystems */ +extern DECLSPEC int SDL_InitSubSystem(Uint32 flags); + +/* This function cleans up specific SDL subsystems */ +extern DECLSPEC void SDL_QuitSubSystem(Uint32 flags); + +/* This function returns mask of the specified subsystems which have + been initialized. + If 'flags' is 0, it returns a mask of all initialized subsystems. +*/ +extern DECLSPEC Uint32 SDL_WasInit(Uint32 flags); + +/* This function cleans up all initialized subsystems and unloads the + * dynamically linked library. You should call it upon all exit conditions. + */ +extern DECLSPEC void SDL_Quit(void); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_H */ diff -r 000000000000 -r 74212992fb08 include/SDL_active.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_active.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,60 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Include file for SDL application focus event handling */ + +#ifndef _SDL_active_h +#define _SDL_active_h + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* The available application states */ +#define SDL_APPMOUSEFOCUS 0x01 /* The app has mouse coverage */ +#define SDL_APPINPUTFOCUS 0x02 /* The app has input focus */ +#define SDL_APPACTIVE 0x04 /* The application is active */ + +/* Function prototypes */ +/* + * This function returns the current state of the application, which is a + * bitwise combination of SDL_APPMOUSEFOCUS, SDL_APPINPUTFOCUS, and + * SDL_APPACTIVE. If SDL_APPACTIVE is set, then the user is able to + * see your application, otherwise it has been iconified or disabled. + */ +extern DECLSPEC Uint8 SDL_GetAppState(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_active_h */ diff -r 000000000000 -r 74212992fb08 include/SDL_audio.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_audio.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,260 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Access to the raw audio mixing buffer for the SDL library */ + +#ifndef _SDL_audio_h +#define _SDL_audio_h + +#include + +#include "SDL_main.h" +#include "SDL_types.h" +#include "SDL_error.h" +#include "SDL_rwops.h" +#include "SDL_byteorder.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* The calculated values in this structure are calculated by SDL_OpenAudio() */ +typedef struct { + int freq; /* DSP frequency -- samples per second */ + Uint16 format; /* Audio data format */ + Uint8 channels; /* Number of channels: 1 mono, 2 stereo */ + Uint8 silence; /* Audio buffer silence value (calculated) */ + Uint16 samples; /* Audio buffer size in samples */ + Uint16 padding; /* Necessary for some compile environments */ + Uint32 size; /* Audio buffer size in bytes (calculated) */ + /* This function is called when the audio device needs more data. + 'stream' is a pointer to the audio data buffer + 'len' is the length of that buffer in bytes. + Once the callback returns, the buffer will no longer be valid. + Stereo samples are stored in a LRLRLR ordering. + */ + void (*callback)(void *userdata, Uint8 *stream, int len); + void *userdata; +} SDL_AudioSpec; + +/* Audio format flags (defaults to LSB byte order) */ +#define AUDIO_U8 0x0008 /* Unsigned 8-bit samples */ +#define AUDIO_S8 0x8008 /* Signed 8-bit samples */ +#define AUDIO_U16LSB 0x0010 /* Unsigned 16-bit samples */ +#define AUDIO_S16LSB 0x8010 /* Signed 16-bit samples */ +#define AUDIO_U16MSB 0x1010 /* As above, but big-endian byte order */ +#define AUDIO_S16MSB 0x9010 /* As above, but big-endian byte order */ +#define AUDIO_U16 AUDIO_U16LSB +#define AUDIO_S16 AUDIO_S16LSB + +/* Native audio byte ordering */ +#if SDL_BYTEORDER == SDL_LIL_ENDIAN +#define AUDIO_U16SYS AUDIO_U16LSB +#define AUDIO_S16SYS AUDIO_S16LSB +#else +#define AUDIO_U16SYS AUDIO_U16MSB +#define AUDIO_S16SYS AUDIO_S16MSB +#endif + + +/* A structure to hold a set of audio conversion filters and buffers */ +typedef struct SDL_AudioCVT { + int needed; /* Set to 1 if conversion possible */ + Uint16 src_format; /* Source audio format */ + Uint16 dst_format; /* Target audio format */ + double rate_incr; /* Rate conversion increment */ + Uint8 *buf; /* Buffer to hold entire audio data */ + int len; /* Length of original audio buffer */ + int len_cvt; /* Length of converted audio buffer */ + int len_mult; /* buffer must be len*len_mult big */ + double len_ratio; /* Given len, final size is len*len_ratio */ + void (*filters[10])(struct SDL_AudioCVT *cvt, Uint16 format); + int filter_index; /* Current audio conversion function */ +} SDL_AudioCVT; + + +/* Function prototypes */ + +/* These functions are used internally, and should not be used unless you + * have a specific need to specify the audio driver you want to use. + * You should normally use SDL_Init() or SDL_InitSubSystem(). + */ +extern DECLSPEC int SDL_AudioInit(const char *driver_name); +extern DECLSPEC void SDL_AudioQuit(void); + +/* This function fills the given character buffer with the name of the + * current audio driver, and returns a pointer to it if the audio driver has + * been initialized. It returns NULL if no driver has been initialized. + */ +extern DECLSPEC char *SDL_AudioDriverName(char *namebuf, int maxlen); + +/* + * This function opens the audio device with the desired parameters, and + * returns 0 if successful, placing the actual hardware parameters in the + * structure pointed to by 'obtained'. If 'obtained' is NULL, the audio + * data passed to the callback function will be guaranteed to be in the + * requested format, and will be automatically converted to the hardware + * audio format if necessary. This function returns -1 if it failed + * to open the audio device, or couldn't set up the audio thread. + * + * When filling in the desired audio spec structure, + * 'desired->freq' should be the desired audio frequency in samples-per-second. + * 'desired->format' should be the desired audio format. + * 'desired->samples' is the desired size of the audio buffer, in samples. + * This number should be a power of two, and may be adjusted by the audio + * driver to a value more suitable for the hardware. Good values seem to + * range between 512 and 8096 inclusive, depending on the application and + * CPU speed. Smaller values yield faster response time, but can lead + * to underflow if the application is doing heavy processing and cannot + * fill the audio buffer in time. A stereo sample consists of both right + * and left channels in LR ordering. + * Note that the number of samples is directly related to time by the + * following formula: ms = (samples*1000)/freq + * 'desired->size' is the size in bytes of the audio buffer, and is + * calculated by SDL_OpenAudio(). + * 'desired->silence' is the value used to set the buffer to silence, + * and is calculated by SDL_OpenAudio(). + * 'desired->callback' should be set to a function that will be called + * when the audio device is ready for more data. It is passed a pointer + * to the audio buffer, and the length in bytes of the audio buffer. + * This function usually runs in a separate thread, and so you should + * protect data structures that it accesses by calling SDL_LockAudio() + * and SDL_UnlockAudio() in your code. + * 'desired->userdata' is passed as the first parameter to your callback + * function. + * + * The audio device starts out playing silence when it's opened, and should + * be enabled for playing by calling SDL_PauseAudio(0) when you are ready + * for your audio callback function to be called. Since the audio driver + * may modify the requested size of the audio buffer, you should allocate + * any local mixing buffers after you open the audio device. + */ +extern DECLSPEC int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained); + +/* + * Get the current audio state: + */ +typedef enum { + SDL_AUDIO_STOPPED = 0, + SDL_AUDIO_PLAYING, + SDL_AUDIO_PAUSED +} SDL_audiostatus; +extern DECLSPEC SDL_audiostatus SDL_GetAudioStatus(void); + +/* + * This function pauses and unpauses the audio callback processing. + * It should be called with a parameter of 0 after opening the audio + * device to start playing sound. This is so you can safely initialize + * data for your callback function after opening the audio device. + * Silence will be written to the audio device during the pause. + */ +extern DECLSPEC void SDL_PauseAudio(int pause_on); + +/* + * This function loads a WAVE from the data source, automatically freeing + * that source if 'freesrc' is non-zero. For example, to load a WAVE file, + * you could do: + * SDL_LoadWAV_RW(SDL_RWFromFile("sample.wav", "rb"), 1, ...); + * + * If this function succeeds, it returns the given SDL_AudioSpec, + * filled with the audio data format of the wave data, and sets + * 'audio_buf' to a malloc()'d buffer containing the audio data, + * and sets 'audio_len' to the length of that audio buffer, in bytes. + * You need to free the audio buffer with SDL_FreeWAV() when you are + * done with it. + * + * This function returns NULL and sets the SDL error message if the + * wave file cannot be opened, uses an unknown data format, or is + * corrupt. Currently raw and MS-ADPCM WAVE files are supported. + */ +extern DECLSPEC SDL_AudioSpec *SDL_LoadWAV_RW(SDL_RWops *src, int freesrc, + SDL_AudioSpec *spec, Uint8 **audio_buf, Uint32 *audio_len); + +/* Compatibility convenience function -- loads a WAV from a file */ +#define SDL_LoadWAV(file, spec, audio_buf, audio_len) \ + SDL_LoadWAV_RW(SDL_RWFromFile(file, "rb"),1, spec,audio_buf,audio_len) + +/* + * This function frees data previously allocated with SDL_LoadWAV_RW() + */ +extern DECLSPEC void SDL_FreeWAV(Uint8 *audio_buf); + +/* + * This function takes a source format and rate and a destination format + * and rate, and initializes the 'cvt' structure with information needed + * by SDL_ConvertAudio() to convert a buffer of audio data from one format + * to the other. + * This function returns 0, or -1 if there was an error. + */ +extern DECLSPEC int SDL_BuildAudioCVT(SDL_AudioCVT *cvt, + Uint16 src_format, Uint8 src_channels, int src_rate, + Uint16 dst_format, Uint8 dst_channels, int dst_rate); + +/* Once you have initialized the 'cvt' structure using SDL_BuildAudioCVT(), + * created an audio buffer cvt->buf, and filled it with cvt->len bytes of + * audio data in the source format, this function will convert it in-place + * to the desired format. + * The data conversion may expand the size of the audio data, so the buffer + * cvt->buf should be allocated after the cvt structure is initialized by + * SDL_BuildAudioCVT(), and should be cvt->len*cvt->len_mult bytes long. + */ +extern DECLSPEC int SDL_ConvertAudio(SDL_AudioCVT *cvt); + +/* + * This takes two audio buffers of the playing audio format and mixes + * them, performing addition, volume adjustment, and overflow clipping. + * The volume ranges from 0 - 128, and should be set to SDL_MIX_MAXVOLUME + * for full audio volume. Note this does not change hardware volume. + * This is provided for convenience -- you can mix your own audio data. + */ +#define SDL_MIX_MAXVOLUME 128 +extern DECLSPEC void SDL_MixAudio(Uint8 *dst, Uint8 *src, Uint32 len, int volume); + +/* + * The lock manipulated by these functions protects the callback function. + * During a LockAudio/UnlockAudio pair, you can be guaranteed that the + * callback function is not running. Do not call these from the callback + * function or you will cause deadlock. + */ +extern DECLSPEC void SDL_LockAudio(void); +extern DECLSPEC void SDL_UnlockAudio(void); + +/* + * This function shuts down audio processing and closes the audio device. + */ +extern DECLSPEC void SDL_CloseAudio(void); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_audio_h */ diff -r 000000000000 -r 74212992fb08 include/SDL_byteorder.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_byteorder.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,51 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Macros for determining the byte-order of this platform */ + +#ifndef _SDL_byteorder_h +#define _SDL_byteorder_h + +/* The two types of endianness */ +#define SDL_LIL_ENDIAN 1234 +#define SDL_BIG_ENDIAN 4321 + +/* Pardon the mess, I'm trying to determine the endianness of this host. + I'm doing it by preprocessor defines rather than some sort of configure + script so that application code can use this too. The "right" way would + be to dynamically generate this file on install, but that's a lot of work. + */ +#if defined(__i386__) || defined(WIN32) || \ + (defined(__alpha__) || defined(__alpha)) || \ + defined(__arm__) || \ + (defined(__mips__) && defined(__MIPSEL__)) +#define SDL_BYTEORDER SDL_LIL_ENDIAN +#else +#define SDL_BYTEORDER SDL_BIG_ENDIAN +#endif + +#endif /* _SDL_byteorder_h */ diff -r 000000000000 -r 74212992fb08 include/SDL_cdrom.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_cdrom.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,175 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* This is the CD-audio control API for Simple DirectMedia Layer */ + +#ifndef _SDL_cdrom_h +#define _SDL_cdrom_h + +#include "SDL_types.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* In order to use these functions, SDL_Init() must have been called + with the SDL_INIT_CDROM flag. This causes SDL to scan the system + for CD-ROM drives, and load appropriate drivers. +*/ + +/* The maximum number of CD-ROM tracks on a disk */ +#define SDL_MAX_TRACKS 99 + +/* The types of CD-ROM track possible */ +#define SDL_AUDIO_TRACK 0x00 +#define SDL_DATA_TRACK 0x04 + +/* The possible states which a CD-ROM drive can be in. */ +typedef enum { + CD_TRAYEMPTY, + CD_STOPPED, + CD_PLAYING, + CD_PAUSED, + CD_ERROR = -1 +} CDstatus; + +/* Given a status, returns true if there's a disk in the drive */ +#define CD_INDRIVE(status) ((int)status > 0) + +typedef struct { + Uint8 id; /* Track number */ + Uint8 type; /* Data or audio track */ + Uint16 unused; + Uint32 length; /* Length, in frames, of this track */ + Uint32 offset; /* Offset, in frames, from start of disk */ +} SDL_CDtrack; + +/* This structure is only current as of the last call to SDL_CDStatus() */ +typedef struct SDL_CD { + int id; /* Private drive identifier */ + CDstatus status; /* Current drive status */ + + /* The rest of this structure is only valid if there's a CD in drive */ + int numtracks; /* Number of tracks on disk */ + int cur_track; /* Current track position */ + int cur_frame; /* Current frame offset within current track */ + SDL_CDtrack track[SDL_MAX_TRACKS+1]; +} SDL_CD; + +/* Conversion functions from frames to Minute/Second/Frames and vice versa */ +#define CD_FPS 75 +#define FRAMES_TO_MSF(f, M,S,F) { \ + int value = f; \ + *(F) = value%CD_FPS; \ + value /= CD_FPS; \ + *(S) = value%60; \ + value /= 60; \ + *(M) = value; \ +} +#define MSF_TO_FRAMES(M, S, F) ((M)*60*CD_FPS+(S)*CD_FPS+(F)) + +/* CD-audio API functions: */ + +/* Returns the number of CD-ROM drives on the system, or -1 if + SDL_Init() has not been called with the SDL_INIT_CDROM flag. + */ +extern DECLSPEC int SDL_CDNumDrives(void); + +/* Returns a human-readable, system-dependent identifier for the CD-ROM. + Example: + "/dev/cdrom" + "E:" + "/dev/disk/ide/1/master" +*/ +extern DECLSPEC const char * SDL_CDName(int drive); + +/* Opens a CD-ROM drive for access. It returns a drive handle on success, + or NULL if the drive was invalid or busy. This newly opened CD-ROM + becomes the default CD used when other CD functions are passed a NULL + CD-ROM handle. + Drives are numbered starting with 0. Drive 0 is the system default CD-ROM. +*/ +extern DECLSPEC SDL_CD * SDL_CDOpen(int drive); + +/* This function returns the current status of the given drive. + If the drive has a CD in it, the table of contents of the CD and current + play position of the CD will be stored in the SDL_CD structure. +*/ +extern DECLSPEC CDstatus SDL_CDStatus(SDL_CD *cdrom); + +/* Play the given CD starting at 'start_track' and 'start_frame' for 'ntracks' + tracks and 'nframes' frames. If both 'ntrack' and 'nframe' are 0, play + until the end of the CD. This function will skip data tracks. + This function should only be called after calling SDL_CDStatus() to + get track information about the CD. + For example: + // Play entire CD: + if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) + SDL_CDPlayTracks(cdrom, 0, 0, 0, 0); + // Play last track: + if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) { + SDL_CDPlayTracks(cdrom, cdrom->numtracks-1, 0, 0, 0); + } + // Play first and second track and 10 seconds of third track: + if ( CD_INDRIVE(SDL_CDStatus(cdrom)) ) + SDL_CDPlayTracks(cdrom, 0, 0, 2, 10); + + This function returns 0, or -1 if there was an error. +*/ +extern DECLSPEC int SDL_CDPlayTracks(SDL_CD *cdrom, + int start_track, int start_frame, int ntracks, int nframes); + +/* Play the given CD starting at 'start' frame for 'length' frames. + It returns 0, or -1 if there was an error. +*/ +extern DECLSPEC int SDL_CDPlay(SDL_CD *cdrom, int start, int length); + +/* Pause play -- returns 0, or -1 on error */ +extern DECLSPEC int SDL_CDPause(SDL_CD *cdrom); + +/* Resume play -- returns 0, or -1 on error */ +extern DECLSPEC int SDL_CDResume(SDL_CD *cdrom); + +/* Stop play -- returns 0, or -1 on error */ +extern DECLSPEC int SDL_CDStop(SDL_CD *cdrom); + +/* Eject CD-ROM -- returns 0, or -1 on error */ +extern DECLSPEC int SDL_CDEject(SDL_CD *cdrom); + +/* Closes the handle for the CD-ROM drive */ +extern DECLSPEC void SDL_CDClose(SDL_CD *cdrom); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_video_h */ diff -r 000000000000 -r 74212992fb08 include/SDL_copying.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_copying.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,27 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + diff -r 000000000000 -r 74212992fb08 include/SDL_endian.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_endian.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,149 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Functions for reading and writing endian-specific values */ + +#ifndef _SDL_endian_h +#define _SDL_endian_h + +/* These functions read and write data of the specified endianness, + dynamically translating to the host machine endianness. + + e.g.: If you want to read a 16 bit value on big-endian machine from + an open file containing little endian values, you would use: + value = SDL_ReadLE16(rp); + Note that the read/write functions use SDL_RWops pointers + instead of FILE pointers. This allows you to read and write + endian values from large chunks of memory as well as files + and other data sources. +*/ + +#include + +#include "SDL_types.h" +#include "SDL_rwops.h" +#include "SDL_byteorder.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* The macros used to swap values */ +/* Try to use superfast macros on systems that support them */ +#ifdef linux +#include +#ifdef __arch__swab16 +#define SDL_Swap16 __arch__swab16 +#endif +#ifdef __arch__swab32 +#define SDL_Swap32 __arch__swab32 +#endif +#endif /* linux */ +/* Use inline functions for compilers that support them, and static + functions for those that do not. Because these functions become + static for compilers that do not support inline functions, this + header should only be included in files that actually use them. +*/ +#ifndef SDL_Swap16 +static __inline__ Uint16 SDL_Swap16(Uint16 D) { + return((D<<8)|(D>>8)); +} +#endif +#ifndef SDL_Swap32 +static __inline__ Uint32 SDL_Swap32(Uint32 D) { + return((D<<24)|((D<<8)&0x00FF0000)|((D>>8)&0x0000FF00)|(D>>24)); +} +#endif +#ifdef SDL_HAS_64BIT_TYPE +#ifndef SDL_Swap64 +static __inline__ Uint64 SDL_Swap64(Uint64 val) { + Uint32 hi, lo; + + /* Separate into high and low 32-bit values and swap them */ + lo = (Uint32)(val&0xFFFFFFFF); + val >>= 32; + hi = (Uint32)(val&0xFFFFFFFF); + val = SDL_Swap32(lo); + val <<= 32; + val |= SDL_Swap32(hi); + return(val); +} +#endif +#else +#ifndef SDL_Swap64 +/* This is mainly to keep compilers from complaining in SDL code. + If there is no real 64-bit datatype, then compilers will complain about + the fake 64-bit datatype that SDL provides when it compiles user code. +*/ +#define SDL_Swap64(X) (X) +#endif +#endif /* SDL_HAS_64BIT_TYPE */ + + +/* Byteswap item from the specified endianness to the native endianness */ +#if SDL_BYTEORDER == SDL_LIL_ENDIAN +#define SDL_SwapLE16(X) (X) +#define SDL_SwapLE32(X) (X) +#define SDL_SwapLE64(X) (X) +#define SDL_SwapBE16(X) SDL_Swap16(X) +#define SDL_SwapBE32(X) SDL_Swap32(X) +#define SDL_SwapBE64(X) SDL_Swap64(X) +#else +#define SDL_SwapLE16(X) SDL_Swap16(X) +#define SDL_SwapLE32(X) SDL_Swap32(X) +#define SDL_SwapLE64(X) SDL_Swap64(X) +#define SDL_SwapBE16(X) (X) +#define SDL_SwapBE32(X) (X) +#define SDL_SwapBE64(X) (X) +#endif + +/* Read an item of the specified endianness and return in native format */ +extern DECLSPEC Uint16 SDL_ReadLE16(SDL_RWops *src); +extern DECLSPEC Uint16 SDL_ReadBE16(SDL_RWops *src); +extern DECLSPEC Uint32 SDL_ReadLE32(SDL_RWops *src); +extern DECLSPEC Uint32 SDL_ReadBE32(SDL_RWops *src); +extern DECLSPEC Uint64 SDL_ReadLE64(SDL_RWops *src); +extern DECLSPEC Uint64 SDL_ReadBE64(SDL_RWops *src); + +/* Write an item of native format to the specified endianness */ +extern DECLSPEC int SDL_WriteLE16(SDL_RWops *dst, Uint16 value); +extern DECLSPEC int SDL_WriteBE16(SDL_RWops *dst, Uint16 value); +extern DECLSPEC int SDL_WriteLE32(SDL_RWops *dst, Uint32 value); +extern DECLSPEC int SDL_WriteBE32(SDL_RWops *dst, Uint32 value); +extern DECLSPEC int SDL_WriteLE64(SDL_RWops *dst, Uint64 value); +extern DECLSPEC int SDL_WriteBE64(SDL_RWops *dst, Uint64 value); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_endian_h */ diff -r 000000000000 -r 74212992fb08 include/SDL_error.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_error.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,62 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Simple error message routines for SDL */ + +#ifndef _SDL_error_h +#define _SDL_error_h + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Public functions */ +extern DECLSPEC void SDL_SetError(const char *fmt, ...); +extern DECLSPEC char * SDL_GetError(void); +extern DECLSPEC void SDL_ClearError(void); + +/* Private error message function - used internally */ +#define SDL_OutOfMemory() SDL_Error(SDL_ENOMEM) +typedef enum { + SDL_ENOMEM, + SDL_EFREAD, + SDL_EFWRITE, + SDL_EFSEEK, + SDL_LASTERROR +} SDL_errorcode; +extern void SDL_Error(SDL_errorcode code); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_error_h */ diff -r 000000000000 -r 74212992fb08 include/SDL_events.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_events.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,334 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Include file for SDL event handling */ + +#ifndef _SDL_events_h +#define _SDL_events_h + +#include "SDL_types.h" +#include "SDL_active.h" +#include "SDL_keyboard.h" +#include "SDL_mouse.h" +#include "SDL_joystick.h" +#include "SDL_quit.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Event enumerations */ +enum { SDL_NOEVENT = 0, /* Unused (do not remove) */ + SDL_ACTIVEEVENT, /* Application loses/gains visibility */ + SDL_KEYDOWN, /* Keys pressed */ + SDL_KEYUP, /* Keys released */ + SDL_MOUSEMOTION, /* Mouse moved */ + SDL_MOUSEBUTTONDOWN, /* Mouse button pressed */ + SDL_MOUSEBUTTONUP, /* Mouse button released */ + SDL_JOYAXISMOTION, /* Joystick axis motion */ + SDL_JOYBALLMOTION, /* Joystick trackball motion */ + SDL_JOYHATMOTION, /* Joystick hat position change */ + SDL_JOYBUTTONDOWN, /* Joystick button pressed */ + SDL_JOYBUTTONUP, /* Joystick button released */ + SDL_QUIT, /* User-requested quit */ + SDL_SYSWMEVENT, /* System specific event */ + SDL_EVENT_RESERVEDA, /* Reserved for future use.. */ + SDL_EVENT_RESERVEDB, /* Reserved for future use.. */ + SDL_VIDEORESIZE, /* User resized video mode */ + SDL_VIDEOEXPOSE, /* Screen needs to be redrawn */ + SDL_EVENT_RESERVED2, /* Reserved for future use.. */ + SDL_EVENT_RESERVED3, /* Reserved for future use.. */ + SDL_EVENT_RESERVED4, /* Reserved for future use.. */ + SDL_EVENT_RESERVED5, /* Reserved for future use.. */ + SDL_EVENT_RESERVED6, /* Reserved for future use.. */ + SDL_EVENT_RESERVED7, /* Reserved for future use.. */ + /* Events SDL_USEREVENT through SDL_MAXEVENTS-1 are for your use */ + SDL_USEREVENT = 24, + /* This last event is only for bounding internal arrays + It is the number of bits in the event mask datatype -- Uint32 + */ + SDL_NUMEVENTS = 32 +}; + +/* Predefined event masks */ +#define SDL_EVENTMASK(X) (1<<(X)) +enum { + SDL_ACTIVEEVENTMASK = SDL_EVENTMASK(SDL_ACTIVEEVENT), + SDL_KEYDOWNMASK = SDL_EVENTMASK(SDL_KEYDOWN), + SDL_KEYUPMASK = SDL_EVENTMASK(SDL_KEYUP), + SDL_MOUSEMOTIONMASK = SDL_EVENTMASK(SDL_MOUSEMOTION), + SDL_MOUSEBUTTONDOWNMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN), + SDL_MOUSEBUTTONUPMASK = SDL_EVENTMASK(SDL_MOUSEBUTTONUP), + SDL_MOUSEEVENTMASK = SDL_EVENTMASK(SDL_MOUSEMOTION)| + SDL_EVENTMASK(SDL_MOUSEBUTTONDOWN)| + SDL_EVENTMASK(SDL_MOUSEBUTTONUP), + SDL_JOYAXISMOTIONMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION), + SDL_JOYBALLMOTIONMASK = SDL_EVENTMASK(SDL_JOYBALLMOTION), + SDL_JOYHATMOTIONMASK = SDL_EVENTMASK(SDL_JOYHATMOTION), + SDL_JOYBUTTONDOWNMASK = SDL_EVENTMASK(SDL_JOYBUTTONDOWN), + SDL_JOYBUTTONUPMASK = SDL_EVENTMASK(SDL_JOYBUTTONUP), + SDL_JOYEVENTMASK = SDL_EVENTMASK(SDL_JOYAXISMOTION)| + SDL_EVENTMASK(SDL_JOYBALLMOTION)| + SDL_EVENTMASK(SDL_JOYHATMOTION)| + SDL_EVENTMASK(SDL_JOYBUTTONDOWN)| + SDL_EVENTMASK(SDL_JOYBUTTONUP), + SDL_VIDEORESIZEMASK = SDL_EVENTMASK(SDL_VIDEORESIZE), + SDL_VIDEOEXPOSEMASK = SDL_EVENTMASK(SDL_VIDEOEXPOSE), + SDL_QUITMASK = SDL_EVENTMASK(SDL_QUIT), + SDL_SYSWMEVENTMASK = SDL_EVENTMASK(SDL_SYSWMEVENT) +}; +#define SDL_ALLEVENTS 0xFFFFFFFF + +/* Application visibility event structure */ +typedef struct { + Uint8 type; /* SDL_ACTIVEEVENT */ + Uint8 gain; /* Whether given states were gained or lost (1/0) */ + Uint8 state; /* A mask of the focus states */ +} SDL_ActiveEvent; + +/* Keyboard event structure */ +typedef struct { + Uint8 type; /* SDL_KEYDOWN or SDL_KEYUP */ + Uint8 which; /* The keyboard device index */ + Uint8 state; /* SDL_PRESSED or SDL_RELEASED */ + SDL_keysym keysym; +} SDL_KeyboardEvent; + +/* Mouse motion event structure */ +typedef struct { + Uint8 type; /* SDL_MOUSEMOTION */ + Uint8 which; /* The mouse device index */ + Uint8 state; /* The current button state */ + Uint16 x, y; /* The X/Y coordinates of the mouse */ + Sint16 xrel; /* The relative motion in the X direction */ + Sint16 yrel; /* The relative motion in the Y direction */ +} SDL_MouseMotionEvent; + +/* Mouse button event structure */ +typedef struct { + Uint8 type; /* SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP */ + Uint8 which; /* The mouse device index */ + Uint8 button; /* The mouse button index */ + Uint8 state; /* SDL_PRESSED or SDL_RELEASED */ + Uint16 x, y; /* The X/Y coordinates of the mouse at press time */ +} SDL_MouseButtonEvent; + +/* Joystick axis motion event structure */ +typedef struct { + Uint8 type; /* SDL_JOYAXISMOTION */ + Uint8 which; /* The joystick device index */ + Uint8 axis; /* The joystick axis index */ + Sint16 value; /* The axis value (range: -32768 to 32767) */ +} SDL_JoyAxisEvent; + +/* Joystick trackball motion event structure */ +typedef struct { + Uint8 type; /* SDL_JOYBALLMOTION */ + Uint8 which; /* The joystick device index */ + Uint8 ball; /* The joystick trackball index */ + Sint16 xrel; /* The relative motion in the X direction */ + Sint16 yrel; /* The relative motion in the Y direction */ +} SDL_JoyBallEvent; + +/* Joystick hat position change event structure */ +typedef struct { + Uint8 type; /* SDL_JOYHATMOTION */ + Uint8 which; /* The joystick device index */ + Uint8 hat; /* The joystick hat index */ + Uint8 value; /* The hat position value: + 8 1 2 + 7 0 3 + 6 5 4 + Note that zero means the POV is centered. + */ +} SDL_JoyHatEvent; + +/* Joystick button event structure */ +typedef struct { + Uint8 type; /* SDL_JOYBUTTONDOWN or SDL_JOYBUTTONUP */ + Uint8 which; /* The joystick device index */ + Uint8 button; /* The joystick button index */ + Uint8 state; /* SDL_PRESSED or SDL_RELEASED */ +} SDL_JoyButtonEvent; + +/* The "window resized" event + When you get this event, you are responsible for setting a new video + mode with the new width and height. + */ +typedef struct { + Uint8 type; /* SDL_VIDEORESIZE */ + int w; /* New width */ + int h; /* New height */ +} SDL_ResizeEvent; + +/* The "screen redraw" event */ +typedef struct { + Uint8 type; /* SDL_VIDEOEXPOSE */ +} SDL_ExposeEvent; + +/* The "quit requested" event */ +typedef struct { + Uint8 type; /* SDL_QUIT */ +} SDL_QuitEvent; + +/* A user-defined event type */ +typedef struct { + Uint8 type; /* SDL_USEREVENT through SDL_NUMEVENTS-1 */ + int code; /* User defined event code */ + void *data1; /* User defined data pointer */ + void *data2; /* User defined data pointer */ +} SDL_UserEvent; + +/* If you want to use this event, you should include SDL_syswm.h */ +struct SDL_SysWMmsg; +typedef struct SDL_SysWMmsg SDL_SysWMmsg; +typedef struct { + Uint8 type; + SDL_SysWMmsg *msg; +} SDL_SysWMEvent; + +/* General event structure */ +typedef union { + Uint8 type; + SDL_ActiveEvent active; + SDL_KeyboardEvent key; + SDL_MouseMotionEvent motion; + SDL_MouseButtonEvent button; + SDL_JoyAxisEvent jaxis; + SDL_JoyBallEvent jball; + SDL_JoyHatEvent jhat; + SDL_JoyButtonEvent jbutton; + SDL_ResizeEvent resize; + SDL_ExposeEvent expose; + SDL_QuitEvent quit; + SDL_UserEvent user; + SDL_SysWMEvent syswm; +} SDL_Event; + + +/* Function prototypes */ + +/* Pumps the event loop, gathering events from the input devices. + This function updates the event queue and internal input device state. + This should only be run in the thread that sets the video mode. +*/ +extern DECLSPEC void SDL_PumpEvents(void); + +/* Checks the event queue for messages and optionally returns them. + If 'action' is SDL_ADDEVENT, up to 'numevents' events will be added to + the back of the event queue. + If 'action' is SDL_PEEKEVENT, up to 'numevents' events at the front + of the event queue, matching 'mask', will be returned and will not + be removed from the queue. + If 'action' is SDL_GETEVENT, up to 'numevents' events at the front + of the event queue, matching 'mask', will be returned and will be + removed from the queue. + This function returns the number of events actually stored, or -1 + if there was an error. This function is thread-safe. +*/ +typedef enum { + SDL_ADDEVENT, + SDL_PEEKEVENT, + SDL_GETEVENT +} SDL_eventaction; +/* */ +extern DECLSPEC int SDL_PeepEvents(SDL_Event *events, int numevents, + SDL_eventaction action, Uint32 mask); + +/* Polls for currently pending events, and returns 1 if there are any pending + events, or 0 if there are none available. If 'event' is not NULL, the next + event is removed from the queue and stored in that area. + */ +extern DECLSPEC int SDL_PollEvent(SDL_Event *event); + +/* Waits indefinitely for the next available event, returning 1, or 0 if there + was an error while waiting for events. If 'event' is not NULL, the next + event is removed from the queue and stored in that area. + */ +extern DECLSPEC int SDL_WaitEvent(SDL_Event *event); + +/* Add an event to the event queue. + This function returns 0, or -1 if the event couldn't be added to + the event queue. If the event queue is full, this function fails. + */ +extern DECLSPEC int SDL_PushEvent(SDL_Event *event); + +/* + This function sets up a filter to process all events before they + change internal state and are posted to the internal event queue. + + The filter is protypted as: +*/ +typedef int (*SDL_EventFilter)(const SDL_Event *event); +/* + If the filter returns 1, then the event will be added to the internal queue. + If it returns 0, then the event will be dropped from the queue, but the + internal state will still be updated. This allows selective filtering of + dynamically arriving events. + + WARNING: Be very careful of what you do in the event filter function, as + it may run in a different thread! + + There is one caveat when dealing with the SDL_QUITEVENT event type. The + event filter is only called when the window manager desires to close the + application window. If the event filter returns 1, then the window will + be closed, otherwise the window will remain open if possible. + If the quit event is generated by an interrupt signal, it will bypass the + internal queue and be delivered to the application at the next event poll. +*/ +extern DECLSPEC void SDL_SetEventFilter(SDL_EventFilter filter); + +/* + Return the current event filter - can be used to "chain" filters. + If there is no event filter set, this function returns NULL. +*/ +extern DECLSPEC SDL_EventFilter SDL_GetEventFilter(void); + +/* + This function allows you to set the state of processing certain events. + If 'state' is set to SDL_IGNORE, that event will be automatically dropped + from the event queue and will not event be filtered. + If 'state' is set to SDL_ENABLE, that event will be processed normally. + If 'state' is set to SDL_QUERY, SDL_EventState() will return the + current processing state of the specified event. +*/ +#define SDL_QUERY -1 +#define SDL_IGNORE 0 +#define SDL_DISABLE 0 +#define SDL_ENABLE 1 +extern DECLSPEC Uint8 SDL_EventState(Uint8 type, int state); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_events_h */ diff -r 000000000000 -r 74212992fb08 include/SDL_getenv.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_getenv.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,30 @@ + +/* Not all environments have a working getenv()/putenv() */ + +#if defined(macintosh) || defined(_WIN32_WCE) +#define NEED_SDL_GETENV +#endif + +#ifdef NEED_SDL_GETENV + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Put a variable of the form "name=value" into the environment */ +extern DECLSPEC int SDL_putenv(const char *variable); +#define putenv(X) SDL_putenv(X) + +/* Retrieve a variable named "name" from the environment */ +extern DECLSPEC char *SDL_getenv(const char *name); +#define getenv(X) SDL_getenv(X) + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* NEED_GETENV */ diff -r 000000000000 -r 74212992fb08 include/SDL_joystick.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_joystick.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,171 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Include file for SDL joystick event handling */ + +#ifndef _SDL_joystick_h +#define _SDL_joystick_h + +#include "SDL_types.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* In order to use these functions, SDL_Init() must have been called + with the SDL_INIT_JOYSTICK flag. This causes SDL to scan the system + for joysticks, and load appropriate drivers. +*/ + +/* The joystick structure used to identify an SDL joystick */ +struct _SDL_Joystick; +typedef struct _SDL_Joystick SDL_Joystick; + + +/* Function prototypes */ +/* + * Count the number of joysticks attached to the system + */ +extern DECLSPEC int SDL_NumJoysticks(void); + +/* + * Get the implementation dependent name of a joystick. + * This can be called before any joysticks are opened. + * If no name can be found, this function returns NULL. + */ +extern DECLSPEC const char *SDL_JoystickName(int device_index); + +/* + * Open a joystick for use - the index passed as an argument refers to + * the N'th joystick on the system. This index is the value which will + * identify this joystick in future joystick events. + * + * This function returns a joystick identifier, or NULL if an error occurred. + */ +extern DECLSPEC SDL_Joystick *SDL_JoystickOpen(int device_index); + +/* + * Returns 1 if the joystick has been opened, or 0 if it has not. + */ +extern DECLSPEC int SDL_JoystickOpened(int device_index); + +/* + * Get the device index of an opened joystick. + */ +extern DECLSPEC int SDL_JoystickIndex(SDL_Joystick *joystick); + +/* + * Get the number of general axis controls on a joystick + */ +extern DECLSPEC int SDL_JoystickNumAxes(SDL_Joystick *joystick); + +/* + * Get the number of trackballs on a joystick + * Joystick trackballs have only relative motion events associated + * with them and their state cannot be polled. + */ +extern DECLSPEC int SDL_JoystickNumBalls(SDL_Joystick *joystick); + +/* + * Get the number of POV hats on a joystick + */ +extern DECLSPEC int SDL_JoystickNumHats(SDL_Joystick *joystick); + +/* + * Get the number of buttons on a joystick + */ +extern DECLSPEC int SDL_JoystickNumButtons(SDL_Joystick *joystick); + +/* + * Update the current state of the open joysticks. + * This is called automatically by the event loop if any joystick + * events are enabled. + */ +extern DECLSPEC void SDL_JoystickUpdate(void); + +/* + * Enable/disable joystick event polling. + * If joystick events are disabled, you must call SDL_JoystickUpdate() + * yourself and check the state of the joystick when you want joystick + * information. + * The state can be one of SDL_QUERY, SDL_ENABLE or SDL_IGNORE. + */ +extern DECLSPEC int SDL_JoystickEventState(int state); + +/* + * Get the current state of an axis control on a joystick + * The state is a value ranging from -32768 to 32767. + * The axis indices start at index 0. + */ +extern DECLSPEC Sint16 SDL_JoystickGetAxis(SDL_Joystick *joystick, int axis); + +/* + * Get the current state of a POV hat on a joystick + * The return value is one of the following positions: + */ +#define SDL_HAT_CENTERED 0x00 +#define SDL_HAT_UP 0x01 +#define SDL_HAT_RIGHT 0x02 +#define SDL_HAT_DOWN 0x04 +#define SDL_HAT_LEFT 0x08 +#define SDL_HAT_RIGHTUP (SDL_HAT_RIGHT|SDL_HAT_UP) +#define SDL_HAT_RIGHTDOWN (SDL_HAT_RIGHT|SDL_HAT_DOWN) +#define SDL_HAT_LEFTUP (SDL_HAT_LEFT|SDL_HAT_UP) +#define SDL_HAT_LEFTDOWN (SDL_HAT_LEFT|SDL_HAT_DOWN) +/* + * The hat indices start at index 0. + */ +extern DECLSPEC Uint8 SDL_JoystickGetHat(SDL_Joystick *joystick, int hat); + +/* + * Get the ball axis change since the last poll + * This returns 0, or -1 if you passed it invalid parameters. + * The ball indices start at index 0. + */ +extern DECLSPEC int SDL_JoystickGetBall(SDL_Joystick *joystick, int ball, int *dx, int *dy); + +/* + * Get the current state of a button on a joystick + * The button indices start at index 0. + */ +extern DECLSPEC Uint8 SDL_JoystickGetButton(SDL_Joystick *joystick, int button); + +/* + * Close a joystick previously opened with SDL_JoystickOpen() + */ +extern DECLSPEC void SDL_JoystickClose(SDL_Joystick *joystick); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_joystick_h */ diff -r 000000000000 -r 74212992fb08 include/SDL_keyboard.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_keyboard.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,124 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Include file for SDL keyboard event handling */ + +#ifndef _SDL_keyboard_h +#define _SDL_keyboard_h + +#include "SDL_types.h" +#include "SDL_keysym.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Keysym structure + - The scancode is hardware dependent, and should not be used by general + applications. If no hardware scancode is available, it will be 0. + + - The 'unicode' translated character is only available when character + translation is enabled by the SDL_EnableUNICODE() API. If non-zero, + this is a UNICODE character corresponding to the keypress. If the + high 9 bits of the character are 0, then this maps to the equivalent + ASCII character: + char ch; + if ( (keysym.unicode & 0xFF80) == 0 ) { + ch = keysym.unicode & 0x7F; + } else { + An international character.. + } + */ +typedef struct { + Uint8 scancode; /* hardware specific scancode */ + SDLKey sym; /* SDL virtual keysym */ + SDLMod mod; /* current key modifiers */ + Uint16 unicode; /* translated character */ +} SDL_keysym; + +/* This is the mask which refers to all hotkey bindings */ +#define SDL_ALL_HOTKEYS 0xFFFFFFFF + +/* Function prototypes */ +/* + * Enable/Disable UNICODE translation of keyboard input. + * This translation has some overhead, so translation defaults off. + * If 'enable' is 1, translation is enabled. + * If 'enable' is 0, translation is disabled. + * If 'enable' is -1, the translation state is not changed. + * It returns the previous state of keyboard translation. + */ +extern DECLSPEC int SDL_EnableUNICODE(int enable); + +/* + * Enable/Disable keyboard repeat. Keyboard repeat defaults to off. + * 'delay' is the initial delay in ms between the time when a key is + * pressed, and keyboard repeat begins. + * 'interval' is the time in ms between keyboard repeat events. + */ +#define SDL_DEFAULT_REPEAT_DELAY 500 +#define SDL_DEFAULT_REPEAT_INTERVAL 30 +/* + * If 'delay' is set to 0, keyboard repeat is disabled. + */ +extern DECLSPEC int SDL_EnableKeyRepeat(int delay, int interval); + +/* + * Get a snapshot of the current state of the keyboard. + * Returns an array of keystates, indexed by the SDLK_* syms. + * Used: + * Uint8 *keystate = SDL_GetKeyState(NULL); + * if ( keystate[SDLK_RETURN] ) ... is pressed. + */ +extern DECLSPEC Uint8 * SDL_GetKeyState(int *numkeys); + +/* + * Get the current key modifier state + */ +extern DECLSPEC SDLMod SDL_GetModState(void); + +/* + * Set the current key modifier state + * This does not change the keyboard state, only the key modifier flags. + */ +extern DECLSPEC void SDL_SetModState(SDLMod modstate); + +/* + * Get the name of an SDL virtual keysym + */ +extern DECLSPEC char * SDL_GetKeyName(SDLKey key); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_keyboard_h */ diff -r 000000000000 -r 74212992fb08 include/SDL_keysym.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_keysym.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,315 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +#ifndef _SDL_keysym_h +#define _SDL_keysym_h + +/* What we really want is a mapping of every raw key on the keyboard. + To support international keyboards, we use the range 0xA1 - 0xFF + as international virtual keycodes. We'll follow in the footsteps of X11... + The names of the keys + */ + +typedef enum { + /* The keyboard syms have been cleverly chosen to map to ASCII */ + SDLK_UNKNOWN = 0, + SDLK_FIRST = 0, + SDLK_BACKSPACE = 8, + SDLK_TAB = 9, + SDLK_CLEAR = 12, + SDLK_RETURN = 13, + SDLK_PAUSE = 19, + SDLK_ESCAPE = 27, + SDLK_SPACE = 32, + SDLK_EXCLAIM = 33, + SDLK_QUOTEDBL = 34, + SDLK_HASH = 35, + SDLK_DOLLAR = 36, + SDLK_AMPERSAND = 38, + SDLK_QUOTE = 39, + SDLK_LEFTPAREN = 40, + SDLK_RIGHTPAREN = 41, + SDLK_ASTERISK = 42, + SDLK_PLUS = 43, + SDLK_COMMA = 44, + SDLK_MINUS = 45, + SDLK_PERIOD = 46, + SDLK_SLASH = 47, + SDLK_0 = 48, + SDLK_1 = 49, + SDLK_2 = 50, + SDLK_3 = 51, + SDLK_4 = 52, + SDLK_5 = 53, + SDLK_6 = 54, + SDLK_7 = 55, + SDLK_8 = 56, + SDLK_9 = 57, + SDLK_COLON = 58, + SDLK_SEMICOLON = 59, + SDLK_LESS = 60, + SDLK_EQUALS = 61, + SDLK_GREATER = 62, + SDLK_QUESTION = 63, + SDLK_AT = 64, + /* + Skip uppercase letters + */ + SDLK_LEFTBRACKET = 91, + SDLK_BACKSLASH = 92, + SDLK_RIGHTBRACKET = 93, + SDLK_CARET = 94, + SDLK_UNDERSCORE = 95, + SDLK_BACKQUOTE = 96, + SDLK_a = 97, + SDLK_b = 98, + SDLK_c = 99, + SDLK_d = 100, + SDLK_e = 101, + SDLK_f = 102, + SDLK_g = 103, + SDLK_h = 104, + SDLK_i = 105, + SDLK_j = 106, + SDLK_k = 107, + SDLK_l = 108, + SDLK_m = 109, + SDLK_n = 110, + SDLK_o = 111, + SDLK_p = 112, + SDLK_q = 113, + SDLK_r = 114, + SDLK_s = 115, + SDLK_t = 116, + SDLK_u = 117, + SDLK_v = 118, + SDLK_w = 119, + SDLK_x = 120, + SDLK_y = 121, + SDLK_z = 122, + SDLK_DELETE = 127, + /* End of ASCII mapped keysyms */ + + /* International keyboard syms */ + SDLK_WORLD_0 = 160, /* 0xA0 */ + SDLK_WORLD_1 = 161, + SDLK_WORLD_2 = 162, + SDLK_WORLD_3 = 163, + SDLK_WORLD_4 = 164, + SDLK_WORLD_5 = 165, + SDLK_WORLD_6 = 166, + SDLK_WORLD_7 = 167, + SDLK_WORLD_8 = 168, + SDLK_WORLD_9 = 169, + SDLK_WORLD_10 = 170, + SDLK_WORLD_11 = 171, + SDLK_WORLD_12 = 172, + SDLK_WORLD_13 = 173, + SDLK_WORLD_14 = 174, + SDLK_WORLD_15 = 175, + SDLK_WORLD_16 = 176, + SDLK_WORLD_17 = 177, + SDLK_WORLD_18 = 178, + SDLK_WORLD_19 = 179, + SDLK_WORLD_20 = 180, + SDLK_WORLD_21 = 181, + SDLK_WORLD_22 = 182, + SDLK_WORLD_23 = 183, + SDLK_WORLD_24 = 184, + SDLK_WORLD_25 = 185, + SDLK_WORLD_26 = 186, + SDLK_WORLD_27 = 187, + SDLK_WORLD_28 = 188, + SDLK_WORLD_29 = 189, + SDLK_WORLD_30 = 190, + SDLK_WORLD_31 = 191, + SDLK_WORLD_32 = 192, + SDLK_WORLD_33 = 193, + SDLK_WORLD_34 = 194, + SDLK_WORLD_35 = 195, + SDLK_WORLD_36 = 196, + SDLK_WORLD_37 = 197, + SDLK_WORLD_38 = 198, + SDLK_WORLD_39 = 199, + SDLK_WORLD_40 = 200, + SDLK_WORLD_41 = 201, + SDLK_WORLD_42 = 202, + SDLK_WORLD_43 = 203, + SDLK_WORLD_44 = 204, + SDLK_WORLD_45 = 205, + SDLK_WORLD_46 = 206, + SDLK_WORLD_47 = 207, + SDLK_WORLD_48 = 208, + SDLK_WORLD_49 = 209, + SDLK_WORLD_50 = 210, + SDLK_WORLD_51 = 211, + SDLK_WORLD_52 = 212, + SDLK_WORLD_53 = 213, + SDLK_WORLD_54 = 214, + SDLK_WORLD_55 = 215, + SDLK_WORLD_56 = 216, + SDLK_WORLD_57 = 217, + SDLK_WORLD_58 = 218, + SDLK_WORLD_59 = 219, + SDLK_WORLD_60 = 220, + SDLK_WORLD_61 = 221, + SDLK_WORLD_62 = 222, + SDLK_WORLD_63 = 223, + SDLK_WORLD_64 = 224, + SDLK_WORLD_65 = 225, + SDLK_WORLD_66 = 226, + SDLK_WORLD_67 = 227, + SDLK_WORLD_68 = 228, + SDLK_WORLD_69 = 229, + SDLK_WORLD_70 = 230, + SDLK_WORLD_71 = 231, + SDLK_WORLD_72 = 232, + SDLK_WORLD_73 = 233, + SDLK_WORLD_74 = 234, + SDLK_WORLD_75 = 235, + SDLK_WORLD_76 = 236, + SDLK_WORLD_77 = 237, + SDLK_WORLD_78 = 238, + SDLK_WORLD_79 = 239, + SDLK_WORLD_80 = 240, + SDLK_WORLD_81 = 241, + SDLK_WORLD_82 = 242, + SDLK_WORLD_83 = 243, + SDLK_WORLD_84 = 244, + SDLK_WORLD_85 = 245, + SDLK_WORLD_86 = 246, + SDLK_WORLD_87 = 247, + SDLK_WORLD_88 = 248, + SDLK_WORLD_89 = 249, + SDLK_WORLD_90 = 250, + SDLK_WORLD_91 = 251, + SDLK_WORLD_92 = 252, + SDLK_WORLD_93 = 253, + SDLK_WORLD_94 = 254, + SDLK_WORLD_95 = 255, /* 0xFF */ + + /* Numeric keypad */ + SDLK_KP0 = 256, + SDLK_KP1 = 257, + SDLK_KP2 = 258, + SDLK_KP3 = 259, + SDLK_KP4 = 260, + SDLK_KP5 = 261, + SDLK_KP6 = 262, + SDLK_KP7 = 263, + SDLK_KP8 = 264, + SDLK_KP9 = 265, + SDLK_KP_PERIOD = 266, + SDLK_KP_DIVIDE = 267, + SDLK_KP_MULTIPLY = 268, + SDLK_KP_MINUS = 269, + SDLK_KP_PLUS = 270, + SDLK_KP_ENTER = 271, + SDLK_KP_EQUALS = 272, + + /* Arrows + Home/End pad */ + SDLK_UP = 273, + SDLK_DOWN = 274, + SDLK_RIGHT = 275, + SDLK_LEFT = 276, + SDLK_INSERT = 277, + SDLK_HOME = 278, + SDLK_END = 279, + SDLK_PAGEUP = 280, + SDLK_PAGEDOWN = 281, + + /* Function keys */ + SDLK_F1 = 282, + SDLK_F2 = 283, + SDLK_F3 = 284, + SDLK_F4 = 285, + SDLK_F5 = 286, + SDLK_F6 = 287, + SDLK_F7 = 288, + SDLK_F8 = 289, + SDLK_F9 = 290, + SDLK_F10 = 291, + SDLK_F11 = 292, + SDLK_F12 = 293, + SDLK_F13 = 294, + SDLK_F14 = 295, + SDLK_F15 = 296, + + /* Key state modifier keys */ + SDLK_NUMLOCK = 300, + SDLK_CAPSLOCK = 301, + SDLK_SCROLLOCK = 302, + SDLK_RSHIFT = 303, + SDLK_LSHIFT = 304, + SDLK_RCTRL = 305, + SDLK_LCTRL = 306, + SDLK_RALT = 307, + SDLK_LALT = 308, + SDLK_RMETA = 309, + SDLK_LMETA = 310, + SDLK_LSUPER = 311, /* Left "Windows" key */ + SDLK_RSUPER = 312, /* Right "Windows" key */ + SDLK_MODE = 313, /* "Alt Gr" key */ + SDLK_COMPOSE = 314, /* Multi-key compose key */ + + /* Miscellaneous function keys */ + SDLK_HELP = 315, + SDLK_PRINT = 316, + SDLK_SYSREQ = 317, + SDLK_BREAK = 318, + SDLK_MENU = 319, + SDLK_POWER = 320, /* Power Macintosh power key */ + SDLK_EURO = 321, /* Some european keyboards */ + + /* Add any other keys here */ + + SDLK_LAST +} SDLKey; + +/* Enumeration of valid key mods (possibly OR'd together) */ +typedef enum { + KMOD_NONE = 0x0000, + KMOD_LSHIFT= 0x0001, + KMOD_RSHIFT= 0x0002, + KMOD_LCTRL = 0x0040, + KMOD_RCTRL = 0x0080, + KMOD_LALT = 0x0100, + KMOD_RALT = 0x0200, + KMOD_LMETA = 0x0400, + KMOD_RMETA = 0x0800, + KMOD_NUM = 0x1000, + KMOD_CAPS = 0x2000, + KMOD_MODE = 0x4000, + KMOD_RESERVED = 0x8000 +} SDLMod; + +#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL) +#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT) +#define KMOD_ALT (KMOD_LALT|KMOD_RALT) +#define KMOD_META (KMOD_LMETA|KMOD_RMETA) + +#endif /* _SDL_keysym_h */ diff -r 000000000000 -r 74212992fb08 include/SDL_main.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_main.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,97 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +#ifndef _SDL_main_h +#define _SDL_main_h + +/* Redefine main() on Win32 and MacOS so that it is called by winmain.c */ + +#if defined(WIN32) || (defined(__MWERKS__) && !defined(__BEOS__)) || \ + defined(macintosh) + +#ifdef __cplusplus +#define C_LINKAGE "C" +#else +#define C_LINKAGE +#endif /* __cplusplus */ + +/* The application's main() function must be called with C linkage, + and should be declared like this: +#ifdef __cplusplus +extern "C" +#endif + int main(int argc, char *argv[]) + { + } + */ +#define main SDL_main + +/* The prototype for the application's main() function */ +extern C_LINKAGE int SDL_main(int argc, char *argv[]); + + +/* From the SDL library code -- needed for registering the app on Win32 */ +#if defined(WIN32) +#include "SDL_types.h" +#include "begin_code.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* This should be called from your WinMain() function, if any */ +extern DECLSPEC int SDL_RegisterApp(char *name, Uint32 style, void *hInst); + +#ifdef __cplusplus +} +#endif +#include "close_code.h" +#endif + +/* From the SDL library code -- needed for registering QuickDraw on MacOS */ +#if defined(macintosh) +#include "begin_code.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/* Forward declaration so we don't need to include QuickDraw.h */ +struct QDGlobals; + +/* This should be called from your main() function, if any */ +extern DECLSPEC void SDL_InitQuickDraw(struct QDGlobals *the_qd); + +#ifdef __cplusplus +} +#endif +#include "close_code.h" +#endif + +#endif /* Need to redefine main()? */ + +#endif /* _SDL_main_h */ diff -r 000000000000 -r 74212992fb08 include/SDL_mouse.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_mouse.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,136 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Include file for SDL mouse event handling */ + +#ifndef _SDL_mouse_h +#define _SDL_mouse_h + +#include "SDL_types.h" +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct WMcursor WMcursor; /* Implementation dependent */ +typedef struct { + SDL_Rect area; /* The area of the mouse cursor */ + Sint16 hot_x, hot_y; /* The "tip" of the cursor */ + Uint8 *data; /* B/W cursor data */ + Uint8 *mask; /* B/W cursor mask */ + Uint8 *save[2]; /* Place to save cursor area */ + WMcursor *wm_cursor; /* Window-manager cursor */ +} SDL_Cursor; + +/* Function prototypes */ +/* + * Retrieve the current state of the mouse. + * The current button state is returned as a button bitmask, which can + * be tested using the SDL_BUTTON(X) macros, and x and y are set to the + * current mouse cursor position. You can pass NULL for either x or y. + */ +extern DECLSPEC Uint8 SDL_GetMouseState(int *x, int *y); + +/* + * Retrieve the current state of the mouse. + * The current button state is returned as a button bitmask, which can + * be tested using the SDL_BUTTON(X) macros, and x and y are set to the + * mouse deltas since the last call to SDL_GetRelativeMouseState(). + */ +extern DECLSPEC Uint8 SDL_GetRelativeMouseState(int *x, int *y); + +/* + * Set the position of the mouse cursor (generates a mouse motion event) + */ +extern DECLSPEC void SDL_WarpMouse(Uint16 x, Uint16 y); + +/* + * Create a cursor using the specified data and mask (in MSB format). + * The cursor width must be a multiple of 8 bits. + * + * The cursor is created in black and white according to the following: + * data mask resulting pixel on screen + * 0 1 White + * 1 1 Black + * 0 0 Transparent + * 1 0 Inverted color if possible, black if not. + * + * Cursors created with this function must be freed with SDL_FreeCursor(). + */ +extern DECLSPEC SDL_Cursor *SDL_CreateCursor + (Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y); + +/* + * Set the currently active cursor to the specified one. + * If the cursor is currently visible, the change will be immediately + * represented on the display. + */ +extern DECLSPEC void SDL_SetCursor(SDL_Cursor *cursor); + +/* + * Returns the currently active cursor. + */ +extern DECLSPEC SDL_Cursor * SDL_GetCursor(void); + +/* + * Deallocates a cursor created with SDL_CreateCursor(). + */ +extern DECLSPEC void SDL_FreeCursor(SDL_Cursor *cursor); + +/* + * Toggle whether or not the cursor is shown on the screen. + * The cursor start off displayed, but can be turned off. + * SDL_ShowCursor() returns 1 if the cursor was being displayed + * before the call, or 0 if it was not. You can query the current + * state by passing a 'toggle' value of -1. + */ +extern DECLSPEC int SDL_ShowCursor(int toggle); + +/* Used as a mask when testing buttons in buttonstate + Button 1: Left mouse button + Button 2: Middle mouse button + Button 3: Right mouse button + */ +#define SDL_BUTTON(X) (SDL_PRESSED<<(X-1)) +#define SDL_BUTTON_LEFT 1 +#define SDL_BUTTON_MIDDLE 2 +#define SDL_BUTTON_RIGHT 3 +#define SDL_BUTTON_LMASK SDL_BUTTON(SDL_BUTTON_LEFT) +#define SDL_BUTTON_MMASK SDL_BUTTON(SDL_BUTTON_MIDDLE) +#define SDL_BUTTON_RMASK SDL_BUTTON(SDL_BUTTON_RIGHT) + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_mouse_h */ diff -r 000000000000 -r 74212992fb08 include/SDL_mutex.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_mutex.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,163 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +#ifndef _SDL_mutex_h +#define _SDL_mutex_h + +/* Functions to provide thread synchronization primitives + + These are independent of the other SDL routines. +*/ + +#include "SDL_main.h" +#include "SDL_types.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Synchronization functions which can time out return this value + if they time out. +*/ +#define SDL_MUTEX_TIMEDOUT 1 + +/* This is the timeout value which corresponds to never time out */ +#define SDL_MUTEX_MAXWAIT (~(Uint32)0) + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* Mutex functions */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* The SDL mutex structure, defined in SDL_mutex.c */ +struct SDL_mutex; +typedef struct SDL_mutex SDL_mutex; + +/* Create a mutex, initialized unlocked */ +extern DECLSPEC SDL_mutex * SDL_CreateMutex(void); + +/* Lock the mutex (Returns 0, or -1 on error) */ +#define SDL_LockMutex(m) SDL_mutexP(m) +extern DECLSPEC int SDL_mutexP(SDL_mutex *mutex); + +/* Unlock the mutex (Returns 0, or -1 on error) */ +#define SDL_UnlockMutex(m) SDL_mutexV(m) +extern DECLSPEC int SDL_mutexV(SDL_mutex *mutex); + +/* Destroy a mutex */ +extern DECLSPEC void SDL_DestroyMutex(SDL_mutex *mutex); + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* Semaphore functions */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* The SDL semaphore structure, defined in SDL_sem.c */ +struct SDL_semaphore; +typedef struct SDL_semaphore SDL_sem; + +/* Create a semaphore, initialized with value, returns NULL on failure. */ +extern DECLSPEC SDL_sem * SDL_CreateSemaphore(Uint32 initial_value); + +/* Destroy a semaphore */ +extern DECLSPEC void SDL_DestroySemaphore(SDL_sem *sem); + +/* This function suspends the calling thread until the semaphore pointed + * to by sem has a positive count. It then atomically decreases the semaphore + * count. + */ +extern DECLSPEC int SDL_SemWait(SDL_sem *sem); + +/* Non-blocking variant of SDL_SemWait(), returns 0 if the wait succeeds, + SDL_MUTEX_TIMEDOUT if the wait would block, and -1 on error. +*/ +extern DECLSPEC int SDL_SemTryWait(SDL_sem *sem); + +/* Variant of SDL_SemWait() with a timeout in milliseconds, returns 0 if + the wait succeeds, SDL_MUTEX_TIMEDOUT if the wait does not succeed in + the allotted time, and -1 on error. + On some platforms this function is implemented by looping with a delay + of 1 ms, and so should be avoided if possible. +*/ +extern DECLSPEC int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 ms); + +/* Atomically increases the semaphore's count (not blocking), returns 0, + or -1 on error. + */ +extern DECLSPEC int SDL_SemPost(SDL_sem *sem); + +/* Returns the current count of the semaphore */ +extern DECLSPEC Uint32 SDL_SemValue(SDL_sem *sem); + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* Condition variable functions */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* The SDL condition variable structure, defined in SDL_cond.c */ +struct SDL_cond; +typedef struct SDL_cond SDL_cond; + +/* Create a condition variable */ +extern DECLSPEC SDL_cond * SDL_CreateCond(void); + +/* Destroy a condition variable */ +extern DECLSPEC void SDL_DestroyCond(SDL_cond *cond); + +/* Restart one of the threads that are waiting on the condition variable, + returns 0 or -1 on error. + */ +extern DECLSPEC int SDL_CondSignal(SDL_cond *cond); + +/* Restart all threads that are waiting on the condition variable, + returns 0 or -1 on error. + */ +extern DECLSPEC int SDL_CondBroadcast(SDL_cond *cond); + +/* Wait on the condition variable, unlocking the provided mutex. + The mutex must be locked before entering this function! + Returns 0 when it is signaled, or -1 on error. + */ +extern DECLSPEC int SDL_CondWait(SDL_cond *cond, SDL_mutex *mut); + +/* Waits for at most 'ms' milliseconds, and returns 0 if the condition + variable is signaled, SDL_MUTEX_TIMEDOUT if the condition is not + signaled in the allotted time, and -1 on error. + On some platforms this function is implemented by looping with a delay + of 1 ms, and so should be avoided if possible. +*/ +extern DECLSPEC int SDL_CondWaitTimeout(SDL_cond *cond, SDL_mutex *mutex, Uint32 ms); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_mutex_h */ diff -r 000000000000 -r 74212992fb08 include/SDL_quit.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_quit.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,52 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Include file for SDL quit event handling */ + +#ifndef _SDL_quit_h +#define _SDL_quit_h + +/* + An SDL_QUITEVENT is generated when the user tries to close the application + window. If it is ignored or filtered out, the window will remain open. + If it is not ignored or filtered, it is queued normally and the window + is allowed to close. When the window is closed, screen updates will + complete, but have no effect. + + SDL_Init() installs signal handlers for SIGINT (keyboard interrupt) + and SIGTERM (system termination request), if handlers do not already + exist, that generate SDL_QUITEVENT events as well. There is no way + to determine the cause of an SDL_QUITEVENT, but setting a signal + handler in your application will override the default generation of + quit events for that signal. +*/ + +/* There are no functions directly affecting the quit event */ +#define SDL_QuitRequested() \ + (SDL_PumpEvents(), SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUITMASK)) + +#endif /* _SDL_quit_h */ diff -r 000000000000 -r 74212992fb08 include/SDL_rwops.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_rwops.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,113 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* This file provides a general interface for SDL to read and write + data sources. It can easily be extended to files, memory, etc. +*/ + +#ifndef _SDL_RWops_h +#define _SDL_RWops_h + +#include + +#include "SDL_types.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* This is the read/write operation structure -- very basic */ + +typedef struct SDL_RWops { + /* Seek to 'offset' relative to whence, one of stdio's whence values: + SEEK_SET, SEEK_CUR, SEEK_END + Returns the final offset in the data source. + */ + int (*seek)(struct SDL_RWops *context, int offset, int whence); + + /* Read up to 'num' objects each of size 'objsize' from the data + source to the area pointed at by 'ptr'. + Returns the number of objects read, or -1 if the read failed. + */ + int (*read)(struct SDL_RWops *context, void *ptr, int size, int maxnum); + + /* Write exactly 'num' objects each of size 'objsize' from the area + pointed at by 'ptr' to data source. + Returns 'num', or -1 if the write failed. + */ + int (*write)(struct SDL_RWops *context, const void *ptr, int size, int num); + + /* Close and free an allocated SDL_FSops structure */ + int (*close)(struct SDL_RWops *context); + + Uint32 type; + union { + struct { + int autoclose; + FILE *fp; + } stdio; + struct { + Uint8 *base; + Uint8 *here; + Uint8 *stop; + } mem; + struct { + void *data1; + } unknown; + } hidden; + +} SDL_RWops; + + +/* Functions to create SDL_RWops structures from various data sources */ + +extern DECLSPEC SDL_RWops * SDL_RWFromFile(const char *file, const char *mode); + +extern DECLSPEC SDL_RWops * SDL_RWFromFP(FILE *fp, int autoclose); + +extern DECLSPEC SDL_RWops * SDL_RWFromMem(void *mem, int size); + +extern DECLSPEC SDL_RWops * SDL_AllocRW(void); +extern DECLSPEC void SDL_FreeRW(SDL_RWops *area); + +/* Macros to easily read and write from an SDL_RWops structure */ +#define SDL_RWseek(ctx, offset, whence) (ctx)->seek(ctx, offset, whence) +#define SDL_RWtell(ctx) (ctx)->seek(ctx, 0, SEEK_CUR) +#define SDL_RWread(ctx, ptr, size, n) (ctx)->read(ctx, ptr, size, n) +#define SDL_RWwrite(ctx, ptr, size, n) (ctx)->write(ctx, ptr, size, n) +#define SDL_RWclose(ctx) (ctx)->close(ctx) + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_RWops_h */ diff -r 000000000000 -r 74212992fb08 include/SDL_syswm.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_syswm.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,150 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Include file for SDL custom system window manager hooks */ + +#ifndef _SDL_syswm_h +#define _SDL_syswm_h + +#include "SDL_version.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Your application has access to a special type of event 'SDL_SYSWMEVENT', + which contains window-manager specific information and arrives whenever + an unhandled window event occurs. This event is ignored by default, but + you can enable it with SDL_EventState() +*/ +#ifdef SDL_PROTOTYPES_ONLY +struct SDL_SysWMinfo; +typedef struct SDL_SysWMinfo SDL_SysWMinfo; +#else + +/* This is the structure for custom window manager events */ +#if (defined(unix) || defined(__unix__) || defined(_AIX)) && \ + (!defined(DISABLE_X11) && !defined(__CYGWIN32__)) + /* AIX is unix, of course, but the native compiler CSet doesn't define unix */ +#include +#include + +/* These are the various supported subsystems under UNIX */ +typedef enum { + SDL_SYSWM_X11 +} SDL_SYSWM_TYPE; + +/* The UNIX custom event structure */ +struct SDL_SysWMmsg { + SDL_version version; + SDL_SYSWM_TYPE subsystem; + union { + XEvent xevent; + } event; +}; + +/* The UNIX custom window manager information structure. + When this structure is returned, it holds information about which + low level system it is using, and will be one of SDL_SYSWM_TYPE. + */ +typedef struct { + SDL_version version; + SDL_SYSWM_TYPE subsystem; + union { + struct { + Display *display; /* The X11 display */ + Window window; /* The X11 display window */ + /* These locking functions should be called around + any X11 functions using the display variable. + They lock the event thread, so should not be + called around event functions or from event filters. + */ + void (*lock_func)(void); + void (*unlock_func)(void); + + /* Introduced in SDL 1.0.2 */ + Window fswindow; /* The X11 fullscreen window */ + Window wmwindow; /* The X11 managed input window */ + } x11; + } info; +} SDL_SysWMinfo; + +#elif defined(WIN32) +#include + +/* The windows custom event structure */ +struct SDL_SysWMmsg { + SDL_version version; + HWND hwnd; /* The window for the message */ + UINT msg; /* The type of message */ + WPARAM wParam; /* WORD message parameter */ + LPARAM lParam; /* LONG message parameter */ +}; + +/* The windows custom window manager information structure */ +typedef struct { + SDL_version version; + HWND window; /* The Win32 display window */ +} SDL_SysWMinfo; + +#else + +/* The generic custom event structure */ +struct SDL_SysWMmsg { + SDL_version version; + int data; +}; + +/* The generic custom window manager information structure */ +typedef struct { + SDL_version version; + int data; +} SDL_SysWMinfo; + +#endif /* OS type */ + +#endif /* SDL_PROTOTYPES_ONLY */ + +/* Function prototypes */ +/* + * This function gives you custom hooks into the window manager information. + * It fills the structure pointed to by 'info' with custom information and + * returns 1 if the function is implemented. If it's not implemented, or + * the version member of the 'info' structure is invalid, it returns 0. + */ +extern DECLSPEC int SDL_GetWMInfo(SDL_SysWMinfo *info); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_syswm_h */ diff -r 000000000000 -r 74212992fb08 include/SDL_thread.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_thread.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,79 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +#ifndef _SDL_thread_h +#define _SDL_thread_h + +/* Header for the SDL thread management routines + + These are independent of the other SDL routines. +*/ + +#include "SDL_main.h" +#include "SDL_types.h" + +/* Thread synchronization primitives */ +#include "SDL_mutex.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* The SDL thread structure, defined in SDL_thread.c */ +struct SDL_Thread; +typedef struct SDL_Thread SDL_Thread; + +/* Create a thread */ +extern DECLSPEC SDL_Thread * SDL_CreateThread(int (*fn)(void *), void *data); + +/* Get the 32-bit thread identifier for the current thread */ +extern DECLSPEC Uint32 SDL_ThreadID(void); + +/* Get the 32-bit thread identifier for the specified thread, + equivalent to SDL_ThreadID() if the specified thread is NULL. + */ +extern DECLSPEC Uint32 SDL_GetThreadID(SDL_Thread *thread); + +/* Wait for a thread to finish. + The return code for the thread function is placed in the area + pointed to by 'status', if 'status' is not NULL. + */ +extern DECLSPEC void SDL_WaitThread(SDL_Thread *thread, int *status); + +/* Forcefully kill a thread without worrying about its state */ +extern DECLSPEC void SDL_KillThread(SDL_Thread *thread); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_thread_h */ diff -r 000000000000 -r 74212992fb08 include/SDL_timer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_timer.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,118 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +#ifndef _SDL_timer_h +#define _SDL_timer_h + +/* Header for the SDL time management routines */ + +#include "SDL_main.h" +#include "SDL_types.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* This is the OS scheduler timeslice, in milliseconds */ +#define SDL_TIMESLICE 10 + +/* This is the maximum resolution of the SDL timer on all platforms */ +#define TIMER_RESOLUTION 10 /* Experimentally determined */ + +/* Get the number of milliseconds since the SDL library initialization. + * Note that this value wraps if the program runs for more than ~49 days. + */ +extern DECLSPEC Uint32 SDL_GetTicks(void); + +/* Wait a specified number of milliseconds before returning */ +extern DECLSPEC void SDL_Delay(Uint32 ms); + +/* Function prototype for the timer callback function */ +typedef Uint32 (*SDL_TimerCallback)(Uint32 interval); + +/* Set a callback to run after the specified number of milliseconds has + * elapsed. The callback function is passed the current timer interval + * and returns the next timer interval. If the returned value is the + * same as the one passed in, the periodic alarm continues, otherwise a + * new alarm is scheduled. If the callback returns 0, the periodic alarm + * is cancelled. + * + * To cancel a currently running timer, call SDL_SetTimer(0, NULL); + * + * The timer callback function may run in a different thread than your + * main code, and so shouldn't call any functions from within itself. + * + * The maximum resolution of this timer is 10 ms, which means that if + * you request a 16 ms timer, your callback will run approximately 20 ms + * later on an unloaded system. If you wanted to set a flag signaling + * a frame update at 30 frames per second (every 33 ms), you might set a + * timer for 30 ms: + * SDL_SetTimer((33/10)*10, flag_update); + * + * If you use this function, you need to pass SDL_INIT_TIMER to SDL_Init(). + * + * Under UNIX, you should not use raise or use SIGALRM and this function + * in the same program, as it is implemented using setitimer(). You also + * should not use this function in multi-threaded applications as signals + * to multi-threaded apps have undefined behavior in some implementations. + */ +extern DECLSPEC int SDL_SetTimer(Uint32 interval, SDL_TimerCallback callback); + +/* New timer API, supports multiple timers + * Written by Stephane Peter + */ + +/* Function prototype for the new timer callback function. + * The callback function is passed the current timer interval and returns + * the next timer interval. If the returned value is the same as the one + * passed in, the periodic alarm continues, otherwise a new alarm is + * scheduled. If the callback returns 0, the periodic alarm is cancelled. + */ +typedef Uint32 (*SDL_NewTimerCallback)(Uint32 interval, void *param); + +/* Definition of the timer ID type */ +typedef struct _SDL_TimerID *SDL_TimerID; + +/* Add a new timer to the pool of timers already running. + Returns a timer ID, or NULL when an error occurs. + */ +extern DECLSPEC SDL_TimerID SDL_AddTimer(Uint32 interval, SDL_NewTimerCallback callback, void *param); + +/* Remove one of the multiple timers knowing its ID. + * Returns a boolean value indicating success. + */ +extern DECLSPEC SDL_bool SDL_RemoveTimer(SDL_TimerID t); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_timer_h */ diff -r 000000000000 -r 74212992fb08 include/SDL_types.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_types.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,87 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* General data types used by the SDL library */ + +#ifndef _SDL_types_h +#define _SDL_types_h + +/* The number of elements in a table */ +#define SDL_TABLESIZE(table) (sizeof(table)/sizeof(table[0])) + +/* Basic data types */ +typedef enum { + SDL_FALSE = 0, + SDL_TRUE = 1 +} SDL_bool; +typedef unsigned char Uint8; +typedef signed char Sint8; +typedef unsigned short Uint16; +typedef signed short Sint16; +typedef unsigned int Uint32; +typedef signed int Sint32; + +/* Figure out how to support 64-bit datatypes */ +#if !defined(__STRICT_ANSI__) +#if defined(__GNUC__) || defined(__MWERKS__) /* MJS */ +#define SDL_HAS_64BIT_TYPE long long +#elif defined(_MSC_VER) /* VC++ */ +#define SDL_HAS_64BIT_TYPE __int64 +#endif +#endif /* !__STRICT_ANSI__ */ + +/* The 64-bit datatype isn't supported on all platforms */ +#ifdef SDL_HAS_64BIT_TYPE +typedef unsigned SDL_HAS_64BIT_TYPE Uint64; +typedef SDL_HAS_64BIT_TYPE Sint64; +#else +/* This is really just a hack to prevent the compiler from complaining */ +typedef struct { + Uint32 hi; + Uint32 lo; +} Uint64, Sint64; +#endif + +/* Make sure the types really have the right sizes */ +#define SDL_COMPILE_TIME_ASSERT(name, x) \ + typedef int SDL_dummy_ ## name[(x) * 2 - 1] + +SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); +SDL_COMPILE_TIME_ASSERT(sint8, sizeof(Sint8) == 1); +SDL_COMPILE_TIME_ASSERT(uint16, sizeof(Uint16) == 2); +SDL_COMPILE_TIME_ASSERT(sint16, sizeof(Sint16) == 2); +SDL_COMPILE_TIME_ASSERT(uint32, sizeof(Uint32) == 4); +SDL_COMPILE_TIME_ASSERT(sint32, sizeof(Sint32) == 4); +SDL_COMPILE_TIME_ASSERT(uint64, sizeof(Uint64) == 8); +SDL_COMPILE_TIME_ASSERT(sint64, sizeof(Sint64) == 8); + +#undef SDL_COMPILE_TIME_ASSERT + +/* General keyboard/mouse state definitions */ +enum { SDL_PRESSED = 0x01, SDL_RELEASED = 0x00 }; + +#endif diff -r 000000000000 -r 74212992fb08 include/SDL_version.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_version.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,90 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* This header defines the current SDL version */ + +#ifndef _SDL_version_h +#define _SDL_version_h + +#include "SDL_types.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL +*/ +#define SDL_MAJOR_VERSION 1 +#define SDL_MINOR_VERSION 2 +#define SDL_PATCHLEVEL 0 + +typedef struct { + Uint8 major; + Uint8 minor; + Uint8 patch; +} SDL_version; + +/* This macro can be used to fill a version structure with the compile-time + * version of the SDL library. + */ +#define SDL_VERSION(X) \ +{ \ + (X)->major = SDL_MAJOR_VERSION; \ + (X)->minor = SDL_MINOR_VERSION; \ + (X)->patch = SDL_PATCHLEVEL; \ +} + +/* This macro turns the version numbers into a numeric value: + (1,2,3) -> (1203) + This assumes that there will never be more than 100 patchlevels +*/ +#define SDL_VERSIONNUM(X, Y, Z) \ + (X)*1000 + (Y)*100 + (Z) + +/* This is the version number macro for the current SDL version */ +#define SDL_COMPILEDVERSION \ + SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) + +/* This macro will evaluate to true if compiled with SDL at least X.Y.Z */ +#define SDL_VERSION_ATLEAST(X, Y, Z) \ + (SDL_COMPILEDVERSION >= SDL_VERSIONNUM(X, Y, Z)) + +/* This function gets the version of the dynamically linked SDL library. + it should NOT be used to fill a version structure, instead you should + use the SDL_Version() macro. + */ +extern DECLSPEC const SDL_version * SDL_Linked_Version(void); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_version_h */ diff -r 000000000000 -r 74212992fb08 include/SDL_video.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/SDL_video.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,887 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Header file for access to the SDL raw framebuffer window */ + +#ifndef _SDL_video_h +#define _SDL_video_h + +#include + +#include "SDL_types.h" +#include "SDL_mutex.h" +#include "SDL_rwops.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Transparency definitions: These define alpha as the opacity of a surface */ +#define SDL_ALPHA_OPAQUE 255 +#define SDL_ALPHA_TRANSPARENT 0 + +/* Useful data types */ +typedef struct { + Sint16 x, y; + Uint16 w, h; +} SDL_Rect; + +typedef struct { + Uint8 r; + Uint8 g; + Uint8 b; + Uint8 unused; +} SDL_Color; + +typedef struct { + int ncolors; + SDL_Color *colors; +} SDL_Palette; + +/* Everything in the pixel format structure is read-only */ +typedef struct SDL_PixelFormat { + SDL_Palette *palette; + Uint8 BitsPerPixel; + Uint8 BytesPerPixel; + Uint8 Rloss; + Uint8 Gloss; + Uint8 Bloss; + Uint8 Aloss; + Uint8 Rshift; + Uint8 Gshift; + Uint8 Bshift; + Uint8 Ashift; + Uint32 Rmask; + Uint32 Gmask; + Uint32 Bmask; + Uint32 Amask; + + /* RGB color key information */ + Uint32 colorkey; + /* Alpha value information (per-surface alpha) */ + Uint8 alpha; +} SDL_PixelFormat; + +/* typedef for private surface blitting functions */ +struct SDL_Surface; +typedef int (*SDL_blit)(struct SDL_Surface *src, SDL_Rect *srcrect, + struct SDL_Surface *dst, SDL_Rect *dstrect); + +/* This structure should be treated as read-only, except for 'pixels', + which, if not NULL, contains the raw pixel data for the surface. +*/ +typedef struct SDL_Surface { + Uint32 flags; /* Read-only */ + SDL_PixelFormat *format; /* Read-only */ + int w, h; /* Read-only */ + Uint16 pitch; /* Read-only */ + void *pixels; /* Read-write */ + int offset; /* Private */ + + /* Hardware-specific surface info */ + struct private_hwdata *hwdata; + + /* clipping information */ + SDL_Rect clip_rect; /* Read-only */ + Uint32 unused1; /* for binary compatibility */ + + /* Allow recursive locks */ + Uint32 locked; /* Private */ + + /* info for fast blit mapping to other surfaces */ + struct SDL_BlitMap *map; /* Private */ + + /* format version, bumped at every change to invalidate blit maps */ + unsigned int format_version; /* Private */ + + /* Reference count -- used when freeing surface */ + int refcount; /* Read-mostly */ +} SDL_Surface; + +/* These are the currently supported flags for the SDL_surface */ +/* Available for SDL_CreateRGBSurface() or SDL_SetVideoMode() */ +#define SDL_SWSURFACE 0x00000000 /* Surface is in system memory */ +#define SDL_HWSURFACE 0x00000001 /* Surface is in video memory */ +#define SDL_ASYNCBLIT 0x00000004 /* Use asynchronous blits if possible */ +/* Available for SDL_SetVideoMode() */ +#define SDL_ANYFORMAT 0x10000000 /* Allow any video depth/pixel-format */ +#define SDL_HWPALETTE 0x20000000 /* Surface has exclusive palette */ +#define SDL_DOUBLEBUF 0x40000000 /* Set up double-buffered video mode */ +#define SDL_FULLSCREEN 0x80000000 /* Surface is a full screen display */ +#define SDL_OPENGL 0x00000002 /* Create an OpenGL rendering context */ +#define SDL_OPENGLBLIT 0x0000000A /* Create an OpenGL rendering context and use it for blitting */ +#define SDL_RESIZABLE 0x00000010 /* This video mode may be resized */ +#define SDL_NOFRAME 0x00000020 /* No window caption or edge frame */ +/* Used internally (read-only) */ +#define SDL_HWACCEL 0x00000100 /* Blit uses hardware acceleration */ +#define SDL_SRCCOLORKEY 0x00001000 /* Blit uses a source color key */ +#define SDL_RLEACCELOK 0x00002000 /* Private flag */ +#define SDL_RLEACCEL 0x00004000 /* Surface is RLE encoded */ +#define SDL_SRCALPHA 0x00010000 /* Blit uses source alpha blending */ +#define SDL_PREALLOC 0x01000000 /* Surface uses preallocated memory */ + +/* Evaluates to true if the surface needs to be locked before access */ +#define SDL_MUSTLOCK(surface) \ + (surface->offset || \ + ((surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT|SDL_RLEACCEL)) != 0)) + + +/* Useful for determining the video hardware capabilities */ +typedef struct { + Uint32 hw_available :1; /* Flag: Can you create hardware surfaces? */ + Uint32 wm_available :1; /* Flag: Can you talk to a window manager? */ + Uint32 UnusedBits1 :6; + Uint32 UnusedBits2 :1; + Uint32 blit_hw :1; /* Flag: Accelerated blits HW --> HW */ + Uint32 blit_hw_CC :1; /* Flag: Accelerated blits with Colorkey */ + Uint32 blit_hw_A :1; /* Flag: Accelerated blits with Alpha */ + Uint32 blit_sw :1; /* Flag: Accelerated blits SW --> HW */ + Uint32 blit_sw_CC :1; /* Flag: Accelerated blits with Colorkey */ + Uint32 blit_sw_A :1; /* Flag: Accelerated blits with Alpha */ + Uint32 blit_fill :1; /* Flag: Accelerated color fill */ + Uint32 UnusedBits3 :16; + Uint32 video_mem; /* The total amount of video memory (in K) */ + SDL_PixelFormat *vfmt; /* Value: The format of the video surface */ +} SDL_VideoInfo; + + +/* The most common video overlay formats. + For an explanation of these pixel formats, see: + http://www.webartz.com/fourcc/indexyuv.htm + + For information on the relationship between color spaces, see: + http://www.neuro.sfc.keio.ac.jp/~aly/polygon/info/color-space-faq.html + */ +#define SDL_YV12_OVERLAY 0x32315659 /* Planar mode: Y + V + U (3 planes) */ +#define SDL_IYUV_OVERLAY 0x56555949 /* Planar mode: Y + U + V (3 planes) */ +#define SDL_YUY2_OVERLAY 0x32595559 /* Packed mode: Y0+U0+Y1+V0 (1 plane) */ +#define SDL_UYVY_OVERLAY 0x59565955 /* Packed mode: U0+Y0+V0+Y1 (1 plane) */ +#define SDL_YVYU_OVERLAY 0x55595659 /* Packed mode: Y0+V0+Y1+U0 (1 plane) */ + +/* The YUV hardware video overlay */ +typedef struct SDL_Overlay { + Uint32 format; /* Read-only */ + int w, h; /* Read-only */ + int planes; /* Read-only */ + Uint16 *pitches; /* Read-only */ + Uint8 **pixels; /* Read-write */ + + /* Hardware-specific surface info */ + struct private_yuvhwfuncs *hwfuncs; + struct private_yuvhwdata *hwdata; + + /* Special flags */ + Uint32 hw_overlay :1; /* Flag: This overlay hardware accelerated? */ + Uint32 UnusedBits :31; +} SDL_Overlay; + + +/* Public enumeration for setting the OpenGL window attributes. */ +typedef enum { + SDL_GL_RED_SIZE, + SDL_GL_GREEN_SIZE, + SDL_GL_BLUE_SIZE, + SDL_GL_ALPHA_SIZE, + SDL_GL_BUFFER_SIZE, + SDL_GL_DOUBLEBUFFER, + SDL_GL_DEPTH_SIZE, + SDL_GL_STENCIL_SIZE, + SDL_GL_ACCUM_RED_SIZE, + SDL_GL_ACCUM_GREEN_SIZE, + SDL_GL_ACCUM_BLUE_SIZE, + SDL_GL_ACCUM_ALPHA_SIZE +} SDL_GLattr; + +/* flags for SDL_SetPalette() */ +#define SDL_LOGPAL 0x01 +#define SDL_PHYSPAL 0x02 + +/* Function prototypes */ + +/* These functions are used internally, and should not be used unless you + * have a specific need to specify the video driver you want to use. + * You should normally use SDL_Init() or SDL_InitSubSystem(). + * + * SDL_VideoInit() initializes the video subsystem -- sets up a connection + * to the window manager, etc, and determines the current video mode and + * pixel format, but does not initialize a window or graphics mode. + * Note that event handling is activated by this routine. + * + * If you use both sound and video in your application, you need to call + * SDL_Init() before opening the sound device, otherwise under Win32 DirectX, + * you won't be able to set full-screen display modes. + */ +extern DECLSPEC int SDL_VideoInit(const char *driver_name, Uint32 flags); +extern DECLSPEC void SDL_VideoQuit(void); + +/* This function fills the given character buffer with the name of the + * video driver, and returns a pointer to it if the video driver has + * been initialized. It returns NULL if no driver has been initialized. + */ +extern DECLSPEC char *SDL_VideoDriverName(char *namebuf, int maxlen); + +/* + * This function returns a pointer to the current display surface. + * If SDL is doing format conversion on the display surface, this + * function returns the publicly visible surface, not the real video + * surface. + */ +extern DECLSPEC SDL_Surface * SDL_GetVideoSurface(void); + +/* + * This function returns a read-only pointer to information about the + * video hardware. If this is called before SDL_SetVideoMode(), the 'vfmt' + * member of the returned structure will contain the pixel format of the + * "best" video mode. + */ +extern DECLSPEC const SDL_VideoInfo * SDL_GetVideoInfo(void); + +/* + * Check to see if a particular video mode is supported. + * It returns 0 if the requested mode is not supported under any bit depth, + * or returns the bits-per-pixel of the closest available mode with the + * given width and height. If this bits-per-pixel is different from the + * one used when setting the video mode, SDL_SetVideoMode() will succeed, + * but will emulate the requested bits-per-pixel with a shadow surface. + * + * The arguments to SDL_VideoModeOK() are the same ones you would pass to + * SDL_SetVideoMode() + */ +extern DECLSPEC int SDL_VideoModeOK(int width, int height, int bpp, Uint32 flags); + +/* + * Return a pointer to an array of available screen dimensions for the + * given format and video flags, sorted largest to smallest. Returns + * NULL if there are no dimensions available for a particular format, + * or (SDL_Rect **)-1 if any dimension is okay for the given format. + * + * If 'format' is NULL, the mode list will be for the format given + * by SDL_GetVideoInfo()->vfmt + */ +extern DECLSPEC SDL_Rect ** SDL_ListModes(SDL_PixelFormat *format, Uint32 flags); + +/* + * Set up a video mode with the specified width, height and bits-per-pixel. + * + * If 'bpp' is 0, it is treated as the current display bits per pixel. + * + * If SDL_ANYFORMAT is set in 'flags', the SDL library will try to set the + * requested bits-per-pixel, but will return whatever video pixel format is + * available. The default is to emulate the requested pixel format if it + * is not natively available. + * + * If SDL_HWSURFACE is set in 'flags', the video surface will be placed in + * video memory, if possible, and you may have to call SDL_LockSurface() + * in order to access the raw framebuffer. Otherwise, the video surface + * will be created in system memory. + * + * If SDL_ASYNCBLIT is set in 'flags', SDL will try to perform rectangle + * updates asynchronously, but you must always lock before accessing pixels. + * SDL will wait for updates to complete before returning from the lock. + * + * If SDL_HWPALETTE is set in 'flags', the SDL library will guarantee + * that the colors set by SDL_SetColors() will be the colors you get. + * Otherwise, in 8-bit mode, SDL_SetColors() may not be able to set all + * of the colors exactly the way they are requested, and you should look + * at the video surface structure to determine the actual palette. + * If SDL cannot guarantee that the colors you request can be set, + * i.e. if the colormap is shared, then the video surface may be created + * under emulation in system memory, overriding the SDL_HWSURFACE flag. + * + * If SDL_FULLSCREEN is set in 'flags', the SDL library will try to set + * a fullscreen video mode. The default is to create a windowed mode + * if the current graphics system has a window manager. + * If the SDL library is able to set a fullscreen video mode, this flag + * will be set in the surface that is returned. + * + * If SDL_DOUBLEBUF is set in 'flags', the SDL library will try to set up + * two surfaces in video memory and swap between them when you call + * SDL_Flip(). This is usually slower than the normal single-buffering + * scheme, but prevents "tearing" artifacts caused by modifying video + * memory while the monitor is refreshing. It should only be used by + * applications that redraw the entire screen on every update. + * + * If SDL_RESIZABLE is set in 'flags', the SDL library will allow the + * window manager, if any, to resize the window at runtime. When this + * occurs, SDL will send a SDL_VIDEORESIZE event to you application, + * and you must respond to the event by re-calling SDL_SetVideoMode() + * with the requested size (or another size that suits the application). + * + * If SDL_NOFRAME is set in 'flags', the SDL library will create a window + * without any title bar or frame decoration. Fullscreen video modes have + * this flag set automatically. + * + * This function returns the video framebuffer surface, or NULL if it fails. + * + * If you rely on functionality provided by certain video flags, check the + * flags of the returned surface to make sure that functionality is available. + * SDL will fall back to reduced functionality if the exact flags you wanted + * are not available. + */ +extern DECLSPEC SDL_Surface *SDL_SetVideoMode + (int width, int height, int bpp, Uint32 flags); + +/* + * Makes sure the given list of rectangles is updated on the given screen. + * If 'x', 'y', 'w' and 'h' are all 0, SDL_UpdateRect will update the entire + * screen. + * These functions should not be called while 'screen' is locked. + */ +extern DECLSPEC void SDL_UpdateRects + (SDL_Surface *screen, int numrects, SDL_Rect *rects); +extern DECLSPEC void SDL_UpdateRect + (SDL_Surface *screen, Sint32 x, Sint32 y, Uint32 w, Uint32 h); + +/* + * On hardware that supports double-buffering, this function sets up a flip + * and returns. The hardware will wait for vertical retrace, and then swap + * video buffers before the next video surface blit or lock will return. + * On hardware that doesn not support double-buffering, this is equivalent + * to calling SDL_UpdateRect(screen, 0, 0, 0, 0); + * The SDL_DOUBLEBUF flag must have been passed to SDL_SetVideoMode() when + * setting the video mode for this function to perform hardware flipping. + * This function returns 0 if successful, or -1 if there was an error. + */ +extern DECLSPEC int SDL_Flip(SDL_Surface *screen); + +/* + * Set the gamma correction for each of the color channels. + * The gamma values range (approximately) between 0.1 and 10.0 + * + * If this function isn't supported directly by the hardware, it will + * be emulated using gamma ramps, if available. If successful, this + * function returns 0, otherwise it returns -1. + */ +extern DECLSPEC int SDL_SetGamma(float red, float green, float blue); + +/* + * Set the gamma translation table for the red, green, and blue channels + * of the video hardware. Each table is an array of 256 16-bit quantities, + * representing a mapping between the input and output for that channel. + * The input is the index into the array, and the output is the 16-bit + * gamma value at that index, scaled to the output color precision. + * + * You may pass NULL for any of the channels to leave it unchanged. + * If the call succeeds, it will return 0. If the display driver or + * hardware does not support gamma translation, or otherwise fails, + * this function will return -1. + */ +extern DECLSPEC int SDL_SetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue); + +/* + * Retrieve the current values of the gamma translation tables. + * + * You must pass in valid pointers to arrays of 256 16-bit quantities. + * Any of the pointers may be NULL to ignore that channel. + * If the call succeeds, it will return 0. If the display driver or + * hardware does not support gamma translation, or otherwise fails, + * this function will return -1. + */ +extern DECLSPEC int SDL_GetGammaRamp(Uint16 *red, Uint16 *green, Uint16 *blue); + +/* + * Sets a portion of the colormap for the given 8-bit surface. If 'surface' + * is not a palettized surface, this function does nothing, returning 0. + * If all of the colors were set as passed to SDL_SetColors(), it will + * return 1. If not all the color entries were set exactly as given, + * it will return 0, and you should look at the surface palette to + * determine the actual color palette. + * + * When 'surface' is the surface associated with the current display, the + * display colormap will be updated with the requested colors. If + * SDL_HWPALETTE was set in SDL_SetVideoMode() flags, SDL_SetColors() + * will always return 1, and the palette is guaranteed to be set the way + * you desire, even if the window colormap has to be warped or run under + * emulation. + */ +extern DECLSPEC int SDL_SetColors(SDL_Surface *surface, + SDL_Color *colors, int firstcolor, int ncolors); + +/* + * Sets a portion of the colormap for a given 8-bit surface. + * 'flags' is one or both of: + * SDL_LOGPAL -- set logical palette, which controls how blits are mapped + * to/from the surface, + * SDL_PHYSPAL -- set physical palette, which controls how pixels look on + * the screen + * Only screens have physical palettes. Separate change of physical/logical + * palettes is only possible if the screen has SDL_HWPALETTE set. + * + * The return value is 1 if all colours could be set as requested, and 0 + * otherwise. + * + * SDL_SetColors() is equivalent to calling this function with + * flags = (SDL_LOGPAL|SDL_PHYSPAL). + */ +extern DECLSPEC int SDL_SetPalette(SDL_Surface *surface, int flags, + SDL_Color *colors, int firstcolor, + int ncolors); + +/* + * Maps an RGB triple to an opaque pixel value for a given pixel format + */ +extern DECLSPEC Uint32 SDL_MapRGB + (SDL_PixelFormat *format, Uint8 r, Uint8 g, Uint8 b); + +/* + * Maps an RGBA quadruple to a pixel value for a given pixel format + */ +extern DECLSPEC Uint32 SDL_MapRGBA(SDL_PixelFormat *format, + Uint8 r, Uint8 g, Uint8 b, Uint8 a); + +/* + * Maps a pixel value into the RGB components for a given pixel format + */ +extern DECLSPEC void SDL_GetRGB(Uint32 pixel, SDL_PixelFormat *fmt, + Uint8 *r, Uint8 *g, Uint8 *b); + +/* + * Maps a pixel value into the RGBA components for a given pixel format + */ +extern DECLSPEC void SDL_GetRGBA(Uint32 pixel, SDL_PixelFormat *fmt, + Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a); + +/* + * Allocate and free an RGB surface (must be called after SDL_SetVideoMode) + * If the depth is 4 or 8 bits, an empty palette is allocated for the surface. + * If the depth is greater than 8 bits, the pixel format is set using the + * flags '[RGB]mask'. + * If the function runs out of memory, it will return NULL. + * + * The 'flags' tell what kind of surface to create. + * SDL_SWSURFACE means that the surface should be created in system memory. + * SDL_HWSURFACE means that the surface should be created in video memory, + * with the same format as the display surface. This is useful for surfaces + * that will not change much, to take advantage of hardware acceleration + * when being blitted to the display surface. + * SDL_ASYNCBLIT means that SDL will try to perform asynchronous blits with + * this surface, but you must always lock it before accessing the pixels. + * SDL will wait for current blits to finish before returning from the lock. + * SDL_SRCCOLORKEY indicates that the surface will be used for colorkey blits. + * If the hardware supports acceleration of colorkey blits between + * two surfaces in video memory, SDL will try to place the surface in + * video memory. If this isn't possible or if there is no hardware + * acceleration available, the surface will be placed in system memory. + * SDL_SRCALPHA means that the surface will be used for alpha blits and + * if the hardware supports hardware acceleration of alpha blits between + * two surfaces in video memory, to place the surface in video memory + * if possible, otherwise it will be placed in system memory. + * If the surface is created in video memory, blits will be _much_ faster, + * but the surface format must be identical to the video surface format, + * and the only way to access the pixels member of the surface is to use + * the SDL_LockSurface() and SDL_UnlockSurface() calls. + * If the requested surface actually resides in video memory, SDL_HWSURFACE + * will be set in the flags member of the returned surface. If for some + * reason the surface could not be placed in video memory, it will not have + * the SDL_HWSURFACE flag set, and will be created in system memory instead. + */ +#define SDL_AllocSurface SDL_CreateRGBSurface +extern DECLSPEC SDL_Surface *SDL_CreateRGBSurface + (Uint32 flags, int width, int height, int depth, + Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); +extern DECLSPEC SDL_Surface *SDL_CreateRGBSurfaceFrom(void *pixels, + int width, int height, int depth, int pitch, + Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); +extern DECLSPEC void SDL_FreeSurface(SDL_Surface *surface); + +/* + * SDL_LockSurface() sets up a surface for directly accessing the pixels. + * Between calls to SDL_LockSurface()/SDL_UnlockSurface(), you can write + * to and read from 'surface->pixels', using the pixel format stored in + * 'surface->format'. Once you are done accessing the surface, you should + * use SDL_UnlockSurface() to release it. + * + * Not all surfaces require locking. If SDL_MUSTLOCK(surface) evaluates + * to 0, then you can read and write to the surface at any time, and the + * pixel format of the surface will not change. In particular, if the + * SDL_HWSURFACE flag is not given when calling SDL_SetVideoMode(), you + * will not need to lock the display surface before accessing it. + * + * No operating system or library calls should be made between lock/unlock + * pairs, as critical system locks may be held during this time. + * + * SDL_LockSurface() returns 0, or -1 if the surface couldn't be locked. + */ +extern DECLSPEC int SDL_LockSurface(SDL_Surface *surface); +extern DECLSPEC void SDL_UnlockSurface(SDL_Surface *surface); + +/* + * Load a surface from a seekable SDL data source (memory or file.) + * If 'freesrc' is non-zero, the source will be closed after being read. + * Returns the new surface, or NULL if there was an error. + * The new surface should be freed with SDL_FreeSurface(). + */ +extern DECLSPEC SDL_Surface * SDL_LoadBMP_RW(SDL_RWops *src, int freesrc); + +/* Convenience macro -- load a surface from a file */ +#define SDL_LoadBMP(file) SDL_LoadBMP_RW(SDL_RWFromFile(file, "rb"), 1) + +/* + * Save a surface to a seekable SDL data source (memory or file.) + * If 'freedst' is non-zero, the source will be closed after being written. + * Returns 0 if successful or -1 if there was an error. + */ +extern DECLSPEC int SDL_SaveBMP_RW + (SDL_Surface *surface, SDL_RWops *dst, int freedst); + +/* Convenience macro -- save a surface to a file */ +#define SDL_SaveBMP(surface, file) \ + SDL_SaveBMP_RW(surface, SDL_RWFromFile(file, "wb"), 1) + +/* + * Sets the color key (transparent pixel) in a blittable surface. + * If 'flag' is SDL_SRCCOLORKEY (optionally OR'd with SDL_RLEACCEL), + * 'key' will be the transparent pixel in the source image of a blit. + * SDL_RLEACCEL requests RLE acceleration for the surface if present, + * and removes RLE acceleration if absent. + * If 'flag' is 0, this function clears any current color key. + * This function returns 0, or -1 if there was an error. + */ +extern DECLSPEC int SDL_SetColorKey + (SDL_Surface *surface, Uint32 flag, Uint32 key); + +/* + * This function sets the alpha value for the entire surface, as opposed to + * using the alpha component of each pixel. This value measures the range + * of transparency of the surface, 0 being completely transparent to 255 + * being completely opaque. An 'alpha' value of 255 causes blits to be + * opaque, the source pixels copied to the destination (the default). Note + * that per-surface alpha can be combined with colorkey transparency. + * + * If 'flag' is 0, alpha blending is disabled for the surface. + * If 'flag' is SDL_SRCALPHA, alpha blending is enabled for the surface. + * OR:ing the flag with SDL_RLEACCEL requests RLE acceleration for the + * surface; if SDL_RLEACCEL is not specified, the RLE accel will be removed. + */ +extern DECLSPEC int SDL_SetAlpha(SDL_Surface *surface, Uint32 flag, Uint8 alpha); + +/* + * Sets the clipping rectangle for the destination surface in a blit. + * + * If the clip rectangle is NULL, clipping will be disabled. + * If the clip rectangle doesn't intersect the surface, the function will + * return SDL_FALSE and blits will be completely clipped. Otherwise the + * function returns SDL_TRUE and blits to the surface will be clipped to + * the intersection of the surface area and the clipping rectangle. + * + * Note that blits are automatically clipped to the edges of the source + * and destination surfaces. + */ +extern DECLSPEC SDL_bool SDL_SetClipRect(SDL_Surface *surface, SDL_Rect *rect); + +/* + * Gets the clipping rectangle for the destination surface in a blit. + * 'rect' must be a pointer to a valid rectangle which will be filled + * with the correct values. + */ +extern DECLSPEC void SDL_GetClipRect(SDL_Surface *surface, SDL_Rect *rect); + +/* + * Creates a new surface of the specified format, and then copies and maps + * the given surface to it so the blit of the converted surface will be as + * fast as possible. If this function fails, it returns NULL. + * + * The 'flags' parameter is passed to SDL_CreateRGBSurface() and has those + * semantics. You can also pass SDL_RLEACCEL in the flags parameter and + * SDL will try to RLE accelerate colorkey and alpha blits in the resulting + * surface. + * + * This function is used internally by SDL_DisplayFormat(). + */ +extern DECLSPEC SDL_Surface *SDL_ConvertSurface + (SDL_Surface *src, SDL_PixelFormat *fmt, Uint32 flags); + +/* + * This performs a fast blit from the source surface to the destination + * surface. It assumes that the source and destination rectangles are + * the same size. If either 'srcrect' or 'dstrect' are NULL, the entire + * surface (src or dst) is copied. The final blit rectangles are saved + * in 'srcrect' and 'dstrect' after all clipping is performed. + * If the blit is successful, it returns 0, otherwise it returns -1. + * + * The blit function should not be called on a locked surface. + * + * The blit semantics for surfaces with and without alpha and colorkey + * are defined as follows: + * + * RGBA->RGB: + * SDL_SRCALPHA set: + * alpha-blend (using alpha-channel). + * SDL_SRCCOLORKEY ignored. + * SDL_SRCALPHA not set: + * copy RGB. + * if SDL_SRCCOLORKEY set, only copy the pixels matching the + * RGB values of the source colour key, ignoring alpha in the + * comparison. + * + * RGB->RGBA: + * SDL_SRCALPHA set: + * alpha-blend (using the source per-surface alpha value); + * set destination alpha to opaque. + * SDL_SRCALPHA not set: + * copy RGB, set destination alpha to opaque. + * both: + * if SDL_SRCCOLORKEY set, only copy the pixels matching the + * source colour key. + * + * RGBA->RGBA: + * SDL_SRCALPHA set: + * alpha-blend (using the source alpha channel) the RGB values; + * leave destination alpha untouched. [Note: is this correct?] + * SDL_SRCCOLORKEY ignored. + * SDL_SRCALPHA not set: + * copy all of RGBA to the destination. + * if SDL_SRCCOLORKEY set, only copy the pixels matching the + * RGB values of the source colour key, ignoring alpha in the + * comparison. + * + * RGB->RGB: + * SDL_SRCALPHA set: + * alpha-blend (using the source per-surface alpha value). + * SDL_SRCALPHA not set: + * copy RGB. + * both: + * if SDL_SRCCOLORKEY set, only copy the pixels matching the + * source colour key. + * + * If either of the surfaces were in video memory, and the blit returns -2, + * the video memory was lost, so it should be reloaded with artwork and + * re-blitted: + while ( SDL_BlitSurface(image, imgrect, screen, dstrect) == -2 ) { + while ( SDL_LockSurface(image) < 0 ) + Sleep(10); + -- Write image pixels to image->pixels -- + SDL_UnlockSurface(image); + } + * This happens under DirectX 5.0 when the system switches away from your + * fullscreen application. The lock will also fail until you have access + * to the video memory again. + */ +/* You should call SDL_BlitSurface() unless you know exactly how SDL + blitting works internally and how to use the other blit functions. +*/ +#define SDL_BlitSurface SDL_UpperBlit + +/* This is the public blit function, SDL_BlitSurface(), and it performs + rectangle validation and clipping before passing it to SDL_LowerBlit() +*/ +extern DECLSPEC int SDL_UpperBlit + (SDL_Surface *src, SDL_Rect *srcrect, + SDL_Surface *dst, SDL_Rect *dstrect); +/* This is a semi-private blit function and it performs low-level surface + blitting only. +*/ +extern DECLSPEC int SDL_LowerBlit + (SDL_Surface *src, SDL_Rect *srcrect, + SDL_Surface *dst, SDL_Rect *dstrect); + +/* + * This function performs a fast fill of the given rectangle with 'color' + * The given rectangle is clipped to the destination surface clip area + * and the final fill rectangle is saved in the passed in pointer. + * If 'dstrect' is NULL, the whole surface will be filled with 'color' + * The color should be a pixel of the format used by the surface, and + * can be generated by the SDL_MapRGB() function. + * This function returns 0 on success, or -1 on error. + */ +extern DECLSPEC int SDL_FillRect + (SDL_Surface *dst, SDL_Rect *dstrect, Uint32 color); + +/* + * This function takes a surface and copies it to a new surface of the + * pixel format and colors of the video framebuffer, suitable for fast + * blitting onto the display surface. It calls SDL_ConvertSurface() + * + * If you want to take advantage of hardware colorkey or alpha blit + * acceleration, you should set the colorkey and alpha value before + * calling this function. + * + * If the conversion fails or runs out of memory, it returns NULL + */ +extern DECLSPEC SDL_Surface * SDL_DisplayFormat(SDL_Surface *surface); + +/* + * This function takes a surface and copies it to a new surface of the + * pixel format and colors of the video framebuffer (if possible), + * suitable for fast alpha blitting onto the display surface. + * The new surface will always have an alpha channel. + * + * If you want to take advantage of hardware colorkey or alpha blit + * acceleration, you should set the colorkey and alpha value before + * calling this function. + * + * If the conversion fails or runs out of memory, it returns NULL + */ +extern DECLSPEC SDL_Surface * SDL_DisplayFormatAlpha(SDL_Surface *surface); + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* YUV video surface overlay functions */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* This function creates a video output overlay + Calling the returned surface an overlay is something of a misnomer because + the contents of the display surface underneath the area where the overlay + is shown is undefined - it may be overwritten with the converted YUV data. +*/ +extern DECLSPEC SDL_Overlay *SDL_CreateYUVOverlay(int width, int height, + Uint32 format, SDL_Surface *display); + +/* Lock an overlay for direct access, and unlock it when you are done */ +extern DECLSPEC int SDL_LockYUVOverlay(SDL_Overlay *overlay); +extern DECLSPEC void SDL_UnlockYUVOverlay(SDL_Overlay *overlay); + +/* Blit a video overlay to the display surface. + The contents of the video surface underneath the blit destination are + not defined. + The width and height of the destination rectangle may be different from + that of the overlay, but currently only 2x scaling is supported. +*/ +extern DECLSPEC int SDL_DisplayYUVOverlay(SDL_Overlay *overlay, SDL_Rect *dstrect); + +/* Free a video overlay */ +extern DECLSPEC void SDL_FreeYUVOverlay(SDL_Overlay *overlay); + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* OpenGL support functions. */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Dynamically load a GL driver, if SDL is built with dynamic GL. + * + * SDL links normally with the OpenGL library on your system by default, + * but you can compile it to dynamically load the GL driver at runtime. + * If you do this, you need to retrieve all of the GL functions used in + * your program from the dynamic library using SDL_GL_GetProcAddress(). + * + * This is disabled in default builds of SDL. + */ +extern DECLSPEC int SDL_GL_LoadLibrary(const char *path); + +/* + * Get the address of a GL function (for extension functions) + */ +extern DECLSPEC void *SDL_GL_GetProcAddress(const char* proc); + +/* + * Set an attribute of the OpenGL subsystem before intialization. + */ +extern DECLSPEC int SDL_GL_SetAttribute(SDL_GLattr attr, int value); + +/* + * Get an attribute of the OpenGL subsystem from the windowing + * interface, such as glX. This is of course different from getting + * the values from SDL's internal OpenGL subsystem, which only + * stores the values you request before initialization. + * + * Developers should track the values they pass into SDL_GL_SetAttribute + * themselves if they want to retrieve these values. + */ +extern DECLSPEC int SDL_GL_GetAttribute(SDL_GLattr attr, int* value); + +/* + * Swap the OpenGL buffers, if double-buffering is supported. + */ +extern DECLSPEC void SDL_GL_SwapBuffers(void); + +/* + * Internal functions that should not be called unless you have read + * and understood the source code for these functions. + */ +extern DECLSPEC void SDL_GL_UpdateRects(int numrects, SDL_Rect* rects); +extern DECLSPEC void SDL_GL_Lock(void); +extern DECLSPEC void SDL_GL_Unlock(void); + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +/* These functions allow interaction with the window manager, if any. */ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * Sets/Gets the title and icon text of the display window + */ +extern DECLSPEC void SDL_WM_SetCaption(const char *title, const char *icon); +extern DECLSPEC void SDL_WM_GetCaption(char **title, char **icon); + +/* + * Sets the icon for the display window. + * This function must be called before the first call to SDL_SetVideoMode(). + * It takes an icon surface, and a mask in MSB format. + * If 'mask' is NULL, the entire icon surface will be used as the icon. + */ +extern DECLSPEC void SDL_WM_SetIcon(SDL_Surface *icon, Uint8 *mask); + +/* + * This function iconifies the window, and returns 1 if it succeeded. + * If the function succeeds, it generates an SDL_APPACTIVE loss event. + * This function is a noop and returns 0 in non-windowed environments. + */ +extern DECLSPEC int SDL_WM_IconifyWindow(void); + +/* + * Toggle fullscreen mode without changing the contents of the screen. + * If the display surface does not require locking before accessing + * the pixel information, then the memory pointers will not change. + * + * If this function was able to toggle fullscreen mode (change from + * running in a window to fullscreen, or vice-versa), it will return 1. + * If it is not implemented, or fails, it returns 0. + * + * The next call to SDL_SetVideoMode() will set the mode fullscreen + * attribute based on the flags parameter - if SDL_FULLSCREEN is not + * set, then the display will be windowed by default where supported. + * + * This is currently only implemented in the X11 video driver. + */ +extern DECLSPEC int SDL_WM_ToggleFullScreen(SDL_Surface *surface); + +/* + * This function allows you to set and query the input grab state of + * the application. It returns the new input grab state. + */ +typedef enum { + SDL_GRAB_QUERY = -1, + SDL_GRAB_OFF = 0, + SDL_GRAB_ON = 1, + SDL_GRAB_FULLSCREEN /* Used internally */ +} SDL_GrabMode; +/* + * Grabbing means that the mouse is confined to the application window, + * and nearly all keyboard input is passed directly to the application, + * and not interpreted by a window manager, if any. + */ +extern DECLSPEC SDL_GrabMode SDL_WM_GrabInput(SDL_GrabMode mode); + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* _SDL_video_h */ diff -r 000000000000 -r 74212992fb08 include/begin_code.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/begin_code.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,86 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +/* This file sets things up for C dynamic library function definitions, + static inlined functions, and structures aligned at 4-byte alignment. + If you don't like ugly C preprocessor code, don't look at this file. :) +*/ + +/* This shouldn't be nested -- included it around code only. */ +#ifdef _begin_code_h +#error Nested inclusion of begin_code.h +#endif +#define _begin_code_h + +/* Some compilers use a special export keyword */ +#ifndef DECLSPEC +# ifdef __BEOS__ +# if defined(__GNUC__) +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC __declspec(export) +# endif +# else +# ifdef WIN32 +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC +# endif +# endif +#endif + +/* Force structure packing at 4 byte alignment. + This is necessary if the header is included in code which has structure + packing set to an alternate value, say for loading structures from disk. + The packing is reset to the previous value in close_code.h + */ +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) +#ifdef _MSC_VER +#pragma warning(disable: 4103) +#endif +#ifdef __BORLANDC__ +#pragma nopackwarning +#endif +#pragma pack(push,4) +#endif /* Compiler needs structure packing set */ + +/* Set up compiler-specific options for inlining functions */ +#ifndef SDL_INLINE_OKAY +#ifdef __GNUC__ +#define SDL_INLINE_OKAY +#else +/* Add any special compiler-specific cases here */ +#if !defined(_MSC_VER) && !defined(__MRC__) && !defined(_SGI_SOURCE) +#define __inline__ inline +#define SDL_INLINE_OKAY +#endif /* Not a funky compiler */ +#endif /* GNU C */ +#endif /* SDL_INLINE_OKAY */ + +/* If inlining isn't supported, remove "__inline__", turning static + inlined functions into static functions (resulting in code bloat + in all files which include the offending header files) +*/ +#ifndef SDL_INLINE_OKAY +#define __inline__ +#endif + diff -r 000000000000 -r 74212992fb08 include/close_code.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/include/close_code.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,36 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +/* This file reverses the effects of begin_code.h and should be included + after you finish any function and structure declarations in your headers +*/ + +#undef _begin_code_h + +/* Reset structure packing at previous byte alignment */ +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) +#ifdef __BORLANDC__ +#pragma nopackwarning +#endif +#pragma pack(pop) +#endif /* Compiler needs structure packing set */ + diff -r 000000000000 -r 74212992fb08 install-sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/install-sh Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,251 @@ +#!/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=: + chmodcmd="" + 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 -r 000000000000 -r 74212992fb08 ltconfig --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ltconfig Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,3123 @@ +#! /bin/sh + +# ltconfig - Create a system-specific libtool. +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 1996 +# +# 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. + +# A lot of this script is taken from autoconf-2.10. + +# Check that we are running under the correct shell. +SHELL=${CONFIG_SHELL-/bin/sh} +echo=echo +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell. + exec "$SHELL" "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat </dev/null`} + case X$UNAME in + *-DOS) PATH_SEPARATOR=';' ;; + *) PATH_SEPARATOR=':' ;; + esac +fi + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +if test "X${echo_test_string+set}" != Xset; then + # find a string as large as possible, as long as the shell can cope with it + for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do + # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ... + if (echo_test_string="`eval $cmd`") 2>/dev/null && + echo_test_string="`eval $cmd`" && + (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null; then + break + fi + done +fi + +if test "X`($echo '\t') 2>/dev/null`" != 'X\t' || + test "X`($echo "$echo_test_string") 2>/dev/null`" != X"$echo_test_string"; then + # The Solaris, AIX, and Digital Unix default echo programs unquote + # backslashes. This makes it impossible to quote backslashes using + # echo "$something" | sed 's/\\/\\\\/g' + # + # So, first we look for a working echo in the user's PATH. + + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH /usr/ucb; do + if (test -f $dir/echo || test -f $dir/echo$ac_exeext) && + test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' && + test "X`($dir/echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + echo="$dir/echo" + break + fi + done + IFS="$save_ifs" + + if test "X$echo" = Xecho; then + # We didn't find a better echo, so look for alternatives. + if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' && + test "X`(print -r "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + # This shell has a builtin print -r that does the trick. + echo='print -r' + elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) && + test "X$CONFIG_SHELL" != X/bin/ksh; then + # If we have ksh, try running ltconfig again with it. + ORIGINAL_CONFIG_SHELL="${CONFIG_SHELL-/bin/sh}" + export ORIGINAL_CONFIG_SHELL + CONFIG_SHELL=/bin/ksh + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$0" --no-reexec ${1+"$@"} + else + # Try using printf. + echo='printf "%s\n"' + if test "X`($echo '\t') 2>/dev/null`" = 'X\t' && + test "X`($echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + # Cool, printf works + : + elif test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && + test "X`("$ORIGINAL_CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + CONFIG_SHELL="$ORIGINAL_CONFIG_SHELL" + export CONFIG_SHELL + SHELL="$CONFIG_SHELL" + export SHELL + echo="$CONFIG_SHELL $0 --fallback-echo" + elif test "X`("$CONFIG_SHELL" "$0" --fallback-echo '\t') 2>/dev/null`" = 'X\t' && + test "X`("$CONFIG_SHELL" "$0" --fallback-echo "$echo_test_string") 2>/dev/null`" = X"$echo_test_string"; then + echo="$CONFIG_SHELL $0 --fallback-echo" + else + # maybe with a smaller string... + prev=: + + for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do + if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null; then + break + fi + prev="$cmd" + done + + if test "$prev" != 'sed 50q "$0"'; then + echo_test_string=`eval $prev` + export echo_test_string + exec "${ORIGINAL_CONFIG_SHELL}" "$0" ${1+"$@"} + else + # Oops. We lost completely, so just stick with echo. + echo=echo + fi + fi + fi + fi +fi + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e s/^X//' +sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# The name of this program. +progname=`$echo "X$0" | $Xsed -e 's%^.*/%%'` + +# Constants: +PROGRAM=ltconfig +PACKAGE=libtool +VERSION=1.3.5 +TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)" +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +rm="rm -f" + +help="Try \`$progname --help' for more information." + +# Global variables: +default_ofile=libtool +can_build_shared=yes +enable_shared=yes +# All known linkers require a `.a' archive for static linking (except M$VC, +# which needs '.lib'). +enable_static=yes +enable_fast_install=yes +enable_dlopen=unknown +enable_win32_dll=no +ltmain= +silent= +srcdir= +ac_config_guess= +ac_config_sub= +host= +nonopt= +ofile="$default_ofile" +verify_host=yes +with_gcc=no +with_gnu_ld=no +need_locks=yes +ac_ext=c +objext=o +libext=a +exeext= +cache_file= + +old_AR="$AR" +old_CC="$CC" +old_CFLAGS="$CFLAGS" +old_CPPFLAGS="$CPPFLAGS" +old_LDFLAGS="$LDFLAGS" +old_LD="$LD" +old_LN_S="$LN_S" +old_LIBS="$LIBS" +old_NM="$NM" +old_RANLIB="$RANLIB" +old_DLLTOOL="$DLLTOOL" +old_OBJDUMP="$OBJDUMP" +old_AS="$AS" + +# Parse the command line options. +args= +prev= +for option +do + case "$option" in + -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + eval "$prev=\$option" + prev= + continue + fi + + case "$option" in + --help) cat <&2 + echo "$help" 1>&2 + exit 1 + ;; + + *) + if test -z "$ltmain"; then + ltmain="$option" + elif test -z "$host"; then +# This generates an unnecessary warning for sparc-sun-solaris4.1.3_U1 +# if test -n "`echo $option| sed 's/[-a-z0-9.]//g'`"; then +# echo "$progname: warning \`$option' is not a valid host type" 1>&2 +# fi + host="$option" + else + echo "$progname: too many arguments" 1>&2 + echo "$help" 1>&2 + exit 1 + fi ;; + esac +done + +if test -z "$ltmain"; then + echo "$progname: you must specify a LTMAIN file" 1>&2 + echo "$help" 1>&2 + exit 1 +fi + +if test ! -f "$ltmain"; then + echo "$progname: \`$ltmain' does not exist" 1>&2 + echo "$help" 1>&2 + exit 1 +fi + +# Quote any args containing shell metacharacters. +ltconfig_args= +for arg +do + case "$arg" in + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ltconfig_args="$ltconfig_args '$arg'" ;; + *) ltconfig_args="$ltconfig_args $arg" ;; + esac +done + +# A relevant subset of AC_INIT. + +# 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 +# 5 compiler messages saved in config.log +# 6 checking for... messages and results +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>>./config.log + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "X${LC_ALL+set}" = Xset; then LC_ALL=C; export LC_ALL; fi +if test "X${LANG+set}" = Xset; then LANG=C; export LANG; fi + +if test -n "$cache_file" && test -r "$cache_file"; then + echo "loading cache $cache_file within ltconfig" + . $cache_file +fi + +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 + +if test -z "$srcdir"; then + # Assume the source directory is the same one as the path to LTMAIN. + srcdir=`$echo "X$ltmain" | $Xsed -e 's%/[^/]*$%%'` + test "$srcdir" = "$ltmain" && srcdir=. +fi + +trap "$rm conftest*; exit 1" 1 2 15 +if test "$verify_host" = yes; then + # Check for config.guess and config.sub. + ac_aux_dir= + for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/config.guess; then + ac_aux_dir=$ac_dir + break + fi + done + if test -z "$ac_aux_dir"; then + echo "$progname: cannot find config.guess in $srcdir $srcdir/.. $srcdir/../.." 1>&2 + echo "$help" 1>&2 + exit 1 + fi + ac_config_guess=$ac_aux_dir/config.guess + ac_config_sub=$ac_aux_dir/config.sub + + # Make sure we can run config.sub. + if $SHELL $ac_config_sub sun4 >/dev/null 2>&1; then : + else + echo "$progname: cannot run $ac_config_sub" 1>&2 + echo "$help" 1>&2 + exit 1 + fi + + echo $ac_n "checking host system type""... $ac_c" 1>&6 + + host_alias=$host + case "$host_alias" in + "") + if host_alias=`$SHELL $ac_config_guess`; then : + else + echo "$progname: cannot guess host type; you must specify one" 1>&2 + echo "$help" 1>&2 + exit 1 + fi ;; + esac + host=`$SHELL $ac_config_sub $host_alias` + echo "$ac_t$host" 1>&6 + + # Make sure the host verified. + test -z "$host" && exit 1 + +elif test -z "$host"; then + echo "$progname: you must specify a host type if you use \`--no-verify'" 1>&2 + echo "$help" 1>&2 + exit 1 +else + host_alias=$host +fi + +# Transform linux* to *-*-linux-gnu*, to support old configure scripts. +case "$host_os" in +linux-gnu*) ;; +linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'` +esac + +host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +case "$host_os" in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR cru $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +# Set a sane default for `AR'. +test -z "$AR" && AR=ar + +# Set a sane default for `OBJDUMP'. +test -z "$OBJDUMP" && OBJDUMP=objdump + +# If RANLIB is not set, then run the test. +if test "${RANLIB+set}" != "set"; then + result=no + + echo $ac_n "checking for ranlib... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/ranlib || test -f $dir/ranlib$ac_exeext; then + RANLIB="ranlib" + result="ranlib" + break + fi + done + IFS="$save_ifs" + + echo "$ac_t$result" 1>&6 +fi + +if test -n "$RANLIB"; then + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" + old_postinstall_cmds="\$RANLIB \$oldlib~$old_postinstall_cmds" +fi + +# Set sane defaults for `DLLTOOL', `OBJDUMP', and `AS', used on cygwin. +test -z "$DLLTOOL" && DLLTOOL=dlltool +test -z "$OBJDUMP" && OBJDUMP=objdump +test -z "$AS" && AS=as + +# Check to see if we are using GCC. +if test "$with_gcc" != yes || test -z "$CC"; then + # If CC is not set, then try to find GCC or a usable CC. + if test -z "$CC"; then + echo $ac_n "checking for gcc... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/gcc || test -f $dir/gcc$ac_exeext; then + CC="gcc" + break + fi + done + IFS="$save_ifs" + + if test -n "$CC"; then + echo "$ac_t$CC" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + fi + + # Not "gcc", so try "cc", rejecting "/usr/ucb/cc". + if test -z "$CC"; then + echo $ac_n "checking for cc... $ac_c" 1>&6 + IFS="${IFS= }"; save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + cc_rejected=no + for dir in $PATH; do + test -z "$dir" && dir=. + if test -f $dir/cc || test -f $dir/cc$ac_exeext; then + if test "$dir/cc" = "/usr/ucb/cc"; then + cc_rejected=yes + continue + fi + CC="cc" + break + fi + done + IFS="$save_ifs" + if test $cc_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same name, so the bogon will be chosen + # first if we set CC to just the name; use the full file name. + shift + set dummy "$dir/cc" "$@" + shift + CC="$@" + fi + fi + + if test -n "$CC"; then + echo "$ac_t$CC" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + + if test -z "$CC"; then + echo "$progname: error: no acceptable cc found in \$PATH" 1>&2 + exit 1 + fi + fi + + # Now see if the compiler is really GCC. + with_gcc=no + echo $ac_n "checking whether we are using GNU C... $ac_c" 1>&6 + echo "$progname:581: checking whether we are using GNU C" >&5 + + $rm conftest.c + cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + with_gcc=yes + fi + $rm conftest.c + echo "$ac_t$with_gcc" 1>&6 +fi + +# Allow CC to be a program name with arguments. +set dummy $CC +compiler="$2" + +echo $ac_n "checking for object suffix... $ac_c" 1>&6 +$rm conftest* +echo 'int i = 1;' > conftest.c +echo "$progname:603: checking for object suffix" >& 5 +if { (eval echo $progname:604: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; }; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + for ac_file in conftest.*; do + case $ac_file in + *.c) ;; + *) objext=`echo $ac_file | sed -e s/conftest.//` ;; + esac + done +else + cat conftest.err 1>&5 + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 +fi +$rm conftest* +echo "$ac_t$objext" 1>&6 + +echo $ac_n "checking for executable suffix... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_exeext'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_exeext="no" + $rm conftest* + echo 'main () { return 0; }' > conftest.c + echo "$progname:629: checking for executable suffix" >& 5 + if { (eval echo $progname:630: \"$ac_link\") 1>&5; (eval $ac_link) 2>conftest.err; }; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + for ac_file in conftest.*; do + case $ac_file in + *.c | *.err | *.$objext ) ;; + *) ac_cv_exeext=.`echo $ac_file | sed -e s/conftest.//` ;; + esac + done + else + cat conftest.err 1>&5 + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + $rm conftest* +fi +if test "X$ac_cv_exeext" = Xno; then + exeext="" +else + exeext="$ac_cv_exeext" +fi +echo "$ac_t$ac_cv_exeext" 1>&6 + +echo $ac_n "checking for $compiler option to produce PIC... $ac_c" 1>&6 +pic_flag= +special_shlib_compile_flags= +wl= +link_static_flag= +no_builtin_flag= + +if test "$with_gcc" = yes; then + wl='-Wl,' + link_static_flag='-static' + + case "$host_os" in + beos* | irix5* | irix6* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + aix*) + # Below there is a dirty hack to force normal static linking with -ldl + # The problem is because libdl dynamically linked with both libc and + # libC (AIX C++ library), which obviously doesn't included in libraries + # list by gcc. This cause undefined symbols with -static flags. + # This hack allows C programs to be linked with "-static -ldl", but + # we not sure about C++ programs. + link_static_flag="$link_static_flag ${wl}-lC" + ;; + cygwin* | mingw* | os2*) + # We can build DLLs from non-PIC. + ;; + amigaos*) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + pic_flag='-m68020 -resident32 -malways-restore-a4' + ;; + sysv4*MP*) + if test -d /usr/nec; then + pic_flag=-Kconform_pic + fi + ;; + *) + pic_flag='-fPIC' + ;; + esac +else + # PORTME Check for PIC flags for the system compiler. + case "$host_os" in + aix3* | aix4*) + # All AIX code is PIC. + link_static_flag='-bnso -bI:/lib/syscalls.exp' + ;; + + hpux9* | hpux10* | hpux11*) + # Is there a better link_static_flag that works with the bundled CC? + wl='-Wl,' + link_static_flag="${wl}-a ${wl}archive" + pic_flag='+Z' + ;; + + irix5* | irix6*) + wl='-Wl,' + link_static_flag='-non_shared' + # PIC (with -KPIC) is the default. + ;; + + cygwin* | mingw* | os2*) + # We can build DLLs from non-PIC. + ;; + + osf3* | osf4* | osf5*) + # All OSF/1 code is PIC. + wl='-Wl,' + link_static_flag='-non_shared' + ;; + + sco3.2v5*) + pic_flag='-Kpic' + link_static_flag='-dn' + special_shlib_compile_flags='-belf' + ;; + + solaris*) + pic_flag='-KPIC' + link_static_flag='-Bstatic' + wl='-Wl,' + ;; + + sunos4*) + pic_flag='-PIC' + link_static_flag='-Bstatic' + wl='-Qoption ld ' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + pic_flag='-KPIC' + link_static_flag='-Bstatic' + wl='-Wl,' + ;; + + uts4*) + pic_flag='-pic' + link_static_flag='-Bstatic' + ;; + sysv4*MP*) + if test -d /usr/nec ;then + pic_flag='-Kconform_pic' + link_static_flag='-Bstatic' + fi + ;; + *) + can_build_shared=no + ;; + esac +fi + +if test -n "$pic_flag"; then + echo "$ac_t$pic_flag" 1>&6 + + # Check to make sure the pic_flag actually works. + echo $ac_n "checking if $compiler PIC flag $pic_flag works... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $pic_flag -DPIC" + echo "$progname:776: checking if $compiler PIC flag $pic_flag works" >&5 + if { (eval echo $progname:777: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.$objext; then + # Append any warnings to the config.log. + cat conftest.err 1>&5 + + case "$host_os" in + hpux9* | hpux10* | hpux11*) + # On HP-UX, both CC and GCC only warn that PIC is supported... then they + # create non-PIC objects. So, if there were any warnings, we assume that + # PIC is not supported. + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + can_build_shared=no + pic_flag= + else + echo "$ac_t"yes 1>&6 + pic_flag=" $pic_flag" + fi + ;; + *) + echo "$ac_t"yes 1>&6 + pic_flag=" $pic_flag" + ;; + esac + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + can_build_shared=no + pic_flag= + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* +else + echo "$ac_t"none 1>&6 +fi + +# Check to see if options -o and -c are simultaneously supported by compiler +echo $ac_n "checking if $compiler supports -c -o file.o... $ac_c" 1>&6 +$rm -r conftest 2>/dev/null +mkdir conftest +cd conftest +$rm conftest* +echo "int some_variable = 0;" > conftest.c +mkdir out +# According to Tom Tromey, Ian Lance Taylor reported there are C compilers +# that will create temporary files in the current directory regardless of +# the output directory. Thus, making CWD read-only will cause this test +# to fail, enabling locking or at least warning the user not to do parallel +# builds. +chmod -w . +save_CFLAGS="$CFLAGS" +CFLAGS="$CFLAGS -o out/conftest2.o" +echo "$progname:829: checking if $compiler supports -c -o file.o" >&5 +if { (eval echo $progname:830: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>out/conftest.err; } && test -s out/conftest2.o; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s out/conftest.err; then + echo "$ac_t"no 1>&6 + compiler_c_o=no + else + echo "$ac_t"yes 1>&6 + compiler_c_o=yes + fi +else + # Append any errors to the config.log. + cat out/conftest.err 1>&5 + compiler_c_o=no + echo "$ac_t"no 1>&6 +fi +CFLAGS="$save_CFLAGS" +chmod u+w . +$rm conftest* out/* +rmdir out +cd .. +rmdir conftest +$rm -r conftest 2>/dev/null + +if test x"$compiler_c_o" = x"yes"; then + # Check to see if we can write to a .lo + echo $ac_n "checking if $compiler supports -c -o file.lo... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -c -o conftest.lo" + echo "$progname:862: checking if $compiler supports -c -o file.lo" >&5 +if { (eval echo $progname:863: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.lo; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + compiler_o_lo=no + else + echo "$ac_t"yes 1>&6 + compiler_o_lo=yes + fi + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + compiler_o_lo=no + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* +else + compiler_o_lo=no +fi + +# Check to see if we can do hard links to lock some files if needed +hard_links="nottested" +if test "$compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + echo $ac_n "checking if we can lock with hard links... $ac_c" 1>&6 + hard_links=yes + $rm conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + echo "$ac_t$hard_links" 1>&6 + $rm conftest* + if test "$hard_links" = no; then + echo "*** WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2 + need_locks=warn + fi +else + need_locks=no +fi + +if test "$with_gcc" = yes; then + # Check to see if options -fno-rtti -fno-exceptions are supported by compiler + echo $ac_n "checking if $compiler supports -fno-rtti -fno-exceptions ... $ac_c" 1>&6 + $rm conftest* + echo "int some_variable = 0;" > conftest.c + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -fno-rtti -fno-exceptions -c conftest.c" + echo "$progname:914: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 + if { (eval echo $progname:915: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>conftest.err; } && test -s conftest.o; then + + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + echo "$ac_t"no 1>&6 + compiler_rtti_exceptions=no + else + echo "$ac_t"yes 1>&6 + compiler_rtti_exceptions=yes + fi + else + # Append any errors to the config.log. + cat conftest.err 1>&5 + compiler_rtti_exceptions=no + echo "$ac_t"no 1>&6 + fi + CFLAGS="$save_CFLAGS" + $rm conftest* + + if test "$compiler_rtti_exceptions" = "yes"; then + no_builtin_flag=' -fno-builtin -fno-rtti -fno-exceptions' + else + no_builtin_flag=' -fno-builtin' + fi + +fi + +# Check for any special shared library compilation flags. +if test -n "$special_shlib_compile_flags"; then + echo "$progname: warning: \`$CC' requires \`$special_shlib_compile_flags' to build shared libraries" 1>&2 + if echo "$old_CC $old_CFLAGS " | egrep -e "[ ]$special_shlib_compile_flags[ ]" >/dev/null; then : + else + echo "$progname: add \`$special_shlib_compile_flags' to the CC or CFLAGS env variable and reconfigure" 1>&2 + can_build_shared=no + fi +fi + +echo $ac_n "checking if $compiler static flag $link_static_flag works... $ac_c" 1>&6 +$rm conftest* +echo 'main(){return(0);}' > conftest.c +save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS $link_static_flag" +echo "$progname:958: checking if $compiler static flag $link_static_flag works" >&5 +if { (eval echo $progname:959: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + echo "$ac_t$link_static_flag" 1>&6 +else + echo "$ac_t"none 1>&6 + link_static_flag= +fi +LDFLAGS="$save_LDFLAGS" +$rm conftest* + +if test -z "$LN_S"; then + # Check to see if we can use ln -s, or we need hard links. + echo $ac_n "checking whether ln -s works... $ac_c" 1>&6 + $rm conftest.dat + if ln -s X conftest.dat 2>/dev/null; then + $rm conftest.dat + LN_S="ln -s" + else + LN_S=ln + fi + if test "$LN_S" = "ln -s"; then + echo "$ac_t"yes 1>&6 + else + echo "$ac_t"no 1>&6 + fi +fi + +# Make sure LD is an absolute path. +if test -z "$LD"; then + ac_prog=ld + if test "$with_gcc" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + echo $ac_n "checking for ld used by GCC... $ac_c" 1>&6 + echo "$progname:991: checking for ld used by GCC" >&5 + ac_prog=`($CC -print-prog-name=ld) 2>&5` + case "$ac_prog" in + # Accept absolute paths. + [\\/]* | [A-Za-z]:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we are not using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac + elif test "$with_gnu_ld" = yes; then + echo $ac_n "checking for GNU ld... $ac_c" 1>&6 + echo "$progname:1015: checking for GNU ld" >&5 + else + echo $ac_n "checking for non-GNU ld""... $ac_c" 1>&6 + echo "$progname:1018: checking for non-GNU ld" >&5 + fi + + if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + if "$LD" -v 2>&1 < /dev/null | egrep '(GNU|with BFD)' > /dev/null; then + test "$with_gnu_ld" != no && break + else + test "$with_gnu_ld" != yes && break + fi + fi + done + IFS="$ac_save_ifs" + fi + + if test -n "$LD"; then + echo "$ac_t$LD" 1>&6 + else + echo "$ac_t"no 1>&6 + fi + + if test -z "$LD"; then + echo "$progname: error: no acceptable ld found in \$PATH" 1>&2 + exit 1 + fi +fi + +# Check to see if it really is or is not GNU ld. +echo $ac_n "checking if the linker ($LD) is GNU ld... $ac_c" 1>&6 +# I'd rather use --version here, but apparently some GNU ld's only accept -v. +if $LD -v 2>&1 &5; then + with_gnu_ld=yes +else + with_gnu_ld=no +fi +echo "$ac_t$with_gnu_ld" 1>&6 + +# See if the linker supports building shared libraries. +echo $ac_n "checking whether the linker ($LD) supports shared libraries... $ac_c" 1>&6 + +allow_undefined_flag= +no_undefined_flag= +need_lib_prefix=unknown +need_version=unknown +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +archive_cmds= +archive_expsym_cmds= +old_archive_from_new_cmds= +export_dynamic_flag_spec= +whole_archive_flag_spec= +thread_safe_flag_spec= +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no +hardcode_shlibpath_var=unsupported +runpath_var= +always_export_symbols=no +export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | sed '\''s/.* //'\'' | sort | uniq > $export_symbols' +# include_expsyms should be a list of space-separated symbols to be *always* +# included in the symbol list +include_expsyms= +# exclude_expsyms can be an egrep regular expression of symbols to exclude +# it will be wrapped by ` (' and `)$', so one must not match beginning or +# end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', +# as well as any symbol that contains `d'. +exclude_expsyms="_GLOBAL_OFFSET_TABLE_" +# Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out +# platforms (ab)use it in PIC code, but their linkers get confused if +# the symbol is explicitly referenced. Since portable code cannot +# rely on this symbol name, it's probably fine to never include it in +# preloaded symbol tables. + +case "$host_os" in +cygwin* | mingw*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$with_gcc" != yes; then + with_gnu_ld=no + fi + ;; + +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # See if GNU ld supports shared libraries. + case "$host_os" in + aix3* | aix4*) + # On AIX, the GNU linker is very broken + ld_shlibs=no + cat <&2 + +*** Warning: the GNU linker, at least up to release 2.9.1, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to modify your PATH +*** so that a non-GNU linker is found, and then restart. + +EOF + ;; + + amigaos*) + archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + + # Samuel A. Falvo II reports + # that the semantics of dynamic libraries on AmigaOS, at least up + # to version 4, is to share data among multiple programs linked + # with the same dynamic library. Since this doesn't match the + # behavior of shared libraries on other platforms, we can use + # them. + ld_shlibs=no + ;; + + beos*) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + #allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' +# allow_undefined_flag=unsupported + always_export_symbols=yes + + # Extract the symbol export list from an `--export-all' def file, + # then regenerate the def file from the symbol export list, so that + # the compiled dll only exports the symbol export list. + # Be careful not to strip the DATA tag left by newer dlltools. + export_symbols_cmds='test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ + test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ + $DLLTOOL --exclude-symbols _DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --output-def $objdir/$soname-def $objdir/$soname-ltdll.$objext $libobjs $convenience~ + sed -e "1,/EXPORTS/d" -e "s/ @ [0-9]*//" -e "s/ *;.*$//" < $objdir/$soname-def > $export_symbols' + + # If DATA tags from a recent dlltool are present, honour them! + archive_expsym_cmds='echo EXPORTS > $objdir/$soname-def~ + _lt_hint=1; + cat $export_symbols | while read symbol; do + set dummy \$symbol; + case \$# in + 2) echo " \$2 @ \$_lt_hint ; " >> $objdir/$soname-def;; + *) echo " \$2 @ \$_lt_hint \$3 ; " >> $objdir/$soname-def;; + esac; + _lt_hint=`expr 1 + \$_lt_hint`; + done~ + test -f $objdir/$soname-ltdll.c || sed -e "/^# \/\* ltdll\.c starts here \*\//,/^# \/\* ltdll.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/$soname-ltdll.c~ + test -f $objdir/$soname-ltdll.$objext || (cd $objdir && $CC -c $soname-ltdll.c)~ + $CC -Wl,--base-file,$objdir/$soname-base -Wl,--dll -nostartfiles -Wl,-e,_DllMain@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols _DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ + $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,_DllMain@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ + $DLLTOOL --as=$AS --dllname $soname --exclude-symbols _DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ + $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,_DllMain@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ + : strip_is_broken_with_dlls_on_win95B - strip $lib' + + old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + archive_cmds='$LD -Bshareable $libobjs $deplibs $linkopts -o $lib' + # can we support soname and/or expsyms with a.out? -oliva + fi + ;; + + solaris* | sysv5*) + if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +EOF + elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linkopts' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = yes; then + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + case $host_os in + cygwin* | mingw*) + # dlltool doesn't understand --whole-archive et. al. + whole_archive_flag_spec= + ;; + *) + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | egrep 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + ;; + esac + fi +else + # PORTME fill in a description of your system's linker (not GNU ld) + case "$host_os" in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $objdir/$soname $libobjs $deplibs $linkopts -bE:$export_symbols -T512 -H512 -bM:SRE~$AR cru $lib $objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$with_gcc" = yes && test -z "$link_static_flag"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix4*) + hardcode_libdir_flag_spec='${wl}-b ${wl}nolibpath ${wl}-b ${wl}libpath:$libdir:/usr/lib:/lib' + hardcode_libdir_separator=':' + if test "$with_gcc" = yes; then + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + hardcode_direct=yes + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + shared_flag='-shared' + else + shared_flag='${wl}-bM:SRE' + hardcode_direct=yes + fi + allow_undefined_flag=' ${wl}-berok' + archive_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bexpall ${wl}-bnoentry${allow_undefined_flag}' + archive_expsym_cmds="\$CC $shared_flag"' -o $objdir/$soname $libobjs $deplibs $linkopts ${wl}-bE:$export_symbols ${wl}-bnoentry${allow_undefined_flag}' + case "$host_os" in aix4.[01]|aix4.[01].*) + # According to Greg Wooledge, -bexpall is only supported from AIX 4.2 on + always_export_symbols=yes ;; + esac + ;; + + amigaos*) + archive_cmds='$rm $objdir/a2ixlibrary.data~$echo "#define NAME $libname" > $objdir/a2ixlibrary.data~$echo "#define LIBRARY_ID 1" >> $objdir/a2ixlibrary.data~$echo "#define VERSION $major" >> $objdir/a2ixlibrary.data~$echo "#define REVISION $revision" >> $objdir/a2ixlibrary.data~$AR cru $lib $libobjs~$RANLIB $lib~(cd $objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + # see comment about different semantics on the GNU ld section + ld_shlibs=no + ;; + + cygwin* | mingw*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' +# allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $linkopts `echo "$deplibs" | sed -e '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib /OUT:$oldlib$oldobjs' + fix_srcfile_path='`cygpath -w $srcfile`' + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd*) + archive_cmds='$CC -shared -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9* | hpux10* | hpux11*) + case "$host_os" in + hpux9*) archive_cmds='$rm $objdir/$soname~$LD -b +b $install_libdir -o $objdir/$soname $libobjs $deplibs $linkopts~test $objdir/$soname = $lib || mv $objdir/$soname $lib' ;; + *) archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linkopts' ;; + esac + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_minus_L=yes # Not in the search PATH, but as the default + # location of the library. + export_dynamic_flag_spec='${wl}-E' + ;; + + irix5* | irix6*) + if test "$with_gcc" = yes; then + archive_cmds='$CC -shared $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + archive_cmds='$LD -shared $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linkopts' # ELF + fi + hardcode_libdir_flag_spec='${wl}-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + openbsd*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def~$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def~$echo DATA >> $objdir/$libname.def~$echo " SINGLE NONSHARED" >> $objdir/$libname.def~$echo EXPORTS >> $objdir/$libname.def~emxexp $libobjs >> $objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $linkopts $objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def' + ;; + + osf3*) + if test "$with_gcc" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # As osf3* with the addition of the -msym flag + if test "$with_gcc" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $linkopts ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linkopts -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${objdir}/so_locations -o $lib' + fi + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + rhapsody*) + archive_cmds='$CC -bundle -undefined suppress -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flags_spec='-L$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + sco3.2v5*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ;; + + solaris*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linkopts' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case "$host_os" in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) # Supported since Solaris 2.6 (maybe 2.5.1?) + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $linkopts' + else + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + fi + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv5*) + no_undefined_flag=' -z text' + # $CC -shared without GNU ld will not create a library from C++ + # object files and a static libstdc++, better avoid it by now + archive_cmds='$LD -G${allow_undefined_flag} -h $rpath/$soname -o $lib $libobjs $deplibs $linkopts' + archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linkopts~$rm $lib.exp' + hardcode_libdir_flag_spec= + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4.2uw2*) + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linkopts' + hardcode_direct=yes + hardcode_minus_L=no + hardcode_shlibpath_var=no + hardcode_runpath_var=yes + runpath_var=LD_RUN_PATH + ;; + + unixware7*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linkopts' + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac +fi +echo "$ac_t$ld_shlibs" 1>&6 +test "$ld_shlibs" = no && can_build_shared=no + +if test -z "$NM"; then + echo $ac_n "checking for BSD-compatible nm... $ac_c" 1>&6 + case "$NM" in + [\\/]* | [A-Za-z]:[\\/]*) ;; # Let the user override the test with a path. + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR}" + for ac_dir in $PATH /usr/ucb /usr/ccs/bin /bin; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/nm || test -f $ac_dir/nm$ac_exeext; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + if ($ac_dir/nm -B /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + NM="$ac_dir/nm -B" + break + elif ($ac_dir/nm -p /dev/null 2>&1 | sed '1q'; exit 0) | egrep /dev/null >/dev/null; then + NM="$ac_dir/nm -p" + break + else + NM=${NM="$ac_dir/nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + fi + fi + done + IFS="$ac_save_ifs" + test -z "$NM" && NM=nm + ;; + esac + echo "$ac_t$NM" 1>&6 +fi + +# Check for command to grab the raw symbol name followed by C symbol from nm. +echo $ac_n "checking command to parse $NM output... $ac_c" 1>&6 + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Transform the above into a raw symbol and a C symbol. +symxfrm='\1 \2\3 \3' + +# Transform an extracted symbol line into a proper C declaration +global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern char \1;/p'" + +# Define system-specific variables. +case "$host_os" in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw*) + symcode='[ABCDGISTW]' + ;; +hpux*) # Its linker distinguishes data from code symbols + global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern char \1();/p' -e 's/^. .* \(.*\)$/extern char \1;/p'" + ;; +irix*) + symcode='[BCDEGRST]' + ;; +solaris*) + symcode='[BDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +if $NM -V 2>&1 | egrep '(GNU|with BFD)' > /dev/null; then + symcode='[ABCDGISTW]' +fi + +# Try without a prefix undercore, then with it. +for ac_symprfx in "" "_"; do + + # Write the raw and C identifiers. + global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode\)[ ][ ]*\($ac_symprfx\)$sympat$/$symxfrm/p'" + + # Check to see that the pipe works correctly. + pipe_works=no + $rm conftest* + cat > conftest.c <&5 + if { (eval echo $progname:1654: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; } && test -s conftest.$objext; then + # Now try to grab the symbols. + nlist=conftest.nm + if { echo "$progname:1657: eval \"$NM conftest.$objext | $global_symbol_pipe > $nlist\"" >&5; eval "$NM conftest.$objext | $global_symbol_pipe > $nlist 2>&5"; } && test -s "$nlist"; then + + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if egrep ' nm_test_var$' "$nlist" >/dev/null; then + if egrep ' nm_test_func$' "$nlist" >/dev/null; then + cat < conftest.c +#ifdef __cplusplus +extern "C" { +#endif + +EOF + # Now generate the symbol file. + eval "$global_symbol_to_cdecl"' < "$nlist" >> conftest.c' + + cat <> conftest.c +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{ +EOF + sed 's/^. \(.*\) \(.*\)$/ {"\2", (lt_ptr_t) \&\2},/' < "$nlist" >> conftest.c + cat <<\EOF >> conftest.c + {0, (lt_ptr_t) 0} +}; + +#ifdef __cplusplus +} +#endif +EOF + # Now try linking the two files. + mv conftest.$objext conftstm.$objext + save_LIBS="$LIBS" + save_CFLAGS="$CFLAGS" + LIBS="conftstm.$objext" + CFLAGS="$CFLAGS$no_builtin_flag" + if { (eval echo $progname:1709: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + pipe_works=yes + else + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + LIBS="$save_LIBS" + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.c >&5 + fi + $rm conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + global_symbol_pipe= + fi +done +if test "$pipe_works" = yes; then + echo "${ac_t}ok" 1>&6 +else + echo "${ac_t}failed" 1>&6 +fi + +if test -z "$global_symbol_pipe"; then + global_symbol_to_cdecl= +fi + +# Check hardcoding attributes. +echo $ac_n "checking how to hardcode library paths into programs... $ac_c" 1>&6 +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || \ + test -n "$runpath_var"; then + + # We can hardcode non-existant directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$hardcode_shlibpath_var" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +echo "$ac_t$hardcode_action" 1>&6 + + +reload_flag= +reload_cmds='$LD$reload_flag -o $output$reload_objs' +echo $ac_n "checking for $LD option to reload object files... $ac_c" 1>&6 +# PORTME Some linkers may need a different reload flag. +reload_flag='-r' +echo "$ac_t$reload_flag" 1>&6 +test -n "$reload_flag" && reload_flag=" $reload_flag" + +# PORTME Fill in your ld.so characteristics +library_names_spec= +libname_spec='lib$name' +soname_spec= +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +file_magic_cmd= +file_magic_test_file= +deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [regex]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given egrep regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. +echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6 +case "$host_os" in +aix3*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}.so$major' + ;; + +aix4*) + version_type=linux + # AIX has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + # We preserve .a as extension for shared libraries though AIX4.2 + # and later linker supports .so + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.a' + shlibpath_var=LIBPATH + deplibs_check_method=pass_all + ;; + +amigaos*) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done' + ;; + +beos*) + library_names_spec='${libname}.so' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + deplibs_check_method=pass_all + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + +bsdi4*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + file_magic_cmd=/usr/bin/file + file_magic_test_file=/shlib/libc.so + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + export_dynamic_flag_spec=-rdynamic + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw*) + version_type=windows + need_version=no + need_lib_prefix=no + if test "$with_gcc" = yes; then + library_names_spec='`echo ${libname} | sed -e 's/^lib//g'`.dll $libname.a' + else + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' + fi + dynamic_linker='Win32 ld.exe' + deplibs_check_method='file_magic file format pe-i386(.*architecture: i386)?' + file_magic_cmd='${OBJDUMP} -f' + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + if test "$with_gcc" = yes; then + # See where the system libraries really are - /usr/lib won't cut it + libuser32=`$CC --print-file-name=libuser32.a` + win32libs=`expr $libuser32 : '\(.*\)/.*'` + sys_lib_search_path_spec="$sys_lib_search_path $win32libs" + fi + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd*) + objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` + version_type=freebsd-$objformat + case "$version_type" in + freebsd-elf*) + deplibs_check_method='pass_all' + + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /usr/lib/libc.so*` + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + deplibs_check_method=unknown + library_names_spec='${libname}${release}.so$versuffix $libname.so$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case "$host_os" in + freebsd2* | freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + ;; + *) # from 3.2 on + shlibpath_overrides_runpath=no + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so${major} ${libname}.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + dynamic_linker="$host_os dld.sl" + version_type=sunos + need_lib_prefix=no + need_version=no + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}.sl$versuffix ${libname}${release}.sl$major $libname.sl' + soname_spec='${libname}${release}.sl$major' + # HP-UX runs *really* slowly unless shared libraries are mode 555. + postinstall_cmds='chmod 555 $lib' + case "$host_os" in + hpux10.20*) + # TODO: Does this work for hpux-11 too? + # deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library' + deplibs_check_method="unknown" + file_magic_cmd=/usr/bin/file + file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +irix5* | irix6*) + version_type=irix + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}.so.$major' + library_names_spec='${libname}${release}.so.$versuffix ${libname}${release}.so.$major ${libname}${release}.so $libname.so' + case "$host_os" in + irix5*) + libsuff= shlibsuff= + # this will be overridden with pass_all, but let us keep it just in case + deplibs_check_method="file_magic ELF 32-bit MSB dynamic lib MIPS - version 1" + ;; + *) + case "$LD" in # libtool.m4 will add one of these switches to LD + *-32|*"-32 ") libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 ") libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /lib${libsuff}/libc.so*` + deplibs_check_method='pass_all' + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux-gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + deplibs_check_method=pass_all + + if test -f /lib/ld.so.1; then + dynamic_linker='GNU ld.so' + else + # Only the GNU ld.so supports shared libraries on MkLinux. + case "$host_cpu" in + powerpc*) dynamic_linker=no ;; + *) dynamic_linker='Linux ld.so' ;; + esac + fi + ;; + +netbsd*) + version_type=sunos + if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major ${libname}${release}.so ${libname}.so' + soname_spec='${libname}${release}.so$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + ;; + +openbsd*) + version_type=sunos + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + need_version=no + fi + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + ;; + +os2*) + libname_spec='$name' + need_lib_prefix=no + library_names_spec='$libname.dll $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_version=no + soname_spec='${libname}${release}.so' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so $libname.so' + shlibpath_var=LD_LIBRARY_PATH + # this will be overridden with pass_all, but let us keep it just in case + deplibs_check_method='file_magic COFF format alpha shared library' + file_magic_cmd=/usr/bin/file + file_magic_test_file=/shlib/libc.so + deplibs_check_method='pass_all' + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rhapsody*) + version_type=sunos + library_names_spec='${libname}.so' + soname_spec='${libname}.so' + shlibpath_var=DYLD_LIBRARY_PATH + deplibs_check_method=pass_all + ;; + +sco3.2v5*) + version_type=osf + soname_spec='${libname}${release}.so$major' + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + shlibpath_var=LD_LIBRARY_PATH + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + deplibs_check_method="file_magic ELF [0-9][0-9]-bit [LM]SB dynamic lib" + file_magic_cmd=/usr/bin/file + file_magic_test_file=/lib/libc.so + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}.so$versuffix ${libname}.so$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + case "$host_vendor" in + sequent) + file_magic_cmd='/bin/file' + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + ncr) + deplibs_check_method='pass_all' + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + file_magic_cmd=/usr/bin/file + file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + esac + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}.so$versuffix ${libname}${release}.so$major $libname.so' + soname_spec='${libname}${release}.so$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname.so.$versuffix $libname.so.$major $libname.so' + soname_spec='$libname.so.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +*) + dynamic_linker=no + ;; +esac +echo "$ac_t$dynamic_linker" 1>&6 +test "$dynamic_linker" = no && can_build_shared=no + +# Report the final consequences. +echo "checking if libtool supports shared libraries... $can_build_shared" 1>&6 + +# Only try to build win32 dlls if AC_LIBTOOL_WIN32_DLL was used in +# configure.in, otherwise build static only libraries. +case "$host_os" in +cygwin* | mingw* | os2*) + if test x$can_build_shared = xyes; then + test x$enable_win32_dll = xno && can_build_shared=no + echo "checking if package supports dlls... $can_build_shared" 1>&6 + fi +;; +esac + +if test -n "$file_magic_test_file" && test -n "$file_magic_cmd"; then + case "$deplibs_check_method" in + "file_magic "*) + file_magic_regex="`expr \"$deplibs_check_method\" : \"file_magic \(.*\)\"`" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + egrep "$file_magic_regex" > /dev/null; then + : + else + cat <&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +EOF + fi ;; + esac +fi + +echo $ac_n "checking whether to build shared libraries... $ac_c" 1>&6 +test "$can_build_shared" = "no" && enable_shared=no + +# On AIX, shared libraries and static libraries use the same namespace, and +# are all built from PIC. +case "$host_os" in +aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + +aix4*) + test "$enable_shared" = yes && enable_static=no + ;; +esac + +echo "$ac_t$enable_shared" 1>&6 + +# Make sure either enable_shared or enable_static is yes. +test "$enable_shared" = yes || enable_static=yes + +echo "checking whether to build static libraries... $enable_static" 1>&6 + +if test "$hardcode_action" = relink; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + +echo $ac_n "checking for objdir... $ac_c" 1>&6 +rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + objdir=_libs +fi +rmdir .libs 2>/dev/null +echo "$ac_t$objdir" 1>&6 + +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else +if eval "test \"`echo '$''{'lt_cv_dlopen'+set}'`\" != set"; then + lt_cv_dlopen=no lt_cv_dlopen_libs= +echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6 +echo "$progname:2248: checking for dlopen in -ldl" >&5 +ac_lib_var=`echo dl'_'dlopen | 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="-ldl $LIBS" +cat > conftest.$ac_ext <&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 "$progname: 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 + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dlopen""... $ac_c" 1>&6 +echo "$progname:2288: checking for dlopen" >&5 +if eval "test \"`echo '$''{'ac_cv_func_dlopen'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* 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. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen(); + +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_dlopen) || defined (__stub___dlopen) +choke me +#else +dlopen(); +#endif + +; return 0; } +EOF +if { (eval echo $progname:2318: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_dlopen=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_dlopen=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_func_'dlopen`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="dlopen" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for dld_link in -ldld""... $ac_c" 1>&6 +echo "$progname:2335: checking for dld_link in -ldld" >&5 +ac_lib_var=`echo dld'_'dld_link | 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="-ldld $LIBS" +cat > conftest.$ac_ext <&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 "$progname: 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 + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for shl_load""... $ac_c" 1>&6 +echo "$progname:2375: checking for shl_load" >&5 +if eval "test \"`echo '$''{'ac_cv_func_shl_load'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* 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. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load(); + +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_shl_load) || defined (__stub___shl_load) +choke me +#else +shl_load(); +#endif + +; return 0; } +EOF +if { (eval echo $progname:2405: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + eval "ac_cv_func_shl_load=yes" +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_shl_load=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'shl_load`\" = yes"; then + echo "$ac_t""yes" 1>&6 + lt_cv_dlopen="shl_load" +else + echo "$ac_t""no" 1>&6 +echo $ac_n "checking for shl_load in -ldld""... $ac_c" 1>&6 +echo "$progname:2423: checking for shl_load in -ldld" >&5 +ac_lib_var=`echo dld'_'shl_load | 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="-ldld $LIBS" +cat > conftest.$ac_ext <&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 "$progname: 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 + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + echo "$ac_t""no" 1>&6 +fi + + +fi + + +fi + + +fi + + +fi + +fi + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + fi + + case "$lt_cv_dlopen" in + dlopen) +for ac_hdr in dlfcn.h; do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "$progname: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 < +int fnord = 0; +EOF +ac_try="$ac_compile >/dev/null 2>conftest.out" +{ (eval echo $progname: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 "$progname: 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 +else + echo "$ac_t""no" 1>&6 +fi +done + + if test "x$ac_cv_header_dlfcn_h" = xyes; then + CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + fi + eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + LIBS="$lt_cv_dlopen_libs $LIBS" + + echo $ac_n "checking whether a program can dlopen itself""... $ac_c" 1>&6 +echo "$progname:2526: checking whether a program can dlopen itself" >&5 +if test "${lt_cv_dlopen_self+set}" = set; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + lt_cv_dlopen_self=cross + else + cat > conftest.c < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LTDL_GLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LTDL_GLOBAL DL_GLOBAL +# else +# define LTDL_GLOBAL 0 +# endif +#endif + +/* We may have to define LTDL_LAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LTDL_LAZY_OR_NOW +# ifdef RTLD_LAZY +# define LTDL_LAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LTDL_LAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LTDL_LAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LTDL_LAZY_OR_NOW DL_NOW +# else +# define LTDL_LAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +fnord() { int i=42;} +main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); + if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); + if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } + +EOF +if { (eval echo $progname:2580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + lt_cv_dlopen_self=yes +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + lt_cv_dlopen_self=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$lt_cv_dlopen_self" 1>&6 + + if test "$lt_cv_dlopen_self" = yes; then + LDFLAGS="$LDFLAGS $link_static_flag" + echo $ac_n "checking whether a statically linked program can dlopen itself""... $ac_c" 1>&6 +echo "$progname:2599: checking whether a statically linked program can dlopen itself" >&5 +if test "${lt_cv_dlopen_self_static+set}" = set; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + lt_cv_dlopen_self_static=cross + else + cat > conftest.c < +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LTDL_GLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LTDL_GLOBAL DL_GLOBAL +# else +# define LTDL_GLOBAL 0 +# endif +#endif + +/* We may have to define LTDL_LAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LTDL_LAZY_OR_NOW +# ifdef RTLD_LAZY +# define LTDL_LAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LTDL_LAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LTDL_LAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LTDL_LAZY_OR_NOW DL_NOW +# else +# define LTDL_LAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +fnord() { int i=42;} +main() { void *self, *ptr1, *ptr2; self=dlopen(0,LTDL_GLOBAL|LTDL_LAZY_OR_NOW); + if(self) { ptr1=dlsym(self,"fnord"); ptr2=dlsym(self,"_fnord"); + if(ptr1 || ptr2) { dlclose(self); exit(0); } } exit(1); } + +EOF +if { (eval echo $progname:2653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + lt_cv_dlopen_self_static=yes +else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + lt_cv_dlopen_self_static=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$lt_cv_dlopen_self_static" 1>&6 +fi + ;; + esac + + case "$lt_cv_dlopen_self" in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case "$lt_cv_dlopen_self_static" in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + +# Copy echo and quote the copy, instead of the original, because it is +# used later. +ltecho="$echo" +if test "X$ltecho" = "X$CONFIG_SHELL $0 --fallback-echo"; then + ltecho="$CONFIG_SHELL \$0 --fallback-echo" +fi +LTSHELL="$SHELL" + +LTCONFIG_VERSION="$VERSION" + +# Only quote variables if we're using ltmain.sh. +case "$ltmain" in +*.sh) + # Now quote all the things that may contain metacharacters. + for var in ltecho old_CC old_CFLAGS old_CPPFLAGS \ + old_LD old_LDFLAGS old_LIBS \ + old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS \ + AR CC LD LN_S NM LTSHELL LTCONFIG_VERSION \ + reload_flag reload_cmds wl \ + pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \ + thread_safe_flag_spec whole_archive_flag_spec libname_spec \ + library_names_spec soname_spec \ + RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \ + file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \ + finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ + hardcode_libdir_flag_spec hardcode_libdir_separator \ + sys_lib_search_path_spec sys_lib_dlsearch_path_spec \ + compiler_c_o compiler_o_lo need_locks exclude_expsyms include_expsyms; do + + case "$var" in + reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ + old_postinstall_cmds | old_postuninstall_cmds | \ + export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + postinstall_cmds | postuninstall_cmds | \ + finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) + # Double-quote double-evaled strings. + eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\"" + ;; + *) + eval "$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\"" + ;; + esac + done + + case "$ltecho" in + *'\$0 --fallback-echo"') + ltecho=`$echo "X$ltecho" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'` + ;; + esac + + trap "$rm \"$ofile\"; exit 1" 1 2 15 + echo "creating $ofile" + $rm "$ofile" + cat < "$ofile" +#! $SHELL + +# `$echo "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +# NOTE: Changes made to this file will be lost: look at ltconfig or ltmain.sh. +# +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 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 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. + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="sed -e s/^X//" + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test "X\${CDPATH+set}" = Xset; then CDPATH=:; export CDPATH; fi + +### BEGIN LIBTOOL CONFIG +EOF + cfgfile="$ofile" + ;; + +*) + # Double-quote the variables that need it (for aesthetics). + for var in old_CC old_CFLAGS old_CPPFLAGS \ + old_LD old_LDFLAGS old_LIBS \ + old_NM old_RANLIB old_LN_S old_DLLTOOL old_OBJDUMP old_AS; do + eval "$var=\\\"\$var\\\"" + done + + # Just create a config file. + cfgfile="$ofile.cfg" + trap "$rm \"$cfgfile\"; exit 1" 1 2 15 + echo "creating $cfgfile" + $rm "$cfgfile" + cat < "$cfgfile" +# `$echo "$cfgfile" | sed 's%^.*/%%'` - Libtool configuration file. +# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP) +EOF + ;; +esac + +cat <> "$cfgfile" +# Libtool was configured as follows, on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# CC=$old_CC CFLAGS=$old_CFLAGS CPPFLAGS=$old_CPPFLAGS \\ +# LD=$old_LD LDFLAGS=$old_LDFLAGS LIBS=$old_LIBS \\ +# NM=$old_NM RANLIB=$old_RANLIB LN_S=$old_LN_S \\ +# DLLTOOL=$old_DLLTOOL OBJDUMP=$old_OBJDUMP AS=$old_AS \\ +# $0$ltconfig_args +# +# Compiler and other test output produced by $progname, useful for +# debugging $progname, is in ./config.log if it exists. + +# The version of $progname that generated this script. +LTCONFIG_VERSION=$LTCONFIG_VERSION + +# Shell to use when invoking shell scripts. +SHELL=$LTSHELL + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# The host system. +host_alias=$host_alias +host=$host + +# An echo program that does not interpret backslashes. +echo=$ltecho + +# The archiver. +AR=$AR + +# The default C compiler. +CC=$CC + +# The linker used to build libraries. +LD=$LD + +# Whether we need hard or soft links. +LN_S=$LN_S + +# A BSD-compatible nm program. +NM=$NM + +# Used on cygwin: DLL creation program. +DLLTOOL="$DLLTOOL" + +# Used on cygwin: object dumper. +OBJDUMP="$OBJDUMP" + +# Used on cygwin: assembler. +AS="$AS" + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# How to create reloadable object files. +reload_flag=$reload_flag +reload_cmds=$reload_cmds + +# How to pass a linker flag through the compiler. +wl=$wl + +# Object file suffix (normally "o"). +objext="$objext" + +# Old archive suffix (normally "a"). +libext="$libext" + +# Executable file suffix (normally ""). +exeext="$exeext" + +# Additional compiler flags for building library objects. +pic_flag=$pic_flag + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$compiler_c_o + +# Can we write directly to a .lo ? +compiler_o_lo=$compiler_o_lo + +# Must we lock files when doing compilation ? +need_locks=$need_locks + +# Do we need the lib prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Whether dlopen is supported. +dlopen=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Compiler flag to prevent dynamic linking. +link_static_flag=$link_static_flag + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$no_builtin_flag + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$whole_archive_flag_spec + +# Compiler flag to generate thread-safe objects. +thread_safe_flag_spec=$thread_safe_flag_spec + +# Library versioning type. +version_type=$version_type + +# Format of library name prefix. +libname_spec=$libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME. +library_names_spec=$library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$soname_spec + +# Commands used to build and install an old-style archive. +RANLIB=$RANLIB +old_archive_cmds=$old_archive_cmds +old_postinstall_cmds=$old_postinstall_cmds +old_postuninstall_cmds=$old_postuninstall_cmds + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$old_archive_from_new_cmds + +# Commands used to build and install a shared archive. +archive_cmds=$archive_cmds +archive_expsym_cmds=$archive_expsym_cmds +postinstall_cmds=$postinstall_cmds +postuninstall_cmds=$postuninstall_cmds + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$deplibs_check_method + +# Command to use when deplibs_check_method == file_magic. +file_magic_cmd=$file_magic_cmd + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$allow_undefined_flag + +# Flag that forces no undefined symbols. +no_undefined_flag=$no_undefined_flag + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$finish_cmds + +# Same as above, but a single script fragment to be evaled but not shown. +finish_eval=$finish_eval + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$global_symbol_pipe + +# Transform the output of nm in a proper C declaration +global_symbol_to_cdecl=$global_symbol_to_cdecl + +# This is the shared library runtime path variable. +runpath_var=$runpath_var + +# This is the shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec + +# Whether we need a single -rpath flag with a separated argument. +hardcode_libdir_separator=$hardcode_libdir_separator + +# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the +# resulting binary. +hardcode_direct=$hardcode_direct + +# Set to yes if using the -LDIR flag during linking hardcodes DIR into the +# resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into +# the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Compile-time system search path for libraries +sys_lib_search_path_spec=$sys_lib_search_path_spec + +# Run-time system search path for libraries +sys_lib_dlsearch_path_spec=$sys_lib_dlsearch_path_spec + +# Fix the shell variable \$srcfile for the compiler. +fix_srcfile_path="$fix_srcfile_path" + +# Set to yes if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$include_expsyms + +EOF + +case "$ltmain" in +*.sh) + echo '### END LIBTOOL CONFIG' >> "$ofile" + echo >> "$ofile" + case "$host_os" in + aix3*) + cat <<\EOF >> "$ofile" + +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +EOF + ;; + esac + + # Append the ltmain.sh script. + sed '$q' "$ltmain" >> "$ofile" || (rm -f "$ofile"; exit 1) + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + + chmod +x "$ofile" + ;; + +*) + # Compile the libtool program. + echo "FIXME: would compile $ltmain" + ;; +esac + +test -n "$cache_file" || exit 0 + +# AC_CACHE_SAVE +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 + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff -r 000000000000 -r 74212992fb08 ltmain.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ltmain.sh Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,4024 @@ +# ltmain.sh - Provide generalized library-building support services. +# NOTE: Changing this file will not affect anything until you rerun ltconfig. +# +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit , 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 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. + +# Check that we have a working $echo. +if test "X$1" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift +elif test "X$1" = X--fallback-echo; then + # Avoid inline document here, it may be left over + : +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$0" --no-reexec ${1+"$@"} +fi + +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + echo "$modename: not configured to build any kind of library" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 +fi + +# Global variables. +mode=$default_mode +nonopt= +prev= +prevopt= +run= +show="$echo" +show_help= +execute_dlfiles= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" + +# Parse our command line options once, thoroughly. +while test $# -gt 0 +do + arg="$1" + shift + + case "$arg" in + -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case "$prev" in + execute_dlfiles) + eval "$prev=\"\$$prev \$arg\"" + ;; + *) + eval "$prev=\$arg" + ;; + esac + + prev= + prevopt= + continue + fi + + # Have we seen a non-optional argument yet? + case "$arg" in + --help) + show_help=yes + ;; + + --version) + echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" + exit 0 + ;; + + --config) + sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0 + exit 0 + ;; + + --debug) + echo "$progname: enabling shell trace mode" + set -x + ;; + + --dry-run | -n) + run=: + ;; + + --features) + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + exit 0 + ;; + + --finish) mode="finish" ;; + + --mode) prevopt="--mode" prev=mode ;; + --mode=*) mode="$optarg" ;; + + --quiet | --silent) + show=: + ;; + + -dlopen) + prevopt="-dlopen" + prev=execute_dlfiles + ;; + + -*) + $echo "$modename: unrecognized option \`$arg'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *) + nonopt="$arg" + break + ;; + esac +done + +if test -n "$prevopt"; then + $echo "$modename: option \`$prevopt' requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 +fi + +if test -z "$show_help"; then + + # Infer the operation mode. + if test -z "$mode"; then + case "$nonopt" in + *cc | *++ | gcc* | *-gcc*) + mode=link + for arg + do + case "$arg" in + -c) + mode=compile + break + ;; + esac + done + ;; + *db | *dbx | *strace | *truss) + mode=execute + ;; + *install*|cp|mv) + mode=install + ;; + *rm) + mode=uninstall + ;; + *) + # If we have no mode, but dlfiles were specified, then do execute mode. + test -n "$execute_dlfiles" && mode=execute + + # Just use the default operation mode. + if test -z "$mode"; then + if test -n "$nonopt"; then + $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 + else + $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 + fi + fi + ;; + esac + fi + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$execute_dlfiles" && test "$mode" != execute; then + $echo "$modename: unrecognized option \`-dlopen'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$modename --help --mode=$mode' for more information." + + # These modes are in order of execution frequency so that they run quickly. + case "$mode" in + # libtool compile mode + compile) + modename="$modename: compile" + # Get the compilation command and the source file. + base_compile= + lastarg= + srcfile="$nonopt" + suppress_output= + + user_target=no + for arg + do + # Accept any command-line options. + case "$arg" in + -o) + if test "$user_target" != "no"; then + $echo "$modename: you cannot specify \`-o' more than once" 1>&2 + exit 1 + fi + user_target=next + ;; + + -static) + build_old_libs=yes + continue + ;; + esac + + case "$user_target" in + next) + # The next one is the -o target name + user_target=yes + continue + ;; + yes) + # We got the output file + user_target=set + libobj="$arg" + continue + ;; + esac + + # Accept the current argument as the source file. + lastarg="$srcfile" + srcfile="$arg" + + # Aesthetically quote the previous argument. + + # Backslashify any backslashes, double quotes, and dollar signs. + # These are the only characters that are still specially + # interpreted inside of double-quoted scrings. + lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` + + # Double-quote args containing other shell metacharacters. + # Many Bourne shells cannot handle close brackets correctly in scan + # sets, so we specify it separately. + case "$lastarg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + lastarg="\"$lastarg\"" + ;; + esac + + # Add the previous argument to base_compile. + if test -z "$base_compile"; then + base_compile="$lastarg" + else + base_compile="$base_compile $lastarg" + fi + done + + case "$user_target" in + set) + ;; + no) + # Get the name of the library object. + libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` + ;; + *) + $echo "$modename: you must specify a target with \`-o'" 1>&2 + exit 1 + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + xform='[cCFSfmso]' + case "$libobj" in + *.ada) xform=ada ;; + *.adb) xform=adb ;; + *.ads) xform=ads ;; + *.asm) xform=asm ;; + *.c++) xform=c++ ;; + *.cc) xform=cc ;; + *.cpp) xform=cpp ;; + *.cxx) xform=cxx ;; + *.f90) xform=f90 ;; + *.for) xform=for ;; + esac + + libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` + + case "$libobj" in + *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; + *) + $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 + exit 1 + ;; + esac + + if test -z "$base_compile"; then + $echo "$modename: you must specify a compilation command" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $libobj" + else + removelist="$libobj" + fi + + $run $rm $removelist + trap "$run $rm $removelist; exit 1" 1 2 15 + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext} + lockfile="$output_obj.lock" + removelist="$removelist $output_obj $lockfile" + trap "$run $rm $removelist; exit 1" 1 2 15 + else + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until ln "$0" "$lockfile" 2>/dev/null; do + $show "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + echo "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + echo $srcfile > "$lockfile" + fi + + if test -n "$fix_srcfile_path"; then + eval srcfile=\"$fix_srcfile_path\" + fi + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + # All platforms use -DPIC, to notify preprocessed assembler code. + command="$base_compile $srcfile $pic_flag -DPIC" + if test "$build_old_libs" = yes; then + lo_libobj="$libobj" + dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$libobj"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + + if test -d "$dir"; then + $show "$rm $libobj" + $run $rm $libobj + else + $show "$mkdir $dir" + $run $mkdir $dir + status=$? + if test $status -ne 0 && test ! -d $dir; then + exit $status + fi + fi + fi + if test "$compiler_o_lo" = yes; then + output_obj="$libobj" + command="$command -o $output_obj" + elif test "$compiler_c_o" = yes; then + output_obj="$obj" + command="$command -o $output_obj" + fi + + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + test -n "$output_obj" && $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed, then go on to compile the next one + if test x"$output_obj" != x"$libobj"; then + $show "$mv $output_obj $libobj" + if $run $mv $output_obj $libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # If we have no pic_flag, then copy the object into place and finish. + if test -z "$pic_flag" && test "$build_old_libs" = yes; then + # Rename the .lo from within objdir to obj + if test -f $obj; then + $show $rm $obj + $run $rm $obj + fi + + $show "$mv $libobj $obj" + if $run $mv $libobj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` + libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + # Now arrange that obj and lo_libobj become the same file + $show "(cd $xdir && $LN_S $baseobj $libobj)" + if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then + exit 0 + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Allow error messages only from the first compilation. + suppress_output=' >/dev/null 2>&1' + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + command="$base_compile $srcfile" + if test "$compiler_c_o" = yes; then + command="$command -o $obj" + output_obj="$obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + command="$command$suppress_output" + $run $rm "$output_obj" + $show "$command" + if $run eval "$command"; then : + else + $run $rm $removelist + exit 1 + fi + + if test "$need_locks" = warn && + test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then + echo "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $run $rm $removelist + exit 1 + fi + + # Just move the object if needed + if test x"$output_obj" != x"$obj"; then + $show "$mv $output_obj $obj" + if $run $mv $output_obj $obj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + + # Create an invalid libtool object if no PIC, so that we do not + # accidentally link it into a program. + if test "$build_libtool_libs" != yes; then + $show "echo timestamp > $libobj" + $run eval "echo timestamp > \$libobj" || exit $? + else + # Move the .lo from within objdir + $show "$mv $libobj $lo_libobj" + if $run $mv $libobj $lo_libobj; then : + else + error=$? + $run $rm $removelist + exit $error + fi + fi + fi + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + $rm "$lockfile" + fi + + exit 0 + ;; + + # libtool link mode + link) + modename="$modename: link" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invokation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + + # This is a source program that is used to create dlls on Windows + # Don't remove nor modify the starting and closing comments +# /* ltdll.c starts here */ +# #define WIN32_LEAN_AND_MEAN +# #include +# #undef WIN32_LEAN_AND_MEAN +# #include +# +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif +# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif +# +# #ifdef __CYGWIN__ +# #include +# DECLARE_CYGWIN_DLL( DllMain ); +# #endif +# HINSTANCE __hDllInstance_base; +# +# BOOL APIENTRY +# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved) +# { +# __hDllInstance_base = hInst; +# return TRUE; +# } +# /* ltdll.c ends here */ + # This is a source program that is used to create import libraries + # on Windows for dlls which lack them. Don't remove nor modify the + # starting and closing comments +# /* impgen.c starts here */ +# /* Copyright (C) 1999 Free Software Foundation, Inc. +# +# This file is part of GNU libtool. +# +# This program is free software; you can redistribute 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 /* for printf() */ +# #include /* for open(), lseek(), read() */ +# #include /* for O_RDONLY, O_BINARY */ +# #include /* for strdup() */ +# +# static unsigned int +# pe_get16 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[2]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 2); +# return b[0] + (b[1]<<8); +# } +# +# static unsigned int +# pe_get32 (fd, offset) +# int fd; +# int offset; +# { +# unsigned char b[4]; +# lseek (fd, offset, SEEK_SET); +# read (fd, b, 4); +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# static unsigned int +# pe_as32 (ptr) +# void *ptr; +# { +# unsigned char *b = ptr; +# return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24); +# } +# +# int +# main (argc, argv) +# int argc; +# char *argv[]; +# { +# int dll; +# unsigned long pe_header_offset, opthdr_ofs, num_entries, i; +# unsigned long export_rva, export_size, nsections, secptr, expptr; +# unsigned long name_rvas, nexp; +# unsigned char *expdata, *erva; +# char *filename, *dll_name; +# +# filename = argv[1]; +# +# dll = open(filename, O_RDONLY|O_BINARY); +# if (!dll) +# return 1; +# +# dll_name = filename; +# +# for (i=0; filename[i]; i++) +# if (filename[i] == '/' || filename[i] == '\\' || filename[i] == ':') +# dll_name = filename + i +1; +# +# pe_header_offset = pe_get32 (dll, 0x3c); +# opthdr_ofs = pe_header_offset + 4 + 20; +# num_entries = pe_get32 (dll, opthdr_ofs + 92); +# +# if (num_entries < 1) /* no exports */ +# return 1; +# +# export_rva = pe_get32 (dll, opthdr_ofs + 96); +# export_size = pe_get32 (dll, opthdr_ofs + 100); +# nsections = pe_get16 (dll, pe_header_offset + 4 +2); +# secptr = (pe_header_offset + 4 + 20 + +# pe_get16 (dll, pe_header_offset + 4 + 16)); +# +# expptr = 0; +# for (i = 0; i < nsections; i++) +# { +# char sname[8]; +# unsigned long secptr1 = secptr + 40 * i; +# unsigned long vaddr = pe_get32 (dll, secptr1 + 12); +# unsigned long vsize = pe_get32 (dll, secptr1 + 16); +# unsigned long fptr = pe_get32 (dll, secptr1 + 20); +# lseek(dll, secptr1, SEEK_SET); +# read(dll, sname, 8); +# if (vaddr <= export_rva && vaddr+vsize > export_rva) +# { +# expptr = fptr + (export_rva - vaddr); +# if (export_rva + export_size > vaddr + vsize) +# export_size = vsize - (export_rva - vaddr); +# break; +# } +# } +# +# expdata = (unsigned char*)malloc(export_size); +# lseek (dll, expptr, SEEK_SET); +# read (dll, expdata, export_size); +# erva = expdata - export_rva; +# +# nexp = pe_as32 (expdata+24); +# name_rvas = pe_as32 (expdata+32); +# +# printf ("EXPORTS\n"); +# for (i = 0; i&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + fi + build_libtool_libs=no + build_old_libs=yes + prefer_static_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test $# -gt 0; do + arg="$1" + shift + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case "$prev" in + output) + compile_command="$compile_command @OUTPUT@" + finalize_command="$finalize_command @OUTPUT@" + ;; + esac + + case "$prev" in + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + compile_command="$compile_command @SYMFILE@" + finalize_command="$finalize_command @SYMFILE@" + preload=yes + fi + case "$arg" in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi + prev= + ;; + esac + ;; + expsyms) + export_symbols="$arg" + if test ! -f "$arg"; then + $echo "$modename: symbol file \`$arg' does not exist" + exit 1 + fi + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case "$arg" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi + prev= + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi + + prevarg="$arg" + + case "$arg" in + -all-static) + if test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 + continue + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: not more than one -exported-symbols argument allowed" + exit 1 + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -L*) + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # We need an absolute path. + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + absdir="$dir" + fi + dir="$absdir" + ;; + esac + case " $deplibs " in + *" $arg "*) ;; + *) deplibs="$deplibs $arg";; + esac + case " $lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir";; + esac + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + dllsearchdir=`cd "$dir" && pwd || echo "$dir"` + case ":$dllsearchpath:" in + ::) dllsearchpath="$dllsearchdir";; + *":$dllsearchdir:"*) ;; + *) dllsearchpath="$dllsearchpath:$dllsearchdir";; + esac + ;; + esac + ;; + + -l*) + if test "$arg" = "-lc"; then + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* |*-*-freebsd* ) + # These systems don't actually have c library (as such) + continue + ;; + esac + elif test "$arg" = "-lm"; then + case "$host" in + *-*-cygwin* | *-*-beos*) + # These systems don't actually have math library (as such) + continue + ;; + esac + fi + deplibs="$deplibs $arg" + ;; + + -module) + module=yes + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -o) prev=output ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + + -static) + # If we have no pic_flag, then this is the same as -all-static. + if test -z "$pic_flag" && test -n "$link_static_flag"; then + compile_command="$compile_command $link_static_flag" + finalize_command="$finalize_command $link_static_flag" + fi + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + # Some other compiler flag. + -* | +*) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + ;; + + *.o | *.obj | *.a | *.lib) + # A standard object. + objs="$objs $arg" + ;; + + *.lo) + # A library object. + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + if test "$prev" = dlprefiles; then + # Preload the old-style object. + dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"` + prev= + fi + libobjs="$libobjs $arg" + ;; + + *.la) + # A libtool-controlled library. + + dlname= + libdir= + library_names= + old_library= + + # Check to see that this really is a libtool archive. + if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2 + exit 1 + fi + + # If the library was installed with an old release of libtool, + # it will not redefine variable installed. + installed=yes + + # Read the .la file + # If there is no directory component, then add one. + case "$arg" in + */* | *\\*) . $arg ;; + *) . ./$arg ;; + esac + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$arg'" 1>&2 + exit 1 + fi + + # Find the relevant object directory and library name. + name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` + + if test "X$installed" = Xyes; then + dir="$libdir" + else + dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` + if test "X$dir" = "X$arg"; then + dir="$objdir" + else + dir="$dir/$objdir" + fi + fi + + if test -n "$dependency_libs"; then + # Extract -R and -L from dependency_libs + temp_deplibs= + for deplib in $dependency_libs; do + case "$deplib" in + -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'` + case " $rpath $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + -L*) case "$compile_command $temp_deplibs " in + *" $deplib "*) ;; + *) temp_deplibs="$temp_deplibs $deplib";; + esac + temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'` + case " $lib_search_path " in + *" $temp_dir "*) ;; + *) lib_search_path="$lib_search_path $temp_dir";; + esac + ;; + *) temp_deplibs="$temp_deplibs $deplib";; + esac + done + dependency_libs="$temp_deplibs" + fi + + if test -z "$libdir"; then + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + deplibs="$deplibs$dependency_libs" + compile_command="$compile_command $dir/$old_library$dependency_libs" + finalize_command="$finalize_command $dir/$old_library$dependency_libs" + continue + fi + + # This library was specified with -dlopen. + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking statically, + # we need to preload. + prev=dlprefiles + else + # We should not create a dependency on this library, but we + # may need any libraries it requires. + compile_command="$compile_command$dependency_libs" + finalize_command="$finalize_command$dependency_libs" + prev= + continue + fi + fi + + # The library was specified with -dlpreopen. + if test "$prev" = dlprefiles; then + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + dlprefiles="$dlprefiles $dir/$old_library" + else + dlprefiles="$dlprefiles $dir/$linklib" + fi + prev= + fi + + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + link_against_libtool_libs="$link_against_libtool_libs $arg" + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + + # We need an absolute path. + case "$dir" in + [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + absdir="$dir" + fi + ;; + esac + + # This is the magic to use -rpath. + # Skip directories that are in the system default run-time + # search path, unless they have been requested with -R. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + + lib_linked=yes + case "$hardcode_action" in + immediate | unsupported) + if test "$hardcode_direct" = no; then + compile_command="$compile_command $dir/$linklib" + deplibs="$deplibs $dir/$linklib" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2*) + dllsearchdir=`cd "$dir" && pwd || echo "$dir"` + if test -n "$dllsearchpath"; then + dllsearchpath="$dllsearchpath:$dllsearchdir" + else + dllsearchpath="$dllsearchdir" + fi + ;; + esac + elif test "$hardcode_minus_L" = no; then + case "$host" in + *-*-sunos*) + compile_shlibpath="$compile_shlibpath$dir:" + ;; + esac + case "$compile_command " in + *" -L$dir "*) ;; + *) compile_command="$compile_command -L$dir";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -L$dir -l$name" + elif test "$hardcode_shlibpath_var" = no; then + case ":$compile_shlibpath:" in + *":$dir:"*) ;; + *) compile_shlibpath="$compile_shlibpath$dir:";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -l$name" + else + lib_linked=no + fi + ;; + + relink) + if test "$hardcode_direct" = yes; then + compile_command="$compile_command $absdir/$linklib" + deplibs="$deplibs $absdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + case "$compile_command " in + *" -L$absdir "*) ;; + *) compile_command="$compile_command -L$absdir";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -L$absdir -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case ":$compile_shlibpath:" in + *":$absdir:"*) ;; + *) compile_shlibpath="$compile_shlibpath$absdir:";; + esac + compile_command="$compile_command -l$name" + deplibs="$deplibs -l$name" + else + lib_linked=no + fi + ;; + + *) + lib_linked=no + ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + finalize_command="$finalize_command $libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + case "$finalize_command " in + *" -L$libdir "*) ;; + *) finalize_command="$finalize_command -L$libdir";; + esac + finalize_command="$finalize_command -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case ":$finalize_shlibpath:" in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:";; + esac + finalize_command="$finalize_command -l$name" + else + # We cannot seem to hardcode it, guess we'll fake it. + case "$finalize_command " in + *" -L$dir "*) ;; + *) finalize_command="$finalize_command -L$libdir";; + esac + finalize_command="$finalize_command -l$name" + fi + else + # Transform directly to old archives if we don't build new libraries. + if test -n "$pic_flag" && test -z "$old_library"; then + $echo "$modename: cannot find static library for \`$arg'" 1>&2 + exit 1 + fi + + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_command="$compile_command $dir/$linklib" + finalize_command="$finalize_command $dir/$linklib" + else + case "$compile_command " in + *" -L$dir "*) ;; + *) compile_command="$compile_command -L$dir";; + esac + compile_command="$compile_command -l$name" + case "$finalize_command " in + *" -L$dir "*) ;; + *) finalize_command="$finalize_command -L$dir";; + esac + finalize_command="$finalize_command -l$name" + fi + fi + + # Add in any libraries that this one depends upon. + compile_command="$compile_command$dependency_libs" + finalize_command="$finalize_command$dependency_libs" + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + ;; + esac + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + done + + if test -n "$prev"; then + $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` + libobjs_save="$libobjs" + + case "$output" in + "") + $echo "$modename: you must specify an output file" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + + *.a | *.lib) + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link libtool libraries into archives" 1>&2 + exit 1 + fi + + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 + fi + + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 + fi + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + ;; + + *.la) + # Make sure we only generate libraries of the form `libNAME.la'. + case "$outputname" in + lib*) + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + eval libname=\"$libname_spec\" + ;; + *) + if test "$module" = no; then + $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + eval libname=\"$libname_spec\" + else + libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` + fi + ;; + esac + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + + if test -n "$objs"; then + $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 + exit 1 + fi + + # How the heck are we supposed to write a wrapper for a shared library? + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2 + exit 1 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 + fi + + set dummy $rpath + if test $# -gt 2; then + $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 + fi + install_libdir="$2" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + libext=al + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + dependency_libs="$deplibs" + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 + fi + else + + # Parse the version information argument. + IFS="${IFS= }"; save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + IFS="$save_ifs" + + if test -n "$8"; then + $echo "$modename: too many parameters to \`-version-info'" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + current="$2" + revision="$3" + age="$4" + + # Check that each of the things are valid numbers. + case "$current" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case "$revision" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + case "$age" in + 0 | [1-9] | [1-9][0-9]*) ;; + *) + $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + ;; + esac + + if test $age -gt $current; then + $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 + $echo "$modename: \`$vinfo' is not valid version information" 1>&2 + exit 1 + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case "$version_type" in + none) ;; + + irix) + major=`expr $current - $age + 1` + versuffix="$major.$revision" + verstring="sgi$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test $loop != 0; do + iface=`expr $revision - $loop` + loop=`expr $loop - 1` + verstring="sgi$major.$iface:$verstring" + done + ;; + + linux) + major=.`expr $current - $age` + versuffix="$major.$age.$revision" + ;; + + osf) + major=`expr $current - $age` + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test $loop != 0; do + iface=`expr $current - $loop` + loop=`expr $loop - 1` + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + verstring="$verstring:${current}.0" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current"; + ;; + + windows) + # Like Linux, but with '-' rather than '.', since we only + # want one extension on Windows 95. + major=`expr $current - $age` + versuffix="-$major-$age-$revision" + ;; + + *) + $echo "$modename: unknown library version type \`$version_type'" 1>&2 + echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 + exit 1 + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + verstring="0.0" + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + dependency_libs="$deplibs" + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos* | *-*-freebsd* ) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody*) + # rhapsody is a little odd... + deplibs="$deplibs -framework System" + ;; + *) + # Add libc to deplibs on all other systems. + deplibs="$deplibs -lc" + ;; + esac + fi + + # Create the output directory, or remove our outputs if we need to. + if test -d $output_objdir; then + $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" + $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + else + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + oldlibs="$oldlibs $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` + fi + + if test "$build_libtool_libs" = yes; then + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case "$deplibs_check_method" in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behaviour. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $rm conftest.c + cat > conftest.c </dev/null` + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null \ + | grep " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | sed 's/.* -> //'` + case "$potliblink" in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + | sed 10q \ + | egrep "$file_magic_regex" > /dev/null; then + newdeplibs="$newdeplibs $a_deplib" + a_deplib="" + break 2 + fi + done + done + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + fi + else + # Add a -L argument. + newdeplibs="$newdeplibs $a_deplib" + fi + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ + -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | + grep . >/dev/null; then + echo + if test "X$deplibs_check_method" = "Xnone"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + fi + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + echo "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + # Get the real and link names of the library. + eval library_names=\"$library_names_spec\" + set dummy $library_names + realname="$2" + shift; shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + lib="$output_objdir/$realname" + for link + do + linknames="$linknames $link" + done + + # Ensure that we have .o objects for linkers which dislike .lo + # (e.g. aix) in case we are running --disable-static + for obj in $libobjs; do + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + $show "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $run $rm $export_symbols + eval cmds=\"$export_symbols_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + if test -n "$export_symbols_regex"; then + $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" + $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + $show "$mv \"${export_symbols}T\" \"$export_symbols\"" + $run eval '$mv "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' + fi + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linkopts="$linkopts $flag" + fi + + # Do each of the archive commands. + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval cmds=\"$archive_expsym_cmds\" + else + eval cmds=\"$archive_cmds\" + fi + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + *.lo | *.o | *.obj) + if test -n "$link_against_libtool_libs"; then + $echo "$modename: error: cannot link libtool libraries into objects" 1>&2 + exit 1 + fi + + if test -n "$deplibs"; then + $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 + fi + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 + fi + + if test -n "$rpath"; then + $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 + fi + + if test -n "$xrpath"; then + $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 + fi + + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 + fi + + case "$output" in + *.lo) + if test -n "$objs"; then + $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 + exit 1 + fi + libobj="$output" + obj=`$echo "X$output" | $Xsed -e "$lo2o"` + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $run $rm $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + # Create the old-style object. + reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" + + output="$obj" + eval cmds=\"$reload_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + $show "echo timestamp > $libobj" + $run eval "echo timestamp > $libobj" || exit $? + exit 0 + fi + + if test -n "$pic_flag"; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + eval cmds=\"$reload_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + else + # Just create a symlink. + $show $rm $libobj + $run $rm $libobj + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + ;; + + # Anything else should be a program. + *) + if test -n "$vinfo"; then + $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 + fi + + if test -n "$release"; then + $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 + fi + + if test "$preload" = yes; then + if test "$dlopen" = unknown && test "$dlopen_self" = unknown && + test "$dlopen_self_static" = unknown; then + $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." + fi + fi + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$compile_rpath " in + *" $libdir "*) ;; + *) compile_rpath="$compile_rpath $libdir" ;; + esac + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` + if test "X$output_objdir" = "X$output"; then + output_objdir="$objdir" + else + output_objdir="$output_objdir/$objdir" + fi + + # Create the binary in the object directory, then wrap it. + if test ! -d $output_objdir; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + fi + + dlsyms= + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + dlsyms="${outputname}S.c" + else + $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 + fi + fi + + if test -n "$dlsyms"; then + case "$dlsyms" in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${outputname}.nm" + + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" + + # Parse the name list into a source file. + $show "creating $output_objdir/$dlsyms" + + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ +/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ +/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +/* Prevent the only kind of declaration conflicts we can make. */ +#define lt_preloaded_symbols some_other_symbol + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + $show "generating symbol list for \`$output'" + + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` + for arg in $progfiles; do + $show "extracting global C symbols from \`$arg'" + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + if test -n "$export_symbols_regex"; then + $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T' + $run eval '$mv "$nlist"T "$nlist"' + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$output.exp" + $run $rm $export_symbols + $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + else + $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval 'mv "$nlist"T "$nlist"' + fi + fi + + for arg in $dlprefiles; do + $show "extracting global C symbols from \`$arg'" + name=`echo "$arg" | sed -e 's%^.*/%%'` + $run eval 'echo ": $name " >> "$nlist"' + $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" + done + + if test -z "$run"; then + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $mv "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then + : + else + grep -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$dlsyms" + fi + + $echo >> "$output_objdir/$dlsyms" "\ + +#undef lt_preloaded_symbols + +#if defined (__STDC__) && __STDC__ +# define lt_ptr_t void * +#else +# define lt_ptr_t char * +# define const +#endif + +/* The mapping between symbol names and symbols. */ +const struct { + const char *name; + lt_ptr_t address; +} +lt_preloaded_symbols[] = +{\ +" + + sed -n -e 's/^: \([^ ]*\) $/ {\"\1\", (lt_ptr_t) 0},/p' \ + -e 's/^. \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr_t) \&\2},/p' \ + < "$nlist" >> "$output_objdir/$dlsyms" + + $echo >> "$output_objdir/$dlsyms" "\ + {0, (lt_ptr_t) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + fi + + pic_flag_for_symtable= + case "$host" in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC";; + esac + esac + + # Now compile the dynamic symbol file. + $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" + + # Transform the symbol file into the correct name. + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + ;; + *) + $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 + exit 1 + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` + fi + + if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then + # Replace the output file specification. + compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + $show "$link_command" + $run eval "$link_command" + status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $status + fi + + if test -n "$shlibpath_var"; then + # We should set the shlibpath_var + rpath= + for dir in $temp_rpath; do + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) + # Absolute path. + rpath="$rpath$dir:" + ;; + *) + # Relative path: add a thisdir entry. + rpath="$rpath\$thisdir/$dir:" + ;; + esac + done + temp_rpath="$rpath" + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + rpath="$rpath$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 + $echo "$modename: \`$output' will be relinked during installation" 1>&2 + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname + + $show "$link_command" + $run eval "$link_command" || exit $? + + # Now create the wrapper script. + $show "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + fi + + # Quote $echo for shipping. + if test "X$echo" = "X$SHELL $0 --fallback-echo"; then + case "$0" in + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; + *) qecho="$SHELL `pwd`/$0 --fallback-echo";; + esac + qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` + else + qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` + fi + + # Only actually do things if our run command is non-null. + if test -z "$run"; then + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) output=`echo $output|sed 's,.exe$,,'` ;; + esac + $rm $output + trap "$rm $output; exit 1" 1 2 15 + + $echo > $output "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed='sed -e 1s/^X//' +sed_quote_subst='$sed_quote_subst' + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variable: + link_against_libtool_libs='$link_against_libtool_libs' +else + # When we are sourced in execute mode, \$file and \$echo are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + echo=\"$qecho\" + file=\"\$0\" + # Make sure echo works. + if test \"X\$1\" = X--no-reexec; then + # Discard the --no-reexec flag, and continue. + shift + elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then + # Yippee, \$echo works! + : + else + # Restart under the correct shell, and then maybe \$echo will work. + exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} + fi + fi\ +" + $echo >> $output "\ + + # Find the directory that this script lives in. + thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\` + done + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + echo >> $output "\ + program=lt-'$outputname' + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || \\ + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $mkdir \"\$progdir\" + else + $rm \"\$progdir/\$file\" + fi" + + echo >> $output "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if (cd \"\$thisdir\" && eval \$relink_command); then : + else + $rm \"\$progdir/\$file\" + exit 1 + fi + fi + + $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $rm \"\$progdir/\$program\"; + $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $rm \"\$progdir/\$file\" + fi" + else + echo >> $output "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + echo >> $output "\ + + if test -f \"\$progdir/\$program\"; then" + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $echo >> $output "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` + + export $shlibpath_var +" + fi + + # fixup the dll searchpath if we need to. + if test -n "$dllsearchpath"; then + $echo >> $output "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + $echo >> $output "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. +" + case $host in + # win32 systems need to use the prog path for dll + # lookup to work + *-*-cygwin*) + $echo >> $output "\ + exec \$progdir/\$program \${1+\"\$@\"} +" + ;; + + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2*) + $echo >> $output "\ + exec \$progdir\\\\\$program \${1+\"\$@\"} +" + ;; + + *) + $echo >> $output "\ + # Export the path to the program. + PATH=\"\$progdir:\$PATH\" + export PATH + + exec \$program \${1+\"\$@\"} +" + ;; + esac + $echo >> $output "\ + \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" + exit 1 + fi + else + # The program doesn't exist. + \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2 + \$echo \"This script is just a wrapper for \$program.\" 1>&2 + echo \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" + chmod +x $output + fi + exit 0 + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + # Add in members from convenience archives. + for xlib in $addlibs; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` + done + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + eval cmds=\"$old_archive_from_new_cmds\" + else + # Ensure that we have .o objects in place in case we decided + # not to build a shared library, and have fallen back to building + # static libs even though --disable-static was passed! + for oldobj in $oldobjs; do + if test ! -f $oldobj; then + xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$oldobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` + obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + $show "(cd $xdir && ${LN_S} $obj $baseobj)" + $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? + fi + done + + eval cmds=\"$old_archive_cmds\" + fi + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$generated"; then + $show "${rm}r$generated" + $run ${rm}r$generated + fi + + # Now create the libtool archive. + case "$output" in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + $show "creating $output" + + if test -n "$xrpath"; then + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + done + dependency_libs="$temp_xrpath $dependency_libs" + fi + + # Only create the output if not a dry run. + if test -z "$run"; then + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + fi + $rm $output + $echo > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$dlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Directory that this library needs to be installed in: +libdir='$install_libdir'\ +" + done + fi + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" + $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $? + ;; + esac + exit 0 + ;; + + # libtool install mode + install) + modename="$modename: install" + + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then + # Aesthetically quote it. + arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$arg " + arg="$1" + shift + else + install_prog= + arg="$nonopt" + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog$arg" + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + for arg + do + if test -n "$dest"; then + files="$files $dest" + dest="$arg" + continue + fi + + case "$arg" in + -d) isdir=yes ;; + -f) prev="-f" ;; + -g) prev="-g" ;; + -m) prev="-m" ;; + -o) prev="-o" ;; + -s) + stripme=" -s" + continue + ;; + -*) ;; + + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + prev= + else + dest="$arg" + continue + fi + ;; + esac + + # Aesthetically quote the argument. + arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` + case "$arg" in + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*) + arg="\"$arg\"" + ;; + esac + install_prog="$install_prog $arg" + done + + if test -z "$install_prog"; then + $echo "$modename: you must specify an install program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -n "$prev"; then + $echo "$modename: the \`$prev' option requires an argument" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + if test -z "$files"; then + if test -z "$dest"; then + $echo "$modename: no file or destination specified" 1>&2 + else + $echo "$modename: you must specify a destination" 1>&2 + fi + $echo "$help" 1>&2 + exit 1 + fi + + # Strip any trailing slash from the destination. + dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` + test "X$destdir" = "X$dest" && destdir=. + destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` + + # Not a directory, so check to see that there is only one file specified. + set dummy $files + if test $# -gt 2; then + $echo "$modename: \`$dest' is not a directory" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + fi + case "$destdir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case "$file" in + *.lo) ;; + *) + $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case "$file" in + *.a | *.lib) + # Do the static libraries later. + staticlibs="$staticlibs $file" + ;; + + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + library_names= + old_library= + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) current_libdirs="$current_libdirs $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) future_libdirs="$future_libdirs $libdir" ;; + esac + fi + + dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/" + test "X$dir" = "X$file/" && dir= + dir="$dir$objdir" + + # See the names of the shared library. + set dummy $library_names + if test -n "$2"; then + realname="$2" + shift + shift + + # Install the shared library and build the symlinks. + $show "$install_prog $dir/$realname $destdir/$realname" + $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? + + if test $# -gt 0; then + # Delete the old symlinks, and create new ones. + for linkname + do + if test "$linkname" != "$realname"; then + $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" + fi + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + eval cmds=\"$postinstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Install the pseudo-library for information purposes. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + instname="$dir/$name"i + $show "$install_prog $instname $destdir/$name" + $run eval "$install_prog $instname $destdir/$name" || exit $? + + # Maybe install the static library, too. + test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case "$destfile" in + *.lo) + staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` + ;; + *.o | *.obj) + staticdest="$destfile" + destfile= + ;; + *) + $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; + esac + + # Install the libtool object if requested. + if test -n "$destfile"; then + $show "$install_prog $file $destfile" + $run eval "$install_prog $file $destfile" || exit $? + fi + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` + + $show "$install_prog $staticobj $staticdest" + $run eval "$install_prog \$staticobj \$staticdest" || exit $? + fi + exit 0 + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + destfile="$destdir/$destfile" + fi + + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + link_against_libtool_libs= + relink_command= + + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Check the variables that should have been set. + if test -z "$link_against_libtool_libs"; then + $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2 + exit 1 + fi + + finalize=yes + for lib in $link_against_libtool_libs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + # If there is no directory component, then add one. + case "$lib" in + */* | *\\*) . $lib ;; + *) . ./$lib ;; + esac + fi + libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + done + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + if test "$finalize" = yes && test -z "$run"; then + tmpdir="/tmp" + test -n "$TMPDIR" && tmpdir="$TMPDIR" + tmpdir="$tmpdir/libtool-$$" + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` + + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + ${rm}r "$tmpdir" + continue + fi + file="$outputname" + else + $echo "$modename: warning: cannot relink \`$file'" 1>&2 + fi + else + # Install the binary that we compiled earlier. + file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + $show "$install_prog$stripme $file $destfile" + $run eval "$install_prog\$stripme \$file \$destfile" || exit $? + test -n "$outputname" && ${rm}r "$tmpdir" + ;; + esac + done + + for file in $staticlibs; do + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + $show "$install_prog $file $oldlib" + $run eval "$install_prog \$file \$oldlib" || exit $? + + # Do each command in the postinstall commands. + eval cmds=\"$old_postinstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + done + + if test -n "$future_libdirs"; then + $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 + fi + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + test -n "$run" && current_libdirs=" -n$current_libdirs" + exec $SHELL $0 --finish$current_libdirs + exit 1 + fi + + exit 0 + ;; + + # libtool finish mode + finish) + modename="$modename: finish" + libdirs="$nonopt" + admincmds= + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for dir + do + libdirs="$libdirs $dir" + done + + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + eval cmds=\"$finish_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || admincmds="$admincmds + $cmd" + done + IFS="$save_ifs" + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $run eval "$cmds" || admincmds="$admincmds + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + test "$show" = : && exit 0 + + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + echo " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + echo " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + echo " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + echo "See any operating system documentation about shared libraries for" + echo "more information, such as the ld(1) and ld.so(8) manual pages." + echo "----------------------------------------------------------------------" + exit 0 + ;; + + # libtool execute mode + execute) + modename="$modename: execute" + + # The first argument is the command name. + cmd="$nonopt" + if test -z "$cmd"; then + $echo "$modename: you must specify a COMMAND" 1>&2 + $echo "$help" + exit 1 + fi + + # Handle -dlopen flags immediately. + for file in $execute_dlfiles; do + if test ! -f "$file"; then + $echo "$modename: \`$file' is not a file" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + dir= + case "$file" in + *.la) + # Check to see that this really is a libtool archive. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + # Read the libtool library. + dlname= + library_names= + + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" + continue + fi + + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + + if test -f "$dir/$objdir/$dlname"; then + dir="$dir/$objdir" + else + $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 + exit 1 + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + ;; + + *) + $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case "$file" in + -*) ;; + *) + # Do a test to see if this is really a libtool program. + if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` + args="$args \"$file\"" + done + + if test -z "$run"; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved enviroment variables + if test "${save_LC_ALL+set}" = set; then + LC_ALL="$save_LC_ALL"; export LC_ALL + fi + if test "${save_LANG+set}" = set; then + LANG="$save_LANG"; export LANG + fi + + # Now actually exec the command. + eval "exec \$cmd$args" + + $echo "$modename: cannot exec \$cmd$args" + exit 1 + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi + $echo "$cmd$args" + exit 0 + fi + ;; + + # libtool uninstall mode + uninstall) + modename="$modename: uninstall" + rm="$nonopt" + files= + + for arg + do + case "$arg" in + -*) rm="$rm $arg" ;; + *) files="$files $arg" ;; + esac + done + + if test -z "$rm"; then + $echo "$modename: you must specify an RM program" 1>&2 + $echo "$help" 1>&2 + exit 1 + fi + + for file in $files; do + dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` + test "X$dir" = "X$file" && dir=. + name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` + + rmfiles="$file" + + case "$name" in + *.la) + # Possibly a libtool archive, so verify it. + if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then + . $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + rmfiles="$rmfiles $dir/$n" + done + test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" + + $show "$rm $rmfiles" + $run $rm $rmfiles + + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + eval cmds=\"$postuninstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + done + IFS="$save_ifs" + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + eval cmds=\"$old_postuninstall_cmds\" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" + done + IFS="$save_ifs" + fi + + # FIXME: should reinstall the best remaining shared library. + fi + ;; + + *.lo) + if test "$build_old_libs" = yes; then + oldobj=`$echo "X$name" | $Xsed -e "$lo2o"` + rmfiles="$rmfiles $dir/$oldobj" + fi + $show "$rm $rmfiles" + $run $rm $rmfiles + ;; + + *) + $show "$rm $rmfiles" + $run $rm $rmfiles + ;; + esac + done + exit 0 + ;; + + "") + $echo "$modename: you must specify a MODE" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 + ;; + esac + + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$generic_help" 1>&2 + exit 1 +fi # test -z "$show_help" + +# We need to display help for each of the modes. +case "$mode" in +"") $echo \ +"Usage: $modename [OPTION]... [MODE-ARG]... + +Provide generalized library-building support services. + + --config show all configuration variables + --debug enable verbose shell tracing +-n, --dry-run display commands without modifying any files + --features display basic configuration information and exit + --finish same as \`--mode=finish' + --help display this help message and exit + --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] + --quiet same as \`--silent' + --silent don't print informational messages + --version print version information + +MODE must be one of the following: + + compile compile a source file into a libtool object + execute automatically set library path, then run a program + finish complete the installation of libtool libraries + install install libraries or executables + link create a library or an executable + uninstall remove libraries from an installed directory + +MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for +a more detailed description of MODE." + exit 0 + ;; + +compile) + $echo \ +"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -static always build a \`.o' file suitable for static linking + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + +execute) + $echo \ +"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + +finish) + $echo \ +"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + +install) + $echo \ +"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + +link) + $echo \ +"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -static do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + +uninstall) + $echo \ +"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + +*) + $echo "$modename: invalid operation mode \`$mode'" 1>&2 + $echo "$help" 1>&2 + exit 1 + ;; +esac + +echo +$echo "Try \`$modename --help' for more information about other modes." + +exit 0 + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff -r 000000000000 -r 74212992fb08 missing --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/missing Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,190 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. +# Copyright (C) 1996, 1997 Free Software Foundation, Inc. +# Franc,ois Pinard , 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. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +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 + +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 + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + yacc create \`y.tab.[ch]', if possible, from existing .[ch]" + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing - GNU libit 0.0" + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + + aclocal) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acinclude.m4' or \`configure.in'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`configure.in'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`acconfig.h' or \`configure.in'. 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.in` + 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) + echo 1>&2 "\ +WARNING: \`$1' is missing on your system. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. + 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 + ;; + + 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 + ;; + + makeinfo) + 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 + ;; + + *) + 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 -r 000000000000 -r 74212992fb08 mkinstalldirs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mkinstalldirs Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,40 @@ +#! /bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Public domain + +# $Id$ + +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" + + mkdir "$pathcomp" || lasterr=$? + + if test ! -d "$pathcomp"; then + errstatus=$lasterr + fi + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff -r 000000000000 -r 74212992fb08 sdl-config.in --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdl-config.in Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,65 @@ +#!/bin/sh + +prefix=@prefix@ +exec_prefix=@exec_prefix@ +exec_prefix_set=no + +usage="\ +Usage: sdl-config [--prefix[=DIR]] [--exec-prefix[=DIR]] [--version] [--libs] [--cflags]" + +if test $# -eq 0; then + echo "${usage}" 1>&2 + exit 1 +fi + +while test $# -gt 0; do + case "$1" in + -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) optarg= ;; + esac + + case $1 in + --prefix=*) + prefix=$optarg + if test $exec_prefix_set = no ; then + exec_prefix=$optarg + fi + ;; + --prefix) + echo $prefix + ;; + --exec-prefix=*) + exec_prefix=$optarg + exec_prefix_set=yes + ;; + --exec-prefix) + echo $exec_prefix + ;; + --version) + echo @SDL_VERSION@ + ;; + --cflags) + if test @includedir@ != /usr/include ; then + # Handle oddities in Win32 path handling (assumes prefix) + prefix=`echo ${prefix} | sed 's,^//\([A-Z]\),\1:,'` + + includes=-I@includedir@ + fi + echo $includes -I@includedir@/SDL @SDL_CFLAGS@ + ;; +@ENABLE_SHARED_TRUE@ --libs) +@ENABLE_SHARED_TRUE@ libdirs="-L@libdir@ @SDL_RLD_FLAGS@" +@ENABLE_SHARED_TRUE@ echo $libdirs @SDL_LIBS@ +@ENABLE_SHARED_TRUE@ ;; +@ENABLE_STATIC_TRUE@@ENABLE_SHARED_TRUE@ --static-libs) +@ENABLE_STATIC_TRUE@@ENABLE_SHARED_FALSE@ --libs|--static-libs) +@ENABLE_STATIC_TRUE@ libdirs="-L@libdir@ @SDL_RLD_FLAGS@" +@ENABLE_STATIC_TRUE@ echo $libdirs @SDL_LIBS@ @SYSTEM_LIBS@ +@ENABLE_STATIC_TRUE@ ;; + *) + echo "${usage}" 1>&2 + exit 1 + ;; + esac + shift +done diff -r 000000000000 -r 74212992fb08 sdl.m4 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sdl.m4 Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,168 @@ +# Configure paths for SDL +# Sam Lantinga 9/21/99 +# stolen from Manish Singh +# stolen back from Frank Belew +# stolen from Manish Singh +# Shamelessly stolen from Owen Taylor + +dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) +dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS +dnl +AC_DEFUN(AM_PATH_SDL, +[dnl +dnl Get the cflags and libraries from the sdl-config script +dnl +AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], + sdl_prefix="$withval", sdl_prefix="") +AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], + sdl_exec_prefix="$withval", sdl_exec_prefix="") +AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], + , enable_sdltest=yes) + + if test x$sdl_exec_prefix != x ; then + sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" + if test x${SDL_CONFIG+set} != xset ; then + SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config + fi + fi + if test x$sdl_prefix != x ; then + sdl_args="$sdl_args --prefix=$sdl_prefix" + if test x${SDL_CONFIG+set} != xset ; then + SDL_CONFIG=$sdl_prefix/bin/sdl-config + fi + fi + + AC_PATH_PROG(SDL_CONFIG, sdl-config, no) + min_sdl_version=ifelse([$1], ,0.11.0,$1) + AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) + no_sdl="" + if test "$SDL_CONFIG" = "no" ; then + no_sdl=yes + else + SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` + SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` + + sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` + sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` + sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ + sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` + if test "x$enable_sdltest" = "xyes" ; then + ac_save_CFLAGS="$CFLAGS" + ac_save_LIBS="$LIBS" + CFLAGS="$CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" +dnl +dnl Now check if the installed SDL is sufficiently new. (Also sanity +dnl checks the results of sdl-config to some extent +dnl + rm -f conf.sdltest + AC_TRY_RUN([ +#include +#include +#include +#include "SDL.h" + +char* +my_strdup (char *str) +{ + char *new_str; + + if (str) + { + new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); + strcpy (new_str, str); + } + else + new_str = NULL; + + return new_str; +} + +int main (int argc, char *argv[]) +{ + int major, minor, micro; + char *tmp_version; + + /* This hangs on some systems (?) + system ("touch conf.sdltest"); + */ + { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } + + /* HP/UX 9 (%@#!) writes to sscanf strings */ + tmp_version = my_strdup("$min_sdl_version"); + if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { + printf("%s, bad version string\n", "$min_sdl_version"); + exit(1); + } + + if (($sdl_major_version > major) || + (($sdl_major_version == major) && ($sdl_minor_version > minor)) || + (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) + { + return 0; + } + else + { + printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); + printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); + printf("*** best to upgrade to the required version.\n"); + printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); + printf("*** to point to the correct copy of sdl-config, and remove the file\n"); + printf("*** config.cache before re-running configure\n"); + return 1; + } +} + +],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + if test "x$no_sdl" = x ; then + AC_MSG_RESULT(yes) + ifelse([$2], , :, [$2]) + else + AC_MSG_RESULT(no) + if test "$SDL_CONFIG" = "no" ; then + echo "*** The sdl-config script installed by SDL could not be found" + echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" + echo "*** your path, or set the SDL_CONFIG environment variable to the" + echo "*** full path to sdl-config." + else + if test -f conf.sdltest ; then + : + else + echo "*** Could not run SDL test program, checking why..." + CFLAGS="$CFLAGS $SDL_CFLAGS" + LIBS="$LIBS $SDL_LIBS" + AC_TRY_LINK([ +#include +#include "SDL.h" +], [ return 0; ], + [ echo "*** The test program compiled, but did not run. This usually means" + echo "*** that the run-time linker is not finding SDL or finding the wrong" + echo "*** version of SDL. If it is not finding SDL, you'll need to set your" + echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" + echo "*** to the installed location Also, make sure you have run ldconfig if that" + echo "*** is required on your system" + echo "***" + echo "*** If you have an old version installed, it is best to remove it, although" + echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], + [ echo "*** The test program failed to compile or link. See the file config.log for the" + echo "*** exact error that occured. This usually means SDL was incorrectly installed" + echo "*** or that you have moved SDL since it was installed. In the latter case, you" + echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) + CFLAGS="$ac_save_CFLAGS" + LIBS="$ac_save_LIBS" + fi + fi + SDL_CFLAGS="" + SDL_LIBS="" + ifelse([$3], , :, [$3]) + fi + AC_SUBST(SDL_CFLAGS) + AC_SUBST(SDL_LIBS) + rm -f conf.sdltest +]) diff -r 000000000000 -r 74212992fb08 src/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/.cvsignore Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,6 @@ +Makefile.in +Makefile +.libs +*.o +*.lo +*.la diff -r 000000000000 -r 74212992fb08 src/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Makefile.am Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,41 @@ + +## Makefile.am for the main SDL library + +# These are the subdirectories that are always built +CORE_SUBDIRS = \ + main + +# These are the subdirectories which may be built +EXTRA_SUBDIRS = \ + audio video events joystick cdrom thread timer endian file hermes + +# These are the subdirectories which will be built now +SUBDIRS = $(CORE_SUBDIRS) @SDL_EXTRADIRS@ + +# These are the subdirectories which will be distributed with "make dist" +DIST_SUBDIRS = $(CORE_SUBDIRS) $(EXTRA_SUBDIRS) + +# The SDL library target +lib_LTLIBRARIES = libSDL.la + +libSDL_la_SOURCES = $(GENERAL_SRCS) +libSDL_la_LDFLAGS = \ + -release $(LT_RELEASE) \ + -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) +libSDL_la_LIBADD = \ + main/libarch.la \ + @SDL_EXTRALIBS@ \ + @SYSTEM_LIBS@ +libSDL_la_DEPENDENCIES = \ + main/libarch.la \ + @SDL_EXTRALIBS@ + +# The SDL library sources +GENERAL_SRCS = \ + SDL.c \ + SDL_error.c \ + SDL_error_c.h \ + SDL_fatal.c \ + SDL_fatal.h \ + SDL_getenv.c + diff -r 000000000000 -r 74212992fb08 src/SDL.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/SDL.c Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,233 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Initialization code for SDL */ + +#include /* For getenv() */ + +#include "SDL.h" +#include "SDL_endian.h" +#include "SDL_fatal.h" +#ifndef DISABLE_VIDEO +#include "SDL_leaks.h" +#endif + +/* Initialization/Cleanup routines */ +#ifndef DISABLE_JOYSTICK +extern int SDL_JoystickInit(void); +extern void SDL_JoystickQuit(void); +#endif +#ifndef DISABLE_CDROM +extern int SDL_CDROMInit(void); +extern void SDL_CDROMQuit(void); +#endif +#ifndef DISABLE_TIMERS +extern void SDL_StartTicks(void); +extern int SDL_TimerInit(void); +extern void SDL_TimerQuit(void); +#endif + +/* The current SDL version */ +static SDL_version version = + { SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL }; + +/* The initialized subsystems */ +static Uint32 SDL_initialized = 0; +static Uint32 ticks_started = 0; + +#ifdef CHECK_LEAKS +int surfaces_allocated = 0; +#endif + +int SDL_InitSubSystem(Uint32 flags) +{ +#ifndef DISABLE_VIDEO + /* Initialize the video/event subsystem */ + if ( (flags & SDL_INIT_VIDEO) && !(SDL_initialized & SDL_INIT_VIDEO) ) { + if ( SDL_VideoInit(getenv("SDL_VIDEODRIVER"), + (flags&SDL_INIT_EVENTTHREAD)) < 0 ) { + return(-1); + } + SDL_initialized |= SDL_INIT_VIDEO; + } +#else + if ( flags & SDL_INIT_VIDEO ) { + SDL_SetError("SDL not built with video support"); + return(-1); + } +#endif + +#ifndef DISABLE_AUDIO + /* Initialize the audio subsystem */ + if ( (flags & SDL_INIT_AUDIO) && !(SDL_initialized & SDL_INIT_AUDIO) ) { + if ( SDL_AudioInit(getenv("SDL_AUDIODRIVER")) < 0 ) { + return(-1); + } + SDL_initialized |= SDL_INIT_AUDIO; + } +#else + if ( flags & SDL_INIT_AUDIO ) { + SDL_SetError("SDL not built with audio support"); + return(-1); + } +#endif + +#ifndef DISABLE_TIMERS + /* Initialize the timer subsystem */ + if ( ! ticks_started ) { + SDL_StartTicks(); + ticks_started = 1; + } + if ( (flags & SDL_INIT_TIMER) && !(SDL_initialized & SDL_INIT_TIMER) ) { + if ( SDL_TimerInit() < 0 ) { + return(-1); + } + SDL_initialized |= SDL_INIT_TIMER; + } +#else + if ( flags & SDL_INIT_TIMER ) { + SDL_SetError("SDL not built with timer support"); + return(-1); + } +#endif + +#ifndef DISABLE_JOYSTICK + /* Initialize the joystick subsystem */ + if ( (flags & SDL_INIT_JOYSTICK) && + !(SDL_initialized & SDL_INIT_JOYSTICK) ) { + if ( SDL_JoystickInit() < 0 ) { + return(-1); + } + SDL_initialized |= SDL_INIT_JOYSTICK; + } +#else + if ( flags & SDL_INIT_JOYSTICK ) { + SDL_SetError("SDL not built with joystick support"); + return(-1); + } +#endif + +#ifndef DISABLE_CDROM + /* Initialize the CD-ROM subsystem */ + if ( (flags & SDL_INIT_CDROM) && !(SDL_initialized & SDL_INIT_CDROM) ) { + if ( SDL_CDROMInit() < 0 ) { + return(-1); + } + SDL_initialized |= SDL_INIT_CDROM; + } +#else + if ( flags & SDL_INIT_CDROM ) { + SDL_SetError("SDL not built with cdrom support"); + return(-1); + } +#endif + return(0); +} + +int SDL_Init(Uint32 flags) +{ + /* Clear the error message */ + SDL_ClearError(); + + /* Initialize the desired subsystems */ + if ( SDL_InitSubSystem(flags) < 0 ) { + return(-1); + } + + /* Everything is initialized */ + if ( !(flags & SDL_INIT_NOPARACHUTE) ) { + SDL_InstallParachute(); + } + return(0); +} + +void SDL_QuitSubSystem(Uint32 flags) +{ + /* Shut down requested initialized subsystems */ +#ifndef DISABLE_CDROM + if ( (flags & SDL_initialized & SDL_INIT_CDROM) ) { + SDL_CDROMQuit(); + SDL_initialized &= ~SDL_INIT_CDROM; + } +#endif +#ifndef DISABLE_JOYSTICK + if ( (flags & SDL_initialized & SDL_INIT_JOYSTICK) ) { + SDL_JoystickQuit(); + SDL_initialized &= ~SDL_INIT_JOYSTICK; + } +#endif +#ifndef DISABLE_TIMERS + if ( (flags & SDL_initialized & SDL_INIT_TIMER) ) { + SDL_TimerQuit(); + SDL_initialized &= ~SDL_INIT_TIMER; + } +#endif +#ifndef DISABLE_AUDIO + if ( (flags & SDL_initialized & SDL_INIT_AUDIO) ) { + SDL_AudioQuit(); + SDL_initialized &= ~SDL_INIT_AUDIO; + } +#endif +#ifndef DISABLE_VIDEO + if ( (flags & SDL_initialized & SDL_INIT_VIDEO) ) { + SDL_VideoQuit(); + SDL_initialized &= ~SDL_INIT_VIDEO; + } +#endif +} + +Uint32 SDL_WasInit(Uint32 flags) +{ + if ( ! flags ) { + flags = SDL_INIT_EVERYTHING; + } + return (SDL_initialized&flags); +} + +void SDL_Quit(void) +{ + /* Quit all subsystems */ + SDL_QuitSubSystem(SDL_INIT_EVERYTHING); + +#ifdef CHECK_LEAKS + /* Print the number of surfaces not freed */ + if ( surfaces_allocated != 0 ) { + fprintf(stderr, "SDL Warning: %d SDL surfaces extant\n", + surfaces_allocated); + } +#endif + + /* Uninstall any parachute signal handlers */ + SDL_UninstallParachute(); +} + +/* Return the library version number */ +const SDL_version * SDL_Linked_Version(void) +{ + return(&version); +} + diff -r 000000000000 -r 74212992fb08 src/SDL_error.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/SDL_error.c Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,340 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Simple error handling in SDL */ + +#include +#include +#include +#include + +#include "SDL_types.h" +#include "SDL_getenv.h" +#include "SDL_error.h" +#include "SDL_error_c.h" +#ifndef DISABLE_THREADS +#include "SDL_thread_c.h" +#endif + +#ifdef DISABLE_THREADS +/* The default (non-thread-safe) global error variable */ +static SDL_error SDL_global_error; + +#define SDL_GetErrBuf() (&SDL_global_error) +#endif /* DISABLE_THREADS */ + +#define SDL_ERRBUFIZE 1024 + +/* Private functions */ + +static void SDL_LookupString(const Uint8 *key, Uint16 *buf, int buflen) +{ + /* FIXME: Add code to lookup key in language string hash-table */ + + /* Key not found in language string hash-table */ + while ( *key && (--buflen > 0) ) { + *buf++ = *key++; + } + *buf = 0; /* NULL terminate string */ +} + +/* Public functions */ + +void SDL_SetError (const char *fmt, ...) +{ + va_list ap; + SDL_error *error; + + /* Copy in the key, mark error as valid */ + error = SDL_GetErrBuf(); + error->error = 1; + strncpy((char *)error->key, fmt, sizeof(error->key)); + error->key[sizeof(error->key)-1] = '\0'; + + va_start(ap, fmt); + error->argc = 0; + while ( *fmt ) { + if ( *fmt++ == '%' ) { + switch (*fmt++) { + case 0: /* Malformed format string.. */ + --fmt; + break; +#if 0 /* What is a character anyway? (UNICODE issues) */ + case 'c': + error->args[error->argc++].value_c = + va_arg(ap, unsigned char); + break; +#endif + case 'd': + error->args[error->argc++].value_i = + va_arg(ap, int); + break; + case 'f': + error->args[error->argc++].value_f = + va_arg(ap, double); + break; + case 'p': + error->args[error->argc++].value_ptr = + va_arg(ap, void *); + break; + case 's': + { + int index = error->argc; + strncpy((char *)error->args[index].buf, + va_arg(ap, char *), ERR_MAX_STRLEN); + error->args[index].buf[ERR_MAX_STRLEN-1] = 0; + error->argc++; + } + break; + default: + break; + } + if ( error->argc >= ERR_MAX_ARGS ) { + break; + } + } + } + va_end(ap); + + /* If we are in debug mode, print out an error message */ +#ifdef DEBUG_ERROR + fprintf(stderr, "SDL_SetError: %s\n", SDL_GetError()); +#else + if ( getenv("SDL_DEBUG") ) { + fprintf(stderr, "SDL_SetError: %s\n", SDL_GetError()); + } +#endif +} + +/* Print out an integer value to a UNICODE buffer */ +static int PrintInt(Uint16 *str, unsigned int maxlen, int value) +{ + char tmp[128]; + int len, i; + + sprintf(tmp, "%d", value); + len = 0; + if ( strlen(tmp) < maxlen ) { + for ( i=0; tmp[i]; ++i ) { + *str++ = tmp[i]; + ++len; + } + } + return(len); +} +/* Print out a double value to a UNICODE buffer */ +static int PrintDouble(Uint16 *str, unsigned int maxlen, double value) +{ + char tmp[128]; + int len, i; + + sprintf(tmp, "%f", value); + len = 0; + if ( strlen(tmp) < maxlen ) { + for ( i=0; tmp[i]; ++i ) { + *str++ = tmp[i]; + ++len; + } + } + return(len); +} +/* Print out a pointer value to a UNICODE buffer */ +static int PrintPointer(Uint16 *str, unsigned int maxlen, void *value) +{ + char tmp[128]; + int len, i; + + sprintf(tmp, "%p", value); + len = 0; + if ( strlen(tmp) < maxlen ) { + for ( i=0; tmp[i]; ++i ) { + *str++ = tmp[i]; + ++len; + } + } + return(len); +} + +/* This function has a bit more overhead than most error functions + so that it supports internationalization and thread-safe errors. +*/ +Uint16 *SDL_GetErrorMsgUNICODE(Uint16 *errstr, unsigned int maxlen) +{ + SDL_error *error; + + /* Clear the error string */ + *errstr = 0; --maxlen; + + /* Get the thread-safe error, and print it out */ + error = SDL_GetErrBuf(); + if ( error->error ) { + Uint16 translated[ERR_MAX_STRLEN], *fmt, *msg; + int len; + int argi; + + /* Print out the UNICODE error message */ + SDL_LookupString(error->key, translated, sizeof(translated)); + msg = errstr; + argi = 0; + for ( fmt=translated; *fmt && (maxlen > 0); ) { + if ( *fmt == '%' ) { + switch (fmt[1]) { + case 'S': /* Special SKIP operand */ + argi += (fmt[2] - '0'); + ++fmt; + break; + case '%': + *msg++ = '%'; + maxlen -= 1; + break; +#if 0 /* What is a character anyway? (UNICODE issues) */ + case 'c': + *msg++ = (unsigned char) + error->args[argi++].value_c; + maxlen -= 1; + break; +#endif + case 'd': + len = PrintInt(msg, maxlen, + error->args[argi++].value_i); + msg += len; + maxlen -= len; + break; + case 'f': + len = PrintDouble(msg, maxlen, + error->args[argi++].value_f); + msg += len; + maxlen -= len; + break; + case 'p': + len = PrintPointer(msg, maxlen, + error->args[argi++].value_ptr); + msg += len; + maxlen -= len; + break; + case 's': /* UNICODE string */ + { Uint16 buf[ERR_MAX_STRLEN], *str; + SDL_LookupString(error->args[argi++].buf, buf, sizeof(buf)); + str = buf; + while ( *str && (maxlen > 0) ) { + *msg++ = *str++; + maxlen -= 1; + } + } + break; + } + fmt += 2; + } else { + *msg++ = *fmt++; + maxlen -= 1; + } + } + *msg = 0; /* NULL terminate the string */ + } + return(errstr); +} + +Uint8 *SDL_GetErrorMsg(Uint8 *errstr, unsigned int maxlen) +{ + Uint16 *errstr16; + unsigned int i; + + /* Allocate the UNICODE buffer */ + errstr16 = (Uint16 *)malloc(maxlen * (sizeof *errstr16)); + if ( ! errstr16 ) { + strncpy((char *)errstr, "Out of memory", maxlen); + errstr[maxlen-1] = '\0'; + return(errstr); + } + + /* Get the error message */ + SDL_GetErrorMsgUNICODE(errstr16, maxlen); + + /* Convert from UNICODE to Latin1 encoding */ + for ( i=0; ierror = 0; +} + +/* Very common errors go here */ +void SDL_Error(SDL_errorcode code) +{ + switch (code) { + case SDL_ENOMEM: + SDL_SetError("Out of memory"); + break; + case SDL_EFREAD: + SDL_SetError("Error reading from datastream"); + break; + case SDL_EFWRITE: + SDL_SetError("Error writing to datastream"); + break; + case SDL_EFSEEK: + SDL_SetError("Error seeking in datastream"); + break; + default: + SDL_SetError("Unknown SDL error"); + break; + } +} + +#ifdef TEST_ERROR +int main(int argc, char *argv[]) +{ + char buffer[BUFSIZ+1]; + + SDL_SetError("Hi there!"); + printf("Error 1: %s\n", SDL_GetError()); + SDL_ClearError(); + memset(buffer, '1', BUFSIZ); + buffer[BUFSIZ] = 0; + SDL_SetError("This is the error: %s (%f)", buffer, 1.0); + printf("Error 2: %s\n", SDL_GetError()); + exit(0); +} +#endif diff -r 000000000000 -r 74212992fb08 src/SDL_error_c.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/SDL_error_c.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,62 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* This file defines a structure that carries language-independent + error messages +*/ + +#ifndef _SDL_error_c_h +#define _SDL_error_c_h + +#define ERR_MAX_STRLEN 128 +#define ERR_MAX_ARGS 5 + +typedef struct { + /* This is a numeric value corresponding to the current error */ + int error; + + /* This is a key used to index into a language hashtable containing + internationalized versions of the SDL error messages. If the key + is not in the hashtable, or no hashtable is available, the key is + used directly as an error message format string. + */ + unsigned char key[ERR_MAX_STRLEN]; + + /* These are the arguments for the error functions */ + int argc; + union { + void *value_ptr; +#if 0 /* What is a character anyway? (UNICODE issues) */ + unsigned char value_c; +#endif + int value_i; + double value_f; + unsigned char buf[ERR_MAX_STRLEN]; + } args[ERR_MAX_ARGS]; +} SDL_error; + +#endif /* _SDL_error_c_h */ diff -r 000000000000 -r 74212992fb08 src/SDL_fatal.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/SDL_fatal.c Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,160 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* General fatal signal handling code for SDL */ + +#ifdef NO_SIGNAL_H + +/* No signals on this platform, nothing to do.. */ + +void SDL_InstallParachute(void) +{ + return; +} + +void SDL_UninstallParachute(void) +{ + return; +} + +#else + +#include +#include +#include +#include + +#include "SDL.h" +#include "SDL_fatal.h" + +/* This installs some signal handlers for the more common fatal signals, + so that if the programmer is lazy, the app doesn't die so horribly if + the program crashes. +*/ + +static void SDL_Parachute(int sig) +{ + signal(sig, SIG_DFL); + fprintf(stderr, "Fatal signal: "); + switch (sig) { + case SIGSEGV: + fprintf(stderr, "Segmentation Fault"); + break; +#ifdef SIGBUS +#if SIGBUS != SIGSEGV + case SIGBUS: + fprintf(stderr, "Bus Error"); + break; +#endif +#endif /* SIGBUS */ +#ifdef SIGFPE + case SIGFPE: + fprintf(stderr, "Floating Point Exception"); + break; +#endif /* SIGFPE */ +#ifdef SIGQUIT + case SIGQUIT: + fprintf(stderr, "Keyboard Quit"); + break; +#endif /* SIGQUIT */ +#ifdef SIGPIPE + case SIGPIPE: + fprintf(stderr, "Broken Pipe"); + break; +#endif /* SIGPIPE */ + default: + fprintf(stderr, "# %d", sig); + break; + } + fprintf(stderr, " (SDL Parachute Deployed)\n"); + SDL_Quit(); + exit(-sig); +} + +static int SDL_fatal_signals[] = { + SIGSEGV, +#ifdef SIGBUS + SIGBUS, +#endif +#ifdef SIGFPE + SIGFPE, +#endif +#ifdef SIGQUIT + SIGQUIT, +#endif +#ifdef SIGPIPE + SIGPIPE, +#endif + 0 +}; + +void SDL_InstallParachute(void) +{ + int i; + void (*ohandler)(int); + + /* Set a handler for any fatal signal not already handled */ + for ( i=0; SDL_fatal_signals[i]; ++i ) { + ohandler = signal(SDL_fatal_signals[i], SDL_Parachute); + if ( ohandler != SIG_DFL ) { + signal(SDL_fatal_signals[i], ohandler); + } + } +#ifdef SIGALRM + /* Set SIGALRM to be ignored -- necessary on Solaris */ + { + struct sigaction action, oaction; + + /* Set SIG_IGN action */ + memset(&action, 0, (sizeof action)); + action.sa_handler = SIG_IGN; + sigaction(SIGALRM, &action, &oaction); + + /* Reset original action if it was already being handled */ + if ( oaction.sa_handler != SIG_DFL ) { + sigaction(SIGALRM, &oaction, NULL); + } + } +#endif + return; +} + +void SDL_UninstallParachute(void) +{ + int i; + void (*ohandler)(int); + + /* Remove a handler for any fatal signal handled */ + for ( i=0; SDL_fatal_signals[i]; ++i ) { + ohandler = signal(SDL_fatal_signals[i], SIG_DFL); + if ( ohandler != SDL_Parachute ) { + signal(SDL_fatal_signals[i], ohandler); + } + } +} + +#endif /* NO_SIGNAL_H */ diff -r 000000000000 -r 74212992fb08 src/SDL_fatal.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/SDL_fatal.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,32 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* General fatal signal handling code for SDL */ + +extern void SDL_InstallParachute(void); +extern void SDL_UninstallParachute(void); + diff -r 000000000000 -r 74212992fb08 src/SDL_getenv.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/SDL_getenv.c Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,171 @@ + +/* Not all environments have a working getenv()/putenv() */ + +#ifdef TEST_MAIN +#define NEED_SDL_GETENV +#endif + +#include "SDL_getenv.h" + +#ifdef NEED_SDL_GETENV + +#include +#include + +static char **SDL_env = (char **)0; + +/* Put a variable of the form "name=value" into the environment */ +int SDL_putenv(const char *variable) +{ + const char *name, *value; + int added; + int len, i; + char **new_env; + char *new_variable; + + /* A little error checking */ + if ( ! variable ) { + return(-1); + } + name = variable; + for ( value=variable; *value && (*value != '='); ++value ) { + /* Keep looking for '=' */ ; + } + if ( *value ) { + ++value; + } else { + return(-1); + } + + /* Allocate memory for the variable */ + new_variable = (char *)malloc(strlen(variable)+1); + if ( ! new_variable ) { + return(-1); + } + strcpy(new_variable, variable); + + /* Actually put it into the environment */ + added = 0; + i = 0; + if ( SDL_env ) { + /* Check to see if it's already there... */ + len = (value - name); + for ( ; SDL_env[i]; ++i ) { + if ( strncmp(SDL_env[i], name, len) == 0 ) { + break; + } + } + /* If we found it, just replace the entry */ + if ( SDL_env[i] ) { + free(SDL_env[i]); + SDL_env[i] = new_variable; + added = 1; + } + } + + /* Didn't find it in the environment, expand and add */ + if ( ! added ) { + new_env = realloc(SDL_env, (i+2)*sizeof(char *)); + if ( new_env ) { + SDL_env = new_env; + SDL_env[i++] = new_variable; + SDL_env[i++] = (char *)0; + added = 1; + } else { + free(new_variable); + } + } + return (added ? 0 : -1); +} + +/* Retrieve a variable named "name" from the environment */ +char *SDL_getenv(const char *name) +{ + int len, i; + char *value; + + value = (char *)0; + if ( SDL_env ) { + len = strlen(name); + for ( i=0; SDL_env[i] && !value; ++i ) { + if ( (strncmp(SDL_env[i], name, len) == 0) && + (SDL_env[i][len] == '=') ) { + value = &SDL_env[i][len+1]; + } + } + } + return value; +} + +#endif /* NEED_GETENV */ + +#ifdef TEST_MAIN +#include + +int main(int argc, char *argv[]) +{ + char *value; + + printf("Checking for non-existent variable... "); + fflush(stdout); + if ( ! getenv("EXISTS") ) { + printf("okay\n"); + } else { + printf("failed\n"); + } + printf("Setting FIRST=VALUE1 in the environment... "); + fflush(stdout); + if ( putenv("FIRST=VALUE1") == 0 ) { + printf("okay\n"); + } else { + printf("failed\n"); + } + printf("Getting FIRST from the environment... "); + fflush(stdout); + value = getenv("FIRST"); + if ( value && (strcmp(value, "VALUE1") == 0) ) { + printf("okay\n"); + } else { + printf("failed\n"); + } + printf("Setting SECOND=VALUE2 in the environment... "); + fflush(stdout); + if ( putenv("SECOND=VALUE2") == 0 ) { + printf("okay\n"); + } else { + printf("failed\n"); + } + printf("Getting SECOND from the environment... "); + fflush(stdout); + value = getenv("SECOND"); + if ( value && (strcmp(value, "VALUE2") == 0) ) { + printf("okay\n"); + } else { + printf("failed\n"); + } + printf("Setting FIRST=NOVALUE in the environment... "); + fflush(stdout); + if ( putenv("FIRST=NOVALUE") == 0 ) { + printf("okay\n"); + } else { + printf("failed\n"); + } + printf("Getting FIRST from the environment... "); + fflush(stdout); + value = getenv("FIRST"); + if ( value && (strcmp(value, "NOVALUE") == 0) ) { + printf("okay\n"); + } else { + printf("failed\n"); + } + printf("Checking for non-existent variable... "); + fflush(stdout); + if ( ! getenv("EXISTS") ) { + printf("okay\n"); + } else { + printf("failed\n"); + } + return(0); +} +#endif /* TEST_MAIN */ + diff -r 000000000000 -r 74212992fb08 src/audio/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/.cvsignore Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,6 @@ +Makefile.in +Makefile +.libs +*.o +*.lo +*.la diff -r 000000000000 -r 74212992fb08 src/audio/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/Makefile.am Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,29 @@ + +## Makefile.am for the SDL audio library + +noinst_LTLIBRARIES = libaudio.la + +# Define which subdirectories need to be built +SUBDIRS = @AUDIO_SUBDIRS@ +DIST_SUBDIRS = alsa arts baudio dma dmedia dsp esd macrom nas nto \ + paudio sun ums windib windx5 + +DRIVERS = @AUDIO_DRIVERS@ + +# Include the architecture-independent sources +COMMON_SRCS = \ + SDL_audio.c \ + SDL_audio_c.h \ + SDL_audiocvt.c \ + SDL_audiodev.c \ + SDL_audiodev_c.h \ + SDL_audiomem.c \ + SDL_audiomem.h \ + SDL_mixer.c \ + SDL_sysaudio.h \ + SDL_wave.c \ + SDL_wave.h + +libaudio_la_SOURCES = $(COMMON_SRCS) +libaudio_la_LIBADD = $(DRIVERS) +libaudio_la_DEPENDENCIES = $(DRIVERS) diff -r 000000000000 -r 74212992fb08 src/audio/SDL_audio.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/SDL_audio.c Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,516 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Allow access to a raw mixing buffer */ +#include +#include +#include + +#include "SDL.h" +#include "SDL_audio.h" +#include "SDL_timer.h" +#include "SDL_error.h" +#include "SDL_audio_c.h" +#include "SDL_audiomem.h" +#include "SDL_sysaudio.h" + +/* Available audio drivers */ +static AudioBootStrap *bootstrap[] = { +#if defined(unix) && \ + !defined(linux) && !defined(__FreeBSD__) && !defined(__CYGWIN32__) \ + && !defined(__bsdi__) + &AUDIO_bootstrap, +#endif +#ifdef OSS_SUPPORT + &DSP_bootstrap, + &DMA_bootstrap, +#endif +#ifdef ALSA_SUPPORT + &ALSA_bootstrap, +#endif +#ifdef ARTSC_SUPPORT + &ARTSC_bootstrap, +#endif +#ifdef ESD_SUPPORT + &ESD_bootstrap, +#endif +#ifdef NAS_SUPPORT + &NAS_bootstrap, +#endif +#ifdef ENABLE_DIRECTX + &DSOUND_bootstrap, +#endif +#ifdef ENABLE_WINDIB + &WAVEOUT_bootstrap, +#endif +#ifdef __BEOS__ + &BAUDIO_bootstrap, +#endif +#if defined(macintosh) || TARGET_API_MAC_CARBON + &SNDMGR_bootstrap, +#endif +#ifdef _AIX + &Paud_bootstrap, +#endif + NULL +}; +SDL_AudioDevice *current_audio = NULL; + +/* Various local functions */ +int SDL_AudioInit(const char *driver_name); +void SDL_AudioQuit(void); + + +/* The general mixing thread function */ +int SDL_RunAudio(void *audiop) +{ + SDL_AudioDevice *audio = (SDL_AudioDevice *)audiop; + Uint8 *stream; + int stream_len; + void *udata; + void (*fill)(void *userdata,Uint8 *stream, int len); + int silence; + + /* Perform any thread setup */ + if ( audio->ThreadInit ) { + audio->ThreadInit(audio); + } + audio->threadid = SDL_ThreadID(); + + /* Set up the mixing function */ + fill = audio->spec.callback; + udata = audio->spec.userdata; + if ( audio->convert.needed ) { + if ( audio->convert.src_format == AUDIO_U8 ) { + silence = 0x80; + } else { + silence = 0; + } + stream_len = audio->convert.len; + } else { + silence = audio->spec.silence; + stream_len = audio->spec.size; + } + stream = audio->fake_stream; + + /* Loop, filling the audio buffers */ + while ( audio->enabled ) { + + /* Wait for new current buffer to finish playing */ + if ( stream == audio->fake_stream ) { + SDL_Delay((audio->spec.samples*1000)/audio->spec.freq); + } else { + audio->WaitAudio(audio); + } + + /* Fill the current buffer with sound */ + if ( audio->convert.needed ) { + /* The buffer may not be allocated yet */ + if ( audio->convert.buf ) { + stream = audio->convert.buf; + } else { + continue; + } + } else { + stream = audio->GetAudioBuf(audio); + if ( stream == NULL ) { + stream = audio->fake_stream; + } + } + memset(stream, silence, stream_len); + + if ( ! audio->paused ) { + SDL_mutexP(audio->mixer_lock); + (*fill)(udata, stream, stream_len); + SDL_mutexV(audio->mixer_lock); + } + + /* Convert the audio if necessary */ + if ( audio->convert.needed ) { + SDL_ConvertAudio(&audio->convert); + stream = audio->GetAudioBuf(audio); + if ( stream == NULL ) { + stream = audio->fake_stream; + } + memcpy(stream, audio->convert.buf, + audio->convert.len_cvt); + } + + /* Ready current buffer for play and change current buffer */ + if ( stream != audio->fake_stream ) { + audio->PlayAudio(audio); + } + } + /* Wait for the audio to drain.. */ + if ( audio->WaitDone ) { + audio->WaitDone(audio); + } + return(0); +} + +int SDL_AudioInit(const char *driver_name) +{ + SDL_AudioDevice *audio; + int i = 0, idx; + + /* Check to make sure we don't overwrite 'current_audio' */ + if ( current_audio != NULL ) { + SDL_AudioQuit(); + } + + /* Select the proper audio driver */ + audio = NULL; + idx = 0; +#ifdef unix + if ( (driver_name == NULL) && (getenv("ESPEAKER") != NULL) ) { + /* Ahem, we know that if ESPEAKER is set, user probably wants + to use ESD, but don't start it if it's not already running. + This probably isn't the place to do this, but... Shh! :) + */ + for ( i=0; bootstrap[i]; ++i ) { + if ( strcmp(bootstrap[i]->name, "esd") == 0 ) { + const char *esd_no_spawn; + + /* Don't start ESD if it's not running */ + esd_no_spawn = getenv("ESD_NO_SPAWN"); + if ( esd_no_spawn == NULL ) { + putenv("ESD_NO_SPAWN=1"); + } + if ( bootstrap[i]->available() ) { + audio = bootstrap[i]->create(0); + break; + } +#ifdef linux /* No unsetenv() on most platforms */ + if ( esd_no_spawn == NULL ) { + unsetenv("ESD_NO_SPAWN"); + } +#endif + } + } + } +#endif /* unix */ + if ( audio == NULL ) { + if ( driver_name != NULL ) { +#if 0 /* This will be replaced with a better driver selection API */ + if ( strrchr(driver_name, ':') != NULL ) { + idx = atoi(strrchr(driver_name, ':')+1); + } +#endif + for ( i=0; bootstrap[i]; ++i ) { + if (strncmp(bootstrap[i]->name, driver_name, + strlen(bootstrap[i]->name)) == 0) { + if ( bootstrap[i]->available() ) { + audio=bootstrap[i]->create(idx); + break; + } + } + } + } else { + for ( i=0; bootstrap[i]; ++i ) { + if ( bootstrap[i]->available() ) { + audio = bootstrap[i]->create(idx); + if ( audio != NULL ) { + break; + } + } + } + } + if ( audio == NULL ) { + SDL_SetError("No available audio device"); +#if 0 /* Don't fail SDL_Init() if audio isn't available. + SDL_OpenAudio() will handle it at that point. *sigh* + */ + return(-1); +#endif + } + } + current_audio = audio; + if ( current_audio ) { + current_audio->name = bootstrap[i]->name; + } + return(0); +} + +char *SDL_AudioDriverName(char *namebuf, int maxlen) +{ + if ( current_audio != NULL ) { + strncpy(namebuf, current_audio->name, maxlen-1); + namebuf[maxlen-1] = '\0'; + return(namebuf); + } + return(NULL); +} + +int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained) +{ + SDL_AudioDevice *audio; + + /* Start up the audio driver, if necessary */ + if ( ! current_audio ) { + if ( (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) || + (current_audio == NULL) ) { + return(-1); + } + } + audio = current_audio; + + /* Verify some parameters */ + if ( desired->callback == NULL ) { + SDL_SetError("SDL_OpenAudio() passed a NULL callback"); + return(-1); + } + switch ( desired->channels ) { + case 1: /* Mono */ + case 2: /* Stereo */ + break; + default: + SDL_SetError("1 (mono) and 2 (stereo) channels supported"); + return(-1); + } + +#ifdef macintosh + /* FIXME: Need to implement PPC interrupt asm for SDL_LockAudio() */ +#else + /* Create a semaphore for locking the sound buffers */ + audio->mixer_lock = SDL_CreateMutex(); + if ( audio->mixer_lock == NULL ) { + SDL_SetError("Couldn't create mixer lock"); + SDL_CloseAudio(); + return(-1); + } +#endif + + /* Calculate the silence and size of the audio specification */ + SDL_CalculateAudioSpec(desired); + + /* Open the audio subsystem */ + memcpy(&audio->spec, desired, sizeof(audio->spec)); + audio->convert.needed = 0; + audio->enabled = 1; + audio->paused = 1; + audio->opened = audio->OpenAudio(audio, &audio->spec)+1; + if ( ! audio->opened ) { + SDL_CloseAudio(); + return(-1); + } + + /* If the audio driver changes the buffer size, accept it */ + if ( audio->spec.samples != desired->samples ) { + desired->samples = audio->spec.samples; + SDL_CalculateAudioSpec(desired); + } + + /* Allocate a fake audio memory buffer */ + audio->fake_stream = SDL_AllocAudioMem(audio->spec.size); + if ( audio->fake_stream == NULL ) { + SDL_CloseAudio(); + SDL_OutOfMemory(); + return(-1); + } + + /* See if we need to do any conversion */ + if ( memcmp(desired, &audio->spec, sizeof(audio->spec)) == 0 ) { + /* Just copy over the desired audio specification */ + if ( obtained != NULL ) { + memcpy(obtained, &audio->spec, sizeof(audio->spec)); + } + } else { + /* Copy over the audio specification if possible */ + if ( obtained != NULL ) { + memcpy(obtained, &audio->spec, sizeof(audio->spec)); + } else { + /* Build an audio conversion block */ + if ( SDL_BuildAudioCVT(&audio->convert, + desired->format, desired->channels, + desired->freq, + audio->spec.format, audio->spec.channels, + audio->spec.freq) < 0 ) { + SDL_CloseAudio(); + return(-1); + } + if ( audio->convert.needed ) { + audio->convert.len = desired->size; + audio->convert.buf =(Uint8 *)SDL_AllocAudioMem( + audio->convert.len*audio->convert.len_mult); + if ( audio->convert.buf == NULL ) { + SDL_CloseAudio(); + SDL_OutOfMemory(); + return(-1); + } + } + } + } + + /* Start the audio thread if necessary */ + switch (audio->opened) { + case 1: + /* Start the audio thread */ + audio->thread = SDL_CreateThread(SDL_RunAudio, audio); + if ( audio->thread == NULL ) { + SDL_CloseAudio(); + SDL_SetError("Couldn't create audio thread"); + return(-1); + } + break; + + default: + /* The audio is now playing */ + break; + } + return(0); +} + +SDL_audiostatus SDL_GetAudioStatus(void) +{ + SDL_AudioDevice *audio = current_audio; + SDL_audiostatus status; + + status = SDL_AUDIO_STOPPED; + if ( audio && audio->enabled ) { + if ( audio->paused ) { + status = SDL_AUDIO_PAUSED; + } else { + status = SDL_AUDIO_PLAYING; + } + } + return(status); +} + +void SDL_PauseAudio (int pause_on) +{ + SDL_AudioDevice *audio = current_audio; + + if ( audio ) { + audio->paused = pause_on; + } +} + +void SDL_LockAudio (void) +{ + SDL_AudioDevice *audio = current_audio; + + /* Obtain a lock on the mixing buffers */ + if ( audio ) { + if ( audio->thread && (SDL_ThreadID() == audio->threadid) ) { + return; + } + SDL_mutexP(audio->mixer_lock); + } +} + +void SDL_UnlockAudio (void) +{ + SDL_AudioDevice *audio = current_audio; + + /* Release lock on the mixing buffers */ + if ( audio ) { + if ( audio->thread && (SDL_ThreadID() == audio->threadid) ) { + return; + } + SDL_mutexV(audio->mixer_lock); + } +} + +void SDL_CloseAudio (void) +{ + SDL_QuitSubSystem(SDL_INIT_AUDIO); +} + +void SDL_AudioQuit(void) +{ + SDL_AudioDevice *audio = current_audio; + + if ( audio ) { + audio->enabled = 0; + if ( audio->thread != NULL ) { + SDL_WaitThread(audio->thread, NULL); + } + if ( audio->mixer_lock != NULL ) { + SDL_DestroyMutex(audio->mixer_lock); + } + if ( audio->fake_stream != NULL ) { + SDL_FreeAudioMem(audio->fake_stream); + } + if ( audio->convert.needed ) { + SDL_FreeAudioMem(audio->convert.buf); + } + if ( audio->opened ) { + audio->CloseAudio(audio); + audio->opened = 0; + } + + /* Free the driver data */ + audio->free(audio); + current_audio = NULL; + } +} + +#define NUM_FORMATS 6 +static int format_idx; +static int format_idx_sub; +static Uint16 format_list[NUM_FORMATS][NUM_FORMATS] = { + { AUDIO_U8, AUDIO_S8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB }, + { AUDIO_S8, AUDIO_U8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB }, + { AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_U8, AUDIO_S8 }, + { AUDIO_S16MSB, AUDIO_S16LSB, AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_U8, AUDIO_S8 }, + { AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U8, AUDIO_S8 }, + { AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_S16MSB, AUDIO_S16LSB, AUDIO_U8, AUDIO_S8 }, +}; + +Uint16 SDL_FirstAudioFormat(Uint16 format) +{ + for ( format_idx=0; format_idx < NUM_FORMATS; ++format_idx ) { + if ( format_list[format_idx][0] == format ) { + break; + } + } + format_idx_sub = 0; + return(SDL_NextAudioFormat()); +} + +Uint16 SDL_NextAudioFormat(void) +{ + if ( (format_idx == NUM_FORMATS) || (format_idx_sub == NUM_FORMATS) ) { + return(0); + } + return(format_list[format_idx][format_idx_sub++]); +} + +void SDL_CalculateAudioSpec(SDL_AudioSpec *spec) +{ + switch (spec->format) { + case AUDIO_U8: + spec->silence = 0x80; + break; + default: + spec->silence = 0x00; + break; + } + spec->size = (spec->format&0xFF)/8; + spec->size *= spec->channels; + spec->size *= spec->samples; +} diff -r 000000000000 -r 74212992fb08 src/audio/SDL_audio_c.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/SDL_audio_c.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,38 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Functions and variables exported from SDL_audio.c for SDL_sysaudio.c */ + +/* Functions to get a list of "close" audio formats */ +extern Uint16 SDL_FirstAudioFormat(Uint16 format); +extern Uint16 SDL_NextAudioFormat(void); + +/* Function to calculate the size and silence for a SDL_AudioSpec */ +extern void SDL_CalculateAudioSpec(SDL_AudioSpec *spec); + +/* The actual mixing thread function */ +extern int SDL_RunAudio(void *audiop); diff -r 000000000000 -r 74212992fb08 src/audio/SDL_audiocvt.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/SDL_audiocvt.c Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,642 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Functions for audio drivers to perform runtime conversion of audio format */ + +#include + +#include "SDL_error.h" +#include "SDL_audio.h" + + +/* Effectively mix right and left channels into a single channel */ +void SDL_ConvertMono(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Sint32 sample; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting to mono\n"); +#endif + switch (format&0x8018) { + + case AUDIO_U8: { + Uint8 *src, *dst; + + src = cvt->buf; + dst = cvt->buf; + for ( i=cvt->len_cvt/2; i; --i ) { + sample = src[0] + src[1]; + if ( sample > 255 ) { + *dst = 255; + } else { + *dst = sample; + } + src += 2; + dst += 1; + } + } + break; + + case AUDIO_S8: { + Sint8 *src, *dst; + + src = (Sint8 *)cvt->buf; + dst = (Sint8 *)cvt->buf; + for ( i=cvt->len_cvt/2; i; --i ) { + sample = src[0] + src[1]; + if ( sample > 127 ) { + *dst = 127; + } else + if ( sample < -128 ) { + *dst = -128; + } else { + *dst = sample; + } + src += 2; + dst += 1; + } + } + break; + + case AUDIO_U16: { + Uint8 *src, *dst; + + src = cvt->buf; + dst = cvt->buf; + if ( (format & 0x1000) == 0x1000 ) { + for ( i=cvt->len_cvt/4; i; --i ) { + sample = (Uint16)((src[0]<<8)|src[1])+ + (Uint16)((src[2]<<8)|src[3]); + if ( sample > 65535 ) { + dst[0] = 0xFF; + dst[1] = 0xFF; + } else { + dst[1] = (sample&0xFF); + sample >>= 8; + dst[0] = (sample&0xFF); + } + src += 4; + dst += 2; + } + } else { + for ( i=cvt->len_cvt/4; i; --i ) { + sample = (Uint16)((src[1]<<8)|src[0])+ + (Uint16)((src[3]<<8)|src[2]); + if ( sample > 65535 ) { + dst[0] = 0xFF; + dst[1] = 0xFF; + } else { + dst[0] = (sample&0xFF); + sample >>= 8; + dst[1] = (sample&0xFF); + } + src += 4; + dst += 2; + } + } + } + break; + + case AUDIO_S16: { + Uint8 *src, *dst; + + src = cvt->buf; + dst = cvt->buf; + if ( (format & 0x1000) == 0x1000 ) { + for ( i=cvt->len_cvt/4; i; --i ) { + sample = (Sint16)((src[0]<<8)|src[1])+ + (Sint16)((src[2]<<8)|src[3]); + if ( sample > 32767 ) { + dst[0] = 0x7F; + dst[1] = 0xFF; + } else + if ( sample < -32768 ) { + dst[0] = 0x80; + dst[1] = 0x00; + } else { + dst[1] = (sample&0xFF); + sample >>= 8; + dst[0] = (sample&0xFF); + } + src += 4; + dst += 2; + } + } else { + for ( i=cvt->len_cvt/4; i; --i ) { + sample = (Sint16)((src[1]<<8)|src[0])+ + (Sint16)((src[3]<<8)|src[2]); + if ( sample > 32767 ) { + dst[1] = 0x7F; + dst[0] = 0xFF; + } else + if ( sample < -32768 ) { + dst[1] = 0x80; + dst[0] = 0x00; + } else { + dst[0] = (sample&0xFF); + sample >>= 8; + dst[1] = (sample&0xFF); + } + src += 4; + dst += 2; + } + } + } + break; + } + cvt->len_cvt /= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + + +/* Duplicate a mono channel to both stereo channels */ +void SDL_ConvertStereo(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting to stereo\n"); +#endif + if ( (format & 0xFF) == 16 ) { + Uint16 *src, *dst; + + src = (Uint16 *)(cvt->buf+cvt->len_cvt); + dst = (Uint16 *)(cvt->buf+cvt->len_cvt*2); + for ( i=cvt->len_cvt/2; i; --i ) { + dst -= 2; + src -= 1; + dst[0] = src[0]; + dst[1] = src[0]; + } + } else { + Uint8 *src, *dst; + + src = cvt->buf+cvt->len_cvt; + dst = cvt->buf+cvt->len_cvt*2; + for ( i=cvt->len_cvt; i; --i ) { + dst -= 2; + src -= 1; + dst[0] = src[0]; + dst[1] = src[0]; + } + } + cvt->len_cvt *= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +/* Convert 8-bit to 16-bit - LSB */ +void SDL_Convert16LSB(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Uint8 *src, *dst; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting to 16-bit LSB\n"); +#endif + src = cvt->buf+cvt->len_cvt; + dst = cvt->buf+cvt->len_cvt*2; + for ( i=cvt->len_cvt; i; --i ) { + src -= 1; + dst -= 2; + dst[1] = *src; + dst[0] = 0; + } + format = ((format & ~0x0008) | AUDIO_U16LSB); + cvt->len_cvt *= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} +/* Convert 8-bit to 16-bit - MSB */ +void SDL_Convert16MSB(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Uint8 *src, *dst; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting to 16-bit MSB\n"); +#endif + src = cvt->buf+cvt->len_cvt; + dst = cvt->buf+cvt->len_cvt*2; + for ( i=cvt->len_cvt; i; --i ) { + src -= 1; + dst -= 2; + dst[0] = *src; + dst[1] = 0; + } + format = ((format & ~0x0008) | AUDIO_U16MSB); + cvt->len_cvt *= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +/* Convert 16-bit to 8-bit */ +void SDL_Convert8(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Uint8 *src, *dst; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting to 8-bit\n"); +#endif + src = cvt->buf; + dst = cvt->buf; + if ( (format & 0x1000) != 0x1000 ) { /* Little endian */ + ++src; + } + for ( i=cvt->len_cvt/2; i; --i ) { + *dst = *src; + src += 2; + dst += 1; + } + format = ((format & ~0x9010) | AUDIO_U8); + cvt->len_cvt /= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +/* Toggle signed/unsigned */ +void SDL_ConvertSign(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Uint8 *data; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting audio signedness\n"); +#endif + data = cvt->buf; + if ( (format & 0xFF) == 16 ) { + if ( (format & 0x1000) != 0x1000 ) { /* Little endian */ + ++data; + } + for ( i=cvt->len_cvt/2; i; --i ) { + *data ^= 0x80; + data += 2; + } + } else { + for ( i=cvt->len_cvt; i; --i ) { + *data++ ^= 0x80; + } + } + format = (format ^ 0x8000); + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +/* Toggle endianness */ +void SDL_ConvertEndian(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Uint8 *data, tmp; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting audio endianness\n"); +#endif + data = cvt->buf; + for ( i=cvt->len_cvt/2; i; --i ) { + tmp = data[0]; + data[0] = data[1]; + data[1] = tmp; + data += 2; + } + format = (format ^ 0x1000); + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +/* Convert rate up by multiple of 2 */ +void SDL_RateMUL2(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Uint8 *src, *dst; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting audio rate * 2\n"); +#endif + src = cvt->buf+cvt->len_cvt; + dst = cvt->buf+cvt->len_cvt*2; + switch (format & 0xFF) { + case 8: + for ( i=cvt->len_cvt; i; --i ) { + src -= 1; + dst -= 2; + dst[0] = src[0]; + dst[1] = src[0]; + } + break; + case 16: + for ( i=cvt->len_cvt/2; i; --i ) { + src -= 2; + dst -= 4; + dst[0] = src[0]; + dst[1] = src[1]; + dst[2] = src[0]; + dst[3] = src[1]; + } + break; + } + cvt->len_cvt *= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +/* Convert rate down by multiple of 2 */ +void SDL_RateDIV2(SDL_AudioCVT *cvt, Uint16 format) +{ + int i; + Uint8 *src, *dst; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting audio rate / 2\n"); +#endif + src = cvt->buf; + dst = cvt->buf; + switch (format & 0xFF) { + case 8: + for ( i=cvt->len_cvt/2; i; --i ) { + dst[0] = src[0]; + src += 2; + dst += 1; + } + break; + case 16: + for ( i=cvt->len_cvt/4; i; --i ) { + dst[0] = src[0]; + dst[1] = src[1]; + src += 4; + dst += 2; + } + break; + } + cvt->len_cvt /= 2; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +/* Very slow rate conversion routine */ +void SDL_RateSLOW(SDL_AudioCVT *cvt, Uint16 format) +{ + double ipos; + int i, clen; + +#ifdef DEBUG_CONVERT + fprintf(stderr, "Converting audio rate * %4.4f\n", 1.0/cvt->rate_incr); +#endif + clen = (int)((double)cvt->len_cvt / cvt->rate_incr); + if ( cvt->rate_incr > 1.0 ) { + switch (format & 0xFF) { + case 8: { + Uint8 *output; + + output = cvt->buf; + ipos = 0.0; + for ( i=clen; i; --i ) { + *output = cvt->buf[(int)ipos]; + ipos += cvt->rate_incr; + output += 1; + } + } + break; + + case 16: { + Uint16 *output; + + clen &= ~1; + output = (Uint16 *)cvt->buf; + ipos = 0.0; + for ( i=clen/2; i; --i ) { + *output=((Uint16 *)cvt->buf)[(int)ipos]; + ipos += cvt->rate_incr; + output += 1; + } + } + break; + } + } else { + switch (format & 0xFF) { + case 8: { + Uint8 *output; + + output = cvt->buf+clen; + ipos = (double)cvt->len_cvt; + for ( i=clen; i; --i ) { + ipos -= cvt->rate_incr; + output -= 1; + *output = cvt->buf[(int)ipos]; + } + } + break; + + case 16: { + Uint16 *output; + + clen &= ~1; + output = (Uint16 *)(cvt->buf+clen); + ipos = (double)cvt->len_cvt/2; + for ( i=clen/2; i; --i ) { + ipos -= cvt->rate_incr; + output -= 1; + *output=((Uint16 *)cvt->buf)[(int)ipos]; + } + } + break; + } + } + cvt->len_cvt = clen; + if ( cvt->filters[++cvt->filter_index] ) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +int SDL_ConvertAudio(SDL_AudioCVT *cvt) +{ + /* Make sure there's data to convert */ + if ( cvt->buf == NULL ) { + SDL_SetError("No buffer allocated for conversion"); + return(-1); + } + /* Return okay if no conversion is necessary */ + cvt->len_cvt = cvt->len; + if ( cvt->filters[0] == NULL ) { + return(0); + } + + /* Set up the conversion and go! */ + cvt->filter_index = 0; + cvt->filters[0](cvt, cvt->src_format); + return(0); +} + +/* Creates a set of audio filters to convert from one format to another. + Returns -1 if the format conversion is not supported, or 1 if the + audio filter is set up. +*/ + +int SDL_BuildAudioCVT(SDL_AudioCVT *cvt, + Uint16 src_format, Uint8 src_channels, int src_rate, + Uint16 dst_format, Uint8 dst_channels, int dst_rate) +{ + /* Start off with no conversion necessary */ + cvt->needed = 0; + cvt->filter_index = 0; + cvt->filters[0] = NULL; + cvt->len_mult = 1; + cvt->len_ratio = 1.0; + + /* First filter: Endian conversion from src to dst */ + if ( (src_format & 0x1000) != (dst_format & 0x1000) + && ((src_format & 0xff) != 8) ) { + cvt->filters[cvt->filter_index++] = SDL_ConvertEndian; + } + + /* Second filter: Sign conversion -- signed/unsigned */ + if ( (src_format & 0x8000) != (dst_format & 0x8000) ) { + cvt->filters[cvt->filter_index++] = SDL_ConvertSign; + } + + /* Next filter: Convert 16 bit <--> 8 bit PCM */ + if ( (src_format & 0xFF) != (dst_format & 0xFF) ) { + switch (dst_format&0x10FF) { + case AUDIO_U8: + cvt->filters[cvt->filter_index++] = + SDL_Convert8; + cvt->len_ratio /= 2; + break; + case AUDIO_U16LSB: + cvt->filters[cvt->filter_index++] = + SDL_Convert16LSB; + cvt->len_mult *= 2; + cvt->len_ratio *= 2; + break; + case AUDIO_U16MSB: + cvt->filters[cvt->filter_index++] = + SDL_Convert16MSB; + cvt->len_mult *= 2; + cvt->len_ratio *= 2; + break; + } + } + + /* Last filter: Mono/Stereo conversion */ + if ( src_channels != dst_channels ) { + while ( (src_channels*2) <= dst_channels ) { + cvt->filters[cvt->filter_index++] = + SDL_ConvertStereo; + cvt->len_mult *= 2; + src_channels *= 2; + cvt->len_ratio *= 2; + } + /* This assumes that 4 channel audio is in the format: + Left {front/back} + Right {front/back} + so converting to L/R stereo works properly. + */ + while ( ((src_channels%2) == 0) && + ((src_channels/2) >= dst_channels) ) { + cvt->filters[cvt->filter_index++] = + SDL_ConvertMono; + src_channels /= 2; + cvt->len_ratio /= 2; + } + if ( src_channels != dst_channels ) { + /* Uh oh.. */; + } + } + + /* Do rate conversion */ + cvt->rate_incr = 0.0; + if ( (src_rate/100) != (dst_rate/100) ) { + Uint32 hi_rate, lo_rate; + int len_mult; + double len_ratio; + void (*rate_cvt)(SDL_AudioCVT *cvt, Uint16 format); + + if ( src_rate > dst_rate ) { + hi_rate = src_rate; + lo_rate = dst_rate; + rate_cvt = SDL_RateDIV2; + len_mult = 1; + len_ratio = 0.5; + } else { + hi_rate = dst_rate; + lo_rate = src_rate; + rate_cvt = SDL_RateMUL2; + len_mult = 2; + len_ratio = 2.0; + } + /* If hi_rate = lo_rate*2^x then conversion is easy */ + while ( ((lo_rate*2)/100) <= (hi_rate/100) ) { + cvt->filters[cvt->filter_index++] = rate_cvt; + cvt->len_mult *= len_mult; + lo_rate *= 2; + cvt->len_ratio *= len_ratio; + } + /* We may need a slow conversion here to finish up */ + if ( (lo_rate/100) != (hi_rate/100) ) { +#if 1 + /* The problem with this is that if the input buffer is + say 1K, and the conversion rate is say 1.1, then the + output buffer is 1.1K, which may not be an acceptable + buffer size for the audio driver (not a power of 2) + */ + /* For now, punt and hope the rate distortion isn't great. + */ +#else + if ( src_rate < dst_rate ) { + cvt->rate_incr = (double)lo_rate/hi_rate; + cvt->len_mult *= 2; + cvt->len_ratio /= cvt->rate_incr; + } else { + cvt->rate_incr = (double)hi_rate/lo_rate; + cvt->len_ratio *= cvt->rate_incr; + } + cvt->filters[cvt->filter_index++] = SDL_RateSLOW; +#endif + } + } + + /* Set up the filter information */ + if ( cvt->filter_index != 0 ) { + cvt->needed = 1; + cvt->src_format = src_format; + cvt->dst_format = dst_format; + cvt->len = 0; + cvt->buf = NULL; + cvt->filters[cvt->filter_index] = NULL; + } + return(cvt->needed); +} diff -r 000000000000 -r 74212992fb08 src/audio/SDL_audiodev.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/SDL_audiodev.c Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,182 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Get the name of the audio device we use for output */ + +#if defined(unix) || defined(__unix__) + +#include +#include +#include +#include +#include +#include + +#include "SDL_audiodev_c.h" + +#ifndef _PATH_DEV_DSP +#define _PATH_DEV_DSP "/dev/dsp" +#endif +#ifndef _PATH_DEV_DSP24 +#define _PATH_DEV_DSP24 "/dev/sound/dsp" +#endif +#ifndef _PATH_DEV_AUDIO +#define _PATH_DEV_AUDIO "/dev/audio" +#endif + + +int SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic) +{ + const char *audiodev; + int audio_fd; + char audiopath[1024]; + + /* Figure out what our audio device is */ + if ( ((audiodev=getenv("SDL_PATH_DSP")) == NULL) && + ((audiodev=getenv("AUDIODEV")) == NULL) ) { + if ( classic ) { + audiodev = _PATH_DEV_AUDIO; + } else { + struct stat sb; + + /* Added support for /dev/sound/\* in Linux 2.4 */ + if ( (stat("/dev/sound", &sb) == 0) && + S_ISDIR(sb.st_mode) ) { + audiodev = _PATH_DEV_DSP24; + } else { + audiodev = _PATH_DEV_DSP; + } + } + } + audio_fd = open(audiodev, flags, 0); + + /* If the first open fails, look for other devices */ + if ( (audio_fd < 0) && (strlen(audiodev) < (sizeof(audiopath)-3)) ) { + int exists, instance; + struct stat sb; + + instance = 1; + do { /* Don't use errno ENOENT - it may not be thread-safe */ + sprintf(audiopath, "%s%d", audiodev, instance++); + exists = 0; + if ( stat(audiopath, &sb) == 0 ) { + exists = 1; + audio_fd = open(audiopath, flags, 0); + } + } while ( exists && (audio_fd < 0) ); + audiodev = audiopath; + } + if ( path != NULL ) { + strncpy(path, audiodev, maxlen); + path[maxlen-1] = '\0'; + } + return(audio_fd); +} + +#elif defined(_AIX) + +/* Get the name of the audio device we use for output */ + +#include +#include +#include +#include + +#include "SDL_audiodev_c.h" + +#ifndef _PATH_DEV_DSP +#define _PATH_DEV_DSP "/dev/%caud%c/%c" +#endif + +char devsettings[][3] = +{ + { 'p', '0', '1' }, { 'p', '0', '2' }, { 'p', '0', '3' }, { 'p', '0', '4' }, + { 'p', '1', '1' }, { 'p', '1', '2' }, { 'p', '1', '3' }, { 'p', '1', '4' }, + { 'p', '2', '1' }, { 'p', '2', '2' }, { 'p', '2', '3' }, { 'p', '2', '4' }, + { 'p', '3', '1' }, { 'p', '3', '2' }, { 'p', '3', '3' }, { 'p', '3', '4' }, + { 'b', '0', '1' }, { 'b', '0', '2' }, { 'b', '0', '3' }, { 'b', '0', '4' }, + { 'b', '1', '1' }, { 'b', '1', '2' }, { 'b', '1', '3' }, { 'b', '1', '4' }, + { 'b', '2', '1' }, { 'b', '2', '2' }, { 'b', '2', '3' }, { 'b', '2', '4' }, + { 'b', '3', '1' }, { 'b', '3', '2' }, { 'b', '3', '3' }, { 'b', '3', '4' }, + { '\0', '\0', '\0' } +}; + +static int OpenUserDefinedDevice(char *path, int maxlen, int flags) +{ + const char *audiodev; + int audio_fd; + + /* Figure out what our audio device is */ + if ((audiodev=getenv("SDL_PATH_DSP")) == NULL) { + audiodev=getenv("AUDIODEV"); + } + if ( audiodev == NULL ) { + return -1; + } + audio_fd = open(audiodev, flags, 0); + if ( path != NULL ) { + strncpy(path, audiodev, maxlen); + path[maxlen-1] = '\0'; + } + return audio_fd; +} + +int SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic) +{ + struct stat sb; + int audio_fd; + char audiopath[1024]; + int cycle; + + audio_fd = OpenUserDefinedDevice(path,maxlen,flags); + if ( audio_fd != -1 ) { + return audio_fd; + } + + cycle = 0; + while( devsettings[cycle][0] != '\0' ) { + sprintf( audiopath, + _PATH_DEV_DSP, + devsettings[cycle][0], + devsettings[cycle][1], + devsettings[cycle][2]); + + if ( stat(audiopath, &sb) == 0 ) { + audio_fd = open(audiopath, flags, 0); + if ( audio_fd > 0 ) { + if ( path != NULL ) { + strncpy( path, audiopath, maxlen ); + path[maxlen-1] = '\0'; + } + return audio_fd; + } + } + } + return -1; +} + +#endif /* UNIX system */ diff -r 000000000000 -r 74212992fb08 src/audio/SDL_audiodev_c.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/SDL_audiodev_c.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,30 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Open the audio device, storing the pathname in 'path' */ +extern int SDL_OpenAudioPath(char *path, int maxlen, int flags, int classic); + diff -r 000000000000 -r 74212992fb08 src/audio/SDL_audiomem.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/SDL_audiomem.c Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,73 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Functions to allocate audio buffer memory, shareable across threads + (necessary because SDL audio emulates threads with fork() + */ + +#ifdef FORK_HACK +#include +#include +#include +#include +#else +#include +#endif + +#include "SDL_audiomem.h" + +/* Allocate memory that will be shared between threads (freed on exit) */ +void *SDL_AllocAudioMem(int size) +{ + void *chunk; + +#ifdef FORK_HACK + int semid; + + /* Create and get the address of a shared memory segment */ + semid = shmget(IPC_PRIVATE, size, (IPC_CREAT|0600)); + if ( semid < 0 ) { + return(NULL); + } + chunk = shmat(semid, NULL, 0); + + /* Set the segment for deletion when it is detatched */ + shmctl(semid, IPC_RMID, NULL); /* Delets semid if shmat() fails */ +#else + chunk = malloc(size); +#endif + return((void *)chunk); +} + +void SDL_FreeAudioMem(void *chunk) +{ +#ifdef FORK_HACK + shmdt(chunk); +#else + free(chunk); +#endif +} diff -r 000000000000 -r 74212992fb08 src/audio/SDL_audiomem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/SDL_audiomem.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,34 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Functions to allocate audio buffer memory, shareable across threads + (necessary because SDL audio emulates threads with fork() + */ + +extern void *SDL_AllocAudioMem(int size); +extern void SDL_FreeAudioMem(void *mem); + diff -r 000000000000 -r 74212992fb08 src/audio/SDL_mixer.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/SDL_mixer.c Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,217 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* This provides the default mixing callback for the SDL audio routines */ + +#include +#include +#include + +#include "SDL_audio.h" +#include "SDL_mutex.h" +#include "SDL_timer.h" +#include "SDL_sysaudio.h" + + +/* This table is used to add two sound values together and pin + * the value to avoid overflow. (used with permission from ARDI) + * Changed to use 0xFE instead of 0xFF for better sound quality. + */ +static const Uint8 mix8[] = +{ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, + 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, + 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, + 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, + 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, + 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3A, + 0x3B, 0x3C, 0x3D, 0x3E, 0x3F, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, + 0x46, 0x47, 0x48, 0x49, 0x4A, 0x4B, 0x4C, 0x4D, 0x4E, 0x4F, 0x50, + 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5A, 0x5B, + 0x5C, 0x5D, 0x5E, 0x5F, 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, + 0x67, 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, 0x70, 0x71, + 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7A, 0x7B, 0x7C, + 0x7D, 0x7E, 0x7F, 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, + 0x88, 0x89, 0x8A, 0x8B, 0x8C, 0x8D, 0x8E, 0x8F, 0x90, 0x91, 0x92, + 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9A, 0x9B, 0x9C, 0x9D, + 0x9E, 0x9F, 0xA0, 0xA1, 0xA2, 0xA3, 0xA4, 0xA5, 0xA6, 0xA7, 0xA8, + 0xA9, 0xAA, 0xAB, 0xAC, 0xAD, 0xAE, 0xAF, 0xB0, 0xB1, 0xB2, 0xB3, + 0xB4, 0xB5, 0xB6, 0xB7, 0xB8, 0xB9, 0xBA, 0xBB, 0xBC, 0xBD, 0xBE, + 0xBF, 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8, 0xC9, + 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, + 0xD5, 0xD6, 0xD7, 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, 0xE8, 0xE9, 0xEA, + 0xEB, 0xEC, 0xED, 0xEE, 0xEF, 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, + 0xF6, 0xF7, 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, + 0xFE, 0xFE, 0xFE, 0xFE, 0xFE, 0xFE +}; + +/* The volume ranges from 0 - 128 */ +#define ADJUST_VOLUME(s, v) (s = (s*v)/SDL_MIX_MAXVOLUME) +#define ADJUST_VOLUME_U8(s, v) (s = (((s-128)*v)/SDL_MIX_MAXVOLUME)+128) + +void SDL_MixAudio (Uint8 *dst, Uint8 *src, Uint32 len, int volume) +{ + Uint16 format; + + if ( volume == 0 ) { + return; + } + /* Mix the user-level audio format */ + if ( current_audio ) { + if ( current_audio->convert.needed ) { + format = current_audio->convert.src_format; + } else { + format = current_audio->spec.format; + } + } else { + /* HACK HACK HACK */ + format = AUDIO_S16; + } + switch (format) { + + case AUDIO_U8: { + Uint8 src_sample; + + while ( len-- ) { + src_sample = *src; + ADJUST_VOLUME_U8(src_sample, volume); + *dst = mix8[*dst+src_sample]; + ++dst; + ++src; + } + } + break; + + case AUDIO_S8: { + Sint8 *dst8, *src8; + Sint8 src_sample; + int dst_sample; + const int max_audioval = ((1<<(8-1))-1); + const int min_audioval = -(1<<(8-1)); + + src8 = (Sint8 *)src; + dst8 = (Sint8 *)dst; + while ( len-- ) { + src_sample = *src8; + ADJUST_VOLUME(src_sample, volume); + dst_sample = *dst8 + src_sample; + if ( dst_sample > max_audioval ) { + *dst8 = max_audioval; + } else + if ( dst_sample < min_audioval ) { + *dst8 = min_audioval; + } else { + *dst8 = dst_sample; + } + ++dst8; + ++src8; + } + } + break; + + case AUDIO_S16LSB: { + Sint16 src1, src2; + int dst_sample; + const int max_audioval = ((1<<(16-1))-1); + const int min_audioval = -(1<<(16-1)); + + len /= 2; + while ( len-- ) { + src1 = ((src[1])<<8|src[0]); + ADJUST_VOLUME(src1, volume); + src2 = ((dst[1])<<8|dst[0]); + src += 2; + dst_sample = src1+src2; + if ( dst_sample > max_audioval ) { + dst_sample = max_audioval; + } else + if ( dst_sample < min_audioval ) { + dst_sample = min_audioval; + } + dst[0] = dst_sample&0xFF; + dst_sample >>= 8; + dst[1] = dst_sample&0xFF; + dst += 2; + } + } + break; + + case AUDIO_S16MSB: { + Sint16 src1, src2; + int dst_sample; + const int max_audioval = ((1<<(16-1))-1); + const int min_audioval = -(1<<(16-1)); + + len /= 2; + while ( len-- ) { + src1 = ((src[0])<<8|src[1]); + ADJUST_VOLUME(src1, volume); + src2 = ((dst[0])<<8|dst[1]); + src += 2; + dst_sample = src1+src2; + if ( dst_sample > max_audioval ) { + dst_sample = max_audioval; + } else + if ( dst_sample < min_audioval ) { + dst_sample = min_audioval; + } + dst[1] = dst_sample&0xFF; + dst_sample >>= 8; + dst[0] = dst_sample&0xFF; + dst += 2; + } + } + break; + + default: /* If this happens... FIXME! */ + SDL_SetError("SDL_MixAudio(): unknown audio format"); + return; + } +} diff -r 000000000000 -r 74212992fb08 src/audio/SDL_sysaudio.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/SDL_sysaudio.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,142 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +#ifndef _SDL_sysaudio_h +#define _SDL_sysaudio_h + +#include "SDL_mutex.h" +#include "SDL_thread.h" + +/* The SDL audio driver */ +typedef struct SDL_AudioDevice SDL_AudioDevice; + +/* Define the SDL audio driver structure */ +#define _THIS SDL_AudioDevice *_this +#ifndef _STATUS +#define _STATUS SDL_status *status +#endif +struct SDL_AudioDevice { + /* * * */ + /* The name of this audio driver */ + const char *name; + + /* * * */ + /* The description of this audio driver */ + const char *desc; + + /* * * */ + /* Public driver functions */ + int (*OpenAudio)(_THIS, SDL_AudioSpec *spec); + void (*ThreadInit)(_THIS); /* Called by audio thread at start */ + void (*WaitAudio)(_THIS); + void (*PlayAudio)(_THIS); + Uint8 *(*GetAudioBuf)(_THIS); + void (*WaitDone)(_THIS); + void (*CloseAudio)(_THIS); + + /* * * */ + /* Data common to all devices */ + + /* The current audio specification (shared with audio thread) */ + SDL_AudioSpec spec; + + /* An audio conversion block for audio format emulation */ + SDL_AudioCVT convert; + + /* Current state flags */ + int enabled; + int paused; + int opened; + + /* Fake audio buffer for when the audio hardware is busy */ + Uint8 *fake_stream; + + /* A semaphore for locking the mixing buffers */ + SDL_mutex *mixer_lock; + + /* A thread to feed the audio device */ + SDL_Thread *thread; + Uint32 threadid; + + /* * * */ + /* Data private to this driver */ + struct SDL_PrivateAudioData *hidden; + + /* * * */ + /* The function used to dispose of this structure */ + void (*free)(_THIS); +}; +#undef _THIS + +typedef struct AudioBootStrap { + const char *name; + const char *desc; + int (*available)(void); + SDL_AudioDevice *(*create)(int devindex); +} AudioBootStrap; + +#if defined(unix) && \ + !defined(linux) && !defined(__FreeBSD__) && !defined(__CYGWIN32__) \ + && !defined(__bsdi__) +extern AudioBootStrap AUDIO_bootstrap; +#endif +#ifdef OSS_SUPPORT +extern AudioBootStrap DSP_bootstrap; +extern AudioBootStrap DMA_bootstrap; +#endif +#ifdef ALSA_SUPPORT +extern AudioBootStrap ALSA_bootstrap; +#endif +#ifdef ARTSC_SUPPORT +extern AudioBootStrap ARTSC_bootstrap; +#endif +#ifdef ESD_SUPPORT +extern AudioBootStrap ESD_bootstrap; +#endif +#ifdef NAS_SUPPORT +extern AudioBootStrap NAS_bootstrap; +#endif +#ifdef ENABLE_DIRECTX +extern AudioBootStrap DSOUND_bootstrap; +#endif +#ifdef ENABLE_WINDIB +extern AudioBootStrap WAVEOUT_bootstrap; +#endif +#ifdef __BEOS__ +extern AudioBootStrap BAUDIO_bootstrap; +#endif +#if defined(macintosh) || TARGET_API_MAC_CARBON +extern AudioBootStrap SNDMGR_bootstrap; +#endif +#ifdef _AIX +extern AudioBootStrap Paud_bootstrap; +#endif + +/* This is the current audio device */ +extern SDL_AudioDevice *current_audio; + +#endif /* _SDL_sysaudio_h */ diff -r 000000000000 -r 74212992fb08 src/audio/SDL_wave.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/SDL_wave.c Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,591 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +#ifndef DISABLE_FILE + +/* Microsoft WAVE file loading routines */ + +#include +#include + +#include "SDL_error.h" +#include "SDL_audio.h" +#include "SDL_wave.h" +#include "SDL_endian.h" + +#ifndef NELEMS +#define NELEMS(array) ((sizeof array)/(sizeof array[0])) +#endif + +static int ReadChunk(SDL_RWops *src, Chunk *chunk); + +struct MS_ADPCM_decodestate { + Uint8 hPredictor; + Uint16 iDelta; + Sint16 iSamp1; + Sint16 iSamp2; +}; +static struct MS_ADPCM_decoder { + WaveFMT wavefmt; + Uint16 wSamplesPerBlock; + Uint16 wNumCoef; + Sint16 aCoeff[7][2]; + /* * * */ + struct MS_ADPCM_decodestate state[2]; +} MS_ADPCM_state; + +static int InitMS_ADPCM(WaveFMT *format) +{ + Uint8 *rogue_feel; + Uint16 extra_info; + int i; + + /* Set the rogue pointer to the MS_ADPCM specific data */ + MS_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding); + MS_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels); + MS_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency); + MS_ADPCM_state.wavefmt.byterate = SDL_SwapLE32(format->byterate); + MS_ADPCM_state.wavefmt.blockalign = SDL_SwapLE16(format->blockalign); + MS_ADPCM_state.wavefmt.bitspersample = + SDL_SwapLE16(format->bitspersample); + rogue_feel = (Uint8 *)format+sizeof(*format); + if ( sizeof(*format) == 16 ) { + extra_info = ((rogue_feel[1]<<8)|rogue_feel[0]); + rogue_feel += sizeof(Uint16); + } + MS_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1]<<8)|rogue_feel[0]); + rogue_feel += sizeof(Uint16); + MS_ADPCM_state.wNumCoef = ((rogue_feel[1]<<8)|rogue_feel[0]); + rogue_feel += sizeof(Uint16); + if ( MS_ADPCM_state.wNumCoef != 7 ) { + SDL_SetError("Unknown set of MS_ADPCM coefficients"); + return(-1); + } + for ( i=0; iiSamp1 * coeff[0]) + + (state->iSamp2 * coeff[1]))/256; + if ( nybble & 0x08 ) { + new_sample += state->iDelta * (nybble-0x10); + } else { + new_sample += state->iDelta * nybble; + } + if ( new_sample < min_audioval ) { + new_sample = min_audioval; + } else + if ( new_sample > max_audioval ) { + new_sample = max_audioval; + } + delta = ((Sint32)state->iDelta * adaptive[nybble])/256; + if ( delta < 16 ) { + delta = 16; + } + state->iDelta = delta; + state->iSamp2 = state->iSamp1; + state->iSamp1 = new_sample; + return(new_sample); +} + +static int MS_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len) +{ + struct MS_ADPCM_decodestate *state[2]; + Uint8 *freeable, *encoded, *decoded; + Sint32 encoded_len, samplesleft; + Sint8 nybble, stereo; + Sint16 *coeff[2]; + Sint32 new_sample; + + /* Allocate the proper sized output buffer */ + encoded_len = *audio_len; + encoded = *audio_buf; + freeable = *audio_buf; + *audio_len = (encoded_len/MS_ADPCM_state.wavefmt.blockalign) * + MS_ADPCM_state.wSamplesPerBlock* + MS_ADPCM_state.wavefmt.channels*sizeof(Sint16); + *audio_buf = (Uint8 *)malloc(*audio_len); + if ( *audio_buf == NULL ) { + SDL_Error(SDL_ENOMEM); + return(-1); + } + decoded = *audio_buf; + + /* Get ready... Go! */ + stereo = (MS_ADPCM_state.wavefmt.channels == 2); + state[0] = &MS_ADPCM_state.state[0]; + state[1] = &MS_ADPCM_state.state[stereo]; + while ( encoded_len >= MS_ADPCM_state.wavefmt.blockalign ) { + /* Grab the initial information for this block */ + state[0]->hPredictor = *encoded++; + if ( stereo ) { + state[1]->hPredictor = *encoded++; + } + state[0]->iDelta = ((encoded[1]<<8)|encoded[0]); + encoded += sizeof(Sint16); + if ( stereo ) { + state[1]->iDelta = ((encoded[1]<<8)|encoded[0]); + encoded += sizeof(Sint16); + } + state[0]->iSamp1 = ((encoded[1]<<8)|encoded[0]); + encoded += sizeof(Sint16); + if ( stereo ) { + state[1]->iSamp1 = ((encoded[1]<<8)|encoded[0]); + encoded += sizeof(Sint16); + } + state[0]->iSamp2 = ((encoded[1]<<8)|encoded[0]); + encoded += sizeof(Sint16); + if ( stereo ) { + state[1]->iSamp2 = ((encoded[1]<<8)|encoded[0]); + encoded += sizeof(Sint16); + } + coeff[0] = MS_ADPCM_state.aCoeff[state[0]->hPredictor]; + coeff[1] = MS_ADPCM_state.aCoeff[state[1]->hPredictor]; + + /* Store the two initial samples we start with */ + decoded[0] = state[0]->iSamp2&0xFF; + decoded[1] = state[0]->iSamp2>>8; + decoded += 2; + if ( stereo ) { + decoded[0] = state[1]->iSamp2&0xFF; + decoded[1] = state[1]->iSamp2>>8; + decoded += 2; + } + decoded[0] = state[0]->iSamp1&0xFF; + decoded[1] = state[0]->iSamp1>>8; + decoded += 2; + if ( stereo ) { + decoded[0] = state[1]->iSamp1&0xFF; + decoded[1] = state[1]->iSamp1>>8; + decoded += 2; + } + + /* Decode and store the other samples in this block */ + samplesleft = (MS_ADPCM_state.wSamplesPerBlock-2)* + MS_ADPCM_state.wavefmt.channels; + while ( samplesleft > 0 ) { + nybble = (*encoded)>>4; + new_sample = MS_ADPCM_nibble(state[0],nybble,coeff[0]); + decoded[0] = new_sample&0xFF; + new_sample >>= 8; + decoded[1] = new_sample&0xFF; + decoded += 2; + + nybble = (*encoded)&0x0F; + new_sample = MS_ADPCM_nibble(state[1],nybble,coeff[1]); + decoded[0] = new_sample&0xFF; + new_sample >>= 8; + decoded[1] = new_sample&0xFF; + decoded += 2; + + ++encoded; + samplesleft -= 2; + } + encoded_len -= MS_ADPCM_state.wavefmt.blockalign; + } + free(freeable); + return(0); +} + +struct IMA_ADPCM_decodestate { + Sint32 sample; + Sint8 index; +}; +static struct IMA_ADPCM_decoder { + WaveFMT wavefmt; + Uint16 wSamplesPerBlock; + /* * * */ + struct IMA_ADPCM_decodestate state[2]; +} IMA_ADPCM_state; + +static int InitIMA_ADPCM(WaveFMT *format) +{ + Uint8 *rogue_feel; + Uint16 extra_info; + + /* Set the rogue pointer to the IMA_ADPCM specific data */ + IMA_ADPCM_state.wavefmt.encoding = SDL_SwapLE16(format->encoding); + IMA_ADPCM_state.wavefmt.channels = SDL_SwapLE16(format->channels); + IMA_ADPCM_state.wavefmt.frequency = SDL_SwapLE32(format->frequency); + IMA_ADPCM_state.wavefmt.byterate = SDL_SwapLE32(format->byterate); + IMA_ADPCM_state.wavefmt.blockalign = SDL_SwapLE16(format->blockalign); + IMA_ADPCM_state.wavefmt.bitspersample = + SDL_SwapLE16(format->bitspersample); + rogue_feel = (Uint8 *)format+sizeof(*format); + if ( sizeof(*format) == 16 ) { + extra_info = ((rogue_feel[1]<<8)|rogue_feel[0]); + rogue_feel += sizeof(Uint16); + } + IMA_ADPCM_state.wSamplesPerBlock = ((rogue_feel[1]<<8)|rogue_feel[0]); + return(0); +} + +static Sint32 IMA_ADPCM_nibble(struct IMA_ADPCM_decodestate *state,Uint8 nybble) +{ + const Sint32 max_audioval = ((1<<(16-1))-1); + const Sint32 min_audioval = -(1<<(16-1)); + const int index_table[16] = { + -1, -1, -1, -1, + 2, 4, 6, 8, + -1, -1, -1, -1, + 2, 4, 6, 8 + }; + const Sint32 step_table[89] = { + 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31, + 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130, + 143, 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, + 449, 494, 544, 598, 658, 724, 796, 876, 963, 1060, 1166, 1282, + 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024, 3327, + 3660, 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630, + 9493, 10442, 11487, 12635, 13899, 15289, 16818, 18500, 20350, + 22385, 24623, 27086, 29794, 32767 + }; + Sint32 delta, step; + + /* Compute difference and new sample value */ + step = step_table[state->index]; + delta = step >> 3; + if ( nybble & 0x04 ) delta += step; + if ( nybble & 0x02 ) delta += (step >> 1); + if ( nybble & 0x01 ) delta += (step >> 2); + if ( nybble & 0x08 ) delta = -delta; + state->sample += delta; + + /* Update index value */ + state->index += index_table[nybble]; + if ( state->index > 88 ) { + state->index = 88; + } else + if ( state->index < 0 ) { + state->index = 0; + } + + /* Clamp output sample */ + if ( state->sample > max_audioval ) { + state->sample = max_audioval; + } else + if ( state->sample < min_audioval ) { + state->sample = min_audioval; + } + return(state->sample); +} + +/* Fill the decode buffer with a channel block of data (8 samples) */ +static void Fill_IMA_ADPCM_block(Uint8 *decoded, Uint8 *encoded, + int channel, int numchannels, struct IMA_ADPCM_decodestate *state) +{ + int i; + Sint8 nybble; + Sint32 new_sample; + + decoded += (channel * 2); + for ( i=0; i<4; ++i ) { + nybble = (*encoded)&0x0F; + new_sample = IMA_ADPCM_nibble(state, nybble); + decoded[0] = new_sample&0xFF; + new_sample >>= 8; + decoded[1] = new_sample&0xFF; + decoded += 2 * numchannels; + + nybble = (*encoded)>>4; + new_sample = IMA_ADPCM_nibble(state, nybble); + decoded[0] = new_sample&0xFF; + new_sample >>= 8; + decoded[1] = new_sample&0xFF; + decoded += 2 * numchannels; + + ++encoded; + } +} + +static int IMA_ADPCM_decode(Uint8 **audio_buf, Uint32 *audio_len) +{ + struct IMA_ADPCM_decodestate *state; + Uint8 *freeable, *encoded, *decoded; + Sint32 encoded_len, samplesleft; + int c, channels; + + /* Check to make sure we have enough variables in the state array */ + channels = IMA_ADPCM_state.wavefmt.channels; + if ( channels > NELEMS(IMA_ADPCM_state.state) ) { + SDL_SetError("IMA ADPCM decoder can only handle %d channels", + NELEMS(IMA_ADPCM_state.state)); + return(-1); + } + state = IMA_ADPCM_state.state; + + /* Allocate the proper sized output buffer */ + encoded_len = *audio_len; + encoded = *audio_buf; + freeable = *audio_buf; + *audio_len = (encoded_len/IMA_ADPCM_state.wavefmt.blockalign) * + IMA_ADPCM_state.wSamplesPerBlock* + IMA_ADPCM_state.wavefmt.channels*sizeof(Sint16); + *audio_buf = (Uint8 *)malloc(*audio_len); + if ( *audio_buf == NULL ) { + SDL_Error(SDL_ENOMEM); + return(-1); + } + decoded = *audio_buf; + + /* Get ready... Go! */ + while ( encoded_len >= IMA_ADPCM_state.wavefmt.blockalign ) { + /* Grab the initial information for this block */ + for ( c=0; c>8; + decoded += 2; + } + + /* Decode and store the other samples in this block */ + samplesleft = (IMA_ADPCM_state.wSamplesPerBlock-1)*channels; + while ( samplesleft > 0 ) { + for ( c=0; cencoding)) { + case PCM_CODE: + /* We can understand this */ + break; + case MS_ADPCM_CODE: + /* Try to understand this */ + if ( InitMS_ADPCM(format) < 0 ) { + was_error = 1; + goto done; + } + MS_ADPCM_encoded = 1; + break; + case IMA_ADPCM_CODE: + /* Try to understand this */ + if ( InitIMA_ADPCM(format) < 0 ) { + was_error = 1; + goto done; + } + IMA_ADPCM_encoded = 1; + break; + default: + SDL_SetError("Unknown WAVE data format: 0x%.4x", + SDL_SwapLE16(format->encoding)); + was_error = 1; + goto done; + } + memset(spec, 0, (sizeof *spec)); + spec->freq = SDL_SwapLE32(format->frequency); + switch (SDL_SwapLE16(format->bitspersample)) { + case 4: + if ( MS_ADPCM_encoded || IMA_ADPCM_encoded ) { + spec->format = AUDIO_S16; + } else { + was_error = 1; + } + break; + case 8: + spec->format = AUDIO_U8; + break; + case 16: + spec->format = AUDIO_S16; + break; + default: + was_error = 1; + break; + } + if ( was_error ) { + SDL_SetError("Unknown %d-bit PCM data format", + SDL_SwapLE16(format->bitspersample)); + goto done; + } + spec->channels = (Uint8)SDL_SwapLE16(format->channels); + spec->samples = 4096; /* Good default buffer size */ + + /* Read the audio data chunk */ + *audio_buf = NULL; + do { + if ( *audio_buf != NULL ) { + free(*audio_buf); + } + lenread = ReadChunk(src, &chunk); + if ( lenread < 0 ) { + was_error = 1; + goto done; + } + *audio_len = lenread; + *audio_buf = chunk.data; + } while ( chunk.magic != DATA ); + + if ( MS_ADPCM_encoded ) { + if ( MS_ADPCM_decode(audio_buf, audio_len) < 0 ) { + was_error = 1; + goto done; + } + } + if ( IMA_ADPCM_encoded ) { + if ( IMA_ADPCM_decode(audio_buf, audio_len) < 0 ) { + was_error = 1; + goto done; + } + } + + /* Don't return a buffer that isn't a multiple of samplesize */ + samplesize = ((spec->format & 0xFF)/8)*spec->channels; + *audio_len &= ~(samplesize-1); + +done: + if ( format != NULL ) { + free(format); + } + if ( freesrc && src ) { + SDL_RWclose(src); + } + if ( was_error ) { + spec = NULL; + } + return(spec); +} + +/* Since the WAV memory is allocated in the shared library, it must also + be freed here. (Necessary under Win32, VC++) + */ +void SDL_FreeWAV(Uint8 *audio_buf) +{ + if ( audio_buf != NULL ) { + free(audio_buf); + } +} + +static int ReadChunk(SDL_RWops *src, Chunk *chunk) +{ + chunk->magic = SDL_ReadLE32(src); + chunk->length = SDL_ReadLE32(src); + chunk->data = (Uint8 *)malloc(chunk->length); + if ( chunk->data == NULL ) { + SDL_Error(SDL_ENOMEM); + return(-1); + } + if ( SDL_RWread(src, chunk->data, chunk->length, 1) != 1 ) { + SDL_Error(SDL_EFREAD); + free(chunk->data); + return(-1); + } + return(chunk->length); +} + +#endif /* ENABLE_FILE */ diff -r 000000000000 -r 74212992fb08 src/audio/SDL_wave.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/SDL_wave.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,65 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* WAVE files are little-endian */ + +/*******************************************/ +/* Define values for Microsoft WAVE format */ +/*******************************************/ +#define RIFF 0x46464952 /* "RIFF" */ +#define WAVE 0x45564157 /* "WAVE" */ +#define FACT 0x74636166 /* "fact" */ +#define LIST 0x5453494c /* "LIST" */ +#define FMT 0x20746D66 /* "fmt " */ +#define DATA 0x61746164 /* "data" */ +#define PCM_CODE 0x0001 +#define MS_ADPCM_CODE 0x0002 +#define IMA_ADPCM_CODE 0x0011 +#define WAVE_MONO 1 +#define WAVE_STEREO 2 + +/* Normally, these three chunks come consecutively in a WAVE file */ +typedef struct WaveFMT { +/* Not saved in the chunk we read: + Uint32 FMTchunk; + Uint32 fmtlen; +*/ + Uint16 encoding; + Uint16 channels; /* 1 = mono, 2 = stereo */ + Uint32 frequency; /* One of 11025, 22050, or 44100 Hz */ + Uint32 byterate; /* Average bytes per second */ + Uint16 blockalign; /* Bytes per sample block */ + Uint16 bitspersample; /* One of 8, 12, 16, or 4 for ADPCM */ +} WaveFMT; + +/* The general chunk found in the WAVE file */ +typedef struct Chunk { + Uint32 magic; + Uint32 length; + Uint8 *data; /* Data includes magic and length */ +} Chunk; + diff -r 000000000000 -r 74212992fb08 src/audio/alsa/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/alsa/.cvsignore Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,6 @@ +Makefile.in +Makefile +.libs +*.o +*.lo +*.la diff -r 000000000000 -r 74212992fb08 src/audio/alsa/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/alsa/Makefile.am Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,9 @@ + +## Makefile.am for SDL using the ALSA PCM audio API + +noinst_LTLIBRARIES = libaudio_alsa.la +libaudio_alsa_la_SOURCES = $(SRCS) + +# The SDL audio driver sources +SRCS = SDL_alsa_audio.c \ + SDL_alsa_audio.h diff -r 000000000000 -r 74212992fb08 src/audio/alsa/SDL_alsa_audio.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/alsa/SDL_alsa_audio.c Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,521 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + + + +/* Allow access to a raw mixing buffer */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "SDL_audio.h" +#include "SDL_error.h" +#include "SDL_audiomem.h" +#include "SDL_audio_c.h" +#include "SDL_timer.h" +#include "SDL_alsa_audio.h" + +/* The tag name used by ALSA audio */ +#define DRIVER_NAME "alsa" + +/* default card and device numbers as listed in dev/snd */ +static int card_no = 0; +static int device_no = 0; + +/* default channel communication parameters */ +#define DEFAULT_CPARAMS_RATE 22050 +#define DEFAULT_CPARAMS_VOICES 1 +#define DEFAULT_CPARAMS_FRAG_SIZE 512 +#define DEFAULT_CPARAMS_FRAGS_MIN 1 +#define DEFAULT_CPARAMS_FRAGS_MAX -1 + +/* Open the audio device for playback, and don't block if busy */ +#define OPEN_FLAGS (SND_PCM_OPEN_PLAYBACK|SND_PCM_OPEN_NONBLOCK) + +/* Audio driver functions */ +static int PCM_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void PCM_WaitAudio(_THIS); +static void PCM_PlayAudio(_THIS); +static Uint8 *PCM_GetAudioBuf(_THIS); +static void PCM_CloseAudio(_THIS); + +/* PCM transfer channel parameters initialize function */ +static void init_pcm_cparams(snd_pcm_channel_params_t* cparams) +{ + memset(cparams,0,sizeof(snd_pcm_channel_params_t)); + + cparams->channel = SND_PCM_CHANNEL_PLAYBACK; + cparams->mode = SND_PCM_MODE_BLOCK; + cparams->start_mode = SND_PCM_START_DATA; //_FULL + cparams->stop_mode = SND_PCM_STOP_STOP; + cparams->format.format = SND_PCM_SFMT_S16_LE; + cparams->format.interleave = 1; + cparams->format.rate = DEFAULT_CPARAMS_RATE; + cparams->format.voices = DEFAULT_CPARAMS_VOICES; + cparams->buf.block.frag_size = DEFAULT_CPARAMS_FRAG_SIZE; + cparams->buf.block.frags_min = DEFAULT_CPARAMS_FRAGS_MIN; + cparams->buf.block.frags_max = DEFAULT_CPARAMS_FRAGS_MAX; +} + +/* Audio driver bootstrap functions */ + +static int Audio_Available(void) +/* + See if we can open a nonblocking channel. + Return value '1' means we can. + Return value '0' means we cannot. +*/ +{ + int available; + int rval; + snd_pcm_t *handle; + snd_pcm_channel_params_t cparams; +#ifdef DEBUG_AUDIO + snd_pcm_channel_status_t cstatus; +#endif + + available = 0; + handle = NULL; + + init_pcm_cparams(&cparams); + + rval = snd_pcm_open(&handle, card_no, device_no, OPEN_FLAGS); + if (rval >= 0) + { + rval = snd_pcm_plugin_params(handle, &cparams); + +#ifdef DEBUG_AUDIO + snd_pcm_plugin_status(handle, &cstatus); + printf("status after snd_pcm_plugin_params call = %d\n",cstatus.status); +#endif + if (rval >= 0) + { + available = 1; + } + else + { + SDL_SetError("snd_pcm_channel_params failed: %s\n", snd_strerror (rval)); + } + + if ((rval = snd_pcm_close(handle)) < 0) + { + SDL_SetError("snd_pcm_close failed: %s\n",snd_strerror(rval)); + available = 0; + } + } + else + { + SDL_SetError("snd_pcm_open failed: %s\n", snd_strerror(rval)); + } + + return(available); +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + free(device->hidden); + free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + free(this); + } + return(0); + } + memset(this->hidden, 0, (sizeof *this->hidden)); + audio_handle = NULL; + + /* Set the function pointers */ + this->OpenAudio = PCM_OpenAudio; + this->WaitAudio = PCM_WaitAudio; + this->PlayAudio = PCM_PlayAudio; + this->GetAudioBuf = PCM_GetAudioBuf; + this->CloseAudio = PCM_CloseAudio; + + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap ALSA_bootstrap = { + DRIVER_NAME, "ALSA PCM audio", + Audio_Available, Audio_CreateDevice +}; + +/* This function waits until it is possible to write a full sound buffer */ +static void PCM_WaitAudio(_THIS) +{ + + /* Check to see if the thread-parent process is still alive */ + { static int cnt = 0; + /* Note that this only works with thread implementations + that use a different process id for each thread. + */ + if (parent && (((++cnt)%10) == 0)) { /* Check every 10 loops */ + if ( kill(parent, 0) < 0 ) { + this->enabled = 0; + } + } + } + + /* See if we need to use timed audio synchronization */ + if ( frame_ticks ) + { + /* Use timer for general audio synchronization */ + Sint32 ticks; + + ticks = ((Sint32)(next_frame - SDL_GetTicks()))-FUDGE_TICKS; + if ( ticks > 0 ) + { + SDL_Delay(ticks); + } + } + else + { + /* Use select() for audio synchronization */ + fd_set fdset; + struct timeval timeout; + FD_ZERO(&fdset); + FD_SET(audio_fd, &fdset); + timeout.tv_sec = 10; + timeout.tv_usec = 0; +#ifdef DEBUG_AUDIO + fprintf(stderr, "Waiting for audio to get ready\n"); +#endif + if ( select(audio_fd+1, NULL, &fdset, NULL, &timeout) <= 0 ) + { + const char *message = + "Audio timeout - buggy audio driver? (disabled)"; + /* In general we should never print to the screen, + but in this case we have no other way of letting + the user know what happened. + */ + fprintf(stderr, "SDL: %s\n", message); + this->enabled = 0; + /* Don't try to close - may hang */ + audio_fd = -1; +#ifdef DEBUG_AUDIO + fprintf(stderr, "Done disabling audio\n"); +#endif + } +#ifdef DEBUG_AUDIO + fprintf(stderr, "Ready!\n"); +#endif + } +} + +static snd_pcm_channel_status_t cstatus; + +static void PCM_PlayAudio(_THIS) +{ + int written, rval; + + /* Write the audio data, checking for EAGAIN (buffer full) and underrun */ + do { + written = snd_pcm_plugin_write(audio_handle, pcm_buf, pcm_len); +#ifdef DEBUG_AUDIO + fprintf(stderr, "written = %d pcm_len = %d\n",written,pcm_len); +#endif + if (written != pcm_len) + { + if (errno == EAGAIN) + { + SDL_Delay(1); /* Let a little CPU time go by and try to write again */ +#ifdef DEBUG_AUDIO + fprintf(stderr, "errno == EAGAIN\n"); +#endif + } + else + { + if( (rval = snd_pcm_plugin_status(audio_handle, &cstatus)) < 0 ) + { + SDL_SetError("snd_pcm_plugin_status failed: %s\n", snd_strerror(rval)); + return; + } + if ( (cstatus.status == SND_PCM_STATUS_UNDERRUN) + ||(cstatus.status == SND_PCM_STATUS_READY) ) + { +#ifdef DEBUG_AUDIO + fprintf(stderr, "buffer underrun\n"); +#endif + if ( (rval = snd_pcm_plugin_prepare (audio_handle,SND_PCM_CHANNEL_PLAYBACK)) < 0 ) + { + SDL_SetError("snd_pcm_plugin_prepare failed: %s\n",snd_strerror(rval) ); + return; + } + /* if we reach here, try to write again */ + } + } + } + } while ( (written < 0) && ((errno == 0) || (errno == EAGAIN)) ); + + /* Set the next write frame */ + if ( frame_ticks ) { + next_frame += frame_ticks; + } + + /* If we couldn't write, assume fatal error for now */ + if ( written < 0 ) { + this->enabled = 0; + } + return; +} + +static Uint8 *PCM_GetAudioBuf(_THIS) +{ + return(pcm_buf); +} + +static void PCM_CloseAudio(_THIS) +{ + int rval; + + if ( pcm_buf != NULL ) { + free(pcm_buf); + pcm_buf = NULL; + } + if ( audio_handle != NULL ) { + if ((rval = snd_pcm_plugin_flush(audio_handle,SND_PCM_CHANNEL_PLAYBACK)) < 0) + { + SDL_SetError("snd_pcm_plugin_flush failed: %s\n",snd_strerror(rval)); + return; + } + if ((rval = snd_pcm_close(audio_handle)) < 0) + { + SDL_SetError("snd_pcm_close failed: %s\n",snd_strerror(rval)); + return; + } + audio_handle = NULL; + } +} + +static int PCM_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + int rval; + snd_pcm_channel_params_t cparams; + snd_pcm_channel_setup_t csetup; + int format; + Uint16 test_format; + int twidth; + + /* initialize channel transfer parameters to default */ + init_pcm_cparams(&cparams); + + /* Reset the timer synchronization flag */ + frame_ticks = 0.0; + + /* Open the audio device */ + + rval = snd_pcm_open(&audio_handle, card_no, device_no, OPEN_FLAGS); + if ( rval < 0 ) { + SDL_SetError("snd_pcm_open failed: %s\n", snd_strerror(rval)); + return(-1); + } + +#ifdef PLUGIN_DISABLE_MMAP /* This is gone in newer versions of ALSA? */ + /* disable count status parameter */ + if ((rval = snd_plugin_set_disable(audio_handle, PLUGIN_DISABLE_MMAP))<0) + { + SDL_SetError("snd_plugin_set_disable failed: %s\n", snd_strerror(rval)); + return(-1); + } +#endif + + pcm_buf = NULL; + + /* Try for a closest match on audio format */ + format = 0; + for ( test_format = SDL_FirstAudioFormat(spec->format); + ! format && test_format; ) + { +#ifdef DEBUG_AUDIO + fprintf(stderr, "Trying format 0x%4.4x spec->samples %d\n", test_format,spec->samples); +#endif + /* if match found set format to equivalent ALSA format */ + switch ( test_format ) { + case AUDIO_U8: + format = SND_PCM_SFMT_U8; + cparams.buf.block.frag_size = spec->samples * spec->channels; + break; + case AUDIO_S8: + format = SND_PCM_SFMT_S8; + cparams.buf.block.frag_size = spec->samples * spec->channels; + break; + case AUDIO_S16LSB: + format = SND_PCM_SFMT_S16_LE; + cparams.buf.block.frag_size = spec->samples*2 * spec->channels; + break; + case AUDIO_S16MSB: + format = SND_PCM_SFMT_S16_BE; + cparams.buf.block.frag_size = spec->samples*2 * spec->channels; + break; + case AUDIO_U16LSB: + format = SND_PCM_SFMT_U16_LE; + cparams.buf.block.frag_size = spec->samples*2 * spec->channels; + break; + case AUDIO_U16MSB: + format = SND_PCM_SFMT_U16_BE; + cparams.buf.block.frag_size = spec->samples*2 * spec->channels; + break; + default: + break; + } + if ( ! format ) { + test_format = SDL_NextAudioFormat(); + } + } + if ( format == 0 ) { + SDL_SetError("Couldn't find any hardware audio formats"); + return(-1); + } + spec->format = test_format; + + /* Set the audio format */ + cparams.format.format = format; + + /* Set mono or stereo audio (currently only two channels supported) */ + cparams.format.voices = spec->channels; + + #ifdef DEBUG_AUDIO + printf("intializing channels %d\n", cparams.format.voices); + #endif + + /* Set rate */ + cparams.format.rate = spec->freq ; + + /* Setup the transfer parameters according to cparams */ + rval = snd_pcm_plugin_params(audio_handle, &cparams); + if (rval < 0) { + SDL_SetError("snd_pcm_channel_params failed: %s\n", snd_strerror (rval)); + return(-1); + } + + /* Make sure channel is setup right one last time */ + memset( &csetup, 0, sizeof( csetup ) ); + csetup.channel = SND_PCM_CHANNEL_PLAYBACK; + if ( snd_pcm_plugin_setup( audio_handle, &csetup ) < 0 ) + { + SDL_SetError("Unable to setup playback channel\n" ); + return(-1); + } + +#ifdef DEBUG_AUDIO + else + { + fprintf(stderr,"requested format: %d\n",cparams.format.format); + fprintf(stderr,"requested frag size: %d\n",cparams.buf.block.frag_size); + fprintf(stderr,"requested max frags: %d\n\n",cparams.buf.block.frags_max); + + fprintf(stderr,"real format: %d\n", csetup.format.format ); + fprintf(stderr,"real frag size : %d\n", csetup.buf.block.frag_size ); + fprintf(stderr,"real max frags : %d\n", csetup.buf.block.frags_max ); + } +#endif // DEBUG_AUDIO + + /* Allocate memory to the audio buffer and initialize with silence + (Note that buffer size must be a multiple of fragment size, so find closest multiple) + */ + + twidth = snd_pcm_format_width(format); + if (twidth < 0) { + printf("snd_pcm_format_width failed\n"); + twidth = 0; + } +#ifdef DEBUG_AUDIO + printf("format is %d bits wide\n",twidth); +#endif + + pcm_len = csetup.buf.block.frag_size * (twidth/8) * csetup.format.voices ; + +#ifdef DEBUG_AUDIO + printf("pcm_len set to %d\n", pcm_len); +#endif + + if (pcm_len == 0) + { + pcm_len = csetup.buf.block.frag_size; + } + + pcm_buf = (Uint8*)malloc(pcm_len); + if (pcm_buf == NULL) { + SDL_SetError("pcm_buf malloc failed\n"); + return(-1); + } + memset(pcm_buf,spec->silence,pcm_len); + +#ifdef DEBUG_AUDIO + fprintf(stderr,"pcm_buf malloced and silenced.\n"); +#endif + + /* get the file descriptor */ + if( (audio_fd = snd_pcm_file_descriptor(audio_handle, device_no)) < 0) + { + fprintf(stderr, "snd_pcm_file_descriptor failed with error code: %d\n", audio_fd); + } + + /* Trigger audio playback */ + rval = snd_pcm_plugin_prepare( audio_handle, SND_PCM_CHANNEL_PLAYBACK); + if (rval < 0) { + SDL_SetError("snd_pcm_plugin_prepare failed: %s\n", snd_strerror (rval)); + return(-1); + } + rval = snd_pcm_playback_go(audio_handle); + if (rval < 0) { + SDL_SetError("snd_pcm_playback_go failed: %s\n", snd_strerror (rval)); + return(-1); + } + + /* Check to see if we need to use select() workaround */ + { char *workaround; + workaround = getenv("SDL_DSP_NOSELECT"); + if ( workaround ) { + frame_ticks = (float)(spec->samples*1000)/spec->freq; + next_frame = SDL_GetTicks()+frame_ticks; + } + } + + /* Get the parent process id (we're the parent of the audio thread) */ + parent = getpid(); + + /* We're ready to rock and roll. :-) */ + return(0); +} diff -r 000000000000 -r 74212992fb08 src/audio/alsa/SDL_alsa_audio.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/alsa/SDL_alsa_audio.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,61 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifndef _ALSA_PCM_audio_h +#define _ALSA_PCM_audio_h + +#include "SDL_sysaudio.h" +#include + +/* Hidden "this" pointer for the video functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData { + /* The audio device handle */ + snd_pcm_t *audio_handle; + + /* The audio file descriptor */ + int audio_fd; + + /* The parent process id, to detect when application quits */ + pid_t parent; + + /* Raw mixing buffer */ + Uint8 *pcm_buf; + int pcm_len; + + /* Support for audio timing using a timer, in addition to select() */ + float frame_ticks; + float next_frame; +}; +#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ + +/* Old variable names */ +#define audio_handle (this->hidden->audio_handle) +#define audio_fd (this->hidden->audio_fd) +#define parent (this->hidden->parent) +#define pcm_buf (this->hidden->pcm_buf) +#define pcm_len (this->hidden->pcm_len) +#define frame_ticks (this->hidden->frame_ticks) +#define next_frame (this->hidden->next_frame) + +#endif /* _ALSA_PCM_audio_h */ diff -r 000000000000 -r 74212992fb08 src/audio/amigaos/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/amigaos/Makefile.am Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,8 @@ + +## Makefile.am for the SDL AmigaOS audio subsystem + +noinst_LTLIBRARIES = libaudio_arch.la + +ARCH_SRCS = SDL_ahiaudio.c SDL_audio.c SDL_lowaudio.h SDL_sysaudio.h + +libaudio_arch_la_SOURCES = $(ARCH_SRCS) diff -r 000000000000 -r 74212992fb08 src/audio/amigaos/SDL_ahiaudio.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/amigaos/SDL_ahiaudio.c Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,299 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + 5635-34 Springhouse Dr. + Pleasanton, CA 94588 (USA) + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Allow access to a raw mixing buffer (For IRIX 6.5 and higher) */ + +#include "SDL_endian.h" +#include "SDL_audio.h" +#include "SDL_audiomem.h" +#include "SDL_audio_c.h" +#include "SDL_lowaudio.h" + +/* Audio driver functions */ +static int AHI_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void AHI_WaitAudio(_THIS); +static void AHI_PlayAudio(_THIS); +static Uint8 *AHI_GetAudioBuf(_THIS); +static void AHI_CloseAudio(_THIS); + +#ifndef __SASC + #define mymalloc(x) AllocVec(x,MEMF_PUBLIC) + #define myfree FreeVec +#else + #define mymalloc malloc + #define myfree free +#endif + +/* Audio driver bootstrap functions */ + +static int Audio_Available(void) +{ +#ifndef NO_AMIGADEBUG + D(bug("AHI available.\n")); +#endif + + return 1; +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + free(device->hidden); + free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + +#ifndef NO_AMIGADEBUG + D(bug("AHI created...\n")); +#endif + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + free(this); + } + return(0); + } + memset(this->hidden, 0, (sizeof *this->hidden)); + + /* Set the function pointers */ + this->OpenAudio = AHI_OpenAudio; + this->WaitAudio = AHI_WaitAudio; + this->PlayAudio = AHI_PlayAudio; + this->GetAudioBuf = AHI_GetAudioBuf; + this->CloseAudio = AHI_CloseAudio; + + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap AHI_bootstrap = { + "AHI", Audio_Available, Audio_CreateDevice +}; + + +void static AHI_WaitAudio(_THIS) +{ + if(!CheckIO((struct IORequest *)audio_req[current_buffer])) + { + WaitIO((struct IORequest *)audio_req[current_buffer]); +// AbortIO((struct IORequest *)audio_req[current_buffer]); + } +} + +static void AHI_PlayAudio(_THIS) +{ + if(playing>1) + WaitIO((struct IORequest *)audio_req[current_buffer]); + + /* Write the audio data out */ + audio_req[current_buffer] -> ahir_Std. io_Message.mn_Node.ln_Pri = 60; + audio_req[current_buffer] -> ahir_Std. io_Data = mixbuf[current_buffer]; + audio_req[current_buffer] -> ahir_Std. io_Length = this->spec.samples*this->hidden->bytespersample; + audio_req[current_buffer] -> ahir_Std. io_Offset = 0; + audio_req[current_buffer] -> ahir_Std . io_Command = CMD_WRITE; + audio_req[current_buffer] -> ahir_Frequency = this->hidden->freq; + audio_req[current_buffer] -> ahir_Volume = 0x10000; + audio_req[current_buffer] -> ahir_Type = this->hidden->type; + audio_req[current_buffer] -> ahir_Position = 0x8000; + audio_req[current_buffer] -> ahir_Link = (playing>0 ? audio_req[current_buffer^1] : NULL); + + SendIO((struct IORequest *)audio_req[current_buffer]); + current_buffer^=1; + + playing++; +} + +static Uint8 *AHI_GetAudioBuf(_THIS) +{ + return(mixbuf[current_buffer]); +} + +static void AHI_CloseAudio(_THIS) +{ + D(bug("Closing audio...\n")); + + if ( mixbuf[0] != NULL ) { + myfree(mixbuf[0]); +// SDL_FreeAudioMem(mixbuf[0]); + mixbuf[0] = NULL; + } + + if ( mixbuf[1] != NULL ) { + myfree(mixbuf[1]); +// SDL_FreeAudioMem(mixbuf[1]); + mixbuf[1] = NULL; + } + + playing=0; + + if(audio_req[0]) + { + if(audio_req[1]) + { + if(!CheckIO((struct IORequest *)audio_req[1])) + { + AbortIO((struct IORequest *)audio_req[1]); + WaitIO((struct IORequest *)audio_req[1]); + } + myfree(audio_req[1]); + } + + if(!CheckIO((struct IORequest *)audio_req[0])) + { + AbortIO((struct IORequest *)audio_req[0]); + WaitIO((struct IORequest *)audio_req[0]); + } + + CloseDevice((struct IORequest *)audio_req[0]); + DeleteIORequest((struct IORequest *)audio_req[0]); + audio_req[0]=audio_req[1]=NULL; + } + + if ( audio_port != NULL ) { + DeleteMsgPort(audio_port); + audio_port = NULL; + } + D(bug("...done!\n")); +} + +static int AHI_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ +// int width; + + D(bug("AHI opening...\n")); + + /* Determine the audio parameters from the AudioSpec */ + switch ( spec->format & 0xFF ) { + + case 8: { /* Signed 8 bit audio data */ + D(bug("Samples a 8 bit...\n")); + spec->format = AUDIO_S8; + this->hidden->bytespersample=1; + this->hidden->type = AHIST_M8S; + + } + break; + + case 16: { /* Signed 16 bit audio data */ + D(bug("Samples a 16 bit...\n")); + spec->format = AUDIO_S16MSB; + this->hidden->bytespersample=2; + this->hidden->type = AHIST_M16S; + } + break; + + default: { + SDL_SetError("Unsupported audio format"); + return(-1); + } + } + + D(bug("Before CalculateAudioSpec\n")); + /* Update the fragment size as size in bytes */ + SDL_CalculateAudioSpec(spec); + + D(bug("Before CreateMsgPort\n")); + + if(!(audio_port=CreateMsgPort())) + { + SDL_SetError("Unable to create a MsgPort"); + return -1; + } + + D(bug("Before CreateIORequest\n")); + + if(!(audio_req[0]=(struct AHIRequest *)CreateIORequest(audio_port,sizeof(struct AHIRequest)))) + { + SDL_SetError("Unable to create an AHIRequest"); + DeleteMsgPort(audio_port); + return -1; + } + + audio_req[0]->ahir_Version = 4; + + if(OpenDevice(AHINAME,0,(struct IORequest *)audio_req[0],NULL)) + { + SDL_SetError("Unable to open AHI device!\n"); + DeleteIORequest((struct IORequest *)audio_req[0]); + DeleteMsgPort(audio_port); + return -1; + } + + D(bug("AFTER opendevice\n")); + + /* Set output frequency */ + this->hidden->freq = spec->freq; + + D(bug("Before buffer allocation\n")); + + /* Allocate mixing buffer */ + mixbuf[0] = (Uint8 *)mymalloc(spec->size); + mixbuf[1] = (Uint8 *)mymalloc(spec->size); + + D(bug("Before audio_req allocation\n")); + + if(!(audio_req[1]=mymalloc(sizeof(struct AHIRequest)))) + { + SDL_OutOfMemory(); + return(-1); + } + + D(bug("Before audio_req memcpy\n")); + + memcpy(audio_req[1],audio_req[0],sizeof(struct AHIRequest)); + + if ( mixbuf[0] == NULL || mixbuf[1] == NULL ) { + SDL_OutOfMemory(); + return(-1); + } + + D(bug("Before mixbuf memset\n")); + + memset(mixbuf[0], spec->silence, spec->size); + memset(mixbuf[1], spec->silence, spec->size); + + current_buffer=0; + playing=0; + + D(bug("AHI opened: freq:%ld mixbuf:%lx/%lx buflen:%ld bits:%ld\n",spec->freq,mixbuf[0],mixbuf[1],spec->size,this->hidden->bytespersample*8)); + + /* We're ready to rock and roll. :-) */ + return(0); +} diff -r 000000000000 -r 74212992fb08 src/audio/amigaos/SDL_audio.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/amigaos/SDL_audio.c Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,532 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Allow access to a raw mixing buffer */ +#include +#include +#include +#include + +#include "SDL.h" +#include "SDL_audio.h" +#include "SDL_timer.h" +#include "SDL_error.h" +#include "SDL_audio_c.h" +#include "SDL_audiomem.h" +#include "SDL_sysaudio.h" + + +/* Available audio drivers */ +static AudioBootStrap *bootstrap[] = { +#ifdef unix + &AUDIO_bootstrap, +#endif +#ifdef linux + &DMA_bootstrap, +#endif +#ifdef ESD_SUPPORT + &ESD_bootstrap, +#endif +#ifdef ENABLE_DIRECTX + &DSOUND_bootstrap, +#endif +#ifdef ENABLE_WINDIB + &WAVEOUT_bootstrap, +#endif +#ifdef __BEOS__ + &BAUDIO_bootstrap, +#endif +#ifdef macintosh + &AUDIO_bootstrap, +#endif +#ifdef _AIX + &Paud_bootstrap, +#endif +#ifdef ENABLE_CYBERGRAPHICS + &AHI_bootstrap, +#endif + NULL +}; +SDL_AudioDevice *current_audio = NULL; + +/* Various local functions */ +int SDL_AudioInit(const char *driver_name); +void SDL_AudioQuit(void); + +struct SignalSemaphore AudioSem; + +/* The general mixing thread function */ +int RunAudio(void *audiop) +{ + SDL_AudioDevice *audio = (SDL_AudioDevice *)audiop; + Uint8 *stream; + int stream_len; + void *udata; + void (*fill)(void *userdata,Uint8 *stream, int len); + int silence,started=0; + + D(bug("Task audio started audio struct:<%lx>...\n",audiop)); + + D(bug("Before Openaudio...")); + if(audio->OpenAudio(audio, &audio->spec)==-1) + { + return(-1); + } + + D(bug("OpenAudio...OK\n")); + + /* Perform any thread setup */ + if ( audio->ThreadInit ) { + audio->ThreadInit(audio); + } + audio->threadid = SDL_ThreadID(); + + /* Set up the mixing function */ + fill = audio->spec.callback; + udata = audio->spec.userdata; + if ( audio->convert.needed ) { + if ( audio->convert.src_format == AUDIO_U8 ) { + silence = 0x80; + D(bug("*** Silence 0x80 ***\n")); + } else { + silence = 0; + } + stream_len = audio->convert.len; + } else { + silence = audio->spec.silence; + stream_len = audio->spec.size; + } + stream = audio->fake_stream; + + ObtainSemaphore(&AudioSem); + ReleaseSemaphore(&AudioSem); + + D(bug("Enering audio loop...\n")); + + D(if(audio->convert.needed)bug("*** Conversion needed.\n")); + + /* Loop, filling the audio buffers */ + while ( audio->enabled ) + { + /* Wait for new current buffer to finish playing */ + + if ( stream == audio->fake_stream ) + SDL_Delay((audio->spec.samples*1000)/audio->spec.freq); + else + { + if(started>1) + { +// D(bug("Waiting audio...\n")); + audio->WaitAudio(audio); + } + } + + ObtainSemaphore(&AudioSem); + + /* Fill the current buffer with sound */ + if ( audio->convert.needed ) { + stream = audio->convert.buf; + } else { + stream = audio->GetAudioBuf(audio); + } + + if(stream!=audio->fake_stream) + memset(stream, silence, stream_len); + + if ( ! audio->paused ) { + ObtainSemaphore(&audio->mixer_lock); + (*fill)(udata, stream, stream_len); + ReleaseSemaphore(&audio->mixer_lock); + } + + /* Convert the audio if necessary */ + if ( audio->convert.needed ) { + SDL_ConvertAudio(&audio->convert); + stream = audio->GetAudioBuf(audio); + memcpy(stream, audio->convert.buf,audio->convert.len_cvt); + } + + if(stream!=audio->fake_stream) + { +// D(bug("Playing stream at %lx\n",stream)); + + audio->PlayAudio(audio); + started++; + } + ReleaseSemaphore(&AudioSem); + + } + D(bug("Out of subtask loop...\n")); + + /* Wait for the audio to drain.. */ + if ( audio->WaitDone ) { + audio->WaitDone(audio); + } + + D(bug("WaitAudio...Done\n")); + + audio->CloseAudio(audio); + + D(bug("CloseAudio..Done, subtask exiting...\n")); + + return(0); +} + +int SDL_AudioInit(const char *driver_name) +{ + SDL_AudioDevice *audio; + int i = 0, idx; + + /* Check to make sure we don't overwrite 'current_audio' */ + if ( current_audio != NULL ) { + SDL_AudioQuit(); + } + + /* Select the proper audio driver */ + audio = NULL; + idx = 0; + + InitSemaphore(&AudioSem); + + if ( audio == NULL ) { + if ( driver_name != NULL ) { + if ( strrchr(driver_name, ':') != NULL ) { + idx = atoi(strrchr(driver_name, ':')+1); + } + for ( i=0; bootstrap[i]; ++i ) { + if (strncmp(bootstrap[i]->name, driver_name, + strlen(bootstrap[i]->name)) == 0) { + if ( bootstrap[i]->available() ) { + audio=bootstrap[i]->create(idx); + break; + } + } + } + } else { + for ( i=0; bootstrap[i]; ++i ) { + if ( bootstrap[i]->available() ) { + audio = bootstrap[i]->create(idx); + if ( audio != NULL ) { + break; + } + } + } + } + if ( audio == NULL ) { + SDL_SetError("No available audio device"); +#if 0 /* Don't fail SDL_Init() if audio isn't available. + SDL_OpenAudio() will handle it at that point. *sigh* + */ + return(-1); +#endif + } + } + current_audio = audio; + if ( current_audio ) { + current_audio->name = bootstrap[i]->name; + } + return(0); +} + +char *SDL_AudioDriverName(char *namebuf, int maxlen) +{ + if ( current_audio != NULL ) { + strncpy(namebuf, current_audio->name, maxlen-1); + namebuf[maxlen-1] = '\0'; + return(namebuf); + } + return(NULL); +} + +int SDL_OpenAudio(SDL_AudioSpec *desired, SDL_AudioSpec *obtained) +{ + SDL_AudioDevice *audio; + + /* Start up the audio driver, if necessary */ + if ( ! current_audio ) { + if ( (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) || + (current_audio == NULL) ) { + return(-1); + } + } + audio = current_audio; + + D(bug("Chiamata SDL_OpenAudio...\n")); + + /* Verify some parameters */ + if ( desired->callback == NULL ) { + SDL_SetError("SDL_OpenAudio() passed a NULL callback"); + return(-1); + } + switch ( desired->channels ) { + case 1: /* Mono */ + case 2: /* Stereo */ + break; + default: + SDL_SetError("1 (mono) and 2 (stereo) channels supported"); + return(-1); + } + + /* Create a semaphore for locking the sound buffers */ + InitSemaphore(&audio->mixer_lock); + + /* Calculate the silence and size of the audio specification */ + SDL_CalculateAudioSpec(desired); + + /* Open the audio subsystem */ + memcpy(&audio->spec, desired, sizeof(audio->spec)); + audio->convert.needed = 0; + audio->enabled = 1; + audio->paused = 1; + + ObtainSemaphore(&AudioSem); + + audio->thread = SDL_CreateThread(RunAudio, audio); + + if ( audio->thread == NULL ) { + ReleaseSemaphore(&AudioSem); + SDL_CloseAudio(); + SDL_SetError("Couldn't create audio thread"); + return(-1); + } + + /* If the audio driver changes the buffer size, accept it */ + if ( audio->spec.samples != desired->samples ) { + desired->samples = audio->spec.samples; + SDL_CalculateAudioSpec(desired); + } + + /* Allocate a fake audio memory buffer */ + audio->fake_stream = SDL_AllocAudioMem(audio->spec.size); + if ( audio->fake_stream == NULL ) { + ReleaseSemaphore(&AudioSem); + SDL_CloseAudio(); + SDL_OutOfMemory(); + return(-1); + } + + /* See if we need to do any conversion */ + if ( memcmp(desired, &audio->spec, sizeof(audio->spec)) == 0 ) { + /* Just copy over the desired audio specification */ + if ( obtained != NULL ) { + memcpy(obtained, &audio->spec, sizeof(audio->spec)); + } + } else { + /* Copy over the audio specification if possible */ + if ( obtained != NULL ) { + memcpy(obtained, &audio->spec, sizeof(audio->spec)); + } else { + /* Build an audio conversion block */ + D(bug("Need conversion:\n desired: C:%ld F:%ld T:%lx\navailable: C:%ld F:%ld T:%lx\n", + desired->channels, desired->freq, desired->format, + audio->spec.channels,audio->spec.freq,audio->spec.format)); + + Forbid(); + +// Magari poi lo sostiutisco con un semaforo. + + if ( SDL_BuildAudioCVT(&audio->convert, + desired->format, desired->channels, + desired->freq, + audio->spec.format, audio->spec.channels, + audio->spec.freq) < 0 ) { + ReleaseSemaphore(&AudioSem); + SDL_CloseAudio(); + return(-1); + } + if ( audio->convert.needed ) { + audio->convert.len = desired->size; + audio->convert.buf =(Uint8 *)SDL_AllocAudioMem( + audio->convert.len*audio->convert.len_mult); + if ( audio->convert.buf == NULL ) { + ReleaseSemaphore(&AudioSem); + SDL_CloseAudio(); + SDL_OutOfMemory(); + return(-1); + } + } + } + } + + ReleaseSemaphore(&AudioSem); + + D(bug("SDL_OpenAudio USCITA...\n")); + + return(0); +} + +SDL_audiostatus SDL_GetAudioStatus(void) +{ + SDL_AudioDevice *audio = current_audio; + SDL_audiostatus status; + + status = SDL_AUDIO_STOPPED; + if ( audio && audio->enabled ) { + if ( audio->paused ) { + status = SDL_AUDIO_PAUSED; + } else { + status = SDL_AUDIO_PLAYING; + } + } + return(status); +} + +void SDL_PauseAudio (int pause_on) +{ + SDL_AudioDevice *audio = current_audio; + + if ( audio ) { + audio->paused = pause_on; + } +} + +void SDL_LockAudio (void) +{ + SDL_AudioDevice *audio = current_audio; + + /* Obtain a lock on the mixing buffers */ + if ( audio ) { + if ( audio->thread && (SDL_ThreadID() == audio->threadid) ) { + return; + } + ObtainSemaphore(&audio->mixer_lock); + } +} + +void SDL_UnlockAudio (void) +{ + SDL_AudioDevice *audio = current_audio; + + /* Release lock on the mixing buffers */ + if ( audio ) { + if ( audio->thread && (SDL_ThreadID() == audio->threadid) ) { + return; + } + ReleaseSemaphore(&audio->mixer_lock); + } +} + +void SDL_CloseAudio (void) +{ + SDL_AudioDevice *audio = current_audio; + + if ( audio ) { + if(audio->enabled) + { + audio->enabled = 0; + + if ( audio->thread != NULL ) { + D(bug("Waiting audio thread...\n")); + SDL_WaitThread(audio->thread, NULL); + D(bug("...audio replied\n")); + } + } + + if ( audio->fake_stream != NULL ) { + SDL_FreeAudioMem(audio->fake_stream); + audio->fake_stream=NULL; + } + if ( audio->convert.needed && current_audio->convert.buf!=NULL) { + SDL_FreeAudioMem(audio->convert.buf); + current_audio->convert.buf=NULL; + } + } + SDL_QuitSubSystem(SDL_INIT_AUDIO); +} + +void SDL_AudioQuit(void) +{ + if ( current_audio ) { + if(current_audio->enabled) + { + D(bug("Closing audio in AudioQuit...\n")); + current_audio->enabled = 0; + + if ( current_audio->thread != NULL ) { + D(bug("Waiting audio thread...\n")); + SDL_WaitThread(current_audio->thread, NULL); + D(bug("...audio replied\n")); + } + } + if ( current_audio->fake_stream != NULL ) { + SDL_FreeAudioMem(current_audio->fake_stream); + } + if ( current_audio->convert.needed && + current_audio->convert.buf) { + SDL_FreeAudioMem(current_audio->convert.buf); + } + + current_audio->free(current_audio); + current_audio = NULL; + } +} + +#define NUM_FORMATS 6 +static int format_idx; +static int format_idx_sub; +static Uint16 format_list[NUM_FORMATS][NUM_FORMATS] = { + { AUDIO_U8, AUDIO_S8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB }, + { AUDIO_S8, AUDIO_U8, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB }, + { AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_U8, AUDIO_S8 }, + { AUDIO_S16MSB, AUDIO_S16LSB, AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_U8, AUDIO_S8 }, + { AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_U8, AUDIO_S8 }, + { AUDIO_U16MSB, AUDIO_U16LSB, AUDIO_S16MSB, AUDIO_S16LSB, AUDIO_U8, AUDIO_S8 }, +}; + +Uint16 SDL_FirstAudioFormat(Uint16 format) +{ + for ( format_idx=0; format_idx < NUM_FORMATS; ++format_idx ) { + if ( format_list[format_idx][0] == format ) { + break; + } + } + format_idx_sub = 0; + return(SDL_NextAudioFormat()); +} + +Uint16 SDL_NextAudioFormat(void) +{ + if ( (format_idx == NUM_FORMATS) || (format_idx_sub == NUM_FORMATS) ) { + return(0); + } + return(format_list[format_idx][format_idx_sub++]); +} + +void SDL_CalculateAudioSpec(SDL_AudioSpec *spec) +{ + switch (spec->format) { + case AUDIO_U8: + spec->silence = 0x80; + break; + default: + spec->silence = 0x00; + break; + } + spec->size = (spec->format&0xFF)/8; + spec->size *= spec->channels; + spec->size *= spec->samples; +} diff -r 000000000000 -r 74212992fb08 src/audio/amigaos/SDL_lowaudio.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/amigaos/SDL_lowaudio.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,58 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +#ifndef _SDL_lowaudio_h +#define _SDL_lowaudio_h + +// #include + +#include "SDL_sysaudio.h" +#include +#include +#include + +/* Hidden "this" pointer for the audio functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData { + /* The handle for the audio device */ + struct AHIRequest *audio_req[2]; + struct MsgPort *audio_port; + Sint32 freq,type,bytespersample; + Uint8 *mixbuf[2]; /* The app mixing buffer */ + int current_buffer; + Uint32 playing; +}; + +/* Old variable names */ +#define audio_port (this->hidden->audio_port) +#define audio_req (this->hidden->audio_req) +#define mixbuf (this->hidden->mixbuf) +#define current_buffer (this->hidden->current_buffer) +#define playing (this->hidden->playing) + +#endif /* _SDL_lowaudio_h */ diff -r 000000000000 -r 74212992fb08 src/audio/amigaos/SDL_sysaudio.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/amigaos/SDL_sysaudio.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,142 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +#ifndef _SDL_sysaudio_h +#define _SDL_sysaudio_h + +#include "SDL_mutex.h" +#include "SDL_thread.h" + +#include +#include +#ifdef __SASC +#include +#else +#include +#endif + +#include +#include "mydebug.h" + +/* The SDL audio driver */ +typedef struct SDL_AudioDevice SDL_AudioDevice; + +/* Define the SDL audio driver structure */ +#define _THIS SDL_AudioDevice *_this +#ifndef _STATUS +#define _STATUS SDL_status *status +#endif +struct SDL_AudioDevice { + /* * * */ + /* The name of this audio driver */ + const char *name; + + /* * * */ + /* Public driver functions */ + int (*OpenAudio)(_THIS, SDL_AudioSpec *spec); + void (*ThreadInit)(_THIS); /* Called by audio thread at start */ + void (*WaitAudio)(_THIS); + void (*PlayAudio)(_THIS); + Uint8 *(*GetAudioBuf)(_THIS); + void (*WaitDone)(_THIS); + void (*CloseAudio)(_THIS); + + /* * * */ + /* Data common to all devices */ + + /* The current audio specification (shared with audio thread) */ + SDL_AudioSpec spec; + + /* An audio conversion block for audio format emulation */ + SDL_AudioCVT convert; + + /* Current state flags */ + int enabled; + int paused; + + /* Fake audio buffer for when the audio hardware is busy */ + Uint8 *fake_stream; + + /* A semaphore for locking the mixing buffers */ + struct SignalSemaphore mixer_lock; + + /* A thread to feed the audio device */ + SDL_Thread *thread; + Uint32 threadid; + + /* * * */ + /* Data private to this driver */ + struct SDL_PrivateAudioData *hidden; + + /* * * */ + /* The function used to dispose of this structure */ + void (*free)(_THIS); +}; +#undef _THIS + +typedef struct AudioBootStrap { + const char *name; + int (*available)(void); + SDL_AudioDevice *(*create)(int devindex); +} AudioBootStrap; + +#ifdef ESD_SUPPORT +extern AudioBootStrap ESD_bootstrap; +#endif +#ifdef linux +extern AudioBootStrap DMA_bootstrap; +#endif +#ifdef unix +extern AudioBootStrap AUDIO_bootstrap; +#endif +#ifdef ENABLE_WINDIB +extern AudioBootStrap WAVEOUT_bootstrap; +#endif +#ifdef ENABLE_DIRECTX +extern AudioBootStrap DSOUND_bootstrap; +#endif +#ifdef __BEOS__ +extern AudioBootStrap BAUDIO_bootstrap; +#endif +#ifdef macintosh +extern AudioBootStrap AUDIO_bootstrap; +#endif +#ifdef _AIX +extern AudioBootStrap Paud_bootstrap; +#endif +#ifdef ENABLE_CYBERGRAPHICS +extern AudioBootStrap AHI_bootstrap; +#endif + +/* This is the current audio device */ +extern SDL_AudioDevice *current_audio; + +#ifndef __SASC +extern struct ExecBase *SysBase; +#endif + +#endif /* _SDL_sysaudio_h */ diff -r 000000000000 -r 74212992fb08 src/audio/arts/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/arts/.cvsignore Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,6 @@ +Makefile.in +Makefile +.libs +*.o +*.lo +*.la diff -r 000000000000 -r 74212992fb08 src/audio/arts/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/arts/Makefile.am Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,9 @@ + +## Makefile.am for SDL using the Analog Realtime Synthesizer sound driver + +noinst_LTLIBRARIES = libaudio_arts.la +libaudio_arts_la_SOURCES = $(SRCS) + +# The SDL audio driver sources +SRCS = SDL_artsaudio.c \ + SDL_artsaudio.h diff -r 000000000000 -r 74212992fb08 src/audio/arts/SDL_artsaudio.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/arts/SDL_artsaudio.c Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,247 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Allow access to a raw mixing buffer */ + +#include +#include +#include +#include +#include +#include +#include + +#include "SDL_audio.h" +#include "SDL_error.h" +#include "SDL_audiomem.h" +#include "SDL_audio_c.h" +#include "SDL_timer.h" +#include "SDL_audiodev_c.h" +#include "SDL_artsaudio.h" + +/* The tag name used by artsc audio */ +#define ARTSC_DRIVER_NAME "artsc" + +/* Audio driver functions */ +static int ARTSC_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void ARTSC_WaitAudio(_THIS); +static void ARTSC_PlayAudio(_THIS); +static Uint8 *ARTSC_GetAudioBuf(_THIS); +static void ARTSC_CloseAudio(_THIS); + +/* Audio driver bootstrap functions */ + +static int Audio_Available(void) +{ + if(arts_init()) + return 0; + else + return 1; +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + free(device->hidden); + free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + free(this); + } + return(0); + } + memset(this->hidden, 0, (sizeof *this->hidden)); + stream = 0; + + /* Set the function pointers */ + this->OpenAudio = ARTSC_OpenAudio; + this->WaitAudio = ARTSC_WaitAudio; + this->PlayAudio = ARTSC_PlayAudio; + this->GetAudioBuf = ARTSC_GetAudioBuf; + this->CloseAudio = ARTSC_CloseAudio; + + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap ARTSC_bootstrap = { + ARTSC_DRIVER_NAME, "Analog Realtime Synthesizer", + Audio_Available, Audio_CreateDevice +}; + +/* This function waits until it is possible to write a full sound buffer */ +static void ARTSC_WaitAudio(_THIS) +{ + Sint32 ticks; + + /* Check to see if the thread-parent process is still alive */ + { static int cnt = 0; + /* Note that this only works with thread implementations + that use a different process id for each thread. + */ + if (parent && (((++cnt)%10) == 0)) { /* Check every 10 loops */ + if ( kill(parent, 0) < 0 ) { + this->enabled = 0; + } + } + } + + /* Use timer for general audio synchronization */ + ticks = ((Sint32)(next_frame - SDL_GetTicks()))-FUDGE_TICKS; + if ( ticks > 0 ) { + SDL_Delay(ticks); + } +} + +static void ARTSC_PlayAudio(_THIS) +{ + int written; + + /* Write the audio data */ + written = arts_write(stream, mixbuf, mixlen); + + /* If timer synchronization is enabled, set the next write frame */ + if ( frame_ticks ) { + next_frame += frame_ticks; + } + + /* If we couldn't write, assume fatal error for now */ + if ( written < 0 ) { + this->enabled = 0; + } +#ifdef DEBUG_AUDIO + fprintf(stderr, "Wrote %d bytes of audio data\n", written); +#endif +} + +static Uint8 *ARTSC_GetAudioBuf(_THIS) +{ + return(mixbuf); +} + +static void ARTSC_CloseAudio(_THIS) +{ + if ( mixbuf != NULL ) { + SDL_FreeAudioMem(mixbuf); + mixbuf = NULL; + } + if ( stream ) { + arts_close_stream(stream); + stream = 0; + } +} + +static int ARTSC_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + int bits, frag_spec; + Uint16 test_format, format; + + /* Reset the timer synchronization flag */ + frame_ticks = 0.0; + + mixbuf = NULL; + + /* Try for a closest match on audio format */ + format = 0; + bits = 0; + for ( test_format = SDL_FirstAudioFormat(spec->format); + ! format && test_format; ) { +#ifdef DEBUG_AUDIO + fprintf(stderr, "Trying format 0x%4.4x\n", test_format); +#endif + switch ( test_format ) { + case AUDIO_U8: + bits = 8; + format = 1; + break; + case AUDIO_S16LSB: + bits = 16; + format = 1; + break; + default: + format = 0; + break; + } + if ( ! format ) { + test_format = SDL_NextAudioFormat(); + } + } + if ( format == 0 ) { + SDL_SetError("Couldn't find any hardware audio formats"); + return(-1); + } + spec->format = test_format; + + stream = arts_play_stream(spec->freq, bits, spec->channels, "SDL"); + + /* Calculate the final parameters for this audio specification */ + SDL_CalculateAudioSpec(spec); + + /* Determine the power of two of the fragment size */ + for ( frag_spec = 0; (0x01<size; ++frag_spec ); + if ( (0x01<size ) { + SDL_SetError("Fragment size must be a power of two"); + return(-1); + } + frag_spec |= 0x00020000; /* two fragments, for low latency */ + +#ifdef ARTS_P_PACKET_SETTINGS + arts_stream_set(stream, ARTS_P_PACKET_SETTINGS, frag_spec); +#else + arts_stream_set(stream, ARTS_P_PACKET_SIZE, frag_spec&0xffff); + arts_stream_set(stream, ARTS_P_PACKET_COUNT, frag_spec>>16); +#endif + spec->size = arts_stream_get(stream, ARTS_P_PACKET_SIZE); + + /* Allocate mixing buffer */ + mixlen = spec->size; + mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen); + if ( mixbuf == NULL ) { + return(-1); + } + memset(mixbuf, spec->silence, spec->size); + + /* Get the parent process id (we're the parent of the audio thread) */ + parent = getpid(); + + /* We're ready to rock and roll. :-) */ + return(0); +} diff -r 000000000000 -r 74212992fb08 src/audio/arts/SDL_artsaudio.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/arts/SDL_artsaudio.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,63 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +#ifndef _SDL_artscaudio_h +#define _SDL_artscaudio_h + +#include +#include "SDL_sysaudio.h" + +/* Hidden "this" pointer for the video functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData { + /* The stream descriptor for the audio device */ + arts_stream_t stream; + + /* The parent process id, to detect when application quits */ + pid_t parent; + + /* Raw mixing buffer */ + Uint8 *mixbuf; + int mixlen; + + /* Support for audio timing using a timer, in addition to select() */ + float frame_ticks; + float next_frame; +}; +#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ + +/* Old variable names */ +#define stream (this->hidden->stream) +#define parent (this->hidden->parent) +#define mixbuf (this->hidden->mixbuf) +#define mixlen (this->hidden->mixlen) +#define frame_ticks (this->hidden->frame_ticks) +#define next_frame (this->hidden->next_frame) + +#endif /* _SDL_artscaudio_h */ + diff -r 000000000000 -r 74212992fb08 src/audio/baudio/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/baudio/.cvsignore Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,6 @@ +Makefile.in +Makefile +.libs +*.o +*.lo +*.la diff -r 000000000000 -r 74212992fb08 src/audio/baudio/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/baudio/Makefile.am Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,9 @@ + +## Makefile.am for SDL using the BeOS BSoundPlayer sound driver + +noinst_LTLIBRARIES = libaudio_baudio.la +libaudio_baudio_la_SOURCES = $(SRCS) + +# The SDL audio driver sources +SRCS = SDL_beaudio.cc \ + SDL_beaudio.h diff -r 000000000000 -r 74212992fb08 src/audio/baudio/SDL_beaudio.cc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/baudio/SDL_beaudio.cc Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,211 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Allow access to the audio stream on BeOS */ + +#include +#include +#include +#include + +#include "SDL_BeApp.h" + +extern "C" { + +#include "SDL_audio.h" +#include "SDL_audio_c.h" +#include "SDL_sysaudio.h" +#include "SDL_systhread_c.h" +#include "SDL_beaudio.h" + + +/* Audio driver functions */ +static int BE_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void BE_WaitAudio(_THIS); +static void BE_PlayAudio(_THIS); +static Uint8 *BE_GetAudioBuf(_THIS); +static void BE_CloseAudio(_THIS); + +/* Audio driver bootstrap functions */ + +static int Audio_Available(void) +{ + return(1); +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + free(device->hidden); + free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *device; + + /* Initialize all variables that we clean on shutdown */ + device = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice)); + if ( device ) { + memset(device, 0, (sizeof *device)); + device->hidden = (struct SDL_PrivateAudioData *) + malloc((sizeof *device->hidden)); + } + if ( (device == NULL) || (device->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( device ) { + free(device); + } + return(0); + } + memset(device->hidden, 0, (sizeof *device->hidden)); + + /* Set the function pointers */ + device->OpenAudio = BE_OpenAudio; + device->WaitAudio = BE_WaitAudio; + device->PlayAudio = BE_PlayAudio; + device->GetAudioBuf = BE_GetAudioBuf; + device->CloseAudio = BE_CloseAudio; + + device->free = Audio_DeleteDevice; + + return device; +} + +AudioBootStrap BAUDIO_bootstrap = { + "baudio", "BeOS BSoundPlayer", + Audio_Available, Audio_CreateDevice +}; + +/* The BeOS callback for handling the audio buffer */ +static void FillSound(void *device, void *stream, size_t len, + const media_raw_audio_format &format) +{ + SDL_AudioDevice *audio = (SDL_AudioDevice *)device; + + /* Silence the buffer, since it's ours */ + memset(stream, audio->spec.silence, len); + + /* Only do soemthing if audio is enabled */ + if ( ! audio->enabled ) + return; + + if ( ! audio->paused ) { + if ( audio->convert.needed ) { + SDL_mutexP(audio->mixer_lock); + (*audio->spec.callback)(audio->spec.userdata, + (Uint8 *)audio->convert.buf,audio->convert.len); + SDL_mutexV(audio->mixer_lock); + SDL_ConvertAudio(&audio->convert); + memcpy(stream,audio->convert.buf,audio->convert.len_cvt); + } else { + SDL_mutexP(audio->mixer_lock); + (*audio->spec.callback)(audio->spec.userdata, + (Uint8 *)stream, len); + SDL_mutexV(audio->mixer_lock); + } + } + return; +} + +/* Dummy functions -- we don't use thread-based audio */ +void BE_WaitAudio(_THIS) +{ + return; +} +void BE_PlayAudio(_THIS) +{ + return; +} +Uint8 *BE_GetAudioBuf(_THIS) +{ + return(NULL); +} + +void BE_CloseAudio(_THIS) +{ + if ( audio_obj ) { + audio_obj->Stop(); + delete audio_obj; + audio_obj = NULL; + } + + /* Quit the Be Application, if there's nothing left to do */ + SDL_QuitBeApp(); +} + +int BE_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + media_raw_audio_format format; + + /* Initialize the Be Application, if it's not already started */ + if ( SDL_InitBeApp() < 0 ) { + return(-1); + } + + /* Parse the audio format and fill the Be raw audio format */ + format.frame_rate = (float)spec->freq; + format.channel_count = spec->channels; + switch (spec->format&~0x1000) { + case AUDIO_S8: + /* Signed 8-bit audio unsupported, convert to U8 */ + spec->format = AUDIO_U8; + case AUDIO_U8: + format.format = media_raw_audio_format::B_AUDIO_UCHAR; + format.byte_order = 0; + break; + case AUDIO_U16: + /* Unsigned 16-bit audio unsupported, convert to S16 */ + spec->format ^= 0x8000; + case AUDIO_S16: + format.format = media_raw_audio_format::B_AUDIO_SHORT; + if ( spec->format & 0x1000 ) { + format.byte_order = 1; /* Big endian */ + } else { + format.byte_order = 2; /* Little endian */ + } + break; + } + format.buffer_size = spec->samples; + + /* Calculate the final parameters for this audio specification */ + SDL_CalculateAudioSpec(spec); + + /* Subscribe to the audio stream (creates a new thread) */ + { sigset_t omask; + SDL_MaskSignals(&omask); + audio_obj = new BSoundPlayer(&format, "SDL Audio", FillSound, + NULL, _this); + SDL_UnmaskSignals(&omask); + } + audio_obj->Start(); + audio_obj->SetHasData(true); + + /* We're running! */ + return(1); +} + +}; /* Extern C */ diff -r 000000000000 -r 74212992fb08 src/audio/baudio/SDL_beaudio.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/baudio/SDL_beaudio.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,43 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +#ifndef _SDL_lowaudio_h +#define _SDL_lowaudio_h + +#include "SDL_sysaudio.h" + +/* Hidden "this" pointer for the video functions */ +#define _THIS SDL_AudioDevice *_this + +struct SDL_PrivateAudioData { + BSoundPlayer *audio_obj; +}; + +/* Old variable names */ +#define audio_obj (_this->hidden->audio_obj) + +#endif /* _SDL_lowaudio_h */ diff -r 000000000000 -r 74212992fb08 src/audio/dma/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/dma/.cvsignore Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,6 @@ +Makefile.in +Makefile +.libs +*.o +*.lo +*.la diff -r 000000000000 -r 74212992fb08 src/audio/dma/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/dma/Makefile.am Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,9 @@ + +## Makefile.am for SDL using the OSS /dev/dsp DMA sound driver + +noinst_LTLIBRARIES = libaudio_dma.la +libaudio_dma_la_SOURCES = $(SRCS) + +# The SDL audio driver sources +SRCS = SDL_dmaaudio.c \ + SDL_dmaaudio.h diff -r 000000000000 -r 74212992fb08 src/audio/dma/SDL_dmaaudio.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/dma/SDL_dmaaudio.c Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,466 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Allow access to a raw mixing buffer */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef linux +#include +#endif +#ifdef __bsdi__ +#include +#endif +#ifdef __FreeBSD__ +#include +#endif +#ifdef __USLC__ +#include +#endif + +#ifndef MAP_FAILED +#define MAP_FAILED ((Uint8 *)-1) +#endif + +#include "SDL_audio.h" +#include "SDL_error.h" +#include "SDL_audiomem.h" +#include "SDL_audio_c.h" +#include "SDL_timer.h" +#include "SDL_audiodev_c.h" +#include "SDL_dmaaudio.h" + +/* The tag name used by DMA audio */ +#define DMA_DRIVER_NAME "dma" + +/* Open the audio device for playback, and don't block if busy */ +#define OPEN_FLAGS (O_RDWR|O_NONBLOCK) + +/* Audio driver functions */ +static int DMA_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void DMA_WaitAudio(_THIS); +static void DMA_PlayAudio(_THIS); +static Uint8 *DMA_GetAudioBuf(_THIS); +static void DMA_CloseAudio(_THIS); + +/* Audio driver bootstrap functions */ + +static int Audio_Available(void) +{ + int available; + int fd; + + available = 0; + + fd = SDL_OpenAudioPath(NULL, 0, OPEN_FLAGS, 0); + if ( fd >= 0 ) { + int caps; + struct audio_buf_info info; + + if ( (ioctl(fd, SNDCTL_DSP_GETCAPS, &caps) == 0) && + (caps & DSP_CAP_TRIGGER) && (caps & DSP_CAP_MMAP) && + (ioctl(fd, SNDCTL_DSP_GETOSPACE, &info) == 0) ) { + available = 1; + } + close(fd); + } + return(available); +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + free(device->hidden); + free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + free(this); + } + return(0); + } + memset(this->hidden, 0, (sizeof *this->hidden)); + audio_fd = -1; + + /* Set the function pointers */ + this->OpenAudio = DMA_OpenAudio; + this->WaitAudio = DMA_WaitAudio; + this->PlayAudio = DMA_PlayAudio; + this->GetAudioBuf = DMA_GetAudioBuf; + this->CloseAudio = DMA_CloseAudio; + + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap DMA_bootstrap = { + DMA_DRIVER_NAME, "OSS /dev/dsp DMA audio", + Audio_Available, Audio_CreateDevice +}; + +/* This function waits until it is possible to write a full sound buffer */ +static void DMA_WaitAudio(_THIS) +{ + fd_set fdset; + + /* Check to see if the thread-parent process is still alive */ + { static int cnt = 0; + /* Note that this only works with thread implementations + that use a different process id for each thread. + */ + if (parent && (((++cnt)%10) == 0)) { /* Check every 10 loops */ + if ( kill(parent, 0) < 0 ) { + this->enabled = 0; + } + } + } + + /* See if we need to use timed audio synchronization */ + if ( frame_ticks ) { + /* Use timer for general audio synchronization */ + Sint32 ticks; + + ticks = ((Sint32)(next_frame - SDL_GetTicks()))-FUDGE_TICKS; + if ( ticks > 0 ) { + SDL_Delay(ticks); + } + } else { + /* Use select() for audio synchronization */ + struct timeval timeout; + FD_ZERO(&fdset); + FD_SET(audio_fd, &fdset); + timeout.tv_sec = 10; + timeout.tv_usec = 0; +#ifdef DEBUG_AUDIO + fprintf(stderr, "Waiting for audio to get ready\n"); +#endif + if ( select(audio_fd+1, NULL, &fdset, NULL, &timeout) <= 0 ) { + const char *message = +#ifdef AUDIO_OSPACE_HACK + "Audio timeout - buggy audio driver? (trying ospace)"; +#else + "Audio timeout - buggy audio driver? (disabled)"; +#endif + /* In general we should never print to the screen, + but in this case we have no other way of letting + the user know what happened. + */ + fprintf(stderr, "SDL: %s\n", message); +#ifdef AUDIO_OSPACE_HACK + /* We may be able to use GET_OSPACE trick */ + frame_ticks = (float)(this->spec->samples*1000) / + this->spec->freq; + next_frame = SDL_GetTicks()+frame_ticks; +#else + this->enabled = 0; + /* Don't try to close - may hang */ + audio_fd = -1; +#ifdef DEBUG_AUDIO + fprintf(stderr, "Done disabling audio\n"); +#endif +#endif /* AUDIO_OSPACE_HACK */ + } +#ifdef DEBUG_AUDIO + fprintf(stderr, "Ready!\n"); +#endif + } +} + +static void DMA_PlayAudio(_THIS) +{ + /* If timer synchronization is enabled, set the next write frame */ + if ( frame_ticks ) { + next_frame += frame_ticks; + } + return; +} + +static Uint8 *DMA_GetAudioBuf(_THIS) +{ + count_info info; + int playing; + int filling; + + /* Get number of blocks, looping if we're not using select() */ + do { + if ( ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &info) < 0 ) { + /* Uh oh... */ + this->enabled = 0; + return(NULL); + } + } while ( frame_ticks && (info.blocks < 1) ); +#ifdef DEBUG_AUDIO + if ( info.blocks > 1 ) { + printf("Warning: audio underflow (%d frags)\n", info.blocks-1); + } +#endif + playing = info.ptr / this->spec.size; + filling = (playing + 1)%num_buffers; + return (dma_buf + (filling * this->spec.size)); +} + +static void DMA_CloseAudio(_THIS) +{ + if ( dma_buf != NULL ) { + munmap(dma_buf, dma_len); + dma_buf = NULL; + } + if ( audio_fd >= 0 ) { + close(audio_fd); + audio_fd = -1; + } +} + +static int DMA_ReopenAudio(_THIS, const char *audiodev, int format, int stereo, + SDL_AudioSpec *spec) +{ + int frag_spec; + int value; + + /* Close and then reopen the audio device */ + close(audio_fd); + audio_fd = open(audiodev, O_RDWR, 0); + if ( audio_fd < 0 ) { + SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno)); + return(-1); + } + ioctl(audio_fd, SNDCTL_DSP_RESET, 0); + + /* Calculate the final parameters for this audio specification */ + SDL_CalculateAudioSpec(spec); + + /* Determine the power of two of the fragment size */ + for ( frag_spec = 0; (0x01<size; ++frag_spec ); + if ( (0x01<size ) { + SDL_SetError("Fragment size must be a power of two"); + return(-1); + } + + /* Set the audio buffering parameters */ + if ( ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag_spec) < 0 ) { + SDL_SetError("Couldn't set audio fragment spec"); + return(-1); + } + + /* Set the audio format */ + value = format; + if ( (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) || + (value != format) ) { + SDL_SetError("Couldn't set audio format"); + return(-1); + } + + /* Set mono or stereo audio */ + value = (spec->channels > 1); + if ( (ioctl(audio_fd, SNDCTL_DSP_STEREO, &stereo) < 0) || + (value != stereo) ) { + SDL_SetError("Couldn't set audio channels"); + return(-1); + } + + /* Set the DSP frequency */ + value = spec->freq; + if ( ioctl(audio_fd, SOUND_PCM_WRITE_RATE, &value) < 0 ) { + SDL_SetError("Couldn't set audio frequency"); + return(-1); + } + spec->freq = value; + + /* We successfully re-opened the audio */ + return(0); +} + +static int DMA_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + char audiodev[1024]; + int format; + int stereo; + int value; + Uint16 test_format; + struct audio_buf_info info; + + /* Reset the timer synchronization flag */ + frame_ticks = 0.0; + + /* Open the audio device */ + audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0); + if ( audio_fd < 0 ) { + SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno)); + return(-1); + } + dma_buf = NULL; + ioctl(audio_fd, SNDCTL_DSP_RESET, 0); + + /* Get a list of supported hardware formats */ + if ( ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0 ) { + SDL_SetError("Couldn't get audio format list"); + return(-1); + } + + /* Try for a closest match on audio format */ + format = 0; + for ( test_format = SDL_FirstAudioFormat(spec->format); + ! format && test_format; ) { +#ifdef DEBUG_AUDIO + fprintf(stderr, "Trying format 0x%4.4x\n", test_format); +#endif + switch ( test_format ) { + case AUDIO_U8: + if ( value & AFMT_U8 ) { + format = AFMT_U8; + } + break; + case AUDIO_S8: + if ( value & AFMT_S8 ) { + format = AFMT_S8; + } + break; + case AUDIO_S16LSB: + if ( value & AFMT_S16_LE ) { + format = AFMT_S16_LE; + } + break; + case AUDIO_S16MSB: + if ( value & AFMT_S16_BE ) { + format = AFMT_S16_BE; + } + break; + case AUDIO_U16LSB: + if ( value & AFMT_U16_LE ) { + format = AFMT_U16_LE; + } + break; + case AUDIO_U16MSB: + if ( value & AFMT_U16_BE ) { + format = AFMT_U16_BE; + } + break; + default: + break; + } + if ( ! format ) { + test_format = SDL_NextAudioFormat(); + } + } + if ( format == 0 ) { + SDL_SetError("Couldn't find any hardware audio formats"); + return(-1); + } + spec->format = test_format; + + /* Set the audio format */ + value = format; + if ( (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) || + (value != format) ) { + SDL_SetError("Couldn't set audio format"); + return(-1); + } + + /* Set mono or stereo audio (currently only two channels supported) */ + stereo = (spec->channels > 1); + ioctl(audio_fd, SNDCTL_DSP_STEREO, &stereo); + if ( stereo ) { + spec->channels = 2; + } else { + spec->channels = 1; + } + + /* Because some drivers don't allow setting the buffer size + after setting the format, we must re-open the audio device + once we know what format and channels are supported + */ + if ( DMA_ReopenAudio(this, audiodev, format, stereo, spec) < 0 ) { + /* Error is set by DMA_ReopenAudio() */ + return(-1); + } + + /* Memory map the audio buffer */ + if ( ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info) < 0 ) { + SDL_SetError("Couldn't get OSPACE parameters"); + return(-1); + } + spec->size = info.fragsize; + spec->samples = spec->size / ((spec->format & 0xFF) / 8); + spec->samples /= spec->channels; + num_buffers = info.fragstotal; + dma_len = num_buffers*spec->size; + dma_buf = (Uint8 *)mmap(NULL, dma_len, PROT_WRITE, MAP_SHARED, + audio_fd, 0); + if ( dma_buf == MAP_FAILED ) { + SDL_SetError("DMA memory map failed"); + dma_buf = NULL; + return(-1); + } + memset(dma_buf, spec->silence, dma_len); + + /* Check to see if we need to use select() workaround */ + { char *workaround; + workaround = getenv("SDL_DSP_NOSELECT"); + if ( workaround ) { + frame_ticks = (float)(spec->samples*1000)/spec->freq; + next_frame = SDL_GetTicks()+frame_ticks; + } + } + + /* Trigger audio playback */ + value = 0; + ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &value); + value = PCM_ENABLE_OUTPUT; + if ( ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &value) < 0 ) { + SDL_SetError("Couldn't trigger audio output"); + return(-1); + } + + /* Get the parent process id (we're the parent of the audio thread) */ + parent = getpid(); + + /* We're ready to rock and roll. :-) */ + return(0); +} diff -r 000000000000 -r 74212992fb08 src/audio/dma/SDL_dmaaudio.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/dma/SDL_dmaaudio.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,63 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +#ifndef _SDL_dspaudio_h +#define _SDL_dspaudio_h + +#include "SDL_sysaudio.h" + +/* Hidden "this" pointer for the video functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData { + /* The file descriptor for the audio device */ + int audio_fd; + + /* The parent process id, to detect when application quits */ + pid_t parent; + + /* Raw mixing buffer */ + Uint8 *dma_buf; + int dma_len; + int num_buffers; + + /* Support for audio timing using a timer, in addition to select() */ + float frame_ticks; + float next_frame; +}; +#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ + +/* Old variable names */ +#define audio_fd (this->hidden->audio_fd) +#define parent (this->hidden->parent) +#define dma_buf (this->hidden->dma_buf) +#define dma_len (this->hidden->dma_len) +#define num_buffers (this->hidden->num_buffers) +#define frame_ticks (this->hidden->frame_ticks) +#define next_frame (this->hidden->next_frame) + +#endif /* _SDL_dspaudio_h */ diff -r 000000000000 -r 74212992fb08 src/audio/dmedia/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/dmedia/.cvsignore Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,6 @@ +Makefile.in +Makefile +.libs +*.o +*.lo +*.la diff -r 000000000000 -r 74212992fb08 src/audio/dmedia/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/dmedia/Makefile.am Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,9 @@ + +## Makefile.am for SDL using the IRIX DMedia sound driver + +noinst_LTLIBRARIES = libaudio_dmedia.la +libaudio_dmedia_la_SOURCES = $(SRCS) + +# The SDL audio driver sources +SRCS = SDL_irixaudio.c \ + SDL_irixaudio.h diff -r 000000000000 -r 74212992fb08 src/audio/dmedia/SDL_irixaudio.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/dmedia/SDL_irixaudio.c Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,201 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + 5635-34 Springhouse Dr. + Pleasanton, CA 94588 (USA) + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Allow access to a raw mixing buffer (For IRIX 6.5 and higher) */ + +#include + +#include "SDL_endian.h" +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "SDL_audiomem.h" +#include "SDL_audio_c.h" +#include "SDL_irixaudio.h" + + +/* Audio driver functions */ +static int AL_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void AL_WaitAudio(_THIS); +static void AL_PlayAudio(_THIS); +static Uint8 *AL_GetAudioBuf(_THIS); +static void AL_CloseAudio(_THIS); + +/* Audio driver bootstrap functions */ + +static int Audio_Available(void) +{ + return 1; +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + free(device->hidden); + free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + free(this); + } + return(0); + } + memset(this->hidden, 0, (sizeof *this->hidden)); + + /* Set the function pointers */ + this->OpenAudio = AL_OpenAudio; + this->WaitAudio = AL_WaitAudio; + this->PlayAudio = AL_PlayAudio; + this->GetAudioBuf = AL_GetAudioBuf; + this->CloseAudio = AL_CloseAudio; + + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap AUDIO_bootstrap = { + "AL", "IRIX DMedia audio", + Audio_Available, Audio_CreateDevice +}; + + +void static AL_WaitAudio(_THIS) +{ + Sint32 timeleft; + + timeleft = this->spec.samples - alGetFillable(audio_port); + if ( timeleft > 0 ) { + timeleft /= (this->spec.freq/1000); + SDL_Delay((Uint32)timeleft); + } +} + +static void AL_PlayAudio(_THIS) +{ + /* Write the audio data out */ + if ( alWriteFrames(audio_port, mixbuf, this->spec.samples) < 0 ) { + /* Assume fatal error, for now */ + this->enabled = 0; + } +} + +static Uint8 *AL_GetAudioBuf(_THIS) +{ + return(mixbuf); +} + +static void AL_CloseAudio(_THIS) +{ + if ( mixbuf != NULL ) { + SDL_FreeAudioMem(mixbuf); + mixbuf = NULL; + } + if ( audio_port != NULL ) { + ALcloseport(audio_port); + audio_port = NULL; + } +} + +static int AL_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + ALconfig audio_config; + ALpv audio_param; + int width; + + /* Determine the audio parameters from the AudioSpec */ + switch ( spec->format & 0xFF ) { + + case 8: { /* Signed 8 bit audio data */ + spec->format = AUDIO_S8; + width = AL_SAMPLE_8; + } + break; + + case 16: { /* Signed 16 bit audio data */ + spec->format = AUDIO_S16MSB; + width = AL_SAMPLE_16; + } + break; + + default: { + SDL_SetError("Unsupported audio format"); + return(-1); + } + } + + /* Update the fragment size as size in bytes */ + SDL_CalculateAudioSpec(spec); + + /* Set output frequency */ + audio_param.param = AL_RATE; + audio_param.value.i = spec->freq; + if( alSetParams(AL_DEFAULT_OUTPUT, &audio_param, 1) < 0 ) { + SDL_SetError("alSetParams failed"); + return(-1); + } + + /* Open the audio port with the requested frequency */ + audio_port = NULL; + audio_config = alNewConfig(); + if ( audio_config && + (alSetSampFmt(audio_config, AL_SAMPFMT_TWOSCOMP) >= 0) && + (alSetWidth(audio_config, width) >= 0) && + (alSetQueueSize(audio_config, spec->samples*2) >= 0) && + (alSetChannels(audio_config, spec->channels) >= 0) ) { + audio_port = ALopenport("SDL audio", "w", audio_config); + } + alFreeConfig(audio_config); + if( audio_port == NULL ) { + SDL_SetError("Unable to open audio port"); + return(-1); + } + + /* Allocate mixing buffer */ + mixbuf = (Uint8 *)SDL_AllocAudioMem(spec->size); + if ( mixbuf == NULL ) { + SDL_OutOfMemory(); + return(-1); + } + memset(mixbuf, spec->silence, spec->size); + + /* We're ready to rock and roll. :-) */ + return(0); +} diff -r 000000000000 -r 74212992fb08 src/audio/dmedia/SDL_irixaudio.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/dmedia/SDL_irixaudio.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,49 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +#ifndef _SDL_lowaudio_h +#define _SDL_lowaudio_h + +#include + +#include "SDL_sysaudio.h" + +/* Hidden "this" pointer for the audio functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData { + /* The handle for the audio device */ + ALport audio_port; + + Uint8 *mixbuf; /* The app mixing buffer */ +}; + +/* Old variable names */ +#define audio_port (this->hidden->audio_port) +#define mixbuf (this->hidden->mixbuf) + +#endif /* _SDL_lowaudio_h */ diff -r 000000000000 -r 74212992fb08 src/audio/dsp/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/dsp/.cvsignore Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,6 @@ +Makefile.in +Makefile +.libs +*.o +*.lo +*.la diff -r 000000000000 -r 74212992fb08 src/audio/dsp/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/dsp/Makefile.am Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,9 @@ + +## Makefile.am for SDL using the OSS /dev/dsp standard sound driver + +noinst_LTLIBRARIES = libaudio_dsp.la +libaudio_dsp_la_SOURCES = $(SRCS) + +# The SDL audio driver sources +SRCS = SDL_dspaudio.c \ + SDL_dspaudio.h diff -r 000000000000 -r 74212992fb08 src/audio/dsp/SDL_dspaudio.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/dsp/SDL_dspaudio.c Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,450 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Allow access to a raw mixing buffer */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef linux +#include +#endif +#ifdef __bsdi__ +#include +#endif +#ifdef __FreeBSD__ +#include +#endif +#ifdef __USLC__ +#include +#endif + +#include "SDL_audio.h" +#include "SDL_error.h" +#include "SDL_audiomem.h" +#include "SDL_audio_c.h" +#include "SDL_timer.h" +#include "SDL_audiodev_c.h" +#include "SDL_dspaudio.h" + +/* The tag name used by DSP audio */ +#define DSP_DRIVER_NAME "dsp" + +/* Open the audio device for playback, and don't block if busy */ +/*#define USE_BLOCKING_WRITES*/ +#ifdef USE_BLOCKING_WRITES +#define OPEN_FLAGS O_WRONLY +#else +#define OPEN_FLAGS (O_WRONLY|O_NONBLOCK) +#endif + +/* Audio driver functions */ +static int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void DSP_WaitAudio(_THIS); +static void DSP_PlayAudio(_THIS); +static Uint8 *DSP_GetAudioBuf(_THIS); +static void DSP_CloseAudio(_THIS); + +/* Audio driver bootstrap functions */ + +static int Audio_Available(void) +{ + int fd; + int available; + + available = 0; + fd = SDL_OpenAudioPath(NULL, 0, OPEN_FLAGS, 0); + if ( fd >= 0 ) { + available = 1; + close(fd); + } + return(available); +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + free(device->hidden); + free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + free(this); + } + return(0); + } + memset(this->hidden, 0, (sizeof *this->hidden)); + audio_fd = -1; + + /* Set the function pointers */ + this->OpenAudio = DSP_OpenAudio; + this->WaitAudio = DSP_WaitAudio; + this->PlayAudio = DSP_PlayAudio; + this->GetAudioBuf = DSP_GetAudioBuf; + this->CloseAudio = DSP_CloseAudio; + + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap DSP_bootstrap = { + DSP_DRIVER_NAME, "OSS /dev/dsp standard audio", + Audio_Available, Audio_CreateDevice +}; + +/* This function waits until it is possible to write a full sound buffer */ +static void DSP_WaitAudio(_THIS) +{ +#ifndef USE_BLOCKING_WRITES /* Not necessary because of blocking writes */ + fd_set fdset; + + /* Check to see if the thread-parent process is still alive */ + { static int cnt = 0; + /* Note that this only works with thread implementations + that use a different process id for each thread. + */ + if (parent && (((++cnt)%10) == 0)) { /* Check every 10 loops */ + if ( kill(parent, 0) < 0 ) { + this->enabled = 0; + } + } + } + + /* See if we need to use timed audio synchronization */ + if ( frame_ticks ) { + /* Use timer for general audio synchronization */ + Sint32 ticks; + + ticks = ((Sint32)(next_frame - SDL_GetTicks()))-FUDGE_TICKS; + if ( ticks > 0 ) { + SDL_Delay(ticks); + } + } else { + /* Use select() for audio synchronization */ + struct timeval timeout; + FD_ZERO(&fdset); + FD_SET(audio_fd, &fdset); + timeout.tv_sec = 10; + timeout.tv_usec = 0; +#ifdef DEBUG_AUDIO + fprintf(stderr, "Waiting for audio to get ready\n"); +#endif + if ( select(audio_fd+1, NULL, &fdset, NULL, &timeout) <= 0 ) { + const char *message = + "Audio timeout - buggy audio driver? (disabled)"; + /* In general we should never print to the screen, + but in this case we have no other way of letting + the user know what happened. + */ + fprintf(stderr, "SDL: %s\n", message); + this->enabled = 0; + /* Don't try to close - may hang */ + audio_fd = -1; +#ifdef DEBUG_AUDIO + fprintf(stderr, "Done disabling audio\n"); +#endif + } +#ifdef DEBUG_AUDIO + fprintf(stderr, "Ready!\n"); +#endif + } +#endif /* !USE_BLOCKING_WRITES */ +} + +static void DSP_PlayAudio(_THIS) +{ + int written; + + /* Write the audio data, checking for EAGAIN on broken audio drivers */ + do { + written = write(audio_fd, mixbuf, mixlen); + if ( (written < 0) && ((errno == 0) || (errno == EAGAIN)) ) { + SDL_Delay(1); /* Let a little CPU time go by */ + } + } while ( (written < 0) && + ((errno == 0) || (errno == EAGAIN) || (errno == EINTR)) ); + + /* If timer synchronization is enabled, set the next write frame */ + if ( frame_ticks ) { + next_frame += frame_ticks; + } + + /* If we couldn't write, assume fatal error for now */ + if ( written < 0 ) { + this->enabled = 0; + } +#ifdef DEBUG_AUDIO + fprintf(stderr, "Wrote %d bytes of audio data\n", written); +#endif +} + +static Uint8 *DSP_GetAudioBuf(_THIS) +{ + return(mixbuf); +} + +static void DSP_CloseAudio(_THIS) +{ + if ( mixbuf != NULL ) { + SDL_FreeAudioMem(mixbuf); + mixbuf = NULL; + } + if ( audio_fd >= 0 ) { + close(audio_fd); + audio_fd = -1; + } +} + +static int DSP_ReopenAudio(_THIS, const char *audiodev, int format, + SDL_AudioSpec *spec) +{ + int frag_spec; + int value; + + /* Close and then reopen the audio device */ + close(audio_fd); + audio_fd = open(audiodev, O_WRONLY, 0); + if ( audio_fd < 0 ) { + SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno)); + return(-1); + } + + /* Calculate the final parameters for this audio specification */ + SDL_CalculateAudioSpec(spec); + + /* Determine the power of two of the fragment size */ + for ( frag_spec = 0; (0x01<size; ++frag_spec ); + if ( (0x01<size ) { + SDL_SetError("Fragment size must be a power of two"); + return(-1); + } + frag_spec |= 0x00020000; /* two fragments, for low latency */ + + /* Set the audio buffering parameters */ +#ifdef DEBUG_AUDIO + fprintf(stderr, "Requesting %d fragments of size %d\n", + (frag_spec >> 16), 1<<(frag_spec&0xFFFF)); +#endif + if ( ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag_spec) < 0 ) { + fprintf(stderr, "Warning: Couldn't set audio fragment size\n"); + } +#ifdef DEBUG_AUDIO + { audio_buf_info info; + ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info); + fprintf(stderr, "fragments = %d\n", info.fragments); + fprintf(stderr, "fragstotal = %d\n", info.fragstotal); + fprintf(stderr, "fragsize = %d\n", info.fragsize); + fprintf(stderr, "bytes = %d\n", info.bytes); + } +#endif + + /* Set the audio format */ + value = format; + if ( (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) || + (value != format) ) { + SDL_SetError("Couldn't set audio format"); + return(-1); + } + + /* Set the number of channels of output */ + value = spec->channels; +#ifdef SNDCTL_DSP_CHANNELS + if ( ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &value) < 0 ) { +#endif + value = (spec->channels > 1); + ioctl(audio_fd, SNDCTL_DSP_STEREO, &value); + value = (value ? 2 : 1); +#ifdef SNDCTL_DSP_CHANNELS + } +#endif + if ( value != spec->channels ) { + SDL_SetError("Couldn't set audio channels"); + return(-1); + } + + /* Set the DSP frequency */ + value = spec->freq; + if ( ioctl(audio_fd, SOUND_PCM_WRITE_RATE, &value) < 0 ) { + SDL_SetError("Couldn't set audio frequency"); + return(-1); + } + spec->freq = value; + + /* We successfully re-opened the audio */ + return(0); +} + +static int DSP_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + char audiodev[1024]; + int format; + int value; + Uint16 test_format; + + /* Reset the timer synchronization flag */ + frame_ticks = 0.0; + + /* Open the audio device */ + audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0); + if ( audio_fd < 0 ) { + SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno)); + return(-1); + } + mixbuf = NULL; + + /* Get a list of supported hardware formats */ + if ( ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0 ) { + SDL_SetError("Couldn't get audio format list"); + return(-1); + } + + /* Try for a closest match on audio format */ + format = 0; + for ( test_format = SDL_FirstAudioFormat(spec->format); + ! format && test_format; ) { +#ifdef DEBUG_AUDIO + fprintf(stderr, "Trying format 0x%4.4x\n", test_format); +#endif + switch ( test_format ) { + case AUDIO_U8: + if ( value & AFMT_U8 ) { + format = AFMT_U8; + } + break; + case AUDIO_S8: + if ( value & AFMT_S8 ) { + format = AFMT_S8; + } + break; + case AUDIO_S16LSB: + if ( value & AFMT_S16_LE ) { + format = AFMT_S16_LE; + } + break; + case AUDIO_S16MSB: + if ( value & AFMT_S16_BE ) { + format = AFMT_S16_BE; + } + break; + case AUDIO_U16LSB: + if ( value & AFMT_U16_LE ) { + format = AFMT_U16_LE; + } + break; + case AUDIO_U16MSB: + if ( value & AFMT_U16_BE ) { + format = AFMT_U16_BE; + } + break; + default: + break; + } + if ( ! format ) { + test_format = SDL_NextAudioFormat(); + } + } + if ( format == 0 ) { + SDL_SetError("Couldn't find any hardware audio formats"); + return(-1); + } + spec->format = test_format; + + /* Set the audio format */ + value = format; + if ( (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) || + (value != format) ) { + SDL_SetError("Couldn't set audio format"); + return(-1); + } + + /* Set the number of channels of output */ + value = spec->channels; +#ifdef SNDCTL_DSP_CHANNELS + if ( ioctl(audio_fd, SNDCTL_DSP_CHANNELS, &value) < 0 ) { +#endif + value = (spec->channels > 1); + ioctl(audio_fd, SNDCTL_DSP_STEREO, &value); + value = (value ? 2 : 1); +#ifdef SNDCTL_DSP_CHANNELS + } +#endif + spec->channels = value; + + /* Because some drivers don't allow setting the buffer size + after setting the format, we must re-open the audio device + once we know what format and channels are supported + */ + if ( DSP_ReopenAudio(this, audiodev, format, spec) < 0 ) { + /* Error is set by DSP_ReopenAudio() */ + return(-1); + } + + /* Allocate mixing buffer */ + mixlen = spec->size; + mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen); + if ( mixbuf == NULL ) { + return(-1); + } + memset(mixbuf, spec->silence, spec->size); + +#ifndef USE_BLOCKING_WRITES + /* Check to see if we need to use select() workaround */ + { char *workaround; + workaround = getenv("SDL_DSP_NOSELECT"); + if ( workaround ) { + frame_ticks = (float)(spec->samples*1000)/spec->freq; + next_frame = SDL_GetTicks()+frame_ticks; + } + } +#endif /* !USE_BLOCKING_WRITES */ + + /* Get the parent process id (we're the parent of the audio thread) */ + parent = getpid(); + + /* We're ready to rock and roll. :-) */ + return(0); +} diff -r 000000000000 -r 74212992fb08 src/audio/dsp/SDL_dspaudio.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/dsp/SDL_dspaudio.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,61 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +#ifndef _SDL_dspaudio_h +#define _SDL_dspaudio_h + +#include "SDL_sysaudio.h" + +/* Hidden "this" pointer for the video functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData { + /* The file descriptor for the audio device */ + int audio_fd; + + /* The parent process id, to detect when application quits */ + pid_t parent; + + /* Raw mixing buffer */ + Uint8 *mixbuf; + int mixlen; + + /* Support for audio timing using a timer, in addition to select() */ + float frame_ticks; + float next_frame; +}; +#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ + +/* Old variable names */ +#define audio_fd (this->hidden->audio_fd) +#define parent (this->hidden->parent) +#define mixbuf (this->hidden->mixbuf) +#define mixlen (this->hidden->mixlen) +#define frame_ticks (this->hidden->frame_ticks) +#define next_frame (this->hidden->next_frame) + +#endif /* _SDL_dspaudio_h */ diff -r 000000000000 -r 74212992fb08 src/audio/esd/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/esd/.cvsignore Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,6 @@ +Makefile.in +Makefile +.libs +*.o +*.lo +*.la diff -r 000000000000 -r 74212992fb08 src/audio/esd/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/esd/Makefile.am Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,9 @@ + +## Makefile.am for SDL using the Enlightened Sound Daemon sound driver + +noinst_LTLIBRARIES = libaudio_esd.la +libaudio_esd_la_SOURCES = $(SRCS) + +# The SDL audio driver sources +SRCS = SDL_esdaudio.c \ + SDL_esdaudio.h diff -r 000000000000 -r 74212992fb08 src/audio/esd/SDL_esdaudio.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/esd/SDL_esdaudio.c Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,260 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Allow access to an ESD network stream mixing buffer */ + +#ifdef ESD_SUPPORT + +#include +#include +#include +#include +#include +#include + +#include + +#include "SDL_audio.h" +#include "SDL_error.h" +#include "SDL_audiomem.h" +#include "SDL_audio_c.h" +#include "SDL_timer.h" +#include "SDL_audiodev_c.h" +#include "SDL_esdaudio.h" + +/* The tag name used by ESD audio */ +#define ESD_DRIVER_NAME "esd" + +/* Audio driver functions */ +static int ESD_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void ESD_WaitAudio(_THIS); +static void ESD_PlayAudio(_THIS); +static Uint8 *ESD_GetAudioBuf(_THIS); +static void ESD_CloseAudio(_THIS); + +/* Audio driver bootstrap functions */ + +static int Audio_Available(void) +{ + int connection; + int available; + + available = 0; + connection = esd_open_sound(NULL); + if ( connection >= 0 ) { + available = 1; + esd_close(connection); + } + return(available); +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + free(device->hidden); + free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + free(this); + } + return(0); + } + memset(this->hidden, 0, (sizeof *this->hidden)); + audio_fd = -1; + + /* Set the function pointers */ + this->OpenAudio = ESD_OpenAudio; + this->WaitAudio = ESD_WaitAudio; + this->PlayAudio = ESD_PlayAudio; + this->GetAudioBuf = ESD_GetAudioBuf; + this->CloseAudio = ESD_CloseAudio; + + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap ESD_bootstrap = { + ESD_DRIVER_NAME, "Enlightened Sound Daemon", + Audio_Available, Audio_CreateDevice +}; + +/* This function waits until it is possible to write a full sound buffer */ +static void ESD_WaitAudio(_THIS) +{ + Sint32 ticks; + + /* Check to see if the thread-parent process is still alive */ + { static int cnt = 0; + /* Note that this only works with thread implementations + that use a different process id for each thread. + */ + if (parent && (((++cnt)%10) == 0)) { /* Check every 10 loops */ + if ( kill(parent, 0) < 0 ) { + this->enabled = 0; + } + } + } + + /* Use timer for general audio synchronization */ + ticks = ((Sint32)(next_frame - SDL_GetTicks()))-FUDGE_TICKS; + if ( ticks > 0 ) { + SDL_Delay(ticks); + } +} + +static void ESD_PlayAudio(_THIS) +{ + int written; + + /* Write the audio data, checking for EAGAIN on broken audio drivers */ + do { + written = write(audio_fd, mixbuf, mixlen); + if ( (written < 0) && ((errno == 0) || (errno == EAGAIN)) ) { + SDL_Delay(1); /* Let a little CPU time go by */ + } + } while ( (written < 0) && + ((errno == 0) || (errno == EAGAIN) || (errno == EINTR)) ); + + /* Set the next write frame */ + next_frame += frame_ticks; + + /* If we couldn't write, assume fatal error for now */ + if ( written < 0 ) { + this->enabled = 0; + } +} + +static Uint8 *ESD_GetAudioBuf(_THIS) +{ + return(mixbuf); +} + +static void ESD_CloseAudio(_THIS) +{ + if ( mixbuf != NULL ) { + SDL_FreeAudioMem(mixbuf); + mixbuf = NULL; + } + if ( audio_fd >= 0 ) { + close(audio_fd); + audio_fd = -1; + } +} + +/* Try to get the name of the program */ +static char *get_progname(void) +{ + char *progname = NULL; +#ifdef linux + FILE *fp; + static char temp[BUFSIZ]; + + sprintf(temp, "/proc/%d/cmdline", getpid()); + fp = fopen(temp, "r"); + if ( fp != NULL ) { + if ( fgets(temp, sizeof(temp)-1, fp) ) { + progname = strrchr(temp, '/'); + if ( progname == NULL ) { + progname = temp; + } else { + progname = progname+1; + } + } + fclose(fp); + } +#endif + return(progname); +} + +static int ESD_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + esd_format_t format; + + /* Convert audio spec to the ESD audio format */ + format = (ESD_STREAM | ESD_PLAY); + switch ( spec->format & 0xFF ) { + case 8: + format |= ESD_BITS8; + break; + case 16: + format |= ESD_BITS16; + break; + default: + SDL_SetError("Unsupported ESD audio format"); + return(-1); + } + if ( spec->channels == 1 ) { + format |= ESD_MONO; + } else { + format |= ESD_STEREO; + } +#if 0 + spec->samples = ESD_BUF_SIZE; /* Darn, no way to change this yet */ +#endif + + /* Open a connection to the ESD audio server */ + audio_fd = esd_play_stream(format, spec->freq, NULL, get_progname()); + if ( audio_fd < 0 ) { + SDL_SetError("Couldn't open ESD connection"); + return(-1); + } + + /* Calculate the final parameters for this audio specification */ + SDL_CalculateAudioSpec(spec); + frame_ticks = (float)(spec->samples*1000)/spec->freq; + next_frame = SDL_GetTicks()+frame_ticks; + + /* Allocate mixing buffer */ + mixlen = spec->size; + mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen); + if ( mixbuf == NULL ) { + return(-1); + } + memset(mixbuf, spec->silence, spec->size); + + /* Get the parent process id (we're the parent of the audio thread) */ + parent = getpid(); + + /* We're ready to rock and roll. :-) */ + return(0); +} + +#endif /* ESD_SUPPORT */ diff -r 000000000000 -r 74212992fb08 src/audio/esd/SDL_esdaudio.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/esd/SDL_esdaudio.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,61 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +#ifndef _SDL_esdaudio_h +#define _SDL_esdaudio_h + +#include "SDL_sysaudio.h" + +/* Hidden "this" pointer for the video functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData { + /* The file descriptor for the audio device */ + int audio_fd; + + /* The parent process id, to detect when application quits */ + pid_t parent; + + /* Raw mixing buffer */ + Uint8 *mixbuf; + int mixlen; + + /* Support for audio timing using a timer */ + float frame_ticks; + float next_frame; +}; +#define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ + +/* Old variable names */ +#define audio_fd (this->hidden->audio_fd) +#define parent (this->hidden->parent) +#define mixbuf (this->hidden->mixbuf) +#define mixlen (this->hidden->mixlen) +#define frame_ticks (this->hidden->frame_ticks) +#define next_frame (this->hidden->next_frame) + +#endif /* _SDL_esdaudio_h */ diff -r 000000000000 -r 74212992fb08 src/audio/macrom/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/macrom/.cvsignore Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,6 @@ +Makefile.in +Makefile +.libs +*.o +*.lo +*.la diff -r 000000000000 -r 74212992fb08 src/audio/macrom/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/macrom/Makefile.am Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,9 @@ + +## Makefile.am for SDL using the MacOS SoundManager audio driver + +noinst_LTLIBRARIES = libaudio_macrom.la +libaudio_macrom_la_SOURCES = $(SRCS) + +# The SDL audio driver sources +SRCS = SDL_romaudio.c \ + SDL_romaudio.h diff -r 000000000000 -r 74212992fb08 src/audio/macrom/SDL_romaudio.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/macrom/SDL_romaudio.c Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,439 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +#if TARGET_API_MAC_CARBON +# include +#else +# include /* SoundManager interface */ +# include +#endif + +#include +#include + +#include "SDL_endian.h" +#include "SDL_audio.h" +#include "SDL_audio_c.h" +#include "SDL_audiomem.h" +#include "SDL_sysaudio.h" +#include "SDL_romaudio.h" + +/* Audio driver functions */ + +static void Mac_CloseAudio(_THIS); +static int Mac_OpenAudio(_THIS, SDL_AudioSpec *spec); + +/* Audio driver bootstrap functions */ + + +static int Audio_Available(void) +{ + return(1); +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + free(device->hidden); + free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + free(this); + } + return(0); + } + memset(this->hidden, 0, (sizeof *this->hidden)); + + /* Set the function pointers */ + this->OpenAudio = Mac_OpenAudio; + this->CloseAudio = Mac_CloseAudio; + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap SNDMGR_bootstrap = { + "sndmgr", "MacOS SoundManager 3.0", + Audio_Available, Audio_CreateDevice +}; + +#if TARGET_API_MAC_CARBON + +static UInt8 *buffer[2]; +static volatile UInt32 running = 0; +static CmpSoundHeader header; + +static void callBackProc (SndChannel *chan, SndCommand *cmd_passed ) { + + UInt32 fill_me, play_me; + SndCommand cmd; + SDL_AudioDevice *audio = (SDL_AudioDevice *)chan->userInfo; + + fill_me = cmd_passed->param2; /* buffer that has just finished playing, +so fill it */ + play_me = ! fill_me; /* filled buffer to play _now_ */ + + if ( ! audio->enabled ) { + return; + } + + header.samplePtr = (Ptr)buffer[play_me]; + + cmd.cmd = bufferCmd; + cmd.param1 = 0; + cmd.param2 = (long)&header; + + SndDoCommand (chan, &cmd, 0); + + memset (buffer[fill_me], 0, audio->spec.size); + + if ( ! audio->paused ) { + if ( audio->convert.needed ) { + audio->spec.callback(audio->spec.userdata, + (Uint8 *)audio->convert.buf,audio->convert.len); + SDL_ConvertAudio(&audio->convert); +#if 0 + if ( audio->convert.len_cvt != audio->spec.size ) { + /* Uh oh... probably crashes here; */ + } +#endif + memcpy(buffer[fill_me], audio->convert.buf, + audio->convert.len_cvt); + } else { + audio->spec.callback(audio->spec.userdata, + (Uint8 *)buffer[fill_me], audio->spec.size); + } + } + + if ( running ) { + + cmd.cmd = callBackCmd; + cmd.param1 = 0; + cmd.param2 = play_me; + + SndDoCommand (chan, &cmd, 0); + } +} + +static int Mac_OpenAudio(_THIS, SDL_AudioSpec *spec) { + + SndCallBackUPP callback; + int sample_bits; + int i; + long initOptions; + + /* Very few conversions are required, but... */ + switch (spec->format) { + case AUDIO_S8: + spec->format = AUDIO_U8; + break; + case AUDIO_U16LSB: + spec->format = AUDIO_S16LSB; + break; + case AUDIO_U16MSB: + spec->format = AUDIO_S16MSB; + break; + } + SDL_CalculateAudioSpec(spec); + + /* initialize bufferCmd header */ + memset (&header, 0, sizeof(header)); + callback = NewSndCallBackUPP (callBackProc); + sample_bits = spec->size / spec->samples / spec->channels * 8; + +#ifdef DEBUG_AUDIO + fprintf(stderr, + "Audio format 0x%x, channels = %d, sample_bits = %d, frequency = %d\n", + spec->format, spec->channels, sample_bits, spec->freq); +#endif /* DEBUG_AUDIO */ + + header.numChannels = spec->channels; + header.sampleSize = sample_bits; + header.sampleRate = spec->freq << 16; + header.numFrames = spec->samples; + header.encode = cmpSH; + + /* Note that we install the 16bitLittleEndian Converter if needed. */ + if ( spec->format == 0x8010 ) { + header.compressionID = fixedCompression; + header.format = k16BitLittleEndianFormat; + } + + /* allocate 2 buffers */ + for (i=0; i<2; i++) { + buffer[i] = (UInt8*)malloc (sizeof(UInt8) * spec->size); + if (buffer[i] == NULL) { + SDL_OutOfMemory(); + return (-1); + } + memset (buffer[i], 0, spec->size); + } + + /* Create the sound manager channel */ + channel = (SndChannelPtr)malloc(sizeof(*channel)); + if ( channel == NULL ) { + SDL_OutOfMemory(); + return(-1); + } + if ( spec->channels >= 2 ) { + initOptions = initStereo; + } else { + initOptions = initMono; + } + channel->userInfo = (long)this; + channel->qLength = 128; + if ( SndNewChannel(&channel, sampledSynth, initOptions, callback) != +noErr ) { + SDL_SetError("Unable to create audio channel"); + free(channel); + channel = NULL; + return(-1); + } + + /* start playback */ + { + SndCommand cmd; + cmd.cmd = callBackCmd; + cmd.param2 = 0; + running = 1; + SndDoCommand (channel, &cmd, 0); + } + + return 1; +} + +static void Mac_CloseAudio(_THIS) { + + int i; + + running = 0; + + if (channel) { + SndDisposeChannel (channel, true); + channel = NULL; + } + + for ( i=0; i<2; ++i ) { + if ( buffer[i] ) { + free(buffer[i]); + buffer[i] = NULL; + } + } +} + +#else /* !TARGET_API_MAC_CARBON */ + +/* This function is called by Sound Manager when it has exhausted one of + the buffers, so we'll zero it to silence and fill it with audio if + we're not paused. +*/ +static pascal +void sndDoubleBackProc (SndChannelPtr chan, SndDoubleBufferPtr newbuf) +{ + SDL_AudioDevice *audio = (SDL_AudioDevice *)newbuf->dbUserInfo[0]; + + /* If audio is quitting, don't do anything */ + if ( ! audio->enabled ) { + return; + } + memset (newbuf->dbSoundData, 0, audio->spec.size); + newbuf->dbNumFrames = audio->spec.samples; + if ( ! audio->paused ) { + if ( audio->convert.needed ) { + audio->spec.callback(audio->spec.userdata, + (Uint8 *)audio->convert.buf,audio->convert.len); + SDL_ConvertAudio(&audio->convert); +#if 0 + if ( audio->convert.len_cvt != audio->spec.size ) { + /* Uh oh... probably crashes here */; + } +#endif + memcpy(newbuf->dbSoundData, audio->convert.buf, + audio->convert.len_cvt); + } else { + audio->spec.callback(audio->spec.userdata, + (Uint8 *)newbuf->dbSoundData, audio->spec.size); + } + } + newbuf->dbFlags |= dbBufferReady; +} + +static int DoubleBufferAudio_Available(void) +{ + int available; + NumVersion sndversion; + long response; + + available = 0; + sndversion = SndSoundManagerVersion(); + if ( sndversion.majorRev >= 3 ) { + if ( Gestalt(gestaltSoundAttr, &response) == noErr ) { + if ( (response & (1 << gestaltSndPlayDoubleBuffer)) ) { + available = 1; + } + } + } else { + if ( Gestalt(gestaltSoundAttr, &response) == noErr ) { + if ( (response & (1 << gestaltHasASC)) ) { + available = 1; + } + } + } + return(available); +} + +static void Mac_CloseAudio(_THIS) +{ + int i; + + if ( channel != NULL ) { +#if 0 + SCStatus status; + + /* Wait for audio to complete */ + do { + SndChannelStatus(channel, sizeof(status), &status); + } while ( status.scChannelBusy ); +#endif + /* Clean up the audio channel */ + SndDisposeChannel(channel, true); + channel = NULL; + } + for ( i=0; i<2; ++i ) { + if ( audio_buf[i] ) { + free(audio_buf[i]); + audio_buf[i] = NULL; + } + } +} + +static int Mac_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + SndDoubleBufferHeader2 audio_dbh; + int i; + long initOptions; + int sample_bits; + SndDoubleBackUPP doubleBackProc; + + /* Check to make sure double-buffered audio is available */ + if ( ! DoubleBufferAudio_Available() ) { + SDL_SetError("Sound manager doesn't support double-buffering"); + return(-1); + } + + /* Very few conversions are required, but... */ + switch (spec->format) { + case AUDIO_S8: + spec->format = AUDIO_U8; + break; + case AUDIO_U16LSB: + spec->format = AUDIO_S16LSB; + break; + case AUDIO_U16MSB: + spec->format = AUDIO_S16MSB; + break; + } + SDL_CalculateAudioSpec(spec); + + /* initialize the double-back header */ + memset(&audio_dbh, 0, sizeof(audio_dbh)); + doubleBackProc = NewSndDoubleBackProc (sndDoubleBackProc); + sample_bits = spec->size / spec->samples / spec->channels * 8; + + audio_dbh.dbhNumChannels = spec->channels; + audio_dbh.dbhSampleSize = sample_bits; + audio_dbh.dbhCompressionID = 0; + audio_dbh.dbhPacketSize = 0; + audio_dbh.dbhSampleRate = spec->freq << 16; + audio_dbh.dbhDoubleBack = doubleBackProc; + audio_dbh.dbhFormat = 0; + + /* Note that we install the 16bitLittleEndian Converter if needed. */ + if ( spec->format == 0x8010 ) { + audio_dbh.dbhCompressionID = fixedCompression; + audio_dbh.dbhFormat = k16BitLittleEndianFormat; + } + + /* allocate the 2 double-back buffers */ + for ( i=0; i<2; ++i ) { + audio_buf[i] = calloc(1, sizeof(SndDoubleBuffer)+spec->size); + if ( audio_buf[i] == NULL ) { + SDL_OutOfMemory(); + return(-1); + } + audio_buf[i]->dbNumFrames = spec->samples; + audio_buf[i]->dbFlags = dbBufferReady; + audio_buf[i]->dbUserInfo[0] = (long)this; + audio_dbh.dbhBufferPtr[i] = audio_buf[i]; + } + + /* Create the sound manager channel */ + channel = (SndChannelPtr)malloc(sizeof(*channel)); + if ( channel == NULL ) { + SDL_OutOfMemory(); + return(-1); + } + if ( spec->channels >= 2 ) { + initOptions = initStereo; + } else { + initOptions = initMono; + } + channel->userInfo = 0; + channel->qLength = 128; + if ( SndNewChannel(&channel, sampledSynth, initOptions, 0L) != noErr ) { + SDL_SetError("Unable to create audio channel"); + free(channel); + channel = NULL; + return(-1); + } + + /* Start playback */ + if ( SndPlayDoubleBuffer(channel, (SndDoubleBufferHeaderPtr)&audio_dbh) + != noErr ) { + SDL_SetError("Unable to play double buffered audio"); + return(-1); + } + + return 1; +} + +#endif /* TARGET_API_MAC_CARBON */ + + diff -r 000000000000 -r 74212992fb08 src/audio/macrom/SDL_romaudio.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/macrom/SDL_romaudio.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,49 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +#ifndef _SDL_romaudio_h +#define _SDL_romaudio_h + +#include "SDL_sysaudio.h" + +/* Hidden "this" pointer for the video functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData { + /* Sound manager audio channel */ + SndChannelPtr channel; + #if ! TARGET_API_MAC_CARBON + /* Double buffering variables */ + SndDoubleBufferPtr audio_buf[2]; + #endif +}; + +/* Old variable names */ +#define channel (this->hidden->channel) +#define audio_buf (this->hidden->audio_buf) + +#endif /* _SDL_romaudio_h */ diff -r 000000000000 -r 74212992fb08 src/audio/nas/.cvsignore --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/nas/.cvsignore Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,6 @@ +Makefile.in +Makefile +.libs +*.o +*.lo +*.la diff -r 000000000000 -r 74212992fb08 src/audio/nas/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/nas/Makefile.am Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,9 @@ + +## Makefile.am for SDL using the Network Audio System sound driver + +noinst_LTLIBRARIES = libaudio_nas.la +libaudio_nas_la_SOURCES = $(SRCS) + +# The SDL audio driver sources +SRCS = SDL_nasaudio.c \ + SDL_nasaudio.h diff -r 000000000000 -r 74212992fb08 src/audio/nas/SDL_nasaudio.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/nas/SDL_nasaudio.c Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,308 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com + + This driver was written by: + Erik Inge Bolsø + knan@mo.himolde.no +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +/* Allow access to a raw mixing buffer */ + +#include +#include +#include +#include +#include +#include + +#include "SDL_audio.h" +#include "SDL_error.h" +#include "SDL_audiomem.h" +#include "SDL_audio_c.h" +#include "SDL_timer.h" +#include "SDL_audiodev_c.h" +#include "SDL_nasaudio.h" + +/* The tag name used by artsc audio */ +#define NAS_DRIVER_NAME "nas" + +static struct SDL_PrivateAudioData *this2 = NULL; + +/* Audio driver functions */ +static int NAS_OpenAudio(_THIS, SDL_AudioSpec *spec); +static void NAS_WaitAudio(_THIS); +static void NAS_PlayAudio(_THIS); +static Uint8 *NAS_GetAudioBuf(_THIS); +static void NAS_CloseAudio(_THIS); + +/* Audio driver bootstrap functions */ + +static int Audio_Available(void) +{ + AuServer *aud = AuOpenServer("", 0, NULL, 0, NULL, NULL); + if (!aud) return 0; + + AuCloseServer(aud); + return 1; +} + +static void Audio_DeleteDevice(SDL_AudioDevice *device) +{ + free(device->hidden); + free(device); +} + +static SDL_AudioDevice *Audio_CreateDevice(int devindex) +{ + SDL_AudioDevice *this; + + /* Initialize all variables that we clean on shutdown */ + this = (SDL_AudioDevice *)malloc(sizeof(SDL_AudioDevice)); + if ( this ) { + memset(this, 0, (sizeof *this)); + this->hidden = (struct SDL_PrivateAudioData *) + malloc((sizeof *this->hidden)); + } + if ( (this == NULL) || (this->hidden == NULL) ) { + SDL_OutOfMemory(); + if ( this ) { + free(this); + } + return(0); + } + memset(this->hidden, 0, (sizeof *this->hidden)); + + /* Set the function pointers */ + this->OpenAudio = NAS_OpenAudio; + this->WaitAudio = NAS_WaitAudio; + this->PlayAudio = NAS_PlayAudio; + this->GetAudioBuf = NAS_GetAudioBuf; + this->CloseAudio = NAS_CloseAudio; + + this->free = Audio_DeleteDevice; + + return this; +} + +AudioBootStrap NAS_bootstrap = { + NAS_DRIVER_NAME, "Network Audio System", + Audio_Available, Audio_CreateDevice +}; + +/* This function waits until it is possible to write a full sound buffer */ +static void NAS_WaitAudio(_THIS) +{ + while ( this->hidden->buf_free < this->hidden->mixlen ) { + AuEvent ev; + AuNextEvent(this->hidden->aud, AuTrue, &ev); + AuDispatchEvent(this->hidden->aud, &ev); + } +} + +static void NAS_PlayAudio(_THIS) +{ + while (this->hidden->mixlen > this->hidden->buf_free) { /* We think the buffer is full? Yikes! Ask the server for events, + in the hope that some of them is LowWater events telling us more + of the buffer is free now than what we think. */ + AuEvent ev; + AuNextEvent(this->hidden->aud, AuTrue, &ev); + AuDispatchEvent(this->hidden->aud, &ev); + } + this->hidden->buf_free -= this->hidden->mixlen; + + /* Write the audio data */ + AuWriteElement(this->hidden->aud, this->hidden->flow, 0, this->hidden->mixlen, this->hidden->mixbuf, AuFalse, NULL); + + this->hidden->written += this->hidden->mixlen; + +#ifdef DEBUG_AUDIO + fprintf(stderr, "Wrote %d bytes of audio data\n", this->hidden->mixlen); +#endif +} + +static Uint8 *NAS_GetAudioBuf(_THIS) +{ + return(this->hidden->mixbuf); +} + +static void NAS_CloseAudio(_THIS) +{ + if ( this->hidden->mixbuf != NULL ) { + SDL_FreeAudioMem(this->hidden->mixbuf); + this->hidden->mixbuf = NULL; + } + if ( this->hidden->aud ) { + AuCloseServer(this->hidden->aud); + this->hidden->aud = 0; + } +} + +static unsigned char sdlformat_to_auformat(unsigned int fmt) +{ + switch (fmt) + { + case AUDIO_U8: + return AuFormatLinearUnsigned8; + case AUDIO_S8: + return AuFormatLinearSigned8; + case AUDIO_U16LSB: + return AuFormatLinearUnsigned16LSB; + case AUDIO_U16MSB: + return AuFormatLinearUnsigned16MSB; + case AUDIO_S16LSB: + return AuFormatLinearSigned16LSB; + case AUDIO_S16MSB: + return AuFormatLinearSigned16MSB; + } + return AuNone; +} + +static AuBool +event_handler(AuServer* aud, AuEvent* ev, AuEventHandlerRec* hnd) +{ + switch (ev->type) { + case AuEventTypeElementNotify: { + AuElementNotifyEvent* event = (AuElementNotifyEvent *)ev; + + switch (event->kind) { + case AuElementNotifyKindLowWater: + if (this2->buf_free >= 0) { + this2->really += event->num_bytes; + gettimeofday(&this2->last_tv, 0); + this2->buf_free += event->num_bytes; + } else { + this2->buf_free = event->num_bytes; + } + break; + case AuElementNotifyKindState: + switch (event->cur_state) { + case AuStatePause: + if (event->reason != AuReasonUser) { + if (this2->buf_free >= 0) { + this2->really += event->num_bytes; + gettimeofday(&this2->last_tv, 0); + this2->buf_free += event->num_bytes; + } else { + this2->buf_free = event->num_bytes; + } + } + break; + } + } + } + } + return AuTrue; +} + +static AuDeviceID +find_device(_THIS, int nch) +{ + int i; + for (i = 0; i < AuServerNumDevices(this->hidden->aud); i++) { + if ((AuDeviceKind(AuServerDevice(this->hidden->aud, i)) == + AuComponentKindPhysicalOutput) && + AuDeviceNumTracks(AuServerDevice(this->hidden->aud, i)) == nch) { + return AuDeviceIdentifier(AuServerDevice(this->hidden->aud, i)); + } + } + return AuNone; +} + +static int NAS_OpenAudio(_THIS, SDL_AudioSpec *spec) +{ + AuElement elms[3]; + int buffer_size; + Uint16 test_format, format; + + this->hidden->mixbuf = NULL; + + /* Try for a closest match on audio format */ + format = 0; + for ( test_format = SDL_FirstAudioFormat(spec->format); + ! format && test_format; ) { + format = sdlformat_to_auformat(test_format); + + if (format == AuNone) { + test_format = SDL_NextAudioFormat(); + } + } + if ( format == 0 ) { + SDL_SetError("Couldn't find any hardware audio formats"); + return(-1); + } + spec->format = test_format; + + this->hidden->aud = AuOpenServer("", 0, NULL, 0, NULL, NULL); + if (this->hidden->aud == 0) + { + SDL_SetError("Couldn't open connection to NAS server"); + return (-1); + } + + this->hidden->dev = find_device(this, spec->channels); + if ((this->hidden->dev == AuNone) || (!(this->hidden->flow = AuCreateFlow(this->hidden->aud, NULL)))) { + AuCloseServer(this->hidden->aud); + this->hidden->aud = 0; + SDL_SetError("Couldn't find a fitting playback device on NAS server"); + return (-1); + } + + buffer_size = spec->freq; + if (buffer_size < 4096) + buffer_size = 4096; + + if (buffer_size > 32768) + buffer_size = 32768; /* So that the buffer won't get unmanageably big. */ + + /* Calculate the final parameters for this audio specification */ + SDL_CalculateAudioSpec(spec); + + this2 = this->hidden; + + AuMakeElementImportClient(elms, spec->freq, format, spec->channels, AuTrue, + buffer_size, buffer_size / 4, 0, NULL); + AuMakeElementExportDevice(elms+1, 0, this->hidden->dev, spec->freq, + AuUnlimitedSamples, 0, NULL); + AuSetElements(this->hidden->aud, this->hidden->flow, AuTrue, 2, elms, NULL); + AuRegisterEventHandler(this->hidden->aud, AuEventHandlerIDMask, 0, this->hidden->flow, + event_handler, (AuPointer) NULL); + + AuStartFlow(this->hidden->aud, this->hidden->flow, NULL); + + /* Allocate mixing buffer */ + this->hidden->mixlen = spec->size; + this->hidden->mixbuf = (Uint8 *)SDL_AllocAudioMem(this->hidden->mixlen); + if ( this->hidden->mixbuf == NULL ) { + return(-1); + } + memset(this->hidden->mixbuf, spec->silence, spec->size); + + /* Get the parent process id (we're the parent of the audio thread) */ + this->hidden->parent = getpid(); + + /* We're ready to rock and roll. :-) */ + return(0); +} diff -r 000000000000 -r 74212992fb08 src/audio/nas/SDL_nasaudio.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/audio/nas/SDL_nasaudio.h Thu Apr 26 16:45:43 2001 +0000 @@ -0,0 +1,61 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997, 1998, 1999, 2000, 2001 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that 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 Library General Public + License along with this library; if not, write to the Free + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + Sam Lantinga + slouken@devolution.com + + This driver was written by: + Erik Inge Bolsø + knan@mo.himolde.no +*/ + +#ifdef SAVE_RCSID +static char rcsid = + "@(#) $Id$"; +#endif + +#ifndef _SDL_nasaudio_h +#define _SDL_nasaudio_h + +#include